Skip to content

Commit 11e8442

Browse files
6by9pelwell
authored andcommitted
iommu: bcm2712: Fixup for new APIs
Based on upstream commits 983efef ("iommu/exynos: Update to {map,unmap}_pages") fa4c450 ("iommu: Allow .iotlb_sync_map to fail and handle s390's -ENOMEM return") Signed-off-by: Dave Stevenson <[email protected]>
1 parent 955086f commit 11e8442

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

drivers/iommu/bcm2712-iommu.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,8 @@ static int bcm2712_iommu_attach_dev(struct iommu_domain *domain, struct device *
237237
}
238238

239239
static int bcm2712_iommu_map(struct iommu_domain *domain, unsigned long iova,
240-
phys_addr_t pa, size_t bytes, int prot, gfp_t gfp)
240+
phys_addr_t pa, size_t bytes, size_t count,
241+
int prot, gfp_t gfp, size_t *mapped)
241242
{
242243
struct bcm2712_iommu *mmu = domain_to_mmu(domain);
243244

@@ -276,12 +277,14 @@ static int bcm2712_iommu_map(struct iommu_domain *domain, unsigned long iova,
276277
(unsigned long long)pa, (unsigned long long)bytes);
277278
return -EINVAL;
278279
}
280+
*mapped = bytes;
279281

280282
return 0;
281283
}
282284

283285
static size_t bcm2712_iommu_unmap(struct iommu_domain *domain, unsigned long iova,
284-
size_t bytes, struct iommu_iotlb_gather *gather)
286+
size_t bytes, size_t count,
287+
struct iommu_iotlb_gather *gather)
285288
{
286289
struct bcm2712_iommu *mmu = domain_to_mmu(domain);
287290

@@ -318,15 +321,15 @@ static size_t bcm2712_iommu_unmap(struct iommu_domain *domain, unsigned long iov
318321
return bytes;
319322
}
320323

321-
static void bcm2712_iommu_sync_range(struct iommu_domain *domain,
324+
static int bcm2712_iommu_sync_range(struct iommu_domain *domain,
322325
unsigned long iova, size_t size)
323326
{
324327
struct bcm2712_iommu *mmu = domain_to_mmu(domain);
325328
unsigned long iova_end;
326329
unsigned int i, p4;
327330

328331
if (!mmu || !mmu->dirty)
329-
return;
332+
return 0;
330333

331334
/* Ensure tables are cleaned from CPU cache or write-buffer */
332335
dma_sync_sgtable_for_device(mmu->dev, mmu->sgt, DMA_TO_DEVICE);
@@ -371,6 +374,8 @@ static void bcm2712_iommu_sync_range(struct iommu_domain *domain,
371374
}
372375
}
373376
}
377+
378+
return 0;
374379
}
375380

376381
static void bcm2712_iommu_sync(struct iommu_domain *domain,
@@ -412,8 +417,8 @@ static void bcm2712_iommu_domain_free(struct iommu_domain *domain)
412417

413418
static const struct iommu_domain_ops bcm2712_iommu_domain_ops = {
414419
.attach_dev = bcm2712_iommu_attach_dev,
415-
.map = bcm2712_iommu_map,
416-
.unmap = bcm2712_iommu_unmap,
420+
.map_pages = bcm2712_iommu_map,
421+
.unmap_pages = bcm2712_iommu_unmap,
417422
.iotlb_sync = bcm2712_iommu_sync,
418423
.iotlb_sync_map = bcm2712_iommu_sync_range,
419424
.flush_iotlb_all = bcm2712_iommu_sync_all,

0 commit comments

Comments
 (0)