[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <SA1PR11MB673422DA73549769390F5D3AA8B69@SA1PR11MB6734.namprd11.prod.outlook.com>
Date: Mon, 6 Mar 2023 09:32:35 +0000
From: "Li, Xin3" <xin3.li@...el.com>
To: "Li, Xin3" <xin3.li@...el.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"x86@...nel.org" <x86@...nel.org>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>
CC: "tglx@...utronix.de" <tglx@...utronix.de>,
"mingo@...hat.com" <mingo@...hat.com>,
"bp@...en8.de" <bp@...en8.de>,
"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
"hpa@...or.com" <hpa@...or.com>,
"peterz@...radead.org" <peterz@...radead.org>,
"andrew.cooper3@...rix.com" <andrew.cooper3@...rix.com>,
"Christopherson,, Sean" <seanjc@...gle.com>,
"pbonzini@...hat.com" <pbonzini@...hat.com>,
"Shankar, Ravi V" <ravi.v.shankar@...el.com>
Subject: RE: [PATCH v4 33/34] KVM: x86/vmx: call external_interrupt() for IRQ
reinjection when FRED is enabled
> arch/x86/kvm/vmx/vmx.c | 22 +++++++++++++++++++++-
> 1 file changed, 21 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index
> bcac3efcde41..30f854015c8c 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -47,6 +47,7 @@
> #include <asm/mshyperv.h>
> #include <asm/mwait.h>
> #include <asm/spec-ctrl.h>
> +#include <asm/traps.h>
> #include <asm/virtext.h>
> #include <asm/vmx.h>
>
> @@ -6923,7 +6924,26 @@ static void handle_external_interrupt_irqoff(struct
> kvm_vcpu *vcpu)
> return;
>
> kvm_before_interrupt(vcpu, KVM_HANDLING_IRQ);
> - vmx_do_interrupt_irqoff(gate_offset(desc));
> + if (cpu_feature_enabled(X86_FEATURE_FRED)) {
> + struct vcpu_vmx *vmx = to_vmx(vcpu);
> + struct pt_regs regs = {};
> +
> + /*
> + * Create an event return stack frame with the
> + * host context immediately after a VM exit.
> + *
> + * All other fields of the pt_regs structure are
> + * cleared to 0.
> + */
> + regs.ssx = __KERNEL_DS;
This breaks i386 build, and should use ss.
> + regs.sp = vmx->loaded_vmcs->host_state.rsp;
> + regs.flags = X86_EFLAGS_FIXED;
> + regs.csx = __KERNEL_CS;
And cs.
> + regs.ip = (unsigned long)vmx_vmexit;
> +
> + external_interrupt(®s, vector);
> + } else
> + vmx_do_interrupt_irqoff(gate_offset(desc));
> kvm_after_interrupt(vcpu);
>
> vcpu->arch.at_instruction_boundary = true;
> --
> 2.34.1
Powered by blists - more mailing lists