From: Vijaya Kumar K
Move SRAT handling code which is common across
architectures is moved to new file xen/drivers/acpi/srat.c
from xen/arch/x86/srat.c file. New header file srat.h is
introduced.
Other major changes are:
- Coding style of code moved is changed.
- Moved struct pxm2node from srat.c to srat.h
- Dropped {memory,processor}_nodes_parsed from x86/srat.c
- Dropped static on node_to_pxm() and moved to beginning of the file.
- Made some static functions as non-static
- acpi_node_distance() is introduced and called from __node_distance()
- Replaced distance constants with LOCAL/REMOTE_DISTANCE defines
Signed-off-by: Vijaya Kumar K
---
v3: - Moved common function declarations from asm-x86/srat.h
---
xen/arch/x86/dom0_build.c | 1 +
xen/arch/x86/mm.c | 2 -
xen/arch/x86/physdev.c | 1 +
xen/arch/x86/setup.c| 1 +
xen/arch/x86/smpboot.c | 1 +
xen/arch/x86/srat.c | 246 +
xen/arch/x86/x86_64/mm.c| 1 +
xen/drivers/acpi/Makefile | 1 +
xen/drivers/acpi/srat.c | 298
xen/drivers/passthrough/vtd/iommu.c | 1 +
xen/include/acpi/srat.h | 24 +++
xen/include/asm-x86/numa.h | 5 -
12 files changed, 331 insertions(+), 251 deletions(-)
diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index 0c125e6..04127e7 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -11,6 +11,7 @@
#include
#include
#include
+#include
#include
#include
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 19f672d..5497621 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -135,8 +135,6 @@ l1_pgentry_t __section(".bss.page_aligned")
__aligned(PAGE_SIZE)
#define PTE_UPDATE_WITH_CMPXCHG
#endif
-paddr_t __read_mostly mem_hotplug;
-
/* Private domain structs for DOMID_XEN and DOMID_IO. */
struct domain *dom_xen, *dom_io, *dom_cow;
diff --git a/xen/arch/x86/physdev.c b/xen/arch/x86/physdev.c
index 0eb4097..a73a954 100644
--- a/xen/arch/x86/physdev.c
+++ b/xen/arch/x86/physdev.c
@@ -8,6 +8,7 @@
#include
#include
#include
+#include
#include
#include
#include
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index db5df69..b957b96 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -27,6 +27,7 @@
#include
#include
#include
+#include
#include
#include
#include
diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index 168c9d4..ff4c7e1 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -33,6 +33,7 @@
#include
#include
#include
+#include
#include
#include
#include
diff --git a/xen/arch/x86/srat.c b/xen/arch/x86/srat.c
index be2634a..d5caccf 100644
--- a/xen/arch/x86/srat.c
+++ b/xen/arch/x86/srat.c
@@ -18,92 +18,10 @@
#include
#include
#include
+#include
#include
#include
-static struct acpi_table_slit *__read_mostly acpi_slit;
-
-struct pxm2node {
- unsigned int pxm;
- nodeid_t node;
-};
-static struct pxm2node __read_mostly pxm2node[MAX_NUMNODES] =
- { [0 ... MAX_NUMNODES - 1] = {.node = NUMA_NO_NODE} };
-
-static unsigned int node_to_pxm(nodeid_t n);
-
-static __initdata DECLARE_BITMAP(memblk_hotplug, NR_NODE_MEMBLKS);
-
-static inline bool node_found(unsigned int idx, unsigned int pxm)
-{
- return ((pxm2node[idx].pxm == pxm) &&
- (pxm2node[idx].node != NUMA_NO_NODE));
-}
-
-static void reset_pxm2node(void)
-{
- unsigned int i;
-
- for (i = 0; i < ARRAY_SIZE(pxm2node); i++)
- pxm2node[i].node = NUMA_NO_NODE;
-}
-
-nodeid_t pxm_to_node(unsigned int pxm)
-{
- unsigned int i;
-
- if ((pxm < ARRAY_SIZE(pxm2node)) && node_found(pxm, pxm))
- return pxm2node[pxm].node;
-
- for (i = 0; i < ARRAY_SIZE(pxm2node); i++)
- if (node_found(i, pxm))
- return pxm2node[i].node;
-
- return NUMA_NO_NODE;
-}
-
-nodeid_t acpi_setup_node(unsigned int pxm)
-{
- nodeid_t node;
- unsigned int idx;
- static bool warned;
- static unsigned int nodes_found;
-
- BUILD_BUG_ON(MAX_NUMNODES >= NUMA_NO_NODE);
-
- if (pxm < ARRAY_SIZE(pxm2node)) {
- if (node_found(pxm, pxm))
- return pxm2node[pxm].node;
-
- /* Try to maintain indexing of pxm2node by pxm */
- if (pxm2node[pxm].node == NUMA_NO_NODE) {
- idx = pxm;
- goto finish;
- }
- }
-
- for (idx = 0; idx < ARRAY_SIZE(pxm2node); idx++)
- if (pxm2node[idx].node == NUMA_NO_NODE)
- goto finish;
-
- if (!warned) {
- printk(KERN_WARNING "SRAT: Too many proximity domains (%#x)\n",
- pxm);
- warned =