diff mbox

[RFC,4/9] x86/SVM: Modify VMCB fields to add AVIC support

Message ID 1474264368-4104-5-git-send-email-suravee.suthikulpanit@amd.com (mailing list archive)
State New, archived
Headers show

Commit Message

Suravee Suthikulpanit Sept. 19, 2016, 5:52 a.m. UTC
Introduce AVIC-related VMCB fields.

Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
---
 xen/include/asm-x86/hvm/svm/vmcb.h | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

Comments

Konrad Rzeszutek Wilk Oct. 12, 2016, 7:07 p.m. UTC | #1
On Mon, Sep 19, 2016 at 12:52:43AM -0500, Suravee Suthikulpanit wrote:
> Introduce AVIC-related VMCB fields.
> 
> Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
> ---
>  xen/include/asm-x86/hvm/svm/vmcb.h | 23 +++++++++++++++--------
>  1 file changed, 15 insertions(+), 8 deletions(-)
> 
> diff --git a/xen/include/asm-x86/hvm/svm/vmcb.h b/xen/include/asm-x86/hvm/svm/vmcb.h
> index bad2382..768e9fb 100644
> --- a/xen/include/asm-x86/hvm/svm/vmcb.h
> +++ b/xen/include/asm-x86/hvm/svm/vmcb.h
> @@ -328,14 +328,15 @@ typedef union __packed
>      struct 
>      {
>          u64 tpr:          8;
> -        u64 irq:          1;
> +        u64 irq:          1; /* disabled for avic */
>          u64 rsvd0:        7;
> -        u64 prio:         4;
> -        u64 ign_tpr:      1;
> +        u64 prio:         4; /* disabled for avic */
> +        u64 ign_tpr:      1; /* disabled for avic */
>          u64 rsvd1:        3;
>          u64 intr_masking: 1;
> -        u64 rsvd2:        7;
> -        u64 vector:       8;
> +        u64 rsvd2:        6;
> +        u64 avic_enable:  1;
> +        u64 vector:       8; /* disabled for avic */

Perhaps 'avic implicitly disables this' ?

>          u64 rsvd3:       24;
>      } fields;
>  } vintr_t;
> @@ -394,7 +395,8 @@ typedef union __packed
>          uint32_t cr2: 1;
>          /* debugctlmsr, last{branch,int}{to,from}ip */
>          uint32_t lbr: 1;
> -        uint32_t resv: 21;
> +        uint32_t avic: 1;
> +        uint32_t resv: 20;
>      } fields;
>  } vmcbcleanbits_t;
>  
> @@ -428,7 +430,8 @@ struct __packed vmcb_struct {
>      u64 exitinfo2;              /* offset 0x80 */
>      eventinj_t  exitintinfo;    /* offset 0x88 */
>      u64 _np_enable;             /* offset 0x90 - cleanbit 4 */
> -    u64 res08[2];
> +    u64 avic_vapic_bar;         /* offset 0x98 */
> +    u64 res08;                  /* offset 0xA0 */
>      eventinj_t  eventinj;       /* offset 0xA8 */
>      u64 _h_cr3;                 /* offset 0xB0 - cleanbit 4 */
>      lbrctrl_t lbr_control;      /* offset 0xB8 */
> @@ -437,7 +440,11 @@ struct __packed vmcb_struct {
>      u64 nextrip;                /* offset 0xC8 */
>      u8  guest_ins_len;          /* offset 0xD0 */
>      u8  guest_ins[15];          /* offset 0xD1 */
> -    u64 res10a[100];            /* offset 0xE0 pad to save area */
> +    u64 avic_bk_pg_pa;          /* offset 0xE0 */
> +    u64 res09a;                 /* offset 0xE8 */
> +    u64 avic_log_apic_id;       /* offset 0xF0 */
> +    u64 avic_phy_apic_id;       /* offset 0xF8 */
> +    u64 res09b[96];             /* offset 0x100 pad to save area */
>  

Otherwise:

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

>      svm_segment_register_t es;  /* offset 1024 - cleanbit 8 */
>      svm_segment_register_t cs;  /* cleanbit 8 */
> -- 
> 1.9.1
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> https://lists.xen.org/xen-devel
Jan Beulich Dec. 22, 2016, 11:11 a.m. UTC | #2
>>> On 19.09.16 at 07:52, <suravee.suthikulpanit@amd.com> wrote:
> --- a/xen/include/asm-x86/hvm/svm/vmcb.h
> +++ b/xen/include/asm-x86/hvm/svm/vmcb.h
> @@ -328,14 +328,15 @@ typedef union __packed
>      struct 
>      {
>          u64 tpr:          8;
> -        u64 irq:          1;
> +        u64 irq:          1; /* disabled for avic */
>          u64 rsvd0:        7;
> -        u64 prio:         4;
> -        u64 ign_tpr:      1;
> +        u64 prio:         4; /* disabled for avic */
> +        u64 ign_tpr:      1; /* disabled for avic */
>          u64 rsvd1:        3;
>          u64 intr_masking: 1;
> -        u64 rsvd2:        7;
> -        u64 vector:       8;
> +        u64 rsvd2:        6;
> +        u64 avic_enable:  1;
> +        u64 vector:       8; /* disabled for avic */

For all of these, do you perhaps mean "ignored" instead of
"disabled"?

Jan
Suravee Suthikulpanit Dec. 26, 2016, 5:55 a.m. UTC | #3
On 12/22/16 18:11, Jan Beulich wrote:
>>>> On 19.09.16 at 07:52, <suravee.suthikulpanit@amd.com> wrote:
>> --- a/xen/include/asm-x86/hvm/svm/vmcb.h
>> +++ b/xen/include/asm-x86/hvm/svm/vmcb.h
>> @@ -328,14 +328,15 @@ typedef union __packed
>>      struct
>>      {
>>          u64 tpr:          8;
>> -        u64 irq:          1;
>> +        u64 irq:          1; /* disabled for avic */
>>          u64 rsvd0:        7;
>> -        u64 prio:         4;
>> -        u64 ign_tpr:      1;
>> +        u64 prio:         4; /* disabled for avic */
>> +        u64 ign_tpr:      1; /* disabled for avic */
>>          u64 rsvd1:        3;
>>          u64 intr_masking: 1;
>> -        u64 rsvd2:        7;
>> -        u64 vector:       8;
>> +        u64 rsvd2:        6;
>> +        u64 avic_enable:  1;
>> +        u64 vector:       8; /* disabled for avic */
>
> For all of these, do you perhaps mean "ignored" instead of
> "disabled"?
>
> Jan
>

Yes, I'm fixing the comment here in my next patch.

S
diff mbox

Patch

diff --git a/xen/include/asm-x86/hvm/svm/vmcb.h b/xen/include/asm-x86/hvm/svm/vmcb.h
index bad2382..768e9fb 100644
--- a/xen/include/asm-x86/hvm/svm/vmcb.h
+++ b/xen/include/asm-x86/hvm/svm/vmcb.h
@@ -328,14 +328,15 @@  typedef union __packed
     struct 
     {
         u64 tpr:          8;
-        u64 irq:          1;
+        u64 irq:          1; /* disabled for avic */
         u64 rsvd0:        7;
-        u64 prio:         4;
-        u64 ign_tpr:      1;
+        u64 prio:         4; /* disabled for avic */
+        u64 ign_tpr:      1; /* disabled for avic */
         u64 rsvd1:        3;
         u64 intr_masking: 1;
-        u64 rsvd2:        7;
-        u64 vector:       8;
+        u64 rsvd2:        6;
+        u64 avic_enable:  1;
+        u64 vector:       8; /* disabled for avic */
         u64 rsvd3:       24;
     } fields;
 } vintr_t;
@@ -394,7 +395,8 @@  typedef union __packed
         uint32_t cr2: 1;
         /* debugctlmsr, last{branch,int}{to,from}ip */
         uint32_t lbr: 1;
-        uint32_t resv: 21;
+        uint32_t avic: 1;
+        uint32_t resv: 20;
     } fields;
 } vmcbcleanbits_t;
 
@@ -428,7 +430,8 @@  struct __packed vmcb_struct {
     u64 exitinfo2;              /* offset 0x80 */
     eventinj_t  exitintinfo;    /* offset 0x88 */
     u64 _np_enable;             /* offset 0x90 - cleanbit 4 */
-    u64 res08[2];
+    u64 avic_vapic_bar;         /* offset 0x98 */
+    u64 res08;                  /* offset 0xA0 */
     eventinj_t  eventinj;       /* offset 0xA8 */
     u64 _h_cr3;                 /* offset 0xB0 - cleanbit 4 */
     lbrctrl_t lbr_control;      /* offset 0xB8 */
@@ -437,7 +440,11 @@  struct __packed vmcb_struct {
     u64 nextrip;                /* offset 0xC8 */
     u8  guest_ins_len;          /* offset 0xD0 */
     u8  guest_ins[15];          /* offset 0xD1 */
-    u64 res10a[100];            /* offset 0xE0 pad to save area */
+    u64 avic_bk_pg_pa;          /* offset 0xE0 */
+    u64 res09a;                 /* offset 0xE8 */
+    u64 avic_log_apic_id;       /* offset 0xF0 */
+    u64 avic_phy_apic_id;       /* offset 0xF8 */
+    u64 res09b[96];             /* offset 0x100 pad to save area */
 
     svm_segment_register_t es;  /* offset 1024 - cleanbit 8 */
     svm_segment_register_t cs;  /* cleanbit 8 */