diff options
author | Nicholas Piggin <npiggin@gmail.com> | 2018-02-14 01:08:11 +1000 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2018-03-30 23:34:22 +1100 |
commit | 8e0b634b132752ec3eba50afb952502b1a87d6ba (patch) | |
tree | 870818dfb79d9b0900fa0458ffbee7a39091edac /arch/powerpc/kernel | |
parent | 0834d627fbea00c1444075eb3e448e1974da452d (diff) | |
download | op-kernel-dev-8e0b634b132752ec3eba50afb952502b1a87d6ba.zip op-kernel-dev-8e0b634b132752ec3eba50afb952502b1a87d6ba.tar.gz |
powerpc/64s: Do not allocate lppaca if we are not virtualized
The "lppaca" is a structure registered with the hypervisor. This is
unnecessary when running on non-virtualised platforms. One field from
the lppaca (pmcregs_in_use) is also used by the host, so move the host
part out into the paca (lppaca field is still updated in
guest mode).
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
[mpe: Fix non-pseries build with some #ifdefs]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r-- | arch/powerpc/kernel/asm-offsets.c | 5 | ||||
-rw-r--r-- | arch/powerpc/kernel/paca.c | 16 |
2 files changed, 18 insertions, 3 deletions
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c index ea5eb91..bbde55f 100644 --- a/arch/powerpc/kernel/asm-offsets.c +++ b/arch/powerpc/kernel/asm-offsets.c @@ -221,12 +221,17 @@ int main(void) OFFSET(PACA_EXMC, paca_struct, exmc); OFFSET(PACA_EXSLB, paca_struct, exslb); OFFSET(PACA_EXNMI, paca_struct, exnmi); +#ifdef CONFIG_PPC_PSERIES OFFSET(PACALPPACAPTR, paca_struct, lppaca_ptr); +#endif OFFSET(PACA_SLBSHADOWPTR, paca_struct, slb_shadow_ptr); OFFSET(SLBSHADOW_STACKVSID, slb_shadow, save_area[SLB_NUM_BOLTED - 1].vsid); OFFSET(SLBSHADOW_STACKESID, slb_shadow, save_area[SLB_NUM_BOLTED - 1].esid); OFFSET(SLBSHADOW_SAVEAREA, slb_shadow, save_area); OFFSET(LPPACA_PMCINUSE, lppaca, pmcregs_in_use); +#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE + OFFSET(PACA_PMCINUSE, paca_struct, pmcregs_in_use); +#endif OFFSET(LPPACA_DTLIDX, lppaca, dtl_idx); OFFSET(LPPACA_YIELDCOUNT, lppaca, yield_count); OFFSET(PACA_DTL_RIDX, paca_struct, dtl_ridx); diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c index 95ffedf..5900540 100644 --- a/arch/powerpc/kernel/paca.c +++ b/arch/powerpc/kernel/paca.c @@ -20,7 +20,7 @@ #include "setup.h" -#ifdef CONFIG_PPC_BOOK3S +#ifdef CONFIG_PPC_PSERIES /* * The structure which the hypervisor knows about - this structure @@ -47,6 +47,9 @@ static long __initdata lppaca_size; static void __init allocate_lppacas(int nr_cpus, unsigned long limit) { + if (early_cpu_has_feature(CPU_FTR_HVMODE)) + return; + if (nr_cpus <= NR_LPPACAS) return; @@ -60,6 +63,9 @@ static struct lppaca * __init new_lppaca(int cpu) { struct lppaca *lp; + if (early_cpu_has_feature(CPU_FTR_HVMODE)) + return NULL; + if (cpu < NR_LPPACAS) return &lppaca[cpu]; @@ -73,6 +79,9 @@ static void __init free_lppacas(void) { long new_size = 0, nr; + if (early_cpu_has_feature(CPU_FTR_HVMODE)) + return; + if (!lppaca_size) return; nr = num_possible_cpus() - NR_LPPACAS; @@ -157,9 +166,10 @@ EXPORT_SYMBOL(paca); void __init initialise_paca(struct paca_struct *new_paca, int cpu) { -#ifdef CONFIG_PPC_BOOK3S +#ifdef CONFIG_PPC_PSERIES new_paca->lppaca_ptr = new_lppaca(cpu); -#else +#endif +#ifdef CONFIG_PPC_BOOK3E new_paca->kernel_pgd = swapper_pg_dir; #endif new_paca->lock_token = 0x8000; |