Signed-off-by: Steven Smith <steven.smith@citrix.com>
diff --git a/drivers/xen/core/gnttab.c b/drivers/xen/core/gnttab.c
-index aaf526d..1ef44d4 100644
+index aaf526d..f42aa48 100644
--- a/drivers/xen/core/gnttab.c
+++ b/drivers/xen/core/gnttab.c
@@ -53,19 +53,35 @@
+ wmb();
+ shared.v1[ref].flags = GTF_permit_access | flags;
+ } else {
-+ shared.v2[ref].frame = frame;
++ shared.v2[ref].full_page.frame = frame;
+ shared.v2[ref].hdr.domid = domid;
+ wmb();
+ shared.v2[ref].hdr.flags = GTF_permit_access | flags;
+ wmb();
+ shared.v1[ref].flags = GTF_accept_transfer;
+ } else {
-+ shared.v2[ref].frame = pfn;
++ shared.v2[ref].full_page.frame = pfn;
+ shared.v2[ref].hdr.domid = domid;
+ wmb();
+ shared.v2[ref].hdr.flags = GTF_accept_transfer;
+ if (grant_table_version == 1)
+ frame = shared.v1[ref].frame;
+ else
-+ frame = shared.v2[ref].frame;
++ frame = shared.v2[ref].full_page.frame;
+ BUG_ON(frame == 0);
+
+ return frame;
void gnttab_grant_foreign_transfer_ref(grant_ref_t, domid_t domid,
unsigned long pfn);
diff --git a/include/xen/interface/grant_table.h b/include/xen/interface/grant_table.h
-index c5c2044..20c4915 100644
+index c5c2044..2359822 100644
--- a/include/xen/interface/grant_table.h
+++ b/include/xen/interface/grant_table.h
@@ -84,12 +84,22 @@
/*
* Subflags for GTF_accept_transfer:
-@@ -149,15 +167,76 @@ typedef struct grant_entry grant_entry_t;
+@@ -149,15 +167,86 @@ typedef struct grant_entry grant_entry_t;
#define _GTF_transfer_completed (3)
#define GTF_transfer_completed (1U<<_GTF_transfer_completed)
- * Reference to a grant entry in a specified domain's grant table.
+ * Version 2 of the grant entry structure.
+ */
-+struct grant_entry_v2 {
++union grant_entry_v2 {
+ grant_entry_header_t hdr;
+ union {
+ /*
-+ * The frame to which we are granting access. This field has
-+ * the same meaning as the grant_entry_v1 field of the same
-+ * name.
++ * This member is used for V1-style full page grants, where either:
++ *
++ * -- hdr.type is GTF_accept_transfer, or
++ * -- hdr.type is GTF_permit_access and GTF_sub_page is not set.
++ *
++ * In that case, the frame field has the same semantics as the
++ * field of the same name in the V1 entry structure.
+ */
-+ uint32_t frame;
++ struct {
++ grant_entry_header_t hdr;
++ uint32_t pad0;
++ uint64_t frame;
++ } full_page;
+
+ /*
+ * If the grant type is GTF_grant_access and GTF_sub_page is
+ * [@page_off,@page_off+@length) in frame @frame.
+ */
+ struct {
-+ uint32_t frame;
++ grant_entry_header_t hdr;
+ uint16_t page_off;
+ uint16_t length;
++ uint64_t frame;
+ } sub_page;
+
+ /*
+ * to be mapped.
+ */
+ struct {
++ grant_entry_header_t hdr;
+ domid_t trans_domid;
+ uint16_t pad0;
+ grant_ref_t gref;
+ } transitive;
+
-+ uint32_t __spacer[3]; /* Pad to a power of two */
++ uint32_t __spacer[4]; /* Pad to a power of two */
+ };
+};
-+typedef struct grant_entry_v2 grant_entry_v2_t;
++typedef union grant_entry_v2 grant_entry_v2_t;
+
+typedef uint16_t grant_status_t;
+
/*
* Handle to track a mapping created via a grant reference.
-@@ -365,6 +444,46 @@ struct gnttab_unmap_and_replace {
+@@ -365,6 +454,46 @@ struct gnttab_unmap_and_replace {
typedef struct gnttab_unmap_and_replace gnttab_unmap_and_replace_t;
DEFINE_XEN_GUEST_HANDLE(gnttab_unmap_and_replace_t);