qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] exec: Fix prototype of phys_mem_set_alloc and related functions
@ 2013-09-29 18:56 Stefan Weil
  2013-09-30  8:38 ` Markus Armbruster
  2013-10-14 14:32 ` Michael S. Tsirkin
  0 siblings, 2 replies; 3+ messages in thread
From: Stefan Weil @ 2013-09-29 18:56 UTC (permalink / raw)
  To: qemu-devel
  Cc: Stefan Weil, Richard Henderson, Markus Armbruster, Alexander Graf

phys_mem_alloc and its assigned values qemu_anon_ram_alloc and
legacy_s390_alloc must have identical argument lists.

legacy_s390_alloc uses the size parameter to call mmap, so size_t is
good enough for all of them.

This patch fixes compiler errors on i686 Linux hosts:

  CC    alpha-softmmu/exec.o
exec.c:752:51: error:
 initialization from incompatible pointer type [-Werror]
exec.c: In function 'qemu_ram_alloc_from_ptr':
exec.c:1139:32: error:
 comparison of distinct pointer types lacks a cast [-Werror]
exec.c: In function 'qemu_ram_remap':
exec.c:1283:21: error:
 comparison of distinct pointer types lacks a cast [-Werror]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
 exec.c                  |    4 ++--
 include/exec/exec-all.h |    2 +-
 target-s390x/kvm.c      |    4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/exec.c b/exec.c
index 26681ce..1a08115 100644
--- a/exec.c
+++ b/exec.c
@@ -749,14 +749,14 @@ static int subpage_register (subpage_t *mmio, uint32_t start, uint32_t end,
                              uint16_t section);
 static subpage_t *subpage_init(AddressSpace *as, hwaddr base);
 
-static void *(*phys_mem_alloc)(ram_addr_t size) = qemu_anon_ram_alloc;
+static void *(*phys_mem_alloc)(size_t size) = qemu_anon_ram_alloc;
 
 /*
  * Set a custom physical guest memory alloator.
  * Accelerators with unusual needs may need this.  Hopefully, we can
  * get rid of it eventually.
  */
-void phys_mem_set_alloc(void *(*alloc)(ram_addr_t))
+void phys_mem_set_alloc(void *(*alloc)(size_t))
 {
     phys_mem_alloc = alloc;
 }
diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
index 77242e2..50ecfd4 100644
--- a/include/exec/exec-all.h
+++ b/include/exec/exec-all.h
@@ -368,7 +368,7 @@ static inline uintptr_t tcg_getra_ext(uintptr_t ra)
 
 #if !defined(CONFIG_USER_ONLY)
 
-void phys_mem_set_alloc(void *(*alloc)(ram_addr_t));
+void phys_mem_set_alloc(void *(*alloc)(size_t));
 
 struct MemoryRegion *iotlb_to_region(hwaddr index);
 bool io_mem_read(struct MemoryRegion *mr, hwaddr addr,
diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c
index 4923e0a..d229bdf 100644
--- a/target-s390x/kvm.c
+++ b/target-s390x/kvm.c
@@ -93,7 +93,7 @@ const KVMCapabilityInfo kvm_arch_required_capabilities[] = {
 
 static int cap_sync_regs;
 
-static void *legacy_s390_alloc(ram_addr_t size);
+static void *legacy_s390_alloc(size_t size);
 
 int kvm_arch_init(KVMState *s)
 {
@@ -325,7 +325,7 @@ int kvm_s390_get_registers_partial(CPUState *cs)
  * to grow. We also have to use MAP parameters that avoid
  * read-only mapping of guest pages.
  */
-static void *legacy_s390_alloc(ram_addr_t size)
+static void *legacy_s390_alloc(size_t size)
 {
     void *mem;
 
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] exec: Fix prototype of phys_mem_set_alloc and related functions
  2013-09-29 18:56 [Qemu-devel] [PATCH] exec: Fix prototype of phys_mem_set_alloc and related functions Stefan Weil
@ 2013-09-30  8:38 ` Markus Armbruster
  2013-10-14 14:32 ` Michael S. Tsirkin
  1 sibling, 0 replies; 3+ messages in thread
From: Markus Armbruster @ 2013-09-30  8:38 UTC (permalink / raw)
  To: Stefan Weil; +Cc: Alexander Graf, qemu-devel, Richard Henderson

Stefan Weil <sw@weilnetz.de> writes:

> phys_mem_alloc and its assigned values qemu_anon_ram_alloc and
> legacy_s390_alloc must have identical argument lists.
>
> legacy_s390_alloc uses the size parameter to call mmap, so size_t is
> good enough for all of them.
>
> This patch fixes compiler errors on i686 Linux hosts:
>
>   CC    alpha-softmmu/exec.o
> exec.c:752:51: error:
>  initialization from incompatible pointer type [-Werror]
> exec.c: In function 'qemu_ram_alloc_from_ptr':
> exec.c:1139:32: error:
>  comparison of distinct pointer types lacks a cast [-Werror]
> exec.c: In function 'qemu_ram_remap':
> exec.c:1283:21: error:
>  comparison of distinct pointer types lacks a cast [-Werror]
>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>

Reviewed-by: Markus Armbruster <armbru@redhat.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] exec: Fix prototype of phys_mem_set_alloc and related functions
  2013-09-29 18:56 [Qemu-devel] [PATCH] exec: Fix prototype of phys_mem_set_alloc and related functions Stefan Weil
  2013-09-30  8:38 ` Markus Armbruster
@ 2013-10-14 14:32 ` Michael S. Tsirkin
  1 sibling, 0 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2013-10-14 14:32 UTC (permalink / raw)
  To: Stefan Weil
  Cc: Markus Armbruster, Alexander Graf, qemu-devel, Anthony Liguori,
	Richard Henderson

On Sun, Sep 29, 2013 at 08:56:45PM +0200, Stefan Weil wrote:
> phys_mem_alloc and its assigned values qemu_anon_ram_alloc and
> legacy_s390_alloc must have identical argument lists.
> 
> legacy_s390_alloc uses the size parameter to call mmap, so size_t is
> good enough for all of them.
> 
> This patch fixes compiler errors on i686 Linux hosts:
> 
>   CC    alpha-softmmu/exec.o
> exec.c:752:51: error:
>  initialization from incompatible pointer type [-Werror]
> exec.c: In function 'qemu_ram_alloc_from_ptr':
> exec.c:1139:32: error:
>  comparison of distinct pointer types lacks a cast [-Werror]
> exec.c: In function 'qemu_ram_remap':
> exec.c:1283:21: error:
>  comparison of distinct pointer types lacks a cast [-Werror]
> 
> Signed-off-by: Stefan Weil <sw@weilnetz.de>

Fixes build on 32 build boxes.

Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Michael S. Tsirkin <mst@redhat.com>

Anthony could you apply this quickly?
Broken builds are annoying ...

> ---
>  exec.c                  |    4 ++--
>  include/exec/exec-all.h |    2 +-
>  target-s390x/kvm.c      |    4 ++--
>  3 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/exec.c b/exec.c
> index 26681ce..1a08115 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -749,14 +749,14 @@ static int subpage_register (subpage_t *mmio, uint32_t start, uint32_t end,
>                               uint16_t section);
>  static subpage_t *subpage_init(AddressSpace *as, hwaddr base);
>  
> -static void *(*phys_mem_alloc)(ram_addr_t size) = qemu_anon_ram_alloc;
> +static void *(*phys_mem_alloc)(size_t size) = qemu_anon_ram_alloc;
>  
>  /*
>   * Set a custom physical guest memory alloator.
>   * Accelerators with unusual needs may need this.  Hopefully, we can
>   * get rid of it eventually.
>   */
> -void phys_mem_set_alloc(void *(*alloc)(ram_addr_t))
> +void phys_mem_set_alloc(void *(*alloc)(size_t))
>  {
>      phys_mem_alloc = alloc;
>  }
> diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
> index 77242e2..50ecfd4 100644
> --- a/include/exec/exec-all.h
> +++ b/include/exec/exec-all.h
> @@ -368,7 +368,7 @@ static inline uintptr_t tcg_getra_ext(uintptr_t ra)
>  
>  #if !defined(CONFIG_USER_ONLY)
>  
> -void phys_mem_set_alloc(void *(*alloc)(ram_addr_t));
> +void phys_mem_set_alloc(void *(*alloc)(size_t));
>  
>  struct MemoryRegion *iotlb_to_region(hwaddr index);
>  bool io_mem_read(struct MemoryRegion *mr, hwaddr addr,
> diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c
> index 4923e0a..d229bdf 100644
> --- a/target-s390x/kvm.c
> +++ b/target-s390x/kvm.c
> @@ -93,7 +93,7 @@ const KVMCapabilityInfo kvm_arch_required_capabilities[] = {
>  
>  static int cap_sync_regs;
>  
> -static void *legacy_s390_alloc(ram_addr_t size);
> +static void *legacy_s390_alloc(size_t size);
>  
>  int kvm_arch_init(KVMState *s)
>  {
> @@ -325,7 +325,7 @@ int kvm_s390_get_registers_partial(CPUState *cs)
>   * to grow. We also have to use MAP parameters that avoid
>   * read-only mapping of guest pages.
>   */
> -static void *legacy_s390_alloc(ram_addr_t size)
> +static void *legacy_s390_alloc(size_t size)
>  {
>      void *mem;
>  
> -- 
> 1.7.10.4
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-10-14 14:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-29 18:56 [Qemu-devel] [PATCH] exec: Fix prototype of phys_mem_set_alloc and related functions Stefan Weil
2013-09-30  8:38 ` Markus Armbruster
2013-10-14 14:32 ` Michael S. Tsirkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).