Message ID | 20191121203344.156835-2-pgonda@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Limit memory encryption cpuid pass through | expand |
On 11/21/2019 12:33 PM, Peter Gonda wrote: > Memory encryption support does not have module parameter dependencies > and can be moved into the general x86 cpuid __do_cpuid_ent function. > This changes maintains current behavior of passing through all of > CPUID.8000001F. > > Suggested-by: Jim Mattson <jmattson@google.com> > Signed-off-by: Peter Gonda <pgonda@google.com> > Reviewed-by: Jim Mattson <jmattson@google.com> > --- > arch/x86/kvm/cpuid.c | 5 +++++ > arch/x86/kvm/svm.c | 7 ------- > 2 files changed, 5 insertions(+), 7 deletions(-) > > diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c > index f68c0c753c38..946fa9cb9dd6 100644 > --- a/arch/x86/kvm/cpuid.c > +++ b/arch/x86/kvm/cpuid.c > @@ -778,6 +778,11 @@ static inline int __do_cpuid_func(struct kvm_cpuid_entry2 *entry, u32 function, > case 0x8000001a: > case 0x8000001e: > break; > + /* Support memory encryption cpuid if host supports it */ > + case 0x8000001F: > + if (!boot_cpu_has(X86_FEATURE_SEV)) > + entry->eax = entry->ebx = entry->ecx = entry->edx = 0; > + break; > /*Add support for Centaur's CPUID instruction*/ > case 0xC0000000: > /*Just support up to 0xC0000004 now*/ > diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c > index c5673bda4b66..79842329ebcd 100644 > --- a/arch/x86/kvm/svm.c > +++ b/arch/x86/kvm/svm.c > @@ -5936,13 +5936,6 @@ static void svm_set_supported_cpuid(u32 func, struct kvm_cpuid_entry2 *entry) > if (npt_enabled) > entry->edx |= F(NPT); > > - break; > - case 0x8000001F: > - /* Support memory encryption cpuid if host supports it */ > - if (boot_cpu_has(X86_FEATURE_SEV)) > - cpuid(0x8000001f, &entry->eax, &entry->ebx, > - &entry->ecx, &entry->edx); > - > } > } > Reviewed-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
On 21/11/19 21:33, Peter Gonda wrote: > Memory encryption support does not have module parameter dependencies > and can be moved into the general x86 cpuid __do_cpuid_ent function. > This changes maintains current behavior of passing through all of > CPUID.8000001F. > > Suggested-by: Jim Mattson <jmattson@google.com> > Signed-off-by: Peter Gonda <pgonda@google.com> > Reviewed-by: Jim Mattson <jmattson@google.com> > --- > arch/x86/kvm/cpuid.c | 5 +++++ > arch/x86/kvm/svm.c | 7 ------- > 2 files changed, 5 insertions(+), 7 deletions(-) > > diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c > index f68c0c753c38..946fa9cb9dd6 100644 > --- a/arch/x86/kvm/cpuid.c > +++ b/arch/x86/kvm/cpuid.c > @@ -778,6 +778,11 @@ static inline int __do_cpuid_func(struct kvm_cpuid_entry2 *entry, u32 function, > case 0x8000001a: > case 0x8000001e: > break; > + /* Support memory encryption cpuid if host supports it */ > + case 0x8000001F: > + if (!boot_cpu_has(X86_FEATURE_SEV)) > + entry->eax = entry->ebx = entry->ecx = entry->edx = 0; > + break; > /*Add support for Centaur's CPUID instruction*/ > case 0xC0000000: > /*Just support up to 0xC0000004 now*/ > diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c > index c5673bda4b66..79842329ebcd 100644 > --- a/arch/x86/kvm/svm.c > +++ b/arch/x86/kvm/svm.c > @@ -5936,13 +5936,6 @@ static void svm_set_supported_cpuid(u32 func, struct kvm_cpuid_entry2 *entry) > if (npt_enabled) > entry->edx |= F(NPT); > > - break; > - case 0x8000001F: > - /* Support memory encryption cpuid if host supports it */ > - if (boot_cpu_has(X86_FEATURE_SEV)) > - cpuid(0x8000001f, &entry->eax, &entry->ebx, > - &entry->ecx, &entry->edx); > - > } > } > > Queued patch 1, only. Paolo
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index f68c0c753c38..946fa9cb9dd6 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c @@ -778,6 +778,11 @@ static inline int __do_cpuid_func(struct kvm_cpuid_entry2 *entry, u32 function, case 0x8000001a: case 0x8000001e: break; + /* Support memory encryption cpuid if host supports it */ + case 0x8000001F: + if (!boot_cpu_has(X86_FEATURE_SEV)) + entry->eax = entry->ebx = entry->ecx = entry->edx = 0; + break; /*Add support for Centaur's CPUID instruction*/ case 0xC0000000: /*Just support up to 0xC0000004 now*/ diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index c5673bda4b66..79842329ebcd 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -5936,13 +5936,6 @@ static void svm_set_supported_cpuid(u32 func, struct kvm_cpuid_entry2 *entry) if (npt_enabled) entry->edx |= F(NPT); - break; - case 0x8000001F: - /* Support memory encryption cpuid if host supports it */ - if (boot_cpu_has(X86_FEATURE_SEV)) - cpuid(0x8000001f, &entry->eax, &entry->ebx, - &entry->ecx, &entry->edx); - } }