Let the ASPEED machines accept "usb-redir-server" with -device, so a UDC
gadget can be exported to a USB host running in another QEMU:

  -device usb-redir-server,id=redirsrv,chardev=<chr>
  -device aspeed.udc-gadget,bus=redirsrv.0,udc=/machine/soc/udc

usb-redir-server sits on the main system bus so that the USB bus it
provides can be found by "bus=<id>.0". That makes it a sysbus device, and
a sysbus device can only be created with -device if the machine lists it.

Signed-off-by: Jamin Lin <[email protected]>
---
 hw/arm/aspeed.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index a7cfbd6c5e..4e1ecbabe7 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -409,6 +409,12 @@ static void aspeed_machine_class_init(ObjectClass *oc, 
const void *data)
     mc->no_cdrom = 1;
     mc->no_parallel = 1;
     mc->default_ram_id = "ram";
+    /*
+     * Lets a UDC gadget be exported to another QEMU instance over usbredir.
+     * The type name is spelled out rather than used through its macro so
+     * that this still builds when the usbredir library is absent.
+     */
+    machine_class_allow_dynamic_sysbus_dev(mc, "usb-redir-server");
     amc->macs_mask = ASPEED_MAC0_ON;
     amc->uart_default = ASPEED_DEV_UART5;
 
-- 
2.53.0

Reply via email to