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

[Xen-changelog] [xen master] xen/x86: mm: Introduce {G, M}FN <-> {G, M}ADDR helpers



commit caa8d100b923f2abfb6ba54dbe20ab3f37f8bd91
Author:     Julien Grall <julien.grall@xxxxxxx>
AuthorDate: Tue Sep 12 11:03:07 2017 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Tue Sep 12 11:29:40 2017 +0100

    xen/x86: mm: Introduce {G, M}FN <-> {G, M}ADDR helpers
    
    The new wrappers will add more safety when converting an address to a
    frame number (either machine or guest). They are already existing for
    Arm and could be useful in common code.
    
    Signed-off-by: Julien Grall <julien.grall@xxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 xen/include/asm-x86/page.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/include/asm-x86/page.h b/xen/include/asm-x86/page.h
index cde5c6b..45ca742 100644
--- a/xen/include/asm-x86/page.h
+++ b/xen/include/asm-x86/page.h
@@ -250,6 +250,10 @@ void copy_page_sse2(void *, const void *);
 /* Convert between frame number and address formats.  */
 #define __pfn_to_paddr(pfn) ((paddr_t)(pfn) << PAGE_SHIFT)
 #define __paddr_to_pfn(pa)  ((unsigned long)((pa) >> PAGE_SHIFT))
+#define gfn_to_gaddr(gfn)   __pfn_to_paddr(gfn_x(gfn))
+#define gaddr_to_gfn(ga)    _gfn(__paddr_to_pfn(ga))
+#define mfn_to_maddr(mfn)   __pfn_to_paddr(mfn_x(mfn))
+#define maddr_to_mfn(ma)    _mfn(__paddr_to_pfn(ma))
 
 /*
  * We define non-underscored wrappers for above conversion functions. These are
--
generated by git-patchbot for /home/xen/git/xen.git#master

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

 


Rackspace

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