* [meta-fsl-arm][PATCH] imx-vpu: fix checks of IOGetVirtMem() return value
@ 2014-06-21 17:52 Eric Nelson
2014-06-25 16:18 ` Otavio Salvador
2014-06-28 14:45 ` Lauren Post
0 siblings, 2 replies; 7+ messages in thread
From: Eric Nelson @ 2014-06-21 17:52 UTC (permalink / raw)
To: meta-freescale
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.
Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com>
---
...etVirtMem-returns-1-MAP_FAILED-on-failure.patch | 81 ++++++++++++++++++++++
recipes-bsp/imx-vpu/imx-vpu_3.10.17-1.0.0.bb | 2 +
2 files changed, 83 insertions(+)
create mode 100644 recipes-bsp/imx-vpu/imx-vpu/0001-IOGetVirtMem-returns-1-MAP_FAILED-on-failure.patch
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..26826ba
--- /dev/null
+++ b/recipes-bsp/imx-vpu/imx-vpu/0001-IOGetVirtMem-returns-1-MAP_FAILED-on-failure.patch
@@ -0,0 +1,81 @@
+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
+
+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)"
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [meta-fsl-arm][PATCH] imx-vpu: fix checks of IOGetVirtMem() return value
2014-06-21 17:52 [meta-fsl-arm][PATCH] imx-vpu: fix checks of IOGetVirtMem() return value Eric Nelson
@ 2014-06-25 16:18 ` Otavio Salvador
2014-06-25 16:22 ` Eric Nelson
2014-06-26 0:22 ` Lauren Post
2014-06-28 14:45 ` Lauren Post
1 sibling, 2 replies; 7+ messages in thread
From: Otavio Salvador @ 2014-06-25 16:18 UTC (permalink / raw)
To: Eric Nelson, Lauren Post; +Cc: meta-freescale@yoctoproject.org
Hello Eric,
Hello Lauren,
On Sat, Jun 21, 2014 at 2:52 PM, Eric Nelson
<eric.nelson@boundarydevices.com> wrote:
> 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.
>
> Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com>
Eric, you forgot the add the upstream-status field as:
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
index 26826ba..348a536 100644
--- 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
@@ -3,6 +3,8 @@ 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 +-
I have done it here, so no need to resend it but please do it next time.
Lauren, this patch should be reviewed internally.
--
Otavio Salvador O.S. Systems
http://www.ossystems.com.br http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854 Mobile: +1 (347) 903-9750
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [meta-fsl-arm][PATCH] imx-vpu: fix checks of IOGetVirtMem() return value
2014-06-25 16:18 ` Otavio Salvador
@ 2014-06-25 16:22 ` Eric Nelson
2014-06-26 0:22 ` Lauren Post
1 sibling, 0 replies; 7+ messages in thread
From: Eric Nelson @ 2014-06-25 16:22 UTC (permalink / raw)
To: Otavio Salvador, Lauren Post; +Cc: meta-freescale@yoctoproject.org
On 06/25/2014 09:18 AM, Otavio Salvador wrote:
> Hello Eric,
> Hello Lauren,
>
> On Sat, Jun 21, 2014 at 2:52 PM, Eric Nelson
> <eric.nelson@boundarydevices.com> wrote:
>> 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.
>>
>> Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com>
>
> Eric, you forgot the add the upstream-status field as:
>
> 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
> index 26826ba..348a536 100644
> --- 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
> @@ -3,6 +3,8 @@ 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 +-
>
> I have done it here, so no need to resend it but please do it next time.
>
Thanks Otavio.
> Lauren, this patch should be reviewed internally.
>
This should be a quick scan, since the routines are pretty simple.
Regards,
Eric
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [meta-fsl-arm][PATCH] imx-vpu: fix checks of IOGetVirtMem() return value
2014-06-25 16:18 ` Otavio Salvador
2014-06-25 16:22 ` Eric Nelson
@ 2014-06-26 0:22 ` Lauren Post
2014-06-26 1:03 ` Eric Nelson
1 sibling, 1 reply; 7+ messages in thread
From: Lauren Post @ 2014-06-26 0:22 UTC (permalink / raw)
To: Otavio Salvador, Eric Nelson; +Cc: meta-freescale@yoctoproject.org
>>Lauren, this patch should be reviewed internally.
I've forwarded it to the ownwers of imx-vpu to review. Sorry I missed this last weekend.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [meta-fsl-arm][PATCH] imx-vpu: fix checks of IOGetVirtMem() return value
2014-06-26 0:22 ` Lauren Post
@ 2014-06-26 1:03 ` Eric Nelson
0 siblings, 0 replies; 7+ messages in thread
From: Eric Nelson @ 2014-06-26 1:03 UTC (permalink / raw)
To: Lauren Post, Otavio Salvador; +Cc: meta-freescale@yoctoproject.org
On 06/25/2014 05:22 PM, Lauren Post wrote:
>
>>> Lauren, this patch should be reviewed internally.
>
> I've forwarded it to the ownwers of imx-vpu to review. Sorry I missed this last weekend.
>
Thanks Lauren.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [meta-fsl-arm][PATCH] imx-vpu: fix checks of IOGetVirtMem() return value
2014-06-21 17:52 [meta-fsl-arm][PATCH] imx-vpu: fix checks of IOGetVirtMem() return value Eric Nelson
2014-06-25 16:18 ` Otavio Salvador
@ 2014-06-28 14:45 ` Lauren Post
2014-06-28 15:48 ` Eric Nelson
1 sibling, 1 reply; 7+ messages in thread
From: Lauren Post @ 2014-06-28 14:45 UTC (permalink / raw)
To: Eric Nelson, meta-freescale@yoctoproject.org
The patch is good. Team said they'll push it into our upcoming beta release.
-----Original Message-----
From: meta-freescale-bounces@yoctoproject.org [mailto:meta-freescale-bounces@yoctoproject.org] On Behalf Of Eric Nelson
Sent: Saturday, June 21, 2014 12:53 PM
To: meta-freescale@yoctoproject.org
Subject: [meta-freescale] [meta-fsl-arm][PATCH] 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.
Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com>
---
...etVirtMem-returns-1-MAP_FAILED-on-failure.patch | 81 ++++++++++++++++++++++
recipes-bsp/imx-vpu/imx-vpu_3.10.17-1.0.0.bb | 2 +
2 files changed, 83 insertions(+)
create mode 100644 recipes-bsp/imx-vpu/imx-vpu/0001-IOGetVirtMem-returns-1-MAP_FAILED-on-failure.patch
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..26826ba
--- /dev/null
+++ b/recipes-bsp/imx-vpu/imx-vpu/0001-IOGetVirtMem-returns-1-MAP_FAILED
+++ -on-failure.patch
@@ -0,0 +1,81 @@
+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
+
+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)"
--
1.9.1
--
_______________________________________________
meta-freescale mailing list
meta-freescale@yoctoproject.org
https://lists.yoctoproject.org/listinfo/meta-freescale
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [meta-fsl-arm][PATCH] imx-vpu: fix checks of IOGetVirtMem() return value
2014-06-28 14:45 ` Lauren Post
@ 2014-06-28 15:48 ` Eric Nelson
0 siblings, 0 replies; 7+ messages in thread
From: Eric Nelson @ 2014-06-28 15:48 UTC (permalink / raw)
To: Lauren Post, meta-freescale@yoctoproject.org
Thanks Lauren.
On 06/28/2014 07:45 AM, Lauren Post wrote:
> The patch is good. Team said they'll push it into our upcoming beta release.
>
> -----Original Message-----
> From: meta-freescale-bounces@yoctoproject.org [mailto:meta-freescale-bounces@yoctoproject.org] On Behalf Of Eric Nelson
> Sent: Saturday, June 21, 2014 12:53 PM
> To: meta-freescale@yoctoproject.org
> Subject: [meta-freescale] [meta-fsl-arm][PATCH] 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.
>
> Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com>
> ---
> ...etVirtMem-returns-1-MAP_FAILED-on-failure.patch | 81 ++++++++++++++++++++++
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-06-28 15:48 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-21 17:52 [meta-fsl-arm][PATCH] imx-vpu: fix checks of IOGetVirtMem() return value Eric Nelson
2014-06-25 16:18 ` Otavio Salvador
2014-06-25 16:22 ` Eric Nelson
2014-06-26 0:22 ` Lauren Post
2014-06-26 1:03 ` Eric Nelson
2014-06-28 14:45 ` Lauren Post
2014-06-28 15:48 ` Eric Nelson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.