public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeremi Piotrowski <jpiotrowski@linux.microsoft.com>
To: Borislav Petkov <bp@alien8.de>
Cc: X86 ML <x86@kernel.org>, LKML <linux-kernel@vger.kernel.org>,
	KVM <kvm@vger.kernel.org>, Ashish Kalra <ashish.kalra@amd.com>,
	Joerg Roedel <joro@8bytes.org>,
	Michael Roth <michael.roth@amd.com>,
	Tom Lendacky <thomas.lendacky@amd.com>
Subject: Re: [PATCH 5/5] x86/CPU/AMD: Track SNP host status with cc_platform_*()
Date: Thu, 4 Apr 2024 19:07:26 +0200	[thread overview]
Message-ID: <aecd56a4-0a88-4162-95ef-47561631f16e@linux.microsoft.com> (raw)
In-Reply-To: <20240328153914.GBZgWPIvLT6EXAPJci@fat_crate.local>

On 28/03/2024 16:39, Borislav Petkov wrote:
> On Thu, Mar 28, 2024 at 03:24:29PM +0100, Jeremi Piotrowski wrote:
>> It's not but if you set it before the check it will be set for all AMD
>> systems, even if they are neither CC hosts nor CC guests.
> 
> That a problem?
> 

No problem now but I did find it odd that cc_vendor will now always be set for AMD but
not for Intel. For Intel the various checks would automatically return true. Something
to look out for in the future when adding CC_ATTR's - no one can assume that the checks
will only run when actively dealing with confidential computing.

> It is under a CONFIG_ARCH_HAS_CC_PLATFORM...
>>> To leave open the possibility of an SNP hypervisor running nested.
> 
> But !CC_ATTR_GUEST_SEV_SNP doesn't mean that. It means it is not
> a SEV-SNP guest.
> 
>> I thought you wanted to filter out SEV-SNP guests, which also have
>> X86_FEATURE_SEV_SNP CPUID bit set.
> 
> I want to run snp_probe_rmptable_info() only on baremetal where it makes
> sense.
>>> My understanding is that these are the cases:
>>
>> CPUID(SEV_SNP) | MSR(SEV_SNP)     | what am I
>> ---------------------------------------------
>> set            | set              | SNP-guest
>> set            | unset            | SNP-host
>> unset          | ??               | not SNP
> 
> So as you can see, we can't use X86_FEATURE_SEV_SNP for anything due to
> the late disable need. So we should be moving away from it.
> 

I see your point about the disable needing to happen late - but then how about we remove
the setup_clear_cpu_cap(X86_FEATURE_SEV_SNP) too? No code depends on it any more and it would
help my cause as well.

> So we need a test for "am I a nested SNP hypervisor?"
> 
> So, can your thing clear X86_FEATURE_HYPERVISOR and thus "emulate"
> baremetal?
> 

Can't do that... it is a VM and hypervisor detection and various paravirt interfaces depend on
X86_FEATURE_HYPERVISOR.



  reply	other threads:[~2024-04-04 17:07 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-27 15:43 [PATCH 0/5] x86/sev: Fix SNP host late disable Borislav Petkov
2024-03-27 15:43 ` [PATCH 1/5] x86/alternatives: Remove a superfluous newline in _static_cpu_has() Borislav Petkov
2024-04-04  9:11   ` [tip: x86/alternatives] " tip-bot2 for Borislav Petkov (AMD)
2024-04-04 10:16   ` tip-bot2 for Borislav Petkov (AMD)
2024-04-09 17:11   ` [tip: x86/asm] " tip-bot2 for Borislav Petkov (AMD)
2024-03-27 15:43 ` [PATCH 2/5] x86/alternatives: Catch late X86_FEATURE modifiers Borislav Petkov
2024-03-27 15:57   ` Nikolay Borisov
2024-04-03 17:59     ` Borislav Petkov
2024-04-04  9:11   ` [tip: x86/alternatives] " tip-bot2 for Borislav Petkov (AMD)
2024-04-04 10:16   ` tip-bot2 for Borislav Petkov (AMD)
2024-04-09 17:11   ` tip-bot2 for Borislav Petkov (AMD)
2024-03-27 15:43 ` [PATCH 3/5] x86/kvm/Kconfig: Have KVM_AMD_SEV select ARCH_HAS_CC_PLATFORM Borislav Petkov
2024-03-29 14:42   ` Tom Lendacky
2024-04-04  9:11   ` [tip: x86/urgent] " tip-bot2 for Borislav Petkov (AMD)
2024-03-27 15:43 ` [PATCH 4/5] x86/cc: Add cc_platform_set/_clear() helpers Borislav Petkov
2024-03-29 14:46   ` Tom Lendacky
2024-04-04  9:11   ` [tip: x86/urgent] " tip-bot2 for Borislav Petkov (AMD)
2024-03-27 15:43 ` [PATCH 5/5] x86/CPU/AMD: Track SNP host status with cc_platform_*() Borislav Petkov
2024-03-28 11:51   ` Jeremi Piotrowski
2024-03-28 13:41     ` Borislav Petkov
2024-03-28 14:24       ` Jeremi Piotrowski
2024-03-28 15:39         ` Borislav Petkov
2024-04-04 17:07           ` Jeremi Piotrowski [this message]
2024-04-24 18:46             ` Borislav Petkov
2024-03-29 14:52   ` Tom Lendacky
2024-04-04  9:11   ` [tip: x86/urgent] " tip-bot2 for Borislav Petkov (AMD)
2024-04-03  4:15 ` [PATCH 0/5] x86/sev: Fix SNP host late disable Aithal, Srikanth

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=aecd56a4-0a88-4162-95ef-47561631f16e@linux.microsoft.com \
    --to=jpiotrowski@linux.microsoft.com \
    --cc=ashish.kalra@amd.com \
    --cc=bp@alien8.de \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.roth@amd.com \
    --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