aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Nelson <eric.nelson@boundarydevices.com>2014-06-21 10:52:48 -0700
committerOtavio Salvador <otavio@ossystems.com.br>2014-06-25 14:21:11 -0300
commitb3cf9ce918cd4fcbc5c39ade47d384414ea590ed (patch)
tree34179c5b95d9bff13926b13945c7fad198bc13ca
parentf5bf277a5a5fba2c3b64ed7d2dbec1903d96386b (diff)
downloadmeta-fsl-arm-b3cf9ce918cd4fcbc5c39ade47d384414ea590ed.tar.gz
meta-fsl-arm-b3cf9ce918cd4fcbc5c39ade47d384414ea590ed.tar.bz2
meta-fsl-arm-b3cf9ce918cd4fcbc5c39ade47d384414ea590ed.zip
imx-vpu: fix checks of IOGetVirtMem() return value
The IOGetVirtMem() routine returns the address of a memory block or -1 (MAP_FAILED) to indicate an error. Many callers of this routine tested the return value for <= 0 to detect failure, and at least with a 3G/1G memory split configured in the kernel, a negative number (!= -1) is a valid (successful) return value. Without this patch, the IOSystemInit() will often detect failure incorrectly. Change-Id: I8b20ae5f74608307cbb810168024e8863599dbdb Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
-rw-r--r--recipes-bsp/imx-vpu/imx-vpu/0001-IOGetVirtMem-returns-1-MAP_FAILED-on-failure.patch83
-rw-r--r--recipes-bsp/imx-vpu/imx-vpu_3.10.17-1.0.0.bb2
2 files changed, 85 insertions, 0 deletions
diff --git a/recipes-bsp/imx-vpu/imx-vpu/0001-IOGetVirtMem-returns-1-MAP_FAILED-on-failure.patch b/recipes-bsp/imx-vpu/imx-vpu/0001-IOGetVirtMem-returns-1-MAP_FAILED-on-failure.patch
new file mode 100644
index 0000000..348a536
--- /dev/null
+++ b/recipes-bsp/imx-vpu/imx-vpu/0001-IOGetVirtMem-returns-1-MAP_FAILED-on-failure.patch
@@ -0,0 +1,83 @@
+From 3f3e374391ddc5e605f604e5bcdf95e29b1bcc39 Mon Sep 17 00:00:00 2001
+From: Eric Nelson <eric.nelson@boundarydevices.com>
+Date: Fri, 20 Jun 2014 19:42:38 -0700
+Subject: [PATCH] IOGetVirtMem returns -1 (MAP_FAILED) on failure
+
+Upstream-Status: Pending
+
+Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com>
+---
+ vpu/vpu_io.c | 2 +-
+ vpu/vpu_io.h | 2 ++
+ vpu/vpu_lib.c | 8 ++++----
+ 3 files changed, 7 insertions(+), 5 deletions(-)
+
+diff --git a/vpu/vpu_io.c b/vpu/vpu_io.c
+index 8cbb571..14759da 100644
+--- a/vpu/vpu_io.c
++++ b/vpu/vpu_io.c
+@@ -265,7 +265,7 @@ int IOSystemInit(void *callback)
+ goto err;
+ }
+
+- if (IOGetVirtMem(&bit_work_addr) <= 0)
++ if (IOGetVirtMem(&bit_work_addr) == -1)
+ goto err;
+ #endif
+ UnlockVpu(vpu_semap);
+diff --git a/vpu/vpu_io.h b/vpu/vpu_io.h
+index 392e04a..1e6340d 100644
+--- a/vpu/vpu_io.h
++++ b/vpu/vpu_io.h
+@@ -64,6 +64,8 @@ int IOSystemInit(void *callback);
+ int IOSystemShutdown(void);
+ int IOGetPhyMem(vpu_mem_desc * buff);
+ int IOFreePhyMem(vpu_mem_desc * buff);
++
++/* returns -1 ((int)MAP_FAILED) on failure */
+ int IOGetVirtMem(vpu_mem_desc * buff);
+ int IOFreeVirtMem(vpu_mem_desc * buff);
+ int IOGetVShareMem(int size);
+diff --git a/vpu/vpu_lib.c b/vpu/vpu_lib.c
+index 1fb731b..7a7f42d 100644
+--- a/vpu/vpu_lib.c
++++ b/vpu/vpu_lib.c
+@@ -1764,7 +1764,7 @@ RetCode vpu_EncStartOneFrame(EncHandle handle, EncParam * param)
+ err_msg("Unable to obtain physical mem\n");
+ return RETCODE_FAILURE;
+ }
+- if (IOGetVirtMem(&pEncInfo->picParaBaseMem) <= 0) {
++ if (IOGetVirtMem(&pEncInfo->picParaBaseMem) == -1) {
+ IOFreePhyMem(&pEncInfo->picParaBaseMem);
+ pEncInfo->picParaBaseMem.phy_addr = 0;
+ err_msg("Unable to obtain virtual mem\n");
+@@ -2982,7 +2982,7 @@ RetCode vpu_DecGetInitialInfo(DecHandle handle, DecInitialInfo * info)
+ UnlockVpu(vpu_semap);
+ return RETCODE_FAILURE;
+ }
+- if (IOGetVirtMem(&pDecInfo->userDataBufMem) <= 0) {
++ if (IOGetVirtMem(&pDecInfo->userDataBufMem) == -1) {
+ IOFreePhyMem(&pDecInfo->userDataBufMem);
+ pDecInfo->userDataBufMem.phy_addr = 0;
+ err_msg("Unable to obtain virtual mem\n");
+@@ -4017,7 +4017,7 @@ RetCode vpu_DecStartOneFrame(DecHandle handle, DecParam * param)
+ UnlockVpu(vpu_semap);
+ return RETCODE_FAILURE;
+ }
+- if (IOGetVirtMem(&pDecInfo->picParaBaseMem) <= 0) {
++ if (IOGetVirtMem(&pDecInfo->picParaBaseMem) == -1) {
+ IOFreePhyMem(&pDecInfo->picParaBaseMem);
+ pDecInfo->picParaBaseMem.phy_addr = 0;
+ err_msg("Unable to obtain virtual mem\n");
+@@ -4057,7 +4057,7 @@ RetCode vpu_DecStartOneFrame(DecHandle handle, DecParam * param)
+ UnlockVpu(vpu_semap);
+ return RETCODE_FAILURE;
+ }
+- if (IOGetVirtMem(&pDecInfo->userDataBufMem) <= 0) {
++ if (IOGetVirtMem(&pDecInfo->userDataBufMem) == -1) {
+ IOFreePhyMem(&pDecInfo->userDataBufMem);
+ pDecInfo->userDataBufMem.phy_addr = 0;
+ err_msg("Unable to obtain virtual mem\n");
+--
+1.9.1
+
diff --git a/recipes-bsp/imx-vpu/imx-vpu_3.10.17-1.0.0.bb b/recipes-bsp/imx-vpu/imx-vpu_3.10.17-1.0.0.bb
index ce07766..7ed9590 100644
--- a/recipes-bsp/imx-vpu/imx-vpu_3.10.17-1.0.0.bb
+++ b/recipes-bsp/imx-vpu/imx-vpu_3.10.17-1.0.0.bb
@@ -7,4 +7,6 @@ PE = "1"
SRC_URI[md5sum] = "71ea1b803864101ebf88a1bab45514d2"
SRC_URI[sha256sum] = "cd8a7bd50ff3274db76a331cc6622d3ba4bb7c790ce778f303e49187df2dfd72"
+SRC_URI_append = " file://0001-IOGetVirtMem-returns-1-MAP_FAILED-on-failure.patch"
+
COMPATIBLE_MACHINE = "(mx6)"