git: 03d6e03851c6 - main - Check for the IORT before adding the ITS driver
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 02 Feb 2023 16:48:25 UTC
The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=03d6e03851c6e8068a07bcbfbd1bb619a8baa963 commit 03d6e03851c6e8068a07bcbfbd1bb619a8baa963 Author: Andrew Turner <andrew@FreeBSD.org> AuthorDate: 2022-12-19 14:19:26 +0000 Commit: Andrew Turner <andrew@FreeBSD.org> CommitDate: 2023-02-02 16:43:15 +0000 Check for the IORT before adding the ITS driver Before adding the ITS interrupt controller driver to handle MSI/MSI-X interrupts check if it is present in the IO Remapping Table (IORT). If not don't attach as devices expect to use this table to find the correct MSI interrupt controller. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D37772 --- sys/arm64/arm64/gic_v3_acpi.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/sys/arm64/arm64/gic_v3_acpi.c b/sys/arm64/arm64/gic_v3_acpi.c index 38f8b310e055..090c61429441 100644 --- a/sys/arm64/arm64/gic_v3_acpi.c +++ b/sys/arm64/arm64/gic_v3_acpi.c @@ -1,5 +1,6 @@ /*- * Copyright (c) 2016 The FreeBSD Foundation + * Copyright (c) 2022 Arm Ltd * * This software was developed by Andrew Turner under * the sponsorship of the FreeBSD Foundation. @@ -393,23 +394,25 @@ gic_v3_add_children(ACPI_SUBTABLE_HEADER *entry, void *arg) dev = arg; sc = device_get_softc(dev); + di = malloc(sizeof(*di), M_GIC_V3, M_WAITOK | M_ZERO); + err = acpi_iort_its_lookup(gict->TranslationId, &xref, &pxm); + if (err != 0) { + free(di, M_GIC_V3); + return; + } + child = device_add_child(dev, "its", -1); - if (child == NULL) + if (child == NULL) { + free(di, M_GIC_V3); return; + } - di = malloc(sizeof(*di), M_GIC_V3, M_WAITOK | M_ZERO); + di->di_gic_dinfo.gic_domain = pxm; + di->di_gic_dinfo.msi_xref = xref; resource_list_init(&di->di_rl); resource_list_add(&di->di_rl, SYS_RES_MEMORY, 0, gict->BaseAddress, gict->BaseAddress + 128 * 1024 - 1, 128 * 1024); - err = acpi_iort_its_lookup(gict->TranslationId, &xref, &pxm); - if (err == 0) { - di->di_gic_dinfo.gic_domain = pxm; - di->di_gic_dinfo.msi_xref = xref; - } else { - di->di_gic_dinfo.gic_domain = -1; - di->di_gic_dinfo.msi_xref = ACPI_MSI_XREF; - } sc->gic_nchildren++; device_set_ivars(child, di); }