mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Brijesh Singh <brijesh.singh@amd.com>
To: Sean Christopherson <sean.j.christopherson@intel.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Cc: brijesh.singh@amd.com, Vitaly Kuznetsov <vkuznets@redhat.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Tom Lendacky <thomas.lendacky@amd.com>
Subject: Re: [RFC PATCH] KVM: SVM: Disallow SEV if NPT is disabled
Date: Tue, 4 Aug 2020 10:16:18 -0500	[thread overview]
Message-ID: <c1ae98a9-beeb-c58e-4623-bf25374330e4@amd.com> (raw)
In-Reply-To: <20200731205116.14891-1-sean.j.christopherson@intel.com>


On 7/31/20 3:51 PM, Sean Christopherson wrote:
> Forcefully turn off SEV if NPT is disabled, e.g. via module param.  SEV
> requires NPT as the C-bit only exists if NPT is active.
>
> Fixes: e9df09428996f ("KVM: SVM: Add sev module_param")
> Cc: stable@vger.kernel.org
> Cc: Tom Lendacky <thomas.lendacky@amd.com>
> Cc: Brijesh Singh <brijesh.singh@amd.com>
> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> ---
>
> RFC as it's entirely possible that I am completely misunderstanding how
> SEV works.  Compile tested only.


Reviewed-By: Brijesh Singh <brijesh.singh@amd.com>


>
>  arch/x86/kvm/svm/svm.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
> index 783330d0e7b88..e30629593458b 100644
> --- a/arch/x86/kvm/svm/svm.c
> +++ b/arch/x86/kvm/svm/svm.c
> @@ -860,8 +860,14 @@ static __init int svm_hardware_setup(void)
>  		kvm_enable_efer_bits(EFER_SVME | EFER_LMSLE);
>  	}
>  
> +	if (!boot_cpu_has(X86_FEATURE_NPT))
> +		npt_enabled = false;
> +
> +	if (npt_enabled && !npt)
> +		npt_enabled = false;
> +
>  	if (sev) {
> -		if (boot_cpu_has(X86_FEATURE_SEV) &&
> +		if (boot_cpu_has(X86_FEATURE_SEV) && npt_enabled &&
>  		    IS_ENABLED(CONFIG_KVM_AMD_SEV)) {
>  			r = sev_hardware_setup();
>  			if (r)
> @@ -879,12 +885,6 @@ static __init int svm_hardware_setup(void)
>  			goto err;
>  	}
>  
> -	if (!boot_cpu_has(X86_FEATURE_NPT))
> -		npt_enabled = false;
> -
> -	if (npt_enabled && !npt)
> -		npt_enabled = false;
> -
>  	kvm_configure_mmu(npt_enabled, PG_LEVEL_1G);
>  	pr_info("kvm: Nested Paging %sabled\n", npt_enabled ? "en" : "dis");
>  

      reply	other threads:[~2020-08-04 15:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-31 20:51 Sean Christopherson
2020-08-04 15:16 ` Brijesh Singh [this message]

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=c1ae98a9-beeb-c58e-4623-bf25374330e4@amd.com \
    --to=brijesh.singh@amd.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=sean.j.christopherson@intel.com \
    --cc=thomas.lendacky@amd.com \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.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

all inboxes | Powered by JetHome®