Commit fa8c3d65 authored by David Brazdil's avatar David Brazdil Committed by Marc Zyngier

KVM: arm64: Keep nVHE EL2 vector installed

KVM by default keeps the stub vector installed and installs the nVHE
vector only briefly for init and later on demand. Change this policy
to install the vector at init and then never uninstall it if the kernel
was given the protected KVM command line parameter.
Signed-off-by: default avatarDavid Brazdil <dbrazdil@google.com>
Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20201202184122.26046-25-dbrazdil@google.com
parent d945f8d9
...@@ -1453,6 +1453,7 @@ static void _kvm_arch_hardware_disable(void *discard) ...@@ -1453,6 +1453,7 @@ static void _kvm_arch_hardware_disable(void *discard)
void kvm_arch_hardware_disable(void) void kvm_arch_hardware_disable(void)
{ {
if (!is_protected_kvm_enabled())
_kvm_arch_hardware_disable(NULL); _kvm_arch_hardware_disable(NULL);
} }
...@@ -1496,10 +1497,12 @@ static struct notifier_block hyp_init_cpu_pm_nb = { ...@@ -1496,10 +1497,12 @@ static struct notifier_block hyp_init_cpu_pm_nb = {
static void __init hyp_cpu_pm_init(void) static void __init hyp_cpu_pm_init(void)
{ {
if (!is_protected_kvm_enabled())
cpu_pm_register_notifier(&hyp_init_cpu_pm_nb); cpu_pm_register_notifier(&hyp_init_cpu_pm_nb);
} }
static void __init hyp_cpu_pm_exit(void) static void __init hyp_cpu_pm_exit(void)
{ {
if (!is_protected_kvm_enabled())
cpu_pm_unregister_notifier(&hyp_init_cpu_pm_nb); cpu_pm_unregister_notifier(&hyp_init_cpu_pm_nb);
} }
#else #else
...@@ -1588,6 +1591,7 @@ static int init_subsystems(void) ...@@ -1588,6 +1591,7 @@ static int init_subsystems(void)
kvm_coproc_table_init(); kvm_coproc_table_init();
out: out:
if (err || !is_protected_kvm_enabled())
on_each_cpu(_kvm_arch_hardware_disable, NULL, 1); on_each_cpu(_kvm_arch_hardware_disable, NULL, 1);
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment