From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MHHRm-0003pb-2b for qemu-devel@nongnu.org; Thu, 18 Jun 2009 09:14:30 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MHHRf-0003dy-VR for qemu-devel@nongnu.org; Thu, 18 Jun 2009 09:14:28 -0400 Received: from [199.232.76.173] (port=56909 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MHHRe-0003df-TS for qemu-devel@nongnu.org; Thu, 18 Jun 2009 09:14:22 -0400 Received: from oxygen.pond.sub.org ([213.239.205.148]:57313) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MHHRe-0003Gk-8W for qemu-devel@nongnu.org; Thu, 18 Jun 2009 09:14:22 -0400 Received: from pike.pond.sub.org (pD9E3BB74.dip.t-dialin.net [217.227.187.116]) by oxygen.pond.sub.org (Postfix) with ESMTPA id 1DD58276CBA for ; Thu, 18 Jun 2009 15:14:21 +0200 (CEST) From: Markus Armbruster Date: Thu, 18 Jun 2009 15:14:06 +0200 Message-Id: Subject: [Qemu-devel] [RFC PATCH 0/4] Configurable PCI device addresses List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org I'm marking this patch series as RFC, because I'm not quite done testing. Please review. Provide addr= in device option arguments for NICs (PCI only) and virtio-blk-pci. More devices to follow. Command line options -net nic and -drive get a new parameter addr, which is interpreted by device code. Because only virtio-blk-pci implements -drive parameter addr, -drive rejects it unless if=virtio. Only PCI NICs implement -net nic parameter addr, others silently ignore it. Monitor command pci_add already provides syntax to select the PCI address, but it doesn't actually work (see patch 3 for details). This patch series makes pci_add work without changing its syntax. addr= in the third argument is caught and rejected because the first argument already has a mandatory pci_addr=. See patches 2 and 4 for how that's done. Aside: the pci_add syntax is ugly. It has two name=value,... arguments, and the first one only accepts the name pci_addr (all other names are silently ignored). Similar ugliness in pci_del and drive_add. While testing this, I stumbled over a pre-existing pci_add problem: it uses ordinary device initialization code, which prints to stderr and exits on error. That's not approproate for monitor commands. Example: "pci_add pci_addr=auto nic model=xxx" goes qemu_pci_hot_add_nic() -> pci_nic_init() -> qemu_check_nic_model_list() -> exit(). Not fixed. Testing showed that PCI devices work in some slots, but not in others, regardless of this patch (to be reported separately). This patch makes the problem more visible, but it doesn't cause it. Markus Armbruster (4): Fix do_pci_register_device() to reject devfn already in use Support addr=... in option argument of -net nic Make first argument of monitor command pci_add work Support addr=... in option argument of -drive if=virtio hw/mips_malta.c | 10 +++--- hw/pc.c | 7 +++- hw/pci-hotplug.c | 64 ++++++++++++++++++++++++++++------------------- hw/pci.c | 53 ++++++++++++++++++++++++++++----------- hw/pci.h | 6 ++-- hw/ppc440_bamboo.c | 6 +++- hw/ppc_newworld.c | 2 +- hw/ppc_oldworld.c | 2 +- hw/ppc_prep.c | 2 +- hw/ppce500_mpc8544ds.c | 6 +++- hw/r2d.c | 2 +- hw/realview.c | 2 +- hw/versatilepb.c | 2 +- net.c | 5 +++- net.h | 1 + qemu-options.hx | 10 +++++-- sysemu.h | 1 + vl.c | 14 +++++++++- 18 files changed, 129 insertions(+), 66 deletions(-)