Message ID | 1522071403-52486-7-git-send-email-pbonzini@redhat.com |
---|---|
State | New |
Headers | show |
Series | [PULL,01/16] scripts/get_maintainer.pl: Print proper error message for missing $file | expand |
On 26.03.2018 15:36, Paolo Bonzini wrote: > From: Alexey Kardashevskiy <aik@ozlabs.ru> > > A "powernv" machine type defines an ISA bus but it does not add any DMA > controller to it so it is possible to hit assert(fdctrl->dma) by > adding "-machine powernv -device isa-fdc". > > This replaces assert() with an error message. > > Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> > [thuth: Slightly adjusted error message and updated scripts/device-crash-test] That's strange, the hunk with the update to device-crash-test seems to be missing ... ? device-crash-test now reports some "Didn't fail as expected" warnings :-( > Signed-off-by: Thomas Huth <thuth@redhat.com> > Message-Id: <1521193892-15552-3-git-send-email-thuth@redhat.com> > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> > --- > hw/block/fdc.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/hw/block/fdc.c b/hw/block/fdc.c > index 7b7dd41..cd29e27 100644 > --- a/hw/block/fdc.c > +++ b/hw/block/fdc.c > @@ -2695,7 +2695,10 @@ static void isabus_fdc_realize(DeviceState *dev, Error **errp) > fdctrl->dma_chann = isa->dma; > if (fdctrl->dma_chann != -1) { > fdctrl->dma = isa_get_dma(isa_bus_from_device(isadev), isa->dma); > - assert(fdctrl->dma); > + if (!fdctrl->dma) { > + error_setg(errp, "ISA controller does not support DMA"); > + return; > + } > } > > qdev_set_legacy_instance_id(dev, isa->iobase, 2); > FWIW, this is the hunk that was part of the version that I sent to the list: diff --git a/scripts/device-crash-test b/scripts/device-crash-test index 7ff351d..99d20cb 100755 --- a/scripts/device-crash-test +++ b/scripts/device-crash-test @@ -217,7 +217,6 @@ ERROR_WHITELIST = [ {'exitcode':-6, 'log':r"Object .* is not an instance of type generic-pc-machine", 'loglevel':logging.ERROR}, {'exitcode':-6, 'log':r"Object .* is not an instance of type e500-ccsr", 'loglevel':logging.ERROR}, {'exitcode':-6, 'log':r"vmstate_register_with_alias_id: Assertion `!se->compat \|\| se->instance_id == 0' failed", 'loglevel':logging.ERROR}, - {'exitcode':-6, 'device':'isa-fdc', 'loglevel':logging.ERROR, 'expected':True}, {'exitcode':-11, 'device':'gus', 'loglevel':logging.ERROR, 'expected':True}, {'exitcode':-11, 'device':'isa-serial', 'loglevel':logging.ERROR, 'expected':True}, {'exitcode':-11, 'device':'sb16', 'loglevel':logging.ERROR, 'expected':True}, Thomas
On 26/03/2018 19:06, Thomas Huth wrote: > On 26.03.2018 15:36, Paolo Bonzini wrote: >> From: Alexey Kardashevskiy <aik@ozlabs.ru> >> >> A "powernv" machine type defines an ISA bus but it does not add any DMA >> controller to it so it is possible to hit assert(fdctrl->dma) by >> adding "-machine powernv -device isa-fdc". >> >> This replaces assert() with an error message. >> >> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> >> [thuth: Slightly adjusted error message and updated scripts/device-crash-test] > > That's strange, the hunk with the update to device-crash-test seems to be missing ... ? > > device-crash-test now reports some "Didn't fail as expected" warnings :-( Probably I applied this patch to an older tree where the warnings had not been added. I'll send a v2 pull request. Paolo >> Signed-off-by: Thomas Huth <thuth@redhat.com> >> Message-Id: <1521193892-15552-3-git-send-email-thuth@redhat.com> >> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> >> --- >> hw/block/fdc.c | 5 ++++- >> 1 file changed, 4 insertions(+), 1 deletion(-) >> >> diff --git a/hw/block/fdc.c b/hw/block/fdc.c >> index 7b7dd41..cd29e27 100644 >> --- a/hw/block/fdc.c >> +++ b/hw/block/fdc.c >> @@ -2695,7 +2695,10 @@ static void isabus_fdc_realize(DeviceState *dev, Error **errp) >> fdctrl->dma_chann = isa->dma; >> if (fdctrl->dma_chann != -1) { >> fdctrl->dma = isa_get_dma(isa_bus_from_device(isadev), isa->dma); >> - assert(fdctrl->dma); >> + if (!fdctrl->dma) { >> + error_setg(errp, "ISA controller does not support DMA"); >> + return; >> + } >> } >> >> qdev_set_legacy_instance_id(dev, isa->iobase, 2); >> > > FWIW, this is the hunk that was part of the version that I sent to the list: > > diff --git a/scripts/device-crash-test b/scripts/device-crash-test > index 7ff351d..99d20cb 100755 > --- a/scripts/device-crash-test > +++ b/scripts/device-crash-test > @@ -217,7 +217,6 @@ ERROR_WHITELIST = [ > {'exitcode':-6, 'log':r"Object .* is not an instance of type generic-pc-machine", 'loglevel':logging.ERROR}, > {'exitcode':-6, 'log':r"Object .* is not an instance of type e500-ccsr", 'loglevel':logging.ERROR}, > {'exitcode':-6, 'log':r"vmstate_register_with_alias_id: Assertion `!se->compat \|\| se->instance_id == 0' failed", 'loglevel':logging.ERROR}, > - {'exitcode':-6, 'device':'isa-fdc', 'loglevel':logging.ERROR, 'expected':True}, > {'exitcode':-11, 'device':'gus', 'loglevel':logging.ERROR, 'expected':True}, > {'exitcode':-11, 'device':'isa-serial', 'loglevel':logging.ERROR, 'expected':True}, > {'exitcode':-11, 'device':'sb16', 'loglevel':logging.ERROR, 'expected':True}, > > Thomas >
diff --git a/hw/block/fdc.c b/hw/block/fdc.c index 7b7dd41..cd29e27 100644 --- a/hw/block/fdc.c +++ b/hw/block/fdc.c @@ -2695,7 +2695,10 @@ static void isabus_fdc_realize(DeviceState *dev, Error **errp) fdctrl->dma_chann = isa->dma; if (fdctrl->dma_chann != -1) { fdctrl->dma = isa_get_dma(isa_bus_from_device(isadev), isa->dma); - assert(fdctrl->dma); + if (!fdctrl->dma) { + error_setg(errp, "ISA controller does not support DMA"); + return; + } } qdev_set_legacy_instance_id(dev, isa->iobase, 2);