From: Hans Zhang <18255117159@163.com>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: lpieralisi@kernel.org, bhelgaas@google.com, kw@linux.com,
manivannan.sadhasivam@linaro.org, robh@kernel.org,
jingoohan1@gmail.com, thomas.richard@bootlin.com,
linux-pci@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [v7 2/5] PCI: Refactor capability search functions to eliminate code duplication
Date: Fri, 4 Apr 2025 00:29:01 +0800 [thread overview]
Message-ID: <d92d433b-89eb-434a-ae5d-0cc2e1ce3606@163.com> (raw)
In-Reply-To: <f77f60a0-72d2-4a9c-864e-bd8c4ea8a514@163.com>
On 2025/4/3 20:24, Hans Zhang wrote:
>
>
> On 2025/4/3 17:15, Ilpo Järvinen wrote:
>>>> I don't like how 1 & 2 patches are split into two. IMO, they mostly
>>>> belong
>>>> together. However, (IMO) you can introduce the new all-size config
>>>> space
>>>> accessor in a separate patch before the combined patch.
>>>>
>>>
>>> Ok. I'll change it to the following. The rest I'll combine into a patch.
>>>
>>> diff --git a/drivers/pci/access.c b/drivers/pci/access.c
>>> index b123da16b63b..bb2e26c2eb81 100644
>>> --- a/drivers/pci/access.c
>>> +++ b/drivers/pci/access.c
>>> @@ -85,6 +85,23 @@ EXPORT_SYMBOL(pci_bus_write_config_byte);
>>> EXPORT_SYMBOL(pci_bus_write_config_word);
>>> EXPORT_SYMBOL(pci_bus_write_config_dword);
>>>
>>> +
>>
>> Extra newline
>>
>
> Hi Ilpo,
>
> Thanks your for reply. Will delete.
>
Hi Ilpo,
The [v9 1/6]patch I plan to submit is as follows, please review it.
From c099691ff1e980ff4633c55e94abcd888000e2cc Mon Sep 17 00:00:00 2001
From: Hans Zhang <18255117159@163.com>
Date: Fri, 4 Apr 2025 00:19:32 +0800
Subject: [v9 1/6] PCI: Introduce generic bus config read helper function
The primary PCI config space accessors are tied to the size of the read
(byte/word/dword). Upcoming refactoring of PCI capability discovery logic
requires passing a config accessor function that must be able to perform
read with different sizes.
Add any size config space read accessor pci_bus_read_config() to allow
giving it as the config space accessor to the upcoming PCI capability
discovery macro.
Reconstructs the PCI function discovery logic to prepare for unified
configuration of access modes. No function changes are intended.
Signed-off-by: Hans Zhang <18255117159@163.com>
---
drivers/pci/access.c | 17 +++++++++++++++++
drivers/pci/pci.h | 2 ++
2 files changed, 19 insertions(+)
diff --git a/drivers/pci/access.c b/drivers/pci/access.c
index b123da16b63b..603332658ab3 100644
--- a/drivers/pci/access.c
+++ b/drivers/pci/access.c
@@ -85,6 +85,23 @@ EXPORT_SYMBOL(pci_bus_write_config_byte);
EXPORT_SYMBOL(pci_bus_write_config_word);
EXPORT_SYMBOL(pci_bus_write_config_dword);
+int pci_bus_read_config(void *priv, unsigned int devfn, int where, u32
size,
+ u32 *val)
+{
+ struct pci_bus *bus = priv;
+ int ret;
+
+ if (size == 1)
+ ret = pci_bus_read_config_byte(bus, devfn, where, (u8 *)val);
+ else if (size == 2)
+ ret = pci_bus_read_config_word(bus, devfn, where, (u16 *)val);
+ else
+ ret = pci_bus_read_config_dword(bus, devfn, where, val);
+
+ return ret;
+}
+EXPORT_SYMBOL_GPL(pci_bus_read_config);
+
int pci_generic_config_read(struct pci_bus *bus, unsigned int devfn,
int where, int size, u32 *val)
{
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 2e9cf26a9ee9..6a7c88b9cd35 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -88,6 +88,8 @@ extern bool pci_early_dump;
bool pcie_cap_has_lnkctl(const struct pci_dev *dev);
bool pcie_cap_has_lnkctl2(const struct pci_dev *dev);
bool pcie_cap_has_rtctl(const struct pci_dev *dev);
+int pci_bus_read_config(void *priv, unsigned int devfn, int where, u32
size,
+ u32 *val);
/* Functions internal to the PCI core code */
Best regards,
Hans
next prev parent reply other threads:[~2025-04-03 16:29 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-02 4:20 [v7 0/5] Refactor capability search into common macros Hans Zhang
2025-04-02 4:20 ` [v7 1/5] PCI: " Hans Zhang
2025-04-02 12:42 ` Ilpo Järvinen
2025-04-02 15:31 ` Hans Zhang
2025-04-03 9:10 ` Ilpo Järvinen
2025-04-03 12:22 ` Hans Zhang
2025-04-03 16:31 ` Hans Zhang
2025-04-02 4:20 ` [v7 2/5] PCI: Refactor capability search functions to eliminate code duplication Hans Zhang
2025-04-02 9:19 ` kernel test robot
2025-04-02 10:42 ` Hans Zhang
2025-04-02 12:38 ` Ilpo Järvinen
2025-04-02 15:37 ` Hans Zhang
2025-04-03 9:15 ` Ilpo Järvinen
2025-04-03 12:24 ` Hans Zhang
2025-04-03 16:29 ` Hans Zhang [this message]
2025-04-03 16:35 ` Hans Zhang
2025-04-07 17:03 ` Ilpo Järvinen
2025-04-08 12:19 ` Hans Zhang
2025-04-08 16:18 ` Ilpo Järvinen
2025-04-09 1:37 ` Hans Zhang
2025-04-02 4:20 ` [v7 3/5] PCI: dwc: Use common PCI host bridge APIs for finding the capabilities Hans Zhang
2025-04-02 11:58 ` kernel test robot
2025-04-02 12:18 ` Hans Zhang
2025-04-02 4:20 ` [v7 4/5] PCI: cadence: " Hans Zhang
2025-04-02 4:20 ` [v7 5/5] PCI: cadence: Use cdns_pcie_find_*capability to avoid hardcode 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=d92d433b-89eb-434a-ae5d-0cc2e1ce3606@163.com \
--to=18255117159@163.com \
--cc=bhelgaas@google.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jingoohan1@gmail.com \
--cc=kw@linux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=robh@kernel.org \
--cc=thomas.richard@bootlin.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