From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id BA2071FF09B for ; Mon, 31 Aug 2026 18:35:43 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id B674B213BF; Mon, 31 Aug 2026 18:35:42 +0200 (CEST) From: Markus Frank To: pve-devel@lists.proxmox.com Subject: [PATCH qemu-server v1 1/2] query-machine-capabilities: amd-sev: add max-asid and min-asid-std-sev Date: Mon, 31 Aug 2026 18:34:14 +0200 Message-ID: <20260831163526.462323-1-m.frank@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1788194125720 X-SPAM-LEVEL: Spam detection results: 0 DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: NWXHSIW5OEGQEURQV3U5H4ZJBPKG4FWO X-Message-ID-Hash: NWXHSIW5OEGQEURQV3U5H4ZJBPKG4FWO X-MailFrom: m.frank@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Read two more AMD SEV values with CPUID that are currently only visible in the BIOS and dmesg. max-asid: maximum number of Address Space Identifiers (ASID) for all AMD SEV VMs = maximum number of SEV guests that can run at the same time min-asid-std-sev: minimum ASID value for standard SEV guests AMD SEV ASID Ranges: * 1 .. (min-asid-std-sev - 1): SEV-ES, SEV-SNP guests * min-asid-std-sev .. max-asid: standard SEV guests This could be used to prevent SEV VMs from starting and to display a more informative error message if all ASIDs are already in use by other SEV VMs. Signed-off-by: Markus Frank --- .../query-machine-capabilities.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/query-machine-capabilities/query-machine-capabilities.c b/src/query-machine-capabilities/query-machine-capabilities.c index 0a9ab805..cf5f5252 100644 --- a/src/query-machine-capabilities/query-machine-capabilities.c +++ b/src/query-machine-capabilities/query-machine-capabilities.c @@ -31,6 +31,8 @@ typedef struct { uint8_t cbitpos; uint8_t reduced_phys_bits; + uint32_t max_asid; + uint32_t min_asid_std_sev; } cpu_caps_amd_sev_t; typedef struct { @@ -138,6 +140,8 @@ void query_cpu_capabilities_sev(cpu_caps_amd_sev_t *res) { res->cbitpos = ebx & 0x3f; res->reduced_phys_bits = (ebx >> 6) & 0x3f; + res->max_asid = ecx; + res->min_asid_std_sev = edx; #else memset(res, 0, sizeof(*res)); #endif @@ -213,12 +217,16 @@ int main() { " \"amd-sev\": {" " \"cbitpos\": %u," " \"reduced-phys-bits\": %u," + " \"max-asid\": %u," + " \"min-asid-std-sev\": %u," " \"sev-support\": %s," " \"sev-support-es\": %s," " \"sev-support-snp\": %s" " }", caps_sev.cbitpos, caps_sev.reduced_phys_bits, + caps_sev.max_asid, + caps_sev.min_asid_std_sev, caps_sev.sev_support ? "true" : "false", caps_sev.sev_es_support ? "true" : "false", caps_sev.sev_snp_support ? "true" : "false" -- 2.47.3