powerpc/book3s64/radix: Add kernel command line option to disable radix GTSE
authorAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Mon, 27 Jul 2020 08:59:08 +0000 (14:29 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 29 Jul 2020 11:09:37 +0000 (21:09 +1000)
This adds a kernel command line option that can be used to disable GTSE support.
Disabling GTSE implies kernel will make hcalls to invalidate TLB entries.

This was done so that we can do VM migration between configs that enable/disable
GTSE support via hypervisor. To migrate a VM from a system that supports
GTSE to a system that doesn't, we can boot the guest with
radix_hcall_invalidate=on, thereby forcing the guest to use hcalls for TLB
invalidates.

The check for hcall availability is done in pSeries_setup_arch so that
the panic message appears on the console. This should only happen on
a hypervisor that doesn't force the guest to hash translation even
though it can't handle the radix GTSE=0 request via CAS. With
radix_hcall_invalidate=on if the hypervisor doesn't support hcall_rpt_invalidate
hcall it should force the LPAR to hash translation.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Tested-by: Bharata B Rao <bharata@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200727085908.420806-1-aneesh.kumar@linux.ibm.com
Documentation/admin-guide/kernel-parameters.txt
arch/powerpc/include/asm/firmware.h
arch/powerpc/kernel/prom_init.c
arch/powerpc/mm/init_64.c
arch/powerpc/platforms/pseries/firmware.c
arch/powerpc/platforms/pseries/setup.c

index fb95fad81c79a065e728202a34a3dabac5653cb4..3ab61cd0f89c7e187ff5dc6129be19fe7cc417a1 100644 (file)
        disable_radix   [PPC]
                        Disable RADIX MMU mode on POWER9
 
+       radix_hcall_invalidate=on  [PPC/PSERIES]
+                       Disable RADIX GTSE feature and use hcall for TLB
+                       invalidate.
+
        disable_tlbie   [PPC]
                        Disable TLBIE instruction. Currently does not work
                        with KVM, with HASH MMU, or with coherent accelerators.
index f67efbaba17f54ea631a40b0b51414a25a80ff89..0b295bdb201e82d0ce3b61d6732fae0e64710942 100644 (file)
@@ -52,6 +52,7 @@
 #define FW_FEATURE_PAPR_SCM    ASM_CONST(0x0000002000000000)
 #define FW_FEATURE_ULTRAVISOR  ASM_CONST(0x0000004000000000)
 #define FW_FEATURE_STUFF_TCE   ASM_CONST(0x0000008000000000)
+#define FW_FEATURE_RPT_INVALIDATE ASM_CONST(0x0000010000000000)
 
 #ifndef __ASSEMBLY__
 
@@ -71,7 +72,8 @@ enum {
                FW_FEATURE_TYPE1_AFFINITY | FW_FEATURE_PRRN |
                FW_FEATURE_HPT_RESIZE | FW_FEATURE_DRMEM_V2 |
                FW_FEATURE_DRC_INFO | FW_FEATURE_BLOCK_REMOVE |
-               FW_FEATURE_PAPR_SCM | FW_FEATURE_ULTRAVISOR,
+               FW_FEATURE_PAPR_SCM | FW_FEATURE_ULTRAVISOR |
+               FW_FEATURE_RPT_INVALIDATE,
        FW_FEATURE_PSERIES_ALWAYS = 0,
        FW_FEATURE_POWERNV_POSSIBLE = FW_FEATURE_OPAL | FW_FEATURE_ULTRAVISOR,
        FW_FEATURE_POWERNV_ALWAYS = 0,
index cbc605cfdec06e4e6638f40932a78a2452adc245..f279a1f58fa72c3d246b34d1ef20000a33fcf195 100644 (file)
@@ -169,6 +169,7 @@ static unsigned long __prombss prom_tce_alloc_end;
 
 #ifdef CONFIG_PPC_PSERIES
 static bool __prombss prom_radix_disable;
+static bool __prombss prom_radix_gtse_disable;
 static bool __prombss prom_xive_disable;
 #endif
 
@@ -823,6 +824,12 @@ static void __init early_cmdline_parse(void)
        if (prom_radix_disable)
                prom_debug("Radix disabled from cmdline\n");
 
+       opt = prom_strstr(prom_cmd_line, "radix_hcall_invalidate=on");
+       if (opt) {
+               prom_radix_gtse_disable = true;
+               prom_debug("Radix GTSE disabled from cmdline\n");
+       }
+
        opt = prom_strstr(prom_cmd_line, "xive=off");
        if (opt) {
                prom_xive_disable = true;
@@ -1285,10 +1292,8 @@ static void __init prom_parse_platform_support(u8 index, u8 val,
                prom_parse_mmu_model(val & OV5_FEAT(OV5_MMU_SUPPORT), support);
                break;
        case OV5_INDX(OV5_RADIX_GTSE): /* Radix Extensions */
-               if (val & OV5_FEAT(OV5_RADIX_GTSE)) {
-                       prom_debug("Radix - GTSE supported\n");
-                       support->radix_gtse = true;
-               }
+               if (val & OV5_FEAT(OV5_RADIX_GTSE))
+                       support->radix_gtse = !prom_radix_gtse_disable;
                break;
        case OV5_INDX(OV5_XIVE_SUPPORT): /* Interrupt mode */
                prom_parse_xive_model(val & OV5_FEAT(OV5_XIVE_SUPPORT),
index 152aa0200cef7d29d3719e9bfa5b576a5386a772..4ae5fc0ceb3095cc6533f24fa1b7f6efc2d3b632 100644 (file)
@@ -406,7 +406,6 @@ static void __init early_check_vec5(void)
                }
                if (!(vec5[OV5_INDX(OV5_RADIX_GTSE)] &
                                                OV5_FEAT(OV5_RADIX_GTSE))) {
-                       pr_warn("WARNING: Hypervisor doesn't support RADIX with GTSE\n");
                        cur_cpu_spec->mmu_features &= ~MMU_FTR_GTSE;
                } else
                        cur_cpu_spec->mmu_features |= MMU_FTR_GTSE;
index 3e49cc23a97a30d1262ead64eb13851996c93731..4c7b7f5a2ebca4d5e5464f4bc581433efee2f336 100644 (file)
@@ -65,6 +65,7 @@ hypertas_fw_features_table[] = {
        {FW_FEATURE_HPT_RESIZE,         "hcall-hpt-resize"},
        {FW_FEATURE_BLOCK_REMOVE,       "hcall-block-remove"},
        {FW_FEATURE_PAPR_SCM,           "hcall-scm"},
+       {FW_FEATURE_RPT_INVALIDATE,     "hcall-rpt-invalidate"},
 };
 
 /* Build up the firmware features bitmask using the contents of
index e29c9bf0a3b985225515e437bf6e21e41bcb28ba..b1a8c72a8c1214553c8e42e70cd321c740d07432 100644 (file)
@@ -747,6 +747,11 @@ static void __init pSeries_setup_arch(void)
        smp_init_pseries();
 
 
+       if (radix_enabled() && !mmu_has_feature(MMU_FTR_GTSE))
+               if (!firmware_has_feature(FW_FEATURE_RPT_INVALIDATE))
+                       panic("BUG: Radix support requires either GTSE or RPT_INVALIDATE\n");
+
+
        /* openpic global configuration register (64-bit format). */
        /* openpic Interrupt Source Unit pointer (64-bit format). */
        /* python0 facility area (mmio) (64-bit format) REAL address. */