[PATCH 2/2] dmaengine: idxd: Reject shared wq mode without shared wq support
From: Fei Yu
Date: Mon Nov 30 2026 - 02:08:04 EST
On a device without shared wq support (no ENQCMD, or PASID not
enabled), the wq mode attribute still accepts "shared". The setting
only fails later: enabling the wq fails with "PASID not enabled and
shared wq", and a shared wq that has a group makes every following
device configuration fail.
Reject "shared" with -EOPNOTSUPP on such devices, so that a wq can not
be put into a mode the device does not support.
Suggested-by: Vinicius Costa Gomes <vinicius.gomes@xxxxxxxxx>
Signed-off-by: Fei Yu <fei.yu@xxxxxxxxx>
---
drivers/dma/idxd/sysfs.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/dma/idxd/sysfs.c b/drivers/dma/idxd/sysfs.c
index 2b0524324089..3c0b27dc8c9f 100644
--- a/drivers/dma/idxd/sysfs.c
+++ b/drivers/dma/idxd/sysfs.c
@@ -693,6 +693,8 @@ static ssize_t wq_mode_store(struct device *dev,
set_bit(WQ_FLAG_DEDICATED, &wq->flags);
wq->threshold = 0;
} else if (sysfs_streq(buf, "shared")) {
+ if (!device_shared_wq_supported(idxd))
+ return -EOPNOTSUPP;
clear_bit(WQ_FLAG_DEDICATED, &wq->flags);
} else {
return -EINVAL;
--
2.53.0