From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=198.175.65.13 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796022473; b=CKiTk5amFwxgDFtwiWUAzjpI3NcXB+h4AoS3+DaNMVN19exj7Dqs2+lch9wTWGzm04BV ZZzgPPy28E2S6H9JTz7lp5F2Z7qTvWkj35q+aLyYhFKZOZ/HUT2AFutu4QWCbiZOz6748 pe31fpVQoltouf1TsP7sFm3p4p5UdqL2g428Q1YFFtml+T5/Sv0ubGqheBP3jhZa4lA1C YWfbiVyJHYHuwTHxjuUvwRiXWTwvtLCDEzOArSN2y6n8yv5OUtAtipHLwS0cHNkObWoc6 pczETv1uNMQj7Xdm7ldmUbDhkS1s797CsHG4FH0zjS/WDNVSp17XGj6DmbC7PTuAcxg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796022473; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:From:To:Cc:Subject: Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=IAK7xz6bpRmPX9fkbtrW8zn73ayVIlhXyZ3rWgaVeLU=; b=dtBg40skbvqgP+Sk+aLPr/b0hkJokNOG6I5a29WZx6xk/xJsJ+KfTR+f9ScHsIOyffxZ qkjOb0pf2HxJVQnSFIQTaWWVCW9G+oj6sGDbMEtJE4fvopPMWIv4TYI/4hROOffG4A65o BE+pdjhQmPQxOqA2JwuLNPoKpKPvmD39Z1CDhuy+1ELmS9nVqDf28mA23rM2Xee7UyKNC sQYaCPPtLyR29lf6mZfAjaVZTbD8pe9VCeCvcmfQwKtzY83AkLxL3qOzQsE/w+HHsYbw3 tfEElNX1/8+ZD3DVLXWPN+z88Dv5B3WEfb19YrkjbtbZk3SrhOfxX7WpWYeSg1XS2pQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=PWZGopxn; arc=none smtp.remote-ip=198.175.65.13 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 503C4606A335; Mon, 30 Nov 2026 07:07:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 503C4606A335 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=PWZGopxn DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796022474; x=1827558474; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=IAK7xz6bpRmPX9fkbtrW8zn73ayVIlhXyZ3rWgaVeLU=; b=PWZGopxn48u+pcMOrDSY2G3sb7lqw9ddFSxl/3LRC0ZwHZgidjUCWUvM lYgsuZDeBOO86uyiPmXQk9+ibeo/fl3f47beZV/65DdQD2pBeauCqglMo HsVlME1hgDDcT8HtP2qc9D6FNMf/QX2zMk/2E66fvcl+EkZ/421HERBnT GHXBlh6Ho3WLVbgS4m6cnBQp66cKfMKBy16SEQv5TV+ccophnWGHgqSy+ 7WtxzAvZrxmKaRLiJmIYfM6fQKattP3j5c4acKWh/IU/PcvV5hOXseMIB k7+Yte/QONOjg4PCuN+9ezGz8MfQsCNuUs6L5MB4+5g47lSWf4UPQxvCa A==; X-CSE-ConnectionGUID: lZ9DpbPjTqqVlfXPi486yg== X-CSE-MsgGUID: 7steZJCcQYe9FQN6vAdJIA== X-IronPort-AV: E=McAfee;i="6800,10657,11981"; a="4743325" X-IronPort-AV: E=Sophos;i="6.27,242,1787036400"; d="scan'208";a="4743325" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2026 23:07:54 -0800 X-CSE-ConnectionGUID: 2CA1EBaWROeVRi7EMyfanQ== X-CSE-MsgGUID: VQnjPjcNTCGVfLhVLSdiLg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,242,1787036400"; d="scan'208";a="13465778" Received: from yufei-super-server.sh.intel.com ([10.239.92.104]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2026 23:07:51 -0800 From: Fei Yu To: Vinod Koul , dmaengine@vger.kernel.org Cc: Vinicius Costa Gomes , Dave Jiang , Frank Li , Andy Shevchenko , linux-kernel@vger.kernel.org Subject: [PATCH 1/2] dmaengine: idxd: Keep wqs dedicated without shared wq support Date: Mon, 30 Nov 2026 15:13:37 +0800 Message-ID: <20261130071338.3120264-2-fei.yu@intel.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261130071338.3120264-1-fei.yu@intel.com> References: <20261130071338.3120264-1-fei.yu@intel.com> X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit A wq is shared unless WQ_FLAG_DEDICATED is set, and wq->flags starts out as 0, so every wq is shared by default. That is also the case on devices without shared wq support (no ENQCMD, or PASID not enabled), where a shared wq is not a valid configuration. Since commit 0f225705cf65 ("dmaengine: idxd: fix wq settings post wq disable"), disabling a wq keeps its size and group, because they can only change while the device is disabled, but idxd_wq_disable_cleanup() still clears wq->flags. The wq thus turns into a shared wq that is still part of the device configuration. On a device without shared wq support, the next device configuration, e.g. the restore after an FLR, is rejected by idxd_wqs_setup() and the device halts. On the Nova Lake IAA, after iaa_crypto releases its wq: idxd 0000:00:0c.0: No shared wq support but configured. idxd 0000:00:0c.0: HALT: iax0 config fails On such devices, make dedicated the mode of a wq when it is set up and after it is disabled: it is the only mode the wq can have there. The check is device wide, as the wq type, which tells whether kernel or user PASID applies, is not known at these points. Devices with shared wq support keep the current behavior. Fixes: 0f225705cf65 ("dmaengine: idxd: fix wq settings post wq disable") Cc: stable@vger.kernel.org Suggested-by: Vinicius Costa Gomes Signed-off-by: Fei Yu --- drivers/dma/idxd/device.c | 9 +++++++++ drivers/dma/idxd/idxd.h | 13 +++++++++++++ drivers/dma/idxd/init.c | 3 +++ 3 files changed, 25 insertions(+) diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c index 131138483b87..e641793f2ce5 100644 --- a/drivers/dma/idxd/device.c +++ b/drivers/dma/idxd/device.c @@ -387,6 +387,15 @@ static void idxd_wq_disable_cleanup(struct idxd_wq *wq) wq->priority = 0; wq->enqcmds_retries = IDXD_ENQCMDS_RETRIES; wq->flags = 0; + /* + * The wq keeps its size and group (see idxd_wq_device_reset_cleanup()), + * so it stays part of the device configuration. Without shared wq + * support, keep it dedicated: a shared wq would make the configuration + * invalid, and the device would fail to be configured again, e.g. after + * an FLR. + */ + if (!device_shared_wq_supported(idxd)) + set_bit(WQ_FLAG_DEDICATED, &wq->flags); memset(wq->name, 0, WQ_NAME_SIZE); wq->max_xfer_bytes = WQ_DEFAULT_MAX_XFER; idxd_wq_set_max_batch_size(idxd->data->type, wq, WQ_DEFAULT_MAX_BATCH); diff --git a/drivers/dma/idxd/idxd.h b/drivers/dma/idxd/idxd.h index ce78b9a7c641..f5fe7442f216 100644 --- a/drivers/dma/idxd/idxd.h +++ b/drivers/dma/idxd/idxd.h @@ -607,6 +607,19 @@ static inline bool wq_shared_supported(struct idxd_wq *wq) return (support_enqcmd && wq_pasid_enabled(wq)); } +/* + * Can any wq of the device, kernel or user, be a shared wq? Unlike + * wq_shared_supported(), this does not depend on the wq type, so it also + * answers for a wq whose type is not set yet. + */ +static inline bool device_shared_wq_supported(struct idxd_device *idxd) +{ + if (!(device_pasid_enabled(idxd) || device_user_pasid_enabled(idxd))) + return false; + + return support_enqcmd; +} + enum idxd_portal_prot { IDXD_PORTAL_UNLIMITED = 0, IDXD_PORTAL_LIMITED, diff --git a/drivers/dma/idxd/init.c b/drivers/dma/idxd/init.c index 4b827a329756..5421c1c0c6d6 100644 --- a/drivers/dma/idxd/init.c +++ b/drivers/dma/idxd/init.c @@ -217,6 +217,9 @@ static int idxd_setup_wqs(struct idxd_device *idxd) idxd_wq_set_max_batch_size(idxd->data->type, wq, WQ_DEFAULT_MAX_BATCH); idxd_wq_set_init_max_sgl_size(idxd, wq); wq->enqcmds_retries = IDXD_ENQCMDS_RETRIES; + /* Without shared wq support, dedicated is the only valid mode */ + if (!device_shared_wq_supported(idxd)) + set_bit(WQ_FLAG_DEDICATED, &wq->flags); wq->wqcfg = kzalloc_node(idxd->wqcfg_size, GFP_KERNEL, dev_to_node(dev)); if (!wq->wqcfg) { put_device(conf_dev); -- 2.53.0