diff options
author | Gary King <gking@nvidia.com> | 2010-02-17 09:17:44 -0800 |
---|---|---|
committer | Gary King <gking@nvidia.com> | 2010-02-17 14:32:31 -0800 |
commit | 2bf197dc9780028c7d160750a65163cb419e91c8 (patch) | |
tree | 7af908676b7d5245557b9e7bacfc31166480cbca /arch/arm/mach-tegra/nvos | |
parent | 7e7449fe722791d5ec61eb705881248154954965 (diff) |
nvrm transport: eliminate double-copying of messages
with the change to allocate messages < MAX_SIZE on the stack
inside the dispatcher, there were actually 2 on-stack copies
of the message being maintained: one in the dispatcher, and
one in the RM transport code itself.
the transport code copied the message in order to prepend
a 3-word header; however, since the entire message was then
copied into a memory handle to send it to the AVP, the
internal copy is unnecessary; the message header can be
written directly to the memory handle and then the buffer
provided by the dispatcher can be copied directly into
the memory handle
Change-Id: I3a748192d7e45445bc821456e170670cc3fb0e98
Diffstat (limited to 'arch/arm/mach-tegra/nvos')
-rw-r--r-- | arch/arm/mach-tegra/nvos/nvos.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/arch/arm/mach-tegra/nvos/nvos.c b/arch/arm/mach-tegra/nvos/nvos.c index 3e98dfc03063..08f30ebb0d2f 100644 --- a/arch/arm/mach-tegra/nvos/nvos.c +++ b/arch/arm/mach-tegra/nvos/nvos.c @@ -349,9 +349,12 @@ void NvOsMemmove(void *dest, const void *src, size_t size) NvError NvOsCopyIn(void *pDst, const void *pSrc, size_t Bytes) { + if (!Bytes) + return NvSuccess; + if( access_ok( VERIFY_READ, pSrc, Bytes ) ) { - copy_from_user(pDst, pSrc, Bytes); + __copy_from_user(pDst, pSrc, Bytes); return NvSuccess; } @@ -360,9 +363,12 @@ NvError NvOsCopyIn(void *pDst, const void *pSrc, size_t Bytes) NvError NvOsCopyOut(void *pDst, const void *pSrc, size_t Bytes) { + if (!Bytes) + return NvSuccess; + if( access_ok( VERIFY_WRITE, pDst, Bytes ) ) { - copy_to_user(pDst, pSrc, Bytes); + __copy_to_user(pDst, pSrc, Bytes); return NvSuccess; } |