mbox series

[RFC,0/8] usb/uhci: Add UHCI sysbus support, and enable for AST machines

Message ID 20241112165618.217454-1-linux@roeck-us.net (mailing list archive)
Headers show
Series usb/uhci: Add UHCI sysbus support, and enable for AST machines | expand

Message

Guenter Roeck Nov. 12, 2024, 4:56 p.m. UTC
Some machines (like Aspeed ARM) only support a sysbus UHCI controller.
The current UHCI implementation in qemu only supports PCI based UHCI
controllers.

This patch series separates basic and PCI functionality from the hcd-uhci
implementation and then adds uhci-sysbus support. This is then used
to implement and enable sysbus based UHCI support for Aspeed machines.

The series is submitted as RFC since I am quite sure that I didn't get
everything right. All code surrounding VMStates deserves special scrutiny,
as well as the changes outside hw/usb/ and hw/arm/.

A side effect of this patch series is that Aspeed AST2400/2500 machines
will now instantiate UHCI, even if the machine does not actually support
it (it also always instantiates both EHCI ports, so that is not really
different). This means that the default USB bus is now the UHCI bus,
not the second EHCI bus. The bus number must therefore now be specified
explicitly when attaching a device unless attaching it to the UHCI port
is ok. I don't know if it is possible to avoid that and to ensure that
the default USB port is still the second EHCI port.

The code was tested on x86 machines to ensure that the existing UHCI
implementation still works. It was also tested on various Aspeed machines
with enabled UHCI ports (ast2500-evb, ast2600-evb, and rainier-bmc).

Changes since RFC:
- Rebased to v9.1.0-1673-g134b443512
- Added Reviewed-by: tags
- Fixed bug in interrupt initialization of vt82c686-uhci-pci.c
  which if instantiated caused a machine crash
- Instantiate UHCI controllers as companion devices on AST2600 machines

----------------------------------------------------------------
Guenter Roeck (10):
      usb/uhci: checkpatch cleanup
      usb/uhci: Introduce and use register defines
      usb/uhci: Move PCI-related code into a separate file
      usb/uhci: enlarge uhci memory space
      usb/uhci: Add support for usb-uhci-sysbus
      usb/uhci: Add aspeed specific read and write functions
      aspeed: Add uhci support for ast2600
      aspeed: Add uhci support for ast2400 and ast2500
      usb-hub: Add support for v2.0 hubs
      usb-hub: Fix handling port power control messages

 hw/arm/Kconfig                |   1 +
 hw/arm/aspeed_ast2400.c       |  14 ++
 hw/arm/aspeed_ast2600.c       |  20 +++
 hw/isa/Kconfig                |   4 +-
 hw/isa/vt82c686.c             |   4 +-
 hw/usb/Kconfig                |  10 +-
 hw/usb/dev-hub.c              |  85 ++++++++++-
 hw/usb/hcd-uhci-pci.c         | 255 ++++++++++++++++++++++++++++++++
 hw/usb/hcd-uhci-pci.h         |  63 ++++++++
 hw/usb/hcd-uhci-sysbus.c      | 202 +++++++++++++++++++++++++
 hw/usb/hcd-uhci-sysbus.h      |  34 +++++
 hw/usb/hcd-uhci.c             | 337 +++++++++++++-----------------------------
 hw/usb/hcd-uhci.h             |  30 ++--
 hw/usb/meson.build            |   2 +
 hw/usb/vt82c686-uhci-pci.c    |  18 +--
 include/hw/arm/aspeed_soc.h   |   3 +
 include/hw/southbridge/piix.h |   4 +-
 include/hw/usb/uhci-regs.h    |  11 ++
 18 files changed, 822 insertions(+), 275 deletions(-)
 create mode 100644 hw/usb/hcd-uhci-pci.c
 create mode 100644 hw/usb/hcd-uhci-pci.h
 create mode 100644 hw/usb/hcd-uhci-sysbus.c
 create mode 100644 hw/usb/hcd-uhci-sysbus.h

Comments

Guenter Roeck Nov. 12, 2024, 4:59 p.m. UTC | #1
Oops, sorry, the subject should have started with "[PATCH 00/10]"

Why do I always see that one second after sending :-(

Guenter

On 11/12/24 08:56, Guenter Roeck wrote:
> Some machines (like Aspeed ARM) only support a sysbus UHCI controller.
> The current UHCI implementation in qemu only supports PCI based UHCI
> controllers.
> 
> This patch series separates basic and PCI functionality from the hcd-uhci
> implementation and then adds uhci-sysbus support. This is then used
> to implement and enable sysbus based UHCI support for Aspeed machines.
> 
> The series is submitted as RFC since I am quite sure that I didn't get
> everything right. All code surrounding VMStates deserves special scrutiny,
> as well as the changes outside hw/usb/ and hw/arm/.
> 
> A side effect of this patch series is that Aspeed AST2400/2500 machines
> will now instantiate UHCI, even if the machine does not actually support
> it (it also always instantiates both EHCI ports, so that is not really
> different). This means that the default USB bus is now the UHCI bus,
> not the second EHCI bus. The bus number must therefore now be specified
> explicitly when attaching a device unless attaching it to the UHCI port
> is ok. I don't know if it is possible to avoid that and to ensure that
> the default USB port is still the second EHCI port.
> 
> The code was tested on x86 machines to ensure that the existing UHCI
> implementation still works. It was also tested on various Aspeed machines
> with enabled UHCI ports (ast2500-evb, ast2600-evb, and rainier-bmc).
> 
> Changes since RFC:
> - Rebased to v9.1.0-1673-g134b443512
> - Added Reviewed-by: tags
> - Fixed bug in interrupt initialization of vt82c686-uhci-pci.c
>    which if instantiated caused a machine crash
> - Instantiate UHCI controllers as companion devices on AST2600 machines
> 
> ----------------------------------------------------------------
> Guenter Roeck (10):
>        usb/uhci: checkpatch cleanup
>        usb/uhci: Introduce and use register defines
>        usb/uhci: Move PCI-related code into a separate file
>        usb/uhci: enlarge uhci memory space
>        usb/uhci: Add support for usb-uhci-sysbus
>        usb/uhci: Add aspeed specific read and write functions
>        aspeed: Add uhci support for ast2600
>        aspeed: Add uhci support for ast2400 and ast2500
>        usb-hub: Add support for v2.0 hubs
>        usb-hub: Fix handling port power control messages
> 
>   hw/arm/Kconfig                |   1 +
>   hw/arm/aspeed_ast2400.c       |  14 ++
>   hw/arm/aspeed_ast2600.c       |  20 +++
>   hw/isa/Kconfig                |   4 +-
>   hw/isa/vt82c686.c             |   4 +-
>   hw/usb/Kconfig                |  10 +-
>   hw/usb/dev-hub.c              |  85 ++++++++++-
>   hw/usb/hcd-uhci-pci.c         | 255 ++++++++++++++++++++++++++++++++
>   hw/usb/hcd-uhci-pci.h         |  63 ++++++++
>   hw/usb/hcd-uhci-sysbus.c      | 202 +++++++++++++++++++++++++
>   hw/usb/hcd-uhci-sysbus.h      |  34 +++++
>   hw/usb/hcd-uhci.c             | 337 +++++++++++++-----------------------------
>   hw/usb/hcd-uhci.h             |  30 ++--
>   hw/usb/meson.build            |   2 +
>   hw/usb/vt82c686-uhci-pci.c    |  18 +--
>   include/hw/arm/aspeed_soc.h   |   3 +
>   include/hw/southbridge/piix.h |   4 +-
>   include/hw/usb/uhci-regs.h    |  11 ++
>   18 files changed, 822 insertions(+), 275 deletions(-)
>   create mode 100644 hw/usb/hcd-uhci-pci.c
>   create mode 100644 hw/usb/hcd-uhci-pci.h
>   create mode 100644 hw/usb/hcd-uhci-sysbus.c
>   create mode 100644 hw/usb/hcd-uhci-sysbus.h