[Devel] [PATCH RHEL7 COMMIT] kvm: fix PKU reporting on Intel hosts #PSBM-129872

Vasily Averin vvs at virtuozzo.com
Thu Jun 3 17:56:46 MSK 2021


The commit is pushed to "branch-rh7-3.10.0-1160.25.1.vz7.180.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1160.25.1.vz7.180.9
------>
commit 6dc6ee3267e1b3f6080980b77e1b41a695a850cb
Author: Denis V. Lunev <den at openvz.org>
Date:   Thu Jun 3 17:56:46 2021 +0300

    kvm: fix PKU reporting on Intel hosts #PSBM-129872
    
    efc7128eca ms/KVM: AMD Milan Support patch from AMD/Diaway friends has
    broken PKU reporting to QEMU. It unconditionally masked it due to
    incorrect backport. Restore authentic Intel behaviour.
    
    https://jira.sw.ru/browse/PSBM-129872
    Signed-off-by: Denis V. Lunev <den at openvz.org>
    CC: Vasily Averin <vvs at virtuozzo.com>
---
 arch/x86/kvm/cpuid.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index 73a1af6..13af742 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -477,8 +477,7 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
 			cpuid_mask(&entry->ebx, CPUID_7_0_EBX);
 			// TSC_ADJUST is emulated
 			entry->ebx |= F(TSC_ADJUST);
-			entry->ecx |= f_pku;
-			entry->ecx &= kvm_cpuid_7_0_ecx_x86_features;
+			entry->ecx &= kvm_cpuid_7_0_ecx_x86_features | f_pku;
 			cpuid_mask(&entry->ecx, CPUID_7_ECX);
 			/* PKU is not yet implemented for shadow paging. */
 			if (!tdp_enabled || !boot_cpu_has(X86_FEATURE_OSPKE))


More information about the Devel mailing list