dmaengine: idxd: Allow ATS disable update only for configurable devices

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: 92de5fa2dc ("dmaengine: idxd: add ATS disable knob for work queues")
Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Link: https://lore.kernel.org/r/20230811012635.535413-1-fenghua.yu@intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
This commit is contained in:
Fenghua Yu
2023-08-10 18:26:34 -07:00
committed by Vinod Koul
parent 84b798fedf
commit 0056a7f07b

View File

@@ -1088,12 +1088,16 @@ static ssize_t wq_ats_disable_store(struct device *dev, struct device_attribute
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct idxd_wq *wq = confdev_to_wq(dev); struct idxd_wq *wq = confdev_to_wq(dev);
struct idxd_device *idxd = wq->idxd;
bool ats_dis; bool ats_dis;
int rc; int rc;
if (wq->state != IDXD_WQ_DISABLED) if (wq->state != IDXD_WQ_DISABLED)
return -EPERM; return -EPERM;
if (!test_bit(IDXD_FLAG_CONFIGURABLE, &idxd->flags))
return -EPERM;
rc = kstrtobool(buf, &ats_dis); rc = kstrtobool(buf, &ats_dis);
if (rc < 0) if (rc < 0)
return rc; return rc;