[v7,1/1] PCI: kirin: Add MSI support

Message ID 20180711080946.14942-2-songxiaowei@hisilicon.com
State Accepted
Delegated to: Lorenzo Pieralisi
Headers show
Series
  • PCI: kirin: Add MSI support
Related show

Commit Message

Songxiaowei (Kirin_DRV) July 11, 2018, 8:09 a.m.
Add support for MSI

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

Comments

Andy Shevchenko July 11, 2018, 9:30 a.m. | #1
On Wed, Jul 11, 2018 at 11:09 AM, Xiaowei Song
<songxiaowei@hisilicon.com> wrote:
> Add support for MSI
>

FWIW,
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> Signed-off-by: Xiaowei Song <songxiaowei@hisilicon.com>
> Signed-off-by: Yao Chen <chenyao11@huawei.com>
> ---
>  drivers/pci/dwc/pcie-kirin.c | 28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
>
> diff --git a/drivers/pci/dwc/pcie-kirin.c b/drivers/pci/dwc/pcie-kirin.c
> index d2970a009eb5..5352e0c3be82 100644
> --- a/drivers/pci/dwc/pcie-kirin.c
> +++ b/drivers/pci/dwc/pcie-kirin.c
> @@ -430,6 +430,9 @@ static int kirin_pcie_host_init(struct pcie_port *pp)
>  {
>         kirin_pcie_establish_link(pp);
>
> +       if (IS_ENABLED(CONFIG_PCI_MSI))
> +               dw_pcie_msi_init(pp);
> +
>         return 0;
>  }
>
> @@ -445,9 +448,34 @@ static const struct dw_pcie_host_ops kirin_pcie_host_ops = {
>         .host_init = kirin_pcie_host_init,
>  };
>
> +static int kirin_pcie_add_msi(struct dw_pcie *pci,
> +                               struct platform_device *pdev)
> +{
> +       int irq;
> +
> +       if (IS_ENABLED(CONFIG_PCI_MSI)) {
> +               irq = platform_get_irq(pdev, 0);
> +               if (irq < 0) {
> +                       dev_err(&pdev->dev,
> +                               "failed to get MSI IRQ (%d)\n", irq);
> +                       return irq;
> +               }
> +
> +               pci->pp.msi_irq = irq;
> +       }
> +
> +       return 0;
> +}
> +
>  static int __init kirin_add_pcie_port(struct dw_pcie *pci,
>                                       struct platform_device *pdev)
>  {
> +       int ret;
> +
> +       ret = kirin_pcie_add_msi(pci, pdev);
> +       if (ret)
> +               return ret;
> +
>         pci->pp.ops = &kirin_pcie_host_ops;
>
>         return dw_pcie_host_init(&pci->pp);
> --
> 2.11.GIT
>
Songxiaowei (Kirin_DRV) July 11, 2018, 9:42 a.m. | #2
Hi Andy,

Thank you a lot.

Best Regards,
Xiaowei.

> -----邮件原件-----
> 发件人: Andy Shevchenko [mailto:andy.shevchenko@gmail.com]
> 发送时间: 2018年7月11日 17:30
> 收件人: Songxiaowei (Kirin_DRV) <songxiaowei@hisilicon.com>
> 抄送: Wangbinghui <wangbinghui@hisilicon.com>; Bjorn Helgaas
> <bhelgaas@google.com>; Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>;
> Rob Herring <robh+dt@kernel.org>; linux-pci@vger.kernel.org; Linux Kernel
> Mailing List <linux-kernel@vger.kernel.org>; Suzhuangluan
> <suzhuangluan@hisilicon.com>; Kongfei <kongfei@hisilicon.com>; chenyao
> (F) <chenyao11@huawei.com>
> 主题: Re: [PATCH v7 1/1] PCI: kirin: Add MSI support
> 
> On Wed, Jul 11, 2018 at 11:09 AM, Xiaowei Song
> <songxiaowei@hisilicon.com> wrote:
> > Add support for MSI
> >
> 
> FWIW,
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> 
> > Signed-off-by: Xiaowei Song <songxiaowei@hisilicon.com>
> > Signed-off-by: Yao Chen <chenyao11@huawei.com>
> > ---
> >  drivers/pci/dwc/pcie-kirin.c | 28 ++++++++++++++++++++++++++++
> >  1 file changed, 28 insertions(+)
> >
> > diff --git a/drivers/pci/dwc/pcie-kirin.c
> > b/drivers/pci/dwc/pcie-kirin.c index d2970a009eb5..5352e0c3be82
> 100644
> > --- a/drivers/pci/dwc/pcie-kirin.c
> > +++ b/drivers/pci/dwc/pcie-kirin.c
> > @@ -430,6 +430,9 @@ static int kirin_pcie_host_init(struct pcie_port
> > *pp)  {
> >         kirin_pcie_establish_link(pp);
> >
> > +       if (IS_ENABLED(CONFIG_PCI_MSI))
> > +               dw_pcie_msi_init(pp);
> > +
> >         return 0;
> >  }
> >
> > @@ -445,9 +448,34 @@ static const struct dw_pcie_host_ops
> kirin_pcie_host_ops = {
> >         .host_init = kirin_pcie_host_init,  };
> >
> > +static int kirin_pcie_add_msi(struct dw_pcie *pci,
> > +                               struct platform_device *pdev) {
> > +       int irq;
> > +
> > +       if (IS_ENABLED(CONFIG_PCI_MSI)) {
> > +               irq = platform_get_irq(pdev, 0);
> > +               if (irq < 0) {
> > +                       dev_err(&pdev->dev,
> > +                               "failed to get MSI IRQ (%d)\n", irq);
> > +                       return irq;
> > +               }
> > +
> > +               pci->pp.msi_irq = irq;
> > +       }
> > +
> > +       return 0;
> > +}
> > +
> >  static int __init kirin_add_pcie_port(struct dw_pcie *pci,
> >                                       struct platform_device *pdev)
> {
> > +       int ret;
> > +
> > +       ret = kirin_pcie_add_msi(pci, pdev);
> > +       if (ret)
> > +               return ret;
> > +
> >         pci->pp.ops = &kirin_pcie_host_ops;
> >
> >         return dw_pcie_host_init(&pci->pp);
> > --
> > 2.11.GIT
> >
> 
> 
> 
> --
> With Best Regards,
> Andy Shevchenko
Lorenzo Pieralisi July 11, 2018, 11:33 a.m. | #3
On Wed, Jul 11, 2018 at 04:09:46PM +0800, Xiaowei Song wrote:
> Add support for MSI
> 
> Signed-off-by: Xiaowei Song <songxiaowei@hisilicon.com>
> Signed-off-by: Yao Chen <chenyao11@huawei.com>
> ---
>  drivers/pci/dwc/pcie-kirin.c | 28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)

Applied to pci/dwc for v4.19, thanks.

Lorenzo

> diff --git a/drivers/pci/dwc/pcie-kirin.c b/drivers/pci/dwc/pcie-kirin.c
> index d2970a009eb5..5352e0c3be82 100644
> --- a/drivers/pci/dwc/pcie-kirin.c
> +++ b/drivers/pci/dwc/pcie-kirin.c
> @@ -430,6 +430,9 @@ static int kirin_pcie_host_init(struct pcie_port *pp)
>  {
>  	kirin_pcie_establish_link(pp);
>  
> +	if (IS_ENABLED(CONFIG_PCI_MSI))
> +		dw_pcie_msi_init(pp);
> +
>  	return 0;
>  }
>  
> @@ -445,9 +448,34 @@ static const struct dw_pcie_host_ops kirin_pcie_host_ops = {
>  	.host_init = kirin_pcie_host_init,
>  };
>  
> +static int kirin_pcie_add_msi(struct dw_pcie *pci,
> +				struct platform_device *pdev)
> +{
> +	int irq;
> +
> +	if (IS_ENABLED(CONFIG_PCI_MSI)) {
> +		irq = platform_get_irq(pdev, 0);
> +		if (irq < 0) {
> +			dev_err(&pdev->dev,
> +				"failed to get MSI IRQ (%d)\n", irq);
> +			return irq;
> +		}
> +
> +		pci->pp.msi_irq = irq;
> +	}
> +
> +	return 0;
> +}
> +
>  static int __init kirin_add_pcie_port(struct dw_pcie *pci,
>  				      struct platform_device *pdev)
>  {
> +	int ret;
> +
> +	ret = kirin_pcie_add_msi(pci, pdev);
> +	if (ret)
> +		return ret;
> +
>  	pci->pp.ops = &kirin_pcie_host_ops;
>  
>  	return dw_pcie_host_init(&pci->pp);
> -- 
> 2.11.GIT
>
Songxiaowei (Kirin_DRV) July 12, 2018, 1 a.m. | #4
Hi Lorenzo,

Thanks a lot.

Best Regards,
Xiaowei Song.

> -----邮件原件-----
> 发件人: Lorenzo Pieralisi [mailto:lorenzo.pieralisi@arm.com]
> 发送时间: 2018年7月11日 19:33
> 收件人: Songxiaowei (Kirin_DRV) <songxiaowei@hisilicon.com>
> 抄送: Wangbinghui <wangbinghui@hisilicon.com>; bhelgaas@google.com;
> robh+dt@kernel.org; linux-pci@vger.kernel.org; linux-kernel@vger.kernel.org;
> Suzhuangluan <suzhuangluan@hisilicon.com>; andy.shevchenko@gmail.com;
> Kongfei <kongfei@hisilicon.com>; chenyao (F) <chenyao11@huawei.com>
> 主题: Re: [PATCH v7 1/1] PCI: kirin: Add MSI support
> 
> On Wed, Jul 11, 2018 at 04:09:46PM +0800, Xiaowei Song wrote:
> > Add support for MSI
> >
> > Signed-off-by: Xiaowei Song <songxiaowei@hisilicon.com>
> > Signed-off-by: Yao Chen <chenyao11@huawei.com>
> > ---
> >  drivers/pci/dwc/pcie-kirin.c | 28 ++++++++++++++++++++++++++++
> >  1 file changed, 28 insertions(+)
> 
> Applied to pci/dwc for v4.19, thanks.
> 
> Lorenzo
> 
> > diff --git a/drivers/pci/dwc/pcie-kirin.c
> > b/drivers/pci/dwc/pcie-kirin.c index d2970a009eb5..5352e0c3be82
> 100644
> > --- a/drivers/pci/dwc/pcie-kirin.c
> > +++ b/drivers/pci/dwc/pcie-kirin.c
> > @@ -430,6 +430,9 @@ static int kirin_pcie_host_init(struct pcie_port
> > *pp)  {
> >  	kirin_pcie_establish_link(pp);
> >
> > +	if (IS_ENABLED(CONFIG_PCI_MSI))
> > +		dw_pcie_msi_init(pp);
> > +
> >  	return 0;
> >  }
> >
> > @@ -445,9 +448,34 @@ static const struct dw_pcie_host_ops
> kirin_pcie_host_ops = {
> >  	.host_init = kirin_pcie_host_init,
> >  };
> >
> > +static int kirin_pcie_add_msi(struct dw_pcie *pci,
> > +				struct platform_device *pdev)
> > +{
> > +	int irq;
> > +
> > +	if (IS_ENABLED(CONFIG_PCI_MSI)) {
> > +		irq = platform_get_irq(pdev, 0);
> > +		if (irq < 0) {
> > +			dev_err(&pdev->dev,
> > +				"failed to get MSI IRQ (%d)\n", irq);
> > +			return irq;
> > +		}
> > +
> > +		pci->pp.msi_irq = irq;
> > +	}
> > +
> > +	return 0;
> > +}
> > +
> >  static int __init kirin_add_pcie_port(struct dw_pcie *pci,
> >  				      struct platform_device *pdev)  {
> > +	int ret;
> > +
> > +	ret = kirin_pcie_add_msi(pci, pdev);
> > +	if (ret)
> > +		return ret;
> > +
> >  	pci->pp.ops = &kirin_pcie_host_ops;
> >
> >  	return dw_pcie_host_init(&pci->pp);
> > --
> > 2.11.GIT
> >

Patch

diff --git a/drivers/pci/dwc/pcie-kirin.c b/drivers/pci/dwc/pcie-kirin.c
index d2970a009eb5..5352e0c3be82 100644
--- a/drivers/pci/dwc/pcie-kirin.c
+++ b/drivers/pci/dwc/pcie-kirin.c
@@ -430,6 +430,9 @@  static int kirin_pcie_host_init(struct pcie_port *pp)
 {
 	kirin_pcie_establish_link(pp);
 
+	if (IS_ENABLED(CONFIG_PCI_MSI))
+		dw_pcie_msi_init(pp);
+
 	return 0;
 }
 
@@ -445,9 +448,34 @@  static const struct dw_pcie_host_ops kirin_pcie_host_ops = {
 	.host_init = kirin_pcie_host_init,
 };
 
+static int kirin_pcie_add_msi(struct dw_pcie *pci,
+				struct platform_device *pdev)
+{
+	int irq;
+
+	if (IS_ENABLED(CONFIG_PCI_MSI)) {
+		irq = platform_get_irq(pdev, 0);
+		if (irq < 0) {
+			dev_err(&pdev->dev,
+				"failed to get MSI IRQ (%d)\n", irq);
+			return irq;
+		}
+
+		pci->pp.msi_irq = irq;
+	}
+
+	return 0;
+}
+
 static int __init kirin_add_pcie_port(struct dw_pcie *pci,
 				      struct platform_device *pdev)
 {
+	int ret;
+
+	ret = kirin_pcie_add_msi(pci, pdev);
+	if (ret)
+		return ret;
+
 	pci->pp.ops = &kirin_pcie_host_ops;
 
 	return dw_pcie_host_init(&pci->pp);