All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Igor Skalkin <igor.skalkin@oss.qualcomm.com>
Cc: "Michael S . Tsirkin" <mst@redhat.com>,
	Jason Wang <jasowangio@gmail.com>,
	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>
Subject: Re: [PATCH 2/8] virtio-usb: add host role (USB Host Controller) support
Date: Fri, 25 Sep 2026 07:18:38 +0200	[thread overview]
Message-ID: <2026092531-giddy-annotate-7a58@gregkh> (raw)
In-Reply-To: <20260924160907.145405-3-igor.skalkin@oss.qualcomm.com>

On Thu, Sep 24, 2026 at 06:09:01PM +0200, Igor Skalkin wrote:
> From: Aiswarya Cyriac <aiswarya.cyriac@oss.qualcomm.com>
> 
> Add the common virtqueue handling code (command, event and data
> queues) shared by every role, and the virtio-usb host controller
> (HCD) implementation, wiring it up as the host role of the dual-role
> driver on top of that common code.
> 
> Each host-role virtual port gets its own HS+SS usb_hcd pair and its
> own root hub (struct virtio_usb_hc_vp), with a fixed
> VIRTIO_USB_VP_MAX_PORTS (8) leaf slots pre-allocated at VP init time
> and reused across connect/disconnect - never dynamically alloc'd or
> freed. This lets the backend forward more than one physical socket -
> and, for host ports behind a physical hub, more than one leaf device
> per socket - as independent virtual ports from the start, instead of
> collapsing everything onto a single shared root hub and having to
> revisit that decision once more than one host-role port needs to
> exist at the same time.
> 
> virtio_usb_add_hcd() derives each VP's HCD bus_name from the parent
> virtio_device with devm_kasprintf() rather than a stack buffer, since
> usb_create_hcd()/usb_create_shared_hcd() store that pointer as-is in
> hcd->self.bus_name without copying it - it must outlive the HCD
> itself.
> 
> Every port is host-role for now, since no other role exists yet;
> vports[].role is populated unconditionally until later commits add
> device role and OTG-based role resolution.
> 
> Signed-off-by: Aiswarya Cyriac <aiswarya.cyriac@oss.qualcomm.com>
> Co-developed-by: Anton Yakovlev <anton.yakovlev@oss.qualcomm.com>
> Signed-off-by: Anton Yakovlev <anton.yakovlev@oss.qualcomm.com>
> Signed-off-by: Vasilii Ianikeev <vasilii.ianikeev@oss.qualcomm.com>
> Co-developed-by: Igor Skalkin <igor.skalkin@oss.qualcomm.com>
> Signed-off-by: Igor Skalkin <igor.skalkin@oss.qualcomm.com>
> ---
>  drivers/usb/virtio_usb/Makefile     |    4 
>  drivers/usb/virtio_usb/controller.c |  105 ++
>  drivers/usb/virtio_usb/controller.h |   35 
>  drivers/usb/virtio_usb/host.c       | 1335 ++++++++++++++++++++++++++++++++++++
>  drivers/usb/virtio_usb/host.h       |  203 +++++
>  drivers/usb/virtio_usb/vq_common.c  |  740 +++++++++++++++++++
>  drivers/usb/virtio_usb/vq_common.h  |  163 ++++
>  include/uapi/linux/virtio_usb.h     |   16 
>  8 files changed, 2585 insertions(+), 16 deletions(-)
>  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/vq_common.c
>  create mode 100644 drivers/usb/virtio_usb/vq_common.h
> 
> diff --git a/drivers/usb/virtio_usb/controller.c b/drivers/usb/virtio_usb/controller.c
> index 2fc6f50..216edfc 100644
> --- a/drivers/usb/virtio_usb/controller.c
> +++ b/drivers/usb/virtio_usb/controller.c
> @@ -6,9 +6,16 @@
>   */
>  
>  #include <linux/module.h>
> +#include <linux/moduleparam.h>
>  #include <uapi/linux/virtio_ids.h>
>  
>  #include "controller.h"
> +#include "host.h"
> +#include "vq_common.h"
> +
> +u32 virtio_usb_cmd_timeout_ms = MSEC_PER_SEC;
> +module_param_named(cmd_timeout_ms, virtio_usb_cmd_timeout_ms, uint, 0644);
> +MODULE_PARM_DESC(cmd_timeout_ms, "Command completion timeout in milliseconds");

This is not the 1990's, please do not add new module parameters.  Just
make it work without manual configuration at module load time.

If you really need a configuration option, make it per-device and use
the correct, modern, apis for it.

thanks,

greg k-h

  parent reply	other threads:[~2026-09-25  5:30 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-24 16:08 [PATCH 0/8] virtio-usb: add dual-role virtio USB driver Igor Skalkin
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 [this message]
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=2026092531-giddy-annotate-7a58@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=aiswarya.cyriac@oss.qualcomm.com \
    --cc=anton.yakovlev@oss.qualcomm.com \
    --cc=igor.skalkin@oss.qualcomm.com \
    --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.