diff mbox

Fix vmstate_register_ram() for rom/device regions

Message ID 1326025876-13241-1-git-send-email-avi@redhat.com
State New
Headers show

Commit Message

Avi Kivity Jan. 8, 2012, 12:31 p.m. UTC
rom/device regions have a ram_addr that is composed of both an I/O handler
(low bits) and RAM region (high bits); but qemu_ram_set_idstr() excepts just
a RAM region.  Mask the I/O handler to make it happy.

Signed-off-by: Avi Kivity <avi@redhat.com>
---
 savevm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Stefan Weil Jan. 8, 2012, 1 p.m. UTC | #1
Am 08.01.2012 13:31, schrieb Avi Kivity:
> rom/device regions have a ram_addr that is composed of both an I/O handler
> (low bits) and RAM region (high bits); but qemu_ram_set_idstr() 
> excepts just
> a RAM region. Mask the I/O handler to make it happy.
>
> Signed-off-by: Avi Kivity <avi@redhat.com>
> ---
> savevm.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/savevm.c b/savevm.c
> index 88c4bd8..80be1ff 100644
> --- a/savevm.c
> +++ b/savevm.c
> @@ -2284,7 +2284,7 @@ void do_info_snapshots(Monitor *mon)
>
> void vmstate_register_ram(MemoryRegion *mr, DeviceState *dev)
> {
> - qemu_ram_set_idstr(memory_region_get_ram_addr(mr),
> + qemu_ram_set_idstr(memory_region_get_ram_addr(mr) & TARGET_PAGE_MASK,
> memory_region_name(mr), dev);
> }
>

This patch fixes the assertion with flash memory (for example Mips Malta).

Tested-by: Stefan Weil <sw@weilnetz.de>
Andreas Färber Jan. 8, 2012, 3:50 p.m. UTC | #2
Am 08.01.2012 13:31, schrieb Avi Kivity:
> rom/device regions have a ram_addr that is composed of both an I/O handler
> (low bits) and RAM region (high bits); but qemu_ram_set_idstr() excepts just

expects :) - if you can still change it on your branch.

Andreas

> a RAM region.  Mask the I/O handler to make it happy.
> 
> Signed-off-by: Avi Kivity <avi@redhat.com>
> ---
>  savevm.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/savevm.c b/savevm.c
> index 88c4bd8..80be1ff 100644
> --- a/savevm.c
> +++ b/savevm.c
> @@ -2284,7 +2284,7 @@ void do_info_snapshots(Monitor *mon)
>  
>  void vmstate_register_ram(MemoryRegion *mr, DeviceState *dev)
>  {
> -    qemu_ram_set_idstr(memory_region_get_ram_addr(mr),
> +    qemu_ram_set_idstr(memory_region_get_ram_addr(mr) & TARGET_PAGE_MASK,
>                         memory_region_name(mr), dev);
>  }
>
Avi Kivity Jan. 8, 2012, 4:17 p.m. UTC | #3
On 01/08/2012 05:50 PM, Andreas Färber wrote:
> Am 08.01.2012 13:31, schrieb Avi Kivity:
> > rom/device regions have a ram_addr that is composed of both an I/O handler
> > (low bits) and RAM region (high bits); but qemu_ram_set_idstr() excepts just
>
> expects :) - if you can still change it on your branch.
>

Did so, hopefully Anthony will see the updated ref.
diff mbox

Patch

diff --git a/savevm.c b/savevm.c
index 88c4bd8..80be1ff 100644
--- a/savevm.c
+++ b/savevm.c
@@ -2284,7 +2284,7 @@  void do_info_snapshots(Monitor *mon)
 
 void vmstate_register_ram(MemoryRegion *mr, DeviceState *dev)
 {
-    qemu_ram_set_idstr(memory_region_get_ram_addr(mr),
+    qemu_ram_set_idstr(memory_region_get_ram_addr(mr) & TARGET_PAGE_MASK,
                        memory_region_name(mr), dev);
 }