From nobody Wed Dec 21 15:54:08 2022
X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NcdKY0xjHz1G39Y;
Wed, 21 Dec 2022 15:54:09 +0000 (UTC)
(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
client-signature RSA-PSS (4096 bits) client-digest SHA256)
(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
by mx1.freebsd.org (Postfix) with ESMTPS id 4NcdKY0Vf3z3Kyv;
Wed, 21 Dec 2022 15:54:09 +0000 (UTC)
(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
t=1671638049;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding;
bh=vO6nX5+PuvWfOroftsm4huGKuhfAuuL3LsT8w3NX67I=;
b=Ne5ARpI1joppJF6bwr1kp94tLSC7bdZ6JRYq8H26bl7JHfBpBy5loRRqGzIr8o2aKkpjvV
FLy0mk/erRmi1SSuy9siqh2bC70mhIf/XZcunim2kOQbKTId0VYvQVqc9X0QX7aQCUgTSd
ZjtHLToo/NXvnyQWDeScBM+b642+YnlbwmacTTS67UFn+iOcBjjsqxsCL4soY268VqOw+M
t6nC+R6GKXG259XWVvT3G0BdT1WoxqyS1HHWuCt+TeaxDkmhfiJmqoK1DCH0EKv/jQ8XHK
PaFTemP0faTEr1nTomEZe7nepX8iwErjhZnQFfoMSntUiW+cCv9Wi7ingZGylA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
s=dkim; t=1671638049;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding;
bh=vO6nX5+PuvWfOroftsm4huGKuhfAuuL3LsT8w3NX67I=;
b=mriETh59FfflZq3uK+EcLW2xTwXgOt68VWcrqhOXHFYMw4qk44uBycLyLUfdm+jfOKF0j8
YtjS9p381EDrsqx6rNh5V4NcUbsD9KBC9nGXc2j049HGesq9UeJ7KIYVRBMtI5ehaj/o0k
wPeQhWMetQiEYU37wZniGiWxOP0QNGMu/75xk90PCIo37KA00xJS4W71zo61vtiWO12zMu
2csm77gP5P5jyJ4cIcJ5L29RuEEgE+6ePRwM4+t8NOZJ9nxVViyV7lRyBv64Gr9F2OXkcp
chsdvXAe1r0zVRDHZaJsa8LktQYGY2poNgcSuszocBTR49AcxDgHlkOCRWObng==
ARC-Authentication-Results: i=1;
mx1.freebsd.org;
none
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1671638049; a=rsa-sha256; cv=none;
b=AmfquISgv3gnBnfN5dlPg/ElypBFr6DjPgXz/aRzb9T+Y4gn4Q6kO7txpirng7ubWPGB6i
sa9/oUmYRyKyK70kTsjSpvBLDcIjQ9e4bekzu5OOMPd/d6lUNcAl1uEKcinOF6lRHJhAtL
9ejE78HhzC/D+PbC8XrcU4O7jOK5Ir/UWRaCMNBVBNbJPAvwknv/cnBYLfiPRMF6HyPthb
xC+1F/bn9piz5tGC1P0p5cZBc4oskWdPj5aK0FTjLyF1IdSuuNOOkCaTKjRVP1/kJq//EQ
LfWDuVvbAxu0Zvr18c55cZMQX4+vqvhwa6JLnYrZRXk7FMySpk1rjGKT13fiWg==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
(Client did not present a certificate)
by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4NcdKX6g3SzL1Y;
Wed, 21 Dec 2022 15:54:08 +0000 (UTC)
(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2BLFs8nb040019;
Wed, 21 Dec 2022 15:54:08 GMT
(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2BLFs8D9040018;
Wed, 21 Dec 2022 15:54:08 GMT
(envelope-from git)
Date: Wed, 21 Dec 2022 15:54:08 GMT
Message-Id: <202212211554.2BLFs8D9040018@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
dev-commits-src-main@FreeBSD.org
From: Ruslan Bukin
Subject: git: 4b4e8cb53abc - main - smmu: set guest address space range to 48-bit, which is a hardware limit in our configuration.
List-Id: Commit messages for all branches of the src repository
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all
List-Help:
List-Post:
List-Subscribe:
List-Unsubscribe:
Sender: owner-dev-commits-src-all@freebsd.org
X-BeenThere: dev-commits-src-all@freebsd.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: br
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 4b4e8cb53abc1651e2f85c939c81393f05bd5fb9
Auto-Submitted: auto-generated
X-ThisMailContainsUnwantedMimeParts: N
The branch main has been updated by br:
URL: https://cgit.FreeBSD.org/src/commit/?id=4b4e8cb53abc1651e2f85c939c81393f05bd5fb9
commit 4b4e8cb53abc1651e2f85c939c81393f05bd5fb9
Author: Ruslan Bukin
AuthorDate: 2022-12-20 11:25:18 +0000
Commit: Ruslan Bukin
CommitDate: 2022-12-21 15:53:05 +0000
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
---
sys/arm64/iommu/iommu.c | 9 +++++----
sys/arm64/iommu/smmu.c | 14 +++++++++++++-
2 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/sys/arm64/iommu/iommu.c b/sys/arm64/iommu/iommu.c
index d24cad94e966..3451a002bef6 100644
--- a/sys/arm64/iommu/iommu.c
+++ b/sys/arm64/iommu/iommu.c
@@ -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);
}
diff --git a/sys/arm64/iommu/smmu.c b/sys/arm64/iommu/smmu.c
index 57f6826faa5e..e307440e725e 100644
--- a/sys/arm64/iommu/smmu.c
+++ b/sys/arm64/iommu/smmu.c
@@ -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