mei: pxp: add command streamer API to the PXP driver

The discrete graphics card with GSC firmware
using command streamer API hence it requires to enhance
pxp module with the new gsc_command() handler.

The handler is implemented via mei_pxp_gsc_command() which is
just a thin wrapper around mei_cldev_send_gsc_command()

Signed-off-by: Vitaly Lubart <vitaly.lubart@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Alan Previn <alan.previn.teres.alexis@intel.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220928004145.745803-6-daniele.ceraolospurio@intel.com
This commit is contained in:
Vitaly Lubart 2022-09-27 17:41:35 -07:00 committed by Daniele Ceraolo Spurio
parent 2266e58a1c
commit c72891256a
2 changed files with 30 additions and 0 deletions

View File

@ -77,10 +77,35 @@ mei_pxp_receive_message(struct device *dev, void *buffer, size_t size)
return byte; return byte;
} }
/**
* mei_pxp_gsc_command() - sends a gsc command, by sending
* a sgl mei message to gsc and receiving reply from gsc
*
* @dev: device corresponding to the mei_cl_device
* @client_id: client id to send the command to
* @fence_id: fence id to send the command to
* @sg_in: scatter gather list containing addresses for rx message buffer
* @total_in_len: total length of data in 'in' sg, can be less than the sum of buffers sizes
* @sg_out: scatter gather list containing addresses for tx message buffer
*
* Return: bytes sent on Success, <0 on Failure
*/
static ssize_t mei_pxp_gsc_command(struct device *dev, u8 client_id, u32 fence_id,
struct scatterlist *sg_in, size_t total_in_len,
struct scatterlist *sg_out)
{
struct mei_cl_device *cldev;
cldev = to_mei_cl_device(dev);
return mei_cldev_send_gsc_command(cldev, client_id, fence_id, sg_in, total_in_len, sg_out);
}
static const struct i915_pxp_component_ops mei_pxp_ops = { static const struct i915_pxp_component_ops mei_pxp_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.send = mei_pxp_send_message, .send = mei_pxp_send_message,
.recv = mei_pxp_receive_message, .recv = mei_pxp_receive_message,
.gsc_command = mei_pxp_gsc_command,
}; };
static int mei_component_master_bind(struct device *dev) static int mei_component_master_bind(struct device *dev)

View File

@ -8,6 +8,7 @@
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/device.h> #include <linux/device.h>
struct scatterlist;
/** /**
* struct i915_pxp_component_ops - ops for PXP services. * struct i915_pxp_component_ops - ops for PXP services.
@ -23,6 +24,10 @@ struct i915_pxp_component_ops {
int (*send)(struct device *dev, const void *message, size_t size); int (*send)(struct device *dev, const void *message, size_t size);
int (*recv)(struct device *dev, void *buffer, size_t size); int (*recv)(struct device *dev, void *buffer, size_t size);
ssize_t (*gsc_command)(struct device *dev, u8 client_id, u32 fence_id,
struct scatterlist *sg_in, size_t total_in_len,
struct scatterlist *sg_out);
}; };
/** /**