]> Git Repo - J-linux.git/commitdiff
Merge branch 'topic/ppc-kvm' into next
authorMichael Ellerman <[email protected]>
Mon, 28 Mar 2022 10:11:24 +0000 (21:11 +1100)
committerMichael Ellerman <[email protected]>
Mon, 28 Mar 2022 10:11:24 +0000 (21:11 +1100)
Merge some more commits from our KVM topic branch. In particular this
brings in some commits that depend on a new capability that was merged
via the KVM tree for v5.18.

1  2 
arch/powerpc/include/asm/setup.h
arch/powerpc/kernel/setup_64.c
arch/powerpc/platforms/pseries/setup.c

index 049ca26893e61033f3319b632ae3f4410fd2fe0d,a555fb77258ad15bc525af542bce1899e3c0a98d..8fa37ef5da4d177cc80e9c425a16aec31edb5a88
@@@ -28,11 -28,13 +28,13 @@@ void setup_panic(void)
  #define ARCH_PANIC_TIMEOUT 180
  
  #ifdef CONFIG_PPC_PSERIES
+ extern bool pseries_reloc_on_exception(void);
  extern bool pseries_enable_reloc_on_exc(void);
  extern void pseries_disable_reloc_on_exc(void);
  extern void pseries_big_endian_exceptions(void);
  void __init pseries_little_endian_exceptions(void);
  #else
+ static inline bool pseries_reloc_on_exception(void) { return false; }
  static inline bool pseries_enable_reloc_on_exc(void) { return false; }
  static inline void pseries_disable_reloc_on_exc(void) {}
  static inline void pseries_big_endian_exceptions(void) {}
@@@ -76,13 -78,6 +78,13 @@@ static inline void setup_spectre_v2(voi
  #endif
  void __init do_btb_flush_fixups(void);
  
 +#ifdef CONFIG_PPC32
 +unsigned long __init early_init(unsigned long dt_ptr);
 +void __init machine_init(u64 dt_ptr);
 +#endif
 +void __init early_setup(unsigned long dt_ptr);
 +void early_setup_secondary(void);
 +
  #endif /* !__ASSEMBLY__ */
  
  #endif        /* _ASM_POWERPC_SETUP_H */
index e547066a06aa6860bf39f5404acdef820af4632f,d973ae7558e36396b464af51b2801d4966b5263f..a96f05063bc9108da0770877ad3b2b86291f8c90
@@@ -67,6 -67,7 +67,6 @@@
  #include <asm/kup.h>
  #include <asm/early_ioremap.h>
  #include <asm/pgalloc.h>
 -#include <asm/asm-prototypes.h>
  
  #include "setup.h"
  
@@@ -196,6 -197,34 +196,34 @@@ static void __init configure_exceptions
  
        /* Under a PAPR hypervisor, we need hypercalls */
        if (firmware_has_feature(FW_FEATURE_SET_MODE)) {
+               /*
+                * - PR KVM does not support AIL mode interrupts in the host
+                *   while a PR guest is running.
+                *
+                * - SCV system call interrupt vectors are only implemented for
+                *   AIL mode interrupts.
+                *
+                * - On pseries, AIL mode can only be enabled and disabled
+                *   system-wide so when a PR VM is created on a pseries host,
+                *   all CPUs of the host are set to AIL=0 mode.
+                *
+                * - Therefore host CPUs must not execute scv while a PR VM
+                *   exists.
+                *
+                * - SCV support can not be disabled dynamically because the
+                *   feature is advertised to host userspace. Disabling the
+                *   facility and emulating it would be possible but is not
+                *   implemented.
+                *
+                * - So SCV support is blanket disabled if PR KVM could possibly
+                *   run. That is, PR support compiled in, booting on pseries
+                *   with hash MMU.
+                */
+               if (IS_ENABLED(CONFIG_KVM_BOOK3S_PR_POSSIBLE) && !radix_enabled()) {
+                       init_task.thread.fscr &= ~FSCR_SCV;
+                       cur_cpu_spec->cpu_user_features2 &= ~PPC_FEATURE2_SCV;
+               }
                /* Enable AIL if possible */
                if (!pseries_enable_reloc_on_exc()) {
                        init_task.thread.fscr &= ~FSCR_SCV;
index 069d7b3bb142ef58fb9afde20b2905955d204364,5bdbbe2151b11d0d1192737a5cef5e77ea3df011..955ff8aa1644d03da0a53b6ca7e2f2a465d737ba
@@@ -353,6 -353,14 +353,14 @@@ static void pseries_lpar_idle(void
        pseries_idle_epilog();
  }
  
+ static bool pseries_reloc_on_exception_enabled;
+ bool pseries_reloc_on_exception(void)
+ {
+       return pseries_reloc_on_exception_enabled;
+ }
+ EXPORT_SYMBOL_GPL(pseries_reloc_on_exception);
  /*
   * Enable relocation on during exceptions. This has partition wide scope and
   * may take a while to complete, if it takes longer than one second we will
@@@ -377,6 -385,7 +385,7 @@@ bool pseries_enable_reloc_on_exc(void
                                        " on exceptions: %ld\n", rc);
                                return false;
                        }
+                       pseries_reloc_on_exception_enabled = true;
                        return true;
                }
  
@@@ -404,7 -413,9 +413,9 @@@ void pseries_disable_reloc_on_exc(void
                        break;
                mdelay(get_longbusy_msecs(rc));
        }
-       if (rc != H_SUCCESS)
+       if (rc == H_SUCCESS)
+               pseries_reloc_on_exception_enabled = false;
+       else
                pr_warn("Warning: Failed to disable relocation on exceptions: %ld\n",
                        rc);
  }
@@@ -1086,7 -1097,6 +1097,7 @@@ define_machine(pseries) 
        .system_reset_exception = pSeries_system_reset_exception,
        .machine_check_early    = pseries_machine_check_realmode,
        .machine_check_exception = pSeries_machine_check_exception,
 +      .machine_check_log_err  = pSeries_machine_check_log_err,
  #ifdef CONFIG_KEXEC_CORE
        .machine_kexec          = pSeries_machine_kexec,
        .kexec_cpu_down         = pseries_kexec_cpu_down,
This page took 0.06733 seconds and 4 git commands to generate.