The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Depei Yang <yangdepei@hygon.cn>
To: <linux-crypto@vger.kernel.org>
Cc: Tom Lendacky <thomas.lendacky@amd.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	Gary R Hook <gary.hook@amd.com>, <linux-kernel@vger.kernel.org>,
	Depei Yang <yangdepei@hygon.cn>, Shan Chen <chenshan@hygon.cn>,
	Yongwei Xu <xuyongwei@hygon.cn>,
	Xiaochen Shen <shenxiaochen@hygon.cn>
Subject: [PATCH 00/11] crypto: ccp - add Hygon SM3/SM4 support
Date: Wed, 25 Nov 2026 15:45:58 +0800	[thread overview]
Message-ID: <cover.1795588986.git.yangdepei@hygon.cn> (raw)

This series adds SM3 and SM4 offload for Hygon CCP devices, which use
the v5 programming model, and fixes two pre-existing problems in the
queue handling that were found while validating it.

Patches 1-2 are generic fixes that apply to the AMD devices as well:

  1: correct the LSB region mask, which tested the wrong region
  2: acknowledge the queue interrupt before publishing the completion

Patches 3-11 prepare and enable the Hygon support on top of a per-device
capability set instead of unconditional registration:

  3-4: add struct ccp_caps and gate algorithm registration on the
       engines the device implements.  AMD v5 devices keep their
       current set of algorithms; the v3 CCP does not implement DES3
       and no longer advertises it.
  5:   split descriptor submission from running the queue, so that the
       SM engines can submit a whole batch and run the queue once.
  6-7: add the SM3/SM4 command ABI, the Hygon PCI IDs and vdata.
  8:   ignore the empty-queue interrupt status bit, which the Hygon
       CCP reports and the v5 handler must not treat as a completion.
       AMD hardware has not been observed to report it; for the status
       values AMD produces the check makes no difference.
  9:   read the implemented engines from the Hygon version register.
  10-11: add the SM4 skcipher and SM3 ahash front ends, registering
       ecb/cbc/ctr(sm4), sm3 and hmac(sm3).

Every patch was built separately with W=1 and passes checkpatch.  The
driver has been tested on Hygon CCP hardware: the crypto API self-tests
pass, and an out-of-tree test module passes all 17 of its cases.  The
cases cover known-answer vectors, cross-checks against the generic
software implementations, streaming and export state, multi-segment
scatterlists, repeated requests and concurrent requests.

AI assistance: the code and changelogs were produced with AI coding
assistants under human review.  The assistance is recorded here, as the
patches do not carry per-patch Assisted-by tags:

  Assisted-by: Claude:deepseek-v4-flash-1017

The test module is not part of this series.

Depei Yang (11):
  crypto: ccp - fix LSB region mask calculation
  crypto: ccp - acknowledge queue interrupt before waking waiter
  crypto: ccp - add engine capability and version information
  crypto: ccp - register algorithms only for supported engines
  crypto: ccp - split v5 command submission from queue run
  crypto: ccp - add SM3/SM4 command definitions
  crypto: ccp - add Hygon CCP device IDs and vdata
  crypto: ccp - handle only supported interrupts in v5 irq bh
  crypto: ccp - detect the Hygon CCP engines from the version register
  crypto: ccp - add SM4 engine and skcipher algorithms
  crypto: ccp - add SM3 engine and ahash algorithms

 drivers/crypto/ccp/Kconfig           |   1 +
 drivers/crypto/ccp/Makefile          |   4 +-
 drivers/crypto/ccp/ccp-crypto-main.c |  36 +-
 drivers/crypto/ccp/ccp-crypto-sm3.c  | 468 +++++++++++++++++++++++++
 drivers/crypto/ccp/ccp-crypto-sm4.c  | 254 ++++++++++++++
 drivers/crypto/ccp/ccp-crypto.h      |  67 ++++
 drivers/crypto/ccp/ccp-dev-v3.c      |  21 +-
 drivers/crypto/ccp/ccp-dev-v5.c      | 260 +++++++++++++-
 drivers/crypto/ccp/ccp-dev.c         |  37 ++
 drivers/crypto/ccp/ccp-dev.h         |  31 ++
 drivers/crypto/ccp/ccp-ops.c         | 487 +++++++++++++++++++++++++++
 drivers/crypto/ccp/sp-dev.h          |  12 +
 drivers/crypto/ccp/sp-pci.c          |  35 ++
 include/linux/ccp.h                  | 187 ++++++++++
 14 files changed, 1878 insertions(+), 22 deletions(-)
 create mode 100644 drivers/crypto/ccp/ccp-crypto-sm3.c
 create mode 100644 drivers/crypto/ccp/ccp-crypto-sm4.c


base-commit: 05441d697f7f9a927264f4058cbbc6a03dfcac9d
-- 
2.34.1



             reply	other threads:[~2026-11-25  7:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25  7:45 Depei Yang [this message]
2026-11-25  7:45 ` [PATCH 01/11] crypto: ccp - fix LSB region mask calculation Depei Yang
2026-11-25  7:46 ` [PATCH 02/11] crypto: ccp - acknowledge queue interrupt before waking waiter Depei Yang
2026-11-25  7:46 ` [PATCH 03/11] crypto: ccp - add engine capability and version information Depei Yang
2026-11-25  7:46 ` [PATCH 04/11] crypto: ccp - register algorithms only for supported engines Depei Yang
2026-11-25  7:46 ` [PATCH 05/11] crypto: ccp - split v5 command submission from queue run Depei Yang
2026-11-25  7:46 ` [PATCH 06/11] crypto: ccp - add SM3/SM4 command definitions Depei Yang
2026-11-25  7:46 ` [PATCH 07/11] crypto: ccp - add Hygon CCP device IDs and vdata Depei Yang
2026-11-25  7:46 ` [PATCH 08/11] crypto: ccp - handle only supported interrupts in v5 irq bh Depei Yang
2026-11-25  7:46 ` [PATCH 09/11] crypto: ccp - detect the Hygon CCP engines from the version register Depei Yang
2026-11-25  7:46 ` [PATCH 10/11] crypto: ccp - add SM4 engine and skcipher algorithms Depei Yang
2026-11-25  7:46 ` [PATCH 11/11] crypto: ccp - add SM3 engine and ahash algorithms Depei Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1795588986.git.yangdepei@hygon.cn \
    --to=yangdepei@hygon.cn \
    --cc=chenshan@hygon.cn \
    --cc=davem@davemloft.net \
    --cc=gary.hook@amd.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shenxiaochen@hygon.cn \
    --cc=thomas.lendacky@amd.com \
    --cc=xuyongwei@hygon.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox