2018-06-28 12:58:11

by Songxiaowei (Kirin_DRV)

[permalink] [raw]
Subject: [PATCH v5 0/1] *** PCI: kirin: Add MSI support ***

Before Version Patches
======================
patch v4
https://patchwork.kernel.org/patch/10402399/
patch v3
https://www.spinics.net/lists/linux-pci/msg72322.html
patch v2
https://www.spinics.net/lists/kernel/msg2797610.html

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

Changes between V5 and V4
=========================
1. rebase the patch based on Linux next-version branch.
2. fix issues according to review comments from Andy Shevchenko and Lorenzo.
(1) Del MSI irq handler for DW handle it, while Kirin only read the number from DT,
(2) Use the function dw_pcie_msi_init directly if CONFIG_PCI_MSI is enabled.

Changes between V4 and V3
=========================
1. remove DT binding patch, for Wei Xu had applied it.
2. fix issues according to review comments from Andy Shevchenko.
(1) Take the msi number get and request as a seperate function,
(2) Use the result of platform_get_irq as return val.

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'.

Xiaowei Song (1):
PCI: kirin: Add MSI support

drivers/pci/dwc/pcie-kirin.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)

--
2.11.GIT



2018-06-28 12:58:48

by Songxiaowei (Kirin_DRV)

[permalink] [raw]
Subject: [PATCH v5 1/1] PCI: kirin: Add MSI support

Add support for MSI.

Signed-off-by: Xiaowei Song <[email protected]>
---
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..6997276eb69c 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 ret = 0;
+
+ if (IS_ENABLED(CONFIG_PCI_MSI)) {
+ ret = platform_get_irq(pdev, 0);
+ if (ret < 0) {
+ dev_err(&pdev->dev,
+ "failed to get MSI IRQ (%d)\n", ret);
+ return ret;
+ }
+
+ pci->pp.msi_irq = ret;
+ }
+
+ return ret;
+}
+
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


2018-07-09 01:57:30

by Songxiaowei (Kirin_DRV)

[permalink] [raw]
Subject: 答复: [PATCH v5 1/1] PCI: kirin: Add MSI supp ort

Hi Bjorn Helgaas,

Would you help to review this patch?

Best regards,

Xiaowei.

> -----?ʼ?ԭ??-----
> ??????: Songxiaowei (Kirin_DRV)
> ????ʱ??: 2018??6??28?? 20:48
> ?ռ???: Wangbinghui <[email protected]>; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]
> ????: chenyao (F) <[email protected]>; Songxiaowei (Kirin_DRV)
> <[email protected]>
> ????: [PATCH v5 1/1] PCI: kirin: Add MSI support
>
> Add support for MSI.
>
> Signed-off-by: Xiaowei Song <[email protected]>
> ---
> 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..6997276eb69c 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 ret = 0;
> +
> + if (IS_ENABLED(CONFIG_PCI_MSI)) {
> + ret = platform_get_irq(pdev, 0);
> + if (ret < 0) {
> + dev_err(&pdev->dev,
> + "failed to get MSI IRQ (%d)\n", ret);
> + return ret;
> + }
> +
> + pci->pp.msi_irq = ret;
> + }
> +
> + return ret;
> +}
> +
> 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

2018-07-10 15:39:52

by Lorenzo Pieralisi

[permalink] [raw]
Subject: Re: 答复 : [PATCH v5 1/1] PCI: kirin: Add MSI support

On Mon, Jul 09, 2018 at 01:54:07AM +0000, Songxiaowei (Kirin_DRV) wrote:
> Hi Bjorn Helgaas,
>
> Would you help to review this patch?
>
> Best regards,
>
> Xiaowei.
>
> > -----邮件原件-----
> > 发件人: Songxiaowei (Kirin_DRV)
> > 发送时间: 2018年6月28日 20:48
> > 收件人: Wangbinghui <[email protected]>; [email protected];
> > [email protected]; [email protected]; [email protected];
> > [email protected]
> > 抄送: chenyao (F) <[email protected]>; Songxiaowei (Kirin_DRV)
> > <[email protected]>
> > 主题: [PATCH v5 1/1] PCI: kirin: Add MSI support
> >
> > Add support for MSI.
> >
> > Signed-off-by: Xiaowei Song <[email protected]>
> > ---
> > 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..6997276eb69c 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 ret = 0;
> > +
> > + if (IS_ENABLED(CONFIG_PCI_MSI)) {
> > + ret = platform_get_irq(pdev, 0);
> > + if (ret < 0) {
> > + dev_err(&pdev->dev,
> > + "failed to get MSI IRQ (%d)\n", ret);
> > + return ret;
> > + }
> > +
> > + pci->pp.msi_irq = ret;
> > + }
> > +
> > + return ret;
> > +}
> > +
> > 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;

If kirin_pcie_add_msi() returns an IRQ number we return from
this function here, is that what you really want ?

Lorenzo

> > +
> > pci->pp.ops = &kirin_pcie_host_ops;
> >
> > return dw_pcie_host_init(&pci->pp);
> > --
> > 2.11.GIT
>

2018-07-11 02:23:32

by Songxiaowei (Kirin_DRV)

[permalink] [raw]
Subject: 答复: 答复: [PATCH v5 1/1] PCI: kirin: Ad d MSI support



> -----邮件原件-----
> 发件人: Lorenzo Pieralisi [mailto:[email protected]]
> 发送时间: 2018年7月10日 23:40
> 收件人: Songxiaowei (Kirin_DRV) <[email protected]>
> 抄送: [email protected]; [email protected]; [email protected];
> [email protected]; chenyao (F) <[email protected]>
> 主题: Re: 答复: [PATCH v5 1/1] PCI: kirin: Add MSI support
>
> On Mon, Jul 09, 2018 at 01:54:07AM +0000, Songxiaowei (Kirin_DRV) wrote:
> > Hi Bjorn Helgaas,
> >
> > Would you help to review this patch?
> >
> > Best regards,
> >
> > Xiaowei.
> >
> > > -----邮件原件-----
> > > 发件人: Songxiaowei (Kirin_DRV)
> > > 发送时间: 2018年6月28日 20:48
> > > 收件人: Wangbinghui <[email protected]>;
> [email protected];
> > > [email protected]; [email protected];
> > > [email protected];
> > > [email protected]
> > > 抄送: chenyao (F) <[email protected]>; Songxiaowei (Kirin_DRV)
> > > <[email protected]>
> > > 主题: [PATCH v5 1/1] PCI: kirin: Add MSI support
> > >
> > > Add support for MSI.
> > >
> > > Signed-off-by: Xiaowei Song <[email protected]>
> > > ---
> > > 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..6997276eb69c
> > > 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 ret = 0;
> > > +
> > > + if (IS_ENABLED(CONFIG_PCI_MSI)) {
> > > + ret = platform_get_irq(pdev, 0);
> > > + if (ret < 0) {
> > > + dev_err(&pdev->dev,
> > > + "failed to get MSI IRQ (%d)\n", ret);
> > > + return ret;
> > > + }
> > > +
> > > + pci->pp.msi_irq = ret;
> > > + }
> > > +
> > > + return ret;
> > > +}
> > > +
> > > 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;
>
> If kirin_pcie_add_msi() returns an IRQ number we return from this function
> here, is that what you really want ?
[songxiaowei] Sorry about this issue, I'll check the patch carefully and test it on Hikey960 Board.
Thanks a lot for your time.

Best regards,
Xiaowei.
>
> Lorenzo
>
> > > +
> > > pci->pp.ops = &kirin_pcie_host_ops;
> > >
> > > return dw_pcie_host_init(&pci->pp);
> > > --
> > > 2.11.GIT
> >