diff mbox

[25/27] x86/svm: Use guest_cpuid() rather than hvm_cpuid()

Message ID 1483533584-8015-26-git-send-email-andrew.cooper3@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andrew Cooper Jan. 4, 2017, 12:39 p.m. UTC
More work is required before LWP details can be read straight out of the
cpuid_policy block, but in the meantime hvm_cpuid() wants to disappear so
update the code to use the newer interface.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Boris Ostrovsky <boris.ostrovsky@oracle.com>
CC: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
---
 xen/arch/x86/hvm/svm/svm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Boris Ostrovsky Jan. 4, 2017, 3:26 p.m. UTC | #1
On 01/04/2017 07:39 AM, Andrew Cooper wrote:
> More work is required before LWP details can be read straight out of the
> cpuid_policy block, but in the meantime hvm_cpuid() wants to disappear so
> update the code to use the newer interface.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Jan Beulich Jan. 5, 2017, 2:04 p.m. UTC | #2
>>> On 04.01.17 at 13:39, <andrew.cooper3@citrix.com> wrote:
> More work is required before LWP details can be read straight out of the
> cpuid_policy block, but in the meantime hvm_cpuid() wants to disappear so
> update the code to use the newer interface.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>
albeit ...

> --- a/xen/arch/x86/hvm/svm/svm.c
> +++ b/xen/arch/x86/hvm/svm/svm.c
> @@ -926,17 +926,17 @@ static inline void svm_lwp_load(struct vcpu *v)
>  /* Update LWP_CFG MSR (0xc0000105). Return -1 if error; otherwise returns 0. 
> */
>  static int svm_update_lwp_cfg(struct vcpu *v, uint64_t msr_content)
>  {
> -    unsigned int edx;
> +    struct cpuid_leaf res;
>      uint32_t msr_low;
>      static uint8_t lwp_intr_vector;
>  
>      if ( xsave_enabled(v) && cpu_has_lwp )
>      {
> -        hvm_cpuid(0x8000001c, NULL, NULL, NULL, &edx);
> +        guest_cpuid(v, 0x8000001c, 0, &res);
>          msr_low = (uint32_t)msr_content;
>          
>          /* generate #GP if guest tries to turn on unsupported features. */
> -        if ( msr_low & ~edx)
> +        if ( msr_low & ~res.d)
>              return -1;

... please consider moving res into the inner scope.

Jan
diff mbox

Patch

diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 8f6737c..36c7edd 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -926,17 +926,17 @@  static inline void svm_lwp_load(struct vcpu *v)
 /* Update LWP_CFG MSR (0xc0000105). Return -1 if error; otherwise returns 0. */
 static int svm_update_lwp_cfg(struct vcpu *v, uint64_t msr_content)
 {
-    unsigned int edx;
+    struct cpuid_leaf res;
     uint32_t msr_low;
     static uint8_t lwp_intr_vector;
 
     if ( xsave_enabled(v) && cpu_has_lwp )
     {
-        hvm_cpuid(0x8000001c, NULL, NULL, NULL, &edx);
+        guest_cpuid(v, 0x8000001c, 0, &res);
         msr_low = (uint32_t)msr_content;
         
         /* generate #GP if guest tries to turn on unsupported features. */
-        if ( msr_low & ~edx)
+        if ( msr_low & ~res.d)
             return -1;
 
         v->arch.hvm_svm.guest_lwp_cfg = msr_content;