Commit 1e87de50 authored by David Woodhouse's avatar David Woodhouse Committed by PvsNarasimha
Browse files

iommu/amd: Set iommu->int_enabled consistently when interrupts are set up

mainline inclusion
from mainline-v5.11-rc3
commit 12bc4570
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IAU6ZD

Reference: https://github.com/torvalds/linux/commit/12bc4570c14e24e6244d66466aeda994f805634b

--------------------------------

commit 12bc4570 upstream

When I made the INTCAPXT support stop gratuitously pretending to be MSI,
I missed the fact that iommu_setup_msi() also sets the ->int_enabled
flag. I missed this in the iommu_setup_intcapxt() code path, which means
that a resume from suspend will try to allocate the IRQ domains again,
accidentally re-enabling interrupts as it does, resulting in much sadness.

Lift out the bit which sets iommu->int_enabled into the iommu_init_irq()
function which is also where it gets checked.

Link: https://lore.kernel.org/r/20210104132250.GE32151@zn.tnic/


Fixes: d1adcfbb ("iommu/amd: Fix IOMMU interrupt generation in X2APIC mode")
Reported-by: default avatarBorislav Petkov <bp@alien8.de>
Signed-off-by: default avatarDavid Woodhouse <dwmw@amazon.co.uk>
Tested-by: default avatarBorislav Petkov <bp@suse.de>
Link: https://lore.kernel.org/r/50cd5f55be8ead0937ac315cd2f5b89364f6a9a5.camel@infradead.org


Signed-off-by: default avatarWill Deacon <will@kernel.org>
Signed-off-by: default avatarPvsNarasimha <PVS.NarasimhaRao@amd.com>
parent 14468a47
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -2011,8 +2011,6 @@ static int iommu_setup_msi(struct amd_iommu *iommu)
		return r;
	}

	iommu->int_enabled = true;

	return 0;
}

@@ -2207,6 +2205,7 @@ static int iommu_init_irq(struct amd_iommu *iommu)
	if (ret)
		return ret;

	iommu->int_enabled = true;
enable_faults:
	iommu_feature_enable(iommu, CONTROL_EVT_INT_EN);