From patchwork Sun Nov 3 03:21:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kanchana P Sridhar X-Patchwork-Id: 13860287 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 4A2DBE6780A for ; Sun, 3 Nov 2024 03:21:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 322566B0085; Sat, 2 Nov 2024 23:21:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2F8D16B0088; Sat, 2 Nov 2024 23:21:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 199C16B0089; Sat, 2 Nov 2024 23:21:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id EE4136B0085 for ; Sat, 2 Nov 2024 23:21:18 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id A224B1C797C for ; Sun, 3 Nov 2024 03:21:18 +0000 (UTC) X-FDA: 82743331902.25.6C55F9E Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) by imf12.hostedemail.com (Postfix) with ESMTP id AE52740005 for ; Sun, 3 Nov 2024 03:21:02 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=j7cJVV08; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf12.hostedemail.com: domain of kanchana.p.sridhar@intel.com designates 192.198.163.14 as permitted sender) smtp.mailfrom=kanchana.p.sridhar@intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730603955; a=rsa-sha256; cv=none; b=O8cswYPskrIG0KM/Gjce8nmpcmSaEB6OJYJa4lt/L6ftc4vL4ia19gyn+PZphGwMt6INHv jnbYZyjX78v+D9Gm2bak9MWsvT0v7MIux+00xrVQyBr77rWjrCW10zHXzSDxKg23RWGU87 fzP1JCaKTx/ZDLcLv86lwXOqVsIgn7o= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=j7cJVV08; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf12.hostedemail.com: domain of kanchana.p.sridhar@intel.com designates 192.198.163.14 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=1730603955; 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=1gKfoDF55DrSTN2ZuWSOudDkE2T3y15YG1/VFZw180Y5MuYL8TKanh8ByHf2x4N9D92Bx6 Z2x1mPBFUnZg9bJ4yOnE8ydH1OsqYTxTlb6eZSsTiOmtmE9c+72AI8BUJtxHcxRqYBbXgM LwZcjpA0u77re4wtNqJdAi1j/N6DIyg= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1730604076; x=1762140076; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LsH6bLbkT8Oq6ZmvZizx30VKkaEZwigMJxQ/s5KiGZI=; b=j7cJVV08gXhZ6Bjuuoxoj2PvRGkHyuouLJNCjzbnU3e8pMnhNL86eimC GdC8/fhT1h5YTdgXT2JWa4Gq8L9qER2+G2cFGgWRYBM4qbrnPNwNVyWbf 2f+WzicOnmHEBZ4hLQjXGvMBiQGLIeIqgXFLpSNWsZu4cVJQVNnf0dHY5 1/kHU4Fr6QOBNMo1l45gLELsVbhuhmnuCFQOR/gqZIoNoklnJGfyfZLNF ec+doEOMceJH4D9D5RcrYgZiWkWz+MRjGkUxONuc9MOh6u8CFTLR3C23p Db85CkC+EO1DhdLnCLGF2RWZ+ScUJgjFg2xAVeCiZ6/aF0ewZpz1n+Rmm w==; X-CSE-ConnectionGUID: iJZhHQ3cSpuiGeMr6gbVwA== X-CSE-MsgGUID: UbwNezJoQImwvFjbA3P6tg== X-IronPort-AV: E=McAfee;i="6700,10204,11244"; a="30548232" X-IronPort-AV: E=Sophos;i="6.11,254,1725346800"; d="scan'208";a="30548232" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Nov 2024 20:21:12 -0700 X-CSE-ConnectionGUID: OModDCsfTFqmbXDkZFRLLQ== X-CSE-MsgGUID: 3DAXP24xSo+OwZV1sOY6/Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,254,1725346800"; d="scan'208";a="83451871" Received: from unknown (HELO JF5300-B11A338T.jf.intel.com) ([10.242.51.115]) by orviesa006.jf.intel.com with ESMTP; 02 Nov 2024 20:21:13 -0700 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 v2 02/13] crypto: iaa - Add an acomp_req flag CRYPTO_ACOMP_REQ_POLL to enable async mode. Date: Sat, 2 Nov 2024 20:21:00 -0700 Message-Id: <20241103032111.333282-3-kanchana.p.sridhar@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20241103032111.333282-1-kanchana.p.sridhar@intel.com> References: <20241103032111.333282-1-kanchana.p.sridhar@intel.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: AE52740005 X-Stat-Signature: cgryp3e3ifuscq6kk1by9qzt64i18why X-Rspam-User: X-Rspamd-Server: rspam05 X-HE-Tag: 1730604062-72077 X-HE-Meta: U2FsdGVkX18n/FR/wCaoZ1WciXl1/pwrrXjr8KL307c29t2sHDAI9U2t5RozSMbKToqhxOi0DksnjfOZFYTbWBYUWj4gLKexERxNcw2GZSh8UwEl9BG0CDWKEmxnfMwwuBMWlDfiRYbq3kOSDxS8SwA8f5yofxLb4ulR0TeOGQbem1J7qTfNo/TWwJ0pk+hn4+IqDHbL0Cm+1+2uALzn+FNzE9zPocLOIa6t9incxDdafmjRprvN34cT8VE4Rqd05/auAQB6swlrg3oTj8nrCkR1BiWPhlqFT9SEBFGujIi+DLvc8QFn9DVubqjF8rtmX205FS4EY1QymgHMY4l33+drJuMmTB04f9d6Lu3dnNKSnnEoIKTiWbVjewsIhmzZVFLcDKHR4SzqKcX2KjpGf9EzIM4BTYE1SDDMvt7sANTSur6tprFexyaWhAyCZutFbo3PFd9HR3P+bEi4K/BqixIYfrb6kpgCHS2WEL/vo/zpPqM6/+1k/QCG+TIwlTQItvm0Z6wnAes6Qxf6NYTSwXM+sz3JfIl2bnqIIZKotUcDMSulwlObdUSoSw7iAKTwBo0Jx/7k5oAny2TpBUMQ0mo7PP5ow3XHobd3g/AQDTCb/y3+KmQcOajnbK3+3ifo+d5O3ZLNh6mnVHqNfmDNGanq2sEQ6iQkk9bZeUqpdV4P3gBhUMdcrwnMD71QFEP273UPdybGxMNKQAsCIku737UYw6jh2AAyhhCFQU2MS8X7084co8LdymITLAUqYZs3XhOIC6Ls3ngeSwXt0J6AUvF4UZKnGR5qgMTf07WubGeuaFClT5LgLn0xNP3kJ19cpTaM1bprvME8on4VXr/Ac39TvQBxlfgP1csyRK2lhR8CwmDKvsd9u1xIUdFk4Qze4cVXZ1Bg+IN2rLOwTEvlWq4GUs5/bojt7U7PRgg19EoNTYtzTJC+LHOzdw2cpDF3LqY7jNpRjWohzxYngvo EObjgMgg WFPiNPzBOJ/oo8owHb82i54eJb2q5P1qc4p3ptA7G0VB3RTM4XehEAvoyYZsD6kn+udN5lE9ws+5G6ykfs9A4ZrH4SxOhvvV/nQWkEPWwPxAJEJwtgRqAeifqDchA9c4v2SCY/GUDauKpXNS5f7xiuNKGYtMrt7kM4UcZcW0HKT1jftkax0LzQSJjNm3RMogs3Y1eaQVqxih6D4yDCbW2Z8NeLhBKwlp1hI8eND+HUutbJVdbEzIW6nU4/a+8Z8aCYzLD59DBFbggJQnTkpUIYYFS7NBaDapRtPmm 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 /**