mei: add vtag support bit in client properties
authorAlexander Usyskin <alexander.usyskin@intel.com>
Tue, 18 Aug 2020 11:51:37 +0000 (14:51 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 18 Aug 2020 13:44:43 +0000 (15:44 +0200)
Vtag support is on a client basis, meaning not every client
supports it. The vtag capability is communicated via the client properties
structure during client enumeration process.
Export the propertiy via sysfs.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Link: https://lore.kernel.org/r/20200818115147.2567012-4-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Documentation/ABI/testing/sysfs-bus-mei
drivers/misc/mei/bus.c
drivers/misc/mei/client.h
drivers/misc/mei/debugfs.c
drivers/misc/mei/hw.h

index 3d37e27..6e9a105 100644 (file)
@@ -41,6 +41,13 @@ Contact:     Tomas Winkler <tomas.winkler@intel.com>
 Description:   Stores mei client fixed address, if any
                Format: %d
 
+What:          /sys/bus/mei/devices/.../vtag
+Date:          Nov 2020
+KernelVersion: 5.9
+Contact:       Tomas Winkler <tomas.winkler@intel.com>
+Description:   Stores mei client vtag support status
+               Format: %d
+
 What:          /sys/bus/mei/devices/.../max_len
 Date:          Nov 2019
 KernelVersion: 5.5
index a6dfc3c..2e7ac53 100644 (file)
@@ -810,6 +810,16 @@ static ssize_t fixed_show(struct device *dev, struct device_attribute *a,
 }
 static DEVICE_ATTR_RO(fixed);
 
+static ssize_t vtag_show(struct device *dev, struct device_attribute *a,
+                        char *buf)
+{
+       struct mei_cl_device *cldev = to_mei_cl_device(dev);
+       bool vt = mei_me_cl_vt(cldev->me_cl);
+
+       return sprintf(buf, "%d", vt);
+}
+static DEVICE_ATTR_RO(vtag);
+
 static ssize_t max_len_show(struct device *dev, struct device_attribute *a,
                            char *buf)
 {
@@ -827,6 +837,7 @@ static struct attribute *mei_cldev_attrs[] = {
        &dev_attr_modalias.attr,
        &dev_attr_max_conn.attr,
        &dev_attr_fixed.attr,
+       &dev_attr_vtag.attr,
        &dev_attr_max_len.attr,
        NULL,
 };
index 2f8954d..0d0f363 100644 (file)
@@ -94,6 +94,18 @@ static inline u8 mei_me_cl_fixed(const struct mei_me_client *me_cl)
 }
 
 /**
+ * mei_me_cl_vt - return me client vtag supported status
+ *
+ * @me_cl: me client
+ *
+ * Return: true if me client supports vt tagging
+ */
+static inline bool mei_me_cl_vt(const struct mei_me_client *me_cl)
+{
+       return me_cl->props.vt_supported == 1;
+}
+
+/**
  * mei_me_cl_max_len - return me client max msg length
  *
  * @me_cl: me client
index b98f6f9..3ab1a43 100644 (file)
@@ -27,7 +27,7 @@ static int mei_dbgfs_meclients_show(struct seq_file *m, void *unused)
 
        down_read(&dev->me_clients_rwsem);
 
-       seq_puts(m, "  |id|fix|         UUID                       |con|msg len|sb|refc|\n");
+       seq_puts(m, "  |id|fix|         UUID                       |con|msg len|sb|refc|vt|\n");
 
        /*  if the driver is not enabled the list won't be consistent */
        if (dev->dev_state != MEI_DEV_ENABLED)
@@ -37,14 +37,15 @@ static int mei_dbgfs_meclients_show(struct seq_file *m, void *unused)
                if (!mei_me_cl_get(me_cl))
                        continue;
 
-               seq_printf(m, "%2d|%2d|%3d|%pUl|%3d|%7d|%2d|%4d|\n",
+               seq_printf(m, "%2d|%2d|%3d|%pUl|%3d|%7d|%2d|%4d|%2d|\n",
                           i++, me_cl->client_id,
                           me_cl->props.fixed_address,
                           &me_cl->props.protocol_name,
                           me_cl->props.max_number_of_connections,
                           me_cl->props.max_msg_length,
                           me_cl->props.single_recv_buf,
-                          kref_read(&me_cl->refcnt));
+                          kref_read(&me_cl->refcnt),
+                          me_cl->props.vt_supported);
                mei_me_cl_put(me_cl);
        }
 
index 13e4cb6..ea0a2e4 100644 (file)
@@ -314,13 +314,26 @@ struct hbm_host_enum_response {
        u8 valid_addresses[32];
 } __packed;
 
+/**
+ * struct mei_client_properties - mei client properties
+ *
+ * @protocol_name: guid of the client
+ * @protocol_version: client protocol version
+ * @max_number_of_connections: number of possible connections.
+ * @fixed_address: fixed me address (0 if the client is dynamic)
+ * @single_recv_buf: 1 if all connections share a single receive buffer.
+ * @vt_supported: the client support vtag
+ * @reserved: reserved
+ * @max_msg_length: MTU of the client
+ */
 struct mei_client_properties {
        uuid_le protocol_name;
        u8 protocol_version;
        u8 max_number_of_connections;
        u8 fixed_address;
        u8 single_recv_buf:1;
-       u8 reserved:7;
+       u8 vt_supported:1;
+       u8 reserved:6;
        u32 max_msg_length;
 } __packed;