diff mbox series

dmaengine: idxd: add capability check for 'block on fault' attribute

Message ID 162802992615.3084999.12539468940404102898.stgit@djiang5-desk3.ch.intel.com (mailing list archive)
State Accepted
Headers show
Series dmaengine: idxd: add capability check for 'block on fault' attribute | expand

Commit Message

Dave Jiang Aug. 3, 2021, 10:32 p.m. UTC
The device general capability has a bit that indicate whether 'block on
fault' is supported. Add check to wq sysfs knob to check if cap exists
before allowing user to toggle.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
---
 drivers/dma/idxd/sysfs.c |    3 +++
 1 file changed, 3 insertions(+)

Comments

Vinod Koul Aug. 6, 2021, 1:53 p.m. UTC | #1
On 03-08-21, 15:32, Dave Jiang wrote:
> The device general capability has a bit that indicate whether 'block on
> fault' is supported. Add check to wq sysfs knob to check if cap exists
> before allowing user to toggle.

Applied, thanks
diff mbox series

Patch

diff --git a/drivers/dma/idxd/sysfs.c b/drivers/dma/idxd/sysfs.c
index 4c01587c9d4a..a88886d0f27b 100644
--- a/drivers/dma/idxd/sysfs.c
+++ b/drivers/dma/idxd/sysfs.c
@@ -642,6 +642,9 @@  static ssize_t wq_block_on_fault_store(struct device *dev,
 	bool bof;
 	int rc;
 
+	if (!idxd->hw.gen_cap.block_on_fault)
+		return -EOPNOTSUPP;
+
 	if (!test_bit(IDXD_FLAG_CONFIGURABLE, &idxd->flags))
 		return -EPERM;