From patchwork Wed Jul 5 16:40:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Cabiddu, Giovanni" X-Patchwork-Id: 699312 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C848EB64DA for ; Wed, 5 Jul 2023 16:40:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232938AbjGEQkz (ORCPT ); Wed, 5 Jul 2023 12:40:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232935AbjGEQkv (ORCPT ); Wed, 5 Jul 2023 12:40:51 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFD4719A4; Wed, 5 Jul 2023 09:40:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1688575240; x=1720111240; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OnHnR7sBOISNo6UsoPV0T1BdsFN9+BHptNLTHfPi2RE=; b=TITzjQpTB4L61tK5hfJaurDU/qAJDnmDmTYhk2uIdoCvDRy9uIp1ABel W08Vv/gnNPPJ4xsdYPc0UU0rM1Rm5swqy81zHqbr9lUEXluZrJh9Xpx9Q OkGyRqRjXw2CFivW8puQHB7BJEjvaYXVMBAl5s9/5eP8T3/AqRGeCo0pO GUAeQWeSQT39B5NoKMNRazof15nnafKE/yfwxDDp7Q0BW1pBEDVUAhAp1 eyJkZrYDEU/pYj7RkTlQKD8VxPTs28bnQ7VFfwst/zh/iRHwumh2jJVDu ea04+PC7RdoAvaN93YtOZjZ4M5pcAjAr00eQwrwa+ylt5LKhYAzKIf4gP g==; X-IronPort-AV: E=McAfee;i="6600,9927,10762"; a="362258310" X-IronPort-AV: E=Sophos;i="6.01,183,1684825200"; d="scan'208";a="362258310" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jul 2023 09:40:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10762"; a="893241782" X-IronPort-AV: E=Sophos;i="6.01,183,1684825200"; d="scan'208";a="893241782" Received: from silpixa00400314.ir.intel.com (HELO silpixa00400314.ger.corp.intel.com) ([10.237.222.216]) by orsmga005.jf.intel.com with ESMTP; 05 Jul 2023 09:40:36 -0700 From: Giovanni Cabiddu To: herbert@gondor.apana.org.au, agk@redhat.com, snitzer@kernel.org Cc: linux-crypto@vger.kernel.org, dm-devel@redhat.com, linux-kernel@vger.kernel.org, qat-linux@intel.com, heinzm@redhat.com, meenakshi.aggarwal@nxp.com, ebiggers@kernel.org, horia.geanta@nxp.com, V.Sethi@nxp.com, pankaj.gupta@nxp.com, gaurav.jain@nxp.com, davem@davemloft.net, iuliana.prodan@nxp.com, Giovanni Cabiddu , Fiona Trahe Subject: [PATCH 3/3] crypto: qat - remove CRYPTO_ALG_ALLOCATES_MEMORY flag Date: Wed, 5 Jul 2023 17:40:09 +0100 Message-Id: <20230705164009.58351-4-giovanni.cabiddu@intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230705164009.58351-1-giovanni.cabiddu@intel.com> References: <20230705164009.58351-1-giovanni.cabiddu@intel.com> MIME-Version: 1.0 Organization: Intel Research and Development Ireland Ltd - Co. Reg. #308263 - Collinstown Industrial Park, Leixlip, County Kildare - Ireland Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Remove the CRYPTO_ALG_ALLOCATES_MEMORY flag from the aead, skcipher and acomp alg structures since the driver does not allocate memory in the request processing for scatterlists with 4 or less entries. This allows the QAT driver to be used by dm-crypt. Signed-off-by: Giovanni Cabiddu Reviewed-by: Fiona Trahe --- drivers/crypto/intel/qat/qat_common/qat_algs.c | 13 ++++++------- drivers/crypto/intel/qat/qat_common/qat_comp_algs.c | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/crypto/intel/qat/qat_common/qat_algs.c b/drivers/crypto/intel/qat/qat_common/qat_algs.c index 3c4bba4a8779..a7a6ac33052a 100644 --- a/drivers/crypto/intel/qat/qat_common/qat_algs.c +++ b/drivers/crypto/intel/qat/qat_common/qat_algs.c @@ -1278,7 +1278,7 @@ static struct aead_alg qat_aeads[] = { { .cra_name = "authenc(hmac(sha1),cbc(aes))", .cra_driver_name = "qat_aes_cbc_hmac_sha1", .cra_priority = 4001, - .cra_flags = CRYPTO_ALG_ASYNC | CRYPTO_ALG_ALLOCATES_MEMORY, + .cra_flags = CRYPTO_ALG_ASYNC, .cra_blocksize = AES_BLOCK_SIZE, .cra_ctxsize = sizeof(struct qat_alg_aead_ctx), .cra_module = THIS_MODULE, @@ -1295,7 +1295,7 @@ static struct aead_alg qat_aeads[] = { { .cra_name = "authenc(hmac(sha256),cbc(aes))", .cra_driver_name = "qat_aes_cbc_hmac_sha256", .cra_priority = 4001, - .cra_flags = CRYPTO_ALG_ASYNC | CRYPTO_ALG_ALLOCATES_MEMORY, + .cra_flags = CRYPTO_ALG_ASYNC, .cra_blocksize = AES_BLOCK_SIZE, .cra_ctxsize = sizeof(struct qat_alg_aead_ctx), .cra_module = THIS_MODULE, @@ -1312,7 +1312,7 @@ static struct aead_alg qat_aeads[] = { { .cra_name = "authenc(hmac(sha512),cbc(aes))", .cra_driver_name = "qat_aes_cbc_hmac_sha512", .cra_priority = 4001, - .cra_flags = CRYPTO_ALG_ASYNC | CRYPTO_ALG_ALLOCATES_MEMORY, + .cra_flags = CRYPTO_ALG_ASYNC, .cra_blocksize = AES_BLOCK_SIZE, .cra_ctxsize = sizeof(struct qat_alg_aead_ctx), .cra_module = THIS_MODULE, @@ -1330,7 +1330,7 @@ static struct skcipher_alg qat_skciphers[] = { { .base.cra_name = "cbc(aes)", .base.cra_driver_name = "qat_aes_cbc", .base.cra_priority = 4001, - .base.cra_flags = CRYPTO_ALG_ASYNC | CRYPTO_ALG_ALLOCATES_MEMORY, + .base.cra_flags = CRYPTO_ALG_ASYNC, .base.cra_blocksize = AES_BLOCK_SIZE, .base.cra_ctxsize = sizeof(struct qat_alg_skcipher_ctx), .base.cra_alignmask = 0, @@ -1348,7 +1348,7 @@ static struct skcipher_alg qat_skciphers[] = { { .base.cra_name = "ctr(aes)", .base.cra_driver_name = "qat_aes_ctr", .base.cra_priority = 4001, - .base.cra_flags = CRYPTO_ALG_ASYNC | CRYPTO_ALG_ALLOCATES_MEMORY, + .base.cra_flags = CRYPTO_ALG_ASYNC, .base.cra_blocksize = 1, .base.cra_ctxsize = sizeof(struct qat_alg_skcipher_ctx), .base.cra_alignmask = 0, @@ -1366,8 +1366,7 @@ static struct skcipher_alg qat_skciphers[] = { { .base.cra_name = "xts(aes)", .base.cra_driver_name = "qat_aes_xts", .base.cra_priority = 4001, - .base.cra_flags = CRYPTO_ALG_ASYNC | CRYPTO_ALG_NEED_FALLBACK | - CRYPTO_ALG_ALLOCATES_MEMORY, + .base.cra_flags = CRYPTO_ALG_ASYNC | CRYPTO_ALG_NEED_FALLBACK, .base.cra_blocksize = AES_BLOCK_SIZE, .base.cra_ctxsize = sizeof(struct qat_alg_skcipher_ctx), .base.cra_alignmask = 0, diff --git a/drivers/crypto/intel/qat/qat_common/qat_comp_algs.c b/drivers/crypto/intel/qat/qat_common/qat_comp_algs.c index b533984906ec..bd1383da1c4a 100644 --- a/drivers/crypto/intel/qat/qat_common/qat_comp_algs.c +++ b/drivers/crypto/intel/qat/qat_common/qat_comp_algs.c @@ -442,7 +442,7 @@ static struct acomp_alg qat_acomp[] = { { .cra_name = "deflate", .cra_driver_name = "qat_deflate", .cra_priority = 4001, - .cra_flags = CRYPTO_ALG_ASYNC | CRYPTO_ALG_ALLOCATES_MEMORY, + .cra_flags = CRYPTO_ALG_ASYNC, .cra_ctxsize = sizeof(struct qat_compression_ctx), .cra_module = THIS_MODULE, },