Messages in this thread Patch in this message | | | From | Suravee Suthikulpanit <> | Subject | [PATCH 1/3] iommu/amd: Introduce helper function to check feature bit on all IOMMUs | Date | Fri, 20 Aug 2021 15:29:55 -0500 |
| |
IOMMU advertises feature via Extended Features Register (EFR). The helper function checks if the specified feature bit is set across all IOMMUs.
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com> --- drivers/iommu/amd/init.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c index 46280e6e1535..c97961451ac5 100644 --- a/drivers/iommu/amd/init.c +++ b/drivers/iommu/amd/init.c @@ -298,6 +298,19 @@ int amd_iommu_get_num_iommus(void) return amd_iommus_present; } +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) + return false; + } + + return true; +} /* * For IVHD type 0x11/0x40, EFR is also available via IVHD. * Default to IVHD EFR since it is available sooner -- 2.17.1
| |