From: Hans Zhang <18255117159@163.com>
To: Niklas Schnelle <schnelle@linux.ibm.com>,
lpieralisi@kernel.org, kwilczynski@kernel.org,
bhelgaas@google.com, helgaas@kernel.org, jingoohan1@gmail.com,
mani@kernel.org
Cc: robh@kernel.org, ilpo.jarvinen@linux.intel.com,
gbayer@linux.ibm.com, lukas@wunner.de, arnd@kernel.org,
geert@linux-m68k.org, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v15 0/6] Refactor capability search into common macros
Date: Thu, 14 Aug 2025 22:51:18 +0800 [thread overview]
Message-ID: <215953a5-658d-4cb2-ab02-57be3ac72697@163.com> (raw)
In-Reply-To: <39e654cfcce848d57671cbd5d7038f2f9667789a.camel@linux.ibm.com>
On 2025/8/14 16:32, Niklas Schnelle wrote:
> On Wed, 2025-08-13 at 22:45 +0800, Hans Zhang wrote:
>> Dear Maintainers,
>>
>> This patch series addresses long-standing code duplication in PCI
>> capability discovery logic across the PCI core and controller drivers.
>> The existing implementation ties capability search to fully initialized
>> PCI device structures, limiting its usability during early controller
>> initialization phases where device/bus structures may not yet be
>> available.
>>
>> The primary goal is to decouple capability discovery from PCI device
>> dependencies by introducing a unified framework using config space
>> accessor-based macros. This enables:
>>
>> 1. Early Capability Discovery: Host controllers (e.g., Cadence, DWC)
>> can now perform capability searches during pre-initialization stages
>> using their native config accessors.
>>
>> 2. Code Consolidation: Common logic for standard and extended capability
>> searches is refactored into shared macros (`PCI_FIND_NEXT_CAP` and
>> `PCI_FIND_NEXT_EXT_CAP`), eliminating redundant implementations.
>>
>> 3. Safety and Maintainability: TTL checks are centralized within the
>> macros to prevent infinite loops, while hardcoded offsets in drivers
>> are replaced with dynamic discovery, reducing fragility.
>>
>> Key improvements include:
>> - Driver Conversions: DesignWare and Cadence drivers are migrated to
>> use the new macros, removing device-specific assumptions and ensuring
>> consistent error handling.
>>
>> - Enhanced Readability: Magic numbers are replaced with symbolic
>> constants, and config space accessors are standardized for clarity.
>>
>> - Backward Compatibility: Existing PCI core behavior remains unchanged.
>>
>> ---
>> Dear Niklas and Gerd,
>>
>> Can you test this series of patches on the s390?
>>
>> Thank you very much.
>
> Hi Hans, I gave this series a try on top of v6.17-rc1 on s390
> and a bunch of PCI devices including the mlx5 cards that Gerd we
> originally saw issues with. All looks well now. So feel free to
> add as appropriate:
>
> Tested-by: Niklas Schnelle <schnelle@linux.ibm.com>
>
Hi Niklas,
Thank you very much for your test. Let's see what others think.
Best regards,
Hans
next prev parent reply other threads:[~2025-08-14 14:52 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-13 14:45 Hans Zhang
2025-08-13 14:45 ` [PATCH v15 1/6] PCI: Clean up __pci_find_next_cap_ttl() readability Hans Zhang
2025-08-20 9:19 ` Gerd Bayer
2025-08-20 11:36 ` Ilpo Järvinen
2025-08-13 14:45 ` [PATCH v15 2/6] PCI: Refactor capability search into PCI_FIND_NEXT_CAP() Hans Zhang
2025-08-13 14:45 ` [PATCH v15 3/6] PCI: Refactor extended capability search into PCI_FIND_NEXT_EXT_CAP() Hans Zhang
2025-08-13 14:45 ` [PATCH v15 4/6] PCI: dwc: Use PCI core APIs to find capabilities Hans Zhang
2025-08-13 14:45 ` [PATCH v15 5/6] PCI: cadence: " Hans Zhang
2025-08-13 14:45 ` [PATCH v15 6/6] PCI: cadence: Use cdns_pcie_find_*capability() to avoid hardcoding offsets Hans Zhang
2025-10-09 14:54 ` Sasha Levin
2025-10-09 15:47 ` Hans Zhang
2025-08-14 8:32 ` [PATCH v15 0/6] Refactor capability search into common macros Niklas Schnelle
2025-08-14 14:51 ` Hans Zhang [this message]
2025-08-14 20:25 ` Bjorn Helgaas
2025-08-14 20:37 ` Niklas Schnelle
2025-08-14 20:51 ` Bjorn Helgaas
2025-08-14 22:21 ` Hans Zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=215953a5-658d-4cb2-ab02-57be3ac72697@163.com \
--to=18255117159@163.com \
--cc=arnd@kernel.org \
--cc=bhelgaas@google.com \
--cc=gbayer@linux.ibm.com \
--cc=geert@linux-m68k.org \
--cc=helgaas@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jingoohan1@gmail.com \
--cc=kwilczynski@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=lukas@wunner.de \
--cc=mani@kernel.org \
--cc=robh@kernel.org \
--cc=schnelle@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®