svn commit: r327388 - head/sys/powerpc/ps3
Nathan Whitehorn
nwhitehorn at FreeBSD.org
Sat Dec 30 20:24:35 UTC 2017
Author: nwhitehorn
Date: Sat Dec 30 20:24:33 2017
New Revision: 327388
URL: https://svnweb.freebsd.org/changeset/base/327388
Log:
Change the way SMP startup works to match the new multi-AP features in
locore64.S introduced in r327358.
MFC after: 3 weeks
Modified:
head/sys/powerpc/ps3/platform_ps3.c
Modified: head/sys/powerpc/ps3/platform_ps3.c
==============================================================================
--- head/sys/powerpc/ps3/platform_ps3.c Sat Dec 30 20:23:14 2017 (r327387)
+++ head/sys/powerpc/ps3/platform_ps3.c Sat Dec 30 20:24:33 2017 (r327388)
@@ -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 *cpur
{
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 *cpure
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);
}
More information about the svn-src-head
mailing list