Thread (3 messages) 3 messages, 2 authors, 2023-08-21

[PATCH 1/2] dmaengine: idxd: Allow ATS disable update only for configurable devices

From: Fenghua Yu <hidden>
Date: 2023-08-11 01:26:51
Also in: lkml
Subsystem: dma generic offload engine subsystem, intel idxd driver, the rest · Maintainers: Vinod Koul, Vinicius Costa Gomes, Linus Torvalds

ATS disable status in a WQ is read-only if the device is not configurable.
This change ensures that the ATS disable attribute can be modified via
sysfs only on configurable devices.

Fixes: 92de5fa2dc39 ("dmaengine: idxd: add ATS disable knob for work queues")
Signed-off-by: Fenghua Yu <redacted>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
---
Applied cleanly to
https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine next

 drivers/dma/idxd/sysfs.c | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/drivers/dma/idxd/sysfs.c b/drivers/dma/idxd/sysfs.c
index d16c16445c4f..66c89b07b3f7 100644
--- a/drivers/dma/idxd/sysfs.c
+++ b/drivers/dma/idxd/sysfs.c
@@ -1088,12 +1088,16 @@ static ssize_t wq_ats_disable_store(struct device *dev, struct device_attribute
 				    const char *buf, size_t count)
 {
 	struct idxd_wq *wq = confdev_to_wq(dev);
+	struct idxd_device *idxd = wq->idxd;
 	bool ats_dis;
 	int rc;
 
 	if (wq->state != IDXD_WQ_DISABLED)
 		return -EPERM;
 
+	if (!test_bit(IDXD_FLAG_CONFIGURABLE, &idxd->flags))
+		return -EPERM;
+
 	rc = kstrtobool(buf, &ats_dis);
 	if (rc < 0)
 		return rc;
-- 
2.37.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help