From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40154) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlI1f-00027n-Du for qemu-devel@nongnu.org; Mon, 03 Nov 2014 08:50:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XlI1Y-0007LC-Pe for qemu-devel@nongnu.org; Mon, 03 Nov 2014 08:50:31 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59229) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlI1Y-0007Kv-I9 for qemu-devel@nongnu.org; Mon, 03 Nov 2014 08:50:24 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sA3DoNIJ020128 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 3 Nov 2014 08:50:23 -0500 Message-ID: <1415022568.2327.34.camel@localhost.localdomain> From: Marcel Apfelbaum Date: Mon, 03 Nov 2014 15:49:28 +0200 In-Reply-To: <877fzcwgfm.fsf@blackfin.pond.sub.org> References: <1414431282-9839-1-git-send-email-marcel.a@redhat.com> <1414431282-9839-3-git-send-email-marcel.a@redhat.com> <87vbmwze25.fsf@blackfin.pond.sub.org> <1415019139.2327.30.camel@localhost.localdomain> <877fzcwgfm.fsf@blackfin.pond.sub.org> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v4 2/2] hw/pci: fixed hotplug crash when using rombar=0 with devices having romfile List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: marcel@redhat.com, pbonzini@redhat.com, alex.williamson@redhat.com, qemu-devel@nongnu.org, mst@redhat.com On Mon, 2014-11-03 at 14:40 +0100, Markus Armbruster wrote: > Marcel Apfelbaum writes: > > > On Mon, 2014-11-03 at 13:03 +0100, Markus Armbruster wrote: > >> Marcel Apfelbaum writes: > >> > >> > Hot-plugging a device that has a romfile (either supplied by user > >> > or built-in) using rombar=0 option is a user error, > >> > do not allow the device to be hot-plugged. > >> > > >> > Reviewed-by: Eric Blake > >> > Signed-off-by: Marcel Apfelbaum > >> > --- > >> > hw/pci/pci.c | 9 +++++++++ > >> > 1 file changed, 9 insertions(+) > >> > > >> > diff --git a/hw/pci/pci.c b/hw/pci/pci.c > >> > index 36226eb..371699c 100644 > >> > --- a/hw/pci/pci.c > >> > +++ b/hw/pci/pci.c > >> > @@ -1942,6 +1942,15 @@ static int pci_add_option_rom(PCIDevice *pdev, bool is_default_rom) > >> > * for 0.11 compatibility. > >> > */ > >> > int class = pci_get_word(pdev->config + PCI_CLASS_DEVICE); > >> > + > >> > + /* > >> > + * Hot-plugged devices can't use the option ROM > >> > + * if the rom bar is disabled. > >> > + */ > >> > + if (DEVICE(pdev)->hotplugged) { > >> > + return -1; > >> > + } > >> > + > >> > if (class == 0x0300) { > >> > rom_add_vga(pdev->romfile); > >> > } else { > >> > >> Unlike the function's other unsuccessful returns, this one is silent. > >> Intentional? > > Yes, the first version included an error message, but was not accepted > > as the reviewers preferred "silent drop" instead. > > The main reason was that a proper error propagation mechanism > > should be used. > > At the time of the patch there was not such an option, but now there is. > > I can add it on top of your series, preferably after is merged. > > My rebased "pci: Convert core to realize" has this hunk: > > @@ -1948,7 +1955,9 @@ static int pci_add_option_rom(PCIDevice *pdev, bool is_default_rom) > * if the rom bar is disabled. > */ > if (DEVICE(pdev)->hotplugged) { > - return -1; > + error_setg(errp, "Hot-plugged device without ROM bar" > + " can't have an option ROM"); > + return; > } > > if (class == 0x0300) { > > Bad, because the patch does two separate things: fix a failure not to be > silent, and convert to realize. Needs to be split. Begs the question > how to order the parts. I'd prefer to put the fix first, and get it > into 2.2. What do you think? If I understand your question correctly: I would first convert to realize, then add the fix. The reason for it is pretty simple: Conversion to realize gives us the error flow propagation we need. Thanks, Marcel