* [Qemu-devel] [PULL 00/26] Trivial-patches pull request for 2013-06-14
@ 2013-06-14 10:50 Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 01/26] qemu-char: remove a few needless #includes Michael Tokarev
` (27 more replies)
0 siblings, 28 replies; 29+ messages in thread
From: Michael Tokarev @ 2013-06-14 10:50 UTC (permalink / raw)
To: Anthony Liguori; +Cc: qemu-trivial, Michael Tokarev, qemu-devel
This is yet another pull request from the trivial-patches queue.
There are many changes this time, most are really trivial, but
some, while also of trivial nature, are large(ish). These include:
- linux headers update request, which syncs copy of linux headers
with 3.10-rc5, together with 3 preparational changes
- "char/serial: serial_ioport_write: Factor out common code" by
Peter Crosthwaite, which is large but it removes ad-hoc implementation
and uses generic bits instead
- "create qemu_openpty_raw() helper function and move it to a separate file"
by Michael Tokarev, which is also a bit large but it just moves common code
into a separate file.
It all appears to build (on OpenBSD, FreeBSD, OpenIndiana and Linux) and
work, as far as I can tell.
Please pull.
Thanks,
/mjt
The following changes since commit bd5c51ee6c4f1c79cae5ad2516d711a27b4ea8ec:
qemu-char: don't issue CHR_EVENT_OPEN in a BH (2013-06-10 11:38:37 -0500)
are available in the git repository at:
git://git.corpit.ru/qemu.git trivial-patches-next
for you to fetch changes up to ba275adba09adfc0f7ec533f1fddba678d9ba826:
piix: fix some printf errors when debug is enabled (2013-06-14 14:38:45 +0400)
----------------------------------------------------------------
Alexey Kardashevskiy (3):
KVM: ARM: Add dummy kvm_arch_init_irq_routing()
KVM: S390: Add dummy kvm_arch_init_irq_routing()
linux-headers: Update to v3.10-rc5
Alon Levy (1):
libcacard/vscclient: fix leakage of socket on error paths
Andreas Färber (1):
Makefile: Install qemu-img and qemu-nbd man pages only if built
Ed Maste (2):
configure: remove ${config_host_ld} variable
configure: Disable host-bsd USB on FreeBSD
Hervé Poussineau (1):
cputlb: fix debug logs
Hu Tao (1):
piix: fix some printf errors when debug is enabled
Michael Tokarev (4):
qemu-char: remove a few needless #includes
gitignore: unignore *.patch
main-loop: do not include slirp/slirp.h, use libslirp.h instead
create qemu_openpty_raw() helper function and move it to a separate file
Peter Crosthwaite (4):
intc/xilinx_intc: Use qemu_set_irq
char/serial: cosmetic fixes.
char/serial: Use generic Fifo8
char/serial: serial_ioport_write: Factor out common code
Peter Wu (2):
gtk: implement -full-screen
Unbreak -no-quit for GTK, validate SDL options
Richard W.M. Jones (1):
curl: Whitespace only changes.
Scott Wood (1):
KVM: PPC: Add dummy kvm_arch_init_irq_routing()
Stefan Hajnoczi (1):
ivshmem: add missing error exit(2)
Stefan Weil (4):
device tree: Fix cppcheck warning
hw/scsi: Don't increment a boolean value
target-sparc: Replace free by g_free
hw/xen: Use g_free instead of free and fix potential memory leaks
.gitignore | 1 -
Makefile | 5 +-
block/curl.c | 4 +-
configure | 7 +--
cputlb.c | 4 +-
device_tree.c | 2 +-
hw/acpi/piix4.c | 12 ++---
hw/char/serial.c | 128 +++++++++++++++++++-----------------------------
hw/intc/xilinx_intc.c | 6 +--
hw/misc/ivshmem.c | 1 +
hw/scsi/vmw_pvscsi.c | 2 +-
hw/xen/xen_pt_config_init.c | 4 +-
include/hw/char/serial.h | 15 ++----
include/qemu-common.h | 15 +-----
include/ui/console.h | 2 +-
libcacard/vscclient.c | 9 +++-
linux-headers/asm-arm/kvm.h | 12 ++---
linux-headers/asm-mips/kvm.h | 138 ++++++++++++++++++++++++++++++++++++++++++++++++++++
linux-headers/asm-mips/kvm_para.h | 1 +
linux-headers/asm-powerpc/kvm.h | 89 +++++++++++++++++++++++++++++++++
linux-headers/asm-x86/kvm.h | 1 -
linux-headers/linux/kvm.h | 42 +++++++++++++---
linux-headers/linux/vfio.h | 1 +
linux-headers/linux/vhost.h | 28 +++++++++++
main-loop.c | 3 +-
qemu-char.c | 79 ++----------------------------
target-arm/kvm.c | 4 ++
target-ppc/kvm.c | 4 ++
target-s390x/kvm.c | 4 ++
target-sparc/cpu.c | 2 +-
ui/gtk.c | 18 +++----
util/Makefile.objs | 2 +-
util/qemu-openpty.c | 135 ++++++++++++++++++++++++++++++++++++++++++++++++++
vl.c | 17 ++++---
xen-all.c | 8 +--
35 files changed, 569 insertions(+), 236 deletions(-)
create mode 100644 linux-headers/asm-mips/kvm.h
create mode 100644 linux-headers/asm-mips/kvm_para.h
create mode 100644 util/qemu-openpty.c
^ permalink raw reply [flat|nested] 29+ messages in thread
* [Qemu-devel] [PULL 01/26] qemu-char: remove a few needless #includes
2013-06-14 10:50 [Qemu-devel] [PULL 00/26] Trivial-patches pull request for 2013-06-14 Michael Tokarev
@ 2013-06-14 10:50 ` Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 02/26] gitignore: unignore *.patch Michael Tokarev
` (26 subsequent siblings)
27 siblings, 0 replies; 29+ messages in thread
From: Michael Tokarev @ 2013-06-14 10:50 UTC (permalink / raw)
To: Anthony Liguori; +Cc: qemu-trivial, Michael Tokarev, qemu-devel
This removes <syslog.h> since we don't use
syslogging, and removes second, solaris-specific,
include of <net/if.h> (which is included in
a common part of the file)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
qemu-char.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/qemu-char.c b/qemu-char.c
index 0b6ae95..596bf9e 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -76,8 +76,6 @@
#include <netinet/ip_icmp.h> // must come after ip.h
#include <netinet/udp.h>
#include <netinet/tcp.h>
-#include <net/if.h>
-#include <syslog.h>
#endif
#endif
#endif
--
1.7.10.4
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [Qemu-devel] [PULL 02/26] gitignore: unignore *.patch
2013-06-14 10:50 [Qemu-devel] [PULL 00/26] Trivial-patches pull request for 2013-06-14 Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 01/26] qemu-char: remove a few needless #includes Michael Tokarev
@ 2013-06-14 10:50 ` Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 03/26] configure: remove ${config_host_ld} variable Michael Tokarev
` (25 subsequent siblings)
27 siblings, 0 replies; 29+ messages in thread
From: Michael Tokarev @ 2013-06-14 10:50 UTC (permalink / raw)
To: Anthony Liguori; +Cc: qemu-trivial, Michael Tokarev, qemu-devel
This partially reverts:
commit 082369e62c5bbaba89f173c2b803bc24115bb111
Author: liguang <lig.fnst@cn.fujitsu.com>
Date: Fri Mar 22 16:44:13 2013 +0800
gitignore: ignore more files
I'm not sure how this went in. The thing is that
ignoring *.patch, in my opinion, is just wrong.
Especially for downstreams who apply patches for
real.
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
.gitignore | 1 -
1 file changed, 1 deletion(-)
diff --git a/.gitignore b/.gitignore
index 64e9466..0fe114d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -82,7 +82,6 @@ fsdev/virtfs-proxy-helper.pod
*.swp
*.orig
.pc
-*.patch
*.gcda
*.gcno
patches
--
1.7.10.4
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [Qemu-devel] [PULL 03/26] configure: remove ${config_host_ld} variable
2013-06-14 10:50 [Qemu-devel] [PULL 00/26] Trivial-patches pull request for 2013-06-14 Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 01/26] qemu-char: remove a few needless #includes Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 02/26] gitignore: unignore *.patch Michael Tokarev
@ 2013-06-14 10:50 ` Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 04/26] configure: Disable host-bsd USB on FreeBSD Michael Tokarev
` (24 subsequent siblings)
27 siblings, 0 replies; 29+ messages in thread
From: Michael Tokarev @ 2013-06-14 10:50 UTC (permalink / raw)
To: Anthony Liguori; +Cc: qemu-trivial, Michael Tokarev, Ed Maste, qemu-devel
From: Ed Maste <emaste@freebsd.org>
It was only used in one place (and already expanded in one other).
Signed-off-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
configure | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/configure b/configure
index 1654413..e197b91 100755
--- a/configure
+++ b/configure
@@ -3556,7 +3556,6 @@ echo "-> Your SDL version is too old - please upgrade to have SDL support"
fi
config_host_mak="config-host.mak"
-config_host_ld="config-host.ld"
echo "# Automatically generated by configure - do not modify" >config-all-disas.mak
@@ -4071,7 +4070,7 @@ if test "$gcov" = "yes" ; then
fi
# generate list of library paths for linker script
-$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
+$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > config-host.ld
# use included Linux headers
if test "$linux" = "yes" ; then
--
1.7.10.4
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [Qemu-devel] [PULL 04/26] configure: Disable host-bsd USB on FreeBSD
2013-06-14 10:50 [Qemu-devel] [PULL 00/26] Trivial-patches pull request for 2013-06-14 Michael Tokarev
` (2 preceding siblings ...)
2013-06-14 10:50 ` [Qemu-devel] [PULL 03/26] configure: remove ${config_host_ld} variable Michael Tokarev
@ 2013-06-14 10:50 ` Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 05/26] intc/xilinx_intc: Use qemu_set_irq Michael Tokarev
` (23 subsequent siblings)
27 siblings, 0 replies; 29+ messages in thread
From: Michael Tokarev @ 2013-06-14 10:50 UTC (permalink / raw)
To: Anthony Liguori; +Cc: qemu-trivial, Michael Tokarev, Ed Maste, qemu-devel
From: Ed Maste <emaste@freebsd.org>
It hasn't built since FreeBSD 8.x, and is disabled by a patch in the
FreeBSD ports tree. FreeBSD is migrating to QEMU's libusb support.
Signed-off-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
configure | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/configure b/configure
index e197b91..a3f0b7a 100755
--- a/configure
+++ b/configure
@@ -553,7 +553,9 @@ esac
if [ "$bsd" = "yes" ] ; then
if [ "$darwin" != "yes" ] ; then
- usb="bsd"
+ if [ "$targetos" != "FreeBSD" ]; then
+ usb="bsd"
+ fi
bsd_user="yes"
fi
fi
--
1.7.10.4
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [Qemu-devel] [PULL 05/26] intc/xilinx_intc: Use qemu_set_irq
2013-06-14 10:50 [Qemu-devel] [PULL 00/26] Trivial-patches pull request for 2013-06-14 Michael Tokarev
` (3 preceding siblings ...)
2013-06-14 10:50 ` [Qemu-devel] [PULL 04/26] configure: Disable host-bsd USB on FreeBSD Michael Tokarev
@ 2013-06-14 10:50 ` Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 06/26] curl: Whitespace only changes Michael Tokarev
` (22 subsequent siblings)
27 siblings, 0 replies; 29+ messages in thread
From: Michael Tokarev @ 2013-06-14 10:50 UTC (permalink / raw)
To: Anthony Liguori
Cc: qemu-trivial, Peter Crosthwaite, Michael Tokarev, qemu-devel
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Use qemu_set_irq rather than if-elsing qemu_irq_(lower|raise). No
functional change, just reduces verbosity.
Cc: qemu-trivial@nongnu.org
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
hw/intc/xilinx_intc.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/hw/intc/xilinx_intc.c b/hw/intc/xilinx_intc.c
index b106e72..5df7008 100644
--- a/hw/intc/xilinx_intc.c
+++ b/hw/intc/xilinx_intc.c
@@ -66,11 +66,7 @@ static void update_irq(struct xlx_pic *p)
i = ~0;
p->regs[R_IVR] = i;
- if ((p->regs[R_MER] & 1) && p->regs[R_IPR]) {
- qemu_irq_raise(p->parent_irq);
- } else {
- qemu_irq_lower(p->parent_irq);
- }
+ qemu_set_irq(p->parent_irq, (p->regs[R_MER] & 1) && p->regs[R_IPR]);
}
static uint64_t
--
1.7.10.4
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [Qemu-devel] [PULL 06/26] curl: Whitespace only changes.
2013-06-14 10:50 [Qemu-devel] [PULL 00/26] Trivial-patches pull request for 2013-06-14 Michael Tokarev
` (4 preceding siblings ...)
2013-06-14 10:50 ` [Qemu-devel] [PULL 05/26] intc/xilinx_intc: Use qemu_set_irq Michael Tokarev
@ 2013-06-14 10:50 ` Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 07/26] char/serial: cosmetic fixes Michael Tokarev
` (21 subsequent siblings)
27 siblings, 0 replies; 29+ messages in thread
From: Michael Tokarev @ 2013-06-14 10:50 UTC (permalink / raw)
To: Anthony Liguori
Cc: qemu-trivial, Michael Tokarev, qemu-devel, Richard W.M. Jones
From: "Richard W.M. Jones" <rjones@redhat.com>
Trivial patch to remove odd whitespace.
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
block/curl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/block/curl.c b/block/curl.c
index b8935fd..4dc3b4b 100644
--- a/block/curl.c
+++ b/block/curl.c
@@ -462,8 +462,8 @@ static int curl_open(BlockDriverState *bs, QDict *options, int flags)
// initialize the multi interface!
s->multi = curl_multi_init();
- curl_multi_setopt( s->multi, CURLMOPT_SOCKETDATA, s);
- curl_multi_setopt( s->multi, CURLMOPT_SOCKETFUNCTION, curl_sock_cb );
+ curl_multi_setopt(s->multi, CURLMOPT_SOCKETDATA, s);
+ curl_multi_setopt(s->multi, CURLMOPT_SOCKETFUNCTION, curl_sock_cb);
curl_multi_do(s);
qemu_opts_del(opts);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [Qemu-devel] [PULL 07/26] char/serial: cosmetic fixes.
2013-06-14 10:50 [Qemu-devel] [PULL 00/26] Trivial-patches pull request for 2013-06-14 Michael Tokarev
` (5 preceding siblings ...)
2013-06-14 10:50 ` [Qemu-devel] [PULL 06/26] curl: Whitespace only changes Michael Tokarev
@ 2013-06-14 10:50 ` Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 08/26] char/serial: Use generic Fifo8 Michael Tokarev
` (20 subsequent siblings)
27 siblings, 0 replies; 29+ messages in thread
From: Michael Tokarev @ 2013-06-14 10:50 UTC (permalink / raw)
To: Anthony Liguori
Cc: qemu-trivial, Peter Crosthwaite, Michael Tokarev, qemu-devel
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Some cosmetic fixes to char/serial fixing some checkpatch errors.
Cc: qemu-trivial@nongnu.org
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
hw/char/serial.c | 30 +++++++++++++++++++-----------
1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/hw/char/serial.c b/hw/char/serial.c
index 66b6348..bd6813e 100644
--- a/hw/char/serial.c
+++ b/hw/char/serial.c
@@ -263,8 +263,9 @@ static gboolean serial_xmit(GIOChannel *chan, GIOCondition cond, void *opaque)
if (s->tsr_retry <= 0) {
if (s->fcr & UART_FCR_FE) {
s->tsr = fifo_get(s,XMIT_FIFO);
- if (!s->xmit_fifo.count)
+ if (!s->xmit_fifo.count) {
s->lsr |= UART_LSR_THRE;
+ }
} else if ((s->lsr & UART_LSR_THRE)) {
return FALSE;
} else {
@@ -461,10 +462,11 @@ static uint64_t serial_ioport_read(void *opaque, hwaddr addr, unsigned size)
} else {
if(s->fcr & UART_FCR_FE) {
ret = fifo_get(s,RECV_FIFO);
- if (s->recv_fifo.count == 0)
+ if (s->recv_fifo.count == 0) {
s->lsr &= ~(UART_LSR_DR | UART_LSR_BI);
- else
+ } else {
qemu_mod_timer(s->fifo_timeout_timer, qemu_get_clock_ns (vm_clock) + s->char_transmit_time * 4);
+ }
s->timeout_ipending = 0;
} else {
ret = s->rbr;
@@ -534,15 +536,21 @@ static uint64_t serial_ioport_read(void *opaque, hwaddr addr, unsigned size)
static int serial_can_receive(SerialState *s)
{
if(s->fcr & UART_FCR_FE) {
- if(s->recv_fifo.count < UART_FIFO_LENGTH)
- /* Advertise (fifo.itl - fifo.count) bytes when count < ITL, and 1 if above. If UART_FIFO_LENGTH - fifo.count is
- advertised the effect will be to almost always fill the fifo completely before the guest has a chance to respond,
- effectively overriding the ITL that the guest has set. */
- return (s->recv_fifo.count <= s->recv_fifo.itl) ? s->recv_fifo.itl - s->recv_fifo.count : 1;
- else
- return 0;
+ if (s->recv_fifo.count < UART_FIFO_LENGTH) {
+ /*
+ * Advertise (fifo.itl - fifo.count) bytes when count < ITL, and 1
+ * if above. If UART_FIFO_LENGTH - fifo.count is advertised the
+ * effect will be to almost always fill the fifo completely before
+ * the guest has a chance to respond, effectively overriding the ITL
+ * that the guest has set.
+ */
+ return (s->recv_fifo.count <= s->recv_fifo.itl) ?
+ s->recv_fifo.itl - s->recv_fifo.count : 1;
+ } else {
+ return 0;
+ }
} else {
- return !(s->lsr & UART_LSR_DR);
+ return !(s->lsr & UART_LSR_DR);
}
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [Qemu-devel] [PULL 08/26] char/serial: Use generic Fifo8
2013-06-14 10:50 [Qemu-devel] [PULL 00/26] Trivial-patches pull request for 2013-06-14 Michael Tokarev
` (6 preceding siblings ...)
2013-06-14 10:50 ` [Qemu-devel] [PULL 07/26] char/serial: cosmetic fixes Michael Tokarev
@ 2013-06-14 10:50 ` Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 09/26] char/serial: serial_ioport_write: Factor out common code Michael Tokarev
` (19 subsequent siblings)
27 siblings, 0 replies; 29+ messages in thread
From: Michael Tokarev @ 2013-06-14 10:50 UTC (permalink / raw)
To: Anthony Liguori
Cc: qemu-trivial, Peter Crosthwaite, Michael Tokarev, qemu-devel
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Use the generic Fifo8 helper provided by QEMU, rather than re-implement
privately.
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
hw/char/serial.c | 98 ++++++++++++++++------------------------------
include/hw/char/serial.h | 15 +++----
2 files changed, 39 insertions(+), 74 deletions(-)
diff --git a/hw/char/serial.c b/hw/char/serial.c
index bd6813e..0a2b6c9 100644
--- a/hw/char/serial.c
+++ b/hw/char/serial.c
@@ -92,8 +92,6 @@
#define UART_FCR_RFR 0x02 /* RCVR Fifo Reset */
#define UART_FCR_FE 0x01 /* FIFO Enable */
-#define XMIT_FIFO 0
-#define RECV_FIFO 1
#define MAX_XMIT_RETRY 4
#ifdef DEBUG_SERIAL
@@ -106,50 +104,14 @@ do {} while (0)
static void serial_receive1(void *opaque, const uint8_t *buf, int size);
-static void fifo_clear(SerialState *s, int fifo)
+static inline void recv_fifo_put(SerialState *s, uint8_t chr)
{
- SerialFIFO *f = (fifo) ? &s->recv_fifo : &s->xmit_fifo;
- memset(f->data, 0, UART_FIFO_LENGTH);
- f->count = 0;
- f->head = 0;
- f->tail = 0;
-}
-
-static int fifo_put(SerialState *s, int fifo, uint8_t chr)
-{
- SerialFIFO *f = (fifo) ? &s->recv_fifo : &s->xmit_fifo;
-
/* Receive overruns do not overwrite FIFO contents. */
- if (fifo == XMIT_FIFO || f->count < UART_FIFO_LENGTH) {
-
- f->data[f->head++] = chr;
-
- if (f->head == UART_FIFO_LENGTH)
- f->head = 0;
- }
-
- if (f->count < UART_FIFO_LENGTH)
- f->count++;
- else if (fifo == RECV_FIFO)
+ if (!fifo8_is_full(&s->recv_fifo)) {
+ fifo8_push(&s->recv_fifo, chr);
+ } else {
s->lsr |= UART_LSR_OE;
-
- return 1;
-}
-
-static uint8_t fifo_get(SerialState *s, int fifo)
-{
- SerialFIFO *f = (fifo) ? &s->recv_fifo : &s->xmit_fifo;
- uint8_t c;
-
- if(f->count == 0)
- return 0;
-
- c = f->data[f->tail++];
- if (f->tail == UART_FIFO_LENGTH)
- f->tail = 0;
- f->count--;
-
- return c;
+ }
}
static void serial_update_irq(SerialState *s)
@@ -165,7 +127,7 @@ static void serial_update_irq(SerialState *s)
tmp_iir = UART_IIR_CTI;
} else if ((s->ier & UART_IER_RDI) && (s->lsr & UART_LSR_DR) &&
(!(s->fcr & UART_FCR_FE) ||
- s->recv_fifo.count >= s->recv_fifo.itl)) {
+ s->recv_fifo.num >= s->recv_fifo_itl)) {
tmp_iir = UART_IIR_RDI;
} else if ((s->ier & UART_IER_THRI) && s->thr_ipending) {
tmp_iir = UART_IIR_THRI;
@@ -262,8 +224,9 @@ static gboolean serial_xmit(GIOChannel *chan, GIOCondition cond, void *opaque)
if (s->tsr_retry <= 0) {
if (s->fcr & UART_FCR_FE) {
- s->tsr = fifo_get(s,XMIT_FIFO);
- if (!s->xmit_fifo.count) {
+ s->tsr = fifo8_is_full(&s->xmit_fifo) ?
+ 0 : fifo8_pop(&s->xmit_fifo);
+ if (!s->xmit_fifo.num) {
s->lsr |= UART_LSR_THRE;
}
} else if ((s->lsr & UART_LSR_THRE)) {
@@ -317,7 +280,11 @@ static void serial_ioport_write(void *opaque, hwaddr addr, uint64_t val,
} else {
s->thr = (uint8_t) val;
if(s->fcr & UART_FCR_FE) {
- fifo_put(s, XMIT_FIFO, s->thr);
+ /* xmit overruns overwrite data, so make space if needed */
+ if (fifo8_is_full(&s->xmit_fifo)) {
+ fifo8_pop(&s->xmit_fifo);
+ }
+ fifo8_push(&s->xmit_fifo, s->thr);
s->thr_ipending = 0;
s->lsr &= ~UART_LSR_TEMT;
s->lsr &= ~UART_LSR_THRE;
@@ -368,28 +335,28 @@ static void serial_ioport_write(void *opaque, hwaddr addr, uint64_t val,
if (val & UART_FCR_RFR) {
qemu_del_timer(s->fifo_timeout_timer);
s->timeout_ipending=0;
- fifo_clear(s,RECV_FIFO);
+ fifo8_reset(&s->recv_fifo);
}
if (val & UART_FCR_XFR) {
- fifo_clear(s,XMIT_FIFO);
+ fifo8_reset(&s->xmit_fifo);
}
if (val & UART_FCR_FE) {
s->iir |= UART_IIR_FE;
- /* Set RECV_FIFO trigger Level */
+ /* Set recv_fifo trigger Level */
switch (val & 0xC0) {
case UART_FCR_ITL_1:
- s->recv_fifo.itl = 1;
+ s->recv_fifo_itl = 1;
break;
case UART_FCR_ITL_2:
- s->recv_fifo.itl = 4;
+ s->recv_fifo_itl = 4;
break;
case UART_FCR_ITL_3:
- s->recv_fifo.itl = 8;
+ s->recv_fifo_itl = 8;
break;
case UART_FCR_ITL_4:
- s->recv_fifo.itl = 14;
+ s->recv_fifo_itl = 14;
break;
}
} else
@@ -461,8 +428,9 @@ static uint64_t serial_ioport_read(void *opaque, hwaddr addr, unsigned size)
ret = s->divider & 0xff;
} else {
if(s->fcr & UART_FCR_FE) {
- ret = fifo_get(s,RECV_FIFO);
- if (s->recv_fifo.count == 0) {
+ ret = fifo8_is_full(&s->recv_fifo) ?
+ 0 : fifo8_pop(&s->recv_fifo);
+ if (s->recv_fifo.num == 0) {
s->lsr &= ~(UART_LSR_DR | UART_LSR_BI);
} else {
qemu_mod_timer(s->fifo_timeout_timer, qemu_get_clock_ns (vm_clock) + s->char_transmit_time * 4);
@@ -536,7 +504,7 @@ static uint64_t serial_ioport_read(void *opaque, hwaddr addr, unsigned size)
static int serial_can_receive(SerialState *s)
{
if(s->fcr & UART_FCR_FE) {
- if (s->recv_fifo.count < UART_FIFO_LENGTH) {
+ if (s->recv_fifo.num < UART_FIFO_LENGTH) {
/*
* Advertise (fifo.itl - fifo.count) bytes when count < ITL, and 1
* if above. If UART_FIFO_LENGTH - fifo.count is advertised the
@@ -544,8 +512,8 @@ static int serial_can_receive(SerialState *s)
* the guest has a chance to respond, effectively overriding the ITL
* that the guest has set.
*/
- return (s->recv_fifo.count <= s->recv_fifo.itl) ?
- s->recv_fifo.itl - s->recv_fifo.count : 1;
+ return (s->recv_fifo.num <= s->recv_fifo_itl) ?
+ s->recv_fifo_itl - s->recv_fifo.num : 1;
} else {
return 0;
}
@@ -558,7 +526,7 @@ static void serial_receive_break(SerialState *s)
{
s->rbr = 0;
/* When the LSR_DR is set a null byte is pushed into the fifo */
- fifo_put(s, RECV_FIFO, '\0');
+ recv_fifo_put(s, '\0');
s->lsr |= UART_LSR_BI | UART_LSR_DR;
serial_update_irq(s);
}
@@ -566,7 +534,7 @@ static void serial_receive_break(SerialState *s)
/* There's data in recv_fifo and s->rbr has not been read for 4 char transmit times */
static void fifo_timeout_int (void *opaque) {
SerialState *s = opaque;
- if (s->recv_fifo.count) {
+ if (s->recv_fifo.num) {
s->timeout_ipending = 1;
serial_update_irq(s);
}
@@ -588,7 +556,7 @@ static void serial_receive1(void *opaque, const uint8_t *buf, int size)
if(s->fcr & UART_FCR_FE) {
int i;
for (i = 0; i < size; i++) {
- fifo_put(s, RECV_FIFO, buf[i]);
+ recv_fifo_put(s, buf[i]);
}
s->lsr |= UART_LSR_DR;
/* call the timeout receive callback in 4 char transmit time */
@@ -668,8 +636,8 @@ static void serial_reset(void *opaque)
s->char_transmit_time = (get_ticks_per_sec() / 9600) * 10;
s->poll_msl = 0;
- fifo_clear(s,RECV_FIFO);
- fifo_clear(s,XMIT_FIFO);
+ fifo8_reset(&s->recv_fifo);
+ fifo8_reset(&s->xmit_fifo);
s->last_xmit_ts = qemu_get_clock_ns(vm_clock);
@@ -692,6 +660,8 @@ void serial_init_core(SerialState *s)
qemu_chr_add_handlers(s->chr, serial_can_receive1, serial_receive1,
serial_event, s);
+ fifo8_create(&s->recv_fifo, UART_FIFO_LENGTH);
+ fifo8_create(&s->xmit_fifo, UART_FIFO_LENGTH);
}
void serial_exit_core(SerialState *s)
diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h
index bca79f1..9ab81f6 100644
--- a/include/hw/char/serial.h
+++ b/include/hw/char/serial.h
@@ -28,17 +28,10 @@
#include "hw/hw.h"
#include "sysemu/sysemu.h"
#include "exec/memory.h"
+#include "qemu/fifo8.h"
#define UART_FIFO_LENGTH 16 /* 16550A Fifo Length */
-typedef struct SerialFIFO {
- uint8_t data[UART_FIFO_LENGTH];
- uint8_t count;
- uint8_t itl; /* Interrupt Trigger Level */
- uint8_t tail;
- uint8_t head;
-} SerialFIFO;
-
struct SerialState {
uint16_t divider;
uint8_t rbr; /* receive register */
@@ -67,8 +60,10 @@ struct SerialState {
/* Time when the last byte was successfully sent out of the tsr */
uint64_t last_xmit_ts;
- SerialFIFO recv_fifo;
- SerialFIFO xmit_fifo;
+ Fifo8 recv_fifo;
+ Fifo8 xmit_fifo;
+ /* Interrupt trigger level for recv_fifo */
+ uint8_t recv_fifo_itl;
struct QEMUTimer *fifo_timeout_timer;
int timeout_ipending; /* timeout interrupt pending state */
--
1.7.10.4
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [Qemu-devel] [PULL 09/26] char/serial: serial_ioport_write: Factor out common code
2013-06-14 10:50 [Qemu-devel] [PULL 00/26] Trivial-patches pull request for 2013-06-14 Michael Tokarev
` (7 preceding siblings ...)
2013-06-14 10:50 ` [Qemu-devel] [PULL 08/26] char/serial: Use generic Fifo8 Michael Tokarev
@ 2013-06-14 10:50 ` Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 10/26] gtk: implement -full-screen Michael Tokarev
` (18 subsequent siblings)
27 siblings, 0 replies; 29+ messages in thread
From: Michael Tokarev @ 2013-06-14 10:50 UTC (permalink / raw)
To: Anthony Liguori
Cc: qemu-trivial, Peter Crosthwaite, Michael Tokarev, qemu-devel
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
These three lines are common to both FIFO and regular mode. Just factor
them out to outside the if rather than replicate the same lines inside
both if and else.
Cc: qemu-trivial@nongnu.org
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
hw/char/serial.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/hw/char/serial.c b/hw/char/serial.c
index 0a2b6c9..017610e 100644
--- a/hw/char/serial.c
+++ b/hw/char/serial.c
@@ -285,15 +285,11 @@ static void serial_ioport_write(void *opaque, hwaddr addr, uint64_t val,
fifo8_pop(&s->xmit_fifo);
}
fifo8_push(&s->xmit_fifo, s->thr);
- s->thr_ipending = 0;
s->lsr &= ~UART_LSR_TEMT;
- s->lsr &= ~UART_LSR_THRE;
- serial_update_irq(s);
- } else {
- s->thr_ipending = 0;
- s->lsr &= ~UART_LSR_THRE;
- serial_update_irq(s);
}
+ s->thr_ipending = 0;
+ s->lsr &= ~UART_LSR_THRE;
+ serial_update_irq(s);
serial_xmit(NULL, G_IO_OUT, s);
}
break;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [Qemu-devel] [PULL 10/26] gtk: implement -full-screen
2013-06-14 10:50 [Qemu-devel] [PULL 00/26] Trivial-patches pull request for 2013-06-14 Michael Tokarev
` (8 preceding siblings ...)
2013-06-14 10:50 ` [Qemu-devel] [PULL 09/26] char/serial: serial_ioport_write: Factor out common code Michael Tokarev
@ 2013-06-14 10:50 ` Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 11/26] Unbreak -no-quit for GTK, validate SDL options Michael Tokarev
` (17 subsequent siblings)
27 siblings, 0 replies; 29+ messages in thread
From: Michael Tokarev @ 2013-06-14 10:50 UTC (permalink / raw)
To: Anthony Liguori; +Cc: qemu-trivial, Peter Wu, Michael Tokarev, qemu-devel
From: Peter Wu <lekensteyn@gmail.com>
Aiming for GTK as replacement for SDL, a feature like -full-screen should also
be implemented.
Bringing the window into full-screen mode is done by activating the "Fullscreen"
menu item. This is done after showing the windows to make the cursor and menu
hidden.
v2: drop -no-frame implementation, use booleans instead of ints and ensure
consistency between ui state and menu.
Signed-off-by: Peter Wu <lekensteyn@gmail.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
include/ui/console.h | 2 +-
ui/gtk.c | 6 +++++-
vl.c | 2 +-
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/include/ui/console.h b/include/ui/console.h
index 4307b5f..f1d79f9 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -339,6 +339,6 @@ int index_from_keycode(int code);
/* gtk.c */
void early_gtk_display_init(void);
-void gtk_display_init(DisplayState *ds);
+void gtk_display_init(DisplayState *ds, bool full_screen);
#endif
diff --git a/ui/gtk.c b/ui/gtk.c
index 63f6081..e314dba 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -1435,7 +1435,7 @@ static const DisplayChangeListenerOps dcl_ops = {
.dpy_cursor_define = gd_cursor_define,
};
-void gtk_display_init(DisplayState *ds)
+void gtk_display_init(DisplayState *ds, bool full_screen)
{
GtkDisplayState *s = g_malloc0(sizeof(*s));
char *filename;
@@ -1511,6 +1511,10 @@ void gtk_display_init(DisplayState *ds)
gtk_widget_show_all(s->window);
+ if (full_screen) {
+ gtk_menu_item_activate(GTK_MENU_ITEM(s->full_screen_item));
+ }
+
register_displaychangelistener(&s->dcl);
global_state = s;
diff --git a/vl.c b/vl.c
index 180fdde..169c807 100644
--- a/vl.c
+++ b/vl.c
@@ -4348,7 +4348,7 @@ int main(int argc, char **argv, char **envp)
#endif
#if defined(CONFIG_GTK)
case DT_GTK:
- gtk_display_init(ds);
+ gtk_display_init(ds, full_screen);
break;
#endif
default:
--
1.7.10.4
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [Qemu-devel] [PULL 11/26] Unbreak -no-quit for GTK, validate SDL options
2013-06-14 10:50 [Qemu-devel] [PULL 00/26] Trivial-patches pull request for 2013-06-14 Michael Tokarev
` (9 preceding siblings ...)
2013-06-14 10:50 ` [Qemu-devel] [PULL 10/26] gtk: implement -full-screen Michael Tokarev
@ 2013-06-14 10:50 ` Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 12/26] Makefile: Install qemu-img and qemu-nbd man pages only if built Michael Tokarev
` (16 subsequent siblings)
27 siblings, 0 replies; 29+ messages in thread
From: Michael Tokarev @ 2013-06-14 10:50 UTC (permalink / raw)
To: Anthony Liguori; +Cc: qemu-trivial, Peter Wu, Michael Tokarev, qemu-devel
From: Peter Wu <lekensteyn@gmail.com>
Certain options (-no-frame, -alt-grab, -ctrl-grab) only make sense with SDL.
When compiling without SDL, these options (and -no-quit) print an error message
and exit qemu.
In case QEMU is compiled with SDL support, the three aforementioned options
still do not make sense with other display types. This patch addresses that
issue by printing a warning. I have chosen not to exit QEMU afterwards because
having the option is not harmful and before this patch it would be ignored
anyway.
By delaying the sanity check from compile-time with some ifdefs to run-time,
-no-quit is now also properly supported when compiling without SDL.
Signed-off-by: Peter Wu <lekensteyn@gmail.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
vl.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/vl.c b/vl.c
index 169c807..9f8fd6e 100644
--- a/vl.c
+++ b/vl.c
@@ -3524,7 +3524,6 @@ int main(int argc, char **argv, char **envp)
case QEMU_OPTION_full_screen:
full_screen = 1;
break;
-#ifdef CONFIG_SDL
case QEMU_OPTION_no_frame:
no_frame = 1;
break;
@@ -3537,14 +3536,11 @@ int main(int argc, char **argv, char **envp)
case QEMU_OPTION_no_quit:
no_quit = 1;
break;
+#ifdef CONFIG_SDL
case QEMU_OPTION_sdl:
display_type = DT_SDL;
break;
#else
- case QEMU_OPTION_no_frame:
- case QEMU_OPTION_alt_grab:
- case QEMU_OPTION_ctrl_grab:
- case QEMU_OPTION_no_quit:
case QEMU_OPTION_sdl:
fprintf(stderr, "SDL support is disabled\n");
exit(1);
@@ -4085,6 +4081,15 @@ int main(int argc, char **argv, char **envp)
#endif
}
+ if ((no_frame || alt_grab || ctrl_grab) && display_type != DT_SDL) {
+ fprintf(stderr, "-no-frame, -alt-grab and -ctrl-grab are only valid "
+ "for SDL, ignoring option\n");
+ }
+ if (no_quit && (display_type != DT_GTK && display_type != DT_SDL)) {
+ fprintf(stderr, "-no-quit is only valid for GTK and SDL, "
+ "ignoring option\n");
+ }
+
#if defined(CONFIG_GTK)
if (display_type == DT_GTK) {
early_gtk_display_init();
--
1.7.10.4
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [Qemu-devel] [PULL 12/26] Makefile: Install qemu-img and qemu-nbd man pages only if built
2013-06-14 10:50 [Qemu-devel] [PULL 00/26] Trivial-patches pull request for 2013-06-14 Michael Tokarev
` (10 preceding siblings ...)
2013-06-14 10:50 ` [Qemu-devel] [PULL 11/26] Unbreak -no-quit for GTK, validate SDL options Michael Tokarev
@ 2013-06-14 10:50 ` Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 13/26] device tree: Fix cppcheck warning Michael Tokarev
` (15 subsequent siblings)
27 siblings, 0 replies; 29+ messages in thread
From: Michael Tokarev @ 2013-06-14 10:50 UTC (permalink / raw)
To: Anthony Liguori
Cc: qemu-trivial, qemu-stable, Michael Tokarev, qemu-devel,
Andreas Färber
From: Andreas Färber <afaerber@suse.de>
When splitting openSUSE's qemu and qemu-linux-user packages we noticed
that for linux-user-only builds unrelated man pages got installed.
It's surely possible to delete them before packaging, but not installing
them in the first place seems more logical.
Cc: qemu-stable@nongnu.org
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
Makefile | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 306e7bd..3cfa7d0 100644
--- a/Makefile
+++ b/Makefile
@@ -306,10 +306,13 @@ install-doc: $(DOCS)
$(INSTALL_DATA) QMP/qmp-commands.txt "$(DESTDIR)$(qemu_docdir)"
ifdef CONFIG_POSIX
$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
- $(INSTALL_DATA) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
+ $(INSTALL_DATA) qemu.1 "$(DESTDIR)$(mandir)/man1"
+ifneq ($(TOOLS),)
+ $(INSTALL_DATA) qemu-img.1 "$(DESTDIR)$(mandir)/man1"
$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
$(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
endif
+endif
ifdef CONFIG_VIRTFS
$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
$(INSTALL_DATA) fsdev/virtfs-proxy-helper.1 "$(DESTDIR)$(mandir)/man1"
--
1.7.10.4
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [Qemu-devel] [PULL 13/26] device tree: Fix cppcheck warning
2013-06-14 10:50 [Qemu-devel] [PULL 00/26] Trivial-patches pull request for 2013-06-14 Michael Tokarev
` (11 preceding siblings ...)
2013-06-14 10:50 ` [Qemu-devel] [PULL 12/26] Makefile: Install qemu-img and qemu-nbd man pages only if built Michael Tokarev
@ 2013-06-14 10:50 ` Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 14/26] hw/scsi: Don't increment a boolean value Michael Tokarev
` (14 subsequent siblings)
27 siblings, 0 replies; 29+ messages in thread
From: Michael Tokarev @ 2013-06-14 10:50 UTC (permalink / raw)
To: Anthony Liguori; +Cc: qemu-trivial, Stefan Weil, Michael Tokarev, qemu-devel
From: Stefan Weil <sw@weilnetz.de>
Fix this cppcheck warning:
Checking device_tree.c...
device_tree.c:216: style:
Checking if unsigned variable 'r' is less than zero.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
device_tree.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/device_tree.c b/device_tree.c
index 56af24b..69be9da 100644
--- a/device_tree.c
+++ b/device_tree.c
@@ -213,7 +213,7 @@ uint32_t qemu_devtree_get_phandle(void *fdt, const char *path)
uint32_t r;
r = fdt_get_phandle(fdt, findnode_nofail(fdt, path));
- if (r <= 0) {
+ if (r == 0) {
fprintf(stderr, "%s: Couldn't get phandle for %s: %s\n", __func__,
path, fdt_strerror(r));
exit(1);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [Qemu-devel] [PULL 14/26] hw/scsi: Don't increment a boolean value
2013-06-14 10:50 [Qemu-devel] [PULL 00/26] Trivial-patches pull request for 2013-06-14 Michael Tokarev
` (12 preceding siblings ...)
2013-06-14 10:50 ` [Qemu-devel] [PULL 13/26] device tree: Fix cppcheck warning Michael Tokarev
@ 2013-06-14 10:50 ` Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 15/26] target-sparc: Replace free by g_free Michael Tokarev
` (13 subsequent siblings)
27 siblings, 0 replies; 29+ messages in thread
From: Michael Tokarev @ 2013-06-14 10:50 UTC (permalink / raw)
To: Anthony Liguori; +Cc: qemu-trivial, Stefan Weil, Michael Tokarev, qemu-devel
From: Stefan Weil <sw@weilnetz.de>
This fixes a warning from cppcheck.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
hw/scsi/vmw_pvscsi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c
index 48d12f4..446f723 100644
--- a/hw/scsi/vmw_pvscsi.c
+++ b/hw/scsi/vmw_pvscsi.c
@@ -389,7 +389,7 @@ pvscsi_process_completion_queue(void *opaque)
QTAILQ_REMOVE(&s->completion_queue, pvscsi_req, next);
pvscsi_cmp_ring_put(s, &pvscsi_req->cmp);
g_free(pvscsi_req);
- has_completed++;
+ has_completed = true;
}
if (has_completed) {
--
1.7.10.4
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [Qemu-devel] [PULL 15/26] target-sparc: Replace free by g_free
2013-06-14 10:50 [Qemu-devel] [PULL 00/26] Trivial-patches pull request for 2013-06-14 Michael Tokarev
` (13 preceding siblings ...)
2013-06-14 10:50 ` [Qemu-devel] [PULL 14/26] hw/scsi: Don't increment a boolean value Michael Tokarev
@ 2013-06-14 10:50 ` Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 16/26] hw/xen: Use g_free instead of free and fix potential memory leaks Michael Tokarev
` (12 subsequent siblings)
27 siblings, 0 replies; 29+ messages in thread
From: Michael Tokarev @ 2013-06-14 10:50 UTC (permalink / raw)
To: Anthony Liguori; +Cc: qemu-trivial, Stefan Weil, Michael Tokarev, qemu-devel
From: Stefan Weil <sw@weilnetz.de>
The wrong function was reported by cppcheck.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
target-sparc/cpu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target-sparc/cpu.c b/target-sparc/cpu.c
index 290b580..13bb7bb 100644
--- a/target-sparc/cpu.c
+++ b/target-sparc/cpu.c
@@ -614,7 +614,7 @@ static int cpu_sparc_find_by_name(sparc_def_t *cpu_def, const char *cpu_model)
return 0;
error:
- free(s);
+ g_free(s);
return -1;
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [Qemu-devel] [PULL 16/26] hw/xen: Use g_free instead of free and fix potential memory leaks
2013-06-14 10:50 [Qemu-devel] [PULL 00/26] Trivial-patches pull request for 2013-06-14 Michael Tokarev
` (14 preceding siblings ...)
2013-06-14 10:50 ` [Qemu-devel] [PULL 15/26] target-sparc: Replace free by g_free Michael Tokarev
@ 2013-06-14 10:50 ` Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 17/26] ivshmem: add missing error exit(2) Michael Tokarev
` (11 subsequent siblings)
27 siblings, 0 replies; 29+ messages in thread
From: Michael Tokarev @ 2013-06-14 10:50 UTC (permalink / raw)
To: Anthony Liguori; +Cc: qemu-trivial, Stefan Weil, Michael Tokarev, qemu-devel
From: Stefan Weil <sw@weilnetz.de>
The wrong functions and the missing calls of g_free were reported
by cppcheck.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
hw/xen/xen_pt_config_init.c | 4 ++--
xen-all.c | 8 +++++---
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/hw/xen/xen_pt_config_init.c b/hw/xen/xen_pt_config_init.c
index 01872db..8ccc2e4 100644
--- a/hw/xen/xen_pt_config_init.c
+++ b/hw/xen/xen_pt_config_init.c
@@ -1777,12 +1777,12 @@ static int xen_pt_config_reg_init(XenPCIPassthroughState *s,
rc = reg->init(s, reg_entry->reg,
reg_grp->base_offset + reg->offset, &data);
if (rc < 0) {
- free(reg_entry);
+ g_free(reg_entry);
return rc;
}
if (data == XEN_PT_INVALID_REG) {
/* free unused BAR register entry */
- free(reg_entry);
+ g_free(reg_entry);
return 0;
}
/* set register value */
diff --git a/xen-all.c b/xen-all.c
index bc105f1..1a1d7bb 100644
--- a/xen-all.c
+++ b/xen-all.c
@@ -389,7 +389,7 @@ static int xen_remove_from_physmap(XenIOState *state,
if (state->log_for_dirtybit == physmap) {
state->log_for_dirtybit = NULL;
}
- free(physmap);
+ g_free(physmap);
return 0;
}
@@ -1030,7 +1030,7 @@ static void xen_read_physmap(XenIOState *state)
xen_domid, entries[i]);
value = xs_read(state->xenstore, 0, path, &len);
if (value == NULL) {
- free(physmap);
+ g_free(physmap);
continue;
}
physmap->start_addr = strtoull(value, NULL, 16);
@@ -1041,7 +1041,7 @@ static void xen_read_physmap(XenIOState *state)
xen_domid, entries[i]);
value = xs_read(state->xenstore, 0, path, &len);
if (value == NULL) {
- free(physmap);
+ g_free(physmap);
continue;
}
physmap->size = strtoull(value, NULL, 16);
@@ -1069,12 +1069,14 @@ int xen_hvm_init(void)
state->xce_handle = xen_xc_evtchn_open(NULL, 0);
if (state->xce_handle == XC_HANDLER_INITIAL_VALUE) {
perror("xen: event channel open");
+ g_free(state);
return -errno;
}
state->xenstore = xs_daemon_open();
if (state->xenstore == NULL) {
perror("xen: xenstore open");
+ g_free(state);
return -errno;
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [Qemu-devel] [PULL 17/26] ivshmem: add missing error exit(2)
2013-06-14 10:50 [Qemu-devel] [PULL 00/26] Trivial-patches pull request for 2013-06-14 Michael Tokarev
` (15 preceding siblings ...)
2013-06-14 10:50 ` [Qemu-devel] [PULL 16/26] hw/xen: Use g_free instead of free and fix potential memory leaks Michael Tokarev
@ 2013-06-14 10:50 ` Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 18/26] KVM: ARM: Add dummy kvm_arch_init_irq_routing() Michael Tokarev
` (10 subsequent siblings)
27 siblings, 0 replies; 29+ messages in thread
From: Michael Tokarev @ 2013-06-14 10:50 UTC (permalink / raw)
To: Anthony Liguori
Cc: qemu-trivial, Michael Tokarev, qemu-devel, qemu-stable,
Stefan Hajnoczi, Cam Macdonell
From: Stefan Hajnoczi <stefanha@redhat.com>
If the user fails to specify 'chardev' or 'shm' then we cannot continue.
Exit right away so that we don't invoke shm_open(3) with a NULL pointer.
It would be nice to replace exit(1) with error returns in the PCI device
.init() function, but leave that for another patch since exit(1) is
currently used elsewhere.
Spotted by Coverity.
Cc: Cam Macdonell <cam@cs.ualberta.ca>
Cc: qemu-stable@nongnu.org
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
hw/misc/ivshmem.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
index a19a6d6..5658f73 100644
--- a/hw/misc/ivshmem.c
+++ b/hw/misc/ivshmem.c
@@ -735,6 +735,7 @@ static int pci_ivshmem_init(PCIDevice *dev)
if (s->shmobj == NULL) {
fprintf(stderr, "Must specify 'chardev' or 'shm' to ivshmem\n");
+ exit(1);
}
IVSHMEM_DPRINTF("using shm_open (shm object = %s)\n", s->shmobj);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [Qemu-devel] [PULL 18/26] KVM: ARM: Add dummy kvm_arch_init_irq_routing()
2013-06-14 10:50 [Qemu-devel] [PULL 00/26] Trivial-patches pull request for 2013-06-14 Michael Tokarev
` (16 preceding siblings ...)
2013-06-14 10:50 ` [Qemu-devel] [PULL 17/26] ivshmem: add missing error exit(2) Michael Tokarev
@ 2013-06-14 10:50 ` Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 19/26] KVM: S390: " Michael Tokarev
` (9 subsequent siblings)
27 siblings, 0 replies; 29+ messages in thread
From: Michael Tokarev @ 2013-06-14 10:50 UTC (permalink / raw)
To: Anthony Liguori
Cc: qemu-trivial, Alexey Kardashevskiy, Michael Tokarev, qemu-devel
From: Alexey Kardashevskiy <aik@ozlabs.ru>
The common KVM code insists on calling kvm_arch_init_irq_routing()
as soon as it sees kernel header support for it (regardless of whether
QEMU supports it). Provide a dummy function to satisfy this.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
target-arm/kvm.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/target-arm/kvm.c b/target-arm/kvm.c
index b7bdc03..27dcab9 100644
--- a/target-arm/kvm.c
+++ b/target-arm/kvm.c
@@ -491,3 +491,7 @@ void kvm_arch_remove_all_hw_breakpoints(void)
{
qemu_log_mask(LOG_UNIMP, "%s: not implemented\n", __func__);
}
+
+void kvm_arch_init_irq_routing(KVMState *s)
+{
+}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [Qemu-devel] [PULL 19/26] KVM: S390: Add dummy kvm_arch_init_irq_routing()
2013-06-14 10:50 [Qemu-devel] [PULL 00/26] Trivial-patches pull request for 2013-06-14 Michael Tokarev
` (17 preceding siblings ...)
2013-06-14 10:50 ` [Qemu-devel] [PULL 18/26] KVM: ARM: Add dummy kvm_arch_init_irq_routing() Michael Tokarev
@ 2013-06-14 10:50 ` Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 20/26] KVM: PPC: " Michael Tokarev
` (8 subsequent siblings)
27 siblings, 0 replies; 29+ messages in thread
From: Michael Tokarev @ 2013-06-14 10:50 UTC (permalink / raw)
To: Anthony Liguori
Cc: qemu-trivial, Alexey Kardashevskiy, Michael Tokarev, qemu-devel
From: Alexey Kardashevskiy <aik@ozlabs.ru>
The common KVM code insists on calling kvm_arch_init_irq_routing()
as soon as it sees kernel header support for it (regardless of whether
QEMU supports it). Provide a dummy function to satisfy this.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
target-s390x/kvm.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c
index 862fb12..4d9ac4a 100644
--- a/target-s390x/kvm.c
+++ b/target-s390x/kvm.c
@@ -928,3 +928,7 @@ void kvm_s390_enable_css_support(S390CPU *cpu)
r = kvm_vcpu_ioctl(CPU(cpu), KVM_ENABLE_CAP, &cap);
assert(r == 0);
}
+
+void kvm_arch_init_irq_routing(KVMState *s)
+{
+}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [Qemu-devel] [PULL 20/26] KVM: PPC: Add dummy kvm_arch_init_irq_routing()
2013-06-14 10:50 [Qemu-devel] [PULL 00/26] Trivial-patches pull request for 2013-06-14 Michael Tokarev
` (18 preceding siblings ...)
2013-06-14 10:50 ` [Qemu-devel] [PULL 19/26] KVM: S390: " Michael Tokarev
@ 2013-06-14 10:50 ` Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 21/26] linux-headers: Update to v3.10-rc5 Michael Tokarev
` (7 subsequent siblings)
27 siblings, 0 replies; 29+ messages in thread
From: Michael Tokarev @ 2013-06-14 10:50 UTC (permalink / raw)
To: Anthony Liguori
Cc: qemu-trivial, Scott Wood, Michael Tokarev, qemu-devel,
Alexey Kardashevskiy
From: Scott Wood <scottwood@freescale.com>
The common KVM code insists on calling kvm_arch_init_irq_routing()
as soon as it sees kernel header support for it (regardless of whether
QEMU supports it). Provide a dummy function to satisfy this.
Unlike x86, PPC does not have one default irqchip, so there's no common
code that we'd stick here. Even if you ignore the routes themselves,
which even on x86 are not set up in this function, the initial XICS
kernel implementation will not support IRQ routing, so it's best to
leave even the general feature flags up to the specific irqchip code.
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
target-ppc/kvm.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index 3ab2946..2bbc3b8 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -1797,3 +1797,7 @@ int kvm_arch_on_sigbus(int code, void *addr)
{
return 1;
}
+
+void kvm_arch_init_irq_routing(KVMState *s)
+{
+}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [Qemu-devel] [PULL 21/26] linux-headers: Update to v3.10-rc5
2013-06-14 10:50 [Qemu-devel] [PULL 00/26] Trivial-patches pull request for 2013-06-14 Michael Tokarev
` (19 preceding siblings ...)
2013-06-14 10:50 ` [Qemu-devel] [PULL 20/26] KVM: PPC: " Michael Tokarev
@ 2013-06-14 10:50 ` Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 22/26] libcacard/vscclient: fix leakage of socket on error paths Michael Tokarev
` (6 subsequent siblings)
27 siblings, 0 replies; 29+ messages in thread
From: Michael Tokarev @ 2013-06-14 10:50 UTC (permalink / raw)
To: Anthony Liguori
Cc: qemu-trivial, Alexey Kardashevskiy, Michael Tokarev, qemu-devel
From: Alexey Kardashevskiy <aik@ozlabs.ru>
This adds symbols required for PPC64 pseries platform features:
1. sPAPR live migration;
2. in-kernel XICS interrupt controller.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
| 12 ++--
| 138 +++++++++++++++++++++++++++++++++++++
| 1 +
| 89 ++++++++++++++++++++++++
| 1 -
| 42 +++++++++--
| 1 +
| 28 ++++++++
8 files changed, 299 insertions(+), 13 deletions(-)
create mode 100644 linux-headers/asm-mips/kvm.h
create mode 100644 linux-headers/asm-mips/kvm_para.h
--git a/linux-headers/asm-arm/kvm.h b/linux-headers/asm-arm/kvm.h
index 023bfeb..c1ee007 100644
--- a/linux-headers/asm-arm/kvm.h
+++ b/linux-headers/asm-arm/kvm.h
@@ -53,12 +53,12 @@
#define KVM_ARM_FIQ_spsr fiq_regs[7]
struct kvm_regs {
- struct pt_regs usr_regs;/* R0_usr - R14_usr, PC, CPSR */
- __u32 svc_regs[3]; /* SP_svc, LR_svc, SPSR_svc */
- __u32 abt_regs[3]; /* SP_abt, LR_abt, SPSR_abt */
- __u32 und_regs[3]; /* SP_und, LR_und, SPSR_und */
- __u32 irq_regs[3]; /* SP_irq, LR_irq, SPSR_irq */
- __u32 fiq_regs[8]; /* R8_fiq - R14_fiq, SPSR_fiq */
+ struct pt_regs usr_regs; /* R0_usr - R14_usr, PC, CPSR */
+ unsigned long svc_regs[3]; /* SP_svc, LR_svc, SPSR_svc */
+ unsigned long abt_regs[3]; /* SP_abt, LR_abt, SPSR_abt */
+ unsigned long und_regs[3]; /* SP_und, LR_und, SPSR_und */
+ unsigned long irq_regs[3]; /* SP_irq, LR_irq, SPSR_irq */
+ unsigned long fiq_regs[8]; /* R8_fiq - R14_fiq, SPSR_fiq */
};
/* Supported Processor Types */
--git a/linux-headers/asm-mips/kvm.h b/linux-headers/asm-mips/kvm.h
new file mode 100644
index 0000000..3f424f5
--- /dev/null
+++ b/linux-headers/asm-mips/kvm.h
@@ -0,0 +1,138 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.
+ * Copyright (C) 2013 Cavium, Inc.
+ * Authors: Sanjay Lal <sanjayl@kymasys.com>
+ */
+
+#ifndef __LINUX_KVM_MIPS_H
+#define __LINUX_KVM_MIPS_H
+
+#include <linux/types.h>
+
+/*
+ * KVM MIPS specific structures and definitions.
+ *
+ * Some parts derived from the x86 version of this file.
+ */
+
+/*
+ * for KVM_GET_REGS and KVM_SET_REGS
+ *
+ * If Config[AT] is zero (32-bit CPU), the register contents are
+ * stored in the lower 32-bits of the struct kvm_regs fields and sign
+ * extended to 64-bits.
+ */
+struct kvm_regs {
+ /* out (KVM_GET_REGS) / in (KVM_SET_REGS) */
+ __u64 gpr[32];
+ __u64 hi;
+ __u64 lo;
+ __u64 pc;
+};
+
+/*
+ * for KVM_GET_FPU and KVM_SET_FPU
+ *
+ * If Status[FR] is zero (32-bit FPU), the upper 32-bits of the FPRs
+ * are zero filled.
+ */
+struct kvm_fpu {
+ __u64 fpr[32];
+ __u32 fir;
+ __u32 fccr;
+ __u32 fexr;
+ __u32 fenr;
+ __u32 fcsr;
+ __u32 pad;
+};
+
+
+/*
+ * For MIPS, we use KVM_SET_ONE_REG and KVM_GET_ONE_REG to access CP0
+ * registers. The id field is broken down as follows:
+ *
+ * bits[2..0] - Register 'sel' index.
+ * bits[7..3] - Register 'rd' index.
+ * bits[15..8] - Must be zero.
+ * bits[63..16] - 1 -> CP0 registers.
+ *
+ * Other sets registers may be added in the future. Each set would
+ * have its own identifier in bits[63..16].
+ *
+ * The addr field of struct kvm_one_reg must point to an aligned
+ * 64-bit wide location. For registers that are narrower than
+ * 64-bits, the value is stored in the low order bits of the location,
+ * and sign extended to 64-bits.
+ *
+ * The registers defined in struct kvm_regs are also accessible, the
+ * id values for these are below.
+ */
+
+#define KVM_REG_MIPS_R0 0
+#define KVM_REG_MIPS_R1 1
+#define KVM_REG_MIPS_R2 2
+#define KVM_REG_MIPS_R3 3
+#define KVM_REG_MIPS_R4 4
+#define KVM_REG_MIPS_R5 5
+#define KVM_REG_MIPS_R6 6
+#define KVM_REG_MIPS_R7 7
+#define KVM_REG_MIPS_R8 8
+#define KVM_REG_MIPS_R9 9
+#define KVM_REG_MIPS_R10 10
+#define KVM_REG_MIPS_R11 11
+#define KVM_REG_MIPS_R12 12
+#define KVM_REG_MIPS_R13 13
+#define KVM_REG_MIPS_R14 14
+#define KVM_REG_MIPS_R15 15
+#define KVM_REG_MIPS_R16 16
+#define KVM_REG_MIPS_R17 17
+#define KVM_REG_MIPS_R18 18
+#define KVM_REG_MIPS_R19 19
+#define KVM_REG_MIPS_R20 20
+#define KVM_REG_MIPS_R21 21
+#define KVM_REG_MIPS_R22 22
+#define KVM_REG_MIPS_R23 23
+#define KVM_REG_MIPS_R24 24
+#define KVM_REG_MIPS_R25 25
+#define KVM_REG_MIPS_R26 26
+#define KVM_REG_MIPS_R27 27
+#define KVM_REG_MIPS_R28 28
+#define KVM_REG_MIPS_R29 29
+#define KVM_REG_MIPS_R30 30
+#define KVM_REG_MIPS_R31 31
+
+#define KVM_REG_MIPS_HI 32
+#define KVM_REG_MIPS_LO 33
+#define KVM_REG_MIPS_PC 34
+
+/*
+ * KVM MIPS specific structures and definitions
+ *
+ */
+struct kvm_debug_exit_arch {
+ __u64 epc;
+};
+
+/* for KVM_SET_GUEST_DEBUG */
+struct kvm_guest_debug_arch {
+};
+
+/* definition of registers in kvm_run */
+struct kvm_sync_regs {
+};
+
+/* dummy definition */
+struct kvm_sregs {
+};
+
+struct kvm_mips_interrupt {
+ /* in */
+ __u32 cpu;
+ __u32 irq;
+};
+
+#endif /* __LINUX_KVM_MIPS_H */
--git a/linux-headers/asm-mips/kvm_para.h b/linux-headers/asm-mips/kvm_para.h
new file mode 100644
index 0000000..14fab8f
--- /dev/null
+++ b/linux-headers/asm-mips/kvm_para.h
@@ -0,0 +1 @@
+#include <asm-generic/kvm_para.h>
--git a/linux-headers/asm-powerpc/kvm.h b/linux-headers/asm-powerpc/kvm.h
index ef072b1..0fb1a6e 100644
--- a/linux-headers/asm-powerpc/kvm.h
+++ b/linux-headers/asm-powerpc/kvm.h
@@ -25,6 +25,8 @@
/* Select powerpc specific features in <linux/kvm.h> */
#define __KVM_HAVE_SPAPR_TCE
#define __KVM_HAVE_PPC_SMT
+#define __KVM_HAVE_IRQCHIP
+#define __KVM_HAVE_IRQ_LINE
struct kvm_regs {
__u64 pc;
@@ -272,8 +274,31 @@ struct kvm_debug_exit_arch {
/* for KVM_SET_GUEST_DEBUG */
struct kvm_guest_debug_arch {
+ struct {
+ /* H/W breakpoint/watchpoint address */
+ __u64 addr;
+ /*
+ * Type denotes h/w breakpoint, read watchpoint, write
+ * watchpoint or watchpoint (both read and write).
+ */
+#define KVMPPC_DEBUG_NONE 0x0
+#define KVMPPC_DEBUG_BREAKPOINT (1UL << 1)
+#define KVMPPC_DEBUG_WATCH_WRITE (1UL << 2)
+#define KVMPPC_DEBUG_WATCH_READ (1UL << 3)
+ __u32 type;
+ __u32 reserved;
+ } bp[16];
};
+/* Debug related defines */
+/*
+ * kvm_guest_debug->control is a 32 bit field. The lower 16 bits are generic
+ * and upper 16 bits are architecture specific. Architecture specific defines
+ * that ioctl is for setting hardware breakpoint or software breakpoint.
+ */
+#define KVM_GUESTDBG_USE_SW_BP 0x00010000
+#define KVM_GUESTDBG_USE_HW_BP 0x00020000
+
/* definition of registers in kvm_run */
struct kvm_sync_regs {
};
@@ -299,6 +324,12 @@ struct kvm_allocate_rma {
__u64 rma_size;
};
+/* for KVM_CAP_PPC_RTAS */
+struct kvm_rtas_token_args {
+ char name[120];
+ __u64 token; /* Use a token of 0 to undefine a mapping */
+};
+
struct kvm_book3e_206_tlb_entry {
__u32 mas8;
__u32 mas1;
@@ -359,6 +390,26 @@ struct kvm_get_htab_header {
__u16 n_invalid;
};
+/* Per-vcpu XICS interrupt controller state */
+#define KVM_REG_PPC_ICP_STATE (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x8c)
+
+#define KVM_REG_PPC_ICP_CPPR_SHIFT 56 /* current proc priority */
+#define KVM_REG_PPC_ICP_CPPR_MASK 0xff
+#define KVM_REG_PPC_ICP_XISR_SHIFT 32 /* interrupt status field */
+#define KVM_REG_PPC_ICP_XISR_MASK 0xffffff
+#define KVM_REG_PPC_ICP_MFRR_SHIFT 24 /* pending IPI priority */
+#define KVM_REG_PPC_ICP_MFRR_MASK 0xff
+#define KVM_REG_PPC_ICP_PPRI_SHIFT 16 /* pending irq priority */
+#define KVM_REG_PPC_ICP_PPRI_MASK 0xff
+
+/* Device control API: PPC-specific devices */
+#define KVM_DEV_MPIC_GRP_MISC 1
+#define KVM_DEV_MPIC_BASE_ADDR 0 /* 64-bit */
+
+#define KVM_DEV_MPIC_GRP_REGISTER 2 /* 32-bit */
+#define KVM_DEV_MPIC_GRP_IRQ_ACTIVE 3 /* 32-bit */
+
+/* One-Reg API: PPC-specific registers */
#define KVM_REG_PPC_HIOR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x1)
#define KVM_REG_PPC_IAC1 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x2)
#define KVM_REG_PPC_IAC2 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x3)
@@ -422,4 +473,42 @@ struct kvm_get_htab_header {
#define KVM_REG_PPC_CLEAR_TSR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x88)
#define KVM_REG_PPC_TCR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x89)
#define KVM_REG_PPC_TSR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x8a)
+
+/* Debugging: Special instruction for software breakpoint */
+#define KVM_REG_PPC_DEBUG_INST (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x8b)
+
+/* MMU registers */
+#define KVM_REG_PPC_MAS0 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x8c)
+#define KVM_REG_PPC_MAS1 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x8d)
+#define KVM_REG_PPC_MAS2 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x8e)
+#define KVM_REG_PPC_MAS7_3 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x8f)
+#define KVM_REG_PPC_MAS4 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x90)
+#define KVM_REG_PPC_MAS6 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x91)
+#define KVM_REG_PPC_MMUCFG (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x92)
+/*
+ * TLBnCFG fields TLBnCFG_N_ENTRY and TLBnCFG_ASSOC can be changed only using
+ * KVM_CAP_SW_TLB ioctl
+ */
+#define KVM_REG_PPC_TLB0CFG (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x93)
+#define KVM_REG_PPC_TLB1CFG (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x94)
+#define KVM_REG_PPC_TLB2CFG (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x95)
+#define KVM_REG_PPC_TLB3CFG (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x96)
+#define KVM_REG_PPC_TLB0PS (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x97)
+#define KVM_REG_PPC_TLB1PS (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x98)
+#define KVM_REG_PPC_TLB2PS (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x99)
+#define KVM_REG_PPC_TLB3PS (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x9a)
+#define KVM_REG_PPC_EPTCFG (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x9b)
+
+/* PPC64 eXternal Interrupt Controller Specification */
+#define KVM_DEV_XICS_GRP_SOURCES 1 /* 64-bit source attributes */
+
+/* Layout of 64-bit source attribute values */
+#define KVM_XICS_DESTINATION_SHIFT 0
+#define KVM_XICS_DESTINATION_MASK 0xffffffffULL
+#define KVM_XICS_PRIORITY_SHIFT 32
+#define KVM_XICS_PRIORITY_MASK 0xff
+#define KVM_XICS_LEVEL_SENSITIVE (1ULL << 40)
+#define KVM_XICS_MASKED (1ULL << 41)
+#define KVM_XICS_PENDING (1ULL << 42)
+
#endif /* __LINUX_KVM_POWERPC_H */
--git a/linux-headers/asm-x86/kvm.h b/linux-headers/asm-x86/kvm.h
index a65ec29..5d9a303 100644
--- a/linux-headers/asm-x86/kvm.h
+++ b/linux-headers/asm-x86/kvm.h
@@ -29,7 +29,6 @@
#define __KVM_HAVE_PIT
#define __KVM_HAVE_IOAPIC
#define __KVM_HAVE_IRQ_LINE
-#define __KVM_HAVE_DEVICE_ASSIGNMENT
#define __KVM_HAVE_MSI
#define __KVM_HAVE_USER_NMI
#define __KVM_HAVE_GUEST_DEBUG
--git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h
index eb02d8a..c614070 100644
--- a/linux-headers/linux/kvm.h
+++ b/linux-headers/linux/kvm.h
@@ -561,9 +561,7 @@ struct kvm_ppc_smmu_info {
#define KVM_CAP_MP_STATE 14
#define KVM_CAP_COALESCED_MMIO 15
#define KVM_CAP_SYNC_MMU 16 /* Changes to host mmap are reflected in guest */
-#ifdef __KVM_HAVE_DEVICE_ASSIGNMENT
#define KVM_CAP_DEVICE_ASSIGNMENT 17
-#endif
#define KVM_CAP_IOMMU 18
#ifdef __KVM_HAVE_MSI
#define KVM_CAP_DEVICE_MSI 20
@@ -579,13 +577,9 @@ struct kvm_ppc_smmu_info {
#ifdef __KVM_HAVE_PIT
#define KVM_CAP_REINJECT_CONTROL 24
#endif
-#ifdef __KVM_HAVE_IOAPIC
#define KVM_CAP_IRQ_ROUTING 25
-#endif
#define KVM_CAP_IRQ_INJECT_STATUS 26
-#ifdef __KVM_HAVE_DEVICE_ASSIGNMENT
#define KVM_CAP_DEVICE_DEASSIGNMENT 27
-#endif
#ifdef __KVM_HAVE_MSIX
#define KVM_CAP_DEVICE_MSIX 28
#endif
@@ -668,6 +662,10 @@ struct kvm_ppc_smmu_info {
#define KVM_CAP_PPC_EPR 86
#define KVM_CAP_ARM_PSCI 87
#define KVM_CAP_ARM_SET_DEVICE_ADDR 88
+#define KVM_CAP_DEVICE_CTRL 89
+#define KVM_CAP_IRQ_MPIC 90
+#define KVM_CAP_PPC_RTAS 91
+#define KVM_CAP_IRQ_XICS 92
#ifdef KVM_CAP_IRQ_ROUTING
@@ -821,6 +819,28 @@ struct kvm_arm_device_addr {
};
/*
+ * Device control API, available with KVM_CAP_DEVICE_CTRL
+ */
+#define KVM_CREATE_DEVICE_TEST 1
+
+struct kvm_create_device {
+ __u32 type; /* in: KVM_DEV_TYPE_xxx */
+ __u32 fd; /* out: device handle */
+ __u32 flags; /* in: KVM_CREATE_DEVICE_xxx */
+};
+
+struct kvm_device_attr {
+ __u32 flags; /* no flags currently defined */
+ __u32 group; /* device-defined */
+ __u64 attr; /* group-defined */
+ __u64 addr; /* userspace address of attr data */
+};
+
+#define KVM_DEV_TYPE_FSL_MPIC_20 1
+#define KVM_DEV_TYPE_FSL_MPIC_42 2
+#define KVM_DEV_TYPE_XICS 3
+
+/*
* ioctls for VM fds
*/
#define KVM_SET_MEMORY_REGION _IOW(KVMIO, 0x40, struct kvm_memory_region)
@@ -907,6 +927,16 @@ struct kvm_s390_ucas_mapping {
#define KVM_PPC_GET_HTAB_FD _IOW(KVMIO, 0xaa, struct kvm_get_htab_fd)
/* Available with KVM_CAP_ARM_SET_DEVICE_ADDR */
#define KVM_ARM_SET_DEVICE_ADDR _IOW(KVMIO, 0xab, struct kvm_arm_device_addr)
+/* Available with KVM_CAP_PPC_RTAS */
+#define KVM_PPC_RTAS_DEFINE_TOKEN _IOW(KVMIO, 0xac, struct kvm_rtas_token_args)
+
+/* ioctl for vm fd */
+#define KVM_CREATE_DEVICE _IOWR(KVMIO, 0xe0, struct kvm_create_device)
+
+/* ioctls for fds returned by KVM_CREATE_DEVICE */
+#define KVM_SET_DEVICE_ATTR _IOW(KVMIO, 0xe1, struct kvm_device_attr)
+#define KVM_GET_DEVICE_ATTR _IOW(KVMIO, 0xe2, struct kvm_device_attr)
+#define KVM_HAS_DEVICE_ATTR _IOW(KVMIO, 0xe3, struct kvm_device_attr)
/*
* ioctls for vcpu fds
--git a/linux-headers/linux/vfio.h b/linux-headers/linux/vfio.h
index e094121..7ec1864 100644
--- a/linux-headers/linux/vfio.h
+++ b/linux-headers/linux/vfio.h
@@ -319,6 +319,7 @@ enum {
VFIO_PCI_INTX_IRQ_INDEX,
VFIO_PCI_MSI_IRQ_INDEX,
VFIO_PCI_MSIX_IRQ_INDEX,
+ VFIO_PCI_ERR_IRQ_INDEX,
VFIO_PCI_NUM_IRQS
};
--git a/linux-headers/linux/vhost.h b/linux-headers/linux/vhost.h
index 165a484..c656f61 100644
--- a/linux-headers/linux/vhost.h
+++ b/linux-headers/linux/vhost.h
@@ -127,4 +127,32 @@ struct vhost_memory {
/* vhost-net should add virtio_net_hdr for RX, and strip for TX packets. */
#define VHOST_NET_F_VIRTIO_NET_HDR 27
+/* VHOST_SCSI specific definitions */
+
+/*
+ * Used by QEMU userspace to ensure a consistent vhost-scsi ABI.
+ *
+ * ABI Rev 0: July 2012 version starting point for v3.6-rc merge candidate +
+ * RFC-v2 vhost-scsi userspace. Add GET_ABI_VERSION ioctl usage
+ * ABI Rev 1: January 2013. Ignore vhost_tpgt filed in struct vhost_scsi_target.
+ * All the targets under vhost_wwpn can be seen and used by guset.
+ */
+
+#define VHOST_SCSI_ABI_VERSION 1
+
+struct vhost_scsi_target {
+ int abi_version;
+ char vhost_wwpn[224]; /* TRANSPORT_IQN_LEN */
+ unsigned short vhost_tpgt;
+ unsigned short reserved;
+};
+
+#define VHOST_SCSI_SET_ENDPOINT _IOW(VHOST_VIRTIO, 0x40, struct vhost_scsi_target)
+#define VHOST_SCSI_CLEAR_ENDPOINT _IOW(VHOST_VIRTIO, 0x41, struct vhost_scsi_target)
+/* Changing this breaks userspace. */
+#define VHOST_SCSI_GET_ABI_VERSION _IOW(VHOST_VIRTIO, 0x42, int)
+/* Set and get the events missed flag */
+#define VHOST_SCSI_SET_EVENTS_MISSED _IOW(VHOST_VIRTIO, 0x43, __u32)
+#define VHOST_SCSI_GET_EVENTS_MISSED _IOW(VHOST_VIRTIO, 0x44, __u32)
+
#endif
--
1.7.10.4
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [Qemu-devel] [PULL 22/26] libcacard/vscclient: fix leakage of socket on error paths
2013-06-14 10:50 [Qemu-devel] [PULL 00/26] Trivial-patches pull request for 2013-06-14 Michael Tokarev
` (20 preceding siblings ...)
2013-06-14 10:50 ` [Qemu-devel] [PULL 21/26] linux-headers: Update to v3.10-rc5 Michael Tokarev
@ 2013-06-14 10:50 ` Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 23/26] main-loop: do not include slirp/slirp.h, use libslirp.h instead Michael Tokarev
` (5 subsequent siblings)
27 siblings, 0 replies; 29+ messages in thread
From: Michael Tokarev @ 2013-06-14 10:50 UTC (permalink / raw)
To: Anthony Liguori; +Cc: qemu-trivial, Michael Tokarev, Alon Levy, qemu-devel
From: Alon Levy <alevy@redhat.com>
Spotted by Coverity.
Signed-off-by: Alon Levy <alevy@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
libcacard/vscclient.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/libcacard/vscclient.c b/libcacard/vscclient.c
index ac23647..5180d29 100644
--- a/libcacard/vscclient.c
+++ b/libcacard/vscclient.c
@@ -618,18 +618,22 @@ connect_to_qemu(
if (ret != 0) {
/* Error */
fprintf(stderr, "getaddrinfo failed\n");
- return -1;
+ goto cleanup_socket;
}
if (connect(sock, server->ai_addr, server->ai_addrlen) < 0) {
/* Error */
fprintf(stderr, "Could not connect\n");
- return -1;
+ goto cleanup_socket;
}
if (verbose) {
printf("Connected (sizeof Header=%zd)!\n", sizeof(VSCMsgHeader));
}
return sock;
+
+cleanup_socket:
+ closesocket(sock);
+ return -1;
}
int
@@ -759,5 +763,6 @@ main(
g_io_channel_unref(channel_socket);
g_byte_array_unref(socket_to_send);
+ closesocket(sock);
return 0;
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [Qemu-devel] [PULL 23/26] main-loop: do not include slirp/slirp.h, use libslirp.h instead
2013-06-14 10:50 [Qemu-devel] [PULL 00/26] Trivial-patches pull request for 2013-06-14 Michael Tokarev
` (21 preceding siblings ...)
2013-06-14 10:50 ` [Qemu-devel] [PULL 22/26] libcacard/vscclient: fix leakage of socket on error paths Michael Tokarev
@ 2013-06-14 10:50 ` Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 24/26] create qemu_openpty_raw() helper function and move it to a separate file Michael Tokarev
` (4 subsequent siblings)
27 siblings, 0 replies; 29+ messages in thread
From: Michael Tokarev @ 2013-06-14 10:50 UTC (permalink / raw)
To: Anthony Liguori; +Cc: qemu-trivial, Michael Tokarev, qemu-devel
The header slirp/slirp.h is an internal header for slirp, and
main-loop.c does not use internals from there. Instead, it uses
public functions (slirp_update_timeout(), slirp_pollfds_fill()
etc) which are declared in slirp/libslirp.h.
Including slirp/slirp.h is somewhat dangerous since it redefines
errno on WIN32, so any file including it may misbehave wrt errno.
Unfortunately libslirp isn't self-contained, it needs declaration
of struct in_addr, which is provided by qemu/sockets.h. Maybe
instead of #including qemu/sockets.h before libslirp.h, it is
better to make the latter self-contained.
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
---
main-loop.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/main-loop.c b/main-loop.c
index cf36645..a44fff6 100644
--- a/main-loop.c
+++ b/main-loop.c
@@ -24,7 +24,8 @@
#include "qemu-common.h"
#include "qemu/timer.h"
-#include "slirp/slirp.h"
+#include "qemu/sockets.h" // struct in_addr needed for libslirp.h
+#include "slirp/libslirp.h"
#include "qemu/main-loop.h"
#include "block/aio.h"
--
1.7.10.4
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [Qemu-devel] [PULL 24/26] create qemu_openpty_raw() helper function and move it to a separate file
2013-06-14 10:50 [Qemu-devel] [PULL 00/26] Trivial-patches pull request for 2013-06-14 Michael Tokarev
` (22 preceding siblings ...)
2013-06-14 10:50 ` [Qemu-devel] [PULL 23/26] main-loop: do not include slirp/slirp.h, use libslirp.h instead Michael Tokarev
@ 2013-06-14 10:50 ` Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 25/26] cputlb: fix debug logs Michael Tokarev
` (3 subsequent siblings)
27 siblings, 0 replies; 29+ messages in thread
From: Michael Tokarev @ 2013-06-14 10:50 UTC (permalink / raw)
To: Anthony Liguori; +Cc: qemu-trivial, Michael Tokarev, qemu-devel
In two places qemu uses openpty() which is very system-dependent,
and in both places the pty is switched to raw mode as well.
Make a wrapper function which does both steps, and move all the
system-dependent complexity into a separate file, together
with static/local implementations of openpty() and cfmakeraw()
from qemu-char.c.
It is in a separate file, not part of oslib-posix.c, because
openpty() often resides in -lutil which is not linked to
every program qemu builds.
This change removes #including of <pty.h>, <termios.h>
and other rather specific system headers out of qemu-common.h,
which isn't a place for such specific headers really.
This version has been verified to build correctly on Linux,
OpenBSD, FreeBSD and OpenIndiana. On the latter it lets qemu
to be built with gtk gui which were not possible there due to
missing openpty() and cfmakeraw().
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Tested-by: Andreas Färber <andreas.faerber@web.de>
---
include/qemu-common.h | 15 +-----
qemu-char.c | 77 ++--------------------------
ui/gtk.c | 12 ++---
util/Makefile.objs | 2 +-
util/qemu-openpty.c | 135 +++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 146 insertions(+), 95 deletions(-)
create mode 100644 util/qemu-openpty.c
diff --git a/include/qemu-common.h b/include/qemu-common.h
index ed8b6e2..3c91375 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -42,19 +42,6 @@
#include <signal.h>
#include "glib-compat.h"
-#if defined(__GLIBC__)
-# include <pty.h>
-#elif defined CONFIG_BSD
-# include <termios.h>
-# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
-# include <libutil.h>
-# else
-# include <util.h>
-# endif
-#elif defined CONFIG_SOLARIS
-# include <stropts.h>
-#endif
-
#ifdef _WIN32
#include "sysemu/os-win32.h"
#endif
@@ -235,6 +222,8 @@ ssize_t qemu_recv_full(int fd, void *buf, size_t count, int flags)
#ifndef _WIN32
int qemu_pipe(int pipefd[2]);
+/* like openpty() but also makes it raw; return master fd */
+int qemu_openpty_raw(int *aslave, char *pty_name);
#endif
#ifdef _WIN32
diff --git a/qemu-char.c b/qemu-char.c
index 596bf9e..2c3cfe6 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -964,63 +964,6 @@ static CharDriverState *qemu_chr_open_stdio(ChardevStdio *opts)
return chr;
}
-#ifdef __sun__
-/* Once Solaris has openpty(), this is going to be removed. */
-static int openpty(int *amaster, int *aslave, char *name,
- struct termios *termp, struct winsize *winp)
-{
- const char *slave;
- int mfd = -1, sfd = -1;
-
- *amaster = *aslave = -1;
-
- mfd = open("/dev/ptmx", O_RDWR | O_NOCTTY);
- if (mfd < 0)
- goto err;
-
- if (grantpt(mfd) == -1 || unlockpt(mfd) == -1)
- goto err;
-
- if ((slave = ptsname(mfd)) == NULL)
- goto err;
-
- if ((sfd = open(slave, O_RDONLY | O_NOCTTY)) == -1)
- goto err;
-
- if (ioctl(sfd, I_PUSH, "ptem") == -1 ||
- (termp != NULL && tcgetattr(sfd, termp) < 0))
- goto err;
-
- if (amaster)
- *amaster = mfd;
- if (aslave)
- *aslave = sfd;
- if (winp)
- ioctl(sfd, TIOCSWINSZ, winp);
-
- return 0;
-
-err:
- if (sfd != -1)
- close(sfd);
- close(mfd);
- return -1;
-}
-
-static void cfmakeraw (struct termios *termios_p)
-{
- termios_p->c_iflag &=
- ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
- termios_p->c_oflag &= ~OPOST;
- termios_p->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
- termios_p->c_cflag &= ~(CSIZE|PARENB);
- termios_p->c_cflag |= CS8;
-
- termios_p->c_cc[VMIN] = 0;
- termios_p->c_cc[VTIME] = 0;
-}
-#endif
-
#if defined(__linux__) || defined(__sun__) || defined(__FreeBSD__) \
|| defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) \
|| defined(__GLIBC__)
@@ -1192,34 +1135,24 @@ static CharDriverState *qemu_chr_open_pty(const char *id,
{
CharDriverState *chr;
PtyCharDriver *s;
- struct termios tty;
int master_fd, slave_fd;
-#if defined(__OpenBSD__) || defined(__DragonFly__)
char pty_name[PATH_MAX];
-#define q_ptsname(x) pty_name
-#else
- char *pty_name = NULL;
-#define q_ptsname(x) ptsname(x)
-#endif
- if (openpty(&master_fd, &slave_fd, pty_name, NULL, NULL) < 0) {
+ master_fd = qemu_openpty_raw(&slave_fd, pty_name);
+ if (master_fd < 0) {
return NULL;
}
- /* Set raw attributes on the pty. */
- tcgetattr(slave_fd, &tty);
- cfmakeraw(&tty);
- tcsetattr(slave_fd, TCSAFLUSH, &tty);
close(slave_fd);
chr = g_malloc0(sizeof(CharDriverState));
- chr->filename = g_strdup_printf("pty:%s", q_ptsname(master_fd));
- ret->pty = g_strdup(q_ptsname(master_fd));
+ chr->filename = g_strdup_printf("pty:%s", pty_name);
+ ret->pty = g_strdup(pty_name);
ret->has_pty = true;
fprintf(stderr, "char device redirected to %s (label %s)\n",
- q_ptsname(master_fd), id);
+ pty_name, id);
s = g_malloc0(sizeof(PtyCharDriver));
chr->opaque = s;
diff --git a/ui/gtk.c b/ui/gtk.c
index e314dba..50a6993 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -1160,8 +1160,7 @@ static GSList *gd_vc_init(GtkDisplayState *s, VirtualConsole *vc, int index, GSL
GIOChannel *chan;
GtkWidget *scrolled_window;
GtkAdjustment *vadjustment;
- int master_fd, slave_fd, ret;
- struct termios tty;
+ int master_fd, slave_fd;
snprintf(buffer, sizeof(buffer), "vc%d", index);
snprintf(path, sizeof(path), "<QEMU>/View/VC%d", index);
@@ -1181,13 +1180,8 @@ static GSList *gd_vc_init(GtkDisplayState *s, VirtualConsole *vc, int index, GSL
vc->terminal = vte_terminal_new();
- ret = openpty(&master_fd, &slave_fd, NULL, NULL, NULL);
- g_assert(ret != -1);
-
- /* Set raw attributes on the pty. */
- tcgetattr(slave_fd, &tty);
- cfmakeraw(&tty);
- tcsetattr(slave_fd, TCSAFLUSH, &tty);
+ master_fd = qemu_openpty_raw(&slave_fd, NULL);
+ g_assert(master_fd != -1);
#if VTE_CHECK_VERSION(0, 26, 0)
pty = vte_pty_new_foreign(master_fd, NULL);
diff --git a/util/Makefile.objs b/util/Makefile.objs
index 4a1bd4e..dc72ab0 100644
--- a/util/Makefile.objs
+++ b/util/Makefile.objs
@@ -1,6 +1,6 @@
util-obj-y = osdep.o cutils.o unicode.o qemu-timer-common.o
util-obj-$(CONFIG_WIN32) += oslib-win32.o qemu-thread-win32.o event_notifier-win32.o
-util-obj-$(CONFIG_POSIX) += oslib-posix.o qemu-thread-posix.o event_notifier-posix.o
+util-obj-$(CONFIG_POSIX) += oslib-posix.o qemu-thread-posix.o event_notifier-posix.o qemu-openpty.o
util-obj-y += envlist.o path.o host-utils.o cache-utils.o module.o
util-obj-y += bitmap.o bitops.o hbitmap.o
util-obj-y += fifo8.o
diff --git a/util/qemu-openpty.c b/util/qemu-openpty.c
new file mode 100644
index 0000000..4febfe9
--- /dev/null
+++ b/util/qemu-openpty.c
@@ -0,0 +1,135 @@
+/*
+ * qemu-openpty.c
+ *
+ * Copyright (c) 2003-2008 Fabrice Bellard
+ * Copyright (c) 2010 Red Hat, Inc.
+ *
+ * Wrapper function qemu_openpty() implementation.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/*
+ * This is not part of oslib-posix.c because this function
+ * uses openpty() which often in -lutil, and if we add this
+ * dependency to oslib-posix.o, every app will have to be
+ * linked with -lutil.
+ */
+
+#include "config-host.h"
+#include "qemu-common.h"
+
+#if defined(__GLIBC__)
+# include <pty.h>
+#elif defined CONFIG_BSD
+# include <termios.h>
+# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
+# include <libutil.h>
+# else
+# include <util.h>
+# endif
+#elif defined CONFIG_SOLARIS
+# include <termios.h>
+# include <stropts.h>
+#endif
+
+#ifdef __sun__
+/* Once Solaris has openpty(), this is going to be removed. */
+static int openpty(int *amaster, int *aslave, char *name,
+ struct termios *termp, struct winsize *winp)
+{
+ const char *slave;
+ int mfd = -1, sfd = -1;
+
+ *amaster = *aslave = -1;
+
+ mfd = open("/dev/ptmx", O_RDWR | O_NOCTTY);
+ if (mfd < 0)
+ goto err;
+
+ if (grantpt(mfd) == -1 || unlockpt(mfd) == -1)
+ goto err;
+
+ if ((slave = ptsname(mfd)) == NULL)
+ goto err;
+
+ if ((sfd = open(slave, O_RDONLY | O_NOCTTY)) == -1)
+ goto err;
+
+ if (ioctl(sfd, I_PUSH, "ptem") == -1 ||
+ (termp != NULL && tcgetattr(sfd, termp) < 0))
+ goto err;
+
+ if (amaster)
+ *amaster = mfd;
+ if (aslave)
+ *aslave = sfd;
+ if (winp)
+ ioctl(sfd, TIOCSWINSZ, winp);
+
+ return 0;
+
+err:
+ if (sfd != -1)
+ close(sfd);
+ close(mfd);
+ return -1;
+}
+
+static void cfmakeraw (struct termios *termios_p)
+{
+ termios_p->c_iflag &=
+ ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
+ termios_p->c_oflag &= ~OPOST;
+ termios_p->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
+ termios_p->c_cflag &= ~(CSIZE|PARENB);
+ termios_p->c_cflag |= CS8;
+
+ termios_p->c_cc[VMIN] = 0;
+ termios_p->c_cc[VTIME] = 0;
+}
+#endif
+
+int qemu_openpty_raw(int *aslave, char *pty_name)
+{
+ int amaster;
+ struct termios tty;
+#if defined(__OpenBSD__) || defined(__DragonFly__)
+ char pty_buf[PATH_MAX];
+#define q_ptsname(x) pty_buf
+#else
+ char *pty_buf = NULL;
+#define q_ptsname(x) ptsname(x)
+#endif
+
+ if (openpty(&amaster, aslave, pty_buf, NULL, NULL) < 0) {
+ return -1;
+ }
+
+ /* Set raw attributes on the pty. */
+ tcgetattr(*aslave, &tty);
+ cfmakeraw(&tty);
+ tcsetattr(*aslave, TCSAFLUSH, &tty);
+
+ if (pty_name) {
+ strcpy(pty_name, q_ptsname(amaster));
+ }
+
+ return amaster;
+}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [Qemu-devel] [PULL 25/26] cputlb: fix debug logs
2013-06-14 10:50 [Qemu-devel] [PULL 00/26] Trivial-patches pull request for 2013-06-14 Michael Tokarev
` (23 preceding siblings ...)
2013-06-14 10:50 ` [Qemu-devel] [PULL 24/26] create qemu_openpty_raw() helper function and move it to a separate file Michael Tokarev
@ 2013-06-14 10:50 ` Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 26/26] piix: fix some printf errors when debug is enabled Michael Tokarev
` (2 subsequent siblings)
27 siblings, 0 replies; 29+ messages in thread
From: Michael Tokarev @ 2013-06-14 10:50 UTC (permalink / raw)
To: Anthony Liguori
Cc: qemu-trivial, Michael Tokarev, Hervé Poussineau, qemu-devel
From: Hervé Poussineau <hpoussin@reactos.org>
'pd' variable has been removed in 06ef3525e1f271b6a842781a05eace5cf63b95c2.
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
cputlb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cputlb.c b/cputlb.c
index 86666c8..1230e9e 100644
--- a/cputlb.c
+++ b/cputlb.c
@@ -262,8 +262,8 @@ void tlb_set_page(CPUArchState *env, target_ulong vaddr,
#if defined(DEBUG_TLB)
printf("tlb_set_page: vaddr=" TARGET_FMT_lx " paddr=0x" TARGET_FMT_plx
- " prot=%x idx=%d pd=0x%08lx\n",
- vaddr, paddr, prot, mmu_idx, pd);
+ " prot=%x idx=%d\n",
+ vaddr, paddr, prot, mmu_idx);
#endif
address = vaddr;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [Qemu-devel] [PULL 26/26] piix: fix some printf errors when debug is enabled
2013-06-14 10:50 [Qemu-devel] [PULL 00/26] Trivial-patches pull request for 2013-06-14 Michael Tokarev
` (24 preceding siblings ...)
2013-06-14 10:50 ` [Qemu-devel] [PULL 25/26] cputlb: fix debug logs Michael Tokarev
@ 2013-06-14 10:50 ` Michael Tokarev
2013-06-14 10:52 ` [Qemu-devel] [PULL 00/26] Trivial-patches pull request for 2013-06-14 Michael Tokarev
2013-06-17 21:17 ` Anthony Liguori
27 siblings, 0 replies; 29+ messages in thread
From: Michael Tokarev @ 2013-06-14 10:50 UTC (permalink / raw)
To: Anthony Liguori; +Cc: qemu-trivial, Hu Tao, Michael Tokarev, qemu-devel
From: Hu Tao <hutao@cn.fujitsu.com>
And use PRIxxx macros if possible.
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
hw/acpi/piix4.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index e6525ac..756df3b 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -518,7 +518,7 @@ static uint64_t gpe_readb(void *opaque, hwaddr addr, unsigned width)
PIIX4PMState *s = opaque;
uint32_t val = acpi_gpe_ioport_readb(&s->ar, addr);
- PIIX4_DPRINTF("gpe read %x == %x\n", addr, val);
+ PIIX4_DPRINTF("gpe read %" HWADDR_PRIx " == %" PRIu32 "\n", addr, val);
return val;
}
@@ -530,7 +530,7 @@ static void gpe_writeb(void *opaque, hwaddr addr, uint64_t val,
acpi_gpe_ioport_writeb(&s->ar, addr, val);
pm_update_sci(s);
- PIIX4_DPRINTF("gpe write %x <== %d\n", addr, val);
+ PIIX4_DPRINTF("gpe write %" HWADDR_PRIx " <== %" PRIu64 "\n", addr, val);
}
static const MemoryRegionOps piix4_gpe_ops = {
@@ -553,15 +553,15 @@ static uint64_t pci_read(void *opaque, hwaddr addr, unsigned int size)
/* Manufacture an "up" value to cause a device check on any hotplug
* slot with a device. Extra device checks are harmless. */
val = s->pci0_slot_device_present & s->pci0_hotplug_enable;
- PIIX4_DPRINTF("pci_up_read %x\n", val);
+ PIIX4_DPRINTF("pci_up_read %" PRIu32 "\n", val);
break;
case PCI_DOWN_BASE - PCI_HOTPLUG_ADDR:
val = s->pci0_status.down;
- PIIX4_DPRINTF("pci_down_read %x\n", val);
+ PIIX4_DPRINTF("pci_down_read %" PRIu32 "\n", val);
break;
case PCI_EJ_BASE - PCI_HOTPLUG_ADDR:
/* No feature defined yet */
- PIIX4_DPRINTF("pci_features_read %x\n", val);
+ PIIX4_DPRINTF("pci_features_read %" PRIu32 "\n", val);
break;
case PCI_RMV_BASE - PCI_HOTPLUG_ADDR:
val = s->pci0_hotplug_enable;
@@ -579,7 +579,7 @@ static void pci_write(void *opaque, hwaddr addr, uint64_t data,
switch (addr) {
case PCI_EJ_BASE - PCI_HOTPLUG_ADDR:
acpi_piix_eject_slot(opaque, (uint32_t)data);
- PIIX4_DPRINTF("pciej write %" HWADDR_PRIx " <== % " PRIu64 "\n",
+ PIIX4_DPRINTF("pciej write %" HWADDR_PRIx " <== %" PRIu64 "\n",
addr, data);
break;
default:
--
1.7.10.4
^ permalink raw reply related [flat|nested] 29+ messages in thread
* Re: [Qemu-devel] [PULL 00/26] Trivial-patches pull request for 2013-06-14
2013-06-14 10:50 [Qemu-devel] [PULL 00/26] Trivial-patches pull request for 2013-06-14 Michael Tokarev
` (25 preceding siblings ...)
2013-06-14 10:50 ` [Qemu-devel] [PULL 26/26] piix: fix some printf errors when debug is enabled Michael Tokarev
@ 2013-06-14 10:52 ` Michael Tokarev
2013-06-17 21:17 ` Anthony Liguori
27 siblings, 0 replies; 29+ messages in thread
From: Michael Tokarev @ 2013-06-14 10:52 UTC (permalink / raw)
To: Michael Tokarev; +Cc: qemu-trivial, Anthony Liguori, qemu-devel
14.06.2013 14:50, Michael Tokarev wrote:
> are available in the git repository at:
>
> git://git.corpit.ru/qemu.git trivial-patches-next
And this is the same as
git://git.corpit.ru/qemu.git trivial-patches
*Sigh*.
/mjt
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [Qemu-devel] [PULL 00/26] Trivial-patches pull request for 2013-06-14
2013-06-14 10:50 [Qemu-devel] [PULL 00/26] Trivial-patches pull request for 2013-06-14 Michael Tokarev
` (26 preceding siblings ...)
2013-06-14 10:52 ` [Qemu-devel] [PULL 00/26] Trivial-patches pull request for 2013-06-14 Michael Tokarev
@ 2013-06-17 21:17 ` Anthony Liguori
27 siblings, 0 replies; 29+ messages in thread
From: Anthony Liguori @ 2013-06-17 21:17 UTC (permalink / raw)
To: Michael Tokarev, Anthony Liguori; +Cc: qemu-trivial, qemu-devel
Pulled. Thanks.
Regards,
Anthony Liguori
^ permalink raw reply [flat|nested] 29+ messages in thread
end of thread, other threads:[~2013-06-17 21:18 UTC | newest]
Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-14 10:50 [Qemu-devel] [PULL 00/26] Trivial-patches pull request for 2013-06-14 Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 01/26] qemu-char: remove a few needless #includes Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 02/26] gitignore: unignore *.patch Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 03/26] configure: remove ${config_host_ld} variable Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 04/26] configure: Disable host-bsd USB on FreeBSD Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 05/26] intc/xilinx_intc: Use qemu_set_irq Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 06/26] curl: Whitespace only changes Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 07/26] char/serial: cosmetic fixes Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 08/26] char/serial: Use generic Fifo8 Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 09/26] char/serial: serial_ioport_write: Factor out common code Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 10/26] gtk: implement -full-screen Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 11/26] Unbreak -no-quit for GTK, validate SDL options Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 12/26] Makefile: Install qemu-img and qemu-nbd man pages only if built Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 13/26] device tree: Fix cppcheck warning Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 14/26] hw/scsi: Don't increment a boolean value Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 15/26] target-sparc: Replace free by g_free Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 16/26] hw/xen: Use g_free instead of free and fix potential memory leaks Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 17/26] ivshmem: add missing error exit(2) Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 18/26] KVM: ARM: Add dummy kvm_arch_init_irq_routing() Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 19/26] KVM: S390: " Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 20/26] KVM: PPC: " Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 21/26] linux-headers: Update to v3.10-rc5 Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 22/26] libcacard/vscclient: fix leakage of socket on error paths Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 23/26] main-loop: do not include slirp/slirp.h, use libslirp.h instead Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 24/26] create qemu_openpty_raw() helper function and move it to a separate file Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 25/26] cputlb: fix debug logs Michael Tokarev
2013-06-14 10:50 ` [Qemu-devel] [PULL 26/26] piix: fix some printf errors when debug is enabled Michael Tokarev
2013-06-14 10:52 ` [Qemu-devel] [PULL 00/26] Trivial-patches pull request for 2013-06-14 Michael Tokarev
2013-06-17 21:17 ` Anthony Liguori
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).