[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGtprH8wfYk05+yfzngHJ99ESwjhDf-sRaLO3AT2x1VyFQ6pvw@mail.gmail.com>
Date: Thu, 22 Dec 2022 14:19:31 -0800
From: Vishal Annapurve <vannapurve@...gle.com>
To: Peter Gonda <pgonda@...gle.com>
Cc: kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
marcorr@...gle.com, seanjc@...gle.com, michael.roth@....com,
thomas.lendacky@....com, joro@...tes.org, mizhang@...gle.com,
pbonzini@...hat.com, andrew.jones@...ux.dev
Subject: Re: [PATCH V5 5/7] KVM: selftests: add library for
creating/interacting with SEV guests
On Tue, Oct 18, 2022 at 1:59 PM Peter Gonda <pgonda@...gle.com> wrote:
>
> ...
> +
> +static void configure_sev_pte_masks(struct kvm_vm *vm)
> +{
> + uint32_t eax, ebx, ecx, edx, enc_bit;
> +
> + cpuid(CPUID_MEM_ENC_LEAF, &eax, &ebx, &ecx, &edx);
> + enc_bit = ebx & CPUID_EBX_CBIT_MASK;
> +
> + vm->arch.c_bit = 1 << enc_bit;
This should be 1ULL << enc_bit as the overall result overflows 32 bits.
> + vm->arch.pte_me_mask = vm->arch.c_bit | vm->arch.s_bit;
Maybe the role of pte_me_mask needs to be discussed in more detail. If
pte_me_mask is to be used only for maintaining/manipulating encryption
of page table memory then maybe it should be just set as
vm->arch.c_bit or better yet replaced with vm->arch.c_bit.
gpa_protected_mask also needs to be set here so that vm_untag_gpa
works as expected.
> + vm->protected = true;
> +}
> +
> ...
> +}
> --
> 2.38.0.413.g74048e4d9e-goog
>
Powered by blists - more mailing lists