summaryrefslogtreecommitdiff
path: root/drivers/dma/idxd/sysfs.c
diff options
context:
space:
mode:
authorFenghua Yu <fenghua.yu@intel.com>2023-07-12 20:44:36 +0300
committerVinod Koul <vkoul@kernel.org>2023-08-01 21:04:43 +0300
commit62b41b656666d2d35890124df5ef0881fe6d6769 (patch)
tree42aa5e2f2b346064982be5c47b58e6d9842e3b95 /drivers/dma/idxd/sysfs.c
parent97b1185fe54c8ce94104e3c7fa4ee0bbedd85920 (diff)
downloadlinux-62b41b656666d2d35890124df5ef0881fe6d6769.tar.xz
dmaengine: idxd: Expose ATS disable knob only when WQ ATS is supported
WQ Advanced Translation Service (ATS) can be controlled only when WQ ATS is supported. The sysfs ATS disable knob should be visible only when the features is supported. Signed-off-by: Fenghua Yu <fenghua.yu@intel.com> Reviewed-by: Dave Jiang <dave.jiang@intel.com> Link: https://lore.kernel.org/r/20230712174436.3435088-2-fenghua.yu@intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers/dma/idxd/sysfs.c')
-rw-r--r--drivers/dma/idxd/sysfs.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/dma/idxd/sysfs.c b/drivers/dma/idxd/sysfs.c
index 36a30957ac9a..d16c16445c4f 100644
--- a/drivers/dma/idxd/sysfs.c
+++ b/drivers/dma/idxd/sysfs.c
@@ -1088,16 +1088,12 @@ 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 (!idxd->hw.wq_cap.wq_ats_support)
- return -EOPNOTSUPP;
-
rc = kstrtobool(buf, &ats_dis);
if (rc < 0)
return rc;
@@ -1316,6 +1312,9 @@ static umode_t idxd_wq_attr_visible(struct kobject *kobj,
if (idxd_wq_attr_invisible(prs_disable, wq_prs_support, attr, idxd))
return 0;
+ if (idxd_wq_attr_invisible(ats_disable, wq_ats_support, attr, idxd))
+ return 0;
+
return attr->mode;
}