From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH common 1/1] sysfs tools: remove moved code
Date: Thu, 5 Mar 2026 10:16:57 +0100 [thread overview]
Message-ID: <20260305091711.1221589-14-d.csapak@proxmox.com> (raw)
In-Reply-To: <20260305091711.1221589-1-d.csapak@proxmox.com>
these functions now live in PVE::QemuServer::PCI::Mdev instead.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
src/PVE/SysFSTools.pm | 111 ------------------------------------------
1 file changed, 111 deletions(-)
diff --git a/src/PVE/SysFSTools.pm b/src/PVE/SysFSTools.pm
index a00fbcb..f689a40 100644
--- a/src/PVE/SysFSTools.pm
+++ b/src/PVE/SysFSTools.pm
@@ -150,71 +150,6 @@ sub lspci {
return $devices;
}
-#
-# return format:
-# [
-# {
-# type => 'FooType_1',
-# description => "a longer description with custom format\nand newlines",
-# available => 5,
-# },
-# ...
-# ]
-#
-sub get_mdev_types {
- my ($id) = @_;
-
- $id = normalize_pci_id($id);
-
- my $types = [];
-
- my $dev_path = "$pcisysfs/devices/$id";
- my $mdev_path = "$dev_path/mdev_supported_types";
- my $nvidia_path = "$dev_path/nvidia/creatable_vgpu_types";
- if (-d $mdev_path) {
- dir_glob_foreach(
- $mdev_path,
- '[^\.].*',
- sub {
- my ($type) = @_;
-
- my $type_path = "$mdev_path/$type";
-
- my $available = int(file_read_firstline("$type_path/available_instances"));
- my $description = PVE::Tools::file_get_contents("$type_path/description");
-
- my $entry = {
- type => $type,
- description => $description,
- available => $available,
- };
-
- my $name = file_read_firstline("$type_path/name");
- $entry->{name} = $name if defined($name);
-
- push @$types, $entry;
- },
- );
- } elsif (-f $nvidia_path) {
- my $creatable = PVE::Tools::file_get_contents($nvidia_path);
- for my $line (split("\n", $creatable)) {
- next if $line =~ m/^ID/; # header
- next if $line !~ m/^(.*?)\s*:\s*(.*)$/;
- my $id = $1;
- my $name = $2;
-
- push $types->@*, {
- type => "nvidia-$id", # backwards compatibility
- description => "", # TODO, read from xml/nvidia-smi ?
- available => 1,
- name => $name,
- };
- }
- }
-
- return $types;
-}
-
sub check_iommu_support {
# we have IOMMU support if /sys/class/iommu/ is populated
return PVE::Tools::dir_glob_regex('/sys/class/iommu/', "[^\.].*");
@@ -372,52 +307,6 @@ sub pci_dev_group_bind_to_vfio {
return 1;
}
-sub pci_create_mdev_device {
- my ($pciid, $uuid, $type) = @_;
-
- $pciid = normalize_pci_id($pciid);
-
- my $basedir = "$pcisysfs/devices/$pciid";
- my $mdev_dir = "$basedir/mdev_supported_types";
-
- die "pci device '$pciid' does not support mediated devices \n"
- if !-d $mdev_dir;
-
- die "pci device '$pciid' has no type '$type'\n"
- if !-d "$mdev_dir/$type";
-
- if (-d "$basedir/$uuid") {
- # it already exists, checking type
- my $typelink = readlink("$basedir/$uuid/mdev_type");
- my ($existingtype) = $typelink =~ m|/([^/]+)$|;
- die "mdev instance '$uuid' already exits, but type is not '$type'\n"
- if $type ne $existingtype;
-
- # instance exists, so use it but warn the user
- warn "mdev instance '$uuid' already existed, using it.\n";
- return undef;
- }
-
- my $instances = file_read_firstline("$mdev_dir/$type/available_instances");
- my ($avail) = $instances =~ m/^(\d+)$/;
- die "pci device '$pciid' has no available instances of '$type'\n"
- if $avail < 1;
-
- die "could not create 'type' for pci devices '$pciid'\n"
- if !file_write("$mdev_dir/$type/create", $uuid);
-
- return undef;
-}
-
-# encode the hostpci index and vmid into the uuid
-sub generate_mdev_uuid {
- my ($vmid, $index) = @_;
-
- my $string = sprintf("%08d-0000-0000-0000-%012d", $index, $vmid);
-
- return $string;
-}
-
# idea is from usbutils package (/usr/bin/usb-devices) script
sub __scan_usb_device {
my ($res, $devpath, $parent, $level) = @_;
--
2.47.3
prev parent reply other threads:[~2026-03-05 9:17 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-05 9:16 [PATCH common/debcargo-conf/manager/proxmox-perl-rs/qemu-server 00/13] use NVML for vGPU info querying Dominik Csapak
2026-03-05 9:16 ` [PATCH debcargo-conf 1/8] nvml-wrapper-sys: Update to 0.9.0 Dominik Csapak
2026-03-05 9:16 ` [PATCH debcargo-conf 2/8] nvml-wrapper-sys: release 0.9.0-1 Dominik Csapak
2026-03-05 9:16 ` [PATCH debcargo-conf 3/8] nvml-wrapper: Update to 0.11.0 Dominik Csapak
2026-03-05 9:16 ` [PATCH debcargo-conf 4/8] nvml-wrapper: release 0.11.0-1 Dominik Csapak
2026-03-05 9:16 ` [PATCH debcargo-conf 5/8] nvml-wrapper: Update to 0.12.0 Dominik Csapak
2026-03-05 9:16 ` [PATCH debcargo-conf 6/8] nvml-wrapper: add patch for vgpu ids Dominik Csapak
2026-03-05 9:16 ` [PATCH debcargo-conf 7/8] backport nvml-wrapper-sys 0.9.0-1 Dominik Csapak
2026-03-05 9:16 ` [PATCH debcargo-conf 8/8] backport nvml-wrapper 0.12.0-1 Dominik Csapak
2026-03-05 9:16 ` [PATCH proxmox-perl-rs 1/1] pve: add binding for accessing vgpu info Dominik Csapak
2026-03-05 9:16 ` [PATCH qemu-server 1/2] pci: move mdev related code to own module Dominik Csapak
2026-03-05 9:16 ` [PATCH qemu-server 2/2] pci: mdev: use PVE::RS::NVML for nvidia mdev information Dominik Csapak
2026-03-05 9:16 ` [PATCH manager 1/1] api: hardware: pci: use NVML for querying " Dominik Csapak
2026-03-05 9:16 ` Dominik Csapak [this message]
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=20260305091711.1221589-14-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.