]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit - drivers/vfio/vfio_iommu_type1.c
vfio/type1: Give hardware MSI regions precedence
authorRobin Murphy <robin.murphy@arm.com>
Thu, 10 Aug 2017 19:11:50 +0000 (13:11 -0600)
committerAlex Williamson <alex.williamson@redhat.com>
Thu, 10 Aug 2017 19:11:50 +0000 (13:11 -0600)
commitf203f7f1dbb298e1ed68f6c2f53715d13d5f3a0f
tree3ba2b07b9637225de57dc9e6a5621ed0dc6e73ab
parentdb406cc0ac2d5d8314dfceab8dce3bb4daac9268
vfio/type1: Give hardware MSI regions precedence

If the IOMMU driver advertises 'real' reserved regions for MSIs, but
still includes the software-managed region as well, we are currently
blind to the former and will configure the IOMMU domain to map MSIs into
the latter, which is unlikely to work as expected.

Since it would take a ridiculous hardware topology for both regions to
be valid (which would be rather difficult to support in general), we
should be safe to assume that the presence of any hardware regions makes
the software region irrelevant. However, the IOMMU driver might still
advertise the software region by default, particularly if the hardware
regions are filled in elsewhere by generic code, so it might not be fair
for VFIO to be super-strict about not mixing them. To that end, make
vfio_iommu_has_sw_msi() robust against the presence of both region types
at once, so that we end up doing what is almost certainly right, rather
than what is almost certainly wrong.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Tested-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/vfio/vfio_iommu_type1.c