Skip to content

Commit 1699bd0

Browse files
paulusmackgregkh
authored andcommitted
powerpc/64: Call H_REGISTER_PROC_TBL when running as a HPT guest on POWER9
commit dbfcf3c upstream. On POWER9, since commit cc3d294 ("powerpc/64: Enable use of radix MMU under hypervisor on POWER9", 2017-01-30), we set both the radix and HPT bits in the client-architecture-support (CAS) vector, which tells the hypervisor that we can do either radix or HPT. According to PAPR, if we use this combination we are promising to do a H_REGISTER_PROC_TBL hcall later on to let the hypervisor know whether we are doing radix or HPT. We currently do this call if we are doing radix but not if we are doing HPT. If the hypervisor is able to support both radix and HPT guests, it would be entitled to defer allocation of the HPT until the H_REGISTER_PROC_TBL call, and to fail any attempts to create HPTEs until the H_REGISTER_PROC_TBL call. Thus we need to do a H_REGISTER_PROC_TBL call when we are doing HPT; otherwise we may crash at boot time. This adds the code to call H_REGISTER_PROC_TBL in this case, before we attempt to create any HPT entries using H_ENTER. Fixes: cc3d294 ("powerpc/64: Enable use of radix MMU under hypervisor on POWER9") Cc: [email protected] # v4.11+ Signed-off-by: Paul Mackerras <[email protected]> Reviewed-by: Suraj Jitindar Singh <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent f4eff13 commit 1699bd0

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

arch/powerpc/mm/hash_utils_64.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -872,6 +872,12 @@ static void __init htab_initialize(void)
872872
/* Using a hypervisor which owns the htab */
873873
htab_address = NULL;
874874
_SDR1 = 0;
875+
/*
876+
* On POWER9, we need to do a H_REGISTER_PROC_TBL hcall
877+
* to inform the hypervisor that we wish to use the HPT.
878+
*/
879+
if (cpu_has_feature(CPU_FTR_ARCH_300))
880+
register_process_table(0, 0, 0);
875881
#ifdef CONFIG_FA_DUMP
876882
/*
877883
* If firmware assisted dump is active firmware preserves

arch/powerpc/platforms/pseries/lpar.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -726,15 +726,18 @@ static int pseries_lpar_resize_hpt(unsigned long shift)
726726
return 0;
727727
}
728728

729-
/* Actually only used for radix, so far */
730729
static int pseries_lpar_register_process_table(unsigned long base,
731730
unsigned long page_size, unsigned long table_size)
732731
{
733732
long rc;
734-
unsigned long flags = PROC_TABLE_NEW;
733+
unsigned long flags = 0;
735734

735+
if (table_size)
736+
flags |= PROC_TABLE_NEW;
736737
if (radix_enabled())
737738
flags |= PROC_TABLE_RADIX | PROC_TABLE_GTSE;
739+
else
740+
flags |= PROC_TABLE_HPT_SLB;
738741
for (;;) {
739742
rc = plpar_hcall_norets(H_REGISTER_PROC_TBL, flags, base,
740743
page_size, table_size);
@@ -760,6 +763,7 @@ void __init hpte_init_pseries(void)
760763
mmu_hash_ops.flush_hash_range = pSeries_lpar_flush_hash_range;
761764
mmu_hash_ops.hpte_clear_all = pseries_hpte_clear_all;
762765
mmu_hash_ops.hugepage_invalidate = pSeries_lpar_hugepage_invalidate;
766+
register_process_table = pseries_lpar_register_process_table;
763767

764768
if (firmware_has_feature(FW_FEATURE_HPT_RESIZE))
765769
mmu_hash_ops.resize_hpt = pseries_lpar_resize_hpt;

0 commit comments

Comments
 (0)