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

[Xen-devel] [PATCH v4 4/9] xen/arm: Implement get_maximum_gpfn hypercall for arm



From: Evgeny Fedotov <e.fedotov@xxxxxxxxxxx>

By using the memory map info in arch_domain (from
set_memory_map hypercall) implement get_maximum_gpfn hypercall.

Singed-off-by: Evgeny Fedotov <e.fedotov@xxxxxxxxxxx>
---
 xen/arch/arm/mm.c        | 21 ++++++++++++++++++++-
 xen/include/asm-arm/mm.h |  2 ++
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index f5d9cf4..120eae8 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -918,9 +918,28 @@ int page_is_ram_type(unsigned long mfn, unsigned long 
mem_type)
     return 0;
 }
 
+void get_gma_start_end(struct domain *d, vaddr_t *start, vaddr_t *end)
+{
+    int nr_banks = d->arch.map_domain.nr_banks;
+
+    ASSERT(nr_banks != 0);
+
+    spin_lock(&d->arch.map_lock);
+    if ( start )
+        *start = d->arch.map_domain.bank[0].start;
+    if ( end )
+        *end = d->arch.map_domain.bank[nr_banks-1].start +
+               d->arch.map_domain.bank[nr_banks-1].size;
+    spin_unlock(&d->arch.map_lock);
+}
+
 unsigned long domain_get_maximum_gpfn(struct domain *d)
 {
-    return -ENOSYS;
+    vaddr_t end;
+
+    get_gma_start_end(d, NULL, &end);
+
+    return (unsigned long) (end >> PAGE_SHIFT);
 }
 
 void share_xen_page_with_guest(struct page_info *page,
diff --git a/xen/include/asm-arm/mm.h b/xen/include/asm-arm/mm.h
index 5142524..021e8d6 100644
--- a/xen/include/asm-arm/mm.h
+++ b/xen/include/asm-arm/mm.h
@@ -342,6 +342,8 @@ static inline void put_page_and_type(struct page_info *page)
     put_page(page);
 }
 
+void get_gma_start_end(struct domain *d, vaddr_t *start, vaddr_t *end);
+
 #endif /*  __ARCH_ARM_MM__ */
 /*
  * Local variables:
-- 
1.8.1.2


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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