event_notifier: Set ->initialized earlier in event_notifier_init()

Otherwise the call to event_notifier_set() is a nop, which causes
the SLOF firmware on POWER to hang when booting from a virtio-scsi
device:

virtio_scsi_dataplane_start()
 virtio_scsi_vring_init()
  virtio_bus_set_host_notifier() <- assign == true
   event_notifier_init() <- active == 1
    event_notifier_set() <- fails right away if !e->initialized

Fixes: e34e47eb28 ("event_notifier: handle initialization failure better")
Cc: mlevitsk@redhat.com
Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <20210216120247.1293569-1-groug@kaod.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Greg Kurz 2021-02-16 13:02:47 +01:00 committed by Paolo Bonzini
parent 106f91d59c
commit 82e2756897

View File

@ -66,10 +66,10 @@ int event_notifier_init(EventNotifier *e, int active)
e->rfd = fds[0]; e->rfd = fds[0];
e->wfd = fds[1]; e->wfd = fds[1];
} }
e->initialized = true;
if (active) { if (active) {
event_notifier_set(e); event_notifier_set(e);
} }
e->initialized = true;
return 0; return 0;
fail: fail: