Skip to content

Commit 670b577

Browse files
jgunthorpejoergroedel
authored andcommitted
iommu/amd: Rename struct amd_io_pgtable iopt to pgtbl
There is struct protection_domain iopt and struct amd_io_pgtable iopt. Next patches are going to want to write domain.iopt.iopt.xx which is quite unnatural to read. Give one of them a different name, amd_io_pgtable has fewer references so call it pgtbl, to match pgtbl_cfg, instead. Suggested-by: Alejandro Jimenez <[email protected]> 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 1ed2d21 commit 670b577

File tree

4 files changed

+22
-22
lines changed

4 files changed

+22
-22
lines changed

drivers/iommu/amd/amd_iommu_types.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ struct amd_irte_ops;
519519
#define AMD_IOMMU_FLAG_TRANS_PRE_ENABLED (1 << 0)
520520

521521
#define io_pgtable_to_data(x) \
522-
container_of((x), struct amd_io_pgtable, iop)
522+
container_of((x), struct amd_io_pgtable, pgtbl)
523523

524524
#define io_pgtable_ops_to_data(x) \
525525
io_pgtable_to_data(io_pgtable_ops_to_pgtable(x))
@@ -540,7 +540,7 @@ struct gcr3_tbl_info {
540540

541541
struct amd_io_pgtable {
542542
struct io_pgtable_cfg pgtbl_cfg;
543-
struct io_pgtable iop;
543+
struct io_pgtable pgtbl;
544544
int mode;
545545
u64 *root;
546546
u64 *pgd; /* v2 pgtable pgd pointer */

drivers/iommu/amd/io_pgtable.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ static int iommu_v1_read_and_clear_dirty(struct io_pgtable_ops *ops,
541541
*/
542542
static void v1_free_pgtable(struct io_pgtable *iop)
543543
{
544-
struct amd_io_pgtable *pgtable = container_of(iop, struct amd_io_pgtable, iop);
544+
struct amd_io_pgtable *pgtable = container_of(iop, struct amd_io_pgtable, pgtbl);
545545
LIST_HEAD(freelist);
546546

547547
if (pgtable->mode == PAGE_MODE_NONE)
@@ -569,12 +569,12 @@ static struct io_pgtable *v1_alloc_pgtable(struct io_pgtable_cfg *cfg, void *coo
569569
cfg->oas = IOMMU_OUT_ADDR_BIT_SIZE;
570570
cfg->tlb = &v1_flush_ops;
571571

572-
pgtable->iop.ops.map_pages = iommu_v1_map_pages;
573-
pgtable->iop.ops.unmap_pages = iommu_v1_unmap_pages;
574-
pgtable->iop.ops.iova_to_phys = iommu_v1_iova_to_phys;
575-
pgtable->iop.ops.read_and_clear_dirty = iommu_v1_read_and_clear_dirty;
572+
pgtable->pgtbl.ops.map_pages = iommu_v1_map_pages;
573+
pgtable->pgtbl.ops.unmap_pages = iommu_v1_unmap_pages;
574+
pgtable->pgtbl.ops.iova_to_phys = iommu_v1_iova_to_phys;
575+
pgtable->pgtbl.ops.read_and_clear_dirty = iommu_v1_read_and_clear_dirty;
576576

577-
return &pgtable->iop;
577+
return &pgtable->pgtbl;
578578
}
579579

580580
struct io_pgtable_init_fns io_pgtable_amd_iommu_v1_init_fns = {

drivers/iommu/amd/io_pgtable_v2.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ static int iommu_v2_map_pages(struct io_pgtable_ops *ops, unsigned long iova,
234234
int prot, gfp_t gfp, size_t *mapped)
235235
{
236236
struct protection_domain *pdom = io_pgtable_ops_to_domain(ops);
237-
struct io_pgtable_cfg *cfg = &pdom->iop.iop.cfg;
237+
struct io_pgtable_cfg *cfg = &pdom->iop.pgtbl.cfg;
238238
u64 *pte;
239239
unsigned long map_size;
240240
unsigned long mapped_size = 0;
@@ -281,7 +281,7 @@ static unsigned long iommu_v2_unmap_pages(struct io_pgtable_ops *ops,
281281
struct iommu_iotlb_gather *gather)
282282
{
283283
struct amd_io_pgtable *pgtable = io_pgtable_ops_to_data(ops);
284-
struct io_pgtable_cfg *cfg = &pgtable->iop.cfg;
284+
struct io_pgtable_cfg *cfg = &pgtable->pgtbl.cfg;
285285
unsigned long unmap_size;
286286
unsigned long unmapped = 0;
287287
size_t size = pgcount << __ffs(pgsize);
@@ -346,7 +346,7 @@ static const struct iommu_flush_ops v2_flush_ops = {
346346

347347
static void v2_free_pgtable(struct io_pgtable *iop)
348348
{
349-
struct amd_io_pgtable *pgtable = container_of(iop, struct amd_io_pgtable, iop);
349+
struct amd_io_pgtable *pgtable = container_of(iop, struct amd_io_pgtable, pgtbl);
350350

351351
if (!pgtable || !pgtable->pgd)
352352
return;
@@ -369,16 +369,16 @@ static struct io_pgtable *v2_alloc_pgtable(struct io_pgtable_cfg *cfg, void *coo
369369
if (get_pgtable_level() == PAGE_MODE_5_LEVEL)
370370
ias = 57;
371371

372-
pgtable->iop.ops.map_pages = iommu_v2_map_pages;
373-
pgtable->iop.ops.unmap_pages = iommu_v2_unmap_pages;
374-
pgtable->iop.ops.iova_to_phys = iommu_v2_iova_to_phys;
372+
pgtable->pgtbl.ops.map_pages = iommu_v2_map_pages;
373+
pgtable->pgtbl.ops.unmap_pages = iommu_v2_unmap_pages;
374+
pgtable->pgtbl.ops.iova_to_phys = iommu_v2_iova_to_phys;
375375

376376
cfg->pgsize_bitmap = AMD_IOMMU_PGSIZES_V2,
377377
cfg->ias = ias,
378378
cfg->oas = IOMMU_OUT_ADDR_BIT_SIZE,
379379
cfg->tlb = &v2_flush_ops;
380380

381-
return &pgtable->iop;
381+
return &pgtable->pgtbl;
382382
}
383383

384384
struct io_pgtable_init_fns io_pgtable_amd_iommu_v2_init_fns = {

drivers/iommu/amd/iommu.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2258,7 +2258,7 @@ void protection_domain_free(struct protection_domain *domain)
22582258
WARN_ON(!list_empty(&domain->dev_list));
22592259

22602260
if (domain->iop.pgtbl_cfg.tlb)
2261-
free_io_pgtable_ops(&domain->iop.iop.ops);
2261+
free_io_pgtable_ops(&domain->iop.pgtbl.ops);
22622262

22632263
if (domain->id)
22642264
domain_id_free(domain->id);
@@ -2366,7 +2366,7 @@ static struct iommu_domain *do_iommu_domain_alloc(unsigned int type,
23662366
domain->domain.geometry.aperture_start = 0;
23672367
domain->domain.geometry.aperture_end = dma_max_address();
23682368
domain->domain.geometry.force_aperture = true;
2369-
domain->domain.pgsize_bitmap = domain->iop.iop.cfg.pgsize_bitmap;
2369+
domain->domain.pgsize_bitmap = domain->iop.pgtbl.cfg.pgsize_bitmap;
23702370

23712371
if (iommu) {
23722372
domain->domain.type = type;
@@ -2510,7 +2510,7 @@ static int amd_iommu_iotlb_sync_map(struct iommu_domain *dom,
25102510
unsigned long iova, size_t size)
25112511
{
25122512
struct protection_domain *domain = to_pdomain(dom);
2513-
struct io_pgtable_ops *ops = &domain->iop.iop.ops;
2513+
struct io_pgtable_ops *ops = &domain->iop.pgtbl.ops;
25142514

25152515
if (ops->map_pages)
25162516
domain_flush_np_cache(domain, iova, size);
@@ -2522,7 +2522,7 @@ static int amd_iommu_map_pages(struct iommu_domain *dom, unsigned long iova,
25222522
int iommu_prot, gfp_t gfp, size_t *mapped)
25232523
{
25242524
struct protection_domain *domain = to_pdomain(dom);
2525-
struct io_pgtable_ops *ops = &domain->iop.iop.ops;
2525+
struct io_pgtable_ops *ops = &domain->iop.pgtbl.ops;
25262526
int prot = 0;
25272527
int ret = -EINVAL;
25282528

@@ -2569,7 +2569,7 @@ static size_t amd_iommu_unmap_pages(struct iommu_domain *dom, unsigned long iova
25692569
struct iommu_iotlb_gather *gather)
25702570
{
25712571
struct protection_domain *domain = to_pdomain(dom);
2572-
struct io_pgtable_ops *ops = &domain->iop.iop.ops;
2572+
struct io_pgtable_ops *ops = &domain->iop.pgtbl.ops;
25732573
size_t r;
25742574

25752575
if ((domain->pd_mode == PD_MODE_V1) &&
@@ -2588,7 +2588,7 @@ static phys_addr_t amd_iommu_iova_to_phys(struct iommu_domain *dom,
25882588
dma_addr_t iova)
25892589
{
25902590
struct protection_domain *domain = to_pdomain(dom);
2591-
struct io_pgtable_ops *ops = &domain->iop.iop.ops;
2591+
struct io_pgtable_ops *ops = &domain->iop.pgtbl.ops;
25922592

25932593
return ops->iova_to_phys(ops, iova);
25942594
}
@@ -2666,7 +2666,7 @@ static int amd_iommu_read_and_clear_dirty(struct iommu_domain *domain,
26662666
struct iommu_dirty_bitmap *dirty)
26672667
{
26682668
struct protection_domain *pdomain = to_pdomain(domain);
2669-
struct io_pgtable_ops *ops = &pdomain->iop.iop.ops;
2669+
struct io_pgtable_ops *ops = &pdomain->iop.pgtbl.ops;
26702670
unsigned long lflags;
26712671

26722672
if (!ops || !ops->read_and_clear_dirty)

0 commit comments

Comments
 (0)