Skip to contentSkip to conversation

include: make domain_page.h's stubs properly use type-unsafe MFN <-> virt helpers

PATCH In review Jan Beulich 3 participants 3 messages Sep 11, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 include: make domain_page.h's stubs properly use type-unsafe MFN <-> virt helpers

The first of the commits referenced below didn't go far enough, and the 2nd of them, while trying to close (some of) the gap, wrongly kept using the potentially type-safe variant. This is getting in the way of new ports preferably not having any type-unsafe private code (and in particular not having a need for any overrides in newly introduced files).

Fixes 41c48004d1d8 ("xen/mm: Use __virt_to_mfn in map_domain_page instead of virt_to_mfn")
Fixes f46b6197344f ("xen: Convert page_to_mfn and mfn_to_page to use typesafe MFN")
xen/include/xen/domain_page.h +2 -2
@@ -56,11 +56,11 @@ static inline void *__map_domain_page_gl
 #define map_domain_page(mfn)                __mfn_to_virt(mfn_x(mfn))
 #define __map_domain_page(pg)               page_to_virt(pg)
 #define unmap_domain_page(va)               ((void)(va))
-#define domain_page_map_to_mfn(va)          _mfn(virt_to_mfn((unsigned long)(va)))
+#define domain_page_map_to_mfn(va)          _mfn(__virt_to_mfn((unsigned long)(va)))
 
 static inline void *map_domain_page_global(mfn_t mfn)
 {
-    return mfn_to_virt(mfn_x(mfn));
+    return __mfn_to_virt(mfn_x(mfn));
 }
 
 static inline void *__map_domain_page_global(const struct page_info *pg)
Reviewed-by on v1 1/1
#1 lore raw

Hi Jan,

Quoted 11 lines · Jan Beulich

The first of the commits referenced below didn't go far enough, and the 2nd of them, while trying to close (some of) the gap, wrongly kept using the potentially type-safe variant. This is getting in the way of new ports preferably not having any type-unsafe private code (and in particular not having a need for any overrides in newly introduced files).

Fixes 41c48004d1d8 ("xen/mm: Use __virt_to_mfn in map_domain_page instead of virt_to_mfn")
Fixes f46b6197344f ("xen: Convert page_to_mfn and mfn_to_page to use typesafe MFN")

Cheers,

Signature · 1 line
Julien Grall
Reviewed-by on v1 1/1
#2 lore raw
In reply to Jan Beulich
Quoted 18 lines · Jan Beulich

The first of the commits referenced below didn't go far enough, and the 2nd of them, while trying to close (some of) the gap, wrongly kept using the potentially type-safe variant. This is getting in the way of new ports preferably not having any type-unsafe private code (and in particular not having a need for any overrides in newly introduced files).

Fixes 41c48004d1d8 ("xen/mm: Use __virt_to_mfn in map_domain_page instead of virt_to_mfn")
Fixes f46b6197344f ("xen: Convert page_to_mfn and mfn_to_page to use typesafe MFN")
xen/include/xen/domain_page.h +0 -0
@@ -56,11 +56,11 @@ static inline void *__map_domain_page_gl
 #define map_domain_page(mfn)                __mfn_to_virt(mfn_x(mfn))
 #define __map_domain_page(pg)               page_to_virt(pg)
 #define unmap_domain_page(va)               ((void)(va))

xen/include/xen/domain_page.h static inline void *__map_domain_page_gl · line 66

Quoted 10 lines
xen/include/xen/domain_page.h +2 -2
-#define domain_page_map_to_mfn(va)          _mfn(virt_to_mfn((unsigned long)(va)))
+#define domain_page_map_to_mfn(va)          _mfn(__virt_to_mfn((unsigned long)(va)))
 
 static inline void *map_domain_page_global(mfn_t mfn)
 {
-    return mfn_to_virt(mfn_x(mfn));
+    return __mfn_to_virt(mfn_x(mfn));
 }
 
 static inline void *__map_domain_page_global(const struct page_info *pg)

Thanks,
Shawn