Skip to content

Msi affinity support qli2.0 - #897

Open
abhishek-6246 wants to merge 4 commits into
qualcomm-linux:qcom-6.18.yfrom
abhishek-6246:msi_affinity_support_qli2.0
Open

Msi affinity support qli2.0#897
abhishek-6246 wants to merge 4 commits into
qualcomm-linux:qcom-6.18.yfrom
abhishek-6246:msi_affinity_support_qli2.0

Conversation

@abhishek-6246

@abhishek-6246 abhishek-6246 commented Aug 4, 2026

Copy link
Copy Markdown

### MSI Affinity Support for DWC PCIe (backport)

Summary

Backports the upstream interrupt redirection infrastructure and enables CPU affinity control for MSI interrupts on DesignWare (DWC) PCIe controllers. On DWC, MSIs are demultiplexed from a single parent interrupt whose affinity cannot be changed, so per-MSI affinity was previously unavailable. This series adds generic genirq support to redirect a child interrupt's handler to run in IRQ-work context on a CPU within its affinity mask, and wires the DWC host driver up to use it.

https://patch.msgid.link/20251128212055.1409093-2-rrendec@redhat.com

https://patch.msgid.link/20251128212055.1409093-3-rrendec@redhat.com

https://patch.msgid.link/20251128212055.1409093-4-rrendec@redhat.com

https://patch.msgid.link/20260112211402.2927336-1-rrendec@redhat.com

Files changed

drivers/pci/controller/dwc/pcie-designware-host.c | 127 +++++++-------
drivers/pci/controller/dwc/pcie-designware.h | 7 +-
include/linux/irq.h | 10 +
include/linux/irqdesc.h | 17 +-
kernel/irq/chip.c | 24 +-
kernel/irq/irqdesc.c | 86 +++++++-
kernel/irq/manage.c | 15 +-
7 files changed, 206 insertions(+), 80 deletions(-)

Add infrastructure to redirect interrupt handler execution to a
different CPU when the current CPU is not part of the interrupt's CPU
affinity mask.

This is primarily aimed at (de)multiplexed interrupts, where the child
interrupt handler runs in the context of the parent interrupt handler,
and therefore CPU affinity control for the child interrupt is typically
not available.

With the new infrastructure, the child interrupt is allowed to freely
change its affinity setting, independently of the parent. If the
interrupt handler happens to be triggered on an "incompatible" CPU (a
CPU that's not part of the child interrupt's affinity mask), the handler
is redirected and runs in IRQ work context on a "compatible" CPU.

No functional change is being made to any existing irqchip driver, and
irqchip drivers must be explicitly modified to use the newly added
infrastructure to support interrupt redirection.

Originally-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Radu Rendec <rrendec@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/linux-pci/878qpg4o4t.ffs@tglx/
Link: https://patch.msgid.link/20251128212055.1409093-2-rrendec@redhat.com
(cherry picked from commit fcc1d0d)
Code cleanup with no functional changes. These changes were originally
made by Thomas Gleixner (see Link tag below) in a patch that was never
submitted as is. Other parts of that patch were eventually submitted as
commit 8e71711 ("PCI: dwc: Switch to msi_create_parent_irq_domain()")
and the remaining parts are the code cleanup changes:

    - Use guard()/scoped_guard() instead of open-coded lock/unlock.
    - Return void in a few functions whose return value is never used.
    - Simplify dw_handle_msi_irq() by using for_each_set_bit().

One notable deviation from the original patch is that it reverts back to a
simple 1 by 1 iteration over the controllers inside dw_handle_msi_irq.  The
reason is that with the original changes, the IRQ offset was calculated
incorrectly.

This prepares the ground for enabling MSI affinity support, which was
originally part of that same series that Thomas Gleixner prepared.

Originally-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Radu Rendec <rrendec@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/linux-pci/878qpg4o4t.ffs@tglx/
Link: https://patch.msgid.link/20251128212055.1409093-3-rrendec@redhat.com
(cherry picked from commit f187509)
Leverage the interrupt redirection infrastructure to enable CPU affinity
support for MSI interrupts. Since the parent interrupt affinity cannot
be changed, affinity control for the child interrupt (MSI) is achieved
by redirecting the handler to run in IRQ work context on the target CPU.

This patch was originally prepared by Thomas Gleixner (see Link tag below)
in a patch series that was never submitted as is, and only parts of that
series have made it upstream so far.

Originally-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Radu Rendec <rrendec@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/linux-pci/878qpg4o4t.ffs@tglx/
Link: https://patch.msgid.link/20251128212055.1409093-4-rrendec@redhat.com
(cherry picked from commit eaf290c)
For redirected interrupts, irq_chip_redirect_set_affinity() does not
update the effective affinity mask, which then triggers the warning in
irq_validate_effective_affinity(). Also, because the effective affinity
mask is empty, the cpumask_test_cpu(smp_processor_id(), m) condition in
demux_redirect_remote() is always false, and the interrupt is always
redirected, even if it's already running on the target CPU.

Set the effective affinity mask to be the same as the requested affinity
mask. It's worth noting that irq_do_set_affinity() filters out offline
CPUs before calling chip->irq_set_affinity() (unless `force` is set), so
the mask passed to irq_chip_redirect_set_affinity() is already filtered.

The solution is not ideal because it may lie about the effective
affinity of the demultiplexed ("child") interrupt. If the requested
affinity mask includes multiple CPUs, the effective affinity, in
reality, is the intersection between the requested mask and the
demultiplexing ("parent") interrupt's effective affinity mask, plus
the first CPU in the requested mask.

Accurately describing the effective affinity of the demultiplexed
interrupt is not trivial because it requires keeping track of the
demultiplexing interrupt's effective affinity. That is tricky in the
context of CPU hot(un)plugging, where interrupt migration ordering is
not guaranteed. The solution in the initial version of the fixed patch,
which stored the first CPU of the demultiplexing interrupt's effective
affinity in the `target_cpu` field, has its own drawbacks and
limitations.

Fixes: fcc1d0d ("genirq: Add interrupt redirection infrastructure")
Reported-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Radu Rendec <rrendec@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Link: https://patch.msgid.link/20260112211402.2927336-1-rrendec@redhat.com
Closes: https://lore.kernel.org/all/44509520-f29b-4b8a-8986-5eae3e022eb7@nvidia.com/
(cherry picked from commit df43971)
@qswat-orbit-external

Copy link
Copy Markdown

Merge Check Failed: No CR Numbers Found

Error: No Change Request numbers were found.

Please add Change Request numbers to your pull request description in the format CRs-Fixed: 12345 or link GitHub issues that are associated with Change Requests.

@abhishek-6246
abhishek-6246 marked this pull request as ready for review August 4, 2026 10:06
@abhishek-6246
abhishek-6246 marked this pull request as draft August 4, 2026 10:07
@qswat-orbit-external

Copy link
Copy Markdown

Merge Check Failed: No CR Numbers Found

Error: No Change Request numbers were found.

Please add Change Request numbers to your pull request description in the format CRs-Fixed: 12345 or link GitHub issues that are associated with Change Requests.

@qlijarvis

Copy link
Copy Markdown

PR #897 — validate-patch

PR: #897

Verdict Issues Detailed Report
0 Full report

Final Summary

  1. Lore link present: Yes - but INCORRECT for commits 1-3 (points to discussion thread instead of patch series)
  2. Lore link matches PR commits: Cannot verify - wrong lore link fetched; correct patch series not available for comparison
  3. Upstream patch status: ✅ Upstreamed - all commits have cherry-pick notes with upstream commit SHAs (fcc1d0d, f187509, eaf290c, df43971)
  4. PR present in qcom-next/topics: Yes - all 4 commit(s) are present in qcom-next or topics
Verdict: ❌ — click to expand

🔍 Patch Validation

PR: #897 - genirq/PCI: Add interrupt redirection infrastructure and enable MSI affinity support
Upstream commits: Multiple (see details below)
Verdict: ❌ FAIL

Critical Issue: Incorrect Lore Links

All four commits in this PR contain an incorrect lore.kernel.org link:

Link: https://lore.kernel.org/linux-pci/878qpg4o4t.ffs@tglx/

This link points to Thomas Gleixner's reply in a discussion thread, not to the actual patch series. The lore mbox evidence confirms this is a discussion where Thomas mentioned providing patches at https://tglx.de/~tglx/patches.tar, but it is not the canonical upstream posting.

Correct Lore Links

The commits should reference the actual Radu Rendec patch series:

Commit Current (Wrong) Link Correct Link
1/4 genirq: Add interrupt redirection infrastructure 878qpg4o4t.ffs@tglx https://patch.msgid.link/20251128212055.1409093-2-rrendec@redhat.com
2/4 PCI: dwc: Code cleanup 878qpg4o4t.ffs@tglx https://patch.msgid.link/20251128212055.1409093-3-rrendec@redhat.com
3/4 PCI: dwc: Enable MSI affinity support 878qpg4o4t.ffs@tglx https://patch.msgid.link/20251128212055.1409093-4-rrendec@redhat.com
4/4 genirq: Update effective affinity for redirected (no wrong link) https://patch.msgid.link/20260112211402.2927336-1-rrendec@redhat.com

Note: Each commit already has the correct patch.msgid.link as a second Link: line, but the first Link: pointing to the discussion thread should be removed.

Commit Message Analysis

Check Status Note
Subject matches upstream Subjects appear correct based on patch.msgid.link references
Body preserves rationale ⚠️ Cannot verify without fetching correct lore patches
Authorship preserved From: Radu Rendec <rrendec@redhat.com> is correct
Cherry-pick notes present All commits have (cherry picked from commit <sha>)
Originally-by usage ⚠️ Commits 1-3 use Originally-by: Thomas Gleixner - verify this is appropriate

Issues

  1. Wrong lore link (CRITICAL): The first Link: line in commits 1-3 points to a discussion thread (878qpg4o4t.ffs@tglx) instead of the actual patch posting. This violates kernel commit message conventions where Link: should point to the canonical patch posting.

  2. Originally-by tag usage: Commits 1-3 use Originally-by: Thomas Gleixner <tglx@linutronix.de>. This tag is non-standard in the kernel. The discussion thread suggests Thomas provided an initial implementation, but the proper way to attribute this is:

    • If Thomas is a co-author: use Co-developed-by: + his Signed-off-by:
    • If he's the original author: he should be in From:/Author:
    • If he just provided the idea/design: mention in commit body, not as a trailer
  3. Cannot verify diff faithfulness: Without the correct lore patches fetched, I cannot verify that the PR diffs match the upstream patches exactly.

Verdict

FAIL - The PR contains incorrect lore.kernel.org links that point to a discussion thread rather than the actual patch series. This must be corrected before merge.

Recommendation

Required changes:

  1. Remove the incorrect Link: line from commits 1-3:

    Link: https://lore.kernel.org/linux-pci/878qpg4o4t.ffs@tglx/
    
  2. Verify Originally-by usage: Check with the subsystem maintainer whether Originally-by: is acceptable, or replace with standard Co-developed-by: if Thomas Gleixner co-authored these patches.

  3. Keep the correct links: The patch.msgid.link URLs are correct and should remain.

After fixing, the Link: section should look like:

Link: https://patch.msgid.link/20251128212055.1409093-2-rrendec@redhat.com
(cherry picked from commit fcc1d0dabdb65ca069f77e5b76d3b20277be4a15)

Final Summary

  1. Lore link present: Yes - but INCORRECT for commits 1-3 (points to discussion thread instead of patch series)
  2. Lore link matches PR commits: Cannot verify - wrong lore link fetched; correct patch series not available for comparison
  3. Upstream patch status: ✅ Upstreamed - all commits have cherry-pick notes with upstream commit SHAs (fcc1d0d, f187509, eaf290c, df43971)
  4. PR present in qcom-next/topics: Yes - all 4 commits present in qcom-next (per integration_presence_report.md)

Deterministic Integration Presence

Integration Presence Report

This report is generated by Jarvis before validate-patch runs.
It is the authoritative source for whether PR changes are already present
in qcom-next or in the kernel topic branches.

Kernel repo: /local/mnt/workspace/sgaud/Qgenie/image_pipeline/kernel
qcom-next ref: 8d5dbc1b17adf8fe86a41adcda686785e73f5414
topics remote: topics -> https://github.com/qualcomm-linux/kernel-topics
topics fetch: fetched

Commit Subject qcom-next topics Final
1/4 [PATCH 1/4] genirq: Add interrupt redirection infrastructure partial - subject or partial tree evidence found, but full change was not verified present - all checked added lines are present present
2/4 [PATCH 2/4] PCI: dwc: Code cleanup present - exact patch-id match at f187509 skipped - not checked because qcom-next already contains the change present
3/4 [PATCH 3/4] PCI: dwc: Enable MSI affinity support present - exact patch-id match at eaf290c skipped - not checked because qcom-next already contains the change present
4/4 [PATCH 4/4] genirq: Update effective affinity for redirected present - exact patch-id match at df43971 skipped - not checked because qcom-next already contains the change present

Final Status

overall_status: PASS
present_commits: 4/4
partial_commits: 0/4
missing_commits: 0/4
topics_checked_for_commits: 1/4
final_summary: PR present in qcom-next/topics: Yes - all 4 commit(s) are present in qcom-next or topics

@qlijarvis

Copy link
Copy Markdown

PR #897 — checker-log-analyzer

PR: #897
Checker run: https://github.com/qualcomm-linux/kernel-config/actions/runs/30898386494

Checker Result Summary
Checker Result Summary
checkpatch 4 commits with warnings (non-standard signature, unknown commit ID, missing Closes:)
dt-binding-check ⏭️ No DT binding changes
dtb-check ⏭️ No devicetree changes
sparse-check Passed (build errors are pre-existing tree issues)
check-uapi-headers Passed
check-patch-compliance All 4 commits missing required prefix tags
tag-check All 4 commits missing required prefix tags

Detailed report: Full report

Checker analysis — click to expand

🤖 CI Checker Analysis (checker-log-analyzer)

PR: #897 - genirq and PCI: dwc MSI affinity support patches
Source: https://github.com/qualcomm-linux/kernel-config/actions/runs/30898386494

Checker Result Summary
checkpatch 4 commits with warnings (non-standard signature, unknown commit ID, missing Closes:)
dt-binding-check ⏭️ No DT binding changes
dtb-check ⏭️ No devicetree changes
sparse-check Passed (build errors are pre-existing tree issues)
check-uapi-headers Passed
check-patch-compliance All 4 commits missing required prefix tags
tag-check All 4 commits missing required prefix tags

❌ checkpatch

Root cause: Multiple style issues across 4 commits including non-standard signature tags, unknown commit references, and missing Closes: trailer.

Failure details:

Commit 1: 9577ab93a260 ("genirq: Add interrupt redirection infrastructure")

WARNING: Non-standard signature: Originally-by:
#24: 
Originally-by: Thomas Gleixner <tglx@linutronix.de>

total: 0 errors, 1 warnings, 0 checks, 255 lines checked

Commit 2: 7466bfc33d8f ("PCI: dwc: Code cleanup")

WARNING: Non-standard signature: Originally-by:
#24: 
Originally-by: Thomas Gleixner <tglx@linutronix.de>

total: 0 errors, 1 warnings, 0 checks, 197 lines checked

Commit 3: 553c3c38fabd ("PCI: dwc: Enable MSI affinity support")

WARNING: Non-standard signature: Originally-by:
#15: 
Originally-by: Thomas Gleixner <tglx@linutronix.de>

total: 0 errors, 1 warnings, 0 checks, 63 lines checked

Commit 4: 7869347dcf9e ("genirq: Update effective affinity for redirected interrupts")

WARNING: Unknown commit id 'fcc1d0dabdb6', maybe rebased or not pulled?
#34: 
Fixes: fcc1d0dabdb6 ("genirq: Add interrupt redirection infrastructure")

WARNING: Reported-by: should be immediately followed by Closes: with a URL to the report
#35: 
Reported-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Radu Rendec <rrendec@redhat.com>

total: 0 errors, 2 warnings, 0 checks, 8 lines checked

Fix:

  1. Originally-by: warnings (commits 1-3): The Originally-by: tag is non-standard. However, these are cherry-picked upstream commits that already have this tag in mainline. Since the commits are verbatim backports, this warning can be accepted as-is — modifying the commit message would make it differ from upstream.

  2. Unknown commit ID warning (commit 4): The Fixes: tag references commit fcc1d0dabdb6, which is the upstream SHA for commit 1 in this series. In the local tree, commit 1 has SHA 9577ab93a260. This is expected for cherry-picks. Action: Update the Fixes: tag to reference the local SHA:

    Fixes: 9577ab93a260 ("genirq: Add interrupt redirection infrastructure")
    
  3. Missing Closes: warning (commit 4): The commit has Reported-by: but checkpatch expects it to be immediately followed by Closes:. The upstream commit already has Closes: at the end. Action: Move the Closes: line to immediately follow Reported-by::

    Reported-by: Jon Hunter <jonathanh@nvidia.com>
    Closes: https://lore.kernel.org/all/44509520-f29b-4b8a-8986-5eae3e022eb7@nvidia.com/
    Signed-off-by: Radu Rendec <rrendec@redhat.com>
    

Reproduce locally:

./scripts/checkpatch.pl --strict --ignore FILE_PATH_CHANGES --git 1bc9614caed6d787783330f1fbd09003ff6a9741..7869347dcf9ea3a50a1f49723749ea4e45b7bb12

❌ check-patch-compliance

Root cause: All 4 commits are missing required subject-line prefix tags (FROMLIST:, FROMGIT:, UPSTREAM:, BACKPORT:).

Failure details:

Checking commit: genirq: Add interrupt redirection infrastructure
Commit summary does not start with a required prefix

Checking commit: PCI: dwc: Code cleanup
Commit summary does not start with a required prefix

Checking commit: PCI: dwc: Enable MSI affinity support
Commit summary does not start with a required prefix

Checking commit: genirq: Update effective affinity for redirected interrupts
Commit summary does not start with a required prefix

Fix:

All 4 commits are cherry-picks from upstream mainline (indicated by cherry picked from commit lines). They should use the UPSTREAM: prefix:

git rebase -i <base_sha>
# For each commit, mark as 'edit', then:

# Commit 1:
git commit --amend -m "UPSTREAM: genirq: Add interrupt redirection infrastructure"

# Commit 2:
git commit --amend -m "UPSTREAM: PCI: dwc: Code cleanup"

# Commit 3:
git commit --amend -m "UPSTREAM: PCI: dwc: Enable MSI affinity support"

# Commit 4:
git commit --amend -m "UPSTREAM: genirq: Update effective affinity for redirected interrupts"

git rebase --continue

Note: When amending, preserve the full commit body including all trailers (Signed-off-by, Link, Closes, etc.).

Reproduce locally:

# The check-patch-compliance script validates prefix tags
# No direct reproduction command available outside CI

❌ tag-check

Root cause: All 4 commits are missing required subject-line prefix tags.

Failure details:

This check is mandatory for all branches except qcom-next and qcom-next-staging. Every commit must start with one of: FROMLIST:, FROMGIT:, UPSTREAM:, BACKPORT:, QCLINUX:, PENDING:, WORKAROUND:.

All 4 commits in this PR lack any prefix:

  • genirq: Add interrupt redirection infrastructure
  • PCI: dwc: Code cleanup
  • PCI: dwc: Enable MSI affinity support
  • genirq: Update effective affinity for redirected interrupts

Fix:

Same as check-patch-compliance fix above — add UPSTREAM: prefix to all 4 commit subjects since they are cherry-picks from mainline.


Verdict

3 blockers must be fixed before merge:

  1. Critical: Add UPSTREAM: prefix to all 4 commit subjects (required for both check-patch-compliance and tag-check)
  2. Important: Fix commit 4's Fixes: tag to reference local SHA 9577ab93a260 instead of upstream SHA fcc1d0dabdb6
  3. Important: Move Closes: line in commit 4 to immediately follow Reported-by:

The Originally-by: warnings can be accepted as-is since these are verbatim upstream backports.

@qswat-orbit-external

Copy link
Copy Markdown

Merge Check Failed: No CR Numbers Found

Error: No Change Request numbers were found.

Please add Change Request numbers to your pull request description in the format CRs-Fixed: 12345 or link GitHub issues that are associated with Change Requests.

2 similar comments
@qswat-orbit-external

Copy link
Copy Markdown

Merge Check Failed: No CR Numbers Found

Error: No Change Request numbers were found.

Please add Change Request numbers to your pull request description in the format CRs-Fixed: 12345 or link GitHub issues that are associated with Change Requests.

@qswat-orbit-external

Copy link
Copy Markdown

Merge Check Failed: No CR Numbers Found

Error: No Change Request numbers were found.

Please add Change Request numbers to your pull request description in the format CRs-Fixed: 12345 or link GitHub issues that are associated with Change Requests.

@abhishek-6246
abhishek-6246 marked this pull request as ready for review August 4, 2026 11:04
@qswat-orbit-external

Copy link
Copy Markdown

Merge Check Failed: No CR Numbers Found

Error: No Change Request numbers were found.

Please add Change Request numbers to your pull request description in the format CRs-Fixed: 12345 or link GitHub issues that are associated with Change Requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants