forked from Minki/linux
IOMMU Fixes for Linux v5.5-rc5
Including: - Two fixes for VT-d and generic IOMMU code to fix teardown on error handling code paths. - Patch for the Intel VT-d driver to fix handling of non-PCI devices - Fix W=1 compile warning in dma-iommu code -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEr9jSbILcajRFYWYyK/BELZcBGuMFAl4a7WgACgkQK/BELZcB GuMUrw//Qh1Sruw3hQ9/DvzzAihK0dhfj1ZMd5dJ4sKW3RoJuXDtRiiJyOIprrIj TPa2CEmqApwFBCvBtzduoV5JGIff5uFQy/29PC5bcbFSN/BqyX5Iq7/w6OvAXoE+ knFgEhd80JkrC0iegt11Pr96SDJsLg0NmalXCE6RD5EjKctBtjNBEEqJ1ufOMDpF t3UoWokSAbfFtDz03WTgNiHtboNTDi4JcpiiBSEtctNzzVvlC4Yq5fz/sj7whDPa RiFKhPmeGWBKrJS2LkuQWx3aPrXhhxV15yk2m7U+7qv7FL6kuDlS9QaCCOd97cWv l17ot2YGXGNbh6nfD3+WAuhAx8/gaS5226E8DXN5+mwYLqKyntQGyu8KvodaCcXg 4ciAuhsuONaUc80yesY//Tvns0rm6048KDM5zOpzOLvDmA5iio5wmRLOHU8LcdWB NXzwhzgowKwi+MeobeEXSbfMHc1FSrcOf+Y9XIC4WDhxKYCzXBfTadDNvhuAqlnt cxdIXqxIW3r79zV5/rRLSlvRGDxjdz+Xf76Nz/WIXz5Ow9gs7N54qmO22DnMK51E +4wB4J+IktY7Zn491C+YtgU6rO975X/ohWwqL6N8kX/1mY9nANZSbzjOHQf8KJpn S8gPqmUz3DBvAnRE5/UFxqq64WkEoBdDInNPPAzWpYpVY3N12tI= =rTxu -----END PGP SIGNATURE----- Merge tag 'iommu-fixes-v5.5-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu Pull iommu fixes from Joerg Roedel: - Two fixes for VT-d and generic IOMMU code to fix teardown on error handling code paths. - Patch for the Intel VT-d driver to fix handling of non-PCI devices - Fix W=1 compile warning in dma-iommu code * tag 'iommu-fixes-v5.5-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: iommu/dma: fix variable 'cookie' set but not used iommu/vt-d: Unlink device if failed to add to group iommu: Remove device link to group on failure iommu/vt-d: Fix adding non-PCI devices to Intel IOMMU
This commit is contained in:
commit
040a3c3362
@ -1203,7 +1203,6 @@ int iommu_dma_prepare_msi(struct msi_desc *desc, phys_addr_t msi_addr)
|
||||
{
|
||||
struct device *dev = msi_desc_to_dev(desc);
|
||||
struct iommu_domain *domain = iommu_get_domain_for_dev(dev);
|
||||
struct iommu_dma_cookie *cookie;
|
||||
struct iommu_dma_msi_page *msi_page;
|
||||
static DEFINE_MUTEX(msi_prepare_lock); /* see below */
|
||||
|
||||
@ -1212,8 +1211,6 @@ int iommu_dma_prepare_msi(struct msi_desc *desc, phys_addr_t msi_addr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
cookie = domain->iova_cookie;
|
||||
|
||||
/*
|
||||
* In fact the whole prepare operation should already be serialised by
|
||||
* irq_domain_mutex further up the callchain, but that's pretty subtle
|
||||
|
@ -5624,8 +5624,10 @@ static int intel_iommu_add_device(struct device *dev)
|
||||
|
||||
group = iommu_group_get_for_dev(dev);
|
||||
|
||||
if (IS_ERR(group))
|
||||
return PTR_ERR(group);
|
||||
if (IS_ERR(group)) {
|
||||
ret = PTR_ERR(group);
|
||||
goto unlink;
|
||||
}
|
||||
|
||||
iommu_group_put(group);
|
||||
|
||||
@ -5651,7 +5653,8 @@ static int intel_iommu_add_device(struct device *dev)
|
||||
if (!get_private_domain_for_dev(dev)) {
|
||||
dev_warn(dev,
|
||||
"Failed to get a private domain.\n");
|
||||
return -ENOMEM;
|
||||
ret = -ENOMEM;
|
||||
goto unlink;
|
||||
}
|
||||
|
||||
dev_info(dev,
|
||||
@ -5666,6 +5669,10 @@ static int intel_iommu_add_device(struct device *dev)
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
unlink:
|
||||
iommu_device_unlink(&iommu->iommu, dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void intel_iommu_remove_device(struct device *dev)
|
||||
@ -5817,6 +5824,13 @@ static void intel_iommu_apply_resv_region(struct device *dev,
|
||||
WARN_ON_ONCE(!reserve_iova(&dmar_domain->iovad, start, end));
|
||||
}
|
||||
|
||||
static struct iommu_group *intel_iommu_device_group(struct device *dev)
|
||||
{
|
||||
if (dev_is_pci(dev))
|
||||
return pci_device_group(dev);
|
||||
return generic_device_group(dev);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_INTEL_IOMMU_SVM
|
||||
struct intel_iommu *intel_svm_device_to_iommu(struct device *dev)
|
||||
{
|
||||
@ -5989,7 +6003,7 @@ const struct iommu_ops intel_iommu_ops = {
|
||||
.get_resv_regions = intel_iommu_get_resv_regions,
|
||||
.put_resv_regions = intel_iommu_put_resv_regions,
|
||||
.apply_resv_region = intel_iommu_apply_resv_region,
|
||||
.device_group = pci_device_group,
|
||||
.device_group = intel_iommu_device_group,
|
||||
.dev_has_feat = intel_iommu_dev_has_feat,
|
||||
.dev_feat_enabled = intel_iommu_dev_feat_enabled,
|
||||
.dev_enable_feat = intel_iommu_dev_enable_feat,
|
||||
|
@ -751,6 +751,7 @@ err_put_group:
|
||||
mutex_unlock(&group->mutex);
|
||||
dev->iommu_group = NULL;
|
||||
kobject_put(group->devices_kobj);
|
||||
sysfs_remove_link(group->devices_kobj, device->name);
|
||||
err_free_name:
|
||||
kfree(device->name);
|
||||
err_remove_link:
|
||||
|
Loading…
Reference in New Issue
Block a user