Re: [Qemu-devel] [Qemu-ppc] [PATCH] hw/ppc/spapr.c: cleaning up qdev_get_machine() calls

2017-09-08 Thread David Gibson
On Thu, Sep 07, 2017 at 05:21:23PM +0200, Greg Kurz wrote:
> On Wed,  6 Sep 2017 15:43:05 -0300
> Daniel Henrique Barboza  wrote:
> 
> > This patch removes the qdev_get_machine() calls that are made in
> > spapr.c in situations where we can get an existing pointer for
> > the MachineState by either passing it as an argument to the function
> > or by using other already available pointers.
> > 
> > The following changes were made:
> > 
> > - spapr_node0_size: static function that is called two times:
> > at spapr_setup_hpt_and_vrma and ppc_spapr_init. In both cases we can
> > pass an existing MachineState pointer to it.
> > 
> > - spapr_build_fdt: MachineState pointer can be retrieved from
> > the existing sPAPRMachineState pointer.
> > 
> > - spapr_boot_set: the opaque in the first arg is a sPAPRMachineState
> > pointer as we can see inside ppc_spapr_init:
> > 
> > qemu_register_boot_set(spapr_boot_set, spapr);
> > 
> > We can get a MachineState pointer from it.
> > 
> > - spapr_machine_device_plug and spapr_machine_device_unplug_request: the
> > MachineState, sPAPRMachineState, MachineClass and sPAPRMachineClass pointers
> > can all be retrieved from the HotplugHandler pointer.
> > 
> > Signed-off-by: Daniel Henrique Barboza 
> > ---
> 
> It makes sense for me.
> 
> Reviewed-by: Greg Kurz 

Applied to ppc-for-2.11.

> 
> >  hw/ppc/spapr.c | 19 +--
> >  1 file changed, 9 insertions(+), 10 deletions(-)
> > 
> > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> > index cec441c..6ac3390 100644
> > --- a/hw/ppc/spapr.c
> > +++ b/hw/ppc/spapr.c
> > @@ -390,10 +390,8 @@ static int spapr_fixup_cpu_dt(void *fdt, 
> > sPAPRMachineState *spapr)
> >  return ret;
> >  }
> >  
> > -static hwaddr spapr_node0_size(void)
> > +static hwaddr spapr_node0_size(MachineState *machine)
> >  {
> > -MachineState *machine = MACHINE(qdev_get_machine());
> > -
> >  if (nb_numa_nodes) {
> >  int i;
> >  for (i = 0; i < nb_numa_nodes; ++i) {
> > @@ -1027,7 +1025,7 @@ static void *spapr_build_fdt(sPAPRMachineState *spapr,
> >   hwaddr rtas_addr,
> >   hwaddr rtas_size)
> >  {
> > -MachineState *machine = MACHINE(qdev_get_machine());
> > +MachineState *machine = MACHINE(spapr);
> >  MachineClass *mc = MACHINE_GET_CLASS(machine);
> >  sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(machine);
> >  int ret;
> > @@ -1347,7 +1345,7 @@ void spapr_setup_hpt_and_vrma(sPAPRMachineState 
> > *spapr)
> >  spapr_reallocate_hpt(spapr, hpt_shift, &error_fatal);
> >  
> >  if (spapr->vrma_adjust) {
> > -spapr->rma_size = kvmppc_rma_size(spapr_node0_size(),
> > +spapr->rma_size = kvmppc_rma_size(spapr_node0_size(MACHINE(spapr)),
> >spapr->htab_shift);
> >  }
> >  /* We're setting up a hash table, so that means we're not radix */
> > @@ -2007,7 +2005,7 @@ static SaveVMHandlers savevm_htab_handlers = {
> >  static void spapr_boot_set(void *opaque, const char *boot_device,
> > Error **errp)
> >  {
> > -MachineState *machine = MACHINE(qdev_get_machine());
> > +MachineState *machine = MACHINE(opaque);
> >  machine->boot_order = g_strdup(boot_device);
> >  }
> >  
> > @@ -2154,7 +2152,7 @@ static void ppc_spapr_init(MachineState *machine)
> >  MemoryRegion *rma_region;
> >  void *rma = NULL;
> >  hwaddr rma_alloc_size;
> > -hwaddr node0_size = spapr_node0_size();
> > +hwaddr node0_size = spapr_node0_size(machine);
> >  long load_limit, fw_size;
> >  char *filename;
> >  Error *resize_hpt_err = NULL;
> > @@ -3198,7 +3196,8 @@ out:
> >  static void spapr_machine_device_plug(HotplugHandler *hotplug_dev,
> >DeviceState *dev, Error **errp)
> >  {
> > -sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(qdev_get_machine());
> > +MachineState *ms = MACHINE(hotplug_dev);
> > +sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(ms);
> >  
> >  if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
> >  int node;
> > @@ -3247,8 +3246,8 @@ static void spapr_machine_device_plug(HotplugHandler 
> > *hotplug_dev,
> >  static void spapr_machine_device_unplug_request(HotplugHandler 
> > *hotplug_dev,
> >  DeviceState *dev, Error 
> > **errp)
> >  {
> > -sPAPRMachineState *sms = SPAPR_MACHINE(qdev_get_machine());
> > -MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine());
> > +sPAPRMachineState *sms = SPAPR_MACHINE(OBJECT(hotplug_dev));
> > +MachineClass *mc = MACHINE_GET_CLASS(sms);
> >  
> >  if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
> >  if (spapr_ovec_test(sms->ov5_cas, OV5_HP_EVT)) {
> 



-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_

Re: [Qemu-devel] [PATCHv2 1/1] net: Add SunGEM device emulation as found on Apple UniNorth

2017-09-08 Thread David Gibson
On Wed, Sep 06, 2017 at 07:19:55PM +0100, Mark Cave-Ayland wrote:
> From: Benjamin Herrenschmidt 
> 
> This adds a simplistic emulation of the Sun GEM ethernet controller
> found in Apple ASICs.
> 
> Currently we only support the Apple UniNorth 1.x variant, but the
> other Apple or Sun variants should mostly be a matter of adding
> PCI IDs options.
> 
> We have a very primitive emulation of a single Broadcom 5201 PHY
> which is supported by the MacOS driver.
> 
> This model brings out-of-the-box networking to MacOS 9, and all
> versions of OS X I tried with the mac99 platform.
> 
> Further improvements from Mark:
> - Remove sungem.h file, moving constants into sungem.c as required
> - Switch to using tracepoints for debugging
> - Split register blocks into separate memory regions
> - Use arrays in SunGEMState to hold register values
> - Add state-saving support
> 
> Signed-off-by: Benjamin Herrenschmidt 
> Signed-off-by: Mark Cave-Ayland 

Applied to ppc-for-2.11.

> ---
>  default-configs/ppc-softmmu.mak |1 +
>  hw/net/Makefile.objs|1 +
>  hw/net/sungem.c | 1447 
> +++
>  hw/net/trace-events |   44 ++
>  hw/pci/pci.c|2 +
>  include/hw/pci/pci_ids.h|1 +
>  6 files changed, 1496 insertions(+)
>  create mode 100644 hw/net/sungem.c
> 
> diff --git a/default-configs/ppc-softmmu.mak b/default-configs/ppc-softmmu.mak
> index 1f1cd85..c12ba9e 100644
> --- a/default-configs/ppc-softmmu.mak
> +++ b/default-configs/ppc-softmmu.mak
> @@ -17,6 +17,7 @@ CONFIG_PREP_PCI=y
>  CONFIG_I82378=y
>  CONFIG_PC87312=y
>  CONFIG_MACIO=y
> +CONFIG_SUNGEM=y
>  CONFIG_PCSPK=y
>  CONFIG_CS4231A=y
>  CONFIG_CUDA=y
> diff --git a/hw/net/Makefile.objs b/hw/net/Makefile.objs
> index 5ddaffe..7e87d01 100644
> --- a/hw/net/Makefile.objs
> +++ b/hw/net/Makefile.objs
> @@ -27,6 +27,7 @@ common-obj-$(CONFIG_CADENCE) += cadence_gem.o
>  common-obj-$(CONFIG_STELLARIS_ENET) += stellaris_enet.o
>  common-obj-$(CONFIG_LANCE) += lance.o
>  common-obj-$(CONFIG_FTGMAC100) += ftgmac100.o
> +common-obj-$(CONFIG_SUNGEM) += sungem.o
>  
>  obj-$(CONFIG_ETRAXFS) += etraxfs_eth.o
>  obj-$(CONFIG_COLDFIRE) += mcf_fec.o
> diff --git a/hw/net/sungem.c b/hw/net/sungem.c
> new file mode 100644
> index 000..dffa0c9
> --- /dev/null
> +++ b/hw/net/sungem.c
> @@ -0,0 +1,1447 @@
> +/*
> + * QEMU model of SUN GEM ethernet controller
> + *
> + * As found in Apple ASICs among others
> + *
> + * Copyright 2016 Ben Herrenschmidt
> + * Copyright 2017 Mark Cave-Ayland
> + */
> +
> +#include "qemu/osdep.h"
> +#include "hw/pci/pci.h"
> +#include "qemu/log.h"
> +#include "net/net.h"
> +#include "net/checksum.h"
> +#include "hw/net/mii.h"
> +#include "sysemu/sysemu.h"
> +#include "trace.h"
> +/* For crc32 */
> +#include 
> +
> +#define TYPE_SUNGEM "sungem"
> +
> +#define SUNGEM(obj) OBJECT_CHECK(SunGEMState, (obj), TYPE_SUNGEM)
> +
> +#define MAX_PACKET_SIZE 9016
> +
> +#define SUNGEM_MMIO_SIZE0x20
> +
> +/* Global registers */
> +#define SUNGEM_MMIO_GREG_SIZE   0x2000
> +
> +#define GREG_SEBSTATE 0xUL/* SEB State Register */
> +
> +#define GREG_STAT 0x000CUL/* Status Register */
> +#define GREG_STAT_TXINTME 0x0001/* TX INTME frame transferred */
> +#define GREG_STAT_TXALL   0x0002/* All TX frames transferred */
> +#define GREG_STAT_TXDONE  0x0004/* One TX frame transferred */
> +#define GREG_STAT_RXDONE  0x0010/* One RX frame arrived */
> +#define GREG_STAT_RXNOBUF 0x0020/* No free RX buffers available 
> */
> +#define GREG_STAT_RXTAGERR0x0040/* RX tag framing is corrupt */
> +#define GREG_STAT_TXMAC   0x4000/* TX MAC signalled interrupt */
> +#define GREG_STAT_RXMAC   0x8000/* RX MAC signalled interrupt */
> +#define GREG_STAT_MAC 0x0001/* MAC Control signalled irq */
> +#define GREG_STAT_TXNR0xfff8/* == TXDMA_TXDONE reg val */
> +#define GREG_STAT_TXNR_SHIFT  19
> +
> +/* These interrupts are edge latches in the status register,
> + * reading it (or writing the corresponding bit in IACK) will
> + * clear them
> + */
> +#define GREG_STAT_LATCH   (GREG_STAT_TXALL  | GREG_STAT_TXINTME | \
> +   GREG_STAT_RXDONE | GREG_STAT_RXDONE |  \
> +   GREG_STAT_RXNOBUF | GREG_STAT_RXTAGERR)
> +
> +#define GREG_IMASK0x0010UL/* Interrupt Mask Register */
> +#define GREG_IACK 0x0014UL/* Interrupt ACK Register */
> +#define GREG_STAT20x001CUL/* Alias of GREG_STAT */
> +#define GREG_PCIESTAT 0x1000UL/* PCI Error Status Register */
> +#define GREG_PCIEMASK 0x1004UL/* PCI Error Mask Register */
> +
> +#define GREG_SWRST0x1010UL/* Software Reset Register */
> +#define GREG_SWRST_TXRST  0x0001/* TX Software Reset */
> +#define GREG_SWRST_RXRST  0x0002/* RX Software Re

[Qemu-devel] [PATCH v4] pci: Set err to errp directly rather than through error_propagate()

2017-09-08 Thread Mao Zhongyi
ioh3420_interrupts_init() pass error message to local_err, then
propagate it to errp by error_propagate(), which is not necessary.
So eliminate it and pass errp directly instead of local_err.

Cc: "Michael S. Tsirkin" 
Cc: Marcel Apfelbaum  
Signed-off-by: Mao Zhongyi 
Reviewed-by: Eric Blake 
Reviewed-by: Marcel Apfelbaum 
Reviewed-by: Philippe Mathieu-Daudé 
---
v4:
it not apply clearly on HEAD, so rebase it and modify the commit
message.
---

 hw/pci-bridge/ioh3420.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/hw/pci-bridge/ioh3420.c b/hw/pci-bridge/ioh3420.c
index da4e5bd..5f56a2f 100644
--- a/hw/pci-bridge/ioh3420.c
+++ b/hw/pci-bridge/ioh3420.c
@@ -64,15 +64,13 @@ static uint8_t ioh3420_aer_vector(const PCIDevice *d)
 static int ioh3420_interrupts_init(PCIDevice *d, Error **errp)
 {
 int rc;
-Error *local_err = NULL;
 
 rc = msi_init(d, IOH_EP_MSI_OFFSET, IOH_EP_MSI_NR_VECTOR,
   IOH_EP_MSI_SUPPORTED_FLAGS & PCI_MSI_FLAGS_64BIT,
   IOH_EP_MSI_SUPPORTED_FLAGS & PCI_MSI_FLAGS_MASKBIT,
-  &local_err);
+  errp);
 if (rc < 0) {
 assert(rc == -ENOTSUP);
-error_propagate(errp, local_err);
 }
 
 return rc;
-- 
2.9.4






Re: [Qemu-devel] [PULL v2 00/37] Staging patches

2017-09-08 Thread no-reply
Hi,

This series seems to have some coding style problems. See output below for
more information:

Subject: [Qemu-devel] [PULL v2 00/37] Staging patches
Message-id: 20170909054613.19148-1-f...@redhat.com
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
failed=1
echo
fi
n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 t [tag update]
patchew/1504815384-8490-1-git-send-email-stef...@linux.vnet.ibm.com -> 
patchew/1504815384-8490-1-git-send-email-stef...@linux.vnet.ibm.com
 t [tag update]
patchew/20170908163859.29820-1-richard.hender...@linaro.org -> 
patchew/20170908163859.29820-1-richard.hender...@linaro.org
 * [new tag]   patchew/20170909054613.19148-1-f...@redhat.com -> 
patchew/20170909054613.19148-1-f...@redhat.com
Switched to a new branch 'test'
274b0b33cb buildsys: Move rdma libs to per object
dee13ca0ca buildsys: Move brlapi libs to per object
51486e4caf buildsys: Move usb redir cflags/libs to per object
e2d2141400 buildsys: Move libusb cflags/libs to per object
e653260901 buildsys: Move libcacard cflags/libs to per object
de80133478 buildsys: Move curese cflags/libs to per object
4da943d9c6 buildsys: Move audio libs to per object
c05be913ea buildsys: Move vnc cflags/libs to per object
066db85c1a buildsys: Move sdl cflags/libs to per object
50200dfb4c buildsys: Move gtk/vte cflags/libs to per object
0832346d7d buildsys: Move vde libs to per object
5cad9f269f vl: Don't include vde header
d642c77e93 docker: Drop 'set -e' from run script
05cb7137d9 docker: Add test-block
f829f5d141 docker: Add nettle-devel to fedora image
ca0c6ffecc docker: Use unconfined security profile
c5a6c192c7 docker: Add test_fail and prep_fail
ee94d2b7c9 docker: Fix return code of build_qemu()
0717923a55 docker: Use archive-source.py
b6a02aee1a tests: Add README for vm tests
f0bfdb4c3b MAINTAINERS: Add tests/vm entry
133ce1feb5 Makefile: Add rules to run vm tests
f88480f6c8 tests: Add OpenBSD image
d05508ab23 tests: Add NetBSD image
8370cb8f2f tests: Add FreeBSD image
a8b70bfa3b tests: Add ubuntu.i386 image
413861ba2d tests: Add vm test lib
e10c67002d scripts: Add archive-source.sh
c353b7acd2 qemu.py: Add "wait()" method
fac58fe6c0 gitignore: Ignore vm test images
1022469bf7 tests/docker: Clean up paths
e6dde9693e docker: Enable features explicitly in test-full
f08e8a2903 docker: Update ubuntu image
6c2c01bbe2 docker: reduce noise when building travis.docker
f63179c5a0 docker: don't install device-tree-compiler build-deps in 
travis.docker
f9d3a9d011 docker: docker.py make --no-cache skip checksum test
3695d96c65 docker: ensure NOUSER for travis images

=== OUTPUT BEGIN ===
Checking PATCH 1/37: docker: ensure NOUSER for travis images...
Checking PATCH 2/37: docker: docker.py make --no-cache skip checksum test...
Checking PATCH 3/37: docker: don't install device-tree-compiler build-deps in 
travis.docker...
Checking PATCH 4/37: docker: reduce noise when building travis.docker...
Checking PATCH 5/37: docker: Update ubuntu image...
Checking PATCH 6/37: docker: Enable features explicitly in test-full...
Checking PATCH 7/37: tests/docker: Clean up paths...
Checking PATCH 8/37: gitignore: Ignore vm test images...
Checking PATCH 9/37: qemu.py: Add "wait()" method...
Checking PATCH 10/37: scripts: Add archive-source.sh...
Checking PATCH 11/37: tests: Add vm test lib...
ERROR: line over 90 characters
#86: FILE: tests/vm/basevm.py:60:
+ssh-rsa 
B3NzaC1yc2EDAQABAAABAQCikC46WYtXotUd0UGPz9547Aj0KqC4gk+nt4BBJm86IHgCD9FygSGX9EFutXlhz9KZIPg9Okk7+IzXRHCWI2MNvhrcjyrezKREm71z08j9iwfxY3340fY2Mo+0khwpO7bzsgzkljHIHqcOg7MgttPInVMNH/EfqpgR8EDKJuWCB2Ny+EBFN/3dAiff0X/EvKle9PUrY70EkSycnyURS8HZReEqj8lN9J5kXzA8F6jBo/0Q42Ttv6e4k5YcaDrwmLrBWLra2PCXZLNyHqXEiFkGmdXtA1Eox9gc/p4jIXim6xrPNmpN6WyrrEjaCF5xYvNv8wXkD6uSWwbHYU24lIAn
 qemu-vm-key

WARNING: line over 80 characters
#100: FILE: tests/vm/basevm.py:74:
+self._tmpdir = tempfile.mkdtemp(prefix="vm-test-", suffix=".tmp", 
dir=".")

WARNING: line over 80 characters
#191: FILE: tests/vm/basevm.py:165:
+logging.debug("Creating archive %s for src_dir dir: %s", tarfile, 
src_dir)

WARNING: line over 80 characters
#196: FILE: tests/vm/basevm.py:170:
+"file=%s,if=none,id=%s,cache=writeback,format=raw" 
% \

WARNING: line over 80 characters
#199: FILE: tests/vm/basevm.py:173:
+"virtio-blk,drive=%s,serial=%s,bootindex=1" % 
(name, name)]

ERROR: line over 90 characters
#246: FILE: tests/vm/basevm.py:220:
+VM test u

Re: [Qemu-devel] [Qemu-ppc] [PATCH 0/3] spapr: XIVE and CAS fixes

2017-09-08 Thread Cédric Le Goater
On 09/08/2017 04:33 PM, Cédric Le Goater wrote:
> Hello,
> 
> Here are a couple of fixes, one for the XIVE exploitation mode option
> bit which is clearly specified now and for one for the CAS generated
> resets.
> 
> Last is a proposal to handle the rebuild of the device tree using a
> reset when the XIVE exploitation mode is negotiated with CAS. 

I should have copied Sam on this topic for some insights. 

Thanks,

C. 


> The full tree is here:
> 
>   https://github.com/legoater/qemu/commits/xive
> 
> XIVE support for Linux is now merged in 4.14.
> 
> Thanks,
> 
> C.
> 
> Cédric Le Goater (3):
>   ppc/xive: fix OV5_XIVE_EXPLOIT bits
>   spapr: fix CAS-generated reset
>   spapr: generate a CAS reset for XIVE exploitation mode
> 
>  hw/ppc/spapr.c  |  8 ++--
>  hw/ppc/spapr_hcall.c| 13 +
>  include/hw/ppc/spapr_ovec.h |  3 ++-
>  3 files changed, 21 insertions(+), 3 deletions(-)
> 




[Qemu-devel] [PULL v2 35/37] buildsys: Move usb redir cflags/libs to per object

2017-09-08 Thread Fam Zheng
Signed-off-by: Fam Zheng 
Message-Id: <20170907082918.7299-10-f...@redhat.com>
Reviewed-by: Gerd Hoffmann 
Reviewed-by: Philippe Mathieu-Daudé 
Signed-off-by: Fam Zheng 
---
 configure| 4 ++--
 hw/usb/Makefile.objs | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index b50d662cde..85ea2c25bb 100755
--- a/configure
+++ b/configure
@@ -4264,8 +4264,6 @@ if test "$usb_redir" != "no" ; then
 usb_redir="yes"
 usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5)
 usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5)
-QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags"
-libs_softmmu="$libs_softmmu $usb_redir_libs"
 else
 if test "$usb_redir" = "yes"; then
 feature_not_found "usb-redir" "Install usbredir devel"
@@ -5828,6 +5826,8 @@ fi
 
 if test "$usb_redir" = "yes" ; then
   echo "CONFIG_USB_REDIR=y" >> $config_host_mak
+  echo "USB_REDIR_CFLAGS=$usb_redir_cflags" >> $config_host_mak
+  echo "USB_REDIR_LIBS=$usb_redir_libs" >> $config_host_mak
 fi
 
 if test "$opengl" = "yes" ; then
diff --git a/hw/usb/Makefile.objs b/hw/usb/Makefile.objs
index 9ce9eadb47..92eb199697 100644
--- a/hw/usb/Makefile.objs
+++ b/hw/usb/Makefile.objs
@@ -38,6 +38,8 @@ endif
 
 # usb redirection
 common-obj-$(CONFIG_USB_REDIR) += redirect.o quirks.o
+redirect.o-cflags = $(USB_REDIR_CFLAGS)
+redirect.o-libs = $(USB_REDIR_LIBS)
 
 # usb pass-through
 common-obj-y += $(patsubst %,host-%.o,$(HOST_USB))
-- 
2.13.5




[Qemu-devel] [PULL v2 36/37] buildsys: Move brlapi libs to per object

2017-09-08 Thread Fam Zheng
baum.o already receives the sdl cflags in its per object variable, do
the same for brlapi libs to avoid cluttering libs_softmmu.

Signed-off-by: Fam Zheng 
Message-Id: <20170907084700.952-1-f...@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé 
Reviewed-by: Marc-André Lureau 
Signed-off-by: Fam Zheng 
---
 chardev/Makefile.objs | 1 +
 configure | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/chardev/Makefile.objs b/chardev/Makefile.objs
index 52a8127606..d68e1347f9 100644
--- a/chardev/Makefile.objs
+++ b/chardev/Makefile.objs
@@ -20,5 +20,6 @@ chardev-obj-$(CONFIG_WIN32) += char-win-stdio.o
 common-obj-y += msmouse.o wctablet.o testdev.o
 common-obj-$(CONFIG_BRLAPI) += baum.o
 baum.o-cflags := $(SDL_CFLAGS)
+baum.o-libs := $(BRLAPI_LIBS)
 
 common-obj-$(CONFIG_SPICE) += spice.o
diff --git a/configure b/configure
index 85ea2c25bb..18f6d0bd5f 100755
--- a/configure
+++ b/configure
@@ -3091,7 +3091,6 @@ int main( void ) { return brlapi__openConnection (NULL, 
NULL, NULL); }
 EOF
   if compile_prog "" "$brlapi_libs" ; then
 brlapi=yes
-libs_softmmu="$brlapi_libs $libs_softmmu"
   else
 if test "$brlapi" = "yes" ; then
   feature_not_found "brlapi" "Install brlapi devel"
@@ -5679,6 +5678,7 @@ if test "$curl" = "yes" ; then
 fi
 if test "$brlapi" = "yes" ; then
   echo "CONFIG_BRLAPI=y" >> $config_host_mak
+  echo "BRLAPI_LIBS=$brlapi_libs" >> $config_host_mak
 fi
 if test "$bluez" = "yes" ; then
   echo "CONFIG_BLUEZ=y" >> $config_host_mak
-- 
2.13.5




[Qemu-devel] [PULL v2 33/37] buildsys: Move libcacard cflags/libs to per object

2017-09-08 Thread Fam Zheng
Signed-off-by: Fam Zheng 
Message-Id: <20170907082918.7299-8-f...@redhat.com>
Reviewed-by: Gerd Hoffmann 
Reviewed-by: Philippe Mathieu-Daudé 
Signed-off-by: Fam Zheng 
---
 configure| 4 ++--
 hw/usb/Makefile.objs | 6 --
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/configure b/configure
index 88eafe8a10..be50159161 100755
--- a/configure
+++ b/configure
@@ -4235,8 +4235,6 @@ if test "$smartcard" != "no"; then
 if $pkg_config libcacard; then
 libcacard_cflags=$($pkg_config --cflags libcacard)
 libcacard_libs=$($pkg_config --libs libcacard)
-QEMU_CFLAGS="$QEMU_CFLAGS $libcacard_cflags"
-libs_softmmu="$libs_softmmu $libcacard_libs"
 smartcard="yes"
 else
 if test "$smartcard" = "yes"; then
@@ -5820,6 +5818,8 @@ fi
 
 if test "$smartcard" = "yes" ; then
   echo "CONFIG_SMARTCARD=y" >> $config_host_mak
+  echo "SMARTCARD_CFLAGS=$libcacard_cflags" >> $config_host_mak
+  echo "SMARTCARD_LIBS=$libcacard_libs" >> $config_host_mak
 fi
 
 if test "$libusb" = "yes" ; then
diff --git a/hw/usb/Makefile.objs b/hw/usb/Makefile.objs
index 97f1c4561a..795ff25a5e 100644
--- a/hw/usb/Makefile.objs
+++ b/hw/usb/Makefile.objs
@@ -26,8 +26,10 @@ common-obj-$(CONFIG_USB_BLUETOOTH)+= dev-bluetooth.o
 
 ifeq ($(CONFIG_USB_SMARTCARD),y)
 common-obj-y  += dev-smartcard-reader.o
-common-obj-$(CONFIG_SMARTCARD)+= ccid-card-passthru.o
-common-obj-$(CONFIG_SMARTCARD)+= ccid-card-emulated.o
+common-obj-$(CONFIG_SMARTCARD)+= smartcard.mo
+smartcard.mo-objs := ccid-card-passthru.o ccid-card-emulated.o
+smartcard.mo-cflags := $(SMARTCARD_CFLAGS)
+smartcard.mo-libs := $(SMARTCARD_LIBS)
 endif
 
 ifeq ($(CONFIG_POSIX),y)
-- 
2.13.5




[Qemu-devel] [PULL v2 32/37] buildsys: Move curese cflags/libs to per object

2017-09-08 Thread Fam Zheng
Signed-off-by: Fam Zheng 
Message-Id: <20170907082918.7299-6-f...@redhat.com>
Reviewed-by: Gerd Hoffmann 
Reviewed-by: Philippe Mathieu-Daudé 
Signed-off-by: Fam Zheng 
---
 configure| 6 --
 ui/Makefile.objs | 3 +++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 5c15e74310..88eafe8a10 100755
--- a/configure
+++ b/configure
@@ -3134,8 +3134,8 @@ EOF
   unset IFS
   if compile_prog "$curses_inc" "$curses_lib" ; then
 curses_found=yes
-QEMU_CFLAGS="$curses_inc $QEMU_CFLAGS"
-libs_softmmu="$curses_lib $libs_softmmu"
+curses_cflags="$curses_inc $curses_cflags"
+curses_libs="$curses_lib $curses_libs"
 break
   fi
 done
@@ -5600,6 +5600,8 @@ if test "$cocoa" = "yes" ; then
 fi
 if test "$curses" = "yes" ; then
   echo "CONFIG_CURSES=y" >> $config_host_mak
+  echo "CURSES_CFLAGS=$curses_cflags" >> $config_host_mak
+  echo "CURSES_LIBS=$curses_libs" >> $config_host_mak
 fi
 if test "$pipe2" = "yes" ; then
   echo "CONFIG_PIPE2=y" >> $config_host_mak
diff --git a/ui/Makefile.objs b/ui/Makefile.objs
index a0b3c15a28..e3403b698b 100644
--- a/ui/Makefile.objs
+++ b/ui/Makefile.objs
@@ -57,3 +57,6 @@ gtk-egl.o-libs += $(OPENGL_LIBS)
 shader.o-libs += $(OPENGL_LIBS)
 console-gl.o-libs += $(OPENGL_LIBS)
 egl-helpers.o-libs += $(OPENGL_LIBS)
+
+curses.o-cflags := $(CURSES_CFLAGS)
+curses.o-libs := $(CURSES_LIBS)
-- 
2.13.5




[Qemu-devel] [PULL v2 37/37] buildsys: Move rdma libs to per object

2017-09-08 Thread Fam Zheng
Signed-off-by: Fam Zheng 
Message-Id: <20170907084230.26493-1-f...@redhat.com>
Reviewed-by: Juan Quintela 
Reviewed-by: Peter Xu 
Reviewed-by: Dr. David Alan Gilbert 
Signed-off-by: Fam Zheng 
---
 configure   | 2 +-
 migration/Makefile.objs | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 18f6d0bd5f..ea54d8b882 100755
--- a/configure
+++ b/configure
@@ -2805,7 +2805,6 @@ EOF
   rdma_libs="-lrdmacm -libverbs"
   if compile_prog "" "$rdma_libs" ; then
 rdma="yes"
-libs_softmmu="$libs_softmmu $rdma_libs"
   else
 if test "$rdma" = "yes" ; then
 error_exit \
@@ -6028,6 +6027,7 @@ echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
 
 if test "$rdma" = "yes" ; then
   echo "CONFIG_RDMA=y" >> $config_host_mak
+  echo "RDMA_LIBS=$rdma_libs" >> $config_host_mak
 fi
 
 if test "$have_rtnetlink" = "yes" ; then
diff --git a/migration/Makefile.objs b/migration/Makefile.objs
index 1c7770da46..99e038024d 100644
--- a/migration/Makefile.objs
+++ b/migration/Makefile.objs
@@ -11,3 +11,4 @@ common-obj-$(CONFIG_RDMA) += rdma.o
 
 common-obj-$(CONFIG_LIVE_BLOCK_MIGRATION) += block.o
 
+rdma.o-libs := $(RDMA_LIBS)
-- 
2.13.5




[Qemu-devel] [PULL v2 31/37] buildsys: Move audio libs to per object

2017-09-08 Thread Fam Zheng
Signed-off-by: Fam Zheng 
Message-Id: <20170907082918.7299-5-f...@redhat.com>
Reviewed-by: Gerd Hoffmann 
Reviewed-by: Philippe Mathieu-Daudé 
Signed-off-by: Fam Zheng 
---
 audio/Makefile.objs |  5 +
 configure   | 15 ++-
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/audio/Makefile.objs b/audio/Makefile.objs
index c20695668f..8a5ede6e2b 100644
--- a/audio/Makefile.objs
+++ b/audio/Makefile.objs
@@ -12,3 +12,8 @@ common-obj-y += wavcapture.o
 
 sdlaudio.o-cflags := $(SDL_CFLAGS)
 sdlaudio.o-libs := $(SDL_LIBS)
+alsaaudio.o-libs := $(ALSA_LIBS)
+paaudio.o-libs := $(PULSE_LIBS)
+coreaudio.o-libs := $(COREAUDIO_LIBS)
+dsoundaudio.o-libs := $(DSOUND_LIBS)
+ossaudio.o-libs := $(OSS_LIBS)
diff --git a/configure b/configure
index ffc93c7cdb..5c15e74310 100755
--- a/configure
+++ b/configure
@@ -3037,13 +3037,13 @@ for drv in $audio_drv_list; do
 alsa)
 audio_drv_probe $drv alsa/asoundlib.h -lasound \
 "return snd_pcm_close((snd_pcm_t *)0);"
-libs_softmmu="-lasound $libs_softmmu"
+alsa_libs="-lasound"
 ;;
 
 pa)
 audio_drv_probe $drv pulse/pulseaudio.h "-lpulse" \
 "pa_context_set_source_output_volume(NULL, 0, NULL, NULL, NULL); 
return 0;"
-libs_softmmu="-lpulse $libs_softmmu"
+pulse_libs="-lpulse"
 audio_pt_int="yes"
 ;;
 
@@ -3054,16 +3054,16 @@ for drv in $audio_drv_list; do
 ;;
 
 coreaudio)
-  libs_softmmu="-framework CoreAudio $libs_softmmu"
+  coreaudio_libs="-framework CoreAudio"
 ;;
 
 dsound)
-  libs_softmmu="-lole32 -ldxguid $libs_softmmu"
+  dsound_libs="-lole32 -ldxguid"
   audio_win_int="yes"
 ;;
 
 oss)
-  libs_softmmu="$oss_lib $libs_softmmu"
+  oss_libs="$oss_lib"
 ;;
 
 wav)
@@ -5542,6 +5542,11 @@ for drv in $audio_drv_list; do
 def=CONFIG_$(echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]')
 echo "$def=y" >> $config_host_mak
 done
+echo "ALSA_LIBS=$alsa_libs" >> $config_host_mak
+echo "PULSE_LIBS=$pulse_libs" >> $config_host_mak
+echo "COREAUDIO_LIBS=$coreaudio_libs" >> $config_host_mak
+echo "DSOUND_LIBS=$dsound_libs" >> $config_host_mak
+echo "OSS_LIBS=$oss_libs" >> $config_host_mak
 if test "$audio_pt_int" = "yes" ; then
   echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
 fi
-- 
2.13.5




[Qemu-devel] [PULL v2 27/37] buildsys: Move vde libs to per object

2017-09-08 Thread Fam Zheng
Signed-off-by: Fam Zheng 
Message-Id: <20170907083552.17725-3-f...@redhat.com>
Reviewed-by: Jason Wang 
Signed-off-by: Fam Zheng 
---
 configure | 3 +--
 net/Makefile.objs | 2 ++
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 3918c47cd8..25c6ad6b20 100755
--- a/configure
+++ b/configure
@@ -2953,8 +2953,6 @@ int main(void)
 EOF
   if compile_prog "" "$vde_libs" ; then
 vde=yes
-libs_softmmu="$vde_libs $libs_softmmu"
-libs_tools="$vde_libs $libs_tools"
   else
 if test "$vde" = "yes" ; then
   feature_not_found "vde" "Install vde (Virtual Distributed Ethernet) 
devel"
@@ -5531,6 +5529,7 @@ if test "$slirp" = "yes" ; then
 fi
 if test "$vde" = "yes" ; then
   echo "CONFIG_VDE=y" >> $config_host_mak
+  echo "VDE_LIBS=$vde_libs" >> $config_host_mak
 fi
 if test "$netmap" = "yes" ; then
   echo "CONFIG_NETMAP=y" >> $config_host_mak
diff --git a/net/Makefile.objs b/net/Makefile.objs
index 67ba5e26fb..64adf32f40 100644
--- a/net/Makefile.objs
+++ b/net/Makefile.objs
@@ -21,3 +21,5 @@ tap-obj-$(CONFIG_SOLARIS) = tap-solaris.o
 tap-obj-y ?= tap-stub.o
 common-obj-$(CONFIG_POSIX) += tap.o $(tap-obj-y)
 common-obj-$(CONFIG_WIN32) += tap-win32.o
+
+vde.o-libs = $(VDE_LIBS)
-- 
2.13.5




[Qemu-devel] [PULL v2 34/37] buildsys: Move libusb cflags/libs to per object

2017-09-08 Thread Fam Zheng
Signed-off-by: Fam Zheng 
Message-Id: <20170907082918.7299-9-f...@redhat.com>
Reviewed-by: Gerd Hoffmann 
Reviewed-by: Philippe Mathieu-Daudé 
Signed-off-by: Fam Zheng 
---
 configure| 4 ++--
 hw/usb/Makefile.objs | 5 +
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index be50159161..b50d662cde 100755
--- a/configure
+++ b/configure
@@ -4250,8 +4250,6 @@ if test "$libusb" != "no" ; then
 libusb="yes"
 libusb_cflags=$($pkg_config --cflags libusb-1.0)
 libusb_libs=$($pkg_config --libs libusb-1.0)
-QEMU_CFLAGS="$QEMU_CFLAGS $libusb_cflags"
-libs_softmmu="$libs_softmmu $libusb_libs"
 else
 if test "$libusb" = "yes"; then
 feature_not_found "libusb" "Install libusb devel >= 1.0.13"
@@ -5824,6 +5822,8 @@ fi
 
 if test "$libusb" = "yes" ; then
   echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak
+  echo "LIBUSB_CFLAGS=$libusb_cflags" >> $config_host_mak
+  echo "LIBUSB_LIBS=$libusb_libs" >> $config_host_mak
 fi
 
 if test "$usb_redir" = "yes" ; then
diff --git a/hw/usb/Makefile.objs b/hw/usb/Makefile.objs
index 795ff25a5e..9ce9eadb47 100644
--- a/hw/usb/Makefile.objs
+++ b/hw/usb/Makefile.objs
@@ -42,6 +42,11 @@ common-obj-$(CONFIG_USB_REDIR) += redirect.o quirks.o
 # usb pass-through
 common-obj-y += $(patsubst %,host-%.o,$(HOST_USB))
 
+host-libusb.o-cflags := $(LIBUSB_CFLAGS)
+host-libusb.o-libs := $(LIBUSB_LIBS)
+
 ifeq ($(CONFIG_USB_LIBUSB),y)
 common-obj-$(CONFIG_XEN) += xen-usb.o
+xen-usb.o-cflags := $(LIBUSB_CFLAGS)
+xen-usb.o-libs := $(LIBUSB_LIBS)
 endif
-- 
2.13.5




[Qemu-devel] [PULL v2 29/37] buildsys: Move sdl cflags/libs to per object

2017-09-08 Thread Fam Zheng
Signed-off-by: Fam Zheng 
Message-Id: <20170907082918.7299-3-f...@redhat.com>
Reviewed-by: Gerd Hoffmann 
Reviewed-by: Philippe Mathieu-Daudé 
Signed-off-by: Fam Zheng 
---
 audio/Makefile.objs | 1 +
 configure   | 2 +-
 ui/Makefile.objs| 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/audio/Makefile.objs b/audio/Makefile.objs
index 481d1aa30e..c20695668f 100644
--- a/audio/Makefile.objs
+++ b/audio/Makefile.objs
@@ -11,3 +11,4 @@ common-obj-$(CONFIG_AUDIO_WIN_INT) += audio_win_int.o
 common-obj-y += wavcapture.o
 
 sdlaudio.o-cflags := $(SDL_CFLAGS)
+sdlaudio.o-libs := $(SDL_LIBS)
diff --git a/configure b/configure
index 8dca32900a..a9577bb952 100755
--- a/configure
+++ b/configure
@@ -2793,7 +2793,6 @@ EOF
 sdl_cflags="$sdl_cflags $x11_cflags"
 sdl_libs="$sdl_libs $x11_libs"
   fi
-  libs_softmmu="$sdl_libs $libs_softmmu"
 fi
 
 ##
@@ -5587,6 +5586,7 @@ if test "$sdl" = "yes" ; then
   echo "CONFIG_SDL=y" >> $config_host_mak
   echo "CONFIG_SDLABI=$sdlabi" >> $config_host_mak
   echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
+  echo "SDL_LIBS=$sdl_libs" >> $config_host_mak
 fi
 if test "$cocoa" = "yes" ; then
   echo "CONFIG_COCOA=y" >> $config_host_mak
diff --git a/ui/Makefile.objs b/ui/Makefile.objs
index 146a8ce062..b3e29e21f0 100644
--- a/ui/Makefile.objs
+++ b/ui/Makefile.objs
@@ -27,6 +27,7 @@ sdl.mo-objs += sdl2-gl.o
 endif
 endif
 sdl.mo-cflags := $(SDL_CFLAGS)
+sdl.mo-libs := $(SDL_LIBS)
 
 ifeq ($(CONFIG_OPENGL),y)
 common-obj-y += shader.o
-- 
2.13.5




[Qemu-devel] [PULL v2 28/37] buildsys: Move gtk/vte cflags/libs to per object

2017-09-08 Thread Fam Zheng
Signed-off-by: Fam Zheng 
Message-Id: <20170907082918.7299-2-f...@redhat.com>
Reviewed-by: Gerd Hoffmann 
Reviewed-by: Philippe Mathieu-Daudé 
Signed-off-by: Fam Zheng 
---
 configure| 3 +--
 ui/Makefile.objs | 4 
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 25c6ad6b20..8dca32900a 100755
--- a/configure
+++ b/configure
@@ -2427,7 +2427,6 @@ if test "$gtk" != "no"; then
 gtk_cflags="$gtk_cflags $x11_cflags"
 gtk_libs="$gtk_libs $x11_libs"
 fi
-libs_softmmu="$gtk_libs $libs_softmmu"
 gtk="yes"
 elif test "$gtk" = "yes"; then
 feature_not_found "gtk" "Install gtk3-devel"
@@ -2677,7 +2676,6 @@ if test "$vte" != "no"; then
 vte_cflags=$($pkg_config --cflags $vtepackage)
 vte_libs=$($pkg_config --libs $vtepackage)
 vteversion=$($pkg_config --modversion $vtepackage)
-libs_softmmu="$vte_libs $libs_softmmu"
 vte="yes"
 elif test "$vte" = "yes"; then
 if test "$gtkabi" = "3.0"; then
@@ -5738,6 +5736,7 @@ fi
 if test "$vte" = "yes" ; then
   echo "CONFIG_VTE=y" >> $config_host_mak
   echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak
+  echo "VTE_LIBS=$vte_libs" >> $config_host_mak
 fi
 if test "$virglrenderer" = "yes" ; then
   echo "CONFIG_VIRGL=y" >> $config_host_mak
diff --git a/ui/Makefile.objs b/ui/Makefile.objs
index 3369451285..146a8ce062 100644
--- a/ui/Makefile.objs
+++ b/ui/Makefile.objs
@@ -45,6 +45,10 @@ gtk.o-cflags := $(GTK_CFLAGS) $(VTE_CFLAGS)
 gtk-egl.o-cflags := $(GTK_CFLAGS) $(VTE_CFLAGS)
 gtk-gl-area.o-cflags := $(GTK_CFLAGS) $(VTE_CFLAGS)
 
+gtk.o-libs := $(GTK_LIBS) $(VTE_LIBS)
+gtk-egl.o-libs := $(GTK_LIBS) $(VTE_LIBS)
+gtk-gl-area.o-libs := $(GTK_LIBS) $(VTE_LIBS)
+
 gtk-egl.o-libs += $(OPENGL_LIBS)
 shader.o-libs += $(OPENGL_LIBS)
 console-gl.o-libs += $(OPENGL_LIBS)
-- 
2.13.5




[Qemu-devel] [PULL v2 26/37] vl: Don't include vde header

2017-09-08 Thread Fam Zheng
Nothing in vl.c uses anything from the vde package, do remove the
unnecessary include.

Signed-off-by: Fam Zheng 
Message-Id: <20170907083552.17725-2-f...@redhat.com>
Reviewed-by: Jason Wang 
Signed-off-by: Fam Zheng 
---
 vl.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/vl.c b/vl.c
index fb1f05b937..7187e6c350 100644
--- a/vl.c
+++ b/vl.c
@@ -31,10 +31,6 @@
 #include "sysemu/seccomp.h"
 #endif
 
-#if defined(CONFIG_VDE)
-#include 
-#endif
-
 #ifdef CONFIG_SDL
 #if defined(__APPLE__) || defined(main)
 #include 
-- 
2.13.5




[Qemu-devel] [PULL v2 21/37] docker: Add test_fail and prep_fail

2017-09-08 Thread Fam Zheng
They both print a message and exit, but with different status code so
distinguish real test errors from env preparation failures.

Signed-off-by: Fam Zheng 
Message-Id: <20170905025614.579-3-f...@redhat.com>
Reviewed-by: Stefan Hajnoczi 
Based-on: 20170905021201.25684-1-f...@redhat.com
---
 tests/docker/common.rc | 12 
 1 file changed, 12 insertions(+)

diff --git a/tests/docker/common.rc b/tests/docker/common.rc
index 3b45eb91c6..87f5263757 100755
--- a/tests/docker/common.rc
+++ b/tests/docker/common.rc
@@ -32,3 +32,15 @@ build_qemu()
 echo $config_opts
 $QEMU_SRC/configure $config_opts && make $MAKEFLAGS
 }
+
+test_fail()
+{
+echo "$@"
+exit 1
+}
+
+prep_fail()
+{
+echo "$@"
+exit 2
+}
-- 
2.13.5




[Qemu-devel] [PULL v2 22/37] docker: Use unconfined security profile

2017-09-08 Thread Fam Zheng
Some by default blocked syscalls are required to run tests for example
userfaultfd.

Reviewed-by: Kashyap Chamarthy 
Signed-off-by: Fam Zheng 
Message-Id: <20170905025614.579-4-f...@redhat.com>
Reviewed-by: Stefan Hajnoczi 
Based-on: 20170905021201.25684-1-f...@redhat.com
---
 tests/docker/Makefile.include | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include
index 4bb02b1bb5..0e4f159619 100644
--- a/tests/docker/Makefile.include
+++ b/tests/docker/Makefile.include
@@ -135,6 +135,7 @@ docker-run: docker-qemu-src
$(call quiet-command,   \
$(SRC_PATH)/tests/docker/docker.py run  \
$(if $(NOUSER),,-u $(shell id -u)) -t   \
+   --security-opt seccomp=unconfined   \
$(if $V,,--rm)  \
$(if $(DEBUG),-i,)  \
$(if $(NETWORK),$(if $(subst 
$(NETWORK),,1),--net=$(NETWORK)),--net=none) \
-- 
2.13.5




[Qemu-devel] [PULL v2 30/37] buildsys: Move vnc cflags/libs to per object

2017-09-08 Thread Fam Zheng
Signed-off-by: Fam Zheng 
Message-Id: <20170907082918.7299-4-f...@redhat.com>
Reviewed-by: Gerd Hoffmann 
Reviewed-by: Philippe Mathieu-Daudé 
Signed-off-by: Fam Zheng 
---
 configure| 14 --
 ui/Makefile.objs | 21 -
 2 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/configure b/configure
index a9577bb952..ffc93c7cdb 100755
--- a/configure
+++ b/configure
@@ -2833,8 +2833,8 @@ EOF
   vnc_sasl_libs="-lsasl2"
   if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
 vnc_sasl=yes
-libs_softmmu="$vnc_sasl_libs $libs_softmmu"
-QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags"
+vnc_libs="$vnc_libs $vnc_sasl_libs"
+vnc_cflags="$vnc_cflags $vnc_sasl_cflags"
   else
 if test "$vnc_sasl" = "yes" ; then
   feature_not_found "vnc-sasl" "Install Cyrus SASL devel"
@@ -2855,8 +2855,8 @@ EOF
 vnc_jpeg_libs="-ljpeg"
   if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
 vnc_jpeg=yes
-libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
-QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags"
+vnc_libs="$vnc_libs $vnc_jpeg_libs"
+vnc_cflags="$vnc_cflags $vnc_jpeg_cflags"
   else
 if test "$vnc_jpeg" = "yes" ; then
   feature_not_found "vnc-jpeg" "Install libjpeg-turbo devel"
@@ -2887,8 +2887,8 @@ EOF
   fi
   if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
 vnc_png=yes
-libs_softmmu="$vnc_png_libs $libs_softmmu"
-QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
+vnc_libs="$vnc_libs $vnc_png_libs"
+vnc_cflags="$vnc_cflags $vnc_png_cflags"
   else
 if test "$vnc_png" = "yes" ; then
   feature_not_found "vnc-png" "Install libpng devel"
@@ -5552,6 +5552,8 @@ echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" 
>> $config_host_mak
 echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak
 if test "$vnc" = "yes" ; then
   echo "CONFIG_VNC=y" >> $config_host_mak
+  echo "VNC_CFLAGS=$vnc_cflags" >> $config_host_mak
+  echo "VNC_LIBS=$vnc_libs" >> $config_host_mak
 fi
 if test "$vnc_sasl" = "yes" ; then
   echo "CONFIG_VNC_SASL=y" >> $config_host_mak
diff --git a/ui/Makefile.objs b/ui/Makefile.objs
index b3e29e21f0..a0b3c15a28 100644
--- a/ui/Makefile.objs
+++ b/ui/Makefile.objs
@@ -1,11 +1,14 @@
-vnc-obj-y += vnc.o
-vnc-obj-y += vnc-enc-zlib.o vnc-enc-hextile.o
-vnc-obj-y += vnc-enc-tight.o vnc-palette.o
-vnc-obj-y += vnc-enc-zrle.o
-vnc-obj-y += vnc-auth-vencrypt.o
-vnc-obj-$(CONFIG_VNC_SASL) += vnc-auth-sasl.o
-vnc-obj-y += vnc-ws.o
-vnc-obj-y += vnc-jobs.o
+vnc.mo-objs += vnc.o
+vnc.mo-objs += vnc-enc-zlib.o vnc-enc-hextile.o
+vnc.mo-objs += vnc-enc-tight.o vnc-palette.o
+vnc.mo-objs += vnc-enc-zrle.o
+vnc.mo-objs += vnc-auth-vencrypt.o
+vnc.mo-objs += $(if $(CONFIG_VNC_SASL), vnc-auth-sasl.o)
+vnc.mo-objs += vnc-ws.o
+vnc.mo-objs += vnc-jobs.o
+
+vnc.mo-cflags := $(VNC_CFLAGS)
+vnc.mo-libs := $(VNC_LIBS)
 
 common-obj-y += keymaps.o console.o cursor.o qemu-pixman.o
 common-obj-y += input.o input-keymap.o input-legacy.o
@@ -14,7 +17,7 @@ common-obj-$(CONFIG_SPICE) += spice-core.o spice-input.o 
spice-display.o
 common-obj-$(CONFIG_SDL) += sdl.mo x_keymap.o
 common-obj-$(CONFIG_COCOA) += cocoa.o
 common-obj-$(CONFIG_CURSES) += curses.o
-common-obj-$(CONFIG_VNC) += $(vnc-obj-y)
+common-obj-$(CONFIG_VNC) += vnc.mo
 common-obj-$(CONFIG_GTK) += gtk.o x_keymap.o
 
 ifeq ($(CONFIG_SDLABI),1.2)
-- 
2.13.5




[Qemu-devel] [PULL v2 24/37] docker: Add test-block

2017-09-08 Thread Fam Zheng
Signed-off-by: Fam Zheng 
Message-Id: <20170905025614.579-6-f...@redhat.com>
Reviewed-by: Stefan Hajnoczi 
Based-on: 20170905021201.25684-1-f...@redhat.com
---
 tests/docker/test-block | 21 +
 1 file changed, 21 insertions(+)
 create mode 100755 tests/docker/test-block

diff --git a/tests/docker/test-block b/tests/docker/test-block
new file mode 100755
index 00..2ca1ce54f6
--- /dev/null
+++ b/tests/docker/test-block
@@ -0,0 +1,21 @@
+#!/bin/bash
+#
+# Run block test cases
+#
+# Copyright 2017 Red Hat Inc.
+#
+# Authors:
+#  Fam Zheng 
+#
+# This code is licensed under the GPL version 2 or later.  See
+# the COPYING file in the top-level directory.
+
+. ./common.rc
+
+cd "$BUILD_DIR"
+
+build_qemu --target-list=x86_64-softmmu
+cd tests/qemu-iotests
+for t in raw qcow2 nbd luks; do
+./check -g quick -$t || test_fail "Test failed: iotests $t"
+done
-- 
2.13.5




[Qemu-devel] [PULL v2 25/37] docker: Drop 'set -e' from run script

2017-09-08 Thread Fam Zheng
Signed-off-by: Fam Zheng 
Message-Id: <20170905025614.579-7-f...@redhat.com>
Reviewed-by: Stefan Hajnoczi 
Based-on: 20170905021201.25684-1-f...@redhat.com
---
 tests/docker/run | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/tests/docker/run b/tests/docker/run
index 52b76e443d..c8f940de15 100755
--- a/tests/docker/run
+++ b/tests/docker/run
@@ -1,4 +1,4 @@
-#!/bin/bash -e
+#!/bin/bash
 #
 # Docker test runner
 #
@@ -11,8 +11,6 @@
 # or (at your option) any later version. See the COPYING file in
 # the top-level directory.
 
-set -e
-
 if test -n "$V"; then
 set -x
 fi
@@ -20,7 +18,7 @@ fi
 BASE="$(dirname $(readlink -e $0))"
 
 # Prepare the environment
-. /etc/profile || true
+. /etc/profile
 export PATH=/usr/lib/ccache:$PATH
 
 if test -n "$J"; then
@@ -32,7 +30,7 @@ export TEST_DIR=/tmp/qemu-test
 mkdir -p $TEST_DIR/{src,build,install}
 
 # Extract the source tarballs
-tar -C $TEST_DIR/src -xf $BASE/qemu.tar
+tar -C $TEST_DIR/src -xf $BASE/qemu.tar || prep_fail "Failed to untar source"
 
 if test -n "$SHOW_ENV"; then
 if test -f /packages.txt; then
-- 
2.13.5




[Qemu-devel] [PULL v2 20/37] docker: Fix return code of build_qemu()

2017-09-08 Thread Fam Zheng
Without "set -e", the "&&" makes sure that the return code reflects the
result status, and that make only runs if configure succeeds.

Signed-off-by: Fam Zheng 
Message-Id: <20170905025614.579-2-f...@redhat.com>
Reviewed-by: Stefan Hajnoczi 
Based-on: 20170905021201.25684-1-f...@redhat.com
---
 tests/docker/common.rc | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tests/docker/common.rc b/tests/docker/common.rc
index 64b36ba2d0..3b45eb91c6 100755
--- a/tests/docker/common.rc
+++ b/tests/docker/common.rc
@@ -30,6 +30,5 @@ build_qemu()
  $@"
 echo "Configure options:"
 echo $config_opts
-$QEMU_SRC/configure $config_opts
-make $MAKEFLAGS
+$QEMU_SRC/configure $config_opts && make $MAKEFLAGS
 }
-- 
2.13.5




[Qemu-devel] [PULL v2 19/37] docker: Use archive-source.py

2017-09-08 Thread Fam Zheng
Signed-off-by: Fam Zheng 
Message-Id: <20170905021201.25684-13-f...@redhat.com>
---
 tests/docker/Makefile.include | 15 ++-
 tests/docker/run  |  8 +---
 2 files changed, 3 insertions(+), 20 deletions(-)

diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include
index d7dafdbd27..4bb02b1bb5 100644
--- a/tests/docker/Makefile.include
+++ b/tests/docker/Makefile.include
@@ -17,24 +17,13 @@ DOCKER_TOOLS := travis
 TESTS ?= %
 IMAGES ?= %
 
-# Make archive from git repo $1 to tar.gz $2
-make-archive-maybe = $(if $(wildcard $1/*), \
-   $(call quiet-command, \
-   (cd $1; if git diff-index --quiet HEAD -- &>/dev/null; then \
-   git archive -1 HEAD --format=tar.gz; \
-   else \
-   git archive -1 $$(git stash create) --format=tar.gz; \
-   fi) > $2, \
-   "ARCHIVE","$(notdir $2)"))
-
 CUR_TIME := $(shell date +%Y-%m-%d-%H.%M.%S.)
 DOCKER_SRC_COPY := docker-src.$(CUR_TIME)
 
 $(DOCKER_SRC_COPY):
@mkdir $@
-   $(call make-archive-maybe, $(SRC_PATH), $@/qemu.tgz)
-   $(call make-archive-maybe, $(SRC_PATH)/dtc, $@/dtc.tgz)
-   $(call make-archive-maybe, $(SRC_PATH)/pixman, $@/pixman.tgz)
+   $(call quiet-command, $(SRC_PATH)/scripts/archive-source.sh 
$@/qemu.tar, \
+   "GEN", "$@/qemu.tar")
$(call quiet-command, cp $(SRC_PATH)/tests/docker/run $@/run, \
"COPY","RUNNER")
 
diff --git a/tests/docker/run b/tests/docker/run
index ec2541cbd9..52b76e443d 100755
--- a/tests/docker/run
+++ b/tests/docker/run
@@ -32,13 +32,7 @@ export TEST_DIR=/tmp/qemu-test
 mkdir -p $TEST_DIR/{src,build,install}
 
 # Extract the source tarballs
-tar -C $TEST_DIR/src -xzf $BASE/qemu.tgz
-for p in dtc pixman; do
-if test -f $BASE/$p.tgz; then
-tar -C $TEST_DIR/src/$p -xzf $BASE/$p.tgz
-export FEATURES="$FEATURES $p"
-fi
-done
+tar -C $TEST_DIR/src -xf $BASE/qemu.tar
 
 if test -n "$SHOW_ENV"; then
 if test -f /packages.txt; then
-- 
2.13.5




[Qemu-devel] [PULL v2 16/37] Makefile: Add rules to run vm tests

2017-09-08 Thread Fam Zheng
Signed-off-by: Fam Zheng 
Message-Id: <20170905021201.25684-10-f...@redhat.com>
---
 Makefile  |  2 ++
 configure |  2 +-
 tests/vm/Makefile.include | 42 ++
 3 files changed, 45 insertions(+), 1 deletion(-)
 create mode 100644 tests/vm/Makefile.include

diff --git a/Makefile b/Makefile
index 337a1f6f9b..946eb2ce35 100644
--- a/Makefile
+++ b/Makefile
@@ -822,6 +822,7 @@ endif
 -include $(wildcard *.d tests/*.d)
 
 include $(SRC_PATH)/tests/docker/Makefile.include
+include $(SRC_PATH)/tests/vm/Makefile.include
 
 .PHONY: help
 help:
@@ -845,6 +846,7 @@ help:
@echo  'Test targets:'
@echo  '  check   - Run all tests (check-help for details)'
@echo  '  docker  - Help about targets running tests inside 
Docker containers'
+   @echo  '  vm-test - Help about targets running tests inside VM'
@echo  ''
@echo  'Documentation targets:'
@echo  '  html info pdf txt'
diff --git a/configure b/configure
index fd7e3a5e81..3918c47cd8 100755
--- a/configure
+++ b/configure
@@ -6546,7 +6546,7 @@ if test "$ccache_cpp2" = "yes"; then
 fi
 
 # build tree in object directory in case the source is not in the current 
directory
-DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos 
tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests"
+DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos 
tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests tests/vm"
 DIRS="$DIRS docs docs/interop fsdev"
 DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw"
 DIRS="$DIRS roms/seabios roms/vgabios"
diff --git a/tests/vm/Makefile.include b/tests/vm/Makefile.include
new file mode 100644
index 00..5daa2a3b73
--- /dev/null
+++ b/tests/vm/Makefile.include
@@ -0,0 +1,42 @@
+# Makefile for VM tests
+
+.PHONY: vm-build-all
+
+IMAGES := ubuntu.i386 freebsd netbsd openbsd
+IMAGE_FILES := $(patsubst %, tests/vm/%.img, $(IMAGES))
+
+.PRECIOUS: $(IMAGE_FILES)
+
+vm-test:
+   @echo "vm-test: Test QEMU in preconfigured virtual machines"
+   @echo
+   @echo "  vm-build-ubuntu.i386- Build QEMU in ubuntu i386 VM"
+   @echo "  vm-build-freebsd- Build QEMU in FreeBSD VM"
+   @echo "  vm-build-netbsd - Build QEMU in NetBSD VM"
+   @echo "  vm-build-openbsd- Build QEMU in OpenBSD VM"
+
+vm-build-all: $(addprefix vm-build-, $(IMAGES))
+
+tests/vm/%.img: $(SRC_PATH)/tests/vm/% \
+   $(SRC_PATH)/tests/vm/basevm.py \
+   $(SRC_PATH)/tests/vm/Makefile.include
+   $(call quiet-command, \
+   $< \
+   $(if $(V)$(DEBUG), --debug) \
+   --image "$@" \
+   --force \
+   --build-image $@, \
+   "  VM-IMAGE $*")
+
+
+# Build in VM $(IMAGE)
+vm-build-%: tests/vm/%.img
+   $(call quiet-command, \
+   $(SRC_PATH)/tests/vm/$* \
+   $(if $(V)$(DEBUG), --debug) \
+   $(if $(DEBUG), --interactive) \
+   $(if $(J),--jobs $(J)) \
+   --image "$<" \
+   --build-qemu $(SRC_PATH), \
+   "  VM-BUILD $*")
+
-- 
2.13.5




[Qemu-devel] [PULL v2 23/37] docker: Add nettle-devel to fedora image

2017-09-08 Thread Fam Zheng
The LUKS cases in qemu-iotests requires this.

Reviewed-by: Kashyap Chamarthy 
Signed-off-by: Fam Zheng 
Message-Id: <20170905025614.579-5-f...@redhat.com>
Reviewed-by: Stefan Hajnoczi 
Based-on: 20170905021201.25684-1-f...@redhat.com
---
 tests/docker/dockerfiles/fedora.docker | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/docker/dockerfiles/fedora.docker 
b/tests/docker/dockerfiles/fedora.docker
index 4eaa8ed2a5..27e8201c54 100644
--- a/tests/docker/dockerfiles/fedora.docker
+++ b/tests/docker/dockerfiles/fedora.docker
@@ -3,6 +3,7 @@ ENV PACKAGES \
 ccache git tar PyYAML sparse flex bison python2 bzip2 hostname \
 glib2-devel pixman-devel zlib-devel SDL-devel libfdt-devel \
 gcc gcc-c++ clang make perl which bc findutils libaio-devel \
+nettle-devel \
 mingw32-pixman mingw32-glib2 mingw32-gmp mingw32-SDL mingw32-pkg-config \
 mingw32-gtk2 mingw32-gtk3 mingw32-gnutls mingw32-nettle mingw32-libtasn1 \
 mingw32-libjpeg-turbo mingw32-libpng mingw32-curl mingw32-libssh2 \
-- 
2.13.5




[Qemu-devel] [PULL v2 17/37] MAINTAINERS: Add tests/vm entry

2017-09-08 Thread Fam Zheng
Signed-off-by: Fam Zheng 
Reviewed-by: Stefan Hajnoczi 
Message-Id: <20170905021201.25684-11-f...@redhat.com>
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 36eeb42d19..42f5454311 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1891,6 +1891,7 @@ S: Maintained
 F: .travis.yml
 F: .shippable.yml
 F: tests/docker/
+F: tests/vm/
 W: https://travis-ci.org/qemu/qemu
 W: https://app.shippable.com/github/qemu/qemu
 W: http://patchew.org/QEMU/
-- 
2.13.5




[Qemu-devel] [PULL v2 18/37] tests: Add README for vm tests

2017-09-08 Thread Fam Zheng
Signed-off-by: Fam Zheng 
Message-Id: <20170905021201.25684-12-f...@redhat.com>
---
 tests/vm/README | 63 +
 1 file changed, 63 insertions(+)
 create mode 100644 tests/vm/README

diff --git a/tests/vm/README b/tests/vm/README
new file mode 100644
index 00..7d2fe4ac8d
--- /dev/null
+++ b/tests/vm/README
@@ -0,0 +1,63 @@
+=== VM test suite to run build in guests ===
+
+== Intro ==
+
+This test suite contains scripts that bootstrap various guest images that have
+necessary packages to build QEMU. The basic usage is documented in Makefile
+help which is displayed with "make vm-test".
+
+== Quick start ==
+
+Run "make vm-test" to list available make targets.
+
+== Manual invocation ==
+
+Each guest script is an executable script with the same command line options.
+For example to work with the netbsd guest, use $QEMU_SRC/tests/vm/netbsd:
+
+$ cd $QEMU_SRC/tests/vm
+
+# To bootstrap the image
+$ ./netbsd --build-image --image /var/tmp/netbsd.img
+<...>
+
+# To run an arbitrary command in guest (the output will not be echoed 
unless
+# --debug is added)
+$ ./netbsd --debug --image /var/tmp/netbsd.img uname -a
+
+# To build QEMU in guest
+$ ./netbsd --debug --image /var/tmp/netbsd.img --build-qemu $QEMU_SRC
+
+# To get to an interactive shell
+$ ./netbsd --interactive --image /var/tmp/netbsd.img sh
+
+== Adding new guests ==
+
+Please look at existing guest scripts for how to add new guests.
+
+Most importantly, create a subclass of BaseVM and implement build_image()
+method and define BUILD_SCRIPT, then finally call basevm.main() from the
+script's main().
+
+  - Usually in build_image(), a template image is downloaded from a predefined
+URL. BaseVM._download_with_cache() takes care of the cache and the
+checksum, so consider using it.
+
+  - Once the image is downloaded, users, SSH server and QEMU build deps should
+be set up:
+
+* Root password set to BaseVM.ROOT_PASS
+* User BaseVM.GUEST_USER is created, and password set to BaseVM.GUEST_PASS
+* SSH service is enabled and started on boot, BaseVM.SSH_PUB_KEY is added
+  to authorized_keys of both root and the normal user
+* DHCP client service is enabled and started on boot, so that it can
+  automatically configure the virtio-net-pci NIC and communicate with QEMU
+  user net (10.0.2.2)
+* Necessary packages are installed to untar the source tarball and build
+  QEMU
+
+  - Write a proper BUILD_SCRIPT template, which should be a shell script that
+untars a raw virtio-blk block device, which is the tarball data blob of the
+QEMU source tree, then configure/build it. Running "make check" is also
+recommended.
+
-- 
2.13.5




[Qemu-devel] [PULL v2 15/37] tests: Add OpenBSD image

2017-09-08 Thread Fam Zheng
The image is prepared following instructions as in:

https://wiki.qemu.org/Hosts/BSD

Signed-off-by: Fam Zheng 
Message-Id: <20170905021201.25684-9-f...@redhat.com>
---
 tests/vm/openbsd | 43 +++
 1 file changed, 43 insertions(+)
 create mode 100755 tests/vm/openbsd

diff --git a/tests/vm/openbsd b/tests/vm/openbsd
new file mode 100755
index 00..6ae16d97fd
--- /dev/null
+++ b/tests/vm/openbsd
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+#
+# OpenBSD VM image
+#
+# Copyright 2017 Red Hat Inc.
+#
+# Authors:
+#  Fam Zheng 
+#
+# This code is licensed under the GPL version 2 or later.  See
+# the COPYING file in the top-level directory.
+#
+
+import os
+import sys
+import subprocess
+import basevm
+
+class OpenBSDVM(basevm.BaseVM):
+name = "openbsd"
+BUILD_SCRIPT = """
+set -e;
+cd $(mktemp -d /var/tmp/qemu-test.XX);
+tar -xf /dev/rsd1c;
+./configure --cc=x86_64-unknown-openbsd6.1-gcc-4.9.4 
--python=python2.7 {configure_opts};
+gmake -j{jobs};
+# XXX: "gmake check" seems to always hang or fail
+#gmake check;
+"""
+
+def build_image(self, img):
+cimg = 
self._download_with_cache("http://download.patchew.org/openbsd-6.1-amd64.img.xz";,
+
sha256sum='8c6cedc483e602cfee5e04f0406c64eb99138495e8ca580bc0293bcf0640c1bf')
+img_tmp_xz = img + ".tmp.xz"
+img_tmp = img + ".tmp"
+subprocess.check_call(["cp", "-f", cimg, img_tmp_xz])
+subprocess.check_call(["xz", "-df", img_tmp_xz])
+if os.path.exists(img):
+os.remove(img)
+os.rename(img_tmp, img)
+
+if __name__ == "__main__":
+sys.exit(basevm.main(OpenBSDVM))
-- 
2.13.5




[Qemu-devel] [PULL v2 14/37] tests: Add NetBSD image

2017-09-08 Thread Fam Zheng
The image is prepared following instructions as in:

https://wiki.qemu.org/Hosts/BSD

Signed-off-by: Fam Zheng 
Reviewed-by: Kamil Rytarowski 
Message-Id: <20170905021201.25684-8-f...@redhat.com>
---
 tests/vm/netbsd | 42 ++
 1 file changed, 42 insertions(+)
 create mode 100755 tests/vm/netbsd

diff --git a/tests/vm/netbsd b/tests/vm/netbsd
new file mode 100755
index 00..3972d8b45c
--- /dev/null
+++ b/tests/vm/netbsd
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+#
+# NetBSD VM image
+#
+# Copyright 2017 Red Hat Inc.
+#
+# Authors:
+#  Fam Zheng 
+#
+# This code is licensed under the GPL version 2 or later.  See
+# the COPYING file in the top-level directory.
+#
+
+import os
+import sys
+import subprocess
+import basevm
+
+class NetBSDVM(basevm.BaseVM):
+name = "netbsd"
+BUILD_SCRIPT = """
+set -e;
+cd $(mktemp -d /var/tmp/qemu-test.XX);
+tar -xf /dev/rld1a;
+./configure --python=python2.7 {configure_opts};
+gmake -j{jobs};
+gmake check;
+"""
+
+def build_image(self, img):
+cimg = 
self._download_with_cache("http://download.patchew.org/netbsd-7.1-amd64.img.xz";,
+ 
sha256sum='b633d565b0eac3d02015cd0c81440bd8a7a8df8512615ac1ee05d318be015732')
+img_tmp_xz = img + ".tmp.xz"
+img_tmp = img + ".tmp"
+subprocess.check_call(["cp", "-f", cimg, img_tmp_xz])
+subprocess.check_call(["xz", "-df", img_tmp_xz])
+if os.path.exists(img):
+os.remove(img)
+os.rename(img_tmp, img)
+
+if __name__ == "__main__":
+sys.exit(basevm.main(NetBSDVM))
-- 
2.13.5




[Qemu-devel] [PULL v2 12/37] tests: Add ubuntu.i386 image

2017-09-08 Thread Fam Zheng
This adds a 32bit guest.

The official LTS cloud image is downloaded and initialized with
cloud-init.

Signed-off-by: Fam Zheng 
Message-Id: <20170905021201.25684-6-f...@redhat.com>
---
 tests/vm/ubuntu.i386 | 88 
 1 file changed, 88 insertions(+)
 create mode 100755 tests/vm/ubuntu.i386

diff --git a/tests/vm/ubuntu.i386 b/tests/vm/ubuntu.i386
new file mode 100755
index 00..e70dcb89ce
--- /dev/null
+++ b/tests/vm/ubuntu.i386
@@ -0,0 +1,88 @@
+#!/usr/bin/env python
+#
+# Ubuntu i386 image
+#
+# Copyright 2017 Red Hat Inc.
+#
+# Authors:
+#  Fam Zheng 
+#
+# This code is licensed under the GPL version 2 or later.  See
+# the COPYING file in the top-level directory.
+#
+
+import os
+import sys
+import subprocess
+import basevm
+import time
+
+class UbuntuX86VM(basevm.BaseVM):
+name = "ubuntu.i386"
+BUILD_SCRIPT = """
+set -e;
+cd $(mktemp -d);
+sudo chmod a+r /dev/vdb;
+tar -xf /dev/vdb;
+./configure {configure_opts};
+make -j{jobs};
+make check;
+"""
+
+def _gen_cloud_init_iso(self):
+cidir = self._tmpdir
+mdata = open(os.path.join(cidir, "meta-data"), "w")
+mdata.writelines(["instance-id: ubuntu-vm-0\n",
+ "local-hostname: ubuntu-guest\n"])
+mdata.close()
+udata = open(os.path.join(cidir, "user-data"), "w")
+udata.writelines(["#cloud-config\n",
+  "chpasswd:\n",
+  "  list: |\n",
+  "root:%s\n" % self.ROOT_PASS,
+  "%s:%s\n" % (self.GUEST_USER, self.GUEST_PASS),
+  "  expire: False\n",
+  "users:\n",
+  "  - name: %s\n" % self.GUEST_USER,
+  "sudo: ALL=(ALL) NOPASSWD:ALL\n",
+  "ssh-authorized-keys:\n",
+  "- %s\n" % basevm.SSH_PUB_KEY,
+  "  - name: root\n",
+  "ssh-authorized-keys:\n",
+  "- %s\n" % basevm.SSH_PUB_KEY])
+udata.close()
+subprocess.check_call(["genisoimage", "-output", "cloud-init.iso",
+   "-volid", "cidata", "-joliet", "-rock",
+   "user-data", "meta-data"],
+   cwd=cidir,
+   stdin=self._devnull, stdout=self._stdout,
+   stderr=self._stdout)
+return os.path.join(cidir, "cloud-init.iso")
+
+def build_image(self, img):
+cimg = 
self._download_with_cache("https://cloud-images.ubuntu.com/releases/16.04/release/ubuntu-16.04-server-cloudimg-i386-disk1.img";)
+img_tmp = img + ".tmp"
+subprocess.check_call(["cp", "-f", cimg, img_tmp])
+subprocess.check_call(["qemu-img", "resize", img_tmp, "50G"])
+self.boot(img_tmp, extra_args = ["-cdrom", self._gen_cloud_init_iso()])
+self.wait_ssh()
+self.ssh_root_check("touch /etc/cloud/cloud-init.disabled")
+self.ssh_root_check("apt-get update")
+self.ssh_root_check("apt-get install -y cloud-initramfs-growroot")
+# Don't check the status in case the guest hang up too quickly
+self.ssh_root("sync && reboot")
+time.sleep(5)
+self.wait_ssh()
+# The previous update sometimes doesn't survive a reboot, so do it 
again
+self.ssh_root_check("apt-get update")
+self.ssh_root_check("apt-get build-dep -y qemu")
+self.ssh_root_check("apt-get install -y libfdt-dev")
+self.ssh_root("poweroff")
+self.wait()
+if os.path.exists(img):
+os.remove(img)
+os.rename(img_tmp, img)
+return 0
+
+if __name__ == "__main__":
+sys.exit(basevm.main(UbuntuX86VM))
-- 
2.13.5




[Qemu-devel] [PULL v2 13/37] tests: Add FreeBSD image

2017-09-08 Thread Fam Zheng
The image is prepared following instructions as in:

https://wiki.qemu.org/Hosts/BSD

Signed-off-by: Fam Zheng 
Message-Id: <20170905021201.25684-7-f...@redhat.com>
---
 tests/vm/freebsd | 42 ++
 1 file changed, 42 insertions(+)
 create mode 100755 tests/vm/freebsd

diff --git a/tests/vm/freebsd b/tests/vm/freebsd
new file mode 100755
index 00..039dad8f69
--- /dev/null
+++ b/tests/vm/freebsd
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+#
+# FreeBSD VM image
+#
+# Copyright 2017 Red Hat Inc.
+#
+# Authors:
+#  Fam Zheng 
+#
+# This code is licensed under the GPL version 2 or later.  See
+# the COPYING file in the top-level directory.
+#
+
+import os
+import sys
+import subprocess
+import basevm
+
+class FreeBSDVM(basevm.BaseVM):
+name = "freebsd"
+BUILD_SCRIPT = """
+set -e;
+cd $(mktemp -d /var/tmp/qemu-test.XX);
+tar -xf /dev/vtbd1;
+./configure {configure_opts};
+gmake -j{jobs};
+gmake check;
+"""
+
+def build_image(self, img):
+cimg = 
self._download_with_cache("http://download.patchew.org/freebsd-11.1-amd64.img.xz";,
+
sha256sum='adcb771549b37bc63826c501f05121a206ed3d9f55f49145908f7e1432d65891')
+img_tmp_xz = img + ".tmp.xz"
+img_tmp = img + ".tmp"
+subprocess.check_call(["cp", "-f", cimg, img_tmp_xz])
+subprocess.check_call(["xz", "-df", img_tmp_xz])
+if os.path.exists(img):
+os.remove(img)
+os.rename(img_tmp, img)
+
+if __name__ == "__main__":
+sys.exit(basevm.main(FreeBSDVM))
-- 
2.13.5




[Qemu-devel] [PULL v2 05/37] docker: Update ubuntu image

2017-09-08 Thread Fam Zheng
Base on the newer ubuntu-lts (16.06) and include more packages for
better build coverage.

Signed-off-by: Fam Zheng 
Message-Id: <20170907141245.31946-2-f...@redhat.com>
Signed-off-by: Fam Zheng 
---
 tests/docker/dockerfiles/ubuntu.docker | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/tests/docker/dockerfiles/ubuntu.docker 
b/tests/docker/dockerfiles/ubuntu.docker
index a360a050a2..d73ce02246 100644
--- a/tests/docker/dockerfiles/ubuntu.docker
+++ b/tests/docker/dockerfiles/ubuntu.docker
@@ -1,12 +1,17 @@
-FROM ubuntu:14.04
+FROM ubuntu:16.04
 RUN echo "deb http://archive.ubuntu.com/ubuntu/ trusty universe multiverse" >> 
\
 /etc/apt/sources.list
 RUN apt-get update
 ENV PACKAGES flex bison \
-libusb-1.0-0-dev libiscsi-dev librados-dev libncurses5-dev \
+libusb-1.0-0-dev libiscsi-dev librados-dev libncurses5-dev 
libncursesw5-dev \
 libseccomp-dev libgnutls-dev libssh2-1-dev  libspice-server-dev \
 libspice-protocol-dev libnss3-dev libfdt-dev \
-libgtk-3-dev libvte-2.90-dev libsdl1.2-dev libpng12-dev libpixman-1-dev \
+libgtk-3-dev libvte-2.91-dev libsdl1.2-dev libpng12-dev libpixman-1-dev \
+libvdeplug-dev liblzo2-dev libsnappy-dev libbz2-dev libxen-dev 
librdmacm-dev libibverbs-dev \
+libsasl2-dev libjpeg-turbo8-dev xfslibs-dev libcap-ng-dev libbrlapi-dev 
libcurl4-gnutls-dev \
+libbluetooth-dev librbd-dev libaio-dev glusterfs-common libnuma-dev 
libepoxy-dev libdrm-dev libgbm-dev \
+libjemalloc-dev libcacard-dev libusbredirhost-dev libnfs-dev libcap-dev 
libattr1-dev \
+texinfo \
 git make ccache python-yaml gcc clang sparse
 RUN apt-get -y install $PACKAGES
 RUN dpkg -l $PACKAGES | sort > /packages.txt
-- 
2.13.5




[Qemu-devel] [PULL v2 11/37] tests: Add vm test lib

2017-09-08 Thread Fam Zheng
This is the common code to implement a "VM test" to

  1) Download and initialize a pre-defined VM that has necessary
  dependencies to build QEMU and SSH access.

  2) Archive $SRC_PATH to a .tar file.

  3) Boot the VM, and pass the source tar file to the guest.

  4) SSH into the VM, untar the source tarball, build from the source.

Signed-off-by: Fam Zheng 
Message-Id: <20170905021201.25684-5-f...@redhat.com>
---
 tests/vm/basevm.py | 276 +
 1 file changed, 276 insertions(+)
 create mode 100755 tests/vm/basevm.py

diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
new file mode 100755
index 00..3fa695c5a2
--- /dev/null
+++ b/tests/vm/basevm.py
@@ -0,0 +1,276 @@
+#!/usr/bin/env python
+#
+# VM testing base class
+#
+# Copyright 2017 Red Hat Inc.
+#
+# Authors:
+#  Fam Zheng 
+#
+# This code is licensed under the GPL version 2 or later.  See
+# the COPYING file in the top-level directory.
+#
+
+import os
+import sys
+import logging
+import time
+import datetime
+sys.path.append(os.path.join(os.path.dirname(__file__), "..", "..", "scripts"))
+from qemu import QEMUMachine
+import subprocess
+import hashlib
+import optparse
+import atexit
+import tempfile
+import shutil
+import multiprocessing
+import traceback
+
+SSH_KEY = """\
+-BEGIN RSA PRIVATE KEY-
+MIIEowIBAAKCAQEAopAuOlmLV6LVHdFBj8/eeOwI9CqguIJPp7eAQSZvOiB4Ag/R
+coEhl/RBbrV5Yc/SmSD4PTpJO/iM10RwliNjDb4a3I8q3sykRJu9c9PI/YsH8WN9
++NH2NjKPtJIcKTu287IM5JYxyB6nDoOzILbTyJ1TDR/xH6qYEfBAyiblggdjcvhA
+RTf93QIn39F/xLypXvT1K2O9BJEsnJ8lEUvB2UXhKo/JTfSeZF8wPBeowaP9EONk
+7b+nuJOWHGg68Ji6wVi62tjwl2Szch6lxIhZBpnV7QNRKMfYHP6eIyF4pusazzZq
+Telsq6xI2ghecWLzb/MF5A+rklsGx2FNuJSAJwIDAQABAoIBAHHi4o/8VZNivz0x
+cWXn8erzKV6tUoWQvW85Lj/2RiwJvSlsnYZDkx5af1CpEE2HA/pFT8PNRqsd+MWC
+7AEy710cVsM4BYerBFYQaYxwzblaoojo88LSjVPw3h5Z0iLM8+IMVd36nwuc9dpE
+R8TecMZ1+U4Tl6BgqkK+9xToZRdPKdjS8L5MoFhGN+xY0vRbbJbGaV9Q0IHxLBkB
+rEBV7T1mUynneCHRUQlJQEwJmKpT8MH3IjsUXlG5YvnuuvcQJSNTaW2iDLxuOKp8
+cxW8+qL88zpb1D5dppoIu6rlrugN0azSq70ruFJQPc/A8GQrDKoGgRQiagxNY3u+
+vHZzXlECgYEA0dKO3gfkSxsDBb94sQwskMScqLhcKhztEa8kPxTx6Yqh+x8/scx3
+XhJyOt669P8U1v8a/2Al+s81oZzzfQSzO1Q7gEwSrgBcRMSIoRBUw9uYcy02ngb/
+j/ng3DGivfJztjjiSJwb46FHkJ2JR8mF2UisC6UMXk3NgFY/3vWQx78CgYEAxlcG
+T3hfSWSmTgKRczMJuHQOX9ULfTBIqwP5VqkkkiavzigGRirzb5lgnmuTSPTpF0LB
+XVPjR2M4q+7gzP0Dca3pocrvLEoxjwIKnCbYKnyyvnUoE9qHv4Kr+vDbgWpa2LXG
+JbLmE7tgTCIp20jOPPT4xuDvlbzQZBJ5qCQSoZkCgYEAgrotSSihlCnAOFSTXbu4
+CHp3IKe8xIBBNENq0eK61kcJpOxTQvOha3sSsJsU4JAM6+cFaxb8kseHIqonCj1j
+bhOM/uJmwQJ4el/4wGDsbxriYOBKpyq1D38gGhDS1IW6kk3erl6VAb36WJ/OaGum
+eTpN9vNeQWM4Jj2WjdNx4QECgYAwTdd6mU1TmZCrJRL5ZG+0nYc2rbMrnQvFoqUi
+BvWiJovggHzur90zy73tNzPaq9Ls2FQxf5G1vCN8NCRJqEEjeYCR59OSDMu/EXc2
+CnvQ9SevHOdS1oEDEjcCWZCMFzPi3XpRih1gptzQDe31uuiHjf3cqcGPzTlPdfRt
+D8P92QKBgC4UaBvIRwREVJsdZzpIzm224Bpe8LOmA7DeTnjlT0b3lkGiBJ36/Q0p
+VhYh/6cjX4/iuIs7gJbGon7B+YPB8scmOi3fj0+nkJAONue1mMfBNkba6qQTc6Y2
+5mEKw2/O7/JpND7ucU3OK9plcw/qnrWDgHxl0Iz95+OzUIIagxne
+-END RSA PRIVATE KEY-
+"""
+SSH_PUB_KEY = """\
+ssh-rsa 
B3NzaC1yc2EDAQABAAABAQCikC46WYtXotUd0UGPz9547Aj0KqC4gk+nt4BBJm86IHgCD9FygSGX9EFutXlhz9KZIPg9Okk7+IzXRHCWI2MNvhrcjyrezKREm71z08j9iwfxY3340fY2Mo+0khwpO7bzsgzkljHIHqcOg7MgttPInVMNH/EfqpgR8EDKJuWCB2Ny+EBFN/3dAiff0X/EvKle9PUrY70EkSycnyURS8HZReEqj8lN9J5kXzA8F6jBo/0Q42Ttv6e4k5YcaDrwmLrBWLra2PCXZLNyHqXEiFkGmdXtA1Eox9gc/p4jIXim6xrPNmpN6WyrrEjaCF5xYvNv8wXkD6uSWwbHYU24lIAn
 qemu-vm-key
+"""
+
+class BaseVM(object):
+GUEST_USER = "qemu"
+GUEST_PASS = "qemupass"
+ROOT_PASS = "qemupass"
+
+# The script to run in the guest that builds QEMU
+BUILD_SCRIPT = ""
+# The guest name, to be overridden by subclasses
+name = "#base"
+def __init__(self, debug=False, vcpus=None):
+self._guest = None
+self._tmpdir = tempfile.mkdtemp(prefix="vm-test-", suffix=".tmp", 
dir=".")
+atexit.register(shutil.rmtree, self._tmpdir)
+
+self._ssh_key_file = os.path.join(self._tmpdir, "id_rsa")
+open(self._ssh_key_file, "w").write(SSH_KEY)
+subprocess.check_call(["chmod", "600", self._ssh_key_file])
+
+self._ssh_pub_key_file = os.path.join(self._tmpdir, "id_rsa.pub")
+open(self._ssh_pub_key_file, "w").write(SSH_PUB_KEY)
+
+self.debug = debug
+self._stderr = sys.stderr
+self._devnull = open("/dev/null", "w")
+if self.debug:
+self._stdout = sys.stdout
+else:
+self._stdout = self._devnull
+self._args = [ \
+"-nodefaults", "-m", "2G",
+"-cpu", "host",
+"-netdev", "user,id=vnet,hostfwd=:0.0.0.0:0-:22",
+"-device", "virtio-net-pci,netdev=vnet",
+"-vnc", ":0,to=20",
+"-serial", "file:%s" % os.path.join(self._tmpdir, "serial.out")]
+if vcpus:
+self._args += ["-smp", str(vcpus)]
+if os.access("/dev/kvm", os.R_OK | os.W_OK):
+self._args += ["-enable-kvm"]
+else:
+logg

[Qemu-devel] [PULL v2 10/37] scripts: Add archive-source.sh

2017-09-08 Thread Fam Zheng
Signed-off-by: Fam Zheng 
Message-Id: <20170905021201.25684-4-f...@redhat.com>
---
 scripts/archive-source.sh | 31 +++
 1 file changed, 31 insertions(+)
 create mode 100755 scripts/archive-source.sh

diff --git a/scripts/archive-source.sh b/scripts/archive-source.sh
new file mode 100755
index 00..1de369532e
--- /dev/null
+++ b/scripts/archive-source.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+#
+# Author: Fam Zheng 
+#
+# Create archive of source tree, including submodules
+#
+# This code is licensed under the GPL version 2 or later.  See
+# the COPYING file in the top-level directory.
+
+set -e
+
+if test $# -lt 1; then
+echo "Usage: $0 "
+exit 1
+fi
+
+submodules=$(git submodule foreach --recursive --quiet 'echo $name')
+
+if test -n "$submodules"; then
+{
+git ls-files
+for sm in $submodules; do
+(cd $sm; git ls-files) | sed "s:^:$sm/:"
+done
+} | grep -x -v $(for sm in $submodules; do echo "-e $sm"; done) > $1.list
+else
+git ls-files > $1.list
+fi
+
+tar -cf $1 -T $1.list
+rm $1.list
-- 
2.13.5




[Qemu-devel] [PULL v2 07/37] tests/docker: Clean up paths

2017-09-08 Thread Fam Zheng
The 'run' script already creats src, build and install directories under
$TEST_DIR, use it in common.rc.

Also the tests always run from $QEMU_SRC/tests/docker, so use a relative
$CMD string.

Message-Id: <20170817035721.11064-1-f...@redhat.com>
Signed-off-by: Fam Zheng 
---
 tests/docker/common.rc | 5 +
 tests/docker/run   | 4 +++-
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/tests/docker/common.rc b/tests/docker/common.rc
index 6865689bb5..64b36ba2d0 100755
--- a/tests/docker/common.rc
+++ b/tests/docker/common.rc
@@ -11,9 +11,6 @@
 # or (at your option) any later version. See the COPYING file in
 # the top-level directory.
 
-BUILD_DIR=/var/tmp/qemu-build
-mkdir $BUILD_DIR
-
 requires()
 {
 for c in $@; do
@@ -28,7 +25,7 @@ build_qemu()
 {
 config_opts="--enable-werror \
  ${TARGET_LIST:+--target-list=${TARGET_LIST}} \
- --prefix=$PWD/install \
+ --prefix=$INSTALL_DIR \
  $QEMU_CONFIGURE_OPTS $EXTRA_CONFIGURE_OPTS \
  $@"
 echo "Configure options:"
diff --git a/tests/docker/run b/tests/docker/run
index c1e4513bce..ec2541cbd9 100755
--- a/tests/docker/run
+++ b/tests/docker/run
@@ -52,10 +52,12 @@ if test -n "$SHOW_ENV"; then
 fi
 
 export QEMU_SRC="$TEST_DIR/src"
+export BUILD_DIR="$TEST_DIR/build"
+export INSTALL_DIR="$TEST_DIR/install"
 
 cd "$QEMU_SRC/tests/docker"
 
-CMD="$QEMU_SRC/tests/docker/$@"
+CMD="./$@"
 
 if test -z "$DEBUG"; then
 exec $CMD
-- 
2.13.5




[Qemu-devel] [PULL v2 06/37] docker: Enable features explicitly in test-full

2017-09-08 Thread Fam Zheng
Also avoid "set -e".

Signed-off-by: Fam Zheng 
Message-Id: <20170907141245.31946-3-f...@redhat.com>
Reviewed-by: Eric Blake 
Signed-off-by: Fam Zheng 
---
 tests/docker/test-full | 82 ++
 1 file changed, 76 insertions(+), 6 deletions(-)

diff --git a/tests/docker/test-full b/tests/docker/test-full
index 05f0d491d1..d71bf9d275 100755
--- a/tests/docker/test-full
+++ b/tests/docker/test-full
@@ -1,8 +1,8 @@
-#!/bin/bash -e
+#!/bin/bash
 #
-# Compile all the targets.
+# Compile all the targets with as many features enabled as possible
 #
-# Copyright (c) 2016 Red Hat Inc.
+# Copyright 2016, 2017 Red Hat Inc.
 #
 # Authors:
 #  Fam Zheng 
@@ -13,7 +13,77 @@
 
 . common.rc
 
-cd "$BUILD_DIR"
+cd "$BUILD_DIR" || exit 1
 
-build_qemu
-make check $MAKEFLAGS
+build_qemu \
+--enable-attr \
+--enable-bluez \
+--enable-brlapi \
+--enable-bsd-user \
+--enable-bzip2 \
+--enable-cap-ng \
+--enable-coroutine-pool \
+--enable-crypto-afalg \
+--enable-curl \
+--enable-curses \
+--enable-debug \
+--enable-debug-info \
+--enable-debug-tcg \
+--enable-docs \
+--enable-fdt \
+--enable-gcrypt \
+--enable-glusterfs \
+--enable-gnutls \
+--enable-gprof \
+--enable-gtk \
+--enable-guest-agent \
+--enable-jemalloc \
+--enable-kvm \
+--enable-libiscsi \
+--enable-libnfs \
+--enable-libssh2 \
+--enable-libusb \
+--enable-linux-aio \
+--enable-linux-user \
+--enable-live-block-migration \
+--enable-lzo \
+--enable-modules \
+--enable-numa \
+--enable-opengl \
+--enable-pie \
+--enable-profiler \
+--enable-qom-cast-debug \
+--enable-rbd \
+--enable-rdma \
+--enable-replication \
+--enable-sdl \
+--enable-seccomp \
+--enable-smartcard \
+--enable-snappy \
+--enable-spice \
+--enable-stack-protector \
+--enable-system \
+--enable-tcg \
+--enable-tcg-interpreter \
+--enable-tools \
+--enable-tpm \
+--enable-trace-backend=ftrace \
+--enable-usb-redir \
+--enable-user \
+--enable-vde \
+--enable-vhost-net \
+--enable-vhost-scsi \
+--enable-vhost-user \
+--enable-vhost-vsock \
+--enable-virtfs \
+--enable-vnc \
+--enable-vnc-jpeg \
+--enable-vnc-png \
+--enable-vnc-sasl \
+--enable-vte \
+--enable-werror \
+--enable-xen \
+--enable-xen-pci-passthrough \
+--enable-xen-pv-domain-build \
+--enable-xfsctl \
+&& make check $MAKEFLAGS
-- 
2.13.5




[Qemu-devel] [PULL v2 09/37] qemu.py: Add "wait()" method

2017-09-08 Thread Fam Zheng
Signed-off-by: Fam Zheng 
Reviewed-by: Stefan Hajnoczi 
Message-Id: <20170905021201.25684-3-f...@redhat.com>
---
 scripts/qemu.py | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/scripts/qemu.py b/scripts/qemu.py
index 4d8ee10943..99963053a5 100644
--- a/scripts/qemu.py
+++ b/scripts/qemu.py
@@ -157,6 +157,13 @@ class QEMUMachine(object):
 self._post_shutdown()
 raise
 
+def wait(self):
+'''Wait for the VM to power off'''
+self._popen.wait()
+self._qmp.close()
+self._load_io_log()
+self._post_shutdown()
+
 def shutdown(self):
 '''Terminate the VM and clean up'''
 if self.is_running():
-- 
2.13.5




[Qemu-devel] [PULL v2 08/37] gitignore: Ignore vm test images

2017-09-08 Thread Fam Zheng
Signed-off-by: Fam Zheng 
Message-Id: <20170905021201.25684-2-f...@redhat.com>
---
 .gitignore   | 1 +
 tests/.gitignore | 1 +
 2 files changed, 2 insertions(+)

diff --git a/.gitignore b/.gitignore
index cf65316863..40acfcb9e2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -52,6 +52,7 @@
 /vscclient
 /vhost-user-scsi
 /fsdev/virtfs-proxy-helper
+*.tmp
 *.[1-9]
 *.a
 *.aux
diff --git a/tests/.gitignore b/tests/.gitignore
index fed0189a5a..cf6d99c91e 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -95,3 +95,4 @@ test-filter-mirror
 test-filter-redirector
 *-test
 qapi-schema/*.test.*
+vm/*.img
-- 
2.13.5




[Qemu-devel] [PULL v2 04/37] docker: reduce noise when building travis.docker

2017-09-08 Thread Fam Zheng
From: Alex Bennée 

Set the DEBIAN_FRONTEND and locale env vars to stop apt complaining so
much as we build the image.

Suggested-by: Philippe Mathieu-Daudé 
Signed-off-by: Alex Bennée 
Message-Id: <20170725133425.436-7-alex.ben...@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé 
Tested-by: Philippe Mathieu-Daudé 
Signed-off-by: Fam Zheng 
---
 tests/docker/dockerfiles/travis.docker | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tests/docker/dockerfiles/travis.docker 
b/tests/docker/dockerfiles/travis.docker
index 57ac8e1419..605b6e429b 100644
--- a/tests/docker/dockerfiles/travis.docker
+++ b/tests/docker/dockerfiles/travis.docker
@@ -1,4 +1,7 @@
 FROM quay.io/travisci/travis-ruby
+ENV DEBIAN_FRONTEND noninteractive
+ENV LANG en_US.UTF-8
+ENV LC_ALL en_US.UTF-8
 RUN apt-get update
 RUN apt-get -y build-dep qemu
 RUN apt-get -y install device-tree-compiler python2.7 python-yaml 
dh-autoreconf gdb strace lsof net-tools
-- 
2.13.5




[Qemu-devel] [PULL v2 01/37] docker: ensure NOUSER for travis images

2017-09-08 Thread Fam Zheng
From: Alex Bennée 

While adding the current user is a useful default behaviour for
creating new images it is not appropriate for Travis which already has
a default user.

Signed-off-by: Alex Bennée 
Reviewed-by: Philippe Mathieu-Daudé 
Tested-by: Philippe Mathieu-Daudé 
Message-Id: <20170725133425.436-2-alex.ben...@linaro.org>
Signed-off-by: Fam Zheng 
---
 tests/docker/Makefile.include | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include
index aaab1a4208..d7dafdbd27 100644
--- a/tests/docker/Makefile.include
+++ b/tests/docker/Makefile.include
@@ -71,6 +71,7 @@ docker-image-debian-ppc64el-cross: docker-image-debian9
 docker-image-debian-s390x-cross: docker-image-debian9
 docker-image-debian-win32-cross: docker-image-debian8-mxe
 docker-image-debian-win64-cross: docker-image-debian8-mxe
+docker-image-travis: NOUSER=1
 
 # Expand all the pre-requistes for each docker image and test combination
 $(foreach i,$(DOCKER_IMAGES), \
-- 
2.13.5




[Qemu-devel] [PULL v2 00/37] Staging patches

2017-09-08 Thread Fam Zheng
The following changes since commit fcea73709b966a7ded9efa7b106ea50c7fe9025c:

  Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging 
(2017-09-08 16:04:42 +0100)

are available in the git repository at:

  git://github.com/famz/qemu.git tags/staging-pull-request

for you to fetch changes up to 734e2410b1c14a4cf17b1500bda1dcc7e7e57cfc:

  buildsys: Move rdma libs to per object (2017-09-09 11:55:51 +0800)



v2: Drop opengl flags patch.
Change the new scripts' licenses to GPLv2+.



Alex Bennée (4):
  docker: ensure NOUSER for travis images
  docker: docker.py make --no-cache skip checksum test
  docker: don't install device-tree-compiler build-deps in travis.docker
  docker: reduce noise when building travis.docker

Fam Zheng (33):
  docker: Update ubuntu image
  docker: Enable features explicitly in test-full
  tests/docker: Clean up paths
  gitignore: Ignore vm test images
  qemu.py: Add "wait()" method
  scripts: Add archive-source.sh
  tests: Add vm test lib
  tests: Add ubuntu.i386 image
  tests: Add FreeBSD image
  tests: Add NetBSD image
  tests: Add OpenBSD image
  Makefile: Add rules to run vm tests
  MAINTAINERS: Add tests/vm entry
  tests: Add README for vm tests
  docker: Use archive-source.py
  docker: Fix return code of build_qemu()
  docker: Add test_fail and prep_fail
  docker: Use unconfined security profile
  docker: Add nettle-devel to fedora image
  docker: Add test-block
  docker: Drop 'set -e' from run script
  vl: Don't include vde header
  buildsys: Move vde libs to per object
  buildsys: Move gtk/vte cflags/libs to per object
  buildsys: Move sdl cflags/libs to per object
  buildsys: Move vnc cflags/libs to per object
  buildsys: Move audio libs to per object
  buildsys: Move curese cflags/libs to per object
  buildsys: Move libcacard cflags/libs to per object
  buildsys: Move libusb cflags/libs to per object
  buildsys: Move usb redir cflags/libs to per object
  buildsys: Move brlapi libs to per object
  buildsys: Move rdma libs to per object

 .gitignore |   1 +
 MAINTAINERS|   1 +
 Makefile   |   2 +
 audio/Makefile.objs|   6 +
 chardev/Makefile.objs  |   1 +
 configure  |  61 
 hw/usb/Makefile.objs   |  13 +-
 migration/Makefile.objs|   1 +
 net/Makefile.objs  |   2 +
 scripts/archive-source.sh  |  31 
 scripts/qemu.py|   7 +
 tests/.gitignore   |   1 +
 tests/docker/Makefile.include  |  17 +-
 tests/docker/common.rc |  20 ++-
 tests/docker/docker.py |   3 +-
 tests/docker/dockerfiles/fedora.docker |   1 +
 tests/docker/dockerfiles/travis.docker |   6 +-
 tests/docker/dockerfiles/ubuntu.docker |  11 +-
 tests/docker/run   |  18 +--
 tests/docker/test-block|  21 +++
 tests/docker/test-full |  82 +-
 tests/vm/Makefile.include  |  42 +
 tests/vm/README|  63 
 tests/vm/basevm.py | 276 +
 tests/vm/freebsd   |  42 +
 tests/vm/netbsd|  42 +
 tests/vm/openbsd   |  43 +
 tests/vm/ubuntu.i386   |  88 +++
 ui/Makefile.objs   |  29 ++--
 vl.c   |   4 -
 30 files changed, 850 insertions(+), 85 deletions(-)
 create mode 100755 scripts/archive-source.sh
 create mode 100755 tests/docker/test-block
 create mode 100644 tests/vm/Makefile.include
 create mode 100644 tests/vm/README
 create mode 100755 tests/vm/basevm.py
 create mode 100755 tests/vm/freebsd
 create mode 100755 tests/vm/netbsd
 create mode 100755 tests/vm/openbsd
 create mode 100755 tests/vm/ubuntu.i386

-- 
2.13.5




[Qemu-devel] [PULL v2 03/37] docker: don't install device-tree-compiler build-deps in travis.docker

2017-09-08 Thread Fam Zheng
From: Alex Bennée 

Installing the device-tree-compiler build-deps is a little extreme. We
only actually need the binary so include it with the other packages.

Suggested-by: Philippe Mathieu-Daudé 
Signed-off-by: Alex Bennée 
Message-Id: <20170725133425.436-6-alex.ben...@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé 
Tested-by: Philippe Mathieu-Daudé 
Signed-off-by: Fam Zheng 
---
 tests/docker/dockerfiles/travis.docker | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tests/docker/dockerfiles/travis.docker 
b/tests/docker/dockerfiles/travis.docker
index 636fa590a5..57ac8e1419 100644
--- a/tests/docker/dockerfiles/travis.docker
+++ b/tests/docker/dockerfiles/travis.docker
@@ -1,6 +1,5 @@
 FROM quay.io/travisci/travis-ruby
 RUN apt-get update
 RUN apt-get -y build-dep qemu
-RUN apt-get -y build-dep device-tree-compiler
-RUN apt-get -y install python2.7 python-yaml dh-autoreconf gdb strace lsof 
net-tools
+RUN apt-get -y install device-tree-compiler python2.7 python-yaml 
dh-autoreconf gdb strace lsof net-tools
 ENV FEATURES pyyaml
-- 
2.13.5




[Qemu-devel] [PULL v2 02/37] docker: docker.py make --no-cache skip checksum test

2017-09-08 Thread Fam Zheng
From: Alex Bennée 

If you invoke with NOCACHE=1 we pass --no-cache in the argv to
docker.py but may still not force a rebuild if the dockerfile checksum
hasn't changed. By testing for its presence we can force builds
without having to manually remove the docker image.

Signed-off-by: Alex Bennée 
Message-Id: <20170725133425.436-5-alex.ben...@linaro.org>
Signed-off-by: Fam Zheng 
---
 tests/docker/docker.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/docker/docker.py b/tests/docker/docker.py
index 81c87ee329..08122ca17d 100755
--- a/tests/docker/docker.py
+++ b/tests/docker/docker.py
@@ -263,7 +263,8 @@ class BuildCommand(SubCommand):
 tag = args.tag
 
 dkr = Docker()
-if dkr.image_matches_dockerfile(tag, dockerfile):
+if "--no-cache" not in argv and \
+   dkr.image_matches_dockerfile(tag, dockerfile):
 if not args.quiet:
 print "Image is up to date."
 else:
-- 
2.13.5




Re: [Qemu-devel] [PATCH v6 04/12] tests: Add vm test lib

2017-09-08 Thread Fam Zheng
On Fri, 09/08 22:25, Philippe Mathieu-Daudé wrote:
> Hi Fam, Alex,
> 
> > > 
> > > If this fails it's fairly cryptic:
> > > 
> > > /home/alex/lsrc/qemu/qemu.git/tests/vm/openbsd  --debug   --image 
> > > "tests/vm/openbsd.img" --build-qemu /home/alex/lsrc/qemu/qemu.git
> > > DEBUG:root:Creating archive ./vm-test-fxejnB.tmp/data-2de24.tar for 
> > > src_dir dir: /home/alex/lsrc/qemu/qemu.git
> > > DEBUG:root:QEMU args: -nodefaults -m 2G -cpu host -netdev 
> > > user,id=vnet,hostfwd=:0.0.0.0:0-:22 -device virtio-net-pci,netdev=vnet 
> > > -vnc :0,to=20 -serial file:./vm-test-fxejnB.tmp/serial.out -smp 4 
> > > -enable-kvm -device VGA -drive 
> > > file=tests/vm/openbsd.img,snapshot=on,if=none,id=drive0,cache=writeback 
> > > -device virtio-blk,drive=drive0,bootindex=0 -drive 
> > > file=./vm-test-fxejnB.tmp/data-2de24.tar,if=none,id=data-2de24,cache=writeback,format=raw
> > >  -device virtio-blk,drive=data-2de24,serial=data-2de24,bootindex=1
> > > Failed to prepare guest environment
> > > Traceback (most recent call last):
> > >File "/home/alex/lsrc/qemu/qemu.git/tests/vm/basevm.py", line 260, in 
> > > main
> > >  vm.boot(args.image + ",snapshot=on")
> > >File "/home/alex/lsrc/qemu/qemu.git/tests/vm/basevm.py", line 184, in 
> > > boot
> > >  guest.launch()
> > >File "/home/alex/lsrc/qemu/qemu.git/tests/vm/../../scripts/qemu.py", 
> > > line 151, in launch
> > >  self._post_launch()
> > >File "/home/alex/lsrc/qemu/qemu.git/tests/vm/../../scripts/qemu.py", 
> > > line 135, in _post_launch
> > >  self._qmp.accept()
> > >File 
> > > "/home/alex/lsrc/qemu/qemu.git/tests/vm/../../scripts/qmp/qmp.py", line 
> > > 147, in accept
> > >  return self.__negotiate_capabilities()
> > >File 
> > > "/home/alex/lsrc/qemu/qemu.git/tests/vm/../../scripts/qmp/qmp.py", line 
> > > 60, in __negotiate_capabilities
> > >  raise QMPConnectError
> > > QMPConnectError
> > > 
> > > I assume QEMU failed to boot and might have given us a message that
> > > would be useful.
> > 
> > It's a separate issue of qemu.py, I didn't try to fix it here because 
> > currently
> > there are many patches touching that file on the list, there is a high 
> > chance of
> > conflict.
> > 
> > In your case which qemu version are you using? If not master it probably is
> > failing because of the hostfwd syntax.
> 
> very likely.
> 
> one simple way to handle this could be having this script catching
> QMPConnectError and restart with older command line format,

The error reporting definitely needs improving (like saying which version of
QEMU is needed), but I'm not sure about adding fallbacks here and there are
worth the effort, see below.

> 
> but I prefer starting QEMU binding a QMP socket, then initialize the options
> via QMP packets, this should be more portable, this is cleaner.

This is just different, but not necessarily cleaner. When you want to manually
start such a VM, it will be very painful. Nor does "ps | grep | less" etc works.
Command line is simpler and more user friendly in this respect.

> 
> also I think we don't want to run those images with bleeding edge
> qemu-system, we want a stable QEMU to be able to compile the bleeding edge
> codebase inside a working VM.

You are right we are not testing that bleeding edge qemus can run the VM, but we
need the features of the bleeding edge qemu to write simpler test code. I think
this is reasonable for both CI and developers.  So unless there is an
alternative way to do the hostfwd port allocation, I think we can live with this
requirement.

> 
> another note: currently when a VM fails, it closes and what I've left is
> only the last stderr.
> I'd rather see 2 modes:
> - run from some CI when only the final return value is useful, the stderr
> being extra value.
> - in user-dev mode if the build fails I'd like to have access to the
> terminal, eventually some msg like "this build failed, you can connect to
> this VM copy/pasting the following ssh command: ... or hit ^C to gracefully
> shutdown the VM"
> But in this mode I'd rather mount my current workdir via a read-writable
> netshare rather than a one-time temporary read-only tarball, so I could
> modify my repo and just run 'make' inside the VM.

Like the docker tests, this is what DEBUG=1 is for.

Fam



Re: [Qemu-devel] [PATCH v6 04/12] tests: Add vm test lib

2017-09-08 Thread Philippe Mathieu-Daudé

Hi Fam, Alex,



If this fails it's fairly cryptic:

/home/alex/lsrc/qemu/qemu.git/tests/vm/openbsd  --debug   --image 
"tests/vm/openbsd.img" --build-qemu /home/alex/lsrc/qemu/qemu.git
DEBUG:root:Creating archive ./vm-test-fxejnB.tmp/data-2de24.tar for src_dir 
dir: /home/alex/lsrc/qemu/qemu.git
DEBUG:root:QEMU args: -nodefaults -m 2G -cpu host -netdev 
user,id=vnet,hostfwd=:0.0.0.0:0-:22 -device virtio-net-pci,netdev=vnet -vnc 
:0,to=20 -serial file:./vm-test-fxejnB.tmp/serial.out -smp 4 -enable-kvm 
-device VGA -drive 
file=tests/vm/openbsd.img,snapshot=on,if=none,id=drive0,cache=writeback -device 
virtio-blk,drive=drive0,bootindex=0 -drive 
file=./vm-test-fxejnB.tmp/data-2de24.tar,if=none,id=data-2de24,cache=writeback,format=raw
 -device virtio-blk,drive=data-2de24,serial=data-2de24,bootindex=1
Failed to prepare guest environment
Traceback (most recent call last):
   File "/home/alex/lsrc/qemu/qemu.git/tests/vm/basevm.py", line 260, in main
 vm.boot(args.image + ",snapshot=on")
   File "/home/alex/lsrc/qemu/qemu.git/tests/vm/basevm.py", line 184, in boot
 guest.launch()
   File "/home/alex/lsrc/qemu/qemu.git/tests/vm/../../scripts/qemu.py", line 
151, in launch
 self._post_launch()
   File "/home/alex/lsrc/qemu/qemu.git/tests/vm/../../scripts/qemu.py", line 
135, in _post_launch
 self._qmp.accept()
   File "/home/alex/lsrc/qemu/qemu.git/tests/vm/../../scripts/qmp/qmp.py", line 
147, in accept
 return self.__negotiate_capabilities()
   File "/home/alex/lsrc/qemu/qemu.git/tests/vm/../../scripts/qmp/qmp.py", line 
60, in __negotiate_capabilities
 raise QMPConnectError
QMPConnectError

I assume QEMU failed to boot and might have given us a message that
would be useful.


It's a separate issue of qemu.py, I didn't try to fix it here because currently
there are many patches touching that file on the list, there is a high chance of
conflict.

In your case which qemu version are you using? If not master it probably is
failing because of the hostfwd syntax.


very likely.

one simple way to handle this could be having this script catching 
QMPConnectError and restart with older command line format,


but I prefer starting QEMU binding a QMP socket, then initialize the 
options via QMP packets, this should be more portable, this is cleaner.


also I think we don't want to run those images with bleeding edge 
qemu-system, we want a stable QEMU to be able to compile the bleeding 
edge codebase inside a working VM.


another note: currently when a VM fails, it closes and what I've left is 
only the last stderr.

I'd rather see 2 modes:
- run from some CI when only the final return value is useful, the 
stderr being extra value.
- in user-dev mode if the build fails I'd like to have access to the 
terminal, eventually some msg like "this build failed, you can connect 
to this VM copy/pasting the following ssh command: ... or hit ^C to 
gracefully shutdown the VM"
But in this mode I'd rather mount my current workdir via a read-writable 
netshare rather than a one-time temporary read-only tarball, so I could 
modify my repo and just run 'make' inside the VM.


Regards,

Phil.



Re: [Qemu-devel] [PATCH] .dir-locals.el: Explicitly set indentation level

2017-09-08 Thread Thiago Jung Bauermann

Markus Armbruster  writes:

> Thiago Jung Bauermann  writes:
>
>> At least in some configurations, setting c-file-style is not enough to
>> conform to the QEMU coding style, so explicitly set c-basic-offset as well.
>>
>> Signed-off-by: Thiago Jung Bauermann 
>> ---
>>
>> My emacs was using indentation level of 8 spaces and this patch convinced
>> it to use the correct value.
>>
>> I set c-basic-offset set to tab-width in my ~/.spacemacs which perhaps
>> isn't the wisest thing to do, but since there's a .dir-locals.el we can
>> make the editor always do the right thing.
>
> I think some of this rationale should be worked into the commit message
> if we decide the patch makes sense.

Ok, I will send a v2 with the rationale in the commit message if it's
determined that the patch itself is ok.

>>  .dir-locals.el | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/.dir-locals.el b/.dir-locals.el
>> index 3ac0cfc6f0d6..8e47418c5996 100644
>> --- a/.dir-locals.el
>> +++ b/.dir-locals.el
>> @@ -1,2 +1,3 @@
>>  ((c-mode . ((c-file-style . "stroustrup")
>> -(indent-tabs-mode . nil
>> +(indent-tabs-mode . nil)
>> +(c-basic-offset . 4
>
> Style "stroustrup" already specified c-basic-offset 4.  If we need to
> specify this setting a second time, why don't we need to specify the
> style's other settings a second time, too?

I added (defvaralias 'c-basic-offset 'tab-width) to my configuration
file following a suggestion from the "Indentation Basics" page of
EmacsWiki¹, which is the first hit if you search for "emacs indentation
width".

Because of that, I assume a lot of people will have that option in their
configuration file. If there are other settings that are common and also
interfere with the stroustrup style I think it makes sense to include
them in .dir-locals.el as well.

-- 
Thiago Jung Bauermann
IBM Linux Technology Center


¹ https://www.emacswiki.org/emacs/IndentationBasics




Re: [Qemu-devel] [PULL 00/38] Test and build system patches

2017-09-08 Thread Fam Zheng
On Fri, 09/08 14:44, Peter Maydell wrote:
> On 8 September 2017 at 10:54, Fam Zheng  wrote:
> > Hi Peter,
> >
> > The following changes since commit cda4a338c4243fa3bff4498b935340ac7121cc76:
> >
> >   tcg/tci: Add TCG_TARGET_DEFAULT_MO (2017-09-07 18:57:34 +0100)
> >
> > are available in the git repository at:
> >
> >   git://github.com/famz/qemu.git tags/staging-pull-request
> >
> > for you to fetch changes up to d0fba2165aa69ee5cb6a368ad611f3d54950fe4e:
> >
> >   buildsys: Move rdma libs to per object (2017-09-08 17:47:11 +0800)
> >
> > 
> >
> > This includes:
> >
> > - Alex's improvements of docker tests
> > - VM test
> > - test-block for docker tests
> > - test-full improvements
> > - cflags / libs cleanup
> >
> > 
> 
> Hi. This failed to build on OpenBSD:
>   CC  qmp.o
> In file included from /home/qemu/ui/vnc.h:33:0,
>  from /home/qemu/qmp.c:26:
> /home/qemu/include/ui/console.h:13:23: fatal error: epoxy/gl.h: No
> such file or directory
>  # include 
>^
> 
> Looks like the opengl_cflags are not being applied everywhere
> they should be. (OpenBSD is a bit odd in that it doesn't put
> epoxy/ in /usr/include, so you must get the -I options right
> for the gl.h header to be found.)

Yeah, fixing that is not trivial, I'll drop that patch and rework it. With that,
OpenBSD compiles fine for me (my fault a selftest wasn't done with this series).

Fam



Re: [Qemu-devel] [PATCH v6 04/12] tests: Add vm test lib

2017-09-08 Thread Fam Zheng
On Fri, 09/08 16:22, Alex Bennée wrote:
> 
> Fam Zheng  writes:
> 
> > This is the common code to implement a "VM test" to
> >
> >   1) Download and initialize a pre-defined VM that has necessary
> >   dependencies to build QEMU and SSH access.
> >
> >   2) Archive $SRC_PATH to a .tar file.
> >
> >   3) Boot the VM, and pass the source tar file to the guest.
> >
> >   4) SSH into the VM, untar the source tarball, build from the source.
> >
> > Signed-off-by: Fam Zheng 
> > ---
> >  tests/vm/basevm.py | 276 
> > +
> >  1 file changed, 276 insertions(+)
> >  create mode 100755 tests/vm/basevm.py
> >
> > diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
> > new file mode 100755
> > index 00..9db91d61fa
> > --- /dev/null
> > +++ b/tests/vm/basevm.py
> > @@ -0,0 +1,276 @@
> > +#!/usr/bin/env python
> > +#
> > +# VM testing base class
> > +#
> > +# Copyright (C) 2017 Red Hat Inc.
> > +#
> > +# Authors:
> > +#  Fam Zheng 
> > +#
> > +# This work is licensed under the terms of the GNU GPL, version 2.  See
> > +# the COPYING file in the top-level directory.
> > +#
> > +
> > +import os
> > +import sys
> > +import logging
> > +import time
> > +import datetime
> > +sys.path.append(os.path.join(os.path.dirname(__file__), "..", "..", 
> > "scripts"))
> > +from qemu import QEMUMachine
> > +import subprocess
> > +import hashlib
> > +import optparse
> > +import atexit
> > +import tempfile
> > +import shutil
> > +import multiprocessing
> > +import traceback
> > +
> > +SSH_KEY = """\
> > +-BEGIN RSA PRIVATE KEY-
> > +MIIEowIBAAKCAQEAopAuOlmLV6LVHdFBj8/eeOwI9CqguIJPp7eAQSZvOiB4Ag/R
> > +coEhl/RBbrV5Yc/SmSD4PTpJO/iM10RwliNjDb4a3I8q3sykRJu9c9PI/YsH8WN9
> > ++NH2NjKPtJIcKTu287IM5JYxyB6nDoOzILbTyJ1TDR/xH6qYEfBAyiblggdjcvhA
> > +RTf93QIn39F/xLypXvT1K2O9BJEsnJ8lEUvB2UXhKo/JTfSeZF8wPBeowaP9EONk
> > +7b+nuJOWHGg68Ji6wVi62tjwl2Szch6lxIhZBpnV7QNRKMfYHP6eIyF4pusazzZq
> > +Telsq6xI2ghecWLzb/MF5A+rklsGx2FNuJSAJwIDAQABAoIBAHHi4o/8VZNivz0x
> > +cWXn8erzKV6tUoWQvW85Lj/2RiwJvSlsnYZDkx5af1CpEE2HA/pFT8PNRqsd+MWC
> > +7AEy710cVsM4BYerBFYQaYxwzblaoojo88LSjVPw3h5Z0iLM8+IMVd36nwuc9dpE
> > +R8TecMZ1+U4Tl6BgqkK+9xToZRdPKdjS8L5MoFhGN+xY0vRbbJbGaV9Q0IHxLBkB
> > +rEBV7T1mUynneCHRUQlJQEwJmKpT8MH3IjsUXlG5YvnuuvcQJSNTaW2iDLxuOKp8
> > +cxW8+qL88zpb1D5dppoIu6rlrugN0azSq70ruFJQPc/A8GQrDKoGgRQiagxNY3u+
> > +vHZzXlECgYEA0dKO3gfkSxsDBb94sQwskMScqLhcKhztEa8kPxTx6Yqh+x8/scx3
> > +XhJyOt669P8U1v8a/2Al+s81oZzzfQSzO1Q7gEwSrgBcRMSIoRBUw9uYcy02ngb/
> > +j/ng3DGivfJztjjiSJwb46FHkJ2JR8mF2UisC6UMXk3NgFY/3vWQx78CgYEAxlcG
> > +T3hfSWSmTgKRczMJuHQOX9ULfTBIqwP5VqkkkiavzigGRirzb5lgnmuTSPTpF0LB
> > +XVPjR2M4q+7gzP0Dca3pocrvLEoxjwIKnCbYKnyyvnUoE9qHv4Kr+vDbgWpa2LXG
> > +JbLmE7tgTCIp20jOPPT4xuDvlbzQZBJ5qCQSoZkCgYEAgrotSSihlCnAOFSTXbu4
> > +CHp3IKe8xIBBNENq0eK61kcJpOxTQvOha3sSsJsU4JAM6+cFaxb8kseHIqonCj1j
> > +bhOM/uJmwQJ4el/4wGDsbxriYOBKpyq1D38gGhDS1IW6kk3erl6VAb36WJ/OaGum
> > +eTpN9vNeQWM4Jj2WjdNx4QECgYAwTdd6mU1TmZCrJRL5ZG+0nYc2rbMrnQvFoqUi
> > +BvWiJovggHzur90zy73tNzPaq9Ls2FQxf5G1vCN8NCRJqEEjeYCR59OSDMu/EXc2
> > +CnvQ9SevHOdS1oEDEjcCWZCMFzPi3XpRih1gptzQDe31uuiHjf3cqcGPzTlPdfRt
> > +D8P92QKBgC4UaBvIRwREVJsdZzpIzm224Bpe8LOmA7DeTnjlT0b3lkGiBJ36/Q0p
> > +VhYh/6cjX4/iuIs7gJbGon7B+YPB8scmOi3fj0+nkJAONue1mMfBNkba6qQTc6Y2
> > +5mEKw2/O7/JpND7ucU3OK9plcw/qnrWDgHxl0Iz95+OzUIIagxne
> > +-END RSA PRIVATE KEY-
> > +"""
> > +SSH_PUB_KEY = """\
> > +ssh-rsa 
> > B3NzaC1yc2EDAQABAAABAQCikC46WYtXotUd0UGPz9547Aj0KqC4gk+nt4BBJm86IHgCD9FygSGX9EFutXlhz9KZIPg9Okk7+IzXRHCWI2MNvhrcjyrezKREm71z08j9iwfxY3340fY2Mo+0khwpO7bzsgzkljHIHqcOg7MgttPInVMNH/EfqpgR8EDKJuWCB2Ny+EBFN/3dAiff0X/EvKle9PUrY70EkSycnyURS8HZReEqj8lN9J5kXzA8F6jBo/0Q42Ttv6e4k5YcaDrwmLrBWLra2PCXZLNyHqXEiFkGmdXtA1Eox9gc/p4jIXim6xrPNmpN6WyrrEjaCF5xYvNv8wXkD6uSWwbHYU24lIAn
> >  qemu-vm-key
> > +"""
> 
> I'm not sure we should be embedding the keys in the script. I understand
> we need a common key for downloaded images (although it would be better
> to post-customise the image after download with the local developer
> keys). Perhaps ./tests/testing-keys/id_rsa[.pub]?

We cannot generate keys or start from local keys because it's hard to inject it
into the *BSD images without ssh access (chicken-and-egg problem). Adding the
local keys might be a good feature, indeed.

> 
> > +
> > +class BaseVM(object):
> > +GUEST_USER = "qemu"
> > +GUEST_PASS = "qemupass"
> > +ROOT_PASS = "qemupass"
> > +
> > +# The script to run in the guest that builds QEMU
> > +BUILD_SCRIPT = ""
> > +# The guest name, to be overridden by subclasses
> > +name = "#base"
> > +def __init__(self, debug=False, vcpus=None):
> > +self._guest = None
> > +self._tmpdir = tempfile.mkdtemp(prefix="vm-test-", suffix=".tmp", 
> > dir=".")
> > +atexit.register(shutil.rmtree, self._tmpdir)
> > +
> > +self._ssh_key_file = os.path.join(self._tmpdir, "id_rsa")
> > +open(self._ssh_key_file, "w").write(SSH_KEY)
> > +subprocess.check_ca

Re: [Qemu-devel] [PATCH v6 03/12] scripts: Add archive-source.sh

2017-09-08 Thread Fam Zheng
On Fri, 09/08 15:42, Alex Bennée wrote:
> 
> Fam Zheng  writes:
> 
> > Signed-off-by: Fam Zheng 
> > ---
> >  scripts/archive-source.sh | 31 +++
> >  1 file changed, 31 insertions(+)
> >  create mode 100755 scripts/archive-source.sh
> >
> > diff --git a/scripts/archive-source.sh b/scripts/archive-source.sh
> > new file mode 100755
> > index 00..3cae7f34d3
> > --- /dev/null
> > +++ b/scripts/archive-source.sh
> > @@ -0,0 +1,31 @@
> > +#!/bin/sh
> > +#
> > +# Author: Fam Zheng 
> > +#
> > +# Create archive of source tree, including submodules
> > +#
> > +# This work is licensed under the terms of the GNU GPL, version 2.
> > +# See the COPYING file in the top-level directory.
> > +
> > +set -e
> > +
> > +if test $# -lt 1; then
> > +echo "Usage: $0 "
> 
> Maybe  to make it clear what it creates?

OK.

> 
> > +exit 1
> > +fi
> > +
> > +submodules=$(git submodule foreach --recursive --quiet 'echo $name')
> > +
> > +if test -n "$submodules"; then
> > +{
> > +git ls-files
> 
> Couldn't we do the main git ls-files first and then append the data for
> any submodules?

Isn't that exactly what we are doing now?

Fam

> 
> > +for sm in $submodules; do
> > +(cd $sm; git ls-files) | sed "s:^:$sm/:"
> > +done
> > +} | grep -x -v $(for sm in $submodules; do echo "-e $sm"; done) > 
> > $1.list
> > +else
> > +git ls-files > $1.list
> > +fi
> > +
> > +tar -cf $1 -T $1.list
> > +rm $1.list
> 
> 
> --
> Alex Bennée



Re: [Qemu-devel] [PATCH v6 03/12] scripts: Add archive-source.sh

2017-09-08 Thread Fam Zheng
On Fri, 09/08 15:56, Peter Maydell wrote:
> On 5 September 2017 at 03:11, Fam Zheng  wrote:
> > Signed-off-by: Fam Zheng 
> > ---
> >  scripts/archive-source.sh | 31 +++
> >  1 file changed, 31 insertions(+)
> >  create mode 100755 scripts/archive-source.sh
> >
> > diff --git a/scripts/archive-source.sh b/scripts/archive-source.sh
> > new file mode 100755
> > index 00..3cae7f34d3
> > --- /dev/null
> > +++ b/scripts/archive-source.sh
> > @@ -0,0 +1,31 @@
> > +#!/bin/sh
> > +#
> > +# Author: Fam Zheng 
> > +#
> > +# Create archive of source tree, including submodules
> > +#
> > +# This work is licensed under the terms of the GNU GPL, version 2.
> > +# See the COPYING file in the top-level directory.
> 
> Why GPL-2-only? We generally prefer GPL-2-or-later for new
> files, or something more permissive.

Copied from some other script/* files, apparently. :)

Will make it GPL-2-or-later.

Fam



Re: [Qemu-devel] [PATCH v6 01/12] gitignore: Ignore vm test images

2017-09-08 Thread Fam Zheng
On Fri, 09/08 15:12, Alex Bennée wrote:
> 
> Fam Zheng  writes:
> 
> > Signed-off-by: Fam Zheng 
> > ---
> >  .gitignore   | 1 +
> >  tests/.gitignore | 1 +
> >  2 files changed, 2 insertions(+)
> >
> > diff --git a/.gitignore b/.gitignore
> > index cf65316863..40acfcb9e2 100644
> > --- a/.gitignore
> > +++ b/.gitignore
> > @@ -52,6 +52,7 @@
> >  /vscclient
> >  /vhost-user-scsi
> >  /fsdev/virtfs-proxy-helper
> > +*.tmp
> 
> I'm not sure we should be dumping anything in the rootdir, .gitignored
> or not.

It used to be /tests/vm/*.tmp but Philippe asked for a generic rule in previous
reviewing. I think it makes sense, we can also unify the docker-src.* pattern by
making the directory names to have a .tmp suffix later.

Fam



Re: [Qemu-devel] [PATCH v2 00/13] add support for Hypervisor.framework in QEMU

2017-09-08 Thread Sergio Andrés Gómez del Real
Guys, I'm almost done with the new version of the patchset (hopefully the
definite one).
What I am missing essentially are presenting a few tests as suggested by
Stefan. Paolo and I only ran the eventinj test from the kvm suite. If I
modify this boot-serial-test to include hvf, should I send these changes
first before the patchset so it could be reproduced? would these be
sufficient, or should I consider some further tests?

On Thu, Aug 31, 2017 at 4:34 AM, Stefan Hajnoczi  wrote:

> On Wed, Aug 30, 2017 at 03:26:49AM -0500, Sergio Andres Gomez Del Real
> wrote:
> > 
> > Changes in v2:
> >  (1) Removed legacy option "-enable-hvf" in favor of "-M accel=hvf"
> >  (2) Added missing copyright headers; replace fprintfs for error_report;
> >  improved commit description.
> >  (3) Moved patch that adds compilation rules in Makefile.objs right after
> >  the patch that adds the new files from Google's repo.
> >  (4) Removed conditional macros from cpus.c and cpu.c
> >  (5) Moved patch that fixes coding style to patch # 3
> >  (6) Fix commit message in apic patch
> >  (7) Squash some commits to avoid code churn
> > 
> >
> > The following patchset adds to QEMU the supporting for macOS's native
> > hypervisor, Hypervisor.framework (hvf). The code base is taken from
> > Google's Android emulator at
> > https://android.googlesource.com/platform/external/qemu/+/emu-master-dev
> .
> >
> > Apart from general code refactoring, some additional features were
> implemented:
> > retrieve the set of features supported by host cpu and hvf (cpuid);
> > dirty page tracking for VGA memory area; reimplementation of the event
> > injection mechanism to allow injection of exceptions during vmexits,
> which is
> > exemplified by the injection of a GP fault when the guest vmexits due to
> > execution of the vmcall instruction; changing the emulator's use of
> CPUState
> > structure in favor of CPUX86State, so as to in the future remove data
> structures
> > that are uselessly specific to hvf and unified some of the state between
> kvm/tcg
> > and hvf.
> > Some features initially planned to implement that didn't make it include:
> > page fault handling in the emulator and implementing the dummy_signal to
> handle
> > the SIG_IPI signal without race conditions. Hopefully these can be
> implemented
> > in the near future.
>
> I have done a brief review (mainly style issues) of the whole series.
>
> A test case is required.  Maybe the easiest option is to extend
> tests/boot-serial-test.c to try hvf (if available).  That way an
> automated test will verify that the BIOS executes inside the guest.
>
> Stefan
>


[Qemu-devel] irqfd for QEMU NVMe

2017-09-08 Thread Huaicheng Li
Hi all,

I'm writing to ask if it's possible to use irqfd mechanism in QEMU's NVMe
virtual controller implementation. My search results show that back in
2015, there is a discussion on improving QEMU NVMe performance by utilizing
eventfd for guest-to-host notification, thus i guess irqfd should also work
? If so, could you briefly describe how to do that and how much can we save
for the host-to-guest notification path by using irqfd?

Thanks for your time.

Best,
Huaicheng


[Qemu-devel] [Bug 1516446] Re: Migration always causes guest freeze in one direction.

2017-09-08 Thread Dr. David Alan Gilbert
Hi Magnus,
  I think there's a fair possibility you're hitting a kernel bug that we found 
in
https://bugzilla.redhat.com/show_bug.cgi?id=1401767
which was also a failure migrating from a newer AMD to an older AMD processor.

That was fixed by upstream kernel fix:
commit 00c87e9a70a17b355b81c36adedf05e84f54e10d
Author: Radim Krčmář 
Date:   Wed Feb 1 14:19:53 2017 +0100

KVM: x86: do not save guest-unsupported XSAVE state

Saving unsupported state prevents migration when the new host does not
support a XSAVE feature of the original host, even if the feature is not
exposed to the guest.

We've masked host features with guest-visible features before, with
4344ee981e21 ("KVM: x86: only copy XSAVE state for the supported
features") and dropped it when implementing XSAVES.  Do it again.

Fixes: df1daba7d1cb ("KVM: x86: support XSAVES usage in the host")
Cc: sta...@vger.kernel.org
Reviewed-by: Paolo Bonzini 
Signed-off-by: Radim Krčmář 

it went into kernel 4.10 - so it's worth trying it on a modern kernel
and seeing what happens.

Dave

** Bug watch added: Red Hat Bugzilla #1401767
   https://bugzilla.redhat.com/show_bug.cgi?id=1401767

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1516446

Title:
  Migration always causes guest freeze in one direction.

Status in QEMU:
  New

Bug description:
  Hello,

  I have three debian jessie machines standard installations except for
  homebuild qemu-2.4.0 package using the source package from testing. I
  had the same problem with the standard debian jessie qemu 2.1 too.

  I have host A, B and C.

  Migrations work between all combinations of these except A -> B. B ->
  A works.

  I use libvirt but as per your written request I have run qemu directly
  and verified the same problem.

  Host A:
  qemu-system-x86_64 --enable-kvm -name ashole -cpu kvm64 -m 1024 -drive 
file=/mnt/synctest/ashole.raw,if=none,id=drive-virtio-disk0,format=raw,cache=none
 -vnc 0.0.0.0:600 -k sv -vga std -device 
virtio-blk-pci,scsi=off,bus=pci.0,addr=0x9,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1

  Host B:
  qemu-system-x86_64 --enable-kvm -name ashole -cpu kvm64 -m 1024 -drive 
file=/mnt/synctest/ashole.raw,if=none,id=drive-virtio-disk0,format=raw,cache=none
 -vnc 0.0.0.0:600 -k sv -vga std -device 
virtio-blk-pci,scsi=off,bus=pci.0,addr=0x9,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1
 -incoming tcp:0:

  Then in qemu monitor I run migrate -d tcp:B: and the guest freeze.

  I have tried with these guest os:es, freebsd 9.1, debian wheezy and
  debian jessie (Standard 3.16 kernel and backported 4.2 kernel), same
  problem with all of them. when running the migration through libvirt
  virt-manager says the guest is using 100% cpu.

  I had a similar problem
  (https://bugzilla.kernel.org/show_bug.cgi?id=61971) 2 years ago which
  was solved in kernel 3.13 if I remember correctly.

  Best Regards
  Magnus

  CPU info:
  Host A
  processor : 0
  vendor_id : AuthenticAMD
  cpu family: 21
  model : 2
  model name: AMD FX(tm)-8320 Eight-Core Processor
  stepping  : 0
  microcode : 0x600081f
  cpu MHz   : 1400.000
  cache size: 2048 KB
  physical id   : 0
  siblings  : 8
  core id   : 0
  cpu cores : 4
  apicid: 16
  initial apicid: 0
  fpu   : yes
  fpu_exception : yes
  cpuid level   : 13
  wp: yes
  flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov 
pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb 
rdtscp lm constant_tsc rep_good nopl nonstop_tsc extd_apicid aperfmperf pni 
pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 popcnt aes xsave avx f16c 
lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch 
osvw ibs xop skinit wdt lwp fma4 tce nodeid_msr tbm topoext perfctr_core 
perfctr_nb arat cpb hw_pstate npt lbrv svm_lock nrip_save tsc_scale vmcb_clean 
flushbyasid decodeassists pausefilter pfthreshold vmmcall bmi1
  bugs  : fxsave_leak sysret_ss_attrs
  bogomips  : 7023.54
  TLB size  : 1536 4K pages
  clflush size  : 64
  cache_alignment   : 64
  address sizes : 48 bits physical, 48 bits virtual
  power management: ts ttp tm 100mhzsteps hwpstate cpb eff_freq_ro

  processor : 1
  vendor_id : AuthenticAMD
  cpu family: 21
  model : 2
  model name: AMD FX(tm)-8320 Eight-Core Processor
  stepping  : 0
  microcode : 0x600081f
  cpu MHz   : 1400.000
  cache size: 2048 KB
  physical id   : 0
  siblings  : 8
  core id   : 1
  cpu cores : 4
  apicid: 17
  initial apicid: 1
  fpu   : yes
  fpu_exception : yes
  cpuid level   : 13
  wp: yes
  flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge

Re: [Qemu-devel] [PATCH] slirp: Add explanation for hostfwd parsing failure

2017-09-08 Thread Philippe Mathieu-Daudé

On 09/08/2017 03:36 PM, Dr. David Alan Gilbert wrote:

* Philippe Mathieu-Daudé (f4...@amsat.org) wrote:

On 09/08/2017 01:22 PM, Dr. David Alan Gilbert wrote:

* Philippe Mathieu-Daudé (f4...@amsat.org) wrote:

Hi David,

On 09/08/2017 12:53 PM, Dr. David Alan Gilbert (git) wrote:

From: "Dr. David Alan Gilbert" 

e.g.
./x86_64-softmmu/qemu-system-x86_64 -nographic -netdev 
'user,id=vnet,hostfwd=:555.0.0.0:0-:22'
qemu-system-x86_64: -netdev user,id=vnet,hostfwd=:555.0.0.0:0-:22: Invalid host 
forwarding rule ':555.0.0.0:0-:22' (Bad host address)

Signed-off-by: Dr. David Alan Gilbert 
---
net/slirp.c | 13 -
1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/net/slirp.c b/net/slirp.c
index 01ed21c006..d87664d42e 100644
--- a/net/slirp.c
+++ b/net/slirp.c
@@ -496,9 +496,11 @@ static int slirp_hostfwd(SlirpState *s, const char 
*redir_str,
char buf[256];
int is_udp;
char *end;
+const char *fail_reason = "";


Isn't it better not initialize this? So if one add a new failed syntax case
the build with abort with -Werror=uninitialized


I never quite trust compilers to spot it or not-moan even though
every route to failure will have set it.


I see, what about:

const char *fail_reason = "Unknown reason";


I could, but you're right that I shouldn't miss any, and
'Unknown Reason' doesn't tell the user any more than no message.


It's not you I'm worried about ;) but if someone adds a new forward 
layer tomorrow (sctp, udplite, rudp...)




Re: [Qemu-devel] [PATCH] slirp: Add explanation for hostfwd parsing failure

2017-09-08 Thread Dr. David Alan Gilbert
* Philippe Mathieu-Daudé (f4...@amsat.org) wrote:
> On 09/08/2017 01:22 PM, Dr. David Alan Gilbert wrote:
> > * Philippe Mathieu-Daudé (f4...@amsat.org) wrote:
> > > Hi David,
> > > 
> > > On 09/08/2017 12:53 PM, Dr. David Alan Gilbert (git) wrote:
> > > > From: "Dr. David Alan Gilbert" 
> > > > 
> > > > e.g.
> > > > ./x86_64-softmmu/qemu-system-x86_64 -nographic -netdev 
> > > > 'user,id=vnet,hostfwd=:555.0.0.0:0-:22'
> > > > qemu-system-x86_64: -netdev user,id=vnet,hostfwd=:555.0.0.0:0-:22: 
> > > > Invalid host forwarding rule ':555.0.0.0:0-:22' (Bad host address)
> > > > 
> > > > Signed-off-by: Dr. David Alan Gilbert 
> > > > ---
> > > >net/slirp.c | 13 -
> > > >1 file changed, 12 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/net/slirp.c b/net/slirp.c
> > > > index 01ed21c006..d87664d42e 100644
> > > > --- a/net/slirp.c
> > > > +++ b/net/slirp.c
> > > > @@ -496,9 +496,11 @@ static int slirp_hostfwd(SlirpState *s, const char 
> > > > *redir_str,
> > > >char buf[256];
> > > >int is_udp;
> > > >char *end;
> > > > +const char *fail_reason = "";
> > > 
> > > Isn't it better not initialize this? So if one add a new failed syntax 
> > > case
> > > the build with abort with -Werror=uninitialized
> > 
> > I never quite trust compilers to spot it or not-moan even though
> > every route to failure will have set it.
> 
> I see, what about:
> 
> const char *fail_reason = "Unknown reason";

I could, but you're right that I shouldn't miss any, and
'Unknown Reason' doesn't tell the user any more than no message.

Dave

> > 
> > > Anyway:
> > > Reviewed-by: Philippe Mathieu-Daudé 
--
Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK



Re: [Qemu-devel] [PATCH v2] Add myself as maintainer for TPM code

2017-09-08 Thread Markus Armbruster
Stefan Berger  writes:

> Also add backends/tpm.c to the list of files.
>
> Signed-off-by: Stefan Berger 
> ---
>  MAINTAINERS | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index caf7e8a..c434a09 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1487,12 +1487,14 @@ F: docs/tracing.txt
>  T: git git://github.com/stefanha/qemu.git tracing
>  
>  TPM
> -S: Orphan
> +M: Stefan Berger 
> +S: Maintained
>  F: tpm.c
>  F: hw/tpm/*
>  F: include/hw/acpi/tpm.h
>  F: include/sysemu/tpm*
>  F: qapi/tpm.json
> +F: backends/tpm.c
>  
>  Checkpatch
>  S: Odd Fixes

Acked-by: Markus Armbruster 



Re: [Qemu-devel] [PATCH v2 0/6] Update websocket code to more fully support the RFC

2017-09-08 Thread Eric Blake
On 09/08/2017 01:11 PM, Brandon Carpenter wrote:
> My apologies. I read that document before submitting the patch, but
> there was a lot to take in. Would you like me to resend the patch
> without the references?

Not a problem - we all had to submit our first patch at some point in
time in the past :)

Re-sending at this point shouldn't be necessary unless a maintainer
specifically asks for it; it's more information for next time (if you
have to send a v3, for whatever reason).


> 
> CONFIDENTIALITY NOTICE: This e-mail message, including any attachments,
> is for the sole use of the intended recipient(s) and may contain
> proprietary, confidential or privileged information or otherwise be
> protected by law. Any unauthorized review, use, disclosure or
> distribution is prohibited. If you are not the intended recipient,
> please notify the sender and destroy all copies and the original message.

By the way, your employer's disclaimer is unenforceable on a
publicly-archived mailing list; still, it may be worth replying from a
person account to avoid the risk of someone refusing to reply to your
mail on principle.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.   +1-919-301-3266
Virtualization:  qemu.org | libvirt.org



signature.asc
Description: OpenPGP digital signature


Re: [Qemu-devel] [PATCH v2 0/6] Update websocket code to more fully support the RFC

2017-09-08 Thread Brandon Carpenter
My apologies. I read that document before submitting the patch, but 
there was a lot to take in. Would you like me to resend the patch 
without the references?

--
Brandon Carpenter | Software Engineer
Cypherpath, Inc.
400 Columbia Point Drive Ste 101 | Richland, Washington USA
Office: (650) 713-3060

On Fri, Sep 8, 2017 at 11:01 AM, Eric Blake  wrote:

On 09/08/2017 12:37 PM, Brandon Carpenter wrote:
 We've been experiencing issues where the qemu websocket server 
closes
 connections from noVNC clients for no apparent reason. Debugging 
shows
 that certain web browsers are injecting ping and pong frames when 
the

 connection becomes idle. Some browsers send those frames without a
 payload, which also is causing closure. This patch series addresses
 these issues by making the websocket server more conformant to RFC
 6455 - The WebSocket Protocol.


meta-comment: sending v2 in-reply-to v1 makes it harder for automated
tooling to recognize that you are sending new patches.  We prefer that
v2 be a top-level thread.  More patch submission hints at:
https://wiki.qemu.org/index.php/Contribute/SubmitAPatch

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.   +1-919-301-3266
Virtualization:  qemu.org | libvirt.org



--


CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is 
for the sole use of the intended recipient(s) and may contain proprietary, 
confidential or privileged information or otherwise be protected by law. 
Any unauthorized review, use, disclosure or distribution is prohibited. If 
you are not the intended recipient, please notify the sender and destroy 
all copies and the original message.


Re: [Qemu-devel] [PATCH] slirp: Add explanation for hostfwd parsing failure

2017-09-08 Thread Philippe Mathieu-Daudé

On 09/08/2017 01:22 PM, Dr. David Alan Gilbert wrote:

* Philippe Mathieu-Daudé (f4...@amsat.org) wrote:

Hi David,

On 09/08/2017 12:53 PM, Dr. David Alan Gilbert (git) wrote:

From: "Dr. David Alan Gilbert" 

e.g.
./x86_64-softmmu/qemu-system-x86_64 -nographic -netdev 
'user,id=vnet,hostfwd=:555.0.0.0:0-:22'
qemu-system-x86_64: -netdev user,id=vnet,hostfwd=:555.0.0.0:0-:22: Invalid host 
forwarding rule ':555.0.0.0:0-:22' (Bad host address)

Signed-off-by: Dr. David Alan Gilbert 
---
   net/slirp.c | 13 -
   1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/net/slirp.c b/net/slirp.c
index 01ed21c006..d87664d42e 100644
--- a/net/slirp.c
+++ b/net/slirp.c
@@ -496,9 +496,11 @@ static int slirp_hostfwd(SlirpState *s, const char 
*redir_str,
   char buf[256];
   int is_udp;
   char *end;
+const char *fail_reason = "";


Isn't it better not initialize this? So if one add a new failed syntax case
the build with abort with -Werror=uninitialized


I never quite trust compilers to spot it or not-moan even though
every route to failure will have set it.


I see, what about:

const char *fail_reason = "Unknown reason";




Anyway:
Reviewed-by: Philippe Mathieu-Daudé 




Re: [Qemu-devel] [PATCH] target/arm: Avoid an extra temporary for store_exclusive

2017-09-08 Thread Alistair Francis
On Fri, Sep 8, 2017 at 9:38 AM, Richard Henderson
 wrote:
> Instead of copying addr to a local temp, reuse the value (which we
> have just compared as equal) already saved in cpu_exclusive_addr.
>
> Signed-off-by: Richard Henderson 

Reviewed-by: Alistair Francis 

Thanks,
Alistair

> ---
>  target/arm/translate-a64.c | 26 +-
>  1 file changed, 9 insertions(+), 17 deletions(-)
>
> diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
> index 9017e30510..114e21cc58 100644
> --- a/target/arm/translate-a64.c
> +++ b/target/arm/translate-a64.c
> @@ -1894,7 +1894,7 @@ static void gen_load_exclusive(DisasContext *s, int rt, 
> int rt2,
>  }
>
>  static void gen_store_exclusive(DisasContext *s, int rd, int rt, int rt2,
> -TCGv_i64 inaddr, int size, int is_pair)
> +TCGv_i64 addr, int size, int is_pair)
>  {
>  /* if (env->exclusive_addr == addr && env->exclusive_val == [addr]
>   * && (!is_pair || env->exclusive_high == [addr + datasize])) {
> @@ -1910,13 +1910,8 @@ static void gen_store_exclusive(DisasContext *s, int 
> rd, int rt, int rt2,
>   */
>  TCGLabel *fail_label = gen_new_label();
>  TCGLabel *done_label = gen_new_label();
> -TCGv_i64 addr = tcg_temp_local_new_i64();
>  TCGv_i64 tmp;
>
> -/* Copy input into a local temp so it is not trashed when the
> - * basic block ends at the branch insn.
> - */
> -tcg_gen_mov_i64(addr, inaddr);
>  tcg_gen_brcond_i64(TCG_COND_NE, addr, cpu_exclusive_addr, fail_label);
>
>  tmp = tcg_temp_new_i64();
> @@ -1927,27 +1922,24 @@ static void gen_store_exclusive(DisasContext *s, int 
> rd, int rt, int rt2,
>  } else {
>  tcg_gen_concat32_i64(tmp, cpu_reg(s, rt2), cpu_reg(s, rt));
>  }
> -tcg_gen_atomic_cmpxchg_i64(tmp, addr, cpu_exclusive_val, tmp,
> +tcg_gen_atomic_cmpxchg_i64(tmp, cpu_exclusive_addr,
> +   cpu_exclusive_val, tmp,
> get_mem_index(s),
> MO_64 | MO_ALIGN | s->be_data);
>  tcg_gen_setcond_i64(TCG_COND_NE, tmp, tmp, cpu_exclusive_val);
>  } else if (s->be_data == MO_LE) {
> -gen_helper_paired_cmpxchg64_le(tmp, cpu_env, addr, cpu_reg(s, 
> rt),
> -   cpu_reg(s, rt2));
> +gen_helper_paired_cmpxchg64_le(tmp, cpu_env, cpu_exclusive_addr,
> +   cpu_reg(s, rt), cpu_reg(s, rt2));
>  } else {
> -gen_helper_paired_cmpxchg64_be(tmp, cpu_env, addr, cpu_reg(s, 
> rt),
> -   cpu_reg(s, rt2));
> +gen_helper_paired_cmpxchg64_be(tmp, cpu_env, cpu_exclusive_addr,
> +   cpu_reg(s, rt), cpu_reg(s, rt2));
>  }
>  } else {
> -TCGv_i64 val = cpu_reg(s, rt);
> -tcg_gen_atomic_cmpxchg_i64(tmp, addr, cpu_exclusive_val, val,
> -   get_mem_index(s),
> +tcg_gen_atomic_cmpxchg_i64(tmp, cpu_exclusive_addr, 
> cpu_exclusive_val,
> +   cpu_reg(s, rt), get_mem_index(s),
> size | MO_ALIGN | s->be_data);
>  tcg_gen_setcond_i64(TCG_COND_NE, tmp, tmp, cpu_exclusive_val);
>  }
> -
> -tcg_temp_free_i64(addr);
> -
>  tcg_gen_mov_i64(cpu_reg(s, rd), tmp);
>  tcg_temp_free_i64(tmp);
>  tcg_gen_br(done_label);
> --
> 2.13.5
>
>



[Qemu-devel] [PATCH v2 0/6] Update websocket code to more fully support the RFC

2017-09-08 Thread Brandon Carpenter
We've been experiencing issues where the qemu websocket server closes
connections from noVNC clients for no apparent reason. Debugging shows
that certain web browsers are injecting ping and pong frames when the
connection becomes idle. Some browsers send those frames without a
payload, which also is causing closure. This patch series addresses
these issues by making the websocket server more conformant to RFC
6455 - The WebSocket Protocol.

Remembering the opcode is sufficient for handling fragmented frames from
the client, which may be introduced by an intermediary server/proxy.
Respond to pings and ignore pongs rather than close the connection as
many browsers use ping/pong to test an idle connection. Close
connections according to the RFC, including providing a reason code and
message to aid debugging of unexpected disconnects. Empty payloads
should not cause a disconnect.

While updating the websocket code, several other bugs were discovered
for which patches are also included early in the set.

Brandon Carpenter (6):
  io: Always remove an old channel watch before adding a new one
  io: Small updates in preparation for websocket changes
  io: Add support for fragmented websocket binary frames
  io: Allow empty websocket payload
  io: Ignore websocket PING and PONG frames
  io: Reply to ping frames

 include/io/channel-websock.h |   1 +
 io/channel-websock.c | 207 ++-
 ui/vnc-auth-vencrypt.c   |   3 +
 ui/vnc-ws.c  |   6 ++
 ui/vnc.c |   4 +
 5 files changed, 122 insertions(+), 99 deletions(-)

-- 
2.14.1


-- 


CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is 
for the sole use of the intended recipient(s) and may contain proprietary, 
confidential or privileged information or otherwise be protected by law. 
Any unauthorized review, use, disclosure or distribution is prohibited. If 
you are not the intended recipient, please notify the sender and destroy 
all copies and the original message.



Re: [Qemu-devel] [PATCH v3 4/7] block: remove legacy I/O throttling

2017-09-08 Thread Manos Pitsidianakis

On Fri, Sep 08, 2017 at 06:00:11PM +0200, Kevin Wolf wrote:

Am 08.09.2017 um 17:44 hat Manos Pitsidianakis geschrieben:

On Thu, Sep 07, 2017 at 03:26:11PM +0200, Kevin Wolf wrote:
> We shouldn't really need any throttling code in
> blk_root_drained_begin/end any more now because the throttle node will
> be drained. If this code is necessary, a bdrv_drain() on an explicit
> throttle node will work differently from one on an implicit one.
>
> Unfortunately, this seems to be true about the throttle node. Implicit
> throttle nodes will keep ignoring the throttle limit in order to
> complete the drain request quickly, where as explicit throttle nodes
> will process their requests at the configured speed before the drain
> request can be completed.
>
> This doesn't feel right to me, both should behave the same.
>
> Kevin
>

I suppose we can implement bdrv_co_drain and increase io_limits_disabled
from inside the driver. And then remove the implicit filter logic from
blk_root_drained_begin. But there's no _end callback equivalent so we can't
decrease io_limits_disabled at the end of the drain. So I think there are
two options:

- make a bdrv_co_drain_end cb and recurse in blk_root_drain_end for all
children to call it. Old behavior of I/O bursts (?) during a drain is  kept.


This is the solution I was thinking of. It was always odd to have a
drained_begin/end pair in the external interface and in BdrvChildRole,
but not in BlockDriver. So it was to be expected that we'd need this
sooner or later.


- remove io_limits_disabled and let throttled requests obey limits  during a
drain


This was discussed earlier (at least when the disable code was
introduced in BlockBackend, but I think actually more than once), and
even though everyone agreed that ignoring the limits is ugly, we
seem to have come to the conclusion that it's the least bad option.
blk_drain() blocks and makes everything else hang, so we don't want it
to wait for several seconds.

Kevin


That makes sense. I will look into this and resubmit the series with 
this additional change.


signature.asc
Description: PGP signature


Re: [Qemu-devel] [PATCH v2 0/6] Update websocket code to more fully support the RFC

2017-09-08 Thread Eric Blake
On 09/08/2017 12:37 PM, Brandon Carpenter wrote:
> We've been experiencing issues where the qemu websocket server closes
> connections from noVNC clients for no apparent reason. Debugging shows
> that certain web browsers are injecting ping and pong frames when the
> connection becomes idle. Some browsers send those frames without a
> payload, which also is causing closure. This patch series addresses
> these issues by making the websocket server more conformant to RFC
> 6455 - The WebSocket Protocol.

meta-comment: sending v2 in-reply-to v1 makes it harder for automated
tooling to recognize that you are sending new patches.  We prefer that
v2 be a top-level thread.  More patch submission hints at:
https://wiki.qemu.org/index.php/Contribute/SubmitAPatch

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.   +1-919-301-3266
Virtualization:  qemu.org | libvirt.org



signature.asc
Description: OpenPGP digital signature


[Qemu-devel] [PATCH v2 5/6] io: Ignore websocket PING and PONG frames

2017-09-08 Thread Brandon Carpenter
Keep pings and gratuitous pongs generated by web browsers from killing
websocket connections.

Signed-off-by: Brandon Carpenter 
---
 io/channel-websock.c | 21 +
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/io/channel-websock.c b/io/channel-websock.c
index 3183aeff77..50387050d5 100644
--- a/io/channel-websock.c
+++ b/io/channel-websock.c
@@ -86,6 +86,7 @@
 #define QIO_CHANNEL_WEBSOCK_HEADER_FIELD_OPCODE 0x0f
 #define QIO_CHANNEL_WEBSOCK_HEADER_FIELD_HAS_MASK 0x80
 #define QIO_CHANNEL_WEBSOCK_HEADER_FIELD_PAYLOAD_LEN 0x7f
+#define QIO_CHANNEL_WEBSOCK_CONTROL_OPCODE_MASK 0x8
 
 typedef struct QIOChannelWebsockHeader QIOChannelWebsockHeader;
 
@@ -565,8 +566,11 @@ static int 
qio_channel_websock_decode_header(QIOChannelWebsock *ioc,
 return -1;
 }
 } else {
-if (opcode != QIO_CHANNEL_WEBSOCK_OPCODE_BINARY_FRAME) {
-error_setg(errp, "only binary websocket frames are supported");
+if (opcode != QIO_CHANNEL_WEBSOCK_OPCODE_BINARY_FRAME &&
+opcode != QIO_CHANNEL_WEBSOCK_OPCODE_PING &&
+opcode != QIO_CHANNEL_WEBSOCK_OPCODE_PONG) {
+error_setg(errp, "unsupported opcode: %#04x; only binary, ping, "
+ "and pong websocket frames are supported", 
opcode);
 return -1;
 }
 }
@@ -579,6 +583,9 @@ static int 
qio_channel_websock_decode_header(QIOChannelWebsock *ioc,
 ioc->payload_remain = payload_len;
 header_size = QIO_CHANNEL_WEBSOCK_HEADER_LEN_7_BIT;
 ioc->mask = header->u.m;
+} else if (opcode & QIO_CHANNEL_WEBSOCK_CONTROL_OPCODE_MASK) {
+error_setg(errp, "websocket control frame is too large");
+return -1;
 } else if (payload_len == QIO_CHANNEL_WEBSOCK_PAYLOAD_LEN_MAGIC_16_BIT &&
ioc->encinput.offset >= QIO_CHANNEL_WEBSOCK_HEADER_LEN_16_BIT) {
 ioc->payload_remain = be16_to_cpu(header->u.s16.l16);
@@ -634,9 +641,15 @@ static int 
qio_channel_websock_decode_payload(QIOChannelWebsock *ioc,
 }
 }
 
+/* Drop the payload of ping/pong packets */
+if (ioc->opcode == QIO_CHANNEL_WEBSOCK_OPCODE_BINARY_FRAME) {
+if (payload_len) {
+buffer_reserve(&ioc->rawinput, payload_len);
+buffer_append(&ioc->rawinput, ioc->encinput.buffer, payload_len);
+}
+}
+
 if (payload_len) {
-buffer_reserve(&ioc->rawinput, payload_len);
-buffer_append(&ioc->rawinput, ioc->encinput.buffer, payload_len);
 buffer_advance(&ioc->encinput, payload_len);
 }
 return 0;
-- 
2.14.1


-- 


CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is 
for the sole use of the intended recipient(s) and may contain proprietary, 
confidential or privileged information or otherwise be protected by law. 
Any unauthorized review, use, disclosure or distribution is prohibited. If 
you are not the intended recipient, please notify the sender and destroy 
all copies and the original message.



Re: [Qemu-devel] [RFC v2 4/8] QAPI: new QMP command option "without-bql"

2017-09-08 Thread Dr. David Alan Gilbert
* Peter Xu (pet...@redhat.com) wrote:
> On Fri, Aug 25, 2017 at 10:06:27AM +0100, Dr. David Alan Gilbert wrote:
> > * Peter Xu (pet...@redhat.com) wrote:
> > > On Wed, Aug 23, 2017 at 06:44:12PM +0100, Dr. David Alan Gilbert wrote:
> > > 
> > > [...]
> > > 
> > > > > +Most of the commands require the Big QEMU Lock (BQL) be held during
> > > > > +execution.  However, there is a small subset of the commands that may
> > > > > +not really need BQL at all.  To mark out this kind of commands, we 
> > > > > can
> > > > > +specify "without-bql" to "true".  This parameter is only a hint for
> > > > > +internal QMP implementation to provide possiblility to allow commands
> > > > > +be run in parallel, or reduce the contention of the lock.  Users of 
> > > > > QMP
> > > > > +should not really be aware of such information.
> > > > 
> > > > Well, I think users of these commands might select them specifically
> > > > because they know that they won't block.  Those who care about latency 
> > > > might
> > > > look to use commands that don't take the lock because of a reduced
> > > > effect on the performance as well.
> > > 
> > > What would be the best way to tell user?  I think again this should
> > > mostly for HMP only, right?
> > 
> > It needs to be docuemnted for QMP users as well so that those developing
> > management code know what's safe.
> 
> I see.  What's the corresponding QMP documentation I should touch up?

I'm not sure, but based on the long thread; I think the idea is to add
something to the schema so the flag appears in the introspection.  I'll
leave the details of how to Markus.

> > 
> > > Maybe we can add a new command to list these lock-free commands.  Or,
> > > I can dump something in "help" and "help info" like:
> > > 
> > > (qemu) help migrate_incoming
> > > migrate_incoming uri -- Continue an incoming migration from an -incoming 
> > > defer (BQL-less)
> > 
> > 'lock free' might be better?
> 
> I'm ok with it.  But would the word "lock" too general?

Maybe, but it's probably not just BQL.

Dave

> -- 
> Peter Xu
--
Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK



[Qemu-devel] [PATCH v2 2/6] io: Small updates in preparation for websocket changes

2017-09-08 Thread Brandon Carpenter
Gets rid of unnecessary bit shifting and performs proper EOF checking to
avoid a large number of repeated calls to recvmsg() when a client
abruptly terminates a connection (bug fix).

Signed-off-by: Brandon Carpenter 
---
 io/channel-websock.c | 62 +++-
 1 file changed, 18 insertions(+), 44 deletions(-)

diff --git a/io/channel-websock.c b/io/channel-websock.c
index 5a3badbec2..185bd31be5 100644
--- a/io/channel-websock.c
+++ b/io/channel-websock.c
@@ -86,8 +86,6 @@
 #define QIO_CHANNEL_WEBSOCK_HEADER_FIELD_OPCODE 0x0f
 #define QIO_CHANNEL_WEBSOCK_HEADER_FIELD_HAS_MASK 0x80
 #define QIO_CHANNEL_WEBSOCK_HEADER_FIELD_PAYLOAD_LEN 0x7f
-#define QIO_CHANNEL_WEBSOCK_HEADER_SHIFT_FIN 7
-#define QIO_CHANNEL_WEBSOCK_HEADER_SHIFT_HAS_MASK 7
 
 typedef struct QIOChannelWebsockHeader QIOChannelWebsockHeader;
 
@@ -492,7 +490,7 @@ static void qio_channel_websock_encode(QIOChannelWebsock 
*ioc)
 return;
 }
 
-header.ws.b0 = (1 << QIO_CHANNEL_WEBSOCK_HEADER_SHIFT_FIN) |
+header.ws.b0 = QIO_CHANNEL_WEBSOCK_HEADER_FIELD_FIN |
 (QIO_CHANNEL_WEBSOCK_OPCODE_BINARY_FRAME &
  QIO_CHANNEL_WEBSOCK_HEADER_FIELD_OPCODE);
 if (ioc->rawoutput.offset <
@@ -519,8 +517,8 @@ static void qio_channel_websock_encode(QIOChannelWebsock 
*ioc)
 }
 
 
-static ssize_t qio_channel_websock_decode_header(QIOChannelWebsock *ioc,
- Error **errp)
+static int qio_channel_websock_decode_header(QIOChannelWebsock *ioc,
+ Error **errp)
 {
 unsigned char opcode, fin, has_mask;
 size_t header_size;
@@ -539,11 +537,9 @@ static ssize_t 
qio_channel_websock_decode_header(QIOChannelWebsock *ioc,
 return QIO_CHANNEL_ERR_BLOCK;
 }
 
-fin = (header->b0 & QIO_CHANNEL_WEBSOCK_HEADER_FIELD_FIN) >>
-QIO_CHANNEL_WEBSOCK_HEADER_SHIFT_FIN;
+fin = header->b0 & QIO_CHANNEL_WEBSOCK_HEADER_FIELD_FIN;
 opcode = header->b0 & QIO_CHANNEL_WEBSOCK_HEADER_FIELD_OPCODE;
-has_mask = (header->b1 & QIO_CHANNEL_WEBSOCK_HEADER_FIELD_HAS_MASK) >>
-QIO_CHANNEL_WEBSOCK_HEADER_SHIFT_HAS_MASK;
+has_mask = header->b1 & QIO_CHANNEL_WEBSOCK_HEADER_FIELD_HAS_MASK;
 payload_len = header->b1 & QIO_CHANNEL_WEBSOCK_HEADER_FIELD_PAYLOAD_LEN;
 
 if (opcode == QIO_CHANNEL_WEBSOCK_OPCODE_CLOSE) {
@@ -561,7 +557,7 @@ static ssize_t 
qio_channel_websock_decode_header(QIOChannelWebsock *ioc,
 return -1;
 }
 if (!has_mask) {
-error_setg(errp, "websocket frames must be masked");
+error_setg(errp, "client websocket frames must be masked");
 return -1;
 }
 if (opcode != QIO_CHANNEL_WEBSOCK_OPCODE_BINARY_FRAME) {
@@ -593,8 +589,8 @@ static ssize_t 
qio_channel_websock_decode_header(QIOChannelWebsock *ioc,
 }
 
 
-static ssize_t qio_channel_websock_decode_payload(QIOChannelWebsock *ioc,
-  Error **errp)
+static int qio_channel_websock_decode_payload(QIOChannelWebsock *ioc,
+  Error **errp)
 {
 size_t i;
 size_t payload_len;
@@ -635,7 +631,7 @@ static ssize_t 
qio_channel_websock_decode_payload(QIOChannelWebsock *ioc,
 buffer_reserve(&ioc->rawinput, payload_len);
 buffer_append(&ioc->rawinput, ioc->encinput.buffer, payload_len);
 buffer_advance(&ioc->encinput, payload_len);
-return payload_len;
+return 0;
 }
 
 
@@ -715,8 +711,8 @@ static ssize_t 
qio_channel_websock_read_wire(QIOChannelWebsock *ioc,
 if (ret < 0) {
 return ret;
 }
-if (ret == 0 &&
-ioc->encinput.offset == 0) {
+if (ret == 0 && ioc->encinput.offset == 0) {
+ioc->io_eof = TRUE;
 return 0;
 }
 ioc->encinput.offset += ret;
@@ -728,10 +724,6 @@ static ssize_t 
qio_channel_websock_read_wire(QIOChannelWebsock *ioc,
 if (ret < 0) {
 return ret;
 }
-if (ret == 0) {
-ioc->io_eof = TRUE;
-break;
-}
 }
 
 ret = qio_channel_websock_decode_payload(ioc, errp);
@@ -996,14 +988,12 @@ struct QIOChannelWebsockSource {
 };
 
 static gboolean
-qio_channel_websock_source_prepare(GSource *source,
-   gint *timeout)
+qio_channel_websock_source_check(GSource *source)
 {
 QIOChannelWebsockSource *wsource = (QIOChannelWebsockSource *)source;
 GIOCondition cond = 0;
-*timeout = -1;
 
-if (wsource->wioc->rawinput.offset) {
+if (wsource->wioc->rawinput.offset || wsource->wioc->io_eof) {
 cond |= G_IO_IN;
 }
 if (wsource->wioc->rawoutput.offset < QIO_CHANNEL_WEBSOCK_MAX_BUFFER) {
@@ -1014,19 +1004,11 @@ qio_channel_websock_source_prepare(GSource *source,
 }
 
 static gboolean
-qio_channel_websock_source_check(GSource *source)
+qio_channel_websock_source_prepare(GSource *source,
+   

[Qemu-devel] [PATCH v2 6/6] io: Reply to ping frames

2017-09-08 Thread Brandon Carpenter
Add an immediate ping reply (pong) to the outgoing stream when a ping
is received. Unsolicited pongs are ignored.

Signed-off-by: Brandon Carpenter 
---
 io/channel-websock.c | 50 --
 1 file changed, 32 insertions(+), 18 deletions(-)

diff --git a/io/channel-websock.c b/io/channel-websock.c
index 50387050d5..175f17ce6b 100644
--- a/io/channel-websock.c
+++ b/io/channel-websock.c
@@ -479,7 +479,8 @@ static gboolean qio_channel_websock_handshake_io(QIOChannel 
*ioc,
 }
 
 
-static void qio_channel_websock_encode(QIOChannelWebsock *ioc)
+static void qio_channel_websock_encode_buffer(QIOChannelWebsock *ioc,
+  uint8_t opcode, Buffer *buffer)
 {
 size_t header_size;
 union {
@@ -487,33 +488,37 @@ static void qio_channel_websock_encode(QIOChannelWebsock 
*ioc)
 QIOChannelWebsockHeader ws;
 } header;
 
-if (!ioc->rawoutput.offset) {
-return;
-}
-
 header.ws.b0 = QIO_CHANNEL_WEBSOCK_HEADER_FIELD_FIN |
-(QIO_CHANNEL_WEBSOCK_OPCODE_BINARY_FRAME &
- QIO_CHANNEL_WEBSOCK_HEADER_FIELD_OPCODE);
-if (ioc->rawoutput.offset <
+(opcode & QIO_CHANNEL_WEBSOCK_HEADER_FIELD_OPCODE);
+if (buffer->offset <
 QIO_CHANNEL_WEBSOCK_PAYLOAD_LEN_THRESHOLD_7_BIT) {
-header.ws.b1 = (uint8_t)ioc->rawoutput.offset;
+header.ws.b1 = (uint8_t)buffer->offset;
 header_size = QIO_CHANNEL_WEBSOCK_HEADER_LEN_7_BIT;
-} else if (ioc->rawoutput.offset <
+} else if (buffer->offset <
QIO_CHANNEL_WEBSOCK_PAYLOAD_LEN_THRESHOLD_16_BIT) {
 header.ws.b1 = QIO_CHANNEL_WEBSOCK_PAYLOAD_LEN_MAGIC_16_BIT;
-header.ws.u.s16.l16 = cpu_to_be16((uint16_t)ioc->rawoutput.offset);
+header.ws.u.s16.l16 = cpu_to_be16((uint16_t)buffer->offset);
 header_size = QIO_CHANNEL_WEBSOCK_HEADER_LEN_16_BIT;
 } else {
 header.ws.b1 = QIO_CHANNEL_WEBSOCK_PAYLOAD_LEN_MAGIC_64_BIT;
-header.ws.u.s64.l64 = cpu_to_be64(ioc->rawoutput.offset);
+header.ws.u.s64.l64 = cpu_to_be64(buffer->offset);
 header_size = QIO_CHANNEL_WEBSOCK_HEADER_LEN_64_BIT;
 }
 header_size -= QIO_CHANNEL_WEBSOCK_HEADER_LEN_MASK;
 
-buffer_reserve(&ioc->encoutput, header_size + ioc->rawoutput.offset);
+buffer_reserve(&ioc->encoutput, header_size + buffer->offset);
 buffer_append(&ioc->encoutput, header.buf, header_size);
-buffer_append(&ioc->encoutput, ioc->rawoutput.buffer,
-  ioc->rawoutput.offset);
+buffer_append(&ioc->encoutput, buffer->buffer, buffer->offset);
+}
+
+
+static void qio_channel_websock_encode(QIOChannelWebsock *ioc)
+{
+if (!ioc->rawoutput.offset) {
+return;
+}
+qio_channel_websock_encode_buffer(ioc,
+QIO_CHANNEL_WEBSOCK_OPCODE_BINARY_FRAME, &ioc->rawoutput);
 buffer_reset(&ioc->rawoutput);
 }
 
@@ -558,7 +563,7 @@ static int 
qio_channel_websock_decode_header(QIOChannelWebsock *ioc,
 /* Websocket frame sanity check:
  * * Fragmentation is only supported for binary frames.
  * * All frames sent by a client MUST be masked.
- * * Only binary encoding is supported.
+ * * Only binary and ping/pong encoding is supported.
  */
 if (!fin) {
 if (opcode != QIO_CHANNEL_WEBSOCK_OPCODE_BINARY_FRAME) {
@@ -619,6 +624,11 @@ static int 
qio_channel_websock_decode_payload(QIOChannelWebsock *ioc,
  * for purpose of unmasking, except at end of payload
  */
 if (ioc->encinput.offset < ioc->payload_remain) {
+/* Wait for the entire payload before processing control frames
+ * because the payload will most likely be echoed back. */
+if (ioc->opcode & QIO_CHANNEL_WEBSOCK_CONTROL_OPCODE_MASK) {
+return QIO_CHANNEL_ERR_BLOCK;
+}
 payload_len = ioc->encinput.offset - (ioc->encinput.offset % 4);
 } else {
 payload_len = ioc->payload_remain;
@@ -641,13 +651,17 @@ static int 
qio_channel_websock_decode_payload(QIOChannelWebsock *ioc,
 }
 }
 
-/* Drop the payload of ping/pong packets */
 if (ioc->opcode == QIO_CHANNEL_WEBSOCK_OPCODE_BINARY_FRAME) {
 if (payload_len) {
+/* binary frames are passed on */
 buffer_reserve(&ioc->rawinput, payload_len);
 buffer_append(&ioc->rawinput, ioc->encinput.buffer, payload_len);
 }
-}
+} else if (ioc->opcode == QIO_CHANNEL_WEBSOCK_OPCODE_PING) {
+/* ping frames produce an immediate pong reply */
+qio_channel_websock_encode_buffer(ioc,
+QIO_CHANNEL_WEBSOCK_OPCODE_PONG, &ioc->encinput);
+}   /* pong frames are ignored */
 
 if (payload_len) {
 buffer_advance(&ioc->encinput, payload_len);
-- 
2.14.1


-- 


CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is 
for the sole use of the intended recipient(s) and may contain proprietary, 
c

Re: [Qemu-devel] [RFC v2 4/8] QAPI: new QMP command option "without-bql"

2017-09-08 Thread Dr. David Alan Gilbert
* Peter Xu (pet...@redhat.com) wrote:
> On Fri, Aug 25, 2017 at 10:14:12AM +0100, Dr. David Alan Gilbert wrote:
> > * Peter Xu (pet...@redhat.com) wrote:
> > > On Thu, Aug 24, 2017 at 07:37:32AM +0800, Fam Zheng wrote:
> > > > On Wed, 08/23 18:44, Dr. David Alan Gilbert wrote:
> > > > > * Peter Xu (pet...@redhat.com) wrote:
> > > > > > Introducing this new parameter for QMP commands in general to mark 
> > > > > > out
> > > > > > when the command does not need BQL.  Normally QMP command 
> > > > > > executions are
> > > > > > done with the protection of BQL in QEMU.  However the truth is that 
> > > > > > not
> > > > > > all the QMP commands require the BQL.
> > > > > > 
> > > > > > This new parameter provides a way to allow QMP commands to run in
> > > > > > parallel when possible, without the contention on the BQL.
> > > > > > 
> > > > > > Since the default value of "without-bql" is still false, so now all 
> > > > > > QMP
> > > > > > commands are still protected by BQL still.
> > > > > > 
> > > > > > Signed-off-by: Peter Xu 
> > > > > 
> > > > > We should define what a 'without-bql' command is allowed to do:
> > > > >'Commands that have without-bql set _may_ be called without the bql
> > > > >being taken.  They must not take the bql or any other lock that may
> > > > >become dependent on the bql.'
> > > 
> > > Sure.
> > > 
> > > > >(Do we need to say anything about RCU?)
> > > 
> > > Could I ask how is RCU related?
> > 
> > My definition above said that anything declared without bql couldn't
> > take the bql, so couldn't block on any other thread holding the bql.
> > But is our command allowed to use synchronize_rcu or rcu_read_lock
> > that could wait for or block other threads doing rcu stuff?
> > Because if it did is there any guarantee that it wouldn't block?
> 
> I see.  Shall we just ignore RCU for now?  Since currently I don't see
> a real synchronize_rcu() user yet in QEMU, except the RCU thread.  And
> rcu_read_lock() should not block itself, so IMHO calling it only in
> monitor command handlers should always be fine?

Yes, I think you're right that the rcu_read_lock is OK; just something
to keep in mind.

Dave

> > 
> > 
> > > 
> > > > > 
> > > > > Also, 'no-bql' is shorter :-)
> > > > 
> > > > Or rather "need-bql" that defaults to true to avoid double negative 
> > > > (TM) with
> > > > "no-bql = false"?
> > > 
> > > Ok let me use "need-bql". :)
> > 
> > Fine by me.
> 
> I'm switching to "need-bql" for QMP only, and used "no-bql" in HMP,
> since I failed to find a good way to init mon_cmd_t field to true by
> default.
> 
> -- 
> Peter Xu
--
Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK



[Qemu-devel] [PATCH v2 3/6] io: Add support for fragmented websocket binary frames

2017-09-08 Thread Brandon Carpenter
Allows fragmented binary frames by saving the previous opcode. Handles
the case where an intermediary (i.e., web proxy) fragments frames
originally sent unfragmented by the client.

Signed-off-by: Brandon Carpenter 
---
 include/io/channel-websock.h |  1 +
 io/channel-websock.c | 26 ++
 2 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/include/io/channel-websock.h b/include/io/channel-websock.h
index 3c9ff84727..7c896557c5 100644
--- a/include/io/channel-websock.h
+++ b/include/io/channel-websock.h
@@ -65,6 +65,7 @@ struct QIOChannelWebsock {
 guint io_tag;
 Error *io_err;
 gboolean io_eof;
+uint8_t opcode;
 };
 
 /**
diff --git a/io/channel-websock.c b/io/channel-websock.c
index 185bd31be5..ced24135ec 100644
--- a/io/channel-websock.c
+++ b/io/channel-websock.c
@@ -542,28 +542,38 @@ static int 
qio_channel_websock_decode_header(QIOChannelWebsock *ioc,
 has_mask = header->b1 & QIO_CHANNEL_WEBSOCK_HEADER_FIELD_HAS_MASK;
 payload_len = header->b1 & QIO_CHANNEL_WEBSOCK_HEADER_FIELD_PAYLOAD_LEN;
 
+/* Save or restore opcode. */
+if (opcode) {
+ioc->opcode = opcode;
+} else {
+opcode = ioc->opcode;
+}
+
 if (opcode == QIO_CHANNEL_WEBSOCK_OPCODE_CLOSE) {
 /* disconnect */
 return 0;
 }
 
 /* Websocket frame sanity check:
- * * Websocket fragmentation is not supported.
- * * All  websockets frames sent by a client have to be masked.
+ * * Fragmentation is only supported for binary frames.
+ * * All frames sent by a client MUST be masked.
  * * Only binary encoding is supported.
  */
 if (!fin) {
-error_setg(errp, "websocket fragmentation is not supported");
-return -1;
+if (opcode != QIO_CHANNEL_WEBSOCK_OPCODE_BINARY_FRAME) {
+error_setg(errp, "only binary websocket frames may be fragmented");
+return -1;
+}
+} else {
+if (opcode != QIO_CHANNEL_WEBSOCK_OPCODE_BINARY_FRAME) {
+error_setg(errp, "only binary websocket frames are supported");
+return -1;
+}
 }
 if (!has_mask) {
 error_setg(errp, "client websocket frames must be masked");
 return -1;
 }
-if (opcode != QIO_CHANNEL_WEBSOCK_OPCODE_BINARY_FRAME) {
-error_setg(errp, "only binary websocket frames are supported");
-return -1;
-}
 
 if (payload_len < QIO_CHANNEL_WEBSOCK_PAYLOAD_LEN_MAGIC_16_BIT) {
 ioc->payload_remain = payload_len;
-- 
2.14.1


-- 


CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is 
for the sole use of the intended recipient(s) and may contain proprietary, 
confidential or privileged information or otherwise be protected by law. 
Any unauthorized review, use, disclosure or distribution is prohibited. If 
you are not the intended recipient, please notify the sender and destroy 
all copies and the original message.



[Qemu-devel] [PATCH v3 15/15] MAINTAINERS: update docs/interop/ entries

2017-09-08 Thread Philippe Mathieu-Daudé
moved in commit 7746cf8aab68

Signed-off-by: Philippe Mathieu-Daudé 
Acked-by: Fam Zheng 
Acked-by: John Snow 
---
 MAINTAINERS | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index f8630561de..99f3681842 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1259,7 +1259,7 @@ F: block/dirty-bitmap.c
 F: include/qemu/hbitmap.h
 F: include/block/dirty-bitmap.h
 F: tests/test-hbitmap.c
-F: docs/bitmaps.md
+F: docs/interop/bitmaps.rst
 T: git git://github.com/famz/qemu.git bitmaps
 T: git git://github.com/jnsnow/qemu.git bitmaps
 
@@ -1837,7 +1837,7 @@ M: Denis V. Lunev 
 L: qemu-bl...@nongnu.org
 S: Supported
 F: block/parallels.c
-F: docs/specs/parallels.txt
+F: docs/interop/parallels.txt
 
 qed
 M: Stefan Hajnoczi 
-- 
2.14.1




[Qemu-devel] [PATCH v2 4/6] io: Allow empty websocket payload

2017-09-08 Thread Brandon Carpenter
Some browsers send pings/pongs with no payload, so allow empty payloads
instead of closing the connection.

Signed-off-by: Brandon Carpenter 
---
 io/channel-websock.c | 62 +---
 1 file changed, 30 insertions(+), 32 deletions(-)

diff --git a/io/channel-websock.c b/io/channel-websock.c
index ced24135ec..3183aeff77 100644
--- a/io/channel-websock.c
+++ b/io/channel-websock.c
@@ -603,44 +603,42 @@ static int 
qio_channel_websock_decode_payload(QIOChannelWebsock *ioc,
   Error **errp)
 {
 size_t i;
-size_t payload_len;
+size_t payload_len = 0;
 uint32_t *payload32;
 
-if (!ioc->payload_remain) {
-error_setg(errp,
-   "Decoding payload but no bytes of payload remain");
-return -1;
-}
-
-/* If we aren't at the end of the payload, then drop
- * off the last bytes, so we're always multiple of 4
- * for purpose of unmasking, except at end of payload
- */
-if (ioc->encinput.offset < ioc->payload_remain) {
-payload_len = ioc->encinput.offset - (ioc->encinput.offset % 4);
-} else {
-payload_len = ioc->payload_remain;
-}
-if (payload_len == 0) {
-return QIO_CHANNEL_ERR_BLOCK;
-}
+if (ioc->payload_remain) {
+/* If we aren't at the end of the payload, then drop
+ * off the last bytes, so we're always multiple of 4
+ * for purpose of unmasking, except at end of payload
+ */
+if (ioc->encinput.offset < ioc->payload_remain) {
+payload_len = ioc->encinput.offset - (ioc->encinput.offset % 4);
+} else {
+payload_len = ioc->payload_remain;
+}
+if (payload_len == 0) {
+return QIO_CHANNEL_ERR_BLOCK;
+}
 
-ioc->payload_remain -= payload_len;
+ioc->payload_remain -= payload_len;
 
-/* unmask frame */
-/* process 1 frame (32 bit op) */
-payload32 = (uint32_t *)ioc->encinput.buffer;
-for (i = 0; i < payload_len / 4; i++) {
-payload32[i] ^= ioc->mask.u;
-}
-/* process the remaining bytes (if any) */
-for (i *= 4; i < payload_len; i++) {
-ioc->encinput.buffer[i] ^= ioc->mask.c[i % 4];
+/* unmask frame */
+/* process 1 frame (32 bit op) */
+payload32 = (uint32_t *)ioc->encinput.buffer;
+for (i = 0; i < payload_len / 4; i++) {
+payload32[i] ^= ioc->mask.u;
+}
+/* process the remaining bytes (if any) */
+for (i *= 4; i < payload_len; i++) {
+ioc->encinput.buffer[i] ^= ioc->mask.c[i % 4];
+}
 }
 
-buffer_reserve(&ioc->rawinput, payload_len);
-buffer_append(&ioc->rawinput, ioc->encinput.buffer, payload_len);
-buffer_advance(&ioc->encinput, payload_len);
+if (payload_len) {
+buffer_reserve(&ioc->rawinput, payload_len);
+buffer_append(&ioc->rawinput, ioc->encinput.buffer, payload_len);
+buffer_advance(&ioc->encinput, payload_len);
+}
 return 0;
 }
 
-- 
2.14.1


-- 


CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is 
for the sole use of the intended recipient(s) and may contain proprietary, 
confidential or privileged information or otherwise be protected by law. 
Any unauthorized review, use, disclosure or distribution is prohibited. If 
you are not the intended recipient, please notify the sender and destroy 
all copies and the original message.



[Qemu-devel] [PATCH v3 13/15] MAINTAINERS: add missing Cryptography entry

2017-09-08 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé 
Acked-by: Daniel P. Berrange 
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 8024a3880b..53891bd36e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1540,6 +1540,7 @@ S: Maintained
 F: crypto/
 F: include/crypto/
 F: tests/test-crypto-*
+F: tests/benchmark-crypto-*
 F: qemu.sasl
 
 Coroutines
-- 
2.14.1




[Qemu-devel] [PATCH v2 1/6] io: Always remove an old channel watch before adding a new one

2017-09-08 Thread Brandon Carpenter
Also set saved handle to zero when removing without adding a new watch.

Signed-off-by: Brandon Carpenter 
Reviewed-by: Paolo Bonzini 
Reviewed-by: Daniel P. Berrange 
---
 ui/vnc-auth-vencrypt.c | 3 +++
 ui/vnc-ws.c| 6 ++
 ui/vnc.c   | 4 
 3 files changed, 13 insertions(+)

diff --git a/ui/vnc-auth-vencrypt.c b/ui/vnc-auth-vencrypt.c
index ffaab57550..c3eece4fa7 100644
--- a/ui/vnc-auth-vencrypt.c
+++ b/ui/vnc-auth-vencrypt.c
@@ -77,6 +77,9 @@ static void vnc_tls_handshake_done(QIOTask *task,
 vnc_client_error(vs);
 error_free(err);
 } else {
+if (vs->ioc_tag) {
+g_source_remove(vs->ioc_tag);
+}
 vs->ioc_tag = qio_channel_add_watch(
 vs->ioc, G_IO_IN | G_IO_OUT, vnc_client_io, vs, NULL);
 start_auth_vencrypt_subauth(vs);
diff --git a/ui/vnc-ws.c b/ui/vnc-ws.c
index f530cd5474..eaf309553c 100644
--- a/ui/vnc-ws.c
+++ b/ui/vnc-ws.c
@@ -36,6 +36,9 @@ static void vncws_tls_handshake_done(QIOTask *task,
 error_free(err);
 } else {
 VNC_DEBUG("TLS handshake complete, starting websocket handshake\n");
+if (vs->ioc_tag) {
+g_source_remove(vs->ioc_tag);
+}
 vs->ioc_tag = qio_channel_add_watch(
 QIO_CHANNEL(vs->ioc), G_IO_IN, vncws_handshake_io, vs, NULL);
 }
@@ -97,6 +100,9 @@ static void vncws_handshake_done(QIOTask *task,
 } else {
 VNC_DEBUG("Websock handshake complete, starting VNC protocol\n");
 vnc_start_protocol(vs);
+if (vs->ioc_tag) {
+g_source_remove(vs->ioc_tag);
+}
 vs->ioc_tag = qio_channel_add_watch(
 vs->ioc, G_IO_IN, vnc_client_io, vs, NULL);
 }
diff --git a/ui/vnc.c b/ui/vnc.c
index 0b5dbc62e4..62f7a3f30a 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -1121,6 +1121,7 @@ static void vnc_disconnect_start(VncState *vs)
 vnc_set_share_mode(vs, VNC_SHARE_MODE_DISCONNECTED);
 if (vs->ioc_tag) {
 g_source_remove(vs->ioc_tag);
+vs->ioc_tag = 0;
 }
 qio_channel_close(vs->ioc, NULL);
 vs->disconnecting = TRUE;
@@ -2931,6 +2932,9 @@ static void vnc_connect(VncDisplay *vd, QIOChannelSocket 
*sioc,
 VNC_DEBUG("New client on socket %p\n", vs->sioc);
 update_displaychangelistener(&vd->dcl, VNC_REFRESH_INTERVAL_BASE);
 qio_channel_set_blocking(vs->ioc, false, NULL);
+if (vs->ioc_tag) {
+g_source_remove(vs->ioc_tag);
+}
 if (websocket) {
 vs->websocket = 1;
 if (vd->tlscreds) {
-- 
2.14.1


-- 


CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is 
for the sole use of the intended recipient(s) and may contain proprietary, 
confidential or privileged information or otherwise be protected by law. 
Any unauthorized review, use, disclosure or distribution is prohibited. If 
you are not the intended recipient, please notify the sender and destroy 
all copies and the original message.



[Qemu-devel] [PATCH v3 14/15] MAINTAINERS: update docs/devel/ entries

2017-09-08 Thread Philippe Mathieu-Daudé
moved in commit ac06724a7158

Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Eric Blake 
---
 MAINTAINERS | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 53891bd36e..f8630561de 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1419,7 +1419,7 @@ F: tests/test-qapi-*.c
 F: tests/test-qmp-*.c
 F: tests/test-visitor-serialization.c
 F: scripts/qapi*
-F: docs/qapi*
+F: docs/devel/qapi*
 T: git git://repo.or.cz/qemu/armbru.git qapi-next
 
 QAPI Schema
@@ -1471,7 +1471,7 @@ M: Markus Armbruster 
 S: Supported
 F: qmp.c
 F: monitor.c
-F: docs/*qmp-*
+F: docs/devel/*qmp-*
 F: scripts/qmp/
 F: tests/qmp-test.c
 T: git git://repo.or.cz/qemu/armbru.git qapi-next
@@ -1502,7 +1502,7 @@ S: Maintained
 F: trace/
 F: scripts/tracetool.py
 F: scripts/tracetool/
-F: docs/tracing.txt
+F: docs/devel/tracing.txt
 T: git git://github.com/stefanha/qemu.git tracing
 
 TPM
@@ -1525,7 +1525,7 @@ F: include/migration/
 F: migration/
 F: scripts/vmstate-static-checker.py
 F: tests/vmstate-static-checker-data/
-F: docs/migration.txt
+F: docs/devel/migration.txt
 F: qapi/migration.json
 
 Seccomp
@@ -1923,5 +1923,5 @@ Documentation
 Build system architecture
 M: Daniel P. Berrange 
 S: Odd Fixes
-F: docs/build-system.txt
+F: docs/devel/build-system.txt
 
-- 
2.14.1




[Qemu-devel] [PATCH v3 09/15] MAINTAINERS: add missing SSI entries

2017-09-08 Thread Philippe Mathieu-Daudé
Alistair Francis volunteered :)

Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Alistair Francis 
---
 MAINTAINERS | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 69ad3aac29..517c8f95d7 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -986,10 +986,13 @@ F: hw/scsi/lsi53c895a.c
 
 SSI
 M: Peter Crosthwaite 
+M: Alistair Francis 
 S: Maintained
 F: hw/ssi/*
 F: hw/block/m25p80.c
+F: include/hw/ssi/ssi.h
 X: hw/ssi/xilinx_*
+F: tests/m25p80-test.c
 
 Xilinx SPI
 M: Alistair Francis 
-- 
2.14.1




[Qemu-devel] [PATCH v3 11/15] MAINTAINERS: add missing AIO entry

2017-09-08 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé 
Acked-by: Fam Zheng 
Reviewed-by: Stefan Hajnoczi 
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 4e05831bda..98b7edc8b3 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1224,6 +1224,7 @@ F: util/aio-*.c
 F: block/io.c
 F: migration/block*
 F: include/block/aio.h
+F: scripts/qemugdb/aio.py
 T: git git://github.com/stefanha/qemu.git block
 
 Block Jobs
-- 
2.14.1




[Qemu-devel] [PATCH v3 12/15] MAINTAINERS: add missing entry for Generic Loader

2017-09-08 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Alistair Francis 
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 98b7edc8b3..8024a3880b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1163,6 +1163,7 @@ M: Alistair Francis 
 S: Maintained
 F: hw/core/generic-loader.c
 F: include/hw/core/generic-loader.h
+F: docs/generic-loader.txt
 
 CHRP NVRAM
 M: Thomas Huth 
-- 
2.14.1




[Qemu-devel] [PATCH v3 07/15] MAINTAINERS: add missing USB entry

2017-09-08 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Thomas Huth 
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 39ac5d132a..04cc35cc3a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1004,6 +1004,7 @@ F: docs/usb2.txt
 F: docs/usb-storage.txt
 F: include/hw/usb.h
 F: include/hw/usb/
+F: default-configs/usb.mak
 
 USB (serial adapter)
 M: Gerd Hoffmann 
-- 
2.14.1




[Qemu-devel] [PATCH v3 10/15] MAINTAINERS: add missing entries for throttling infra

2017-09-08 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Stefan Hajnoczi 
Reviewed-by: Alberto Garcia 
---
 MAINTAINERS | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 517c8f95d7..4e05831bda 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1574,8 +1574,10 @@ M: Alberto Garcia 
 S: Supported
 F: block/throttle-groups.c
 F: include/block/throttle-groups.h
-F: include/qemu/throttle.h
+F: include/qemu/throttle*.h
 F: util/throttle.c
+F: docs/throttle.txt
+F: tests/test-throttle.c
 L: qemu-bl...@nongnu.org
 
 UUID
-- 
2.14.1




[Qemu-devel] [PATCH v3 06/15] MAINTAINERS: add missing qcow2 entry

2017-09-08 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé 
Acked-by: Kevin Wolf 
Reviewed-by: Stefan Hajnoczi 
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index fa1620d8a8..39ac5d132a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1851,6 +1851,7 @@ M: Max Reitz 
 L: qemu-bl...@nongnu.org
 S: Supported
 F: block/qcow2*
+F: docs/interop/qcow2.txt
 
 qcow
 M: Kevin Wolf 
-- 
2.14.1




[Qemu-devel] [PATCH v3 04/15] MAINTAINERS: add missing VMWare entry

2017-09-08 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Thomas Huth 
Reviewed-by: Dmitry Fleytman 
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index afc0072a17..e0e5a8dc3f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1126,6 +1126,7 @@ M: Dmitry Fleytman 
 S: Maintained
 F: hw/net/vmxnet*
 F: hw/scsi/vmw_pvscsi*
+F: tests/vmxnet3-test.c
 
 Rocker
 M: Jiri Pirko 
-- 
2.14.1




[Qemu-devel] [PATCH v3 08/15] MAINTAINERS: add missing PCI entries

2017-09-08 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Marcel Apfelbaum 
Acked-by: Michael S. Tsirkin 
---
 MAINTAINERS | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 04cc35cc3a..69ad3aac29 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -928,6 +928,8 @@ F: include/hw/pci/*
 F: hw/misc/pci-testdev.c
 F: hw/pci/*
 F: hw/pci-bridge/*
+F: docs/pci*
+F: docs/specs/*pci*
 
 ACPI/SMBIOS
 M: Michael S. Tsirkin 
-- 
2.14.1




[Qemu-devel] [PATCH v3 05/15] MAINTAINERS: add missing Guest Agent entries

2017-09-08 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé 
Acked-by: Michael Roth 
---
 MAINTAINERS | 4 
 1 file changed, 4 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index e0e5a8dc3f..fa1620d8a8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1440,6 +1440,10 @@ QEMU Guest Agent
 M: Michael Roth 
 S: Maintained
 F: qga/
+F: qemu-ga.texi
+F: scripts/qemu-guest-agent/
+F: tests/test-qga.c
+F: docs/interop/qemu-ga-ref.texi
 T: git git://github.com/mdroth/qemu.git qga
 
 QOM
-- 
2.14.1




Re: [Qemu-devel] [PATCH v7 03/22] migration: Teach it about G_SOURCE_REMOVE

2017-09-08 Thread Dr. David Alan Gilbert
* Juan Quintela (quint...@redhat.com) wrote:
> As this is defined on glib 2.32, add compatibility macros for older glibs.
> 
> Signed-off-by: Juan Quintela 
> Reviewed-by: Daniel P. Berrange 
> Reviewed-by: Peter Xu 

I think 03 and 04 could both be merged to current qemu?

I think you could remove the G_SOURCE_CONTINUE/REMOVE defines in
contrib/vhost-user-scsi/vhost-user-scsi.c as well.

Dave

> ---
>  include/glib-compat.h | 2 ++
>  migration/exec.c  | 2 +-
>  migration/fd.c| 2 +-
>  migration/socket.c| 2 +-
>  4 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/include/glib-compat.h b/include/glib-compat.h
> index fcffcd3f07..e15aca2d40 100644
> --- a/include/glib-compat.h
> +++ b/include/glib-compat.h
> @@ -223,6 +223,8 @@ static inline gboolean g_hash_table_contains(GHashTable 
> *hash_table,
>  {
>  return g_hash_table_lookup_extended(hash_table, key, NULL, NULL);
>  }
> +#define G_SOURCE_CONTINUE TRUE
> +#define G_SOURCE_REMOVE FALSE
>  #endif
>  
>  #ifndef g_assert_true
> diff --git a/migration/exec.c b/migration/exec.c
> index 08b599e0e2..f3be1baf2e 100644
> --- a/migration/exec.c
> +++ b/migration/exec.c
> @@ -49,7 +49,7 @@ static gboolean exec_accept_incoming_migration(QIOChannel 
> *ioc,
>  {
>  migration_channel_process_incoming(ioc);
>  object_unref(OBJECT(ioc));
> -return FALSE; /* unregister */
> +return G_SOURCE_REMOVE;
>  }
>  
>  void exec_start_incoming_migration(const char *command, Error **errp)
> diff --git a/migration/fd.c b/migration/fd.c
> index 30f5258a6a..30de4b9847 100644
> --- a/migration/fd.c
> +++ b/migration/fd.c
> @@ -49,7 +49,7 @@ static gboolean fd_accept_incoming_migration(QIOChannel 
> *ioc,
>  {
>  migration_channel_process_incoming(ioc);
>  object_unref(OBJECT(ioc));
> -return FALSE; /* unregister */
> +return G_SOURCE_REMOVE;
>  }
>  
>  void fd_start_incoming_migration(const char *infd, Error **errp)
> diff --git a/migration/socket.c b/migration/socket.c
> index 757d3821a1..b02d37d7a3 100644
> --- a/migration/socket.c
> +++ b/migration/socket.c
> @@ -154,7 +154,7 @@ static gboolean 
> socket_accept_incoming_migration(QIOChannel *ioc,
>  out:
>  /* Close listening socket as its no longer needed */
>  qio_channel_close(ioc, NULL);
> -return FALSE; /* unregister */
> +return G_SOURCE_REMOVE;
>  }
>  
>  
> -- 
> 2.13.5
> 
--
Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK



Re: [Qemu-devel] [PATCH 3/3] Unified Datagram Socket Transport - raw support

2017-09-08 Thread Anton Ivanov
On 24/07/17 05:03, Jason Wang wrote:
>
>
> On 2017年07月22日 02:50, Anton Ivanov wrote:
>>
>> [snip]
>>
 +"-netdev raw,id=str,ifname=ifname\n"
 +"configure a network backend with ID 'str'
 connected to\n"
 +"an Ethernet interface named ifname via raw
 socket.\n"
 +"This backend does not change the interface
 settings.\n"
 +"Most interfaces will require being set into
 promisc mode,\n"
 +"as well having most offloads (TSO, etc)
 turned off.\n"
 +"Some virtual interfaces like tap support only
 RX.\n"
>>>
>>> Pay attention that qemu supports vnet header. So any reason to turn
>>> off e.g TSO here?
>>
>> I am not aware of any means to get extra info like checksums, etc
>> show up on raw socket read.
>>
>> If you know a way to make them show up, this is worth investigating.
>
> See packet_rcv_vnet(). But a known 'issue' for raw socket is that it
> forbids change vnet header length after creation, we may need some
> workaround in qemu.

There are a couple of other issues - if I understand the situation
correctly, probing the vnet header size relies on tap ioctls.

I have some support for this working now. I will try to get around to
redo the patches as per your last comments + initial vnet header support
and re-submit.

One definitive advantage of having it is that it allows to detect if
GSO/TSO is enabled on the interface as this is not something that gets
along very well with fixed buffer size vector IO.

A.

[snip]
>>>
>
>


-- 
Anton R. Ivanov
Cambridgegreys Limited. Registered in England. Company Number 10273661




Re: [Qemu-devel] [PATCH v7 13/22] migration: Split migration_fd_process_incoming

2017-09-08 Thread Dr. David Alan Gilbert
* Juan Quintela (quint...@redhat.com) wrote:
> We need that on later patches.
> 
> Signed-off-by: Juan Quintela 
> Reviewed-by: Dr. David Alan Gilbert 
> Reviewed-by: Peter Xu 
> Reviewed-by: Daniel P. Berrange 

I think this could also go into current qemu?

Dave

> ---
>  migration/migration.c | 14 --
>  1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/migration/migration.c b/migration/migration.c
> index 9fec880a58..18bd24a14c 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -372,9 +372,8 @@ static void process_incoming_migration_co(void *opaque)
>  qemu_bh_schedule(mis->bh);
>  }
>  
> -void migration_fd_process_incoming(QEMUFile *f)
> +static void migration_incoming_setup(QEMUFile *f)
>  {
> -Coroutine *co = qemu_coroutine_create(process_incoming_migration_co, 
> NULL);
>  MigrationIncomingState *mis = migration_incoming_get_current();
>  
>  if (multifd_load_setup() != 0) {
> @@ -387,9 +386,20 @@ void migration_fd_process_incoming(QEMUFile *f)
>  mis->from_src_file = f;
>  }
>  qemu_file_set_blocking(f, false);
> +}
> +
> +static void migration_incoming_process(void)
> +{
> +Coroutine *co = qemu_coroutine_create(process_incoming_migration_co, 
> NULL);
>  qemu_coroutine_enter(co);
>  }
>  
> +void migration_fd_process_incoming(QEMUFile *f)
> +{
> +migration_incoming_setup(f);
> +migration_incoming_process();
> +}
> +
>  void migration_ioc_process_incoming(QIOChannel *ioc)
>  {
>  MigrationIncomingState *mis = migration_incoming_get_current();
> -- 
> 2.13.5
> 
--
Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK



Re: [Qemu-devel] [PATCH v2 12/17] MAINTAINERS: add missing megasas test entry

2017-09-08 Thread Philippe Mathieu-Daudé

Let's try another SUSE domain

On 09/08/2017 02:12 PM, Philippe Mathieu-Daudé wrote:

I wonder if "megasas" is still maintained, I got:

To: Hannes Reinecke 
Final-Recipient: rfc822; h...@suse.de
Action: failed
Status: 5.1.1
Remote-MTA: dns; mx2.suse.de. (195.135.220.15, the server for the domain 
suse.de.)
Diagnostic-Code: smtp; 550 5.1.1 : Recipient address 
rejected: User unknown in local recipient table

Last-Attempt-Date: Fri, 08 Sep 2017 06:04:54 -0700 (PDT)

For now I'll just drop this patch.

On 09/08/2017 10:04 AM, Philippe Mathieu-Daudé wrote:

ping?

On 08/30/2017 06:55 PM, Philippe Mathieu-Daudé wrote:

Signed-off-by: Philippe Mathieu-Daudé 
---
  MAINTAINERS | 1 +
  1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index fa74b7254b..20d65dca73 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1118,6 +1118,7 @@ L: qemu-bl...@nongnu.org
  S: Supported
  F: hw/scsi/megasas.c
  F: hw/scsi/mfi.h
+F: tests/megasas-test.c
  Network packet abstractions
  M: Dmitry Fleytman 





[Qemu-devel] [PATCH v3 00/15] add missing entries in MAINTAINERS

2017-09-08 Thread Philippe Mathieu-Daudé
Hi,

I tried to have a more helpful ./scripts/get_maintainer.pl output, filling
missing entries in MAINTAINERS.

Regards,

Phil.

v3:
- rebased, add R-b & A-b
- squashed ARM patches (Thomas Huth)
- remove 'megasas' patch, maintainer email not working

v2:
- add R-b & A-b
- clean ARM entries (Thomas Huth)
- moved files: comment since which commit (Eric Blake)
- drop inconsistent patches (default-configs.mak related to hw/machine, no CPU)
- drop unhappy patches (include/standard-headers/linux/*)
- drop unreplied patches

Philippe Mathieu-Daudé (15):
  MAINTAINERS: add missing ARM entries
  MAINTAINERS: add missing STM32 entry
  MAINTAINERS: add missing entry for vhost
  MAINTAINERS: add missing VMWare entry
  MAINTAINERS: add missing Guest Agent entries
  MAINTAINERS: add missing qcow2 entry
  MAINTAINERS: add missing USB entry
  MAINTAINERS: add missing PCI entries
  MAINTAINERS: add missing SSI entries
  MAINTAINERS: add missing entries for throttling infra
  MAINTAINERS: add missing AIO entry
  MAINTAINERS: add missing entry for Generic Loader
  MAINTAINERS: add missing Cryptography entry
  MAINTAINERS: update docs/devel/ entries
  MAINTAINERS: update docs/interop/ entries

 MAINTAINERS | 43 +--
 1 file changed, 33 insertions(+), 10 deletions(-)

-- 
2.14.1




Re: [Qemu-devel] [RFC v2 2/8] monitor: allow monitor to create thread to poll

2017-09-08 Thread Dr. David Alan Gilbert
* Peter Xu (pet...@redhat.com) wrote:
> On Fri, Aug 25, 2017 at 10:30:42AM +0100, Dr. David Alan Gilbert wrote:
> 
> [...]
> 
> > > >   c) As mentioned on irc there's fun to be had with cur_mon and error
> > > >  handling - in my local world I have cur_mon declared as __thread
> > > >  but never got around to thinking aobut what should set it up.
> > > >  There's also 'wavcapture: Convert to error_report' that I posted
> > > >  in March that got rid of some uses of cur_mon in wavcapture.c
> > > >  for error_report.
> > > 
> > > Yeh.  I at least also see a positive ACK from Markus in the other
> > > thread for per-thread cur_mon, sounds like this is the right way to
> > > go.
> > > 
> > > To setup cur_mon, what I can think of is create wrapper for
> > > pthread_create() in qemu_thread_create().  I see that we have done
> > > similar thing in util/qemu-thread-win32.c for Windows.  With that we
> > > can setup the cur_mon before going into real thread function but in
> > > the right context, though we may need one more parameter for current
> > > qemu_thread_create():
> > > 
> > > void qemu_thread_create(QemuThread *thread, const char *name,
> > >void *(*start_routine)(void*),
> > >void *arg, int mode, Monitor *mon);
> > > 
> > > Then we can specify monitor for any new thread (default to cur_mon).
> > > For per-monitor threads, I think we need to pass in that specific mon.
> > > 
> > > Is this doable?
> > 
> > That would mean changing all the qemu_thread_create calls, but yes
> > I guess is doable.  I'd thought the other way, perhaps you inherit
> > Monitor except in the case of when the monitor creates threads.
> 
> Do you mean setup cur_mon in monitor threads?
> 
> I'm afraid that may not be enough, since after we mark cur_mon as
> __thread variable, it should be NULL for each newly created threads,
> then we need to init them for every thread.  Or anything I missed?

Right, I thought you'd modify qemu_thread_create to setup cur_mon in
new threads to the same as the parent.

Dave

> [...]
> 
> > > > 
> > > >   d) I wonder if it's better to have thread as a flag, so that you have
> > > >  to explicitly ask for a monitor to have it's own thread.
> > > 
> > > This should be doable.  Would a new parameter for "-qmp" and "-hmp"
> > > suffice?
> > 
> > Yes.
> 
> (I meant "-monitor" when saying "-hmp")
> 
> Hmm, it seems not easy to simply add a new parameter for it, since we
> used "," already to parse the chardev params in monitor codes, like
> the usage of:
> 
>   -qmp telnet::,server,nowait
> 
> So I cannot simply do:
> 
>   -qmp telnet::,server,nowait,threaded=on
> 
> Or it will be treated for a parameter for chardev type "telnet".
> 
> I can at least add something similar to QEMU_OPTION_qmp_pretty, like:
> QEMU_OPTION_qmp_threaded, and maybe I also need
> QEMU_OPTION_monitor_pretty.  But I am thinking whether there can be
> anything better.  Any suggestion from anyone?
> 
> -- 
> Peter Xu
--
Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK



[Qemu-devel] [PATCH v3 03/15] MAINTAINERS: add missing entry for vhost

2017-09-08 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé 
Acked-by: Michael S. Tsirkin 
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index fb93e4b554..afc0072a17 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1029,6 +1029,7 @@ vhost
 M: Michael S. Tsirkin 
 S: Supported
 F: hw/*/*vhost*
+F: docs/interop/vhost-user.txt
 
 virtio
 M: Michael S. Tsirkin 
-- 
2.14.1




[Qemu-devel] [PATCH v3 02/15] MAINTAINERS: add missing STM32 entry

2017-09-08 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Thomas Huth 
Reviewed-by: Alistair Francis 
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 35c8c9c752..fb93e4b554 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -552,6 +552,7 @@ F: hw/char/stm32f2xx_usart.c
 F: hw/timer/stm32f2xx_timer.c
 F: hw/adc/*
 F: hw/ssi/stm32f2xx_spi.c
+F: include/hw/*/stm32*.h
 
 Netduino 2
 M: Alistair Francis 
-- 
2.14.1




[Qemu-devel] [PATCH v3 01/15] MAINTAINERS: add missing ARM entries

2017-09-08 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé 
Reviewed-by: Thomas Huth 
---
 MAINTAINERS | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 36eeb42d19..35c8c9c752 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -380,6 +380,7 @@ M: Peter Maydell 
 L: qemu-...@nongnu.org
 S: Maintained
 F: hw/char/pl011.c
+F: include/hw/char/pl011.h
 F: hw/display/pl110*
 F: hw/dma/pl080.c
 F: hw/dma/pl330.c
@@ -403,13 +404,15 @@ F: hw/intc/gic_internal.h
 F: hw/misc/a9scu.c
 F: hw/misc/arm11scu.c
 F: hw/timer/a9gtimer*
-F: hw/timer/arm_*
-F: include/hw/arm/arm.h
+F: hw/timer/arm*
+F: include/hw/arm/arm*.h
 F: include/hw/intc/arm*
 F: include/hw/misc/a9scu.h
 F: include/hw/misc/arm11scu.h
 F: include/hw/timer/a9gtimer.h
 F: include/hw/timer/arm_mptimer.h
+F: include/hw/timer/armv7m_systick.h
+F: tests/test-arm-mptimer.c
 
 Exynos
 M: Igor Mitsyanko 
@@ -512,6 +515,7 @@ M: Peter Maydell 
 L: qemu-...@nongnu.org
 S: Maintained
 F: hw/*/versatile*
+F: hw/misc/arm_sysctl.c
 
 Xilinx Zynq
 M: Edgar E. Iglesias 
-- 
2.14.1




Re: [Qemu-devel] [PATCH v2 12/17] MAINTAINERS: add missing megasas test entry

2017-09-08 Thread Philippe Mathieu-Daudé

I wonder if "megasas" is still maintained, I got:

To: Hannes Reinecke 
Final-Recipient: rfc822; h...@suse.de
Action: failed
Status: 5.1.1
Remote-MTA: dns; mx2.suse.de. (195.135.220.15, the server for the domain 
suse.de.)
Diagnostic-Code: smtp; 550 5.1.1 : Recipient address 
rejected: User unknown in local recipient table

Last-Attempt-Date: Fri, 08 Sep 2017 06:04:54 -0700 (PDT)

For now I'll just drop this patch.

On 09/08/2017 10:04 AM, Philippe Mathieu-Daudé wrote:

ping?

On 08/30/2017 06:55 PM, Philippe Mathieu-Daudé wrote:

Signed-off-by: Philippe Mathieu-Daudé 
---
  MAINTAINERS | 1 +
  1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index fa74b7254b..20d65dca73 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1118,6 +1118,7 @@ L: qemu-bl...@nongnu.org
  S: Supported
  F: hw/scsi/megasas.c
  F: hw/scsi/mfi.h
+F: tests/megasas-test.c
  Network packet abstractions
  M: Dmitry Fleytman 





Re: [Qemu-devel] [PATCH 1/1] AArch64: Fix single stepping of ERET instruction

2017-09-08 Thread Richard Henderson
On 09/08/2017 04:02 AM, Jaroslaw Pelczar wrote:
> Previously when single stepping through ERET instruction via GDB
> would result in debugger entering the "next" PC after ERET instruction.
> When debugging in kernel mode, this will also cause unintended behavior,
> because debugger will try to access memory from EL0 point of view.
> 
> Signed-off-by: Jaroslaw Pelczar 
> ---
>  target/arm/translate-a64.c | 1 +
>  1 file changed, 1 insertion(+)

Reviewed-by: Richard Henderson 


r~



[Qemu-devel] [Bug 1178101] Re: Could not enable gtk UI on build for Windows target

2017-09-08 Thread Thomas Huth
Triaging old bug tickets... can you still reproduce this issue with the
latest version of QEMU? Or could we close this ticket nowadays?

** Changed in: qemu
   Status: New => Incomplete

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1178101

Title:
  Could not enable gtk UI on build for Windows target

Status in QEMU:
  Incomplete

Bug description:
  $ ${QEMU_SRC_DIR}/configure --prefix=${BIN_ROOT} --cross-
  prefix=${HOST_TRIPLET}- --extra-cflags="-I${BIN_ROOT}/include"
  --extra-ldflags="-L${BIN_ROOT}/lib" --enable-gtk --disable-xen

  ERROR: User requested feature gtk
 configure was not able to find it

  
  $ cat config.log
  # QEMU configure log Thu May  9 13:50:40 CST 2013
  # Configured with: '/home/cauchy/vcs/git/qemu/configure' 
'--prefix=/home/cauchy/w32' '--cross-prefix=i686-w64-mingw32-' 
'--extra-cflags=-I/home/cauchy/w32/include' 
'--extra-ldflags=-L/home/cauchy/w32/lib' '--enable-gtk' '--disable-xen'
  #
  i686-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 
-Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings 
-Wmissing-prototypes -fno-strict-aliasing -I/home/cauchy/w32/include -c -o 
/tmp/qemu-conf--18025-.o /tmp/qemu-conf--18025-.c
  /tmp/qemu-conf--18025-.c:2:2: error: #error __linux__ not defined
   #error __linux__ not defined
^
  i686-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 
-Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings 
-Wmissing-prototypes -fno-strict-aliasing -I/home/cauchy/w32/include -c -o 
/tmp/qemu-conf--18025-.o /tmp/qemu-conf--18025-.c
  i686-w64-mingw32-gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 
-Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings 
-Wmissing-prototypes -fno-strict-aliasing -I/home/cauchy/w32/include -c -o 
/tmp/qemu-conf--18025-.o /tmp/qemu-conf--18025-.c
  i686-w64-mingw32-gcc -D__USE_MINGW_ANSI_STDIO=1 -DWIN32_LEAN_AND_MEAN 
-DWINVER=0x501 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 
-Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings 
-Wmissing-prototypes -fno-strict-aliasing -I/home/cauchy/w32/include -o 
/tmp/qemu-conf--18025-.exe /tmp/qemu-conf--18025-.c -g -L/home/cauchy/w32/lib 
-liberty
  i686-w64-mingw32-gcc -m32 -D__USE_MINGW_ANSI_STDIO=1 -DWIN32_LEAN_AND_MEAN 
-DWINVER=0x501 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 
-Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings 
-Wmissing-prototypes -fno-strict-aliasing -I/home/cauchy/w32/include -c -o 
/tmp/qemu-conf--18025-.o /tmp/qemu-conf--18025-.c
  i686-w64-mingw32-gcc -m32 -D__USE_MINGW_ANSI_STDIO=1 -DWIN32_LEAN_AND_MEAN 
-DWINVER=0x501 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 
-Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings 
-Wmissing-prototypes -fno-strict-aliasing -I/home/cauchy/w32/include -Werror 
-Winitializer-overrides -o /tmp/qemu-conf--18025-.exe /tmp/qemu-conf--18025-.c 
-m32 -g -L/home/cauchy/w32/lib
  i686-w64-mingw32-gcc: error: unrecognized command line option 
‘-Winitializer-overrides’
  i686-w64-mingw32-gcc -m32 -D__USE_MINGW_ANSI_STDIO=1 -DWIN32_LEAN_AND_MEAN 
-DWINVER=0x501 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 
-Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings 
-Wmissing-prototypes -fno-strict-aliasing -I/home/cauchy/w32/include -Werror 
-Wendif-labels -o /tmp/qemu-conf--18025-.exe /tmp/qemu-conf--18025-.c -m32 -g 
-L/home/cauchy/w32/lib
  i686-w64-mingw32-gcc -m32 -D__USE_MINGW_ANSI_STDIO=1 -DWIN32_LEAN_AND_MEAN 
-DWINVER=0x501 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 
-Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings 
-Wmissing-prototypes -fno-strict-aliasing -I/home/cauchy/w32/include 
-Wendif-labels -Werror -Wmissing-include-dirs -o /tmp/qemu-conf--18025-.exe 
/tmp/qemu-conf--18025-.c -m32 -g -L/home/cauchy/w32/lib
  i686-w64-mingw32-gcc -m32 -D__USE_MINGW_ANSI_STDIO=1 -DWIN32_LEAN_AND_MEAN 
-DWINVER=0x501 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 
-Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings 
-Wmissing-prototypes -fno-strict-aliasing -I/home/cauchy/w32/include 
-Wendif-labels -Wmissing-include-dirs -Werror -Wempty-body -o 
/tmp/qemu-conf--18025-.exe /tmp/qemu-conf--18025-.c -m32 -g 
-L/home/cauchy/w32/lib
  i686-w64-mingw32-gcc -m32 -D__USE_MINGW_ANSI_STDIO=1 -DWIN32_LEAN_AND_MEAN 
-DWINVER=0x501 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 
-Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings 
-Wmissing-prototypes -fno-strict-aliasing -I/home/cauchy/w32/include 
-Wendif-labels -Wmissing-include-dirs -Wempty-body -Werror -Wnested-externs -o 
/tmp/qemu-conf--18025-.exe /tmp/qemu-conf--18025-.c -m32 -g 
-L/home/cauchy/w32/lib
  i686-w64-mingw32-gcc -m32 -D__USE_MINGW_ANSI_STDIO=1 -DWIN32_LEAN_AND_MEAN 
-DWINVER

[Qemu-devel] [Bug 1060928] Re: Error in launch virtual server port

2017-09-08 Thread Thomas Huth
Triaging old bug tickets... can you anyhow still reproduce this issue
with the latest version of QEMU? Or could we close this ticket nowadays?

** Changed in: qemu
   Status: New => Incomplete

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1060928

Title:
  Error in launch virtual server port

Status in QEMU:
  Incomplete

Bug description:
  .- configure
  .- uname -a
  .- script bash launcher
  .- Error
  .- output serial.c in statusRUN

  ---

  .- configure

  ./configure --target-list=i386-softmmu,x86_64-softmmu,\
  i386-linux-user,x86_64-linux-user --enable-vde --disable-vnc --enable-sdl \
  --audio-drv-list=oss,alsa,sdl,esd,pa \
  --audio-card-list=ac97,es1370,sb16,cs4231a,adlib,gus,hda &>status

  ---

  .- uname -a
  Linux Aspire5250 3.2.0-23-generic #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 2012 
x86_64 x86_64 x86_64 GNU/Linux

  ---

  .- script bash launcher

  #!/bin/bash

  qemu-system-i386 -m 128 -display sdl -cpu pentium \
  -k es \
  -net nic,vlan=0,macaddr=52:54:00:12:02:04,model=pcnet \
  -net vde,vlan=0,sock=/var/run/vde2/tap0.ctl \
  -serial unix:/tmp/com1,server,nowait \
  -vga cirrus \
  -boot c -hda "/home/VirtualMachines/Discos/Hispa70_1.vmdk" \
  -cdrom "/home/VirtualMachines/CDROM/hf-7.0a.iso" 2>statusRUN

  echo -n "Pulsa enter para continuar . . . " && read REPLY

  ---

  .- Error

  *** buffer overflow detected ***: qemu-system-i386 terminated
  === Backtrace: =
  /lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x37)[0x7f2759892007]
  /lib/x86_64-linux-gnu/libc.so.6(+0x107f00)[0x7f2759890f00]
  /lib/x86_64-linux-gnu/libc.so.6(+0x108fbe)[0x7f2759891fbe]
  qemu-system-i386(+0xe5153)[0x7f275bfd8153]
  qemu-system-i386(+0x1744f6)[0x7f275c0674f6]
  qemu-system-i386(main+0xe77)[0x7f275bf5ef37]
  /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed)[0x7f27597aa76d]
  qemu-system-i386(+0x70229)[0x7f275bf63229]
  === Memory map: 
  41912000-43912000 rwxp  00:00 0 
  7f273000-7f2730054000 rw-p  00:00 0 
  7f2730054000-7f273400 ---p  00:00 0 
  7f2736539000-7f273bdff000 r--p  08:05 1978631
/usr/lib/locale/locale-archive
  7f273bdff000-7f273be0 rw-p  00:00 0 
  7f273be0-7f2743e0 rw-p  00:00 0 
  7f2743e0-7f274400 rw-p  00:00 0 
  7f274400-7f2744021000 rw-p  00:00 0 
  7f2744021000-7f274800 ---p  00:00 0 
  7f274c00-7f274c021000 rw-p  00:00 0 
  7f274c021000-7f275000 ---p  00:00 0 
  7f27500c5000-7f27500ca000 r-xp  08:05 1979531
/usr/lib/x86_64-linux-gnu/libXfixes.so.3.1.0
  7f27500ca000-7f27502c9000 ---p 5000 08:05 1979531
/usr/lib/x86_64-linux-gnu/libXfixes.so.3.1.0
  7f27502c9000-7f27502ca000 r--p 4000 08:05 1979531
/usr/lib/x86_64-linux-gnu/libXfixes.so.3.1.0
  7f27502ca000-7f27502cb000 rw-p 5000 08:05 1979531
/usr/lib/x86_64-linux-gnu/libXfixes.so.3.1.0
  7f27502cb000-7f27502d4000 r-xp  08:05 1979549
/usr/lib/x86_64-linux-gnu/libXrender.so.1.3.0
  7f27502d4000-7f27504d3000 ---p 9000 08:05 1979549
/usr/lib/x86_64-linux-gnu/libXrender.so.1.3.0
  7f27504d3000-7f27504d4000 r--p 8000 08:05 1979549
/usr/lib/x86_64-linux-gnu/libXrender.so.1.3.0
  7f27504d4000-7f27504d5000 rw-p 9000 08:05 1979549
/usr/lib/x86_64-linux-gnu/libXrender.so.1.3.0
  7f27504d5000-7f27504de000 r-xp  08:05 1979523
/usr/lib/x86_64-linux-gnu/libXcursor.so.1.0.2
  7f27504de000-7f27506dd000 ---p 9000 08:05 1979523
/usr/lib/x86_64-linux-gnu/libXcursor.so.1.0.2
  7f27506dd000-7f27506de000 r--p 8000 08:05 1979523
/usr/lib/x86_64-linux-gnu/libXcursor.so.1.0.2
  7f27506de000-7f27506df000 rw-p 9000 08:05 1979523
/usr/lib/x86_64-linux-gnu/libXcursor.so.1.0.2
  7f27506df000-7f2750763000 rw-p  00:00 0 
  7f2750775000-7f2750776000 rw-p  00:00 0 
  7f2750776000-7f275089 rw-s  00:04 1736706
/SYSV (deleted)
  7f275089-7f2750a0 rw-p  00:00 0 
  7f2750a0-7f275120 rw-p  00:00 0 
  7f275120-7f2751291000 rw-p  00:00 0 
  7f2751291000-7f2751292000 ---p  00:00 0 
  7f2751292000-7f2751a92000 rw-p  00:00 0 
  7f2751a92000-7f2751a93000 ---p  00:00 0 
  7f2751a93000-7f2752293000 rw-p  00:00 0 
  7f2752293000-7f2752294000 ---p  00:00 0 
  7f2752294000-7f2752a94000 rw-p  00:00 0 
  7f2752a94000-7f2752a95000 ---p  00:00 0 
  7f2752a95000-7f2753295000 rw-p  00:00 0 
  7f2753295000-7f2753296000 ---p

[Qemu-devel] [Bug 1196426] Re: Setup virtual serial connection for Windows VMs FAILS

2017-09-08 Thread Thomas Huth
Triaging old bug tickets... can you still reproduce this issue with the
latest version of QEMU? Or could we close this ticket nowadays?

** Changed in: qemu
   Status: New => Incomplete

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1196426

Title:
  Setup virtual serial connection for Windows VMs FAILS

Status in QEMU:
  Incomplete

Bug description:
  Hi,

  To setup a virtual serial connections between two Windows 2008 R2(64-bit) 
guest VMs, I am referring the link 
  http://www.linux-kvm.org/page/WindowsGuestDrivers/UpdatedGuestDebugging

  I started the host VM using the command
  # /usr/local/bin/qemu-system-x86_64 -smp 1 -enable-kvm -m 512 -boot c 
-chardev stdio,id=mon0 -mon chardev=mon0 -serial tcp::4445,server,nowait -hda 
/mnt/sda5/var/lib/libvirt/images/win2008host.img 

  To start a target VM, the link specifies the below command
  /usr/local/bin/qemu-system-x86_64 \--enable-kvm \-m 1024 \-drive 
file=win-target.img \-chardev stdio,id=mon0 \-mdev=mon0 \-serial 
tcp:127.0.0.1:4445.

  I am using the QEMU emulator version 0.15.1 (qemu-kvm-0.15.1). The
  command is lil bit changed and also doesn't have -mdev option. I
  executed the below command.

  # /usr/local/bin/qemu-system-x86_64 -enable-kvm -smp 1 -m 512 -boot c
  -chardev stdio,id=mon0 -mon chardev=mon0 -serial tcp:127.0.0.1:4455
  -hda /var/lib/libvirt/images/win2008target.img

  It through the error 
  inet_connect_opts: connect(ipv4,127.0.0.1,127.0.0.1,4455): Connection refused
  chardev: opening backend "socket" failed: Connection refused
  qemu: could not open serial device 'tcp:127.0.0.1:4455': Connection refused

  Please let me know if any one knows how to fix issue.

  My Linux System Info:
  # cat /etc/redhat-release 
  Fedora release 12 (Constantine)

  # uname -a
  Linux petla 2.6.31.5-127.fc12.x86_64 #1 SMP Sat Nov 7 21:11:14 EST 2009 
x86_64 x86_64 x86_64 GNU/Linux

  #cat /proc/cpuinfo
  processor : 0
  vendor_id : GenuineIntel
  cpu family: 6
  model : 44
  model name: Intel(R) Xeon(R) CPU   E5645  @ 2.40GHz

  #/usr/local/bin/qemu-system-x86_64 --version
  QEMU emulator version 0.15.1 (qemu-kvm-0.15.1), Copyright (c) 2003-2008 
Fabrice Bellard

  Guest VMs(host and target): Windows Server 2008 R2 (64-bit)

  Thanks in Advance
  Venkatesh

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1196426/+subscriptions



[Qemu-devel] [Bug 1135567] Re: QXL crashes a Windows 7 guest if host goes into screensaver

2017-09-08 Thread Thomas Huth
Triaging old bug tickets... can you still reproduce this issue with the
latest version of QEMU? Or could we close this ticket nowadays?

** Changed in: qemu
   Status: New => Incomplete

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1135567

Title:
  QXL crashes a Windows 7 guest if host goes into screensaver

Status in QEMU:
  Incomplete

Bug description:
  Note: if further information is required, I'll be glad to supply it.

  I am using on the host
  - HP z800 with 72GB RAM and 2x x5680
  - Gentoo 64-bit host (3.7.9 kernel, FGLRX RADEON driver 13.1)
  - LIBVIRT 1.0.2 with QEMU(-KVM) 1.4.0

  The guest:
  - Windows 7 32-bit
  - 2GB allocated
  - 2 CPU
  - using virtio for everything (disk,net,memballoon)
  - Display = SPICE with spice channel
  - Video driver is qxl (ram says 64MB)
  - Spice-guest-tools 0.52 installed

  When I use QXL and  have the guest open in Virt-Manager/Virt-Viewer
  and let the host go into screensaver mode, the Win7 crashes hard.

  When I change video to VGA, it survives the screen saver,  no problem
  at all ,smooth sailing.

  regards

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1135567/+subscriptions



[Qemu-devel] [Bug 1061778] Re: signal mask not reset on exec

2017-09-08 Thread Thomas Huth
Triaging old bug tickets... can you still reproduce this issue with the
latest version of QEMU? Or could we close this ticket nowadays?

** Changed in: qemu
   Status: New => Incomplete

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1061778

Title:
  signal mask not reset on exec

Status in QEMU:
  Incomplete

Bug description:
  Seen in qemu-1.0 under 12.04, but AFAICT from current git it hasn't
  changed.

  ./main-loop.c:qemu_signal_init blocks SIGALRM so it can be handled via
  signalfd.

  ./net/tap.c:launch_script does not reset the signal mask before the
  execv() call, and signal masks are inherited. So the script is run
  with SIGALRM blocked (as can be seen in /proc/$$/status, "SigBlk:
  2000"). One reasonable example of where this bites is an
  interface up script that calls ping with a timeout to give things a
  chance to settle down before continuing, but abort if this doesn't
  happen within a reasonable time). Since ping uses SIGALRM for the
  timeout, this now never terminates.

  qemu-0.14 didn't block SIGALRM, so such scripts worked fine there.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1061778/+subscriptions



  1   2   3   4   5   >