mbox series

[v4,0/3] arch/x86: Enable MPK feature on AMD

Message ID 158932780954.44260.4292038705292213548.stgit@naples-babu.amd.com (mailing list archive)
Headers show
Series arch/x86: Enable MPK feature on AMD | expand

Message

Babu Moger May 12, 2020, 11:58 p.m. UTC
AMD's next generation of EPYC processors support the MPK (Memory
Protection Keys) feature.

This series enables the feature on AMD and updates config parameters
and documentation to reflect the MPK support on x86 platforms.

AMD documentation for MPK feature is available at "AMD64 Architecture
Programmer’s Manual Volume 2: System Programming, Pub. 24593 Rev. 3.34,
Section 5.6.6 Memory Protection Keys (MPK) Bit".

The documentation can be obtained at the link below:
https://bugzilla.kernel.org/show_bug.cgi?id=206537

---
v4:
  - Removed all the source changes related to config parameter.
    Just kept the doc changes and add new config parameter
    X86_MEMORY_PROTECTION_KEYS which shadows X86_INTEL_MEMORY_PROTECTION_KEYS.
 - Minor change in feature detection in kvm/cpuid.c 

v3:
  https://lore.kernel.org/lkml/158923982830.20128.14580309786525588408.stgit@naples-babu.amd.com/#r
  - Fixed the problem Jim Mattson pointed out which can cause pkru
    resources to get corrupted during host and guest switches. 
  - Moved the PKU feature detection code from VMX.c to common code.
  
v2:
  https://lore.kernel.org/lkml/158897190718.22378.3974700869904223395.stgit@naples-babu.amd.com/
  - Introduced intermediate config option X86_MEMORY_PROTECTION_KEYS to
    avoid user propmpts. Kept X86_INTEL_MEMORY_PROTECTION_KEYS as is.
    Eventually, we will be moving to X86_MEMORY_PROTECTION_KEYS after
    couple of kernel revisions. 
  - Moved pkru data structures to kvm_vcpu_arch. Moved save/restore pkru
    to kvm_load_host_xsave_state/kvm_load_guest_xsave_state.

v1:
  https://lore.kernel.org/lkml/158880240546.11615.2219410169137148044.stgit@naples-babu.amd.com/

Babu Moger (3):
      arch/x86: Update config and kernel doc for MPK feature on AMD
      KVM: x86: Move pkru save/restore to x86.c
      KVM: x86: Move MPK feature detection to common code


 Documentation/core-api/protection-keys.rst |    3 ++-
 arch/x86/Kconfig                           |   14 ++++++++++++--
 arch/x86/include/asm/kvm_host.h            |    1 +
 arch/x86/kvm/cpuid.c                       |    9 ++++++++-
 arch/x86/kvm/vmx/vmx.c                     |   22 ----------------------
 arch/x86/kvm/x86.c                         |   17 +++++++++++++++++
 6 files changed, 40 insertions(+), 26 deletions(-)

--
Signature

Comments

Paolo Bonzini May 13, 2020, 3:35 p.m. UTC | #1
On 13/05/20 01:58, Babu Moger wrote:
> AMD's next generation of EPYC processors support the MPK (Memory
> Protection Keys) feature.
> 
> This series enables the feature on AMD and updates config parameters
> and documentation to reflect the MPK support on x86 platforms.
> 
> AMD documentation for MPK feature is available at "AMD64 Architecture
> Programmer’s Manual Volume 2: System Programming, Pub. 24593 Rev. 3.34,
> Section 5.6.6 Memory Protection Keys (MPK) Bit".
> 
> The documentation can be obtained at the link below:
> https://bugzilla.kernel.org/show_bug.cgi?id=206537

I'm queuing patches 2 and 3, since they are do not need any support in
common code.

Paolo
Babu Moger May 13, 2020, 4 p.m. UTC | #2
On 5/13/20 10:35 AM, Paolo Bonzini wrote:
> On 13/05/20 01:58, Babu Moger wrote:
>> AMD's next generation of EPYC processors support the MPK (Memory
>> Protection Keys) feature.
>>
>> This series enables the feature on AMD and updates config parameters
>> and documentation to reflect the MPK support on x86 platforms.
>>
>> AMD documentation for MPK feature is available at "AMD64 Architecture
>> Programmer’s Manual Volume 2: System Programming, Pub. 24593 Rev. 3.34,
>> Section 5.6.6 Memory Protection Keys (MPK) Bit".
>>
>> The documentation can be obtained at the link below:
> 
> I'm queuing patches 2 and 3, since they are do not need any support in
> common code.

Thanks Paolo. I will just resubmit the patch #1 addressing Dave's feedback.