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

Re: [Xen-devel] [PATCH 04/27] xen/mm: Move {G, M]FN <-> {G, M}ADDR helpers to common code



>>> On 14.08.17 at 16:23, <julien.grall@xxxxxxx> wrote:
> --- a/xen/include/xen/mm.h
> +++ b/xen/include/xen/mm.h
> @@ -92,6 +92,9 @@ static inline bool_t mfn_eq(mfn_t x, mfn_t y)
>      return mfn_x(x) == mfn_x(y);
>  }
>  
> +#define maddr_to_mfn(maddr) _mfn(paddr_to_pfn(maddr))
> +#define mfn_to_maddr(mfn)   pfn_to_paddr(mfn_x(mfn))
> +
>  TYPE_SAFE(unsigned long, gfn);
>  #define PRI_gfn          "05lx"
>  #define INVALID_GFN      _gfn(~0UL)
> @@ -130,6 +133,9 @@ static inline bool_t gfn_eq(gfn_t x, gfn_t y)
>      return gfn_x(x) == gfn_x(y);
>  }
>  
> +#define gaddr_to_gfn(gaddr) _gfn(paddr_to_pfn(gaddr))
> +#define gfn_to_gaddr(gfn)   pfn_to_paddr(gfn_x(gfn))
> +
>  TYPE_SAFE(unsigned long, pfn);
>  #define PRI_pfn          "05lx"
>  #define INVALID_PFN      (~0UL)

Hmm, if you want this in common code, I think this needs to be
correct from a more abstract perspective, i.e. not just for ARM
and x86. In general I don't think we can assume machine,
physical, and guest addresses to all be the same width (which
the uses above imply). IOW I think these would better stay
arch-specific, and if you want to use them in common code
you'll need to add x86 variants.

Jan


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

 


Rackspace

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