From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id A4EAF1FF17A for ; Sat, 23 Nov 2024 06:41:57 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 8D9431D2B4; Sat, 23 Nov 2024 06:42:05 +0100 (CET) To: pve-devel@lists.proxmox.com Date: Sat, 23 Nov 2024 14:38:15 +0900 MIME-Version: 1.0 Message-ID: List-Id: Proxmox VE development discussion List-Post: From: Jing Luo via pve-devel Precedence: list Cc: Jing Luo X-Mailman-Version: 2.1.29 X-BeenThere: pve-devel@lists.proxmox.com List-Subscribe: , List-Unsubscribe: , List-Archive: Reply-To: Proxmox VE development discussion List-Help: Subject: [pve-devel] [PATCH qemy-server v2] query-machine-capabilities: make it work on non-x86 arch Content-Type: multipart/mixed; boundary="===============7290394293723277504==" Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" --===============7290394293723277504== Content-Type: message/rfc822 Content-Disposition: inline Return-Path: X-Original-To: pve-devel@lists.proxmox.com Delivered-To: pve-devel@lists.proxmox.com Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id CCD58C8F04 for ; Sat, 23 Nov 2024 06:42:03 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A17C71D277 for ; Sat, 23 Nov 2024 06:41:33 +0100 (CET) Received: from mail-gw3.jing.rocks (mail-gw3.jing.rocks [219.117.250.209]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Sat, 23 Nov 2024 06:41:30 +0100 (CET) Received: from mail-gw3.jing.rocks (localhost [127.0.0.1]) by mail-gw3.jing.rocks (Proxmox) with ESMTP id 0BD62214DE for ; Sat, 23 Nov 2024 14:41:25 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jing.rocks; h=cc :cc:content-transfer-encoding:date:from:from:message-id :mime-version:reply-to:subject:subject:to:to; s=mail-gw; bh=3WVB ATN+j8hFwkufzNiMv6+yAfv7K5u2fauocO8k0So=; b=tvwbUqFpasVrgJJScRrg 0w5lVHHAyI2OkDwCeq49ux/fnDvnb1PQOi/XMBc16ch2uDgfRjSAOBfH72ds2QWz f6nPNoBcPK+wVZOByEIS8YczDa8HDc6Q6sF0vC+rAOCoerzOnaUkRZZjaft56/Co xNCHi15jXyZj9MB79m2+FThO6QrXclEGUyFbh+ThropO0ZbISDIk8rx9bA4zxSvT KGKNDgcUzkUa3+HoVRwmOhbVUk2RHOO6FdWVxh+wW9NOTa9T0mSIz9VFfglmvz74 tPPKg3d5yEw7wYg6le1e5AelzN3xK7wdGPikWPMlkxuSwWsSNirFmQUMqyerzEBu pQ== Received: from mail.jing.rocks (mail.jing.rocks [IPv6:240b:10:f00:1b00::222]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail-gw3.jing.rocks (Proxmox) with ESMTPS id 2D876214D5 for ; Sat, 23 Nov 2024 14:41:24 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=jing.rocks; s=default; t=1732340484; bh=PqXNI/2iVZ2PacIZJci2RASulNth3/gLghzBFaWKPWo=; h=From:To:Cc:Subject:Date:From; b=Z7g0cqtfTmvxmRPeh8wWnKuOSX9rSpbRA9hmVUoy4Dz4wlAjqddmTEppmqG/fD8W6 WrlOhA+JwJISlNSSOqQ69I1cqi1Ni8DTN1GJrW75ZdmwCOdzcJR/SStslYG0hy3c6+ gq3XhGPUcR1/cXP86CFHvW1NurOiMTvDnnilZxXEUal6CL4U+RIQcqTBGrolguKTnF VlEjMsGfWo5x2mpFd+Dik//FwX7mMHS6rOQA2JnrkT8almOlibEuXLh2WWl6KAKLU+ 6zxbDRoBz7lJiGC+A1hM7N8XDcZKAxwhnUC8vqE8DD//crnh/OdIIwxA+rrbUtf6BV YeTIpmm1ZCBWQ== Received: from X570AM.jing.rocks (X570AM.jing.rocks [IPv6:240b:10:f00:1b00::7e82]) (Authenticated sender: jing@jing.rocks) by mail.jing.rocks (Postfix) with ESMTPSA id 153393D1E9; Sat, 23 Nov 2024 14:41:24 +0900 (JST) From: Jing Luo To: pve-devel@lists.proxmox.com Cc: Jing Luo Subject: [PATCH qemy-server v2] query-machine-capabilities: make it work on non-x86 arch Date: Sat, 23 Nov 2024 14:38:15 +0900 Message-ID: <20241123054046.1634788-1-jing@jing.rocks> X-Mailer: git-send-email 2.47.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.002 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% 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 KAM_INFOUSMEBIZ 0.75 Prevalent use of .info|.us|.me|.me.uk|.biz|xyz|id|rocks|life domains in spam/malware KAM_OTHER_BAD_TLD 0.75 Other untrustworthy TLDs RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record This little program has inline assembly code that won't work on non-x86 arch: query-machine-capabilities.c: In function 'query_cpu_capabilities': query-machine-capabilities.c:29:5: error: impossible constraint in 'asm' 29 | asm volatile("cpuid" | ^~~ So let's define a marco if we find ourselves not on x86, and skip the actual querying, just write false to things since non-x86 cpu definitely won't support AMD SEV. Signed-off-by: Jing Luo --- Changes to v2: use Lukas' suggestion to use gcc's built in macro --- query-machine-capabilities/query-machine-capabilities.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/query-machine-capabilities/query-machine-capabilities.c b/query-machine-capabilities/query-machine-capabilities.c index 0c522afc..ed684603 100644 --- a/query-machine-capabilities/query-machine-capabilities.c +++ b/query-machine-capabilities/query-machine-capabilities.c @@ -21,6 +21,7 @@ typedef struct { } cpu_caps_t; void query_cpu_capabilities(cpu_caps_t *res) { +#ifdef __x86_64__ uint32_t eax, ebx, ecx, edx; // query Encrypted Memory Capabilities, see: @@ -37,6 +38,13 @@ void query_cpu_capabilities(cpu_caps_t *res) { res->cbitpos = ebx & 0x3f; res->reduced_phys_bits = (ebx >> 6) & 0x3f; +#else + res->sev_support = false; + res->sev_es_support = false; + res->sev_snp_support = false; + res->cbitpos = 0; + res->reduced_phys_bits = 0; +#endif } int prepare_output_directory() { -- 2.47.0 --===============7290394293723277504== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel --===============7290394293723277504==--