From 4b28dda3dc83c249ae8ef66b9d59e2abcc923d3f Mon Sep 17 00:00:00 2001
From: David Marchand <david.marchand@6wind.com>
Date: Fri, 28 Feb 2014 09:21:35 +0100
Subject: [PATCH] mem: fix build of virtual address hinting for 32-bit
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit

The initial commit doesn't build for 32-bit:
8ea9ff83 (mem: allow virtual memory address hinting)

lib/librte_eal/linuxapp/eal/eal.c: In function ‘eal_parse_base_virtaddr’:
build/include/rte_common.h:133:22:
error: cast from pointer to integer of different size
[-Werror=pointer-to-int-cast]
  RTE_PTR_ALIGN_FLOOR((typeof(ptr))RTE_PTR_ADD(ptr, (align) - 1), align)
                      ^

RTE_PTR_ALIGN_CEIL return type is the same as what we give it as input.
So instead of casting the returned value, cast 'addr' which should be the same
as base_virtaddr.

Reported-by: Mats Liljegren <mats.liljegren@enea.com>
Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
 lib/librte_eal/linuxapp/eal/eal.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index db0e15cf98..72b4dd7b13 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -563,9 +563,9 @@ eal_parse_base_virtaddr(const char *arg)
 #endif
 
 	/* align the addr on 2M boundary */
-	addr = RTE_PTR_ALIGN_CEIL(addr, RTE_PGSIZE_2M);
+	internal_config.base_virtaddr = RTE_PTR_ALIGN_CEIL((uintptr_t)addr,
+	                                                   RTE_PGSIZE_2M);
 
-	internal_config.base_virtaddr = (uintptr_t) addr;
 	return 0;
 }
 
-- 
2.39.5