mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-11-29 13:06:00 +08:00
Char / Misc driver fixes for 3.12-rc3
Here are some HyperV and MEI driver fixes for 3.12-rc3. They resolve some issues that people have been reporting for them. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.21 (GNU/Linux) iEYEABECAAYFAlJIgcwACgkQMUfUDdst+ynRGwCgoIIGIXG2RTVaTDm8wezRERGA ZDoAoKZe5Bec2CSqydcPNZWYg4ATTMjn =6r+r -----END PGP SIGNATURE----- Merge tag 'char-misc-3.12-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc Pull char/misc driver fixes from Greg KH: "Here are some HyperV and MEI driver fixes for 3.12-rc3. They resolve some issues that people have been reporting for them" * tag 'char-misc-3.12-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: Drivers: hv: vmbus: Terminate vmbus version negotiation on timeout Drivers: hv: util: Correctly support ws2008R2 and earlier mei: cancel stall timers in mei_reset mei: bus: stop wait for read during cl state transition mei: make me client counters less error prone
This commit is contained in:
commit
c23c2234de
@ -195,7 +195,7 @@ int vmbus_connect(void)
|
||||
|
||||
do {
|
||||
ret = vmbus_negotiate_version(msginfo, version);
|
||||
if (ret)
|
||||
if (ret == -ETIMEDOUT)
|
||||
goto cleanup;
|
||||
|
||||
if (vmbus_connection.conn_state == CONNECTED)
|
||||
|
@ -32,13 +32,17 @@
|
||||
/*
|
||||
* Pre win8 version numbers used in ws2008 and ws 2008 r2 (win7)
|
||||
*/
|
||||
#define WS2008_SRV_MAJOR 1
|
||||
#define WS2008_SRV_MINOR 0
|
||||
#define WS2008_SRV_VERSION (WS2008_SRV_MAJOR << 16 | WS2008_SRV_MINOR)
|
||||
|
||||
#define WIN7_SRV_MAJOR 3
|
||||
#define WIN7_SRV_MINOR 0
|
||||
#define WIN7_SRV_MAJOR_MINOR (WIN7_SRV_MAJOR << 16 | WIN7_SRV_MINOR)
|
||||
#define WIN7_SRV_VERSION (WIN7_SRV_MAJOR << 16 | WIN7_SRV_MINOR)
|
||||
|
||||
#define WIN8_SRV_MAJOR 4
|
||||
#define WIN8_SRV_MINOR 0
|
||||
#define WIN8_SRV_MAJOR_MINOR (WIN8_SRV_MAJOR << 16 | WIN8_SRV_MINOR)
|
||||
#define WIN8_SRV_VERSION (WIN8_SRV_MAJOR << 16 | WIN8_SRV_MINOR)
|
||||
|
||||
/*
|
||||
* Global state maintained for transaction that is being processed.
|
||||
@ -587,6 +591,8 @@ void hv_kvp_onchannelcallback(void *context)
|
||||
|
||||
struct icmsg_hdr *icmsghdrp;
|
||||
struct icmsg_negotiate *negop = NULL;
|
||||
int util_fw_version;
|
||||
int kvp_srv_version;
|
||||
|
||||
if (kvp_transaction.active) {
|
||||
/*
|
||||
@ -606,17 +612,26 @@ void hv_kvp_onchannelcallback(void *context)
|
||||
|
||||
if (icmsghdrp->icmsgtype == ICMSGTYPE_NEGOTIATE) {
|
||||
/*
|
||||
* We start with win8 version and if the host cannot
|
||||
* support that we use the previous version.
|
||||
* Based on the host, select appropriate
|
||||
* framework and service versions we will
|
||||
* negotiate.
|
||||
*/
|
||||
if (vmbus_prep_negotiate_resp(icmsghdrp, negop,
|
||||
recv_buffer, UTIL_FW_MAJOR_MINOR,
|
||||
WIN8_SRV_MAJOR_MINOR))
|
||||
goto done;
|
||||
|
||||
switch (vmbus_proto_version) {
|
||||
case (VERSION_WS2008):
|
||||
util_fw_version = UTIL_WS2K8_FW_VERSION;
|
||||
kvp_srv_version = WS2008_SRV_VERSION;
|
||||
break;
|
||||
case (VERSION_WIN7):
|
||||
util_fw_version = UTIL_FW_VERSION;
|
||||
kvp_srv_version = WIN7_SRV_VERSION;
|
||||
break;
|
||||
default:
|
||||
util_fw_version = UTIL_FW_VERSION;
|
||||
kvp_srv_version = WIN8_SRV_VERSION;
|
||||
}
|
||||
vmbus_prep_negotiate_resp(icmsghdrp, negop,
|
||||
recv_buffer, UTIL_FW_MAJOR_MINOR,
|
||||
WIN7_SRV_MAJOR_MINOR);
|
||||
recv_buffer, util_fw_version,
|
||||
kvp_srv_version);
|
||||
|
||||
} else {
|
||||
kvp_msg = (struct hv_kvp_msg *)&recv_buffer[
|
||||
@ -649,7 +664,6 @@ void hv_kvp_onchannelcallback(void *context)
|
||||
return;
|
||||
|
||||
}
|
||||
done:
|
||||
|
||||
icmsghdrp->icflags = ICMSGHDRFLAG_TRANSACTION
|
||||
| ICMSGHDRFLAG_RESPONSE;
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
#define VSS_MAJOR 5
|
||||
#define VSS_MINOR 0
|
||||
#define VSS_MAJOR_MINOR (VSS_MAJOR << 16 | VSS_MINOR)
|
||||
#define VSS_VERSION (VSS_MAJOR << 16 | VSS_MINOR)
|
||||
|
||||
|
||||
|
||||
@ -190,8 +190,8 @@ void hv_vss_onchannelcallback(void *context)
|
||||
|
||||
if (icmsghdrp->icmsgtype == ICMSGTYPE_NEGOTIATE) {
|
||||
vmbus_prep_negotiate_resp(icmsghdrp, negop,
|
||||
recv_buffer, UTIL_FW_MAJOR_MINOR,
|
||||
VSS_MAJOR_MINOR);
|
||||
recv_buffer, UTIL_FW_VERSION,
|
||||
VSS_VERSION);
|
||||
} else {
|
||||
vss_msg = (struct hv_vss_msg *)&recv_buffer[
|
||||
sizeof(struct vmbuspipe_hdr) +
|
||||
|
@ -28,17 +28,32 @@
|
||||
#include <linux/reboot.h>
|
||||
#include <linux/hyperv.h>
|
||||
|
||||
#define SHUTDOWN_MAJOR 3
|
||||
#define SHUTDOWN_MINOR 0
|
||||
#define SHUTDOWN_MAJOR_MINOR (SHUTDOWN_MAJOR << 16 | SHUTDOWN_MINOR)
|
||||
|
||||
#define TIMESYNCH_MAJOR 3
|
||||
#define TIMESYNCH_MINOR 0
|
||||
#define TIMESYNCH_MAJOR_MINOR (TIMESYNCH_MAJOR << 16 | TIMESYNCH_MINOR)
|
||||
#define SD_MAJOR 3
|
||||
#define SD_MINOR 0
|
||||
#define SD_VERSION (SD_MAJOR << 16 | SD_MINOR)
|
||||
|
||||
#define HEARTBEAT_MAJOR 3
|
||||
#define HEARTBEAT_MINOR 0
|
||||
#define HEARTBEAT_MAJOR_MINOR (HEARTBEAT_MAJOR << 16 | HEARTBEAT_MINOR)
|
||||
#define SD_WS2008_MAJOR 1
|
||||
#define SD_WS2008_VERSION (SD_WS2008_MAJOR << 16 | SD_MINOR)
|
||||
|
||||
#define TS_MAJOR 3
|
||||
#define TS_MINOR 0
|
||||
#define TS_VERSION (TS_MAJOR << 16 | TS_MINOR)
|
||||
|
||||
#define TS_WS2008_MAJOR 1
|
||||
#define TS_WS2008_VERSION (TS_WS2008_MAJOR << 16 | TS_MINOR)
|
||||
|
||||
#define HB_MAJOR 3
|
||||
#define HB_MINOR 0
|
||||
#define HB_VERSION (HB_MAJOR << 16 | HB_MINOR)
|
||||
|
||||
#define HB_WS2008_MAJOR 1
|
||||
#define HB_WS2008_VERSION (HB_WS2008_MAJOR << 16 | HB_MINOR)
|
||||
|
||||
static int sd_srv_version;
|
||||
static int ts_srv_version;
|
||||
static int hb_srv_version;
|
||||
static int util_fw_version;
|
||||
|
||||
static void shutdown_onchannelcallback(void *context);
|
||||
static struct hv_util_service util_shutdown = {
|
||||
@ -99,8 +114,8 @@ static void shutdown_onchannelcallback(void *context)
|
||||
|
||||
if (icmsghdrp->icmsgtype == ICMSGTYPE_NEGOTIATE) {
|
||||
vmbus_prep_negotiate_resp(icmsghdrp, negop,
|
||||
shut_txf_buf, UTIL_FW_MAJOR_MINOR,
|
||||
SHUTDOWN_MAJOR_MINOR);
|
||||
shut_txf_buf, util_fw_version,
|
||||
sd_srv_version);
|
||||
} else {
|
||||
shutdown_msg =
|
||||
(struct shutdown_msg_data *)&shut_txf_buf[
|
||||
@ -216,6 +231,7 @@ static void timesync_onchannelcallback(void *context)
|
||||
struct icmsg_hdr *icmsghdrp;
|
||||
struct ictimesync_data *timedatap;
|
||||
u8 *time_txf_buf = util_timesynch.recv_buffer;
|
||||
struct icmsg_negotiate *negop = NULL;
|
||||
|
||||
vmbus_recvpacket(channel, time_txf_buf,
|
||||
PAGE_SIZE, &recvlen, &requestid);
|
||||
@ -225,9 +241,10 @@ static void timesync_onchannelcallback(void *context)
|
||||
sizeof(struct vmbuspipe_hdr)];
|
||||
|
||||
if (icmsghdrp->icmsgtype == ICMSGTYPE_NEGOTIATE) {
|
||||
vmbus_prep_negotiate_resp(icmsghdrp, NULL, time_txf_buf,
|
||||
UTIL_FW_MAJOR_MINOR,
|
||||
TIMESYNCH_MAJOR_MINOR);
|
||||
vmbus_prep_negotiate_resp(icmsghdrp, negop,
|
||||
time_txf_buf,
|
||||
util_fw_version,
|
||||
ts_srv_version);
|
||||
} else {
|
||||
timedatap = (struct ictimesync_data *)&time_txf_buf[
|
||||
sizeof(struct vmbuspipe_hdr) +
|
||||
@ -257,6 +274,7 @@ static void heartbeat_onchannelcallback(void *context)
|
||||
struct icmsg_hdr *icmsghdrp;
|
||||
struct heartbeat_msg_data *heartbeat_msg;
|
||||
u8 *hbeat_txf_buf = util_heartbeat.recv_buffer;
|
||||
struct icmsg_negotiate *negop = NULL;
|
||||
|
||||
vmbus_recvpacket(channel, hbeat_txf_buf,
|
||||
PAGE_SIZE, &recvlen, &requestid);
|
||||
@ -266,9 +284,9 @@ static void heartbeat_onchannelcallback(void *context)
|
||||
sizeof(struct vmbuspipe_hdr)];
|
||||
|
||||
if (icmsghdrp->icmsgtype == ICMSGTYPE_NEGOTIATE) {
|
||||
vmbus_prep_negotiate_resp(icmsghdrp, NULL,
|
||||
hbeat_txf_buf, UTIL_FW_MAJOR_MINOR,
|
||||
HEARTBEAT_MAJOR_MINOR);
|
||||
vmbus_prep_negotiate_resp(icmsghdrp, negop,
|
||||
hbeat_txf_buf, util_fw_version,
|
||||
hb_srv_version);
|
||||
} else {
|
||||
heartbeat_msg =
|
||||
(struct heartbeat_msg_data *)&hbeat_txf_buf[
|
||||
@ -321,6 +339,25 @@ static int util_probe(struct hv_device *dev,
|
||||
goto error;
|
||||
|
||||
hv_set_drvdata(dev, srv);
|
||||
/*
|
||||
* Based on the host; initialize the framework and
|
||||
* service version numbers we will negotiate.
|
||||
*/
|
||||
switch (vmbus_proto_version) {
|
||||
case (VERSION_WS2008):
|
||||
util_fw_version = UTIL_WS2K8_FW_VERSION;
|
||||
sd_srv_version = SD_WS2008_VERSION;
|
||||
ts_srv_version = TS_WS2008_VERSION;
|
||||
hb_srv_version = HB_WS2008_VERSION;
|
||||
break;
|
||||
|
||||
default:
|
||||
util_fw_version = UTIL_FW_VERSION;
|
||||
sd_srv_version = SD_VERSION;
|
||||
ts_srv_version = TS_VERSION;
|
||||
hb_srv_version = HB_VERSION;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
|
@ -57,6 +57,7 @@ void mei_amthif_reset_params(struct mei_device *dev)
|
||||
dev->iamthif_ioctl = false;
|
||||
dev->iamthif_state = MEI_IAMTHIF_IDLE;
|
||||
dev->iamthif_timer = 0;
|
||||
dev->iamthif_stall_timer = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -297,10 +297,13 @@ int __mei_cl_recv(struct mei_cl *cl, u8 *buf, size_t length)
|
||||
|
||||
if (cl->reading_state != MEI_READ_COMPLETE &&
|
||||
!waitqueue_active(&cl->rx_wait)) {
|
||||
|
||||
mutex_unlock(&dev->device_lock);
|
||||
|
||||
if (wait_event_interruptible(cl->rx_wait,
|
||||
(MEI_READ_COMPLETE == cl->reading_state))) {
|
||||
cl->reading_state == MEI_READ_COMPLETE ||
|
||||
mei_cl_is_transitioning(cl))) {
|
||||
|
||||
if (signal_pending(current))
|
||||
return -EINTR;
|
||||
return -ERESTARTSYS;
|
||||
|
@ -90,6 +90,12 @@ static inline bool mei_cl_is_connected(struct mei_cl *cl)
|
||||
cl->dev->dev_state == MEI_DEV_ENABLED &&
|
||||
cl->state == MEI_FILE_CONNECTED);
|
||||
}
|
||||
static inline bool mei_cl_is_transitioning(struct mei_cl *cl)
|
||||
{
|
||||
return (MEI_FILE_INITIALIZING == cl->state ||
|
||||
MEI_FILE_DISCONNECTED == cl->state ||
|
||||
MEI_FILE_DISCONNECTING == cl->state);
|
||||
}
|
||||
|
||||
bool mei_cl_is_other_connecting(struct mei_cl *cl);
|
||||
int mei_cl_disconnect(struct mei_cl *cl);
|
||||
|
@ -35,11 +35,15 @@ static void mei_hbm_me_cl_allocate(struct mei_device *dev)
|
||||
struct mei_me_client *clients;
|
||||
int b;
|
||||
|
||||
dev->me_clients_num = 0;
|
||||
dev->me_client_presentation_num = 0;
|
||||
dev->me_client_index = 0;
|
||||
|
||||
/* count how many ME clients we have */
|
||||
for_each_set_bit(b, dev->me_clients_map, MEI_CLIENTS_MAX)
|
||||
dev->me_clients_num++;
|
||||
|
||||
if (dev->me_clients_num <= 0)
|
||||
if (dev->me_clients_num == 0)
|
||||
return;
|
||||
|
||||
kfree(dev->me_clients);
|
||||
@ -221,7 +225,7 @@ static int mei_hbm_prop_req(struct mei_device *dev)
|
||||
struct hbm_props_request *prop_req;
|
||||
const size_t len = sizeof(struct hbm_props_request);
|
||||
unsigned long next_client_index;
|
||||
u8 client_num;
|
||||
unsigned long client_num;
|
||||
|
||||
|
||||
client_num = dev->me_client_presentation_num;
|
||||
@ -677,8 +681,6 @@ void mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
|
||||
if (dev->dev_state == MEI_DEV_INIT_CLIENTS &&
|
||||
dev->hbm_state == MEI_HBM_ENUM_CLIENTS) {
|
||||
dev->init_clients_timer = 0;
|
||||
dev->me_client_presentation_num = 0;
|
||||
dev->me_client_index = 0;
|
||||
mei_hbm_me_cl_allocate(dev);
|
||||
dev->hbm_state = MEI_HBM_CLIENT_PROPERTIES;
|
||||
|
||||
|
@ -175,6 +175,9 @@ void mei_reset(struct mei_device *dev, int interrupts_enabled)
|
||||
memset(&dev->wr_ext_msg, 0, sizeof(dev->wr_ext_msg));
|
||||
}
|
||||
|
||||
/* we're already in reset, cancel the init timer */
|
||||
dev->init_clients_timer = 0;
|
||||
|
||||
dev->me_clients_num = 0;
|
||||
dev->rd_msg_hdr = 0;
|
||||
dev->wd_pending = false;
|
||||
|
@ -249,19 +249,16 @@ static ssize_t mei_read(struct file *file, char __user *ubuf,
|
||||
mutex_unlock(&dev->device_lock);
|
||||
|
||||
if (wait_event_interruptible(cl->rx_wait,
|
||||
(MEI_READ_COMPLETE == cl->reading_state ||
|
||||
MEI_FILE_INITIALIZING == cl->state ||
|
||||
MEI_FILE_DISCONNECTED == cl->state ||
|
||||
MEI_FILE_DISCONNECTING == cl->state))) {
|
||||
MEI_READ_COMPLETE == cl->reading_state ||
|
||||
mei_cl_is_transitioning(cl))) {
|
||||
|
||||
if (signal_pending(current))
|
||||
return -EINTR;
|
||||
return -ERESTARTSYS;
|
||||
}
|
||||
|
||||
mutex_lock(&dev->device_lock);
|
||||
if (MEI_FILE_INITIALIZING == cl->state ||
|
||||
MEI_FILE_DISCONNECTED == cl->state ||
|
||||
MEI_FILE_DISCONNECTING == cl->state) {
|
||||
if (mei_cl_is_transitioning(cl)) {
|
||||
rets = -EBUSY;
|
||||
goto out;
|
||||
}
|
||||
|
@ -396,9 +396,9 @@ struct mei_device {
|
||||
struct mei_me_client *me_clients; /* Note: memory has to be allocated */
|
||||
DECLARE_BITMAP(me_clients_map, MEI_CLIENTS_MAX);
|
||||
DECLARE_BITMAP(host_clients_map, MEI_CLIENTS_MAX);
|
||||
u8 me_clients_num;
|
||||
u8 me_client_presentation_num;
|
||||
u8 me_client_index;
|
||||
unsigned long me_clients_num;
|
||||
unsigned long me_client_presentation_num;
|
||||
unsigned long me_client_index;
|
||||
|
||||
struct mei_cl wd_cl;
|
||||
enum mei_wd_states wd_state;
|
||||
|
@ -30,10 +30,13 @@
|
||||
/*
|
||||
* Framework version for util services.
|
||||
*/
|
||||
#define UTIL_FW_MINOR 0
|
||||
|
||||
#define UTIL_WS2K8_FW_MAJOR 1
|
||||
#define UTIL_WS2K8_FW_VERSION (UTIL_WS2K8_FW_MAJOR << 16 | UTIL_FW_MINOR)
|
||||
|
||||
#define UTIL_FW_MAJOR 3
|
||||
#define UTIL_FW_MINOR 0
|
||||
#define UTIL_FW_MAJOR_MINOR (UTIL_FW_MAJOR << 16 | UTIL_FW_MINOR)
|
||||
#define UTIL_FW_VERSION (UTIL_FW_MAJOR << 16 | UTIL_FW_MINOR)
|
||||
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user