Skip to content
This repository has been archived by the owner on Dec 14, 2022. It is now read-only.

Commit

Permalink
mei: connection to fixed address clients from user-space
Browse files Browse the repository at this point in the history
This should be used for debug only.
The feaure is gated by "allow_fixed_address" control exposed in debugfs.

Signed-off-by: Alexander Usyskin <[email protected]>
Signed-off-by: Tomas Winkler <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
ausyskin authored and gregkh committed May 24, 2015
1 parent 1df629e commit eeabfcf
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
6 changes: 6 additions & 0 deletions drivers/misc/mei/debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,12 @@ int mei_dbgfs_register(struct mei_device *dev, const char *name)
dev_err(dev->dev, "devstate: registration failed\n");
goto err;
}
f = debugfs_create_bool("allow_fixed_address", S_IRUSR | S_IWUSR, dir,
&dev->allow_fixed_address);
if (!f) {
dev_err(dev->dev, "allow_fixed_address: registration failed\n");
goto err;
}
dev->dbgfs_dir = dir;
return 0;
err:
Expand Down
8 changes: 7 additions & 1 deletion drivers/misc/mei/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,11 @@ static ssize_t mei_read(struct file *file, char __user *ubuf,

cb = mei_cl_read_cb(cl, file);
if (!cb) {
if (mei_cl_is_fixed_address(cl) && dev->allow_fixed_address) {
cb = mei_cl_read_cb(cl, NULL);
if (cb)
goto copy_buffer;
}
rets = 0;
goto out;
}
Expand Down Expand Up @@ -389,7 +394,8 @@ static int mei_ioctl_connect_client(struct file *file,

/* find ME client we're trying to connect to */
me_cl = mei_me_cl_by_uuid(dev, &data->in_client_uuid);
if (!me_cl || me_cl->props.fixed_address) {
if (!me_cl ||
(me_cl->props.fixed_address && !dev->allow_fixed_address)) {
dev_dbg(dev->dev, "Cannot connect to FW Client UUID = %pUl\n",
&data->in_client_uuid);
mei_me_cl_put(me_cl);
Expand Down
4 changes: 4 additions & 0 deletions drivers/misc/mei/mei_dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,8 @@ const char *mei_pg_state_str(enum mei_pg_state state);
* @host_clients_map : host clients id pool
* @me_client_index : last FW client index in enumeration
*
* @allow_fixed_address: allow user space to connect a fixed client
*
* @wd_cl : watchdog client
* @wd_state : watchdog client state
* @wd_pending : watchdog command is pending
Expand Down Expand Up @@ -567,6 +569,8 @@ struct mei_device {
DECLARE_BITMAP(host_clients_map, MEI_CLIENTS_MAX);
unsigned long me_client_index;

u32 allow_fixed_address;

struct mei_cl wd_cl;
enum mei_wd_states wd_state;
bool wd_pending;
Expand Down

0 comments on commit eeabfcf

Please sign in to comment.