From nobody Tue Nov 19 17:47:01 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 4XtBl95hf6z5fGBR; Tue, 19 Nov 2024 17:47:01 +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 4XtBl952N0z4R0L; Tue, 19 Nov 2024 17:47:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732038421; 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=yif/r19ieqKGQVmzQqvm1HtIW44sLIHmh84ehiCYNEY=; b=DM8kDXu4y84bSAm7V+XiOI05/zODkR3QbCwcjyiEYUHahcSWmKvkMAt3Ycl65VfM4XVLh7 THbQ8Hwq/6gXYoQpLLCHfLnuEaE+UhR4Xu9XLoesaJ8iHQA8mzQ4fUSQz4hT5UnudoY7gL Q4CtKJff49BcTyeyxWWDknw5uOzagDHiUvkmN7N+8Q6oHC5PxcQojtMtlQV8IZdExBWM1k MmqOMGgohwj3Yto19wZP6DKx1A4KCrRJSOHx4V2oG/0cogwNE7qxXZMoOWnNPGdI4j/mNK /7GU4Mzd8C9Mh8zgSRWwWRGCLU/FV+hrwKt8jjXL5qrH9DyW49qJHkFbna0EjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732038421; 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=yif/r19ieqKGQVmzQqvm1HtIW44sLIHmh84ehiCYNEY=; b=Vbgm2O77vS14v0EQyVpMBFqvRN+BsfjlxZXhu7cWiCe0BUjiU44gTi25FBFl+RE6H204OC BSMVEg3K34mPezQRX5gEbuepp4E6Z2qBcwEEAcg284LX4X+vkCFhKlvaKwZ48JN6ggDGcK 14KaorYKwJD3lBYaDkCNDuAzg3EHYCcLNGUshy+cgrnUOoCGd45H2+EGvf/qyPZkru7OTz +6h32+EeP+aZkU5dAKy4P+/ZD9JEJuUrX/vGUCX6ZQWdVEVJKAPl9YC6ATjOi70kxaamGv YzyMM0WQQVXrPjSEHMt3Y2xpbzxCLZWsXW7BoEf/YUaGWtEEs97Xstet692Jfw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1732038421; a=rsa-sha256; cv=none; b=l/9BcTunQ3G4HTyBO8inRtSeU4ptkl9/ArUumegQcakcUG/zzQzUGDNXMi08XxfDSeX62w EeL6gABkS+g4JBrIuiD2pyvXcaDgCOKmO8UW+Ecj7f1aFZBwaDTSSiUyESsUEjoKDWTHOI j/40ThbX/AH7MLaBg2ZHxyqAkBq02UXWV2PF8xf3w64wgK8RuFq+B1u0ZNBLPZhDCqtxXP YnIhmbG+atbDaGTpWjceZdHuKMQ1I8ymEDvs4scy8xA2Lm17y9Wu5JYKHsdPJB3qQxDEzp fjds4Gy6E5PNLsgna48RPtZ7MwbymeOQ9kjSBQDQ+8IveuVUWh5RpZramLzsYA== 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 4XtBl94dGtzJlm; Tue, 19 Nov 2024 17:47:01 +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 4AJHl1nE000829; Tue, 19 Nov 2024 17:47:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4AJHl1q4000826; Tue, 19 Nov 2024 17:47:01 GMT (envelope-from git) Date: Tue, 19 Nov 2024 17:47:01 GMT Message-Id: <202411191747.4AJHl1q4000826@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: a1330a71d20d - main - acpi: Handle multiple interrupts 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: a1330a71d20d862eb9d930d87245f23ee4853527 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=a1330a71d20d862eb9d930d87245f23ee4853527 commit a1330a71d20d862eb9d930d87245f23ee4853527 Author: Andrew Turner AuthorDate: 2024-11-18 15:29:42 +0000 Commit: Andrew Turner CommitDate: 2024-11-19 17:14:42 +0000 acpi: Handle multiple interrupts When multiple IRQs are specified in a single resource then we only check the first. Change this to check all interrupts for the value we expect to find. Without this we may still enable the interrupt, but it can have the wrong polatiry or trigger. This can cause an interrupt storm if the interrupt was configured with a level trigger when it should have been an edge. PR: 282241 Reported by: trasz Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D47487 --- sys/dev/acpica/acpi_resource.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/sys/dev/acpica/acpi_resource.c b/sys/dev/acpica/acpi_resource.c index 1257ed30cc65..8c5a3ed57f32 100644 --- a/sys/dev/acpica/acpi_resource.c +++ b/sys/dev/acpica/acpi_resource.c @@ -72,19 +72,33 @@ acpi_lookup_irq_handler(ACPI_RESOURCE *res, void *context) { struct lookup_irq_request *req; size_t len; - u_int irqnum, irq, trig, pol; + u_int irqnum, trig, pol; + bool found; + + found = false; + req = (struct lookup_irq_request *)context; switch (res->Type) { case ACPI_RESOURCE_TYPE_IRQ: irqnum = res->Data.Irq.InterruptCount; - irq = res->Data.Irq.Interrupts[0]; + for (int i = 0; i < irqnum; i++) { + if (res->Data.Irq.Interrupts[i] == req->irq) { + found = true; + break; + } + } len = ACPI_RS_SIZE(ACPI_RESOURCE_IRQ); trig = res->Data.Irq.Triggering; pol = res->Data.Irq.Polarity; break; case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: irqnum = res->Data.ExtendedIrq.InterruptCount; - irq = res->Data.ExtendedIrq.Interrupts[0]; + for (int i = 0; i < irqnum; i++) { + if (res->Data.ExtendedIrq.Interrupts[i] == req->irq) { + found = true; + break; + } + } len = ACPI_RS_SIZE(ACPI_RESOURCE_EXTENDED_IRQ); trig = res->Data.ExtendedIrq.Triggering; pol = res->Data.ExtendedIrq.Polarity; @@ -92,18 +106,13 @@ acpi_lookup_irq_handler(ACPI_RESOURCE *res, void *context) default: return (AE_OK); } - if (irqnum != 1) + if (!found) return (AE_OK); - req = (struct lookup_irq_request *)context; if (req->checkrid) { if (req->counter != req->rid) { req->counter++; return (AE_OK); } - KASSERT(irq == req->irq, ("IRQ resources do not match")); - } else { - if (req->irq != irq) - return (AE_OK); } req->found = 1; req->pol = pol;