Patchwork [PULL] memory core fixes

login
register
mail settings
Submitter Avi Kivity
Date Jan. 8, 2012, 2:01 p.m.
Message ID <4F09A1A2.7000205@redhat.com>
Download mbox | patch
Permalink /patch/134913/
State New
Headers show

Comments

Avi Kivity - Jan. 8, 2012, 2:01 p.m.
Please pull from

  git://git.kernel.org/pub/scm/virt/kvm/qemu-kvm.git memory/urgent

to receive fixes for recent memory core breakages.

Andreas Färber (2):
      memory: Fix memory_region_wrong_endianness()
      memory: Fix adjust_endianness()

Avi Kivity (2):
      kvm: fix build error in ppc kvm due to
memory_region_init_ram_ptr() change
      Fix vmstate_register_ram() for rom/device regions

 memory.c         |    3 ++-
 savevm.c         |    2 +-
 target-ppc/kvm.c |    3 ++-
 3 files changed, 5 insertions(+), 3 deletions(-)

     return size;
Anthony Liguori - Jan. 9, 2012, 2:51 p.m.
On 01/08/2012 08:01 AM, Avi Kivity wrote:
> Please pull from
>
>    git://git.kernel.org/pub/scm/virt/kvm/qemu-kvm.git memory/urgent
>
> to receive fixes for recent memory core breakages.

Pulled.  Thanks.

Regards,

Anthony Liguori

>
> Andreas Färber (2):
>        memory: Fix memory_region_wrong_endianness()
>        memory: Fix adjust_endianness()
>
> Avi Kivity (2):
>        kvm: fix build error in ppc kvm due to
> memory_region_init_ram_ptr() change
>        Fix vmstate_register_ram() for rom/device regions
>
>   memory.c         |    3 ++-
>   savevm.c         |    2 +-
>   target-ppc/kvm.c |    3 ++-
>   3 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/memory.c b/memory.c
> index 394cbab..5ab2112 100644
> --- a/memory.c
> +++ b/memory.c
> @@ -843,7 +843,7 @@ static void
> memory_region_destructor_rom_device(MemoryRegion *mr)
>
>   static bool memory_region_wrong_endianness(MemoryRegion *mr)
>   {
> -#ifdef TARGET_BIG_ENDIAN
> +#ifdef TARGET_WORDS_BIGENDIAN
>       return mr->ops->endianness == DEVICE_LITTLE_ENDIAN;
>   #else
>       return mr->ops->endianness == DEVICE_BIG_ENDIAN;
> @@ -942,6 +942,7 @@ static void adjust_endianness(MemoryRegion *mr,
> uint64_t *data, unsigned size)
>               break;
>           case 4:
>               *data = bswap32(*data);
> +            break;
>           default:
>               abort();
>           }
> 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);
>   }
>
> diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
> index 9b2e605..ce8ac5b 100644
> --- a/target-ppc/kvm.c
> +++ b/target-ppc/kvm.c
> @@ -822,7 +822,8 @@ off_t kvmppc_alloc_rma(const char *name,
> MemoryRegion *sysmem)
>       };
>
>       rma_region = g_new(MemoryRegion, 1);
> -    memory_region_init_ram_ptr(rma_region, NULL, name, size, rma);
> +    memory_region_init_ram_ptr(rma_region, name, size, rma);
> +    vmstate_register_ram_global(rma_region);
>       memory_region_add_subregion(sysmem, 0, rma_region);
>
>       return size;
>

Patch

diff --git a/memory.c b/memory.c
index 394cbab..5ab2112 100644
--- a/memory.c
+++ b/memory.c
@@ -843,7 +843,7 @@  static void
memory_region_destructor_rom_device(MemoryRegion *mr)
 
 static bool memory_region_wrong_endianness(MemoryRegion *mr)
 {
-#ifdef TARGET_BIG_ENDIAN
+#ifdef TARGET_WORDS_BIGENDIAN
     return mr->ops->endianness == DEVICE_LITTLE_ENDIAN;
 #else
     return mr->ops->endianness == DEVICE_BIG_ENDIAN;
@@ -942,6 +942,7 @@  static void adjust_endianness(MemoryRegion *mr,
uint64_t *data, unsigned size)
             break;
         case 4:
             *data = bswap32(*data);
+            break;
         default:
             abort();
         }
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);
 }
 
diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index 9b2e605..ce8ac5b 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -822,7 +822,8 @@  off_t kvmppc_alloc_rma(const char *name,
MemoryRegion *sysmem)
     };
 
     rma_region = g_new(MemoryRegion, 1);
-    memory_region_init_ram_ptr(rma_region, NULL, name, size, rma);
+    memory_region_init_ram_ptr(rma_region, name, size, rma);
+    vmstate_register_ram_global(rma_region);
     memory_region_add_subregion(sysmem, 0, rma_region);