On Wed, Feb 22, 2023 at 02:40:32AM -0800, Andrea Bolognani wrote:On Tue, Feb 21, 2023 at 08:24:25PM +0100, Stefano Brivio wrote:Actually, I think we're ok. PCI slots are addressed in hex by convention, but AFAICT if you *just* give a slot number, it will accept either decimal or hex (so addr=10 and addr=0xa are equivalent). That's *not* true if you use SS.F format to include the function number - then it expects hex only. But we're not doing that, so so always using decimal should be ok here. Source: set_pci_devfn() in the qemu source Obviously that's a pretty fragile hack, but that's 'qrap' for you. -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibsonif (!has_json) { snprintf(dev_str, ARG_MAX, - "%s,%s%x%s,netdev=hostnet0,x-txburst=4096", + "%s,%s%i%s,netdev=hostnet0,x-txburst=4096", dev->name, dev->template, i, dev->template_post); } else { snprintf(dev_str, ARG_MAX, - "{\"driver\":\"%s\",%s%x\"%s,\"netdev\":\"hostnet0\",\"x-txburst\":4096}", + "{\"driver\":\"%s\",%s%i\"%s,\"netdev\":\"hostnet0\",\"x-txburst\":4096}", dev->name, dev->template_json, i, dev->template_json_post); }I don't think this is going to work. The problem is that, while PCI buses are indeed named with increasing numbers in integer format (pci.9, pci.10 and so on), PCI slots are addressed using hexadecimal format (0x9, 0xa and so on). libvirt uses this naming convention because it matches QEMU's.