Skip to content

Commit e55f4d5

Browse files
legoaterpaulusmack
authored andcommitted
KVM: PPC: Book3S HV: Increase KVMPPC_NR_LPIDS on POWER8 and POWER9
POWER8 and POWER9 have 12-bit LPIDs. Change LPID_RSVD to support up to (4096 - 2) guests on these processors. POWER7 is kept the same with a limitation of (1024 - 2), but it might be time to drop KVM support for POWER7. Tested with 2048 guests * 4 vCPUs on a witherspoon system with 512G RAM and a bit of swap. Signed-off-by: Cédric Le Goater <[email protected]> Signed-off-by: Paul Mackerras <[email protected]>
1 parent 4cb4ade commit e55f4d5

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

arch/powerpc/include/asm/reg.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,8 @@
473473
#ifndef SPRN_LPID
474474
#define SPRN_LPID 0x13F /* Logical Partition Identifier */
475475
#endif
476-
#define LPID_RSVD 0x3ff /* Reserved LPID for partn switching */
476+
#define LPID_RSVD_POWER7 0x3ff /* Reserved LPID for partn switching */
477+
#define LPID_RSVD 0xfff /* Reserved LPID for partn switching */
477478
#define SPRN_HMER 0x150 /* Hypervisor maintenance exception reg */
478479
#define HMER_DEBUG_TRIG (1ul << (63 - 17)) /* Debug trigger */
479480
#define SPRN_HMEER 0x151 /* Hyp maintenance exception enable reg */

arch/powerpc/kvm/book3s_64_mmu_hv.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,11 +260,15 @@ int kvmppc_mmu_hv_init(void)
260260
if (!mmu_has_feature(MMU_FTR_LOCKLESS_TLBIE))
261261
return -EINVAL;
262262

263-
/* POWER7 has 10-bit LPIDs (12-bit in POWER8) */
264263
host_lpid = 0;
265264
if (cpu_has_feature(CPU_FTR_HVMODE))
266265
host_lpid = mfspr(SPRN_LPID);
267-
rsvd_lpid = LPID_RSVD;
266+
267+
/* POWER8 and above have 12-bit LPIDs (10-bit in POWER7) */
268+
if (cpu_has_feature(CPU_FTR_ARCH_207S))
269+
rsvd_lpid = LPID_RSVD;
270+
else
271+
rsvd_lpid = LPID_RSVD_POWER7;
268272

269273
kvmppc_init_lpid(rsvd_lpid + 1);
270274

0 commit comments

Comments
 (0)