From patchwork Sat Nov 23 07:01:19 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: 13883778 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 78D1FE6ADE9 for ; Sat, 23 Nov 2024 07:01:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D8D456B0085; Sat, 23 Nov 2024 02:01:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D17436B0088; Sat, 23 Nov 2024 02:01:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B681C6B0089; Sat, 23 Nov 2024 02:01:34 -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 98E236B0085 for ; Sat, 23 Nov 2024 02:01:34 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 45B911A1A9C for ; Sat, 23 Nov 2024 07:01:34 +0000 (UTC) X-FDA: 82816464066.08.3F6710D Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) by imf21.hostedemail.com (Postfix) with ESMTP id 380B31C0009 for ; Sat, 23 Nov 2024 07:01:31 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b="ay/0ykPt"; spf=pass (imf21.hostedemail.com: domain of kanchana.p.sridhar@intel.com designates 198.175.65.21 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=1732345291; 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=cLV3EYnjobaIrpsJgwTTh+2K3zYd4sDcsAaGVIPHKs0=; b=oINii0sHdK624bvTnoN2WtQiL9/7gSmT9bIqanLB/XWr3J4J/ZZlAVmQlY5MAoj1TAEDfR 2VoO0AUOASnxS0tR6NAaTHkos8rQQoycd0KN+FEyybdTlzsQCdyysAU89lbMN6S+Bopjeg Jk6aHI0UmYQd68cu3M3eP9LMJeisO9M= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b="ay/0ykPt"; spf=pass (imf21.hostedemail.com: domain of kanchana.p.sridhar@intel.com designates 198.175.65.21 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=1732345291; a=rsa-sha256; cv=none; b=dB2VcGUQV1tLICgJaJ5s7UNcjuM5XHXj6n+xGVo/r9RzqeXDUSbUacIPtTHc4bulFqKE9v n/XPjUqffYm67x9831x+e6EvZTE4SdAGAo5ZwnklaAXcovLwgBuevRk37xuJ4/Eqdzpj58 mYxV1ZSMBuhtSxEIC17KJYYqFOOGvf8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1732345293; x=1763881293; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2nV7tAyF29XIJl5hqo4L8d+IjA/bGBNSbr3o8YrSMP0=; b=ay/0ykPtDnj2oGZvRuMkGFNjnAYE/IgcolA5ARnY7tUhXoL94dagyYD6 mC3UST9U+EIil7LMyh02CQxbkobDHB4SpWDxPUKtUunr9bYVsGbffdo+B 89H63F0sjrqQ0FAJ0l3N2PNAQhR47FEWIEQMukPYST12BJ+0iGGWBSH+k 9Mio4lcmp6o7mcJjG4yofY4MGr9PwzaTaMgDxEUEnlRNeBtiUXY4/IM7X 7+jVikZVpu4wyFTMyBQmUvIXKYUgGa1t5o5+DqUn+DiXuBontwMYIdqNB X8sqK4zbF63ps+GfVFERwVd2EalvXkGCVD/FjNtN6vLVtzRrswIIpr2OJ w==; X-CSE-ConnectionGUID: pE4oa+4RQzawgOZU35hI2Q== X-CSE-MsgGUID: 0UaTNizAR1KEPlAPmggDqA== X-IronPort-AV: E=McAfee;i="6700,10204,11264"; a="32435473" X-IronPort-AV: E=Sophos;i="6.12,178,1728975600"; d="scan'208";a="32435473" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Nov 2024 23:01:29 -0800 X-CSE-ConnectionGUID: zgZFbcPVTsqJbBTEyVkAlQ== X-CSE-MsgGUID: 2fHdvS1NQqiWAwE+SNwUbA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,178,1728975600"; d="scan'208";a="91573550" Received: from unknown (HELO JF5300-B11A338T.jf.intel.com) ([10.242.51.115]) by orviesa008.jf.intel.com with ESMTP; 22 Nov 2024 23:01:28 -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 Cc: wajdi.k.feghali@intel.com, vinodh.gopal@intel.com, kanchana.p.sridhar@intel.com Subject: [PATCH v4 02/10] crypto: iaa - Add an acomp_req flag CRYPTO_ACOMP_REQ_POLL to enable async mode. Date: Fri, 22 Nov 2024 23:01:19 -0800 Message-Id: <20241123070127.332773-3-kanchana.p.sridhar@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20241123070127.332773-1-kanchana.p.sridhar@intel.com> References: <20241123070127.332773-1-kanchana.p.sridhar@intel.com> MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 380B31C0009 X-Stat-Signature: ehoxxggqpxdmyeyc94oup3z64t4txqun X-Rspam-User: X-HE-Tag: 1732345291-811075 X-HE-Meta: U2FsdGVkX19WHUG6OH8mJTmmQpqayOtXcDj9r9hv8N6ss1qT3yj48MeSjWkd0tmSXMTH6+cu8jgZs/SBubFuXG34s/+QQeBMyn2prjhA0Y6nG4LNF9tXj7g5IG2kZRHb8b14EPukIp8josGIi41LQYSKfTau19wXY/ofyJRdIXOWO4XsuPl3JC+wEKxqVuHXHz+2nETVkRDYjXhv0MYlaHNYRixLDfO8frpaFeROZpVtkqgVzjBNh5YPxS2PlbLghd2WXom2sKuwWLqP1Uhj36/OoIYSqASD7fZkmk0WYbiGmVq1sLQvomI4Fap/iaNNOAPu5EnvvCcuFY4qhoYTCSR9vzjfIK/k2bcWGfYG7ZHnV2MSV8+Ms2n5KvHjhobzaFbj4L9YMp1o1ZqPESoqbiOCm4A9rxN0wrzgPqpiDacppuQn8SQeuRFlI7cZDPEcbdprl/bkN6wxA1PnqZD/u28ywR4EHb85w7i/ysG2QwRDu35TsCYFjYq8y1VF/geccWdoY+HaG9Ud1Rz5bxD4rs8LxAgTd/4tYWz6xPvZU/0PwPc9GXoXGQrMBDi/cEmFV1AslHWT3mW4dISC1E9Spu2u24U8ZjdYISKscUXt4tSsPlpdO+o2yIh4KKHLcQzHbr4c68mrMKjFv3aiokR4leD1SCY3+69SZR/TcP/DFAnFAht+eApsyLUpqOJH5/x42KpRRqriWhsRFRz3HcP1M/NvDviZYG5h1HH4fwm6Uxe9Po/Oc5ena4iHEpEsebFlcZxxk9cHkhGYF1mYyugjG8v4jg2o1xmVfQWEFdxxlL+o5BFbYUsG6qBmVOFW2MOPkT5IzSROAzCMS+19Ptm5Mkq4WJF6lRRF4PbVFAduZZAS4dAfBox6xLpLmAzrV+X3T9ipKReTS1MDs4N128dxxElF6gEZMcC0lXc0KI1/kVXdXfQ/10k/kDODGlzF67wDcGM6SJBPeUJXox+Dj5a xewXQ7Aa 9xhuiB0uT9l8gJiHzYVtoxRZUHTkQX/fxaY4XtLShiU80j9I4StbvyS+G62opT+cUMMCaa4qPP/3tpZC85Ra6XkHZb+TEUixeqySewcpaUVDcnwtsIq26GtBdcQYMTyDO6wy1q2FG65tWjn10zvEakZHn0HeP8ViM7udGRcYpo/UHTlyjw/u6v2BMLYVSA0lFw3rSXHpFw0GzphawJ0J+Hd3O3Doz0DaGZrDuNfuTHf0lEb2bw7QG5nBcpAQpLOB8MqSRETgMtT6SyOUbEBTKEfKGJctkMMd3Zr4+ 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 4252bab3d0e1..c1ed47405557 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 /**