msm: adsprpc: FastRPC driver interface to get HLOS PID

Currently there is no interface request to get HLOS PID of
the device attached to FastRPC bus driver. Add new request
FASTRPC_DEV_GET_HLOS_PID, to get HLOS PID of the attached
device.

Signed-off-by: Himateja Reddy <quic_hmreddy@quicinc.com>
This commit is contained in:
Himateja Reddy
2023-05-03 11:44:06 -07:00
parent d0ad5cc2d5
commit 2c1d233879
2 changed files with 42 additions and 0 deletions

33
dsp/adsprpc.c Executable file → Normal file
View File

@@ -8148,6 +8148,7 @@ static struct platform_driver fastrpc_driver = {
union fastrpc_dev_param { union fastrpc_dev_param {
struct fastrpc_dev_map_dma *map; struct fastrpc_dev_map_dma *map;
struct fastrpc_dev_unmap_dma *unmap; struct fastrpc_dev_unmap_dma *unmap;
struct fastrpc_dev_get_hlos_pid *hpid;
}; };
long fastrpc_dev_map_dma(struct fastrpc_device *dev, unsigned long invoke_param) long fastrpc_dev_map_dma(struct fastrpc_device *dev, unsigned long invoke_param)
@@ -8281,6 +8282,35 @@ bail:
return err; return err;
} }
long fastrpc_dev_get_hlos_pid(struct fastrpc_device *dev, unsigned long invoke_param)
{
int err = 0;
union fastrpc_dev_param p;
struct fastrpc_file *fl = NULL;
struct fastrpc_apps *me = &gfa;
unsigned long irq_flags = 0;
p.hpid = (struct fastrpc_dev_get_hlos_pid *)invoke_param;
spin_lock_irqsave(&me->hlock, irq_flags);
/* Verify if fastrpc device is closed*/
VERIFY(err, dev && !dev->dev_close);
if (err) {
err = -ESRCH;
spin_unlock_irqrestore(&me->hlock, irq_flags);
return err;
}
fl = dev->fl;
/* Verify if fastrpc file is not NULL*/
if (!fl) {
err = -EBADF;
spin_unlock_irqrestore(&me->hlock, irq_flags);
return err;
}
p.hpid->hlos_pid = fl->tgid;
spin_unlock_irqrestore(&me->hlock, irq_flags);
return err;
}
long fastrpc_driver_invoke(struct fastrpc_device *dev, unsigned int invoke_num, long fastrpc_driver_invoke(struct fastrpc_device *dev, unsigned int invoke_num,
unsigned long invoke_param) unsigned long invoke_param)
{ {
@@ -8293,6 +8323,9 @@ long fastrpc_driver_invoke(struct fastrpc_device *dev, unsigned int invoke_num,
case FASTRPC_DEV_UNMAP_DMA: case FASTRPC_DEV_UNMAP_DMA:
err = fastrpc_dev_unmap_dma(dev, invoke_param); err = fastrpc_dev_unmap_dma(dev, invoke_param);
break; break;
case FASTRPC_DEV_GET_HLOS_PID:
err = fastrpc_dev_get_hlos_pid(dev, invoke_param);
break;
default: default:
err = -ENOTTY; err = -ENOTTY;
break; break;

View File

@@ -18,6 +18,7 @@ enum fastrpc_driver_status {
enum fastrpc_driver_invoke_nums { enum fastrpc_driver_invoke_nums {
FASTRPC_DEV_MAP_DMA = 1, FASTRPC_DEV_MAP_DMA = 1,
FASTRPC_DEV_UNMAP_DMA, FASTRPC_DEV_UNMAP_DMA,
FASTRPC_DEV_GET_HLOS_PID,
}; };
/** /**
@@ -44,6 +45,14 @@ struct fastrpc_dev_unmap_dma {
size_t size; size_t size;
}; };
/**
* struct fastrpc_dev_get_hlos_pid - fastrpc dma buffer unmap structure
* @hlos_pid : HLOS PID of attached device
*/
struct fastrpc_dev_get_hlos_pid {
int hlos_pid;
};
/** /**
* fastrpc_device - device that belong to the fastrpc bus * fastrpc_device - device that belong to the fastrpc bus
* @hn: Head node to add to fastrpc device list * @hn: Head node to add to fastrpc device list