Skip to content

Commit e5d8be7

Browse files
jgunthorpejoergroedel
authored andcommitted
iommu: Move IOMMU_DOMAIN_BLOCKED global statics to ops->blocked_domain
Following the pattern of identity domains, just assign the BLOCKED domain global statics to a value in ops. Update the core code to use the global static directly. Update powerpc to use the new scheme and remove its empty domain_alloc callback. Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Acked-by: Sven Peter <sven@svenpeter.dev> Link: https://lore.kernel.org/r/1-v2-bff223cf6409+282-dart_paging_jgg@nvidia.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent 058b4d9 commit e5d8be7

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

arch/powerpc/kernel/iommu.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,13 +1333,6 @@ static bool spapr_tce_iommu_capable(struct device *dev, enum iommu_cap cap)
13331333
return false;
13341334
}
13351335

1336-
static struct iommu_domain *spapr_tce_iommu_domain_alloc(unsigned int type)
1337-
{
1338-
if (type != IOMMU_DOMAIN_BLOCKED)
1339-
return NULL;
1340-
return &spapr_tce_blocked_domain;
1341-
}
1342-
13431336
static struct iommu_device *spapr_tce_iommu_probe_device(struct device *dev)
13441337
{
13451338
struct pci_dev *pdev;
@@ -1374,8 +1367,8 @@ static struct iommu_group *spapr_tce_iommu_device_group(struct device *dev)
13741367

13751368
static const struct iommu_ops spapr_tce_iommu_ops = {
13761369
.default_domain = &spapr_tce_platform_domain,
1370+
.blocked_domain = &spapr_tce_blocked_domain,
13771371
.capable = spapr_tce_iommu_capable,
1378-
.domain_alloc = spapr_tce_iommu_domain_alloc,
13791372
.probe_device = spapr_tce_iommu_probe_device,
13801373
.release_device = spapr_tce_iommu_release_device,
13811374
.device_group = spapr_tce_iommu_device_group,

drivers/iommu/iommu.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2086,6 +2086,8 @@ static struct iommu_domain *__iommu_domain_alloc(const struct iommu_ops *ops,
20862086

20872087
if (alloc_type == IOMMU_DOMAIN_IDENTITY && ops->identity_domain)
20882088
return ops->identity_domain;
2089+
else if (alloc_type == IOMMU_DOMAIN_BLOCKED && ops->blocked_domain)
2090+
return ops->blocked_domain;
20892091
else if (type & __IOMMU_DOMAIN_PAGING && ops->domain_alloc_paging)
20902092
domain = ops->domain_alloc_paging(dev);
20912093
else if (ops->domain_alloc)

include/linux/iommu.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,8 @@ struct iommu_iotlb_gather {
265265
* @owner: Driver module providing these ops
266266
* @identity_domain: An always available, always attachable identity
267267
* translation.
268+
* @blocked_domain: An always available, always attachable blocking
269+
* translation.
268270
* @default_domain: If not NULL this will always be set as the default domain.
269271
* This should be an IDENTITY/BLOCKED/PLATFORM domain.
270272
* Do not use in new drivers.
@@ -303,6 +305,7 @@ struct iommu_ops {
303305
unsigned long pgsize_bitmap;
304306
struct module *owner;
305307
struct iommu_domain *identity_domain;
308+
struct iommu_domain *blocked_domain;
306309
struct iommu_domain *default_domain;
307310
};
308311

0 commit comments

Comments
 (0)