all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH common] SysFSTools: allow longer pci domains
@ 2022-02-28 13:48 Dominik Csapak
  2022-02-28 13:48 ` [pve-devel] [PATCH qemu-server] PCI: " Dominik Csapak
  2022-03-16 18:09 ` [pve-devel] applied: [PATCH common] SysFSTools: " Thomas Lamprecht
  0 siblings, 2 replies; 4+ messages in thread
From: Dominik Csapak @ 2022-02-28 13:48 UTC (permalink / raw)
  To: pve-devel

by default, there is only one pci domain ('0000'), but there are systems
where there are more, and they don't need to be exactly 4 characters
long (see [0]), so extend that regex to allow domains 4 characters or
longer

0: https://forum.proxmox.com/threads/problem-with-gpu-passthrough-in-a-virtual-machine.105720/

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/PVE/SysFSTools.pm | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/PVE/SysFSTools.pm b/src/PVE/SysFSTools.pm
index 8b26599..aabe833 100644
--- a/src/PVE/SysFSTools.pm
+++ b/src/PVE/SysFSTools.pm
@@ -8,7 +8,7 @@ use IO::File;
 use PVE::Tools qw(file_read_firstline dir_glob_foreach);
 
 my $pcisysfs = "/sys/bus/pci";
-my $pciregex = "([a-f0-9]{4}):([a-f0-9]{2}):([a-f0-9]{2})\.([a-f0-9])";
+my $pciregex = "([a-f0-9]{4,}):([a-f0-9]{2}):([a-f0-9]{2})\.([a-f0-9])";
 
 my $parse_pci_ids = sub {
     my $ids = {};
@@ -149,7 +149,7 @@ sub get_mdev_types {
     my ($id) = @_;
 
     my $fullid = $id;
-    if ($id !~ m/^[0-9a-fA-f]{4}:/) {
+    if ($id !~ m/^[0-9a-fA-f]{4,}:/) {
 	$fullid = "0000:$id";
     }
 
@@ -300,11 +300,11 @@ sub pci_dev_group_bind_to_vfio {
     }
     die "Cannot find vfio-pci module!\n" if !-d $vfio_basedir;
 
-    $pciid = "0000:$pciid" if $pciid !~ m/^[0-9a-f]{4}:/;
+    $pciid = "0000:$pciid" if $pciid !~ m/^[0-9a-f]{4,}:/;
 
     # get IOMMU group devices
     opendir(my $D, "$pcisysfs/devices/$pciid/iommu_group/devices/") || die "Cannot open iommu_group: $!\n";
-    my @devs = grep /^[0-9a-f]{4}:/, readdir($D);
+    my @devs = grep /^[0-9a-f]{4,}:/, readdir($D);
     closedir($D);
 
     foreach my $pciid (@devs) {
@@ -323,7 +323,7 @@ sub pci_dev_group_bind_to_vfio {
 sub pci_create_mdev_device {
     my ($pciid, $uuid, $type) = @_;
 
-    $pciid = "0000:$pciid" if $pciid !~ m/^[0-9a-f]{4}:/;
+    $pciid = "0000:$pciid" if $pciid !~ m/^[0-9a-f]{4,}:/;
 
     my $basedir = "$pcisysfs/devices/$pciid";
     my $mdev_dir = "$basedir/mdev_supported_types";
@@ -360,7 +360,7 @@ sub pci_create_mdev_device {
 sub pci_cleanup_mdev_device {
     my ($pciid, $uuid) = @_;
 
-    $pciid = "0000:$pciid" if $pciid !~ m/^[0-9a-f]{4}:/;
+    $pciid = "0000:$pciid" if $pciid !~ m/^[0-9a-f]{4,}:/;
 
     my $basedir = "$pcisysfs/devices/$pciid/$uuid";
 
-- 
2.30.2





^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pve-devel] [PATCH qemu-server] PCI: allow longer pci domains
  2022-02-28 13:48 [pve-devel] [PATCH common] SysFSTools: allow longer pci domains Dominik Csapak
@ 2022-02-28 13:48 ` Dominik Csapak
  2022-03-16 17:04   ` [pve-devel] applied: " Thomas Lamprecht
  2022-03-16 18:09 ` [pve-devel] applied: [PATCH common] SysFSTools: " Thomas Lamprecht
  1 sibling, 1 reply; 4+ messages in thread
From: Dominik Csapak @ 2022-02-28 13:48 UTC (permalink / raw)
  To: pve-devel

some systems[0] have pci domains longer than the default ('0000') of 4
characters, so change the regex to allow at least 4.

0: https://forum.proxmox.com/threads/problem-with-gpu-passthrough-in-a-virtual-machine.105720/

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 PVE/QemuServer/PCI.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PVE/QemuServer/PCI.pm b/PVE/QemuServer/PCI.pm
index 70987d8..23fe508 100644
--- a/PVE/QemuServer/PCI.pm
+++ b/PVE/QemuServer/PCI.pm
@@ -18,7 +18,7 @@ parse_hostpci
 
 our $MAX_HOSTPCI_DEVICES = 16;
 
-my $PCIRE = qr/(?:[a-f0-9]{4}:)?[a-f0-9]{2}:[a-f0-9]{2}(?:\.[a-f0-9])?/;
+my $PCIRE = qr/(?:[a-f0-9]{4,}:)?[a-f0-9]{2}:[a-f0-9]{2}(?:\.[a-f0-9])?/;
 my $hostpci_fmt = {
     host => {
 	default_key => 1,
-- 
2.30.2





^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pve-devel] applied: [PATCH qemu-server] PCI: allow longer pci domains
  2022-02-28 13:48 ` [pve-devel] [PATCH qemu-server] PCI: " Dominik Csapak
@ 2022-03-16 17:04   ` Thomas Lamprecht
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Lamprecht @ 2022-03-16 17:04 UTC (permalink / raw)
  To: Proxmox VE development discussion, Dominik Csapak

On 28.02.22 14:48, Dominik Csapak wrote:
> some systems[0] have pci domains longer than the default ('0000') of 4
> characters, so change the regex to allow at least 4.
> 
> 0: https://forum.proxmox.com/threads/problem-with-gpu-passthrough-in-a-virtual-machine.105720/
> 
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
>  PVE/QemuServer/PCI.pm | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
>

applied, thanks!




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pve-devel] applied: [PATCH common] SysFSTools: allow longer pci domains
  2022-02-28 13:48 [pve-devel] [PATCH common] SysFSTools: allow longer pci domains Dominik Csapak
  2022-02-28 13:48 ` [pve-devel] [PATCH qemu-server] PCI: " Dominik Csapak
@ 2022-03-16 18:09 ` Thomas Lamprecht
  1 sibling, 0 replies; 4+ messages in thread
From: Thomas Lamprecht @ 2022-03-16 18:09 UTC (permalink / raw)
  To: Proxmox VE development discussion, Dominik Csapak

On 28.02.22 14:48, Dominik Csapak wrote:
> by default, there is only one pci domain ('0000'), but there are systems
> where there are more, and they don't need to be exactly 4 characters
> long (see [0]), so extend that regex to allow domains 4 characters or
> longer
> 
> 0: https://forum.proxmox.com/threads/problem-with-gpu-passthrough-in-a-virtual-machine.105720/
> 
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
>  src/PVE/SysFSTools.pm | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
>

applied, thanks!

The churn amount suggests that there's some potential of having a more centrally
defined format though ;-)




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-03-16 18:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-28 13:48 [pve-devel] [PATCH common] SysFSTools: allow longer pci domains Dominik Csapak
2022-02-28 13:48 ` [pve-devel] [PATCH qemu-server] PCI: " Dominik Csapak
2022-03-16 17:04   ` [pve-devel] applied: " Thomas Lamprecht
2022-03-16 18:09 ` [pve-devel] applied: [PATCH common] SysFSTools: " Thomas Lamprecht

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