All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka-kv7WeFo6aLtBDgjK7y7TUQ@public.gmane.org>
To: Carlo Marcelo Arenas Belon
	<carenas-kLeDWSohozoJb6fo7hG9ng@public.gmane.org>
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: [PATCH] qemu: fix some warnings
Date: Tue, 22 Jan 2008 11:06:41 +0100	[thread overview]
Message-ID: <4795C031.8050108@siemens.com> (raw)
In-Reply-To: <20080121142259.GC28468@tapir>

Carlo Marcelo Arenas Belon wrote:
> On Mon, Jan 21, 2008 at 01:46:11PM +0100, Jan Kiszka wrote:
>> Here are 4 more warnings fixes (actually, I should sent 2 of them to
>> qemu...). Nothing critical, just less noise during compilation.
> 
> probably a good idea having them in independent patches as they are unrelated
> (other by the fact that they are all warnings in current git).

Will do (later).

> 
>> Index: b/qemu/vl.c
>> ===================================================================
>> --- a/qemu/vl.c
>> +++ b/qemu/vl.c
>> @@ -8862,7 +8862,7 @@ int main(int argc, char **argv)
>>                  if (ram_size <= 0)
>>                      help(1);
>>                  if (ram_size > PHYS_RAM_MAX_SIZE) {
>> -                    fprintf(stderr, "qemu: at most %d MB RAM can be simulated\n",
>> +                    fprintf(stderr, "qemu: at most %llu MB RAM can be simulated\n",
>>                              PHYS_RAM_MAX_SIZE / (1024 * 1024));
> 
> using TARGET_FMT_lu instead of "%llu" would seem more appropriate here because
> this is meant to reflect a physical memory address, but then the fact that kvm
> is using the x64_64 target also for 32 bit will mean that the definition of
> PHYS_RAM_MAX_SIZE has to be made somehow also HOST specific.
> 
> for my take on that (which will need to be updated with your version of the 
> exec.c changes and re-tested) look at :
> 
>   http://tapir.sajinet.com.pe/gentoo/portage/app-emulation/kvm/files/kvm-51-qemu-ramaddr.patch
> 

Ah, that's great. So what about this rebased and extended version:

---
 qemu/exec.c      |   10 +++++-----
 qemu/migration.c |    4 ++--
 qemu/vl.c        |    8 ++++++--
 3 files changed, 13 insertions(+), 9 deletions(-)

Index: kvm-userspace/qemu/exec.c
===================================================================
--- kvm-userspace.orig/qemu/exec.c
+++ kvm-userspace/qemu/exec.c
@@ -2028,9 +2028,9 @@ static inline void tlb_set_dirty(CPUStat
 }
 #endif /* defined(CONFIG_USER_ONLY) */
 
-static int subpage_register (subpage_t *mmio, uint32_t start, uint32_t end,
+static int subpage_register (subpage_t *mmio, ram_addr_t start, ram_addr_t end,
                              int memory);
-static void *subpage_init (target_phys_addr_t base, uint32_t *phys,
+static void *subpage_init (target_phys_addr_t base, ram_addr_t *phys,
                            int orig_memory);
 #define CHECK_SUBPAGE(addr, start_addr, start_addr2, end_addr, end_addr2, \
                       need_subpage)                                     \
@@ -2138,7 +2138,7 @@ ram_addr_t qemu_ram_alloc(unsigned long 
 {
     ram_addr_t addr;
     if ((phys_ram_alloc_offset + size) > phys_ram_size) {
-        fprintf(stderr, "Not enough memory (requested_size = %lu, max memory = %d)\n",
+        fprintf(stderr, "Not enough memory (requested_size = %lu, max memory = %lu)\n",
                 size, phys_ram_size);
         abort();
     }
@@ -2455,7 +2455,7 @@ static CPUWriteMemoryFunc *subpage_write
     &subpage_writel,
 };
 
-static int subpage_register (subpage_t *mmio, uint32_t start, uint32_t end,
+static int subpage_register (subpage_t *mmio, ram_addr_t start, ram_addr_t end,
                              int memory)
 {
     int idx, eidx;
@@ -2478,7 +2478,7 @@ static int subpage_register (subpage_t *
     return 0;
 }
 
-static void *subpage_init (target_phys_addr_t base, uint32_t *phys,
+static void *subpage_init (target_phys_addr_t base, ram_addr_t *phys,
                            int orig_memory)
 {
     subpage_t *mmio;
Index: kvm-userspace/qemu/migration.c
===================================================================
--- kvm-userspace.orig/qemu/migration.c
+++ kvm-userspace/qemu/migration.c
@@ -808,7 +808,7 @@ static int migrate_incoming_fd(int fd)
 
     size = qemu_get_be32(f);
     if (size != phys_ram_size) {
-        fprintf(stderr, "migration: memory size mismatch: recv %u mine %u\n",
+        fprintf(stderr, "migration: memory size mismatch: recv %u mine %lu\n",
                 size, phys_ram_size);
 	return MIG_STAT_DST_MEM_SIZE_MISMATCH;
     }
@@ -1063,7 +1063,7 @@ void do_info_migration(void)
 	    term_printf("Transfer rate %3.1f mb/s\n",
 			(double)s->bps / (1024 * 1024));
 	term_printf("Iteration %d\n", s->iteration);
-	term_printf("Transferred %d/%d pages\n", s->updated_pages, phys_ram_size >> TARGET_PAGE_BITS);
+	term_printf("Transferred %d/%lu pages\n", s->updated_pages, phys_ram_size >> TARGET_PAGE_BITS);
 	if (s->iteration)
 	    term_printf("Last iteration found %d dirty pages\n", s->last_updated_pages);
     } else {
Index: kvm-userspace/qemu/vl.c
===================================================================
--- kvm-userspace.orig/qemu/vl.c
+++ kvm-userspace/qemu/vl.c
@@ -148,10 +148,14 @@ int inet_aton(const char *cp, struct in_
 //#define DEBUG_UNUSED_IOPORT
 //#define DEBUG_IOPORT
 
-#if HOST_LONG_BITS < 64
+#if TARGET_LONG_BITS < 64
 #define PHYS_RAM_MAX_SIZE (2047 * 1024 * 1024)
 #else
+#if HOST_LONG_BITS < 64
 #define PHYS_RAM_MAX_SIZE (2047 * 1024 * 1024 * 1024ULL)
+#else
+#define PHYS_RAM_MAX_SIZE (2047 * 1024 * 1024 * 1024UL)
+#endif
 #endif
 
 #ifdef TARGET_PPC
@@ -8862,7 +8866,7 @@ int main(int argc, char **argv)
                 if (ram_size <= 0)
                     help(1);
                 if (ram_size > PHYS_RAM_MAX_SIZE) {
-                    fprintf(stderr, "qemu: at most %d MB RAM can be simulated\n",
+                    fprintf(stderr, "qemu: at most " TARGET_FMT_lu " MB RAM can be simulated\n",
                             PHYS_RAM_MAX_SIZE / (1024 * 1024));
                     exit(1);
                 }

-- 
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

      reply	other threads:[~2008-01-22 10:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-21 12:46 [PATCH] qemu: fix some warnings Jan Kiszka
     [not found] ` <47949413.4060804-kv7WeFo6aLtBDgjK7y7TUQ@public.gmane.org>
2008-01-21 13:06   ` Jan Kiszka
     [not found]     ` <479498B9.1000005-kv7WeFo6aLtBDgjK7y7TUQ@public.gmane.org>
2008-01-21 14:00       ` Carlo Marcelo Arenas Belon
2008-01-24  6:34       ` Avi Kivity
2008-01-21 14:22   ` Carlo Marcelo Arenas Belon
2008-01-22 10:06     ` Jan Kiszka [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4795C031.8050108@siemens.com \
    --to=jan.kiszka-kv7wefo6altbdgjk7y7tuq@public.gmane.org \
    --cc=carenas-kLeDWSohozoJb6fo7hG9ng@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.