From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id AE0521FF09B for ; Mon, 28 Sep 2026 14:56:32 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id B070D2170A; Mon, 28 Sep 2026 14:56:30 +0200 (CEST) Content-Type: text/plain; charset=UTF-8 Date: Mon, 28 Sep 2026 14:56:27 +0200 Message-Id: Subject: Re: [PATCH proxmox-perl-rs 5/9] pve: add bindings for `pve-qemu-server-pci` crate From: "Elias Huhsovitz" To: "Dominik Csapak" , Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Mailer: aerc 0.20.0 References: <20260922105550.2084078-1-d.csapak@proxmox.com> <20260922105550.2084078-6-d.csapak@proxmox.com> In-Reply-To: <20260922105550.2084078-6-d.csapak@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1790600187229 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.400 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) KAM_MAILER 2 Automated Mailer Tag Left in Email RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: DBW6OV7VE7BFPWTMLRYHALUKCSRY5DZL X-Message-ID-Hash: DBW6OV7VE7BFPWTMLRYHALUKCSRY5DZL X-MailFrom: e.huhsovitz@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: I feel like this patch (5/9) and the next patch (6/9) could have been the same commit. Since here we already use crate::bindings::pci::machine::pve_rs_pci_machine::MachineWrap, which gets introduced in the subsequent patch. On Tue Sep 22, 2026 at 12:55 PM CEST, Dominik Csapak wrote: > These provide bindings for using the rust pci code in PVE's qemu-server > perl code. For now a very limited set of functions that live in rust. > > Signed-off-by: Dominik Csapak > --- > pve-rs/Cargo.toml | 1 + > pve-rs/Makefile | 1 + > pve-rs/src/bindings/mod.rs | 3 ++ > pve-rs/src/bindings/pci/mod.rs | 50 ++++++++++++++++++++++++++++++++++ > 4 files changed, 55 insertions(+) > create mode 100644 pve-rs/src/bindings/pci/mod.rs > > diff --git a/pve-rs/Cargo.toml b/pve-rs/Cargo.toml > index 5ae9082..0c4a47e 100644 > --- a/pve-rs/Cargo.toml > +++ b/pve-rs/Cargo.toml > @@ -52,6 +52,7 @@ proxmox-tfa =3D { version =3D "6.0.3", features =3D ["a= pi"] } > proxmox-time =3D "2" > proxmox-ve-config =3D { version =3D "0.10.4", features =3D [ "frr" ] } > proxmox-wireguard =3D { version =3D "0.1.2" } > +pve-qemu-server-pci =3D "0.1" > =20 > # [patch.crates-io] > # pbs-api-types =3D { path =3D "../../proxmox/pbs-api-types" } > diff --git a/pve-rs/Makefile b/pve-rs/Makefile > index bb1cd2d..dbffb38 100644 > --- a/pve-rs/Makefile > +++ b/pve-rs/Makefile > @@ -29,6 +29,7 @@ PERLMOD_PACKAGES :=3D \ > PVE::RS::Firewall::SDN \ > PVE::RS::NVML \ > PVE::RS::OCI \ > + PVE::RS::PCI \ > PVE::RS::OpenId \ > PVE::RS::ResourceScheduling::Static \ > PVE::RS::ResourceScheduling::Dynamic \ > diff --git a/pve-rs/src/bindings/mod.rs b/pve-rs/src/bindings/mod.rs > index f922982..2d88580 100644 > --- a/pve-rs/src/bindings/mod.rs > +++ b/pve-rs/src/bindings/mod.rs > @@ -6,6 +6,9 @@ pub use nvml::pve_rs_nvml; > mod oci; > pub use oci::pve_rs_oci; > =20 > +mod pci; > +pub use pci::pve_rs_pci; > + > pub mod resource_scheduling; > =20 > mod tfa; > diff --git a/pve-rs/src/bindings/pci/mod.rs b/pve-rs/src/bindings/pci/mod= .rs > new file mode 100644 > index 0000000..9b3ad9d > --- /dev/null > +++ b/pve-rs/src/bindings/pci/mod.rs > @@ -0,0 +1,50 @@ > +#[perlmod::package(name =3D "PVE::RS::PCI", lib =3D "pve_rs")] > +pub mod pve_rs_pci { > + //! The `PVE::RS::PCI` package. > + //! > + //! Provides bindings for the [`pve-qemu-server-pci`] crate. > + > + use anyhow::{Error, format_err}; > + > + pub use pve_qemu_server_pci::Machine; > + > + use crate::bindings::pci::machine::pve_rs_pci_machine::MachineWrap; this crate here doesnt exist yet. > + > + #[export] > + /// Prints the PCI address for a guest from the given ID and archite= cture. > + pub fn print_pci_addr(id: &str, arch: &str) -> Result= { > + pve_qemu_server_pci::print_pci_addr(id, arch) > + .map_err(|err| format_err!("can't find pci address for {id}:= {:?}", err)) > + } > + > + #[export] > + /// Prints the PCIe address for a guest from the given ID. > + pub fn print_pcie_addr(id: &str) -> Result { > + pve_qemu_server_pci::print_pcie_addr(id) > + .map_err(|err| format_err!("can't find pcie address for {id}= : {:?}", err)) > + } > + > + #[export] > + /// Prints the PCIe root port for a guest from the given index. > + pub fn print_pcie_root_port(i: u8) -> Result { > + pve_qemu_server_pci::print_pcie_root_port(i) > + .map_err(|err| format_err!("can't find pcie root port {i}: {= :?}", err)) > + } > + > + #[export] > + /// Get PCI bridge number the given device sits on (if it exists) > + pub fn get_pci_bridge_for_device(id: &str) -> Option { > + pve_qemu_server_pci::get_pci_bridge_for_device(id) > + } > + > + #[export] > + /// Get the necessary PCI bridges for a guest from the given options= . > + pub fn get_pci_bridges( > + arch: &str, > + q35: bool, > + virtio_scsi_single: bool, > + legacy_igd: bool, > + ) -> Vec { > + pve_qemu_server_pci::get_pci_bridges(arch, q35, virtio_scsi_sing= le, legacy_igd) > + } > +}