From: Binbin Wu <binbin.wu@linux.intel.com>
To: Ewan Hai <ewandevelop@gmail.com>
Cc: seanjc@google.com, pbonzini@redhat.com, tglx@kernel.org,
mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
x86@kernel.org, hpa@zytor.com, kvm@vger.kernel.org,
linux-kernel@vger.kernel.org, ewanhai@zhaoxin.com,
cobechen@zhaoxin.com, tonywwang@zhaoxin.com
Subject: Re: [PATCH v2 2/5] KVM: x86: Expose Zhaoxin CCS (SM3 + SM4) CPUID feature
Date: Tue, 2 Jun 2026 15:30:04 +0800 [thread overview]
Message-ID: <8890aa54-b119-4040-a508-e71706405ae2@linux.intel.com> (raw)
In-Reply-To: <20260528032234.1322565-3-ewandevelop@gmail.com>
On 5/28/2026 11:22 AM, Ewan Hai wrote:
> Advertise the Zhaoxin CCS (Chinese Cryptography Standard) feature to
> guests via CPUID 0xC0000001 EDX bits 4 (CCS) and 5 (CCS_EN). CCS groups
> two user-mode instructions for Chinese national cryptographic
^
Nit:
It's supposed to be replaced?
> primitives, documented in the Zhaoxin GMI Instruction Set Reference,
> chapter 2 ("CCS instruction group"):
>
> - SM3 (encoding F3 0F A6 E8, subsection 2.1) implements the SM3 hash
> algorithm specified in GM/T 0004-2012. It supports two modes
> selected by RAX: auto-padding stream mode (RAX=0) and pre-padded
> block mode (RAX=-1).
>
> - SM4 (encoding F3 0F A7 F0, subsection 2.2) implements the SM4 block
> cipher specified in GM/T 0002-2012, supporting ECB / CBC / CFB /
> OFB / CTR modes via a control word in RAX, and CBC-MAC / CFB-MAC
> when RAX bit[11] is set.
>
> Both instructions are unprivileged (no CPL restriction) and available
> in all CPU modes, with no associated MSR control. The CCS and CCS_EN
> bits are redundant by hardware design (set or cleared together) and
> both serve purely as CPUID-level feature-presence reporting flags
> requiring no KVM emulation. Both bits are advertised because different
> software may probe either one when checking for CCS availability.
>
> Signed-off-by: Ewan Hai <ewandevelop@gmail.com>
> ---
> arch/x86/include/asm/cpufeatures.h | 2 ++
> arch/x86/kvm/cpuid.c | 2 ++
> 2 files changed, 4 insertions(+)
>
> diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h
> index 20b33413189c..276e4ef90bd0 100644
> --- a/arch/x86/include/asm/cpufeatures.h
> +++ b/arch/x86/include/asm/cpufeatures.h
> @@ -140,6 +140,8 @@
> #define X86_FEATURE_SM2_EN ( 5*32+ 1) /* "sm2_en" SM2 enabled */
> #define X86_FEATURE_XSTORE ( 5*32+ 2) /* "rng" RNG present (xstore) */
> #define X86_FEATURE_XSTORE_EN ( 5*32+ 3) /* "rng_en" RNG enabled */
> +#define X86_FEATURE_CCS ( 5*32+ 4) /* "ccs" SM3 + SM4 instructions */
> +#define X86_FEATURE_CCS_EN ( 5*32+ 5) /* "ccs_en" CCS enabled */
> #define X86_FEATURE_XCRYPT ( 5*32+ 6) /* "ace" on-CPU crypto (xcrypt) */
> #define X86_FEATURE_XCRYPT_EN ( 5*32+ 7) /* "ace_en" on-CPU crypto enabled */
> #define X86_FEATURE_ACE2 ( 5*32+ 8) /* "ace2" Advanced Cryptography Engine v2 */
> diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
> index 1eb4b88aaa80..8aaa3f20670e 100644
> --- a/arch/x86/kvm/cpuid.c
> +++ b/arch/x86/kvm/cpuid.c
> @@ -1276,6 +1276,8 @@ void kvm_initialize_cpu_caps(void)
> F(SM2_EN),
> F(XSTORE),
> F(XSTORE_EN),
> + F(CCS),
> + F(CCS_EN),
> F(XCRYPT),
> F(XCRYPT_EN),
> F(ACE2),
next prev parent reply other threads:[~2026-06-02 7:30 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-28 3:22 [PATCH v2 0/5] KVM: x86: Expose Zhaoxin CPUID 0xC0000001 EDX cryptographic features Ewan Hai
2026-05-28 3:22 ` [PATCH v2 1/5] KVM: x86: Expose Zhaoxin SM2 CPUID feature Ewan Hai
2026-05-28 3:42 ` sashiko-bot
2026-05-28 7:09 ` Ewan Hai
2026-05-28 12:49 ` Sean Christopherson
2026-05-28 13:35 ` Ewan Hai
2026-05-28 3:22 ` [PATCH v2 2/5] KVM: x86: Expose Zhaoxin CCS (SM3 + SM4) " Ewan Hai
2026-06-02 7:30 ` Binbin Wu [this message]
2026-06-02 7:49 ` Ewan Hai
2026-05-28 3:22 ` [PATCH v2 3/5] KVM: x86: Expose Zhaoxin RNG2 " Ewan Hai
2026-05-28 3:22 ` [PATCH v2 4/5] KVM: x86: Expose Zhaoxin PHE2 " Ewan Hai
2026-06-02 7:29 ` Binbin Wu
2026-05-28 3:22 ` [PATCH v2 5/5] KVM: x86: Expose Zhaoxin RSA " Ewan Hai
2026-05-28 5:03 ` sashiko-bot
2026-05-28 7:14 ` Ewan Hai
2026-06-02 7:32 ` [PATCH v2 0/5] KVM: x86: Expose Zhaoxin CPUID 0xC0000001 EDX cryptographic features Binbin Wu
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=8890aa54-b119-4040-a508-e71706405ae2@linux.intel.com \
--to=binbin.wu@linux.intel.com \
--cc=bp@alien8.de \
--cc=cobechen@zhaoxin.com \
--cc=dave.hansen@linux.intel.com \
--cc=ewandevelop@gmail.com \
--cc=ewanhai@zhaoxin.com \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=tglx@kernel.org \
--cc=tonywwang@zhaoxin.com \
--cc=x86@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.