Skip to contentSkip to conversation

arm64: acpi: Support PCI devices numa_node property in ACPI mode

PATCH In review Sergey Temerkhanov 2 participants 4 messages Apr 6, 2017 – Apr 21, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: acpi: Support PCI devices numa_node property in ACPI mode

This commit modifies ARM64-specific ACPI PCI support functions to properly set the numa_node property on host bridges and thus on PCI devices. Such support requires _PXM objects to be set in DSDT/SSDT tables describing PCI root bridges

---
 arch/arm64/kernel/pci.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
arch/arm64/kernel/pci.c +12 -1
index 4f0e3ebfea4b..c45c7a26f984 100644
@@ -81,7 +81,16 @@ int raw_pci_write(unsigned int domain, unsigned int bus,
 
 int pcibus_to_node(struct pci_bus *bus)
 {
-	return dev_to_node(&bus->dev);
+	struct pci_config_window *cfg = bus->sysdata;
+	struct acpi_device *adev = NULL;
+	struct device *dev;
+
+	if (!acpi_disabled)
+		adev = to_acpi_device(cfg->parent);
+
+	dev = adev ? &adev->dev : &bus->dev;
+
+	return dev_to_node(dev);
 }
 EXPORT_SYMBOL(pcibus_to_node);
 
@@ -186,6 +195,8 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 	struct pci_bus *bus, *child;
 	struct acpi_pci_root_ops *root_ops;
 
+	set_dev_node(&root->device->dev, node);
+
 	ri = kzalloc_node(sizeof(*ri), GFP_KERNEL, node);
 	if (!ri)
 		return NULL;
Signature · 1 line
2.12.1
#1 lore raw

Hi Sergey,

Quoted 15 lines · Sergey Temerkhanov

This commit modifies ARM64-specific ACPI PCI support functions to properly set the numa_node property on host bridges and thus on PCI devices. Such support requires _PXM objects to be set in DSDT/SSDT tables describing PCI root bridges

---
 arch/arm64/kernel/pci.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
arch/arm64/kernel/pci.c +0 -0
index 4f0e3ebfea4b..c45c7a26f984 100644

arch/arm64/kernel/pci.c int raw_pci_write(unsigned int domain, unsigned int bus, · line 84

Quoted 5 lines
arch/arm64/kernel/pci.c +1 -1
@@ -81,7 +81,16 @@ int raw_pci_write(unsigned int domain, unsigned int bus,
 
 int pcibus_to_node(struct pci_bus *bus)
 {
-	return dev_to_node(&bus->dev);
+	struct pci_config_window *cfg = bus->sysdata;

Well, this implicit cast is a guess (ie it might be a DT sysdata and there you can't have a clue on what it really is).

Quoted 13 lines
arch/arm64/kernel/pci.c +9 -0
+	struct acpi_device *adev = NULL;
+	struct device *dev;
+
+	if (!acpi_disabled)
+		adev = to_acpi_device(cfg->parent);
+
+	dev = adev ? &adev->dev : &bus->dev;
+
+	return dev_to_node(dev);
 }
 EXPORT_SYMBOL(pcibus_to_node);
 

arch/arm64/kernel/pci.c struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) · line 198

Quoted 4 lines
arch/arm64/kernel/pci.c +1 -0
@@ -186,6 +195,8 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
 	struct pci_bus *bus, *child;
 	struct acpi_pci_root_ops *root_ops;
 
+	set_dev_node(&root->device->dev, node);

Ok I suspect this is one of those catch-22 issues with host bridge creation/scan code (like domain nr), let me have a look I will send you a patch next week when I figure out the call ordering required to make this work, I want to make sure we can make this work with DT and ACPI alike.

Thanks !
Lorenzo

Quoted 11 lines
arch/arm64/kernel/pci.c +1 -0
+
 	ri = kzalloc_node(sizeof(*ri), GFP_KERNEL, node);
 	if (!ri)
 		return NULL;
Signature · 6 lines
2.12.1

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw
Quoted 19 lines · Lorenzo Pieralisi

Hi Sergey,

Quoted 16 lines · Sergey Temerkhanov

This commit modifies ARM64-specific ACPI PCI support functions to properly set the numa_node property on host bridges and thus on PCI devices. Such support requires _PXM objects to be set in DSDT/SSDT tables describing PCI root bridges

---
 arch/arm64/kernel/pci.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
arch/arm64/kernel/pci.c +0 -0
index 4f0e3ebfea4b..c45c7a26f984 100644
@@ -81,7 +81,16 @@ int raw_pci_write(unsigned int domain, unsigned int bus,
 
Quoted 7 lines

arch/arm64/kernel/pci.c int raw_pci_write(unsigned int domain, unsigned int bus, · line 84

Quoted 4 lines
arch/arm64/kernel/pci.c +1 -1
 int pcibus_to_node(struct pci_bus *bus)
 {
-     return dev_to_node(&bus->dev);
+     struct pci_config_window *cfg = bus->sysdata;

Well, this implicit cast is a guess (ie it might be a DT sysdata and there you can't have a clue on what it really is).

Yes, but it's only accessed when acpi_disabled != 0. I just tried to save few lines and brackets :-)

Regards,
Sergey

Quoted 39 lines
Quoted 14 lines
arch/arm64/kernel/pci.c +9 -0
+     struct acpi_device *adev = NULL;
+     struct device *dev;
+
+     if (!acpi_disabled)
+             adev = to_acpi_device(cfg->parent);
+
+     dev = adev ? &adev->dev : &bus->dev;
+
+     return dev_to_node(dev);
 }
 EXPORT_SYMBOL(pcibus_to_node);
 

arch/arm64/kernel/pci.c struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) · line 198

Quoted 4 lines
arch/arm64/kernel/pci.c +1 -0
@@ -186,6 +195,8 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
      struct pci_bus *bus, *child;
      struct acpi_pci_root_ops *root_ops;
 
+     set_dev_node(&root->device->dev, node);

Ok I suspect this is one of those catch-22 issues with host bridge creation/scan code (like domain nr), let me have a look I will send you a patch next week when I figure out the call ordering required to make this work, I want to make sure we can make this work with DT and ACPI alike.

Thanks !
Lorenzo

Quoted 11 lines
arch/arm64/kernel/pci.c +1 -1
+
      ri = kzalloc_node(sizeof(*ri), GFP_KERNEL, node);
      if (!ri)
              return NULL;
--

2.12.1

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw

Hi Sergei,

Quoted 29 lines · Sergei Temerkhanov
Quoted 19 lines · Lorenzo Pieralisi

Hi Sergey,

Quoted 16 lines · Sergey Temerkhanov

This commit modifies ARM64-specific ACPI PCI support functions to properly set the numa_node property on host bridges and thus on PCI devices. Such support requires _PXM objects to be set in DSDT/SSDT tables describing PCI root bridges

---
 arch/arm64/kernel/pci.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
arch/arm64/kernel/pci.c +0 -0
index 4f0e3ebfea4b..c45c7a26f984 100644
@@ -81,7 +81,16 @@ int raw_pci_write(unsigned int domain, unsigned int bus,
 
Quoted 7 lines

arch/arm64/kernel/pci.c int raw_pci_write(unsigned int domain, unsigned int bus, · line 84

Quoted 4 lines
arch/arm64/kernel/pci.c +1 -1
 int pcibus_to_node(struct pci_bus *bus)
 {
-     return dev_to_node(&bus->dev);
+     struct pci_config_window *cfg = bus->sysdata;

Well, this implicit cast is a guess (ie it might be a DT sysdata and there you can't have a clue on what it really is).

Quoted 2 lines

Yes, but it's only accessed when acpi_disabled != 0. I just tried to save few lines and brackets :-)

I have put together a patch, I will drop it on linux-pci next week so that we can all have a look and test it.

Thanks !
Lorenzo

Quoted 42 lines

Regards,
Sergey

Quoted 39 lines
Quoted 14 lines
arch/arm64/kernel/pci.c +9 -0
+     struct acpi_device *adev = NULL;
+     struct device *dev;
+
+     if (!acpi_disabled)
+             adev = to_acpi_device(cfg->parent);
+
+     dev = adev ? &adev->dev : &bus->dev;
+
+     return dev_to_node(dev);
 }
 EXPORT_SYMBOL(pcibus_to_node);
 

arch/arm64/kernel/pci.c struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) · line 198

Quoted 4 lines
arch/arm64/kernel/pci.c +1 -0
@@ -186,6 +195,8 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
      struct pci_bus *bus, *child;
      struct acpi_pci_root_ops *root_ops;
 
+     set_dev_node(&root->device->dev, node);

Ok I suspect this is one of those catch-22 issues with host bridge creation/scan code (like domain nr), let me have a look I will send you a patch next week when I figure out the call ordering required to make this work, I want to make sure we can make this work with DT and ACPI alike.

Thanks !
Lorenzo

Quoted 11 lines
arch/arm64/kernel/pci.c +1 -1
+
      ri = kzalloc_node(sizeof(*ri), GFP_KERNEL, node);
      if (!ri)
              return NULL;
--

2.12.1

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html