xen/arm: alternative: Redefine virt_to_mfn to support typesafe
authorJulien Grall <julien.grall@arm.com>
Fri, 30 Jun 2017 15:54:21 +0000 (16:54 +0100)
committerStefano Stabellini <sstabellini@kernel.org>
Fri, 30 Jun 2017 20:12:57 +0000 (13:12 -0700)
The file xen/arch/arm/alternative.c is using typesafe MFN in most of
the place. The only caller to virt_to_mfn is using with _mfn(...).

To avoid extra _mfn(...), re-define virt_to_mfn within
xen/arch/arm/alternative.c to handle typesafe MFN.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabelllini <sstabellini@kernel.org>
xen/arch/arm/alternative.c

index 4d7e5b6155b5232ee996955af97768a2169bfe4d..a3bcda31174bc7f3d5933e97131858f91370b597 100644 (file)
 #include <asm/insn.h>
 #include <asm/page.h>
 
+/* Override macros from asm/page.h to make them work with mfn_t */
+#undef virt_to_mfn
+#define virt_to_mfn(va) _mfn(__virt_to_mfn(va))
+
 extern const struct alt_instr __alt_instructions[], __alt_instructions_end[];
 
 struct alt_region {
@@ -154,7 +158,7 @@ static int __apply_alternatives_multi_stop(void *unused)
     {
         int ret;
         struct alt_region region;
-        mfn_t xen_mfn = _mfn(virt_to_mfn(_start));
+        mfn_t xen_mfn = virt_to_mfn(_start);
         paddr_t xen_size = _end - _start;
         unsigned int xen_order = get_order_from_bytes(xen_size);
         void *xenmap;