lkml.org 
[lkml]   [2022]   [Jun]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v3 1/7] iommu/amd: Warn when found inconsistency EFR mask
From


On 6/23/2022 3:22 PM, Joerg Roedel wrote:
> On Wed, Jun 22, 2022 at 12:11:25PM -0500, Suravee Suthikulpanit wrote:
>> #ifdef CONFIG_IRQ_REMAP
>> +/*
>> + * Iterate through all the IOMMUs to verify if the specified
>> + * EFR bitmask of IOMMU feature are set.
>> + * Warn and return false if found inconsistency.
>> + */
>> static bool check_feature_on_all_iommus(u64 mask)
>> {
>> bool ret = false;
>> struct amd_iommu *iommu;
>>
>> for_each_iommu(iommu) {
>> - ret = iommu_feature(iommu, mask);
>> - if (!ret)
>> + bool tmp = iommu_feature(iommu, mask);
>> +
>> + if ((ret != tmp) &&
>> + !list_is_first(&iommu->list, &amd_iommu_list)) {
>> + pr_err(FW_BUG "Found inconsistent EFR mask (%#llx) on iommu%d (%04x:%02x:%02x.%01x).\n",
>> + mask, iommu->index, iommu->pci_seg->id, PCI_BUS_NUM(iommu->devid),
>> + PCI_SLOT(iommu->devid), PCI_FUNC(iommu->devid));
>> return false;
>> + }
>> + ret = tmp;
>
> It is better to implement this by introducing a global feature mask,
> which represents the minial set of features supported by any IOMMU in
> the system.
>
> The warning is then something like:
>
> if ((global_feature_mask & iommu_features) != global_feature_mask)
> pr_warn(...);
>
> This also makes the global variable to track SNP support obsolete.
>
> Regards,
>
> Joerg

That's actually better. I'll send out v4 w/ global EFR variable.

Thanks,
Suravee

\
 
 \ /
  Last update: 2022-06-29 13:52    [W:1.830 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site