Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mei: connection to fixed address clients from user-space

This should be used for debug only.
The feaure is gated by "allow_fixed_address" control exposed in debugfs.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Alexander Usyskin and committed by
Greg Kroah-Hartman
eeabfcf5 1df629ef

+17 -1
+6
drivers/misc/mei/debugfs.c
··· 209 209 dev_err(dev->dev, "devstate: registration failed\n"); 210 210 goto err; 211 211 } 212 + f = debugfs_create_bool("allow_fixed_address", S_IRUSR | S_IWUSR, dir, 213 + &dev->allow_fixed_address); 214 + if (!f) { 215 + dev_err(dev->dev, "allow_fixed_address: registration failed\n"); 216 + goto err; 217 + } 212 218 dev->dbgfs_dir = dir; 213 219 return 0; 214 220 err:
+7 -1
drivers/misc/mei/main.c
··· 215 215 216 216 cb = mei_cl_read_cb(cl, file); 217 217 if (!cb) { 218 + if (mei_cl_is_fixed_address(cl) && dev->allow_fixed_address) { 219 + cb = mei_cl_read_cb(cl, NULL); 220 + if (cb) 221 + goto copy_buffer; 222 + } 218 223 rets = 0; 219 224 goto out; 220 225 } ··· 394 389 395 390 /* find ME client we're trying to connect to */ 396 391 me_cl = mei_me_cl_by_uuid(dev, &data->in_client_uuid); 397 - if (!me_cl || me_cl->props.fixed_address) { 392 + if (!me_cl || 393 + (me_cl->props.fixed_address && !dev->allow_fixed_address)) { 398 394 dev_dbg(dev->dev, "Cannot connect to FW Client UUID = %pUl\n", 399 395 &data->in_client_uuid); 400 396 mei_me_cl_put(me_cl);
+4
drivers/misc/mei/mei_dev.h
··· 476 476 * @host_clients_map : host clients id pool 477 477 * @me_client_index : last FW client index in enumeration 478 478 * 479 + * @allow_fixed_address: allow user space to connect a fixed client 480 + * 479 481 * @wd_cl : watchdog client 480 482 * @wd_state : watchdog client state 481 483 * @wd_pending : watchdog command is pending ··· 568 566 DECLARE_BITMAP(me_clients_map, MEI_CLIENTS_MAX); 569 567 DECLARE_BITMAP(host_clients_map, MEI_CLIENTS_MAX); 570 568 unsigned long me_client_index; 569 + 570 + u32 allow_fixed_address; 571 571 572 572 struct mei_cl wd_cl; 573 573 enum mei_wd_states wd_state;