From: Fiona Ebner <f.ebner@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
Philipp Giersfeld <philipp.giersfeld@canarybit.eu>
Subject: Re: [pve-devel] [PATCH qemu-server v3 3/5] Convert policy calculation
Date: Wed, 5 Mar 2025 16:35:15 +0100 [thread overview]
Message-ID: <2db917eb-875e-4dec-aa4d-42db882c50f2@proxmox.com> (raw)
In-Reply-To: <20250224123714.2662460-4-philipp.giersfeld@canarybit.eu>
Am 24.02.25 um 13:37 schrieb Philipp Giersfeld:
> Convert policy calcucalation to use shift operators and OR operation
Nit: there is a typo here: calcucalation
> 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>
With the typo above fixed:
Reviewed-by: Fiona Ebner <f.ebner@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'});
While at it, we could also go for using constants, i.e. something like:
$policy |= AMD_SEV_POLICY_NO_DEBUG if $amd_sev_conf->{'no-debug'};
and for the one in the next patch, AMD_SEV_SNP_POLICY_NO_DEBUG.
But not a blocker from my side, if you don't want to go for it.
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2025-03-05 15:35 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-24 12:37 [pve-devel] [PATCH edk2-firmware/qemu-server/manager v3 0/5] AMD SEV-SNP Philipp Giersfeld
2025-02-24 12:37 ` [pve-devel] [PATCH edk2-firmware v3 1/5] Update edk2 to edkstable202411 Philipp Giersfeld
2025-03-05 16:51 ` [pve-devel] applied: " Thomas Lamprecht
2025-02-24 12:37 ` [pve-devel] [PATCH edk2-firmware v3 2/5] Add OVMF targets for AMD SEV-ES and SEV-SNP Philipp Giersfeld
2025-03-05 14:18 ` Fiona Ebner
2025-03-05 15:35 ` Thomas Lamprecht
2025-03-11 12:31 ` Philipp Giersfeld
2025-02-24 12:37 ` [pve-devel] [PATCH qemu-server v3 3/5] Convert policy calculation Philipp Giersfeld
2025-03-05 15:35 ` Fiona Ebner [this message]
2025-02-24 12:37 ` [pve-devel] [PATCH qemu-server v3 4/5] config: add AMD SEV-SNP support Philipp Giersfeld
2025-03-05 15:35 ` Fiona Ebner
2025-03-11 13:56 ` Philipp Giersfeld
2025-03-11 14:22 ` Fiona Ebner
2025-02-24 12:37 ` [pve-devel] [PATCH pve-manager v3 5/5] Add configuration options for AMD SEV-SNP Philipp Giersfeld
2025-03-05 8:31 ` [pve-devel] [PATCH edk2-firmware/qemu-server/manager v3 0/5] " Philipp Giersfeld
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2db917eb-875e-4dec-aa4d-42db882c50f2@proxmox.com \
--to=f.ebner@proxmox.com \
--cc=philipp.giersfeld@canarybit.eu \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal