mei: restrict vtag support to hbm version 2.2
authorAlexander Usyskin <alexander.usyskin@intel.com>
Tue, 18 Aug 2020 11:51:36 +0000 (14:51 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 18 Aug 2020 13:44:43 +0000 (15:44 +0200)
The vtag allows partitioning the mei messages into virtual groups/channels.
Vtags are supported for firmwares with HBM version 2.2 and newer
and only when a firmware confirms the support via capability handshake.
This change only define vtag restrictions in order to make
the series bisectable. Everything will be enabled when driver HBM
version is set to 2.2.

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-3-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/mei/debugfs.c
drivers/misc/mei/hbm.c
drivers/misc/mei/hw.h
drivers/misc/mei/mei_dev.h

index 72ee572ad9b46926ce2595727b324760d4b2a2c6..b98f6f9a4896ca57b329b9da7d3839cae0457543 100644 (file)
@@ -103,6 +103,7 @@ static int mei_dbgfs_devstate_show(struct seq_file *m, void *unused)
                seq_printf(m, "\tFA: %01d\n", dev->hbm_f_fa_supported);
                seq_printf(m, "\tOS: %01d\n", dev->hbm_f_os_supported);
                seq_printf(m, "\tDR: %01d\n", dev->hbm_f_dr_supported);
+               seq_printf(m, "\tVT: %01d\n", dev->hbm_f_vt_supported);
                seq_printf(m, "\tCAP: %01d\n", dev->hbm_f_cap_supported);
        }
 
index 3a227d9363d5475394be1e281191f4871861d29a..0513b8a4ea882ce79ff7fbf5f58af815f09bf8d2 100644 (file)
@@ -342,6 +342,8 @@ static int mei_hbm_capabilities_req(struct mei_device *dev)
 
        memset(&req, 0, sizeof(req));
        req.hbm_cmd = MEI_HBM_CAPABILITIES_REQ_CMD;
+       if (dev->hbm_f_vt_supported)
+               req.capability_requested[0] = HBM_CAP_VT;
 
        ret = mei_hbm_write_message(dev, &mei_hdr, &req);
        if (ret) {
@@ -1074,6 +1076,14 @@ static void mei_hbm_config_features(struct mei_device *dev)
             dev->version.minor_version >= HBM_MINOR_VERSION_DR))
                dev->hbm_f_dr_supported = 1;
 
+       /* VTag Support */
+       dev->hbm_f_vt_supported = 0;
+       if (dev->version.major_version > HBM_MAJOR_VERSION_VT ||
+           (dev->version.major_version == HBM_MAJOR_VERSION_VT &&
+            dev->version.minor_version >= HBM_MINOR_VERSION_VT))
+               dev->hbm_f_vt_supported = 1;
+
+       /* Capability message Support */
        dev->hbm_f_cap_supported = 0;
        if (dev->version.major_version > HBM_MAJOR_VERSION_CAP ||
            (dev->version.major_version == HBM_MAJOR_VERSION_CAP &&
@@ -1112,6 +1122,7 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
        struct hbm_host_enum_response *enum_res;
        struct hbm_dma_setup_response *dma_setup_res;
        struct hbm_add_client_request *add_cl_req;
+       struct hbm_capability_response *capability_res;
        int ret;
 
        struct mei_hbm_cl_cmd *cl_cmd;
@@ -1214,6 +1225,10 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
                        return -EPROTO;
                }
 
+               capability_res = (struct hbm_capability_response *)mei_msg;
+               if (!(capability_res->capability_granted[0] & HBM_CAP_VT))
+                       dev->hbm_f_vt_supported = 0;
+
                if (dev->hbm_f_dr_supported) {
                        if (mei_dmam_ring_alloc(dev))
                                dev_info(dev->dev, "running w/o dma ring\n");
index 539d89ba1c61f08917064f4bbf301a9568994c37..13e4cb68a0e6813da57a0f6a457f3cfc3eec1b49 100644 (file)
 #define HBM_MINOR_VERSION_DR               1
 #define HBM_MAJOR_VERSION_DR               2
 
+/*
+ * MEI version with vm tag support
+ */
+#define HBM_MINOR_VERSION_VT               2
+#define HBM_MAJOR_VERSION_VT               2
+
 /*
  * MEI version with capabilities message support
  */
@@ -542,6 +548,9 @@ struct hbm_dma_ring_ctrl {
        u32 reserved4;
 } __packed;
 
+/* virtual tag supported */
+#define HBM_CAP_VT BIT(0)
+
 /**
  * struct hbm_capability_request - capability request from host to fw
  *
index e18af7dfd9ff9266fa0759e3e767cf44c90ccee2..f80cc6463f1890fb2e21a695d9f8ad10a8477763 100644 (file)
@@ -426,6 +426,7 @@ struct mei_fw_version {
  * @hbm_f_ie_supported  : hbm feature immediate reply to enum request
  * @hbm_f_os_supported  : hbm feature support OS ver message
  * @hbm_f_dr_supported  : hbm feature dma ring supported
+ * @hbm_f_vt_supported  : hbm feature vtag supported
  * @hbm_f_cap_supported : hbm feature capabilities message supported
  *
  * @fw_ver : FW versions
@@ -511,6 +512,7 @@ struct mei_device {
        unsigned int hbm_f_ie_supported:1;
        unsigned int hbm_f_os_supported:1;
        unsigned int hbm_f_dr_supported:1;
+       unsigned int hbm_f_vt_supported:1;
        unsigned int hbm_f_cap_supported:1;
 
        struct mei_fw_version fw_ver[MEI_MAX_FW_VER_BLOCKS];