lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <da5b6b73-3243-d492-4b82-77411e4676d9@nvidia.com>
Date:   Wed, 8 Feb 2023 17:49:09 +0530
From:   Manikanta Maddireddy <mmaddireddy@...dia.com>
To:     Thierry Reding <thierry.reding@...il.com>
Cc:     bhelgaas@...gle.com, petlozup@...dia.com,
        rafael.j.wysocki@...el.com, lpieralisi@...nel.org, robh@...nel.org,
        jeffy.chen@...k-chips.com, krzysztof.kozlowski+dt@...aro.org,
        jonathanh@...dia.com, dmitry.osipenko@...labora.com,
        viresh.kumar@...aro.org, gregkh@...uxfoundation.org,
        steven.price@....com, kw@...ux.com, linux-pci@...r.kernel.org,
        devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-tegra@...r.kernel.org, linux-pm@...r.kernel.org,
        vidyas@...dia.com
Subject: Re: [RFC,v14 3/5] PCI / PM: Add support for the PCIe WAKE# signal for
 OF


On 2/8/2023 5:20 PM, Thierry Reding wrote:
> On Wed, Feb 08, 2023 at 04:46:43PM +0530, Manikanta Maddireddy wrote:
>> From: Jeffy Chen <jeffy.chen@...k-chips.com>
>>
>> Add of_pci_setup_wake_irq() to parse the PCIe WAKE# interrupt from the
>> device tree and set the wake irq. Add of_pci_teardown_wake_irq() to clear
>> the wake irq.
>>
>> Call of_pci_setup_wake_irq() in pci_device_probe() to setup PCIe WAKE#
>> interrupt during PCIe Endpoint enumeration.
>>
>> Enable or disable PCIe WAKE# interrupt in platform_pci_set_wakeup().
>>
>> Signed-off-by: Jeffy Chen <jeffy.chen@...k-chips.com>
>> Signed-off-by: Manikanta Maddireddy <mmaddireddy@...dia.com>
>> ---
>>
>> Changes in v14:
>> pci_platform_pm_ops structure is removed in latest kernel, so dropped
>> pci-of driver. Instead, enable wake in platform_pci_set_wakeup().
>>
>> Changes in v13:
>> Fix compiler error reported by kbuild test robot <fengguang.wu@...el.com>
>>
>> Changes in v12:
>> Enable the wake irq in noirq stage to avoid possible irq storm.
>>
>> Changes in v11:
>> Only support 1-per-device PCIe WAKE# pin as suggested.
>>
>> Changes in v10:
>> Use device_set_wakeup_capable() instead of device_set_wakeup_enable(),
>> since dedicated wakeirq will be lost in device_set_wakeup_enable(false).
>>
>> Changes in v9:
>> Fix check error in .cleanup().
>> Move dedicated wakeirq setup to setup() callback and use
>> device_set_wakeup_enable() to enable/disable.
>>
>> Changes in v8:
>> Add pci-of.c and use platform_pm_ops to handle the PCIe WAKE# signal.
>>
>> Changes in v7:
>> Move PCIE_WAKE handling into pci core.
>>
>> Changes in v6:
>> Fix device_init_wake error handling, and add some comments.
>>
>> Changes in v5:
>> Rebase.
>>
>> Changes in v3:
>> Fix error handling.
>>
>> Changes in v2:
>> Use dev_pm_set_dedicated_wake_irq.
>>
>>   drivers/pci/of.c         | 49 ++++++++++++++++++++++++++++++++++++++++
>>   drivers/pci/pci-driver.c | 10 ++++++++
>>   drivers/pci/pci.c        |  7 ++++++
>>   drivers/pci/pci.h        |  8 +++++++
>>   4 files changed, 74 insertions(+)
>>
>> diff --git a/drivers/pci/of.c b/drivers/pci/of.c
>> index ff897c40ed71..1c348e63f175 100644
>> --- a/drivers/pci/of.c
>> +++ b/drivers/pci/of.c
>> @@ -13,6 +13,7 @@
>>   #include <linux/of_irq.h>
>>   #include <linux/of_address.h>
>>   #include <linux/of_pci.h>
>> +#include <linux/pm_wakeirq.h>
>>   #include "pci.h"
>>   
>>   #ifdef CONFIG_PCI
>> @@ -705,3 +706,51 @@ u32 of_pci_get_slot_power_limit(struct device_node *node,
>>   	return slot_power_limit_mw;
>>   }
>>   EXPORT_SYMBOL_GPL(of_pci_get_slot_power_limit);
>> +
>> +int of_pci_setup_wake_irq(struct pci_dev *pdev)
>> +{
>> +	struct pci_dev *ppdev;
> Perhaps "parent" since that's what it is referring to? ppdev is a bit
> vague.
ppdev is already used in of_irq_parse_pci(), I think it mean parent pci_dev.
I see that parent is mostly used for pci_bus parent. Let me know if it 
is fine
to leave it as ppdev or need to rename it.
>
>> +	struct device_node *dn;
>> +	int ret, irq;
>> +
>> +	/* Get the pci_dev of our parent. Hopefully it's a port. */
>> +	ppdev = pdev->bus->self;
>> +	/* Nope, it's a host bridge. */
>> +	if (!ppdev)
>> +		return 0;
>> +
>> +	dn = pci_device_to_OF_node(ppdev);
>> +	if (!dn)
>> +		return 0;
>> +
>> +	irq = of_irq_get_byname(dn, "wakeup");
>> +	if (irq == -EPROBE_DEFER) {
>> +		return irq;
>> +	} else if (irq < 0) {
>> +		/* Ignore other errors, since a missing wakeup is non-fatal. */
>> +		dev_info(&pdev->dev, "cannot get wakeup interrupt: %d\n", irq);
> dev_dbg() maybe? As it is this would add an annoying info message for
> basically every PCI controller on every DT-based board out there.
>
> Thierry
Ack. I will wait for few days for other review this series before 
sending new patch set.

Manikanta

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ