public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Alexandre Derumier via pve-devel <pve-devel@lists.proxmox.com>
To: pve-devel@lists.proxmox.com
Cc: Alexandre Derumier <alexandre.derumier@groupe-cyllene.com>
Subject: [pve-devel] [PATCH v2 qemu-server 04/10] pci: add get_pci_addr
Date: Wed, 16 Jul 2025 18:34:09 +0200	[thread overview]
Message-ID: <mailman.70.1752683661.354.pve-devel@lists.proxmox.com> (raw)
In-Reply-To: <20250716163415.1837210-1-alexandre.derumier@groupe-cyllene.com>

[-- Attachment #1: Type: message/rfc822, Size: 5030 bytes --]

From: Alexandre Derumier <alexandre.derumier@groupe-cyllene.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH v2 qemu-server 04/10] pci: add get_pci_addr
Date: Wed, 16 Jul 2025 18:34:09 +0200
Message-ID: <20250716163415.1837210-5-alexandre.derumier@groupe-cyllene.com>

return a hash with pci bus && pci address

Signed-off-by: Alexandre Derumier <alexandre.derumier@groupe-cyllene.com>
---
 src/PVE/QemuServer/PCI.pm | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/PVE/QemuServer/PCI.pm b/src/PVE/QemuServer/PCI.pm
index e7a9a610..94fd10bd 100644
--- a/src/PVE/QemuServer/PCI.pm
+++ b/src/PVE/QemuServer/PCI.pm
@@ -16,6 +16,7 @@ use PVE::QemuServer::Machine;
 use base 'Exporter';
 
 our @EXPORT_OK = qw(
+    get_pci_addr
     print_pci_addr
     print_pcie_addr
     print_pcie_root_port
@@ -288,12 +289,12 @@ my $get_addr_mapping_from_id = sub {
     return { bus => $d->{bus}, addr => sprintf("0x%x", $d->{addr}) };
 };
 
-sub print_pci_addr {
+sub get_pci_addr {
     my ($id, $bridges, $arch) = @_;
 
     die "aarch64 cannot use IDE devices\n" if $arch eq 'aarch64' && $id =~ /^ide/;
 
-    my $res = '';
+    my $res = {};
 
     my $map = get_pci_addr_map();
     if (my $d = $get_addr_mapping_from_id->($map, $id)) {
@@ -301,13 +302,23 @@ sub print_pci_addr {
         # virt machine has an initial pcie.0. The other pci bridges that get added are called pci.N.
         my $busname = $arch eq 'aarch64' && $d->{bus} eq 0 ? 'pcie' : 'pci';
 
-        $res = ",bus=$busname.$d->{bus},addr=$d->{addr}";
+        $res = { bus => "$busname.$d->{bus}", addr => $d->{addr} };
         $bridges->{ $d->{bus} } = 1 if $bridges;
     }
 
     return $res;
 }
 
+sub print_pci_addr {
+    my ($id, $bridges, $arch) = @_;
+
+    my $pci = get_pci_addr($id, $bridges, $arch);
+    my $res = "";
+    $res .= ",bus=$pci->{bus}" if $pci->{bus};
+    $res .= ",addr=$pci->{addr}" if $pci->{addr};
+    return $res;
+}
+
 my $pcie_addr_map;
 
 sub get_pcie_addr_map {
-- 
2.39.5



[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

  parent reply	other threads:[~2025-07-16 16:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20250716163415.1837210-1-alexandre.derumier@groupe-cyllene.com>
2025-07-16 16:34 ` [pve-devel] [PATCH v2 qemu-server 01/10] introduce DriveDevice module Alexandre Derumier via pve-devel
2025-07-16 16:34 ` [pve-devel] [PATCH v2 qemu-server 02/10] add print_drivedevice_controller && print_drivedevice_iothread Alexandre Derumier via pve-devel
2025-07-16 16:34 ` [pve-devel] [PATCH v2 qemu-server 03/10] hotplug: drive controller : use print_drivedevice_iothread && print_drivedevice_controller Alexandre Derumier via pve-devel
2025-07-16 16:34 ` Alexandre Derumier via pve-devel [this message]
2025-07-16 16:34 ` [pve-devel] [PATCH v2 qemu-server 05/10] qmphelpers: add qmp_deviceadd && qmp_devicedel Alexandre Derumier via pve-devel
2025-07-16 16:34 ` [pve-devel] [PATCH v2 qemu-server 06/10] convert drive device to json format Alexandre Derumier via pve-devel
2025-07-16 16:34 ` [pve-devel] [PATCH v2 qemu-server 07/10] convert iothread to json Alexandre Derumier via pve-devel
2025-07-16 16:34 ` [pve-devel] [PATCH v2 qemu-server 08/10] convert disk controller device to json format Alexandre Derumier via pve-devel
2025-07-16 16:34 ` [pve-devel] [PATCH v2 qemu-server 09/10] tests: cfg2cmd: convert drive devices " Alexandre Derumier via pve-devel
2025-07-16 16:34 ` [pve-devel] [PATCH v2 qemu-server 10/10] RFC: add multiple iothreads support Alexandre Derumier via pve-devel

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=mailman.70.1752683661.354.pve-devel@lists.proxmox.com \
    --to=pve-devel@lists.proxmox.com \
    --cc=alexandre.derumier@groupe-cyllene.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal