Skip to content

Commit 8bf08b0

Browse files
hoshinolinamarcan
authored andcommitted
linux.py: Implement TSO
Signed-off-by: Asahi Lina <[email protected]>
1 parent fa3dcd3 commit 8bf08b0

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

proxyclient/tools/linux.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
parser.add_argument('-b', '--bootargs', type=str, metavar='"boot arguments"')
1515
parser.add_argument('-t', '--tty', type=str)
1616
parser.add_argument('-u', '--u-boot', type=pathlib.Path, help="load u-boot before linux")
17+
parser.add_argument('-T', '--tso', action="store_true", help="enable TSO")
1718
args = parser.parse_args()
1819

1920
from m1n1.setup import *
@@ -112,6 +113,18 @@
112113

113114
p.smp_start_secondaries()
114115

116+
if args.tso:
117+
print("Enabling TSO:")
118+
actlr = u.mrs("ACTLR_EL1")
119+
actlr |= (1 << 1) # TSO
120+
print(" CPU #0")
121+
u.msr("ACTLR_EL1", actlr)
122+
for i in range(1, 64):
123+
if p.smp_is_alive(i):
124+
print(f" CPU #{i}")
125+
u.msr("ACTLR_EL1", actlr, call=lambda addr, *args: p.smp_call_sync(i, addr & ~REGION_RX_EL1, *args))
126+
p.kboot_set_chosen("apple,tso", "")
127+
115128
if p.kboot_prepare_dt(dtb_addr):
116129
print("DT prepare failed")
117130
sys.exit(1)

0 commit comments

Comments
 (0)