From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <pve-devel-bounces@lists.proxmox.com> Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 934391FF173 for <inbox@lore.proxmox.com>; Mon, 24 Feb 2025 13:37:55 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id B4D281944; Mon, 24 Feb 2025 13:37:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1740400665; x=1741005465; d=canarybit.eu; s=rsa2; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:from; bh=yiQsR5xdNKVWgxDyg6YThk4HpJ3qVEK4e13SBWHMdj8=; b=Am6uT4nYucuv8OnNKaU3cc0UpThSPLFyctMU0Qtdz6/tFQZZkkD3YOD9Eut61E6jwWPqNMhIO6qeM EM7aOn3SmkKgeiBqmBNntR6V25Dyr84JRrBL+eWokxOumDpN+4brQPx99mEGlA/nBE/7X6PVkKrPTG wWyM2mY2avgGYxegX9eMBGyLFUAntje8ReGfroJ/GioHuj8fKzBjSui1+D8xx0dNMYfezL7Hjrza3S 7BoVctF+FLccdJyaNb4R9eYAJUyg2ts4iVbDd2FBjEJLuWMBjdHDOMynhYbyYiBdAFg1lInStM/JNV aNBg8XQMQs9Ip3CXtsM56l+N/FkhryQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1740400665; x=1741005465; d=canarybit.eu; s=ed2; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:from; bh=yiQsR5xdNKVWgxDyg6YThk4HpJ3qVEK4e13SBWHMdj8=; b=y/ZqDok8pfmVdLniAbC/hlCmiQTkrp7T3Gp8U71v+OEdTvCGSVYAEaGYOfdFZwGI93Irr2HbvRrOW QHKkrGcBg== X-HalOne-ID: 246becef-f2ac-11ef-ab26-29b2d794c87d From: Philipp Giersfeld <philipp.giersfeld@canarybit.eu> To: pve-devel@lists.proxmox.com Date: Mon, 24 Feb 2025 13:37:12 +0100 Message-Id: <20250224123714.2662460-4-philipp.giersfeld@canarybit.eu> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250224123714.2662460-1-philipp.giersfeld@canarybit.eu> References: <20250224123714.2662460-1-philipp.giersfeld@canarybit.eu> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.198 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_MISSING 0.1 Missing DMARC policy RCVD_IN_DNSWL_NONE -0.0001 Sender listed at https://www.dnswl.org/, no trust SPF_HELO_PASS -0.001 SPF: HELO matches SPF record SPF_NONE 0.001 SPF: sender does not publish an SPF Record Subject: [pve-devel] [PATCH qemu-server v3 3/5] Convert policy calculation X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com> List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe> List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/> List-Post: <mailto:pve-devel@lists.proxmox.com> List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help> List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe> Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com> Convert policy calcucalation to use shift operators and OR operation instead of binary numbers and addition. Signed-off-by: Philipp Giersfeld <philipp.giersfeld@canarybit.eu> Reviewed-by: Daniel Kral <d.kral@proxmox.com> Tested-by: Markus Frank <m.frank@proxmox.com> --- no changes since last version PVE/QemuServer/CPUConfig.pm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/PVE/QemuServer/CPUConfig.pm b/PVE/QemuServer/CPUConfig.pm index e65d8c26..ad0be16e 100644 --- a/PVE/QemuServer/CPUConfig.pm +++ b/PVE/QemuServer/CPUConfig.pm @@ -846,12 +846,12 @@ sub get_amd_sev_object { # guest policy bit calculation as described here: # https://documentation.suse.com/sles/15-SP5/html/SLES-amd-sev/article-amd-sev.html#table-guestpolicy - my $policy = 0b0000; - $policy += 0b0001 if $amd_sev_conf->{'no-debug'}; - $policy += 0b0010 if $amd_sev_conf->{'no-key-sharing'}; - $policy += 0b0100 if $amd_sev_conf->{type} eq 'es'; + my $policy = 0; + $policy |= 1 << 0 if $amd_sev_conf->{'no-debug'}; + $policy |= 1 << 1 if $amd_sev_conf->{'no-key-sharing'}; + $policy |= 1 << 2 if $amd_sev_conf->{type} eq 'es'; # disable migration with bit 3 nosend to prevent amd-sev-migration-attack - $policy += 0b1000; + $policy |= 1 << 3; $sev_mem_object .= ',policy='.sprintf("%#x", $policy); $sev_mem_object .= ',kernel-hashes=on' if ($amd_sev_conf->{'kernel-hashes'}); -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel