diff options
author | Andrew Turner <andrew@FreeBSD.org> | 2025-02-04 11:57:21 +0000 |
---|---|---|
committer | Andrew Turner <andrew@FreeBSD.org> | 2025-02-04 12:02:00 +0000 |
commit | 8fd88aeedb1e4f34d6c127cf66fa3e7ecb3f5168 (patch) | |
tree | fc0643cd5e281ba08611907e96a6a7e740684da9 | |
parent | 6a7a01ec8b7495497d3d0cd28234cc68c36b6d61 (diff) |
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
-rw-r--r-- | sys/arm64/arm64/gicv3_its.c | 10 |
1 files 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); |