lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 7 Apr 2022 14:48:36 +0000
From:   Sean Christopherson <seanjc@...gle.com>
To:     Paolo Bonzini <pbonzini@...hat.com>
Cc:     isaku.yamahata@...el.com, kvm@...r.kernel.org,
        linux-kernel@...r.kernel.org, isaku.yamahata@...il.com,
        Jim Mattson <jmattson@...gle.com>, erdemaktas@...gle.com,
        Connor Kuehl <ckuehl@...hat.com>
Subject: Re: [RFC PATCH v5 091/104] KVM: TDX: Handle TDX PV CPUID hypercall

On Thu, Apr 07, 2022, Paolo Bonzini wrote:
> On 3/4/22 20:49, isaku.yamahata@...el.com wrote:
> > From: Isaku Yamahata <isaku.yamahata@...el.com>
> > 
> > Wire up TDX PV CPUID hypercall to the KVM backend function.
> > 
> > Signed-off-by: Isaku Yamahata <isaku.yamahata@...el.com>
> > ---
> >   arch/x86/kvm/vmx/tdx.c | 27 +++++++++++++++++++++++++++
> >   1 file changed, 27 insertions(+)
> > 
> > diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
> > index 53f59fb92dcf..f7c9170d596a 100644
> > --- a/arch/x86/kvm/vmx/tdx.c
> > +++ b/arch/x86/kvm/vmx/tdx.c
> > @@ -893,6 +893,30 @@ static int tdx_emulate_vmcall(struct kvm_vcpu *vcpu)
> >   	return 1;
> >   }
> > +static int tdx_emulate_cpuid(struct kvm_vcpu *vcpu)
> > +{
> > +	u32 eax, ebx, ecx, edx;
> > +
> > +	/* EAX and ECX for cpuid is stored in R12 and R13. */
> > +	eax = tdvmcall_p1_read(vcpu);
> > +	ecx = tdvmcall_p2_read(vcpu);
> > +
> > +	kvm_cpuid(vcpu, &eax, &ebx, &ecx, &edx, true);
> > +
> > +	/*
> > +	 * The returned value for CPUID (EAX, EBX, ECX, and EDX) is stored into
> > +	 * R12, R13, R14, and R15.
> > +	 */
> > +	tdvmcall_p1_write(vcpu, eax);
> > +	tdvmcall_p2_write(vcpu, ebx);
> > +	tdvmcall_p3_write(vcpu, ecx);
> > +	tdvmcall_p4_write(vcpu, edx);
> > +
> > +	tdvmcall_set_return_code(vcpu, TDG_VP_VMCALL_SUCCESS);
> > +
> > +	return 1;
> > +}
> > +
> >   static int handle_tdvmcall(struct kvm_vcpu *vcpu)
> >   {
> >   	struct vcpu_tdx *tdx = to_tdx(vcpu);
> > @@ -904,6 +928,9 @@ static int handle_tdvmcall(struct kvm_vcpu *vcpu)
> >   		return tdx_emulate_vmcall(vcpu);
> >   	switch (tdvmcall_exit_reason(vcpu)) {
> > +	case EXIT_REASON_CPUID:
> > +		return tdx_emulate_cpuid(vcpu);
> > +

Spurious whitespace that gets deleted by the HLT patch.

> >   	default:
> >   		break;
> >   	}
> 
> Reviewed-by: Paolo Bonzini <pbonzini@...hat.com>
> 
> but I don't think tdvmcall_*_{read,write} add much.

They provided a lot more value when the ABI was still in flux, but I still like
having them.  That said, either the comments about R12..R15 need to go, or the
wrappers need to go.  Having both is confusing.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ