Jaeyong Yoo
2013-Nov-06 03:45 UTC
[PATCH v5 2/6] xen/arm: Implement get_maximum_gpfn hypercall for arm
By using the memory map info in arch_domain (from set_memory_map hypercall) implement get_maximum_gpfn hypercall. Changes from v4: Use GUEST_RAM_BASE as the start physical address of guest RAM. And, purge set-memory-map patch Singed-off-by: Evgeny Fedotov <e.fedotov@samsung.com> --- xen/arch/arm/mm.c | 22 +++++++++++++++++++++- xen/include/asm-arm/mm.h | 2 ++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index 123280e..3801f07 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -927,7 +927,11 @@ int page_is_ram_type(unsigned long mfn, unsigned long mem_type) unsigned long domain_get_maximum_gpfn(struct domain *d) { - return -ENOSYS; + paddr_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, @@ -1308,6 +1312,22 @@ int is_iomem_page(unsigned long mfn) return 1; return 0; } + +/* Guest RAM base */ +#define GUEST_RAM_BASE 0x80000000 +/* + * XXX: Use correct definition for RAM base when the following patch + * xen: arm: 64-bit guest support and domU FDT autogeneration + * will be upstreamed. + */ +void get_gma_start_end(struct domain *d, paddr_t *start, paddr_t *end) +{ + if ( start ) + *start = GUEST_RAM_BASE; + if ( end ) + *end = GUEST_RAM_BASE + ((paddr_t) d->max_pages << PAGE_SHIFT); +} + /* * Local variables: * mode: C diff --git a/xen/include/asm-arm/mm.h b/xen/include/asm-arm/mm.h index ce66099..c5cb3af 100644 --- a/xen/include/asm-arm/mm.h +++ b/xen/include/asm-arm/mm.h @@ -341,6 +341,8 @@ static inline void put_page_and_type(struct page_info *page) put_page(page); } +void get_gma_start_end(struct domain *d, paddr_t *start, paddr_t *end); + #endif /* __ARCH_ARM_MM__ */ /* * Local variables: -- 1.8.1.2 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel