From patchwork Thu Feb 6 07:20:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sridhar, Kanchana P" X-Patchwork-Id: 13962453 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89089C02196 for ; Thu, 6 Feb 2025 07:21:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 65CA26B0088; Thu, 6 Feb 2025 02:21:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 608EF280001; Thu, 6 Feb 2025 02:21:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4AD056B008A; Thu, 6 Feb 2025 02:21:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 215926B0088 for ; Thu, 6 Feb 2025 02:21:10 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id E1828160F5D for ; Thu, 6 Feb 2025 07:21:09 +0000 (UTC) X-FDA: 83088673458.04.4B9CEE9 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by imf26.hostedemail.com (Postfix) with ESMTP id CB766140002 for ; Thu, 6 Feb 2025 07:21:07 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=Hti2Atbt; spf=pass (imf26.hostedemail.com: domain of kanchana.p.sridhar@intel.com designates 192.198.163.8 as permitted sender) smtp.mailfrom=kanchana.p.sridhar@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1738826468; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=YD+ICK81+HgzK5rOlYxzVxOHxfGIIKv/2BMPBaqlY3U=; b=hGPJGwV4DJtczsPCfGn9Zx/DCQsKOd3Wik0uwEdOkgmtYdeAOjTkSp0lMpHHQN9PVwLQ9C QgOqX0YB7QCi+S2TPDKwNMcEFcaSsGD8dB5GyH/stIkLIWqlbNkjhxyYo7mygivkGBd21c nT5eK3JQPYJ9g2LPIALR/WvgTjjtkVQ= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=Hti2Atbt; spf=pass (imf26.hostedemail.com: domain of kanchana.p.sridhar@intel.com designates 192.198.163.8 as permitted sender) smtp.mailfrom=kanchana.p.sridhar@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1738826468; a=rsa-sha256; cv=none; b=wCZWQtZg2m2UAYbkGRZC8hGo8ASNiLFBIkEWGtcvO8DKe4utfMp/j27Zwn4iZcSQ5O0qkQ 7Knp7d9k2MsMNLJSCZVeSOBCYF7ZH8HDzLReto18AKGNprWsj5nydtSPFK2NfOQaBt4Lts b72YO27AvuuZjtIbE4mxhzMUr0Tktl4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1738826468; x=1770362468; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=aa0CRR/xEnOe7ecidFKr7n4dRE0EgIea9NyU6tuNilQ=; b=Hti2Atbt/RGtd56WyLWh2WKiJuNILxjScoWYMHo7Bvw8geiC70QVErez 6niHRv04f/M2IU/rfsB4cvxQpXyY+pgKf8C9ECFcShvVjUO0fwX5Jz+yE rOHpNGSj1Mfhqjd9MhghVFJ6JCXYQRrDAEoetl7zJP04TlICz0QN6fAFA SylZ2G9gOL560BP0efBRujRMMeb5rTKEo9RAY5GWGK40Nf9uxvF7JxD3W s9coSB1gzdN7/7WMYQkwh8dCxG0hHdajIhg0w7tqKC5nIGwG/tbIgJYwY cxupWeESprM8s8WhWaDr44RXkSrRhv7Z6nWTQ5Momski3LT0nEZLv5fef w==; X-CSE-ConnectionGUID: MG45gd7TR9uG4xR9dm5Y+A== X-CSE-MsgGUID: jbQUXx5sTzWK4oJkZ1RiTw== X-IronPort-AV: E=McAfee;i="6700,10204,11336"; a="56962589" X-IronPort-AV: E=Sophos;i="6.13,263,1732608000"; d="scan'208";a="56962589" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Feb 2025 23:21:03 -0800 X-CSE-ConnectionGUID: 0qv2Q5XmQcmCbrrd3qHiSA== X-CSE-MsgGUID: ZBp6cQVISTO02ezo4hUqhA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="112022600" Received: from jf5300-b11a338t.jf.intel.com ([10.242.51.115]) by orviesa008.jf.intel.com with ESMTP; 05 Feb 2025 23:21:04 -0800 From: Kanchana P Sridhar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org, hannes@cmpxchg.org, yosry.ahmed@linux.dev, nphamcs@gmail.com, chengming.zhou@linux.dev, usamaarif642@gmail.com, ryan.roberts@arm.com, 21cnbao@gmail.com, akpm@linux-foundation.org, linux-crypto@vger.kernel.org, herbert@gondor.apana.org.au, davem@davemloft.net, clabbe@baylibre.com, ardb@kernel.org, ebiggers@google.com, surenb@google.com, kristen.c.accardi@intel.com Cc: wajdi.k.feghali@intel.com, vinodh.gopal@intel.com, kanchana.p.sridhar@intel.com Subject: [PATCH v6 03/16] crypto: iaa - Add an acomp_req flag CRYPTO_ACOMP_REQ_POLL to enable async mode. Date: Wed, 5 Feb 2025 23:20:49 -0800 Message-Id: <20250206072102.29045-4-kanchana.p.sridhar@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20250206072102.29045-1-kanchana.p.sridhar@intel.com> References: <20250206072102.29045-1-kanchana.p.sridhar@intel.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: CB766140002 X-Stat-Signature: ury8jahb58xqb88fadt8pqzx5qur37tu X-Rspamd-Server: rspam08 X-Rspam-User: X-HE-Tag: 1738826467-386456 X-HE-Meta: U2FsdGVkX1/dcQhBqfEQ8jTtMXt6VdPtNk489HzBYwZnShC/Xls2cQfnp8fWPdXh0VIiONeI7FSYVlZCh4KgWcHjs1zQURJESbXSPLrKGbRNps1BDk+USzkQgcpgQqUFbh5Vs1yPrtb5QuMsrYMPm1Jbeo3RwB8gbvmg0+iBkm0DxDu/v/i864U+r1Tf0pgP6IkpuiueXa9bmEMDpHF9VLPNg6PfvQEKmJjO0HHbFTWXwZJ8bj87FYC0dYcZx45buieqqik1LWALrIhwUvvwtDJRQ5fg4FiVrr8YD1emwhDHvO0qQffqEm85klHPyCH2giomYyQYfKDYIKqq3NAY6unSb66J2bF2f9nxc40qxZz5+WuhWSz0T1uCTic/zJdMXh4dzZj0ybY18LpztESRGMePZ9l09ORyCALU+21B4TQDfocgyCD8x3wgucbTCXx30zGWKiL18BB8zA7oYD/ONB60TqEefUMR28tO+8qhhgWEjgjP0gGWx/A+SBzR1PWlWRU7LUoBhL+49e1q5nL6Cc6YKIAo5nKIsR2+TGojMZH+pq9RGmjSDanBvq0xezjY8CflqD1zh6Tf1oBEw2UhHX8vflNJ+P22C8oq3kRXzbDilmwgBWi07D+qneJnCne/eWsyPkdX/y0tPQCqWULwlRIL0Tfkq0lapwawrM283VkzAYIq+l2+A8oTEARSCLytwLdBdLHEl8zUukAXMfsT9fSxj7ZaFhWS4tGdSedJvy6hKP1yx05hcreZwXQ85KxHse3jaJGwNxqfX3mXpChFgKPr+6VlfuvDrPvS6QnMYCd/cVxEAKwxILXvfhTW4b3A3ZTyBTGAB1rNDyskM3OxP9y874YjPVXff/3s92wQA+HFtVWTFCIrGID4lhob7/TADq8gnnbRxfNjCmX3zvi+cbxvV3B+9k9Ak2aGaov5J3ZFAQGlCUjSCLhx/C0NYCGZg6y3xiV9jMyeDrTOBP8 b4s1nO5p DwBoTsXfWMdx8GXmgGZTObY9CaBSPZnM92FhbellGq1fxvn5c4UXdVDFAzxIodRAVosHF81zcRYmDcz/4iEiyY0j50bpfdlvsYZpOiev0DycMHosgZVdZy6+rwsCNpqLo295RVS4WyKs+bj0AvDRYqaDNU/PlNY4bdDybr4pO8h0bhF0GTbxHaVED7vPk3sVygoaqAxKrscIhZQNElJFhUZJoy0eOQlxVyXeP5uWDL7Mvh6G1ghTegdc5v4daCjQn6t+vBRnA7O1sv5ZX0hHJpTvEDZY86LVAknXF X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: If the iaa_crypto driver has async_mode set to true, and use_irq set to false, it can still be forced to use synchronous mode by turning off the CRYPTO_ACOMP_REQ_POLL flag in req->flags. In other words, all three of the following need to be true for a request to be processed in fully async poll mode: 1) async_mode should be "true" 2) use_irq should be "false" 3) req->flags & CRYPTO_ACOMP_REQ_POLL should be "true" Suggested-by: Herbert Xu Signed-off-by: Kanchana P Sridhar --- drivers/crypto/intel/iaa/iaa_crypto_main.c | 11 ++++++++++- include/crypto/acompress.h | 5 +++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/intel/iaa/iaa_crypto_main.c b/drivers/crypto/intel/iaa/iaa_crypto_main.c index c3776b0de51d..d7983ab3c34a 100644 --- a/drivers/crypto/intel/iaa/iaa_crypto_main.c +++ b/drivers/crypto/intel/iaa/iaa_crypto_main.c @@ -1520,6 +1520,10 @@ static int iaa_comp_acompress(struct acomp_req *req) return -EINVAL; } + /* If the caller has requested no polling, disable async. */ + if (!(req->flags & CRYPTO_ACOMP_REQ_POLL)) + disable_async = true; + cpu = get_cpu(); wq = wq_table_next_wq(cpu); put_cpu(); @@ -1712,6 +1716,7 @@ static int iaa_comp_adecompress(struct acomp_req *req) { struct crypto_tfm *tfm = req->base.tfm; dma_addr_t src_addr, dst_addr; + bool disable_async = false; int nr_sgs, cpu, ret = 0; struct iaa_wq *iaa_wq; struct device *dev; @@ -1727,6 +1732,10 @@ static int iaa_comp_adecompress(struct acomp_req *req) return -EINVAL; } + /* If the caller has requested no polling, disable async. */ + if (!(req->flags & CRYPTO_ACOMP_REQ_POLL)) + disable_async = true; + if (!req->dst) return iaa_comp_adecompress_alloc_dest(req); @@ -1775,7 +1784,7 @@ static int iaa_comp_adecompress(struct acomp_req *req) req->dst, req->dlen, sg_dma_len(req->dst)); ret = iaa_decompress(tfm, req, wq, src_addr, req->slen, - dst_addr, &req->dlen, false); + dst_addr, &req->dlen, disable_async); if (ret == -EINPROGRESS) return ret; diff --git a/include/crypto/acompress.h b/include/crypto/acompress.h index 8451ade70fd8..e090538e8406 100644 --- a/include/crypto/acompress.h +++ b/include/crypto/acompress.h @@ -14,6 +14,11 @@ #include #define CRYPTO_ACOMP_ALLOC_OUTPUT 0x00000001 +/* + * If set, the driver must have a way to submit the req, then + * poll its completion status for success/error. + */ +#define CRYPTO_ACOMP_REQ_POLL 0x00000002 #define CRYPTO_ACOMP_DST_MAX 131072 /**