diff mbox

kvmtool/arm{,64}: fix ARM initrd functionality

Message ID 1410878272-9949-1-git-send-email-andre.przywara@arm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andre Przywara Sept. 16, 2014, 2:37 p.m. UTC
lkvm -i is currently broken on ARM/ARM64.
We should not try to convert smaller-than-4GB addresses into 64-bit
big endian and then stuff them into u32 variables if we expect to read
anything other than 0 out of it.
Adjust the type to u64 to write the proper address in BE format into
the /chosen node (and also match the address size we formely posted)
and let Linux thus read the right values.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
 tools/kvm/arm/fdt.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Marc Zyngier Sept. 16, 2014, 6:54 p.m. UTC | #1
On 2014-09-16 15:37, Andre Przywara wrote:
> lkvm -i is currently broken on ARM/ARM64.
> We should not try to convert smaller-than-4GB addresses into 64-bit
> big endian and then stuff them into u32 variables if we expect to 
> read
> anything other than 0 out of it.
> Adjust the type to u64 to write the proper address in BE format into
> the /chosen node (and also match the address size we formely posted)
> and let Linux thus read the right values.
>
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> ---
>  tools/kvm/arm/fdt.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/kvm/arm/fdt.c b/tools/kvm/arm/fdt.c
> index 186a718..1a76b07c 100644
> --- a/tools/kvm/arm/fdt.c
> +++ b/tools/kvm/arm/fdt.c
> @@ -119,8 +119,8 @@ static int setup_fdt(struct kvm *kvm)
>
>  	/* Initrd */
>  	if (kvm->arch.initrd_size != 0) {
> -		u32 ird_st_prop = cpu_to_fdt64(kvm->arch.initrd_guest_start);
> -		u32 ird_end_prop = cpu_to_fdt64(kvm->arch.initrd_guest_start +
> +		u64 ird_st_prop = cpu_to_fdt64(kvm->arch.initrd_guest_start);
> +		u64 ird_end_prop = cpu_to_fdt64(kvm->arch.initrd_guest_start +
>  					       kvm->arch.initrd_size);
>
>  		_FDT(fdt_property(fdt, "linux,initrd-start",

Who need an initrd anyway? ;-)

Acked-by: Marc Zyngier <marc.zyngier@arm.com>

         M.
diff mbox

Patch

diff --git a/tools/kvm/arm/fdt.c b/tools/kvm/arm/fdt.c
index 186a718..1a76b07c 100644
--- a/tools/kvm/arm/fdt.c
+++ b/tools/kvm/arm/fdt.c
@@ -119,8 +119,8 @@  static int setup_fdt(struct kvm *kvm)
 
 	/* Initrd */
 	if (kvm->arch.initrd_size != 0) {
-		u32 ird_st_prop = cpu_to_fdt64(kvm->arch.initrd_guest_start);
-		u32 ird_end_prop = cpu_to_fdt64(kvm->arch.initrd_guest_start +
+		u64 ird_st_prop = cpu_to_fdt64(kvm->arch.initrd_guest_start);
+		u64 ird_end_prop = cpu_to_fdt64(kvm->arch.initrd_guest_start +
 					       kvm->arch.initrd_size);
 
 		_FDT(fdt_property(fdt, "linux,initrd-start",