Message ID | 1397148539-19084-3-git-send-email-w1.huang@samsung.com |
---|---|
State | New |
Headers | show |
On 10/04/14 17:48, Wei Huang wrote: > From: Jaeyong Yoo <jaeyong.yoo@samsung.com> > > This patchi implements get_maximum_gpfn by using the memory map > info in arch_domain (from set_memory_map hypercall). > > Signed-off-by: Evgeny Fedotov <e.fedotov@samsung.com> Common implementation and a specific arch_get_maximum_gpfn() ? ~Andrew > --- > xen/arch/arm/mm.c | 19 ++++++++++++++++++- > xen/include/asm-arm/mm.h | 2 ++ > 2 files changed, 20 insertions(+), 1 deletion(-) > > diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c > index 362bc8d..14b4686 100644 > --- a/xen/arch/arm/mm.c > +++ b/xen/arch/arm/mm.c > @@ -947,7 +947,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, > @@ -1235,6 +1239,19 @@ int is_iomem_page(unsigned long mfn) > return 1; > return 0; > } > + > +/* > + * Return start and end addresses of guest > + */ > +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 b8d4e7d..341493a 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:
On 04/10/2014 12:28 PM, Andrew Cooper wrote: > On 10/04/14 17:48, Wei Huang wrote: >> From: Jaeyong Yoo <jaeyong.yoo@samsung.com> >> >> This patchi implements get_maximum_gpfn by using the memory map >> info in arch_domain (from set_memory_map hypercall). >> >> Signed-off-by: Evgeny Fedotov <e.fedotov@samsung.com> > > Common implementation and a specific arch_get_maximum_gpfn() ? > > ~Andrew Yes, will do. > >> --- >> xen/arch/arm/mm.c | 19 ++++++++++++++++++- >> xen/include/asm-arm/mm.h | 2 ++ >> 2 files changed, 20 insertions(+), 1 deletion(-) >> >> diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c >> index 362bc8d..14b4686 100644 >> --- a/xen/arch/arm/mm.c >> +++ b/xen/arch/arm/mm.c >> @@ -947,7 +947,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, >> @@ -1235,6 +1239,19 @@ int is_iomem_page(unsigned long mfn) >> return 1; >> return 0; >> } >> + >> +/* >> + * Return start and end addresses of guest >> + */ >> +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 b8d4e7d..341493a 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: > >
Hello Wei, On 04/10/2014 05:48 PM, Wei Huang wrote: > From: Jaeyong Yoo <jaeyong.yoo@samsung.com> > > This patchi implements get_maximum_gpfn by using the memory map > info in arch_domain (from set_memory_map hypercall). > > Signed-off-by: Evgeny Fedotov <e.fedotov@samsung.com> > --- > xen/arch/arm/mm.c | 19 ++++++++++++++++++- > xen/include/asm-arm/mm.h | 2 ++ > 2 files changed, 20 insertions(+), 1 deletion(-) > > diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c > index 362bc8d..14b4686 100644 > --- a/xen/arch/arm/mm.c > +++ b/xen/arch/arm/mm.c > @@ -947,7 +947,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, > @@ -1235,6 +1239,19 @@ int is_iomem_page(unsigned long mfn) > return 1; > return 0; > } > + > +/* > + * Return start and end addresses of guest > + */ > +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); > +} > + Ian plans to add multiple banks support for the guest very soon. This solution will stop to work. Late december, we've introduce max_mapped_pfn for ARM which give the maximum pfn mapped in the guest. Would it suit for your purpose? FYI x86 uses a similar solution. Regards,
Hi Andrew, On 04/10/2014 06:28 PM, Andrew Cooper wrote: > On 10/04/14 17:48, Wei Huang wrote: >> From: Jaeyong Yoo <jaeyong.yoo@samsung.com> >> >> This patchi implements get_maximum_gpfn by using the memory map >> info in arch_domain (from set_memory_map hypercall). >> >> Signed-off-by: Evgeny Fedotov <e.fedotov@samsung.com> > > Common implementation and a specific arch_get_maximum_gpfn() ? domain_get_maximum_gfn is already a common implementation. Except prefixing this function by arch_. I don't think it's possible to be more common... Regards,
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index 362bc8d..14b4686 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -947,7 +947,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, @@ -1235,6 +1239,19 @@ int is_iomem_page(unsigned long mfn) return 1; return 0; } + +/* + * Return start and end addresses of guest + */ +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 b8d4e7d..341493a 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: