[PATCH v3 07/29] arm_mpam: Add probe/remove for mpam msc driver and kbuild boiler plate
Ben Horgan
ben.horgan at arm.com
Mon Oct 20 05:43:31 PDT 2025
Hi James,
On 10/17/25 19:56, James Morse wrote:
> Probing MPAM is convoluted. MSCs that are integrated with a CPU may
> only be accessible from those CPUs, and they may not be online.
> Touching the hardware early is pointless as MPAM can't be used until
> the system-wide common values for num_partid and num_pmg have been
> discovered.
>
> Start with driver probe/remove and mapping the MSC.
>
> CC: Carl Worth <carl at os.amperecomputing.com>
> Tested-by: Fenghua Yu <fenghuay at nvidia.com>
> Signed-off-by: James Morse <james.morse at arm.com>
> ---
> Changes since v2:
> * Comment in Kconfig about why EXPERT.
> * Dropped duplicate depends.
> * Fixed duplicate return statement.
> * Restructured driver probe to have a do_ function to allow breaks to be
> return instead...
> * Removed resctrl.h include, added spinlock.h
> * Removed stray DT function prototype
> * Removed stray PCC variables in struct mpam_msc.
> * Used ccflags not cflags for debug define.
> * Moved srcu header include to internal.h
> * Moved mpam_msc_destroy() into this patch.
>
> Changes since v1:
> * Avoid selecting driver on other architectrues.
> * Removed PCC support stub.
> * Use for_each_available_child_of_node_scoped() and of_property_read_reg()
> * Clarified a comment.
> * Stopped using mpam_num_msc as an id,a and made it atomic.
> * Size of -1 returned from cache_of_calculate_id()
> * Renamed some struct members.
> * Made a bunch of pr_err() dev_err_ocne().
> * Used more cleanup magic.
> * Inlined a print message.
> * Fixed error propagation from mpam_dt_parse_resources().
> * Moved cache accessibility checks earlier.
> * Change cleanup macro to use IS_ERR_OR_NULL().
>
> Changes since RFC:
> * Check for status=broken DT devices.
> * Moved all the files around.
> * Made Kconfig symbols depend on EXPERT
> ---
> arch/arm64/Kconfig | 1 +
> drivers/Kconfig | 2 +
> drivers/Makefile | 1 +
> drivers/acpi/arm64/mpam.c | 7 ++
> drivers/resctrl/Kconfig | 13 +++
> drivers/resctrl/Makefile | 4 +
> drivers/resctrl/mpam_devices.c | 190 ++++++++++++++++++++++++++++++++
> drivers/resctrl/mpam_internal.h | 52 +++++++++
> include/linux/acpi.h | 2 +-
> 9 files changed, 271 insertions(+), 1 deletion(-)
> create mode 100644 drivers/resctrl/Kconfig
> create mode 100644 drivers/resctrl/Makefile
> create mode 100644 drivers/resctrl/mpam_devices.c
> create mode 100644 drivers/resctrl/mpam_internal.h
>
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index c5e66d5d72cd..004d58cfbff8 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -2025,6 +2025,7 @@ config ARM64_TLB_RANGE
>
> config ARM64_MPAM
> bool "Enable support for MPAM"
> + select ARM64_MPAM_DRIVER if EXPERT # does nothing yet
> select ACPI_MPAM if ACPI
> help
> Memory System Resource Partitioning and Monitoring (MPAM) is an
> diff --git a/drivers/Kconfig b/drivers/Kconfig
> index 4915a63866b0..3054b50a2f4c 100644
> --- a/drivers/Kconfig
> +++ b/drivers/Kconfig
> @@ -251,4 +251,6 @@ source "drivers/hte/Kconfig"
>
> source "drivers/cdx/Kconfig"
>
> +source "drivers/resctrl/Kconfig"
> +
> endmenu
> diff --git a/drivers/Makefile b/drivers/Makefile
> index 8e1ffa4358d5..20eb17596b89 100644
> --- a/drivers/Makefile
> +++ b/drivers/Makefile
> @@ -194,6 +194,7 @@ obj-$(CONFIG_HTE) += hte/
> obj-$(CONFIG_DRM_ACCEL) += accel/
> obj-$(CONFIG_CDX_BUS) += cdx/
> obj-$(CONFIG_DPLL) += dpll/
> +obj-y += resctrl/
>
> obj-$(CONFIG_DIBS) += dibs/
> obj-$(CONFIG_S390) += s390/
> diff --git a/drivers/acpi/arm64/mpam.c b/drivers/acpi/arm64/mpam.c
> index 59712397025d..51c6f5fd4a5e 100644
> --- a/drivers/acpi/arm64/mpam.c
> +++ b/drivers/acpi/arm64/mpam.c
> @@ -337,6 +337,13 @@ static int __init acpi_mpam_parse(void)
> return 0;
> }
>
> +/**
> + * acpi_mpam_count_msc() - Count the number of MSC described by firmware.
> + *
> + * Returns the number of of MSC, or zero for an error.
> + *
> + * This can be called before or in parallel with acpi_mpam_parse().
> + */
This comment can be added in the patch where you add the function,
acpi_mpam_count_msc().
> int acpi_mpam_count_msc(void)
> {
> struct acpi_table_header *table __free(acpi_table) = acpi_get_table_ret(ACPI_SIG_MPAM, 0);
[...]
> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
> index 9d66421f68ff..70f075b397ce 100644
> --- a/include/linux/acpi.h
> +++ b/include/linux/acpi.h
> @@ -231,7 +231,7 @@ static inline struct acpi_table_header *acpi_get_table_ret(char *signature, u32
> return ERR_PTR(-ENOENT);
> return table;
> }
> -DEFINE_FREE(acpi_table, struct acpi_table_header *, if (!IS_ERR(_T)) acpi_put_table(_T))
> +DEFINE_FREE(acpi_table, struct acpi_table_header *, if (!IS_ERR_OR_NULL(_T)) acpi_put_table(_T))
Ah, you did make this change. Just ended up in the wrong patch.
>
> int acpi_table_parse(char *id, acpi_tbl_table_handler handler);
> int __init_or_acpilib acpi_table_parse_entries(char *id,
--
Thanks,
Ben
More information about the linux-arm-kernel
mailing list