From nobody Thu Nov 19 16:06:52 2026 X-Original-To: dev-commits-src-all@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 4jVjyj1zsDz71Kbl for ; Thu, 19 Nov 2026 16:06:53 +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) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jVjyh6mP0z3Pbg for ; Thu, 19 Nov 2026 16:06:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1795104413; 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=m+lm1GPH5sxLJ2LXOnN4aX+r7SEwiG8X8GDxIN0ReVQ=; b=KEHuh2qMEkoW/ADEFgxZdHwyjbdQ01J7jSF7Kt5VwVxjila6vo85jrXFpT2PxADaiAXGyI KrdDaxFDDYPYl7mnrSs4jTRHnxtnNNhVfIWHgpEm2YeORkPkjMjMYDIuniHNbrzJZsIBLP Ty4RZzI9rd9QWzTVJoju95FtQZIbBV5vXlvzeMu1fyOP5fYmuyje2u7cXohBgCjl0wAVft B78/jFxK/eQ+V1B93E+PWNUxEs8Jx1je0GETtwkXnTEAhMgyHT6CohuHwGj11zrEPLlXo4 P/hlOUbxzpjcQJHwHn7Nz2rhwNp9vNxSfnUpb6Wwtd6BKxkITRP064XvVG7lCg== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1795104413; b=DR2VfZbdJ9rITDZeV1EqyTr4uslnDawOB4st0htRcCYnY3bbJcKQLwVuq2o0s2CYF6DwFg luxsi86HUTwkHKYYYf1wR95Xr73OkHJoinv+0BqFfvCCJhHF4WHz1bNj2jOinx+Ec7o7DD noxv81aEAid+j/jN1JApoDqIqwiAhUWvDHMXhzL4cdQfXh+hHrV//4MSqmQqzaWE/3SQoJ PH9HqDhKIfFoLnAkmmmM/olmesqoqVEO23pD1yCAuDoSatD/CMnCaBeni3r3OCMh3lSMU7 mJtLf/ShyJhjGHFvuNomb45LR1X5igW0B5GbYBihFP215V7gX8d6MvzHawaQeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1795104413; 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=m+lm1GPH5sxLJ2LXOnN4aX+r7SEwiG8X8GDxIN0ReVQ=; b=icSiur/hC6c1dJT05LNhy8alpjhtA7nGURK6LAYPnLfeN+u8haLCWyubqcbMV84XHk0Yyp wTHDcRa/MVD88LIy9xVf76LZVlsoZvt+8Gwio5YsrH8gmCSL8aLFhHb9UgxOLuweUZVvJv fEJqXjl1s91EfztUyWtgDME9dJzY4SohR8zbzOYjLWbcDtu4meFTQXosZaK/3dnVs+u3hB GyEQ4UXVi+gRUyIMNX1ROEAnKiuKn4nF/BPRE2i9PeOVWFCtePaktiZLh+TUR62KqQmc4y y88xRm5j3CTJIt7Ab4yT2/JnlH5AxO76+0Ss/xTnyYaFqm4PjBLmaJFACzmQaQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jVjyh6M8bz16sb for ; Thu, 19 Nov 2026 16:06:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 107fc by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 19 Nov 2026 16:06:52 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: d646fb91b263 - stable/14 - acpi_pci_link: Handle IRQ values > 255 List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: d646fb91b263153af68b9572489a25ce90436803 Auto-Submitted: auto-generated Date: Thu, 19 Nov 2026 16:06:52 +0000 Message-Id: <6aff1e9c.107fc.3c212c7a@gitrepo.freebsd.org> The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=d646fb91b263153af68b9572489a25ce90436803 commit d646fb91b263153af68b9572489a25ce90436803 Author: John Baldwin AuthorDate: 2026-11-14 16:02:38 +0000 Commit: John Baldwin CommitDate: 2026-11-19 15:01:49 +0000 acpi_pci_link: Handle IRQ values > 255 Some systems use a stub PCI link device for hardwired interrupts instead of static _PRT entries. These link devices can use an IRQ > 255. The current driver was designed to handle PCI link devices on x86 used for legacy INTx IRQs which were < 255. These changes handle larger IRQ values while making a few tradeoffs. - Expand most IRQ fields from 8 bits to 32-bits. The BIOS IRQ (read from the PCIR_INTLINE config register which is an 8-bit register) remains 8 bits. - Add a wrapper API for managing interrupt weights and avoid tracking weights for IRQs > 255 and instead report a constant weight of 0 for IRQs > 255. PR: 300476 Reported by: Aviv Bakal Tested by: cperciva (cherry picked from commit 931a5d8866bcd7163272f6a9a65ed87fe481763b) --- sys/dev/acpica/acpi_pci_link.c | 59 +++++++++++++++++++++++++++++++----------- 1 file changed, 44 insertions(+), 15 deletions(-) diff --git a/sys/dev/acpica/acpi_pci_link.c b/sys/dev/acpica/acpi_pci_link.c index b10f9614c5bc..0848b7fb5a81 100644 --- a/sys/dev/acpica/acpi_pci_link.c +++ b/sys/dev/acpica/acpi_pci_link.c @@ -49,6 +49,15 @@ ACPI_MODULE_NAME("PCI_LINK") ACPI_SERIAL_DECL(pci_link, "ACPI PCI link"); +/* + * Link devices are (mostly) used for legacy INTx interrupts on x86 + * systems. The PCI config register for INTx interrupts is only an + * 8-bit register. However, some non-x86 systems also use link + * devices (even for hardwired interrupts that can't be routed) with + * GSI values above 255. + * + * NB: Due to API constraints a GSI value of exactly 255 can't be used. + */ #define NUM_ISA_INTERRUPTS 16 #define NUM_ACPI_INTERRUPTS 256 @@ -95,12 +104,12 @@ struct acpi_pci_link_softc { struct link { struct acpi_pci_link_softc *l_sc; uint8_t l_bios_irq; - uint8_t l_irq; - uint8_t l_initial_irq; + uint32_t l_irq; + uint32_t l_initial_irq; UINT32 l_crs_type; int l_res_index; - int l_num_irqs; - int *l_irqs; + u_int l_num_irqs; + uint32_t *l_irqs; int l_references; bool l_routed:1; bool l_isa_irq:1; @@ -126,6 +135,26 @@ static int pci_link_bios_isa_irqs; static char *pci_link_ids[] = { "PNP0C0F", NULL }; +/* + * For traditional INTx IRQ values, this driver maintains a set of + * weights to distribute IRQs more evenly. For values > 255, just + * punt and treat the weights as always being zero. + */ +static void +acpi_pci_link_add_weight(u_int irq, int refs) +{ + if (irq < nitems(pci_link_interrupt_weights)) + pci_link_interrupt_weights[irq] += refs; +} + +static int +acpi_pci_link_interrupt_weight(u_int irq) +{ + if (irq < nitems(pci_link_interrupt_weights)) + return (pci_link_interrupt_weights[irq]); + return (0); +} + /* * Fetch the short name associated with an ACPI handle and save it in the * passed in buffer. @@ -385,7 +414,7 @@ link_add_prs(ACPI_RESOURCE *res, void *context) } static bool -link_valid_irq(struct link *link, int irq) +link_valid_irq(struct link *link, u_int irq) { int i; @@ -423,17 +452,17 @@ acpi_pci_link_dump(struct acpi_pci_link_softc *sc, int header, const char *tag) if (header) { snprintf(buf, sizeof(buf), "%s:", device_get_nameunit(sc->pl_dev)); - printf("%-16.16s Index IRQ Rtd Ref IRQs\n", buf); + printf("%-16.16s Index IRQ Rtd Ref IRQs\n", buf); } for (i = 0; i < sc->pl_num_links; i++) { link = &sc->pl_links[i]; - printf(" %-14.14s %5d %3d %c %3d ", i == 0 ? tag : "", i, + printf(" %-14.14s %5d %5u %c %3d ", i == 0 ? tag : "", i, link->l_irq, link->l_routed ? 'Y' : 'N', link->l_references); if (link->l_num_irqs == 0) printf(" none"); else for (j = 0; j < link->l_num_irqs; j++) - printf(" %d", link->l_irqs[j]); + printf(" %u", link->l_irqs[j]); printf("\n"); } } @@ -664,7 +693,7 @@ acpi_pci_link_add_reference(device_t dev, int index, device_t pcib, int slot, } link->l_references++; if (link->l_routed) - pci_link_interrupt_weights[link->l_irq]++; + acpi_pci_link_add_weight(link->l_irq, 1); /* * The BIOS only routes interrupts via ISA IRQs using the ATPICs @@ -907,8 +936,8 @@ acpi_pci_link_route_irqs(device_t dev) PCI_INTERRUPT_VALID(link->l_irq)) { link->l_routed = true; acpi_config_intr(dev, resource); - pci_link_interrupt_weights[link->l_irq] += - link->l_references; + acpi_pci_link_add_weight(link->l_irq, + link->l_references); } link++; i++; @@ -955,11 +984,11 @@ acpi_pci_link_resume(device_t dev) /* * Pick an IRQ to use for this unrouted link. */ -static uint8_t +static u_int acpi_pci_link_choose_irq(device_t dev, struct link *link) { char tunable_buffer[64], link_name[5]; - u_int8_t best_irq, pos_irq; + u_int best_irq, pos_irq; int best_weight, pos_weight, i; KASSERT(!link->l_routed, ("%s: link already routed", __func__)); @@ -1017,7 +1046,7 @@ acpi_pci_link_choose_irq(device_t dev, struct link *link) if (pos_irq < NUM_ISA_INTERRUPTS && (pci_link_bios_isa_irqs & 1 << pos_irq) == 0) continue; - pos_weight = pci_link_interrupt_weights[pos_irq]; + pos_weight = acpi_pci_link_interrupt_weight(pos_irq); if (pos_weight < best_weight) { best_weight = pos_weight; best_irq = pos_irq; @@ -1030,7 +1059,7 @@ acpi_pci_link_choose_irq(device_t dev, struct link *link) */ if (link->l_isa_irq) { pos_irq = AcpiGbl_FADT.SciInterrupt; - pos_weight = pci_link_interrupt_weights[pos_irq]; + pos_weight = acpi_pci_link_interrupt_weight(pos_irq); if (pos_weight < best_weight) { best_weight = pos_weight; best_irq = pos_irq;