kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Moger, Babu" <Babu.Moger@amd.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"bp@alien8.de" <bp@alien8.de>, "hpa@zytor.com" <hpa@zytor.com>,
	"rkrcmar@redhat.com" <rkrcmar@redhat.com>,
	"sean.j.christopherson@intel.com"
	<sean.j.christopherson@intel.com>,
	"vkuznets@redhat.com" <vkuznets@redhat.com>,
	"wanpengli@tencent.com" <wanpengli@tencent.com>,
	"jmattson@google.com" <jmattson@google.com>
Cc: "x86@kernel.org" <x86@kernel.org>,
	"joro@8bytes.org" <joro@8bytes.org>,
	"luto@kernel.org" <luto@kernel.org>,
	"zohar@linux.ibm.com" <zohar@linux.ibm.com>,
	"yamada.masahiro@socionext.com" <yamada.masahiro@socionext.com>,
	"nayna@linux.ibm.com" <nayna@linux.ibm.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: [PATCH 2/4] kvm: svm: Enable UMIP feature on AMD
Date: Mon, 4 Nov 2019 18:45:48 +0000	[thread overview]
Message-ID: <2f61ae5c-0658-e5c9-754c-9ca80148a54d@amd.com> (raw)
In-Reply-To: <37c61050-e315-fc84-9699-bb92e5afacda@redhat.com>



On 11/4/19 5:54 AM, Paolo Bonzini wrote:
> On 01/11/19 18:33, Moger, Babu wrote:
>> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
>> index 4153ca8cddb7..79abbdeca148 100644
>> --- a/arch/x86/kvm/svm.c
>> +++ b/arch/x86/kvm/svm.c
>> @@ -2533,6 +2533,11 @@ static void svm_decache_cr4_guest_bits(struct kvm_vcpu *vcpu)
>>  {
>>  }
>>  
>> +static bool svm_umip_emulated(void)
>> +{
>> +	return boot_cpu_has(X86_FEATURE_UMIP);
>> +}
> 
> For hardware that supports UMIP, this is only needed because of your
> patch 1.  Without it, X86_FEATURE_UMIP should already be enabled on
> processors that natively support UMIP.

Yes, That is correct. Will remove the patch #1. Intention was to enable
UMIP for the hardware that supports it. Will send out only the config
changes(Patch #4).  Also there is a complexity with supporting emulation
on SEV guest.

> 
> If you want UMIP *emulation* instead, this should become "return true".
> 
>>  static void update_cr0_intercept(struct vcpu_svm *svm)
>>  {
>>  	ulong gcr0 = svm->vcpu.arch.cr0;
>> @@ -4438,6 +4443,13 @@ static int interrupt_window_interception(struct vcpu_svm *svm)
>>  	return 1;
>>  }
>>  
>> +static int umip_interception(struct vcpu_svm *svm)
>> +{
>> +	struct kvm_vcpu *vcpu = &svm->vcpu;
>> +
>> +	return kvm_emulate_instruction(vcpu, 0);
>> +}
>> +
>>  static int pause_interception(struct vcpu_svm *svm)
>>  {
>>  	struct kvm_vcpu *vcpu = &svm->vcpu;
>> @@ -4775,6 +4787,10 @@ static int (*const svm_exit_handlers[])(struct vcpu_svm *svm) = {
>>  	[SVM_EXIT_SMI]				= nop_on_interception,
>>  	[SVM_EXIT_INIT]				= nop_on_interception,
>>  	[SVM_EXIT_VINTR]			= interrupt_window_interception,
>> +	[SVM_EXIT_IDTR_READ]			= umip_interception,
>> +	[SVM_EXIT_GDTR_READ]			= umip_interception,
>> +	[SVM_EXIT_LDTR_READ]			= umip_interception,
>> +	[SVM_EXIT_TR_READ]			= umip_interception,
> 
> This is missing enabling the intercepts.  Also, this can be just
> emulate_on_interception instead of a new function.
> 
> Paolo
> 
>>  	[SVM_EXIT_RDPMC]			= rdpmc_interception,
>>  	[SVM_EXIT_CPUID]			= cpuid_interception,
>>  	[SVM_EXIT_IRET]                         = iret_interception,
>> @@ -5976,11 +5992,6 @@ static bool svm_xsaves_supported(void)
>>  	return boot_cpu_has(X86_FEATURE_XSAVES);
>>  }
>>  
>> -static bool svm_umip_emulated(void)
>> -{
>> -	return false;
>> -}
>> -
>>  static bool svm_pt_supported(void)
>>  {
>>  	return false;
>>
> 

  reply	other threads:[~2019-11-04 18:45 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-01 17:33 [PATCH 0/4] Emulate and enable UMIP feature on AMD Moger, Babu
2019-11-01 17:33 ` [PATCH 1/4] kvm: x86: Dont set UMIP feature bit unconditionally Moger, Babu
2019-11-01 18:35   ` Jim Mattson
2019-11-01 19:39     ` Moger, Babu
2019-11-01 19:42       ` Jim Mattson
2019-11-01 17:33 ` [PATCH 2/4] kvm: svm: Enable UMIP feature on AMD Moger, Babu
2019-11-01 18:24   ` Andy Lutomirski
2019-11-01 18:38     ` Moger, Babu
2019-11-01 19:09       ` Andy Lutomirski
2019-11-01 18:29   ` Jim Mattson
2019-11-01 19:20     ` Moger, Babu
2019-11-01 19:24       ` Andy Lutomirski
2019-11-01 20:04         ` Moger, Babu
2019-11-01 20:08           ` Jim Mattson
2019-11-02 19:23             ` Moger, Babu
2019-11-03 11:45               ` Borislav Petkov
2019-11-04 18:46                 ` Moger, Babu
2019-11-04 11:54   ` Paolo Bonzini
2019-11-04 18:45     ` Moger, Babu [this message]
2019-11-01 17:33 ` [PATCH 3/4] kvm: svm: Emulate UMIP instructions on non SEV guest Moger, Babu
2019-11-01 17:34 ` [PATCH 4/4] x86/Kconfig: Rename UMIP config parameter Moger, Babu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2f61ae5c-0658-e5c9-754c-9ca80148a54d@amd.com \
    --to=babu.moger@amd.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=nayna@linux.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    --cc=sean.j.christopherson@intel.com \
    --cc=tglx@linutronix.de \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.com \
    --cc=x86@kernel.org \
    --cc=yamada.masahiro@socionext.com \
    --cc=zohar@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).