mirror of https://gitee.com/openkylin/linux.git
mei: limit the number of consecutive resets
give up reseting after 3 unsuccessful tries Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
33ec082631
commit
6adb8efb02
|
@ -370,6 +370,7 @@ void mei_host_client_init(struct work_struct *work)
|
||||||
}
|
}
|
||||||
|
|
||||||
dev->dev_state = MEI_DEV_ENABLED;
|
dev->dev_state = MEI_DEV_ENABLED;
|
||||||
|
dev->reset_count = 0;
|
||||||
|
|
||||||
mutex_unlock(&dev->device_lock);
|
mutex_unlock(&dev->device_lock);
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,6 +89,13 @@ int mei_reset(struct mei_device *dev)
|
||||||
interrupts_enabled = state != MEI_DEV_POWER_DOWN;
|
interrupts_enabled = state != MEI_DEV_POWER_DOWN;
|
||||||
dev->dev_state = MEI_DEV_RESETTING;
|
dev->dev_state = MEI_DEV_RESETTING;
|
||||||
|
|
||||||
|
dev->reset_count++;
|
||||||
|
if (dev->reset_count > MEI_MAX_CONSEC_RESET) {
|
||||||
|
dev_err(&dev->pdev->dev, "reset: reached maximal consecutive resets: disabling the device\n");
|
||||||
|
dev->dev_state = MEI_DEV_DISABLED;
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
ret = mei_hw_reset(dev, interrupts_enabled);
|
ret = mei_hw_reset(dev, interrupts_enabled);
|
||||||
/* fall through and remove the sw state even if hw reset has failed */
|
/* fall through and remove the sw state even if hw reset has failed */
|
||||||
|
|
||||||
|
@ -169,6 +176,7 @@ int mei_start(struct mei_device *dev)
|
||||||
dev_dbg(&dev->pdev->dev, "reset in start the mei device.\n");
|
dev_dbg(&dev->pdev->dev, "reset in start the mei device.\n");
|
||||||
|
|
||||||
dev->dev_state = MEI_DEV_INITIALIZING;
|
dev->dev_state = MEI_DEV_INITIALIZING;
|
||||||
|
dev->reset_count = 0;
|
||||||
mei_reset(dev);
|
mei_reset(dev);
|
||||||
|
|
||||||
if (dev->dev_state == MEI_DEV_DISABLED) {
|
if (dev->dev_state == MEI_DEV_DISABLED) {
|
||||||
|
@ -224,6 +232,7 @@ int mei_restart(struct mei_device *dev)
|
||||||
mei_clear_interrupts(dev);
|
mei_clear_interrupts(dev);
|
||||||
|
|
||||||
dev->dev_state = MEI_DEV_POWER_UP;
|
dev->dev_state = MEI_DEV_POWER_UP;
|
||||||
|
dev->reset_count = 0;
|
||||||
|
|
||||||
err = mei_reset(dev);
|
err = mei_reset(dev);
|
||||||
|
|
||||||
|
@ -285,6 +294,7 @@ void mei_device_init(struct mei_device *dev)
|
||||||
init_waitqueue_head(&dev->wait_recvd_msg);
|
init_waitqueue_head(&dev->wait_recvd_msg);
|
||||||
init_waitqueue_head(&dev->wait_stop_wd);
|
init_waitqueue_head(&dev->wait_stop_wd);
|
||||||
dev->dev_state = MEI_DEV_INITIALIZING;
|
dev->dev_state = MEI_DEV_INITIALIZING;
|
||||||
|
dev->reset_count = 0;
|
||||||
|
|
||||||
mei_io_list_init(&dev->read_list);
|
mei_io_list_init(&dev->read_list);
|
||||||
mei_io_list_init(&dev->write_list);
|
mei_io_list_init(&dev->write_list);
|
||||||
|
|
|
@ -60,6 +60,11 @@ extern const uuid_le mei_wd_guid;
|
||||||
*/
|
*/
|
||||||
#define MEI_CLIENTS_MAX 256
|
#define MEI_CLIENTS_MAX 256
|
||||||
|
|
||||||
|
/*
|
||||||
|
* maximum number of consecutive resets
|
||||||
|
*/
|
||||||
|
#define MEI_MAX_CONSEC_RESET 3
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Number of File descriptors/handles
|
* Number of File descriptors/handles
|
||||||
* that can be opened to the driver.
|
* that can be opened to the driver.
|
||||||
|
@ -327,6 +332,7 @@ struct mei_cl_device {
|
||||||
/**
|
/**
|
||||||
* struct mei_device - MEI private device struct
|
* struct mei_device - MEI private device struct
|
||||||
|
|
||||||
|
* @reset_count - limits the number of consecutive resets
|
||||||
* @hbm_state - state of host bus message protocol
|
* @hbm_state - state of host bus message protocol
|
||||||
* @mem_addr - mem mapped base register address
|
* @mem_addr - mem mapped base register address
|
||||||
|
|
||||||
|
@ -370,6 +376,7 @@ struct mei_device {
|
||||||
/*
|
/*
|
||||||
* mei device states
|
* mei device states
|
||||||
*/
|
*/
|
||||||
|
unsigned long reset_count;
|
||||||
enum mei_dev_state dev_state;
|
enum mei_dev_state dev_state;
|
||||||
enum mei_hbm_state hbm_state;
|
enum mei_hbm_state hbm_state;
|
||||||
u16 init_clients_timer;
|
u16 init_clients_timer;
|
||||||
|
|
Loading…
Reference in New Issue