diff mbox series

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

Message ID 20180221140259.29360-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 Feb. 21, 2018, 2:02 p.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>

---

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 v4:
        - Patch added
---
 xen/include/xen/pdx.h | 3 +++
 1 file changed, 3 insertions(+)

Comments

Wei Liu Feb. 22, 2018, 4:39 p.m. UTC | #1
On Wed, Feb 21, 2018 at 02:02:52PM +0000, Julien Grall wrote:
> 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>
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 */