iommu/amd: Check feature support bit before accessing MSI capability registers
authorSuravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Wed, 20 Nov 2019 13:55:48 +0000 (07:55 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 24 Feb 2020 07:36:39 +0000 (08:36 +0100)
commitb1b7add9d2dee9391d1aafdf2eaa5fec20e2912e
treea982c1c129195a2ab2c86a3bd41402fb6845c907
parent0c09d9dc84400a24c2d4dca5cda28cf9f463bdf5
iommu/amd: Check feature support bit before accessing MSI capability registers

[ Upstream commit 813071438e83d338ba5cfe98b3b26c890dc0a6c0 ]

The IOMMU MMIO access to MSI capability registers is available only if
the EFR[MsiCapMmioSup] is set. Current implementation assumes this bit
is set if the EFR[XtSup] is set, which might not be the case.

Fix by checking the EFR[MsiCapMmioSup] before accessing the MSI address
low/high and MSI data registers via the MMIO.

Fixes: 66929812955b ('iommu/amd: Add support for X2APIC IOMMU interrupts')
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iommu/amd_iommu_init.c
drivers/iommu/amd_iommu_types.h