linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] fix loadable module for DPAA Ethernet
@ 2017-06-19 15:04 Madalin Bucur
  2017-06-19 15:04 ` [PATCH 1/2] fsl/fman: propagate dma_ops Madalin Bucur
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Madalin Bucur @ 2017-06-19 15:04 UTC (permalink / raw)
  To: netdev, davem; +Cc: linuxppc-dev, linux-kernel, Madalin Bucur

The DPAA Ethernet makes use of a symbol that is not exported.
Address the issue by propagating the dma_ops rather than calling
arch_setup_dma_ops().

Madalin Bucur (2):
  fsl/fman: propagate dma_ops
  dpaa_eth: reuse the dma_ops provided by the FMan MAC device

 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 2 +-
 drivers/net/ethernet/freescale/fman/mac.c      | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

-- 
2.1.0

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

* [PATCH 1/2] fsl/fman: propagate dma_ops
  2017-06-19 15:04 [PATCH 0/2] fix loadable module for DPAA Ethernet Madalin Bucur
@ 2017-06-19 15:04 ` Madalin Bucur
  2017-06-26  7:48   ` Geert Uytterhoeven
  2017-06-19 15:04 ` [PATCH 2/2] dpaa_eth: reuse the dma_ops provided by the FMan MAC device Madalin Bucur
  2017-06-20 17:47 ` [PATCH 0/2] fix loadable module for DPAA Ethernet David Miller
  2 siblings, 1 reply; 8+ messages in thread
From: Madalin Bucur @ 2017-06-19 15:04 UTC (permalink / raw)
  To: netdev, davem; +Cc: linuxppc-dev, linux-kernel, Madalin Bucur

Make sure dma_ops are set, to be later used by the Ethernet driver.

Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
---
 drivers/net/ethernet/freescale/fman/mac.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c
index 0b31f85..6e67d22f 100644
--- a/drivers/net/ethernet/freescale/fman/mac.c
+++ b/drivers/net/ethernet/freescale/fman/mac.c
@@ -623,6 +623,8 @@ static struct platform_device *dpaa_eth_add_device(int fman_id,
 		goto no_mem;
 	}
 
+	set_dma_ops(&pdev->dev, get_dma_ops(priv->dev));
+
 	ret = platform_device_add_data(pdev, &data, sizeof(data));
 	if (ret)
 		goto err;
-- 
2.1.0

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

* [PATCH 2/2] dpaa_eth: reuse the dma_ops provided by the FMan MAC device
  2017-06-19 15:04 [PATCH 0/2] fix loadable module for DPAA Ethernet Madalin Bucur
  2017-06-19 15:04 ` [PATCH 1/2] fsl/fman: propagate dma_ops Madalin Bucur
@ 2017-06-19 15:04 ` Madalin Bucur
  2017-06-20 17:47 ` [PATCH 0/2] fix loadable module for DPAA Ethernet David Miller
  2 siblings, 0 replies; 8+ messages in thread
From: Madalin Bucur @ 2017-06-19 15:04 UTC (permalink / raw)
  To: netdev, davem; +Cc: linuxppc-dev, linux-kernel, Madalin Bucur

Remove the use of arch_setup_dma_ops() that was not exported
and was breaking loadable module compilation.

Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
---
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index 9a520e4..290ad05 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -2647,7 +2647,7 @@ static int dpaa_eth_probe(struct platform_device *pdev)
 	priv->buf_layout[TX].priv_data_size = DPAA_TX_PRIV_DATA_SIZE; /* Tx */
 
 	/* device used for DMA mapping */
-	arch_setup_dma_ops(dev, 0, 0, NULL, false);
+	set_dma_ops(dev, get_dma_ops(&pdev->dev));
 	err = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(40));
 	if (err) {
 		dev_err(dev, "dma_coerce_mask_and_coherent() failed\n");
-- 
2.1.0

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

* Re: [PATCH 0/2] fix loadable module for DPAA Ethernet
  2017-06-19 15:04 [PATCH 0/2] fix loadable module for DPAA Ethernet Madalin Bucur
  2017-06-19 15:04 ` [PATCH 1/2] fsl/fman: propagate dma_ops Madalin Bucur
  2017-06-19 15:04 ` [PATCH 2/2] dpaa_eth: reuse the dma_ops provided by the FMan MAC device Madalin Bucur
@ 2017-06-20 17:47 ` David Miller
  2 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2017-06-20 17:47 UTC (permalink / raw)
  To: madalin.bucur; +Cc: netdev, linuxppc-dev, linux-kernel

From: Madalin Bucur <madalin.bucur@nxp.com>
Date: Mon, 19 Jun 2017 18:04:15 +0300

> The DPAA Ethernet makes use of a symbol that is not exported.
> Address the issue by propagating the dma_ops rather than calling
> arch_setup_dma_ops().

Series applied, thanks.

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

* Re: [PATCH 1/2] fsl/fman: propagate dma_ops
  2017-06-19 15:04 ` [PATCH 1/2] fsl/fman: propagate dma_ops Madalin Bucur
@ 2017-06-26  7:48   ` Geert Uytterhoeven
  2017-06-26 14:55     ` Madalin-cristian Bucur
  0 siblings, 1 reply; 8+ messages in thread
From: Geert Uytterhoeven @ 2017-06-26  7:48 UTC (permalink / raw)
  To: madalin.bucur; +Cc: netdev, David S. Miller, linuxppc-dev, linux-kernel

Hi Madalin,

On Mon, Jun 19, 2017 at 5:04 PM, Madalin Bucur <madalin.bucur@nxp.com> wrote:
> Make sure dma_ops are set, to be later used by the Ethernet driver.
>
> Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
> ---
>  drivers/net/ethernet/freescale/fman/mac.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c
> index 0b31f85..6e67d22f 100644
> --- a/drivers/net/ethernet/freescale/fman/mac.c
> +++ b/drivers/net/ethernet/freescale/fman/mac.c
> @@ -623,6 +623,8 @@ static struct platform_device *dpaa_eth_add_device(int fman_id,
>                 goto no_mem;
>         }
>
> +       set_dma_ops(&pdev->dev, get_dma_ops(priv->dev));
> +

When compile-testing with f NO_DMA=y:

    drivers/net/ethernet/freescale/fman/mac.c: In function
‘dpaa_eth_add_device’:
    drivers/net/ethernet/freescale/fman/mac.c:626: error: implicit
declaration of function ‘set_dma_ops’

Reverting commit 5567e989198b5a8d fixes this regression in v4.12-rc7.

Why is this change needed?
There's no single other call to the DMA API in this file?

If it's really needed, can't set_dma_ops() be called from the driver that
needs it, cfr. your other patch "[PATCH 2/2] dpaa_eth: reuse the dma_ops
provided by the FMan MAC device"?

Thanks!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* RE: [PATCH 1/2] fsl/fman: propagate dma_ops
  2017-06-26  7:48   ` Geert Uytterhoeven
@ 2017-06-26 14:55     ` Madalin-cristian Bucur
  2017-06-26 16:24       ` Geert Uytterhoeven
  0 siblings, 1 reply; 8+ messages in thread
From: Madalin-cristian Bucur @ 2017-06-26 14:55 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: netdev, David S. Miller, linuxppc-dev, linux-kernel

> -----Original Message-----
> From: geert.uytterhoeven@gmail.com [mailto:geert.uytterhoeven@gmail.com]
> On Behalf Of Geert Uytterhoeven
> Sent: Monday, June 26, 2017 10:49 AM
> To: Madalin-cristian Bucur <madalin.bucur@nxp.com>
> Cc: netdev@vger.kernel.org; David S. Miller <davem@davemloft.net>;
> linuxppc-dev@lists.ozlabs.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH 1/2] fsl/fman: propagate dma_ops
> 
> Hi Madalin,
> 
> On Mon, Jun 19, 2017 at 5:04 PM, Madalin Bucur <madalin.bucur@nxp.com>
> wrote:
> > Make sure dma_ops are set, to be later used by the Ethernet driver.
> >
> > Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
> > ---
> >  drivers/net/ethernet/freescale/fman/mac.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/net/ethernet/freescale/fman/mac.c
> b/drivers/net/ethernet/freescale/fman/mac.c
> > index 0b31f85..6e67d22f 100644
> > --- a/drivers/net/ethernet/freescale/fman/mac.c
> > +++ b/drivers/net/ethernet/freescale/fman/mac.c
> > @@ -623,6 +623,8 @@ static struct platform_device
> *dpaa_eth_add_device(int fman_id,
> >                 goto no_mem;
> >         }
> >
> > +       set_dma_ops(&pdev->dev, get_dma_ops(priv->dev));
> > +
> 
> When compile-testing with f NO_DMA=y:
> 
>     drivers/net/ethernet/freescale/fman/mac.c: In function
> ‘dpaa_eth_add_device’:
>     drivers/net/ethernet/freescale/fman/mac.c:626: error: implicit
> declaration of function ‘set_dma_ops’
> 
> Reverting commit 5567e989198b5a8d fixes this regression in v4.12-rc7.
> 
> Why is this change needed?
> There's no single other call to the DMA API in this file?

We're setting here the dma_ops that are later used in the other driver/patch.
The problem is we now depend upon DMA but do not explicitly declare it:

<<Code that depends on the dma-mapping API needs to set 'depends on HAS_DMA'
in its Kconfig>>

I'll need to add this to the FMan driver Kconfig. 

> If it's really needed, can't set_dma_ops() be called from the driver that
> needs it, cfr. your other patch "[PATCH 2/2] dpaa_eth: reuse the dma_ops
> provided by the FMan MAC device"?
> 
> Thanks!
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-
> m68k.org
> 
> In personal conversations with technical people, I call myself a hacker.
> But
> when I'm talking to journalists I just say "programmer" or something like
> that.
>                                 -- Linus Torvalds

Thanks,
Madalin

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

* Re: [PATCH 1/2] fsl/fman: propagate dma_ops
  2017-06-26 14:55     ` Madalin-cristian Bucur
@ 2017-06-26 16:24       ` Geert Uytterhoeven
  2017-06-27  6:49         ` Madalin-cristian Bucur
  0 siblings, 1 reply; 8+ messages in thread
From: Geert Uytterhoeven @ 2017-06-26 16:24 UTC (permalink / raw)
  To: Madalin-cristian Bucur
  Cc: netdev, David S. Miller, linuxppc-dev, linux-kernel

Hi Madalin,

On Mon, Jun 26, 2017 at 4:55 PM, Madalin-cristian Bucur
<madalin.bucur@nxp.com> wrote:
>> -----Original Message-----
>> From: geert.uytterhoeven@gmail.com [mailto:geert.uytterhoeven@gmail.com]
>> On Behalf Of Geert Uytterhoeven
>> Sent: Monday, June 26, 2017 10:49 AM
>> To: Madalin-cristian Bucur <madalin.bucur@nxp.com>
>> Cc: netdev@vger.kernel.org; David S. Miller <davem@davemloft.net>;
>> linuxppc-dev@lists.ozlabs.org; linux-kernel@vger.kernel.org
>> Subject: Re: [PATCH 1/2] fsl/fman: propagate dma_ops
>>
> On Mon, Jun 19, 2017 at 5:04 PM, Madalin Bucur <madalin.bucur@nxp.com>
>> wrote:
>> > Make sure dma_ops are set, to be later used by the Ethernet driver.
>> >
>> > Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
>> > ---
>> >  drivers/net/ethernet/freescale/fman/mac.c | 2 ++
>> >  1 file changed, 2 insertions(+)
>> >
>> > diff --git a/drivers/net/ethernet/freescale/fman/mac.c
>> b/drivers/net/ethernet/freescale/fman/mac.c
>> > index 0b31f85..6e67d22f 100644
>> > --- a/drivers/net/ethernet/freescale/fman/mac.c
>> > +++ b/drivers/net/ethernet/freescale/fman/mac.c
>> > @@ -623,6 +623,8 @@ static struct platform_device
>> *dpaa_eth_add_device(int fman_id,
>> >                 goto no_mem;
>> >         }
>> >
>> > +       set_dma_ops(&pdev->dev, get_dma_ops(priv->dev));
>> > +
>>
>> When compile-testing with f NO_DMA=y:
>>
>>     drivers/net/ethernet/freescale/fman/mac.c: In function
>> ‘dpaa_eth_add_device’:
>>     drivers/net/ethernet/freescale/fman/mac.c:626: error: implicit
>> declaration of function ‘set_dma_ops’
>>
>> Reverting commit 5567e989198b5a8d fixes this regression in v4.12-rc7.
>>
>> Why is this change needed?
>> There's no single other call to the DMA API in this file?
>
> We're setting here the dma_ops that are later used in the other driver/patch.
> The problem is we now depend upon DMA but do not explicitly declare it:
>
> <<Code that depends on the dma-mapping API needs to set 'depends on HAS_DMA'
> in its Kconfig>>

Sure. But only if the driver really uses DMA.
I can stick a set_dma_ops() call in whatever driver, but that doesn't
mean it will
suddenly use DMA.
Why does the FMan driver suddenly has a dependency on DMA, if it doesn't
use DMA?

> I'll need to add this to the FMan driver Kconfig.

Why does the FMan driver need this?
Why can't his call be done in the driver that uses the DMA APIO?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* RE: [PATCH 1/2] fsl/fman: propagate dma_ops
  2017-06-26 16:24       ` Geert Uytterhoeven
@ 2017-06-27  6:49         ` Madalin-cristian Bucur
  0 siblings, 0 replies; 8+ messages in thread
From: Madalin-cristian Bucur @ 2017-06-27  6:49 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: netdev, David S. Miller, linuxppc-dev, linux-kernel

> -----Original Message-----
> From: geert.uytterhoeven@gmail.com [mailto:geert.uytterhoeven@gmail.com]
> On Behalf Of Geert Uytterhoeven
> Sent: Monday, June 26, 2017 7:24 PM
> To: Madalin-cristian Bucur <madalin.bucur@nxp.com>
> Cc: netdev@vger.kernel.org; David S. Miller <davem@davemloft.net>;
> linuxppc-dev@lists.ozlabs.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH 1/2] fsl/fman: propagate dma_ops
> 
> Hi Madalin,
> 
> On Mon, Jun 26, 2017 at 4:55 PM, Madalin-cristian Bucur
> <madalin.bucur@nxp.com> wrote:
> >> -----Original Message-----
> >> From: geert.uytterhoeven@gmail.com
> [mailto:geert.uytterhoeven@gmail.com]
> >> On Behalf Of Geert Uytterhoeven
> >> Sent: Monday, June 26, 2017 10:49 AM
> >> To: Madalin-cristian Bucur <madalin.bucur@nxp.com>
> >> Cc: netdev@vger.kernel.org; David S. Miller <davem@davemloft.net>;
> >> linuxppc-dev@lists.ozlabs.org; linux-kernel@vger.kernel.org
> >> Subject: Re: [PATCH 1/2] fsl/fman: propagate dma_ops
> >>
> > On Mon, Jun 19, 2017 at 5:04 PM, Madalin Bucur <madalin.bucur@nxp.com>
> >> wrote:
> >> > Make sure dma_ops are set, to be later used by the Ethernet driver.
> >> >
> >> > Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
> >> > ---
> >> >  drivers/net/ethernet/freescale/fman/mac.c | 2 ++
> >> >  1 file changed, 2 insertions(+)
> >> >
> >> > diff --git a/drivers/net/ethernet/freescale/fman/mac.c
> >> b/drivers/net/ethernet/freescale/fman/mac.c
> >> > index 0b31f85..6e67d22f 100644
> >> > --- a/drivers/net/ethernet/freescale/fman/mac.c
> >> > +++ b/drivers/net/ethernet/freescale/fman/mac.c
> >> > @@ -623,6 +623,8 @@ static struct platform_device
> >> *dpaa_eth_add_device(int fman_id,
> >> >                 goto no_mem;
> >> >         }
> >> >
> >> > +       set_dma_ops(&pdev->dev, get_dma_ops(priv->dev));
> >> > +
> >>
> >> When compile-testing with f NO_DMA=y:
> >>
> >>     drivers/net/ethernet/freescale/fman/mac.c: In function
> >> ‘dpaa_eth_add_device’:
> >>     drivers/net/ethernet/freescale/fman/mac.c:626: error: implicit
> >> declaration of function ‘set_dma_ops’
> >>
> >> Reverting commit 5567e989198b5a8d fixes this regression in v4.12-rc7.
> >>
> >> Why is this change needed?
> >> There's no single other call to the DMA API in this file?
> >
> > We're setting here the dma_ops that are later used in the other
> driver/patch.
> > The problem is we now depend upon DMA but do not explicitly declare it:
> >
> > <<Code that depends on the dma-mapping API needs to set 'depends on
> HAS_DMA'
> > in its Kconfig>>
> 
> Sure. But only if the driver really uses DMA.
> I can stick a set_dma_ops() call in whatever driver, but that doesn't
> mean it will
> suddenly use DMA.
> Why does the FMan driver suddenly has a dependency on DMA, if it doesn't
> use DMA?
> 
> > I'll need to add this to the FMan driver Kconfig.
> 
> Why does the FMan driver need this?
> Why can't his call be done in the driver that uses the DMA APIO?

The DPAA Ethernet driver makes use of DMA ops. It used to get them from
an API call (arch_setup_dma_ops) that was not exported. The DPAA Ethernet
that makes use of the FMan devices does not get the dma_ops as it does not
probe neither as an OF platform device nor thorough ACPI. It probes as a
platform device based on information prepared by the FMan driver. What the
FMan change [1] does is supplement the information shared with the Ethernet
driver with the dma_ops that the FMan driver gets during OF probing. There
are no scenarios one can use the DPAA drivers with NO_DMA, as far as I know.

For general info on the DPAA drivers please refer to the documentation
found in Documentation/networking/dpaa.txt. For the probing of the Ethernet
driver see change [2] and dpaa_eth_add_device() in fsl/fman, dpaa_eth_probe()
in dpaa_eth.
 
[1] 5567e989198b5a8d fsl/fman: propagate dma_ops
[2] fb52728a9294d97d dpaa_eth: reuse the dma_ops provided by the FMan MAC device

> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-
> m68k.org
> 
> In personal conversations with technical people, I call myself a hacker.
> But
> when I'm talking to journalists I just say "programmer" or something like
> that.
>                                 -- Linus Torvalds

Thanks,
Madalin

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

end of thread, other threads:[~2017-06-27  6:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-19 15:04 [PATCH 0/2] fix loadable module for DPAA Ethernet Madalin Bucur
2017-06-19 15:04 ` [PATCH 1/2] fsl/fman: propagate dma_ops Madalin Bucur
2017-06-26  7:48   ` Geert Uytterhoeven
2017-06-26 14:55     ` Madalin-cristian Bucur
2017-06-26 16:24       ` Geert Uytterhoeven
2017-06-27  6:49         ` Madalin-cristian Bucur
2017-06-19 15:04 ` [PATCH 2/2] dpaa_eth: reuse the dma_ops provided by the FMan MAC device Madalin Bucur
2017-06-20 17:47 ` [PATCH 0/2] fix loadable module for DPAA Ethernet David Miller

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