mirror of
https://github.com/AsahiLinux/m1n1
synced 2024-11-24 23:53:04 +00:00
Allow boot cpus with non-zero index
This commit is contained in:
parent
88c7efe83d
commit
fc5f8ab58c
4 changed files with 20 additions and 6 deletions
|
@ -90,7 +90,7 @@ class HV(Reloadable):
|
|||
self.sym_offset = 0
|
||||
self.symbols = []
|
||||
self.symbol_dict = {}
|
||||
self.sysreg = {0: {}}
|
||||
self.sysreg = {0: {}, 6:{}}
|
||||
self.novm = False
|
||||
self._in_handler = False
|
||||
self._sigint_pending = False
|
||||
|
@ -1369,6 +1369,10 @@ class HV(Reloadable):
|
|||
print(f"Disable iodev {iodev!s}")
|
||||
self.p.iodev_set_usage(iodev, 0)
|
||||
|
||||
for cpu in self.adt["cpus"]:
|
||||
if cpu.state == "running":
|
||||
self.boot_cpu = cpu
|
||||
|
||||
print("Initializing hypervisor over iodev %s" % self.iodev)
|
||||
self.p.hv_init()
|
||||
|
||||
|
@ -1755,7 +1759,9 @@ class HV(Reloadable):
|
|||
|
||||
print("Setting secondary CPU RVBARs...")
|
||||
rvbar = self.entry & ~0xfff
|
||||
for cpu in self.adt["cpus"][1:]:
|
||||
for cpu in self.adt["cpus"]:
|
||||
if cpu.state == "running":
|
||||
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,7 @@ class HV(Reloadable):
|
|||
# Does not return
|
||||
|
||||
self.started = True
|
||||
self.started_cpus[0] = (0, 0, 0)
|
||||
self.started_cpus[self.boot_cpu.cpu_id] = (0, self.boot_cpu.cluster_id, self.boot_cpu.reg & 0xff)
|
||||
self.p.hv_start(self.entry, self.guest_base + self.bootargs_off)
|
||||
|
||||
from .. import trace
|
||||
|
|
|
@ -85,7 +85,9 @@ for name in ("mtp", "aop"):
|
|||
print("Setting secondary CPU RVBARs...")
|
||||
|
||||
rvbar = entry & ~0xfff
|
||||
for cpu in u.adt["cpus"][1:]:
|
||||
for cpu in u.adt["cpus"]:
|
||||
if cpu.state == "running":
|
||||
continue
|
||||
addr, size = cpu.cpu_impl_reg
|
||||
print(f" {cpu.name}: [0x{addr:x}] = 0x{rvbar:x}")
|
||||
p.write64(addr, rvbar)
|
||||
|
|
|
@ -509,7 +509,7 @@ void hv_exc_fiq(struct exc_info *ctx)
|
|||
|
||||
int interruptible_cpu = hv_pinned_cpu;
|
||||
if (interruptible_cpu == -1)
|
||||
interruptible_cpu = 0;
|
||||
interruptible_cpu = boot_cpu_idx;
|
||||
|
||||
if (smp_id() != interruptible_cpu && !(mrs(ISR_EL1) & 0x40) && hv_want_cpu == -1) {
|
||||
// Non-interruptible CPU and it was just a timer tick (or spurious), so just update FIQs
|
||||
|
|
|
@ -266,6 +266,12 @@ void smp_start_secondaries(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (in_el2())
|
||||
msr(TPIDR_EL2, boot_cpu_idx);
|
||||
else
|
||||
msr(TPIDR_EL1, boot_cpu_idx);
|
||||
|
||||
|
||||
for (int i = 0; i < MAX_CPUS; i++) {
|
||||
|
||||
if (i == boot_cpu_idx)
|
||||
|
@ -334,7 +340,7 @@ void smp_call4(int cpu, void *func, u64 arg0, u64 arg1, u64 arg2, u64 arg3)
|
|||
|
||||
struct spin_table *target = &spin_table[cpu];
|
||||
|
||||
if (cpu == 0)
|
||||
if (cpu == boot_cpu_idx)
|
||||
return;
|
||||
|
||||
u64 flag = target->flag;
|
||||
|
|
Loading…
Reference in a new issue