diff options
author | Nathan Whitehorn <nwhitehorn@FreeBSD.org> | 2017-12-30 20:24:33 +0000 |
---|---|---|
committer | Nathan Whitehorn <nwhitehorn@FreeBSD.org> | 2017-12-30 20:24:33 +0000 |
commit | ba06dbb8742a043295f85107a79f0fcd8b4cdb89 (patch) | |
tree | da4c03bf5d2517f08761dac0346b200a071cbb4e | |
parent | 223d42a4de4e9a3d6416db878abd375a41ea1225 (diff) | |
download | src-ba06dbb8742a043295f85107a79f0fcd8b4cdb89.tar.gz src-ba06dbb8742a043295f85107a79f0fcd8b4cdb89.zip |
Change the way SMP startup works to match the new multi-AP features in
locore64.S introduced in r327358.
MFC after: 3 weeks
Notes
Notes:
svn path=/head/; revision=327388
-rw-r--r-- | sys/powerpc/ps3/platform_ps3.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/sys/powerpc/ps3/platform_ps3.c b/sys/powerpc/ps3/platform_ps3.c index 564b48e99fd6..5f8145dc6f4e 100644 --- a/sys/powerpc/ps3/platform_ps3.c +++ b/sys/powerpc/ps3/platform_ps3.c @@ -103,6 +103,8 @@ static platform_def_t ps3_platform = { PLATFORM_DEF(ps3_platform); +static int ps3_boot_pir = 0; + static int ps3_probe(platform_t plat) { @@ -129,6 +131,9 @@ ps3_attach(platform_t plat) /* Set a breakpoint to make NULL an invalid address */ lv1_set_dabr(0x7 /* read and write, MMU on */, 2 /* kernel accesses */); + /* Record our PIR at boot for later */ + ps3_boot_pir = mfspr(SPR_PIR); + return (0); } @@ -189,7 +194,7 @@ ps3_smp_first_cpu(platform_t plat, struct cpuref *cpuref) { cpuref->cr_cpuid = 0; - cpuref->cr_hwref = cpuref->cr_cpuid; + cpuref->cr_hwref = ps3_boot_pir; return (0); } @@ -202,7 +207,7 @@ ps3_smp_next_cpu(platform_t plat, struct cpuref *cpuref) return (ENOENT); cpuref->cr_cpuid++; - cpuref->cr_hwref = cpuref->cr_cpuid; + cpuref->cr_hwref = !ps3_boot_pir; return (0); } @@ -212,7 +217,7 @@ ps3_smp_get_bsp(platform_t plat, struct cpuref *cpuref) { cpuref->cr_cpuid = 0; - cpuref->cr_hwref = cpuref->cr_cpuid; + cpuref->cr_hwref = ps3_boot_pir; return (0); } @@ -220,21 +225,21 @@ ps3_smp_get_bsp(platform_t plat, struct cpuref *cpuref) static int ps3_smp_start_cpu(platform_t plat, struct pcpu *pc) { - /* loader(8) is spinning on 0x40 == 0 right now */ - uint32_t *secondary_spin_sem = (uint32_t *)(0x40); + /* kernel is spinning on 0x40 == -1 right now */ + volatile uint32_t *secondary_spin_sem = (uint32_t *)(0x40); + int remote_pir = pc->pc_hwref; int timeout; - if (pc->pc_hwref != 1) - return (ENXIO); - ap_pcpu = pc; - *secondary_spin_sem = 1; - powerpc_sync(); - DELAY(1); + /* Try both PIR values, looping a few times: the HV likes moving us */ timeout = 10000; - while (!pc->pc_awake && timeout--) + while (!pc->pc_awake && timeout--) { + *secondary_spin_sem = remote_pir; + powerpc_sync(); DELAY(100); + remote_pir = !remote_pir; + } return ((pc->pc_awake) ? 0 : EBUSY); } |