mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-24 10:11:26 +03:00
video: tegra: host: dla: get ping cmd mem from pool
- command memory allocated during init, get that memory for ping command from 'cmd mem pool' and release after send cmd complete Jira DLA-243 Change-Id: I6738e995e1fef9c1f13a0032b9e4796c255ea6e9 Signed-off-by: Shridhar Rasal <srasal@nvidia.com> Reviewed-on: http://git-master/r/1274301 Reviewed-by: Prashant Gaikwad <pgaikwad@nvidia.com> GVS: Gerrit_Virtual_Submit
This commit is contained in:
committed by
Laxman Dewangan
parent
e819214492
commit
8e43147075
@@ -66,6 +66,7 @@
|
||||
*/
|
||||
union nvdla_cmd_mem_list {
|
||||
struct dla_region_printf dont_use_me;
|
||||
u32 ping_dont_use_me;
|
||||
};
|
||||
|
||||
#define MAX_COMMANDS_PER_DEVICE 1
|
||||
|
||||
@@ -45,8 +45,6 @@
|
||||
(MAX_NUM_NVDLA_PREFENCES + MAX_NUM_NVDLA_POSTFENCES) * \
|
||||
sizeof(struct nvdla_fence)
|
||||
|
||||
static DEFINE_DMA_ATTRS(attrs);
|
||||
|
||||
/**
|
||||
* struct nvdla_private per unique FD private data
|
||||
* @pdev pointer to platform device
|
||||
@@ -119,8 +117,7 @@ nvdla_buffer_cpy_err:
|
||||
static int nvdla_ping(struct platform_device *pdev,
|
||||
struct nvdla_ping_args *args)
|
||||
{
|
||||
DEFINE_DMA_ATTRS(ping_attrs);
|
||||
dma_addr_t ping_pa;
|
||||
struct nvdla_cmd_mem_info ping_cmd_mem_info;
|
||||
u32 *ping_va;
|
||||
int err = 0;
|
||||
|
||||
@@ -132,15 +129,13 @@ static int nvdla_ping(struct platform_device *pdev,
|
||||
goto fail_to_on;
|
||||
}
|
||||
|
||||
/* allocate ping buffer */
|
||||
ping_va = dma_alloc_attrs(&pdev->dev,
|
||||
DEBUG_BUFFER_SIZE, &ping_pa,
|
||||
GFP_KERNEL, &ping_attrs);
|
||||
if (!ping_va) {
|
||||
/* assign ping cmd buffer */
|
||||
err = nvdla_get_cmd_memory(pdev, &ping_cmd_mem_info);
|
||||
if (err) {
|
||||
nvdla_dbg_err(pdev, "dma memory allocation failed for ping");
|
||||
err = -ENOMEM;
|
||||
goto fail_to_alloc;
|
||||
}
|
||||
ping_va = ping_cmd_mem_info.va;
|
||||
|
||||
/* pass ping value to falcon */
|
||||
*ping_va = args->in_challenge;
|
||||
@@ -148,7 +143,8 @@ static int nvdla_ping(struct platform_device *pdev,
|
||||
nvdla_dbg_info(pdev, "ping challenge [%d]", *ping_va);
|
||||
|
||||
/* send ping cmd */
|
||||
err = nvdla_send_cmd(pdev, DLA_CMD_PING, ALIGNED_DMA(ping_pa), true);
|
||||
err = nvdla_send_cmd(pdev, DLA_CMD_PING,
|
||||
ALIGNED_DMA(ping_cmd_mem_info.pa), true);
|
||||
if (err) {
|
||||
nvdla_dbg_err(pdev, "failed to send ping command");
|
||||
goto fail_cmd;
|
||||
@@ -165,9 +161,7 @@ static int nvdla_ping(struct platform_device *pdev,
|
||||
}
|
||||
|
||||
fail_cmd:
|
||||
if (ping_va)
|
||||
dma_free_attrs(&pdev->dev, DEBUG_BUFFER_SIZE,
|
||||
ping_va, ping_pa, &attrs);
|
||||
nvdla_put_cmd_memory(pdev, ping_cmd_mem_info.index);
|
||||
fail_to_alloc:
|
||||
nvhost_module_idle(pdev);
|
||||
fail_to_on:
|
||||
|
||||
Reference in New Issue
Block a user