diff mbox series

[v2,1/2] mm: introduce INVALID_{G,M}FN_RAW

Message ID 6d2d29ca-0495-5029-afc8-7248f462db06@suse.com (mailing list archive)
State New, archived
Headers show
Series grant table and add-to-physmap adjustments on top of XSAs 379 and 384 | expand

Commit Message

Jan Beulich Dec. 10, 2021, 9:39 a.m. UTC
This allows properly tying together INVALID_{G,M}FN and
INVALID_{G,M}FN_INITIALIZER as well as using the actual values in
compile time constant expressions (or even preprocessor dirctives).

Since INVALID_PFN is unused, and with x86'es paging_mark_pfn_dirty()
being the only user of pfn_t it also doesn't seem likely that new uses
would appear, remove that one at this same occasion.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
v2: New.

Comments

Oleksandr Andrushchenko Dec. 10, 2021, 9:51 a.m. UTC | #1
Hi, Jan!

On 10.12.21 11:39, Jan Beulich wrote:
> This allows properly tying together INVALID_{G,M}FN and
> INVALID_{G,M}FN_INITIALIZER as well as using the actual values in
> compile time constant expressions (or even preprocessor dirctives).
s/dirctives/directives
>
> Since INVALID_PFN is unused, and with x86'es paging_mark_pfn_dirty()
> being the only user of pfn_t it also doesn't seem likely that new uses
> would appear, remove that one at this same occasion.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
With the above nit fixed:
Reviewed-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
> ---
> v2: New.
>
> --- a/xen/include/xen/mm-frame.h
> +++ b/xen/include/xen/mm-frame.h
> @@ -6,12 +6,13 @@
>   
>   TYPE_SAFE(unsigned long, mfn);
>   #define PRI_mfn          "05lx"
> -#define INVALID_MFN      _mfn(~0UL)
> +#define INVALID_MFN_RAW  (~0UL)
> +#define INVALID_MFN      _mfn(INVALID_MFN_RAW)
>   /*
>    * To be used for global variable initialization. This workaround a bug
>    * in GCC < 5.0.
>    */
> -#define INVALID_MFN_INITIALIZER { ~0UL }
> +#define INVALID_MFN_INITIALIZER { INVALID_MFN_RAW }
>   
>   #ifndef mfn_t
>   #define mfn_t /* Grep fodder: mfn_t, _mfn() and mfn_x() are defined above */
> @@ -44,12 +45,13 @@ static inline bool_t mfn_eq(mfn_t x, mfn
>   
>   TYPE_SAFE(unsigned long, gfn);
>   #define PRI_gfn          "05lx"
> -#define INVALID_GFN      _gfn(~0UL)
> +#define INVALID_GFN_RAW  (~0UL)
> +#define INVALID_GFN      _gfn(INVALID_GFN_RAW)
>   /*
>    * To be used for global variable initialization. This workaround a bug
>    * in GCC < 5.0 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64856
>    */
> -#define INVALID_GFN_INITIALIZER { ~0UL }
> +#define INVALID_GFN_INITIALIZER { INVALID_GFN_RAW }
>   
>   #ifndef gfn_t
>   #define gfn_t /* Grep fodder: gfn_t, _gfn() and gfn_x() are defined above */
> @@ -82,7 +84,6 @@ static inline bool_t gfn_eq(gfn_t x, gfn
>   
>   TYPE_SAFE(unsigned long, pfn);
>   #define PRI_pfn          "05lx"
> -#define INVALID_PFN      (~0UL)
>   
>   #ifndef pfn_t
>   #define pfn_t /* Grep fodder: pfn_t, _pfn() and pfn_x() are defined above */
>
>
Julien Grall Dec. 17, 2021, 2:46 p.m. UTC | #2
Hi Jan,

On 10/12/2021 09:39, Jan Beulich wrote:
> This allows properly tying together INVALID_{G,M}FN and
> INVALID_{G,M}FN_INITIALIZER as well as using the actual values in
> compile time constant expressions (or even preprocessor dirctives).
> 
> Since INVALID_PFN is unused, and with x86'es paging_mark_pfn_dirty()
> being the only user of pfn_t it also doesn't seem likely that new uses
> would appear, remove that one at this same occasion.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Julien Grall <jgrall@amazon.com>

Cheers,
diff mbox series

Patch

--- a/xen/include/xen/mm-frame.h
+++ b/xen/include/xen/mm-frame.h
@@ -6,12 +6,13 @@ 
 
 TYPE_SAFE(unsigned long, mfn);
 #define PRI_mfn          "05lx"
-#define INVALID_MFN      _mfn(~0UL)
+#define INVALID_MFN_RAW  (~0UL)
+#define INVALID_MFN      _mfn(INVALID_MFN_RAW)
 /*
  * To be used for global variable initialization. This workaround a bug
  * in GCC < 5.0.
  */
-#define INVALID_MFN_INITIALIZER { ~0UL }
+#define INVALID_MFN_INITIALIZER { INVALID_MFN_RAW }
 
 #ifndef mfn_t
 #define mfn_t /* Grep fodder: mfn_t, _mfn() and mfn_x() are defined above */
@@ -44,12 +45,13 @@  static inline bool_t mfn_eq(mfn_t x, mfn
 
 TYPE_SAFE(unsigned long, gfn);
 #define PRI_gfn          "05lx"
-#define INVALID_GFN      _gfn(~0UL)
+#define INVALID_GFN_RAW  (~0UL)
+#define INVALID_GFN      _gfn(INVALID_GFN_RAW)
 /*
  * To be used for global variable initialization. This workaround a bug
  * in GCC < 5.0 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64856
  */
-#define INVALID_GFN_INITIALIZER { ~0UL }
+#define INVALID_GFN_INITIALIZER { INVALID_GFN_RAW }
 
 #ifndef gfn_t
 #define gfn_t /* Grep fodder: gfn_t, _gfn() and gfn_x() are defined above */
@@ -82,7 +84,6 @@  static inline bool_t gfn_eq(gfn_t x, gfn
 
 TYPE_SAFE(unsigned long, pfn);
 #define PRI_pfn          "05lx"
-#define INVALID_PFN      (~0UL)
 
 #ifndef pfn_t
 #define pfn_t /* Grep fodder: pfn_t, _pfn() and pfn_x() are defined above */