ivshmem: Fix compilation (wrong format specifier)
PATCH 1/2 ivshmem: Fix compilation (wrong format specifier)
st_size is an off32_t or off64_t, so %ld does not always work.
--- hw/ivshmem.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
hw/ivshmem.c +2 -2
@@ -352,8 +352,8 @@ static int check_shm_size(IVShmemState *s, int fd) {if (s->ivshmem_size > buf.st_size) {fprintf (stderr,"IVSHMEM ERROR: Requested memory size greater" ); -fprintf (stderr," than shared object size (%" PRIu64" > %ld)\n" , - s->ivshmem_size, buf.st_size); +fprintf (stderr," than shared object size (%" PRIu64" > %" PRIu64")\n" , + s->ivshmem_size, (uint64_t )buf.st_size);return -1 ; }else {return 0 ;
Signature · 1 line
1.7.1
PATCH 2/2 ivshmem: Fix compilation without kvm
kvm_set_ioeventfd_mmio_long is only available with CONFIG_KVM.
--- hw/ivshmem.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
hw/ivshmem.c +6 -1
@@ -385,8 +385,10 @@ static void close_guest_eventfds(IVShmemState *s, int posn) guest_curr_max = s->peers[posn].nb_eventfds;for (i =0 ; i < guest_curr_max; i++) { +#if defined(CONFIG_KVM )kvm_set_ioeventfd_mmio_long (s->peers[posn].eventfds[i], s->mmio_addr +DOORBELL , (posn <<16 ) | i,0 ); +#endif close (s->peers[posn].eventfds[i]); }
@@ -395,7 +397,7 @@ static void close_guest_eventfds(IVShmemState *s, int posn) }static void setup_ioeventfds (IVShmemState *s) { - +#if defined(CONFIG_KVM )int i, j;for (i =0 ; i <= s->max_peer; i++) {
@@ -404,6 +406,7 @@ static void setup_ioeventfds(IVShmemState *s) { s->mmio_addr + DOORBELL, (i << 16) | j, 1); } } +#endif }/* this function increase the dynamic storage need to store data about other
@@ -530,12 +533,14 @@ static void ivshmem_read(void *opaque, const uint8_t * buf, int flags) guest_max_eventfd); } +#if defined(CONFIG_KVM )if (ivshmem_has_feature (s,IVSHMEM_IOEVENTFD )) {if (kvm_set_ioeventfd_mmio_long (incoming_fd, s->mmio_addr +DOORBELL , (incoming_posn <<16 ) | guest_max_eventfd,1 ) <0 ) {fprintf (stderr,"ivshmem: ioeventfd not available\n" ); } } +#endif return ; }
Signature · 1 line
1.7.1
[Qemu-devel] Re: [PATCH 2/2] ivshmem: Fix compilation without kvm
Quoted 1 line · Stefan Weil
kvm_set_ioeventfd_mmio_longis only available withCONFIG_KVM.
We should just disable ivshmem for non-KVM
Makefile.target +1 -1
@@ -191,7 +191,7 @@ obj-y += rtl8139.o obj-y += e1000.o # Inter-VM PCI shared memory -obj-y += ivshmem.o +obj-$(CONFIG_KVM) += ivshmem.o # Hardware support obj-i386-y += vga.o
because it is also breaking Windows builds.
Alternatively, the right way to do what this patch does, is to add kvm_set_ioeventfd_mmio_long to kvm-stub.c, and to use "obj-$(CONFIG_POSIX) += ivshmem.o" in the makefile to work around the Windows build problems.
Paolo
Re: [Qemu-devel] Re: [PATCH 2/2] ivshmem: Fix compilation without kvm
Quoted 17 lines · Paolo Bonzini
Quoted 2 lines · Stefan Weil
kvm_set_ioeventfd_mmio_longis only available withCONFIG_KVM.We should just disable ivshmem for non-KVM
Makefile.target +0
-0@@ -191,7 +191,7 @@ obj-y += rtl8139.oobj-y += e1000.o
# Inter-VM PCI shared memory
Makefile.target +1
-1-obj-y += ivshmem.o +obj-$(CONFIG_KVM) += ivshmem.o
Quoted 8 lines
# Hardware support
obj-i386-y += vga.obecause it is also breaking Windows builds.
Alternatively, the right way to do what this patch does, is to add
kvm_set_ioeventfd_mmio_longtokvm-stub.c, and to use "obj-$(CONFIG_POSIX) += ivshmem.o" in the makefile to work around the Windows build problems.
This patch fixes mingw32 build for me.
From 53bb966fb4e55f96e2c306a7c2df5b11ec574e05 Mon Sep 17 00:00:00 2001
From: Blue Swirl <[email protected]>
Date: Wed, 11 Aug 2010 17:16:48 +0000
Subject: [PATCH] Fix mingw32 build
Compile ivshm only on Posix hosts and only once.
Don't define qemu_chr_open_eventfd() on Windows.
--- Makefile.objs | 3 +++ Makefile.target | 3 --- qemu-char.c | 7 ++++--- 3 files changed, 7 insertions(+), 6 deletions(-)
Makefile.objs +3 -0
@@ -244,6 +244,9 @@ sound-obj-$(CONFIG_CS4231A) += cs4231a.o adlib.o fmopl.o: QEMU_CFLAGS += -DBUILD_Y8950=0 hw-obj-$(CONFIG_SOUND) += $(sound-obj-y) +# Inter-VM PCI shared memory +obj-$(CONFIG_POSIX) += ivshmem.o + hw-obj-$(CONFIG_VIRTFS) += virtio-9p-debug.o virtio-9p-local.o ######################################################################
Makefile.target +0 -3
@@ -190,9 +190,6 @@ obj-$(CONFIG_USB_OHCI) += usb-ohci.o obj-y += rtl8139.o obj-y += e1000.o -# Inter-VM PCI shared memory -obj-y += ivshmem.o - # Hardware support obj-i386-y += vga.o obj-i386-y += mc146818rtc.o i8259.o pc.o
qemu-char.c +4 -3
@@ -2087,11 +2087,12 @@ static void tcp_chr_read(void *opaque) } } -CharDriverState *qemu_chr_open_eventfd (int eventfd){ - +#ifndef _WIN32 +CharDriverState *qemu_chr_open_eventfd (int eventfd) +{return qemu_chr_open_fd (eventfd, eventfd); - } +#endif static void tcp_chr_connect (void *opaque) {
Signature · 1 line
1.5.6.5
[Qemu-devel] Re: [PATCH 2/2] ivshmem: Fix compilation without kvm
Quoted 21 lines · Blue Swirl
Quoted 20 lines · Paolo Bonzini
Quoted 2 lines · Stefan Weil
kvm_set_ioeventfd_mmio_longis only available withCONFIG_KVM.We should just disable ivshmem for non-KVM
Makefile.target +1
-1@@ -191,7 +191,7 @@ obj-y += rtl8139.o obj-y += e1000.o # Inter-VM PCI shared memory -obj-y += ivshmem.o +obj-$(CONFIG_KVM) += ivshmem.o # Hardware support obj-i386-y += vga.o
Quoted 7 lines
Quoted 5 lines
because it is also breaking Windows builds.
Alternatively, the right way to do what this patch does, is to add
kvm_set_ioeventfd_mmio_longtokvm-stub.c, and to use "obj-$(CONFIG_POSIX) += ivshmem.o" in the makefile to work around the Windows build problems.This patch fixes mingw32 build for me.
Looks fine.
Paolo
[Qemu-devel] Re: [PATCH 2/2] ivshmem: Fix compilation without kvm
In reply to Paolo BonziniQuoted 17 lines · Paolo Bonzini
Quoted 2 lines · Stefan Weil
kvm_set_ioeventfd_mmio_longis only available withCONFIG_KVM.We should just disable ivshmem for non-KVM
Makefile.target +0
-0@@ -191,7 +191,7 @@ obj-y += rtl8139.oobj-y += e1000.o
# Inter-VM PCI shared memory
Makefile.target +1
-1-obj-y += ivshmem.o +obj-$(CONFIG_KVM) += ivshmem.o
Quoted 9 lines
# Hardware support
obj-i386-y += vga.obecause it is also breaking Windows builds.
Alternatively, the right way to do what this patch does, is to add
kvm_set_ioeventfd_mmio_longtokvm-stub.c, and to use "obj-$(CONFIG_POSIX) += ivshmem.o" in the makefile to work around the Windows build problems.
I think we decided to disable it on non-KVM systems to avoid people stumbling into atomicity issues with emulation.
Quoted 3 lines
Paolo