[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <85a88037-d36f-433a-96c6-95a0c2e8307f@amd.com>
Date: Wed, 8 Oct 2025 09:16:13 -0500
From: "Suthikulpanit, Suravee" <suravee.suthikulpanit@....com>
To: Nicolin Chen <nicolinc@...dia.com>
Cc: jgg@...dia.com, linux-kernel@...r.kernel.org, robin.murphy@....com,
will@...nel.org, joro@...tes.org, kevin.tian@...el.com, jsnitsel@...hat.com,
vasant.hegde@....com, iommu@...ts.linux.dev, santosh.shukla@....com,
sairaj.arunkodilkar@....com, jon.grimm@....com, prashanthpra@...gle.com,
wvw@...gle.com, wnliu@...gle.com, gptran@...gle.com, kpsingh@...gle.com,
joao.m.martins@...cle.com, alejandro.j.jimenez@...cle.com
Subject: Re: [PATCH v2 09/12] iommu/amd: Add support for nest parent domain
allocation
On 10/2/2025 1:00 PM, Nicolin Chen wrote:
> On Wed, Oct 01, 2025 at 06:09:51AM +0000, Suravee Suthikulpanit wrote:
>> To support nested translation, the nest parent domain is allocated with
>> IOMMU_HWPT_ALLOC_NEST_PARENT flag, and stores information of the v1 page
>> table for stage 2 (i.e. GPA->SPA).
>>
>> Also, only support nest parent domain on AMD system, which can support
>> the Guest CR3 Table (GCR3TRPMode) feature. This feature is required in
>> order to program DTE[GCR3 Table Root Pointer] with the GPA.
>>
>> Signed-off-by: Suravee Suthikulpanit<suravee.suthikulpanit@....com>
>> +static inline bool is_nest_parent_supported(u32 flags)
>> +{
>> + /* Only allow nest parent when these features are supported */
>> + if ((flags & IOMMU_HWPT_ALLOC_NEST_PARENT) &&
>> + (!check_feature(FEATURE_GT) ||
>> + !check_feature(FEATURE_GIOSUP) ||
>> + !check_feature2(FEATURE_GCR3TRPMODE)))
>> + return false;
>> +
>> + return true;
> If the "flags" doesn't have IOMMU_HWPT_ALLOC_NEST_PARENT while one
> of the features is missing, this would return true, indicating the
> HW supports nesting parent, which will be logically wrong although
> it does validate the nest parent flag.
>
> Following the existing coding style, I think this could be just:
>
> static inline bool is_nest_parent_supported(void)
> {
> /* Only allow nest parent when these features are supported */
> return check_feature(FEATURE_GT) && check_feature(FEATURE_GIOSUP) &&
> check_feature2(FEATURE_GCR3TRPMODE);
> }
Ahh, I missed this part.
Thanks,
Suravee
Powered by blists - more mailing lists