Received: from [140.186.70.92] (port=55680 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OfCuh-0005f1-No for qemu-devel@nongnu.org; Sat, 31 Jul 2010 10:19:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OfCug-0000N6-Jg for qemu-devel@nongnu.org; Sat, 31 Jul 2010 10:19:47 -0400 Received: from hall.aurel32.net ([88.191.82.174]:60607) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OfCug-0000Mt-89 for qemu-devel@nongnu.org; Sat, 31 Jul 2010 10:19:46 -0400 Date: Sat, 31 Jul 2010 16:19:44 +0200 From: Aurelien Jarno Subject: Re: [Qemu-devel] [PATCH] Do not try loading option ROM for hotplug PCI device in pc-0.11 compat mode Message-ID: <20100731141944.GC31640@hall.aurel32.net> References: <1279900598-8432-1-git-send-email-Jes.Sorensen@redhat.com> <20100730210847.GD20459@volta.aurel32.net> <4C53E9FD.4070109@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <4C53E9FD.4070109@redhat.com> Sender: Aurelien Jarno List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jes Sorensen Cc: Alex.Williamson@redhat.com, qemu-devel@nongnu.org On Sat, Jul 31, 2010 at 11:16:45AM +0200, Jes Sorensen wrote: > On 07/30/10 23:08, Aurelien Jarno wrote: > > On Fri, Jul 23, 2010 at 05:56:38PM +0200, Jes.Sorensen@redhat.com wrote: > >> From: Jes Sorensen > >> > >> pc-0.11 and older uses fw_cfg to provide option ROMs. As fw_cfg is setup > >> at init time, it is not possible to load an option ROM for a hotplug > >> device when running in compat mode. > >> > >> v2: Alex Williamson pointed out that one can get to qdev directly from > >> pci_dev, so no need to pass it down. > >> > >> Signed-off-by: Jes Sorensen > >> --- > >> hw/pci.c | 8 ++++++-- > >> 1 files changed, 6 insertions(+), 2 deletions(-) > >> > >> diff --git a/hw/pci.c b/hw/pci.c > >> index a98d6f3..2d38643 100644 > >> --- a/hw/pci.c > >> +++ b/hw/pci.c > >> @@ -1810,11 +1810,15 @@ static int pci_add_option_rom(PCIDevice *pdev) > >> return 0; > >> > >> if (!pdev->rom_bar) { > >> + int class; > >> /* > >> * Load rom via fw_cfg instead of creating a rom bar, > >> - * for 0.11 compatibility. > >> + * for 0.11 compatibility. fw_cfg is initialized at boot, so > >> + * we cannot do hotplug load of option roms. > >> */ > >> - int class = pci_get_word(pdev->config + PCI_CLASS_DEVICE); > >> + if (pdev->qdev.hotplugged) > >> + return 0; > > > > Missing braces around the return 0 line. > > Half the QEMU code base doesn't have braces around single line if > statements, including in hw/pci.c. Adding braces here would be inconsistent. > If we follow the coding style in new patches, it will eventually become consistent. -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurelien@aurel32.net http://www.aurel32.net