Skip to contentSkip to conversation

gnttab/ARM: properly implement gnttab_create_status_page()

PATCH In review Jan Beulich 3 participants 3 messages Aug 15, 2018 – Aug 22, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gnttab/ARM: properly implement gnttab_create_status_page()

Prevent the "BUG_ON(page_get_owner(pg) != d)" in gnttab_unpopulate_status_frames() from triggering.

---
It looks to me as if this was the only piece missing to make v2 grant tables work on ARM, but this was build tested only anyway.

xen/include/asm-arm/grant_table.h +6 -1
@@ -21,7 +21,6 @@ int create_grant_host_mapping(unsigned l
 int replace_grant_host_mapping(unsigned long gpaddr, mfn_t mfn,
                                unsigned long new_gpaddr, unsigned int flags);
 void gnttab_mark_dirty(struct domain *d, mfn_t mfn);
-#define gnttab_create_status_page(d, t, i) do {} while (0)
 #define gnttab_release_host_mappings(domain) 1
 static inline int replace_grant_supported(void)
 {
@@ -84,6 +83,12 @@ static inline unsigned int gnttab_dom0_m
             virt_to_page((char *)(t)->shared_raw[i]), d, SHARE_rw);      \
     } while ( 0 )
 
+#define gnttab_create_status_page(d, t, i)                               \
+    do {                                                                 \
+        share_xen_page_with_guest(                                       \
+            virt_to_page((char *)(t)->status[i]), d, SHARE_rw);          \
+    } while ( 0 )
+
 #define gnttab_shared_gmfn(d, t, i)                                      \
     gfn_x(((i) >= nr_grant_frames(t)) ? INVALID_GFN : (t)->arch.shared_gfn[i])
 

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

Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Jan Beulich

Prevent the "BUG_ON(page_get_owner(pg) != d)" in gnttab_unpopulate_status_frames() from triggering.

---
It looks to me as if this was the only piece missing to make v2 grant tables work on ARM, but this was build tested only anyway.

For the public records, it cannot be tested until the Linux (or other OSes functionalities) get implemented. Specifically, arch_gnttab_map_shared and arch_gnttab_map_status in Linux.

But this patch is a clear improvement on the Xen side:

Quoted 14 lines
xen/include/asm-arm/grant_table.h +0 -1
@@ -21,7 +21,6 @@ int create_grant_host_mapping(unsigned l
 int replace_grant_host_mapping(unsigned long gpaddr, mfn_t mfn,
                                unsigned long new_gpaddr, unsigned int flags);
 void gnttab_mark_dirty(struct domain *d, mfn_t mfn);
-#define gnttab_create_status_page(d, t, i) do {} while (0)
 #define gnttab_release_host_mappings(domain) 1
 static inline int replace_grant_supported(void)
 {
@@ -84,6 +83,12 @@ static inline unsigned int gnttab_dom0_m
             virt_to_page((char *)(t)->shared_raw[i]), d, SHARE_rw);      \
     } while ( 0 )

xen/include/asm-arm/grant_table.h static inline unsigned int gnttab_dom0_m · line 94

Quoted 10 lines
xen/include/asm-arm/grant_table.h +6 -0
 
+#define gnttab_create_status_page(d, t, i)                               \
+    do {                                                                 \
+        share_xen_page_with_guest(                                       \
+            virt_to_page((char *)(t)->status[i]), d, SHARE_rw);          \
+    } while ( 0 )
+
 #define gnttab_shared_gmfn(d, t, i)                                      \
     gfn_x(((i) >= nr_grant_frames(t)) ? INVALID_GFN : (t)->arch.shared_gfn[i])
 

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

#2 lore raw

Hi,

Quoted 7 lines · Stefano Stabellini
Quoted 6 lines · Jan Beulich

Prevent the "BUG_ON(page_get_owner(pg) != d)" in gnttab_unpopulate_status_frames() from triggering.

Quoted 7 lines
Quoted 3 lines

---
It looks to me as if this was the only piece missing to make v2 grant tables work on ARM, but this was build tested only anyway.

For the public records, it cannot be tested until the Linux (or other OSes functionalities) get implemented. Specifically, arch_gnttab_map_shared and arch_gnttab_map_status in Linux.

I have created XEN-115 on Jira to track the work.

Cheers,

Signature · 6 lines
Julien Grall

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