Commit f5645edf authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'iommu-fixes-v5.19-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu

Pull iommu fixes from Joerg Roedel:

 - fix device setup failures in the Intel VT-d driver when the PASID
   table is shared

 - fix Intel VT-d device hot-add failure due to wrong device notifier
   order

 - remove the old IOMMU mailing list from the MAINTAINERS file now that
   it has been retired

* tag 'iommu-fixes-v5.19-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
  MAINTAINERS: Remove iommu@lists.linux-foundation.org
  iommu/vt-d: Fix RID2PASID setup/teardown failure
  iommu/vt-d: Fix PCI bus rescan device hot add
parents 2b93fe64 c51b8f85
...@@ -426,7 +426,6 @@ F: drivers/acpi/*thermal* ...@@ -426,7 +426,6 @@ F: drivers/acpi/*thermal*
ACPI VIOT DRIVER ACPI VIOT DRIVER
M: Jean-Philippe Brucker <jean-philippe@linaro.org> M: Jean-Philippe Brucker <jean-philippe@linaro.org>
L: linux-acpi@vger.kernel.org L: linux-acpi@vger.kernel.org
L: iommu@lists.linux-foundation.org
L: iommu@lists.linux.dev L: iommu@lists.linux.dev
S: Maintained S: Maintained
F: drivers/acpi/viot.c F: drivers/acpi/viot.c
...@@ -960,7 +959,6 @@ F: drivers/video/fbdev/geode/ ...@@ -960,7 +959,6 @@ F: drivers/video/fbdev/geode/
AMD IOMMU (AMD-VI) AMD IOMMU (AMD-VI)
M: Joerg Roedel <joro@8bytes.org> M: Joerg Roedel <joro@8bytes.org>
R: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com> R: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
L: iommu@lists.linux-foundation.org
L: iommu@lists.linux.dev L: iommu@lists.linux.dev
S: Maintained S: Maintained
T: git git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git T: git git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git
...@@ -6055,7 +6053,6 @@ DMA MAPPING HELPERS ...@@ -6055,7 +6053,6 @@ DMA MAPPING HELPERS
M: Christoph Hellwig <hch@lst.de> M: Christoph Hellwig <hch@lst.de>
M: Marek Szyprowski <m.szyprowski@samsung.com> M: Marek Szyprowski <m.szyprowski@samsung.com>
R: Robin Murphy <robin.murphy@arm.com> R: Robin Murphy <robin.murphy@arm.com>
L: iommu@lists.linux-foundation.org
L: iommu@lists.linux.dev L: iommu@lists.linux.dev
S: Supported S: Supported
W: http://git.infradead.org/users/hch/dma-mapping.git W: http://git.infradead.org/users/hch/dma-mapping.git
...@@ -6068,7 +6065,6 @@ F: kernel/dma/ ...@@ -6068,7 +6065,6 @@ F: kernel/dma/
DMA MAPPING BENCHMARK DMA MAPPING BENCHMARK
M: Xiang Chen <chenxiang66@hisilicon.com> M: Xiang Chen <chenxiang66@hisilicon.com>
L: iommu@lists.linux-foundation.org
L: iommu@lists.linux.dev L: iommu@lists.linux.dev
F: kernel/dma/map_benchmark.c F: kernel/dma/map_benchmark.c
F: tools/testing/selftests/dma/ F: tools/testing/selftests/dma/
...@@ -7653,7 +7649,6 @@ F: drivers/gpu/drm/exynos/exynos_dp* ...@@ -7653,7 +7649,6 @@ F: drivers/gpu/drm/exynos/exynos_dp*
EXYNOS SYSMMU (IOMMU) driver EXYNOS SYSMMU (IOMMU) driver
M: Marek Szyprowski <m.szyprowski@samsung.com> M: Marek Szyprowski <m.szyprowski@samsung.com>
L: iommu@lists.linux-foundation.org
L: iommu@lists.linux.dev L: iommu@lists.linux.dev
S: Maintained S: Maintained
F: drivers/iommu/exynos-iommu.c F: drivers/iommu/exynos-iommu.c
...@@ -10078,7 +10073,6 @@ F: drivers/hid/intel-ish-hid/ ...@@ -10078,7 +10073,6 @@ F: drivers/hid/intel-ish-hid/
INTEL IOMMU (VT-d) INTEL IOMMU (VT-d)
M: David Woodhouse <dwmw2@infradead.org> M: David Woodhouse <dwmw2@infradead.org>
M: Lu Baolu <baolu.lu@linux.intel.com> M: Lu Baolu <baolu.lu@linux.intel.com>
L: iommu@lists.linux-foundation.org
L: iommu@lists.linux.dev L: iommu@lists.linux.dev
S: Supported S: Supported
T: git git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git T: git git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git
...@@ -10458,7 +10452,6 @@ F: include/linux/iomap.h ...@@ -10458,7 +10452,6 @@ F: include/linux/iomap.h
IOMMU DRIVERS IOMMU DRIVERS
M: Joerg Roedel <joro@8bytes.org> M: Joerg Roedel <joro@8bytes.org>
M: Will Deacon <will@kernel.org> M: Will Deacon <will@kernel.org>
L: iommu@lists.linux-foundation.org
L: iommu@lists.linux.dev L: iommu@lists.linux.dev
S: Maintained S: Maintained
T: git git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git T: git git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git
...@@ -12618,7 +12611,6 @@ F: drivers/i2c/busses/i2c-mt65xx.c ...@@ -12618,7 +12611,6 @@ F: drivers/i2c/busses/i2c-mt65xx.c
MEDIATEK IOMMU DRIVER MEDIATEK IOMMU DRIVER
M: Yong Wu <yong.wu@mediatek.com> M: Yong Wu <yong.wu@mediatek.com>
L: iommu@lists.linux-foundation.org
L: iommu@lists.linux.dev L: iommu@lists.linux.dev
L: linux-mediatek@lists.infradead.org (moderated for non-subscribers) L: linux-mediatek@lists.infradead.org (moderated for non-subscribers)
S: Supported S: Supported
...@@ -16670,7 +16662,6 @@ F: drivers/i2c/busses/i2c-qcom-cci.c ...@@ -16670,7 +16662,6 @@ F: drivers/i2c/busses/i2c-qcom-cci.c
QUALCOMM IOMMU QUALCOMM IOMMU
M: Rob Clark <robdclark@gmail.com> M: Rob Clark <robdclark@gmail.com>
L: iommu@lists.linux-foundation.org
L: iommu@lists.linux.dev L: iommu@lists.linux.dev
L: linux-arm-msm@vger.kernel.org L: linux-arm-msm@vger.kernel.org
S: Maintained S: Maintained
...@@ -19299,7 +19290,6 @@ F: arch/x86/boot/video* ...@@ -19299,7 +19290,6 @@ F: arch/x86/boot/video*
SWIOTLB SUBSYSTEM SWIOTLB SUBSYSTEM
M: Christoph Hellwig <hch@infradead.org> M: Christoph Hellwig <hch@infradead.org>
L: iommu@lists.linux-foundation.org
L: iommu@lists.linux.dev L: iommu@lists.linux.dev
S: Supported S: Supported
W: http://git.infradead.org/users/hch/dma-mapping.git W: http://git.infradead.org/users/hch/dma-mapping.git
...@@ -21975,7 +21965,6 @@ XEN SWIOTLB SUBSYSTEM ...@@ -21975,7 +21965,6 @@ XEN SWIOTLB SUBSYSTEM
M: Juergen Gross <jgross@suse.com> M: Juergen Gross <jgross@suse.com>
M: Stefano Stabellini <sstabellini@kernel.org> M: Stefano Stabellini <sstabellini@kernel.org>
L: xen-devel@lists.xenproject.org (moderated for non-subscribers) L: xen-devel@lists.xenproject.org (moderated for non-subscribers)
L: iommu@lists.linux-foundation.org
L: iommu@lists.linux.dev L: iommu@lists.linux.dev
S: Supported S: Supported
F: arch/x86/xen/*swiotlb* F: arch/x86/xen/*swiotlb*
......
...@@ -382,7 +382,7 @@ static int dmar_pci_bus_notifier(struct notifier_block *nb, ...@@ -382,7 +382,7 @@ static int dmar_pci_bus_notifier(struct notifier_block *nb,
static struct notifier_block dmar_pci_bus_nb = { static struct notifier_block dmar_pci_bus_nb = {
.notifier_call = dmar_pci_bus_notifier, .notifier_call = dmar_pci_bus_notifier,
.priority = INT_MIN, .priority = 1,
}; };
static struct dmar_drhd_unit * static struct dmar_drhd_unit *
......
...@@ -320,30 +320,6 @@ EXPORT_SYMBOL_GPL(intel_iommu_gfx_mapped); ...@@ -320,30 +320,6 @@ EXPORT_SYMBOL_GPL(intel_iommu_gfx_mapped);
DEFINE_SPINLOCK(device_domain_lock); DEFINE_SPINLOCK(device_domain_lock);
static LIST_HEAD(device_domain_list); static LIST_HEAD(device_domain_list);
/*
* Iterate over elements in device_domain_list and call the specified
* callback @fn against each element.
*/
int for_each_device_domain(int (*fn)(struct device_domain_info *info,
void *data), void *data)
{
int ret = 0;
unsigned long flags;
struct device_domain_info *info;
spin_lock_irqsave(&device_domain_lock, flags);
list_for_each_entry(info, &device_domain_list, global) {
ret = fn(info, data);
if (ret) {
spin_unlock_irqrestore(&device_domain_lock, flags);
return ret;
}
}
spin_unlock_irqrestore(&device_domain_lock, flags);
return 0;
}
const struct iommu_ops intel_iommu_ops; const struct iommu_ops intel_iommu_ops;
static bool translation_pre_enabled(struct intel_iommu *iommu) static bool translation_pre_enabled(struct intel_iommu *iommu)
......
...@@ -86,54 +86,6 @@ void vcmd_free_pasid(struct intel_iommu *iommu, u32 pasid) ...@@ -86,54 +86,6 @@ void vcmd_free_pasid(struct intel_iommu *iommu, u32 pasid)
/* /*
* Per device pasid table management: * Per device pasid table management:
*/ */
static inline void
device_attach_pasid_table(struct device_domain_info *info,
struct pasid_table *pasid_table)
{
info->pasid_table = pasid_table;
list_add(&info->table, &pasid_table->dev);
}
static inline void
device_detach_pasid_table(struct device_domain_info *info,
struct pasid_table *pasid_table)
{
info->pasid_table = NULL;
list_del(&info->table);
}
struct pasid_table_opaque {
struct pasid_table **pasid_table;
int segment;
int bus;
int devfn;
};
static int search_pasid_table(struct device_domain_info *info, void *opaque)
{
struct pasid_table_opaque *data = opaque;
if (info->iommu->segment == data->segment &&
info->bus == data->bus &&
info->devfn == data->devfn &&
info->pasid_table) {
*data->pasid_table = info->pasid_table;
return 1;
}
return 0;
}
static int get_alias_pasid_table(struct pci_dev *pdev, u16 alias, void *opaque)
{
struct pasid_table_opaque *data = opaque;
data->segment = pci_domain_nr(pdev->bus);
data->bus = PCI_BUS_NUM(alias);
data->devfn = alias & 0xff;
return for_each_device_domain(&search_pasid_table, data);
}
/* /*
* Allocate a pasid table for @dev. It should be called in a * Allocate a pasid table for @dev. It should be called in a
...@@ -143,28 +95,18 @@ int intel_pasid_alloc_table(struct device *dev) ...@@ -143,28 +95,18 @@ int intel_pasid_alloc_table(struct device *dev)
{ {
struct device_domain_info *info; struct device_domain_info *info;
struct pasid_table *pasid_table; struct pasid_table *pasid_table;
struct pasid_table_opaque data;
struct page *pages; struct page *pages;
u32 max_pasid = 0; u32 max_pasid = 0;
int ret, order; int order, size;
int size;
might_sleep(); might_sleep();
info = dev_iommu_priv_get(dev); info = dev_iommu_priv_get(dev);
if (WARN_ON(!info || !dev_is_pci(dev) || info->pasid_table)) if (WARN_ON(!info || !dev_is_pci(dev) || info->pasid_table))
return -EINVAL; return -EINVAL;
/* DMA alias device already has a pasid table, use it: */
data.pasid_table = &pasid_table;
ret = pci_for_each_dma_alias(to_pci_dev(dev),
&get_alias_pasid_table, &data);
if (ret)
goto attach_out;
pasid_table = kzalloc(sizeof(*pasid_table), GFP_KERNEL); pasid_table = kzalloc(sizeof(*pasid_table), GFP_KERNEL);
if (!pasid_table) if (!pasid_table)
return -ENOMEM; return -ENOMEM;
INIT_LIST_HEAD(&pasid_table->dev);
if (info->pasid_supported) if (info->pasid_supported)
max_pasid = min_t(u32, pci_max_pasids(to_pci_dev(dev)), max_pasid = min_t(u32, pci_max_pasids(to_pci_dev(dev)),
...@@ -182,9 +124,7 @@ int intel_pasid_alloc_table(struct device *dev) ...@@ -182,9 +124,7 @@ int intel_pasid_alloc_table(struct device *dev)
pasid_table->table = page_address(pages); pasid_table->table = page_address(pages);
pasid_table->order = order; pasid_table->order = order;
pasid_table->max_pasid = 1 << (order + PAGE_SHIFT + 3); pasid_table->max_pasid = 1 << (order + PAGE_SHIFT + 3);
info->pasid_table = pasid_table;
attach_out:
device_attach_pasid_table(info, pasid_table);
return 0; return 0;
} }
...@@ -202,10 +142,7 @@ void intel_pasid_free_table(struct device *dev) ...@@ -202,10 +142,7 @@ void intel_pasid_free_table(struct device *dev)
return; return;
pasid_table = info->pasid_table; pasid_table = info->pasid_table;
device_detach_pasid_table(info, pasid_table); info->pasid_table = NULL;
if (!list_empty(&pasid_table->dev))
return;
/* Free scalable mode PASID directory tables: */ /* Free scalable mode PASID directory tables: */
dir = pasid_table->table; dir = pasid_table->table;
......
...@@ -74,7 +74,6 @@ struct pasid_table { ...@@ -74,7 +74,6 @@ struct pasid_table {
void *table; /* pasid table pointer */ void *table; /* pasid table pointer */
int order; /* page order of pasid table */ int order; /* page order of pasid table */
u32 max_pasid; /* max pasid */ u32 max_pasid; /* max pasid */
struct list_head dev; /* device list */
}; };
/* Get PRESENT bit of a PASID directory entry. */ /* Get PRESENT bit of a PASID directory entry. */
......
...@@ -612,7 +612,6 @@ struct intel_iommu { ...@@ -612,7 +612,6 @@ struct intel_iommu {
struct device_domain_info { struct device_domain_info {
struct list_head link; /* link to domain siblings */ struct list_head link; /* link to domain siblings */
struct list_head global; /* link to global list */ struct list_head global; /* link to global list */
struct list_head table; /* link to pasid table */
u32 segment; /* PCI segment number */ u32 segment; /* PCI segment number */
u8 bus; /* PCI bus number */ u8 bus; /* PCI bus number */
u8 devfn; /* PCI devfn number */ u8 devfn; /* PCI devfn number */
...@@ -729,8 +728,6 @@ extern int dmar_ir_support(void); ...@@ -729,8 +728,6 @@ extern int dmar_ir_support(void);
void *alloc_pgtable_page(int node); void *alloc_pgtable_page(int node);
void free_pgtable_page(void *vaddr); void free_pgtable_page(void *vaddr);
struct intel_iommu *domain_get_iommu(struct dmar_domain *domain); struct intel_iommu *domain_get_iommu(struct dmar_domain *domain);
int for_each_device_domain(int (*fn)(struct device_domain_info *info,
void *data), void *data);
void iommu_flush_write_buffer(struct intel_iommu *iommu); void iommu_flush_write_buffer(struct intel_iommu *iommu);
int intel_iommu_enable_pasid(struct intel_iommu *iommu, struct device *dev); int intel_iommu_enable_pasid(struct intel_iommu *iommu, struct device *dev);
struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devfn); struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devfn);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment