git: 8fd88aeedb1e - main - arm64/its: Support devices not behind an iommu
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 04 Feb 2025 12:26:37 UTC
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);