[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] hw/pci: fixed crash when using rombar=0 for hot
From: |
Michael S. Tsirkin |
Subject: |
Re: [Qemu-devel] [PATCH] hw/pci: fixed crash when using rombar=0 for hotplugged devices |
Date: |
Wed, 22 Oct 2014 11:02:01 +0300 |
On Wed, Oct 22, 2014 at 10:41:05AM +0300, Marcel Apfelbaum wrote:
> On Wed, 2014-10-22 at 00:06 +0200, Paolo Bonzini wrote:
> >
> > On 10/21/2014 02:37 PM, Marcel Apfelbaum wrote:
> > > ROM images must be loaded at startup. Usage of rombar=0 after that
> > > is not allowed, but should not crash QEMU.
> > >
> > > Check that the device is not hotplugged before trying to
> > > insert the rom file.
> >
> > I think it could also make sense to just ignore the option ROM and allow
> > the hotplug.
> We need a way to inform the user we did that, he *specifically* asked
> for a ROM he might need it.
>
> Thanks,
> Marcel
But he also asked to disable BAR.
I don't see valid reasons for this configuration
expcept compatibility.
But I have a vague memory Alex thought differently.
Alex?
> >
> > Sooner or later we should drop the oldest compat machine types...
> > everything until 0.12 probably could go.
> >
> > Paolo
> >
> > > Signed-off-by: Marcel Apfelbaum <address@hidden>
> > > ---
> > > hw/pci/pci.c | 11 ++++++++++-
> > > 1 file changed, 10 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/hw/pci/pci.c b/hw/pci/pci.c
> > > index 6ce75aa..3907c90 100644
> > > --- a/hw/pci/pci.c
> > > +++ b/hw/pci/pci.c
> > > @@ -1776,7 +1776,12 @@ static int pci_qdev_init(DeviceState *qdev)
> > > pci_dev->romfile = g_strdup(pc->romfile);
> > > is_default_rom = true;
> > > }
> > > - pci_add_option_rom(pci_dev, is_default_rom);
> > > +
> > > + rc = pci_add_option_rom(pci_dev, is_default_rom);
> > > + if (rc != 0) {
> > > + pci_unregister_device(DEVICE(pci_dev));
> > > + return rc;
> > > + }
> > >
> > > return 0;
> > > }
> > > @@ -1940,6 +1945,10 @@ static int pci_add_option_rom(PCIDevice *pdev,
> > > bool is_default_rom)
> > > if (class == 0x0300) {
> > > rom_add_vga(pdev->romfile);
> > > } else {
> > > + if (DEVICE(pdev)->hotplugged) {
> > > + error_report("PCI: rombar can't be 0 for hotplugged
> > > devices!");
> > > + return -1;
> > > + }
> > > rom_add_option(pdev->romfile, -1);
> > > }
> > > return 0;
> > >
>
>
Re: [Qemu-devel] [PATCH] hw/pci: fixed crash when using rombar=0 for hotplugged devices, Michael S. Tsirkin, 2014/10/22
- Re: [Qemu-devel] [PATCH] hw/pci: fixed crash when using rombar=0 for hotplugged devices, Marcel Apfelbaum, 2014/10/22
- Re: [Qemu-devel] [PATCH] hw/pci: fixed crash when using rombar=0 for hotplugged devices, Michael S. Tsirkin, 2014/10/22
- Re: [Qemu-devel] [PATCH] hw/pci: fixed crash when using rombar=0 for hotplugged devices, Marcel Apfelbaum, 2014/10/22
- Re: [Qemu-devel] [PATCH] hw/pci: fixed crash when using rombar=0 for hotplugged devices, Michael S. Tsirkin, 2014/10/22
- Re: [Qemu-devel] [PATCH] hw/pci: fixed crash when using rombar=0 for hotplugged devices, Marcel Apfelbaum, 2014/10/22
- Re: [Qemu-devel] [PATCH] hw/pci: fixed crash when using rombar=0 for hotplugged devices, Michael S. Tsirkin, 2014/10/22