diff mbox series

[v5,1/7] riscv: Add DMA 64-bit address support

Message ID 20201202203211.2843-2-padmarao.begari@microchip.com
State Superseded
Delegated to: Andes
Headers show
Series Microchip PolarFire SoC support | expand

Commit Message

Padmarao Begari Dec. 2, 2020, 8:32 p.m. UTC
dma_addr_t holds any valid DMA address. If the DMA API only uses 32/64-bit
addresses, dma_addr_t need only be 32/64 bits wide.

Signed-off-by: Padmarao Begari <padmarao.begari@microchip.com>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
---
 arch/riscv/Kconfig             | 4 ++++
 arch/riscv/include/asm/types.h | 4 ++++
 2 files changed, 8 insertions(+)

Comments

Bin Meng Dec. 10, 2020, 10:40 a.m. UTC | #1
Hi Padmarao,

On Thu, Dec 3, 2020 at 4:43 AM Padmarao Begari
<padmarao.begari@microchip.com> wrote:
>
> dma_addr_t holds any valid DMA address. If the DMA API only uses 32/64-bit
> addresses, dma_addr_t need only be 32/64 bits wide.
>
> Signed-off-by: Padmarao Begari <padmarao.begari@microchip.com>
> Reviewed-by: Anup Patel <anup.patel@wdc.com>
> ---
>  arch/riscv/Kconfig             | 4 ++++
>  arch/riscv/include/asm/types.h | 4 ++++
>  2 files changed, 8 insertions(+)
>
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index 30b05408b1..55eaee2da6 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -152,6 +152,10 @@ config 32BIT
>  config 64BIT
>         bool
>
> +config DMA_ADDR_T_64BIT
> +       bool
> +       default y if 64BIT
> +
>  config SIFIVE_CLINT
>         bool
>         depends on RISCV_MMODE || SPL_RISCV_MMODE
> diff --git a/arch/riscv/include/asm/types.h b/arch/riscv/include/asm/types.h
> index 403cf9a48f..b800b2d221 100644
> --- a/arch/riscv/include/asm/types.h
> +++ b/arch/riscv/include/asm/types.h
> @@ -29,7 +29,11 @@ typedef unsigned short umode_t;
>
>  #include <stddef.h>
>
> +#ifdef CONFIG_DMA_ADDR_T_64BIT
> +typedef u64 dma_addr_t;
> +#else
>  typedef u32 dma_addr_t;
> +#endif

Why is this patch needed for U-Boot?

Regards,
Bin
Padmarao Begari Dec. 11, 2020, 6:59 a.m. UTC | #2
Hi Bin,

On Thu, Dec 10, 2020 at 4:11 PM Bin Meng <bmeng.cn@gmail.com> wrote:

> Hi Padmarao,
>
> On Thu, Dec 3, 2020 at 4:43 AM Padmarao Begari
> <padmarao.begari@microchip.com> wrote:
> >
> > dma_addr_t holds any valid DMA address. If the DMA API only uses
> 32/64-bit
> > addresses, dma_addr_t need only be 32/64 bits wide.
> >
> > Signed-off-by: Padmarao Begari <padmarao.begari@microchip.com>
> > Reviewed-by: Anup Patel <anup.patel@wdc.com>
> > ---
> >  arch/riscv/Kconfig             | 4 ++++
> >  arch/riscv/include/asm/types.h | 4 ++++
> >  2 files changed, 8 insertions(+)
> >
> > diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> > index 30b05408b1..55eaee2da6 100644
> > --- a/arch/riscv/Kconfig
> > +++ b/arch/riscv/Kconfig
> > @@ -152,6 +152,10 @@ config 32BIT
> >  config 64BIT
> >         bool
> >
> > +config DMA_ADDR_T_64BIT
> > +       bool
> > +       default y if 64BIT
> > +
> >  config SIFIVE_CLINT
> >         bool
> >         depends on RISCV_MMODE || SPL_RISCV_MMODE
> > diff --git a/arch/riscv/include/asm/types.h
> b/arch/riscv/include/asm/types.h
> > index 403cf9a48f..b800b2d221 100644
> > --- a/arch/riscv/include/asm/types.h
> > +++ b/arch/riscv/include/asm/types.h
> > @@ -29,7 +29,11 @@ typedef unsigned short umode_t;
> >
> >  #include <stddef.h>
> >
> > +#ifdef CONFIG_DMA_ADDR_T_64BIT
> > +typedef u64 dma_addr_t;
> > +#else
> >  typedef u32 dma_addr_t;
> > +#endif
>
> Why is this patch needed for U-Boot?
>
>
Initially this patch was created for the MACB driver dependency and now the
MACB driver is not dependent on CONFIG_DMA_ADDR_T_64BIT.
But We created this patch the same as the ARM 64-bit kconfig and the
'CONFIG_DMA_ADDR_T_64BIT' is used when the MMC driver is configured with
DMA.

Regards
Padmarao


> Regards,
> Bin
>
Bin Meng Dec. 11, 2020, 7:52 a.m. UTC | #3
Hi Padmarao,

On Fri, Dec 11, 2020 at 3:10 PM Padmarao Begari <padmarao.b@gmail.com> wrote:
>
> Hi Bin,
>
> On Thu, Dec 10, 2020 at 4:11 PM Bin Meng <bmeng.cn@gmail.com> wrote:
>>
>> Hi Padmarao,
>>
>> On Thu, Dec 3, 2020 at 4:43 AM Padmarao Begari
>> <padmarao.begari@microchip.com> wrote:
>> >
>> > dma_addr_t holds any valid DMA address. If the DMA API only uses 32/64-bit
>> > addresses, dma_addr_t need only be 32/64 bits wide.
>> >
>> > Signed-off-by: Padmarao Begari <padmarao.begari@microchip.com>
>> > Reviewed-by: Anup Patel <anup.patel@wdc.com>
>> > ---
>> >  arch/riscv/Kconfig             | 4 ++++
>> >  arch/riscv/include/asm/types.h | 4 ++++
>> >  2 files changed, 8 insertions(+)
>> >
>> > diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
>> > index 30b05408b1..55eaee2da6 100644
>> > --- a/arch/riscv/Kconfig
>> > +++ b/arch/riscv/Kconfig
>> > @@ -152,6 +152,10 @@ config 32BIT
>> >  config 64BIT
>> >         bool
>> >
>> > +config DMA_ADDR_T_64BIT
>> > +       bool
>> > +       default y if 64BIT
>> > +
>> >  config SIFIVE_CLINT
>> >         bool
>> >         depends on RISCV_MMODE || SPL_RISCV_MMODE
>> > diff --git a/arch/riscv/include/asm/types.h b/arch/riscv/include/asm/types.h
>> > index 403cf9a48f..b800b2d221 100644
>> > --- a/arch/riscv/include/asm/types.h
>> > +++ b/arch/riscv/include/asm/types.h
>> > @@ -29,7 +29,11 @@ typedef unsigned short umode_t;
>> >
>> >  #include <stddef.h>
>> >
>> > +#ifdef CONFIG_DMA_ADDR_T_64BIT
>> > +typedef u64 dma_addr_t;
>> > +#else
>> >  typedef u32 dma_addr_t;
>> > +#endif
>>
>> Why is this patch needed for U-Boot?
>>
>
> Initially this patch was created for the MACB driver dependency and now the MACB driver is not dependent on CONFIG_DMA_ADDR_T_64BIT.
> But We created this patch the same as the ARM 64-bit kconfig and the 'CONFIG_DMA_ADDR_T_64BIT' is used when the MMC driver is configured with DMA.
>

But in U-Boot there is no 64-bit address. The DMA address should be
under 4G. Both MACB and MMC driver should work with the 32-bit DMA
addresses, no?

Regards,
Bin
Padmarao Begari Dec. 11, 2020, 8:12 a.m. UTC | #4
Hi Bin,

On Fri, Dec 11, 2020 at 1:22 PM Bin Meng <bmeng.cn@gmail.com> wrote:

> Hi Padmarao,
>
> On Fri, Dec 11, 2020 at 3:10 PM Padmarao Begari <padmarao.b@gmail.com>
> wrote:
> >
> > Hi Bin,
> >
> > On Thu, Dec 10, 2020 at 4:11 PM Bin Meng <bmeng.cn@gmail.com> wrote:
> >>
> >> Hi Padmarao,
> >>
> >> On Thu, Dec 3, 2020 at 4:43 AM Padmarao Begari
> >> <padmarao.begari@microchip.com> wrote:
> >> >
> >> > dma_addr_t holds any valid DMA address. If the DMA API only uses
> 32/64-bit
> >> > addresses, dma_addr_t need only be 32/64 bits wide.
> >> >
> >> > Signed-off-by: Padmarao Begari <padmarao.begari@microchip.com>
> >> > Reviewed-by: Anup Patel <anup.patel@wdc.com>
> >> > ---
> >> >  arch/riscv/Kconfig             | 4 ++++
> >> >  arch/riscv/include/asm/types.h | 4 ++++
> >> >  2 files changed, 8 insertions(+)
> >> >
> >> > diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> >> > index 30b05408b1..55eaee2da6 100644
> >> > --- a/arch/riscv/Kconfig
> >> > +++ b/arch/riscv/Kconfig
> >> > @@ -152,6 +152,10 @@ config 32BIT
> >> >  config 64BIT
> >> >         bool
> >> >
> >> > +config DMA_ADDR_T_64BIT
> >> > +       bool
> >> > +       default y if 64BIT
> >> > +
> >> >  config SIFIVE_CLINT
> >> >         bool
> >> >         depends on RISCV_MMODE || SPL_RISCV_MMODE
> >> > diff --git a/arch/riscv/include/asm/types.h
> b/arch/riscv/include/asm/types.h
> >> > index 403cf9a48f..b800b2d221 100644
> >> > --- a/arch/riscv/include/asm/types.h
> >> > +++ b/arch/riscv/include/asm/types.h
> >> > @@ -29,7 +29,11 @@ typedef unsigned short umode_t;
> >> >
> >> >  #include <stddef.h>
> >> >
> >> > +#ifdef CONFIG_DMA_ADDR_T_64BIT
> >> > +typedef u64 dma_addr_t;
> >> > +#else
> >> >  typedef u32 dma_addr_t;
> >> > +#endif
> >>
> >> Why is this patch needed for U-Boot?
> >>
> >
> > Initially this patch was created for the MACB driver dependency and now
> the MACB driver is not dependent on CONFIG_DMA_ADDR_T_64BIT.
> > But We created this patch the same as the ARM 64-bit kconfig and the
> 'CONFIG_DMA_ADDR_T_64BIT' is used when the MMC driver is configured with
> DMA.
> >
>
> But in U-Boot there is no 64-bit address. The DMA address should be
> under 4G. Both MACB and MMC driver should work with the 32-bit DMA
> addresses, no?
>
>
We will use 64-bit addresses in the future.
Both MACB and MMC drivers work with 64-bit DMA addresses in the PolarFire
SoC.

Regards
Padmarao



> Regards,
> Bin
>
Bin Meng Dec. 11, 2020, 9:26 a.m. UTC | #5
HI Padmarao,

On Fri, Dec 11, 2020 at 4:23 PM Padmarao Begari <padmarao.b@gmail.com> wrote:
>
> Hi Bin,
>
> On Fri, Dec 11, 2020 at 1:22 PM Bin Meng <bmeng.cn@gmail.com> wrote:
>>
>> Hi Padmarao,
>>
>> On Fri, Dec 11, 2020 at 3:10 PM Padmarao Begari <padmarao.b@gmail.com> wrote:
>> >
>> > Hi Bin,
>> >
>> > On Thu, Dec 10, 2020 at 4:11 PM Bin Meng <bmeng.cn@gmail.com> wrote:
>> >>
>> >> Hi Padmarao,
>> >>
>> >> On Thu, Dec 3, 2020 at 4:43 AM Padmarao Begari
>> >> <padmarao.begari@microchip.com> wrote:
>> >> >
>> >> > dma_addr_t holds any valid DMA address. If the DMA API only uses 32/64-bit
>> >> > addresses, dma_addr_t need only be 32/64 bits wide.
>> >> >
>> >> > Signed-off-by: Padmarao Begari <padmarao.begari@microchip.com>
>> >> > Reviewed-by: Anup Patel <anup.patel@wdc.com>
>> >> > ---
>> >> >  arch/riscv/Kconfig             | 4 ++++
>> >> >  arch/riscv/include/asm/types.h | 4 ++++
>> >> >  2 files changed, 8 insertions(+)
>> >> >
>> >> > diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
>> >> > index 30b05408b1..55eaee2da6 100644
>> >> > --- a/arch/riscv/Kconfig
>> >> > +++ b/arch/riscv/Kconfig
>> >> > @@ -152,6 +152,10 @@ config 32BIT
>> >> >  config 64BIT
>> >> >         bool
>> >> >
>> >> > +config DMA_ADDR_T_64BIT
>> >> > +       bool
>> >> > +       default y if 64BIT
>> >> > +
>> >> >  config SIFIVE_CLINT
>> >> >         bool
>> >> >         depends on RISCV_MMODE || SPL_RISCV_MMODE
>> >> > diff --git a/arch/riscv/include/asm/types.h b/arch/riscv/include/asm/types.h
>> >> > index 403cf9a48f..b800b2d221 100644
>> >> > --- a/arch/riscv/include/asm/types.h
>> >> > +++ b/arch/riscv/include/asm/types.h
>> >> > @@ -29,7 +29,11 @@ typedef unsigned short umode_t;
>> >> >
>> >> >  #include <stddef.h>
>> >> >
>> >> > +#ifdef CONFIG_DMA_ADDR_T_64BIT
>> >> > +typedef u64 dma_addr_t;
>> >> > +#else
>> >> >  typedef u32 dma_addr_t;
>> >> > +#endif
>> >>
>> >> Why is this patch needed for U-Boot?
>> >>
>> >
>> > Initially this patch was created for the MACB driver dependency and now the MACB driver is not dependent on CONFIG_DMA_ADDR_T_64BIT.
>> > But We created this patch the same as the ARM 64-bit kconfig and the 'CONFIG_DMA_ADDR_T_64BIT' is used when the MMC driver is configured with DMA.
>> >
>>
>> But in U-Boot there is no 64-bit address. The DMA address should be
>> under 4G. Both MACB and MMC driver should work with the 32-bit DMA
>> addresses, no?
>>
>
> We will use 64-bit addresses in the future.

But U-Boot does not generate 64-bit addresses for DMA at present.

> Both MACB and MMC drivers work with 64-bit DMA addresses in the PolarFire SoC.

So I think the patch to enable 64-bit DMA in U-Boot is not necessary.

Regards,
Bin
Padmarao Begari Dec. 11, 2020, 12:03 p.m. UTC | #6
Hi Bin,

On Fri, Dec 11, 2020 at 2:57 PM Bin Meng <bmeng.cn@gmail.com> wrote:

> HI Padmarao,
>
> On Fri, Dec 11, 2020 at 4:23 PM Padmarao Begari <padmarao.b@gmail.com>
> wrote:
> >
> > Hi Bin,
> >
> > On Fri, Dec 11, 2020 at 1:22 PM Bin Meng <bmeng.cn@gmail.com> wrote:
> >>
> >> Hi Padmarao,
> >>
> >> On Fri, Dec 11, 2020 at 3:10 PM Padmarao Begari <padmarao.b@gmail.com>
> wrote:
> >> >
> >> > Hi Bin,
> >> >
> >> > On Thu, Dec 10, 2020 at 4:11 PM Bin Meng <bmeng.cn@gmail.com> wrote:
> >> >>
> >> >> Hi Padmarao,
> >> >>
> >> >> On Thu, Dec 3, 2020 at 4:43 AM Padmarao Begari
> >> >> <padmarao.begari@microchip.com> wrote:
> >> >> >
> >> >> > dma_addr_t holds any valid DMA address. If the DMA API only uses
> 32/64-bit
> >> >> > addresses, dma_addr_t need only be 32/64 bits wide.
> >> >> >
> >> >> > Signed-off-by: Padmarao Begari <padmarao.begari@microchip.com>
> >> >> > Reviewed-by: Anup Patel <anup.patel@wdc.com>
> >> >> > ---
> >> >> >  arch/riscv/Kconfig             | 4 ++++
> >> >> >  arch/riscv/include/asm/types.h | 4 ++++
> >> >> >  2 files changed, 8 insertions(+)
> >> >> >
> >> >> > diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> >> >> > index 30b05408b1..55eaee2da6 100644
> >> >> > --- a/arch/riscv/Kconfig
> >> >> > +++ b/arch/riscv/Kconfig
> >> >> > @@ -152,6 +152,10 @@ config 32BIT
> >> >> >  config 64BIT
> >> >> >         bool
> >> >> >
> >> >> > +config DMA_ADDR_T_64BIT
> >> >> > +       bool
> >> >> > +       default y if 64BIT
> >> >> > +
> >> >> >  config SIFIVE_CLINT
> >> >> >         bool
> >> >> >         depends on RISCV_MMODE || SPL_RISCV_MMODE
> >> >> > diff --git a/arch/riscv/include/asm/types.h
> b/arch/riscv/include/asm/types.h
> >> >> > index 403cf9a48f..b800b2d221 100644
> >> >> > --- a/arch/riscv/include/asm/types.h
> >> >> > +++ b/arch/riscv/include/asm/types.h
> >> >> > @@ -29,7 +29,11 @@ typedef unsigned short umode_t;
> >> >> >
> >> >> >  #include <stddef.h>
> >> >> >
> >> >> > +#ifdef CONFIG_DMA_ADDR_T_64BIT
> >> >> > +typedef u64 dma_addr_t;
> >> >> > +#else
> >> >> >  typedef u32 dma_addr_t;
> >> >> > +#endif
> >> >>
> >> >> Why is this patch needed for U-Boot?
> >> >>
> >> >
> >> > Initially this patch was created for the MACB driver dependency and
> now the MACB driver is not dependent on CONFIG_DMA_ADDR_T_64BIT.
> >> > But We created this patch the same as the ARM 64-bit kconfig and the
> 'CONFIG_DMA_ADDR_T_64BIT' is used when the MMC driver is configured with
> DMA.
> >> >
> >>
> >> But in U-Boot there is no 64-bit address. The DMA address should be
> >> under 4G. Both MACB and MMC driver should work with the 32-bit DMA
> >> addresses, no?
> >>
> >
> > We will use 64-bit addresses in the future.
>
> But U-Boot does not generate 64-bit addresses for DMA at present.
>
>
PolarFire SoC GEM uses 64-bit DMA not 32-bit DMA

Regards
Padmarao

> > Both MACB and MMC drivers work with 64-bit DMA addresses in the
> PolarFire SoC.
>
> So I think the patch to enable 64-bit DMA in U-Boot is not necessary.
>
> Regards,
> Bin
>
diff mbox series

Patch

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 30b05408b1..55eaee2da6 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -152,6 +152,10 @@  config 32BIT
 config 64BIT
 	bool
 
+config DMA_ADDR_T_64BIT
+	bool
+	default y if 64BIT
+
 config SIFIVE_CLINT
 	bool
 	depends on RISCV_MMODE || SPL_RISCV_MMODE
diff --git a/arch/riscv/include/asm/types.h b/arch/riscv/include/asm/types.h
index 403cf9a48f..b800b2d221 100644
--- a/arch/riscv/include/asm/types.h
+++ b/arch/riscv/include/asm/types.h
@@ -29,7 +29,11 @@  typedef unsigned short umode_t;
 
 #include <stddef.h>
 
+#ifdef CONFIG_DMA_ADDR_T_64BIT
+typedef u64 dma_addr_t;
+#else
 typedef u32 dma_addr_t;
+#endif
 
 typedef unsigned long phys_addr_t;
 typedef unsigned long phys_size_t;