Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

acpi: numa: Add support to enumerate and store extended linear address mode

Store the address mode as part of the cache attriutes. Export the mode
attribute to sysfs as all other cache attributes.

Link: https://lore.kernel.org/linux-cxl/668333b17e4b2_5639294fd@dwillia2-xfh.jf.intel.com.notmuch/
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Li Ming <ming.li@zohomail.com>
Reviewed-by: Alison Schofield <alison.schofield@intel.com>
Link: https://patch.msgid.link/20250226162224.3633792-2-dave.jiang@intel.com
Signed-off-by: Dave Jiang <dave.jiang@intel.com>

+20
+6
Documentation/ABI/stable/sysfs-devices-node
··· 177 177 The cache write policy: 0 for write-back, 1 for write-through, 178 178 other or unknown. 179 179 180 + What: /sys/devices/system/node/nodeX/memory_side_cache/indexY/address_mode 181 + Date: March 2025 182 + Contact: Dave Jiang <dave.jiang@intel.com> 183 + Description: 184 + The address mode: 0 for reserved, 1 for extended-linear. 185 + 180 186 What: /sys/devices/system/node/nodeX/x86/sgx_total_bytes 181 187 Date: November 2021 182 188 Contact: Jarkko Sakkinen <jarkko@kernel.org>
+5
drivers/acpi/numa/hmat.c
··· 506 506 switch ((attrs & ACPI_HMAT_CACHE_ASSOCIATIVITY) >> 8) { 507 507 case ACPI_HMAT_CA_DIRECT_MAPPED: 508 508 tcache->cache_attrs.indexing = NODE_CACHE_DIRECT_MAP; 509 + /* Extended Linear mode is only valid if cache is direct mapped */ 510 + if (cache->address_mode == ACPI_HMAT_CACHE_MODE_EXTENDED_LINEAR) { 511 + tcache->cache_attrs.address_mode = 512 + NODE_CACHE_ADDR_MODE_EXTENDED_LINEAR; 513 + } 509 514 break; 510 515 case ACPI_HMAT_CA_COMPLEX_CACHE_INDEXING: 511 516 tcache->cache_attrs.indexing = NODE_CACHE_INDEXED;
+2
drivers/base/node.c
··· 244 244 CACHE_ATTR(line_size, "%u") 245 245 CACHE_ATTR(indexing, "%u") 246 246 CACHE_ATTR(write_policy, "%u") 247 + CACHE_ATTR(address_mode, "%#x") 247 248 248 249 static struct attribute *cache_attrs[] = { 249 250 &dev_attr_indexing.attr, 250 251 &dev_attr_size.attr, 251 252 &dev_attr_line_size.attr, 252 253 &dev_attr_write_policy.attr, 254 + &dev_attr_address_mode.attr, 253 255 NULL, 254 256 }; 255 257 ATTRIBUTE_GROUPS(cache);
+7
include/linux/node.h
··· 57 57 NODE_CACHE_WRITE_OTHER, 58 58 }; 59 59 60 + enum cache_mode { 61 + NODE_CACHE_ADDR_MODE_RESERVED, 62 + NODE_CACHE_ADDR_MODE_EXTENDED_LINEAR, 63 + }; 64 + 60 65 /** 61 66 * struct node_cache_attrs - system memory caching attributes 62 67 * ··· 70 65 * @size: Total size of cache in bytes 71 66 * @line_size: Number of bytes fetched on a cache miss 72 67 * @level: The cache hierarchy level 68 + * @address_mode: The address mode 73 69 */ 74 70 struct node_cache_attrs { 75 71 enum cache_indexing indexing; ··· 78 72 u64 size; 79 73 u16 line_size; 80 74 u8 level; 75 + u16 address_mode; 81 76 }; 82 77 83 78 #ifdef CONFIG_HMEM_REPORTING