* [PATCH] qemu: fix some warnings
@ 2008-01-21 12:46 Jan Kiszka
[not found] ` <47949413.4060804-kv7WeFo6aLtBDgjK7y7TUQ@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Jan Kiszka @ 2008-01-21 12:46 UTC (permalink / raw)
To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
Here are 4 more warnings fixes (actually, I should sent 2 of them to
qemu...). Nothing critical, just less noise during compilation.
At this chance, can anyone comment on these uint32_t types?
static int subpage_register (subpage_t *mmio, uint32_t start, uint32_t end,
int memory);
static void *subpage_init (target_phys_addr_t base, uint32_t *phys,
int orig_memory);
Shouldn't they be target_phys_addr_t? Can't this cause troubles when
building 64-bit targets? Looks like it's even a generic qemu issue.
Jan
---
qemu/hw/pc.c | 31 -------------------------------
qemu/kvm-tpr-opt.c | 13 -------------
qemu/migration.c | 4 ++--
qemu/vl.c | 2 +-
4 files changed, 3 insertions(+), 47 deletions(-)
Index: b/qemu/hw/pc.c
===================================================================
--- a/qemu/hw/pc.c
+++ b/qemu/hw/pc.c
@@ -450,37 +450,6 @@ static void generate_bootsect(uint32_t g
bdrv_set_boot_sector(drives_table[hda].bdrv, bootsect, sizeof(bootsect));
}
-static int load_kernel(const char *filename, uint8_t *addr,
- uint8_t *real_addr)
-{
- int fd, size;
- int setup_sects;
-
- fd = open(filename, O_RDONLY | O_BINARY);
- if (fd < 0)
- return -1;
-
- /* load 16 bit code */
- if (read(fd, real_addr, 512) != 512)
- goto fail;
- setup_sects = real_addr[0x1F1];
- if (!setup_sects)
- setup_sects = 4;
- if (read(fd, real_addr + 512, setup_sects * 512) !=
- setup_sects * 512)
- goto fail;
-
- /* load 32 bit code */
- size = read(fd, addr, 16 * 1024 * 1024);
- if (size < 0)
- goto fail;
- close(fd);
- return size;
- fail:
- close(fd);
- return -1;
-}
-
static long get_file_size(FILE *f)
{
long where, size;
Index: b/qemu/kvm-tpr-opt.c
===================================================================
--- a/qemu/kvm-tpr-opt.c
+++ b/qemu/kvm-tpr-opt.c
@@ -76,19 +76,6 @@ static void write_byte_virt(CPUState *en
stb_phys(map_addr(&sregs, virt, NULL), b);
}
-static uint32_t get_bios_map(CPUState *env, unsigned *perms)
-{
- uint32_t v;
- struct kvm_sregs sregs;
-
- kvm_get_sregs(kvm_context, env->cpu_index, &sregs);
-
- for (v = -4096u; v != 0; v -= 4096)
- if (map_addr(&sregs, v, perms) == 0xe0000)
- return v;
- return -1u;
-}
-
struct vapic_bios {
char signature[8];
uint32_t virt_base;
Index: b/qemu/migration.c
===================================================================
--- a/qemu/migration.c
+++ b/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: 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));
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/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] qemu: fix some warnings
[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:22 ` Carlo Marcelo Arenas Belon
1 sibling, 1 reply; 6+ messages in thread
From: Jan Kiszka @ 2008-01-21 13:06 UTC (permalink / raw)
To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
Jan Kiszka wrote:
> At this chance, can anyone comment on these uint32_t types?
>
> static int subpage_register (subpage_t *mmio, uint32_t start, uint32_t end,
> int memory);
> static void *subpage_init (target_phys_addr_t base, uint32_t *phys,
> int orig_memory);
>
> Shouldn't they be target_phys_addr_t? Can't this cause troubles when
> building 64-bit targets? Looks like it's even a generic qemu issue.
At least it should cause no harm to convert to target_phys_addr_t, so
here is a cleanup patch for qemu/exec.c.
Jan
---
qemu/exec.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 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,
- int memory);
-static void *subpage_init (target_phys_addr_t base, uint32_t *phys,
+static int subpage_register (subpage_t *mmio, target_phys_addr_t start,
+ target_phys_addr_t end, int memory);
+static void *subpage_init (target_phys_addr_t base, target_phys_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,8 +2455,8 @@ static CPUWriteMemoryFunc *subpage_write
&subpage_writel,
};
-static int subpage_register (subpage_t *mmio, uint32_t start, uint32_t end,
- int memory)
+static int subpage_register (subpage_t *mmio, target_phys_addr_t start,
+ target_phys_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, target_phys_addr_t *phys,
int orig_memory)
{
subpage_t *mmio;
--
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/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] qemu: fix some warnings
[not found] ` <479498B9.1000005-kv7WeFo6aLtBDgjK7y7TUQ@public.gmane.org>
@ 2008-01-21 14:00 ` Carlo Marcelo Arenas Belon
2008-01-24 6:34 ` Avi Kivity
1 sibling, 0 replies; 6+ messages in thread
From: Carlo Marcelo Arenas Belon @ 2008-01-21 14:00 UTC (permalink / raw)
To: Jan Kiszka; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
On Mon, Jan 21, 2008 at 02:06:01PM +0100, Jan Kiszka wrote:
> Jan Kiszka wrote:
> > At this chance, can anyone comment on these uint32_t types?
> >
> > static int subpage_register (subpage_t *mmio, uint32_t start, uint32_t end,
> > int memory);
> > static void *subpage_init (target_phys_addr_t base, uint32_t *phys,
> > int orig_memory);
> >
> > Shouldn't they be target_phys_addr_t? Can't this cause troubles when
> > building 64-bit targets? Looks like it's even a generic qemu issue.
not sure what you mean here, but qemu doesn't have a mismatching type for
subpage_init because the types they use are all width consistent and tied to
the target processor.
kvm uses the x86_64 target for 32bit and therefore breaks that assumption
triggering this issues AFAIK.
> At least it should cause no harm to convert to target_phys_addr_t, so
> here is a cleanup patch for qemu/exec.c.
the SUBPAGE_IDX might not be correct in this case as it is dependant in
TARGET_PAGE_SIZE and TARGET_PAGE_BITS
> ---
> qemu/exec.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 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,
> - int memory);
> -static void *subpage_init (target_phys_addr_t base, uint32_t *phys,
> +static int subpage_register (subpage_t *mmio, target_phys_addr_t start,
> + target_phys_addr_t end, int memory);
> +static void *subpage_init (target_phys_addr_t base, target_phys_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",
TARGET_FMT_lu will be a better match for this format as it is meant to be
defined correctly for each target by qemu.
Carlo
-------------------------------------------------------------------------
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/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] qemu: fix some warnings
[not found] ` <47949413.4060804-kv7WeFo6aLtBDgjK7y7TUQ@public.gmane.org>
2008-01-21 13:06 ` Jan Kiszka
@ 2008-01-21 14:22 ` Carlo Marcelo Arenas Belon
2008-01-22 10:06 ` Jan Kiszka
1 sibling, 1 reply; 6+ messages in thread
From: Carlo Marcelo Arenas Belon @ 2008-01-21 14:22 UTC (permalink / raw)
To: Jan Kiszka; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
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).
> 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
Carlo
-------------------------------------------------------------------------
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/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] qemu: fix some warnings
2008-01-21 14:22 ` Carlo Marcelo Arenas Belon
@ 2008-01-22 10:06 ` Jan Kiszka
0 siblings, 0 replies; 6+ messages in thread
From: Jan Kiszka @ 2008-01-22 10:06 UTC (permalink / raw)
To: Carlo Marcelo Arenas Belon; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
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/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] qemu: fix some warnings
[not found] ` <479498B9.1000005-kv7WeFo6aLtBDgjK7y7TUQ@public.gmane.org>
2008-01-21 14:00 ` Carlo Marcelo Arenas Belon
@ 2008-01-24 6:34 ` Avi Kivity
1 sibling, 0 replies; 6+ messages in thread
From: Avi Kivity @ 2008-01-24 6:34 UTC (permalink / raw)
To: Jan Kiszka; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
Jan Kiszka wrote:
> Jan Kiszka wrote:
>
>> At this chance, can anyone comment on these uint32_t types?
>>
>> static int subpage_register (subpage_t *mmio, uint32_t start, uint32_t end,
>> int memory);
>> static void *subpage_init (target_phys_addr_t base, uint32_t *phys,
>> int orig_memory);
>>
>> Shouldn't they be target_phys_addr_t? Can't this cause troubles when
>> building 64-bit targets? Looks like it's even a generic qemu issue.
>>
>
> At least it should cause no harm to convert to target_phys_addr_t, so
> here is a cleanup patch for qemu/exec.c.
>
>
Please post these patches to qemu-devel, in order to limit the
divergence between kvm's version of qemu and upstream.
--
Any sufficiently difficult bug is indistinguishable from a feature.
-------------------------------------------------------------------------
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/
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-01-24 6:34 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox