From: Tom Lendacky <thomas.lendacky@amd.com>
To: "Kalra, Ashish" <ashish.kalra@amd.com>,
linux-kernel@vger.kernel.org, x86@kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
Michael Roth <michael.roth@amd.com>,
Nikunj A Dadhania <nikunj@amd.com>,
Neeraj Upadhyay <Neeraj.Upadhyay@amd.com>
Subject: Re: [PATCH v4 6/8] x86/sev: Treat the contiguous RMP table as a single RMP segment
Date: Fri, 25 Oct 2024 08:43:45 -0500 [thread overview]
Message-ID: <9d1792de-ef5e-b1c2-cbbe-55b1ef616341@amd.com> (raw)
In-Reply-To: <de69eefa-0da3-4142-bcd0-257248c403f1@amd.com>
On 10/25/24 06:51, Kalra, Ashish wrote:
> On 10/23/2024 1:42 PM, Tom Lendacky wrote:
>> In preparation for support of a segmented RMP table, treat the contiguous
>> RMP table as a segmented RMP table with a single segment covering all
>> of memory. By treating a contiguous RMP table as a single segment, much
>> of the code that initializes and accesses the RMP can be re-used.
>>
>> Segmented RMP tables can have up to 512 segment entries. Each segment
>> will have metadata associated with it to identify the segment location,
>> the segment size, etc. The segment data and the physical address are used
>> to determine the index of the segment within the table and then the RMP
>> entry within the segment. For an actual segmented RMP table environment,
>> much of the segment information will come from a configuration MSR. For
>> the contiguous RMP, though, much of the information will be statically
>> defined.
>>
>> Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
>> ---
>> arch/x86/virt/svm/sev.c | 193 ++++++++++++++++++++++++++++++++++++----
>> 1 file changed, 174 insertions(+), 19 deletions(-)
>>
>> diff --git a/arch/x86/virt/svm/sev.c b/arch/x86/virt/svm/sev.c
>> index dd256e76e443..043b2582e10e 100644
>> --- a/arch/x86/virt/svm/sev.c
>> +++ b/arch/x86/virt/svm/sev.c
>> - return rmptable + pfn;
>> + segment_index = RMP_ENTRY_INDEX(paddr);
>> + if (unlikely(segment_index >= desc->max_index))
>> + return ERR_PTR(-EFAULT);
>> + segment_index = array_index_nospec(segment_index, desc->max_index);
>> +
>> + return desc->rmp_entry + segment_index;
>> }
>>
>
> Ah ok, __get_rmpentry() is finalized here in this patch and rmptable & rmptable_max_pfn
> are removed as part of this patch, so probably my comments on patch #1 are not relevant.
>
> This is somewhat confusing, maybe some comments can be added in patch #1 to explain that
> __get_rmpentry() will be finalized in this patch ?
>
> My confusion results from the following :
>
> Patch #1:
> __get_rmpentry()
> --- refers to rmptable.
>
> Patch #5:
> rmptable initialized here.
>
> Patch #6:
> rmptable not required and removed in this patch.
> do final cleanup for __get_rmpentry().
Patch #1 was just a restructuring, rmptable_max_pfn and rmptable are both
initialized in snp_rmptable_init() as they previously were. So no real
explanation needed.
Thanks,
Tom
>
> Thanks,
> Ashish
>
>> static int get_rmpentry(u64 pfn, struct rmpread *entry)
next prev parent reply other threads:[~2024-10-25 13:43 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-23 18:41 [PATCH v4 0/8] Provide support for RMPREAD and a segmented RMP Tom Lendacky
2024-10-23 18:41 ` [PATCH v4 1/8] x86/sev: Prepare for using the RMPREAD instruction to access the RMP Tom Lendacky
2024-10-25 9:00 ` Kalra, Ashish
2024-10-25 13:39 ` Tom Lendacky
2024-10-25 12:09 ` Borislav Petkov
2024-10-25 13:47 ` Tom Lendacky
2024-10-25 13:55 ` Borislav Petkov
2024-10-25 13:56 ` Tom Lendacky
2024-10-25 14:03 ` Borislav Petkov
2024-10-23 18:41 ` [PATCH v4 2/8] x86/sev: Add support for the RMPREAD instruction Tom Lendacky
2024-10-25 9:25 ` Kalra, Ashish
2024-10-23 18:41 ` [PATCH v4 3/8] x86/sev: Require the RMPREAD instruction after Zen4 Tom Lendacky
2024-10-25 10:47 ` Kalra, Ashish
2024-10-23 18:41 ` [PATCH v4 4/8] x86/sev: Move the SNP probe routine out of the way Tom Lendacky
2024-10-23 18:41 ` [PATCH v4 5/8] x86/sev: Map only the RMP table entries instead of the full RMP range Tom Lendacky
2024-10-25 11:03 ` Kalra, Ashish
2024-10-23 18:42 ` [PATCH v4 6/8] x86/sev: Treat the contiguous RMP table as a single RMP segment Tom Lendacky
2024-10-25 11:51 ` Kalra, Ashish
2024-10-25 13:43 ` Tom Lendacky [this message]
2024-10-23 18:42 ` [PATCH v4 7/8] x86/sev: Add full support for a segmented RMP table Tom Lendacky
2024-10-23 18:42 ` [PATCH v4 8/8] x86/sev/docs: Document the SNP Reverse Map Table (RMP) Tom Lendacky
2024-10-25 7:18 ` Kalra, Ashish
2024-10-25 6:11 ` [PATCH v4 0/8] Provide support for RMPREAD and a segmented RMP Neeraj Upadhyay
2024-10-25 6:38 ` Nikunj A. Dadhania
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=9d1792de-ef5e-b1c2-cbbe-55b1ef616341@amd.com \
--to=thomas.lendacky@amd.com \
--cc=Neeraj.Upadhyay@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=nikunj@amd.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
all inboxes | Powered by JetHome®