Skip to content

Commit 977fc27

Browse files
jgunthorpejoergroedel
authored andcommitted
iommu/amd: Remove amd_io_pgtable::pgtbl_cfg
This struct is already in iop.cfg, we don't need two. AMD is using this API sort of wrong, the cfg is supposed to be passed in and then the allocation function will allocate ops memory and copy the passed config into the new memory. Keep it kind of wrong and pass in the cfg memory that is already part of the pagetable struct. Reviewed-by: Vasant Hegde <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 670b577 commit 977fc27

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

drivers/iommu/amd/amd_iommu_types.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ struct amd_irte_ops;
529529
struct protection_domain, iop)
530530

531531
#define io_pgtable_cfg_to_data(x) \
532-
container_of((x), struct amd_io_pgtable, pgtbl_cfg)
532+
container_of((x), struct amd_io_pgtable, pgtbl.cfg)
533533

534534
struct gcr3_tbl_info {
535535
u64 *gcr3_tbl; /* Guest CR3 table */
@@ -539,7 +539,6 @@ struct gcr3_tbl_info {
539539
};
540540

541541
struct amd_io_pgtable {
542-
struct io_pgtable_cfg pgtbl_cfg;
543542
struct io_pgtable pgtbl;
544543
int mode;
545544
u64 *root;

drivers/iommu/amd/iommu.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2257,7 +2257,7 @@ void protection_domain_free(struct protection_domain *domain)
22572257

22582258
WARN_ON(!list_empty(&domain->dev_list));
22592259

2260-
if (domain->iop.pgtbl_cfg.tlb)
2260+
if (domain->iop.pgtbl.cfg.tlb)
22612261
free_io_pgtable_ops(&domain->iop.pgtbl.ops);
22622262

22632263
if (domain->id)
@@ -2315,7 +2315,8 @@ struct protection_domain *protection_domain_alloc(unsigned int type)
23152315
goto out_err;
23162316
}
23172317

2318-
pgtbl_ops = alloc_io_pgtable_ops(pgtable, &domain->iop.pgtbl_cfg, domain);
2318+
pgtbl_ops =
2319+
alloc_io_pgtable_ops(pgtable, &domain->iop.pgtbl.cfg, domain);
23192320
if (!pgtbl_ops)
23202321
goto out_err;
23212322

0 commit comments

Comments
 (0)