diff mbox series

[v2,01/10] PCI: update current bus speed as part of pci_bus_add_devices()

Message ID 20250313-mhi_bw_up-v2-1-869ca32170bf@oss.qualcomm.com (mailing list archive)
State New
Delegated to: Johannes Berg
Headers show
Series bus: mhi: host: Add support for mhi bus bw | expand

Checks

Context Check Description
wifibot/fixes_present success Fixes tag not required for -next series
wifibot/series_format success Posting correctly formatted
wifibot/tree_selection success Guessed tree name to be wireless-next
wifibot/ynl success Generated files up to date; no warnings/errors; no diff in generated;
wifibot/build_clang success Errors and warnings before: 0 this patch: 0
wifibot/build_32bit success Errors and warnings before: 0 this patch: 0
wifibot/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
wifibot/build_clang_rust success No Rust files in patch. Skipping build
wifibot/build_tools success No tools touched, skip
wifibot/check_selftest success No net selftest shell script
wifibot/checkpatch success total: 0 errors, 0 warnings, 0 checks, 9 lines checked
wifibot/deprecated_api success None detected
wifibot/header_inline success No static functions without inline keyword in header files
wifibot/kdoc success Errors and warnings before: 1 this patch: 1
wifibot/source_inline success Was 0 now: 0
wifibot/verify_fixes success No Fixes tag
wifibot/verify_signedoff success Signed-off-by tag matches author and committer

Commit Message

Krishna Chaitanya Chundru March 13, 2025, 11:40 a.m. UTC
If the link is not up till the pwrctl drivers enable power to endpoints
then cur_bus_speed will not be updated with correct speed.

As part of rescan, pci_bus_add_devices() will be called and as part of
it update the link bus speed.

Signed-off-by: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com>
---
 drivers/pci/bus.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Bjorn Helgaas March 13, 2025, 5 p.m. UTC | #1
[+cc Bartosz since this is related to pwrctrl]

On Thu, Mar 13, 2025 at 05:10:08PM +0530, Krishna Chaitanya Chundru wrote:
> If the link is not up till the pwrctl drivers enable power to endpoints
> then cur_bus_speed will not be updated with correct speed.
> 
> As part of rescan, pci_bus_add_devices() will be called and as part of
> it update the link bus speed.
> 
> Signed-off-by: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com>
> ---
>  drivers/pci/bus.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
> index 98910bc0fcc4..994879071d4c 100644
> --- a/drivers/pci/bus.c
> +++ b/drivers/pci/bus.c
> @@ -432,6 +432,9 @@ void pci_bus_add_devices(const struct pci_bus *bus)
>  	struct pci_dev *dev;
>  	struct pci_bus *child;
>  
> +	if (bus->self)
> +		pcie_update_link_speed((struct pci_bus *)bus);

Why the cast?  I guess to discard "const"?  I would prefer to avoid
that if we can.

The only existing callers of pcie_update_link_speed() are from bwctrl,
where it obviously makes sense because bwctrl manages link speed, and
from pci_set_bus_speed() in the pci_alloc_child_bus() path.

If we call pcie_update_link_speed() here, do we still need the
pci_set_bus_speed() in pci_alloc_child_bus()?

Bartosz, so you have any suggestions?  Is there a point in pwrctrl
where it would make sense to do this, similar to what bwctrl does?

>  	list_for_each_entry(dev, &bus->devices, bus_list) {
>  		/* Skip already-added devices */
>  		if (pci_dev_is_added(dev))
> 
> -- 
> 2.34.1
>
Bjorn Helgaas March 13, 2025, 5 p.m. UTC | #2
s/update/Update/ in subject to match others
diff mbox series

Patch

diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
index 98910bc0fcc4..994879071d4c 100644
--- a/drivers/pci/bus.c
+++ b/drivers/pci/bus.c
@@ -432,6 +432,9 @@  void pci_bus_add_devices(const struct pci_bus *bus)
 	struct pci_dev *dev;
 	struct pci_bus *child;
 
+	if (bus->self)
+		pcie_update_link_speed((struct pci_bus *)bus);
+
 	list_for_each_entry(dev, &bus->devices, bus_list) {
 		/* Skip already-added devices */
 		if (pci_dev_is_added(dev))