From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 018721FF0E9 for ; Thu, 30 Jul 2026 03:48:16 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 6163821331; Thu, 30 Jul 2026 03:48:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785376081; x=1785980881; darn=lists.proxmox.com; h=content-transfer-encoding:content-type:mime-version:message-id:date :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to :content-type; bh=LaP+2OST9ljTF2R3R2FMnwJU/aSKGGeKSCpp+dXC7Mw=; b=g4dmwxHrXFIloScKyfRTPBkjGXUFPwW5yZSslgxRPmdF3BTqv7sUtpnOfVmqBylIoj 5dBqwpPY7aIEse5HWA3qvOFzSp6xi3wKTVxKN6Y7SK97uMXsLZIyVX098biu8KcktEe6 8CgUu6LqUZKnXJ8PVe6CxgQ9sjSypnVX/WtRp1Ie8MrK6o/L+6i6T7Hcz+dUTqHMwuIy los52rKwg1hMhQepLA2jlbSgHi67ZgZwA3MoDtOdidr+9pl22bH/99NVFzOOlxXCjUOD tNynFB0uxN99v4b5NX7iiyg0lkZ3DkNs4PhPqBXo22AumNSJ/2vj2PVAvq4bcxFXCngV f9FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785376081; x=1785980881; h=content-transfer-encoding:content-type: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:content-type; bh=LaP+2OST9ljTF2R3R2FMnwJU/aSKGGeKSCpp+dXC7Mw=; b=r1Q3hpP30Wwb0GXTSJiV9k5NqJXa3F/31TilQfvF5lj7w9xtIr5lsnAQlIkxnUyEUR BFGVEB0OwQblSKZEEZFTr3goxkK/bb7hxi7UAv6Yg1UXkVPhsM7rRRpd/YZJPVY8Pzi3 Ravrr0HU+9nDOn0e83yz0oSD4UdLzPABgT3QdsIOcvhmrabZEQD8ZzwfIBFsbOpLpM5Y k3lcIJWJz0kca4K2ScxZ/KmtWQYQ57bCiRDAqrznuFCdN8pUKz3Nsw8QD38sKOYak4cp IRrEO2dzMhP0tUUcjqTTXcyJCiWfmDzRfurwOV0qF+UhCvtYlLZzyvZKvRDZrldNiwi0 k6tw== X-Gm-Message-State: AOJu0YzbUEaaDankTNfRydSfGIKfPZMVoJsRJqPvCzNw8pb5lIXX1HEm JVL/Ffaqp+UkK8D94zg/XPhMS05pgyy4jsxaai0SBlooi8AEnCDt2ZYOsOEtOkHKPjg+sg== X-Gm-Gg: AR+sD10P04vnlbU+qt8A5NvWTG4FsShGAtJtEZD3es7shtyweevqHA2pCrRQq2SwoCz X9HI9HNUfs0d1VMOdSoXiAtq4j/nHtv8uAD5eTqrpO9Ny57yMJ5tkkI1yInMO9IY8vxj409OnOQ LcAz86v82Z4tZY6iOw/WmB+r3zN4gPYpOjrta8d0g/ek8v+OL+RO35tKXNbjOCT68mXSmDADwtQ 4WnzPkH90zycRg3YHaCgdw6qZLNPGsY16TB5kAJw74gro8CYbGqZnR8OMMGzDx6ByYGWvwwgtjo 3D3oYlZl54MU33rmlXAd/bXaPlcEUoNXCWPUGJh6yzZS7YLhh69Vyf0nd8yyoumt7a9eJnEA3Ti IY4tIATzpk5XvJJBM3pCQr5THkunjORrL/ktOTxGg+7ndvac80h+cbIPs7hiH/d/HusAB9ZJPOT BPizwITf+1rIme+NJ/nbeb/AgrgHLoW1KwlXv3q1bIva9A3ViFfbz0++cnOCW39Brd7iQbxsshk rfL1cukJMnBd7uVUoZAJ1Wh X-Received: by 2002:a05:6a00:b8a:b0:84a:29a7:f3b3 with SMTP id d2e1a72fcca58-84ebc423ef7mr655817b3a.68.1785376081270; Wed, 29 Jul 2026 18:48:01 -0700 (PDT) From: Kaiyang Wu X-Google-Original-From: Kaiyang Wu To: pve-devel@lists.proxmox.com Subject: [PATCH qemu-server v3] query-machine-capabilities: limit AuthenticAMD and GenuineIntel checks to x86-64 Date: Thu, 30 Jul 2026 09:47:05 +0800 Message-ID: <20260730014713.64822-2-wukaiyang@loongfans.cn> X-Mailer: git-send-email 2.55.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.000 Adjusted score from AWL reputation of From: address DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain DMARC_PASS -0.1 DMARC pass policy FREEMAIL_ENVFROM_END_DIGIT 1 Envelope-from freemail username ends in digit FREEMAIL_FROM 0.001 Sender email is commonly abused enduser mail provider RCVD_IN_DNSWL_NONE -0.0001 Sender listed at https://www.dnswl.org/, no 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: HRLL73RLDNU5RJ26TZR32CR4AG3MPP6T X-Message-ID-Hash: HRLL73RLDNU5RJ26TZR32CR4AG3MPP6T X-MailFrom: wukaiyang2003@gmail.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 CC: Kaiyang Wu X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Intel TDX and AMD SEV are both x86-64-only extensions [0] [1]. The current method of checking results in compilation errors on "unknown" vendors, where the current placeholder string length ("Unknown") mismatches the lengths of both "AuthenticAMD" and "GenuineIntel": error: ‘strncmp’ of strings of length 7 and 12 and bound of 12 evaluates to nonzero [-Werror=string-compare] Limit the machine capability checks for Intel TDX and AMD SEV to x86-64 to fix build. [0]: https://docs.kernel.org/arch/x86/tdx.html [1]: https://docs.kernel.org/virt/kvm/x86/amd-memory-encryption.html Signed-off-by: Kaiyang Wu --- v1: https://lore.proxmox.com/pve-devel/20260603055031.106241-1-wukaiyang@loongfans.cn/ v2: https://lore.proxmox.com/pve-devel/20260729111024.58285-2-wukaiyang@loongfans.cn/ Changes v1 -> v2: - Use conditional compilation to limit Intel TDX and AMD SEV checks to x86-64 - Eliminate the vendor string length check Changes v2 -> v3: - Remove the extra 'else' block to fix compilation on aarch64 .../query-machine-capabilities.c | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/src/query-machine-capabilities/query-machine-capabilities.c b/src/query-machine-capabilities/query-machine-capabilities.c index abb47acd..b47ed698 100644 --- a/src/query-machine-capabilities/query-machine-capabilities.c +++ b/src/query-machine-capabilities/query-machine-capabilities.c @@ -204,6 +204,7 @@ int main() { eprintf("Error writing to file '" OUTPUT_PATH "': %s\n", strerror(errno)); } +#ifdef __x86_64__ if (strncmp(vendor, "AuthenticAMD", 12) == 0) { cpu_caps_amd_sev_t caps_sev; query_cpu_capabilities_sev(&caps_sev); @@ -233,22 +234,20 @@ int main() { ); } } -#ifdef __aarch64__ - else { - cpu_caps_arm_t caps_arm; - query_cpu_capabilities_arm(&caps_arm); - - ret = fprintf(file, - " \"arm-caps\": {" - " \"vendor\": \"%s\"," - " \"aes\": %s," - " \"sha2\": %s" - " }", - vendor, - caps_arm.aes ? "true" : "false", - caps_arm.sha2 ? "true" : "false" - ); - } +#elif defined(__aarch64__) + cpu_caps_arm_t caps_arm; + query_cpu_capabilities_arm(&caps_arm); + + ret = fprintf(file, + " \"arm-caps\": {" + " \"vendor\": \"%s\"," + " \"aes\": %s," + " \"sha2\": %s" + " }", + vendor, + caps_arm.aes ? "true" : "false", + caps_arm.sha2 ? "true" : "false" + ); #endif if (ret < 0) { -- 2.55.0