Page MenuHomeFreeBSD

D37756.diff
No OneTemporary

D37756.diff

diff --git a/sys/arm64/iommu/iommu.c b/sys/arm64/iommu/iommu.c
--- a/sys/arm64/iommu/iommu.c
+++ b/sys/arm64/iommu/iommu.c
@@ -136,8 +136,9 @@
if (iodom == NULL)
return (NULL);
+ KASSERT(iodom->end != 0, ("domain end is not set"));
+
iommu_domain_init(iommu, iodom, &domain_map_ops);
- iodom->end = VM_MAXUSER_ADDRESS;
iodom->iommu = iommu;
iommu_gas_init_domain(iodom);
@@ -168,11 +169,11 @@
}
static void
-iommu_tag_init(struct bus_dma_tag_iommu *t)
+iommu_tag_init(struct iommu_domain *iodom, struct bus_dma_tag_iommu *t)
{
bus_addr_t maxaddr;
- maxaddr = BUS_SPACE_MAXADDR;
+ maxaddr = MIN(iodom->end, BUS_SPACE_MAXADDR);
t->common.ref_count = 0;
t->common.impl = &bus_dma_iommu_impl;
@@ -223,7 +224,7 @@
tag->ctx = ioctx;
tag->ctx->domain = iodom;
- iommu_tag_init(tag);
+ iommu_tag_init(iodom, tag);
return (error);
}
diff --git a/sys/arm64/iommu/smmu.c b/sys/arm64/iommu/smmu.c
--- a/sys/arm64/iommu/smmu.c
+++ b/sys/arm64/iommu/smmu.c
@@ -149,6 +149,9 @@
#define SMMU_Q_ALIGN (64 * 1024)
+#define MAXADDR_48BIT 0xFFFFFFFFFFFFUL
+#define MAXADDR_52BIT 0xFFFFFFFFFFFFFUL
+
static struct resource_spec smmu_spec[] = {
{ SYS_RES_MEMORY, 0, RF_ACTIVE },
{ SYS_RES_IRQ, 0, RF_ACTIVE },
@@ -1702,6 +1705,7 @@
static struct iommu_domain *
smmu_domain_alloc(device_t dev, struct iommu_unit *iommu)
{
+ struct iommu_domain *iodom;
struct smmu_domain *domain;
struct smmu_unit *unit;
struct smmu_softc *sc;
@@ -1742,7 +1746,15 @@
LIST_INSERT_HEAD(&unit->domain_list, domain, next);
IOMMU_UNLOCK(iommu);
- return (&domain->iodom);
+ iodom = &domain->iodom;
+
+ /*
+ * Use 48-bit address space regardless of VAX bit
+ * as we need 64k IOMMU_PAGE_SIZE for 52-bit space.
+ */
+ iodom->end = MAXADDR_48BIT;
+
+ return (iodom);
}
static void

File Metadata

Mime Type
text/plain
Expires
Tue, Oct 1, 6:20 AM (22 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
13234713
Default Alt Text
D37756.diff (1 KB)

Event Timeline