mbox series

[00/10] Add loadable kernel module and power management support

Message ID 1511538800-8275-1-git-send-email-mmaddireddy@nvidia.com
Headers show
Series Add loadable kernel module and power management support | expand

Message

Manikanta Maddireddy Nov. 24, 2017, 3:53 p.m. UTC
This series of patches add loadable kernel module and power management
support to Tegra PCIe host controller driver.

These patches are tested on Jetson TK1, TX1 and TX2 platforms, following
are the verification details.
	- Multiple module insert & remove
	- PCIe device functionality after module insert
	- Free clock, resets, regulators, powergate, iomem and interrupt
	resources after module remove
	- PCIe device functionality after resume from RAM

Tegra PCIe host controller driver is using ioremap_page_range() which is
not exported. This is switched with devm_ioremap() in the series
'https://patchwork.ozlabs.org/project/linux-tegra/list/?series=9907'.
Both these series will complete the loadable module support for Tegra
PCIe host driver.

Manikanta Maddireddy (10):
  genirq: Export irq_set_msi_desc()
  of: Export of_pci_range_to_resource()
  PM / QoS: Fix device resume latency for non PM QoS devices
  ARM: tegra: EXPORT tegra_cpuidle_pcie_irqs_in_use()
  PCI: Export pci_find_host_bridge()
  PCI: Export pci_flags
  PCI: tegra: free resources on probe failure
  PCI: tegra: Add loadable kernel module support
  PCI: tegra: Broadcast PME_turn_Off message before link goes to L2
  PCI: tegra: Add power management support

 arch/arm/mach-tegra/cpuidle.c |   1 +
 drivers/of/address.c          |   1 +
 drivers/pci/host-bridge.c     |   1 +
 drivers/pci/host/Kconfig      |   2 +-
 drivers/pci/host/pci-tegra.c  | 359 +++++++++++++++++++++++++++++++++---------
 drivers/pci/setup-bus.c       |   1 +
 include/linux/pm_qos.h        |   3 +-
 kernel/irq/chip.c             |   1 +
 8 files changed, 294 insertions(+), 75 deletions(-)

Comments

Rafael J. Wysocki Nov. 24, 2017, 4:50 p.m. UTC | #1
On Fri, Nov 24, 2017 at 4:53 PM, Manikanta Maddireddy
<mmaddireddy@nvidia.com> wrote:
> In 'commit 0cc2b4e5a020 ("PM / QoS: Fix device resume latency PM QoS")'
> PM QoS resume latency modified 0 as "no latency at all". However
> dev_pm_qos_raw_read_value() returns 0 for devices which doesn't have
> PM QoS constraints. This is blocking runtime suspend for these devices
> in rpm_check_suspend_allowed(). Return PM_QOS_RESUME_LATENCY_NO_CONSTRAINT
> when PM QoS constraints are not available for a particular device.
>
> Fixes: 0cc2b4e5a020 ("PM / QoS: Fix device resume latency PM QoS")

That commit has been reverted, so this patch is not applicable and
therefore the whole series isn't.

What kernel is it based off?

Thanks,
Rafael
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Thierry Reding Nov. 24, 2017, 8:39 p.m. UTC | #2
On Fri, Nov 24, 2017 at 05:50:42PM +0100, Rafael J. Wysocki wrote:
> On Fri, Nov 24, 2017 at 4:53 PM, Manikanta Maddireddy
> <mmaddireddy@nvidia.com> wrote:
> > In 'commit 0cc2b4e5a020 ("PM / QoS: Fix device resume latency PM QoS")'
> > PM QoS resume latency modified 0 as "no latency at all". However
> > dev_pm_qos_raw_read_value() returns 0 for devices which doesn't have
> > PM QoS constraints. This is blocking runtime suspend for these devices
> > in rpm_check_suspend_allowed(). Return PM_QOS_RESUME_LATENCY_NO_CONSTRAINT
> > when PM QoS constraints are not available for a particular device.
> >
> > Fixes: 0cc2b4e5a020 ("PM / QoS: Fix device resume latency PM QoS")
> 
> That commit has been reverted, so this patch is not applicable and
> therefore the whole series isn't.
> 
> What kernel is it based off?

It looks like this might have crept in via commit 0759e80b84e3 ("PM /
QoS: Fix device resume latency framework"). But checking more closely,
that commit actually incorporates this change already.

According to the git log the correct commit for this showed up in
linux-next only today, which is probably why Manikanta missed it.

Manikanta: can you try rebasing your series on top of next-20171124?
git should notice that this particular change is already part of that
and drop it during the rebase.

Thierry
Thomas Gleixner Nov. 24, 2017, 11:55 p.m. UTC | #3
On Fri, 24 Nov 2017, Manikanta Maddireddy wrote:

Please CC the proper mailing list for irq related changes.

> PCI bus support MSI interrupts, allow PCI host driver to set MSI descriptor
> data for an irq.

This is not really an explanation why this export is needed.

Thanks,

	tglx

> 
> Signed-off-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
> ---
>  kernel/irq/chip.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
> index 5a2ef92c2782..bfbd17386bc4 100644
> --- a/kernel/irq/chip.c
> +++ b/kernel/irq/chip.c
> @@ -136,6 +136,7 @@ int irq_set_msi_desc(unsigned int irq, struct msi_desc *entry)
>  {
>  	return irq_set_msi_desc_off(irq, 0, entry);
>  }
> +EXPORT_SYMBOL(irq_set_msi_desc);
>  
>  /**
>   *	irq_set_chip_data - set irq chip data for an irq
> -- 
> 2.1.4
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rafael J. Wysocki Nov. 25, 2017, 12:02 a.m. UTC | #4
On Fri, Nov 24, 2017 at 9:39 PM, Thierry Reding
<thierry.reding@gmail.com> wrote:
> On Fri, Nov 24, 2017 at 05:50:42PM +0100, Rafael J. Wysocki wrote:
>> On Fri, Nov 24, 2017 at 4:53 PM, Manikanta Maddireddy
>> <mmaddireddy@nvidia.com> wrote:
>> > In 'commit 0cc2b4e5a020 ("PM / QoS: Fix device resume latency PM QoS")'
>> > PM QoS resume latency modified 0 as "no latency at all". However
>> > dev_pm_qos_raw_read_value() returns 0 for devices which doesn't have
>> > PM QoS constraints. This is blocking runtime suspend for these devices
>> > in rpm_check_suspend_allowed(). Return PM_QOS_RESUME_LATENCY_NO_CONSTRAINT
>> > when PM QoS constraints are not available for a particular device.
>> >
>> > Fixes: 0cc2b4e5a020 ("PM / QoS: Fix device resume latency PM QoS")
>>
>> That commit has been reverted, so this patch is not applicable and
>> therefore the whole series isn't.
>>
>> What kernel is it based off?
>
> It looks like this might have crept in via commit 0759e80b84e3 ("PM /
> QoS: Fix device resume latency framework"). But checking more closely,
> that commit actually incorporates this change already.
>
> According to the git log the correct commit for this showed up in
> linux-next only today, which is probably why Manikanta missed it.

Well, it's been in the Linus' tree for a week, though.

Thanks,
Rafael
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Manikanta Maddireddy Nov. 25, 2017, 7:41 p.m. UTC | #5
On 25-Nov-17 5:25 AM, Thomas Gleixner wrote:
> On Fri, 24 Nov 2017, Manikanta Maddireddy wrote:
> 
> Please CC the proper mailing list for irq related changes.
> 
>> PCI bus support MSI interrupts, allow PCI host driver to set MSI descriptor
>> data for an irq.
> 
> This is not really an explanation why this export is needed.
> 
> Thanks,
> 
> 	tglx
> 
Updated the commit log with why Tegra PCIe driver is using this function in V2.
Please review.
>>
>> Signed-off-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
>> ---
>>  kernel/irq/chip.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
>> index 5a2ef92c2782..bfbd17386bc4 100644
>> --- a/kernel/irq/chip.c
>> +++ b/kernel/irq/chip.c
>> @@ -136,6 +136,7 @@ int irq_set_msi_desc(unsigned int irq, struct msi_desc *entry)
>>  {
>>  	return irq_set_msi_desc_off(irq, 0, entry);
>>  }
>> +EXPORT_SYMBOL(irq_set_msi_desc);
>>  
>>  /**
>>   *	irq_set_chip_data - set irq chip data for an irq
>> -- 
>> 2.1.4
>>
>>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Manikanta Maddireddy Nov. 25, 2017, 7:46 p.m. UTC | #6
On 25-Nov-17 5:32 AM, Rafael J. Wysocki wrote:
> On Fri, Nov 24, 2017 at 9:39 PM, Thierry Reding
> <thierry.reding@gmail.com> wrote:
>> On Fri, Nov 24, 2017 at 05:50:42PM +0100, Rafael J. Wysocki wrote:
>>> On Fri, Nov 24, 2017 at 4:53 PM, Manikanta Maddireddy
>>> <mmaddireddy@nvidia.com> wrote:
>>>> In 'commit 0cc2b4e5a020 ("PM / QoS: Fix device resume latency PM QoS")'
>>>> PM QoS resume latency modified 0 as "no latency at all". However
>>>> dev_pm_qos_raw_read_value() returns 0 for devices which doesn't have
>>>> PM QoS constraints. This is blocking runtime suspend for these devices
>>>> in rpm_check_suspend_allowed(). Return PM_QOS_RESUME_LATENCY_NO_CONSTRAINT
>>>> when PM QoS constraints are not available for a particular device.
>>>>
>>>> Fixes: 0cc2b4e5a020 ("PM / QoS: Fix device resume latency PM QoS")
>>>
>>> That commit has been reverted, so this patch is not applicable and
>>> therefore the whole series isn't.
>>>
>>> What kernel is it based off?
>>
>> It looks like this might have crept in via commit 0759e80b84e3 ("PM /
>> QoS: Fix device resume latency framework"). But checking more closely,
>> that commit actually incorporates this change already.
>>
>> According to the git log the correct commit for this showed up in
>> linux-next only today, which is probably why Manikanta missed it.
> 
> Well, it's been in the Linus' tree for a week, though.
> 
> Thanks,
> Rafael
> 
I dropped this patch in V2.

Thanks,
Manikanta
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Marc Zyngier Nov. 28, 2017, 10 a.m. UTC | #7
On 25/11/17 19:41, Manikanta Maddireddy wrote:
> 
> 
> On 25-Nov-17 5:25 AM, Thomas Gleixner wrote:
>> On Fri, 24 Nov 2017, Manikanta Maddireddy wrote:
>>
>> Please CC the proper mailing list for irq related changes.
>>
>>> PCI bus support MSI interrupts, allow PCI host driver to set MSI descriptor
>>> data for an irq.
>>
>> This is not really an explanation why this export is needed.
>>
>> Thanks,
>>
>> 	tglx
>>
> Updated the commit log with why Tegra PCIe driver is using this function in V2.
> Please review.

Well, to review it, I would like to be on Cc.

My current position on this is that if you need to export this function,
then you're using a deprecated API, and you should instead consider
moving to the generic MSI model, which doesn't need any of this.

I've done that a distant past, but never actually published the patch
(not tested it):

https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git/commit/?h=irq/kill-msi-controller&id=83b3602fcee7972b9d549ed729b56ec28de16081

But without seeing the patches, I may be barking up the wrong tree...

Thanks,

	M.
Manikanta Maddireddy Nov. 28, 2017, 5:19 p.m. UTC | #8
On 28-Nov-17 3:30 PM, Marc Zyngier wrote:
> On 25/11/17 19:41, Manikanta Maddireddy wrote:
>>
>>
>> On 25-Nov-17 5:25 AM, Thomas Gleixner wrote:
>>> On Fri, 24 Nov 2017, Manikanta Maddireddy wrote:
>>>
>>> Please CC the proper mailing list for irq related changes.
>>>
>>>> PCI bus support MSI interrupts, allow PCI host driver to set MSI descriptor
>>>> data for an irq.
>>>
>>> This is not really an explanation why this export is needed.
>>>
>>> Thanks,
>>>
>>> 	tglx
>>>
>> Updated the commit log with why Tegra PCIe driver is using this function in V2.
>> Please review.
> 
> Well, to review it, I would like to be on Cc.
> 
> My current position on this is that if you need to export this function,
> then you're using a deprecated API, and you should instead consider
> moving to the generic MSI model, which doesn't need any of this.
> 
> I've done that a distant past, but never actually published the patch
> (not tested it):
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git/commit/?h=irq/kill-msi-controller&id=83b3602fcee7972b9d549ed729b56ec28de16081
> 
> But without seeing the patches, I may be barking up the wrong tree...
> 
> Thanks,
> 
> 	M.
> 
Hi Mark,

I will drop this change from this series and will take up generic MSI work in the next series of changes for pci-tegra driver.
Even without this change, pci-tegra driver will work fine as a builtin module. So other changes can still be reviewed and
can be considered as initial step for adding LKM support for pci-tegra.

Thanks,
Manikanta
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Lorenzo Pieralisi Nov. 30, 2017, 12:41 p.m. UTC | #9
On Fri, Nov 24, 2017 at 09:23:14PM +0530, Manikanta Maddireddy wrote:
> EXPORT tegra_cpuidle_pcie_irqs_in_use() to allow Tegra PCIe driver to be
> compiled as loadable kernel module.
> 
> Signed-off-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
> ---
>  arch/arm/mach-tegra/cpuidle.c | 1 +
>  1 file changed, 1 insertion(+)

You should find a way to remove this call and the corresponding
drivers->arch dependency, not to export it by spreading it even
further.

Lorenzo

> diff --git a/arch/arm/mach-tegra/cpuidle.c b/arch/arm/mach-tegra/cpuidle.c
> index 316563141add..7d7e6d3ce32d 100644
> --- a/arch/arm/mach-tegra/cpuidle.c
> +++ b/arch/arm/mach-tegra/cpuidle.c
> @@ -57,3 +57,4 @@ void tegra_cpuidle_pcie_irqs_in_use(void)
>  		break;
>  	}
>  }
> +EXPORT_SYMBOL(tegra_cpuidle_pcie_irqs_in_use);
> -- 
> 2.1.4
> 
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Manikanta Maddireddy Nov. 30, 2017, 6:46 p.m. UTC | #10
On 30-Nov-17 6:11 PM, Lorenzo Pieralisi wrote:
> On Fri, Nov 24, 2017 at 09:23:14PM +0530, Manikanta Maddireddy wrote:
>> EXPORT tegra_cpuidle_pcie_irqs_in_use() to allow Tegra PCIe driver to be
>> compiled as loadable kernel module.
>>
>> Signed-off-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
>> ---
>>  arch/arm/mach-tegra/cpuidle.c | 1 +
>>  1 file changed, 1 insertion(+)
> 
> You should find a way to remove this call and the corresponding
> drivers->arch dependency, not to export it by spreading it even
> further.
> 
> Lorenzo
> 
I will drop this patch from the series and will explore the possibilities of
removing the arch dependency. I will address it in next series of patches

>> diff --git a/arch/arm/mach-tegra/cpuidle.c b/arch/arm/mach-tegra/cpuidle.c
>> index 316563141add..7d7e6d3ce32d 100644
>> --- a/arch/arm/mach-tegra/cpuidle.c
>> +++ b/arch/arm/mach-tegra/cpuidle.c
>> @@ -57,3 +57,4 @@ void tegra_cpuidle_pcie_irqs_in_use(void)
>>  		break;
>>  	}
>>  }
>> +EXPORT_SYMBOL(tegra_cpuidle_pcie_irqs_in_use);
>> -- 
>> 2.1.4
>>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html