• Nicholas Piggin's avatar
    KVM: PPC: Book3S PR: Disable SCV when AIL could be disabled · b5149e22
    Nicholas Piggin authored
    PR KVM does not support running with AIL enabled, and SCV does is not
    supported with AIL disabled. Fix this by ensuring the SCV facility is
    disabled with FSCR while a CPU could be running with AIL=0.
    
    The PowerNV host supports disabling AIL on a per-CPU basis, so SCV just
    needs to be disabled when a vCPU is being run.
    
    The pSeries machine can only switch AIL on a system-wide basis, so it
    must disable SCV support at boot if the configuration can potentially
    run a PR KVM guest.
    
    Also ensure a the FSCR[SCV] bit can not be enabled when emulating
    mtFSCR for the guest.
    
    SCV is not emulated for the PR guest at the moment, this just fixes the
    host crashes.
    
    Alternatives considered and rejected:
    - SCV support can not be disabled by PR KVM after boot, because it is
      advertised to userspace with HWCAP.
    - AIL can not be disabled on a per-CPU basis. At least when running on
      pseries it is a per-LPAR setting.
    - Support for real-mode SCV vectors will not be added because they are
      at 0x17000 so making such a large fixed head space causes immediate
      value limits to be exceeded, requiring a lot rework and more code.
    - Disabling SCV for any PR KVM possible kernel will cause a slowdown
      when not using PR KVM.
    - A boot time option to disable SCV to use PR KVM is user-hostile.
    - System call instruction emulation for SCV facility unavailable
      instructions is too complex and old emulation code was subtly broken
      and removed.
    Signed-off-by: default avatarNicholas Piggin <npiggin@gmail.com>
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    Reviewed-by: default avatarFabiano Rosas <farosas@linux.ibm.com>
    Link: https://lore.kernel.org/r/20220222064727.2314380-2-npiggin@gmail.com
    b5149e22
Kconfig 6.87 KB