public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Tycho Andersen <tycho@kernel.org>
Cc: Ashish Kalra <ashish.kalra@amd.com>,
	Tom Lendacky <thomas.lendacky@amd.com>,
	 John Allen <john.allen@amd.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	 Paolo Bonzini <pbonzini@redhat.com>,
	Shuah Khan <shuah@kernel.org>,
	 "David S. Miller" <davem@davemloft.net>,
	linux-crypto@vger.kernel.org,  linux-kernel@vger.kernel.org,
	kvm@vger.kernel.org,  linux-kselftest@vger.kernel.org
Subject: Re: [PATCH 3/4] crypto/ccp: support setting RAPL_DIS in SNP_INIT_EX
Date: Mon, 23 Feb 2026 08:40:19 -0800	[thread overview]
Message-ID: <aZyC89v9JAVEPeLt@google.com> (raw)
In-Reply-To: <20260223162900.772669-4-tycho@kernel.org>

On Mon, Feb 23, 2026, Tycho Andersen wrote:
> From: "Tycho Andersen (AMD)" <tycho@kernel.org>
> 
> The kernel allows setting the RAPL_DIS policy bit, but had no way to set

Please actually say what RAPL_DIS is and does, and explain why this is the
correct approach.  I genuinely have no idea what the impact of this patch is,
(beyond disabling something, obviously).

> the RAPL_DIS bit during SNP_INIT_EX. Setting the policy bit would always
> result in:
> 
>     [  898.840286] ccp 0000:a9:00.5: sev command 0xa0 failed (0x00000007)
> 
> Allow setting the RAPL_DIS bit during SNP_INIT_EX via a module parameter.
> If the hardware does not support RAPL_DIS, log and disable the module
> parameter.
> 
> Signed-off-by: Tycho Andersen (AMD) <tycho@kernel.org>
> ---
>  drivers/crypto/ccp/sev-dev.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c
> index 096f993974d1..362126453ef0 100644
> --- a/drivers/crypto/ccp/sev-dev.c
> +++ b/drivers/crypto/ccp/sev-dev.c
> @@ -75,6 +75,10 @@ static bool psp_init_on_probe = true;
>  module_param(psp_init_on_probe, bool, 0444);
>  MODULE_PARM_DESC(psp_init_on_probe, "  if true, the PSP will be initialized on module init. Else the PSP will be initialized on the first command requiring it");
>  
> +static bool rapl_disable;
> +module_param(rapl_disable, bool, 0444);
> +MODULE_PARM_DESC(rapl_disable, "  if true, the RAPL_DIS bit will be set during INIT_EX if supported");
> +
>  #if IS_ENABLED(CONFIG_PCI_TSM)
>  static bool sev_tio_enabled = true;
>  module_param_named(tio, sev_tio_enabled, bool, 0444);
> @@ -1428,6 +1432,16 @@ static int __sev_snp_init_locked(int *error, unsigned int max_snp_asid)
>  			data.max_snp_asid = max_snp_asid;
>  		}
>  
> +		if (rapl_disable) {
> +			if (sev->snp_feat_info_0.ecx & SNP_RAPL_DISABLE_SUPPORTED) {
> +				data.rapl_dis = 1;
> +			} else {
> +				dev_info(sev->dev,
> +					"SEV: RAPL_DIS requested, but not supported");
> +				rapl_disable = false;
> +			}
> +		}
> +
>  		data.init_rmp = 1;
>  		data.list_paddr_en = 1;
>  		data.list_paddr = __psp_pa(snp_range_list);
> -- 
> 2.53.0
> 

  reply	other threads:[~2026-02-23 16:40 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-23 16:28 [PATCH 0/4] Allow setting RAPL_DIS during SNP_INIT_EX Tycho Andersen
2026-02-23 16:28 ` [PATCH 1/4] selftests/kvm: allow retrieving underlying SEV firmware error Tycho Andersen
2026-02-23 16:28 ` [PATCH 2/4] selftests/kvm: check that SEV-ES VMs are allowed in SEV-SNP mode Tycho Andersen
2026-02-23 16:36   ` Sean Christopherson
2026-02-23 16:48     ` Tycho Andersen
2026-02-23 17:15       ` Sean Christopherson
2026-02-23 22:12         ` Tycho Andersen
2026-02-24 18:02           ` Sean Christopherson
2026-02-25 17:29             ` Tycho Andersen
2026-02-25 17:44               ` Sean Christopherson
2026-02-26 20:59                 ` Tycho Andersen
2026-02-26 22:28                   ` Sean Christopherson
2026-02-23 16:28 ` [PATCH 3/4] crypto/ccp: support setting RAPL_DIS in SNP_INIT_EX Tycho Andersen
2026-02-23 16:40   ` Sean Christopherson [this message]
2026-02-23 22:14     ` Tycho Andersen
2026-02-24 17:50       ` Sean Christopherson
2026-02-25 18:05         ` Tycho Andersen
2026-02-23 16:29 ` [PATCH 4/4] selftests/kvm: smoke test support for RAPL_DIS Tycho Andersen

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=aZyC89v9JAVEPeLt@google.com \
    --to=seanjc@google.com \
    --cc=ashish.kalra@amd.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=john.allen@amd.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=shuah@kernel.org \
    --cc=thomas.lendacky@amd.com \
    --cc=tycho@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