diff mbox

[v3] use an uint64_t for the max_sz parameter in load_image_targphys

Message ID 1331570005-18492-1-git-send-email-mark.langsdorf@calxeda.com
State New
Headers show

Commit Message

Mark Langsdorf March 12, 2012, 4:33 p.m. UTC
Allow load_image_targphys to load files on systems with more than 2G of
emulated memory by changing the max_sz parameter from an int to an
uint64_t.

Signed-off-by: Mark Langsdorf <mark.langsdorf@calxeda.com>
---
Changes from v2
	changed max_sz from target_phys_addr_t to uint64_t
Changes from v1
	changed max_sz from unsigned long to target_phys_addr_t
	returned size to an int to match get_image_size

 hw/loader.c |    2 +-
 hw/loader.h |    3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

Comments

Andreas Färber March 12, 2012, 4:47 p.m. UTC | #1
Am 12.03.2012 17:33, schrieb Mark Langsdorf:
> Allow load_image_targphys to load files on systems with more than 2G of
> emulated memory by changing the max_sz parameter from an int to an
> uint64_t.
> 
> Signed-off-by: Mark Langsdorf <mark.langsdorf@calxeda.com>

A very non-intrusive solution for allowing large theoretical limits.
I've skimmed through the callers and it looks fine.

Reviewed-by: Andreas Färber <afaerber@suse.de>

Independently David's off_t patch or a variation thereof would still be
needed to make use of the enlarged limit, wouldn't it? Image sizes
remain int here.

Andreas

> ---
> Changes from v2
> 	changed max_sz from target_phys_addr_t to uint64_t
> Changes from v1
> 	changed max_sz from unsigned long to target_phys_addr_t
> 	returned size to an int to match get_image_size
> 
>  hw/loader.c |    2 +-
>  hw/loader.h |    3 ++-
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/loader.c b/hw/loader.c
> index 415cdce..7d64113 100644
> --- a/hw/loader.c
> +++ b/hw/loader.c
> @@ -103,7 +103,7 @@ ssize_t read_targphys(const char *name,
>  
>  /* return the size or -1 if error */
>  int load_image_targphys(const char *filename,
> -			target_phys_addr_t addr, int max_sz)
> +                        target_phys_addr_t addr, uint64_t max_sz)
>  {
>      int size;
>  
> diff --git a/hw/loader.h b/hw/loader.h
> index fbcaba9..6da291e 100644
> --- a/hw/loader.h
> +++ b/hw/loader.h
> @@ -4,7 +4,8 @@
>  /* loader.c */
>  int get_image_size(const char *filename);
>  int load_image(const char *filename, uint8_t *addr); /* deprecated */
> -int load_image_targphys(const char *filename, target_phys_addr_t, int max_sz);
> +int load_image_targphys(const char *filename, target_phys_addr_t,
> +                        uint64_t max_sz);
>  int load_elf(const char *filename, uint64_t (*translate_fn)(void *, uint64_t),
>               void *translate_opaque, uint64_t *pentry, uint64_t *lowaddr,
>               uint64_t *highaddr, int big_endian, int elf_machine,
Alexander Graf March 12, 2012, 4:58 p.m. UTC | #2
On 12.03.2012, at 17:33, Mark Langsdorf wrote:

> Allow load_image_targphys to load files on systems with more than 2G of
> emulated memory by changing the max_sz parameter from an int to an
> uint64_t.
> 
> Signed-off-by: Mark Langsdorf <mark.langsdorf@calxeda.com>

Looks good to me.

Acked-by: Alexander Graf <agraf@suse.de>


Alex
Peter Maydell March 12, 2012, 5:13 p.m. UTC | #3
On 12 March 2012 16:47, Andreas Färber <afaerber@suse.de> wrote:
> A very non-intrusive solution for allowing large theoretical limits.
> I've skimmed through the callers and it looks fine.
>
> Reviewed-by: Andreas Färber <afaerber@suse.de>
>
> Independently David's off_t patch or a variation thereof would still be
> needed to make use of the enlarged limit, wouldn't it? Image sizes
> remain int here.

Yes. Also the arm_boot.c code is still passing things around in
int variables, which should be updated to use uint64_t. (The
arm_boot device tree code needs updating too, to check whether
the dtb is using 32 bit or 64 bit cell sizes for its RAM size).
I'm happy to put together a patch to do this at some point if
Mark doesn't already have one lined up.

-- PMM
Mark Langsdorf March 12, 2012, 5:23 p.m. UTC | #4
On 03/12/2012 12:13 PM, Peter Maydell wrote:
> On 12 March 2012 16:47, Andreas Färber <afaerber@suse.de> wrote:
>> A very non-intrusive solution for allowing large theoretical limits.
>> I've skimmed through the callers and it looks fine.
>>
>> Reviewed-by: Andreas Färber <afaerber@suse.de>
>>
>> Independently David's off_t patch or a variation thereof would still be
>> needed to make use of the enlarged limit, wouldn't it? Image sizes
>> remain int here.
> 
> Yes. Also the arm_boot.c code is still passing things around in
> int variables, which should be updated to use uint64_t. (The
> arm_boot device tree code needs updating too, to check whether
> the dtb is using 32 bit or 64 bit cell sizes for its RAM size).
> I'm happy to put together a patch to do this at some point if
> Mark doesn't already have one lined up.

I don't have one lined up for that.

--Mark Langsdorf
Calxeda, Inc.
Mark Langsdorf April 11, 2012, 8:48 p.m. UTC | #5
On 03/12/2012 11:47 AM, Andreas Färber wrote:
> Am 12.03.2012 17:33, schrieb Mark Langsdorf:
>> Allow load_image_targphys to load files on systems with more than 2G of
>> emulated memory by changing the max_sz parameter from an int to an
>> uint64_t.
>>
>> Signed-off-by: Mark Langsdorf <mark.langsdorf@calxeda.com>
> 
> A very non-intrusive solution for allowing large theoretical limits.
> I've skimmed through the callers and it looks fine.
> 
> Reviewed-by: Andreas Färber <afaerber@suse.de>
> 
> Independently David's off_t patch or a variation thereof would still be
> needed to make use of the enlarged limit, wouldn't it? Image sizes
> remain int here.

I did some testing and this patch hasn't been picked up. Is there any
schedule for when I should expect it to be added?
Thanks.

--Mark Langsdorf
Calxeda, Inc.

>> ---
>> Changes from v2
>> 	changed max_sz from target_phys_addr_t to uint64_t
>> Changes from v1
>> 	changed max_sz from unsigned long to target_phys_addr_t
>> 	returned size to an int to match get_image_size
>>
>>  hw/loader.c |    2 +-
>>  hw/loader.h |    3 ++-
>>  2 files changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/hw/loader.c b/hw/loader.c
>> index 415cdce..7d64113 100644
>> --- a/hw/loader.c
>> +++ b/hw/loader.c
>> @@ -103,7 +103,7 @@ ssize_t read_targphys(const char *name,
>>  
>>  /* return the size or -1 if error */
>>  int load_image_targphys(const char *filename,
>> -			target_phys_addr_t addr, int max_sz)
>> +                        target_phys_addr_t addr, uint64_t max_sz)
>>  {
>>      int size;
>>  
>> diff --git a/hw/loader.h b/hw/loader.h
>> index fbcaba9..6da291e 100644
>> --- a/hw/loader.h
>> +++ b/hw/loader.h
>> @@ -4,7 +4,8 @@
>>  /* loader.c */
>>  int get_image_size(const char *filename);
>>  int load_image(const char *filename, uint8_t *addr); /* deprecated */
>> -int load_image_targphys(const char *filename, target_phys_addr_t, int max_sz);
>> +int load_image_targphys(const char *filename, target_phys_addr_t,
>> +                        uint64_t max_sz);
>>  int load_elf(const char *filename, uint64_t (*translate_fn)(void *, uint64_t),
>>               void *translate_opaque, uint64_t *pentry, uint64_t *lowaddr,
>>               uint64_t *highaddr, int big_endian, int elf_machine,
>
Alexander Graf April 17, 2012, 9:45 a.m. UTC | #6
On 04/11/2012 10:48 PM, Mark Langsdorf wrote:
> On 03/12/2012 11:47 AM, Andreas Färber wrote:
>> Am 12.03.2012 17:33, schrieb Mark Langsdorf:
>>> Allow load_image_targphys to load files on systems with more than 2G of
>>> emulated memory by changing the max_sz parameter from an int to an
>>> uint64_t.
>>>
>>> Signed-off-by: Mark Langsdorf<mark.langsdorf@calxeda.com>
>> A very non-intrusive solution for allowing large theoretical limits.
>> I've skimmed through the callers and it looks fine.
>>
>> Reviewed-by: Andreas Färber<afaerber@suse.de>
>>
>> Independently David's off_t patch or a variation thereof would still be
>> needed to make use of the enlarged limit, wouldn't it? Image sizes
>> remain int here.
> I did some testing and this patch hasn't been picked up. Is there any
> schedule for when I should expect it to be added?
> Thanks.

Acked-by: Alexander Graf <agraf@suse.de>

Anthony, mind to pick it up?


Alex
diff mbox

Patch

diff --git a/hw/loader.c b/hw/loader.c
index 415cdce..7d64113 100644
--- a/hw/loader.c
+++ b/hw/loader.c
@@ -103,7 +103,7 @@  ssize_t read_targphys(const char *name,
 
 /* return the size or -1 if error */
 int load_image_targphys(const char *filename,
-			target_phys_addr_t addr, int max_sz)
+                        target_phys_addr_t addr, uint64_t max_sz)
 {
     int size;
 
diff --git a/hw/loader.h b/hw/loader.h
index fbcaba9..6da291e 100644
--- a/hw/loader.h
+++ b/hw/loader.h
@@ -4,7 +4,8 @@ 
 /* loader.c */
 int get_image_size(const char *filename);
 int load_image(const char *filename, uint8_t *addr); /* deprecated */
-int load_image_targphys(const char *filename, target_phys_addr_t, int max_sz);
+int load_image_targphys(const char *filename, target_phys_addr_t,
+                        uint64_t max_sz);
 int load_elf(const char *filename, uint64_t (*translate_fn)(void *, uint64_t),
              void *translate_opaque, uint64_t *pentry, uint64_t *lowaddr,
              uint64_t *highaddr, int big_endian, int elf_machine,