From patchwork Sat Dec 21 06:31:10 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: 13917679 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 6845CE7718B for ; Sat, 21 Dec 2024 06:31:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B87346B008A; Sat, 21 Dec 2024 01:31:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B31A46B008C; Sat, 21 Dec 2024 01:31:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 984D36B0092; Sat, 21 Dec 2024 01:31:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 6EEF96B008C for ; Sat, 21 Dec 2024 01:31:26 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 21514A1064 for ; Sat, 21 Dec 2024 06:31:26 +0000 (UTC) X-FDA: 82917992850.01.63490D8 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) by imf11.hostedemail.com (Postfix) with ESMTP id D2DF540003 for ; Sat, 21 Dec 2024 06:30:51 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=TETX67+X; spf=pass (imf11.hostedemail.com: domain of kanchana.p.sridhar@intel.com designates 198.175.65.20 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=1734762647; 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=YVJmj5zSLwn5iUgEfK58x/2pa7veZjU56kFmzIWb3pY=; b=CQBbBNs2F5fPH9Nixm9YjlaGP0Gtpu4i8WdzlHPe6xAbohAF13JosT6xrZ3TSBVRm6P6Gd SrkbXSadVAA5WFHC4He0XdEclueHy9gIyGnv8wexuoXUz0khdm28ioLtf5t46e6iEOX2zF oLlP/EeveMl/pCsgzTXsH3gyDZExQj4= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=TETX67+X; spf=pass (imf11.hostedemail.com: domain of kanchana.p.sridhar@intel.com designates 198.175.65.20 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=1734762647; a=rsa-sha256; cv=none; b=ARvCJxdyUyb5xUDXlI4DODm/oa/TCxCSNExMO2AJ+6llzhV5lYvKNfBhCmCqe/thtqT8Eo awUQHp9uA8ybwase5FndVUuzvxBANZXt1PEId6489F8A9fWaeZqNpn5/3F+muhi+SviNc1 xpC8LLismzOkQnaQhRk8R4OnAhBzc4w= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1734762684; x=1766298684; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=kq/8cpMYX4ePi7N8tA49JxZ+4FRLNlknFPm5kH1FrRw=; b=TETX67+XOVFw5CSdcKZ3J5yPBCHy/kiHLaF8f6CTb1ZPohfpguc/f/wS QMd51ww7gVdZX6VMYSzcZTf7lkoo9UfIa4jkqP3L00njmUywOsC7NewrF h9WAYwjPqjTT7lsyG9firj8yD58H5OpSl4/S4LX0R73sVFHopL6Pb+GKY W5fqlhAgBS4moAwYd5GzZoo4lUrlNOU/2whpyHY8kb618HZtbfKPy4R1V RfzVqm/l7IjR4T3Wgg6bpeDmruLAzcEm6KefLpIA2JjBb9gMT2kTfUVTr L1DvvHAyNxUf1SNRh4B6n6N7pKb0Wl1xFx9b1FTpWx78sqKqjLmkVz1rj g==; X-CSE-ConnectionGUID: dtzNcEgZRNiaSs7OyQvDbw== X-CSE-MsgGUID: Z8vESoLDRbivWFotEnf93A== X-IronPort-AV: E=McAfee;i="6700,10204,11292"; a="35021635" X-IronPort-AV: E=Sophos;i="6.12,253,1728975600"; d="scan'208";a="35021635" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2024 22:31:20 -0800 X-CSE-ConnectionGUID: TWLbik5QSQ2kAGkr571m+g== X-CSE-MsgGUID: A6XjNyo5To2v5JmsY9R0Jw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="99184582" Received: from jf5300-b11a338t.jf.intel.com ([10.242.51.115]) by orviesa007.jf.intel.com with ESMTP; 20 Dec 2024 22:31:20 -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, 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 v5 03/12] crypto: iaa - Add an acomp_req flag CRYPTO_ACOMP_REQ_POLL to enable async mode. Date: Fri, 20 Dec 2024 22:31:10 -0800 Message-Id: <20241221063119.29140-4-kanchana.p.sridhar@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20241221063119.29140-1-kanchana.p.sridhar@intel.com> References: <20241221063119.29140-1-kanchana.p.sridhar@intel.com> MIME-Version: 1.0 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: D2DF540003 X-Rspam-User: X-Stat-Signature: zikcexzooqkgr9cbrnr8j8skgkrq5bp1 X-HE-Tag: 1734762651-236091 X-HE-Meta: U2FsdGVkX1/j/3S+Ecug49xqTQPGpAm7vpzTdpDnMPCc3MURCg5Yfv2jlGp8+Fe2mvssKDUAhSIlEcYSrD0Pql3titddjkkAoiVH7XFn5V3MriO8yWRFFd4/GgZc0yz57uegAfyHKSgAJ+ANNoUawwaqdj3cQrjgcIcIm3R/bkO0QJlmtgwP7LzzR5ZG8eN6Csvhu+y12T2xnLBMarS94KwZn/wPJMy5xA89Sh/skXwx7v8Q4zT28nx/x8CTrBO8sLbeW+kBAH5fcfT6ipJa78KjTS/9MiP/ACPwILwtMPkUY0lHQlRvdh5CYr9wtL8jASAw349M+rDugCH5xpEYmzfKXIXc6u8FKbzZM2kEZR0LrpPmmOqp249pZh1jqyHVUsXHX27VMK7ws6vQNRMtRIdA5xqZRWG3PMxzb/LRbDxSa0CMBlJwWheZ3/3kLVsHrAgWaL+hcXArJqK8i86oZ5Zo6aOA2by3rJJFRnwY+0izz3Q5ke29Se6UmYuec8vUvDdrOELZSnXsWtIHZXck+PyirqX2vVNZze/Cme8Tq78Zz5XNvrGT2r+ZbyFSdEspbkLoZIz+lwyNbmPgWvrbwo43/b/otLWvAzeZI7yqDWEKUMGLKLy+Gz1dfJh5yO9cWI0GjaeIbXK01bbBYgmkulAQn0PnxTMH97TbK/H0bAhMvcjMnrPf1G1HIUd8o2sUwa5RtMnLejJdP6Xs58n1SQw7YOuKJ8JGY7ObhLlt9EvF3Ai/0P4sraWiIk2OJhBqb3SuuGPZHFYGQ/8oijQsWki6JPqGFoHyZV078njv7g4Yqfb6uCXNjYi1uqUG7Qg3TBl5EMwATHgTdnILBlBX8iA7o7q7xjtJh6OO5+qI5+Yoy3AdKhYpMYWxVelAbYBA5sEM0Kc4rbaaiRNL1GFaMp6uGdP1oRos9TKH4YHe5DTgvPPbJOo79TCFL6/jQsRFrXJMOF5/IkmHzr6ydq9 D+RwG7Tm dKpA0wpxRsTpjT+ONy4g31SgTEY1qwMOv+gZlLRDLsH9oA1YV4zFaDb826z+5DHzebuKxdRdhbZeltNnlRlzCKJHW9Q7KjiFp8Ghx+Dk5SLevamdN4NDl3rwJ355qjgGYzmtIC50bLmTweY6zEeKBHZunCQoOHDlc8sZePhmzt/TViRWNtjYaRG4E/lkO5yfIzn8g4yAbn5tMesrvpL0jkjOxQxHi53r1ecGb/nsQxGoG8t1/lx8e0pwSpHbYOYlXKR6BNd/e16c9yaoW6FRjM2T4/+x7oTW1jgkY 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 9e557649e5d0..29d03df39fab 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 /**