Takashi Iwai 123281
From 81c2f79c2104c5b48f01da674bc2f7d4bc600db4 Mon Sep 17 00:00:00 2001
Takashi Iwai 123281
From: Dave Jiang <dave.jiang@intel.com>
Takashi Iwai 123281
Date: Tue, 3 Aug 2021 15:32:06 -0700
Takashi Iwai 123281
Subject: [PATCH] dmaengine: idxd: add capability check for 'block on fault' attribute
Takashi Iwai 123281
Git-commit: 81c2f79c2104c5b48f01da674bc2f7d4bc600db4
Takashi Iwai 123281
Patch-mainline: v5.15-rc1
Takashi Iwai 123281
References: jsc#SLE-18899
Takashi Iwai 123281
Takashi Iwai 123281
The device general capability has a bit that indicate whether 'block on
Takashi Iwai 123281
fault' is supported. Add check to wq sysfs knob to check if cap exists
Takashi Iwai 123281
before allowing user to toggle.
Takashi Iwai 123281
Takashi Iwai 123281
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Takashi Iwai 123281
Link: https://lore.kernel.org/r/162802992615.3084999.12539468940404102898.stgit@djiang5-desk3.ch.intel.com
Takashi Iwai 123281
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Takashi Iwai 123281
Acked-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai 123281
Takashi Iwai 123281
---
Takashi Iwai 123281
 drivers/dma/idxd/sysfs.c | 3 +++
Takashi Iwai 123281
 1 file changed, 3 insertions(+)
Takashi Iwai 123281
Takashi Iwai 123281
diff --git a/drivers/dma/idxd/sysfs.c b/drivers/dma/idxd/sysfs.c
Takashi Iwai 123281
index 4c01587c9d4a..a88886d0f27b 100644
Takashi Iwai 123281
--- a/drivers/dma/idxd/sysfs.c
Takashi Iwai 123281
+++ b/drivers/dma/idxd/sysfs.c
Takashi Iwai 123281
@@ -642,6 +642,9 @@ static ssize_t wq_block_on_fault_store(struct device *dev,
Takashi Iwai 123281
 	bool bof;
Takashi Iwai 123281
 	int rc;
Takashi Iwai 123281
 
Takashi Iwai 123281
+	if (!idxd->hw.gen_cap.block_on_fault)
Takashi Iwai 123281
+		return -EOPNOTSUPP;
Takashi Iwai 123281
+
Takashi Iwai 123281
 	if (!test_bit(IDXD_FLAG_CONFIGURABLE, &idxd->flags))
Takashi Iwai 123281
 		return -EPERM;
Takashi Iwai 123281
 
Takashi Iwai 123281
-- 
Takashi Iwai 123281
2.26.2
Takashi Iwai 123281