Commit 69b789b6 authored by Dave Jiang's avatar Dave Jiang Committed by Dan Williams
Browse files

acpi: numa: Create enum for memory_target access coordinates indexing



Create enums to provide named indexing for the access coordinate array.
This is in preparation for adding generic port support which will add a
third index in the array to keep the generic port attributes separate from
the memory attributes.

Reviewed-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: default avatarDave Jiang <dave.jiang@intel.com>
Acked-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://lore.kernel.org/r/170319616332.2212653.3872789279950567889.stgit@djiang5-mobl3


Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent 6a954e94
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -58,12 +58,18 @@ struct target_cache {
	struct node_cache_attrs cache_attrs;
};

enum {
	NODE_ACCESS_CLASS_0 = 0,
	NODE_ACCESS_CLASS_1,
	NODE_ACCESS_CLASS_MAX,
};

struct memory_target {
	struct list_head node;
	unsigned int memory_pxm;
	unsigned int processor_pxm;
	struct resource memregions;
	struct access_coordinate coord[2];
	struct access_coordinate coord[NODE_ACCESS_CLASS_MAX];
	struct list_head caches;
	struct node_cache_attrs cache_attrs;
	bool registered;
@@ -339,10 +345,12 @@ static __init int hmat_parse_locality(union acpi_subtable_headers *header,
			if (mem_hier == ACPI_HMAT_MEMORY) {
				target = find_mem_target(targs[targ]);
				if (target && target->processor_pxm == inits[init]) {
					hmat_update_target_access(target, type, value, 0);
					hmat_update_target_access(target, type, value,
								  NODE_ACCESS_CLASS_0);
					/* If the node has a CPU, update access 1 */
					if (node_state(pxm_to_node(inits[init]), N_CPU))
						hmat_update_target_access(target, type, value, 1);
						hmat_update_target_access(target, type, value,
									  NODE_ACCESS_CLASS_1);
				}
			}
		}
@@ -726,8 +734,8 @@ static void hmat_register_target(struct memory_target *target)
	if (!target->registered) {
		hmat_register_target_initiators(target);
		hmat_register_target_cache(target);
		hmat_register_target_perf(target, 0);
		hmat_register_target_perf(target, 1);
		hmat_register_target_perf(target, NODE_ACCESS_CLASS_0);
		hmat_register_target_perf(target, NODE_ACCESS_CLASS_1);
		target->registered = true;
	}
	mutex_unlock(&target_lock);