mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-04 21:29:43 +00:00
dm: mei: fix double fw_reset on uos reboot
Edge triggered mevent on sysfs file is triggered immediately after mevent_add(), hence this has to be ignored. The issue that is resolved that the 'first' flag was global and wasn't reset on each mevent_add(). Tracked-On: #1846 Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Acked-by: Acked-by: Yu Wang <yu1.wang@intel.com>
This commit is contained in:
parent
844553ef23
commit
87fbb7003d
@ -318,6 +318,7 @@ struct virtio_mei {
|
||||
pthread_mutex_t mutex;
|
||||
|
||||
struct mevent *reset_mevp;
|
||||
bool dev_state_first;
|
||||
|
||||
struct mei_virtio_cfg *config;
|
||||
|
||||
@ -1979,7 +1980,6 @@ vmei_stop(struct virtio_mei *vmei)
|
||||
static void
|
||||
vmei_reset_callback(int fd, enum ev_type type, void *param)
|
||||
{
|
||||
static bool first_time = true;
|
||||
struct virtio_mei *vmei = param;
|
||||
char buf[MEI_DEV_STATE_LEN] = {0};
|
||||
int sz;
|
||||
@ -1989,8 +1989,12 @@ vmei_reset_callback(int fd, enum ev_type type, void *param)
|
||||
|
||||
lseek(fd, 0, SEEK_SET);
|
||||
sz = read(fd, buf, 12);
|
||||
if (first_time) {
|
||||
first_time = false;
|
||||
/*
|
||||
* edge mevent is hit immediately after add
|
||||
* as the file is not empty, this has to be ignored
|
||||
*/
|
||||
if (vmei->dev_state_first) {
|
||||
vmei->dev_state_first = false;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2017,6 +2021,7 @@ static int vmei_add_reset_event(struct virtio_mei *vmei)
|
||||
if (dev_state_fd < 0)
|
||||
return -errno;
|
||||
|
||||
vmei->dev_state_first = true;
|
||||
vmei->reset_mevp = mevent_add(dev_state_fd, EVF_READ_ET,
|
||||
vmei_reset_callback, vmei);
|
||||
if (!vmei->reset_mevp) {
|
||||
|
Loading…
Reference in New Issue
Block a user