From: Peter Gonda <pgonda@google.com>
To: Vishal Annapurve <vannapurve@google.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
marcorr@google.com, seanjc@google.com, michael.roth@amd.com,
thomas.lendacky@amd.com, joro@8bytes.org, mizhang@google.com,
pbonzini@redhat.com, andrew.jones@linux.dev
Subject: Re: [PATCH V5 5/7] KVM: selftests: add library for creating/interacting with SEV guests
Date: Mon, 9 Jan 2023 14:20:07 -0700 [thread overview]
Message-ID: <CAMkAt6pLFO0ZAnQ23ZUX3MdtFpcb69kwW79JDn=_5b7a48rtHg@mail.gmail.com> (raw)
In-Reply-To: <CAGtprH8wfYk05+yfzngHJ99ESwjhDf-sRaLO3AT2x1VyFQ6pvw@mail.gmail.com>
On Thu, Dec 22, 2022 at 3:19 PM Vishal Annapurve <vannapurve@google.com> wrote:
>
> On Tue, Oct 18, 2022 at 1:59 PM Peter Gonda <pgonda@google.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.
Thanks for speaking with me offline about TDX. I have removed
pte_me_mask entirely and set gpa_protected_mask here in my V6.
>
> > + vm->protected = true;
> > +}
> > +
> > ...
> > +}
>
> > --
> > 2.38.0.413.g74048e4d9e-goog
> >
next prev parent reply other threads:[~2023-01-09 21:22 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-18 20:58 [PATCH V5 0/7] KVM: selftests: Add simple SEV test Peter Gonda
2022-10-18 20:58 ` [PATCH V5 1/7] KVM: selftests: sparsebit: add const where appropriate Peter Gonda
2022-10-18 20:58 ` [PATCH V5 2/7] KVM: selftests: add hooks for managing protected guest memory Peter Gonda
2022-10-18 20:58 ` [PATCH V5 3/7] KVM: selftests: handle protected bits in page tables Peter Gonda
2022-10-18 20:58 ` [PATCH V5 4/7] KVM: selftests: add support for protected vm_vaddr_* allocations Peter Gonda
2022-10-18 20:58 ` [PATCH V5 5/7] KVM: selftests: add library for creating/interacting with SEV guests Peter Gonda
2022-12-21 21:13 ` Ackerley Tng
2023-01-09 21:19 ` Peter Gonda
2022-12-22 22:19 ` Vishal Annapurve
2023-01-09 21:20 ` Peter Gonda [this message]
2022-10-18 20:58 ` [PATCH V5 6/7] KVM: selftests: Update ucall pool to allocate from shared memory Peter Gonda
2022-10-18 20:58 ` [PATCH V5 7/7] KVM: selftests: Add simple sev vm testing Peter Gonda
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='CAMkAt6pLFO0ZAnQ23ZUX3MdtFpcb69kwW79JDn=_5b7a48rtHg@mail.gmail.com' \
--to=pgonda@google.com \
--cc=andrew.jones@linux.dev \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcorr@google.com \
--cc=michael.roth@amd.com \
--cc=mizhang@google.com \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=thomas.lendacky@amd.com \
--cc=vannapurve@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).