Lines Matching +full:locality +full:- +full:specific

1 // SPDX-License-Identifier: GPL-2.0
27 #include <linux/memory-tiers.h>
96 if (initiator->processor_pxm == cpu_pxm) in find_mem_initiator()
106 if (target->memory_pxm == mem_pxm) in find_mem_target()
118 uid_ptr = target->gen_port_device_handle + 8; in acpi_find_genport_target()
128 * acpi_get_genport_coordinates - Retrieve the access coordinates for a generic port
145 return -ENOENT; in acpi_get_genport_coordinates()
148 target->coord[NODE_ACCESS_CLASS_GENPORT_SINK_LOCAL]; in acpi_get_genport_coordinates()
150 target->coord[NODE_ACCESS_CLASS_GENPORT_SINK_CPU]; in acpi_get_genport_coordinates()
171 initiator->processor_pxm = cpu_pxm; in alloc_memory_initiator()
172 initiator->has_cpu = node_state(pxm_to_node(cpu_pxm), N_CPU); in alloc_memory_initiator()
173 list_add_tail(&initiator->node, &initiators); in alloc_memory_initiator()
185 target->memory_pxm = mem_pxm; in alloc_target()
186 target->processor_pxm = PXM_INVAL; in alloc_target()
187 target->memregions = (struct resource) { in alloc_target()
190 .end = -1, in alloc_target()
193 list_add_tail(&target->node, &targets); in alloc_target()
194 INIT_LIST_HEAD(&target->caches); in alloc_target()
212 * in the per-target memregions resource tree. in alloc_memory_target()
214 if (!__request_region(&target->memregions, start, len, "memory target", in alloc_memory_target()
216 pr_warn("failed to reserve %#llx - %#llx in pxm: %d\n", in alloc_memory_target()
228 memcpy(target->gen_port_device_handle, handle, in alloc_genport_target()
308 target->coord[access].read_latency = value; in hmat_update_target_access()
309 target->coord[access].write_latency = value; in hmat_update_target_access()
312 target->coord[access].read_latency = value; in hmat_update_target_access()
315 target->coord[access].write_latency = value; in hmat_update_target_access()
318 target->coord[access].read_bandwidth = value; in hmat_update_target_access()
319 target->coord[access].write_bandwidth = value; in hmat_update_target_access()
322 target->coord[access].read_bandwidth = value; in hmat_update_target_access()
325 target->coord[access].write_bandwidth = value; in hmat_update_target_access()
339 return -EINVAL; in hmat_update_target_coordinates()
345 return -ENODEV; in hmat_update_target_coordinates()
348 coord->read_latency, access); in hmat_update_target_coordinates()
350 coord->write_latency, access); in hmat_update_target_coordinates()
352 coord->read_bandwidth, access); in hmat_update_target_coordinates()
354 coord->write_bandwidth, access); in hmat_update_target_coordinates()
355 target->ext_updated = true; in hmat_update_target_coordinates()
367 pr_notice_once("Failed to allocate HMAT locality\n"); in hmat_add_locality()
371 loc->hmat_loc = hmat_loc; in hmat_add_locality()
372 list_add_tail(&loc->node, &localities); in hmat_add_locality()
374 switch (hmat_loc->data_type) { in hmat_add_locality()
408 if (target && target->processor_pxm == init_pxm) { in hmat_update_target()
427 if (hmat_loc->header.length < sizeof(*hmat_loc)) { in hmat_parse_locality()
428 pr_notice("Unexpected locality header length: %u\n", in hmat_parse_locality()
429 hmat_loc->header.length); in hmat_parse_locality()
430 return -EINVAL; in hmat_parse_locality()
433 type = hmat_loc->data_type; in hmat_parse_locality()
434 mem_hier = hmat_loc->flags & ACPI_HMAT_MEMORY_HIERARCHY; in hmat_parse_locality()
435 ipds = hmat_loc->number_of_initiator_Pds; in hmat_parse_locality()
436 tpds = hmat_loc->number_of_target_Pds; in hmat_parse_locality()
439 if (hmat_loc->header.length < total_size) { in hmat_parse_locality()
440 pr_notice("Unexpected locality header length:%u, minimum required:%u\n", in hmat_parse_locality()
441 hmat_loc->header.length, total_size); in hmat_parse_locality()
442 return -EINVAL; in hmat_parse_locality()
445 pr_info("Locality: Flags:%02x Type:%s Initiator Domains:%u Target Domains:%u Base:%lld\n", in hmat_parse_locality()
446 hmat_loc->flags, hmat_data_type(type), ipds, tpds, in hmat_parse_locality()
447 hmat_loc->entry_base_unit); in hmat_parse_locality()
456 hmat_loc->entry_base_unit, in hmat_parse_locality()
458 pr_info(" Initiator-Target[%u-%u]:%u%s\n", in hmat_parse_locality()
481 if (cache->header.length < sizeof(*cache)) { in hmat_parse_cache()
483 cache->header.length); in hmat_parse_cache()
484 return -EINVAL; in hmat_parse_cache()
487 attrs = cache->cache_attributes; in hmat_parse_cache()
489 cache->memory_PD, cache->cache_size, attrs, in hmat_parse_cache()
490 cache->number_of_SMBIOShandles); in hmat_parse_cache()
492 target = find_mem_target(cache->memory_PD); in hmat_parse_cache()
502 tcache->cache_attrs.size = cache->cache_size; in hmat_parse_cache()
503 tcache->cache_attrs.level = (attrs & ACPI_HMAT_CACHE_LEVEL) >> 4; in hmat_parse_cache()
504 tcache->cache_attrs.line_size = (attrs & ACPI_HMAT_CACHE_LINE_SIZE) >> 16; in hmat_parse_cache()
508 tcache->cache_attrs.indexing = NODE_CACHE_DIRECT_MAP; in hmat_parse_cache()
511 tcache->cache_attrs.indexing = NODE_CACHE_INDEXED; in hmat_parse_cache()
515 tcache->cache_attrs.indexing = NODE_CACHE_OTHER; in hmat_parse_cache()
521 tcache->cache_attrs.write_policy = NODE_CACHE_WRITE_BACK; in hmat_parse_cache()
524 tcache->cache_attrs.write_policy = NODE_CACHE_WRITE_THROUGH; in hmat_parse_cache()
528 tcache->cache_attrs.write_policy = NODE_CACHE_WRITE_OTHER; in hmat_parse_cache()
531 list_add_tail(&tcache->node, &target->caches); in hmat_parse_cache()
542 if (p->header.length != sizeof(*p)) { in hmat_parse_proximity_domain()
544 p->header.length); in hmat_parse_proximity_domain()
545 return -EINVAL; in hmat_parse_proximity_domain()
550 p->reserved3, p->reserved4, p->flags, p->processor_PD, in hmat_parse_proximity_domain()
551 p->memory_PD); in hmat_parse_proximity_domain()
554 p->flags, p->processor_PD, p->memory_PD); in hmat_parse_proximity_domain()
556 if ((hmat_revision == 1 && p->flags & ACPI_HMAT_MEMORY_PD_VALID) || in hmat_parse_proximity_domain()
558 target = find_mem_target(p->memory_PD); in hmat_parse_proximity_domain()
561 return -EINVAL; in hmat_parse_proximity_domain()
564 if (target && p->flags & ACPI_HMAT_PROCESSOR_PD_VALID) { in hmat_parse_proximity_domain()
565 int p_node = pxm_to_node(p->processor_PD); in hmat_parse_proximity_domain()
569 return -EINVAL; in hmat_parse_proximity_domain()
571 target->processor_pxm = p->processor_PD; in hmat_parse_proximity_domain()
583 return -EINVAL; in hmat_parse_subtable()
585 switch (hdr->type) { in hmat_parse_subtable()
593 return -EINVAL; in hmat_parse_subtable()
603 return -EINVAL; in srat_parse_mem_affinity()
604 if (!(ma->flags & ACPI_SRAT_MEM_ENABLED)) in srat_parse_mem_affinity()
606 alloc_memory_target(ma->proximity_domain, ma->base_address, ma->length); in srat_parse_mem_affinity()
616 return -EINVAL; in srat_parse_genport_affinity()
618 if (!(ga->flags & ACPI_SRAT_GENERIC_AFFINITY_ENABLED)) in srat_parse_genport_affinity()
622 if (ga->device_handle_type != 0) in srat_parse_genport_affinity()
625 alloc_genport_target(ga->proximity_domain, in srat_parse_genport_affinity()
626 (u8 *)ga->device_handle); in srat_parse_genport_affinity()
639 ipds = hmat_loc->number_of_initiator_Pds; in hmat_initiator_perf()
640 tpds = hmat_loc->number_of_target_Pds; in hmat_initiator_perf()
646 if (inits[i] == initiator->processor_pxm) { in hmat_initiator_perf()
656 if (targs[i] == target->memory_pxm) { in hmat_initiator_perf()
665 hmat_loc->entry_base_unit, in hmat_initiator_perf()
666 hmat_loc->data_type); in hmat_initiator_perf()
707 return ia->processor_pxm - ib->processor_pxm; in initiator_cmp()
715 return -ENXIO; in initiators_to_nodemask()
718 set_bit(initiator->processor_pxm, p_nodes); in initiators_to_nodemask()
733 if (target->ext_updated) in hmat_update_target_attrs()
739 !(*(u16 *)target->gen_port_device_handle)) in hmat_update_target_attrs()
748 if (target->processor_pxm != PXM_INVAL) { in hmat_update_target_attrs()
749 cpu_nid = pxm_to_node(target->processor_pxm); in hmat_update_target_attrs()
752 set_bit(target->processor_pxm, p_nodes); in hmat_update_target_attrs()
781 !initiator->has_cpu) { in hmat_update_target_attrs()
782 clear_bit(initiator->processor_pxm, p_nodes); in hmat_update_target_attrs()
785 if (!test_bit(initiator->processor_pxm, p_nodes)) in hmat_update_target_attrs()
788 value = hmat_initiator_perf(target, initiator, loc->hmat_loc); in hmat_update_target_attrs()
789 if (hmat_update_best(loc->hmat_loc->data_type, value, &best)) in hmat_update_target_attrs()
790 bitmap_clear(p_nodes, 0, initiator->processor_pxm); in hmat_update_target_attrs()
792 clear_bit(initiator->processor_pxm, p_nodes); in hmat_update_target_attrs()
795 hmat_update_target_access(target, loc->hmat_loc->data_type, best, access); in hmat_update_target_attrs()
806 mem_nid = pxm_to_node(target->memory_pxm); in __hmat_register_target_initiators()
836 unsigned mem_nid = pxm_to_node(target->memory_pxm); in hmat_register_target_cache()
839 list_for_each_entry(tcache, &target->caches, node) in hmat_register_target_cache()
840 node_add_cache(mem_nid, &tcache->cache_attrs); in hmat_register_target_cache()
845 unsigned mem_nid = pxm_to_node(target->memory_pxm); in hmat_register_target_perf()
846 node_set_perf_attrs(mem_nid, &target->coord[access], access); in hmat_register_target_perf()
860 for (res = target->memregions.child; res; res = res->sibling) { in hmat_register_target_devices()
861 int target_nid = pxm_to_node(target->memory_pxm); in hmat_register_target_devices()
869 int nid = pxm_to_node(target->memory_pxm); in hmat_register_target()
882 if (*(u16 *)target->gen_port_device_handle) { in hmat_register_target()
884 target->registered = true; in hmat_register_target()
890 * marked EFI_MEMORY_SP, "specific purpose", is applied in hmat_register_target()
893 * memory-only "hotplug" node is offline. in hmat_register_target()
899 if (!target->registered) { in hmat_register_target()
904 target->registered = true; in hmat_register_target()
922 int pxm, nid = mnb->status_change_nid; in hmat_callback()
948 attrs = &target->coord[ACCESS_COORDINATE_CPU]; in hmat_set_default_dram_perf()
975 perf = &target->coord[ACCESS_COORDINATE_CPU]; in hmat_calculate_adistance()
998 list_for_each_entry_safe(tcache, cnext, &target->caches, node) { in hmat_free_structures()
999 list_del(&tcache->node); in hmat_free_structures()
1003 list_del(&target->node); in hmat_free_structures()
1004 res = target->memregions.child; in hmat_free_structures()
1006 res_next = res->sibling; in hmat_free_structures()
1007 __release_region(&target->memregions, res->start, in hmat_free_structures()
1015 list_del(&initiator->node); in hmat_free_structures()
1020 list_del(&loc->node); in hmat_free_structures()
1056 hmat_revision = tbl->revision; in hmat_init()