From: "Kalra, Ashish" <ashish.kalra@amd.com>
To: Tom Lendacky <thomas.lendacky@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 2/8] x86/sev: Add support for the RMPREAD instruction
Date: Fri, 25 Oct 2024 04:25:50 -0500 [thread overview]
Message-ID: <28d98245-e6fc-4f04-876e-366a353ee6ce@amd.com> (raw)
In-Reply-To: <cacc1a3e63a790450e342d08457b52b2d471cca2.1729708922.git.thomas.lendacky@amd.com>
On 10/23/2024 1:41 PM, Tom Lendacky wrote:
> The RMPREAD instruction returns an architecture defined format of an
> RMP table entry. This is the preferred method for examining RMP entries.
>
> The instruction is advertised in CPUID 0x8000001f_EAX[21]. Use this
> instruction when available.
>
> Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
> ---
> arch/x86/include/asm/cpufeatures.h | 1 +
> arch/x86/virt/svm/sev.c | 11 +++++++++++
> 2 files changed, 12 insertions(+)
>
> diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h
> index 913fd3a7bac6..89c1308cdf54 10064
> --- a/arch/x86/include/asm/cpufeatures.h
> +++ b/arch/x86/include/asm/cpufeatures.h
> @@ -448,6 +448,7 @@
> #define X86_FEATURE_V_TSC_AUX (19*32+ 9) /* Virtual TSC_AUX */
> #define X86_FEATURE_SME_COHERENT (19*32+10) /* AMD hardware-enforced cache coherency */
> #define X86_FEATURE_DEBUG_SWAP (19*32+14) /* "debug_swap" AMD SEV-ES full debug state swap support */
> +#define X86_FEATURE_RMPREAD (19*32+21) /* RMPREAD instruction */
> #define X86_FEATURE_SVSM (19*32+28) /* "svsm" SVSM present */
>
> /* AMD-defined Extended Feature 2 EAX, CPUID level 0x80000021 (EAX), word 20 */
> diff --git a/arch/x86/virt/svm/sev.c b/arch/x86/virt/svm/sev.c
> index 4d095affdb4d..e197610b4eed 100644
> --- a/arch/x86/virt/svm/sev.c
> +++ b/arch/x86/virt/svm/sev.c
> @@ -301,6 +301,17 @@ static int get_rmpentry(u64 pfn, struct rmpread *entry)
> {
> struct rmpentry *e;
>
> + if (cpu_feature_enabled(X86_FEATURE_RMPREAD)) {
> + int ret;
> +
> + asm volatile(".byte 0xf2, 0x0f, 0x01, 0xfd"
> + : "=a" (ret)
> + : "a" (pfn << PAGE_SHIFT), "c" (entry)
> + : "memory", "cc");
> +
> + return ret;
> + }
> +
> e = __get_rmpentry(pfn);
> if (IS_ERR(e))
> return PTR_ERR(e);
Reviewed-by: Ashish Kalra <ashish.kalra@amd.com>
Thanks,
Ashish
next prev parent reply other threads:[~2024-10-25 9:26 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 [this message]
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
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=28d98245-e6fc-4f04-876e-366a353ee6ce@amd.com \
--to=ashish.kalra@amd.com \
--cc=Neeraj.Upadhyay@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=thomas.lendacky@amd.com \
--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