Page MenuHomeFreeBSD

D35424.diff
No OneTemporary

D35424.diff

diff --git a/sys/arm64/arm64/gicv3_its.c b/sys/arm64/arm64/gicv3_its.c
--- a/sys/arm64/arm64/gicv3_its.c
+++ b/sys/arm64/arm64/gicv3_its.c
@@ -1483,7 +1483,8 @@
ctx = iommu_get_dev_ctx(child);
if (ctx == NULL)
return (ENXIO);
- error = iommu_map_msi(ctx, PAGE_SIZE, GITS_TRANSLATER,
+ /* Map the page containing the GITS_TRANSLATER register. */
+ error = iommu_map_msi(ctx, PAGE_SIZE, 0,
IOMMU_MAP_ENTRY_WRITE, IOMMU_MF_CANWAIT, &sc->ma);
*domain = iommu_get_ctx_domain(ctx);
diff --git a/sys/dev/iommu/busdma_iommu.c b/sys/dev/iommu/busdma_iommu.c
--- a/sys/dev/iommu/busdma_iommu.c
+++ b/sys/dev/iommu/busdma_iommu.c
@@ -594,8 +594,7 @@
if (seg + 1 < tag->common.nsegments)
gas_flags |= IOMMU_MF_CANSPLIT;
- error = iommu_map(domain, &tag->common,
- round_page(offset + buflen1),
+ error = iommu_map(domain, &tag->common, buflen1,
offset, e_flags, gas_flags, ma + idx, &entry);
if (error != 0)
break;
diff --git a/sys/dev/iommu/iommu_gas.c b/sys/dev/iommu/iommu_gas.c
--- a/sys/dev/iommu/iommu_gas.c
+++ b/sys/dev/iommu/iommu_gas.c
@@ -364,7 +364,8 @@
* The page sized gap is created between consequent
* allocations to ensure that out-of-bounds accesses fault.
*/
- a->entry->end = a->entry->start + a->size;
+ a->entry->end = a->entry->start +
+ roundup2(a->size + a->offset, IOMMU_PAGE_SIZE);
found = iommu_gas_rb_insert(a->domain, a->entry);
KASSERT(found, ("found dup %p start %jx size %jx",
@@ -381,7 +382,8 @@
* If the subtree doesn't have free space for the requested allocation
* plus two guard pages, give up.
*/
- if (entry->free_down < a->size + a->offset + 2 * IOMMU_PAGE_SIZE)
+ if (entry->free_down < 2 * IOMMU_PAGE_SIZE +
+ roundup2(a->size + a->offset, IOMMU_PAGE_SIZE))
return (ENOMEM);
if (entry->first >= a->common->lowaddr)
return (ENOMEM);
@@ -415,7 +417,8 @@
* If the subtree doesn't have free space for the requested allocation
* plus two guard pages, give up.
*/
- if (entry->free_down < a->size + a->offset + 2 * IOMMU_PAGE_SIZE)
+ if (entry->free_down < 2 * IOMMU_PAGE_SIZE +
+ roundup2(a->size + a->offset, IOMMU_PAGE_SIZE))
return (ENOMEM);
if (entry->last < a->common->highaddr)
return (ENOMEM);
@@ -450,7 +453,6 @@
IOMMU_DOMAIN_ASSERT_LOCKED(domain);
KASSERT(entry->flags == 0, ("dirty entry %p %p", domain, entry));
- KASSERT((size & IOMMU_PAGE_MASK) == 0, ("size %jx", (uintmax_t)size));
a.domain = domain;
a.size = size;

File Metadata

Mime Type
text/plain
Expires
Sat, Feb 22, 9:58 PM (5 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16781134
Default Alt Text
D35424.diff (2 KB)

Event Timeline