diff options
| author | Tony Luck <tony.luck@intel.com> | 2025-05-05 10:38:17 -0700 |
|---|---|---|
| committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2025-05-12 15:43:16 +0200 |
| commit | b9020bdb9f76b58117f9902db3047693fd12b11b (patch) | |
| tree | 199390347bef9841b4992418b1f885f5b9ab1d57 /drivers/acpi/acpi_mrrm.c | |
| parent | fec2686d4d94f91056e510c541a76c192a45a7a0 (diff) | |
ACPI: MRRM: Minimal parse of ACPI MRRM table
The resctrl file system code needs to know how many region tags
are supported. Parse the ACPI MRRM table and save the max_mem_region
value.
Provide a function for resctrl to collect that value.
Signed-off-by: Tony Luck <tony.luck@intel.com>
Link: https://patch.msgid.link/20250505173819.419271-2-tony.luck@intel.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/acpi_mrrm.c')
| -rw-r--r-- | drivers/acpi/acpi_mrrm.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/drivers/acpi/acpi_mrrm.c b/drivers/acpi/acpi_mrrm.c new file mode 100644 index 000000000000..ab8022e58da5 --- /dev/null +++ b/drivers/acpi/acpi_mrrm.c @@ -0,0 +1,42 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2025, Intel Corporation. + * + * Memory Range and Region Mapping (MRRM) structure + */ + +#define pr_fmt(fmt) "acpi/mrrm: " fmt + +#include <linux/acpi.h> +#include <linux/init.h> + +static int max_mem_region = -ENOENT; + +/* Access for use by resctrl file system */ +int acpi_mrrm_max_mem_region(void) +{ + return max_mem_region; +} + +static __init int acpi_parse_mrrm(struct acpi_table_header *table) +{ + struct acpi_table_mrrm *mrrm; + + mrrm = (struct acpi_table_mrrm *)table; + if (!mrrm) + return -ENODEV; + + max_mem_region = mrrm->max_mem_region; + + return 0; +} + +static __init int mrrm_init(void) +{ + int ret; + + ret = acpi_table_parse(ACPI_SIG_MRRM, acpi_parse_mrrm); + + return ret; +} +device_initcall(mrrm_init); |
