[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <8a4e9350-8a0e-469b-969c-25cd81926f7a@amd.com>
Date: Thu, 6 Feb 2025 11:11:48 +0530
From: Vasant Hegde <vasant.hegde@....com>
To: Sean Christopherson <seanjc@...gle.com>
Cc: Ashish Kalra <Ashish.Kalra@....com>, pbonzini@...hat.com,
tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
dave.hansen@...ux.intel.com, x86@...nel.org, hpa@...or.com,
thomas.lendacky@....com, john.allen@....com, herbert@...dor.apana.org.au,
davem@...emloft.net, joro@...tes.org, suravee.suthikulpanit@....com,
will@...nel.org, robin.murphy@....com, michael.roth@....com,
dionnaglaze@...gle.com, nikunj@....com, ardb@...nel.org,
kevinloughlin@...gle.com, Neeraj.Upadhyay@....com, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-crypto@...r.kernel.org,
linux-coco@...ts.linux.dev, iommu@...ts.linux.dev
Subject: Re: [PATCH v3 3/3] x86/sev: Fix broken SNP support with KVM module
built-in
Sean,
On 2/6/2025 1:01 AM, Sean Christopherson wrote:
> On Wed, Feb 05, 2025, Vasant Hegde wrote:
>> On 2/5/2025 8:47 PM, Sean Christopherson wrote:
>>> On Wed, Feb 05, 2025, Vasant Hegde wrote:
>>>>> @@ -3318,6 +3326,9 @@ static int __init iommu_go_to_state(enum iommu_init_state state)
>>>>> ret = state_next();
>>>>> }
>>>>>
>>>>> + if (ret && !amd_iommu_snp_en && cc_platform_has(CC_ATTR_HOST_SEV_SNP))
>>>>
>>>>
>>>> I think we should clear when `amd_iommu_snp_en` is true.
>>>
>>> That doesn't address the case where amd_iommu_prepare() fails, because amd_iommu_snp_en
>>> will be %false (its init value) and the RMP will be uninitialized, i.e.
>>> CC_ATTR_HOST_SEV_SNP will be incorrectly left set.
>>
>> You are right. I missed early failure scenarios :-(
>>
>>>
>>> And conversely, IMO clearing CC_ATTR_HOST_SEV_SNP after initializing the IOMMU
>>> and RMP is wrong as well. Such a host is probably hosed regardless, but from
>>> the CPU's perspective, SNP is supported and enabled.
>>
>> So we don't want to clear CC_ATTR_HOST_SEV_SNP after RMP initialization -OR-
>> clear for all failures?
>
> I honestly don't know, because the answer largely depends on what happens with
> hardware. I asked in an earlier version of this series if IOMMU initialization
> failure after the RMP is configured is even survivable.
>
> For this series, I think it makes sense to match the existing behavior, unless
> someone from AMD can definitively state that we should do something different.
> And the existing behavior is that amd_iommu_snp_en and CC_ATTR_HOST_SEV_SNP will
> be left set if the IOMMU completes iommu_snp_enable(), and the kernel completes
> RMP setup.
Thanks for the clarification. Patch looks OK to me.
-Vasant
Powered by blists - more mailing lists