All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fei Yu <fei.yu@intel.com>
To: Vinod Koul <vkoul@kernel.org>, dmaengine@vger.kernel.org
Cc: Vinicius Costa Gomes <vinicius.gomes@intel.com>,
	Dave Jiang <dave.jiang@intel.com>, Frank Li <Frank.Li@kernel.org>,
	Andy Shevchenko <andriy.shevchenko@intel.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] dmaengine: idxd: Reject shared wq mode without shared wq support
Date: Mon, 30 Nov 2026 15:13:38 +0800	[thread overview]
Message-ID: <20261130071338.3120264-3-fei.yu@intel.com> (raw)
In-Reply-To: <20261130071338.3120264-1-fei.yu@intel.com>

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@intel.com>
Signed-off-by: Fei Yu <fei.yu@intel.com>
---
 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


      parent reply	other threads:[~2026-11-30  7:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30  7:13 [PATCH 0/2] dmaengine: idxd: No shared wqs without shared wq support Fei Yu
2026-11-30  7:13 ` [PATCH 1/2] dmaengine: idxd: Keep wqs dedicated " Fei Yu
2026-11-30  7:23   ` sashiko-bot
2026-11-30 16:30   ` Andy Shevchenko
2026-11-30  7:13 ` Fei Yu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261130071338.3120264-3-fei.yu@intel.com \
    --to=fei.yu@intel.com \
    --cc=Frank.Li@kernel.org \
    --cc=andriy.shevchenko@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vinicius.gomes@intel.com \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.