[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <215953a5-658d-4cb2-ab02-57be3ac72697@163.com>
Date: Thu, 14 Aug 2025 22:51:18 +0800
From: Hans Zhang <18255117159@....com>
To: Niklas Schnelle <schnelle@...ux.ibm.com>, lpieralisi@...nel.org,
kwilczynski@...nel.org, bhelgaas@...gle.com, helgaas@...nel.org,
jingoohan1@...il.com, mani@...nel.org
Cc: robh@...nel.org, ilpo.jarvinen@...ux.intel.com, gbayer@...ux.ibm.com,
lukas@...ner.de, arnd@...nel.org, geert@...ux-m68k.org,
linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v15 0/6] Refactor capability search into common macros
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@...ux.ibm.com>
>
Hi Niklas,
Thank you very much for your test. Let's see what others think.
Best regards,
Hans
Powered by blists - more mailing lists