All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@wwwdotorg.org>
To: Thierry Reding <thierry.reding@avionic-design.de>
Cc: linux-tegra@vger.kernel.org, Liam Girdwood <lrg@ti.com>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Jesse Barnes <jbarnes@virtuousgeek.org>,
	linux-pci@vger.kernel.org,
	Grant Likely <grant.likely@secretlab.ca>,
	Rob Herring <rob.herring@calxeda.com>,
	devicetree-discuss@lists.ozlabs.org,
	Russell King <linux@arm.linux.org.uk>,
	linux-arm-kernel@lists.infradead.org,
	Colin Cross <ccross@android.com>, Olof Johansson <olof@lixom.net>
Subject: Re: [PATCH 10/11] ARM: tegra: pcie: Add MSI support
Date: Thu, 08 Mar 2012 14:14:39 -0700	[thread overview]
Message-ID: <4F59213F.6070107@wwwdotorg.org> (raw)
In-Reply-To: <1331218291-16119-11-git-send-email-thierry.reding@avionic-design.de>

On 03/08/2012 07:51 AM, Thierry Reding wrote:
> This commit adds support for message signaled interrupts to the Tegra
> PCIe controller.
> 
> Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
> ---
> This code is taken from the NVIDIA Vibrante kernel and therefore has no
> appropriate Signed-off-by from the original author. Maybe someone at
> NVIDIA can find out who wrote this code and maybe provide a proper
> Signed-off-by that I can add?

I think if you look in:
git://nv-tegra.nvidia.com/linux-2.6.git android-tegra-2.6.36

the following commits are what you're after:

de7fd8768b32da66eaf4eaf58473c65f7a76808d
arm: tegra: pcie: enabling MSI support for pcie

ac1f8310811c64a084511d2afc27f66334b31a81
ARM: tegra: pcie: fix return value from MSI irq routine

Although the patch below only partially resembles those patches, I guess
because you've rewritten the code a lot to conform to the current kernel
APIs, clean stuff up, etc. Perhaps just saying "based on code by Krishna
Kishore <kthota@nvidia.com>" is enough...

> diff --git a/arch/arm/mach-tegra/pcie.c b/arch/arm/mach-tegra/pcie.c

> +static int tegra_pcie_enable_msi(struct platform_device *pdev)
> +{
> +	struct tegra_pcie_info *pcie = platform_get_drvdata(pdev);
> +	volatile void *pages;
> +	unsigned long base;
> +	unsigned int msi;
> +	int msi_base;
> +	int err;
> +	u32 reg;
> +
> +	mutex_init(&pcie->msi_lock);
> +
> +	msi_base = irq_alloc_descs(-1, 0, INT_PCI_MSI_NR, 0);
> +	if (msi_base < 0) {
> +		dev_err(&pdev->dev, "failed to allocate IRQs\n");
> +		return msi_base;
> +	}
> +
> +	pcie->msi_domain = irq_domain_add_legacy(pcie->dev->of_node,
> +						 INT_PCI_MSI_NR, msi_base,
> +						 0, &irq_domain_simple_ops,
> +						 NULL);
> +	if (!pcie->msi_domain) {
> +		dev_err(&pdev->dev, "failed to create IRQ domain\n");

Free the IRQ descriptors in the error paths?

> +		return -ENOMEM;
> +	}
> +
> +	pcie->msi_chip.name = "PCIe-MSI";
> +	pcie->msi_chip.irq_enable = unmask_msi_irq;
> +	pcie->msi_chip.irq_disable = mask_msi_irq;
> +	pcie->msi_chip.irq_mask = mask_msi_irq;
> +	pcie->msi_chip.irq_unmask = unmask_msi_irq;
> +
> +	for (msi = 0; msi < INT_PCI_MSI_NR; msi++) {
> +		unsigned int irq = irq_find_mapping(pcie->msi_domain, msi);
> +
> +		irq_set_chip_data(irq, pcie);
> +		irq_set_chip_and_handler(irq, &pcie->msi_chip,
> +					 handle_simple_irq);
> +		set_irq_flags(irq, IRQF_VALID);
> +	}
> +
> +	err = platform_get_irq(pdev, 1);
> +	if (err < 0) {
> +		dev_err(&pdev->dev, "failed to get IRQ: %d\n", err);

Same here, and undo setting IRQF_VALID?

> +		return err;
> +	}
...

> +static int tegra_pcie_disable_msi(struct platform_device *pdev)
> +{
> +	return 0;
> +}

This is empty in both the ifdef(CONFIG_PCI_MSI) case and otherwise. It
should probably clean everything up here right?

WARNING: multiple messages have this Message-ID (diff)
From: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
To: Thierry Reding
	<thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Liam Girdwood <lrg-l0cyMroinI0@public.gmane.org>,
	Mark Brown
	<broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>,
	Jesse Barnes <jbarnes-Y1mF5jBUw70BENJcbMCuUQ@public.gmane.org>,
	linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Grant Likely
	<grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>,
	Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	Russell King <linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	Colin Cross <ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>,
	Olof Johansson <olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>
Subject: Re: [PATCH 10/11] ARM: tegra: pcie: Add MSI support
Date: Thu, 08 Mar 2012 14:14:39 -0700	[thread overview]
Message-ID: <4F59213F.6070107@wwwdotorg.org> (raw)
In-Reply-To: <1331218291-16119-11-git-send-email-thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>

On 03/08/2012 07:51 AM, Thierry Reding wrote:
> This commit adds support for message signaled interrupts to the Tegra
> PCIe controller.
> 
> Signed-off-by: Thierry Reding <thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org>
> ---
> This code is taken from the NVIDIA Vibrante kernel and therefore has no
> appropriate Signed-off-by from the original author. Maybe someone at
> NVIDIA can find out who wrote this code and maybe provide a proper
> Signed-off-by that I can add?

I think if you look in:
git://nv-tegra.nvidia.com/linux-2.6.git android-tegra-2.6.36

the following commits are what you're after:

de7fd8768b32da66eaf4eaf58473c65f7a76808d
arm: tegra: pcie: enabling MSI support for pcie

ac1f8310811c64a084511d2afc27f66334b31a81
ARM: tegra: pcie: fix return value from MSI irq routine

Although the patch below only partially resembles those patches, I guess
because you've rewritten the code a lot to conform to the current kernel
APIs, clean stuff up, etc. Perhaps just saying "based on code by Krishna
Kishore <kthota-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>" is enough...

> diff --git a/arch/arm/mach-tegra/pcie.c b/arch/arm/mach-tegra/pcie.c

> +static int tegra_pcie_enable_msi(struct platform_device *pdev)
> +{
> +	struct tegra_pcie_info *pcie = platform_get_drvdata(pdev);
> +	volatile void *pages;
> +	unsigned long base;
> +	unsigned int msi;
> +	int msi_base;
> +	int err;
> +	u32 reg;
> +
> +	mutex_init(&pcie->msi_lock);
> +
> +	msi_base = irq_alloc_descs(-1, 0, INT_PCI_MSI_NR, 0);
> +	if (msi_base < 0) {
> +		dev_err(&pdev->dev, "failed to allocate IRQs\n");
> +		return msi_base;
> +	}
> +
> +	pcie->msi_domain = irq_domain_add_legacy(pcie->dev->of_node,
> +						 INT_PCI_MSI_NR, msi_base,
> +						 0, &irq_domain_simple_ops,
> +						 NULL);
> +	if (!pcie->msi_domain) {
> +		dev_err(&pdev->dev, "failed to create IRQ domain\n");

Free the IRQ descriptors in the error paths?

> +		return -ENOMEM;
> +	}
> +
> +	pcie->msi_chip.name = "PCIe-MSI";
> +	pcie->msi_chip.irq_enable = unmask_msi_irq;
> +	pcie->msi_chip.irq_disable = mask_msi_irq;
> +	pcie->msi_chip.irq_mask = mask_msi_irq;
> +	pcie->msi_chip.irq_unmask = unmask_msi_irq;
> +
> +	for (msi = 0; msi < INT_PCI_MSI_NR; msi++) {
> +		unsigned int irq = irq_find_mapping(pcie->msi_domain, msi);
> +
> +		irq_set_chip_data(irq, pcie);
> +		irq_set_chip_and_handler(irq, &pcie->msi_chip,
> +					 handle_simple_irq);
> +		set_irq_flags(irq, IRQF_VALID);
> +	}
> +
> +	err = platform_get_irq(pdev, 1);
> +	if (err < 0) {
> +		dev_err(&pdev->dev, "failed to get IRQ: %d\n", err);

Same here, and undo setting IRQF_VALID?

> +		return err;
> +	}
...

> +static int tegra_pcie_disable_msi(struct platform_device *pdev)
> +{
> +	return 0;
> +}

This is empty in both the ifdef(CONFIG_PCI_MSI) case and otherwise. It
should probably clean everything up here right?

WARNING: multiple messages have this Message-ID (diff)
From: swarren@wwwdotorg.org (Stephen Warren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 10/11] ARM: tegra: pcie: Add MSI support
Date: Thu, 08 Mar 2012 14:14:39 -0700	[thread overview]
Message-ID: <4F59213F.6070107@wwwdotorg.org> (raw)
In-Reply-To: <1331218291-16119-11-git-send-email-thierry.reding@avionic-design.de>

On 03/08/2012 07:51 AM, Thierry Reding wrote:
> This commit adds support for message signaled interrupts to the Tegra
> PCIe controller.
> 
> Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
> ---
> This code is taken from the NVIDIA Vibrante kernel and therefore has no
> appropriate Signed-off-by from the original author. Maybe someone at
> NVIDIA can find out who wrote this code and maybe provide a proper
> Signed-off-by that I can add?

I think if you look in:
git://nv-tegra.nvidia.com/linux-2.6.git android-tegra-2.6.36

the following commits are what you're after:

de7fd8768b32da66eaf4eaf58473c65f7a76808d
arm: tegra: pcie: enabling MSI support for pcie

ac1f8310811c64a084511d2afc27f66334b31a81
ARM: tegra: pcie: fix return value from MSI irq routine

Although the patch below only partially resembles those patches, I guess
because you've rewritten the code a lot to conform to the current kernel
APIs, clean stuff up, etc. Perhaps just saying "based on code by Krishna
Kishore <kthota@nvidia.com>" is enough...

> diff --git a/arch/arm/mach-tegra/pcie.c b/arch/arm/mach-tegra/pcie.c

> +static int tegra_pcie_enable_msi(struct platform_device *pdev)
> +{
> +	struct tegra_pcie_info *pcie = platform_get_drvdata(pdev);
> +	volatile void *pages;
> +	unsigned long base;
> +	unsigned int msi;
> +	int msi_base;
> +	int err;
> +	u32 reg;
> +
> +	mutex_init(&pcie->msi_lock);
> +
> +	msi_base = irq_alloc_descs(-1, 0, INT_PCI_MSI_NR, 0);
> +	if (msi_base < 0) {
> +		dev_err(&pdev->dev, "failed to allocate IRQs\n");
> +		return msi_base;
> +	}
> +
> +	pcie->msi_domain = irq_domain_add_legacy(pcie->dev->of_node,
> +						 INT_PCI_MSI_NR, msi_base,
> +						 0, &irq_domain_simple_ops,
> +						 NULL);
> +	if (!pcie->msi_domain) {
> +		dev_err(&pdev->dev, "failed to create IRQ domain\n");

Free the IRQ descriptors in the error paths?

> +		return -ENOMEM;
> +	}
> +
> +	pcie->msi_chip.name = "PCIe-MSI";
> +	pcie->msi_chip.irq_enable = unmask_msi_irq;
> +	pcie->msi_chip.irq_disable = mask_msi_irq;
> +	pcie->msi_chip.irq_mask = mask_msi_irq;
> +	pcie->msi_chip.irq_unmask = unmask_msi_irq;
> +
> +	for (msi = 0; msi < INT_PCI_MSI_NR; msi++) {
> +		unsigned int irq = irq_find_mapping(pcie->msi_domain, msi);
> +
> +		irq_set_chip_data(irq, pcie);
> +		irq_set_chip_and_handler(irq, &pcie->msi_chip,
> +					 handle_simple_irq);
> +		set_irq_flags(irq, IRQF_VALID);
> +	}
> +
> +	err = platform_get_irq(pdev, 1);
> +	if (err < 0) {
> +		dev_err(&pdev->dev, "failed to get IRQ: %d\n", err);

Same here, and undo setting IRQF_VALID?

> +		return err;
> +	}
...

> +static int tegra_pcie_disable_msi(struct platform_device *pdev)
> +{
> +	return 0;
> +}

This is empty in both the ifdef(CONFIG_PCI_MSI) case and otherwise. It
should probably clean everything up here right?

  reply	other threads:[~2012-03-08 21:14 UTC|newest]

Thread overview: 124+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-08 14:51 [PATCH 00/11] ARM: tegra: Add PCIe device tree support Thierry Reding
2012-03-08 14:51 ` Thierry Reding
2012-03-08 14:51 ` Thierry Reding
2012-03-08 14:51 ` [PATCH 01/11] drivercore: Add driver probe deferral mechanism Thierry Reding
2012-03-08 14:51   ` Thierry Reding
2012-03-19 23:12   ` Sylwester Nawrocki
2012-03-19 23:12     ` Sylwester Nawrocki
2012-03-19 23:12     ` Sylwester Nawrocki
2012-03-20 14:21     ` Grant Likely
2012-03-20 14:21       ` Grant Likely
2012-03-20 14:21       ` Grant Likely
2012-03-08 14:51 ` [PATCH 02/11] regulator: Support driver probe deferral Thierry Reding
2012-03-08 14:51   ` Thierry Reding
2012-03-08 14:51   ` Thierry Reding
2012-03-08 14:51 ` [PATCH 03/11] regulator: fixed: " Thierry Reding
2012-03-08 14:51   ` Thierry Reding
2012-03-08 14:51   ` Thierry Reding
2012-03-11 12:58   ` Mark Brown
2012-03-11 12:58     ` Mark Brown
2012-03-08 14:51 ` [PATCH 04/11] regulator: tps6586x: fix typo in debug message Thierry Reding
2012-03-08 14:51   ` Thierry Reding
2012-03-08 14:51   ` Thierry Reding
2012-03-08 19:08   ` Mark Brown
2012-03-08 19:08     ` Mark Brown
2012-03-08 19:08     ` Mark Brown
2012-03-08 14:51 ` [PATCH 05/11] tps6586x: Add device-tree support Thierry Reding
2012-03-08 14:51   ` Thierry Reding
2012-03-08 15:06   ` Mark Brown
2012-03-08 15:06     ` Mark Brown
2012-03-08 15:15     ` Thierry Reding
2012-03-08 15:15       ` Thierry Reding
2012-03-08 15:15       ` Thierry Reding
2012-03-08 15:17       ` Mark Brown
2012-03-08 15:17         ` Mark Brown
2012-03-08 15:45         ` Thierry Reding
2012-03-08 15:45           ` Thierry Reding
2012-03-09  5:15       ` Grant Likely
2012-03-09  5:15         ` Grant Likely
2012-03-09  5:15         ` Grant Likely
2012-03-09  7:53         ` Thierry Reding
2012-03-09  7:53           ` Thierry Reding
2012-03-09  7:53           ` Thierry Reding
2012-03-08 14:51 ` [PATCH 06/11] PCI: Keep pci_fixup_irqs() around after init Thierry Reding
2012-03-08 14:51   ` Thierry Reding
2012-03-08 14:51   ` Thierry Reding
2012-03-08 17:27   ` Bjorn Helgaas
2012-03-08 17:27     ` Bjorn Helgaas
2012-03-08 17:27     ` Bjorn Helgaas
2012-03-08 18:37     ` Thierry Reding
2012-03-08 18:37       ` Thierry Reding
2012-03-08 18:41       ` Bjorn Helgaas
2012-03-08 18:41         ` Bjorn Helgaas
2012-03-08 14:51 ` [PATCH 07/11] ARM: pci: Keep pci_common_init() " Thierry Reding
2012-03-08 14:51   ` Thierry Reding
2012-03-08 14:51   ` Thierry Reding
2012-03-08 14:51 ` [PATCH 08/11] ARM: tegra: Move tegra_pcie_xclk_clamp() to PMC Thierry Reding
2012-03-08 14:51   ` Thierry Reding
2012-03-08 14:51   ` Thierry Reding
2012-03-08 19:50   ` Stephen Warren
2012-03-08 19:50     ` Stephen Warren
2012-03-08 19:50     ` Stephen Warren
2012-03-08 14:51 ` [PATCH 09/11] ARM: tegra: Rewrite PCIe support as a driver Thierry Reding
2012-03-08 14:51   ` Thierry Reding
2012-03-08 14:51   ` Thierry Reding
2012-03-08 20:09   ` Stephen Warren
2012-03-08 20:09     ` Stephen Warren
2012-03-08 20:09     ` Stephen Warren
2012-03-09  6:37     ` Thierry Reding
2012-03-09  6:37       ` Thierry Reding
2012-03-09  6:37       ` Thierry Reding
2012-03-09 16:42       ` Stephen Warren
2012-03-09 16:42         ` Stephen Warren
2012-03-09 16:42         ` Stephen Warren
2012-03-08 14:51 ` [PATCH 10/11] ARM: tegra: pcie: Add MSI support Thierry Reding
2012-03-08 14:51   ` Thierry Reding
2012-03-08 14:51   ` Thierry Reding
2012-03-08 21:14   ` Stephen Warren [this message]
2012-03-08 21:14     ` Stephen Warren
2012-03-08 21:14     ` Stephen Warren
2012-03-09  6:50     ` Thierry Reding
2012-03-09  6:50       ` Thierry Reding
2012-03-09  6:50       ` Thierry Reding
2012-03-09 16:45       ` Stephen Warren
2012-03-09 16:45         ` Stephen Warren
2012-03-09 16:45         ` Stephen Warren
2012-03-12  8:00     ` Thierry Reding
2012-03-12  8:00       ` Thierry Reding
2012-03-12  8:00       ` Thierry Reding
2012-03-12 16:57       ` Stephen Warren
2012-03-12 16:57         ` Stephen Warren
2012-03-12 16:57         ` Stephen Warren
2012-03-08 14:51 ` [PATCH 11/11] ARM: tegra: pcie: Add device tree support Thierry Reding
2012-03-08 14:51   ` Thierry Reding
2012-03-08 14:51   ` Thierry Reding
2012-03-08 21:31   ` Stephen Warren
2012-03-08 21:31     ` Stephen Warren
2012-03-09  6:31     ` Thierry Reding
2012-03-09  6:31       ` Thierry Reding
2012-03-09  6:31       ` Thierry Reding
2012-03-09 16:47       ` Stephen Warren
2012-03-09 16:47         ` Stephen Warren
2012-03-09 16:47         ` Stephen Warren
2012-03-12 12:06     ` Mark Brown
2012-03-12 12:06       ` Mark Brown
2012-03-12 12:06       ` Mark Brown
2012-03-12 14:17       ` Thierry Reding
2012-03-12 14:17         ` Thierry Reding
2012-03-12 14:23         ` Mark Brown
2012-03-12 14:23           ` Mark Brown
2012-03-12 14:23           ` Mark Brown
2012-03-12 14:28           ` Thierry Reding
2012-03-12 14:28             ` Thierry Reding
2012-03-12 14:32             ` Mark Brown
2012-03-12 14:32               ` Mark Brown
2012-03-08 15:22 ` [PATCH 00/11] ARM: tegra: Add PCIe " Rob Herring
2012-03-08 15:22   ` Rob Herring
2012-03-08 15:22   ` Rob Herring
2012-03-08 15:43   ` Thierry Reding
2012-03-08 15:43     ` Thierry Reding
2012-03-09  4:54 ` Grant Likely
2012-03-09  4:54   ` Grant Likely
2012-03-18 17:31 ` Olof Johansson
2012-03-18 17:31   ` Olof Johansson
2012-03-18 17:31   ` Olof Johansson

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=4F59213F.6070107@wwwdotorg.org \
    --to=swarren@wwwdotorg.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=ccross@android.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@secretlab.ca \
    --cc=jbarnes@virtuousgeek.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=lrg@ti.com \
    --cc=olof@lixom.net \
    --cc=rob.herring@calxeda.com \
    --cc=thierry.reding@avionic-design.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.