mbox series

[0/2] Fix reserved bits calculation errors caused by MKTME

Message ID cover.1556877940.git.kai.huang@linux.intel.com (mailing list archive)
Headers show
Series Fix reserved bits calculation errors caused by MKTME | expand

Message

Kai Huang May 3, 2019, 10:08 a.m. UTC
This series fix reserved bits related calculation errors caused by MKTME. MKTME
repurposes high bits of physical address bits as 'keyID' thus they are not
reserved bits, and to honor such HW behavior those reduced bits are taken away
from boot_cpu_data.x86_phys_bits when MKTME is detected (exactly how many bits
are taken away is configured by BIOS). Currently KVM asssumes bits from
boot_cpu_data.x86_phys_bits to 51 are reserved bits, which is not true anymore
with MKTME, and needs fix.

This series was splitted from the old patch I sent out around 2 weeks ago:

kvm: x86: Fix several SPTE mask calculation errors caused by MKTME

Changes to old patch:

  - splitted one patch into two patches. First patch is to move
    kvm_set_mmio_spte_mask() as prerequisite. It doesn't impact functionality.
    Patch 2 does the real fix.

  - renamed shadow_first_rsvd_bits to shadow_phys_bits suggested by Sean.

  - refined comments and commit msg to be more concise.

Btw sorry that I will be out next week and won't be able to reply email.

Kai Huang (2):
  kvm: x86: Move kvm_set_mmio_spte_mask() from x86.c to mmu.c
  kvm: x86: Fix reserved bits related calculation errors caused by MKTME

 arch/x86/kvm/mmu.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++----
 arch/x86/kvm/x86.c | 31 ---------------------------
 2 files changed, 57 insertions(+), 35 deletions(-)

Comments

Kai Huang May 13, 2019, 3:31 a.m. UTC | #1
Hi Paolo/Radim,

Would you take a look?

Thanks,
-Kai


> -----Original Message-----
> From: Kai Huang [mailto:kai.huang@linux.intel.com]
> Sent: Friday, May 3, 2019 10:09 PM
> To: kvm@vger.kernel.org; pbonzini@redhat.com; rkrcmar@redhat.com
> Cc: Christopherson, Sean J <sean.j.christopherson@intel.com>;
> junaids@google.com; thomas.lendacky@amd.com; brijesh.singh@amd.com;
> guangrong.xiao@gmail.com; tglx@linutronix.de; bp@alien8.de;
> hpa@zytor.com; Huang, Kai <kai.huang@intel.com>
> Subject: [PATCH 0/2] Fix reserved bits calculation errors caused by MKTME
> 
> This series fix reserved bits related calculation errors caused by MKTME.
> MKTME repurposes high bits of physical address bits as 'keyID' thus they are
> not reserved bits, and to honor such HW behavior those reduced bits are
> taken away from boot_cpu_data.x86_phys_bits when MKTME is detected
> (exactly how many bits are taken away is configured by BIOS). Currently KVM
> asssumes bits from boot_cpu_data.x86_phys_bits to 51 are reserved bits,
> which is not true anymore with MKTME, and needs fix.
> 
> This series was splitted from the old patch I sent out around 2 weeks ago:
> 
> kvm: x86: Fix several SPTE mask calculation errors caused by MKTME
> 
> Changes to old patch:
> 
>   - splitted one patch into two patches. First patch is to move
>     kvm_set_mmio_spte_mask() as prerequisite. It doesn't impact
> functionality.
>     Patch 2 does the real fix.
> 
>   - renamed shadow_first_rsvd_bits to shadow_phys_bits suggested by Sean.
> 
>   - refined comments and commit msg to be more concise.
> 
> Btw sorry that I will be out next week and won't be able to reply email.
> 
> Kai Huang (2):
>   kvm: x86: Move kvm_set_mmio_spte_mask() from x86.c to mmu.c
>   kvm: x86: Fix reserved bits related calculation errors caused by MKTME
> 
>  arch/x86/kvm/mmu.c | 61
> ++++++++++++++++++++++++++++++++++++++++++++++++++----
>  arch/x86/kvm/x86.c | 31 ---------------------------
>  2 files changed, 57 insertions(+), 35 deletions(-)
> 
> --
> 2.13.6
Kai Huang May 27, 2019, 12:12 a.m. UTC | #2
Hi Paolo,

Kindly ping.

Thanks,
-Kai

On Mon, 2019-05-13 at 03:31 +0000, Huang, Kai wrote:
> Hi Paolo/Radim,
> 
> Would you take a look?
> 
> Thanks,
> -Kai
> 
> 
> > -----Original Message-----
> > From: Kai Huang [mailto:kai.huang@linux.intel.com]
> > Sent: Friday, May 3, 2019 10:09 PM
> > To: kvm@vger.kernel.org; pbonzini@redhat.com; rkrcmar@redhat.com
> > Cc: Christopherson, Sean J <sean.j.christopherson@intel.com>;
> > junaids@google.com; thomas.lendacky@amd.com; brijesh.singh@amd.com;
> > guangrong.xiao@gmail.com; tglx@linutronix.de; bp@alien8.de;
> > hpa@zytor.com; Huang, Kai <kai.huang@intel.com>
> > Subject: [PATCH 0/2] Fix reserved bits calculation errors caused by MKTME
> > 
> > This series fix reserved bits related calculation errors caused by MKTME.
> > MKTME repurposes high bits of physical address bits as 'keyID' thus they are
> > not reserved bits, and to honor such HW behavior those reduced bits are
> > taken away from boot_cpu_data.x86_phys_bits when MKTME is detected
> > (exactly how many bits are taken away is configured by BIOS). Currently KVM
> > asssumes bits from boot_cpu_data.x86_phys_bits to 51 are reserved bits,
> > which is not true anymore with MKTME, and needs fix.
> > 
> > This series was splitted from the old patch I sent out around 2 weeks ago:
> > 
> > kvm: x86: Fix several SPTE mask calculation errors caused by MKTME
> > 
> > Changes to old patch:
> > 
> >   - splitted one patch into two patches. First patch is to move
> >     kvm_set_mmio_spte_mask() as prerequisite. It doesn't impact
> > functionality.
> >     Patch 2 does the real fix.
> > 
> >   - renamed shadow_first_rsvd_bits to shadow_phys_bits suggested by Sean.
> > 
> >   - refined comments and commit msg to be more concise.
> > 
> > Btw sorry that I will be out next week and won't be able to reply email.
> > 
> > Kai Huang (2):
> >   kvm: x86: Move kvm_set_mmio_spte_mask() from x86.c to mmu.c
> >   kvm: x86: Fix reserved bits related calculation errors caused by MKTME
> > 
> >  arch/x86/kvm/mmu.c | 61
> > ++++++++++++++++++++++++++++++++++++++++++++++++++----
> >  arch/x86/kvm/x86.c | 31 ---------------------------
> >  2 files changed, 57 insertions(+), 35 deletions(-)
> > 
> > --
> > 2.13.6
> 
>
Paolo Bonzini June 4, 2019, 5:04 p.m. UTC | #3
On 03/05/19 12:08, Kai Huang wrote:
> This series fix reserved bits related calculation errors caused by MKTME. MKTME
> repurposes high bits of physical address bits as 'keyID' thus they are not
> reserved bits, and to honor such HW behavior those reduced bits are taken away
> from boot_cpu_data.x86_phys_bits when MKTME is detected (exactly how many bits
> are taken away is configured by BIOS). Currently KVM asssumes bits from
> boot_cpu_data.x86_phys_bits to 51 are reserved bits, which is not true anymore
> with MKTME, and needs fix.
> 
> This series was splitted from the old patch I sent out around 2 weeks ago:
> 
> kvm: x86: Fix several SPTE mask calculation errors caused by MKTME
> 
> Changes to old patch:
> 
>   - splitted one patch into two patches. First patch is to move
>     kvm_set_mmio_spte_mask() as prerequisite. It doesn't impact functionality.
>     Patch 2 does the real fix.
> 
>   - renamed shadow_first_rsvd_bits to shadow_phys_bits suggested by Sean.
> 
>   - refined comments and commit msg to be more concise.
> 
> Btw sorry that I will be out next week and won't be able to reply email.
> 
> Kai Huang (2):
>   kvm: x86: Move kvm_set_mmio_spte_mask() from x86.c to mmu.c
>   kvm: x86: Fix reserved bits related calculation errors caused by MKTME
> 
>  arch/x86/kvm/mmu.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++----
>  arch/x86/kvm/x86.c | 31 ---------------------------
>  2 files changed, 57 insertions(+), 35 deletions(-)
> 

Queued, thanks.

Paolo