Skip to content

Commit 84b2592

Browse files
committed
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>
1 parent 2014c95 commit 84b2592

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

Documentation/ABI/stable/sysfs-devices-node

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,12 @@ Description:
177177
The cache write policy: 0 for write-back, 1 for write-through,
178178
other or unknown.
179179

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+
180186
What: /sys/devices/system/node/nodeX/x86/sgx_total_bytes
181187
Date: November 2021
182188
Contact: Jarkko Sakkinen <jarkko@kernel.org>

drivers/acpi/numa/hmat.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,11 @@ static __init int hmat_parse_cache(union acpi_subtable_headers *header,
506506
switch ((attrs & ACPI_HMAT_CACHE_ASSOCIATIVITY) >> 8) {
507507
case ACPI_HMAT_CA_DIRECT_MAPPED:
508508
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+
}
509514
break;
510515
case ACPI_HMAT_CA_COMPLEX_CACHE_INDEXING:
511516
tcache->cache_attrs.indexing = NODE_CACHE_INDEXED;

drivers/base/node.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,12 +244,14 @@ CACHE_ATTR(size, "%llu")
244244
CACHE_ATTR(line_size, "%u")
245245
CACHE_ATTR(indexing, "%u")
246246
CACHE_ATTR(write_policy, "%u")
247+
CACHE_ATTR(address_mode, "%#x")
247248

248249
static struct attribute *cache_attrs[] = {
249250
&dev_attr_indexing.attr,
250251
&dev_attr_size.attr,
251252
&dev_attr_line_size.attr,
252253
&dev_attr_write_policy.attr,
254+
&dev_attr_address_mode.attr,
253255
NULL,
254256
};
255257
ATTRIBUTE_GROUPS(cache);

include/linux/node.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ enum cache_write_policy {
5757
NODE_CACHE_WRITE_OTHER,
5858
};
5959

60+
enum cache_mode {
61+
NODE_CACHE_ADDR_MODE_RESERVED,
62+
NODE_CACHE_ADDR_MODE_EXTENDED_LINEAR,
63+
};
64+
6065
/**
6166
* struct node_cache_attrs - system memory caching attributes
6267
*
@@ -65,13 +70,15 @@ enum cache_write_policy {
6570
* @size: Total size of cache in bytes
6671
* @line_size: Number of bytes fetched on a cache miss
6772
* @level: The cache hierarchy level
73+
* @address_mode: The address mode
6874
*/
6975
struct node_cache_attrs {
7076
enum cache_indexing indexing;
7177
enum cache_write_policy write_policy;
7278
u64 size;
7379
u16 line_size;
7480
u8 level;
81+
u16 address_mode;
7582
};
7683

7784
#ifdef CONFIG_HMEM_REPORTING

0 commit comments

Comments
 (0)