iommu/amd: Enable PPR/GA interrupt after interrupt handler setup

Current code enables PPR and GA interrupts before setting up the
interrupt handler (in state_next()). Make sure interrupt handler
is in place before enabling these interrupt.

amd_iommu_enable_interrupts() gets called in normal boot, kdump as well
as in suspend/resume path. Hence moving interrupt enablement to this
function works fine.

Reviewed-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com>
Link: https://lore.kernel.org/r/20230628054554.6131-4-vasant.hegde@amd.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
This commit is contained in:
Vasant Hegde 2023-06-28 05:45:54 +00:00 committed by Joerg Roedel
parent f52c895a2d
commit a48130e92f

View File

@ -2943,8 +2943,6 @@ static void enable_iommus_vapic(void)
static void enable_iommus(void) static void enable_iommus(void)
{ {
early_enable_iommus(); early_enable_iommus();
enable_iommus_vapic();
enable_iommus_v2();
} }
static void disable_iommus(void) static void disable_iommus(void)
@ -3208,6 +3206,13 @@ static int amd_iommu_enable_interrupts(void)
goto out; goto out;
} }
/*
* Interrupt handler is ready to process interrupts. Enable
* PPR and GA log interrupt for all IOMMUs.
*/
enable_iommus_vapic();
enable_iommus_v2();
out: out:
return ret; return ret;
} }
@ -3287,8 +3292,6 @@ static int __init state_next(void)
register_syscore_ops(&amd_iommu_syscore_ops); register_syscore_ops(&amd_iommu_syscore_ops);
ret = amd_iommu_init_pci(); ret = amd_iommu_init_pci();
init_state = ret ? IOMMU_INIT_ERROR : IOMMU_PCI_INIT; init_state = ret ? IOMMU_INIT_ERROR : IOMMU_PCI_INIT;
enable_iommus_vapic();
enable_iommus_v2();
break; break;
case IOMMU_PCI_INIT: case IOMMU_PCI_INIT:
ret = amd_iommu_enable_interrupts(); ret = amd_iommu_enable_interrupts();