]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
arm_mpam: resctrl: Implement resctrl_arch_reset_all_ctrls()
authorJames Morse <james.morse@arm.com>
Fri, 13 Mar 2026 14:45:53 +0000 (14:45 +0000)
committerJames Morse <james.morse@arm.com>
Fri, 27 Mar 2026 15:29:42 +0000 (15:29 +0000)
We already have a helper for resetting an mpam class and component.  Hook
it up to resctrl_arch_reset_all_ctrls() and the domain offline path.

Tested-by: Gavin Shan <gshan@redhat.com>
Tested-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
Tested-by: Peter Newman <peternewman@google.com>
Tested-by: Zeng Heng <zengheng4@huawei.com>
Tested-by: Punit Agrawal <punit.agrawal@oss.qualcomm.com>
Tested-by: Jesse Chick <jessechick@os.amperecomputing.com>
Reviewed-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
Reviewed-by: Zeng Heng <zengheng4@huawei.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Reviewed-by: Gavin Shan <gshan@redhat.com>
Co-developed-by: Ben Horgan <ben.horgan@arm.com>
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
Signed-off-by: James Morse <james.morse@arm.com>
drivers/resctrl/mpam_devices.c
drivers/resctrl/mpam_internal.h
drivers/resctrl/mpam_resctrl.c

index 0e525539b7e29bcfb342e3978b7c4fdc01764878..0e5e24ef60fee908cfa925b7871803050c7ae342 100644 (file)
@@ -2551,7 +2551,7 @@ static void mpam_reset_component_locked(struct mpam_component *comp)
        }
 }
 
-static void mpam_reset_class_locked(struct mpam_class *class)
+void mpam_reset_class_locked(struct mpam_class *class)
 {
        struct mpam_component *comp;
 
index 43c8e0f5f7ac54092e549d9bf2f24bb074be08dc..f063a741aaba20001a9a909d87e85bd9e43e47da 100644 (file)
@@ -388,6 +388,9 @@ extern u8 mpam_pmg_max;
 void mpam_enable(struct work_struct *work);
 void mpam_disable(struct work_struct *work);
 
+/* Reset all the RIS in a class under cpus_read_lock() */
+void mpam_reset_class_locked(struct mpam_class *class);
+
 int mpam_apply_config(struct mpam_component *comp, u16 partid,
                      struct mpam_config *cfg);
 
index 65bb670dc3fb15d1d4ab83ee547308c74c001567..b2217d11561d8bbba405c37d3f734ecbd658f00f 100644 (file)
@@ -170,6 +170,19 @@ static int mpam_resctrl_pick_domain_id(int cpu, struct mpam_component *comp)
        return comp->comp_id;
 }
 
+void resctrl_arch_reset_all_ctrls(struct rdt_resource *r)
+{
+       struct mpam_resctrl_res *res;
+
+       lockdep_assert_cpus_held();
+
+       if (!mpam_is_enabled())
+               return;
+
+       res = container_of(r, struct mpam_resctrl_res, resctrl_res);
+       mpam_reset_class_locked(res->class);
+}
+
 static void mpam_resctrl_domain_hdr_init(int cpu, struct mpam_component *comp,
                                         enum resctrl_res_level rid,
                                         struct rdt_domain_hdr *hdr)