[PATCH 5/5] KVM: x86: Expose Zhaoxin RSA CPUID feature
From: Ewan Hai
Date: Wed May 13 2026 - 04:33:17 EST
Advertise the Zhaoxin big-number arithmetic engine to guests viaCPUID 0xC0000001 EDX bits 27 (RSA) and 28 (RSA_EN). The RSA featureprovides two user-mode instructions for modular arithmetic on bigintegers, documented in the Zhaoxin PadLock Instruction Reference,chapter 4 ("Modular Multiplication and Exponentiation Engine"). Bothsupport operand sizes from 256 to 32768 bits (in 128-bit increments): - REP XMODEXP (encoding F3 0F A6 F8, subsection 4.1) computes A^B mod M - REP MONTMUL2 (encoding F3 0F A6 F0, subsection 4.2) computes A*B mod MREP MONTMUL2 is the long-mode replacement of legacy REP MONTMUL, whichis restricted to compatibility and 32-bit protected modes. Theseprimitives accelerate RSA and related public-key operations.Both instructions are user-mode and available in all CPU modes, with noassociated MSR control. The RSA and RSA_EN bits are redundant byhardware design (set or cleared together) and both serve purely asCPUID-level feature-presence reporting flags requiring no KVMemulation. Both bits are advertised because different software mayprobe either one when checking for RSA availability.Signed-off-by: Ewan Hai <ewanhai-oc@xxxxxxxxxxx>--- arch/x86/kvm/cpuid.c | 2 ++ arch/x86/kvm/reverse_cpuid.h | 2 ++ 2 files changed, 4 insertions(+)diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.cindex 3fb81f7a6107..94ea9abae566 100644--- a/arch/x86/kvm/cpuid.c+++ b/arch/x86/kvm/cpuid.c@@ -1290,6 +1290,8 @@ void kvm_initialize_cpu_caps(void) F(RNG2_EN), F(PHE2), F(PHE2_EN),+ F(RSA),+ F(RSA_EN), ); /*diff --git a/arch/x86/kvm/reverse_cpuid.h b/arch/x86/kvm/reverse_cpuid.hindex f28300c2d5e0..0df96ff9515c 100644--- a/arch/x86/kvm/reverse_cpuid.h+++ b/arch/x86/kvm/reverse_cpuid.h@@ -85,6 +85,8 @@ #define X86_FEATURE_RNG2_EN KVM_X86_FEATURE(CPUID_C000_0001_EDX, 23) #define X86_FEATURE_PHE2 KVM_X86_FEATURE(CPUID_C000_0001_EDX, 25) #define X86_FEATURE_PHE2_EN KVM_X86_FEATURE(CPUID_C000_0001_EDX, 26)+#define X86_FEATURE_RSA KVM_X86_FEATURE(CPUID_C000_0001_EDX, 27)+#define X86_FEATURE_RSA_EN KVM_X86_FEATURE(CPUID_C000_0001_EDX, 28) struct cpuid_reg { u32 function;-- 2.34.1
ä¿?å¯?声æ??
æ?¬é?®ä»¶å?«æ??ä¿?å¯?æ??ä¸?æ??ä¿¡æ?¯ï¼?ä»?ä¾?æ??å®?æ?¶ä»¶äººä½¿ç?¨ã??严ç¦?对æ?¬é?®ä»¶æ??å?¶å??容å??ä»»ä½?æ?ªç»?æ??æ??ç??æ?¥é??ã??使ç?¨ã??å¤?å?¶æ??转å??ã??
This email contains confidential or legally privileged information and is for the sole use of its intended recipient. Any unauthorized review, use, copying or forwarding of this email or the content of this email is strictly prohibited.