fix #6466: aarch64: pci: properly print higher-index PCI bridge addresses

For aarch64, the virt machine has an initial pcie.0 bus. The other pci
bridges that get added on top are called pci.N, see the relevant
section in config_to_command() which adds them.

In particular this fixes adding an RNG device, which is require for
OVMF PXE boot.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Link: https://lore.proxmox.com/20250618152009.120524-4-f.ebner@proxmox.com
This commit is contained in:
Fiona Ebner 2025-06-18 17:20:09 +02:00 committed by Thomas Lamprecht
parent a8417c5611
commit 6223caf16f

View file

@ -291,17 +291,16 @@ my $get_addr_mapping_from_id = sub {
sub print_pci_addr {
my ($id, $bridges, $arch) = @_;
my $res = '';
die "aarch64 cannot use IDE devices\n" if $arch eq 'aarch64' && $id =~ /^ide/;
# using same bus slots on all HW, so we need to check special cases here:
my $busname = 'pci';
if ($arch eq 'aarch64') {
die "aarch64 cannot use IDE devices\n" if $id =~ /^ide/;
$busname = 'pcie';
}
my $res = '';
my $map = get_pci_addr_map();
if (my $d = $get_addr_mapping_from_id->($map, $id)) {
# Using same bus slots on all HW, so we need to check special cases here. For aarch64, the
# 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}";
$bridges->{ $d->{bus} } = 1 if $bridges;
}