mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tomas Winkler <tomas.winkler@intel.com>
To: gregkh@linuxfoundation.org
Cc: arnd@arndb.de, linux-kernel@vger.kernel.org,
	Alexander Usyskin <alexander.usyskin@intel.com>,
	Tomas Winkler <tomas.winkler@intel.com>
Subject: [char-misc-next 09/11] mei: connection to fixed address clients from user-space
Date: Fri, 27 Mar 2015 00:28:05 +0200	[thread overview]
Message-ID: <1427408887-27979-9-git-send-email-tomas.winkler@intel.com> (raw)
In-Reply-To: <1427408887-27979-1-git-send-email-tomas.winkler@intel.com>

From: Alexander Usyskin <alexander.usyskin@intel.com>

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>
---
 drivers/misc/mei/debugfs.c | 6 ++++++
 drivers/misc/mei/main.c    | 8 +++++++-
 drivers/misc/mei/mei_dev.h | 4 ++++
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/mei/debugfs.c b/drivers/misc/mei/debugfs.c
index 3f6d855a7ecb..3cac3bc82185 100644
--- a/drivers/misc/mei/debugfs.c
+++ b/drivers/misc/mei/debugfs.c
@@ -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_IROTH | S_IWOTH, 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:
diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c
index dcaa7658e742..ca128e2aaf10 100644
--- a/drivers/misc/mei/main.c
+++ b/drivers/misc/mei/main.c
@@ -216,6 +216,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;
 	}
@@ -390,7 +395,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);
diff --git a/drivers/misc/mei/mei_dev.h b/drivers/misc/mei/mei_dev.h
index f17979c680a9..6cbcb11a6974 100644
--- a/drivers/misc/mei/mei_dev.h
+++ b/drivers/misc/mei/mei_dev.h
@@ -475,6 +475,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
@@ -566,6 +568,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;
-- 
1.9.3


  parent reply	other threads:[~2015-03-26 22:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-26 22:27 [char-misc-next 01/11] mei: fix mei_poll operation Tomas Winkler
2015-03-26 22:27 ` [char-misc-next 02/11] mei: use mei_cl_is_connected consistently Tomas Winkler
2015-03-26 22:27 ` [char-misc-next 03/11] mei: replace check for connection instead of transitioning Tomas Winkler
2015-03-26 22:28 ` [char-misc-next 04/11] mei: revamp client disconnection flow Tomas Winkler
2015-04-03 14:19   ` Greg KH
2015-04-05 11:00     ` Winkler, Tomas
2015-04-05 13:18       ` Greg KH
2015-04-06 10:19         ` Winkler, Tomas
2015-03-26 22:28 ` [char-misc-next 05/11] mei: revamp client connection Tomas Winkler
2015-03-26 22:28 ` [char-misc-next 06/11] mei: add a reference from the host client to the me client Tomas Winkler
2015-03-26 22:28 ` [char-misc-next 07/11] mei: fix flow control for single buffer clients Tomas Winkler
2015-03-26 22:28 ` [char-misc-next 08/11] mei: support for fixed address clients Tomas Winkler
2015-03-26 22:28 ` Tomas Winkler [this message]
2015-03-26 22:28 ` [char-misc-next 10/11] mei: drop iamthif_mtu from device structure Tomas Winkler
2015-03-26 22:28 ` [char-misc-next 11/11] mei: txe: fix incorrect indentation Tomas Winkler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1427408887-27979-9-git-send-email-tomas.winkler@intel.com \
    --to=tomas.winkler@intel.com \
    --cc=alexander.usyskin@intel.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®