From 9ba75c55a718d07d068d0fc04b9aa492338dbccf Mon Sep 17 00:00:00 2001 From: Aviad Nissel Date: Mon, 29 Oct 2018 00:49:08 +0200 Subject: [PATCH] dm: mei: fix firmware reset race. The FW reset is currently detected from two points upon a read failure from native read and from the reset handler. The fix removes the detection from the mevent rx callback, leaving a single detection point. To prevent reset hiccup, hw_ready is not set if a full rescan is performed, it will be set only when virtio FW will request the FW reset. Tracked-On: #1632 Signed-off-by: Aviad Nissel Signed-off-by: Tomas Winkler --- devicemodel/hw/pci/virtio/virtio_mei.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/devicemodel/hw/pci/virtio/virtio_mei.c b/devicemodel/hw/pci/virtio/virtio_mei.c index 3e7e6a2b4..21b4aa1f7 100644 --- a/devicemodel/hw/pci/virtio/virtio_mei.c +++ b/devicemodel/hw/pci/virtio/virtio_mei.c @@ -1708,12 +1708,6 @@ vmei_rx_callback(int fd, enum ev_type type, void *param) out: pthread_mutex_unlock(&vmei->rx_mutex); vmei_host_client_put(hclient); - if (vmei->status == VMEI_STS_PENDING_RESET) { - vmei_virtual_fw_reset(vmei); - /* Let's wait 100ms for HBM enumeration done */ - usleep(100000); - virtio_config_changed(&vmei->base); - } } /* @@ -1939,7 +1933,9 @@ vmei_start(struct virtio_mei *vmei, bool do_rescan) vmei_fixed_clients_connect(vmei); - vmei->config->hw_ready = 1; + if (!do_rescan) + vmei->config->hw_ready = 1; + vmei_set_status(vmei, VMEI_STS_READY); return 0; @@ -2001,6 +1997,7 @@ vmei_reset_callback(int fd, enum ev_type type, void *param) DPRINTF("Reset state callback\n"); vmei_virtual_fw_reset(vmei); + virtio_config_changed(&vmei->base); vmei_free_me_clients(vmei); vmei_start(vmei, true); }