All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Skalkin <igor.skalkin@oss.qualcomm.com>
To: "Michael S . Tsirkin" <mst@redhat.com>,
	Jason Wang <jasowangio@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: virtualization@lists.linux.dev, linux-usb@vger.kernel.org,
	Vasilii Ianikeev <vasilii.ianikeev@oss.qualcomm.com>,
	Aiswarya Cyriac <aiswarya.cyriac@oss.qualcomm.com>,
	Anton Yakovlev <anton.yakovlev@oss.qualcomm.com>,
	Trilok Soni <trilok.soni@oss.qualcomm.com>,
	Igor Skalkin <igor.skalkin@oss.qualcomm.com>
Subject: [PATCH 0/8] virtio-usb: add dual-role virtio USB driver
Date: Thu, 24 Sep 2026 18:08:59 +0200	[thread overview]
Message-ID: <20260924160907.145405-1-igor.skalkin@oss.qualcomm.com> (raw)

This series adds a new virtio-usb driver: a dual-role virtio device
capable of acting as a USB host controller, a USB device controller,
or both simultaneously with runtime role switching between the two
(USB OTG-style role switching) on ports that support it.

The corresponding virtio-usb device specification has been posted to
virtio-comment for review. This series matches the v2 revision of
that spec, which reconciles a small number of protocol details
(per-role virtqueue presentation, host-role vp_idx for hub/multi-VP
support, and the device-role BIND/UNBIND event split) that were
clarified while integrating and testing this driver against the
spec:

  [RFC PATCH v2] virtio-usb: Add initial virtio-usb specification
  Igor Skalkin <igor.skalkin@oss.qualcomm.com>
  virtio-comment@lists.linux.dev
  https://lore.kernel.org/virtio-comment/20260924154007.143927-1-igor.skalkin@oss.qualcomm.com/

This driver has been tested end-to-end against our own userspace
virtio-usb device implementation (host-side backend) in two setups:
  - arm64 hardware with a type-1 hypervisor, exercising a real dwc3
    USB controller on the host side.
  - x86 with a type-2 hypervisor (QEMU/KVM), using dummy_hcd/dummy_udc
    on the host side in place of real USB hardware.
Host role and device role were exercised in both setups: testusb on
the guest, over a virtualized host port, against g_zero running on
a real hardware UDC or on dummy UDC on the host side (host role);
and testusb on the host side, against g_zero running on a virtualized
UDC on the guest (device role); plus real USB mass-storage
hardware/gadgets and iperf3 over usbnet. Role switching was exercised
in both setups as well, but not with a real OTG cable/ID-pin connection:
on dwc3, role switching was driven through its "role-switch" sysfs
configuration; on dummy_hcd, it was emulated by toggling between two
simultaneously-configured dummy_hcd instances on the same port.
Testing with a real OTG connection is planned as a follow-up.

Known scope: this driver virtualizes an entire UDC per device-role
port, with each port owned by a single guest. USB function-level
virtualization - a single physical UDC exposing a composite gadget
whose individual functions are routed to different guests - is a
separate approach currently being explored, and is out of scope for
this series.

Patch summary:
  1:   protocol header and skeleton dual-role driver (probe/remove
       plumbing, no role support yet).
  2:   USB host controller (HCD) role support.
  3:   USB device controller (UDC) role support.
  4-5: USB OTG-style role query and role-switching support.
  6:   endpoint-lifecycle robustness rework (async split-phase state
       machine, replacing an earlier out-of-tree gadget.nonatomic
       patch that didn't pass upstream review).
  7:   SuperSpeed device-role support.
  8:   guest UDC naming fix (name prefix from the bind event).

Aiswarya Cyriac (3):
  virtio-usb: add protocol header and skeleton dual-role driver
  virtio-usb: add host role (USB Host Controller) support
  virtio-usb: add device role (USB Device Controller) support

Igor Skalkin (5):
  virtio-usb: add OTG role query support
  virtio-usb: add USB On-The-Go role-switching support
  virtio-usb: rework endpoint lifecycle to an async split-phase state
    machine
  virtio-usb: add SuperSpeed device-role support
  virtio-usb: support a guest UDC name prefix from the bind event

 MAINTAINERS                         |   10 +
 drivers/usb/Kconfig                 |    2 +
 drivers/usb/Makefile                |    1 +
 drivers/usb/virtio_usb/Kconfig      |   21 +
 drivers/usb/virtio_usb/Makefile     |    9 +
 drivers/usb/virtio_usb/controller.c |  422 ++++++++
 drivers/usb/virtio_usb/controller.h |  152 +++
 drivers/usb/virtio_usb/device.c     | 1893 +++++++++++++++++++++++++++++++++++
 drivers/usb/virtio_usb/device.h     |  115 +++
 drivers/usb/virtio_usb/host.c       | 1368 +++++++++++++++++++++++++
 drivers/usb/virtio_usb/host.h       |  203 ++++
 drivers/usb/virtio_usb/otg.c        |  403 ++++++++
 drivers/usb/virtio_usb/otg.h        |   38 +
 drivers/usb/virtio_usb/vq_common.c  |  740 ++++++++++++++
 drivers/usb/virtio_usb/vq_common.h  |  163 +++
 include/uapi/linux/virtio_usb.h     |  346 +++++++
 16 files changed, 5886 insertions(+)
 create mode 100644 drivers/usb/virtio_usb/Kconfig
 create mode 100644 drivers/usb/virtio_usb/Makefile
 create mode 100644 drivers/usb/virtio_usb/controller.c
 create mode 100644 drivers/usb/virtio_usb/controller.h
 create mode 100644 drivers/usb/virtio_usb/device.c
 create mode 100644 drivers/usb/virtio_usb/device.h
 create mode 100644 drivers/usb/virtio_usb/host.c
 create mode 100644 drivers/usb/virtio_usb/host.h
 create mode 100644 drivers/usb/virtio_usb/otg.c
 create mode 100644 drivers/usb/virtio_usb/otg.h
 create mode 100644 drivers/usb/virtio_usb/vq_common.c
 create mode 100644 drivers/usb/virtio_usb/vq_common.h
 create mode 100644 include/uapi/linux/virtio_usb.h

-- 
2.49.0

             reply	other threads:[~2026-09-24 16:09 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-24 16:08 Igor Skalkin [this message]
2026-09-24 16:09 ` [PATCH 1/8] virtio-usb: add protocol header and skeleton dual-role driver Igor Skalkin
2026-09-24 16:23   ` sashiko-bot
2026-09-25  5:14   ` Greg Kroah-Hartman
2026-09-28 14:19     ` Igor Skalkin
2026-09-25  5:21   ` Greg Kroah-Hartman
2026-09-28 14:14     ` Igor Skalkin
2026-09-24 16:09 ` [PATCH 2/8] virtio-usb: add host role (USB Host Controller) support Igor Skalkin
2026-09-24 16:25   ` sashiko-bot
2026-09-25  5:18   ` Greg Kroah-Hartman
2026-09-28 14:01     ` Igor Skalkin
2026-09-24 16:09 ` [PATCH 3/8] virtio-usb: add device role (USB Device " Igor Skalkin
2026-09-24 16:28   ` sashiko-bot
2026-09-24 16:09 ` [PATCH 4/8] virtio-usb: add OTG role query support Igor Skalkin
2026-09-24 16:19   ` sashiko-bot
2026-09-24 16:09 ` [PATCH 5/8] virtio-usb: add USB On-The-Go role-switching support Igor Skalkin
2026-09-24 16:24   ` sashiko-bot
2026-09-24 16:09 ` [PATCH 6/8] virtio-usb: rework endpoint lifecycle to an async split-phase state machine Igor Skalkin
2026-09-24 16:30   ` sashiko-bot
2026-09-24 16:09 ` [PATCH 7/8] virtio-usb: add SuperSpeed device-role support Igor Skalkin
2026-09-24 16:35   ` sashiko-bot
2026-09-24 16:09 ` [PATCH 8/8] virtio-usb: support a guest UDC name prefix from the bind event Igor Skalkin
2026-09-24 16:35   ` sashiko-bot
2026-09-25  5:17 ` [PATCH 0/8] virtio-usb: add dual-role virtio USB driver Greg Kroah-Hartman
2026-09-28 13:55   ` Igor Skalkin
2026-09-28 14:44     ` Greg Kroah-Hartman
2026-09-28 15:56       ` Igor Skalkin
2026-09-28 16:10         ` Greg Kroah-Hartman
2026-09-29  9:47     ` Michael S. Tsirkin
2026-09-29 16:01       ` Greg Kroah-Hartman
2026-09-29 19:02         ` Vasilii Ianikeev
2026-09-29 19:58         ` Vasilii Ianikeev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260924160907.145405-1-igor.skalkin@oss.qualcomm.com \
    --to=igor.skalkin@oss.qualcomm.com \
    --cc=aiswarya.cyriac@oss.qualcomm.com \
    --cc=anton.yakovlev@oss.qualcomm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jasowangio@gmail.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=trilok.soni@oss.qualcomm.com \
    --cc=vasilii.ianikeev@oss.qualcomm.com \
    --cc=virtualization@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.