From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=198.175.65.11 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796068423; b=M2JvQQYC6uzU4OpTqmkKxO0S4Eo023Nj/E+Qach2nmj9GA/F/NU/AO3ROSK9hxYlRhm5 OGynlR3Wk7zEfc66Sewh8szSnnPhdtH8O6+diioPv/Djg41MuUAX2+pYQ5C4KIcjof7AT V8h4knhyaNk8wzSu4Diln4FqvsaUMYYH2i4hCfcyUg61Sv/cfFquvKusfAK2bUv6amBiH g/KD1zaAlukXT8SYW+WrsZHwJkV5uaboJmAjv1auO9+g6ozduSgPHiZs5T16EiSBi6l01 E88lVhRfrzeFlFeIftU0Aq1GL/ZgtjSJXKh+YTCeNPyfcUPDSAwbsn5+83YOJn9wTBA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796068423; 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=XRvv5YurvudpPW8VUC0LTsOfdqzCgNXOfwp7Up6hZCw=; b=0mF//3SQ2MWu3UTnUP5TeO+8oMr3URJ21w2PjbuNN/3T/FwjR1D7FRE0KTfq0X2X37jv DZt3LP0evhunKoZI35/qBVon+2rytNoLdWp0ZOhf6icxbeHd4/0d3t9xYTFG1tujgx20j gO9nJQLfV+pwkkd+srfCJRHyd6tuQjAeo4W43dx0npy+cna/k9Q9SIUYD1a6gfU/nIUcw CBVNwKVPpMyyFCeQt4MDAgQWptMOjC7X0zbI4H8U5GkRbcT44v6dj0tPWV+f88M6o4vAc hg2XEn/RNS+iNqGEjnsX5LLFKdAize5z0EHet07baode875X36RiLGy72w/Hn723gfg== 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=Qo5dakTW; arc=none smtp.remote-ip=198.175.65.11 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) (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 BDF44606A335; Mon, 30 Nov 2026 19:53:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org BDF44606A335 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=Qo5dakTW DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796068423; x=1827604423; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XRvv5YurvudpPW8VUC0LTsOfdqzCgNXOfwp7Up6hZCw=; b=Qo5dakTWZ9X1YvegigIa3fzYG2CzNRxqWMJdM/CsgnniNH6ogF/3TzI2 BN3WriRqI7kY4T/1snJKY0boh34rk97TmwklXg4TRpcO5lh8ULd1kkL+9 XLQ2uLIDv9Uwj0NXe7UUmjlwuCQHlcf5s5jwB8aCw4zsbyOf/YZ167lX/ +T/VitAkMJt74OU8dWfTTDdlj8CiVYNLaAfWEXdDfWUvv6Stynpf1P8G4 rv3pqtCiTlSit/Ludu8oTm37tlI47c0nuGu/2r2fvRxwOMwb9UOF+teLC vBY7Lzdb8a7g+B224Evez/ihsMFrnt5e1PTaUkjaNKowupWaOE+pMD2ni w==; X-CSE-ConnectionGUID: qgcEn2IFSpGnFQy+jvhhxQ== X-CSE-MsgGUID: W0L/WJuqTxe+crE23OsZHA== X-IronPort-AV: E=McAfee;i="6800,10657,11982"; a="4805765" X-IronPort-AV: E=Sophos;i="6.27,243,1787036400"; d="scan'208";a="4805765" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2026 11:53:41 -0800 X-CSE-ConnectionGUID: vNz23KO7RMeAZaq80v5Xkw== X-CSE-MsgGUID: zGPuXF9vRP26wXJbfZaNCg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,243,1787036400"; d="scan'208";a="13036620" Received: from jf5300-15a101203tc.jf.intel.com (HELO meta-crater2c.jf.intel.com) ([10.54.113.49]) by orviesa002.jf.intel.com with ESMTP; 30 Nov 2026 11:53:40 -0800 From: Daniel Byrne To: Vinod Koul , dmaengine@vger.kernel.org Cc: Vinicius Costa Gomes , Dave Jiang , Frank Li , Fenghua Yu , Dan Williams , linux-kernel@vger.kernel.org, Daniel Byrne , stable@vger.kernel.org, Frank Li Subject: [PATCH v2 04/10] dmaengine: idxd: refuse a memcpy longer than the WQ max transfer size Date: Mon, 30 Nov 2026 11:47:15 -0800 Message-ID: <20261130194721.1900266-5-daniel1.byrne@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261130194721.1900266-1-daniel1.byrne@intel.com> References: <20261130194721.1900266-1-daniel1.byrne@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 idxd_dma_submit_memcpy() checks the length only against the device limit from GENCAP. Since commit d7aad5550eca ("dmaengine: idxd: add support for configurable max wq xfer size"), WQCFG is programmed with the work queue's own max_transfer_size instead, and that is the limit the hardware enforces. Since commit 92452a72ebdf ("dmaengine: idxd: set defaults for wq configs"), that limit defaults to 2 MiB. A copy longer than the work queue's limit is therefore accepted at prep time and then fails in hardware with DSA_COMP_XFER_ERANGE. A client that sets only tx->callback cannot see that error, so the copy looks complete. Also check the work queue's limit, so that prep returns NULL and the caller can fall back. On Granite Rapids DSA 2.0 with the default 2 MiB work queue limit and a device limit of 2 GiB, dmatest with norandom=1 and test_buf_size=4194304 reports a data error for every copy on v7.2. The destination is never written, yet each copy completes. With this change the same test fails at prep, and copies of 1 MiB and 2 MiB pass as before. Fixes: d7aad5550eca ("dmaengine: idxd: add support for configurable max wq xfer size") Cc: stable@vger.kernel.org # 5.10+ Signed-off-by: Daniel Byrne Reviewed-by: Frank Li --- v2: code unchanged; Reviewed-by from Frank Li added; the message names the test device as Granite Rapids DSA 2.0. drivers/dma/idxd/dma.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/dma/idxd/dma.c b/drivers/dma/idxd/dma.c index 9937b671f637..c116416e10e5 100644 --- a/drivers/dma/idxd/dma.c +++ b/drivers/dma/idxd/dma.c @@ -115,7 +115,8 @@ idxd_dma_submit_memcpy(struct dma_chan *c, dma_addr_t dma_dest, if (wq->state != IDXD_WQ_ENABLED) return NULL; - if (len > idxd->max_xfer_bytes) + /* The work queue's configured limit is what the hardware enforces. */ + if (len > idxd->max_xfer_bytes || len > wq->max_xfer_bytes) return NULL; op_flag_setup(flags, &desc_flags); -- 2.43.0