Re: [RFC 5/7] KVM: MMU: Add support for PKS emulation

2021-01-27 Thread Paolo Bonzini
On 27/01/21 04:00, Chenyi Qiang wrote: if (pte_access & PT_USER_MASK) pkr_bits = (vcpu->arch.pkru >> (pte_pkey * 2)) & 3; +    else if (!kvm_get_msr(vcpu, MSR_IA32_PKRS, )) +    pkr_bits = (pkrs >> (pte_pkey * 2)) & 3; You should be able to always use

Re: [RFC 5/7] KVM: MMU: Add support for PKS emulation

2021-01-26 Thread Chenyi Qiang
On 1/27/2021 2:23 AM, Paolo Bonzini wrote: On 07/08/20 10:48, Chenyi Qiang wrote: if (pte_access & PT_USER_MASK) pkr_bits = (vcpu->arch.pkru >> (pte_pkey * 2)) & 3; +    else if (!kvm_get_msr(vcpu, MSR_IA32_PKRS, )) +    pkr_bits = (pkrs >> (pte_pkey * 2))

Re: [RFC 5/7] KVM: MMU: Add support for PKS emulation

2021-01-26 Thread Paolo Bonzini
On 07/08/20 10:48, Chenyi Qiang wrote: if (pte_access & PT_USER_MASK) pkr_bits = (vcpu->arch.pkru >> (pte_pkey * 2)) & 3; + else if (!kvm_get_msr(vcpu, MSR_IA32_PKRS, )) + pkr_bits = (pkrs >> (pte_pkey * 2)) & 3; You

[RFC 5/7] KVM: MMU: Add support for PKS emulation

2020-08-07 Thread Chenyi Qiang
Advertise pkr_mask to cache the conditions where pretection key checks for supervisor pages are needed. When the accessed pages are those with a translation for which the U/S flag is 0 in at least one paging-structure entry controlling the translation, they are the supervisor pages and PKRS