From: Tom Lendacky <thomas.lendacky@amd.com>
To: linux-kernel@vger.kernel.org, x86@kernel.org,
linux-coco@lists.linux.dev, svsm-devel@coconut-svsm.dev
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
"H. Peter Anvin" <hpa@zytor.com>,
Andy Lutomirski <luto@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Dan Williams <dan.j.williams@intel.com>,
Michael Roth <michael.roth@amd.com>,
Ashish Kalra <ashish.kalra@amd.com>
Subject: Re: [PATCH v5 04/13] x86/sev: Perform PVALIDATE using the SVSM when not at VMPL0
Date: Mon, 17 Jun 2024 12:50:27 -0500 [thread overview]
Message-ID: <234bb23c-d295-76e5-a690-7ea68dc1118b@amd.com> (raw)
In-Reply-To: <4c4017d8b94512d565de9ccb555b1a9f8983c69c.1717600736.git.thomas.lendacky@amd.com>
On 6/5/24 10:18, Tom Lendacky wrote:
> The PVALIDATE instruction can only be performed at VMPL0. An SVSM will
> be present when running at VMPL1 or a lower privilege level.
>
> When an SVSM is present, use the SVSM_CORE_PVALIDATE call to perform
> memory validation instead of issuing the PVALIDATE instruction directly.
>
> The validation of a single 4K page is now explicitly identified as such
> in the function name, pvalidate_4k_page(). The pvalidate_pages() function
> is used for validating 1 or more pages at either 4K or 2M in size. Each
> function, however, determines whether it can issue the PVALIDATE directly
> or whether the SVSM needs to be invoked.
>
> Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
> ---
> arch/x86/boot/compressed/sev.c | 45 +++++-
> arch/x86/include/asm/sev.h | 26 ++++
> arch/x86/kernel/sev-shared.c | 250 +++++++++++++++++++++++++++++++--
> arch/x86/kernel/sev.c | 30 ++--
> 4 files changed, 325 insertions(+), 26 deletions(-)
Small fix on top of this patch for SVSM PVALIDATE support.
Thanks,
Tom
diff --git a/arch/x86/kernel/sev-shared.c b/arch/x86/kernel/sev-shared.c
index b889be32ef9c..7933c1203b63 100644
--- a/arch/x86/kernel/sev-shared.c
+++ b/arch/x86/kernel/sev-shared.c
@@ -1360,15 +1360,12 @@ static u64 svsm_build_ca_from_pfn_range(u64 pfn, u64 pfn_end, bool action,
return pfn;
}
-static void svsm_build_ca_from_psc_desc(struct snp_psc_desc *desc,
- struct svsm_pvalidate_call *pc)
+static int svsm_build_ca_from_psc_desc(struct snp_psc_desc *desc, unsigned int desc_entry,
+ struct svsm_pvalidate_call *pc)
{
struct svsm_pvalidate_entry *pe;
- unsigned int desc_entry;
struct psc_entry *e;
- desc_entry = desc->hdr.cur_entry;
-
/* Nothing in the CA yet */
pc->num_entries = 0;
pc->cur_index = 0;
@@ -1391,7 +1388,7 @@ static void svsm_build_ca_from_psc_desc(struct snp_psc_desc *desc,
break;
}
- desc->hdr.cur_entry = desc_entry;
+ return desc_entry;
}
static void svsm_pval_pages(struct snp_psc_desc *desc)
@@ -1427,8 +1424,8 @@ static void svsm_pval_pages(struct snp_psc_desc *desc)
call.rax = SVSM_CORE_CALL(SVSM_CORE_PVALIDATE);
call.rcx = pc_pa;
- while (desc->hdr.cur_entry <= desc->hdr.end_entry) {
- svsm_build_ca_from_psc_desc(desc, pc);
+ for (i = 0; i <= desc->hdr.end_entry;) {
+ i = svsm_build_ca_from_psc_desc(desc, i, pc);
do {
ret = svsm_perform_call_protocol(&call);
>
next prev parent reply other threads:[~2024-06-17 17:50 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-05 15:18 [PATCH v5 00/13] Provide SEV-SNP support for running under an SVSM Tom Lendacky
2024-06-05 15:18 ` [PATCH v5 01/13] x86/irqflags: Provide native versions of the local_irq_save()/restore() Tom Lendacky
2024-06-05 15:18 ` [PATCH v5 02/13] x86/sev: Check for the presence of an SVSM in the SNP Secrets page Tom Lendacky
2024-06-05 19:38 ` Borislav Petkov
2024-06-05 21:17 ` Tom Lendacky
2024-06-05 15:18 ` [PATCH v5 03/13] x86/sev: Use kernel provided SVSM Calling Areas Tom Lendacky
2024-06-06 12:36 ` Borislav Petkov
2024-06-05 15:18 ` [PATCH v5 04/13] x86/sev: Perform PVALIDATE using the SVSM when not at VMPL0 Tom Lendacky
2024-06-06 14:38 ` Borislav Petkov
2024-06-17 17:50 ` Tom Lendacky [this message]
2024-06-05 15:18 ` [PATCH v5 05/13] x86/sev: Use the SVSM to create a vCPU when not in VMPL0 Tom Lendacky
2024-06-05 15:18 ` [PATCH v5 06/13] x86/sev: Provide SVSM discovery support Tom Lendacky
2024-06-05 15:18 ` [PATCH v5 07/13] x86/sev: Provide guest VMPL level to userspace Tom Lendacky
2024-06-05 15:18 ` [PATCH v5 08/13] virt: sev-guest: Choose the VMPCK key based on executing VMPL Tom Lendacky
2024-06-05 15:18 ` [PATCH v5 09/13] configfs-tsm: Allow the privlevel_floor attribute to be updated Tom Lendacky
2024-06-14 20:47 ` Dan Williams
2024-06-05 15:18 ` [PATCH v5 10/13] fs/configfs: Add a callback to determine attribute visibility Tom Lendacky
2024-07-11 20:07 ` Christophe JAILLET
2024-06-05 15:18 ` [PATCH v5 11/13] x86/sev: Take advantage of configfs visibility support in TSM Tom Lendacky
2024-06-05 15:18 ` [PATCH v5 12/13] x86/sev: Extend the config-fs attestation support for an SVSM Tom Lendacky
2024-06-06 19:15 ` Tom Lendacky
2024-06-05 15:18 ` [PATCH v5 13/13] x86/sev: Allow non-VMPL0 execution when an SVSM is present 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=234bb23c-d295-76e5-a690-7ea68dc1118b@amd.com \
--to=thomas.lendacky@amd.com \
--cc=ashish.kalra@amd.com \
--cc=bp@alien8.de \
--cc=dan.j.williams@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-coco@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=michael.roth@amd.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=svsm-devel@coconut-svsm.dev \
--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;
as well as URLs for NNTP newsgroup(s).