IOMMU Fixes for Linux v5.7-rc6
All related to the AMD IOMMU driver, including: - ACPI table parser fix to correctly read the UID of ACPI devices. - ACPI UID device matching fix. - Fix deferred device attachment to a domain in kdump kernels when the IOMMU driver uses the dma-iommu DMA-API implementation. -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEr9jSbILcajRFYWYyK/BELZcBGuMFAl7D+L4ACgkQK/BELZcB GuODuA//as7BzDzCW09Jvfhg08LnGiJKkHLMXzh8caCmtz1vkA37v/owx/gE8Tze YDNwqa1JyZ9A//CEbt+sf48Zla9Dg9N6tZpsgTqpmAHNuA3Ry2DXhjFs3YM64Qtg OuqdvniXmr8j0FUnb1bWRfevKXo96nvlZ3ANwODl8Y/p+8PrDECRYnC8GOzGHFkO IMawgWAACpPXSr6LIsft9UWDVuXHxcOkWU7dW+GWGGUnoRexnt0ToHAi+br0lrmH 3YGjmgtF+sUMkg8FW0CPpcFF6oKtLZlqwfax1CZyIsQdV6T0mkgDtwJ7g03VvG+O J2mz5upAktHor7qXmy5jYq/U1hGkuF2PmkKOyFgXjo0ZJL51947q8uCkehY27o/z P99lT3JOoOjsfaQaykZko7t1cvZaWe+bj+jS1UsVRzmP75Kuz1J5uQqtp3JwdfeM KFG9QcfC2K1vdnfERo+77NpLo2ikhXWGgghfAG1EZwPCJExOeiJDADnz37+sOgTi FBUwAlSuQbT3YLXcb+j+0Y8wffbu3YLXfecldfkX5uk5ZilN44D4SXdE/wMpHTiH fjffn/besD7l2rC40zHi0BsqPRneTZF5ssGqNPQ0IcVltP4FVx267lTlulANMzpy TisUnPSmw7arv7loccnJ374/+GMysdEra+TmWHn+cMIjfZ6glp8= =aY9L -----END PGP SIGNATURE----- Merge tag 'iommu-fixes-v5.7-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu Pull iommu fixes from Joerg Roedel: "All related to the AMD IOMMU driver: - ACPI table parser fix to correctly read the UID of ACPI devices - ACPI UID device matching fix - Fix deferred device attachment to a domain in kdump kernels when the IOMMU driver uses the dma-iommu DMA-API implementation" * tag 'iommu-fixes-v5.7-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: iommu: Fix deferred domain attachment iommu/amd: Fix get_acpihid_device_id() iommu/amd: Fix over-read of ACPI UID from IVRS table
This commit is contained in:
commit
c2b00cbda9
|
@ -127,7 +127,8 @@ static inline int get_acpihid_device_id(struct device *dev,
|
|||
return -ENODEV;
|
||||
|
||||
list_for_each_entry(p, &acpihid_map, list) {
|
||||
if (acpi_dev_hid_uid_match(adev, p->hid, p->uid)) {
|
||||
if (acpi_dev_hid_uid_match(adev, p->hid,
|
||||
p->uid[0] ? p->uid : NULL)) {
|
||||
if (entry)
|
||||
*entry = p;
|
||||
return p->devid;
|
||||
|
|
|
@ -1329,8 +1329,8 @@ static int __init init_iommu_from_acpi(struct amd_iommu *iommu,
|
|||
}
|
||||
case IVHD_DEV_ACPI_HID: {
|
||||
u16 devid;
|
||||
u8 hid[ACPIHID_HID_LEN] = {0};
|
||||
u8 uid[ACPIHID_UID_LEN] = {0};
|
||||
u8 hid[ACPIHID_HID_LEN];
|
||||
u8 uid[ACPIHID_UID_LEN];
|
||||
int ret;
|
||||
|
||||
if (h->type != 0x40) {
|
||||
|
@ -1347,6 +1347,7 @@ static int __init init_iommu_from_acpi(struct amd_iommu *iommu,
|
|||
break;
|
||||
}
|
||||
|
||||
uid[0] = '\0';
|
||||
switch (e->uidf) {
|
||||
case UID_NOT_PRESENT:
|
||||
|
||||
|
@ -1361,8 +1362,8 @@ static int __init init_iommu_from_acpi(struct amd_iommu *iommu,
|
|||
break;
|
||||
case UID_IS_CHARACTER:
|
||||
|
||||
memcpy(uid, (u8 *)(&e->uid), ACPIHID_UID_LEN - 1);
|
||||
uid[ACPIHID_UID_LEN - 1] = '\0';
|
||||
memcpy(uid, &e->uid, e->uidl);
|
||||
uid[e->uidl] = '\0';
|
||||
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -693,6 +693,15 @@ out:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static bool iommu_is_attach_deferred(struct iommu_domain *domain,
|
||||
struct device *dev)
|
||||
{
|
||||
if (domain->ops->is_attach_deferred)
|
||||
return domain->ops->is_attach_deferred(domain, dev);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* iommu_group_add_device - add a device to an iommu group
|
||||
* @group: the group into which to add the device (reference should be held)
|
||||
|
@ -747,7 +756,7 @@ rename:
|
|||
|
||||
mutex_lock(&group->mutex);
|
||||
list_add_tail(&device->list, &group->devices);
|
||||
if (group->domain)
|
||||
if (group->domain && !iommu_is_attach_deferred(group->domain, dev))
|
||||
ret = __iommu_attach_device(group->domain, dev);
|
||||
mutex_unlock(&group->mutex);
|
||||
if (ret)
|
||||
|
@ -1653,9 +1662,6 @@ static int __iommu_attach_device(struct iommu_domain *domain,
|
|||
struct device *dev)
|
||||
{
|
||||
int ret;
|
||||
if ((domain->ops->is_attach_deferred != NULL) &&
|
||||
domain->ops->is_attach_deferred(domain, dev))
|
||||
return 0;
|
||||
|
||||
if (unlikely(domain->ops->attach_dev == NULL))
|
||||
return -ENODEV;
|
||||
|
@ -1727,8 +1733,7 @@ EXPORT_SYMBOL_GPL(iommu_sva_unbind_gpasid);
|
|||
static void __iommu_detach_device(struct iommu_domain *domain,
|
||||
struct device *dev)
|
||||
{
|
||||
if ((domain->ops->is_attach_deferred != NULL) &&
|
||||
domain->ops->is_attach_deferred(domain, dev))
|
||||
if (iommu_is_attach_deferred(domain, dev))
|
||||
return;
|
||||
|
||||
if (unlikely(domain->ops->detach_dev == NULL))
|
||||
|
|
Loading…
Reference in New Issue