From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF727606A699 for ; Wed, 2 Dec 2026 10:07:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=qmIesb7s; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=XlU3Ysdx DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Unsubscribe-Post:List-Owner; bh=3BhXq2lOzRwr6Q6KK8AWMJu6CytO/jgBjx5rkilBkHo=; b=qmIesb7svugVOS0kGELcoOHRaW zzFg2vVERmEfpshZudyNI1Zi44bZ0d/DpGoapqbouHjG22gqeN3VlqtYyIo8ryXmDMFNUKFr2ZfY5 lprYxJieLUlNmqWe6WiJ6DR5bH1sTbZRgqDtV/31hikkNut3/KjC/cy2EKdMdEtlfope/YMqZK03L gwUvYdCjfgMl1q279ujA/3uZH+9euXemVOO7Z+HnAqa5K2UXPfHGBx6xBczpsV1eKZ+yAdqggZvj9 aY+k7GV17LaNHrq75QkRqFIvk955fFy8/3qHceh/hGjlR/XlHquARUrR/GzoO75hmSNLq6jU8jcIo yAiJ/bRQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYhFI-0000000B0Xf-14Fu; Wed, 02 Dec 2026 10:07:28 +0000 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYhFF-0000000B0VU-35oS for linux-amlogic@lists.infradead.org; Wed, 02 Dec 2026 10:07:26 +0000 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-4c4b8e58c9aso2379124f8f.0 for ; Wed, 02 Dec 2026 02:07:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796206043; x=1796810843; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=YSCqpNzKs3+wLNUSpT4FdOion3SVHtMtD5pmOvWpdqw=; b=XlU3YsdxfF1Kgdcn8JBxQVnQnRxR3y1nYZTQASqp6IUsCaD+mVcpX1Ent+AZ0TQLHv Scqqc/BAjAIgoF4pqkTsuhP4sKgE+cqXRrK+dvkiRIA1gm58Y5NOaMFfY7vGKOdoXtLh 1PhtPD2c+kG1slnIQGE0YwNyrphte8Rkd5MVX4g47UR9OSMaXPhqcL2uf+zEyJCKCC9i 7RaiVtIEeCDr1dt5aV18RpLLRfylGONoQRwIEjanRU8o3qA7gD7g8EilVEFfSOYe7GXq HOjLoZtTw2/AHq/JDVanW0sJsWoiJh0K+UI1mx2UvJTKVG2i07T+8cwiYNRCigkiUvfS u7Yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796206043; x=1796810843; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=YSCqpNzKs3+wLNUSpT4FdOion3SVHtMtD5pmOvWpdqw=; b=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5db0My1qG+a70ziBGGDUTBmPlMfUFpxQD+O+CW2dL4D6RQ1WLw Wq5auEsqPjTqMMB9XRV7Wr7V3GfRn9jEyyCP1hC94Xfv3vndOpsStdR83yjU0c4EOfQscBaG/2f 5dJgWwfzkhZ8pwcNRYu6xHnU/nKGJxdZy+3rvYG8BSg/v/keE1h3decvqAWowhHWFMM= X-Received: by 2002:a05:6000:4008:b0:4b6:8c1:bc3d with SMTP id ffacd0b85a97d-4b608c1bc69mr52667220f8f.57.1796206043409; Wed, 02 Dec 2026 02:07:23 -0800 (PST) Received: from localhost.localdomain ([79.117.198.103]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4ab6a67fe75sm87617495f8f.24.2026.12.02.02.07.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 02:07:22 -0800 (PST) From: Jose Nieto To: Corentin Labbe , Herbert Xu , "David S . Miller" Cc: linux-crypto@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jose Nieto Subject: [PATCH v15 00/35] crypto: amlogic: add support for G12/AXG/A1/S4 and misc fixes Date: Wed, 2 Dec 2026 11:06:39 +0100 Message-ID: <20261202100714.115460-1-jnieto.alaber@gmail.com> X-Mailer: git-send-email 2.47.3 X-Archived-By: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261202_020725_820669_F123F0F5 X-CRM114-Status: GOOD ( 18.96 ) X-Spam-Score: -2.1 (--) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-amlogic" X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 This is v15 of the Amlogic crypto driver series originally posted by Alexey Romanov. It rebases the series onto linux-next (next-20261123) and adds, on top of the original patches, the fixes required for the current tree and the corrections raised during review. This version is sent as its own thread, as requested. The original 22 patches by Alexey Romanov are kept untouched (authorship is preserved); I only appended my own Signed-off-by trailer, so the DCO is complete now. On top of them: - the fixes that landed in the driver since v12 are preserved (IRQ handler return value and fallthrough, devm clock management, DMA SG unmap on the cipher error path, probe cleanup, devm_kmalloc_obj conversion); - three patches add what is needed for the current code (drop CRYPTO_ALG_ALLOCATES_MEMORY so dm-crypt can select the hardware engine, the ahash ->digest one-shot path, and a small cleanup); - the review fixes: probe/registration error paths, key/IV descriptor sizing and CBC IV reload, the redundant A1 platform data, the A1/S4 crypto clock, hasher request completion and DMA context, algorithm pointer cleanup on unregister, per-flow completion init before the IRQ, a per-request key/IV buffer, and keeping the bus clock enabled. Changes in v15: - add my Signed-off-by to every patch carried from Alexey (DCO); - drop the "keep standard property order" binding patch: clocks may stay after interrupts; - sent as a new thread (not attached to v13/v14); - hasher: return 0 after finalizing the request (the crypto engine also completes it on a negative return, causing a double completion), use ahash_request_ctx_dma(), always unmap the partial buffer, and guard a NULL request scatterlist; - core: clear algs[i].mc on unregister, initialize the per-flow completion before requesting its IRQ, and get/enable the device tree bus clock; - cipher: size the key/IV setup descriptors from the actual key/IV length (fixing an out-of-bounds DMA read in ECB mode on GXL/AXG), reload the CBC IV on every hardware kick (fixing multi-batch CBC), keep the DMA-mapped key/IV buffer per request (removing a race between concurrent requests on the same transform), zero the unused tail of the per-tfm key buffer on re-key and make meson_handle_cipher_request() static. Tested on Khadas VIM3 (A311D / G12B), booted with a linux-next kernel built from this series: - the crypto self-tests (known-answer tests) pass for ecb/cbc(aes) and sha1/224/256; - dm-crypt with aes-cbc-plain runs on top of cbc-aes-gxl and the driver's request counter accounts for the I/O; - the hardware hasher matches a software SHA-256 for both the one-shot and the streaming (init/update/final) paths, including a >8 MiB multi-batch CBC request. A note on the automated review reports against v13/v14 (Sashiko): - the claim that ctx.keyiv.len does not cover the CBC IV is not correct for this series: for CBC, ctx.keyiv.len is extended to AES_MAX_KEY_SIZE + ivsize before the buffer is mapped; - the sg_virt()/sg_dma_len() coalescing concern does not apply on these SoCs: there is no IOMMU, dma_map_sg() keeps the scatterlist entries and the DMA segments 1:1, and the key/IV buffer is separate request memory. Thanks, Jose Alexey Romanov (22): dt-bindings: crypto: amlogic,gxl-crypto: correct clk and interrupt lines dt-bindings: crypto: amlogic,gxl-crypto: support new SoC's crypto: amlogic - Don't hardcode IRQ count crypto: amlogic - Add platform data crypto: amlogic - Remove clock input crypto: amlogic - Add MMIO helpers crypto: amlogic - Move get_engine_number() crypto: amlogic - Drop status field from meson_flow crypto: amlogic - Move algs definition and cipher API to cipher.c crypto: amlogic - Cleanup defines crypto: amlogic - Process more than MAXDESCS descriptors crypto: amlogic - Avoid kzalloc in engine thread crypto: amlogic - Introduce hasher crypto: amlogic - Use fallback for 192-bit keys crypto: amlogic - Add support for G12-series crypto: amlogic - Add support for AXG-series crypto: amlogic - Add support for A1-series arm64: dts: amlogic: gxl: correct crypto node definition arm64: dts: amlogic: a1: add crypto node arm64: dts: amlogic: s4: add crypto node arm64: dts: amlogic: g12: add crypto node arm64: dts: amlogic: axg: add crypto node Jose Nieto (13): crypto: amlogic: g12: drop CRYPTO_ALG_ALLOCATES_MEMORY crypto: amlogic: hasher: add one-shot digest path crypto: amlogic: drop unused field and stale includes crypto: amlogic: fix probe and algorithm registration error paths crypto: amlogic: fix setup descriptor lengths and CBC IV reload crypto: amlogic: drop redundant A1 platform data arm64: dts: amlogic: use the system clock for A1/S4 crypto crypto: amlogic: fix hasher request completion and DMA context crypto: amlogic: clear algorithm pointers on unregister crypto: amlogic: minor cipher cleanups crypto: amlogic: initialize flow completion before requesting IRQ crypto: amlogic: keep the cipher key/IV buffer per request crypto: amlogic: keep the bus clock enabled .../bindings/crypto/amlogic,gxl-crypto.yaml | 32 +- arch/arm64/boot/dts/amlogic/meson-a1.dtsi | 8 + arch/arm64/boot/dts/amlogic/meson-axg.dtsi | 7 + .../boot/dts/amlogic/meson-g12-common.dtsi | 7 + arch/arm64/boot/dts/amlogic/meson-gxl.dtsi | 6 +- arch/arm64/boot/dts/amlogic/meson-s4.dtsi | 7 + drivers/crypto/amlogic/Makefile | 2 +- drivers/crypto/amlogic/amlogic-gxl-cipher.c | 621 ++++++++++++------ drivers/crypto/amlogic/amlogic-gxl-core.c | 274 ++++---- drivers/crypto/amlogic/amlogic-gxl-hasher.c | 512 +++++++++++++++ drivers/crypto/amlogic/amlogic-gxl.h | 121 +++- 11 files changed, 1224 insertions(+), 373 deletions(-) create mode 100644 drivers/crypto/amlogic/amlogic-gxl-hasher.c base-commit: 3191063649dbf7c0d0b768e1f3655e4c5fc6edb5 -- 2.47.3 _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic