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.