From nobody Tue Oct 29 10:34:43 2024 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 4Xd6834KCGz5bHdC; Tue, 29 Oct 2024 10:34:43 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Xd6833pdtz4rtB; Tue, 29 Oct 2024 10:34:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730198083; 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=HJdmK2LL//VoEDqejU8Y66cU/TLd4ma5gAyAp4f3dqg=; b=Xz3mQeOxUt9O04Toa4ebt5NWVyiRi5VRMPmJuRsoG23xrVxXCRkl/JwHD1seqvYL2ZQKu2 wazXq/23g0XnnY9gJ/r9LYMexyDQNqFbyE2hCkQW33lWL7UnsseD2zvqFHCTRIgIo0SQuS eMh78h1d8AOt2JBdGdpP+J9hXXJ7rOJ0sbIk8jTPRzE+/SX+xTbRpQm2nyIX3xv4zbMhl1 yp8hw/L5cJD2zKalviUcW2hCsLshNbB4O/IyhMYI8x05i+IKAD1YVcBTlJM1bc9wHZY41g mKuigH1GEr0mjEy5Vx/b6zRzHNKlTTViMApap2UNjoIuWyTmHqOYEb7r4uUv4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730198083; 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=HJdmK2LL//VoEDqejU8Y66cU/TLd4ma5gAyAp4f3dqg=; b=RT3Uc1QyGnSf3wXYtqLcoDm0n36hI+YqPwuMgtM6OM6ezrVfBGPpmampG6BJ1DnNueiJ0p UPVl+Qo1H/5uuculhDxJdDALcB0RXkZRb66YK46vQOgngnO4LUVR+Dyh9qZ/f9FTjkekzb u+w5tMZ9RkIWaVWyuh6rVDd/1vPSxYtJogtdU6DQVGDK5n4KPK+vUATo9srJCKgPdCmzU9 2c11lVZMJ/aqtYUUIE7vu/EdJVpd9l9KsI0OpjUWj7GpGqIxoroTvjgcqs9zECUGRLM9pV 27kL/h15Dd55vLG2wO5IaAUICACJ0nCQ6evAfAq1lG8l4FfCUBYoSIzklSuGBQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730198083; a=rsa-sha256; cv=none; b=ZaXA7hPWnuhhav1v7mCJY/mWy3VfFmGA3W6Rteo70zlS2qP6QihP9N0opOBDsb/B69dHA4 oYPT2vpNZz4Yw/paES4lH2pe74cFWsL0XIPWoT4FxyAV3o/8hNMG58KYEEmumGX5b8uZ3B n9yfXvOLpdCJvzZHlA3fcRiVQEVMq7EAaomrEFSdZLOtU/Evuq+CjP4NKR/paEZ49M1l++ lzvAUh3iKUsuqVRimzdksuyrcwwjmiD4Ko0Mheb3clqRiPcb/EBk3Cy9akqvId82mdHA/+ IYkTy1jRXFcjpmgzbR5sjwkg/v2RL0OPunYfPKJYN/C+IYA63sPkUtuNstxarQ== 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 4Xd6833QlHzKxX; Tue, 29 Oct 2024 10:34:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49TAYhqI001706; Tue, 29 Oct 2024 10:34:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49TAYhBH001703; Tue, 29 Oct 2024 10:34:43 GMT (envelope-from git) Date: Tue, 29 Oct 2024 10:34:43 GMT Message-Id: <202410291034.49TAYhBH001703@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: c85855a72db9 - main - bus: Activate INTRNG interrupts in common code 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-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: c85855a72db9f9d7b4326b676241e1dffabf0fae Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=c85855a72db9f9d7b4326b676241e1dffabf0fae commit c85855a72db9f9d7b4326b676241e1dffabf0fae Author: Andrew Turner AuthorDate: 2024-10-29 10:19:45 +0000 Commit: Andrew Turner CommitDate: 2024-10-29 10:31:37 +0000 bus: Activate INTRNG interrupts in common code We need to call into INTRNG to activate all interrupts on platforms that use it. Currently, interrupts are only activated in the nexus drivers for INTRNG platforms, but this does not handle other bus devices such as gpiobus that manage their own IRQ space. Reported by: cperciva Reviewed by: cperciva, jhb Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D47282 --- sys/kern/subr_bus.c | 47 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index eeba75ac574a..681971df4307 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -53,6 +53,9 @@ #include #include #include +#ifdef INTRNG +#include +#endif #include @@ -4364,17 +4367,26 @@ bus_generic_rman_activate_resource(device_t dev, device_t child, if (error != 0) return (error); - if ((rman_get_flags(r) & RF_UNMAPPED) == 0 && - (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT)) { - error = BUS_MAP_RESOURCE(dev, child, r, NULL, &map); - if (error != 0) { - rman_deactivate_resource(r); - return (error); - } + switch (rman_get_type(r)) { + case SYS_RES_IOPORT: + case SYS_RES_MEMORY: + if ((rman_get_flags(r) & RF_UNMAPPED) == 0) { + error = BUS_MAP_RESOURCE(dev, child, r, NULL, &map); + if (error != 0) + break; - rman_set_mapping(r, &map); + rman_set_mapping(r, &map); + } + break; +#ifdef INTRNG + case SYS_RES_IRQ: + error = intr_activate_irq(child, r); + break; +#endif } - return (0); + if (error != 0) + rman_deactivate_resource(r); + return (error); } /** @@ -4404,10 +4416,19 @@ bus_generic_rman_deactivate_resource(device_t dev, device_t child, if (error != 0) return (error); - if ((rman_get_flags(r) & RF_UNMAPPED) == 0 && - (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT)) { - rman_get_mapping(r, &map); - BUS_UNMAP_RESOURCE(dev, child, r, &map); + switch (type) { + case SYS_RES_IOPORT: + case SYS_RES_MEMORY: + if ((rman_get_flags(r) & RF_UNMAPPED) == 0) { + rman_get_mapping(r, &map); + BUS_UNMAP_RESOURCE(dev, child, r, &map); + } + break; +#ifdef INTRNG + case SYS_RES_IRQ: + intr_deactivate_irq(child, r); + break; +#endif } return (0); }