lkml.org 
[lkml]   [2020]   [May]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Subject[PATCH v2 3/3] KVM: SVM: Add support for MPK feature on AMD
    From
    Date
    The Memory Protection Key (MPK) feature provides a way for applications
    to impose page-based data access protections (read/write, read-only or
    no access), without requiring modification of page tables and subsequent
    TLB invalidations when the application changes protection domains.

    This feature is already available in Intel platforms. Now enable the
    feature on AMD 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". Documentation can be
    obtained at the link below.

    Link: https://bugzilla.kernel.org/show_bug.cgi?id=206537
    Signed-off-by: Babu Moger <babu.moger@amd.com>
    ---
    arch/x86/kvm/svm/svm.c | 4 ++++
    1 file changed, 4 insertions(+)

    diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
    index 2f379bacbb26..37fb41ad9149 100644
    --- a/arch/x86/kvm/svm/svm.c
    +++ b/arch/x86/kvm/svm/svm.c
    @@ -818,6 +818,10 @@ static __init void svm_set_cpu_caps(void)
    if (boot_cpu_has(X86_FEATURE_LS_CFG_SSBD) ||
    boot_cpu_has(X86_FEATURE_AMD_SSBD))
    kvm_cpu_cap_set(X86_FEATURE_VIRT_SSBD);
    +
    + /* PKU is not yet implemented for shadow paging. */
    + if (npt_enabled && boot_cpu_has(X86_FEATURE_OSPKE))
    + kvm_cpu_cap_check_and_set(X86_FEATURE_PKU);
    }

    static __init int svm_hardware_setup(void)
    \
     
     \ /
      Last update: 2020-05-08 23:10    [W:6.441 / U:0.664 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site