]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mei: more prints with client prefix
authorAlexander Usyskin <alexander.usyskin@intel.com>
Thu, 17 Jul 2025 14:11:11 +0000 (17:11 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 19 Jul 2025 07:57:55 +0000 (09:57 +0200)
Use client-aware print macro instead of usual device print in more
places to expand debug-ability.
The client-aware print macro prefixes the usual device print with
current connection endpoints.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Link: https://lore.kernel.org/r/20250717141112.1696482-3-alexander.usyskin@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/mei/hbm.c
drivers/misc/mei/interrupt.c
drivers/misc/mei/main.c

index 026b1f686c162abf0291c1d09174b0d33dad592a..4fe9a2752d43dfc22b8a41760735c06bf18fd879 100644 (file)
@@ -510,7 +510,7 @@ int mei_hbm_cl_notify_req(struct mei_device *dev,
 
        ret = mei_hbm_write_message(dev, &mei_hdr, &req);
        if (ret)
-               dev_err(dev->dev, "notify request failed: ret = %d\n", ret);
+               cl_err(dev, cl, "notify request failed: ret = %d\n", ret);
 
        return ret;
 }
@@ -626,7 +626,7 @@ int mei_hbm_cl_dma_map_req(struct mei_device *dev, struct mei_cl *cl)
 
        ret = mei_hbm_write_message(dev, &mei_hdr, &req);
        if (ret)
-               dev_err(dev->dev, "dma map request failed: ret = %d\n", ret);
+               cl_err(dev, cl, "dma map request failed: ret = %d\n", ret);
 
        return ret;
 }
@@ -654,7 +654,7 @@ int mei_hbm_cl_dma_unmap_req(struct mei_device *dev, struct mei_cl *cl)
 
        ret = mei_hbm_write_message(dev, &mei_hdr, &req);
        if (ret)
-               dev_err(dev->dev, "dma unmap request failed: ret = %d\n", ret);
+               cl_err(dev, cl, "dma unmap request failed: ret = %d\n", ret);
 
        return ret;
 }
@@ -679,10 +679,10 @@ static void mei_hbm_cl_dma_map_res(struct mei_device *dev,
                return;
 
        if (res->status) {
-               dev_err(dev->dev, "cl dma map failed %d\n", res->status);
+               cl_err(dev, cl, "cl dma map failed %d\n", res->status);
                cl->status = -EFAULT;
        } else {
-               dev_dbg(dev->dev, "cl dma map succeeded\n");
+               cl_dbg(dev, cl, "cl dma map succeeded\n");
                cl->dma_mapped = 1;
                cl->status = 0;
        }
@@ -709,10 +709,10 @@ static void mei_hbm_cl_dma_unmap_res(struct mei_device *dev,
                return;
 
        if (res->status) {
-               dev_err(dev->dev, "cl dma unmap failed %d\n", res->status);
+               cl_err(dev, cl, "cl dma unmap failed %d\n", res->status);
                cl->status = -EFAULT;
        } else {
-               dev_dbg(dev->dev, "cl dma unmap succeeded\n");
+               cl_dbg(dev, cl, "cl dma unmap succeeded\n");
                cl->dma_mapped = 0;
                cl->status = 0;
        }
index c484f416fae419641cfd9ed5d8a37f18298dfa29..d472f6bbe767d1f6656f1f59bc046d9e3027a6bb 100644 (file)
@@ -35,7 +35,7 @@ void mei_irq_compl_handler(struct mei_device *dev, struct list_head *cmpl_list)
                cl = cb->cl;
                list_del_init(&cb->list);
 
-               dev_dbg(dev->dev, "completing call back.\n");
+               cl_dbg(dev, cl, "completing call back.\n");
                mei_cl_complete(cl, cb);
        }
 }
index 1f5aaf16e300f0b9f1a59647203d9b7e9ce24176..8a149a15b861099c0faedc6d98ce9abe730cf048 100644 (file)
@@ -256,7 +256,7 @@ copy_buffer:
        length = min_t(size_t, length, cb->buf_idx - *offset);
 
        if (copy_to_user(ubuf, cb->buf.data + *offset, length)) {
-               dev_dbg(dev->dev, "failed to copy data to userland\n");
+               cl_dbg(dev, cl, "failed to copy data to userland\n");
                rets = -EFAULT;
                goto free;
        }
@@ -379,7 +379,7 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf,
 
        rets = copy_from_user(cb->buf.data, ubuf, length);
        if (rets) {
-               dev_dbg(dev->dev, "failed to copy data from userland\n");
+               cl_dbg(dev, cl, "failed to copy data from userland\n");
                rets = -EFAULT;
                mei_io_cb_free(cb);
                goto out;
@@ -421,7 +421,7 @@ 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, in_client_uuid);
        if (!me_cl) {
-               dev_dbg(dev->dev, "Cannot connect to FW Client UUID = %pUl\n",
+               cl_dbg(dev, cl, "Cannot connect to FW Client UUID = %pUl\n",
                        in_client_uuid);
                rets = -ENOTTY;
                goto end;
@@ -431,24 +431,21 @@ static int mei_ioctl_connect_client(struct file *file,
                bool forbidden = dev->override_fixed_address ?
                         !dev->allow_fixed_address : !dev->hbm_f_fa_supported;
                if (forbidden) {
-                       dev_dbg(dev->dev, "Connection forbidden to FW Client UUID = %pUl\n",
+                       cl_dbg(dev, cl, "Connection forbidden to FW Client UUID = %pUl\n",
                                in_client_uuid);
                        rets = -ENOTTY;
                        goto end;
                }
        }
 
-       dev_dbg(dev->dev, "Connect to FW Client ID = %d\n",
-                       me_cl->client_id);
-       dev_dbg(dev->dev, "FW Client - Protocol Version = %d\n",
-                       me_cl->props.protocol_version);
-       dev_dbg(dev->dev, "FW Client - Max Msg Len = %d\n",
-                       me_cl->props.max_msg_length);
+       cl_dbg(dev, cl, "Connect to FW Client ID = %d\n", me_cl->client_id);
+       cl_dbg(dev, cl, "FW Client - Protocol Version = %d\n", me_cl->props.protocol_version);
+       cl_dbg(dev, cl, "FW Client - Max Msg Len = %d\n", me_cl->props.max_msg_length);
 
        /* prepare the output buffer */
        client->max_msg_length = me_cl->props.max_msg_length;
        client->protocol_version = me_cl->props.protocol_version;
-       dev_dbg(dev->dev, "Can connect?\n");
+       cl_dbg(dev, cl, "Can connect?\n");
 
        rets = mei_cl_connect(cl, me_cl, file);
 
@@ -515,19 +512,19 @@ static int mei_ioctl_connect_vtag(struct file *file,
        cl = file->private_data;
        dev = cl->dev;
 
-       dev_dbg(dev->dev, "FW Client %pUl vtag %d\n", in_client_uuid, vtag);
+       cl_dbg(dev, cl, "FW Client %pUl vtag %d\n", in_client_uuid, vtag);
 
        switch (cl->state) {
        case MEI_FILE_DISCONNECTED:
                if (mei_cl_vtag_by_fp(cl, file) != vtag) {
-                       dev_err(dev->dev, "reconnect with different vtag\n");
+                       cl_err(dev, cl, "reconnect with different vtag\n");
                        return -EINVAL;
                }
                break;
        case MEI_FILE_INITIALIZING:
                /* malicious connect from another thread may push vtag */
                if (!IS_ERR(mei_cl_fp_by_vtag(cl, vtag))) {
-                       dev_err(dev->dev, "vtag already filled\n");
+                       cl_err(dev, cl, "vtag already filled\n");
                        return -EINVAL;
                }
 
@@ -546,7 +543,7 @@ static int mei_ioctl_connect_vtag(struct file *file,
                                continue;
 
                        /* replace cl with acquired one */
-                       dev_dbg(dev->dev, "replacing with existing cl\n");
+                       cl_dbg(dev, cl, "replacing with existing cl\n");
                        mei_cl_unlink(cl);
                        kfree(cl);
                        file->private_data = pos;
@@ -656,7 +653,7 @@ static long mei_ioctl(struct file *file, unsigned int cmd, unsigned long data)
 
        dev = cl->dev;
 
-       dev_dbg(dev->dev, "IOCTL cmd = 0x%x", cmd);
+       cl_dbg(dev, cl, "IOCTL cmd = 0x%x", cmd);
 
        mutex_lock(&dev->device_lock);
        if (dev->dev_state != MEI_DEV_ENABLED) {
@@ -666,9 +663,9 @@ static long mei_ioctl(struct file *file, unsigned int cmd, unsigned long data)
 
        switch (cmd) {
        case IOCTL_MEI_CONNECT_CLIENT:
-               dev_dbg(dev->dev, ": IOCTL_MEI_CONNECT_CLIENT.\n");
+               cl_dbg(dev, cl, "IOCTL_MEI_CONNECT_CLIENT\n");
                if (copy_from_user(&conn, (char __user *)data, sizeof(conn))) {
-                       dev_dbg(dev->dev, "failed to copy data from userland\n");
+                       cl_dbg(dev, cl, "failed to copy data from userland\n");
                        rets = -EFAULT;
                        goto out;
                }
@@ -689,7 +686,7 @@ static long mei_ioctl(struct file *file, unsigned int cmd, unsigned long data)
 
                /* if all is ok, copying the data back to user. */
                if (copy_to_user((char __user *)data, &conn, sizeof(conn))) {
-                       dev_dbg(dev->dev, "failed to copy data to userland\n");
+                       cl_dbg(dev, cl, "failed to copy data to userland\n");
                        rets = -EFAULT;
                        goto out;
                }
@@ -697,10 +694,10 @@ static long mei_ioctl(struct file *file, unsigned int cmd, unsigned long data)
                break;
 
        case IOCTL_MEI_CONNECT_CLIENT_VTAG:
-               dev_dbg(dev->dev, "IOCTL_MEI_CONNECT_CLIENT_VTAG\n");
+               cl_dbg(dev, cl, "IOCTL_MEI_CONNECT_CLIENT_VTAG\n");
                if (copy_from_user(&conn_vtag, (char __user *)data,
                                   sizeof(conn_vtag))) {
-                       dev_dbg(dev->dev, "failed to copy data from userland\n");
+                       cl_dbg(dev, cl, "failed to copy data from userland\n");
                        rets = -EFAULT;
                        goto out;
                }
@@ -711,13 +708,13 @@ static long mei_ioctl(struct file *file, unsigned int cmd, unsigned long data)
 
                rets = mei_vt_support_check(dev, cl_uuid);
                if (rets == -EOPNOTSUPP)
-                       dev_dbg(dev->dev, "FW Client %pUl does not support vtags\n",
+                       cl_dbg(dev, cl, "FW Client %pUl does not support vtags\n",
                                cl_uuid);
                if (rets)
                        goto out;
 
                if (!vtag) {
-                       dev_dbg(dev->dev, "vtag can't be zero\n");
+                       cl_dbg(dev, cl, "vtag can't be zero\n");
                        rets = -EINVAL;
                        goto out;
                }
@@ -729,7 +726,7 @@ static long mei_ioctl(struct file *file, unsigned int cmd, unsigned long data)
                /* if all is ok, copying the data back to user. */
                if (copy_to_user((char __user *)data, &conn_vtag,
                                 sizeof(conn_vtag))) {
-                       dev_dbg(dev->dev, "failed to copy data to userland\n");
+                       cl_dbg(dev, cl, "failed to copy data to userland\n");
                        rets = -EFAULT;
                        goto out;
                }
@@ -737,10 +734,10 @@ static long mei_ioctl(struct file *file, unsigned int cmd, unsigned long data)
                break;
 
        case IOCTL_MEI_NOTIFY_SET:
-               dev_dbg(dev->dev, ": IOCTL_MEI_NOTIFY_SET.\n");
+               cl_dbg(dev, cl, "IOCTL_MEI_NOTIFY_SET\n");
                if (copy_from_user(&notify_req,
                                   (char __user *)data, sizeof(notify_req))) {
-                       dev_dbg(dev->dev, "failed to copy data from userland\n");
+                       cl_dbg(dev, cl, "failed to copy data from userland\n");
                        rets = -EFAULT;
                        goto out;
                }
@@ -748,15 +745,15 @@ static long mei_ioctl(struct file *file, unsigned int cmd, unsigned long data)
                break;
 
        case IOCTL_MEI_NOTIFY_GET:
-               dev_dbg(dev->dev, ": IOCTL_MEI_NOTIFY_GET.\n");
+               cl_dbg(dev, cl, "IOCTL_MEI_NOTIFY_GET\n");
                rets = mei_ioctl_client_notify_get(file, &notify_get);
                if (rets)
                        goto out;
 
-               dev_dbg(dev->dev, "copy connect data to user\n");
+               cl_dbg(dev, cl, "copy connect data to user\n");
                if (copy_to_user((char __user *)data,
                                &notify_get, sizeof(notify_get))) {
-                       dev_dbg(dev->dev, "failed to copy data to userland\n");
+                       cl_dbg(dev, cl, "failed to copy data to userland\n");
                        rets = -EFAULT;
                        goto out;