FSICOM: IOVA per client kernel changes

- IOCTL datatype and call added for sending IOVA,
  offset and channel id data to FSI

JIRA SS-3385
JIRA SS-4628
Bug 3855033

Change-Id: I1212913a7ede879108800a68eafbe8240211572b
Signed-off-by: Rahul Bedarkar <rabedarkar@nvidia.com>
Signed-off-by: Prashant Kumar Shaw <pshaw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2819743
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Prashant Kumar Shaw
2022-12-01 08:03:47 +00:00
committed by mobile promotions
parent 6a69011d7c
commit f6d27d0561
2 changed files with 31 additions and 5 deletions

View File

@@ -19,7 +19,9 @@
/* Timeout in milliseconds */
#define TIMEOUT 1000
/* Data type for mailbox client and channel details */
#define IOVA_UNI_CODE 0xFE0D
/*Data type for mailbox client and channel details*/
struct fsi_hsp_sm {
struct mbox_client client;
struct mbox_chan *chan;
@@ -118,15 +120,16 @@ static ssize_t device_file_ioctl(
struct rw_data *user_input;
int ret = 0;
uint32_t pdata[4] = {0};
struct iova_data ldata;
user_input = (struct rw_data *)arg;
if (copy_from_user(&input, (void __user *)arg,
sizeof(struct rw_data)))
return -EACCES;
switch (cmd) {
case NVMAP_SMMU_MAP:
user_input = (struct rw_data *)arg;
if (copy_from_user(&input, (void __user *)arg,
sizeof(struct rw_data)))
return -EACCES;
dmabuf = dma_buf_get(input.handle);
if (IS_ERR_OR_NULL(dmabuf))
@@ -159,6 +162,9 @@ static ssize_t device_file_ioctl(
break;
case TEGRA_HSP_WRITE:
if (copy_from_user(&input, (void __user *)arg,
sizeof(struct rw_data)))
return -EACCES;
pdata[0] = input.handle;
ret = mbox_send_message(fsi_hsp_v->tx.chan,
(void *)pdata);
@@ -168,6 +174,18 @@ static ssize_t device_file_ioctl(
task = get_current();
break;
case TEGRA_IOVA_DATA:
if (copy_from_user(&ldata, (void __user *)arg,
sizeof(struct iova_data)))
return -EACCES;
pdata[0] = ldata.offset;
pdata[1] = ldata.iova;
pdata[2] = ldata.chid;
pdata[3] = IOVA_UNI_CODE;
ret = mbox_send_message(fsi_hsp_v->tx.chan,
(void *)pdata);
break;
default:
return -EINVAL;
}

View File

@@ -14,6 +14,13 @@ struct rw_data {
uint64_t iova;
};
/*Data type for sending the offset,IOVA and channel Id details to FSI */
struct iova_data {
uint32_t offset;
uint32_t iova;
uint32_t chid;
};
/* signal value */
#define SIG_DRIVER_RESUME 43
#define SIG_FSI_WRITE_EVENT 44
@@ -23,5 +30,6 @@ struct rw_data {
#define NVMAP_SMMU_UNMAP _IOWR('q', 2, struct rw_data *)
#define TEGRA_HSP_WRITE _IOWR('q', 3, struct rw_data *)
#define TEGRA_SIGNAL_REG _IOWR('q', 4, struct rw_data *)
#define TEGRA_IOVA_DATA _IOWR('q', 5, struct iova_data *)
#endif /* _UAPI_TEGRA_FSICOM_H_ */