Changeset View
Changeset View
Standalone View
Standalone View
sys/powerpc/powernv/platform_powernv.c
Show First 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | |||||
#include "platform_if.h" | #include "platform_if.h" | ||||
#include "opal.h" | #include "opal.h" | ||||
#ifdef SMP | #ifdef SMP | ||||
extern void *ap_pcpu; | extern void *ap_pcpu; | ||||
#endif | #endif | ||||
extern void xicp_smp_cpu_startup(void); | |||||
static int powernv_probe(platform_t); | static int powernv_probe(platform_t); | ||||
static int powernv_attach(platform_t); | static int powernv_attach(platform_t); | ||||
void powernv_mem_regions(platform_t, struct mem_region *phys, int *physsz, | void powernv_mem_regions(platform_t, struct mem_region *phys, int *physsz, | ||||
struct mem_region *avail, int *availsz); | struct mem_region *avail, int *availsz); | ||||
static u_long powernv_timebase_freq(platform_t, struct cpuref *cpuref); | static u_long powernv_timebase_freq(platform_t, struct cpuref *cpuref); | ||||
static int powernv_smp_first_cpu(platform_t, struct cpuref *cpuref); | static int powernv_smp_first_cpu(platform_t, struct cpuref *cpuref); | ||||
static int powernv_smp_next_cpu(platform_t, struct cpuref *cpuref); | static int powernv_smp_next_cpu(platform_t, struct cpuref *cpuref); | ||||
static int powernv_smp_get_bsp(platform_t, struct cpuref *cpuref); | static int powernv_smp_get_bsp(platform_t, struct cpuref *cpuref); | ||||
▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | #endif | ||||
/* LPID must not be altered when PSL_DR or PSL_IR is set */ | /* LPID must not be altered when PSL_DR or PSL_IR is set */ | ||||
msr = mfmsr(); | msr = mfmsr(); | ||||
mtmsr(msr & ~(PSL_DR | PSL_IR)); | mtmsr(msr & ~(PSL_DR | PSL_IR)); | ||||
/* Direct interrupts to SRR instead of HSRR and reset LPCR otherwise */ | /* Direct interrupts to SRR instead of HSRR and reset LPCR otherwise */ | ||||
mtspr(SPR_LPID, 0); | mtspr(SPR_LPID, 0); | ||||
isync(); | isync(); | ||||
mtspr(SPR_LPCR, LPCR_LPES); | if (cpu_features2 & PPC_FEATURE2_ARCH_3_00) | ||||
lpcr |= LPCR_HVICE; | |||||
nwhitehorn: Shouldn't this be earlier/elsewhere? It's not exactly PowerNV specific (insofar as PowerNV… | |||||
Not Done Inline ActionsThis double-sets LPCR_HVICE. nwhitehorn: This double-sets LPCR_HVICE. | |||||
mtspr(SPR_LPCR, lpcr); | |||||
Not Done Inline ActionsSee: POWER ISA 3 comments. nwhitehorn: See: POWER ISA 3 comments. | |||||
isync(); | isync(); | ||||
mtmsr(msr); | mtmsr(msr); | ||||
/* Init CPU bits */ | |||||
powernv_smp_ap_init(plat); | |||||
powernv_cpuref_init(); | powernv_cpuref_init(); | ||||
/* Set SLB count from device tree */ | /* Set SLB count from device tree */ | ||||
cpu = OF_peer(0); | cpu = OF_peer(0); | ||||
cpu = OF_child(cpu); | cpu = OF_child(cpu); | ||||
while (cpu != 0) { | while (cpu != 0) { | ||||
res = OF_getprop(cpu, "name", buf, sizeof(buf)); | res = OF_getprop(cpu, "name", buf, sizeof(buf)); | ||||
if (res > 0 && strcmp(buf, "cpus") == 0) | if (res > 0 && strcmp(buf, "cpus") == 0) | ||||
▲ Show 20 Lines • Show All 284 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
opal_call(OPAL_CEC_REBOOT); | opal_call(OPAL_CEC_REBOOT); | ||||
} | } | ||||
static void | static void | ||||
powernv_smp_ap_init(platform_t platform) | powernv_smp_ap_init(platform_t platform) | ||||
{ | { | ||||
struct cpuref cpuref; | |||||
Not Done Inline ActionsThis method is called only on APs, so no need for this if. nwhitehorn: This method is called only on APs, so no need for this if. | |||||
platform_smp_get_bsp(&cpuref); | |||||
Not Done Inline ActionsWhy not do this inline? I assume this whole mode will be removed once XIVE support lands. nwhitehorn: Why not do this inline? I assume this whole mode will be removed once XIVE support lands. | |||||
if (PCPU_GET(cpuid) != cpuref.cr_cpuid) | |||||
Not Done Inline ActionsThis doesn't work. PCPU fields aren't set until after this function is called on the BSP. nwhitehorn: This doesn't work. PCPU fields aren't set until after this function is called on the BSP. | |||||
xicp_smp_cpu_startup(); | |||||
} | } | ||||
static void | static void | ||||
powernv_cpu_idle(sbintime_t sbt) | powernv_cpu_idle(sbintime_t sbt) | ||||
{ | { | ||||
} | } |
Shouldn't this be earlier/elsewhere? It's not exactly PowerNV specific (insofar as PowerNV means "opal + FDT"). This is not a blocking comment, though.