diff options
author | Victor(Weiguo) Pan <wpan@nvidia.com> | 2010-09-07 16:52:10 -0700 |
---|---|---|
committer | Yu-Huan Hsu <yhsu@nvidia.com> | 2010-09-21 22:19:38 -0700 |
commit | ae81447a26b98ef94f03db094ad8c77f719b35a9 (patch) | |
tree | dc334cf78a13e576295a61efc445a76480bf42d8 /arch/arm/mach-tegra/nvrm/dispatch | |
parent | 3dab0e0518e951e62ebcdceb9f170f304cb9d9b5 (diff) |
[ARM/Tegra] nvrm : Clean up user mode DMA handles
Nvrm exposes nvrm DMA APIs to allocate and use the DMA channel
from user mode. I2S (i.e audio HAL) is the main user of these
APIs. When the process that allocates the handles doesn't free-up
and crashes, RM reftracker driver will clean up the handles its
on-behalf. Same mechanism already exists for the mmeory handles.
bug 730003
Change-Id: Iceb5c3b6d22989463d184c90e25ab06f6979b5a4
Reviewed-on: http://git-master.nvidia.com/r/7013
Tested-by: Victor (Weiguo) Pan <wpan@nvidia.com>
Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>
Diffstat (limited to 'arch/arm/mach-tegra/nvrm/dispatch')
-rw-r--r-- | arch/arm/mach-tegra/nvrm/dispatch/nvrm_dma_dispatch.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/arch/arm/mach-tegra/nvrm/dispatch/nvrm_dma_dispatch.c b/arch/arm/mach-tegra/nvrm/dispatch/nvrm_dma_dispatch.c index ff246393b5ef..003e0329cfbf 100644 --- a/arch/arm/mach-tegra/nvrm/dispatch/nvrm_dma_dispatch.c +++ b/arch/arm/mach-tegra/nvrm/dispatch/nvrm_dma_dispatch.c @@ -260,7 +260,6 @@ static NvError NvRmDmaAbort_dispatch_( void *InBuffer, NvU32 InSize, void *OutBu p_in = (NvRmDmaAbort_in *)InBuffer; - NvRmDmaAbort( p_in->hDma ); return err_; @@ -300,6 +299,7 @@ static NvError NvRmDmaFree_dispatch_( void *InBuffer, NvU32 InSize, void *OutBuf p_in = (NvRmDmaFree_in *)InBuffer; + if (p_in->hDma != NULL) NvRtFreeObjRef(Ctx, NvRtObjType_NvRm_NvRmDmaHandle, p_in->hDma); NvRmDmaFree( p_in->hDma ); @@ -311,12 +311,25 @@ static NvError NvRmDmaAllocate_dispatch_( void *InBuffer, NvU32 InSize, void *Ou NvError err_ = NvSuccess; NvRmDmaAllocate_in *p_in; NvRmDmaAllocate_out *p_out; + NvRtObjRefHandle ref_phDma = 0; p_in = (NvRmDmaAllocate_in *)InBuffer; p_out = (NvRmDmaAllocate_out *)((NvU8 *)OutBuffer + OFFSET(NvRmDmaAllocate_params, out) - OFFSET(NvRmDmaAllocate_params, inout)); + err_ = NvRtAllocObjRef(Ctx, &ref_phDma); + if (err_ != NvSuccess) + { + goto clean; + } p_out->ret_ = NvRmDmaAllocate( p_in->hRmDevice, &p_out->phDma, p_in->Enable32bitSwap, p_in->Priority, p_in->DmaRequestorModuleId, p_in->DmaRequestorInstanceId ); + if ( p_out->ret_ == NvSuccess ) + { + NvRtStoreObjRef(Ctx, ref_phDma, NvRtObjType_NvRm_NvRmDmaHandle, p_out->phDma); + ref_phDma = 0; + } +clean: + if (ref_phDma) NvRtDiscardObjRef(Ctx, ref_phDma); return err_; } @@ -330,7 +343,6 @@ static NvError NvRmDmaGetCapabilities_dispatch_( void *InBuffer, NvU32 InSize, v p_in = (NvRmDmaGetCapabilities_in *)InBuffer; p_out = (NvRmDmaGetCapabilities_out *)((NvU8 *)OutBuffer + OFFSET(NvRmDmaGetCapabilities_params, out) - OFFSET(NvRmDmaGetCapabilities_params, inout)); - p_out->ret_ = NvRmDmaGetCapabilities( p_in->hDevice, &p_in->pRmDmaCaps ); return err_; |