Lines Matching +full:revision +full:- +full:id

1 // SPDX-License-Identifier: GPL-2.0
3 * pptt.c - parsing of Processor Properties Topology Table (PPTT)
33 if (pptt_ref + sizeof(struct acpi_subtable_header) > table_hdr->length) in fetch_pptt_subtable()
38 if (entry->length == 0) in fetch_pptt_subtable()
41 if (pptt_ref + entry->length > table_hdr->length) in fetch_pptt_subtable()
65 if (resource >= node->number_of_priv_resources) in acpi_get_pptt_resource()
81 * acpi_pptt_walk_cache() - Attempt to find the requested acpi_pptt_cache
111 if (res->type != ACPI_PPTT_TYPE_CACHE) in acpi_pptt_walk_cache()
118 if (!(cache->flags & ACPI_PPTT_CACHE_TYPE_VALID)) { in acpi_pptt_walk_cache()
119 cache = fetch_pptt_cache(table_hdr, cache->next_level_of_cache); in acpi_pptt_walk_cache()
124 (acpi_pptt_match_type(cache->attributes, ACPI_PPTT_CACHE_TYPE_DATA) || in acpi_pptt_walk_cache()
125 acpi_pptt_match_type(cache->attributes, ACPI_PPTT_CACHE_TYPE_INSTR))) in acpi_pptt_walk_cache()
129 acpi_pptt_match_type(cache->attributes, type)) { in acpi_pptt_walk_cache()
141 cache = fetch_pptt_cache(table_hdr, cache->next_level_of_cache); in acpi_pptt_walk_cache()
180 * acpi_count_levels() - Given a PPTT table, and a CPU node, count the cache
201 cpu_node = fetch_pptt_node(table_hdr, cpu_node->parent); in acpi_count_levels()
206 * acpi_pptt_leaf_node() - Given a processor node, determine if its a leaf
225 if (table_hdr->revision > 1) in acpi_pptt_leaf_node()
226 return (node->flags & ACPI_PPTT_ACPI_LEAF_NODE); in acpi_pptt_leaf_node()
228 table_end = (unsigned long)table_hdr + table_hdr->length; in acpi_pptt_leaf_node()
236 if (entry->type == ACPI_PPTT_TYPE_PROCESSOR && in acpi_pptt_leaf_node()
237 cpu_node->parent == node_entry) in acpi_pptt_leaf_node()
239 if (entry->length == 0) in acpi_pptt_leaf_node()
242 entry->length); in acpi_pptt_leaf_node()
249 * acpi_find_processor_node() - Given a PPTT table find the requested processor
270 table_end = (unsigned long)table_hdr + table_hdr->length; in acpi_find_processor_node()
279 if (entry->length == 0) { in acpi_find_processor_node()
283 if (entry->type == ACPI_PPTT_TYPE_PROCESSOR && in acpi_find_processor_node()
284 acpi_cpu_id == cpu_node->acpi_processor_id && in acpi_find_processor_node()
290 entry->length); in acpi_find_processor_node()
338 cpu_node = fetch_pptt_node(table_hdr, cpu_node->parent); in acpi_find_cache_node()
345 * update_cache_properties() - Update cacheinfo for the given processor
349 * @revision: The revision of the PPTT table
360 u8 revision) in update_cache_properties() argument
364 this_leaf->fw_token = cpu_node; in update_cache_properties()
365 if (found_cache->flags & ACPI_PPTT_SIZE_PROPERTY_VALID) in update_cache_properties()
366 this_leaf->size = found_cache->size; in update_cache_properties()
367 if (found_cache->flags & ACPI_PPTT_LINE_SIZE_VALID) in update_cache_properties()
368 this_leaf->coherency_line_size = found_cache->line_size; in update_cache_properties()
369 if (found_cache->flags & ACPI_PPTT_NUMBER_OF_SETS_VALID) in update_cache_properties()
370 this_leaf->number_of_sets = found_cache->number_of_sets; in update_cache_properties()
371 if (found_cache->flags & ACPI_PPTT_ASSOCIATIVITY_VALID) in update_cache_properties()
372 this_leaf->ways_of_associativity = found_cache->associativity; in update_cache_properties()
373 if (found_cache->flags & ACPI_PPTT_WRITE_POLICY_VALID) { in update_cache_properties()
374 switch (found_cache->attributes & ACPI_PPTT_MASK_WRITE_POLICY) { in update_cache_properties()
376 this_leaf->attributes = CACHE_WRITE_THROUGH; in update_cache_properties()
379 this_leaf->attributes = CACHE_WRITE_BACK; in update_cache_properties()
383 if (found_cache->flags & ACPI_PPTT_ALLOCATION_TYPE_VALID) { in update_cache_properties()
384 switch (found_cache->attributes & ACPI_PPTT_MASK_ALLOCATION_TYPE) { in update_cache_properties()
386 this_leaf->attributes |= CACHE_READ_ALLOCATE; in update_cache_properties()
389 this_leaf->attributes |= CACHE_WRITE_ALLOCATE; in update_cache_properties()
393 this_leaf->attributes |= in update_cache_properties()
408 if (this_leaf->type == CACHE_TYPE_NOCACHE && in update_cache_properties()
409 found_cache->flags & ACPI_PPTT_CACHE_TYPE_VALID) in update_cache_properties()
410 this_leaf->type = CACHE_TYPE_UNIFIED; in update_cache_properties()
412 if (revision >= 3 && (found_cache->flags & ACPI_PPTT_CACHE_ID_VALID)) { in update_cache_properties()
415 this_leaf->id = found_cache_v1->cache_id; in update_cache_properties()
416 this_leaf->attributes |= CACHE_ID; in update_cache_properties()
430 while (index < get_cpu_cacheinfo(cpu)->num_leaves) { in cache_setup_acpi_cpu()
431 this_leaf = this_cpu_ci->info_list + index; in cache_setup_acpi_cpu()
433 this_leaf->type, in cache_setup_acpi_cpu()
434 this_leaf->level, in cache_setup_acpi_cpu()
440 table->revision); in cache_setup_acpi_cpu()
451 /* heterogeneous machines must use PPTT revision > 1 */ in flag_identical()
452 if (table_hdr->revision < 2) in flag_identical()
456 if (cpu->flags & ACPI_PPTT_ACPI_IDENTICAL) { in flag_identical()
457 next = fetch_pptt_node(table_hdr, cpu->parent); in flag_identical()
458 if (!(next && next->flags & ACPI_PPTT_ACPI_IDENTICAL)) in flag_identical()
479 } else if (cpu->flags & flag) in acpi_find_processor_tag()
482 prev_node = fetch_pptt_node(table_hdr, cpu->parent); in acpi_find_processor_tag()
486 level--; in acpi_find_processor_tag()
497 * topology_get_acpi_cpu_tag() - Find a unique topology value for a feature
507 * Return: Unique value, or -ENOENT if unable to locate CPU
521 * an actual processor, then ACPI processor ID must be valid. in topology_get_acpi_cpu_tag()
526 cpu_node->flags & ACPI_PPTT_ACPI_PROCESSOR_ID_VALID) in topology_get_acpi_cpu_tag()
527 return cpu_node->acpi_processor_id; in topology_get_acpi_cpu_tag()
532 return -ENOENT; in topology_get_acpi_cpu_tag()
564 return -ENOENT; in find_acpi_cpu_topology_tag()
574 * check_acpi_cpu_flag() - Determine if CPU node has a flag set
576 * @rev: The minimum PPTT revision defining the flag
581 * Return: -ENOENT if the PPTT doesn't exist, the CPU cannot be found or
582 * the table revision isn't new enough.
591 int ret = -ENOENT; in check_acpi_cpu_flag()
595 return -ENOENT; in check_acpi_cpu_flag()
597 if (table->revision >= rev) in check_acpi_cpu_flag()
601 ret = (cpu_node->flags & flag) != 0; in check_acpi_cpu_flag()
607 * acpi_get_cache_info() - Determine the number of cache levels and
618 * Return: -ENOENT if no PPTT table or no PPTT processor struct found.
634 return -ENOENT; in acpi_get_cache_info()
641 return -ENOENT; in acpi_get_cache_info()
646 *levels, split_levels ? *split_levels : -1); in acpi_get_cache_info()
652 * cache_setup_acpi() - Override CPU cache topology with data from the PPTT
662 * Return: -ENOENT on failure to find table, or 0 on success
670 return -ENOENT; in cache_setup_acpi()
680 * acpi_pptt_cpu_is_thread() - Determine if CPU is a thread
685 * -ENOENT ,if the PPTT doesn't exist, the CPU cannot be found or
686 * the table revision isn't new enough.
694 * find_acpi_cpu_topology() - Determine a unique topology value for a given CPU
696 * @level: The topological level for which we would like a unique ID
698 * Determine a topology unique ID for each thread/core/cluster/mc_grouping
699 * /socket/etc. This ID can then be used to group peers, which will have
704 * same unique ID. The unique id for level 0 is the acpi processor id. All
708 * Return: -ENOENT if the PPTT doesn't exist, or the CPU cannot be found.
717 * find_acpi_cpu_topology_package() - Determine a unique CPU package value
720 * Determine a topology unique package ID for the given CPU.
721 * This ID can then be used to group peers, which will have matching ids.
726 * Return: -ENOENT if the PPTT doesn't exist, or the CPU cannot be found.
736 * find_acpi_cpu_topology_cluster() - Determine a unique CPU cluster value
739 * Determine a topology unique cluster ID for the given CPU/thread.
740 * This ID can then be used to group peers, which will have matching ids.
743 * multi-thread CPU, it will be the level above the CPU, not the thread.
744 * It may not exist in single CPU systems. In simple multi-CPU systems,
747 * Return: -ENOENT if the PPTT doesn't exist, the CPU cannot be found
762 return -ENOENT; in find_acpi_cpu_topology_cluster()
766 if (!cpu_node || !cpu_node->parent) in find_acpi_cpu_topology_cluster()
767 return -ENOENT; in find_acpi_cpu_topology_cluster()
769 is_thread = cpu_node->flags & ACPI_PPTT_ACPI_PROCESSOR_IS_THREAD; in find_acpi_cpu_topology_cluster()
770 cluster_node = fetch_pptt_node(table, cpu_node->parent); in find_acpi_cpu_topology_cluster()
772 return -ENOENT; in find_acpi_cpu_topology_cluster()
775 if (!cluster_node->parent) in find_acpi_cpu_topology_cluster()
776 return -ENOENT; in find_acpi_cpu_topology_cluster()
778 cluster_node = fetch_pptt_node(table, cluster_node->parent); in find_acpi_cpu_topology_cluster()
780 return -ENOENT; in find_acpi_cpu_topology_cluster()
782 if (cluster_node->flags & ACPI_PPTT_ACPI_PROCESSOR_ID_VALID) in find_acpi_cpu_topology_cluster()
783 retval = cluster_node->acpi_processor_id; in find_acpi_cpu_topology_cluster()
791 * find_acpi_cpu_topology_hetero_id() - Get a core architecture tag
806 * Return: -ENOENT if the PPTT doesn't exist, or the CPU cannot be found.