Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Feb 2025 12:26:37 GMT
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 8fd88aeedb1e - main - arm64/its: Support devices not behind an iommu
Message-ID:  <202502041226.514CQbta040948@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by andrew:

URL: https://cgit.FreeBSD.org/src/commit/?id=8fd88aeedb1e4f34d6c127cf66fa3e7ecb3f5168

commit 8fd88aeedb1e4f34d6c127cf66fa3e7ecb3f5168
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2025-02-04 11:57:21 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2025-02-04 12:02:00 +0000

    arm64/its: Support devices not behind an iommu
    
    When the IOMMU option is enabled but a device doesn't have an IOMMU
    this will return an error. If the device is really behind an IOMMU
    then it will fail later, and if not this is needed to allocate MSI and
    MSI-X interrupts.
    
    Reviewed by:    kib
    Sponsored by:   Arm Ltd
    Differential Revision:  https://reviews.freebsd.org/D48725
---
 sys/arm64/arm64/gicv3_its.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/sys/arm64/arm64/gicv3_its.c b/sys/arm64/arm64/gicv3_its.c
index 9224e03dec52..77d1936d8c95 100644
--- a/sys/arm64/arm64/gicv3_its.c
+++ b/sys/arm64/arm64/gicv3_its.c
@@ -1744,9 +1744,15 @@ gicv3_iommu_init(device_t dev, device_t child, struct iommu_domain **domain)
 	int error;
 
 	sc = device_get_softc(dev);
+	/*
+	 * Get the context. If no context is found then the device isn't
+	 * behind an IOMMU so no setup is needed.
+	 */
 	ctx = iommu_get_dev_ctx(child);
-	if (ctx == NULL)
-		return (ENXIO);
+	if (ctx == NULL) {
+		*domain = NULL;
+		return (0);
+	}
 	/* 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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202502041226.514CQbta040948>