This makes common code less ifdef-y and is consistent with PVHVM on x86. Also note that phys_to_machine_mapping_valid should take a pfn argument and make it do so. Add __set_phys_to_machine, make set_phys_to_machine a simple wrapper (on systems with non-nop implementations the outer one can allocate new p2m pages). Make __set_phys_to_machine check for identity mapping or invalid only. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> --- arch/arm/include/asm/xen/page.h | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-) diff --git a/arch/arm/include/asm/xen/page.h b/arch/arm/include/asm/xen/page.h index 1742023..c6b9096 100644 --- a/arch/arm/include/asm/xen/page.h +++ b/arch/arm/include/asm/xen/page.h @@ -10,7 +10,7 @@ #include <xen/interface/grant_table.h> #define pfn_to_mfn(pfn) (pfn) -#define phys_to_machine_mapping_valid (1) +#define phys_to_machine_mapping_valid(pfn) (1) #define mfn_to_pfn(mfn) (mfn) #define mfn_to_virt(m) (__va(mfn_to_pfn(m) << PAGE_SHIFT)) @@ -30,6 +30,8 @@ typedef struct xpaddr { #define XMADDR(x) ((xmaddr_t) { .maddr = (x) }) #define XPADDR(x) ((xpaddr_t) { .paddr = (x) }) +#define INVALID_P2M_ENTRY (~0UL) + static inline xmaddr_t phys_to_machine(xpaddr_t phys) { unsigned offset = phys.paddr & ~PAGE_MASK; @@ -74,9 +76,14 @@ static inline int m2p_remove_override(struct page *page, bool clear_pte) return 0; } +static inline bool __set_phys_to_machine(unsigned long pfn, unsigned long mfn) +{ + BUG_ON(pfn != mfn && mfn != INVALID_P2M_ENTRY); + return true; +} + static inline bool set_phys_to_machine(unsigned long pfn, unsigned long mfn) { - BUG(); - return false; + return __set_phys_to_machine(pfn, mfn); } #endif /* _ASM_ARM_XEN_PAGE_H */ -- 1.7.2.5
Stefano Stabellini
2012-Oct-17 17:13 UTC
Re: [PATCH 10/10] xen: arm: make p2m operations NOPs
On Wed, 17 Oct 2012, Ian Campbell wrote:> This makes common code less ifdef-y and is consistent with PVHVM on > x86. > > Also note that phys_to_machine_mapping_valid should take a pfn > argument and make it do so. > > Add __set_phys_to_machine, make set_phys_to_machine a simple wrapper > (on systems with non-nop implementations the outer one can allocate > new p2m pages). > > Make __set_phys_to_machine check for identity mapping or invalid only. > > Signed-off-by: Ian Campbell <ian.campbell@citrix.com>Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>> arch/arm/include/asm/xen/page.h | 13 ++++++++++--- > 1 files changed, 10 insertions(+), 3 deletions(-) > > diff --git a/arch/arm/include/asm/xen/page.h b/arch/arm/include/asm/xen/page.h > index 1742023..c6b9096 100644 > --- a/arch/arm/include/asm/xen/page.h > +++ b/arch/arm/include/asm/xen/page.h > @@ -10,7 +10,7 @@ > #include <xen/interface/grant_table.h> > > #define pfn_to_mfn(pfn) (pfn) > -#define phys_to_machine_mapping_valid (1) > +#define phys_to_machine_mapping_valid(pfn) (1) > #define mfn_to_pfn(mfn) (mfn) > #define mfn_to_virt(m) (__va(mfn_to_pfn(m) << PAGE_SHIFT)) > > @@ -30,6 +30,8 @@ typedef struct xpaddr { > #define XMADDR(x) ((xmaddr_t) { .maddr = (x) }) > #define XPADDR(x) ((xpaddr_t) { .paddr = (x) }) > > +#define INVALID_P2M_ENTRY (~0UL) > + > static inline xmaddr_t phys_to_machine(xpaddr_t phys) > { > unsigned offset = phys.paddr & ~PAGE_MASK; > @@ -74,9 +76,14 @@ static inline int m2p_remove_override(struct page *page, bool clear_pte) > return 0; > } > > +static inline bool __set_phys_to_machine(unsigned long pfn, unsigned long mfn) > +{ > + BUG_ON(pfn != mfn && mfn != INVALID_P2M_ENTRY); > + return true; > +} > + > static inline bool set_phys_to_machine(unsigned long pfn, unsigned long mfn) > { > - BUG(); > - return false; > + return __set_phys_to_machine(pfn, mfn); > } > #endif /* _ASM_ARM_XEN_PAGE_H */ > -- > 1.7.2.5 >