Message ID | 20210317091037.31374-3-joro@8bytes.org |
---|---|
State | New |
Headers | show |
Series | [1/3] iommu/amd: Move Stoney Ridge check to detect_ivrs() | expand |
On Wed, Mar 17, 2021 at 01:37:16PM +0000, David Woodhouse wrote: > If we can get to the point where we don't even need to check > amd_iommu_irq_remap in the ...select() function because the IRQ domain > is never even registered in the case where the flag ends up false, all > the better :) This should already be achieved with this patch :) But the check is still needed if something goes wrong during IOMMU initialization. In this case the IOMMUs are teared down and the memory is freed. But the IRQ domains stay registered for now, mostly because the upper-level APIs to register them lack a deregister function. I havn't looked into the details yet whether it is suffient to call irq_domain_remove() on a domain created with arch_create_remap_msi_irq_domain() for example. This needs more research on my side :) Regards, Joerg
diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c index 3280e6f5b720..61dae1800b7f 100644 --- a/drivers/iommu/amd/init.c +++ b/drivers/iommu/amd/init.c @@ -2919,12 +2919,12 @@ static int __init state_next(void) } break; case IOMMU_IVRS_DETECTED: - ret = early_amd_iommu_init(); - init_state = ret ? IOMMU_INIT_ERROR : IOMMU_ACPI_FINISHED; - if (init_state == IOMMU_ACPI_FINISHED && amd_iommu_disabled) { - pr_info("AMD IOMMU disabled\n"); + if (amd_iommu_disabled) { init_state = IOMMU_CMDLINE_DISABLED; ret = -EINVAL; + } else { + ret = early_amd_iommu_init(); + init_state = ret ? IOMMU_INIT_ERROR : IOMMU_ACPI_FINISHED; } break; case IOMMU_ACPI_FINISHED: