aboutsummaryrefslogtreecommitdiff
path: root/emulators
diff options
context:
space:
mode:
Diffstat (limited to 'emulators')
-rw-r--r--emulators/qemu-devel/Makefile66
-rw-r--r--emulators/qemu-devel/files/patch-e1000-rx133
-rw-r--r--emulators/qemu/Makefile49
3 files changed, 193 insertions, 55 deletions
diff --git a/emulators/qemu-devel/Makefile b/emulators/qemu-devel/Makefile
index 64e4d9773eaa..c3d2d16f93aa 100644
--- a/emulators/qemu-devel/Makefile
+++ b/emulators/qemu-devel/Makefile
@@ -7,7 +7,7 @@
PORTNAME= qemu
PORTVERSION= 1.0.1
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= emulators
MASTER_SITES= http://wiki.qemu.org/download/:release \
LOCAL/nox:snapshot
@@ -31,28 +31,30 @@ ONLY_FOR_ARCHS= amd64 i386 powerpc # XXX someone wants to debug sparc64 hosts?
CONFLICTS_INSTALL= qemu-[0-9]*
MAKE_JOBS_SAFE= yes
-OPTIONS= SAMBA "samba dependency (for -smb)" Off \
- SDL "SDL/X dependency (graphical output)" On \
- OPENGL "OpenGL dependency" On \
- GNUTLS "gnutls dependency (vnc encryption)" On \
- SASL "cyrus-sasl dependency (vnc encryption)" On \
- JPEG "jpeg dependency (vnc lossy compression)" On \
- PNG "png dependency (vnc compression)" On \
- CURL "libcurl dependency (remote images)" On \
- CDROM_DMA "IDE CDROM DMA" On \
- PCAP "pcap dependency (networking with bpf)" On \
- SEABIOS_GIT "add seabios snapshot (-bios bios.bin-1.6.3.1)" On \
- USBREDIR "usb device network redirection (experimental!)" Off \
- GNS3 "gns3 patches (udp, promiscuous multicast)" Off \
- ADD_AUDIO "Emulate more audio hardware (experimental!)" Off \
- ALL_TARGETS "Also build bsd-user targets (for testing)" Off
+OPTIONS_DEFINE= SAMBA SDL OPENGL GNUTLS SASL JPEG PNG CURL CDROM_DMA PCAP \
+ SEABIOS_GIT USBREDIR GNS3 ADD_AUDIO ALL_TARGETS
+SAMBA_DESC= "samba dependency (for -smb)"
+GNUTLS_DESC= "gnutls dependency (vnc encryption)"
+SASL_DESC= "cyrus-sasl dependency (vnc encryption)"
+JPEG_DESC= "jpeg dependency (vnc lossy compression)"
+PNG_DESC= "png dependency (vnc compression)"
+CURL_DESC= "libcurl dependency (remote images)"
+CDROM_DMA_DESC= IDE CDROM DMA
+PCAP_DESC= "pcap dependency (networking with bpf)"
+SEABIOS_GIT_DESC= "add seabios snapshot (-bios bios.bin-1.6.3.1)"
+USBREDIR_DESC= "usb device network redirection (experimental!)"
+GNS3_DESC= "gns3 patches (udp, promiscuous multicast)"
+ADD_AUDIO_DESC= "Emulate more audio hardware (experimental!)"
+ALL_TARGETS_DESC= "Also build bsd-user targets (for testing)"
+OPTIONS_DEFAULT=SDL OPENGL GNUTLS SASL JPEG PNG CURL CDROM_DMA PCAP \
+ SEABIOS_GIT
.include <bsd.port.options.mk>
CONFIGURE_ARGS+= --extra-ldflags=-L${LOCALBASE}/lib
PORTDOCS= docs qemu-doc.html qemu-tech.html
-.if defined(WITHOUT_ALL_TARGETS)
+.if empty(PORT_OPTIONS:MALL_TARGETS)
CONFIGURE_ARGS+= --disable-bsd-user
PLIST_SUB+= ALLTARGETS="@comment "
.else
@@ -62,7 +64,7 @@ IGNORE= bsd-user targets not tested on sparc64
.endif
.endif
-.if defined(WITH_GNS3)
+.if ${PORT_OPTIONS:MGNS3}
EXTRA_PATCHES+= ${FILESDIR}/hw_e1000_c.patch \
${FILESDIR}/net_c.patch \
${FILESDIR}/net_h.patch \
@@ -80,67 +82,67 @@ CONFIGURE_ARGS+= --prefix=${PREFIX} --cc=${CC} --enable-docs \
--smbd=${LOCALBASE}/sbin/smbd \
--extra-cflags=-I${WRKSRC}\ -I${LOCALBASE}/include\ -DPREFIX=\\\"${PREFIX}\\\"
-.if defined(WITHOUT_SDL)
+.if empty(PORT_OPTIONS:MSDL)
CONFIGURE_ARGS+= --disable-sdl
.else
USE_SDL= sdl
.endif
-.if defined(WITHOUT_GNUTLS)
+.if empty(PORT_OPTIONS:MGNUTLS)
CONFIGURE_ARGS+= --disable-vnc-tls
.else
LIB_DEPENDS+= gnutls:${PORTSDIR}/security/gnutls
.endif
-.if defined(WITHOUT_SASL)
+.if empty(PORT_OPTIONS:MSASL)
CONFIGURE_ARGS+= --disable-vnc-sasl
.else
LIB_DEPENDS+= sasl2:${PORTSDIR}/security/cyrus-sasl2
.endif
-.if defined(WITHOUT_JPEG)
+.if empty(PORT_OPTIONS:MJPEG)
CONFIGURE_ARGS+= --disable-vnc-jpeg
.else
LIB_DEPENDS+= jpeg:${PORTSDIR}/graphics/jpeg
.endif
-.if defined(WITHOUT_PNG)
+.if empty(PORT_OPTIONS:MPNG)
CONFIGURE_ARGS+= --disable-vnc-png
.else
LIB_DEPENDS+= png15:${PORTSDIR}/graphics/png
.endif
-.if defined(WITHOUT_CURL)
+.if empty(PORT_OPTIONS:MCURL)
CONFIGURE_ARGS+= --disable-curl
.else
LIB_DEPENDS+= curl:${PORTSDIR}/ftp/curl
.endif
-.if defined(WITHOUT_OPENGL)
+.if empty(PORT_OPTIONS:MOPENGL)
CONFIGURE_ARGS+= --disable-opengl
.else
USE_GL= yes
.endif
-.if defined(WITHOUT_USBREDIR)
+.if empty(PORT_OPTIONS:MUSBREDIR)
CONFIGURE_ARGS+= --disable-usb-redir
.else
LIB_DEPENDS+= usbredirparser:${PORTSDIR}/net/usbredir
.endif
-.if defined(WITH_PCAP)
+.if ${PORT_OPTIONS:MPCAP}
CONFIGURE_ARGS+= --enable-pcap
.endif
-.if defined(WITH_ADD_AUDIO)
+.if ${PORT_OPTIONS:MADD_AUDIO}
CONFIGURE_ARGS+= --audio-card-list=ac97,es1370,sb16,cs4231a,adlib,gus,hda
.endif
-.if defined(WITH_SAMBA)
+.if ${PORT_OPTIONS:MSAMBA}
RUN_DEPENDS+= ${LOCALBASE}/sbin/smbd:${PORTSDIR}/net/samba35
.endif
-.if defined(WITH_SEABIOS_GIT)
+.if ${PORT_OPTIONS:MSEABIOS_GIT}
RUN_DEPENDS+= seabios-devel>=1.6.3.1:${PORTSDIR}/emulators/seabios-devel
.endif
@@ -173,11 +175,11 @@ MAKE_ENV+= COMPILER_PATH=${LOCALBASE}/bin
.endif
post-patch:
-.if defined(WITH_PCAP)
+.if ${PORT_OPTIONS:MPCAP}
@cd ${WRKSRC} && ${PATCH} --quiet < ${FILESDIR}/pcap-patch
@${REINPLACE_CMD} -f ${FILESDIR}/pcap-client-type.sed ${WRKSRC}/net.h
.endif
-.if defined(WITHOUT_CDROM_DMA)
+.if empty(PORT_OPTIONS:MCDROM_DMA)
@cd ${WRKSRC} && ${PATCH} --quiet < ${FILESDIR}/cdrom-dma-patch
.endif
@${REINPLACE_CMD} -E \
diff --git a/emulators/qemu-devel/files/patch-e1000-rx b/emulators/qemu-devel/files/patch-e1000-rx
new file mode 100644
index 000000000000..c24490138414
--- /dev/null
+++ b/emulators/qemu-devel/files/patch-e1000-rx
@@ -0,0 +1,133 @@
+Message-ID: <4FC741F1.4000905@redhat.com>
+Date: Thu, 31 May 2012 12:03:29 +0200
+From: Paolo Bonzini <pbonzini@redhat.com>
+To: Jan Kiszka <jan.kiszka@web.de>
+References: <20120530202311.GA1768@onelab2.iet.unipi.it>
+ <20120530212333.GD2672@onelab2.iet.unipi.it>
+ <4FC69389.8050404@web.de>
+ <CA+hQ2+g-2FdgWnqZUh1-oTZkziq8CTNJ5SeA+aCW32FFF=zi4A@mail.gmail.com>
+ <4FC69B28.1000106@web.de>
+ <CA+hQ2+gA5hZ2Zk-kwPNDVcguBsu2UfNiLxs84MgqBUK_MQuC4g@mail.gmail.com>
+ <4FC71FEB.9030100@redhat.com> <4FC72A95.4040808@web.de>
+In-Reply-To: <4FC72A95.4040808@web.de>
+Cc: Luigi Rizzo <rizzo.unipi@gmail.com>, rizzo@iet.unipi.it,
+ qemu-devel@nongnu.org,
+ Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
+Subject: Re: [Qemu-devel] Proposed patch: huge RX speedup for hw/e1000.c
+
+Il 31/05/2012 10:23, Jan Kiszka ha scritto:
+>> > @@ -922,6 +923,7 @@ set_rdt(E1000State *s, int index, uint32_t val)
+>> > {
+>> > s->check_rxov = 0;
+>> > s->mac_reg[index] = val & 0xffff;
+>> > + qemu_notify_event();
+> This still looks like the wrong tool: Packets that can't be delivered
+> are queued.
+
+Packets that are read from the tap but can't be delivered are queued;
+packets that are left on the tap need qemu_notify_event to be flushed.
+
+> So we need to flush the queue and clear the blocked delivery
+> there. qemu_flush_queued_packets appears more appropriate for this.
+
+Right, and qemu_flush_queued_packets needs to call qemu_notify_event
+which makes the call in virtio-net unnecessary.
+
+Paolo
+
+diff --git a/hw/e1000.c b/hw/e1000.c
+index 4573f13..43d933a 100644
+--- a/hw/e1000.c
++++ b/hw/e1000.c
+@@ -295,6 +295,7 @@ set_rx_control(E1000State *s, int index, uint32_t val)
+ s->rxbuf_min_shift = ((val / E1000_RCTL_RDMTS_QUAT) & 3) + 1;
+ DBGOUT(RX, "RCTL: %d, mac_reg[RCTL] = 0x%x\n", s->mac_reg[RDT],
+ s->mac_reg[RCTL]);
++ qemu_flush_queued_packets(&s->nic->nc);
+ }
+
+ static void
+@@ -926,6 +927,9 @@ set_rdt(E1000State *s, int index, uint32_t val)
+ {
+ s->check_rxov = 0;
+ s->mac_reg[index] = val & 0xffff;
++ if (e1000_has_rxbufs(s, 1)) {
++ qemu_flush_queued_packets(&s->nic->nc);
++ }
+ }
+
+ static void
+diff --git a/hw/virtio-net.c b/hw/virtio-net.c
+index 3f190d4..0974945 100644
+--- a/hw/virtio-net.c
++++ b/hw/virtio-net.c
+@@ -447,10 +447,6 @@ static void virtio_net_handle_rx(VirtIODevice *vdev, VirtQueue *vq)
+ VirtIONet *n = to_virtio_net(vdev);
+
+ qemu_flush_queued_packets(&n->nic->nc);
+-
+- /* We now have RX buffers, signal to the IO thread to break out of the
+- * select to re-poll the tap file descriptor */
+- qemu_notify_event();
+ }
+
+ static int virtio_net_can_receive(VLANClientState *nc)
+diff --git a/net.c b/net.c
+index 1922d8a..fa846ae 100644
+--- a/net.c
++++ b/net.c
+@@ -491,7 +491,12 @@ void qemu_flush_queued_packets(VLANClientState *vc)
+ queue = vc->send_queue;
+ }
+
+- qemu_net_queue_flush(queue);
++ if (qemu_net_queue_flush(queue)) {
++ /* We emptied the queue successfully, signal to the IO thread to repoll
++ * the file descriptor (for tap, for example).
++ */
++ qemu_notify_event();
++ }
+ }
+
+ static ssize_t qemu_send_packet_async_with_flags(VLANClientState *sender,
+diff --git a/net/queue.c b/net/queue.c
+index 1ab5247..fd1c7e6 100644
+--- a/net/queue.c
++++ b/net/queue.c
+@@ -232,7 +232,7 @@ void qemu_net_queue_purge(NetQueue *queue, VLANClientState *from)
+ }
+ }
+
+-void qemu_net_queue_flush(NetQueue *queue)
++bool qemu_net_queue_flush(NetQueue *queue)
+ {
+ while (!QTAILQ_EMPTY(&queue->packets)) {
+ NetPacket *packet;
+@@ -248,7 +248,7 @@ void qemu_net_queue_flush(NetQueue *queue)
+ packet->size);
+ if (ret == 0) {
+ QTAILQ_INSERT_HEAD(&queue->packets, packet, entry);
+- break;
++ return 0;
+ }
+
+ if (packet->sent_cb) {
+@@ -257,4 +257,5 @@ void qemu_net_queue_flush(NetQueue *queue)
+
+ g_free(packet);
+ }
++ return 1;
+ }
+diff --git a/net/queue.h b/net/queue.h
+index a31958e..4bf6d3c 100644
+--- a/net/queue.h
++++ b/net/queue.h
+@@ -66,6 +66,6 @@ ssize_t qemu_net_queue_send_iov(NetQueue *queue,
+ NetPacketSent *sent_cb);
+
+ void qemu_net_queue_purge(NetQueue *queue, VLANClientState *from);
+-void qemu_net_queue_flush(NetQueue *queue);
++bool qemu_net_queue_flush(NetQueue *queue);
+
+ #endif /* QEMU_NET_QUEUE_H */
+
diff --git a/emulators/qemu/Makefile b/emulators/qemu/Makefile
index b3fd052f184b..1f1180d9eb9b 100644
--- a/emulators/qemu/Makefile
+++ b/emulators/qemu/Makefile
@@ -27,21 +27,24 @@ ONLY_FOR_ARCHS= amd64 i386
CONFLICTS= qemu-devel-[0-9]*
MAKE_JOBS_SAFE= yes
-OPTIONS= KQEMU "Build with (alpha!) accelerator module" Off \
- RTL8139_TIMER "allow use of re(4) nic with FreeBSD guests" Off \
- SAMBA "samba dependency (for -smb)" Off \
- SDL "SDL/X dependency (graphical output)" On \
- GNUTLS "gnutls dependency (vnc encryption)" On \
- CURL "libcurl dependency (remote images)" On \
- PCAP "pcap dependency (networking with bpf)" On \
- GNS3 "gns3 patches (udp, promiscuous multicast)" On \
- CDROM_DMA "IDE CDROM DMA" On \
- ADD_AUDIO "Emulate more audio hardware (experimental!)" Off \
- ALL_TARGETS "Also build non-x86 targets" On
+OPTIONS_DEFINE= KQEMU RTL8139_TIMER SAMBA SDL GNUTLS CURL PCAP GNS3 \
+ CDROM_DMA ADD_AUDIO ALL_TARGETS
+KQEMU_DESC= "Build with (alpha!) accelerator module"
+RTL8139_TIMER_DESC= "allow use of re(4) nic with FreeBSD guests"
+SAMBA_DESC= "samba dependency (for -smb)"
+SDL_DESC= "SDL/X dependency (graphical output)"
+GNUTLS_DESC= "gnutls dependency (vnc encryption)"
+CURL_DESC= "libcurl dependency (remote images)"
+PCAP_DESC= "pcap dependency (networking with bpf)"
+GNS3_DESC= "gns3 patches (udp, promiscuous multicast)"
+CDROM_DMA_DESC= IDE CDROM DMA
+ADD_AUDIO_DESC= "Emulate more audio hardware (experimental!)"
+ALL_TARGETS_DESC= Also build non-x86 targets
+OPTIONS_DEFAULT= SDL GNUTLS CURL PCAP GNS3 CDROM_DMA ALL_TARGETS
.include <bsd.port.pre.mk>
-.if defined(WITHOUT_ALL_TARGETS)
+.if empty(PORT_OPTIONS:MALL_TARGETS)
CONFIGURE_ARGS+= --target-list=i386-softmmu,x86_64-softmmu
PLIST_SUB+= ALLTARGETS="@comment "
.else
@@ -52,40 +55,40 @@ WITHOUT_CPU_CFLAGS=yes #to avoid problems with register allocation
CFLAGS:= ${CFLAGS:C/-fno-tree-vrp//}
CONFIGURE_ARGS+= --prefix=${PREFIX} --cc=${CC}
-.if defined(WITHOUT_SDL)
+.if empty(PORT_OPTIONS:MSDL)
CONFIGURE_ARGS+= --disable-sdl
.else
USE_SDL= sdl
.endif
-.if defined(WITHOUT_GNUTLS)
+.if empty(PORT_OPTIONS:MGNUTLS)
CONFIGURE_ARGS+= --disable-vnc-tls
.else
LIB_DEPENDS+= gnutls:${PORTSDIR}/security/gnutls
.endif
-.if defined(WITHOUT_CURL)
+.if empty(PORT_OPTIONS:MCURL)
CONFIGURE_ARGS+= --disable-curl
.else
LIB_DEPENDS+= curl:${PORTSDIR}/ftp/curl
.endif
-.if defined(WITH_PCAP)
+.if ${PORT_OPTIONS:MPCAP}
CONFIGURE_ARGS+= --enable-pcap
.endif
-.if defined(WITH_ADD_AUDIO)
+.if ${PORT_OPTIONS:MADD_AUDIO}
CONFIGURE_ARGS+= --audio-card-list=ac97,es1370,sb16,cs4231a,adlib,gus
.endif
# XXX
CONFIGURE_ARGS+= --disable-bsd-user
-.if defined(WITH_SAMBA)
+.if ${PORT_OPTIONS:MSAMBA}
RUN_DEPENDS+= ${LOCALBASE}/sbin/smbd:${PORTSDIR}/net/samba35
.endif
-.if defined(WITH_KQEMU)
+.if ${PORT_OPTIONS:MKQEMU}
BUILD_DEPENDS+= kqemu-kmod-devel>=1.4.0pre1:${PORTSDIR}/emulators/kqemu-kmod-devel
RUN_DEPENDS+= kqemu-kmod-devel>=1.4.0pre1:${PORTSDIR}/emulators/kqemu-kmod-devel
.else
@@ -117,16 +120,16 @@ pre-patch:
done
post-patch:
-.if defined(WITH_RTL8139_TIMER)
+.if ${PORT_OPTIONS:MRTL8139_TIMER}
@cd ${WRKSRC} && ${PATCH} --quiet < ${FILESDIR}/rtl8139-re-patch
.endif
-.if defined(WITH_PCAP)
+.if ${PORT_OPTIONS:MPCAP}
@cd ${WRKSRC} && ${PATCH} --quiet < ${FILESDIR}/pcap-patch
.endif
-.if defined(WITH_GNS3)
+.if ${PORT_OPTIONS:MGNS3}
@cd ${WRKSRC} && ${PATCH} -p1 --quiet < ${FILESDIR}/gns3-patch
.endif
-.if defined(WITHOUT_CDROM_DMA)
+.if empty(PORT_OPTIONS:MCDROM_DMA)
@cd ${WRKSRC} && ${PATCH} --quiet < ${FILESDIR}/cdrom-dma-patch
.endif
@${REINPLACE_CMD} -E \