Message ID | 20220609231955.3632596-6-daniele.ceraolospurio@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | HuC loading for DG2 | expand |
code looks in order and this patch hasnt too much meat to it anyways. I have 1 question but its not pertaining to the code but rather to the backend firmware expectation, see below: On Thu, 2022-06-09 at 16:19 -0700, Ceraolo Spurio, Daniele wrote: > From: Vitaly Lubart <vitaly.lubart@intel.com> > > Adding command streamer API to the PXP driver > > Signed-off-by: Vitaly Lubart <vitaly.lubart@intel.com> > Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> > Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> > --- > drivers/misc/mei/pxp/mei_pxp.c | 27 +++++++++++++++++++++++++++ > include/drm/i915_pxp_tee_interface.h | 5 +++++ > 2 files changed, 32 insertions(+) > > diff --git a/drivers/misc/mei/pxp/mei_pxp.c b/drivers/misc/mei/pxp/mei_pxp.c > index 5c39457e3f53..94d3ef3cc73a 100644 > --- a/drivers/misc/mei/pxp/mei_pxp.c > +++ b/drivers/misc/mei/pxp/mei_pxp.c > @@ -77,10 +77,37 @@ mei_pxp_receive_message(struct device *dev, void *buffer, size_t size) > return byte; > } > > +/** > + * mei_pxp_gsc_command() - sends a gsc command, by sending > + * a gsl 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 > + Question: Can sg_in and sg_out be the same memory address? I am assuming yes because of the usage i see later in this series. If so, perhaps its a good idea to add that into the description (so that any future changes are aware that clients calling this component interface may already be doing this). That said, here is a conditional r-b assuming that change is made in the structure definition above (if not, we have to change the other patch, #8). Reviewed-by: Alan Previn <alan.previn.teres.alexis@intel.com> > * > + * 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; > + > + if (!dev || !sg_in || !sg_out) > + return -EINVAL; > + > + cldev = to_mei_cl_device(dev); > + > + return mei_cldev_send_gsc_command(cldev, client_id, fence_id, sg_in, total_in_len, sg_out); > +} > +
diff --git a/drivers/misc/mei/pxp/mei_pxp.c b/drivers/misc/mei/pxp/mei_pxp.c index 5c39457e3f53..94d3ef3cc73a 100644 --- a/drivers/misc/mei/pxp/mei_pxp.c +++ b/drivers/misc/mei/pxp/mei_pxp.c @@ -77,10 +77,37 @@ mei_pxp_receive_message(struct device *dev, void *buffer, size_t size) return byte; } +/** + * mei_pxp_gsc_command() - sends a gsc command, by sending + * a gsl 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; + + if (!dev || !sg_in || !sg_out) + return -EINVAL; + + 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 = { .owner = THIS_MODULE, .send = mei_pxp_send_message, .recv = mei_pxp_receive_message, + .gsc_command = mei_pxp_gsc_command, }; static int mei_component_master_bind(struct device *dev) diff --git a/include/drm/i915_pxp_tee_interface.h b/include/drm/i915_pxp_tee_interface.h index af593ec64469..67d44a1827f9 100644 --- a/include/drm/i915_pxp_tee_interface.h +++ b/include/drm/i915_pxp_tee_interface.h @@ -8,6 +8,7 @@ #include <linux/mutex.h> #include <linux/device.h> +#include <linux/scatterlist.h> /** * 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 (*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); + }; /**