Skip to contentSkip to conversation

spl: Fix compilation warnings for arm64

PATCH New Michal Simek 2 participants 5 messages Jul 15, 2016 – Jul 22, 2016 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spl: Fix compilation warnings for arm64

Make code 64bit aware.

Warnings:
+../arch/arm/lib/spl.c: In function ?jump_to_image_linux?:
+../arch/arm/lib/spl.c:63:3: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] +../common/spl/spl_fat.c: In function ?spl_load_image_fat?:
+../common/spl/spl_fat.c:91:33: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

---

 arch/arm/lib/spl.c   | 2 +-
 common/spl/spl_fat.c | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
arch/arm/lib/spl.c +1 -1
index e42886840ed6..c1b85340fad6 100644
@@ -60,7 +60,7 @@ void __noreturn jump_to_image_linux(void *arg)
 	typedef void (*image_entry_arg_t)(int, int, void *)
 		__attribute__ ((noreturn));
 	image_entry_arg_t image_entry =
-		(image_entry_arg_t) spl_image.entry_point;
+		(image_entry_arg_t)(uintptr_t) spl_image.entry_point;
 	cleanup_before_linux();
 	image_entry(0, machid, arg);
 }
common/spl/spl_fat.c +2 -1
index db676186d354..73d33f54fc13 100644
@@ -88,7 +88,8 @@ int spl_load_image_fat(struct blk_desc *block_dev,
 		if (err)
 			goto end;
 
-		err = file_fat_read(filename, (u8 *)spl_image.load_addr, 0);
+		err = file_fat_read(filename,
+				    (u8 *)(uintptr_t)spl_image.load_addr, 0);
 	}
 
 end:
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 spl: Fix compilation warnings for arm64

Hi Michal,

Quoted 10 lines · Michal Simek

Make code 64bit aware.

Warnings:
+../arch/arm/lib/spl.c: In function ?jump_to_image_linux?:
+../arch/arm/lib/spl.c:63:3: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] +../common/spl/spl_fat.c: In function ?spl_load_image_fat?:
+../common/spl/spl_fat.c:91:33: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

Quoted 6 lines

---

 arch/arm/lib/spl.c   | 2 +-
 common/spl/spl_fat.c | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

You could use map_sysmem() / unmap_sysmem() to convert a ulong address into a pointer.

Quoted 31 lines
arch/arm/lib/spl.c +1 -1
index e42886840ed6..c1b85340fad6 100644
@@ -60,7 +60,7 @@ void __noreturn jump_to_image_linux(void *arg)
        typedef void (*image_entry_arg_t)(int, int, void *)
                __attribute__ ((noreturn));
        image_entry_arg_t image_entry =
-               (image_entry_arg_t) spl_image.entry_point;
+               (image_entry_arg_t)(uintptr_t) spl_image.entry_point;
        cleanup_before_linux();
        image_entry(0, machid, arg);
 }
common/spl/spl_fat.c +2 -2
index db676186d354..73d33f54fc13 100644
@@ -88,7 +88,8 @@ int spl_load_image_fat(struct blk_desc *block_dev,
                if (err)
                        goto end;
 
-               err = file_fat_read(filename, (u8 *)spl_image.load_addr, 0);
+               err = file_fat_read(filename,
+                                   (u8 *)(uintptr_t)spl_image.load_addr, 0);
        }
 
 end:
--

1.9.1

#2 lore raw

PATCH 1/1 spl: Fix compilation warnings for arm64

Hi Simon,

Quoted 16 lines · Simon Glass

Hi Michal,

Quoted 13 lines · Michal Simek

Make code 64bit aware.

Warnings:
+../arch/arm/lib/spl.c: In function ?jump_to_image_linux?:
+../arch/arm/lib/spl.c:63:3: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] +../common/spl/spl_fat.c: In function ?spl_load_image_fat?:
+../common/spl/spl_fat.c:91:33: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

---

Quoted 8 lines
Quoted 3 lines
 arch/arm/lib/spl.c   | 2 +-
 common/spl/spl_fat.c | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

You could use map_sysmem() / unmap_sysmem() to convert a ulong address into a pointer.

Isn't this used more for remapping with non zero length?
I see in the code that people are using it just for conversion but the question is if this is right usage.

Thanks,
Michal

#3 lore raw

PATCH 1/1 spl: Fix compilation warnings for arm64

Hi Michael,

Quoted 23 lines · Michal Simek

Hi Simon,

Quoted 20 lines · Simon Glass

Hi Michal,

Quoted 16 lines · Michal Simek

Make code 64bit aware.

Warnings:
+../arch/arm/lib/spl.c: In function ?jump_to_image_linux?:
+../arch/arm/lib/spl.c:63:3: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] +../common/spl/spl_fat.c: In function ?spl_load_image_fat?:
+../common/spl/spl_fat.c:91:33: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

---

 arch/arm/lib/spl.c   | 2 +-
 common/spl/spl_fat.c | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
Quoted 8 lines
Quoted 4 lines

You could use map_sysmem() / unmap_sysmem() to convert a ulong address into a pointer.

Isn't this used more for remapping with non zero length?
I see in the code that people are using it just for conversion but the question is if this is right usage.

You are supposed to unmap afterwards. Is that not possible?

Regards,
Simon

#4 lore raw

PATCH 1/1 spl: Fix compilation warnings for arm64

Quoted 28 lines · Simon Glass

Hi Michael,

Quoted 25 lines · Michal Simek

Hi Simon,

Quoted 22 lines · Simon Glass

Hi Michal,

Quoted 10 lines · Michal Simek

Make code 64bit aware.

Warnings:
+../arch/arm/lib/spl.c: In function ?jump_to_image_linux?:
+../arch/arm/lib/spl.c:63:3: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] +../common/spl/spl_fat.c: In function ?spl_load_image_fat?:
+../common/spl/spl_fat.c:91:33: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

Quoted 6 lines

---

 arch/arm/lib/spl.c   | 2 +-
 common/spl/spl_fat.c | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

You could use map_sysmem() / unmap_sysmem() to convert a ulong address into a pointer.

Isn't this used more for remapping with non zero length?
I see in the code that people are using it just for conversion but the question is if this is right usage.

You are supposed to unmap afterwards. Is that not possible?

The first one is __noreturn function. It means I can't see a way where to call unmap.

The second one is different. You want to only map that image and probably at the end you will jump to it. For error case I see that unmap should be called.
I will use the first version and moving to map_sysmem can be done later.

Thanks,
Michal