smmu: set guest address space range to 48-bit, which is a hardware

limit in our configuration.

Reviewed by:	andrew
Sponsored by:	UKRI
Differential Revision:	https://reviews.freebsd.org/D37756
This commit is contained in:
Ruslan Bukin 2022-12-20 11:25:18 +00:00
parent e00b6e254f
commit 4b4e8cb53a
2 changed files with 18 additions and 5 deletions

View File

@ -136,8 +136,9 @@ iommu_domain_alloc(struct iommu_unit *iommu)
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 @@ iommu_domain_free(struct iommu_domain *iodom)
}
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 @@ iommu_ctx_init(device_t requester, struct iommu_ctx *ioctx)
tag->ctx = ioctx;
tag->ctx->domain = iodom;
iommu_tag_init(tag);
iommu_tag_init(iodom, tag);
return (error);
}

View File

@ -149,6 +149,9 @@ __FBSDID("$FreeBSD$");
#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 @@ smmu_map(device_t dev, struct iommu_domain *iodom,
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 @@ smmu_domain_alloc(device_t dev, struct iommu_unit *iommu)
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