]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
iommu/amd: Remove amd_io_pgtable::pgtbl_cfg
authorJason Gunthorpe <jgg@nvidia.com>
Fri, 30 Aug 2024 00:06:16 +0000 (21:06 -0300)
committerJoerg Roedel <jroedel@suse.de>
Wed, 4 Sep 2024 09:38:33 +0000 (11:38 +0200)
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 <vasant.hegde@amd.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/7-v2-831cdc4d00f3+1a315-amd_iopgtbl_jgg@nvidia.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/amd/amd_iommu_types.h
drivers/iommu/amd/iommu.c

index ce7825b4d631f3ede3412a3a764f169ab0b7945f..7aa4f1983e405ff9f3748bc5ea88c37ef4c3f1d2 100644 (file)
@@ -529,7 +529,7 @@ struct amd_irte_ops;
                     struct protection_domain, iop)
 
 #define io_pgtable_cfg_to_data(x) \
-       container_of((x), struct amd_io_pgtable, pgtbl_cfg)
+       container_of((x), struct amd_io_pgtable, pgtbl.cfg)
 
 struct gcr3_tbl_info {
        u64     *gcr3_tbl;      /* Guest CR3 table */
@@ -539,7 +539,6 @@ struct gcr3_tbl_info {
 };
 
 struct amd_io_pgtable {
-       struct io_pgtable_cfg   pgtbl_cfg;
        struct io_pgtable       pgtbl;
        int                     mode;
        u64                     *root;
index 14030adba3d01ca421c63ae3c4cc13bbf93c3808..212cc28012747d87af7a228b36630224275da0bb 100644 (file)
@@ -2257,7 +2257,7 @@ void protection_domain_free(struct protection_domain *domain)
 
        WARN_ON(!list_empty(&domain->dev_list));
 
-       if (domain->iop.pgtbl_cfg.tlb)
+       if (domain->iop.pgtbl.cfg.tlb)
                free_io_pgtable_ops(&domain->iop.pgtbl.ops);
 
        if (domain->id)
@@ -2315,7 +2315,8 @@ struct protection_domain *protection_domain_alloc(unsigned int type)
                goto out_err;
        }
 
-       pgtbl_ops = alloc_io_pgtable_ops(pgtable, &domain->iop.pgtbl_cfg, domain);
+       pgtbl_ops =
+               alloc_io_pgtable_ops(pgtable, &domain->iop.pgtbl.cfg, domain);
        if (!pgtbl_ops)
                goto out_err;