Re: [PATCH v3 7/7] KVM, pkeys: disable PKU feature without ept
On 18/11/2015 06:44, Huaitong Han wrote: > This patch disables CPUID:PKU without ept, becase pkeys is not supported > with softmmu. Sure, but _what_ makes it impossible to support pkeys with shadow pages? Is it enough to add the pkey bits to the role (and then to kvm_get_mmu_page, mmu_set_spte, set_spte) or are there fundamental problems? The trick to handle !CR0.WP in FNAME(page_fault) (search for "walker.pte_access &= ~ACC_USER_MASK"; it's documented in Documentation/virtual/kvm/mmu.txt as well) should work for PKRU. If you just want me to change it to "is not yet implemented for shadow paging", I can do that. Thanks, Paolo > Signed-off-by: Huaitong Han-- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 7/7] KVM, pkeys: disable PKU feature without ept
On Wed, 2015-11-18 at 10:06 +0100, Paolo Bonzini wrote: > > On 18/11/2015 06:44, Huaitong Han wrote: > > This patch disables CPUID:PKU without ept, becase pkeys is not > > supported > > with softmmu. > > Sure, but _what_ makes it impossible to support pkeys with shadow > pages? > > Is it enough to add the pkey bits to the role (and then to > kvm_get_mmu_page, mmu_set_spte, set_spte) or are there fundamental > problems? > > The trick to handle !CR0.WP in FNAME(page_fault) (search for > "walker.pte_access &= ~ACC_USER_MASK"; it's documented in > Documentation/virtual/kvm/mmu.txt as well) should work for PKRU. > > If you just want me to change it to "is not yet implemented for > shadow > paging", I can do that. Yes, the comments should be described as "becase pkeys is not yet implemented for shadow paging." Thanks Huaitong. > > Thanks, > > Paolo > > > Signed-off-by: Huaitong Han > >N�r��yb�X��ǧv�^�){.n�+h����ܨ}���Ơz�:+v���zZ+��+zf���h���~i���z��w���?�&�)ߢf
[PATCH v3 7/7] KVM, pkeys: disable PKU feature without ept
This patch disables CPUID:PKU without ept, becase pkeys is not supported with softmmu. Signed-off-by: Huaitong Handiff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index ece687b..e422f0a 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c @@ -447,6 +447,9 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function, entry->ebx |= F(TSC_ADJUST); entry->ecx &= kvm_supported_word11_x86_features; cpuid_mask(>ecx, 13); + if (!tdp_enabled) + /* PKU cannot work with softmmu */ + entry->ecx &= ~F(PKU); } else { entry->ebx = 0; entry->ecx = 0; -- 2.4.3 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html