From: Tom Lendacky <thomas.lendacky@amd.com>
To: Borislav Petkov <bp@alien8.de>
Cc: <linux-kernel@vger.kernel.org>, <x86@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>,
Dave Hansen <dave.hansen@linux.intel.com>,
Michael Roth <michael.roth@amd.com>,
"Ashish Kalra" <ashish.kalra@amd.com>
Subject: Re: [PATCH v2 1/7] x86/sev: Prepare for using the RMPREAD instruction to access the RMP
Date: Thu, 17 Oct 2024 13:16:36 -0500 [thread overview]
Message-ID: <20241017181636.2878844-1-thomas.lendacky@amd.com> (raw)
In-Reply-To: <20240904104728.GBZtg6wIgihDlsIgIS@fat_crate.local>
> On Wed, 4 Sep 2024 12:47:28 +0200, Borislav Petkov wrote:
Sorry, this email seemed to get lost in our email quarantine. Trying to
reply using copy/paste and git send-email...
> > On Tue, Jul 30, 2024 at 02:40:01PM -0500, Tom Lendacky wrote:
> > The RMPREAD instruction returns an architecture defined format of an
> > RMP entry. This is the preferred method for examining RMP entries.
> >
> > In preparation for using the RMPREAD instruction, convert the existing
> > code that directly accesses the RMP to map the raw RMP information into
> > the architecture defined format.
> >
> > RMPREAD output returns a status bit for the 2MB region status. If the
> > input page address is 2MB aligned and any other pages within the 2MB
> > region are assigned, then 2MB region status will be set to 1. Otherwise,
> > the 2MB region status will be set to 0. For systems that do not support
> > RMPREAD, calculating this value would require looping over all of the RMP
> > table entries within that range until one is found with the assigned bit
> > set. Since this bit is not defined in the current format, and so not used
> > today, do not incur the overhead associated with calculating it.
> >
> > Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
> > ---
> > arch/x86/virt/svm/sev.c | 141 ++++++++++++++++++++++++++++------------
> > 1 file changed, 98 insertions(+), 43 deletions(-)
> >
> > diff --git a/arch/x86/virt/svm/sev.c b/arch/x86/virt/svm/sev.c
> > index 0ce17766c0e5..103a2dd6e81d 100644
> > --- a/arch/x86/virt/svm/sev.c
> > +++ b/arch/x86/virt/svm/sev.c
> > @@ -30,11 +30,27 @@
> > #include <asm/cmdline.h>
> > #include <asm/iommu.h>
> >
> > +/*
> > + * The RMP entry format as returned by the RMPREAD instruction.
>
> I'm guessing this is the architectural variant...
Yes, this is the format returned by RMPREAD.
>
> > + */
> > +struct rmpentry {
> > + u64 gpa;
> > + u8 assigned :1,
> > + rsvd1 :7;
> > + u8 pagesize :1,
> > + hpage_region_status :1,
> > + rsvd2 :6;
> > + u8 immutable :1,
> > + rsvd3 :7;
> > + u8 rsvd4;
> > + u32 asid;
> > +} __packed;
> > +
> > /*
> > * The RMP entry format is not architectural. The format is defined in PPR
> > * Family 19h Model 01h, Rev B1 processor.
>
> ... considering this thing?
>
> > */
> > -struct rmpentry {
> > +struct rmpentry_raw {
>
> "raw"? Hm.
>
> So what is the goal here?
>
> Use rmpentry_raw for the kernel's representation and convert the format that
> gets returned by RMPREAD into rmpentry_raw?
No, just the opposite. Take the current systems that don't have RMPREAD support
and transform the "raw" RMP entry data obtained directly from the RMP table
into the architectural variant. This way, only the architectural variant is
used going forward.
>
> Because if so, the _raw thing is what comes from RMPREAD.
>
> Because as it is now, it is begging to confuse people.
>
> Because if you call the *new* entry differently, it won't cause any of the
> churn you have to do below...
I can look at naming the new struct "rmpread" and see how that looks if you
prefer.
Thanks,
Tom
>
> Hmmm?
>
> --
> Regards/Gruss,
> Boris.
>
next prev parent reply other threads:[~2024-10-17 18:16 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-30 19:40 [PATCH v2 0/7] Provide support for RMPREAD and a segmented RMP Tom Lendacky
2024-07-30 19:40 ` [PATCH v2 1/7] x86/sev: Prepare for using the RMPREAD instruction to access the RMP Tom Lendacky
2024-09-04 10:47 ` Borislav Petkov
2024-10-17 18:16 ` Tom Lendacky [this message]
2024-10-18 11:10 ` Borislav Petkov
2024-07-30 19:40 ` [PATCH v2 2/7] x86/sev: Add support for the RMPREAD instruction Tom Lendacky
2024-07-30 19:40 ` [PATCH v2 3/7] x86/sev: Require the RMPREAD instruction after Fam19h Tom Lendacky
2024-07-30 19:40 ` [PATCH v2 4/7] x86/sev: Move the SNP probe routine out of the way Tom Lendacky
2024-07-30 19:40 ` [PATCH v2 5/7] x86/sev: Map only the RMP table entries instead of the full RMP range Tom Lendacky
2024-07-30 19:40 ` [PATCH v2 6/7] x86/sev: Treat the contiguous RMP table as a single RMP segment Tom Lendacky
2024-07-30 19:40 ` [PATCH v2 7/7] x86/sev: Add full support for a segmented RMP table Tom Lendacky
2024-08-29 6:56 ` [PATCH v2 0/7] Provide support for RMPREAD and a segmented RMP Borislav Petkov
2024-09-11 18:30 ` Tom Lendacky
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=20241017181636.2878844-1-thomas.lendacky@amd.com \
--to=thomas.lendacky@amd.com \
--cc=ashish.kalra@amd.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.roth@amd.com \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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