all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server 6/7] USB: increase max usb devices to 14 for newer machine version and ostype
Date: Thu, 10 Nov 2022 15:35:57 +0100	[thread overview]
Message-ID: <20221110143600.258897-7-d.csapak@proxmox.com> (raw)
In-Reply-To: <20221110143600.258897-1-d.csapak@proxmox.com>

for machine versions >= 7.1 and ostype linux or windows > 7, we use the
qemu-xhci controller where we have up to 14 usable ports, so make them
available to the user

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 PVE/QemuServer.pm     |  5 +++--
 PVE/QemuServer/USB.pm | 13 +++++++++++++
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 452eb10..3a0704a 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -823,7 +823,7 @@ while (my ($k, $v) = each %$confdesc) {
     PVE::JSONSchema::register_standard_option("pve-qm-$k", $v);
 }
 
-my $MAX_USB_DEVICES = 5;
+my $MAX_USB_DEVICES = 14;
 my $MAX_NETS = 32;
 my $MAX_SERIAL_PORTS = 4;
 my $MAX_PARALLEL_PORTS = 3;
@@ -1102,7 +1102,8 @@ EODESCR
 my $usbdesc = {
     optional => 1,
     type => 'string', format => $usb_fmt,
-    description => "Configure an USB device (n is 0 to 4).",
+    description => "Configure an USB device (n is 0 to 4, for machine version >= 7.1 and ostype"
+	." l26 or windows > 7, n can be up to 14).",
 };
 PVE::JSONSchema::register_standard_option("pve-qm-usb", $usbdesc);
 
diff --git a/PVE/QemuServer/USB.pm b/PVE/QemuServer/USB.pm
index 96931d4..7def04d 100644
--- a/PVE/QemuServer/USB.pm
+++ b/PVE/QemuServer/USB.pm
@@ -14,6 +14,8 @@ get_usb_controllers
 get_usb_devices
 );
 
+my $OLD_MAX_USB = 5;
+
 sub parse_usb_device {
     my ($value) = @_;
 
@@ -35,6 +37,15 @@ sub parse_usb_device {
     return $res;
 }
 
+my sub check_usb_index {
+    my ($index, $use_qemu_xhci) = @_;
+
+    die "using usb$index is only possible with machine type >= 7.1 and ostype l26 or windows > 7\n"
+	if $index >= $OLD_MAX_USB && !$use_qemu_xhci;
+
+    return undef;
+}
+
 sub get_usb_controllers {
     my ($conf, $bridges, $arch, $machine, $format, $max_usb_devices, $machine_version) = @_;
 
@@ -72,6 +83,7 @@ sub get_usb_controllers {
     my $use_usb = 0;
     for (my $i = 0; $i < $max_usb_devices; $i++)  {
 	next if !$conf->{"usb$i"};
+	check_usb_index($i, $use_qemu_xhci);
 	my $d = eval { PVE::JSONSchema::parse_property_string($format,$conf->{"usb$i"}) };
 	next if !$d;
 	$use_usb = 1;
@@ -100,6 +112,7 @@ sub get_usb_devices {
     for (my $i = 0; $i < $max_usb_devices; $i++)  {
 	my $devname = "usb$i";
 	next if !$conf->{$devname};
+	check_usb_index($i, $use_qemu_xhci);
 	my $d = eval { PVE::JSONSchema::parse_property_string($format,$conf->{$devname}) };
 	next if !$d;
 
-- 
2.30.2





  parent reply	other threads:[~2022-11-10 14:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-10 14:35 [pve-devel] [PATCH qemu-server/pve-manager] use qemu-xhci for new guests Dominik Csapak
2022-11-10 14:35 ` [pve-devel] [PATCH qemu-server 1/7] print_tabletdevice_full: make use of $q35 variable Dominik Csapak
2022-11-10 14:35 ` [pve-devel] [PATCH qemu-server 2/7] move 'windows_version' to Helpers Dominik Csapak
2022-11-10 14:35 ` [pve-devel] [PATCH qemu-server 3/7] USB: print_usbdevice_full: error out on invalid configuration Dominik Csapak
2022-11-10 14:35 ` [pve-devel] [PATCH qemu-server 4/7] USB: use machine_type_is_q35 instead of regex Dominik Csapak
2022-11-10 14:35 ` [pve-devel] [PATCH qemu-server 5/7] fix #4324: USB: use qemu-xhci for machine versions >= 7.1 Dominik Csapak
2022-11-10 14:35 ` Dominik Csapak [this message]
2022-11-10 14:35 ` [pve-devel] [PATCH qemu-server 7/7] fix #3271: USB: allow usb hotplugging for modern guests Dominik Csapak
2022-11-10 14:35 ` [pve-devel] [PATCH manager 1/2] ui: USBInputPanel: use correct maximum usb index Dominik Csapak
2022-11-10 14:36 ` [pve-devel] [PATCH manager 2/2] ui: qemu: increase available usb ports depending on machine and ostype Dominik Csapak
2022-11-10 14:39 ` [pve-devel] [PATCH qemu-server/pve-manager] use qemu-xhci for new guests Dominik Csapak
2022-11-10 17:02 ` [pve-devel] applied-series: " Thomas Lamprecht

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=20221110143600.258897-7-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal