diff mbox series

[v13,06/19] acpi: numa: Add setting of generic port system locality attributes

Message ID 170198993962.3522351.12813244732508169089.stgit@djiang5-mobl3
State Superseded
Headers show
Series cxl: Add support for QTG ID retrieval for CXL subsystem | expand

Commit Message

Dave Jiang Dec. 7, 2023, 10:58 p.m. UTC
Add generic port support for the parsing of HMAT system locality sub-table.
The attributes will be added to the third array member of the access
coordinates in order to not mix with the existing memory attributes. It
only provides the system locality attributes from initator to the
generic port targets and is missing the rest of the data to the actual
memory device.

The complete attributes will be updated when a memory device is
attached and the system locality information is calculated end to end.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/numa/hmat.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/acpi/numa/hmat.c b/drivers/acpi/numa/hmat.c
index 4cae2e84251a..70a6e775856d 100644
--- a/drivers/acpi/numa/hmat.c
+++ b/drivers/acpi/numa/hmat.c
@@ -61,6 +61,7 @@  struct target_cache {
 enum {
 	NODE_ACCESS_CLASS_0 = 0,
 	NODE_ACCESS_CLASS_1,
+	NODE_ACCESS_CLASS_GENPORT_SINK,
 	NODE_ACCESS_CLASS_MAX,
 };
 
@@ -327,10 +328,13 @@  static __init void hmat_update_target(unsigned int tgt_pxm, unsigned int init_px
 {
 	struct memory_target *target = find_mem_target(tgt_pxm);
 
+	if (!target)
+		return;
+
 	if (mem_hier != ACPI_HMAT_MEMORY)
 		return;
 
-	if (target && target->processor_pxm == init_pxm) {
+	if (target->processor_pxm == init_pxm) {
 		hmat_update_target_access(target, type, value,
 					  NODE_ACCESS_CLASS_0);
 		/* If the node has a CPU, update access 1 */
@@ -338,6 +342,11 @@  static __init void hmat_update_target(unsigned int tgt_pxm, unsigned int init_px
 			hmat_update_target_access(target, type, value,
 						  NODE_ACCESS_CLASS_1);
 	}
+
+	/* Update access from generic port target */
+	if (init_pxm == 0 && *(u16 *)target->gen_port_device_handle)
+		hmat_update_target_access(target, type, value,
+					  NODE_ACCESS_CLASS_GENPORT_SINK);
 }
 
 static __init int hmat_parse_locality(union acpi_subtable_headers *header,