On 4/21/25 21:38, Maximilian Martin via Devel wrote:
> This resubmission splits up the previous patch into multiple patches and
> incorporates review comments from Michal Prívozník.
> 
> Currently, only vendor/product and bus/device matching are supported for USB 
> host
> devices. Neither of these provide a stable and persistent way of assigning a 
> guest
> a specific host device. Vendor/product can be ambiguous. Device numbers 
> change on
> every enumeration.
> 
> This patch adds a bus/port matching, which allows a specific port on the host 
> to be
> specified using the dotted notation found in Linux's "devpath" sysfs 
> attribute.
> 
> This patch is based on the previous work of Thomas Hebb: 
> https://lists.libvirt.org/archives/list/devel@lists.libvirt.org/message/7U3HFUW3DGDOSF4RIBRZJINKFDYCE2ZH/
> 
> Resolves: https://gitlab.com/libvirt/libvirt/-/issues/513
> 
> Signed-off-by: Maximilian Martin <maximilian_mar...@gmx.de>
> 
> Maximilian Martin (4):
>   virusb test data: add devpath files for port addressing
>   domain_conf, virhostdev, virusb, virusb test: add bus/port matching
>   schema: add USB port attribute
>   docs: add description for USB port matching
> 
>  docs/formatdomain.rst                         |  29 ++--
>  src/conf/domain_conf.c                        |  69 +++++++-
>  src/conf/domain_conf.h                        |   1 +
>  src/conf/schemas/domaincommon.rng             |  11 +-
>  src/hypervisor/virhostdev.c                   | 131 +++++++++------
>  src/libvirt_private.syms                      |   2 -
>  src/util/virusb.c                             | 156 ++++++------------
>  src/util/virusb.h                             |  32 ++--
>  tests/virusbtest.c                            | 149 ++++++++++++-----
>  .../sys_bus_usb/devices/1-1.5.3.1/devpath     |   1 +
>  .../sys_bus_usb/devices/1-1.5.3.3/devpath     |   1 +
>  .../sys_bus_usb/devices/1-1.5.3/devpath       |   1 +
>  .../sys_bus_usb/devices/1-1.5.4/devpath       |   1 +
>  .../sys_bus_usb/devices/1-1.5.5/devpath       |   1 +
>  .../sys_bus_usb/devices/1-1.5.6/devpath       |   1 +
>  .../sys_bus_usb/devices/1-1.5/devpath         |   1 +
>  .../sys_bus_usb/devices/1-1.6/devpath         |   1 +
>  .../sys_bus_usb/devices/1-1/devpath           |   1 +
>  .../sys_bus_usb/devices/2-1.2/devpath         |   1 +
>  .../sys_bus_usb/devices/2-1/devpath           |   1 +
>  .../sys_bus_usb/devices/usb1/devpath          |   1 +
>  .../sys_bus_usb/devices/usb2/devpath          |   1 +
>  .../sys_bus_usb/devices/usb3/devpath          |   1 +
>  .../sys_bus_usb/devices/usb4/devpath          |   1 +
>  24 files changed, 351 insertions(+), 244 deletions(-)
>  create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.1/devpath
>  create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3.3/devpath
>  create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.3/devpath
>  create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.4/devpath
>  create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.5/devpath
>  create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5.6/devpath
>  create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.5/devpath
>  create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1.6/devpath
>  create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/1-1/devpath
>  create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/2-1.2/devpath
>  create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/2-1/devpath
>  create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/usb1/devpath
>  create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/usb2/devpath
>  create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/usb3/devpath
>  create mode 100644 tests/virusbtestdata/sys_bus_usb/devices/usb4/devpath
> 

I've accumulated some fixes to patch 2/4 and stored them as a fixup
commit:

https://gitlab.com/MichalPrivoznik/libvirt/-/commit/bd6f9c823b0bbdafce4a8b7426c5763ad1d77966

If you're fine with suggested changes I could squash them and merge.

Michal

Reply via email to