Skip to contentSkip to conversation

(remainder of) viridian cleanup

PATCH In review Paul Durrant 4 participants 14 messages Nov 7, 2018 – Nov 9, 2018

lore
Share & tools
lore
#0 lore raw

v3 cover (remainder of) viridian cleanup

I plan to add implementations for more viridian enlightenments in the near future. This series is the remainder, since v2, of the cleanup I've been doing in preparation.

Paul Durrant (5):
viridian: separate interrupt related enlightenment implementations...
viridian: separate time related enlightenment implementations...
viridian: define type for the 'virtual VP assist page' tools/misc: fix hard tabs in xen-hvmctx.c
viridian: introduce struct viridian_page

 tools/misc/xen-hvmctx.c                |  18 +-
 xen/arch/x86/hvm/viridian/Makefile     |   2 +
 xen/arch/x86/hvm/viridian/private.h    | 105 ++++++++
 xen/arch/x86/hvm/viridian/synic.c      | 176 +++++++++++++
 xen/arch/x86/hvm/viridian/time.c       | 244 +++++++++++++++++
 xen/arch/x86/hvm/viridian/viridian.c   | 460 ++++++---------------------------
 xen/include/asm-x86/hvm/viridian.h     |  22 +-
 xen/include/public/arch-x86/hvm/save.h |   2 +-
 8 files changed, 625 insertions(+), 404 deletions(-)
 create mode 100644 xen/arch/x86/hvm/viridian/private.h
 create mode 100644 xen/arch/x86/hvm/viridian/synic.c
 create mode 100644 xen/arch/x86/hvm/viridian/time.c
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#5 lore raw

PATCH v3 3/5 viridian: define type for the 'virtual VP assist page'

The specification [1] defines a type so we should use it, rather than just OR-ing and AND-ing magic bits.

No functional change.

NOTE: The type defined in the specification does include an anonymous
sub-struct in the page type but, as we currently use only the first element, the struct declaration has been omitted.

[1] https://github.com/MicrosoftDocs/Virtualization-Documentation/raw/live/tlfs/Hypervisor%20Top%20Level%20Functional%20Specification%20v5.0C.pdf

---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>

v3:
- Move the typedef of HV_VP_ASSIST_PAGE into viridian.h so that it can be used in the declaration of struct viridian_vcpu

---
 xen/arch/x86/hvm/viridian/synic.c  | 52 +++++++++++++++++++++++---------------
 xen/include/asm-x86/hvm/viridian.h |  4 ++-
 2 files changed, 35 insertions(+), 21 deletions(-)
xen/arch/x86/hvm/viridian/synic.c +32 -20
index 366608208f..d8d6f6e1c9 100644
@@ -16,6 +16,18 @@
 
 #include "private.h"
 
+typedef struct _HV_VIRTUAL_APIC_ASSIST
+{
+    uint32_t no_eoi:1;
+    uint32_t reserved_zero:31;
+} HV_VIRTUAL_APIC_ASSIST;
+
+union _HV_VP_ASSIST_PAGE
+{
+    HV_VIRTUAL_APIC_ASSIST ApicAssist;
+    uint8_t ReservedZBytePadding[PAGE_SIZE];
+};
+
 static void dump_vp_assist(const struct vcpu *v)
 {
     const union viridian_page_msr *va = &v->arch.hvm.viridian.vp_assist.msr;
@@ -32,9 +44,9 @@ static void initialize_vp_assist(struct vcpu *v)
     struct domain *d = v->domain;
     unsigned long gmfn = v->arch.hvm.viridian.vp_assist.msr.fields.pfn;
     struct page_info *page = get_page_from_gfn(d, gmfn, NULL, P2M_ALLOC);
-    void *va;
+    HV_VP_ASSIST_PAGE *ptr;
 
-    ASSERT(!v->arch.hvm.viridian.vp_assist.va);
+    ASSERT(!v->arch.hvm.viridian.vp_assist.ptr);
 
     if ( !page )
         goto fail;
@@ -45,16 +57,16 @@ static void initialize_vp_assist(struct vcpu *v)
         goto fail;
     }
 
-    va = __map_domain_page_global(page);
-    if ( !va )
+    ptr = __map_domain_page_global(page);
+    if ( !ptr )
     {
         put_page_and_type(page);
         goto fail;
     }
 
-    clear_page(va);
+    clear_page(ptr);
 
-    v->arch.hvm.viridian.vp_assist.va = va;
+    v->arch.hvm.viridian.vp_assist.ptr = ptr;
     return;
 
  fail:
@@ -64,25 +76,25 @@ static void initialize_vp_assist(struct vcpu *v)
 
 static void teardown_vp_assist(struct vcpu *v)
 {
-    void *va = v->arch.hvm.viridian.vp_assist.va;
+    HV_VP_ASSIST_PAGE *ptr = v->arch.hvm.viridian.vp_assist.ptr;
     struct page_info *page;
 
-    if ( !va )
+    if ( !ptr )
         return;
 
-    v->arch.hvm.viridian.vp_assist.va = NULL;
+    v->arch.hvm.viridian.vp_assist.ptr = NULL;
 
-    page = mfn_to_page(domain_page_map_to_mfn(va));
+    page = mfn_to_page(domain_page_map_to_mfn(ptr));
 
-    unmap_domain_page_global(va);
+    unmap_domain_page_global(ptr);
     put_page_and_type(page);
 }
 
 void viridian_apic_assist_set(struct vcpu *v)
 {
-    uint32_t *va = v->arch.hvm.viridian.vp_assist.va;
+    HV_VP_ASSIST_PAGE *ptr = v->arch.hvm.viridian.vp_assist.ptr;
 
-    if ( !va )
+    if ( !ptr )
         return;
 
     /*
@@ -94,18 +106,18 @@ void viridian_apic_assist_set(struct vcpu *v)
         domain_crash(v->domain);
 
     v->arch.hvm.viridian.vp_assist.pending = true;
-    *va |= 1u;
+    ptr->ApicAssist.no_eoi = 1;
 }
 
 bool viridian_apic_assist_completed(struct vcpu *v)
 {
-    uint32_t *va = v->arch.hvm.viridian.vp_assist.va;
+    HV_VP_ASSIST_PAGE *ptr = v->arch.hvm.viridian.vp_assist.ptr;
 
-    if ( !va )
+    if ( !ptr )
         return false;
 
     if ( v->arch.hvm.viridian.vp_assist.pending &&
-         !(*va & 1u) )
+         !ptr->ApicAssist.no_eoi )
     {
         /* An EOI has been avoided */
         v->arch.hvm.viridian.vp_assist.pending = false;
@@ -117,12 +129,12 @@ bool viridian_apic_assist_completed(struct vcpu *v)
 
 void viridian_apic_assist_clear(struct vcpu *v)
 {
-    uint32_t *va = v->arch.hvm.viridian.vp_assist.va;
+    HV_VP_ASSIST_PAGE *ptr = v->arch.hvm.viridian.vp_assist.ptr;
 
-    if ( !va )
+    if ( !ptr )
         return;
 
-    *va &= ~1u;
+    ptr->ApicAssist.no_eoi = 0;
     v->arch.hvm.viridian.vp_assist.pending = false;
 }
 
xen/include/asm-x86/hvm/viridian.h +3 -1
index 5ff83a46e5..22f14a526e 100644
@@ -20,11 +20,13 @@ union viridian_page_msr
     } fields;
 };
 
+typedef union _HV_VP_ASSIST_PAGE HV_VP_ASSIST_PAGE;
+
 struct viridian_vcpu
 {
     struct {
         union viridian_page_msr msr;
-        void *va;
+        HV_VP_ASSIST_PAGE *ptr;
         bool pending;
     } vp_assist;
     uint64_t crash_param[5];
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#10 lore raw

PATCH v3 4/5 tools/misc: fix hard tabs in xen-hvmctx.c

In reply to Paul Durrant

Also add emacs boilerplate to avoid future problems.

Purely cosmetic. No functional change.

---
Cc: Ian Jackson <[email protected]>

v2:
- New in v2

---
 tools/misc/xen-hvmctx.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
tools/misc/xen-hvmctx.c +13 -3
index 40e77851be..823aa7d736 100644
@@ -371,8 +371,8 @@ static void dump_viridian_vcpu(void)
     HVM_SAVE_TYPE(VIRIDIAN_VCPU) p;
     READ(p);
     printf("    VIRIDIAN_VCPU: vp_assist_msr 0x%llx, vp_assist_pending %s\n",
-	   (unsigned long long) p.vp_assist_msr,
-	   p.vp_assist_pending ? "true" : "false");
+           (unsigned long long) p.vp_assist_msr,
+           p.vp_assist_pending ? "true" : "false");
 }
 
 static void dump_vmce_vcpu(void)
@@ -468,4 +468,14 @@ int main(int argc, char **argv)
     } while ( desc.typecode != HVM_SAVE_CODE(END) && off < len );
 
     return 0;
-} 
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#3 lore raw

PATCH v3 2/5 viridian: separate time related enlightenment implementations...

In reply to Paul Durrant

...into new 'time' module.

This patch reduces the size of the main viridian source module by moving time related enlightenments into their own source module. This is done in anticipation of implementation of more such enightenments and a desire to not further lengthen the main source module when this work is done.

While moving the code:

- Move the declaration of HV_REFERENCE_TSC_PAGE from the header file into the new source module, since it is only used there.
- Clean up a bool_t.

---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>

v3:
- Use new private header to host function prototypes

v2:
- Sort headers alphabetically and separate asm/ amd xen/ sections
- Constify domain context during load

---
 xen/arch/x86/hvm/viridian/Makefile   |   1 +
 xen/arch/x86/hvm/viridian/private.h  |   8 ++
 xen/arch/x86/hvm/viridian/time.c     | 244 +++++++++++++++++++++++++++++++++++
 xen/arch/x86/hvm/viridian/viridian.c | 174 +------------------------
 xen/include/asm-x86/hvm/viridian.h   |   9 --
 5 files changed, 260 insertions(+), 176 deletions(-)
 create mode 100644 xen/arch/x86/hvm/viridian/time.c
xen/arch/x86/hvm/viridian/Makefile +1 -0
index fca8e16e20..3ecdffe2f6 100644
@@ -1,2 +1,3 @@
 obj-y += synic.o
+obj-y += time.o
 obj-y += viridian.o
xen/arch/x86/hvm/viridian/private.h +8 -0
index 5b4992d118..a5e06f9866 100644
@@ -79,6 +79,14 @@ void viridian_synic_save_vcpu_ctxt(const struct vcpu *v,
 void viridian_synic_load_vcpu_ctxt(
     struct vcpu *v, const struct hvm_viridian_vcpu_context *ctxt);
 
+int viridian_time_wrmsr(struct vcpu *v, uint32_t idx, uint64_t val);
+int viridian_time_rdmsr(const struct vcpu *v, uint32_t idx, uint64_t *val);
+
+void viridian_time_save_domain_ctxt(
+    const struct domain *d, struct hvm_viridian_domain_context *ctxt);
+void viridian_time_load_domain_ctxt(
+    struct domain *d, const struct hvm_viridian_domain_context *ctxt);
+
 #endif /* X86_HVM_VIRIDIAN_PRIVATE_H */
 
 /*
xen/arch/x86/hvm/viridian/time.c new file +244 -0

244 lines not on this page · raw message

xen/arch/x86/hvm/viridian/viridian.c +7 -167

234 lines not on this page · raw message

xen/include/asm-x86/hvm/viridian.h +0 -9
index 359fdf5a83..5ff83a46e5 100644
@@ -57,15 +57,6 @@ struct viridian_time_ref_count
     int64_t off;
 };
 
-typedef struct _HV_REFERENCE_TSC_PAGE
-{
-    uint32_t TscSequence;
-    uint32_t Reserved1;
-    uint64_t TscScale;
-    int64_t  TscOffset;
-    uint64_t Reserved2[509];
-} HV_REFERENCE_TSC_PAGE, *PHV_REFERENCE_TSC_PAGE;
-
 struct viridian_domain
 {
     union viridian_guest_os_id_msr guest_os_id;
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw

PATCH v3 1/5 viridian: separate interrupt related enlightenment implementations...

In reply to Paul Durrant

...into new 'synic' module.

The SynIC (synthetic interrupt controller) is specified [1] to be a super- set of a virtualized LAPIC, and its definition encompasses all enlightenments related to virtual interrupt control.

This patch reduces the size of the main viridian source module by giving these enlightenments their own module. This is done in anticipation of implementation of more such enlightenments and a desire not to further lengthen then main source module when this work is done.

Whilst moving the code:

- Fix various style issues.
- Move the MSR definitions into the header (since they are now needed in more than one source module).

[1] https://github.com/MicrosoftDocs/Virtualization-Documentation/raw/live/tlfs/Hypervisor%20Top%20Level%20Functional%20Specification%20v5.0C.pdf

---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>

v3:
- Add new private header file to host MSR definitions and local function prototypes
- Adding Wei's R-b since the changes from v2 are just further code movement

v2:
- Sort headers alphabetically and separate asm/ amd xen/ sections
- Constify vcpu context during load

---
 xen/arch/x86/hvm/viridian/Makefile   |   1 +
 xen/arch/x86/hvm/viridian/private.h  |  92 ++++++++++++++
 xen/arch/x86/hvm/viridian/synic.c    | 224 ++++++++++++++++++++++++++++++++++
 xen/arch/x86/hvm/viridian/viridian.c | 229 ++---------------------------------
 4 files changed, 328 insertions(+), 218 deletions(-)
 create mode 100644 xen/arch/x86/hvm/viridian/private.h
 create mode 100644 xen/arch/x86/hvm/viridian/synic.c
xen/arch/x86/hvm/viridian/Makefile +1 -0
index 09fd0a5f3c..fca8e16e20 100644
@@ -1 +1,2 @@
+obj-y += synic.o
 obj-y += viridian.o
xen/arch/x86/hvm/viridian/private.h new file +92 -0

92 lines not on this page · raw message

xen/arch/x86/hvm/viridian/synic.c new file +224 -0

224 lines not on this page · raw message

xen/arch/x86/hvm/viridian/viridian.c +11 -218

292 lines not on this page · raw message

Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#13 lore raw

PATCH v3 5/5 viridian: introduce struct viridian_page

In reply to Paul Durrant

The 'vp_assist' page is currently an example of a guest page which needs to be kept mapped throughout the life-time of a guest, but there are other such examples in the specifiction [1]. This patch therefore introduces a generic 'viridian_page' type and converts the current vp_assist/apic_assist related code to use it. Subsequent patches implementing other enlightments can then also make use of it.

This patch also renames the 'vp_assist_pending' field in struct hvm_viridian_vcpu_context to 'apic_assist_pending' to more accurately reflect its meaning. The term 'vp_assist' applies to the whole page rather than just the EOI-avoidance enlightenment. New versons of the specification have defined data structures for other enlightenments within the same page.

No functional change.

[1] https://github.com/MicrosoftDocs/Virtualization-Documentation/raw/live/tlfs/Hypervisor%20Top%20Level%20Functional%20Specification%20v5.0C.pdf

---
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>

v3:
- Move the typedef of HV_VP_ASSIST_PAGE back into synic.c after re- location in eariler patch
- Move init and teardown functions into viridian.c now that they are more generic, and use map/unmap naming to better reflect what they do
- Drop unnecessary !!

---
 tools/misc/xen-hvmctx.c                |  4 +-
 xen/arch/x86/hvm/viridian/private.h    |  5 ++
 xen/arch/x86/hvm/viridian/synic.c      | 90 ++++++----------------------------
 xen/arch/x86/hvm/viridian/viridian.c   | 57 +++++++++++++++++++++
 xen/include/asm-x86/hvm/viridian.h     | 13 ++---
 xen/include/public/arch-x86/hvm/save.h |  2 +-
 6 files changed, 87 insertions(+), 84 deletions(-)
tools/misc/xen-hvmctx.c +2 -2
index 823aa7d736..4f336a6cea 100644
@@ -370,9 +370,9 @@ static void dump_viridian_vcpu(void)
 {
     HVM_SAVE_TYPE(VIRIDIAN_VCPU) p;
     READ(p);
-    printf("    VIRIDIAN_VCPU: vp_assist_msr 0x%llx, vp_assist_pending %s\n",
+    printf("    VIRIDIAN_VCPU: vp_assist_msr 0x%llx, apic_assist_pending %s\n",
            (unsigned long long) p.vp_assist_msr,
-           p.vp_assist_pending ? "true" : "false");
+           p.apic_assist_pending ? "true" : "false");
 }
 
 static void dump_vmce_vcpu(void)
xen/arch/x86/hvm/viridian/private.h +5 -0
index a5e06f9866..398b22f12d 100644
@@ -87,6 +87,11 @@ void viridian_time_save_domain_ctxt(
 void viridian_time_load_domain_ctxt(
     struct domain *d, const struct hvm_viridian_domain_context *ctxt);
 
+void viridian_dump_guest_page(const struct vcpu *v, const char *name,
+                              const struct viridian_page *vp);
+void viridian_map_guest_page(struct vcpu *v, struct viridian_page *vp);
+void viridian_unmap_guest_page(struct viridian_page *vp);
+
 #endif /* X86_HVM_VIRIDIAN_PRIVATE_H */
 
 /*
xen/arch/x86/hvm/viridian/synic.c +15 -75

143 lines not on this page · raw message

xen/arch/x86/hvm/viridian/viridian.c +57 -0

63 lines not on this page · raw message

xen/include/asm-x86/hvm/viridian.h +7 -6
index 22f14a526e..ec5ef8d3f9 100644
@@ -20,15 +20,16 @@ union viridian_page_msr
     } fields;
 };
 
-typedef union _HV_VP_ASSIST_PAGE HV_VP_ASSIST_PAGE;
+struct viridian_page
+{
+    union viridian_page_msr msr;
+    void *ptr;
+};
 
 struct viridian_vcpu
 {
-    struct {
-        union viridian_page_msr msr;
-        HV_VP_ASSIST_PAGE *ptr;
-        bool pending;
-    } vp_assist;
+    struct viridian_page vp_assist;
+    bool apic_assist_pending;
     uint64_t crash_param[5];
 };
 
xen/include/public/arch-x86/hvm/save.h +1 -1
index 4691d4d4aa..80e762c335 100644
@@ -600,7 +600,7 @@ DECLARE_HVM_SAVE_TYPE(VIRIDIAN_DOMAIN, 15, struct hvm_viridian_domain_context);
 
 struct hvm_viridian_vcpu_context {
     uint64_t vp_assist_msr;
-    uint8_t  vp_assist_pending;
+    uint8_t  apic_assist_pending;
     uint8_t  _pad[7];
 };
 
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Reviewed-by on v3 1/5
#2 lore raw

Re: [PATCH v3 1/5] viridian: separate interrupt related enlightenment implementations...

In reply to Paul Durrant
Quoted 13 lines · Paul Durrant

...into new 'synic' module.

The SynIC (synthetic interrupt controller) is specified [1] to be a super- set of a virtualized LAPIC, and its definition encompasses all enlightenments related to virtual interrupt control.

This patch reduces the size of the main viridian source module by giving these enlightenments their own module. This is done in anticipation of implementation of more such enlightenments and a desire not to further lengthen then main source module when this work is done.

Whilst moving the code:

Quoted 8 lines

- Fix various style issues.
- Move the MSR definitions into the header (since they are now needed in more than one source module).

[1] https://github.com/MicrosoftDocs/Virtualization-Documentation/raw/live/tlfs/Hypervisor%20Top%20Level%20Functional%20Specification%20v5.0C.pdf

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reviewed-by on v3 2/5
#4 lore raw

Re: [PATCH v3 2/5] viridian: separate time related enlightenment implementations...

In reply to Paul Durrant
Quoted 8 lines · Paul Durrant

...into new 'time' module.

This patch reduces the size of the main viridian source module by moving time related enlightenments into their own source module. This is done in anticipation of implementation of more such enightenments and a desire to not further lengthen the main source module when this work is done.

Quoted 8 lines

While moving the code:

- Move the declaration of HV_REFERENCE_TSC_PAGE from the header file into the new source module, since it is only used there.
- Clean up a bool_t.

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reviewed-by on v3 3/5
#6 lore raw

Re: [PATCH v3 3/5] viridian: define type for the 'virtual VP assist page'

In reply to Paul Durrant
Quoted 5 lines · Paul Durrant

The specification [1] defines a type so we should use it, rather than just OR-ing and AND-ing magic bits.

No functional change.

Quoted 8 lines

NOTE: The type defined in the specification does include an anonymous
sub-struct in the page type but, as we currently use only the first element, the struct declaration has been omitted.

[1] https://github.com/MicrosoftDocs/Virtualization-Documentation/raw/live/tlfs/Hypervisor%20Top%20Level%20Functional%20Specification%20v5.0C.pdf

Just one style nit below...

Quoted 21 lines

---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>

v3:
- Move the typedef of HV_VP_ASSIST_PAGE into viridian.h so that it can be used in the declaration of struct viridian_vcpu

---
 xen/arch/x86/hvm/viridian/synic.c  | 52 +++++++++++++++++++++++---------------
 xen/include/asm-x86/hvm/viridian.h |  4 ++-
 2 files changed, 35 insertions(+), 21 deletions(-)
xen/arch/x86/hvm/viridian/synic.c +1 -0
index 366608208f..d8d6f6e1c9 100644
@@ -16,6 +16,18 @@
 
 #include "private.h"
 
+typedef struct _HV_VIRTUAL_APIC_ASSIST

xen/arch/x86/hvm/viridian/synic.c line 29

Quoted 10 lines
xen/arch/x86/hvm/viridian/synic.c +10 -0
+{
+    uint32_t no_eoi:1;
+    uint32_t reserved_zero:31;
+} HV_VIRTUAL_APIC_ASSIST;
+
+union _HV_VP_ASSIST_PAGE
+{
+    HV_VIRTUAL_APIC_ASSIST ApicAssist;
+    uint8_t ReservedZBytePadding[PAGE_SIZE];
+};

One struct uses CamelCase for fields while the other just uses underscores. I think it would be better to use a single style.

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#7 lore raw

Re: [PATCH v3 3/5] viridian: define type for the 'virtual VP assist page'

Quoted 54 lines

-----Original Message-----
From: Roger Pau Monne
Sent: 07 November 2018 11:49
To: Paul Durrant <[email protected]>
Cc: [email protected]; Andrew Cooper <[email protected]>; Jan Beulich <[email protected]>
Subject: Re: [Xen-devel] [PATCH v3 3/5] viridian: define type for the 'virtual VP assist page'

Quoted 1 line · Paul Durrant

The specification [1] defines a type so we should use it, rather than

just

Quoted 6 lines

OR-ing and AND-ing magic bits.

No functional change.

NOTE: The type defined in the specification does include an anonymous
sub-struct in the page type but, as we currently use only the

first

Quoted 3 lines

element, the struct declaration has been omitted.

[1] https://github.com/MicrosoftDocs/Virtualization-

Documentation/raw/live/tlfs/Hypervisor%20Top%20Level%20Functional%20Specif ication%20v5.0C.pdf

Quoted 3 lines

Just one style nit below...

Quoted 9 lines

---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>

v3:
- Move the typedef of HV_VP_ASSIST_PAGE into viridian.h so that it can be used in the declaration of struct viridian_vcpu

---
 xen/arch/x86/hvm/viridian/synic.c  | 52 +++++++++++++++++++++++--------

-------

Review

Quoted 4 lines
 xen/include/asm-x86/hvm/viridian.h |  4 ++-
 2 files changed, 35 insertions(+), 21 deletions(-)
(quoted diff) +0 -0

b/xen/arch/x86/hvm/viridian/synic.c

Quoted 7 lines

index 366608208f..d8d6f6e1c9 100644

xen/arch/x86/hvm/viridian/synic.c +0 -0
@@ -16,6 +16,18 @@
 
 #include "private.h"
 
Quoted 15 lines

xen/arch/x86/hvm/viridian/synic.c line 29

Quoted 11 lines
xen/arch/x86/hvm/viridian/synic.c +11 -0
+typedef struct _HV_VIRTUAL_APIC_ASSIST
+{
+    uint32_t no_eoi:1;
+    uint32_t reserved_zero:31;
+} HV_VIRTUAL_APIC_ASSIST;
+
+union _HV_VP_ASSIST_PAGE
+{
+    HV_VIRTUAL_APIC_ASSIST ApicAssist;
+    uint8_t ReservedZBytePadding[PAGE_SIZE];
+};

One struct uses CamelCase for fields while the other just uses underscores. I think it would be better to use a single style.

That is deliberate. There is no struct definition in the spec. only the name. Thus the field names are ones I have invented based on the text, rather than being 'official'. I reserve CamelCase for the 'official' names :-)

Paul

Quoted 1 line

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#11 lore raw

Re: [PATCH v3 4/5] tools/misc: fix hard tabs in xen-hvmctx.c

In reply to Paul Durrant
Quoted 6 lines · Paul Durrant

Also add emacs boilerplate to avoid future problems.

Purely cosmetic. No functional change.

I have pushed this patch to staging.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#12 lore raw

Re: [PATCH v3 4/5] tools/misc: fix hard tabs in xen-hvmctx.c

Quoted 10 lines

-----Original Message-----
From: Wei Liu [mailto:[email protected]]
Sent: 07 November 2018 13:09
To: Paul Durrant <[email protected]>
Cc: [email protected]; Ian Jackson <[email protected]>; Wei Liu <[email protected]>
Subject: Re: [Xen-devel] [PATCH v3 4/5] tools/misc: fix hard tabs in xen- hvmctx.c

On Wed, Nov 07, 2018 at 10:52:22AM +0000, Paul Durrant wrote:

Quoted 8 lines
Quoted 6 lines

Also add emacs boilerplate to avoid future problems.

Purely cosmetic. No functional change.

I have pushed this patch to staging.

Thanks :-)

Paul

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#8 lore raw

Re: [PATCH v3 3/5] viridian: define type for the 'virtual VP assist page'

In reply to Paul Durrant
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 07.11.18 at 11:52, <[email protected]> wrote:
xen/include/asm-x86/hvm/viridian.h +1 -0
@@ -20,11 +20,13 @@ union viridian_page_msr
     } fields;
 };
 
+typedef union _HV_VP_ASSIST_PAGE HV_VP_ASSIST_PAGE;

xen/include/asm-x86/hvm/viridian.h union viridian_page_msr · line 32

Quoted 10 lines
xen/include/asm-x86/hvm/viridian.h +2 -1
+
 struct viridian_vcpu
 {
     struct {
         union viridian_page_msr msr;
-        void *va;
+        HV_VP_ASSIST_PAGE *ptr;
         bool pending;
     } vp_assist;
     uint64_t crash_param[5];

I'll commit this as is, but even better would have been to avoid having the typedef here (visible to everyone).

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#9 lore raw

Re: [PATCH v3 3/5] viridian: define type for the 'virtual VP assist page'

Quoted 16 lines

-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: 09 November 2018 10:24
To: Paul Durrant <[email protected]>
Cc: Andrew Cooper <[email protected]>; xen-devel <xen- [email protected]>
Subject: Re: [PATCH v3 3/5] viridian: define type for the 'virtual VP assist page'

Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 07.11.18 at 11:52, <[email protected]> wrote:
xen/include/asm-x86/hvm/viridian.h +0 -0
@@ -20,11 +20,13 @@ union viridian_page_msr
     } fields;
 };
 
Quoted 15 lines

xen/include/asm-x86/hvm/viridian.h union viridian_page_msr · line 32

Quoted 11 lines
xen/include/asm-x86/hvm/viridian.h +3 -1
+typedef union _HV_VP_ASSIST_PAGE HV_VP_ASSIST_PAGE;
+
 struct viridian_vcpu
 {
     struct {
         union viridian_page_msr msr;
-        void *va;
+        HV_VP_ASSIST_PAGE *ptr;
         bool pending;
     } vp_assist;
     uint64_t crash_param[5];

I'll commit this as is, but even better would have been to avoid having the typedef here (visible to everyone).

It goes away in the next patch anyway, when the generalized guest_page is introduced.

Paul

Quoted 2 lines

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel