From patchwork Wed Nov 6 19:20:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sridhar, Kanchana P" X-Patchwork-Id: 13865317 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 0052CD59F6A for ; Wed, 6 Nov 2024 19:21:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 15C916B0085; Wed, 6 Nov 2024 14:21:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 10AAD6B0088; Wed, 6 Nov 2024 14:21:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EC6946B0089; Wed, 6 Nov 2024 14:21:13 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id C8B0A6B0085 for ; Wed, 6 Nov 2024 14:21:13 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 7B79980C17 for ; Wed, 6 Nov 2024 19:21:13 +0000 (UTC) X-FDA: 82756637754.04.5255613 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) by imf23.hostedemail.com (Postfix) with ESMTP id A1DB5140018 for ; Wed, 6 Nov 2024 19:20:48 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=G0emlv75; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf23.hostedemail.com: domain of kanchana.p.sridhar@intel.com designates 198.175.65.11 as permitted sender) smtp.mailfrom=kanchana.p.sridhar@intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730920812; a=rsa-sha256; cv=none; b=rrdAydCYXacQKJg8gsCvbPE7d/RKeHJUKTSqZgpsgJjYzzb5jdVtwkC3YMHlwff9giJ/Q3 VfUnbOdICuCijkxyOHLLv3CSsWbtaD0CsSpqPD/VsAM2t8wiYRyscuQxK/q7aeRo6ZW+3e 799oc5uS0MBbATJmyjcV1bsYCFIzFKY= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=G0emlv75; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf23.hostedemail.com: domain of kanchana.p.sridhar@intel.com designates 198.175.65.11 as permitted sender) smtp.mailfrom=kanchana.p.sridhar@intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1730920812; 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=I/oxNup6yHKTkAJUW7pkB0pJRmgS83/ZcHxjD5s3KGY=; b=nbTcwBvWXrtTTnOZHBAftdRelMjp7W/KRci9Ki+hysS7DJT6+LJoD77MxZbhRrDaZLdDTk VPNwKhHn8csqjhQx9SXoauxNFAs/li3NCNvMTlDWAYmrRi4nnmH0gSmE4SDHDmI+dR25j+ vNJgzfa4TBAG65BcGTcsbugy3TpLZs8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1730920872; x=1762456872; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LsH6bLbkT8Oq6ZmvZizx30VKkaEZwigMJxQ/s5KiGZI=; b=G0emlv75VFl9pyZS/qRHFqWLotqqqia1F8V+0ikcFfjWfCTLe8Uj8BD9 /oa2yyGWubeYw+/3w8/H/snsisSPjUKFV31gx/0kwADO/9cSOQ0thP3rb D7whI1yXLyPMPP5aBd6gvrKwaX7wYYZGMXyuyko7V2jv/qsauzc8faPEC Prp6YJvDQsvWMeBToAe/mbUiY87KUbGz7h/14EIV4fG6wtOyyC54ZsQTx qHORg36u2Obw6SAW5ujo9wrR0dJZju+pU5KucFoDWAUilWAcuLv5XFRYm oTmPXv4LCOpLA6WmN+yM3TwdzIjhKCeg3sJWA+t3q07Mn5hcxRpPPk//q A==; X-CSE-ConnectionGUID: al9oM9h3TxKNbf6bEauxrg== X-CSE-MsgGUID: lC4VG1IFQlOC4dsrvD93Ug== X-IronPort-AV: E=McAfee;i="6700,10204,11222"; a="41291948" X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="41291948" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Nov 2024 11:21:08 -0800 X-CSE-ConnectionGUID: 45D0axoXRkqG1lvhXbXrLQ== X-CSE-MsgGUID: I5t60IOLTB+NwG+Q6dcZ5A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,263,1725346800"; d="scan'208";a="88695369" Received: from unknown (HELO JF5300-B11A338T.jf.intel.com) ([10.242.51.115]) by fmviesa003.fm.intel.com with ESMTP; 06 Nov 2024 11:21:07 -0800 From: Kanchana P Sridhar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org, hannes@cmpxchg.org, yosryahmed@google.com, nphamcs@gmail.com, chengming.zhou@linux.dev, usamaarif642@gmail.com, ryan.roberts@arm.com, ying.huang@intel.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, zanussi@kernel.org Cc: wajdi.k.feghali@intel.com, vinodh.gopal@intel.com, kanchana.p.sridhar@intel.com Subject: [PATCH v3 02/13] crypto: iaa - Add an acomp_req flag CRYPTO_ACOMP_REQ_POLL to enable async mode. Date: Wed, 6 Nov 2024 11:20:54 -0800 Message-Id: <20241106192105.6731-3-kanchana.p.sridhar@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20241106192105.6731-1-kanchana.p.sridhar@intel.com> References: <20241106192105.6731-1-kanchana.p.sridhar@intel.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: A1DB5140018 X-Rspamd-Server: rspam11 X-Stat-Signature: mkzw117gji1xgu8b7mbd6i3ck4ww9gpo X-HE-Tag: 1730920848-261070 X-HE-Meta: U2FsdGVkX1/jd3jP7Oin5/0yvHwTzZupryrnxcxjfx7yHyq6LvbzTunfwlulJpQZ13Watm9TTW20bz9GxIoOnbUs2q4nsyQOb56H0kwL6xme2ksMGMiuTWUH98Rg1bQ6Jueh+JVX8CR1zWUto+vGx+guC76XRevmDkxf64btO1+YxPe5D7zHCgKXn6uzBTE+mXG1bRCX0kwmVX/SWtMWKjJkQFbvnSqcolan+m2EyiT5kQ7g53GgGq+AaWxkCyyCYm2V78RlCYnUhc1PTFGAKaORQblX0oivDnLc/MdRw35z1P2arcH8bYcA7HtVr6jRF/qf0PYt69xK0JEHiof3mWluPUvrFKaSQYra3cBuLWNm0Y3RHtyzlSVNnruXm9HWphzh3Ahcn1NaU8LrLXQJTZdFGpLc9xb4yEcQ0RKXJyOAGsM4BTtdqZSayVDLK3C11mG6WogsAPh85IAjevz4Kw/AqtyFN1zRPZwUFDD8unkA9P7ovle8+95dVxmZFPGFHrVXYLiTf/YCPCUXxJSsk0EBu2m5vn4yNQn1ryN5s6HuqyTeu9wJ6No77/1Yz4IdWvfhM2D9JIApEP/7edHbZXwbYK2xKsYWDIFSEQvle8TH4nxO7VvkCeYJXCANfhaOvcfG11W4b20MZ2iLT5Gof+Tol8kRtIo1sc+i8rmGw0REIAnHyHtFZ8SwLA385RAydQBujFYCxvRlYiUDSTex5iRFTzfaHKGOxWMlFj4BOwyC1P+rZHBx9DiMxLh7oC0ut9c+vPKbB20ZdT/53WMVCNJ99Yk+fpsEP1QKXDjBg6RfMUValCrgMmBMSuPswtKVgm3g5+qxeQHvpe2cy+UcZPIRdKeHKoG+bBZS6BlET4H6wVJnsQ4lIJAIZlavyBBRdTUV2sl6/gF2OJqacBfle5SJErVz89690GRX1sXK89VtdorCdvaSRNvyyEnWpB/bJGb0wmfpKILh2OWQgsM b7GZtJls gOE7VfKRBd00BUUIZ29SL67RDAAUQtXSM5tYOmt/Sz1XNJYT/CzzUxy6TOsl9823ssL5tUWuosa/iNCvllXiUrGmkwzSmVcwlNpjsY1WZA2ftXscye96GLNhKceLbhf4Odye6K2uv4sv8mhJ4NVN9p5/OBrh8/WemZlbdgdZcp4CaXNkCWhI21bzRUDZVN4c8Zaun/CrVLYfJKVYiUo4+uAcXSbyR71HNodqNrQp1u2nJYPeiASkEGEek/F24dCQpsLGGve0IDvtmshIEakOMLEyjo4dkps9eJlni 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. 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 237f87000070..2edaecd42cc6 100644 --- a/drivers/crypto/intel/iaa/iaa_crypto_main.c +++ b/drivers/crypto/intel/iaa/iaa_crypto_main.c @@ -1510,6 +1510,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(); @@ -1702,6 +1706,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; @@ -1717,6 +1722,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); @@ -1765,7 +1774,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 ab0d9987bde1..5973f5f67954 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 /**