From patchwork Tue Apr 20 03:35:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 424543 Delivered-To: patch@linaro.org Received: by 2002:a17:906:6d12:0:0:0:0 with SMTP id m18csp3272416ejr; Mon, 19 Apr 2021 20:36:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxwlRrI2lTcknNcQhXBKsiAJ6PaSVMezqcr6Plw1//X2its09bi4lQzjH3EwoTiO6y5I7XT X-Received: by 2002:a50:ee17:: with SMTP id g23mr29721307eds.45.1618889777626; Mon, 19 Apr 2021 20:36:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618889777; cv=none; d=google.com; s=arc-20160816; b=zzZI/5eJBlHd0bYYw5t0XELGZEttUulaXVyIBUPb85AkJOOkjcC8mZaSJMOOXEp6zT Uogcbp/rNvszFSdznT9EVQxN8PkSLO7uIFeH6WhyeqHnJ4FFqsmwDeKA7Xcqn3r6C6CO +CUvRraADTz2X3zS6imxNXhTX6vQ5Vezn10QrFiePlmR58mG2Ml26gC6YXCPwGHANtlu 0l0hBSTyAKKjxlnJYdRkyio8l/ZFmk4qlxY+mb19flhtMh/q11ZSqbPQB1l551+cylBX nixArTcjluxLXFCbnFjNvUnUFVvSNrXU15Wx85uTmdFye7/NJxGMz70+rbvW6hWXrZ1P FduA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=T6+zvlvsLjNp5pODzoq20iFMKbJBEBGuZQctRXwxLzk=; b=gVSyww2hEeNhUMSz+d4j362PxMMOkIVAeOr1H+SYkJwSXUx6Q+esbGNnQ+jyvEeMjk d2jBeKFLA61QRDPChN7pQieLBX++ZbyNtDVaOw2ULfBquBAo66otTtz2LKnl4TVgz0PY a9p/j50fAQzGgmm3acdUcw+maWFUaHh1ipZOovN0gGa6WEP71SOFYSxiDKgTJLzt/KgA 7CxNpJZ1EDkg9BqKvWDvdnqS6YSy289LGOs5VK3+0Gwsl4iHUg9DRd4YlAFPRGInEMrP DCH4J0GfcM2J62bQ/lWbmZn+9liVjwxg8AsxEQlW/6PQ0ijWUuVe9Q8YaYWnq48ZhT0i nvmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pNVEqhlK; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q19si13939060ejd.250.2021.04.19.20.36.17; Mon, 19 Apr 2021 20:36:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pNVEqhlK; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230281AbhDTDgi (ORCPT + 3 others); Mon, 19 Apr 2021 23:36:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229508AbhDTDgh (ORCPT ); Mon, 19 Apr 2021 23:36:37 -0400 Received: from mail-qt1-x831.google.com (mail-qt1-x831.google.com [IPv6:2607:f8b0:4864:20::831]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5477C06138A for ; Mon, 19 Apr 2021 20:36:05 -0700 (PDT) Received: by mail-qt1-x831.google.com with SMTP id z15so19719508qtj.7 for ; Mon, 19 Apr 2021 20:36:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=T6+zvlvsLjNp5pODzoq20iFMKbJBEBGuZQctRXwxLzk=; b=pNVEqhlK3G5r1t9ZbVhVyTsSkjWwpKmkaqqnPdEt574Q98uODBUM4eRh28yHIOpMx3 HKg/paiyZUU3nLBhWYWlTJM014w1Bjg9dWLaPUBgtQaJHsgcE4mi78omwnMvohX704Nf OpFbtAgbJiXYcL9GUOgpmoyWKrxtNN1IX0iB3voK8Bml9IDTHiJnweP4XddOSRXZMvuH OvQhA+h5NRmrYdLOBWAmxnXPh/aZ7a2/5tqGqJm3r7DwVO9zyaiR7Tm86iKliuDTcRC5 fbO0K9r3neWTl7X+DsyYChdvxr8S3YL9UJTX1+lrjD/crPGq5xP1I9l+YGUNq3PCqcJ1 /+ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=T6+zvlvsLjNp5pODzoq20iFMKbJBEBGuZQctRXwxLzk=; b=B/Zyk/ZlgOVESI3PzCL/RrpqcxKcHq17T1iTZ0xyfZRvwAt25k210T2AP7UzIvLsHd RkrB7I7/47Rh8XUA7+8dP6Lw9I9Nzh/A2jeDlw9my6mYTyh9pfEyvc8Eg1daYUDtBBgq am67gYBJQrp8nHk3Z2mkSnYSy/Pz8BcsIt2S+UZrvGQobAuDJHPnfSQs9X3B+usTlQa5 uJrDsdJd8d3RG+nMs0l5cLg4r6bT18e6YZj6i1eu/uNqM9y3zzn0Gxv9QjDtL91jZ6t1 K44O3Y5vLXTeWeP/rNomGV2fHRcR069ipiM9uvyQ0uR4xFL9i9ofY3NiFDCkXws3VBCl W1Xg== X-Gm-Message-State: AOAM531XmkXyCM10xHJWwrQKlKyS8WCXDAS8twQrGy/Poh8CtdeGgKTG Cwjh+MJGY8KGN8OOXOh0expt9g== X-Received: by 2002:ac8:5ad5:: with SMTP id d21mr15067440qtd.198.1618889765198; Mon, 19 Apr 2021 20:36:05 -0700 (PDT) Received: from pop-os.fios-router.home (pool-71-163-245-5.washdc.fios.verizon.net. [71.163.245.5]) by smtp.googlemail.com with ESMTPSA id b8sm3562643qka.117.2021.04.19.20.36.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 20:36:04 -0700 (PDT) From: Thara Gopinath To: herbert@gondor.apana.org.au, davem@davemloft.net, bjorn.andersson@linaro.org Cc: ebiggers@google.com, ardb@kernel.org, sivaprak@codeaurora.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [Patch v3 2/7] crypto: qce: common: Make result dump optional Date: Mon, 19 Apr 2021 23:35:57 -0400 Message-Id: <20210420033602.1729947-3-thara.gopinath@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210420033602.1729947-1-thara.gopinath@linaro.org> References: <20210420033602.1729947-1-thara.gopinath@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Qualcomm crypto engine allows for IV registers and status register to be concatenated to the output. This option is enabled by setting the RESULTS_DUMP field in GOPROC register. This is useful for most of the algorithms to either retrieve status of operation or in case of authentication algorithms to retrieve the mac. But for ccm algorithms, the mac is part of the output stream and not retrieved from the IV registers, thus needing a separate buffer to retrieve it. Make enabling RESULTS_DUMP field optional so that algorithms can choose whether or not to enable the option. Note that in this patch, the enabled algorithms always choose RESULTS_DUMP to be enabled. But later with the introduction of ccm algorithms, this changes. Reviewed-by: Bjorn Andersson Signed-off-by: Thara Gopinath --- drivers/crypto/qce/common.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) -- 2.25.1 diff --git a/drivers/crypto/qce/common.c b/drivers/crypto/qce/common.c index dd76175d5c62..7b5bc5a6ae81 100644 --- a/drivers/crypto/qce/common.c +++ b/drivers/crypto/qce/common.c @@ -88,9 +88,12 @@ static void qce_setup_config(struct qce_device *qce) qce_write(qce, REG_CONFIG, config); } -static inline void qce_crypto_go(struct qce_device *qce) +static inline void qce_crypto_go(struct qce_device *qce, bool result_dump) { - qce_write(qce, REG_GOPROC, BIT(GO_SHIFT) | BIT(RESULTS_DUMP_SHIFT)); + if (result_dump) + qce_write(qce, REG_GOPROC, BIT(GO_SHIFT) | BIT(RESULTS_DUMP_SHIFT)); + else + qce_write(qce, REG_GOPROC, BIT(GO_SHIFT)); } #ifdef CONFIG_CRYPTO_DEV_QCE_SHA @@ -219,7 +222,7 @@ static int qce_setup_regs_ahash(struct crypto_async_request *async_req) config = qce_config_reg(qce, 1); qce_write(qce, REG_CONFIG, config); - qce_crypto_go(qce); + qce_crypto_go(qce, true); return 0; } @@ -380,7 +383,7 @@ static int qce_setup_regs_skcipher(struct crypto_async_request *async_req) config = qce_config_reg(qce, 1); qce_write(qce, REG_CONFIG, config); - qce_crypto_go(qce); + qce_crypto_go(qce, true); return 0; }