Re: [PATCH v20 2/2] dmaengine: tegra: Add tegra gpcdma driver

Vinod Koul
2022-02-24T04:39:06Z

On 24-02-22, 04:23, Akhil R wrote:
> > On Wed, Feb 23, 2022 at 03:49:09AM +0000, Akhil R wrote:

> > > I am getting notification for the below warning also.
> > >
> > > >> drivers/dma/tegra186-gpc-dma.c:898:53: warning: shift count >= width of
> > type [-Wshift-count-overflow]
> > > FIELD_PREP(TEGRA_GPCDMA_HIGH_ADDR_DST_PTR, (dest >>
> > 32));
> > > https://lore.kernel.org/all/202202230559.bLOEMEUh-lkp@intel.com/
> > >
> > > I suppose, this is because it is compiled against a different ARCH other than
> > arm64.
> > > For arm64, the dma_addr_t is 64 bytes, and this warning does not occur.
> > > Could this be ignored for now? If not, could you suggest a fix, if possible?
> >
> > I am not really familiar with the DMA API and dma_addr_t so I am not
> > sure about a proper fix.
> >
> > You could cast dest to u64 to guarantee it is a type that can be shifted
> > by 32 but that might not be right for CONFIG_PHYS_ADDR_T_64BIT=n. If the
> > driver is not expected to run without CONFIG_PHYS_ADDR_T_64BIT, then
> > this is probably fine.
> >
> > You could mark this driver 'depends on PHYS_ADDR_T_64BIT' if it cannot
> > run with CONFIG_ARCH_TEGRA=y + CONFIG_PHYS_ADDR_T_64BIT=n but I do
> > not
> > see any other drivers that do that, which might mean that is not a
> > proper fix.
> >
> > Please do not ignore the warning, as it will show up with ARCH=arm
> > allmodconfig, which has -Werror enabled.
> I see some drivers using 'depends on ARM64'. I guess probably we could
> use that to avoid this warning. The driver is only supported for arm64 Tegra
> systems as of now.

dma_addr_t can be different on different arch so yes this 'can'
overflow, but since this driver would never be used on non ARM64, make
sense to put depends.

--
~Vinod