Re: [RFC PATCH 2/6] iommu/amd: Add support for hw_info for iommu capability query

Suthikulpanit, Suravee
2024-01-05T13:40:13Z

Hi Kevin,

On 12/15/2023 2:32 PM, Tian, Kevin wrote:
>> From: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
>> Sent: Wednesday, December 13, 2023 12:02 AM
>>
>> +void amd_iommu_build_efr(u64 *efr, u64 *efr2)
>> +{
>> + if (efr) {
>> + *efr = (FEATURE_GT | FEATURE_GIOSUP | FEATURE_PPR);
>> +
>> + /* 5-level v2 page table support */
>> + *efr |= ((FEATURE_GATS_5LEVEL << FEATURE_GATS_SHIFT) &
>> + FEATURE_GATS_MASK);
>> +
>> + /* 3-level GCR3 table support */
>> + *efr |= ((FEATURE_GLX_3LEVEL << FEATURE_GLX_SHIFT) &
>> + FEATURE_GLX_MASK);
>> +
>> + /* 16-bit PASMAX support */
>> + *efr |= ((FEATURE_PASMAX_16 << FEATURE_PASMAX_SHIFT)
>> &
>> + FEATURE_PASMAX_MASK);
>> + }
>> +
>> + if (efr2)
>> + *efr2 = 0;
>> +}
>
> Don't this need to check the support in hw?

Ah.. Good point. Let me add check for the support for these features in
the actual hardware.

Thanks,
Suravee