Such declaration is moved in order to provide it for Arm and PPC,
whilst not violating MISRA C:2012 Rule 8.4 in common/page_alloc.c:
"A compatible declaration shall be visible when an object or
function with external linkage is defined".

Signed-off-by: Julien Grall <jul...@xen.org>
Signed-off-by: Nicola Vetrini <nicola.vetr...@bugseng.com>
---
Changes in v2:
This patch is a rework of a previous one appeared in this series [1], of which
patches 1 and 2 have been committed already.

The updated patch was provided by Julien in this thread [2]. I added the commit
message and the rest of the information.

[1] 
https://lore.kernel.org/xen-devel/cover.1702285639.git.nicola.vetr...@bugseng.com/T/#mee6def855787d932fe2f10d5648d437dcb6f046c
[2] 
https://lore.kernel.org/xen-devel/cover.1702285639.git.nicola.vetr...@bugseng.com/T/#m3c5b141b806530b5920bb5e9dd53631195560317
---
 xen/arch/arm/include/asm/numa.h | 6 ------
 xen/arch/ppc/include/asm/numa.h | 6 ------
 xen/common/page_alloc.c         | 6 ++++--
 xen/include/xen/numa.h          | 2 ++
 4 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/xen/arch/arm/include/asm/numa.h b/xen/arch/arm/include/asm/numa.h
index e2bee2bd8223..a2c1da4a82f7 100644
--- a/xen/arch/arm/include/asm/numa.h
+++ b/xen/arch/arm/include/asm/numa.h
@@ -11,12 +11,6 @@ typedef u8 nodeid_t;
 #define cpu_to_node(cpu) 0
 #define node_to_cpumask(node)   (cpu_online_map)
 
-/*
- * TODO: make first_valid_mfn static when NUMA is supported on Arm, this
- * is required because the dummy helpers are using it.
- */
-extern mfn_t first_valid_mfn;
-
 /* XXX: implement NUMA support */
 #define node_spanned_pages(nid) (max_page - mfn_x(first_valid_mfn))
 #define node_start_pfn(nid) (mfn_x(first_valid_mfn))
diff --git a/xen/arch/ppc/include/asm/numa.h b/xen/arch/ppc/include/asm/numa.h
index 7fdf66c3da74..204180ad5b98 100644
--- a/xen/arch/ppc/include/asm/numa.h
+++ b/xen/arch/ppc/include/asm/numa.h
@@ -10,12 +10,6 @@ typedef uint8_t nodeid_t;
 #define cpu_to_node(cpu) 0
 #define node_to_cpumask(node)   (cpu_online_map)
 
-/*
- * TODO: make first_valid_mfn static when NUMA is supported on PPC, this
- * is required because the dummy helpers are using it.
- */
-extern mfn_t first_valid_mfn;
-
 /* XXX: implement NUMA support */
 #define node_spanned_pages(nid) (max_page - mfn_x(first_valid_mfn))
 #define node_start_pfn(nid) (mfn_x(first_valid_mfn))
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 9b5df74fddab..d874525916ea 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -255,8 +255,10 @@ static PAGE_LIST_HEAD(page_broken_list);
  */
 
 /*
- * first_valid_mfn is exported because it is use in ARM specific NUMA
- * helpers. See comment in arch/arm/include/asm/numa.h.
+ * first_valid_mfn is exported because it is used when !CONFIG_NUMA.
+ *
+ * TODO: Consider if we can conditionally export first_valid_mfn based
+ * on whether NUMA is selected.
  */
 mfn_t first_valid_mfn = INVALID_MFN_INITIALIZER;
 
diff --git a/xen/include/xen/numa.h b/xen/include/xen/numa.h
index 287e81ff6666..a10d4b1778a0 100644
--- a/xen/include/xen/numa.h
+++ b/xen/include/xen/numa.h
@@ -108,6 +108,8 @@ extern void numa_set_processor_nodes_parsed(nodeid_t node);
 
 #else
 
+extern mfn_t first_valid_mfn;
+
 static inline nodeid_t mfn_to_nid(mfn_t mfn)
 {
     return 0;
-- 
2.34.1

Reply via email to