All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: gadget: Mark USB_FSL_QE broken on 64-bit
@ 2021-10-27  8:08 ` Geert Uytterhoeven
  0 siblings, 0 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2021-10-27  8:08 UTC (permalink / raw)
  To: Li Yang, Felipe Balbi, Greg Kroah-Hartman
  Cc: Arnd Bergmann, linux-usb, linuxppc-dev, linux-kernel, Geert Uytterhoeven

On 64-bit:

    drivers/usb/gadget/udc/fsl_qe_udc.c: In function ‘qe_ep0_rx’:
    drivers/usb/gadget/udc/fsl_qe_udc.c:842:13: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
      842 |     vaddr = (u32)phys_to_virt(in_be32(&bd->buf));
	  |             ^
    In file included from drivers/usb/gadget/udc/fsl_qe_udc.c:41:
    drivers/usb/gadget/udc/fsl_qe_udc.c:843:28: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
      843 |     frame_set_data(pframe, (u8 *)vaddr);
	  |                            ^

The driver assumes physical and virtual addresses are 32-bit, hence it
cannot work on 64-bit platforms.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
One more casualty of CONFIG_WERROR=y.
http://kisskb.ellerman.id.au/kisskb/buildresult/14652936/
---
 drivers/usb/gadget/udc/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/gadget/udc/Kconfig b/drivers/usb/gadget/udc/Kconfig
index 8c614bb86c665c77..69394dc1cdfb6436 100644
--- a/drivers/usb/gadget/udc/Kconfig
+++ b/drivers/usb/gadget/udc/Kconfig
@@ -330,6 +330,7 @@ config USB_AMD5536UDC
 config USB_FSL_QE
 	tristate "Freescale QE/CPM USB Device Controller"
 	depends on FSL_SOC && (QUICC_ENGINE || CPM)
+	depends on !64BIT || BROKEN
 	help
 	   Some of Freescale PowerPC processors have a Full Speed
 	   QE/CPM2 USB controller, which support device mode with 4
-- 
2.25.1


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

* [PATCH] usb: gadget: Mark USB_FSL_QE broken on 64-bit
@ 2021-10-27  8:08 ` Geert Uytterhoeven
  0 siblings, 0 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2021-10-27  8:08 UTC (permalink / raw)
  To: Li Yang, Felipe Balbi, Greg Kroah-Hartman
  Cc: Geert Uytterhoeven, linux-usb, linuxppc-dev, linux-kernel, Arnd Bergmann

On 64-bit:

    drivers/usb/gadget/udc/fsl_qe_udc.c: In function ‘qe_ep0_rx’:
    drivers/usb/gadget/udc/fsl_qe_udc.c:842:13: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
      842 |     vaddr = (u32)phys_to_virt(in_be32(&bd->buf));
	  |             ^
    In file included from drivers/usb/gadget/udc/fsl_qe_udc.c:41:
    drivers/usb/gadget/udc/fsl_qe_udc.c:843:28: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
      843 |     frame_set_data(pframe, (u8 *)vaddr);
	  |                            ^

The driver assumes physical and virtual addresses are 32-bit, hence it
cannot work on 64-bit platforms.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
One more casualty of CONFIG_WERROR=y.
http://kisskb.ellerman.id.au/kisskb/buildresult/14652936/
---
 drivers/usb/gadget/udc/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/gadget/udc/Kconfig b/drivers/usb/gadget/udc/Kconfig
index 8c614bb86c665c77..69394dc1cdfb6436 100644
--- a/drivers/usb/gadget/udc/Kconfig
+++ b/drivers/usb/gadget/udc/Kconfig
@@ -330,6 +330,7 @@ config USB_AMD5536UDC
 config USB_FSL_QE
 	tristate "Freescale QE/CPM USB Device Controller"
 	depends on FSL_SOC && (QUICC_ENGINE || CPM)
+	depends on !64BIT || BROKEN
 	help
 	   Some of Freescale PowerPC processors have a Full Speed
 	   QE/CPM2 USB controller, which support device mode with 4
-- 
2.25.1


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

* Re: [PATCH] usb: gadget: Mark USB_FSL_QE broken on 64-bit
  2021-10-27  8:08 ` Geert Uytterhoeven
@ 2021-10-27 10:38   ` Arnd Bergmann
  -1 siblings, 0 replies; 6+ messages in thread
From: Arnd Bergmann @ 2021-10-27 10:38 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Li Yang, Felipe Balbi, Greg Kroah-Hartman, Arnd Bergmann,
	USB list, linuxppc-dev, Linux Kernel Mailing List

On Wed, Oct 27, 2021 at 10:08 AM Geert Uytterhoeven
<geert@linux-m68k.org> wrote:
>
> On 64-bit:
>
>     drivers/usb/gadget/udc/fsl_qe_udc.c: In function ‘qe_ep0_rx’:
>     drivers/usb/gadget/udc/fsl_qe_udc.c:842:13: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
>       842 |     vaddr = (u32)phys_to_virt(in_be32(&bd->buf));
>           |             ^
>     In file included from drivers/usb/gadget/udc/fsl_qe_udc.c:41:
>     drivers/usb/gadget/udc/fsl_qe_udc.c:843:28: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>       843 |     frame_set_data(pframe, (u8 *)vaddr);
>           |                            ^
>
> The driver assumes physical and virtual addresses are 32-bit, hence it
> cannot work on 64-bit platforms.
>
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> ---

Interesting, I have not seen this one in randconfig builds.

It looks like the driver also assumes that physical addresses are the same as
bus addresses, so maybe it should also be marked broken when CONFIG_IOMMU
is enabled? Maybe that takes it too far, as this driver could still be used
on a machine without IOMMU in a kernel that supports IOMMUs on
other machines.

        Arnd

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

* Re: [PATCH] usb: gadget: Mark USB_FSL_QE broken on 64-bit
@ 2021-10-27 10:38   ` Arnd Bergmann
  0 siblings, 0 replies; 6+ messages in thread
From: Arnd Bergmann @ 2021-10-27 10:38 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Felipe Balbi, Arnd Bergmann, Greg Kroah-Hartman, USB list,
	Linux Kernel Mailing List, Li Yang, linuxppc-dev

On Wed, Oct 27, 2021 at 10:08 AM Geert Uytterhoeven
<geert@linux-m68k.org> wrote:
>
> On 64-bit:
>
>     drivers/usb/gadget/udc/fsl_qe_udc.c: In function ‘qe_ep0_rx’:
>     drivers/usb/gadget/udc/fsl_qe_udc.c:842:13: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
>       842 |     vaddr = (u32)phys_to_virt(in_be32(&bd->buf));
>           |             ^
>     In file included from drivers/usb/gadget/udc/fsl_qe_udc.c:41:
>     drivers/usb/gadget/udc/fsl_qe_udc.c:843:28: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>       843 |     frame_set_data(pframe, (u8 *)vaddr);
>           |                            ^
>
> The driver assumes physical and virtual addresses are 32-bit, hence it
> cannot work on 64-bit platforms.
>
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> ---

Interesting, I have not seen this one in randconfig builds.

It looks like the driver also assumes that physical addresses are the same as
bus addresses, so maybe it should also be marked broken when CONFIG_IOMMU
is enabled? Maybe that takes it too far, as this driver could still be used
on a machine without IOMMU in a kernel that supports IOMMUs on
other machines.

        Arnd

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

* Re: [PATCH] usb: gadget: Mark USB_FSL_QE broken on 64-bit
  2021-10-27  8:08 ` Geert Uytterhoeven
@ 2021-10-27 14:37   ` Li Yang
  -1 siblings, 0 replies; 6+ messages in thread
From: Li Yang @ 2021-10-27 14:37 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Felipe Balbi, Greg Kroah-Hartman, linux-usb, linuxppc-dev, lkml,
	Arnd Bergmann

On Wed, Oct 27, 2021 at 5:25 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> On 64-bit:
>
>     drivers/usb/gadget/udc/fsl_qe_udc.c: In function ‘qe_ep0_rx’:
>     drivers/usb/gadget/udc/fsl_qe_udc.c:842:13: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
>       842 |     vaddr = (u32)phys_to_virt(in_be32(&bd->buf));
>           |             ^
>     In file included from drivers/usb/gadget/udc/fsl_qe_udc.c:41:
>     drivers/usb/gadget/udc/fsl_qe_udc.c:843:28: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>       843 |     frame_set_data(pframe, (u8 *)vaddr);
>           |                            ^
>
> The driver assumes physical and virtual addresses are 32-bit, hence it
> cannot work on 64-bit platforms.

The device is truly only used in legacy 32-bit PowerPC chips and never
tested with 64-bit.  Thanks.

>
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>

Acked-by: Li Yang <leoyang.li@nxp.com>

> ---
> One more casualty of CONFIG_WERROR=y.
> http://kisskb.ellerman.id.au/kisskb/buildresult/14652936/
> ---
>  drivers/usb/gadget/udc/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/usb/gadget/udc/Kconfig b/drivers/usb/gadget/udc/Kconfig
> index 8c614bb86c665c77..69394dc1cdfb6436 100644
> --- a/drivers/usb/gadget/udc/Kconfig
> +++ b/drivers/usb/gadget/udc/Kconfig
> @@ -330,6 +330,7 @@ config USB_AMD5536UDC
>  config USB_FSL_QE
>         tristate "Freescale QE/CPM USB Device Controller"
>         depends on FSL_SOC && (QUICC_ENGINE || CPM)
> +       depends on !64BIT || BROKEN
>         help
>            Some of Freescale PowerPC processors have a Full Speed
>            QE/CPM2 USB controller, which support device mode with 4
> --
> 2.25.1
>

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

* Re: [PATCH] usb: gadget: Mark USB_FSL_QE broken on 64-bit
@ 2021-10-27 14:37   ` Li Yang
  0 siblings, 0 replies; 6+ messages in thread
From: Li Yang @ 2021-10-27 14:37 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Felipe Balbi, Arnd Bergmann, Greg Kroah-Hartman, linux-usb, lkml,
	linuxppc-dev

On Wed, Oct 27, 2021 at 5:25 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> On 64-bit:
>
>     drivers/usb/gadget/udc/fsl_qe_udc.c: In function ‘qe_ep0_rx’:
>     drivers/usb/gadget/udc/fsl_qe_udc.c:842:13: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
>       842 |     vaddr = (u32)phys_to_virt(in_be32(&bd->buf));
>           |             ^
>     In file included from drivers/usb/gadget/udc/fsl_qe_udc.c:41:
>     drivers/usb/gadget/udc/fsl_qe_udc.c:843:28: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>       843 |     frame_set_data(pframe, (u8 *)vaddr);
>           |                            ^
>
> The driver assumes physical and virtual addresses are 32-bit, hence it
> cannot work on 64-bit platforms.

The device is truly only used in legacy 32-bit PowerPC chips and never
tested with 64-bit.  Thanks.

>
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>

Acked-by: Li Yang <leoyang.li@nxp.com>

> ---
> One more casualty of CONFIG_WERROR=y.
> http://kisskb.ellerman.id.au/kisskb/buildresult/14652936/
> ---
>  drivers/usb/gadget/udc/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/usb/gadget/udc/Kconfig b/drivers/usb/gadget/udc/Kconfig
> index 8c614bb86c665c77..69394dc1cdfb6436 100644
> --- a/drivers/usb/gadget/udc/Kconfig
> +++ b/drivers/usb/gadget/udc/Kconfig
> @@ -330,6 +330,7 @@ config USB_AMD5536UDC
>  config USB_FSL_QE
>         tristate "Freescale QE/CPM USB Device Controller"
>         depends on FSL_SOC && (QUICC_ENGINE || CPM)
> +       depends on !64BIT || BROKEN
>         help
>            Some of Freescale PowerPC processors have a Full Speed
>            QE/CPM2 USB controller, which support device mode with 4
> --
> 2.25.1
>

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

end of thread, other threads:[~2021-10-27 14:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-27  8:08 [PATCH] usb: gadget: Mark USB_FSL_QE broken on 64-bit Geert Uytterhoeven
2021-10-27  8:08 ` Geert Uytterhoeven
2021-10-27 10:38 ` Arnd Bergmann
2021-10-27 10:38   ` Arnd Bergmann
2021-10-27 14:37 ` Li Yang
2021-10-27 14:37   ` Li Yang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.