From nobody Thu Feb 02 16:48:25 2023 X-Original-To: dev-commits-src-main@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 4P74VL30f4z3kM4V; Thu, 2 Feb 2023 16:48:26 +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 4P74VL1zXkz3nVr; Thu, 2 Feb 2023 16:48:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675356506; 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=PZyyLv9BLmjGlG80/ghQs/L2chKc8q9Mcu83uJ/iBN4=; b=NOibg8mgMmo+HFRYa3jMda0UnrDtFzFCYQ6SwerA6NnxzuC4yGUmwsFZ9piN8RKmPjGAUd O5CZ7TI3aT+pOw15vbaGJUxmPOLftPh3AQGBIHN/0ltcrlvmUduM2O+sKY2uqsRS8gkAgI uJwlro15qyy1K/g40N/xfjrVG1wwHzjz0BcDwCSe/51da5nSh13QBA2Y2cMa7w8vbsu4KV dZqJJVi0UYRHU4pH1+hN3gKfxYIYmpaHXa0+QpwrMCKGa87xuRaQPPAsF7Kvyt76CM75Wt Z1Q5dijdFa0sZQHEMZ8VdBW1VgcyJcL/yNgotiDBb1cPvTMk/MhPBXOnOOmSOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675356506; 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=PZyyLv9BLmjGlG80/ghQs/L2chKc8q9Mcu83uJ/iBN4=; b=N84ytO1b9kDulRAU/wgkYUssfPysB2cxz7JQ5DOfEQJZ0SLrn29nJCaDjV2OHvXR4pFyu+ AkYs5I70eU7uGMJITIae8Jib0nKYMtzuq38QNzGItUGQlnK+t3dGZsQVaQyBBLpAGCTkHD IBYYkZ9WOvyCUIIsTxSbPs2khqlLrZAZVuRMh0i5DfXcomVKTPWZc41Y++svu6ogPJp1xK UtdJT16BFMkKFwoZNoGWHRhym9BE/6WsMfqKkQRHdNGmlqZfu9js+1uOGox4NwHJf1kyRa 26iI2BGESs1ULp2mDlRlmHhN6TxvsYRbXkkxODtMzt5ZhXLASCBUncmIXLMJFw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675356506; a=rsa-sha256; cv=none; b=PtG4+ubV4u1++peIRQaJuYQSeMyY57m/YyV7Tgxf1nWuAXwB0JSl9hpnvweIIl8mM6tR9a W8+xT3WKPxg+iUUf2xlK/i/JO5Nf2xHj5WSEIv/Vk3Fu7KsJ+5oJT2Uq3jGJbJ/2ALmBAU YI7n6kUJuO2nP9aevzRst2jfTtqy69QIS0LSlPhFRcHG79jd4S1Wb4vLiwJHy0tfeYrhBr mFrvT8wXMa9KkyKt50flZUa894lqR049jJjDPrpyMQI/LLfgK6F0/SBYnyxRzqK2cTAvDz 2jKE1RWGUOSiBi1LgEXCSOJAE4kExTYoty1mMA8DcxzmVyBl4AATTQBE1asWOQ== 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 4P74VL0gndz124W; Thu, 2 Feb 2023 16:48:26 +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 312GmP7E049700; Thu, 2 Feb 2023 16:48:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 312GmPHd049699; Thu, 2 Feb 2023 16:48:25 GMT (envelope-from git) Date: Thu, 2 Feb 2023 16:48:25 GMT Message-Id: <202302021648.312GmPHd049699@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 03d6e03851c6 - main - Check for the IORT before adding the ITS driver List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 03d6e03851c6e8068a07bcbfbd1bb619a8baa963 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=03d6e03851c6e8068a07bcbfbd1bb619a8baa963 commit 03d6e03851c6e8068a07bcbfbd1bb619a8baa963 Author: Andrew Turner AuthorDate: 2022-12-19 14:19:26 +0000 Commit: Andrew Turner 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); }