mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-23 20:24:12 +08:00
IOMMU Fixes for Linux v6.8-rc2
Including: - 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 -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEr9jSbILcajRFYWYyK/BELZcBGuMFAmW894wACgkQK/BELZcB GuPgsRAAgX/6ohccFIZ3KdsMl6A7cc0P1nSB18r+1YhY42ZoYUCOE8O/Ifsw1Bid 6XCL6fDK3gfd7AA81DhQA/A+qj5P/iU3ZDFHTPI4HKj2Yk2vcadA883hchLMoRMY A6NSzJHLmfnuUQEcdXUKZjQ7jt0K13bTyMb7XHiwXFE8QnVT1Ymeo6pgJdhgUvls 1ZUuI1sR2/zEHFt25A8eyftQNxH4366l5SBgGbwst7T0BMplpGVprEiI5k+bqYfT CXjw0785wYmV/0mATJzQUuL1p/XBIXRRjFqQWWeYzWi0y/nzmPgEzoIFcgOse/z1 1iRfyLrhJgu1vJOwbNePNu6RCpbVdFbCdkez7eCHkPSqgVxejhvTVpPpMVyZSHwL Wao1jmVt2NsoCKmqlV55YY/ZGgnwActoyGZzIu0W4zPpGFgndpcKnJkdHq2fzqAw a9f4Ia98tueMZMEhWZzX0aqAIym4IRhnTs+GXdPrhMenS335jiY2tcOBO3y8YsTW AzVxkXRESClifVrXA+YVQTcH0CrrB2l7gORxGkLvJNKHAkF0ZP5+4VMbKXSxU8iS AM3pYJDRjl/y9ycIkSX+MGP9+aZobKtQQlchpt/F9hC46TCmdeImO18XnxJHDXXp NA5d62CNlMksLPEn4u7hSvWyFfoOM+67YNkiy6LVbgR6VaCds4I= =87n3 -----END PGP SIGNATURE----- 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
This commit is contained in:
commit
4f18d3fd29
@ -1287,20 +1287,20 @@ spapr_tce_platform_iommu_attach_dev(struct iommu_domain *platform_domain,
|
|||||||
struct iommu_domain *domain = iommu_get_domain_for_dev(dev);
|
struct iommu_domain *domain = iommu_get_domain_for_dev(dev);
|
||||||
struct iommu_group *grp = iommu_group_get(dev);
|
struct iommu_group *grp = iommu_group_get(dev);
|
||||||
struct iommu_table_group *table_group;
|
struct iommu_table_group *table_group;
|
||||||
int ret = -EINVAL;
|
|
||||||
|
|
||||||
/* At first attach the ownership is already set */
|
/* At first attach the ownership is already set */
|
||||||
if (!domain)
|
if (!domain)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!grp)
|
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
table_group = iommu_group_get_iommudata(grp);
|
table_group = iommu_group_get_iommudata(grp);
|
||||||
ret = table_group->ops->take_ownership(table_group);
|
/*
|
||||||
|
* The domain being set to PLATFORM from earlier
|
||||||
|
* BLOCKED. The table_group ownership has to be released.
|
||||||
|
*/
|
||||||
|
table_group->ops->release_ownership(table_group);
|
||||||
iommu_group_put(grp);
|
iommu_group_put(grp);
|
||||||
|
|
||||||
return ret;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct iommu_domain_ops spapr_tce_platform_domain_ops = {
|
static const struct iommu_domain_ops spapr_tce_platform_domain_ops = {
|
||||||
@ -1312,13 +1312,32 @@ static struct iommu_domain spapr_tce_platform_domain = {
|
|||||||
.ops = &spapr_tce_platform_domain_ops,
|
.ops = &spapr_tce_platform_domain_ops,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct iommu_domain spapr_tce_blocked_domain = {
|
static int
|
||||||
.type = IOMMU_DOMAIN_BLOCKED,
|
spapr_tce_blocked_iommu_attach_dev(struct iommu_domain *platform_domain,
|
||||||
|
struct device *dev)
|
||||||
|
{
|
||||||
|
struct iommu_group *grp = iommu_group_get(dev);
|
||||||
|
struct iommu_table_group *table_group;
|
||||||
|
int ret = -EINVAL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* FIXME: SPAPR mixes blocked and platform behaviors, the blocked domain
|
* FIXME: SPAPR mixes blocked and platform behaviors, the blocked domain
|
||||||
* also sets the dma_api ops
|
* also sets the dma_api ops
|
||||||
*/
|
*/
|
||||||
.ops = &spapr_tce_platform_domain_ops,
|
table_group = iommu_group_get_iommudata(grp);
|
||||||
|
ret = table_group->ops->take_ownership(table_group);
|
||||||
|
iommu_group_put(grp);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct iommu_domain_ops spapr_tce_blocked_domain_ops = {
|
||||||
|
.attach_dev = spapr_tce_blocked_iommu_attach_dev,
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct iommu_domain spapr_tce_blocked_domain = {
|
||||||
|
.type = IOMMU_DOMAIN_BLOCKED,
|
||||||
|
.ops = &spapr_tce_blocked_domain_ops,
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool spapr_tce_iommu_capable(struct device *dev, enum iommu_cap cap)
|
static bool spapr_tce_iommu_capable(struct device *dev, enum iommu_cap cap)
|
||||||
|
@ -960,7 +960,8 @@ int host1x_client_iommu_attach(struct host1x_client *client)
|
|||||||
* not the shared IOMMU domain, don't try to attach it to a different
|
* not the shared IOMMU domain, don't try to attach it to a different
|
||||||
* domain. This allows using the IOMMU-backed DMA API.
|
* domain. This allows using the IOMMU-backed DMA API.
|
||||||
*/
|
*/
|
||||||
if (domain && domain != tegra->domain)
|
if (domain && domain->type != IOMMU_DOMAIN_IDENTITY &&
|
||||||
|
domain != tegra->domain)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (tegra->domain) {
|
if (tegra->domain) {
|
||||||
|
@ -1799,7 +1799,7 @@ iommu_group_alloc_default_domain(struct iommu_group *group, int req_type)
|
|||||||
* domain. Do not use in new drivers.
|
* domain. Do not use in new drivers.
|
||||||
*/
|
*/
|
||||||
if (ops->default_domain) {
|
if (ops->default_domain) {
|
||||||
if (req_type)
|
if (req_type != ops->default_domain->type)
|
||||||
return ERR_PTR(-EINVAL);
|
return ERR_PTR(-EINVAL);
|
||||||
return ops->default_domain;
|
return ops->default_domain;
|
||||||
}
|
}
|
||||||
@ -1871,10 +1871,18 @@ static int iommu_get_def_domain_type(struct iommu_group *group,
|
|||||||
const struct iommu_ops *ops = dev_iommu_ops(dev);
|
const struct iommu_ops *ops = dev_iommu_ops(dev);
|
||||||
int type;
|
int type;
|
||||||
|
|
||||||
if (!ops->def_domain_type)
|
if (ops->default_domain) {
|
||||||
return cur_type;
|
/*
|
||||||
|
* Drivers that declare a global static default_domain will
|
||||||
type = ops->def_domain_type(dev);
|
* always choose that.
|
||||||
|
*/
|
||||||
|
type = ops->default_domain->type;
|
||||||
|
} else {
|
||||||
|
if (ops->def_domain_type)
|
||||||
|
type = ops->def_domain_type(dev);
|
||||||
|
else
|
||||||
|
return cur_type;
|
||||||
|
}
|
||||||
if (!type || cur_type == type)
|
if (!type || cur_type == type)
|
||||||
return cur_type;
|
return cur_type;
|
||||||
if (!cur_type)
|
if (!cur_type)
|
||||||
|
Loading…
Reference in New Issue
Block a user