From: Paolo Bonzini Date: Thu, 7 Jan 2021 23:06:52 +0000 (-0500) Subject: Merge branch 'kvm-master' into kvm-next X-Git-Url: https://repo.jachan.dev/J-linux.git/commitdiff_plain/bc351f07260533cc1b3987339551decd00ddd52e Merge branch 'kvm-master' into kvm-next Fixes to get_mmio_spte, destined to 5.10 stable branch. --- bc351f07260533cc1b3987339551decd00ddd52e diff --cc arch/arm64/kernel/sdei.c index e04b3e90c003,793c46d6a447..2132bd953a87 --- a/arch/arm64/kernel/sdei.c +++ b/arch/arm64/kernel/sdei.c @@@ -216,40 -223,13 +217,40 @@@ static __kprobes unsigned long _sdei_ha return vbar + 0x480; } +static void __kprobes notrace __sdei_pstate_entry(void) +{ + /* + * The original SDEI spec (ARM DEN 0054A) can be read ambiguously as to + * whether PSTATE bits are inherited unchanged or generated from + * scratch, and the TF-A implementation always clears PAN and always + * clears UAO. There are no other known implementations. + * + * Subsequent revisions (ARM DEN 0054B) follow the usual rules for how + * PSTATE is modified upon architectural exceptions, and so PAN is + * either inherited or set per SCTLR_ELx.SPAN, and UAO is always + * cleared. + * + * We must explicitly reset PAN to the expected state, including + * clearing it when the host isn't using it, in case a VM had it set. + */ + if (system_uses_hw_pan()) + set_pstate_pan(1); + else if (cpu_has_pan()) + set_pstate_pan(0); +} - asmlinkage __kprobes notrace unsigned long + asmlinkage noinstr unsigned long __sdei_handler(struct pt_regs *regs, struct sdei_registered_event *arg) { unsigned long ret; + /* + * We didn't take an exception to get here, so the HW hasn't + * set/cleared bits in PSTATE that we may rely on. Initialize PAN. + */ + __sdei_pstate_entry(); + - nmi_enter(); + arm64_enter_nmi(regs); ret = _sdei_handler(regs, arg); diff --cc arch/x86/kvm/svm/svm.c index 941e5251e13f,da7eb4aaf44f..cce0143a6f80 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@@ -1347,8 -1309,10 +1347,10 @@@ static int svm_create_vcpu(struct kvm_v svm->avic_is_running = true; svm->msrpm = svm_vcpu_alloc_msrpm(); - if (!svm->msrpm) + if (!svm->msrpm) { + err = -ENOMEM; - goto error_free_vmcb_page; + goto error_free_vmsa_page; + } svm_vcpu_init_msrpm(vcpu, svm->msrpm);