Skip to content

Commit a3a3e34

Browse files
davejiangdjbw
authored andcommitted
acpi: numa: Add setting of generic port system locality attributes
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 initiator 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. Through hmat_update_target_attrs(), the best performance attributes will be setup in target->coord. 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> Link: https://lore.kernel.org/r/170319618135.2212653.13778540010384821833.stgit@djiang5-mobl3 Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent 7920565 commit a3a3e34

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

drivers/acpi/numa/hmat.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ struct target_cache {
6161
enum {
6262
NODE_ACCESS_CLASS_0 = 0,
6363
NODE_ACCESS_CLASS_1,
64+
NODE_ACCESS_CLASS_GENPORT_SINK,
6465
NODE_ACCESS_CLASS_MAX,
6566
};
6667

@@ -654,6 +655,11 @@ static void hmat_update_target_attrs(struct memory_target *target,
654655
u32 best = 0;
655656
int i;
656657

658+
/* Don't update for generic port if there's no device handle */
659+
if (access == NODE_ACCESS_CLASS_GENPORT_SINK &&
660+
!(*(u16 *)target->gen_port_device_handle))
661+
return;
662+
657663
bitmap_zero(p_nodes, MAX_NUMNODES);
658664
/*
659665
* If the Address Range Structure provides a local processor pxm, set
@@ -723,6 +729,14 @@ static void __hmat_register_target_initiators(struct memory_target *target,
723729
}
724730
}
725731

732+
static void hmat_register_generic_target_initiators(struct memory_target *target)
733+
{
734+
static DECLARE_BITMAP(p_nodes, MAX_NUMNODES);
735+
736+
__hmat_register_target_initiators(target, p_nodes,
737+
NODE_ACCESS_CLASS_GENPORT_SINK);
738+
}
739+
726740
static void hmat_register_target_initiators(struct memory_target *target)
727741
{
728742
static DECLARE_BITMAP(p_nodes, MAX_NUMNODES);
@@ -774,6 +788,17 @@ static void hmat_register_target(struct memory_target *target)
774788
*/
775789
hmat_register_target_devices(target);
776790

791+
/*
792+
* Register generic port perf numbers. The nid may not be
793+
* initialized and is still NUMA_NO_NODE.
794+
*/
795+
mutex_lock(&target_lock);
796+
if (*(u16 *)target->gen_port_device_handle) {
797+
hmat_register_generic_target_initiators(target);
798+
target->registered = true;
799+
}
800+
mutex_unlock(&target_lock);
801+
777802
/*
778803
* Skip offline nodes. This can happen when memory
779804
* marked EFI_MEMORY_SP, "specific purpose", is applied

0 commit comments

Comments
 (0)