From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH qemu-server v5 10/13] pve-qemu-pci: bus: add buses for numa expander bridges and pcie switches
Date: Wed, 18 Nov 2026 16:27:52 +0100 [thread overview]
Message-ID: <20261118152803.3843758-11-d.csapak@proxmox.com> (raw)
In-Reply-To: <20261118152803.3843758-1-d.csapak@proxmox.com>
These are needed to place hostpcie devices like on the host.
`bridge_model` now also returns the models for them and for root
ports, so the code placing the devices can look them up.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
pve-qemu-rs/pve-qemu-pci/src/types/bus.rs | 37 +++++++++++++++++++++--
1 file changed, 34 insertions(+), 3 deletions(-)
diff --git a/pve-qemu-rs/pve-qemu-pci/src/types/bus.rs b/pve-qemu-rs/pve-qemu-pci/src/types/bus.rs
index 052ef008..602c88a9 100644
--- a/pve-qemu-rs/pve-qemu-pci/src/types/bus.rs
+++ b/pve-qemu-rs/pve-qemu-pci/src/types/bus.rs
@@ -84,17 +84,35 @@ pub enum Bus {
Sys(u8),
/// One of the bridges PVE adds per device kind, see [`PveBridge`].
Pve { kind: PveBridge, index: u8 },
+ /// Root bus of the PCIe expander bridge for a guest NUMA node.
+ Numa(u8),
+ /// The bus behind the port of a replicated PCIe switch, only holds its
+ /// upstream port.
+ SwitchUplink(u8),
+ /// The bus behind the upstream port of a replicated PCIe switch, holds its
+ /// downstream ports.
+ Switch(u8),
+ /// The bus behind the downstream switch port for `hostpcie<index>`.
+ SwitchPort(u8),
}
type BusConstructor = fn(u8) -> Bus;
impl Bus {
/// The QEMU device model needed to create this bus below `parent`, or
- /// `None` if the bus is not created by a bridge device.
+ /// `None` for root buses.
pub fn bridge_model(self, parent: Bus) -> Option<&'static str> {
match self {
+ Bus::Pcie(_) => None,
#[expect(deprecated)]
- Bus::Pcie(_) | Bus::RootPort(_) | Bus::LegacyRootPort(_) => None,
+ Bus::RootPort(_) | Bus::LegacyRootPort(_) => Some("pcie-root-port"),
+ Bus::Numa(_) => Some("pxb-pcie"),
+ Bus::SwitchUplink(_) => Some(match parent {
+ Bus::Switch(_) => "xio3130-downstream",
+ _ => "pcie-root-port",
+ }),
+ Bus::Switch(_) => Some("x3130-upstream"),
+ Bus::SwitchPort(_) => Some("xio3130-downstream"),
Bus::Pcidmi => Some("i82801b11-bridge"),
Bus::Sys(_) | Bus::Pci(_) | Bus::Pve { .. } => Some(match parent {
#[expect(deprecated)]
@@ -118,6 +136,10 @@ impl std::fmt::Display for Bus {
Bus::Pve { kind, index } => {
write!(f, "pve.{kind}{index}")
}
+ Bus::Numa(i) => write!(f, "pve.numa{i}"),
+ Bus::SwitchUplink(i) => write!(f, "pve.switch-uplink{i}"),
+ Bus::Switch(i) => write!(f, "pve.switch{i}"),
+ Bus::SwitchPort(i) => write!(f, "pve.switch-port{i}"),
}
}
}
@@ -127,7 +149,8 @@ impl std::str::FromStr for Bus {
fn from_str(s: &str) -> Result<Self, Self::Err> {
// NOTE: the prefixes here must be checked before the generic 'pve.'
- // one below, which would otherwise swallow them.
+ // one below, which would otherwise swallow them. Also 'pve.switch' has to
+ // come after the longer 'pve.switch-' prefixes.
const PREFIXES: &[(&str, BusConstructor)] = &[
("pci.", Bus::Pci),
("pcie.", Bus::Pcie),
@@ -135,6 +158,10 @@ impl std::str::FromStr for Bus {
#[expect(deprecated)]
("ich9-pcie-port-", Bus::LegacyRootPort),
("pve.sys", Bus::Sys),
+ ("pve.numa", Bus::Numa),
+ ("pve.switch-uplink", Bus::SwitchUplink),
+ ("pve.switch-port", Bus::SwitchPort),
+ ("pve.switch", Bus::Switch),
];
if s == "pcidmi" {
@@ -194,5 +221,9 @@ mod test {
#[expect(deprecated)]
test(Bus::LegacyRootPort(99));
test(Bus::Sys(99));
+ test(Bus::Numa(7));
+ test(Bus::SwitchUplink(99));
+ test(Bus::Switch(99));
+ test(Bus::SwitchPort(99));
}
}
--
2.47.3
next prev parent reply other threads:[~2026-11-18 15:28 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 15:27 [PATCH manager/qemu-server v5 00/13] pci-handling rewrite Dominik Csapak
2026-11-18 15:27 ` [PATCH qemu-server v5 01/13] pve-qemu-rs: add pve-qemu-pci crate for guest PCI address generation Dominik Csapak
2026-11-18 15:27 ` [PATCH qemu-server v5 02/13] pve-qemu-pci: legacy: generate pci bridges Dominik Csapak
2026-11-18 15:27 ` [PATCH qemu-server v5 03/13] pve-qemu-pci: legacy: generate q35 chipset devices and hostpcie root ports Dominik Csapak
2026-11-18 15:27 ` [PATCH qemu-server v5 04/13] pve-qemu-rs: build perlmod library with bindings for pve-qemu-pci Dominik Csapak
2026-11-19 12:47 ` Elias Huhsovitz
2026-11-19 14:51 ` Dominik Csapak
2026-11-18 15:27 ` [PATCH qemu-server v5 05/13] pci: use PVE::QemuServer::RS::PCI bindings for addresses and bus devices Dominik Csapak
2026-11-18 15:27 ` [PATCH qemu-server v5 06/13] tree-wide: use HardwareConfig for the machine version checks Dominik Csapak
2026-11-18 15:27 ` [PATCH qemu-server v5 07/13] cfg2cmd: q35: generate chipset devices with machine version 11.1+pve1 Dominik Csapak
2026-11-18 15:27 ` [PATCH qemu-server v5 08/13] pve-qemu-pci: layout: add grouped PCI and PCIe layouts Dominik Csapak
2026-11-18 15:27 ` [PATCH qemu-server v5 09/13] machine: add 'pci-layout' option Dominik Csapak
2026-11-18 15:27 ` Dominik Csapak [this message]
2026-11-18 15:27 ` [PATCH qemu-server v5 11/13] pve-qemu-pci: topology: place hostpcie devices like on the host Dominik Csapak
2026-11-19 13:43 ` Elias Huhsovitz
2026-11-19 15:10 ` Dominik Csapak
2026-11-18 15:27 ` [PATCH qemu-server v5 12/13] machine: add 'pci-topology' option Dominik Csapak
2026-11-19 12:42 ` Elias Huhsovitz
2026-11-19 15:12 ` Dominik Csapak
2026-11-18 15:27 ` [PATCH pve-manager v5 13/13] ui: qemu machine: don't lose pci options on edit cycle Dominik Csapak
2026-11-19 12:18 ` [PATCH manager/qemu-server v5 00/13] pci-handling rewrite Elias Huhsovitz
2026-11-19 12:33 ` Dominik Csapak
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=20261118152803.3843758-11-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox