Skip to content

Commit 1463edc

Browse files
aikmpe
authored andcommitted
vfio/spapr: Use IOMMU pageshift rather than pagesize
The size is always equal to 1 page so let's use this. Later on this will be used for other checks which use page shifts to check the granularity of access. This should cause no behavioral change. Cc: [email protected] # v4.12+ Reviewed-by: David Gibson <[email protected]> Acked-by: Alex Williamson <[email protected]> Signed-off-by: Alexey Kardashevskiy <[email protected]> Signed-off-by: Michael Ellerman <[email protected]>
1 parent 941d810 commit 1463edc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/vfio/vfio_iommu_spapr_tce.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -457,13 +457,13 @@ static void tce_iommu_unuse_page(struct tce_container *container,
457457
}
458458

459459
static int tce_iommu_prereg_ua_to_hpa(struct tce_container *container,
460-
unsigned long tce, unsigned long size,
460+
unsigned long tce, unsigned long shift,
461461
unsigned long *phpa, struct mm_iommu_table_group_mem_t **pmem)
462462
{
463463
long ret = 0;
464464
struct mm_iommu_table_group_mem_t *mem;
465465

466-
mem = mm_iommu_lookup(container->mm, tce, size);
466+
mem = mm_iommu_lookup(container->mm, tce, 1ULL << shift);
467467
if (!mem)
468468
return -EINVAL;
469469

@@ -487,7 +487,7 @@ static void tce_iommu_unuse_page_v2(struct tce_container *container,
487487
if (!pua)
488488
return;
489489

490-
ret = tce_iommu_prereg_ua_to_hpa(container, *pua, IOMMU_PAGE_SIZE(tbl),
490+
ret = tce_iommu_prereg_ua_to_hpa(container, *pua, tbl->it_page_shift,
491491
&hpa, &mem);
492492
if (ret)
493493
pr_debug("%s: tce %lx at #%lx was not cached, ret=%d\n",
@@ -611,7 +611,7 @@ static long tce_iommu_build_v2(struct tce_container *container,
611611
entry + i);
612612

613613
ret = tce_iommu_prereg_ua_to_hpa(container,
614-
tce, IOMMU_PAGE_SIZE(tbl), &hpa, &mem);
614+
tce, tbl->it_page_shift, &hpa, &mem);
615615
if (ret)
616616
break;
617617

0 commit comments

Comments
 (0)