summaryrefslogtreecommitdiff
path: root/drivers/resctrl/mpam_internal.h
diff options
context:
space:
mode:
authorJames Morse <james.morse@arm.com>2025-11-19 12:23:03 +0000
committerCatalin Marinas <catalin.marinas@arm.com>2025-11-19 18:34:24 +0000
commit2557e0eafec1547aa9e0e768d2376e66252dada4 (patch)
tree55546afb713c578b5dfbd5c0a34eb0e165b3f464 /drivers/resctrl/mpam_internal.h
parente3565d1fd4dcf2c7ee6912094066e47c7500eaf2 (diff)
arm_mpam: Add kunit tests for props_mismatch()
When features are mismatched between MSC the way features are combined to the class determines whether resctrl can support this SoC. Add some tests to illustrate the sort of thing that is expected to work, and those that must be removed. Signed-off-by: James Morse <james.morse@arm.com> Reviewed-by: Ben Horgan <ben.horgan@arm.com> Reviewed-by: Fenghua Yu <fenghuay@nvidia.com> Reviewed-by: Gavin Shan <gshan@redhat.com> Reviewed-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com> Tested-by: Fenghua Yu <fenghuay@nvidia.com> Tested-by: Carl Worth <carl@os.amperecomputing.com> Tested-by: Gavin Shan <gshan@redhat.com> Tested-by: Zeng Heng <zengheng4@huawei.com> Tested-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com> Tested-by: Hanjun Guo <guohanjun@huawei.com> Signed-off-by: Ben Horgan <ben.horgan@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'drivers/resctrl/mpam_internal.h')
-rw-r--r--drivers/resctrl/mpam_internal.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/resctrl/mpam_internal.h b/drivers/resctrl/mpam_internal.h
index 18d53c07b3d7..e79c3c47259c 100644
--- a/drivers/resctrl/mpam_internal.h
+++ b/drivers/resctrl/mpam_internal.h
@@ -23,6 +23,12 @@ struct platform_device;
DECLARE_STATIC_KEY_FALSE(mpam_enabled);
+#ifdef CONFIG_MPAM_KUNIT_TEST
+#define PACKED_FOR_KUNIT __packed
+#else
+#define PACKED_FOR_KUNIT
+#endif
+
static inline bool mpam_is_enabled(void)
{
return static_branch_likely(&mpam_enabled);
@@ -186,7 +192,13 @@ struct mpam_props {
u16 dspri_wd;
u16 num_csu_mon;
u16 num_mbwu_mon;
-};
+
+/*
+ * Kunit tests use memset() to set up feature combinations that should be
+ * removed, and will false-positive if the compiler introduces padding that
+ * isn't cleared during sanitisation.
+ */
+} PACKED_FOR_KUNIT;
#define mpam_has_feature(_feat, x) test_bit(_feat, (x)->features)
#define mpam_set_feature(_feat, x) set_bit(_feat, (x)->features)