Also provided pcibus_to_node and cpumask_of_pcibus based on x86.
Signed-off-by: Ashok Kumar ashoks@broadcom.com --- Hanjun, This patch is based on your acpi numa patchset and leg-kernel. Tested it on qemu using generic pci host controller. could you add this to your set of patches if it is fine? Thanks!
arch/arm64/include/asm/numa.h | 4 +--- arch/arm64/include/asm/pci.h | 20 ++++++++++++++++++++ arch/arm64/pci/pci.c | 5 ++++- 3 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/arch/arm64/include/asm/numa.h b/arch/arm64/include/asm/numa.h index 3ed6edb..18716ec 100644 --- a/arch/arm64/include/asm/numa.h +++ b/arch/arm64/include/asm/numa.h @@ -12,9 +12,7 @@ /* currently, arm64 implements flat NUMA topology */ #define parent_node(node) (node)
-/* dummy definitions for pci functions */ -#define pcibus_to_node(node) 0 -#define cpumask_of_pcibus(bus) 0 +#define pcibus_to_node(bus) __pcibus_to_node(bus)
struct node_cpu_hwid { u32 node_id; /* logical node containing this CPU */ diff --git a/arch/arm64/include/asm/pci.h b/arch/arm64/include/asm/pci.h index faad64c..522ba7c 100644 --- a/arch/arm64/include/asm/pci.h +++ b/arch/arm64/include/asm/pci.h @@ -88,6 +88,26 @@ struct acpi_mcfg_fixup { acpi_mcfg_fixup_t hook; };
+#ifdef CONFIG_NUMA +/* Returns the node based on pci bus */ +static inline int __pcibus_to_node(const struct pci_bus *bus) +{ + const struct pci_sysdata *sd = bus->sysdata; + + return sd->node; +} + +static inline const struct cpumask * +cpumask_of_pcibus(const struct pci_bus *bus) +{ + int node; + + node = __pcibus_to_node(bus); + return (node == -1) ? cpu_online_mask : + cpumask_of_node(node); +} +#endif + /* Designate a routine to fix up buggy MCFG */ #define DECLARE_ACPI_MCFG_FIXUP(oem_id, table_id, hook) \ static const struct acpi_mcfg_fixup __acpi_fixup_##hook __used \ diff --git a/arch/arm64/pci/pci.c b/arch/arm64/pci/pci.c index a1f8b08..a38753e 100644 --- a/arch/arm64/pci/pci.c +++ b/arch/arm64/pci/pci.c @@ -324,7 +324,10 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) return NULL; }
- node = NUMA_NO_NODE; + node = acpi_get_node(device->handle); + + if (node != NUMA_NO_NODE && !node_online(node)) + node = NUMA_NO_NODE;
info = kzalloc_node(sizeof(*info), GFP_KERNEL, node); if (!info) {
Hi Ashok,
I am very interested in getting qemu running as a development machine for ACPI, could you give details of what you used and how it was configured?
Graeme
On 7 January 2015 at 13:32, Ashok Kumar ashoks@broadcom.com wrote:
Also provided pcibus_to_node and cpumask_of_pcibus based on x86.
Signed-off-by: Ashok Kumar ashoks@broadcom.com
Hanjun, This patch is based on your acpi numa patchset and leg-kernel. Tested it on qemu using generic pci host controller. could you add this to your set of patches if it is fine? Thanks!
arch/arm64/include/asm/numa.h | 4 +--- arch/arm64/include/asm/pci.h | 20 ++++++++++++++++++++ arch/arm64/pci/pci.c | 5 ++++- 3 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/arch/arm64/include/asm/numa.h b/arch/arm64/include/asm/numa.h index 3ed6edb..18716ec 100644 --- a/arch/arm64/include/asm/numa.h +++ b/arch/arm64/include/asm/numa.h @@ -12,9 +12,7 @@ /* currently, arm64 implements flat NUMA topology */ #define parent_node(node) (node)
-/* dummy definitions for pci functions */ -#define pcibus_to_node(node) 0 -#define cpumask_of_pcibus(bus) 0 +#define pcibus_to_node(bus) __pcibus_to_node(bus)
struct node_cpu_hwid { u32 node_id; /* logical node containing this CPU */ diff --git a/arch/arm64/include/asm/pci.h b/arch/arm64/include/asm/pci.h index faad64c..522ba7c 100644 --- a/arch/arm64/include/asm/pci.h +++ b/arch/arm64/include/asm/pci.h @@ -88,6 +88,26 @@ struct acpi_mcfg_fixup { acpi_mcfg_fixup_t hook; };
+#ifdef CONFIG_NUMA +/* Returns the node based on pci bus */ +static inline int __pcibus_to_node(const struct pci_bus *bus) +{
const struct pci_sysdata *sd = bus->sysdata;
return sd->node;
+}
+static inline const struct cpumask * +cpumask_of_pcibus(const struct pci_bus *bus) +{
int node;
node = __pcibus_to_node(bus);
return (node == -1) ? cpu_online_mask :
cpumask_of_node(node);
+} +#endif
/* Designate a routine to fix up buggy MCFG */ #define DECLARE_ACPI_MCFG_FIXUP(oem_id, table_id, hook) \ static const struct acpi_mcfg_fixup __acpi_fixup_##hook __used \ diff --git a/arch/arm64/pci/pci.c b/arch/arm64/pci/pci.c index a1f8b08..a38753e 100644 --- a/arch/arm64/pci/pci.c +++ b/arch/arm64/pci/pci.c @@ -324,7 +324,10 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) return NULL; }
node = NUMA_NO_NODE;
node = acpi_get_node(device->handle);
if (node != NUMA_NO_NODE && !node_online(node))
node = NUMA_NO_NODE; info = kzalloc_node(sizeof(*info), GFP_KERNEL, node); if (!info) {
-- 1.9.1
Linaro-acpi mailing list Linaro-acpi@lists.linaro.org http://lists.linaro.org/mailman/listinfo/linaro-acpi
On Wed, Jan 07, 2015 at 02:51:16PM +0000, G Gregory wrote:
Hi Ashok,
I am very interested in getting qemu running as a development machine for ACPI, could you give details of what you used and how it was configured?
Graeme
Hi Graeme,
I did it in a hacky way. Based on the "-M virt" platform's config, I wrote the ACPI tables statically in UEFI and passed it to the linux. Please find attached the edk2 diffs and the bootup logs for reference.
There is also a mail thread[1] which discusses whether the ACPI tables to be created in qemu or in uefi using the dt.
[1] http://lists.gnu.org/archive/html/qemu-devel/2014-11/msg02529.html
Thanks, Ashok
On 7 January 2015 at 13:32, Ashok Kumar ashoks@broadcom.com wrote:
Also provided pcibus_to_node and cpumask_of_pcibus based on x86.
Signed-off-by: Ashok Kumar ashoks@broadcom.com
Hanjun, This patch is based on your acpi numa patchset and leg-kernel. Tested it on qemu using generic pci host controller. could you add this to your set of patches if it is fine? Thanks!
arch/arm64/include/asm/numa.h | 4 +--- arch/arm64/include/asm/pci.h | 20 ++++++++++++++++++++ arch/arm64/pci/pci.c | 5 ++++- 3 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/arch/arm64/include/asm/numa.h b/arch/arm64/include/asm/numa.h index 3ed6edb..18716ec 100644 --- a/arch/arm64/include/asm/numa.h +++ b/arch/arm64/include/asm/numa.h @@ -12,9 +12,7 @@ /* currently, arm64 implements flat NUMA topology */ #define parent_node(node) (node)
-/* dummy definitions for pci functions */ -#define pcibus_to_node(node) 0 -#define cpumask_of_pcibus(bus) 0 +#define pcibus_to_node(bus) __pcibus_to_node(bus)
struct node_cpu_hwid { u32 node_id; /* logical node containing this CPU */ diff --git a/arch/arm64/include/asm/pci.h b/arch/arm64/include/asm/pci.h index faad64c..522ba7c 100644 --- a/arch/arm64/include/asm/pci.h +++ b/arch/arm64/include/asm/pci.h @@ -88,6 +88,26 @@ struct acpi_mcfg_fixup { acpi_mcfg_fixup_t hook; };
+#ifdef CONFIG_NUMA +/* Returns the node based on pci bus */ +static inline int __pcibus_to_node(const struct pci_bus *bus) +{
const struct pci_sysdata *sd = bus->sysdata;
return sd->node;
+}
+static inline const struct cpumask * +cpumask_of_pcibus(const struct pci_bus *bus) +{
int node;
node = __pcibus_to_node(bus);
return (node == -1) ? cpu_online_mask :
cpumask_of_node(node);
+} +#endif
/* Designate a routine to fix up buggy MCFG */ #define DECLARE_ACPI_MCFG_FIXUP(oem_id, table_id, hook) \ static const struct acpi_mcfg_fixup __acpi_fixup_##hook __used \ diff --git a/arch/arm64/pci/pci.c b/arch/arm64/pci/pci.c index a1f8b08..a38753e 100644 --- a/arch/arm64/pci/pci.c +++ b/arch/arm64/pci/pci.c @@ -324,7 +324,10 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) return NULL; }
node = NUMA_NO_NODE;
node = acpi_get_node(device->handle);
if (node != NUMA_NO_NODE && !node_online(node))
node = NUMA_NO_NODE; info = kzalloc_node(sizeof(*info), GFP_KERNEL, node); if (!info) {
-- 1.9.1
Linaro-acpi mailing list Linaro-acpi@lists.linaro.org http://lists.linaro.org/mailman/listinfo/linaro-acpi
On 2015年01月07日 21:32, Ashok Kumar wrote:
Also provided pcibus_to_node and cpumask_of_pcibus based on x86.
Signed-off-by: Ashok Kumar ashoks@broadcom.com
Hanjun, This patch is based on your acpi numa patchset and leg-kernel. Tested it on qemu using generic pci host controller. could you add this to your set of patches if it is fine? Thanks!
sure, I will. thanks for your patch!
I already fixed the call trace of early_ioremap memory leak, will send another version.
Regards, Hanjun
On Thu, Jan 08, 2015 at 04:00:37PM +0800, Hanjun Guo wrote:
On 2015???01???07??? 21:32, Ashok Kumar wrote:
Also provided pcibus_to_node and cpumask_of_pcibus based on x86.
Signed-off-by: Ashok Kumar ashoks@broadcom.com
Hanjun, This patch is based on your acpi numa patchset and leg-kernel. Tested it on qemu using generic pci host controller. could you add this to your set of patches if it is fine? Thanks!
sure, I will. thanks for your patch!
I already fixed the call trace of early_ioremap memory leak, will send another version.
Hanjun,
Thanks!
I just noticed the call to numa_add_memblk in acpi_numa_memory_affinity_init should use ma->length as the second param. The syntax of numa_add_memblk is numa_add_memblk(u32 nid, u64 base, u64 size).
diff --git a/arch/arm64/kernel/acpi_numa.c b/arch/arm64/kernel/acpi_numa.c index 44de133..b5fc732 100644 --- a/arch/arm64/kernel/acpi_numa.c +++ b/arch/arm64/kernel/acpi_numa.c @@ -147,7 +147,7 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma) goto out_err_bad_srat; }
- if (numa_add_memblk(node, start, end) < 0) + if (numa_add_memblk(node, start, ma->length) < 0) goto out_err_bad_srat;
node_set(node, numa_nodes_parsed);
Ganapat, Is it possible to change the info prints of numa_add_memblk_to like below
diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c index 7bead6a..f293182 100644 --- a/arch/arm64/mm/numa.c +++ b/arch/arm64/mm/numa.c @@ -194,7 +194,7 @@ static int __init numa_add_memblk_to(int nid, u64 start, u64 end, }
pr_info("NUMA: Adding memblock %d [0x%llx - 0x%llx] on node %d\n", - mi->nr_blks, start, end, nid); + mi->nr_blks, start, end - 1, nid); mi->blk[mi->nr_blks].start = start; mi->blk[mi->nr_blks].end = end; mi->blk[mi->nr_blks].nid = nid;
as the range prints are conflicting with ACPI range prints and also inaccurate.
... NUMA: Adding memblock 0 [0x40000000 - 0x60000000] on node 0 ACPI: SRAT: SRAT: Node 0 PXM 0 [mem 0x40000000-0x5fffffff] NUMA: Adding memblock 1 [0x60000000 - 0x80000000] on node 1 ACPI: SRAT: SRAT: Node 1 PXM 1 [mem 0x60000000-0x7fffffff] ...
Thanks, Ashok
Regards, Hanjun