diff options
author | Suravee Suthikulpanit <suravee.suthikulpanit@amd.com> | 2024-02-05 11:56:10 +0000 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2024-02-09 13:16:28 +0100 |
commit | fb575d17813f6aff2e8b7e051dac8def2c291bff (patch) | |
tree | e5a596f3fba6eb46ef3ebf986830630fd44d4314 /drivers/iommu/amd | |
parent | 4ebd4c7f2501cc5876717e0f2382d5b825e59405 (diff) |
iommu/amd: Refactor protection_domain helper functions
To removes the code to setup GCR3 table, and only handle domain
create / destroy, since GCR3 is no longer part of a domain.
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/20240205115615.6053-13-vasant.hegde@amd.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu/amd')
-rw-r--r-- | drivers/iommu/amd/iommu.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c index 929a0e8d41d0..e2f546926b6f 100644 --- a/drivers/iommu/amd/iommu.c +++ b/drivers/iommu/amd/iommu.c @@ -2176,9 +2176,6 @@ static void protection_domain_free(struct protection_domain *domain) if (domain->iop.pgtbl_cfg.tlb) free_io_pgtable_ops(&domain->iop.iop.ops); - if (domain->flags & PD_IOMMUV2_MASK) - free_gcr3_table(domain); - if (domain->iop.root) free_page((unsigned long)domain->iop.root); @@ -2206,15 +2203,10 @@ static int protection_domain_init_v1(struct protection_domain *domain, int mode) return 0; } -static int protection_domain_init_v2(struct protection_domain *domain) +static int protection_domain_init_v2(struct protection_domain *pdom) { - domain->flags |= PD_GIOV_MASK; - domain->pd_mode = PD_MODE_V2; - - domain->domain.pgsize_bitmap = AMD_IOMMU_PGSIZES_V2; - - if (setup_gcr3_table(domain, 1)) - return -ENOMEM; + pdom->pd_mode = PD_MODE_V2; + pdom->domain.pgsize_bitmap = AMD_IOMMU_PGSIZES_V2; return 0; } |