[PATCH 0/5] PCI/pwrctl: Ensure that the pwrctl drivers are probed before PCI client drivers

Manivannan Sadhasivam via B4 Relay posted 5 patches 1 month ago
There is a newer version of this series
drivers/pci/bus.c         | 64 +++++++++++++++++++++++++++++++++++++++++------
drivers/pci/of.c          | 27 ++++++++++++++++++++
drivers/pci/pci.h         |  5 ++++
drivers/pci/pwrctl/core.c | 10 --------
drivers/pci/remove.c      | 17 ++++++-------
5 files changed, 96 insertions(+), 27 deletions(-)
[PATCH 0/5] PCI/pwrctl: Ensure that the pwrctl drivers are probed before PCI client drivers
Posted by Manivannan Sadhasivam via B4 Relay 1 month ago
Hi,

This series reworks the PCI/pwrctl integration to ensure that the pwrctl drivers
are always probed before the PCI client drivers. This series addresses a race
condition when both pwrctl and pwrctl/pwrseq drivers probe parallely (even when
the later one probes last). One such issue was reported for the Qcom X13s
platform with WLAN module and fixed with 'commit a9aaf1ff88a8 ("power:
sequencing: request the WLAN enable GPIO as-is")'.

Though the issue was fixed with a hack in the pwrseq driver, it was clear that
the issue is applicable to all pwrctl drivers. Hence, this series tries to
address the issue in the PCI/pwrctl integration.

- Mani

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
Manivannan Sadhasivam (5):
      PCI/pwrctl: Use of_platform_device_create() to create pwrctl devices
      PCI/pwrctl: Create pwrctl devices only if at least one power supply is present
      PCI/pwrctl: Ensure that the pwrctl drivers are probed before the PCI client drivers
      PCI/pwrctl: Move pwrctl device creation to its own helper function
      PCI/pwrctl: Remove pwrctl device without iterating over all children of pwrctl parent

 drivers/pci/bus.c         | 64 +++++++++++++++++++++++++++++++++++++++++------
 drivers/pci/of.c          | 27 ++++++++++++++++++++
 drivers/pci/pci.h         |  5 ++++
 drivers/pci/pwrctl/core.c | 10 --------
 drivers/pci/remove.c      | 17 ++++++-------
 5 files changed, 96 insertions(+), 27 deletions(-)
---
base-commit: 48dc7986beb60522eb217c0016f999cc7afaf0b7
change-id: 20241022-pci-pwrctl-rework-a1b024158555

Best regards,
-- 
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Re: [PATCH 0/5] PCI/pwrctl: Ensure that the pwrctl drivers are probed before PCI client drivers
Posted by Krzysztof Wilczyński 3 weeks, 1 day ago
Hello,

> This series reworks the PCI/pwrctl integration to ensure that the pwrctl drivers
> are always probed before the PCI client drivers. This series addresses a race
> condition when both pwrctl and pwrctl/pwrseq drivers probe parallely (even when
> the later one probes last). One such issue was reported for the Qcom X13s
> platform with WLAN module and fixed with 'commit a9aaf1ff88a8 ("power:
> sequencing: request the WLAN enable GPIO as-is")'.
> 
> Though the issue was fixed with a hack in the pwrseq driver, it was clear that
> the issue is applicable to all pwrctl drivers. Hence, this series tries to
> address the issue in the PCI/pwrctl integration.

Applied to bwctrl, thank you!

[01/05] PCI/pwrctl: Use of_platform_device_create() to create pwrctl devices
        https://git.kernel.org/pci/pci/c/d2b6619e7419

[02/05] PCI/pwrctl: Create pwrctl devices only if at least one power supply is present
        https://git.kernel.org/pci/pci/c/5f2710a4c275

[03/05] PCI/pwrctl: Ensure that the pwrctl drivers are probed before the PCI client drivers
        https://git.kernel.org/pci/pci/c/4c963d4c13b9

[04/05] PCI/pwrctl: Move pwrctl device creation to its own helper function
        https://git.kernel.org/pci/pci/c/73ae23a6af78

[05/05] PCI/pwrctl: Remove pwrctl device without iterating over all children of pwrctl parent
        https://git.kernel.org/pci/pci/c/5ccc52fd1e5a

	Krzysztof
Re: [PATCH 0/5] PCI/pwrctl: Ensure that the pwrctl drivers are probed before PCI client drivers
Posted by Bjorn Helgaas 3 weeks ago
On Mon, Nov 04, 2024 at 05:31:07AM +0900, Krzysztof Wilczyński wrote:
> Hello,
> 
> > This series reworks the PCI/pwrctl integration to ensure that the pwrctl drivers
> > are always probed before the PCI client drivers. This series addresses a race
> > condition when both pwrctl and pwrctl/pwrseq drivers probe parallely (even when
> > the later one probes last). One such issue was reported for the Qcom X13s
> > platform with WLAN module and fixed with 'commit a9aaf1ff88a8 ("power:
> > sequencing: request the WLAN enable GPIO as-is")'.
> > 
> > Though the issue was fixed with a hack in the pwrseq driver, it was clear that
> > the issue is applicable to all pwrctl drivers. Hence, this series tries to
> > address the issue in the PCI/pwrctl integration.
> 
> Applied to bwctrl, thank you!

Should be pci/pwrctl.  bwctrl (bandwidth control) and pwrctl (power
control) are quite different despite the confusingly similar names.

> [01/05] PCI/pwrctl: Use of_platform_device_create() to create pwrctl devices
>         https://git.kernel.org/pci/pci/c/d2b6619e7419
> 
> [02/05] PCI/pwrctl: Create pwrctl devices only if at least one power supply is present
>         https://git.kernel.org/pci/pci/c/5f2710a4c275
> 
> [03/05] PCI/pwrctl: Ensure that the pwrctl drivers are probed before the PCI client drivers
>         https://git.kernel.org/pci/pci/c/4c963d4c13b9
> 
> [04/05] PCI/pwrctl: Move pwrctl device creation to its own helper function
>         https://git.kernel.org/pci/pci/c/73ae23a6af78
> 
> [05/05] PCI/pwrctl: Remove pwrctl device without iterating over all children of pwrctl parent
>         https://git.kernel.org/pci/pci/c/5ccc52fd1e5a
> 
> 	Krzysztof
Re: [PATCH 0/5] PCI/pwrctl: Ensure that the pwrctl drivers are probed before PCI client drivers
Posted by Krzysztof Wilczyński 2 weeks, 6 days ago
Hello,

> > > This series reworks the PCI/pwrctl integration to ensure that the pwrctl drivers
> > > are always probed before the PCI client drivers. This series addresses a race
> > > condition when both pwrctl and pwrctl/pwrseq drivers probe parallely (even when
> > > the later one probes last). One such issue was reported for the Qcom X13s
> > > platform with WLAN module and fixed with 'commit a9aaf1ff88a8 ("power:
> > > sequencing: request the WLAN enable GPIO as-is")'.
> > > 
> > > Though the issue was fixed with a hack in the pwrseq driver, it was clear that
> > > the issue is applicable to all pwrctl drivers. Hence, this series tries to
> > > address the issue in the PCI/pwrctl integration.
> > 
> > Applied to bwctrl, thank you!
> 
> Should be pci/pwrctl.  bwctrl (bandwidth control) and pwrctl (power
> control) are quite different despite the confusingly similar names.

Correct.  I moved patches to the correct branch.  Sorry about that!

	Krzysztof
Re: [PATCH 0/5] PCI/pwrctl: Ensure that the pwrctl drivers are probed before PCI client drivers
Posted by Bartosz Golaszewski 1 month ago
On Tue, 22 Oct 2024 at 12:28, Manivannan Sadhasivam via B4 Relay
<devnull+manivannan.sadhasivam.linaro.org@kernel.org> wrote:
>
> Hi,
>
> This series reworks the PCI/pwrctl integration to ensure that the pwrctl drivers
> are always probed before the PCI client drivers. This series addresses a race
> condition when both pwrctl and pwrctl/pwrseq drivers probe parallely (even when
> the later one probes last). One such issue was reported for the Qcom X13s
> platform with WLAN module and fixed with 'commit a9aaf1ff88a8 ("power:
> sequencing: request the WLAN enable GPIO as-is")'.
>
> Though the issue was fixed with a hack in the pwrseq driver, it was clear that
> the issue is applicable to all pwrctl drivers. Hence, this series tries to
> address the issue in the PCI/pwrctl integration.
>
> - Mani
>
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> ---
> Manivannan Sadhasivam (5):
>       PCI/pwrctl: Use of_platform_device_create() to create pwrctl devices
>       PCI/pwrctl: Create pwrctl devices only if at least one power supply is present
>       PCI/pwrctl: Ensure that the pwrctl drivers are probed before the PCI client drivers
>       PCI/pwrctl: Move pwrctl device creation to its own helper function
>       PCI/pwrctl: Remove pwrctl device without iterating over all children of pwrctl parent
>
>  drivers/pci/bus.c         | 64 +++++++++++++++++++++++++++++++++++++++++------
>  drivers/pci/of.c          | 27 ++++++++++++++++++++
>  drivers/pci/pci.h         |  5 ++++
>  drivers/pci/pwrctl/core.c | 10 --------
>  drivers/pci/remove.c      | 17 ++++++-------
>  5 files changed, 96 insertions(+), 27 deletions(-)
> ---
> base-commit: 48dc7986beb60522eb217c0016f999cc7afaf0b7
> change-id: 20241022-pci-pwrctl-rework-a1b024158555
>
> Best regards,
> --
> Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
>
>

Excellent work, thanks for doing this.

Tested on: sc8280xp-crd, RB5 and sm8450-hdk.

Tested-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

Just a couple nits from my side under respective patches.

Bart
Re: [PATCH 0/5] PCI/pwrctl: Ensure that the pwrctl drivers are probed before PCI client drivers
Posted by Krishna Chaitanya Chundru 1 month ago

On 10/23/2024 4:00 PM, Bartosz Golaszewski wrote:
> On Tue, 22 Oct 2024 at 12:28, Manivannan Sadhasivam via B4 Relay
> <devnull+manivannan.sadhasivam.linaro.org@kernel.org> wrote:
>>
>> Hi,
>>
>> This series reworks the PCI/pwrctl integration to ensure that the pwrctl drivers
>> are always probed before the PCI client drivers. This series addresses a race
>> condition when both pwrctl and pwrctl/pwrseq drivers probe parallely (even when
>> the later one probes last). One such issue was reported for the Qcom X13s
>> platform with WLAN module and fixed with 'commit a9aaf1ff88a8 ("power:
>> sequencing: request the WLAN enable GPIO as-is")'.
>>
>> Though the issue was fixed with a hack in the pwrseq driver, it was clear that
>> the issue is applicable to all pwrctl drivers. Hence, this series tries to
>> address the issue in the PCI/pwrctl integration.
>>
>> - Mani
>>
>> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
>> ---
>> Manivannan Sadhasivam (5):
>>        PCI/pwrctl: Use of_platform_device_create() to create pwrctl devices
>>        PCI/pwrctl: Create pwrctl devices only if at least one power supply is present
>>        PCI/pwrctl: Ensure that the pwrctl drivers are probed before the PCI client drivers
>>        PCI/pwrctl: Move pwrctl device creation to its own helper function
>>        PCI/pwrctl: Remove pwrctl device without iterating over all children of pwrctl parent
>>
>>   drivers/pci/bus.c         | 64 +++++++++++++++++++++++++++++++++++++++++------
>>   drivers/pci/of.c          | 27 ++++++++++++++++++++
>>   drivers/pci/pci.h         |  5 ++++
>>   drivers/pci/pwrctl/core.c | 10 --------
>>   drivers/pci/remove.c      | 17 ++++++-------
>>   5 files changed, 96 insertions(+), 27 deletions(-)
>> ---
>> base-commit: 48dc7986beb60522eb217c0016f999cc7afaf0b7
>> change-id: 20241022-pci-pwrctl-rework-a1b024158555
>>
>> Best regards,
>> --
>> Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
>>
>>
> 
> Excellent work, thanks for doing this.
> 
> Tested on: sc8280xp-crd, RB5 and sm8450-hdk.
> 
> Tested-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> 
> Just a couple nits from my side under respective patches.
> 
> Bart
Tested on: qcs6490-rb3gen board with work in progress qps615 pcie switch

Tested-by: Krishna chaitanya chundru <quic_krichai@quicinc.com>

- Krishna Chaitanya.
>