Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ashish Kalra" <Ashish.Kalra@amd.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH v15 3/5] x86/sev: Initialize RMPOPT configuration MSRs
Date: Wed, 16 Sep 2026 20:06:52 +0000	[thread overview]
Message-ID: <20260916200652.A18511F000FF@smtp.kernel.org> (raw)
In-Reply-To: <9d57b0584549df093c5134660ee5a76f7972a1aa.1789586444.git.ashish.kalra@amd.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] x86/sev: missing X86_FEATURE_RMPOPT cleanup on probe failure
--

commit 1564212e828a7dee0758e1b6a358828053507df5
Author: Ashish Kalra <ashish.kalra@amd.com>
x86/sev: Initialize RMPOPT configuration MSRs

This commit initializes the per-CPU RMPOPT table base to enable RMP
optimizations for up to 2 TB of addressable memory. It introduces
snp_enable_rmpopt() to program the RMPOPT MSR once SNP is enabled and modifies
snp_probe_rmptable_info() to clear the RMPOPT capability if segmented RMP is
unavailable.

> diff --git a/arch/x86/virt/svm/sev.c b/arch/x86/virt/svm/sev.c
> index 558f7924a3f85..f458128b9864f 100644
> --- a/arch/x86/virt/svm/sev.c
> +++ b/arch/x86/virt/svm/sev.c
[ ... ]
> @@ -699,13 +735,21 @@ static bool probe_segmented_rmptable_info(void)
>  
>  bool snp_probe_rmptable_info(void)
>  {
> -	if (cpu_feature_enabled(X86_FEATURE_SEGMENTED_RMP))
> +	if (cpu_feature_enabled(X86_FEATURE_SEGMENTED_RMP)) {
>  		rdmsrq(MSR_AMD64_RMP_CFG, rmp_cfg);
>  
> -	if (rmp_cfg & MSR_AMD64_SEG_RMP_ENABLED)
> -		return probe_segmented_rmptable_info();
> -	else
> -		return probe_contiguous_rmptable_info();
> +		if (rmp_cfg & MSR_AMD64_SEG_RMP_ENABLED)
> +			return probe_segmented_rmptable_info();

[Severity: Low]
If probe_segmented_rmptable_info() fails and returns false, does this early
return bypass the setup_clear_cpu_cap(X86_FEATURE_RMPOPT) cleanup below?

If the BIOS or firmware enables Segmented RMP but provides an invalid
configuration (e.g., missing RMP_BASE or out-of-bounds segment size), this
could leave the X86_FEATURE_RMPOPT CPU capability flag erroneously set.
Consequently, later initcalls might unnecessarily allocate resources for
RMPOPT, even though SEV-SNP initialization will subsequently fail.

> +	}
> +
> +	/*
> +	 * Segmented RMP is either not supported on the platform or is
> +	 * disabled by the firmware.  RMPOPT is not supported without
> +	 * segmented RMP.
> +	 */
> +	setup_clear_cpu_cap(X86_FEATURE_RMPOPT);
> +
> +	return probe_contiguous_rmptable_info();
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1789586444.git.ashish.kalra@amd.com?part=3

  reply	other threads:[~2026-09-16 20:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-16 19:52 [PATCH v15 0/5] Add RMPOPT support Ashish Kalra
2026-09-16 19:52 ` [PATCH v15 1/5] x86/cpufeatures: Add X86_FEATURE_RMPOPT feature flag Ashish Kalra
2026-09-16 19:52 ` [PATCH v15 2/5] x86/sev: Disable CPU hotplug while SNP is active Ashish Kalra
2026-09-16 20:11   ` sashiko-bot
2026-09-16 19:53 ` [PATCH v15 3/5] x86/sev: Initialize RMPOPT configuration MSRs Ashish Kalra
2026-09-16 20:06   ` sashiko-bot [this message]
2026-09-16 19:53 ` [PATCH v15 4/5] x86/sev: Perform RMP optimizations asynchronously Ashish Kalra
2026-09-16 20:09   ` sashiko-bot
2026-09-16 19:53 ` [PATCH v15 5/5] x86/sev: Re-enable RMP optimizations on SNP guest shutdown Ashish Kalra
2026-09-16 20:06   ` sashiko-bot

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=20260916200652.A18511F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Ashish.Kalra@amd.com \
    --cc=kvm@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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