diff mbox series

[Xen-devel,for-4.11,v6,09/16] xen/pdx: Introduce helper to convert MFN <-> PDX

Message ID 20180321044737.20794-10-julien.grall@arm.com
State Superseded
Headers show
Series xen: Convert page_to_mfn and mfn_to_page to use typesafe MFN | expand

Commit Message

Julien Grall March 21, 2018, 4:47 a.m. UTC
This will avoid use of pfn_to_pdx(mfn_x(mfn)) over the code base.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>

---

Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: George Dunlap <George.Dunlap@eu.citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Tim Deegan <tim@xen.org>
Cc: Wei Liu <wei.liu2@citrix.com>

    Changes in v6:
        - Add Andrew's acked-by

    Changes in v5:
        - Add Wei's reviewed-by

    Changes in v4:
        - Patch added
---
 xen/include/xen/pdx.h | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/xen/include/xen/pdx.h b/xen/include/xen/pdx.h
index 4c56645c4c..a151aac1a2 100644
--- a/xen/include/xen/pdx.h
+++ b/xen/include/xen/pdx.h
@@ -35,6 +35,9 @@  static inline unsigned long pdx_to_pfn(unsigned long pdx)
            ((pdx << pfn_pdx_hole_shift) & pfn_top_mask);
 }
 
+#define mfn_to_pdx(mfn) pfn_to_pdx(mfn_x(mfn))
+#define pdx_to_mfn(pdx) _mfn(pdx_to_pfn(pdx))
+
 extern void pfn_pdx_hole_setup(unsigned long);
 
 #endif /* HAS_PDX */