Skip to content

[Deepin-Kernel-SIG] [linux 6.6-y] [Deepin] PCI: Add ARCH_PHYTIUM check for phytium root and switch ports#1550

Open
opsiff wants to merge 1 commit intodeepin-community:linux-6.6.yfrom
opsiff:linux-6.6.y-2026-03-12-phytium-config-pci
Open

[Deepin-Kernel-SIG] [linux 6.6-y] [Deepin] PCI: Add ARCH_PHYTIUM check for phytium root and switch ports#1550
opsiff wants to merge 1 commit intodeepin-community:linux-6.6.yfrom
opsiff:linux-6.6.y-2026-03-12-phytium-config-pci

Conversation

@opsiff
Copy link
Member

@opsiff opsiff commented Mar 12, 2026

deepin inclusion
category: bugfix

To prevent affect other platform or use a runtime check, use ARCH_PHYTIUM to limit the quirk in our arm64 platform kernel.

Fixes: 66d2694 ("PCI: Add ACS quirk for phytium root and switch ports")

Summary by Sourcery

Bug Fixes:

  • Prevent unintended impact of the Phytium PCI ACS quirk on non-Phytium platforms by guarding it with an ARCH_PHYTIUM configuration check.

deepin inclusion
category: bugfix

To prevent affect other platform or use a runtime check,
use ARCH_PHYTIUM  to limit the quirk in our arm64 platform kernel.

Fixes: 66d2694 ("PCI: Add ACS quirk for phytium root and switch ports")
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
@deepin-ci-robot deepin-ci-robot requested a review from BLumia March 12, 2026 09:09
@sourcery-ai
Copy link

sourcery-ai bot commented Mar 12, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Scopes existing PCI ACS quirks for PLX and Cadence devices to Phytium architectures only, avoiding unintended impact on non-Phytium platforms while preserving the Phytium-specific behavior.

Class diagram for pci_dev_acs_enabled entries and quirk function

classDiagram
  class pci_dev_acs_enabled {
    int vendor_id
    int device_id
    void (*quirk_fn)(struct pci_dev *dev)
  }

  class pci_quirk_xgene_acs {
    +void pci_quirk_xgene_acs(struct pci_dev *dev)
  }

  class PCI_VENDOR_ID_PLX {
    <<constant>>
    +int value
  }

  class PCI_VENDOR_ID_CDNS {
    <<constant>>
    +int value
  }

  class PCI_VENDOR_ID_PHYTIUM {
    <<constant>>
    +int value
  }

  pci_dev_acs_enabled "*" --> "1" pci_quirk_xgene_acs : uses_quirk_fn
  pci_dev_acs_enabled --> PCI_VENDOR_ID_PLX : matches_vendor
  pci_dev_acs_enabled --> PCI_VENDOR_ID_CDNS : matches_vendor
  pci_dev_acs_enabled --> PCI_VENDOR_ID_PHYTIUM : matches_vendor

  class CONFIG_ARCH_PHYTIUM {
    <<config_option>>
    +bool enabled
  }

  CONFIG_ARCH_PHYTIUM --> pci_dev_acs_enabled : controls_presence_of_PLX_and_CDNS_entries
Loading

Flow diagram for PCI ACS quirk usage under ARCH_PHYTIUM

flowchart TD
  A[Kernel_config] --> B{CONFIG_ARCH_PHYTIUM}
  B -- enabled --> C[Compile Phytium_specific_ACS_quirks]
  B -- disabled --> D[Exclude Phytium_specific_ACS_quirks]

  C --> E[acs_dev_table]
  E --> F[Entry: vendor_id=PCI_VENDOR_ID_PLX\n device_id=PCI_ANY_ID\n quirk_fn=pci_quirk_xgene_acs]
  E --> G[Entry: vendor_id=PCI_VENDOR_ID_CDNS\n device_id=PCI_ANY_ID\n quirk_fn=pci_quirk_xgene_acs]
  E --> H[Entry: vendor_id=PCI_VENDOR_ID_PHYTIUM\n device_id=PCI_ANY_ID\n quirk_fn=pci_quirk_xgene_acs]

  D --> I[acs_dev_table]
  I --> J[Entry: vendor_id=PCI_VENDOR_ID_PHYTIUM\n device_id=PCI_ANY_ID\n quirk_fn=pci_quirk_xgene_acs]

  K[PCI_enumeration_runtime] --> L[Check acs_dev_table for matching vendor/device]
  L --> M[Apply pci_quirk_xgene_acs when matching entry found]
Loading

File-Level Changes

Change Details Files
Gate PLX and Cadence PCI ACS quirks behind ARCH_PHYTIUM configuration
  • Wrap the pci_quirk_xgene_acs entries for PCI_VENDOR_ID_PLX and PCI_VENDOR_ID_CDNS in a CONFIG_ARCH_PHYTIUM preprocessor conditional
  • Ensure the Phytium vendor (PCI_VENDOR_ID_PHYTIUM) quirk entry remains always enabled and unaffected by the new conditional
drivers/pci/quirks.c

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

[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 ask for approval from opsiff. 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

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • Instead of using CONFIG_ARCH_PHYTIUM directly in generic PCI quirk code, consider introducing a dedicated Kconfig option (e.g., CONFIG_PCI_PHYTIUM_ACS_QUIRK) selected by ARCH_PHYTIUM so the quirk remains decoupled from a specific architecture symbol and easier to control or reuse.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Instead of using CONFIG_ARCH_PHYTIUM directly in generic PCI quirk code, consider introducing a dedicated Kconfig option (e.g., CONFIG_PCI_PHYTIUM_ACS_QUIRK) selected by ARCH_PHYTIUM so the quirk remains decoupled from a specific architecture symbol and easier to control or reuse.

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.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Guards overly broad PCI ACS quirk entries for PLX and Cadence vendor IDs behind CONFIG_ARCH_PHYTIUM to prevent them from affecting non-Phytium platforms, while keeping the Phytium-specific vendor ID entry unconditionally active.

Changes:

  • Wrapped PLX and CDNS ACS quirk entries in #ifdef CONFIG_ARCH_PHYTIUM to limit their scope to Phytium platform kernels.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

{ PCI_VENDOR_ID_MUCSE, 0x1061, pci_quirk_mf_endpoint_acs },
{ PCI_VENDOR_ID_MUCSE, 0x1c61, pci_quirk_mf_endpoint_acs },
/* Phytium Technology */
#ifdef CONFIG_ARCH_PHYTIUM
Copy link
Member

Choose a reason for hiding this comment

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

According to the original patch submission, the incompatibility here is caused by Phytium bridge chips (for example, the x100).

Is simply isolating it with CONFIG_ARCH_PHYTIUM sufficient to cover all cases?

For example, bridge chips like the x100 might also be used on RISC‑V devices, in which case this workaround would not take effect.

Copy link
Member Author

Choose a reason for hiding this comment

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

According to the original patch submission, the incompatibility here is caused by Phytium bridge chips (for example, the x100).

Is simply isolating it with CONFIG_ARCH_PHYTIUM sufficient to cover all cases?

For example, bridge chips like the x100 might also be used on RISC‑V devices, in which case this workaround would not take effect.

这个是故意的 因为原始quirk依赖SMMU,如果其他架构需要应该重新添加
https://lore.kernel.org/all/20170720161905.24e300eb@ul30vt.home/
https://lore.kernel.org/all/1519183167-17716-1-git-send-email-fkan@apm.com/
https://lore.kernel.org/all/1501267843-8095-1-git-send-email-fkan@apm.com/

Copy link
Member

Choose a reason for hiding this comment

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

这个是故意的 因为原始quirk依赖SMMU,如果其他架构需要应该重新添加 https://lore.kernel.org/all/20170720161905.24e300eb@ul30vt.home/ https://lore.kernel.org/all/1519183167-17716-1-git-send-email-fkan@apm.com/ https://lore.kernel.org/all/1501267843-8095-1-git-send-email-fkan@apm.com/

Understood.
Please add the relevant explanation to the commit message — that will save future readers from asking the same question and make tracing the change easier.

#ifdef CONFIG_ARCH_PHYTIUM
{ PCI_VENDOR_ID_PLX, PCI_ANY_ID, pci_quirk_xgene_acs },
{ PCI_VENDOR_ID_CDNS, PCI_ANY_ID, pci_quirk_xgene_acs },
#endif
Copy link
Member

Choose a reason for hiding this comment

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

#endif /* CONFIG_ARCH_PHYTIUM */

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.

4 participants