Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'iommu-fixes-v6.8-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu

Pul iommu fixes from Joerg Roedel:

- Make iommu_ops->default_domain work without CONFIG_IOMMU_DMA to fix
initialization of FSL-PAMU devices

- Fix for Tegra fbdev initialization failure

- Fix for a VFIO device unbinding failure on PowerPC

* tag 'iommu-fixes-v6.8-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
powerpc: iommu: Bring back table group release_ownership() call
drm/tegra: Do not assume that a NULL domain means no DMA IOMMU
iommu: Allow ops->default_domain to work when !CONFIG_IOMMU_DMA

+43 -15
+28 -9
arch/powerpc/kernel/iommu.c
··· 1287 1287 struct iommu_domain *domain = iommu_get_domain_for_dev(dev); 1288 1288 struct iommu_group *grp = iommu_group_get(dev); 1289 1289 struct iommu_table_group *table_group; 1290 - int ret = -EINVAL; 1291 1290 1292 1291 /* At first attach the ownership is already set */ 1293 1292 if (!domain) 1294 1293 return 0; 1295 1294 1296 - if (!grp) 1297 - return -ENODEV; 1298 - 1299 1295 table_group = iommu_group_get_iommudata(grp); 1300 - ret = table_group->ops->take_ownership(table_group); 1296 + /* 1297 + * The domain being set to PLATFORM from earlier 1298 + * BLOCKED. The table_group ownership has to be released. 1299 + */ 1300 + table_group->ops->release_ownership(table_group); 1301 1301 iommu_group_put(grp); 1302 1302 1303 - return ret; 1303 + return 0; 1304 1304 } 1305 1305 1306 1306 static const struct iommu_domain_ops spapr_tce_platform_domain_ops = { ··· 1312 1312 .ops = &spapr_tce_platform_domain_ops, 1313 1313 }; 1314 1314 1315 - static struct iommu_domain spapr_tce_blocked_domain = { 1316 - .type = IOMMU_DOMAIN_BLOCKED, 1315 + static int 1316 + spapr_tce_blocked_iommu_attach_dev(struct iommu_domain *platform_domain, 1317 + struct device *dev) 1318 + { 1319 + struct iommu_group *grp = iommu_group_get(dev); 1320 + struct iommu_table_group *table_group; 1321 + int ret = -EINVAL; 1322 + 1317 1323 /* 1318 1324 * FIXME: SPAPR mixes blocked and platform behaviors, the blocked domain 1319 1325 * also sets the dma_api ops 1320 1326 */ 1321 - .ops = &spapr_tce_platform_domain_ops, 1327 + table_group = iommu_group_get_iommudata(grp); 1328 + ret = table_group->ops->take_ownership(table_group); 1329 + iommu_group_put(grp); 1330 + 1331 + return ret; 1332 + } 1333 + 1334 + static const struct iommu_domain_ops spapr_tce_blocked_domain_ops = { 1335 + .attach_dev = spapr_tce_blocked_iommu_attach_dev, 1336 + }; 1337 + 1338 + static struct iommu_domain spapr_tce_blocked_domain = { 1339 + .type = IOMMU_DOMAIN_BLOCKED, 1340 + .ops = &spapr_tce_blocked_domain_ops, 1322 1341 }; 1323 1342 1324 1343 static bool spapr_tce_iommu_capable(struct device *dev, enum iommu_cap cap)
+2 -1
drivers/gpu/drm/tegra/drm.c
··· 960 960 * not the shared IOMMU domain, don't try to attach it to a different 961 961 * domain. This allows using the IOMMU-backed DMA API. 962 962 */ 963 - if (domain && domain != tegra->domain) 963 + if (domain && domain->type != IOMMU_DOMAIN_IDENTITY && 964 + domain != tegra->domain) 964 965 return 0; 965 966 966 967 if (tegra->domain) {
+13 -5
drivers/iommu/iommu.c
··· 1799 1799 * domain. Do not use in new drivers. 1800 1800 */ 1801 1801 if (ops->default_domain) { 1802 - if (req_type) 1802 + if (req_type != ops->default_domain->type) 1803 1803 return ERR_PTR(-EINVAL); 1804 1804 return ops->default_domain; 1805 1805 } ··· 1871 1871 const struct iommu_ops *ops = dev_iommu_ops(dev); 1872 1872 int type; 1873 1873 1874 - if (!ops->def_domain_type) 1875 - return cur_type; 1876 - 1877 - type = ops->def_domain_type(dev); 1874 + if (ops->default_domain) { 1875 + /* 1876 + * Drivers that declare a global static default_domain will 1877 + * always choose that. 1878 + */ 1879 + type = ops->default_domain->type; 1880 + } else { 1881 + if (ops->def_domain_type) 1882 + type = ops->def_domain_type(dev); 1883 + else 1884 + return cur_type; 1885 + } 1878 1886 if (!type || cur_type == type) 1879 1887 return cur_type; 1880 1888 if (!cur_type)