Re: [Qemu-devel] [PATCH] s390x: initialize virtio dev region

2011-11-11 Thread Andreas Färber
Am 11.11.2011 18:40, schrieb Alexander Graf: > On 11/11/2011 05:44 PM, Peter Maydell wrote: >> On 11 November 2011 16:24, Alexander Graf wrote: >>> On 11/11/2011 05:11 PM, Peter Maydell wrote: Yes, so that's option (2) and you need to be using a target_phys_addr_t. >>> But ram_size is ra

Re: [Qemu-devel] [PATCH] s390x: initialize virtio dev region

2011-11-11 Thread Peter Maydell
On 11 November 2011 17:40, Alexander Graf wrote: > Or actually rather this one: > > > Alex > > diff --git a/hw/s390-virtio.c b/hw/s390-virtio.c > index d936809..61b67e8 100644 > --- a/hw/s390-virtio.c > +++ b/hw/s390-virtio.c > @@ -167,6 +167,7 @@ static void s390_init(ram_addr_t my_ram_size, >  

Re: [Qemu-devel] [PATCH] s390x: initialize virtio dev region

2011-11-11 Thread Alexander Graf
On 11/11/2011 05:44 PM, Peter Maydell wrote: On 11 November 2011 16:24, Alexander Graf wrote: On 11/11/2011 05:11 PM, Peter Maydell wrote: Yes, so that's option (2) and you need to be using a target_phys_addr_t. But ram_size is ram_addr_t and is the ram size that I have available to use, so i

Re: [Qemu-devel] [PATCH] s390x: initialize virtio dev region

2011-11-11 Thread Alexander Graf
On 11/11/2011 05:44 PM, Peter Maydell wrote: On 11 November 2011 16:24, Alexander Graf wrote: On 11/11/2011 05:11 PM, Peter Maydell wrote: Yes, so that's option (2) and you need to be using a target_phys_addr_t. But ram_size is ram_addr_t and is the ram size that I have available to use, so i

Re: [Qemu-devel] [PATCH] s390x: initialize virtio dev region

2011-11-11 Thread Alexander Graf
On 11/11/2011 05:44 PM, Peter Maydell wrote: On 11 November 2011 16:24, Alexander Graf wrote: On 11/11/2011 05:11 PM, Peter Maydell wrote: Yes, so that's option (2) and you need to be using a target_phys_addr_t. But ram_size is ram_addr_t and is the ram size that I have available to use, so i

Re: [Qemu-devel] [PATCH] s390x: initialize virtio dev region

2011-11-11 Thread Peter Maydell
On 11 November 2011 16:24, Alexander Graf wrote: > On 11/11/2011 05:11 PM, Peter Maydell wrote: >> Yes, so that's option (2) and you need to be using a target_phys_addr_t. > > But ram_size is ram_addr_t and is the ram size that I have available to use, > so it's exactly the address that I want. I

Re: [Qemu-devel] [PATCH] s390x: initialize virtio dev region

2011-11-11 Thread Alexander Graf
On 11/11/2011 05:11 PM, Peter Maydell wrote: On 11 November 2011 15:59, Alexander Graf wrote: This is the machine init function. The s390 virtio machine's ram layout is defined to be exactly as I posted in the previous post. So there won't be any ram starts at != 0 or multiple mappings :). Tha

Re: [Qemu-devel] [PATCH] s390x: initialize virtio dev region

2011-11-11 Thread Peter Maydell
On 11 November 2011 15:59, Alexander Graf wrote: > This is the machine init function. The s390 virtio machine's ram layout is > defined to be exactly as I posted in the previous post. So there won't be > any ram starts at != 0 or multiple mappings :). That's the layout of the RAM in target_phys_a

Re: [Qemu-devel] [PATCH] s390x: initialize virtio dev region

2011-11-11 Thread Alexander Graf
On 11/10/2011 03:19 AM, Peter Maydell wrote: On 10 November 2011 01:45, Alexander Graf wrote: On 10.11.2011, at 02:36, Peter Maydell wrote: This looks a bit fishy -- cpu_physical_memory_map() takes a target_phys_addr_t but you're passing it a ram_addr_t. Meh. Always those types ... :) In the

Re: [Qemu-devel] [PATCH] s390x: initialize virtio dev region

2011-11-09 Thread Peter Maydell
On 10 November 2011 01:45, Alexander Graf wrote: > On 10.11.2011, at 02:36, Peter Maydell wrote: >> This looks a bit fishy -- cpu_physical_memory_map() takes a >> target_phys_addr_t but you're passing it a ram_addr_t. > > Meh. Always those types ... :) In the simple case ("ram starts at 0, not mu

Re: [Qemu-devel] [PATCH] s390x: initialize virtio dev region

2011-11-09 Thread Alexander Graf
On 10.11.2011, at 02:36, Peter Maydell wrote: > On 10 November 2011 01:19, Alexander Graf wrote: >> @@ -184,6 +186,13 @@ static void s390_init(ram_addr_t my_ram_size, >> memory_region_init_ram(ram, NULL, "s390.ram", my_ram_size); >> memory_region_add_subregion(sysmem, 0, ram); >> >> +

Re: [Qemu-devel] [PATCH] s390x: initialize virtio dev region

2011-11-09 Thread Peter Maydell
On 10 November 2011 01:19, Alexander Graf wrote: > @@ -184,6 +186,13 @@ static void s390_init(ram_addr_t my_ram_size, >     memory_region_init_ram(ram, NULL, "s390.ram", my_ram_size); >     memory_region_add_subregion(sysmem, 0, ram); > > +    /* clear virtio region */ > +    virtio_region_len = m

[Qemu-devel] [PATCH] s390x: initialize virtio dev region

2011-11-09 Thread Alexander Graf
When running the s390x virtio machine we can potentially use uninitialized memory for the virtio device backing ram. That can lead to weird breakge. So let's better initialize it to 0 properly. Reported-by: Andreas Färber Signed-off-by: Alexander Graf --- hw/s390-virtio.c |9 + 1 f