All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <sean.j.christopherson@intel.com>
To: Krish Sadhukhan <krish.sadhukhan@oracle.com>
Cc: kvm@vger.kernel.org, pbonzini@redhat.com
Subject: Re: [PATCH 1/3 v3] KVM: x86: Create mask for guest CR4 reserved bits in kvm_update_cpuid()
Date: Fri, 15 May 2020 07:29:30 -0700	[thread overview]
Message-ID: <20200515142930.GB17572@linux.intel.com> (raw)
In-Reply-To: <20200515053609.3347-2-krish.sadhukhan@oracle.com>

On Fri, May 15, 2020 at 01:36:07AM -0400, Krish Sadhukhan wrote:
> Instead of creating the mask for guest CR4 reserved bits in kvm_valid_cr4(),
> do it in kvm_update_cpuid() so that it can be reused instead of creating it
> each time kvm_valid_cr4() is called.
> 
> Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
> ---
>  arch/x86/include/asm/kvm_host.h |  2 ++
>  arch/x86/kvm/cpuid.c            |  2 ++
>  arch/x86/kvm/x86.c              | 24 ++----------------------
>  arch/x86/kvm/x86.h              | 21 +++++++++++++++++++++
>  4 files changed, 27 insertions(+), 22 deletions(-)
> 
> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> index 42a2d0d..e2d9e4b 100644
> --- a/arch/x86/include/asm/kvm_host.h
> +++ b/arch/x86/include/asm/kvm_host.h
> @@ -820,6 +820,8 @@ struct kvm_vcpu_arch {
>  
>  	/* AMD MSRC001_0015 Hardware Configuration */
>  	u64 msr_hwcr;
> +
> +	u64 guest_cr4_reserved_bits;

This can be an 'unsigned long', the u64 type in the existing code is a goof
on my part.  I'd also vote to co-locate it with the other cr4 variables and
abbreviate reserved to keep the name manageable, e.g.

diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index ae6a93ed83d39..21ece121e1858 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -573,6 +573,7 @@ struct kvm_vcpu_arch {
        unsigned long cr3;
        unsigned long cr4;
        unsigned long cr4_guest_owned_bits;
+       unsigned long cr4_guest_rsvd_bits;
        unsigned long cr8;
        u32 pkru;
        u32 hflags;

  reply	other threads:[~2020-05-15 14:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-15  5:36 [PATCH 0/3 v3] KVM: nSVM: Check MBZ bits in CR3 and CR4 on vmrun of nested guests Krish Sadhukhan
2020-05-15  5:36 ` [PATCH 1/3 v3] KVM: x86: Create mask for guest CR4 reserved bits in kvm_update_cpuid() Krish Sadhukhan
2020-05-15 14:29   ` Sean Christopherson [this message]
2020-05-15  5:36 ` [PATCH 2/3 v3] KVM: nSVM: Check that MBZ bits in CR3 and CR4 are not set on vmrun of nested guests Krish Sadhukhan
2020-05-15  5:36 ` [PATCH 3/3 v3] KVM: nSVM: Test " Krish Sadhukhan
2020-07-02 22:33 ` [PATCH 0/3 v3] KVM: nSVM: Check MBZ bits in CR3 and CR4 " Krish Sadhukhan
2020-07-03 17:09   ` Paolo Bonzini
2020-07-03 17:11   ` Paolo Bonzini
2020-07-07  0:34     ` Krish Sadhukhan
2020-07-07 10:32       ` Paolo Bonzini

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=20200515142930.GB17572@linux.intel.com \
    --to=sean.j.christopherson@intel.com \
    --cc=krish.sadhukhan@oracle.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.