From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH v2 1/3] xen/domain_page: Convert map_domain_page_global() to using mfn_t Date: Tue, 7 Jul 2015 11:07:26 +0100 Message-ID: <559BA4DE.5000507@citrix.com> References: <1435838656-9219-1-git-send-email-Ben.Catterall@citrix.com> <559BBF80020000780008D42A@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZCPml-0000dt-42 for xen-devel@lists.xenproject.org; Tue, 07 Jul 2015 10:07:31 +0000 In-Reply-To: <559BBF80020000780008D42A@mail.emea.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich , Ben Catterall Cc: xen-devel@lists.xenproject.org, keir@xen.org, stefano.stabellini@citrix.com, ian.campbell@citrix.com, tim@xen.org List-Id: xen-devel@lists.xenproject.org On 07/07/15 11:01, Jan Beulich wrote: >>>> On 02.07.15 at 14:04, wrote: >> --- a/xen/include/xen/domain_page.h >> +++ b/xen/include/xen/domain_page.h >> @@ -41,11 +41,15 @@ unsigned long domain_page_map_to_mfn(const void *va); >> * address spaces (not just within the VCPU that created the mapping). Global >> * mappings can also be unmapped from any context. >> */ >> -void *map_domain_page_global(unsigned long mfn); >> +void *map_domain_page_global(mfn_t mfn); >> void unmap_domain_page_global(const void *va); >> >> #define __map_domain_page(pg) map_domain_page(__page_to_mfn(pg)) >> -#define __map_domain_page_global(pg) map_domain_page_global(__page_to_mfn(pg)) >> + >> +static inline void *__map_domain_page_global(struct page_info *pg) > const > >> @@ -117,9 +121,17 @@ domain_mmap_cache_destroy(struct domain_mmap_cache *cache) >> mfn_to_virt(smfn)) >> #define domain_page_map_to_mfn(va) virt_to_mfn((unsigned long)(va)) >> >> -#define map_domain_page_global(mfn) mfn_to_virt(mfn) >> -#define __map_domain_page_global(pg) page_to_virt(pg) >> -#define unmap_domain_page_global(va) ((void)(va)) >> +static inline void *map_domain_page_global(mfn_t mfn) >> +{ >> + return mfn_to_virt(mfn_x(mfn)); >> +} >> + >> +static inline void *__map_domain_page_global(struct page_info *pg) > const > >> +{ >> + return page_to_virt(pg); >> +} >> + >> +static inline void unmap_domain_page_global(void *va) {}; > And again (the more that the real function already has it that way). Hmm. Both unmap_domain_page() and _global() should be updated to not take a const void *va. Just like free(), these functions are not performing a read-only operation on the destination pointer, therefore must not be performed on an actual const pointer. ~Andrew