Felix Held submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Arthur Heymans: Looks good to me, approved Shuo Liu: Looks good to me, but someone else must approve
soc/intel/xeon_sp/numa: Store pointer to device

Instead of a BDF number store a pointer to the device itself.

Change-Id: I3fef93c5e54c8af792102bcd25364c43b554a5f0
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/80257
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Shuo Liu <shuo.liu@intel.com>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
---
M src/soc/intel/xeon_sp/include/soc/numa.h
M src/soc/intel/xeon_sp/spr/chip.c
M src/soc/intel/xeon_sp/spr/numa.c
M src/soc/intel/xeon_sp/spr/soc_util.c
M src/soc/intel/xeon_sp/uncore_acpi_cxl.c
5 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/soc/intel/xeon_sp/include/soc/numa.h b/src/soc/intel/xeon_sp/include/soc/numa.h
index 48141c7..6aaf172 100644
--- a/src/soc/intel/xeon_sp/include/soc/numa.h
+++ b/src/soc/intel/xeon_sp/include/soc/numa.h
@@ -41,7 +41,7 @@
/*
* Below fields are set to 0 for processor domains.
*/
- uint32_t device_handle; /* This holds PCIe device segment, BDF info */
+ struct device *dev;
uint32_t base; /* Memory region base address in the unit of 64MB */
uint32_t size; /* Memory region size in the unit of 64MB */
};
diff --git a/src/soc/intel/xeon_sp/spr/chip.c b/src/soc/intel/xeon_sp/spr/chip.c
index abab0d2..cebe4fe 100644
--- a/src/soc/intel/xeon_sp/spr/chip.c
+++ b/src/soc/intel/xeon_sp/spr/chip.c
@@ -199,7 +199,7 @@
for (i = 0; i < pds.num_pds; i++) {
if (pds.pds[i].pd_type == PD_TYPE_PROCESSOR)
continue;
- ep_bus = pds.pds[i].device_handle >> 20;
+ ep_bus = PCI_BDF(pds.pds[i].dev) >> 20;
if (ep_bus == ecrc_bus + 1)
break;
}
diff --git a/src/soc/intel/xeon_sp/spr/numa.c b/src/soc/intel/xeon_sp/spr/numa.c
index ef1c153..169f4f8 100644
--- a/src/soc/intel/xeon_sp/spr/numa.c
+++ b/src/soc/intel/xeon_sp/spr/numa.c
@@ -19,7 +19,7 @@
printk(BIOS_DEBUG, "\tproximity domain %d:\n", i);
printk(BIOS_DEBUG, "\t\ttype:%d\n", pds.pds[i].pd_type);
printk(BIOS_DEBUG, "\t\tsocket_bitmap:0x%x\n", pds.pds[i].socket_bitmap);
- printk(BIOS_DEBUG, "\t\tdevice_handle:0x%x\n", pds.pds[i].device_handle);
+ printk(BIOS_DEBUG, "\t\tdevice:%s\n", pds.pds[i].dev ? dev_path(pds.pds[i].dev) : "");
printk(BIOS_DEBUG, "\t\tbase(64MB):0x%x\n", pds.pds[i].base);
printk(BIOS_DEBUG, "\t\tsize(64MB):0x%x\n", pds.pds[i].size);
}
@@ -85,7 +85,7 @@
pds.pds[i].base = node.Address;
pds.pds[i].size = node.Size;
dev = pcie_find_dsn(node.SerialNumber, node.VendorId, 0);
- pds.pds[i].device_handle = PCI_BDF(dev);
+ pds.pds[i].dev = dev;
pds.pds[i].distances = malloc(sizeof(uint8_t) * pds.num_pds);
if (!pds.pds[i].distances)
die("%s %d out of memory.", __FILE__, __LINE__);
diff --git a/src/soc/intel/xeon_sp/spr/soc_util.c b/src/soc/intel/xeon_sp/spr/soc_util.c
index fb87611..a2516df 100644
--- a/src/soc/intel/xeon_sp/spr/soc_util.c
+++ b/src/soc/intel/xeon_sp/spr/soc_util.c
@@ -91,7 +91,7 @@
if (pds.pds[i].pd_type == PD_TYPE_PROCESSOR)
continue;

- uint32_t bus = pds.pds[i].device_handle >> 20;
+ uint32_t bus = PCI_BDF(pds.pds[i].dev) >> 20;
if (bus >= res->BusBase && bus <= res->BusLimit)
return true;
}
diff --git a/src/soc/intel/xeon_sp/uncore_acpi_cxl.c b/src/soc/intel/xeon_sp/uncore_acpi_cxl.c
index de776eb..5bd13d0 100644
--- a/src/soc/intel/xeon_sp/uncore_acpi_cxl.c
+++ b/src/soc/intel/xeon_sp/uncore_acpi_cxl.c
@@ -1,5 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */

+#include <device/pci_ops.h>
#include <soc/acpi.h>
#include <soc/numa.h>
#include <soc/util.h>
@@ -16,9 +17,9 @@
uint8_t bus, dev, func;
uint32_t base, size;
for (uint8_t i = soc_get_num_cpus(); i < pds.num_pds; i++) {
- bus = pds.pds[i].device_handle >> 20;
- dev = (pds.pds[i].device_handle >> 15) & 0x1f;
- func = (pds.pds[i].device_handle >> 12) & 0x07;
+ bus = PCI_BDF(pds.pds[i].dev) >> 20;
+ dev = (PCI_BDF(pds.pds[i].dev) >> 15) & 0x1f;
+ func = (PCI_BDF(pds.pds[i].dev) >> 12) & 0x07;
printk(BIOS_DEBUG,
"adding srat GIA ID: %d, seg: 0x%x, bus: 0x%x, dev: 0x%x, func: 0x%x\n",
i, seg, bus, dev, func);

To view, visit change 80257. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: I3fef93c5e54c8af792102bcd25364c43b554a5f0
Gerrit-Change-Number: 80257
Gerrit-PatchSet: 5
Gerrit-Owner: Patrick Rudolph <patrick.rudolph@9elements.com>
Gerrit-Reviewer: Arthur Heymans <arthur@aheymans.xyz>
Gerrit-Reviewer: Christian Walter <christian.walter@9elements.com>
Gerrit-Reviewer: Felix Held <felix-coreboot@felixheld.de>
Gerrit-Reviewer: Johnny Lin <Johnny_Lin@wiwynn.com>
Gerrit-Reviewer: Lean Sheng Tan <sheng.tan@9elements.com>
Gerrit-Reviewer: Shuo Liu <shuo.liu@intel.com>
Gerrit-Reviewer: Tim Chu <Tim.Chu@quantatw.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-MessageType: merged