Skip to content

PCI/ACPI: Add stacked IRQ domain support to PCI Interrupt Link - #2119

Open
wangchenlu2236 wants to merge 1 commit into
deepin-community:linux-6.6.yfrom
wangchenlu2236:pci-6.6.y
Open

PCI/ACPI: Add stacked IRQ domain support to PCI Interrupt Link#2119
wangchenlu2236 wants to merge 1 commit into
deepin-community:linux-6.6.yfrom
wangchenlu2236:pci-6.6.y

Conversation

@wangchenlu2236

@wangchenlu2236 wangchenlu2236 commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

The ResourceSource field of an Extended Interrupt Descriptor was ignored when the driver is parsing _PRS method of PNP0C0F PCI Interrupt Link devices, which means PCI INTx would be always registered under the GSI domain. This patch introduces stacked IRQ domain support to PCI Interrupt Link devices for ACPI.

With this support, we can populate the ResourceSource field in _PRS method of PCI Interrupt Link devices to refer to a device object that describes an interrupt controller as the following examples:

Device (IXIU) {
...
}

Device(LINKA) {
Name(_HID, EISAID("PNP0C0F"))
Name(_PRS, ResourceTemplate(){
Interrupt(ResourceProducer, Level, ActiveHigh, Exclusive,
0, "\SB.IXIU") { 60 }
})
...
}

Summary by Sourcery

Enable PCI Interrupt Link devices to resolve and register PCI INTx interrupts through hierarchical ACPI IRQ domains.

New Features:

  • Add stacked IRQ domain support for ACPI PCI Interrupt Link devices by honoring interrupt resource sources from _PRS descriptors.

Bug Fixes:

  • Route PCI INTx interrupts through their referenced interrupt controller instead of always registering them in the GSI domain.

Enhancements:

  • Refactor ACPI IRQ registration to support explicit firmware nodes and preserve interrupt resource-source information across PCI link allocation and configuration.

The ResourceSource field of an Extended Interrupt Descriptor was ignored
when the driver is parsing _PRS method of PNP0C0F PCI Interrupt Link
devices, which means PCI INTx would be always registered under the GSI
domain. This patch introduces stacked IRQ domain support to PCI Interrupt
Link devices for ACPI.

With this support, we can populate the ResourceSource field in _PRS method
of PCI Interrupt Link devices to refer to a device object that describes
an interrupt controller as the following examples:

  Device (IXIU) {
    ...
  }

  Device(LINKA) {
    Name(_HID, EISAID("PNP0C0F"))
    Name(_PRS, ResourceTemplate(){
      Interrupt(ResourceProducer, Level, ActiveHigh, Exclusive,
                0, "\\SB.IXIU") { 60 }
    })
    ...
  }

Signed-off-by: Chen Baozi <chenbaozi@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Signed-off-by: Wang Chenlu <wangchenlu2236@phytium.com.cn>
@sourcery-ai

sourcery-ai Bot commented Sep 2, 2026

Copy link
Copy Markdown

Reviewer's Guide

The PR enables PCI Interrupt Link INTx interrupts to be mapped through the interrupt controller named by an Extended IRQ ResourceSource, while preserving GSI-domain behavior as a compatibility fallback through new fwnode-aware ACPI IRQ registration APIs.

Sequence diagram for PCI INTx ResourceSource IRQ mapping

sequenceDiagram
    participant PCI as PCI device
    participant PIRQ as ACPI PCI IRQ
    participant PciLink as PCI Interrupt Link
    participant ACPI as ACPI ResourceSource
    participant IRQ as IRQ domain

    PCI->>PIRQ: acpi_pci_irq_enable()
    PIRQ->>PciLink: acpi_pci_link_allocate_irq()
    PciLink->>ACPI: acpi_get_irq_source_fwhandle(resource_source, 0)
    ACPI-->>PciLink: interrupt-controller fwnode
    PciLink-->>PIRQ: GSI, trigger, polarity, rs_fwnode
    PIRQ->>IRQ: acpi_register_irq(dev, GSI, trigger, polarity, rs_fwnode)
    IRQ-->>PCI: Linux IRQ mapping
Loading

File-Level Changes

Change Details Files
Preserve and resolve ACPI Extended IRQ ResourceSource entries from PCI Interrupt Link _PRS data.
  • Store the resource-source index and duplicated source path while parsing possible IRQs.
  • Propagate the source descriptor when programming the selected link resource.
  • Expose the source fwnode to PCI IRQ setup after link allocation.
drivers/acpi/pci_link.c
include/acpi/acpi_drivers.h
Add fwnode-directed ACPI IRQ registration and use it for PCI INTx mappings.
  • Build IRQ firmware specifications against the supplied interrupt-controller fwnode.
  • Retain GSI-domain registration as the fallback when no generic ACPI GSI support is configured.
  • Register PCI link interrupts through the resolved ResourceSource domain.
drivers/acpi/irq.c
drivers/acpi/pci_irq.c
drivers/acpi/internal.h
Expose ACPI ResourceSource-to-fwnode resolution to the PCI IRQ path with configuration guards.
  • Make the resolver available outside its implementation file.
  • Provide a no-op inline fallback when generic ACPI GSI support is disabled.
drivers/acpi/irq.c
include/linux/acpi.h

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign avenger-285714 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@deepin-ci-robot

Copy link
Copy Markdown

Hi @wangchenlu2236. Thanks for your PR.

I'm waiting for a deepin-community member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

IRQ-domain selection, failure handling, teardown, and resource ownership contain correctness issues.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds hierarchical ACPI IRQ-domain support for PCI Interrupt Link devices.

Changes:

  • Preserves _PRS interrupt resource sources.
  • Registers PCI INTx through referenced IRQ domains.
  • Refactors GSI registration around explicit firmware nodes.
File summaries
File Description
include/linux/acpi.h Declares resource-source lookup.
include/acpi/acpi_drivers.h Extends link allocation API.
drivers/acpi/pci_link.c Preserves and resolves resource sources.
drivers/acpi/pci_irq.c Uses domain-aware IRQ registration.
drivers/acpi/irq.c Adds explicit-fwnode registration.
drivers/acpi/internal.h Declares the internal registration helper.
Review details

Suppressed comments (2)

drivers/acpi/pci_irq.c:457

  • This can create the mapping in the ResourceSource domain, but acpi_pci_irq_disable() still tears it down with acpi_unregister_gsi(gsi), which searches the GSI domain. A child-domain hwirq is not necessarily a GSI, so disable can leave the new mapping allocated or dispose a different GSI mapping; retain enough mapping information to dispose the IRQ in the same domain in which it was created.
	rc = acpi_register_irq(&dev->dev, gsi, triggering, polarity, rs_fwnode);

drivers/acpi/pci_link.c:151

  • The duplicated source string is owned by link, but both the attach-error path and acpi_pci_link_remove() free only link, leaking this allocation. Also handle allocation failure before leaving a nonzero string_length paired with a NULL pointer; add matching cleanup on every link destruction path or use an appropriate managed allocation.
				rs->string_ptr = kstrdup(p->resource_source.string_ptr,
							 GFP_KERNEL);
  • Files reviewed: 6/6 changed files
  • Comments generated: 4
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread drivers/acpi/irq.c
fwspec.param[1] = acpi_dev_get_irq_type(trigger, polarity);
fwspec.param_count = 2;

return irq_create_fwspec_mapping(&fwspec);
Comment thread drivers/acpi/pci_irq.c
}

rc = acpi_register_gsi(&dev->dev, gsi, triggering, polarity);
rc = acpi_register_irq(&dev->dev, gsi, triggering, polarity, rs_fwnode);
Comment thread drivers/acpi/pci_link.c
Comment on lines +147 to +151
if (p->resource_source.string_length) {
rs->index = p->resource_source.index;
rs->string_length = p->resource_source.string_length;
rs->string_ptr = kstrdup(p->resource_source.string_ptr,
GFP_KERNEL);
Comment thread drivers/acpi/pci_link.c
* are only for LoongArch. Therefore, passing any value makes no differences for us.
* Need some reconstruction for this function to meet the real semantic.
*/
*rs_fwnode = acpi_get_irq_source_fwhandle(&link->irq.resource_source, 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants