VT-d: avoid PCI device lookup
authorJan Beulich <jbeulich@suse.com>
Thu, 5 Sep 2019 07:58:17 +0000 (09:58 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 5 Sep 2019 07:58:17 +0000 (09:58 +0200)
commit4067bbfa3bc02d9b80a25196681629dbd4456123
treefb1bd78a4757a03503cd023bb1449a83f1fb3062
parente03eb145484c10351b40755a148babe2ad69d1d8
VT-d: avoid PCI device lookup

The two uses of pci_get_pdev_by_domain() lack proper locking, but are
also only used to get hold of a NUMA node ID. Calculate and store the
node ID earlier on and remove the lookups (in lieu of fixing the
locking).

While doing this it became apparent that iommu_alloc()'s use of
alloc_pgtable_maddr() would occur before RHSAs would have been parsed:
iommu_alloc() gets called from the DRHD parsing routine, which - on
spec conforming platforms - happens strictly before RHSA parsing. Defer
the allocation until after all ACPI table parsing has finished,
established the node ID there first.

Suggested-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
xen/drivers/passthrough/iommu.c
xen/drivers/passthrough/vtd/dmar.c
xen/drivers/passthrough/vtd/extern.h
xen/drivers/passthrough/vtd/intremap.c
xen/drivers/passthrough/vtd/iommu.c
xen/drivers/passthrough/vtd/iommu.h
xen/drivers/passthrough/vtd/qinval.c
xen/include/xen/iommu.h