From: Qinxin Xia <xiaqinxin@huawei.com>
To: <ben.horgan@arm.com>, <zhangzhanpeng.jasper@bytedance.com>,
<joro@8bytes.org>, <palmer@dabbelt.com>, <tony.luck@intel.com>,
<reinette.chatre@intel.com>, <tomasz.jeznach@linux.dev>,
<zengheng4@huawei.com>, <fustini@kernel.org>,
<cuiyunhui@bytedance.com>, <wangzhou1@hisilicon.com>,
<xiaqinxin@huawei.com>
Cc: <will@kernel.org>, <robin.murphy@arm.com>, <pjw@kernel.org>,
<aou@eecs.berkeley.edu>, <alex@ghiti.fr>, <Dave.Martin@arm.com>,
<james.morse@arm.com>, <babu.moger@amd.com>, <corbet@lwn.net>,
<shuah@kernel.org>, <jgg@ziepe.ca>, <kevin.tian@intel.com>,
<yuanzhu@bytedance.com>, <iommu@lists.linux.dev>,
<linuxarm@huawei.com>, <baolin.wang@linux.alibaba.com>
Subject: [RFC PATCH 2/5] arm_mpam: resctrl: Add arch query for device DMA QoS support
Date: Tue, 1 Sep 2026 22:07:59 +0800 [thread overview]
Message-ID: <20260901140802.1215508-3-xiaqinxin@huawei.com> (raw)
In-Reply-To: <20260901140802.1215508-1-xiaqinxin@huawei.com>
Add an architecture query so core resctrl can decide whether to expose the
"devices" file.
The file is only meaningful when an IOMMU can tag the DMA of devices behind
it with a QoS class (such as an MPAM PARTID/PMG), so the query reports
support only on platforms where that is available.
Signed-off-by: Qinxin Xia <xiaqinxin@huawei.com>
---
arch/x86/include/asm/resctrl.h | 5 +++++
drivers/resctrl/mpam_devices.c | 20 ++++++++++++++++++++
drivers/resctrl/mpam_resctrl.c | 5 +++++
include/linux/arm_mpam.h | 5 +++++
4 files changed, 35 insertions(+)
diff --git a/arch/x86/include/asm/resctrl.h b/arch/x86/include/asm/resctrl.h
index 8f6edcdcfd87..744a04f06025 100644
--- a/arch/x86/include/asm/resctrl.h
+++ b/arch/x86/include/asm/resctrl.h
@@ -71,6 +71,11 @@ static inline bool resctrl_arch_mon_capable(void)
return rdt_mon_capable;
}
+static inline bool resctrl_arch_devices_supported(void)
+{
+ return false;
+}
+
static inline void resctrl_arch_enable_mon(void)
{
static_branch_enable_cpuslocked(&rdt_mon_enable_key);
diff --git a/drivers/resctrl/mpam_devices.c b/drivers/resctrl/mpam_devices.c
index dd422c56fbb1..882184651c14 100644
--- a/drivers/resctrl/mpam_devices.c
+++ b/drivers/resctrl/mpam_devices.c
@@ -67,6 +67,26 @@ u8 mpam_pmg_max;
static bool partid_max_init, partid_max_published;
static DEFINE_SPINLOCK(partid_max_lock);
+/*
+ * Set once an IOMMU (e.g. ARM SMMU v3) has registered that it can tag
+ * device DMA with a PARTID/PMG. resctrl only exposes the "devices" file
+ * when this is true, so unsupported architectures never see it. The flag
+ * only ever flips false -> true and is read with READ_ONCE().
+ */
+static bool mpam_device_requestor_registered;
+
+void mpam_register_device_requestor(void)
+{
+ WRITE_ONCE(mpam_device_requestor_registered, true);
+}
+EXPORT_SYMBOL(mpam_register_device_requestor);
+
+bool mpam_devices_supported(void)
+{
+ return READ_ONCE(mpam_device_requestor_registered);
+}
+EXPORT_SYMBOL(mpam_devices_supported);
+
/*
* mpam is enabled once all devices have been probed from CPU online callbacks,
* scheduled via this work_struct. If access to an MSC depends on a CPU that
diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c
index 9d223057953a..71ccb3db5987 100644
--- a/drivers/resctrl/mpam_resctrl.c
+++ b/drivers/resctrl/mpam_resctrl.c
@@ -97,6 +97,11 @@ bool resctrl_arch_mon_capable(void)
return l3->mon_capable;
}
+bool resctrl_arch_devices_supported(void)
+{
+ return mpam_devices_supported();
+}
+
bool resctrl_arch_is_evt_configurable(enum resctrl_event_id evt)
{
return false;
diff --git a/include/linux/arm_mpam.h b/include/linux/arm_mpam.h
index f92a36187a52..9d2deee604ce 100644
--- a/include/linux/arm_mpam.h
+++ b/include/linux/arm_mpam.h
@@ -53,6 +53,11 @@ static inline int mpam_ris_create(struct mpam_msc *msc, u8 ris_idx,
bool resctrl_arch_alloc_capable(void);
bool resctrl_arch_mon_capable(void);
+bool resctrl_arch_devices_supported(void);
+
+void mpam_register_device_requestor(void);
+bool mpam_devices_supported(void);
+
void resctrl_arch_set_cpu_default_closid(int cpu, u32 closid);
void resctrl_arch_set_closid_rmid(struct task_struct *tsk, u32 closid, u32 rmid);
void resctrl_arch_set_cpu_default_closid_rmid(int cpu, u32 closid, u32 rmid);
--
2.33.0
next prev parent reply other threads:[~2026-09-01 14:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-01 14:07 [RFC PATCH 0/5] resctrl: Assign devices to resource groups via IOMMU DMA QoS tagging Qinxin Xia
2026-09-01 14:07 ` [RFC PATCH 1/5] iommu: Add per-device requestor QoS tagging and lookup helpers Qinxin Xia
2026-09-01 14:07 ` Qinxin Xia [this message]
2026-09-01 14:08 ` [RFC PATCH 3/5] iommu/arm-smmu-v3: Support MPAM device DMA QoS tagging Qinxin Xia
2026-09-01 14:08 ` [RFC PATCH 4/5] fs/resctrl: Add device-to-group QoS tracking infrastructure Qinxin Xia
2026-09-01 14:08 ` [RFC PATCH 5/5] fs/resctrl: Add a "devices" file to assign devices to groups Qinxin Xia
2026-09-10 10:24 ` Ben Horgan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260901140802.1215508-3-xiaqinxin@huawei.com \
--to=xiaqinxin@huawei.com \
--cc=Dave.Martin@arm.com \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=babu.moger@amd.com \
--cc=baolin.wang@linux.alibaba.com \
--cc=ben.horgan@arm.com \
--cc=corbet@lwn.net \
--cc=cuiyunhui@bytedance.com \
--cc=fustini@kernel.org \
--cc=iommu@lists.linux.dev \
--cc=james.morse@arm.com \
--cc=jgg@ziepe.ca \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=linuxarm@huawei.com \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
--cc=reinette.chatre@intel.com \
--cc=robin.murphy@arm.com \
--cc=shuah@kernel.org \
--cc=tomasz.jeznach@linux.dev \
--cc=tony.luck@intel.com \
--cc=wangzhou1@hisilicon.com \
--cc=will@kernel.org \
--cc=yuanzhu@bytedance.com \
--cc=zengheng4@huawei.com \
--cc=zhangzhanpeng.jasper@bytedance.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.