diff --git a/proxyclient/m1n1/hv/__init__.py b/proxyclient/m1n1/hv/__init__.py index 37cbdb1e..35183f9b 100644 --- a/proxyclient/m1n1/hv/__init__.py +++ b/proxyclient/m1n1/hv/__init__.py @@ -1558,10 +1558,12 @@ class HV(Reloadable): chip_id = self.u.adt["/chosen"].chip_id if chip_id in (0x8103, 0x6000, 0x6001, 0x6002): cpu_start = 0x54000 + die * 0x20_0000_0000 - elif chip_id in (0x8112,): + elif chip_id in (0x8112, 0x8122): cpu_start = 0x34000 + die * 0x20_0000_0000 elif chip_id in (0x6020, 0x6021, 0x6022): cpu_start = 0x28000 + die * 0x20_0000_0000 + elif chip_id in (0x6031,): + cpu_start = 0x88000 + die * 0x20_0000_0000 else: self.log("CPUSTART unknown for this SoC!") break @@ -1628,8 +1630,9 @@ class HV(Reloadable): pass if not self.smp: + boot_cpu_name = "cpu" + str(self.p.get_boot_cpu_idx()) for cpu in list(self.adt["cpus"]): - if cpu.name != "cpu0": + if cpu.name != boot_cpu_name: print(f"Removing ADT node {cpu._path}") try: del self.adt["cpus"][cpu.name] @@ -1755,7 +1758,10 @@ class HV(Reloadable): print("Setting secondary CPU RVBARs...") rvbar = self.entry & ~0xfff - for cpu in self.adt["cpus"][1:]: + boot_cpu_name = "cpu" + str(self.p.get_boot_cpu_idx()) + for cpu in self.adt["cpus"]: + if cpu.name == boot_cpu_name: + continue addr, size = cpu.cpu_impl_reg print(f" {cpu.name}: [0x{addr:x}] = 0x{rvbar:x}") self.p.write64(addr, rvbar) @@ -1906,7 +1912,10 @@ class HV(Reloadable): # Does not return self.started = True - self.started_cpus[0] = (0, 0, 0) + boot_cpu_name = "cpu" + str(self.p.get_boot_cpu_idx()) + boot_cpu_adt = self.u.adt["/cpus/" + boot_cpu_name] + boot_cpu_mpidr = self.p.get_boot_cpu_mpidr() + self.started_cpus[0] = (boot_cpu_adt.die_id, boot_cpu_adt.cluster_id, boot_cpu_mpidr & 0xf) self.p.hv_start(self.entry, self.guest_base + self.bootargs_off) from .. import trace diff --git a/proxyclient/m1n1/proxy.py b/proxyclient/m1n1/proxy.py index 09ee6d7a..eca9dedd 100644 --- a/proxyclient/m1n1/proxy.py +++ b/proxyclient/m1n1/proxy.py @@ -494,6 +494,8 @@ class M1N1Proxy(Reloadable): P_PUT_SIMD_STATE = 0x00f P_REBOOT = 0x010 P_SLEEP = 0x011 + P_GET_BOOT_CPU_IDX = 0x012 + P_GET_BOOT_CPU_MPIDR = 0x013 P_WRITE64 = 0x100 P_WRITE32 = 0x101 @@ -718,6 +720,10 @@ class M1N1Proxy(Reloadable): self.request(self.P_CALL, addr, *args, reboot=True) def get_bootargs(self): return self.request(self.P_GET_BOOTARGS) + def get_boot_cpu_idx(self): + return self.request(self.P_GET_BOOT_CPU_IDX) + def get_boot_cpu_mpidr(self): + return self.request(self.P_GET_BOOT_CPU_MPIDR) def get_base(self): return self.request(self.P_GET_BASE) def set_baud(self, baudrate): diff --git a/src/proxy.c b/src/proxy.c index 05dcd700..87bfe5b5 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -54,6 +54,12 @@ int proxy_process(ProxyRequest *request, ProxyReply *reply) case P_GET_BOOTARGS: reply->retval = boot_args_addr; break; + case P_GET_BOOT_CPU_IDX: + reply->retval = boot_cpu_idx; + break; + case P_GET_BOOT_CPU_MPIDR: + reply->retval = boot_cpu_mpidr; + break; case P_GET_BASE: reply->retval = (u64)_base; break; diff --git a/src/proxy.h b/src/proxy.h index 675d607d..974701b5 100644 --- a/src/proxy.h +++ b/src/proxy.h @@ -24,6 +24,8 @@ typedef enum { P_PUT_SIMD_STATE, P_REBOOT, P_SLEEP, + P_GET_BOOT_CPU_IDX, + P_GET_BOOT_CPU_MPIDR, P_WRITE64 = 0x100, // Generic register functions P_WRITE32,