linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] Add MSI support
@ 2018-05-11  9:15 Yao Chen
  2018-05-11  9:15 ` [PATCH v3 1/2] PCI: kirin: " Yao Chen
  2018-05-11  9:15 ` [PATCH v3 2/2] arm64: dts: hi3660: Add pcie msi interrupt attribute Yao Chen
  0 siblings, 2 replies; 5+ messages in thread
From: Yao Chen @ 2018-05-11  9:15 UTC (permalink / raw)
  To: songxiaowei, wangbinghui, lorenzo.pieralisi, bhelgaas, xuwei5,
	robh+dt, mark.rutland, catalin.marinas, will.deacon, linux-pci,
	linux-kernel, linux-arm-kernel, devicetree
  Cc: dimitrysh, guodong.xu, chenyao11, suzhuangluan, kongfei

Before Version Patches
======================
patch v2
https://www.spinics.net/lists/kernel/msg2797610.html

patch v1
https://www.spinics.net/lists/kernel/msg2796410.html

Changes between V3 and V2
=========================
1. fix issues according to review comments
   (1)from Bjorn Helgaas: Check for 'pci->pp.msi_irq < 0'.
   (2)from Bjorn Helgaas: Update the message of 'msi irq' in dev_err().

Changes between V2 and V1
=========================
1. seperate DT binding patch.
2. fix issues according to review comments
   (1)from Bjorn Helgaas: Update the style of subject and changelog.
   (2)from Bjorn Helgaas: Add msi irq number in the message.
   (3)from Bjorn Helgaas: Delete unnecessary code 'pci->pp.root_bus_nr = -1'.
   (4)from Dmitry Shmidt: Fix typing error. Replace 'interrupts-names' of 'interrupt-names'.

Yao Chen (2):
  PCI: kirin: Add MSI support
  arm64: dts: hi3660: Add pcie msi interrupt attribute

 arch/arm64/boot/dts/hisilicon/hi3660.dtsi |  2 ++
 drivers/pci/dwc/pcie-kirin.c              | 39 +++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v3 1/2] PCI: kirin: Add MSI support
  2018-05-11  9:15 [PATCH v3 0/2] Add MSI support Yao Chen
@ 2018-05-11  9:15 ` Yao Chen
  2018-05-13 23:16   ` Andy Shevchenko
  2018-05-11  9:15 ` [PATCH v3 2/2] arm64: dts: hi3660: Add pcie msi interrupt attribute Yao Chen
  1 sibling, 1 reply; 5+ messages in thread
From: Yao Chen @ 2018-05-11  9:15 UTC (permalink / raw)
  To: songxiaowei, wangbinghui, lorenzo.pieralisi, bhelgaas, xuwei5,
	robh+dt, mark.rutland, catalin.marinas, will.deacon, linux-pci,
	linux-kernel, linux-arm-kernel, devicetree
  Cc: dimitrysh, guodong.xu, chenyao11, suzhuangluan, kongfei

Add support for MSI.

Signed-off-by: Yao Chen <chenyao11@huawei.com>
---
 drivers/pci/dwc/pcie-kirin.c | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/drivers/pci/dwc/pcie-kirin.c b/drivers/pci/dwc/pcie-kirin.c
index d2970a0..8daab1f 100644
--- a/drivers/pci/dwc/pcie-kirin.c
+++ b/drivers/pci/dwc/pcie-kirin.c
@@ -426,9 +426,28 @@ static int kirin_pcie_establish_link(struct pcie_port *pp)
 	return 0;
 }
 
+static irqreturn_t kirin_pcie_msi_irq_handler(int irq, void *arg)
+{
+	struct pcie_port *pp = arg;
+
+	return dw_handle_msi_irq(pp);
+}
+
+static void kirin_pcie_msi_init(struct pcie_port *pp)
+{
+	dw_pcie_msi_init(pp);
+}
+
+static void kirin_pcie_enable_interrupts(struct pcie_port *pp)
+{
+	if (IS_ENABLED(CONFIG_PCI_MSI))
+		kirin_pcie_msi_init(pp);
+}
+
 static int kirin_pcie_host_init(struct pcie_port *pp)
 {
 	kirin_pcie_establish_link(pp);
+	kirin_pcie_enable_interrupts(pp);
 
 	return 0;
 }
@@ -448,6 +467,26 @@ static int kirin_pcie_host_init(struct pcie_port *pp)
 static int __init kirin_add_pcie_port(struct dw_pcie *pci,
 				      struct platform_device *pdev)
 {
+	int ret;
+
+	if (IS_ENABLED(CONFIG_PCI_MSI)) {
+		pci->pp.msi_irq = platform_get_irq(pdev, 0);
+		if (pci->pp.msi_irq < 0) {
+			dev_err(&pdev->dev, "failed to get MSI IRQ (%d)\n",
+				pci->pp.msi_irq);
+			return -ENODEV;
+		}
+		ret = devm_request_irq(&pdev->dev, pci->pp.msi_irq,
+				       kirin_pcie_msi_irq_handler,
+				       IRQF_SHARED | IRQF_NO_THREAD,
+				       "kirin_pcie_msi", &pci->pp);
+		if (ret) {
+			dev_err(&pdev->dev, "failed to request MSI IRQ %d\n",
+				pci->pp.msi_irq);
+			return ret;
+		}
+	}
+
 	pci->pp.ops = &kirin_pcie_host_ops;
 
 	return dw_pcie_host_init(&pci->pp);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v3 2/2] arm64: dts: hi3660: Add pcie msi interrupt attribute
  2018-05-11  9:15 [PATCH v3 0/2] Add MSI support Yao Chen
  2018-05-11  9:15 ` [PATCH v3 1/2] PCI: kirin: " Yao Chen
@ 2018-05-11  9:15 ` Yao Chen
  2018-05-11 14:09   ` Wei Xu
  1 sibling, 1 reply; 5+ messages in thread
From: Yao Chen @ 2018-05-11  9:15 UTC (permalink / raw)
  To: songxiaowei, wangbinghui, lorenzo.pieralisi, bhelgaas, xuwei5,
	robh+dt, mark.rutland, catalin.marinas, will.deacon, linux-pci,
	linux-kernel, linux-arm-kernel, devicetree
  Cc: dimitrysh, guodong.xu, chenyao11, suzhuangluan, kongfei

Add pcie msi interrupt attribute for hi3660 SOC.

Signed-off-by: Yao Chen <chenyao11@huawei.com>
---
 arch/arm64/boot/dts/hisilicon/hi3660.dtsi | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
index ec3eb8e..2cef8f4 100644
--- a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
+++ b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
@@ -872,6 +872,8 @@
 				  0x0 0x02000000>;
 			num-lanes = <1>;
 			#interrupt-cells = <1>;
+			interrupts = <0 283 4>;
+			interrupt-names = "msi";
 			interrupt-map-mask = <0xf800 0 0 7>;
 			interrupt-map = <0x0 0 0 1
 					 &gic GIC_SPI 282 IRQ_TYPE_LEVEL_HIGH>,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v3 2/2] arm64: dts: hi3660: Add pcie msi interrupt attribute
  2018-05-11  9:15 ` [PATCH v3 2/2] arm64: dts: hi3660: Add pcie msi interrupt attribute Yao Chen
@ 2018-05-11 14:09   ` Wei Xu
  0 siblings, 0 replies; 5+ messages in thread
From: Wei Xu @ 2018-05-11 14:09 UTC (permalink / raw)
  To: Yao Chen, songxiaowei, wangbinghui, lorenzo.pieralisi, bhelgaas,
	robh+dt, mark.rutland, catalin.marinas, will.deacon, linux-pci,
	linux-kernel, linux-arm-kernel, devicetree
  Cc: dimitrysh, guodong.xu, suzhuangluan, kongfei, xuwei5

Hi Yao,

On 2018/5/11 10:15, Yao Chen wrote:
> Add pcie msi interrupt attribute for hi3660 SOC.
> 
> Signed-off-by: Yao Chen <chenyao11@huawei.com>

Applied patch 2 into the hisilicon dt tree.
Thanks!

BR,
Wei

> ---
>  arch/arm64/boot/dts/hisilicon/hi3660.dtsi | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
> index ec3eb8e..2cef8f4 100644
> --- a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
> +++ b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
> @@ -872,6 +872,8 @@
>  				  0x0 0x02000000>;
>  			num-lanes = <1>;
>  			#interrupt-cells = <1>;
> +			interrupts = <0 283 4>;
> +			interrupt-names = "msi";
>  			interrupt-map-mask = <0xf800 0 0 7>;
>  			interrupt-map = <0x0 0 0 1
>  					 &gic GIC_SPI 282 IRQ_TYPE_LEVEL_HIGH>,
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3 1/2] PCI: kirin: Add MSI support
  2018-05-11  9:15 ` [PATCH v3 1/2] PCI: kirin: " Yao Chen
@ 2018-05-13 23:16   ` Andy Shevchenko
  0 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2018-05-13 23:16 UTC (permalink / raw)
  To: Yao Chen
  Cc: songxiaowei, wangbinghui, Lorenzo Pieralisi, Bjorn Helgaas,
	xuwei (O),
	Rob Herring, Mark Rutland, Catalin Marinas, Will Deacon,
	linux-pci, Linux Kernel Mailing List, linux-arm Mailing List,
	devicetree, dimitrysh, guodong.xu, suzhuangluan, kongfei

On Fri, May 11, 2018 at 12:15 PM, Yao Chen <chenyao11@huawei.com> wrote:
> Add support for MSI.


> +       int ret;
> +
> +       if (IS_ENABLED(CONFIG_PCI_MSI)) {

> +               pci->pp.msi_irq = platform_get_irq(pdev, 0);
> +               if (pci->pp.msi_irq < 0) {
> +                       dev_err(&pdev->dev, "failed to get MSI IRQ (%d)\n",
> +                               pci->pp.msi_irq);

> +                       return -ENODEV;

Why shadowing actual error code?

> +               }
> +               ret = devm_request_irq(&pdev->dev, pci->pp.msi_irq,
> +                                      kirin_pcie_msi_irq_handler,
> +                                      IRQF_SHARED | IRQF_NO_THREAD,
> +                                      "kirin_pcie_msi", &pci->pp);
> +               if (ret) {
> +                       dev_err(&pdev->dev, "failed to request MSI IRQ %d\n",
> +                               pci->pp.msi_irq);
> +                       return ret;
> +               }

It would be easy to read and maintain if this would be a separate function.

> +       }



-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-05-13 23:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-11  9:15 [PATCH v3 0/2] Add MSI support Yao Chen
2018-05-11  9:15 ` [PATCH v3 1/2] PCI: kirin: " Yao Chen
2018-05-13 23:16   ` Andy Shevchenko
2018-05-11  9:15 ` [PATCH v3 2/2] arm64: dts: hi3660: Add pcie msi interrupt attribute Yao Chen
2018-05-11 14:09   ` Wei Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).