From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dl1-f42.google.com (mail-dl1-f42.google.com [74.125.82.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1BA21309F08 for ; Wed, 13 May 2026 12:48:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778676534; cv=none; b=fPAAHTaaN65NbfOI/5bS0o6tOdY3S06GCqaoXLV6FbLa5uNpVC8r0Pmflv/9ehWpBpPfjaCvP/yCxsr5gKbpVuuWkhiYah4zxZczzoST0HUSocTAlLn2J7Opfq24iXtqdEmrmYZa2EF6eEEQSSZiRpjDYAjqf2KCK5mDf+Q7c94= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778676534; c=relaxed/simple; bh=aZyLfBGopL0QGvNVnnuQ0iptBrTpLGR9vFh7tXx3zsM=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=Md2A5iVAG/Yw6pl1DB2L8fSopGuHhYzSIb0A91UTfZqVh3SWACHBsRbVhGeglm4/cfhDpLRhr+c9k6wzonKFJwbn1v5inbbVtqF45ntyeg3fpNWlhaMhXK9JfQuES6zr7WnChyQ7fuwDiOMcEgSEuExQu2bc58yezul/tRGicHI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=dH/jjaH1; arc=none smtp.client-ip=74.125.82.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dH/jjaH1" Received: by mail-dl1-f42.google.com with SMTP id a92af1059eb24-1334825de43so2084875c88.0 for ; Wed, 13 May 2026 05:48:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778676532; x=1779281332; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=ByktUNvjJyp/tVC7zVVMY3FW0HTxNuLUSrPRR6QCBAY=; b=dH/jjaH1iFHk6eDHDoWQc14NZYMgu1hET+pL4tOA4jokuzXhhWlXTxlMda8k7cBXaZ nqd7UwCxH04JgNI+q8SkFZAU17BTozs5kRzNd+/XhnQoCbc0GQKZ9j/nTHcOB/+lv+Kb TpVcimgwHtkX6PDfVStuTCi9vS6/U6MLAcQFgQ1tyqhVi3jPKfTgdDCHd7qC9lx+5SsY BlD/OcRS58meQIOSyrBzVId0Z/olw76By/RmKaSSrZqBF6/XcTWK8nVxZeWlrOcLguHp KHhhM/dT0kec/1dFzyigHu6/y8FB2ok1aumzUKzU6H/jhkCeMoskgoC940r7IlYUrC+e Qw9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778676532; x=1779281332; 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; bh=ByktUNvjJyp/tVC7zVVMY3FW0HTxNuLUSrPRR6QCBAY=; b=bSHlHGdQUrDbdZs97IgcTewYa26zdhCNHLCkIQg/QQF/XJz0Dg75n5l1GwIkcIBrBO zBtyxpSUKWyKu+U7DBTZ0CLNFiQ1QAmCWaFNva02MdJt76bVDCQuhtswUur+vXjF6xW9 A4p+ak3gz8fpSY53lTuIO3pICjVqJC8Y8XuhgChwnYZpKBrhqGqYB2vD7mKgwwMA0hlW 6BI6Cb3933KughCRQwyv2BRVuOr34T2oroICbC/9sMeGaUBuke60MqDlGLibAw8bfEX+ iwGiWM82F7+NaRM6odeYuITRkYVIycIrarB6GPM20BQHXerEs+5lWoSeGJ3SK+0/BrO1 HwkA== X-Forwarded-Encrypted: i=1; AFNElJ9Ii8gwRakDkp7HrsASBpL0mdt5gDfRw89v3gba8nNiSGhJ2GfaiEAzX/ZJ7256b1cEP5qLHQlwp1Q3bhQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yy3Zbkhj9yIgewTmVgTRq3SQs1rtLa9Ss5VPd5vdPoD2+Wq0mwH Ug8tXjdeY92er48o8/GWqcShugEUWzUCdW20TCKDYoHO30LGCmbYzinO X-Gm-Gg: Acq92OEAz9lDMgn0sh0aF/cpIrr8ad178UPsiDX6vlXDFaLq4dTllJQClhWqshsCruq OCdARozRJAyS2duES783CNE4qX4SNcNP3aik+sFStXYIimsgowdsZMYKM56EicKFewmWKVcH8aj nSKwnFUUe/2hmsJhUNOg3/4UcszpzDN1eRcroO41mUtnmnNARC6kEox8ZqY7gCMzm6oNATdqrzL cOGHKXGl4A3dqBuOirdDRauI2PpSAztqRbdg5dVcUOkHcxyPBjc+I9fg/roGUxyF95h9+ZngZ4n Cq8kYArZIAMjrxVYc4ytTNcwKbuAl0LbGro/jz+9YNuWL9lR0bg+yZ6gGaA6sJ6bEF5ZLMS+izM qUarKS9Z6ggOu0R0OhQKESlEPZEJaiB3AQhLjkihNTpcPxzkcMFglC/2Hb4sV9LIXJwPFZn7x84 BvXxWIqhhLCzEXHlUGHrhIdonTEQ2ZrI/XcBLpwYML X-Received: by 2002:a05:7022:eacc:b0:130:7246:10aa with SMTP id a92af1059eb24-13431940533mr2131481c88.12.1778676531933; Wed, 13 May 2026 05:48:51 -0700 (PDT) Received: from ewan-server.zhaoxin.com ([154.26.185.247]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-134b4e153dbsm1066142c88.12.2026.05.13.05.48.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2026 05:48:51 -0700 (PDT) From: Ewan Hai To: 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 Cc: cobechen@zhaoxin.com, tonywwang@zhaoxin.com Subject: [PATCH v1 0/5] KVM: x86: Expose Zhaoxin CPUID 0xC0000001 EDX cryptographic features Date: Wed, 13 May 2026 20:48:41 +0800 Message-Id: <20260513124846.1622462-1-ewandevelop@gmail.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit NOTE: This is a clean repost. The original submission was sent through our corporate SMTP relay, which appended a legal disclaimer and corrupted the patch encoding, leaving the series unreadable. The previous thread has been retracted: https://lore.kernel.org/all/20260513083042.1603237-1-ewanhai-oc@zhaoxin.com/ The patches below are functionally identical to that submission and have not been technically modified; only the delivery path differs (and the commit messages were lightly tidied up in the process). --- This series exposes five groups of Zhaoxin-specific CPUID 0xC0000001 EDX feature bits to KVM guests. Each group corresponds to a category of user-mode cryptographic or RNG instructions that have been present in Zhaoxin processors but not yet advertised by KVM. All instructions covered here are user-mode and available in all CPU modes (real / V86 / compat / protected / long), with no associated MSR control. Each feature is reported as a (X, X_EN) pair where the two bits are redundant by hardware design (set or cleared together), and both are CPUID-level reporting bits requiring no KVM emulation. The five feature groups: 1. SM2 (bits 0, 1): SM2 elliptic-curve public-key cryptography algorithm per GM/T 0003-2012. Used for key generation, encryption/decryption, digital signatures, and key exchange in Chinese cryptographic standards. 2. CCS (bits 4, 5): SM3 hash algorithm per GM/T 0004-2012 and SM4 block cipher per GM/T 0002-2012 (supports ECB / CBC / CFB / OFB / CTR plus CBC-MAC / CFB-MAC). Foundational primitives for Chinese cryptographic protocols. 3. RNG2 (bits 22, 23): Second-generation hardware RNG exposed via the REP XRNG2 instruction. Two on-die RNG sources selectable per call, with raw and post-processed output modes. Provides high-quality entropy for cryptographic operations. 4. PHE2 (bits 25, 26): SHA-384 and SHA-512 hardware acceleration per FIPS 180-3, exposed via REP XSHA384 and REP XSHA512. Used by TLS, SSH, file integrity, and signature schemes. 5. RSA (bits 27, 28): Big-number modular exponentiation (REP XMODEXP, A^B mod M) and modular multiplication (REP MONTMUL2, A*B mod M), supporting operand sizes from 256 to 32768 bits. Used for RSA and related public-key operations. References: The instruction encodings, control-word formats, and per-feature semantics referenced in the individual patches are documented in: - GMI Instruction Set Reference (SM2 / SM3 / SM4) - PadLock Instruction Reference (XRNG2 / XSHA384 / XSHA512 / XMODEXP / MONTMUL2) Both available from https://kib.kiev.ua/x86docs/Zhaoxin/ Ewan Hai (5): KVM: x86: Expose Zhaoxin SM2 CPUID feature KVM: x86: Expose Zhaoxin CCS (SM3 + SM4) CPUID feature KVM: x86: Expose Zhaoxin RNG2 CPUID feature KVM: x86: Expose Zhaoxin PHE2 CPUID feature KVM: x86: Expose Zhaoxin RSA CPUID feature arch/x86/kvm/cpuid.c | 10 ++++++++++ arch/x86/kvm/reverse_cpuid.h | 12 ++++++++++++ 2 files changed, 22 insertions(+) base-commit: 50897c955902c93ae71c38698abb910525ebdc89 -- 2.34.1