Re: [RFC PATCH 20/36] arm_mpam: Probe the hardware features resctrl supports
From: James Morse <james.morse@arm.com>
Date: 2025-08-08 07:20:36
Also in:
lkml
Hi Ben, On 28/07/2025 09:56, Ben Horgan wrote:
On 7/11/25 19:36, James Morse wrote:quoted
Expand the probing support with the control and monitor types we can use with resctrl.
quoted
diff --git a/drivers/platform/arm64/mpam/mpam_internal.h b/drivers/platform/arm64/mpam/mpam_internal.h index 42a454d5f914..ae6fd1f62cc4 100644--- a/drivers/platform/arm64/mpam/mpam_internal.h +++ b/drivers/platform/arm64/mpam/mpam_internal.h@@ -136,6 +136,55 @@ static inline void mpam_mon_sel_lock_held(struct mpam_msc *msc) lockdep_assert_preemption_enabled(); } +/* + * When we compact the supported features, we don't care what they are. + * Storing them as a bitmap makes life easy. + */ +typedef u16 mpam_features_t; + +/* Bits for mpam_features_t */ +enum mpam_device_features { + mpam_feat_ccap_part = 0, + mpam_feat_cpor_part, + mpam_feat_mbw_part, + mpam_feat_mbw_min, + mpam_feat_mbw_max, + mpam_feat_mbw_prop, + mpam_feat_msmon, + mpam_feat_msmon_csu, + mpam_feat_msmon_csu_capture, + mpam_feat_msmon_csu_hw_nrdy, + mpam_feat_msmon_mbwu, + mpam_feat_msmon_mbwu_capture, + mpam_feat_msmon_mbwu_rwbw, + mpam_feat_msmon_mbwu_hw_nrdy, + mpam_feat_msmon_capt, + MPAM_FEATURE_LAST, +}; +#define MPAM_ALL_FEATURES ((1 << MPAM_FEATURE_LAST) - 1)Consider a static assert to check the type is big enough. static_assert(BITS_PER_TYPE(mpam_features_t) >= MPAM_FEATURE_LAST);
Fancy. There used to be an uglier one - not sure what happened to it! Thanks, James