(CCing Michael and Marcel)
For better visibility I suggest copying the maintainers of hw/pci/pci.c when
submitting this patch in the next version:
$ ./scripts/get_maintainer.pl -f hw/pci/pci.c
"Michael S. Tsirkin" <m...@redhat.com> (supporter:PCI)
Marcel Apfelbaum <marcel.apfelb...@gmail.com> (supporter:PCI)
qemu-devel@nongnu.org (open list:All patches CC here)
We can push this via the RISC-V tree but we need an ack/review from the PCI
overlords.
Thanks,
Daniel
On 6/18/25 9:27 AM, Djordje Todorovic wrote:
Since there is no pch_gbe emulation, we could be using func other
than 0 when adding new devices to specific boards.
Signed-off-by: Chao-ying Fu <c...@mips.com>
Signed-off-by: Djordje Todorovic <djordje.todoro...@htecgroup.com>
---
hw/pci/pci.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index f5ab510697..23f7f02837 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -974,14 +974,15 @@ static int pci_parse_devaddr(const char *addr, int *domp,
int *busp,
slot = val;
- if (funcp != NULL) {
- if (*e != '.')
+ if (funcp != NULL && *e != 0) {
+ if (*e != '.') {
return -1;
-
+ }
p = e + 1;
val = strtoul(p, &e, 16);
- if (e == p)
+ if (e == p) {
return -1;
+ }
func = val;
}
@@ -2045,13 +2046,15 @@ bool pci_init_nic_in_slot(PCIBus *rootbus, const char
*model,
int dom, busnr, devfn;
PCIDevice *pci_dev;
unsigned slot;
+
PCIBus *bus;
if (!nd) {
return false;
}
- if (!devaddr || pci_parse_devaddr(devaddr, &dom, &busnr, &slot, NULL) < 0) {
+ unsigned func;
+ if (!devaddr || pci_parse_devaddr(devaddr, &dom, &busnr, &slot, &func) <
0) {
error_report("Invalid PCI device address %s for device %s",
devaddr, model);
exit(1);
@@ -2062,7 +2065,7 @@ bool pci_init_nic_in_slot(PCIBus *rootbus, const char
*model,
exit(1);
}
- devfn = PCI_DEVFN(slot, 0);
+ devfn = PCI_DEVFN(slot, func);
bus = pci_find_bus_nr(rootbus, busnr);
if (!bus) {