iommu/amd: Process all IVHDs before enabling IOMMU features
authorSuravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Wed, 13 Jul 2022 22:56:46 +0000 (17:56 -0500)
committerJoerg Roedel <jroedel@suse.de>
Fri, 15 Jul 2022 08:41:03 +0000 (10:41 +0200)
commitae180ba42662afe2ed7620bdb863c7c6b61f6f2d
treea509538acc3dc720e1aaa5ea00169800fc692ef8
parent9dd299d8c6cd9cd50fe49c067a82f091df87565f
iommu/amd: Process all IVHDs before enabling IOMMU features

The ACPI IVRS table can contain multiple IVHD blocks. Each block contains
information used to initialize each IOMMU instance.

Currently, init_iommu_all sequentially process IVHD block and initialize
IOMMU instance one-by-one. However, certain features require all IOMMUs
to be configured in the same way system-wide. In case certain IVHD blocks
contain inconsistent information (most likely FW bugs), the driver needs
to go through and try to revert settings on IOMMUs that have already been
configured.

A solution is to split IOMMU initialization into 3 phases:

Phase1 : Processes information of the IVRS table for all IOMMU instances.
This allow all IVHDs to be processed prior to enabling features.

Phase2 : Early feature support check on all IOMMUs (using information in
IVHD blocks.

Phase3 : Iterates through all IOMMU instances and enabling features.

Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Link: https://lore.kernel.org/r/20220713225651.20758-5-suravee.suthikulpanit@amd.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/amd/init.c