[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] xen/arm: implement gnttab_create_shared_page and gnttab_shared_gmfn


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Tue, 19 Feb 2013 15:22:24 +0000
  • Delivery-date: Tue, 19 Feb 2013 15:22:31 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
# Date 1360935141 0
# Node ID e9c1712765cdfa6fe792ab917767f2e04e83630b
# Parent  1e168abb73b52d440f5528bdc27125df2c3e9669
xen/arm: implement gnttab_create_shared_page and gnttab_shared_gmfn

Introduce a simple pfn array, grant_table_gpfn, to keep track of the
grant table pages mapped in guest gpfn space.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Committed-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---


diff -r 1e168abb73b5 -r e9c1712765cd xen/arch/arm/domain.c
--- a/xen/arch/arm/domain.c     Fri Feb 15 13:32:20 2013 +0000
+++ b/xen/arch/arm/domain.c     Fri Feb 15 13:32:21 2013 +0000
@@ -6,6 +6,7 @@
 #include <xen/wait.h>
 #include <xen/errno.h>
 #include <xen/bitops.h>
+#include <xen/grant_table.h>
 
 #include <asm/current.h>
 #include <asm/event.h>
@@ -329,11 +330,13 @@ struct domain *alloc_domain_struct(void)
     d = alloc_xenheap_pages(0, 0);
     if ( d != NULL )
         clear_page(d);
+    d->arch.grant_table_gpfn = xmalloc_array(xen_pfn_t, max_nr_grant_frames);
     return d;
 }
 
 void free_domain_struct(struct domain *d)
 {
+    xfree(d->arch.grant_table_gpfn);
     free_xenheap_page(d);
 }
 
diff -r 1e168abb73b5 -r e9c1712765cd xen/arch/arm/mm.c
--- a/xen/arch/arm/mm.c Fri Feb 15 13:32:20 2013 +0000
+++ b/xen/arch/arm/mm.c Fri Feb 15 13:32:21 2013 +0000
@@ -595,6 +595,8 @@ static int xenmem_add_to_physmap_one(
             if ( idx < nr_grant_frames(d->grant_table) )
                 mfn = virt_to_mfn(d->grant_table->shared_raw[idx]);
         }
+        
+        d->arch.grant_table_gpfn[idx] = gpfn;
 
         spin_unlock(&d->grant_table->lock);
         break;
diff -r 1e168abb73b5 -r e9c1712765cd xen/include/asm-arm/domain.h
--- a/xen/include/asm-arm/domain.h      Fri Feb 15 13:32:20 2013 +0000
+++ b/xen/include/asm-arm/domain.h      Fri Feb 15 13:32:21 2013 +0000
@@ -39,6 +39,7 @@ struct arch_domain
 {
     struct p2m_domain p2m;
     struct hvm_domain hvm_domain;
+    xen_pfn_t *grant_table_gpfn;
 
     struct {
         /*
diff -r 1e168abb73b5 -r e9c1712765cd xen/include/asm-arm/grant_table.h
--- a/xen/include/asm-arm/grant_table.h Fri Feb 15 13:32:20 2013 +0000
+++ b/xen/include/asm-arm/grant_table.h Fri Feb 15 13:32:21 2013 +0000
@@ -15,8 +15,6 @@ int replace_grant_host_mapping(unsigned 
         unsigned long new_gpaddr, unsigned int flags);
 void gnttab_mark_dirty(struct domain *d, unsigned long l);
 #define gnttab_create_status_page(d, t, i) do {} while (0)
-#define gnttab_create_shared_page(d, t, i) do {} while (0)
-#define gnttab_shared_gmfn(d, t, i) (0)
 #define gnttab_status_gmfn(d, t, i) (0)
 #define gnttab_release_host_mappings(domain) 1
 static inline int replace_grant_supported(void)
@@ -24,6 +22,17 @@ static inline int replace_grant_supporte
     return 1;
 }
 
+#define gnttab_create_shared_page(d, t, i)                               \
+    do {                                                                 \
+        share_xen_page_with_guest(                                       \
+            virt_to_page((char *)(t)->shared_raw[i]),                    \
+            (d), XENSHARE_writable);                                     \
+    } while ( 0 )
+
+#define gnttab_shared_gmfn(d, t, i)                                      \
+    ( ((i >= nr_grant_frames(d->grant_table)) &&                         \
+     (i < max_nr_grant_frames)) ? 0 : (d->arch.grant_table_gpfn[i]))
+
 #endif /* __ASM_GRANT_TABLE_H__ */
 /*
  * Local variables:

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.