[Qemu-devel] [Bug 1567254] Re: qemu-2.5.1 will not run with gtk3/vte

2019-03-22 Thread Thomas Huth
Looking through old bug tickets... can you still reproduce these issues
with the latest version of QEMU?

** 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/1567254

Title:
  qemu-2.5.1 will not run with gtk3/vte

Status in QEMU:
  Incomplete

Bug description:
  Using qemu-2.5.1 and compiling without gtk3 and vte-2.90.

  This works:

  CC="gcc -mtune=generic -Os -pipe" CXX="g++ -mtune=generic -Os -pipe
  -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local
  --localstatedir=/var --libexecdir=/usr/local/lib/qemu --interp-
  prefix=/usr/local/share/qemu --audio-drv-list="oss alsa sdl" --target-
  list="i386-softmmu i386-linux-user x86_64-softmmu x86_64-linux-user"
  --smbd=/usr/local/sbin/smbd --disable-curses

  find . -name config-host.mak -type f -exec sed -i 's/-O2//g' {} \;

  make
  sudo make install

  If I then add gtk3 and vte-2.90 development files and compile again,
  this fails with or without --disable-docs:

   sudo make install
  ...
  make -C po install
  make[1]: Entering directory '/usr/src/qemu-2.5.1/po'
GEN   tr.mo
  /bin/sh: msgfmt: not found
  Makefile:13: recipe for target 'tr.mo' failed
  make[1]: *** [tr.mo] Error 127
  make[1]: Leaving directory '/usr/src/qemu-2.5.1/po'
  Makefile:443: recipe for target 'install' failed
  make: *** [install] Error 2

  If I then add gettext and re-compile, "qemu-system-x86_64 -blah-blah"
  opens a window, displays the bios message and stops.

  * configure script should check for gettext
  * if "--disable-docs" is passed, "make install" should not try to install docs
  * qemu should work when compiled with gtk3 and vte
  * why does qemu insist on vte-2.90, when vte-2.91 has been out +/- 2 years?

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



Re: [Qemu-devel] [PATCH 8/8] Clean up decorations and whitespace around header guards

2019-03-22 Thread Alistair Francis
On Fri, Mar 15, 2019 at 4:54 AM Markus Armbruster  wrote:
>
> Cleaned up with scripts/clean-header-guards.pl.
>
> Signed-off-by: Markus Armbruster 

For the RISC-V part:

Reviewed-by: Alistair Francis 

Alistair

> ---
>  hw/ide/ahci_internal.h  | 2 +-
>  include/block/aio-wait.h| 2 +-
>  include/exec/translator.h   | 2 +-
>  include/hw/arm/nrf51_soc.h  | 1 -
>  include/hw/arm/smmu-common.h| 2 +-
>  include/hw/misc/imx2_wdt.h  | 2 +-
>  include/hw/misc/nrf51_rng.h | 3 ++-
>  include/hw/pci-host/designware.h| 2 +-
>  include/hw/riscv/sifive_plic.h  | 1 -
>  include/qemu/pmem.h | 2 +-
>  target/xtensa/xtensa-isa-internal.h | 2 +-
>  tests/acpi-utils.h  | 2 +-
>  tests/tpm-emu.h | 2 +-
>  13 files changed, 12 insertions(+), 13 deletions(-)
>
> diff --git a/hw/ide/ahci_internal.h b/hw/ide/ahci_internal.h
> index 9b7fa8fc7d..95ecddcd3c 100644
> --- a/hw/ide/ahci_internal.h
> +++ b/hw/ide/ahci_internal.h
> @@ -394,4 +394,4 @@ void ahci_reset(AHCIState *s);
>
>  #define SYSBUS_AHCI(obj) OBJECT_CHECK(SysbusAHCIState, (obj), 
> TYPE_SYSBUS_AHCI)
>
> -#endif /* HW_IDE_AHCI_H */
> +#endif /* HW_IDE_AHCI_INTERNAL_H */
> diff --git a/include/block/aio-wait.h b/include/block/aio-wait.h
> index afd0ff7eb8..afeeb18f95 100644
> --- a/include/block/aio-wait.h
> +++ b/include/block/aio-wait.h
> @@ -124,4 +124,4 @@ void aio_wait_kick(void);
>   */
>  void aio_wait_bh_oneshot(AioContext *ctx, QEMUBHFunc *cb, void *opaque);
>
> -#endif /* QEMU_AIO_WAIT */
> +#endif /* QEMU_AIO_WAIT_H */
> diff --git a/include/exec/translator.h b/include/exec/translator.h
> index 71e7b2c347..f327242576 100644
> --- a/include/exec/translator.h
> +++ b/include/exec/translator.h
> @@ -141,4 +141,4 @@ void translator_loop(const TranslatorOps *ops, 
> DisasContextBase *db,
>
>  void translator_loop_temp_check(DisasContextBase *db);
>
> -#endif  /* EXEC__TRANSLATOR_H */
> +#endif /* EXEC__TRANSLATOR_H */
> diff --git a/include/hw/arm/nrf51_soc.h b/include/hw/arm/nrf51_soc.h
> index fd7fcc71a5..0cb78aafea 100644
> --- a/include/hw/arm/nrf51_soc.h
> +++ b/include/hw/arm/nrf51_soc.h
> @@ -53,4 +53,3 @@ typedef struct NRF51State {
>  } NRF51State;
>
>  #endif
> -
> diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h
> index b07cadd0ef..9a6ac64c97 100644
> --- a/include/hw/arm/smmu-common.h
> +++ b/include/hw/arm/smmu-common.h
> @@ -167,4 +167,4 @@ void smmu_inv_notifiers_all(SMMUState *s);
>  /* Unmap the range of all the notifiers registered to @mr */
>  void smmu_inv_notifiers_mr(IOMMUMemoryRegion *mr);
>
> -#endif  /* HW_ARM_SMMU_COMMON */
> +#endif /* HW_ARM_SMMU_COMMON_H */
> diff --git a/include/hw/misc/imx2_wdt.h b/include/hw/misc/imx2_wdt.h
> index 8afc99a10e..b91b002528 100644
> --- a/include/hw/misc/imx2_wdt.h
> +++ b/include/hw/misc/imx2_wdt.h
> @@ -30,4 +30,4 @@ typedef struct IMX2WdtState {
>  MemoryRegion mmio;
>  } IMX2WdtState;
>
> -#endif /* IMX7_SNVS_H */
> +#endif /* IMX2_WDT_H */
> diff --git a/include/hw/misc/nrf51_rng.h b/include/hw/misc/nrf51_rng.h
> index 3d6bf79997..b0133bf665 100644
> --- a/include/hw/misc/nrf51_rng.h
> +++ b/include/hw/misc/nrf51_rng.h
> @@ -30,6 +30,7 @@
>   * the COPYING file in the top-level directory.
>   *
>   */
> +
>  #ifndef NRF51_RNG_H
>  #define NRF51_RNG_H
>
> @@ -80,4 +81,4 @@ typedef struct {
>  } NRF51RNGState;
>
>
> -#endif /* NRF51_RNG_H_ */
> +#endif /* NRF51_RNG_H */
> diff --git a/include/hw/pci-host/designware.h 
> b/include/hw/pci-host/designware.h
> index a4f2c0695b..186bb36238 100644
> --- a/include/hw/pci-host/designware.h
> +++ b/include/hw/pci-host/designware.h
> @@ -99,4 +99,4 @@ typedef struct DesignwarePCIEHost {
>  MemoryRegion mmio;
>  } DesignwarePCIEHost;
>
> -#endif  /* DESIGNWARE_H */
> +#endif /* DESIGNWARE_H */
> diff --git a/include/hw/riscv/sifive_plic.h b/include/hw/riscv/sifive_plic.h
> index 688cd97f82..ce8907f6aa 100644
> --- a/include/hw/riscv/sifive_plic.h
> +++ b/include/hw/riscv/sifive_plic.h
> @@ -80,4 +80,3 @@ DeviceState *sifive_plic_create(hwaddr addr, char 
> *hart_config,
>  uint32_t aperture_size);
>
>  #endif
> -
> diff --git a/include/qemu/pmem.h b/include/qemu/pmem.h
> index dfb6d0da62..d2d7ad085c 100644
> --- a/include/qemu/pmem.h
> +++ b/include/qemu/pmem.h
> @@ -33,4 +33,4 @@ pmem_persist(const void *addr, size_t len)
>
>  #endif /* CONFIG_LIBPMEM */
>
> -#endif /* !QEMU_PMEM_H */
> +#endif /* QEMU_PMEM_H */
> diff --git a/target/xtensa/xtensa-isa-internal.h 
> b/target/xtensa/xtensa-isa-internal.h
> index c29295ff96..40dd8bac96 100644
> --- a/target/xtensa/xtensa-isa-internal.h
> +++ b/target/xtensa/xtensa-isa-internal.h
> @@ -228,4 +228,4 @@ int xtensa_isa_name_compare(const void *, const void *);
>  extern xtensa_isa_status xtisa_errno;
>  extern char xtisa_error_msg[];
>
> -#endif /* !XTENSA_ISA_INTERNAL_H */
> +#endif /* XTENSA_ISA_INTERNAL_H */
> diff --git a/tests/acpi-utils.h b/tests/acpi-ut

Re: [Qemu-devel] [PATCH 6/8] Clean up ill-advised or unusual header guards

2019-03-22 Thread Alistair Francis
On Fri, Mar 15, 2019 at 7:16 AM Markus Armbruster  wrote:
>
> Philippe Mathieu-Daudé  writes:
>
> > On 3/15/19 3:51 PM, Markus Armbruster wrote:
> >> Leading underscores are ill-advised because such identifiers are
> >> reserved.  Trailing underscores are merely ugly.  Strip both.
> >>
> >> Our header guards commonly end in _H.  Normalize the exceptions.
> >>
> >> Done with scripts/clean-header-guards.pl.
> >>
> >> Signed-off-by: Markus Armbruster 

For the RISC-V patch:

Reviewed-by: Alistair Francis 

Alistair

> >> ---
> >>  block/crypto.h | 6 +++---
> >>  hw/i386/amd_iommu.h| 4 ++--
> >>  hw/tpm/tpm_ioctl.h | 7 ---
> >>  hw/xtensa/xtensa_memory.h  | 4 ++--
> >>  include/authz/base.h   | 7 +++
> >>  include/authz/list.h   | 7 +++
> >>  include/authz/simple.h | 7 +++
> >>  include/chardev/spice.h| 4 ++--
> >>  include/hw/ppc/pnv.h   | 7 ---
> >>  include/hw/ppc/pnv_core.h  | 7 ---
> >>  include/hw/ppc/pnv_lpc.h   | 7 ---
> >>  include/hw/ppc/pnv_occ.h   | 7 ---
> >>  include/hw/ppc/pnv_psi.h   | 7 ---
> >>  include/hw/ppc/pnv_xscom.h | 7 ---
> >>  include/hw/ppc/spapr_ovec.h| 7 ---
> >>  include/hw/timer/pl031.h   | 4 ++--
> >>  include/hw/virtio/vhost-vsock.h| 6 +++---
> >>  include/hw/virtio/virtio-crypto.h  | 6 +++---
> >>  include/hw/xen/start_info.h| 6 +++---
> >>  include/hw/xtensa/mx_pic.h | 4 ++--
> >>  include/qemu/drm.h | 4 ++--
> >>  include/qemu/jhash.h   | 6 +++---
> >>  include/sysemu/hvf.h   | 5 +++--
> >>  linux-user/xtensa/syscall_nr.h | 6 +++---
> >>  linux-user/xtensa/target_structs.h | 4 ++--
> >>  linux-user/xtensa/termbits.h   | 6 +++---
> >>  qga/vss-win32/vss-handles.h| 4 ++--
> >>  slirp/src/debug.h  | 6 +++---
> >>  slirp/src/stream.h | 6 +++---
> >>  slirp/src/util.h   | 5 +++--
> >>  slirp/src/vmstate.h| 5 +++--
> >>  target/i386/hax-i386.h | 4 ++--
> >>  target/i386/hax-interface.h| 4 ++--
> >>  target/i386/hvf/hvf-i386.h | 4 ++--
> >>  target/i386/hvf/vmcs.h | 4 ++--
> >>  target/i386/hvf/x86_emu.h  | 5 +++--
> >>  target/i386/hvf/x86_flags.h| 7 ---
> >>  target/i386/hvf/x86_mmu.h  | 7 ---
> >>  target/riscv/pmp.h | 4 ++--
> >>  target/sparc/asi.h | 6 +++---
> >>  tests/libqos/e1000e.h  | 4 ++--
> >>  tests/libqos/sdhci.h   | 4 ++--
> >>  42 files changed, 121 insertions(+), 110 deletions(-)
> >>
> >> diff --git a/block/crypto.h b/block/crypto.h
> >> index dd7d47903c..b935695e79 100644
> >> --- a/block/crypto.h
> >> +++ b/block/crypto.h
> >> @@ -18,8 +18,8 @@
> >>   *
> >>   */
> >>
> >> -#ifndef BLOCK_CRYPTO_H__
> >> -#define BLOCK_CRYPTO_H__
> >> +#ifndef BLOCK_CRYPTO_H
> >> +#define BLOCK_CRYPTO_H
> >>
> >>  #define BLOCK_CRYPTO_OPT_DEF_KEY_SECRET(prefix, helpstr)\
> >>  {   \
> >> @@ -94,4 +94,4 @@ block_crypto_create_opts_init(QDict *opts, Error **errp);
> >>  QCryptoBlockOpenOptions *
> >>  block_crypto_open_opts_init(QDict *opts, Error **errp);
> >>
> >> -#endif /* BLOCK_CRYPTO_H__ */
> >> +#endif /* BLOCK_CRYPTO_H */
> >> diff --git a/hw/i386/amd_iommu.h b/hw/i386/amd_iommu.h
> >> index 0ff9095f32..3a694b186b 100644
> >> --- a/hw/i386/amd_iommu.h
> >> +++ b/hw/i386/amd_iommu.h
> >> @@ -18,8 +18,8 @@
> >>   * with this program; if not, see .
> >>   */
> >>
> >> -#ifndef AMD_IOMMU_H_
> >> -#define AMD_IOMMU_H_
> >> +#ifndef AMD_IOMMU_H
> >> +#define AMD_IOMMU_H
> >>
> >>  #include "hw/hw.h"
> >>  #include "hw/pci/pci.h"
> >> diff --git a/hw/tpm/tpm_ioctl.h b/hw/tpm/tpm_ioctl.h
> >> index 59a0b0595d..f5f5c553a9 100644
> >> --- a/hw/tpm/tpm_ioctl.h
> >> +++ b/hw/tpm/tpm_ioctl.h
> >> @@ -5,8 +5,9 @@
> >>   *
> >>   * This file is licensed under the terms of the 3-clause BSD license
> >>   */
> >> -#ifndef _TPM_IOCTL_H_
> >> -#define _TPM_IOCTL_H_
> >> +
> >> +#ifndef TPM_IOCTL_H
> >> +#define TPM_IOCTL_H
> >>
> >>  #include 
> >>  #include 
> >> @@ -267,4 +268,4 @@ enum {
> >>  CMD_SET_BUFFERSIZE,
> >>  };
> >>
> >> -#endif /* _TPM_IOCTL_H */
> >> +#endif /* TPM_IOCTL_H */
> >> diff --git a/hw/xtensa/xtensa_memory.h b/hw/xtensa/xtensa_memory.h
> >> index e9aa08749d..89125c4a0d 100644
> >> --- a/hw/xtensa/xtensa_memory.h
> >> +++ b/hw/xtensa/xtensa_memory.h
> >> @@ -25,8 +25,8 @@
> >>   * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> >>   */
> >>
> >> -#ifndef _XTENSA_MEMORY_H
> >> -#define _XTENSA_MEMORY_H
> >> +#ifndef XTENSA_MEMORY_H
> >> +#define XTENSA_MEMORY_H
> >>
> >>  #include "qemu-common.h"
> >>  #include "cpu.h"
> >> diff --git a/include/authz/base.h

Re: [Qemu-devel] [PATCH 3/8] linux-user/nios2 linux-user/riscv: Clean up header guards

2019-03-22 Thread Alistair Francis
On Fri, Mar 15, 2019 at 6:17 AM Philippe Mathieu-Daudé
 wrote:
>
> On 3/15/19 3:51 PM, Markus Armbruster wrote:
> > Reuse of the same guard symbol in multiple headers is okay as long as
> > they cannot be included together.  scripts/clean-header-guards.pl
> > can't tell, so it warns.
> >
> > Since we can avoid guard symbol reuse easily, do so: use guard symbol
> > ${target^^}_${fname^^} for linux-user/$target/$fname, just like we did
> > in commit a9c94277f0..3500385697.
> >
> > Signed-off-by: Markus Armbruster 
>
> Reviewed-by: Philippe Mathieu-Daudé 

Reviewed-by: Alistair Francis 

Alistair

>
> > ---
> >  linux-user/nios2/target_cpu.h | 4 ++--
> >  linux-user/nios2/target_signal.h  | 6 +++---
> >  linux-user/nios2/target_structs.h | 4 ++--
> >  linux-user/nios2/target_syscall.h | 6 +++---
> >  linux-user/riscv/target_cpu.h | 4 ++--
> >  linux-user/riscv/target_signal.h  | 6 +++---
> >  linux-user/riscv/target_structs.h | 4 ++--
> >  7 files changed, 17 insertions(+), 17 deletions(-)
> >
> > diff --git a/linux-user/nios2/target_cpu.h b/linux-user/nios2/target_cpu.h
> > index 14f63338fa..5596c05c9c 100644
> > --- a/linux-user/nios2/target_cpu.h
> > +++ b/linux-user/nios2/target_cpu.h
> > @@ -17,8 +17,8 @@
> >   * License along with this library; if not, see 
> > .
> >   */
> >
> > -#ifndef TARGET_CPU_H
> > -#define TARGET_CPU_H
> > +#ifndef NIOS2_TARGET_CPU_H
> > +#define NIOS2_TARGET_CPU_H
> >
> >  static inline void cpu_clone_regs(CPUNios2State *env, target_ulong newsp)
> >  {
> > diff --git a/linux-user/nios2/target_signal.h 
> > b/linux-user/nios2/target_signal.h
> > index 7776bcdbfd..fe48721b3d 100644
> > --- a/linux-user/nios2/target_signal.h
> > +++ b/linux-user/nios2/target_signal.h
> > @@ -1,5 +1,5 @@
> > -#ifndef TARGET_SIGNAL_H
> > -#define TARGET_SIGNAL_H
> > +#ifndef NIOS2_TARGET_SIGNAL_H
> > +#define NIOS2_TARGET_SIGNAL_H
> >
> >  /* this struct defines a stack used during syscall handling */
> >
> > @@ -18,4 +18,4 @@ typedef struct target_sigaltstack {
> >
> >  #include "../generic/signal.h"
> >
> > -#endif /* TARGET_SIGNAL_H */
> > +#endif /* NIOS2_TARGET_SIGNAL_H */
> > diff --git a/linux-user/nios2/target_structs.h 
> > b/linux-user/nios2/target_structs.h
> > index 8713772089..7145251706 100644
> > --- a/linux-user/nios2/target_structs.h
> > +++ b/linux-user/nios2/target_structs.h
> > @@ -16,8 +16,8 @@
> >   * You should have received a copy of the GNU Lesser General Public
> >   * License along with this library; if not, see 
> > .
> >   */
> > -#ifndef TARGET_STRUCTS_H
> > -#define TARGET_STRUCTS_H
> > +#ifndef NIOS2_TARGET_STRUCTS_H
> > +#define NIOS2_TARGET_STRUCTS_H
> >
> >  struct target_ipc_perm {
> >  abi_int __key;  /* Key.  */
> > diff --git a/linux-user/nios2/target_syscall.h 
> > b/linux-user/nios2/target_syscall.h
> > index ca6b7e69f6..f3b2a500f4 100644
> > --- a/linux-user/nios2/target_syscall.h
> > +++ b/linux-user/nios2/target_syscall.h
> > @@ -1,5 +1,5 @@
> > -#ifndef TARGET_SYSCALL_H
> > -#define TARGET_SYSCALL_H
> > +#ifndef NIOS2_TARGET_SYSCALL_H
> > +#define NIOS2_TARGET_SYSCALL_H
> >
> >  #define UNAME_MACHINE "nios2"
> >  #define UNAME_MINIMUM_RELEASE "3.19.0"
> > @@ -34,4 +34,4 @@ struct target_pt_regs {
> >  #define TARGET_MLOCKALL_MCL_CURRENT 1
> >  #define TARGET_MLOCKALL_MCL_FUTURE  2
> >
> > -#endif  /* TARGET_SYSCALL_H */
> > +#endif /* NIOS2_TARGET_SYSCALL_H */
> > diff --git a/linux-user/riscv/target_cpu.h b/linux-user/riscv/target_cpu.h
> > index 7e090f376a..90f9a4171e 100644
> > --- a/linux-user/riscv/target_cpu.h
> > +++ b/linux-user/riscv/target_cpu.h
> > @@ -1,5 +1,5 @@
> > -#ifndef TARGET_CPU_H
> > -#define TARGET_CPU_H
> > +#ifndef RISCV_TARGET_CPU_H
> > +#define RISCV_TARGET_CPU_H
> >
> >  static inline void cpu_clone_regs(CPURISCVState *env, target_ulong newsp)
> >  {
> > diff --git a/linux-user/riscv/target_signal.h 
> > b/linux-user/riscv/target_signal.h
> > index c8b1455800..f113ba9a55 100644
> > --- a/linux-user/riscv/target_signal.h
> > +++ b/linux-user/riscv/target_signal.h
> > @@ -1,5 +1,5 @@
> > -#ifndef TARGET_SIGNAL_H
> > -#define TARGET_SIGNAL_H
> > +#ifndef RISCV_TARGET_SIGNAL_H
> > +#define RISCV_TARGET_SIGNAL_H
> >
> >  typedef struct target_sigaltstack {
> >  abi_ulong ss_sp;
> > @@ -15,4 +15,4 @@ typedef struct target_sigaltstack {
> >
> >  #include "../generic/signal.h"
> >
> > -#endif /* TARGET_SIGNAL_H */
> > +#endif /* RISCV_TARGET_SIGNAL_H */
> > diff --git a/linux-user/riscv/target_structs.h 
> > b/linux-user/riscv/target_structs.h
> > index 4f0462c497..ea3e5ed17e 100644
> > --- a/linux-user/riscv/target_structs.h
> > +++ b/linux-user/riscv/target_structs.h
> > @@ -4,8 +4,8 @@
> >   * This is a copy of ../aarch64/target_structs.h atm.
> >   *
> >   */
> > -#ifndef TARGET_STRUCTS_H
> > -#define TARGET_STRUCTS_H
> > +#ifndef RISCV_TARGET_STRUCTS_H
> > +#define RISCV_TARGET_STRUCTS_H
> >
> >  struct target_ipc_perm {
> >  abi_int

Re: [Qemu-devel] [PATCH] MAINTAINERS: DT: Remove myself and degrade

2019-03-22 Thread Alistair Francis
On Thu, Mar 21, 2019 at 11:49 PM Peter Maydell  wrote:
>
> Alex and I just noticed that we didn't pick up this
> MAINTAINERS patch for the "Device Tree" section.
> In the interim Peter Crosthwaite has also removed himself
> from maintainership, so by default this will move into
> the "Orphan" state. Is anybody interested in taking up
> the maintainership role here? In practice it doesn't really
> need much care as mostly it's dealt with by the people
> who maintain the boards that use the dtb utility code
> (currently arm, ppc, riscv) and there's not much change
> in this area.

I am happy to take this over. I have a fair bit of experience with
device trees so it should be straight forward.

I can send a patch adding me as a maintainer when I'm back in the
office next week.

Alistair

>
> On Tue, 30 Oct 2018 at 09:40, Alexander Graf  wrote:
> >
> > I haven't really maintained the device tree infrastructure in QEMU for a 
> > long
> > time by now. I also haven't seen Peter work on the code for the last 2 
> > years,
> > so let's put it into Odd Fixes to make room for others to step up :).
> >
> > Signed-off-by: Alexander Graf 
> > ---
> >  MAINTAINERS | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index 8bc9a594da..08ea12172e 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -1548,8 +1548,7 @@ F: include/qom/cpu.h
> >
> >  Device Tree
> >  M: Peter Crosthwaite 
> > -M: Alexander Graf 
> > -S: Maintained
> > +S: Odd Fixes
> >  F: device_tree.c
> >  F: include/sysemu/device_tree.h
>
> thanks
> -- PMM
>



Re: [Qemu-devel] [PATCH] target/arm: default config

2019-03-22 Thread Thomas Huth
On 22/03/2019 17.30, Andrew Jones wrote:
> In the kconfig shuffle arm lost pci-testdev which is used by
> kvm-unit-tests. Let's add it back.

... the other architectures use "imply TEST_DEVICES" in the Kconfig
files, but since the Kconfig-for-arm patches have not included before
the hard-freeze, your patch here is likely the better work-around for 4.0.

Reviewed-by: Thomas Huth 



[Qemu-devel] [Bug 1812694] Re: qemu-system-x86_64 version 3.0+ is 20 times slower than version 2.12

2019-03-22 Thread Launchpad Bug Tracker
[Expired for QEMU because there has been no activity for 60 days.]

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

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

Title:
  qemu-system-x86_64 version 3.0+ is 20 times slower than version 2.12

Status in QEMU:
  Expired

Bug description:
  version 3.0+ is 20 times slower than version 2.12
  I wrote a small 64-bit operating system (SIGMAOS) in which I use the lzma 
decoder. unpacking the file takes 20 times slower than in version 2.12.
  You can download it from 
https://drive.google.com/drive/folders/0B_wEiYjzVkC0ZGtkbENENzF1Nms

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



Re: [Qemu-devel] [PATCH v8 05/16] gdbstub: add multiprocess support to vCont packets

2019-03-22 Thread Lucien Anti-Spam via Qemu-devel
 

   > On Friday, March 22, 2019, 11:01:34 PM GMT+9, Luc Michel 
 wrote: > Lucien: do you plan to send a re-roll? 
Otherwise I'll do it on next
> Monday (25/03) because I would like this bug to be fixed before it hits 4.0.

I am on assignment in China which is why I havent gotten to it, I will attempt 
to get to it this Sunday.
Cheers,Luc


  


[Qemu-devel] [Bug 1821430] [NEW] qemu-user-arm (4.0.0-rc0) crashes

2019-03-22 Thread asavah
Public bug reported:

I'm using qemu-user-arm for crosscompilation needs, usually via a wrapper.
qemu-user-arm (4.0.0-rc0) crashes with SIGILL on at least 2 instructions:

first case (sadly I don't have more data handy, can reproduce at a later time 
if needed):
(gdb) x/i $pc
=> 0xfffce314:  vseleq.f64  d0, d17, d0

second case (llvm-config):
qemu cmdline:
qemu-arm -strace -cpu max -r 5.0.0 -L /home/asavah/kross/build/rpi3/rootfs -E 
LD_LIBRARY_PATH=/home/asavah/kross/build/rpi3/rootfs/usr/bin:/home/asavah/kross/build/rpi3/rootfs/usr/lib
 /home/asavah/kross/build/rpi3/rootfs/usr/bin/llvm-config --shared-mode

--- SIGILL {si_signo=SIGILL, si_code=2, si_addr=0xf9f89f80} ---
qemu: uncaught target signal 4 (Illegal instruction) - core dumped

output from gdb(arm) attached to qemu-user-arm
Program received signal SIGILL, Illegal instruction.
0xf9f77f80 in ?? ()
(gdb) bt
#0  0xf9f77f80 in ?? ()
#1  0xfffd796c in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb)  x/i $pc
=> 0xf9f77f80:  vrintm.f64  d18, d18


The very same binaries when run with qemu-user-arm 3.1.0 (both from ubuntu 
19.04 package and self built)
work flawlessly.

This is clearly a regression.
Please fix before releasing 4.0.0.

** Affects: qemu
 Importance: Undecided
 Status: New

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

Title:
  qemu-user-arm (4.0.0-rc0) crashes

Status in QEMU:
  New

Bug description:
  I'm using qemu-user-arm for crosscompilation needs, usually via a wrapper.
  qemu-user-arm (4.0.0-rc0) crashes with SIGILL on at least 2 instructions:

  first case (sadly I don't have more data handy, can reproduce at a later time 
if needed):
  (gdb) x/i $pc
  => 0xfffce314:  vseleq.f64  d0, d17, d0

  second case (llvm-config):
  qemu cmdline:
  qemu-arm -strace -cpu max -r 5.0.0 -L /home/asavah/kross/build/rpi3/rootfs -E 
LD_LIBRARY_PATH=/home/asavah/kross/build/rpi3/rootfs/usr/bin:/home/asavah/kross/build/rpi3/rootfs/usr/lib
 /home/asavah/kross/build/rpi3/rootfs/usr/bin/llvm-config --shared-mode

  --- SIGILL {si_signo=SIGILL, si_code=2, si_addr=0xf9f89f80} ---
  qemu: uncaught target signal 4 (Illegal instruction) - core dumped

  output from gdb(arm) attached to qemu-user-arm
  Program received signal SIGILL, Illegal instruction.
  0xf9f77f80 in ?? ()
  (gdb) bt
  #0  0xf9f77f80 in ?? ()
  #1  0xfffd796c in ?? ()
  Backtrace stopped: previous frame identical to this frame (corrupt stack?)
  (gdb)  x/i $pc
  => 0xf9f77f80:  vrintm.f64  d18, d18

  
  The very same binaries when run with qemu-user-arm 3.1.0 (both from ubuntu 
19.04 package and self built)
  work flawlessly.

  This is clearly a regression.
  Please fix before releasing 4.0.0.

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



[Qemu-devel] [PATCH for-4.0] target/arm: Fix non-parallel expansion of CASP

2019-03-22 Thread Richard Henderson
The second word has been loaded from the unincremented
address since the first commit.

Fixes: 44ac14b06fa
Reported-by: Alex Bennée 
Signed-off-by: Richard Henderson 
---
 target/arm/translate-a64.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
index 1959046343..dcdeb80176 100644
--- a/target/arm/translate-a64.c
+++ b/target/arm/translate-a64.c
@@ -2510,7 +2510,7 @@ static void gen_compare_and_swap_pair(DisasContext *s, 
int rs, int rt,
 tcg_gen_qemu_ld_i64(d1, clean_addr, memidx,
 MO_64 | MO_ALIGN_16 | s->be_data);
 tcg_gen_addi_i64(a2, clean_addr, 8);
-tcg_gen_qemu_ld_i64(d2, clean_addr, memidx, MO_64 | s->be_data);
+tcg_gen_qemu_ld_i64(d2, a2, memidx, MO_64 | s->be_data);
 
 /* Compare the two words, also in memory order.  */
 tcg_gen_setcond_i64(TCG_COND_EQ, c1, d1, s1);
-- 
2.17.1




Re: [Qemu-devel] [PATCH] virtio-vga: only enable for specific boards

2019-03-22 Thread Paolo Bonzini



- Original Message -
> From: "Laszlo Ersek" 
> To: "Paolo Bonzini" , qemu-devel@nongnu.org
> Cc: th...@redhat.com
> Sent: Thursday, March 21, 2019 8:34:46 PM
> Subject: Re: [PATCH] virtio-vga: only enable for specific boards
> 
> On 03/21/19 15:29, Paolo Bonzini wrote:
> > When virtio-vga was added, the intention was to only support it for
> > those machines where the firmware does not know about virtio-gpu,
> > and supported VGA legacy hardware before virtio-{gpu,vga} were
> > introduced.
> > 
> > The Kconfig switch however enabled virtio-vga for all machines with
> > a PCI bus, and libvirt then prefers it even on hardware where
> > virtio-gpu would be preferrable.  At least for now, only enable
> > virtio-vga for PC, hppa and pSeries machines, as was the case
> > before Kconfig dependencies were introduced.
> > 
> > Reported-by: Laszlo Ersek 
> > Signed-off-by: Paolo Bonzini 
> > ---
> >  hw/display/Kconfig | 2 +-
> >  hw/hppa/Kconfig| 1 +
> >  hw/i386/Kconfig| 1 +
> >  hw/ppc/Kconfig | 1 +
> >  4 files changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/hw/display/Kconfig b/hw/display/Kconfig
> > index 86c1d544c5..72be57a403 100644
> > --- a/hw/display/Kconfig
> > +++ b/hw/display/Kconfig
> > @@ -100,7 +100,7 @@ config VIRTIO_GPU
> >  
> >  config VIRTIO_VGA
> >  bool
> > -default y if PCI_DEVICES
> > +# defaults to "N", enabled by specific boards
> >  depends on VIRTIO_PCI
> >  select VGA
> >  
> > diff --git a/hw/hppa/Kconfig b/hw/hppa/Kconfig
> > index 7334f57081..6e5d74a825 100644
> > --- a/hw/hppa/Kconfig
> > +++ b/hw/hppa/Kconfig
> > @@ -2,6 +2,7 @@ config DINO
> >  bool
> >  imply PCI_DEVICES
> >  imply E1000_PCI
> > +imply VIRTIO_VGA
> >  select PCI
> >  select SERIAL
> >  select ISA_BUS
> > diff --git a/hw/i386/Kconfig b/hw/i386/Kconfig
> > index 8e8444dbf9..a6aed7c131 100644
> > --- a/hw/i386/Kconfig
> > +++ b/hw/i386/Kconfig
> > @@ -19,6 +19,7 @@ config PC
> >  imply TPM_CRB
> >  imply TPM_TIS
> >  imply VGA_PCI
> > +imply VIRTIO_VGA
> >  select FDC
> >  select I8259
> >  select I8254
> > diff --git a/hw/ppc/Kconfig b/hw/ppc/Kconfig
> > index ae07b4da63..a3465155f0 100644
> > --- a/hw/ppc/Kconfig
> > +++ b/hw/ppc/Kconfig
> > @@ -2,6 +2,7 @@ config PSERIES
> >  bool
> >  imply PCI_DEVICES
> >  imply TEST_DEVICES
> > +imply VIRTIO_VGA
> >  select DIMM
> >  select PCI
> >  select SPAPR_VSCSI
> > 
> 
> I tried to apply this for testing, on top of
> c692931cda9dc6cbc16b89d5094a725a10dbb641, but git-am failed. The
> conflicts are in "hw/hppa/Kconfig" and "hw/i386/Kconfig". In the former,
> the conflict is due to E1000_PCI, in the latter, the conflict occurs due
> to VGA_PCI -- upstream doesn't seem to have either of those.

Yeah, it is on top of my tree.  You can find it as tag for-upstream at
https://github.com/bonzini/qemu, but it is not tested yet.

Paolo



Re: [Qemu-devel] [PATCH v2 0/3] qemu-img: removing created when img_create fails

2019-03-22 Thread Daniel Henrique Barboza




On 3/22/19 4:02 PM, no-re...@patchew.org wrote:

Patchew URL: 
https://patchew.org/QEMU/20190322175241.5954-1-danielhb...@gmail.com/



Hi,

This series failed the docker-mingw@fedora build test. Please find the testing 
commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.

=== TEST SCRIPT BEGIN ===
#!/bin/bash
time make docker-test-mingw@fedora SHOW_ENV=1 J=14 NETWORK=1
=== TEST SCRIPT END ===

   CC  aarch64-softmmu/tcg/tcg-op.o
   CC  aarch64-softmmu/tcg/tcg-op-vec.o
/tmp/qemu-test/src/qemu-img.c: In function 'img_create':
/tmp/qemu-test/src/qemu-img.c:568:13: error: 'filename' may be used 
uninitialized in this function [-Werror=maybe-uninitialized]
  error_reportf_err(local_err, "%s: ", filename);
  ^~
cc1: all warnings being treated as errors


Not sure why it complained about this. Travis didn't care 


How can I reproduce this docker use test? I have a Fedora29 box with 
Docker and

issuing "make docker-test-mingw(...)" as mentioned above doesn't work.


Thanks,


dhb



The full log is available at
http://patchew.org/logs/20190322175241.5954-1-danielhb...@gmail.com/testing.docker-mingw@fedora/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-de...@redhat.com





[Qemu-devel] [PATCH v2 for-4.0] hardfloat: fix float32/64 fused multiply-add

2019-03-22 Thread Emilio G. Cota
From: Kito Cheng 

Before falling back to softfloat FMA, we do not restore the original
values of inputs A and C. Fix it.

This bug was caught by running gcc's testsuite on RISC-V qemu.

Note that this change gives a small perf increase for fp-bench:

  Host: Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz
  Command: perf stat -r 3 taskset -c 0 ./fp-bench -o mulAdd -p $prec

- $prec = single:
  - before:
101.71 MFlops
102.18 MFlops
100.96 MFlops
  - after:
103.63 MFlops
103.05 MFlops
102.96 MFlops

- $prec = double:
  - before:
173.10 MFlops
173.93 MFlops
172.11 MFlops
  - after:
178.49 MFlops
178.88 MFlops
178.66 MFlops

Signed-off-by: Kito Cheng 
Signed-off-by: Emilio G. Cota 
---
 fpu/softfloat.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index 4610738ab1..2ba36ec370 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -1596,6 +1596,9 @@ float32_muladd(float32 xa, float32 xb, float32 xc, int 
flags, float_status *s)
 }
 ur.h = up.h + uc.h;
 } else {
+union_float32 ua_orig = ua;
+union_float32 uc_orig = uc;
+
 if (flags & float_muladd_negate_product) {
 ua.h = -ua.h;
 }
@@ -1608,6 +1611,8 @@ float32_muladd(float32 xa, float32 xb, float32 xc, int 
flags, float_status *s)
 if (unlikely(f32_is_inf(ur))) {
 s->float_exception_flags |= float_flag_overflow;
 } else if (unlikely(fabsf(ur.h) <= FLT_MIN)) {
+ua = ua_orig;
+uc = uc_orig;
 goto soft;
 }
 }
@@ -1662,6 +1667,9 @@ float64_muladd(float64 xa, float64 xb, float64 xc, int 
flags, float_status *s)
 }
 ur.h = up.h + uc.h;
 } else {
+union_float64 ua_orig = ua;
+union_float64 uc_orig = uc;
+
 if (flags & float_muladd_negate_product) {
 ua.h = -ua.h;
 }
@@ -1674,6 +1682,8 @@ float64_muladd(float64 xa, float64 xb, float64 xc, int 
flags, float_status *s)
 if (unlikely(f64_is_inf(ur))) {
 s->float_exception_flags |= float_flag_overflow;
 } else if (unlikely(fabs(ur.h) <= FLT_MIN)) {
+ua = ua_orig;
+uc = uc_orig;
 goto soft;
 }
 }
-- 
2.17.1




Re: [Qemu-devel] [PATCH 0/6] block: Fix slow pre-zeroing in qemu-img convert

2019-03-22 Thread Eric Blake
On 3/22/19 3:22 PM, Nir Soffer wrote:

> Thanks for fixing this! This will be a very important performance fix for
> importing
> VMs.
> 
> The change description sounds good to me.
> 
> Can you make these patches available on some git repo to make it easy to
> test?

Based on commit titles, this branch looks reasonably close (at the moment):

https://repo.or.cz/qemu/kevin.git/shortlog/refs/heads/qcow2-data-file

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



signature.asc
Description: OpenPGP digital signature


Re: [Qemu-devel] [PATCH 0/6] block: Fix slow pre-zeroing in qemu-img convert

2019-03-22 Thread Nir Soffer
On Fri, Mar 22, 2019 at 3:22 PM Kevin Wolf  wrote:

> If qemu-img convert sees that the target image isn't zero-initialised
> yet, it tries to do an efficient zero write for the whole image first
> to save the overhead of repeated explicit zero writes during the
> conversion. Obviously, this provides only an advantage if the
> pre-zeroing is actually efficient. Otherwise, we can end up writing
> zeroes slowly while zeroing out the whole image, and then overwrite the
> same blocks again with real data, potentially doubling the written data.
>
> Additionally, commit 9776f0db changed NBD to advertise for all NBD
> devices that zero writes with unmap is supported for all NBD devices, no
> matter whether the storage of NBD server actually can do this or whether
> we would fall back to explicit zero writes.
>
> This series adds a new BDRV_REQ_NO_FALLBACK flag for writing zeroes,
> which makes the request return an error if it can't guarantee that we
> don't end up running a slow fallback path.
>
> For NBD, this means that we still support zero writes from guests, but
> qemu-img convert will not try to use it to zero out the whole image.
> This is potentially suboptimal if the server does actually support
> efficient zero writes. We'd need an NBD protocol extension to transfer
> this flag so we can re-enable the qemu-img convert feature for the NBD
> driver without regressing on storage that can't provide efficient zero
> writes.
>

Thanks for fixing this! This will be a very important performance fix for
importing
VMs.

The change description sounds good to me.

Can you make these patches available on some git repo to make it easy to
test?

Nir

Kevin Wolf (6):
>   block: Remove error messages in bdrv_make_zero()
>   block: Add BDRV_REQ_NO_FALLBACK
>   block: Advertise BDRV_REQ_NO_FALLBACK in filter drivers
>   file-posix: Support BDRV_REQ_NO_FALLBACK for zero writes
>   qemu-img: Use BDRV_REQ_NO_FALLBACK for pre-zeroing
>   qemu-io: Add write -n for BDRV_REQ_NO_FALLBACK
>
>  include/block/block.h   |  7 ++-
>  include/block/raw-aio.h |  1 +
>  block/blkdebug.c|  2 +-
>  block/copy-on-read.c|  7 +++
>  block/file-posix.c  | 24 
>  block/io.c  | 16 +++-
>  block/mirror.c  |  3 ++-
>  block/raw-format.c  |  2 +-
>  qemu-img.c  |  2 +-
>  qemu-io-cmds.c  | 13 +++--
>  10 files changed, 53 insertions(+), 24 deletions(-)
>
> --
> 2.20.1
>
>


Re: [Qemu-devel] [PATCH] hardfloat: fix float32/64 fused multiply-add

2019-03-22 Thread Emilio G. Cota
On Sat, Mar 23, 2019 at 01:39:26 +0800, Kito Cheng wrote:
> hardfloat fused multiply-add might fallback to softfloat mode in some
> situation, but it might already changed the value of input operands,
> so we must restore those value before fallback.
> 
> This bug is catched by running gcc testsuite on RISC-V qemu.
> 
> Signed-off-by: Kito Cheng 

Good catch!

I'll send a v2 shortly with some small changes.

Thanks,

Emilio



[Qemu-devel] [PATCH] target/xtensa: don't announce exit simcall

2019-03-22 Thread Max Filippov
Don't announce that exit simcall has been invoked: this is just noise.

Signed-off-by: Max Filippov 
---
 target/xtensa/xtensa-semi.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/target/xtensa/xtensa-semi.c b/target/xtensa/xtensa-semi.c
index 2f762162768c..5f5ce4f344c6 100644
--- a/target/xtensa/xtensa-semi.c
+++ b/target/xtensa/xtensa-semi.c
@@ -202,7 +202,6 @@ void HELPER(simcall)(CPUXtensaState *env)
 
 switch (regs[2]) {
 case TARGET_SYS_exit:
-qemu_log("exit(%d) simcall\n", regs[3]);
 exit(regs[3]);
 break;
 
-- 
2.11.0




[Qemu-devel] [PATCH] tests/tcg/xtensa: clean up test set

2019-03-22 Thread Max Filippov
Drop test_fail: we know that exit simcall works. Now that it's not run
automatically there's no point in keeping it.
Drop test_pipeline: we're not modeling pipeline, we don't control ccount
and there's no plan to do so.
Enable test_boolean: it won't break on cores without boolean option, it
will do testing on cores with boolean option.

Signed-off-by: Max Filippov 
---
 tests/tcg/xtensa/Makefile.softmmu-target |   2 +-
 tests/tcg/xtensa/test_fail.S |   9 --
 tests/tcg/xtensa/test_pipeline.S | 157 ---
 3 files changed, 1 insertion(+), 167 deletions(-)
 delete mode 100644 tests/tcg/xtensa/test_fail.S
 delete mode 100644 tests/tcg/xtensa/test_pipeline.S

diff --git a/tests/tcg/xtensa/Makefile.softmmu-target 
b/tests/tcg/xtensa/Makefile.softmmu-target
index 86bb47db775b..8212d96b81de 100644
--- a/tests/tcg/xtensa/Makefile.softmmu-target
+++ b/tests/tcg/xtensa/Makefile.softmmu-target
@@ -8,7 +8,7 @@ XTENSA_SRC = $(SRC_PATH)/tests/tcg/xtensa
 XTENSA_ALL = $(filter-out $(XTENSA_SRC)/linker.ld.S,$(wildcard 
$(XTENSA_SRC)/*.S))
 XTENSA_TESTS = $(patsubst $(XTENSA_SRC)/%.S, %, $(XTENSA_ALL))
 # Filter out common blobs and broken tests
-XTENSA_BROKEN_TESTS  = crt vectors test_boolean test_pipeline test_fail
+XTENSA_BROKEN_TESTS  = crt vectors
 XTENSA_USABLE_TESTS = $(filter-out $(XTENSA_BROKEN_TESTS), $(XTENSA_TESTS))
 
 # add to the list of tests
diff --git a/tests/tcg/xtensa/test_fail.S b/tests/tcg/xtensa/test_fail.S
deleted file mode 100644
index 1c26d5079038..
--- a/tests/tcg/xtensa/test_fail.S
+++ /dev/null
@@ -1,9 +0,0 @@
-#include "macros.inc"
-
-test_suite fail
-
-test fail
-test_fail
-test_end
-
-test_suite_end
diff --git a/tests/tcg/xtensa/test_pipeline.S b/tests/tcg/xtensa/test_pipeline.S
deleted file mode 100644
index f418c11974aa..
--- a/tests/tcg/xtensa/test_pipeline.S
+++ /dev/null
@@ -1,157 +0,0 @@
-#include "macros.inc"
-
-.purgem test
-.macro test name
-movia2, 1f
-movia3, 99f
-0:
-ipf a2, 0
-ipf a2, 4
-ipf a2, 8
-ipf a2, 12
-addia2, a2, 16
-blt a2, a3, 0b
-j   1f
-.align 4
-1:
-.endm
-
-test_suite pipeline
-
-test register_no_stall
-rsr a3, ccount
-add a5, a6, a6
-add a6, a5, a5
-rsr a4, ccount
-sub a3, a4, a3
-assert  eqi, a3, 3
-test_end
-
-test register_stall
-l32ia5, a1, 0   /* data cache preload */
-nop
-rsr a3, ccount
-l32ia5, a1, 0
-add a6, a5, a5  /* M-to-E interlock */
-rsr a4, ccount
-sub a3, a4, a3
-assert  eqi, a3, 4
-test_end
-
-test j0_stall
-rsr a3, ccount
-j   1f  /* E + 2-cycle penalty */
-1:
-rsr a4, ccount  /* E */
-sub a3, a4, a3
-assert  eqi, a3, 4
-test_end
-
-test j1_stall
-rsr a3, ccount
-j   1f
-nop
-1:
-rsr a4, ccount
-sub a3, a4, a3
-assert  eqi, a3, 4
-test_end
-
-test j5_stall
-rsr a3, ccount
-j   1f
-nop
-nop
-nop
-nop
-nop
-1:
-rsr a4, ccount
-sub a3, a4, a3
-assert  eqi, a3, 4
-test_end
-
-test b_no_stall
-movia5, 1
-rsr a3, ccount
-beqia5, 2, 1f
-rsr a4, ccount
-sub a3, a4, a3
-assert  eqi, a3, 2
-1:
-test_end
-
-test b1_stall
-movia5, 1
-rsr a3, ccount
-beqia5, 1, 1f
-nop
-1:
-rsr a4, ccount
-sub a3, a4, a3
-assert  eqi, a3, 4
-test_end
-
-test b5_stall
-movia5, 1
-rsr a3, ccount
-beqia5, 1, 1f
-nop
-nop
-nop
-nop
-nop
-1:
-rsr a4, ccount
-sub a3, a4, a3
-assert  eqi, a3, 4
-test_end
-
-/* PS *SYNC */
-
-test ps_dsync
-rsr a5, ps
-isync
-rsr a3, ccount
-wsr a5, ps
-dsync
-rsr a4, ccount
-sub a3, a4, a3
-assert  eqi, a3, 5
-test_end
-
-test ps_esync
-rsr a5, ps
-isync
-rsr a3, ccount
-wsr a5, ps
-esync
-rsr a4, ccount
-sub a3, a4, a3
-assert  eqi, a3, 5
-test_end
-
-test ps_rsync
-rsr a5, ps
-isync
-rsr a3, ccount
-wsr a5, ps
-rsync
-rsr a4, ccount
-sub a3, a4, a3
-assert  eqi, a3, 5
-test_end
-
-test ps_isync
-rsr a5, ps
-isync
-rsr a3, ccount
-wsr a5, ps
-isync
-rsr a4, ccount
-sub a3, a4, a3
-movia4, 9
-assert  eq, a3, a4
-test_end
-
-test_suite_end
-- 
2.11.0




[Qemu-devel] [PULL 6/8] slirp: clarify license of slirp files using SPDX: implicit via unstated

2019-03-22 Thread Marc-André Lureau
Add SPDX license identifier to clarify the license of files without
explicit license header.

Signed-off-by: Marc-André Lureau 
Reviewed-by: Thomas Huth 
---
 slirp/src/bootp.h  | 1 +
 slirp/src/ip6.h| 1 +
 slirp/src/ip6_icmp.h   | 1 +
 slirp/src/libslirp.h   | 1 +
 slirp/src/slirp.h  | 1 +
 slirp/src/stream.h | 1 +
 slirp/src/tftp.h   | 1 +
 slirp/src/ip6_icmp.c   | 1 +
 slirp/src/ip6_input.c  | 1 +
 slirp/src/ip6_output.c | 1 +
 slirp/src/ndp_table.c  | 1 +
 slirp/src/udp6.c   | 1 +
 12 files changed, 12 insertions(+)

diff --git a/slirp/src/bootp.h b/slirp/src/bootp.h
index 4043489835..d881ad620a 100644
--- a/slirp/src/bootp.h
+++ b/slirp/src/bootp.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /* bootp/dhcp defines */
 
 #ifndef SLIRP_BOOTP_H
diff --git a/slirp/src/ip6.h b/slirp/src/ip6.h
index 1b3364f960..33683c8e20 100644
--- a/slirp/src/ip6.h
+++ b/slirp/src/ip6.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 2013
  * Guillaume Subiron, Yann Bordenave, Serigne Modou Wagne.
diff --git a/slirp/src/ip6_icmp.h b/slirp/src/ip6_icmp.h
index e8ed753db5..d8d13e30fc 100644
--- a/slirp/src/ip6_icmp.h
+++ b/slirp/src/ip6_icmp.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 2013
  * Guillaume Subiron, Yann Bordenave, Serigne Modou Wagne.
diff --git a/slirp/src/libslirp.h b/slirp/src/libslirp.h
index 2d13950065..3b28764bec 100644
--- a/slirp/src/libslirp.h
+++ b/slirp/src/libslirp.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 #ifndef LIBSLIRP_H
 #define LIBSLIRP_H
 
diff --git a/slirp/src/slirp.h b/slirp/src/slirp.h
index 8068ba1d1e..39580934f3 100644
--- a/slirp/src/slirp.h
+++ b/slirp/src/slirp.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 #ifndef SLIRP_H
 #define SLIRP_H
 
diff --git a/slirp/src/stream.h b/slirp/src/stream.h
index 985334c043..08bb5b6610 100644
--- a/slirp/src/stream.h
+++ b/slirp/src/stream.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 #ifndef STREAM_H_
 #define STREAM_H_
 
diff --git a/slirp/src/tftp.h b/slirp/src/tftp.h
index a4c4a64e64..3fe3b70205 100644
--- a/slirp/src/tftp.h
+++ b/slirp/src/tftp.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /* tftp defines */
 
 #ifndef SLIRP_TFTP_H
diff --git a/slirp/src/ip6_icmp.c b/slirp/src/ip6_icmp.c
index c1e3d30470..5642457fdd 100644
--- a/slirp/src/ip6_icmp.c
+++ b/slirp/src/ip6_icmp.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 2013
  * Guillaume Subiron, Yann Bordenave, Serigne Modou Wagne.
diff --git a/slirp/src/ip6_input.c b/slirp/src/ip6_input.c
index 1b8c003c66..d9d2b7e9cd 100644
--- a/slirp/src/ip6_input.c
+++ b/slirp/src/ip6_input.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 2013
  * Guillaume Subiron, Yann Bordenave, Serigne Modou Wagne.
diff --git a/slirp/src/ip6_output.c b/slirp/src/ip6_output.c
index 19d1ae7748..b86110662c 100644
--- a/slirp/src/ip6_output.c
+++ b/slirp/src/ip6_output.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 2013
  * Guillaume Subiron, Yann Bordenave, Serigne Modou Wagne.
diff --git a/slirp/src/ndp_table.c b/slirp/src/ndp_table.c
index 34ea4fdf1f..78324877e2 100644
--- a/slirp/src/ndp_table.c
+++ b/slirp/src/ndp_table.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 2013
  * Guillaume Subiron, Yann Bordenave, Serigne Modou Wagne.
diff --git a/slirp/src/udp6.c b/slirp/src/udp6.c
index be5cba1f54..bfcc7ec6fa 100644
--- a/slirp/src/udp6.c
+++ b/slirp/src/udp6.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 2013
  * Guillaume Subiron
-- 
2.21.0.4.g36eb1cb9cf




[Qemu-devel] [PULL 4/8] slirp: clarify license of slirp files using SPDX: explicit MIT

2019-03-22 Thread Marc-André Lureau
Add SPDX license identifier to clarify the license of files with
explicit MIT license header.

Signed-off-by: Marc-André Lureau 
Reviewed-by: Thomas Huth 
---
 slirp/src/util.h  | 1 +
 slirp/src/arp_table.c | 1 +
 slirp/src/bootp.c | 1 +
 slirp/src/dnssearch.c | 1 +
 slirp/src/slirp.c | 1 +
 slirp/src/state.c | 1 +
 slirp/src/stream.c| 1 +
 slirp/src/tftp.c  | 1 +
 slirp/src/util.c  | 1 +
 9 files changed, 9 insertions(+)

diff --git a/slirp/src/util.h b/slirp/src/util.h
index e94ee4e7f1..01f1e0e068 100644
--- a/slirp/src/util.h
+++ b/slirp/src/util.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: MIT */
 /*
  * Copyright (c) 2003-2008 Fabrice Bellard
  * Copyright (c) 2010-2019 Red Hat, Inc.
diff --git a/slirp/src/arp_table.c b/slirp/src/arp_table.c
index 58eafdcfd8..9d7a59eb2c 100644
--- a/slirp/src/arp_table.c
+++ b/slirp/src/arp_table.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: MIT */
 /*
  * ARP table
  *
diff --git a/slirp/src/bootp.c b/slirp/src/bootp.c
index d396849a05..b208e3b216 100644
--- a/slirp/src/bootp.c
+++ b/slirp/src/bootp.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: MIT */
 /*
  * QEMU BOOTP/DHCP server
  *
diff --git a/slirp/src/dnssearch.c b/slirp/src/dnssearch.c
index c459cece8d..12c488971e 100644
--- a/slirp/src/dnssearch.c
+++ b/slirp/src/dnssearch.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: MIT */
 /*
  * Domain search option for DHCP (RFC 3397)
  *
diff --git a/slirp/src/slirp.c b/slirp/src/slirp.c
index 18af670a0a..169c85b906 100644
--- a/slirp/src/slirp.c
+++ b/slirp/src/slirp.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: MIT */
 /*
  * libslirp glue
  *
diff --git a/slirp/src/state.c b/slirp/src/state.c
index c3e3f0b671..09cea3590e 100644
--- a/slirp/src/state.c
+++ b/slirp/src/state.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: MIT */
 /*
  * libslirp
  *
diff --git a/slirp/src/stream.c b/slirp/src/stream.c
index d114dde334..9c1764c0b7 100644
--- a/slirp/src/stream.c
+++ b/slirp/src/stream.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: MIT */
 /*
  * libslirp io streams
  *
diff --git a/slirp/src/tftp.c b/slirp/src/tftp.c
index 2d8f978786..2071dca2a6 100644
--- a/slirp/src/tftp.c
+++ b/slirp/src/tftp.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: MIT */
 /*
  * tftp.c - a simple, read-only tftp server for qemu
  *
diff --git a/slirp/src/util.c b/slirp/src/util.c
index 5ec2fa87ab..60bb200801 100644
--- a/slirp/src/util.c
+++ b/slirp/src/util.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: MIT */
 /*
  * util.c (mostly based on QEMU os-win32.c)
  *
-- 
2.21.0.4.g36eb1cb9cf




[Qemu-devel] [PULL 1/8] slirp: update COPYRIGHT to use full 3-Clause BSD License

2019-03-22 Thread Marc-André Lureau
According to commit 2f5f89963186d42a7ded253bc6cf5b32abb45cec ("Remove
the advertising clause from the slirp license"), Danny Gasparovski
gave permission to license slirp code under 3-clause BSD license:

Subject: RE: Slirp license
Date: Thu, 8 Jan 2009 10:51:00 +1100
From: "Gasparovski, Daniel" 
To: "Richard Fontana" 

I have no objection to having Slirp code in QEMU be licensed under
the 3-clause BSD license.

slirp/COPYRIGHT's initial version in 2004 (commit 5fafdf24) listed
only 3 clauses BUT used the poisonous advertising clause for clause 3
which is the controversial clause of non-free 4-clause (that is, it
appears that the BSD-4 license was copied, and then the WRONG clause
was deleted, when creating COPYRIGHT.  Perhaps explained as an easy
mistake to make since 3-clause was created by removing clause 3 of the
4-clause, where you sometimes see the three-clause version with
clauses 1, 2, 4; but more commonly see a renumbered version with
clauses 1, 2, 3 to close the gap. If you pay attention only to clause
numbers instead of content, it can be easy to confuse which clause to
delete to go from 4-clause to 3-clause).

Commit 2f5f89963 removed the poisonous wrong clause on
the grounds of moving from 4-clause to 3-clause; but did not add the
missing clause, which makes it LOOK like the 2-clause version.  But I
think we have a decent enough trail showing the intent for 3-clause.

Signed-off-by: Marc-André Lureau 
Reviewed-by: Eric Blake 
Reviewed-by: Thomas Huth 
---
 slirp/COPYRIGHT | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/slirp/COPYRIGHT b/slirp/COPYRIGHT
index 1bc83d497e..9863ea31cb 100644
--- a/slirp/COPYRIGHT
+++ b/slirp/COPYRIGHT
@@ -25,6 +25,9 @@ The copyright terms and conditions:
  2. Redistributions in binary form must reproduce the above copyright
 notice, this list of conditions and the following disclaimer in the
 documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the copyright holder nor the names of its
+contributors may be used to endorse or promote products derived
+from this software without specific prior written permission.
 
  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-- 
2.21.0.4.g36eb1cb9cf




[Qemu-devel] [PULL 0/8] Slirp patches

2019-03-22 Thread Marc-André Lureau
The following changes since commit d97a39d903fe33c45be83ac6943a2f82a3649a11:

  Merge remote-tracking branch 'remotes/ehabkost/tags/x86-next-pull-request' 
into staging (2019-03-22 09:37:38 +)

are available in the Git repository at:

  https://github.com/elmarco/qemu.git tags/slirp-pull-request

for you to fetch changes up to 7849f0c2ecf35f04c8dfcea30f675182cafdd455:

  slirp: is not maintained by Kelly Price for a long time (2019-03-22 17:31:42 
+0100)


slirp: clarify license of slirp as BSD-3



Marc-André Lureau (8):
  slirp: update COPYRIGHT to use full 3-Clause BSD License
  slirp: relicense GPL files to BSD-3
  slirp: clarify license of slirp files using SPDX: explicit BSD
  slirp: clarify license of slirp files using SPDX: explicit MIT
  slirp: clarify license of slirp files using SPDX: implicit via
COPYRIGHT
  slirp: clarify license of slirp files using SPDX: implicit via
unstated
  slirp: remove reference to COPYRIGHT file
  slirp: is not maintained by Kelly Price for a long time

 slirp/src/bootp.h  |  1 +
 slirp/src/debug.h  |  4 +---
 slirp/src/dhcpv6.h | 32 +--
 slirp/src/if.h |  4 +---
 slirp/src/ip.h |  1 +
 slirp/src/ip6.h|  1 +
 slirp/src/ip6_icmp.h   |  1 +
 slirp/src/ip_icmp.h|  1 +
 slirp/src/libslirp.h   |  1 +
 slirp/src/main.h   |  4 +---
 slirp/src/mbuf.h   |  1 +
 slirp/src/misc.h   |  4 +---
 slirp/src/ncsi-pkt.h   | 34 +
 slirp/src/qtailq.h |  1 +
 slirp/src/sbuf.h   |  4 +---
 slirp/src/slirp.h  |  1 +
 slirp/src/socket.h |  4 +---
 slirp/src/stream.h |  1 +
 slirp/src/tcp.h|  1 +
 slirp/src/tcp_timer.h  |  1 +
 slirp/src/tcp_var.h|  1 +
 slirp/src/tcpip.h  |  1 +
 slirp/src/tftp.h   |  1 +
 slirp/src/udp.h|  1 +
 slirp/src/util.h   |  1 +
 slirp/src/vmstate.h| 43 +++---
 slirp/src/arp_table.c  |  1 +
 slirp/src/bootp.c  |  1 +
 slirp/src/cksum.c  |  1 +
 slirp/src/dhcpv6.c | 38 +++--
 slirp/src/dnssearch.c  |  1 +
 slirp/src/if.c |  4 +---
 slirp/src/ip6_icmp.c   |  1 +
 slirp/src/ip6_input.c  |  1 +
 slirp/src/ip6_output.c |  1 +
 slirp/src/ip_icmp.c|  1 +
 slirp/src/ip_input.c   |  4 +---
 slirp/src/ip_output.c  |  4 +---
 slirp/src/mbuf.c   |  4 +---
 slirp/src/misc.c   |  4 +---
 slirp/src/ncsi.c   | 32 +--
 slirp/src/ndp_table.c  |  1 +
 slirp/src/sbuf.c   |  4 +---
 slirp/src/slirp.c  |  1 +
 slirp/src/socket.c |  4 +---
 slirp/src/state.c  |  1 +
 slirp/src/stream.c |  1 +
 slirp/src/tcp_input.c  |  4 +---
 slirp/src/tcp_output.c |  4 +---
 slirp/src/tcp_subr.c   |  4 +---
 slirp/src/tcp_timer.c  |  1 +
 slirp/src/tftp.c   |  1 +
 slirp/src/udp.c|  1 +
 slirp/src/udp6.c   |  1 +
 slirp/src/util.c   |  1 +
 slirp/src/vmstate.c| 32 +--
 slirp/COPYRIGHT|  5 +++--
 57 files changed, 229 insertions(+), 85 deletions(-)

-- 
2.21.0.4.g36eb1cb9cf




Re: [Qemu-devel] [Xen-devel] [PATCH 6/6] xen-pt: Round pci regions sizes to XEN_PAGE_SIZE

2019-03-22 Thread Jason Andryuk
On Thu, Mar 21, 2019 at 11:09 PM Roger Pau Monné  wrote:
>
> On Wed, Mar 20, 2019 at 01:28:47PM -0400, Jason Andryuk wrote:
> > On Fri, Mar 15, 2019 at 12:28 PM Andrew Cooper
> >  wrote:
> > >
> > > On 15/03/2019 09:17, Paul Durrant wrote:
> > > >> -Original Message-
> > > >> From: Jason Andryuk [mailto:jandr...@gmail.com]
> > > >> Sent: 14 March 2019 18:16
> > > >> To: Paul Durrant 
> > > >> Cc: qemu-devel@nongnu.org; xen-de...@lists.xenproject.org; 
> > > >> marma...@invisiblethingslab.com; Simon
> > > >> Gaiser ; Stefano Stabellini 
> > > >> ; Anthony Perard
> > > >> 
> > > >> Subject: Re: [PATCH 6/6] xen-pt: Round pci regions sizes to 
> > > >> XEN_PAGE_SIZE
> > > >>
> > > >> On Wed, Mar 13, 2019 at 11:09 AM Paul Durrant 
> > > >>  wrote:
> > >  -Original Message-
> > >  From: Jason Andryuk [mailto:jandr...@gmail.com]
> > >  Sent: 11 March 2019 18:02
> > >  To: qemu-devel@nongnu.org
> > >  Cc: xen-de...@lists.xenproject.org; marma...@invisiblethingslab.com; 
> > >  Simon Gaiser
> > >  ; Jason Andryuk ; 
> > >  Stefano Stabellini
> > >  ; Anthony Perard 
> > >  ; Paul Durrant
> > >  
> > >  Subject: [PATCH 6/6] xen-pt: Round pci regions sizes to XEN_PAGE_SIZE
> > > 
> > >  From: Simon Gaiser 
> > > 
> > >  If a pci memory region has a size < XEN_PAGE_SIZE it can get located 
> > >  at
> > >  an address which is not page aligned.
> > > >>> IIRC the PCI spec says that the minimum memory region size should be 
> > > >>> at least 4k. Should we even be
> > > >> tolerating BARs smaller than that?
> > > >>>   Paul
> > > >>>
> > > >> Hi, Paul.
> > > >>
> > > >> Simon found this, so it affects a real device.  Simon, do you recall
> > > >> which device was affected?
> > > >>
> > > >> I think BARs only need to be power-of-two size and aligned, and 4k is
> > > >> not a minimum.  16bytes may be a minimum, but I don't know what the
> > > >> spec says.
> > > >>
> > > >> On an Ivy Bridge system, here are some of the devices with BARs 
> > > >> smaller than 4K:
> > > >> 00:16.0 Communication controller: Intel Corporation 7 Series/C210
> > > >> Series Chipset Family MEI Controller #1 (rev 04)
> > > >>Memory at d0735000 (64-bit, non-prefetchable) [disabled] [size=16]
> > > >> 00:1d.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset
> > > >> Family USB Enhanced Host Controller #1 (rev 04) (prog-if 20 [EHCI])
> > > >>Memory at d0739000 (32-bit, non-prefetchable) [disabled] [size=1K]
> > > >> 00:1f.3 SMBus: Intel Corporation 7 Series/C210 Series Chipset Family
> > > >> SMBus Controller (rev 04)
> > > >>Memory at d0734000 (64-bit, non-prefetchable) [disabled] [size=256]
> > > >> 02:00.0 System peripheral: JMicron Technology Corp. SD/MMC Host
> > > >> Controller (rev 30)
> > > >>Memory at d0503000 (32-bit, non-prefetchable) [disabled] [size=256]
> > > >>
> > > >> These examples are all 4K aligned, so this is not an issue on this 
> > > >> machine.
> > > >>
> > > >> Reviewing the code, I'm now wondering if the following in
> > > >> hw/xen/xen_pt.c:xen_pt_region_update is wrong:rc =
> > > >> xc_domain_memory_mapping(xen_xc, xen_domid,
> > > >>  XEN_PFN(guest_addr + XC_PAGE_SIZE 
> > > >> - 1),
> > > >>  XEN_PFN(machine_addr + 
> > > >> XC_PAGE_SIZE - 1),
> > > >>  XEN_PFN(size + XC_PAGE_SIZE - 1),
> > > >>  op);
> > > >>
> > > >> If a bar of size 0x100 is at 0xd0500800, then the machine_addr passed
> > > >> in would be 0xd0501000 which is past the actual location.  Should the
> > > >> call arguments just be XEN_PFN(guest_addr) & XEN_PFN(machine_addr)?
> > > >>
> > > >> BARs smaller than a page would also be a problem if BARs for different
> > > >> devices shared the same page.
> > > > Exactly. We cannot pass them through with any degree of safety (not 
> > > > that passthrough of an arbitrary device is a particularly safe thing to 
> > > > do anyway). The xen-pt code would instead need to trap those BARs and 
> > > > perform the accesses to the real BAR itself. Ultimately though I think 
> > > > we should be retiring the xen-pt code in favour of a standalone 
> > > > emulator.
> > >
> > > It doesn't matter if the BAR is smaller than 4k, if there are holes next
> > > to it.
> > >
> > > Do we know what the case is in practice for these USB controllers?
> > >
> > > If the worst comes to the worst, we can re-enumerate the PCI bus to
> > > ensure that all bars smaller than 4k still have 4k alignment between
> > > them.  That way we can safely pass them through even when they are 
> > > smaller.
> >
> > Andrew, thanks for checking the spec on the minimum BAR size.
> >
> > Dropping the Round PCI region patch from QMEU, the guest HVM will have:
> >
> > 00:06.0 SD Host controller: Ricoh Co Ltd PCIe SDXC/MMC Host Controller (rev 
> > 07)
> > Memory at f2028800 (32-bit, 

[Qemu-devel] [PULL 5/8] slirp: clarify license of slirp files using SPDX: implicit via COPYRIGHT

2019-03-22 Thread Marc-André Lureau
Add SPDX license identifier to clarify the license of files with
reference to BSD license from slirp COPYRIGHT file.

Signed-off-by: Marc-André Lureau 
Reviewed-by: Thomas Huth 
---
 slirp/src/debug.h  | 1 +
 slirp/src/if.h | 1 +
 slirp/src/main.h   | 1 +
 slirp/src/misc.h   | 1 +
 slirp/src/sbuf.h   | 1 +
 slirp/src/socket.h | 1 +
 slirp/src/if.c | 1 +
 slirp/src/mbuf.c   | 1 +
 slirp/src/misc.c   | 1 +
 slirp/src/sbuf.c   | 1 +
 slirp/src/socket.c | 1 +
 11 files changed, 11 insertions(+)

diff --git a/slirp/src/debug.h b/slirp/src/debug.h
index 44d922df37..2e503ad7fa 100644
--- a/slirp/src/debug.h
+++ b/slirp/src/debug.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski.
  *
diff --git a/slirp/src/if.h b/slirp/src/if.h
index 69569c10df..8a60c4e052 100644
--- a/slirp/src/if.h
+++ b/slirp/src/if.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski.
  *
diff --git a/slirp/src/main.h b/slirp/src/main.h
index f11d4572b7..a88774215f 100644
--- a/slirp/src/main.h
+++ b/slirp/src/main.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski.
  *
diff --git a/slirp/src/misc.h b/slirp/src/misc.h
index c2ceadb591..4eaa2466d7 100644
--- a/slirp/src/misc.h
+++ b/slirp/src/misc.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski.
  *
diff --git a/slirp/src/sbuf.h b/slirp/src/sbuf.h
index 1cb9a42834..ece616e317 100644
--- a/slirp/src/sbuf.h
+++ b/slirp/src/sbuf.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski.
  *
diff --git a/slirp/src/socket.h b/slirp/src/socket.h
index e4d12cd591..10a0c78a26 100644
--- a/slirp/src/socket.h
+++ b/slirp/src/socket.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski.
  *
diff --git a/slirp/src/if.c b/slirp/src/if.c
index 1830cc396c..b8cddebf66 100644
--- a/slirp/src/if.c
+++ b/slirp/src/if.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski.
  *
diff --git a/slirp/src/mbuf.c b/slirp/src/mbuf.c
index 521c02c967..f079a86d78 100644
--- a/slirp/src/mbuf.c
+++ b/slirp/src/mbuf.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski
  *
diff --git a/slirp/src/misc.c b/slirp/src/misc.c
index 937a418d4e..da41f3bb5f 100644
--- a/slirp/src/misc.c
+++ b/slirp/src/misc.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski.
  *
diff --git a/slirp/src/sbuf.c b/slirp/src/sbuf.c
index 51a9f0cc7d..815823ffbe 100644
--- a/slirp/src/sbuf.c
+++ b/slirp/src/sbuf.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski.
  *
diff --git a/slirp/src/socket.c b/slirp/src/socket.c
index f2428a3ae8..ad58262a06 100644
--- a/slirp/src/socket.c
+++ b/slirp/src/socket.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski.
  *
-- 
2.21.0.4.g36eb1cb9cf




[Qemu-devel] [PULL 3/8] slirp: clarify license of slirp files using SPDX: explicit BSD

2019-03-22 Thread Marc-André Lureau
Add SPDX license identifier to clarify the license of files with
explicit 3-clause BSD license header.

Signed-off-by: Marc-André Lureau 
Reviewed-by: Thomas Huth 
---
 slirp/src/dhcpv6.h | 1 +
 slirp/src/ip.h | 1 +
 slirp/src/ip_icmp.h| 1 +
 slirp/src/mbuf.h   | 1 +
 slirp/src/ncsi-pkt.h   | 1 +
 slirp/src/qtailq.h | 1 +
 slirp/src/tcp.h| 1 +
 slirp/src/tcp_timer.h  | 1 +
 slirp/src/tcp_var.h| 1 +
 slirp/src/tcpip.h  | 1 +
 slirp/src/udp.h| 1 +
 slirp/src/vmstate.h| 1 +
 slirp/src/cksum.c  | 1 +
 slirp/src/dhcpv6.c | 1 +
 slirp/src/ip_icmp.c| 1 +
 slirp/src/ip_input.c   | 1 +
 slirp/src/ip_output.c  | 1 +
 slirp/src/ncsi.c   | 1 +
 slirp/src/tcp_input.c  | 1 +
 slirp/src/tcp_output.c | 1 +
 slirp/src/tcp_subr.c   | 1 +
 slirp/src/tcp_timer.c  | 1 +
 slirp/src/udp.c| 1 +
 slirp/src/vmstate.c| 1 +
 24 files changed, 24 insertions(+)

diff --git a/slirp/src/dhcpv6.h b/slirp/src/dhcpv6.h
index af0e193b06..dc26a93cff 100644
--- a/slirp/src/dhcpv6.h
+++ b/slirp/src/dhcpv6.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Definitions and prototypes for SLIRP stateless DHCPv6
  *
diff --git a/slirp/src/ip.h b/slirp/src/ip.h
index 73a4d2a3d2..1484de1176 100644
--- a/slirp/src/ip.h
+++ b/slirp/src/ip.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1982, 1986, 1993
  * The Regents of the University of California.  All rights reserved.
diff --git a/slirp/src/ip_icmp.h b/slirp/src/ip_icmp.h
index a4e5b8b265..05d85c59dd 100644
--- a/slirp/src/ip_icmp.h
+++ b/slirp/src/ip_icmp.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1982, 1986, 1993
  * The Regents of the University of California.  All rights reserved.
diff --git a/slirp/src/mbuf.h b/slirp/src/mbuf.h
index e2d443418a..732c85c63c 100644
--- a/slirp/src/mbuf.h
+++ b/slirp/src/mbuf.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1982, 1986, 1988, 1993
  * The Regents of the University of California.  All rights reserved.
diff --git a/slirp/src/ncsi-pkt.h b/slirp/src/ncsi-pkt.h
index 3867feb1d3..4c0be39f6e 100644
--- a/slirp/src/ncsi-pkt.h
+++ b/slirp/src/ncsi-pkt.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright Gavin Shan, IBM Corporation 2016.
  *
diff --git a/slirp/src/qtailq.h b/slirp/src/qtailq.h
index a89b0c439a..d8aa0e19a4 100644
--- a/slirp/src/qtailq.h
+++ b/slirp/src/qtailq.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*  $NetBSD: queue.h,v 1.52 2009/04/20 09:56:08 mschuett Exp $ */
 
 /*
diff --git a/slirp/src/tcp.h b/slirp/src/tcp.h
index 47aaea6c5b..79d3251bb5 100644
--- a/slirp/src/tcp.h
+++ b/slirp/src/tcp.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1982, 1986, 1993
  * The Regents of the University of California.  All rights reserved.
diff --git a/slirp/src/tcp_timer.h b/slirp/src/tcp_timer.h
index b25b3911d7..709f63987a 100644
--- a/slirp/src/tcp_timer.h
+++ b/slirp/src/tcp_timer.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1982, 1986, 1993
  * The Regents of the University of California.  All rights reserved.
diff --git a/slirp/src/tcp_var.h b/slirp/src/tcp_var.h
index 27ef1a51cb..162be6e95e 100644
--- a/slirp/src/tcp_var.h
+++ b/slirp/src/tcp_var.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1982, 1986, 1993, 1994
  * The Regents of the University of California.  All rights reserved.
diff --git a/slirp/src/tcpip.h b/slirp/src/tcpip.h
index 07dbf2c432..560a86417c 100644
--- a/slirp/src/tcpip.h
+++ b/slirp/src/tcpip.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1982, 1986, 1993
  * The Regents of the University of California.  All rights reserved.
diff --git a/slirp/src/udp.h b/slirp/src/udp.h
index 3d29504caa..29c0297179 100644
--- a/slirp/src/udp.h
+++ b/slirp/src/udp.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1982, 1986, 1993
  * The Regents of the University of California.  All rights reserved.
diff --git a/slirp/src/vmstate.h b/slirp/src/vmstate.h
index 21157b5ec2..44efea7b50 100644
--- a/slirp/src/vmstate.h
+++ b/slirp/src/vmstate.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * QEMU migration/snapshot declarations
  *
diff --git a/slirp/src/cksum.c b/slirp/src/cksum.c
index 25bfa67348..9599f6a280 100644
--- a/slirp/src/cksum.c
+++ b/slirp/src/cksum.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1988, 1992, 1993
  * The Regents of the University of California.  All rights reserved.
diff --git a/slirp/src/dhcpv6.c b/slirp/src/dhcpv6.c
index df350e9f26..3c8f420912 100644
--- a/slirp/src/dhcpv6.c
+++ b/slirp/src/dhcpv6.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * SLIR

[Qemu-devel] [PULL 2/8] slirp: relicense GPL files to BSD-3

2019-03-22 Thread Marc-André Lureau
In order to make slirp a standalone project, the project must have a
clear license, and be compatible with the GPL or LGPL.

Since commit 2f5f89963186d42a7ded253bc6cf5b32abb45cec ("Remove the
advertising clause from the slirp license"), slirp is BSD-3. But new
files have been added under slirp/ with QEMU GPL license since then.

The copyright holders have been asked to relicense files to BSD-3 and
gave their permission:

- slirp/dhcpv6.{c,h}

Subject: Re: Clearing slirp/ license
To: "Marc-André Lureau" , QEMU 
, Thomas Huth 
Cc: Peter Maydell , Samuel Thibault 

References: 
From: "Cédric Le Goater" 
Message-ID: 
Date: Mon, 11 Mar 2019 16:23:25 +0100

> Could you reply that you have no objection in relicensing those files
> are 3-Clause BSD?

Fine for me. You can change the license of slirp/ncsi.c and
slirp/ncsi-pkt.hto a 3-Clause BSD.

Thanks,

C.

Subject: Re: [Qemu-devel] Clearing slirp/ license
To: Peter Maydell , Shan Gavin 
Cc: Alexey Kardashevskiy , "Marc-André Lureau" 
, Gavin Shan , Thomas 
Huth , QEMU , Samuel Thibault 

References: 
 
 
 
 
 

From: "Cédric Le Goater" 
Message-ID: <4ddf6031-0df1-b3b5-965e-a181266e4...@kaod.org>
Date: Tue, 12 Mar 2019 11:49:21 +0100

> Is the code in question copyright you personally, or copyright
> IBM as your employer at the time ? If the latter, it is IBM that
> would need to approve the relicensing.

That was done. I had our legal team approve the change of license.

Thanks,

C.

From: Shan Gavin 
Date: Tue, 12 Mar 2019 15:04:54 +0800
Message-ID: 
Subject: Re: [Qemu-devel] Clearing slirp/ license
To: Alexey Kardashevskiy 
Cc: "Marc-André Lureau" , "Cédric Le Goater" 
, gws...@linux.vnet.ibm.com, Peter Maydell 
, Thomas Huth , QEMU 
, Samuel Thibault 

> Gavin, could you reply that you have no objection in relicensing
> ncsi-pkt.h as 3-Clause BSD?

No objection. Please go ahead with the relicensing.

Cheers,
Gavin

- ncsi.c, ncsi-pkt.h

Subject: Re: Clearing slirp/ license
To: "Marc-André Lureau" , QEMU 
, "Cédric Le Goater" 
Cc: Peter Maydell , Samuel Thibault 

References: 
From: Thomas Huth 
Message-ID: 
Date: Wed, 13 Feb 2019 12:30:32 +0100

> Could you reply that you have no objection in relicensing those files
> are 3-Clause BSD?

Ok, for the records: I'm fine if you change the license of dhcpv6.[ch]
to either 3-Clause BSD or 2-Clause BSD.

 Thomas

- vmstate.{c,h}

From: Juan Quintela 
To: "Marc-André Lureau" 
Cc: QEMU , Peter Maydell , 
Samuel Thibault 
Subject: Re: Clearing slirp/ license
Date: Tue, 12 Mar 2019 12:43:17 +0100
Message-ID: <87k1h4qpwq@trasno.org>

> Juan, Could you reply that you have no objection in relicensing the
> vmstate files as 3-Clause BSD?

No problem at all on my side.

Later, Juan.

Signed-off-by: Marc-André Lureau 
Reviewed-by: Eric Blake 
[ for the NC-SI files ]
Reviewed-by: Cédric Le Goater 
Acked-by: Thomas Huth 
---
 slirp/src/dhcpv6.h   | 31 +--
 slirp/src/ncsi-pkt.h | 33 +
 slirp/src/vmstate.h  | 42 +++---
 slirp/src/dhcpv6.c   | 37 +++--
 slirp/src/ncsi.c | 31 +--
 slirp/src/vmstate.c  | 31 +--
 6 files changed, 170 insertions(+), 35 deletions(-)

diff --git a/slirp/src/dhcpv6.h b/slirp/src/dhcpv6.h
index 3373f6cb89..af0e193b06 100644
--- a/slirp/src/dhcpv6.h
+++ b/slirp/src/dhcpv6.h
@@ -3,8 +3,35 @@
  *
  * Copyright 2016 Thomas Huth, Red Hat Inc.
  *
- * This work is licensed under the terms of the GNU GPL, version 2
- * or later. See the COPYING file in the top-level directory.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT L

[Qemu-devel] [PULL 7/8] slirp: remove reference to COPYRIGHT file

2019-03-22 Thread Marc-André Lureau
The slirp COPYRIGHT file is a BSD-3 license. Instead of referring to
another project file, the SPDX license notice present in all source
files states that unequivocally.

Signed-off-by: Marc-André Lureau 
Reviewed-by: Eric Blake 
---
 slirp/src/debug.h  | 3 ---
 slirp/src/if.h | 3 ---
 slirp/src/main.h   | 3 ---
 slirp/src/misc.h   | 3 ---
 slirp/src/sbuf.h   | 3 ---
 slirp/src/socket.h | 3 ---
 slirp/src/if.c | 3 ---
 slirp/src/ip_input.c   | 3 ---
 slirp/src/ip_output.c  | 3 ---
 slirp/src/mbuf.c   | 3 ---
 slirp/src/misc.c   | 3 ---
 slirp/src/sbuf.c   | 3 ---
 slirp/src/socket.c | 3 ---
 slirp/src/tcp_input.c  | 3 ---
 slirp/src/tcp_output.c | 3 ---
 slirp/src/tcp_subr.c   | 3 ---
 16 files changed, 48 deletions(-)

diff --git a/slirp/src/debug.h b/slirp/src/debug.h
index 2e503ad7fa..c95fd8ffd2 100644
--- a/slirp/src/debug.h
+++ b/slirp/src/debug.h
@@ -1,9 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski.
- *
- * Please read the file COPYRIGHT for the
- * terms and conditions of the copyright.
  */
 
 #ifndef DEBUG_H_
diff --git a/slirp/src/if.h b/slirp/src/if.h
index 8a60c4e052..b71c37d6ea 100644
--- a/slirp/src/if.h
+++ b/slirp/src/if.h
@@ -1,9 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski.
- *
- * Please read the file COPYRIGHT for the
- * terms and conditions of the copyright.
  */
 
 #ifndef IF_H
diff --git a/slirp/src/main.h b/slirp/src/main.h
index a88774215f..3b3f883703 100644
--- a/slirp/src/main.h
+++ b/slirp/src/main.h
@@ -1,9 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski.
- *
- * Please read the file COPYRIGHT for the
- * terms and conditions of the copyright.
  */
 
 #ifndef SLIRP_MAIN_H
diff --git a/slirp/src/misc.h b/slirp/src/misc.h
index 4eaa2466d7..23b7490448 100644
--- a/slirp/src/misc.h
+++ b/slirp/src/misc.h
@@ -1,9 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski.
- *
- * Please read the file COPYRIGHT for the
- * terms and conditions of the copyright.
  */
 
 #ifndef MISC_H
diff --git a/slirp/src/sbuf.h b/slirp/src/sbuf.h
index ece616e317..337af1bbde 100644
--- a/slirp/src/sbuf.h
+++ b/slirp/src/sbuf.h
@@ -1,9 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski.
- *
- * Please read the file COPYRIGHT for the
- * terms and conditions of the copyright.
  */
 
 #ifndef SBUF_H
diff --git a/slirp/src/socket.h b/slirp/src/socket.h
index 10a0c78a26..25403898cd 100644
--- a/slirp/src/socket.h
+++ b/slirp/src/socket.h
@@ -1,9 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski.
- *
- * Please read the file COPYRIGHT for the
- * terms and conditions of the copyright.
  */
 
 #ifndef SLIRP_SOCKET_H
diff --git a/slirp/src/if.c b/slirp/src/if.c
index b8cddebf66..6eaac7292a 100644
--- a/slirp/src/if.c
+++ b/slirp/src/if.c
@@ -1,9 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski.
- *
- * Please read the file COPYRIGHT for the
- * terms and conditions of the copyright.
  */
 
 #include "slirp.h"
diff --git a/slirp/src/ip_input.c b/slirp/src/ip_input.c
index 6ad6765938..a714fecd58 100644
--- a/slirp/src/ip_input.c
+++ b/slirp/src/ip_input.c
@@ -34,9 +34,6 @@
 /*
  * Changes and additions relating to SLiRP are
  * Copyright (c) 1995 Danny Gasparovski.
- *
- * Please read the file COPYRIGHT for the
- * terms and conditions of the copyright.
  */
 
 #include "slirp.h"
diff --git a/slirp/src/ip_output.c b/slirp/src/ip_output.c
index 927efb..8560197cf6 100644
--- a/slirp/src/ip_output.c
+++ b/slirp/src/ip_output.c
@@ -34,9 +34,6 @@
 /*
  * Changes and additions relating to SLiRP are
  * Copyright (c) 1995 Danny Gasparovski.
- *
- * Please read the file COPYRIGHT for the
- * terms and conditions of the copyright.
  */
 
 #include "slirp.h"
diff --git a/slirp/src/mbuf.c b/slirp/src/mbuf.c
index f079a86d78..800406ca9e 100644
--- a/slirp/src/mbuf.c
+++ b/slirp/src/mbuf.c
@@ -1,9 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski
- *
- * Please read the file COPYRIGHT for the
- * terms and conditions of the copyright.
  */
 
 /*
diff --git a/slirp/src/misc.c b/slirp/src/misc.c
index da41f3bb5f..7c5db0e0aa 100644
--- a/slirp/src/misc.c
+++ b/slirp/src/misc.c
@@ -1,9 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski.
- *
- * Please read the file COPYRIGHT for the
- * terms and conditions of the copyright.
  */
 
 #include "slirp.h"
diff --git a/slirp/src/sbuf.c b/slirp/src/sbuf.c
index 815823ffbe..9c0b31b513 100644
--- a/slirp/src/sbuf.c
+++ b/slirp/src/sbuf.c
@@ -1,9 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski.
- *
- * Please read the file COPYRIGHT for the
- * terms an

[Qemu-devel] [PULL 8/8] slirp: is not maintained by Kelly Price for a long time

2019-03-22 Thread Marc-André Lureau
slirp has been maintained by the QEMU maintainers and will be
maintained under an independent project soon.

Reviewed-by: Eric Blake 
Signed-off-by: Kelly Price 
Signed-off-by: Marc-André Lureau 
---
 slirp/COPYRIGHT | 2 --
 1 file changed, 2 deletions(-)

diff --git a/slirp/COPYRIGHT b/slirp/COPYRIGHT
index 9863ea31cb..ed49512dbc 100644
--- a/slirp/COPYRIGHT
+++ b/slirp/COPYRIGHT
@@ -1,8 +1,6 @@
 Slirp was written by Danny Gasparovski.
 Copyright (c), 1995,1996 All Rights Reserved.
 
-Slirp is maintained by Kelly Price 
-
 Slirp is free software; "free" as in you don't have to pay for it, and you
 are free to do whatever you want with it.  I do not accept any donations,
 monetary or otherwise, for Slirp.  Instead, I would ask you to pass this
-- 
2.21.0.4.g36eb1cb9cf




Re: [Qemu-devel] [PATCH v2 0/3] qemu-img: removing created when img_create fails

2019-03-22 Thread no-reply
Patchew URL: 
https://patchew.org/QEMU/20190322175241.5954-1-danielhb...@gmail.com/



Hi,

This series failed the docker-mingw@fedora build test. Please find the testing 
commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.

=== TEST SCRIPT BEGIN ===
#!/bin/bash
time make docker-test-mingw@fedora SHOW_ENV=1 J=14 NETWORK=1
=== TEST SCRIPT END ===

  CC  aarch64-softmmu/tcg/tcg-op.o
  CC  aarch64-softmmu/tcg/tcg-op-vec.o
/tmp/qemu-test/src/qemu-img.c: In function 'img_create':
/tmp/qemu-test/src/qemu-img.c:568:13: error: 'filename' may be used 
uninitialized in this function [-Werror=maybe-uninitialized]
 error_reportf_err(local_err, "%s: ", filename);
 ^~
cc1: all warnings being treated as errors


The full log is available at
http://patchew.org/logs/20190322175241.5954-1-danielhb...@gmail.com/testing.docker-mingw@fedora/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-de...@redhat.com

Re: [Qemu-devel] [PATCH 2/4] target/mips: Fix copy_s. for MIPS big endian host

2019-03-22 Thread Mateja Marjanovic



On 22.3.19. 18:45, Aleksandar Markovic wrote:

From: Mateja Marjanovic 
Subject: [PATCH 2/4] target/mips: Fix copy_s. for MIPS big endian host

From: Mateja Marjanovic 

Signed element copy from MSA registers to GPR when
executed on a MIPS big endian CPU, didn't pick the
right element, and was behaving like on little endian.

Signed-off-by: Mateja Marjanovic 
---

 From the title, I gather you are testing on a 32-bit big-endian
host. (If you had tested on a 64-bit host, you would most likely
had said "" rather than .) This means you can
test only MIPS32 MSA, since QEMU can't emulate a 64-bit target
system on a 32-bit host.

But what about COPY_S.D? This instruction is present only in
MIPS64 MSA. If you don't have access to the 64-bit big-endian
host, could you perhaps do some logical analysis of handling
of COPY_S.D on big-endian host?

Well, in the case of doubleword, there are only two registers, and
each has only one element,  unlike in the case of halfword (or word,
or byte), where the number of elements is 4 (2, 8) per register.
The difference between big endian and litlle endian is that copying
from the 0th element in little endian, is the same as copying from
the 3rd in big endian (but still in same register). Likewise, copying
from the 4th element in LE is the same as copying from the 7th
element in BE. So, if we had a number, let's say
FA87 1BC2 FED2 0411 D16B C014 BFF0 01E1
and we wanted to copy (COPY_S.H) the 1st element into the gpr,
big endian would copy 0xBFF0 into the grp, and little endian would
copy 0xC014 into the gpr (because the contents of the lower register
are D16B C014 BFF0 01E1).
 LE     0    1   2   3
 BE    3    2   1   0

An almost same question arises for the next patch of course,
regarding COPY_U.D.

I am not sure that COPY_U.D exists. One of the next patches will
correct that in target/mips/msa_helper.c and target/mips/translate.c

Sincerely,
Aleksandar

Regards,
Mateja



  target/mips/msa_helper.c | 7 +++
  1 file changed, 7 insertions(+)

diff --git a/target/mips/msa_helper.c b/target/mips/msa_helper.c
index 421dced..012f373 100644
--- a/target/mips/msa_helper.c
+++ b/target/mips/msa_helper.c
@@ -1435,6 +1435,13 @@ void helper_msa_copy_s_df(CPUMIPSState *env, uint32_t 
df, uint32_t rd,
uint32_t ws, uint32_t n)
  {
  n %= DF_ELEMENTS(df);
+#if defined(HOST_WORDS_BIGENDIAN)
+if (n < DF_ELEMENTS(df) / 2) {
+n = DF_ELEMENTS(df) / 2 - n - 1;
+} else {
+n = 3 * DF_ELEMENTS(df) / 2 - n - 1;
+}
+#endif

  switch (df) {
  case DF_BYTE:




Re: [Qemu-devel] [PATCH 4/4] target/mips: Fix insert. for MIPS big endian host

2019-03-22 Thread Mateja Marjanovic



On 22.3.19. 19:04, Aleksandar Markovic wrote:

@@ -1511,9 +1518,11 @@ void helper_msa_insert_df(CPUMIPSState *env, uint32_t 
df, uint32_t wd,
   case DF_WORD:
   pwd->w[n] = (int32_t)rs;
   break;
+#ifdef TARGET_MIPS64
   case DF_DOUBLE:
   pwd->d[n] = (int64_t)rs;
   break;
+#endif
   default:
   assert(0);
   }

You are right that this case should be under ifdef the way you did.

In fact, this code should be impossible to reach, since there is a check
for MIPS32/64 in translate.c before invoking this helper, so technically
there is no bug. However, it is a latent bag, and also an instance of
"dead code" (for MIPS32). So, you are rightfully removing this case
for MIPS32.

May I just ask you to put this in a separate patch, since this has nothing
to do with endianess etc. (with the title, let's say:

"target/mips: Remove handling of nonexistent flavor of INSERT for MIPS32",

and the commit message

"INSERT.D is present in MIPS64 MSA only. [1] page 

[1] "

)?

You are right, it has nothing to do with the endianness problem. I will
remove that in v2, and add another patch for that.


Mateja, I noticed that FILL.D has almost identical problem.

Could you create a separate patch for FILL.D too, dealing with the same
issue?

And also analyze all MIPS64-only MSA instructions in this regard?

Glancing at the MIPS64 MSA doc, they are:

COPY_S.D
COPY_U.W (this is not a typo, it is W, not D)
FILL.D
INSERT.D

Will do.


Yours,
Aleksandar

Regards,
Mateja

Thanks,
Aleksandar

Thanks,
Mateja




Re: [Qemu-devel] [PATCH 1/2] iotests: 030 TestParallelOps non-shared base node

2019-03-22 Thread Andrey Shinkevich


On 22/03/2019 18:54, Alberto Garcia wrote:
> On Thu 21 Mar 2019 03:51:12 PM CET, Alberto Garcia  wrote:
> 
>> I was checking the tests that run commit and stream in parallel in
>> 030, but they do commit on the upper images and stream on the lower
>> ones, so that's safe. I'll try to run them the other way around
>> because we might have a problem there.
> 
> I considered these scenarios with the following backing chain:
> 
> E <- D <- C <- B <- A
> 
> 1) stream from C to A, then commit from C to E
> 
> This fails because qmp_block_commit() checks for op blockers in C's
> overlay (B), which is blocked by the stream block job.
> ("Node 'B' is busy: block device is in use by block job: stream")
> 
> 2) commit from C to E, then stream from C to A
> 
> This fails because the commit job inserts a filter between C and B
> and the bdrv_freeze_backing_chain(bs, base) call in stream_start()
> fails.
> 
> However! I found this crash in a couple of occasions, I believe that
> it happens if the commit job finishes before block_stream, but I need
> to debug it further to see why the previous error didn't happen.
> 
> Program terminated with signal SIGSEGV, Segmentation fault.
> #0  0x559aca6e745d in stream_prepare (job=0x559acdafad70) at 
> block/stream.c:80
> 80  base_fmt = base->drv->format_name;
> (gdb) print base
> $1 = (BlockDriverState *) 0x559acd070240
> (gdb) print base->drv
> $2 = (BlockDriver *) 0xb5b5b5b5b5b5b5b5
> (gdb) bt
> #0  0x559aca6e745d in stream_prepare (job=0x559acdafad70) at 
> block/stream.c:80
> #1  0x559aca973a40 in job_prepare (job=0x559acdafad70) at job.c:771
> #2  0x559aca9722fd in job_txn_apply (txn=0x559acd01e6d0, 
> fn=0x559aca973a03 ) at job.c:146
> #3  0x559aca973ad2 in job_do_finalize (job=0x559acdafad70) at job.c:788
> #4  0x559aca973ca0 in job_completed_txn_success (job=0x559acdafad70) at 
> job.c:842
> #5  0x559aca973d3d in job_completed (job=0x559acdafad70) at job.c:855
> #6  0x559aca973d8c in job_exit (opaque=0x559acdafad70) at job.c:874
> #7  0x559acaa99c55 in aio_bh_call (bh=0x559acd3247f0) at util/async.c:90
> #8  0x559acaa99ced in aio_bh_poll (ctx=0x559accfb9a30) at util/async.c:118
> #9  0x559acaa9ebc0 in aio_dispatch (ctx=0x559accfb9a30) at 
> util/aio-posix.c:460
> #10 0x559acaa9a088 in aio_ctx_dispatch (source=0x559accfb9a30, 
> callback=0x0, user_data=0x0) at util/async.c:261
> #11 0x7f7d8e7787f7 in g_main_context_dispatch () from 
> /lib/x86_64-linux-gnu/libglib-2.0.so.0
> #12 0x559acaa9d4bf in glib_pollfds_poll () at util/main-loop.c:222
> #13 0x559acaa9d539 in os_host_main_loop_wait (timeout=0) at 
> util/main-loop.c:245
> #14 0x559acaa9d63e in main_loop_wait (nonblocking=0) at 
> util/main-loop.c:521
> #15 0x559aca6c0ace in main_loop () at vl.c:1969
> #16 0x559aca6c7db3 in main (argc=18, argv=0x7ffe11ee6d58, 
> envp=0x7ffe11ee6df0) at vl.c:4589
> 
> So we need to look into this :( but I'd say that it seems that stream
> should not need 'base' at all, just the node on top of it.
> 
> Berto
> 

Meanwhile, I will tackle a new series that uses a 'bottom node'
instead of the 'base'...

Andrey


Re: [Qemu-devel] [PATCH 4/4] target/mips: Fix insert. for MIPS big endian host

2019-03-22 Thread Aleksandar Markovic
> >> @@ -1511,9 +1518,11 @@ void helper_msa_insert_df(CPUMIPSState *env, 
> >> uint32_t df, uint32_t wd,
> >>   case DF_WORD:
> >>   pwd->w[n] = (int32_t)rs;
> >>   break;
> >> +#ifdef TARGET_MIPS64
> >>   case DF_DOUBLE:
> >>   pwd->d[n] = (int64_t)rs;
> >>   break;
> >> +#endif
> >>   default:
> >>   assert(0);
> >>   }
> > You are right that this case should be under ifdef the way you did.
> >
> > In fact, this code should be impossible to reach, since there is a check
> > for MIPS32/64 in translate.c before invoking this helper, so technically
> > there is no bug. However, it is a latent bag, and also an instance of
> > "dead code" (for MIPS32). So, you are rightfully removing this case
> > for MIPS32.
> >
> > May I just ask you to put this in a separate patch, since this has nothing
> > to do with endianess etc. (with the title, let's say:
> >
> > "target/mips: Remove handling of nonexistent flavor of INSERT for MIPS32",
> >
> > and the commit message
> >
> > "INSERT.D is present in MIPS64 MSA only. [1] page 
> >
> > [1] "
> >
> > )?
> You are right, it has nothing to do with the endianness problem. I will
> remove that in v2, and add another patch for that.


Mateja, I noticed that FILL.D has almost identical problem.

Could you create a separate patch for FILL.D too, dealing with the same
issue?

And also analyze all MIPS64-only MSA instructions in this regard?

Glancing at the MIPS64 MSA doc, they are:

COPY_S.D
COPY_U.W (this is not a typo, it is W, not D)
FILL.D
INSERT.D

Yours,
Aleksandar

> >
> > Thanks,
> > Aleksandar
> Thanks,
> Mateja



[Qemu-devel] [PATCH for-4.0 3/3] target/ppc: Consolidate 64-bit server processor detection in a helper

2019-03-22 Thread Greg Kurz
We use PPC_SEGMENT_64B in various places to guard code that is specific
to 64-bit server processors compliant with arch 2.x. Consolidate the
logic in a helper macro with an explicit name.

Signed-off-by: Greg Kurz 
---
 hw/ppc/ppc.c |2 +-
 target/ppc/cpu.h |6 ++
 target/ppc/helper_regs.h |2 +-
 target/ppc/translate.c   |   10 --
 4 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c
index 49d57469fb34..ad20584f268d 100644
--- a/hw/ppc/ppc.c
+++ b/hw/ppc/ppc.c
@@ -1101,7 +1101,7 @@ clk_setup_cb cpu_ppc_tb_init (CPUPPCState *env, uint32_t 
freq)
 tb_env = g_malloc0(sizeof(ppc_tb_t));
 env->tb_env = tb_env;
 tb_env->flags = PPC_DECR_UNDERFLOW_TRIGGERED;
-if (env->insns_flags & PPC_SEGMENT_64B) {
+if (is_book3s_arch2x(env)) {
 /* All Book3S 64bit CPUs implement level based DEC logic */
 tb_env->flags |= PPC_DECR_UNDERFLOW_LEVEL;
 }
diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
index fc12b4688e8c..070717758452 100644
--- a/target/ppc/cpu.h
+++ b/target/ppc/cpu.h
@@ -2409,6 +2409,12 @@ enum {
 target_ulong cpu_read_xer(CPUPPCState *env);
 void cpu_write_xer(CPUPPCState *env, target_ulong xer);
 
+/*
+ * All 64-bit server processors compliant with arch 2.x, ie. 970 and newer,
+ * have PPC_SEGMENT_64B.
+ */
+#define is_book3s_arch2x(ctx) (!!((ctx)->insns_flags & PPC_SEGMENT_64B))
+
 static inline void cpu_get_tb_cpu_state(CPUPPCState *env, target_ulong *pc,
 target_ulong *cs_base, uint32_t *flags)
 {
diff --git a/target/ppc/helper_regs.h b/target/ppc/helper_regs.h
index a2205e1044c9..c863abc0bfc3 100644
--- a/target/ppc/helper_regs.h
+++ b/target/ppc/helper_regs.h
@@ -152,7 +152,7 @@ static inline int hreg_store_msr(CPUPPCState *env, 
target_ulong value,
  * - 64-bit embedded implementations do not need any operation to be
  *   performed when PR is set.
  */
-if ((env->insns_flags & PPC_SEGMENT_64B) && ((value >> MSR_PR) & 1)) {
+if (is_book3s_arch2x(env) && ((value >> MSR_PR) & 1)) {
 value |= (1 << MSR_EE) | (1 << MSR_DR) | (1 << MSR_IR);
 }
 #endif
diff --git a/target/ppc/translate.c b/target/ppc/translate.c
index d3aaa6482c6a..576210d901ad 100644
--- a/target/ppc/translate.c
+++ b/target/ppc/translate.c
@@ -3755,7 +3755,7 @@ static void gen_bcond(DisasContext *ctx, int type)
  * arch 2.x, do implement a "test and decrement" logic instead,
  * as described in their respective UMs.
  */
-if (unlikely(!(ctx->insns_flags & PPC_SEGMENT_64B))) {
+if (unlikely(!is_book3s_arch2x(ctx))) {
 gen_inval_exception(ctx, POWERPC_EXCP_INVAL_INVAL);
 tcg_temp_free(temp);
 tcg_temp_free(target);
@@ -3913,7 +3913,7 @@ static void gen_rfi(DisasContext *ctx)
 /* This instruction doesn't exist anymore on 64-bit server
  * processors compliant with arch 2.x
  */
-if (ctx->insns_flags & PPC_SEGMENT_64B) {
+if (is_book3s_arch2x(ctx)) {
 gen_inval_exception(ctx, POWERPC_EXCP_INVAL_INVAL);
 return;
 }
@@ -6535,8 +6535,7 @@ static void gen_msgclr(DisasContext *ctx)
 GEN_PRIV;
 #else
 CHK_HV;
-/* 64-bit server processors compliant with arch 2.x */
-if (ctx->insns_flags & PPC_SEGMENT_64B) {
+if (is_book3s_arch2x(ctx)) {
 gen_helper_book3s_msgclr(cpu_env, cpu_gpr[rB(ctx->opcode)]);
 } else {
 gen_helper_msgclr(cpu_env, cpu_gpr[rB(ctx->opcode)]);
@@ -6550,8 +6549,7 @@ static void gen_msgsnd(DisasContext *ctx)
 GEN_PRIV;
 #else
 CHK_HV;
-/* 64-bit server processors compliant with arch 2.x */
-if (ctx->insns_flags & PPC_SEGMENT_64B) {
+if (is_book3s_arch2x(ctx)) {
 gen_helper_book3s_msgsnd(cpu_gpr[rB(ctx->opcode)]);
 } else {
 gen_helper_msgsnd(cpu_gpr[rB(ctx->opcode)]);




[Qemu-devel] [PATCH v2 0/3] qemu-img: removing created when img_create fails

2019-03-22 Thread Daniel Henrique Barboza
This is a patch series that follows up the patch [1] after
the review from Daniel P. Berrange.

The new interface is being implemented only by the LUKS driver
because this is the error condition I'm trying to fix. My first
idea when coding it was to implement this interface in all drivers
that deals with local files, but I thought it would be overkill -
at least for this second spin.


[1] https://lists.gnu.org/archive/html/qemu-devel/2019-03/msg05899.html


Daniel Henrique Barboza (3):
  block: introducing 'bdrv_co_delete_file' interface
  block.c: adding bdrv_delete_file
  qemu-img.c: clean up created file on img_create failure

 block.c   | 117 ++
 block/crypto.c|   2 +
 include/block/block.h |   6 ++
 include/block/block_int.h |   6 ++
 qemu-img.c|  29 +-
 5 files changed, 159 insertions(+), 1 deletion(-)

-- 
2.20.1




[Qemu-devel] [PATCH for-4.0 1/3] target/ppc: Fix TCG temporary leaks in gen_bcond()

2019-03-22 Thread Greg Kurz
Signed-off-by: Greg Kurz 
---
 target/ppc/translate.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/target/ppc/translate.c b/target/ppc/translate.c
index 98b37cebc2f5..aaafa3a715d8 100644
--- a/target/ppc/translate.c
+++ b/target/ppc/translate.c
@@ -3749,6 +3749,8 @@ static void gen_bcond(DisasContext *ctx, int type)
 TCGv temp = tcg_temp_new();
 if (unlikely(type == BCOND_CTR)) {
 gen_inval_exception(ctx, POWERPC_EXCP_INVAL_INVAL);
+tcg_temp_free(temp);
+tcg_temp_free(target);
 return;
 }
 tcg_gen_subi_tl(cpu_ctr, cpu_ctr, 1);




[Qemu-devel] [PATCH v2 1/3] block: introducing 'bdrv_co_delete_file' interface

2019-03-22 Thread Daniel Henrique Barboza
Adding to Block Drivers the capability of being able to clean up
its created files can be useful in certain situations. For the
LUKS driver, for instance, a failure in one of its authentication
steps can leave files in the host that weren't there before.

This patch adds the 'bdrv_co_delete_file' interface to block
drivers and add it to the LUKS driver. The implementation is provided
in a new 'bdrv_co_delete_file_generic' function inside block.c. This
function is made public in case other block drivers wants to
support this cleanup interface as well.

Suggested-by: Daniel P. Berrangé 
Signed-off-by: Daniel Henrique Barboza 
---
 block.c   | 45 +++
 block/crypto.c|  2 ++
 include/block/block.h |  3 +++
 include/block/block_int.h |  6 ++
 4 files changed, 56 insertions(+)

diff --git a/block.c b/block.c
index 0a93ee9ac8..2b632baba2 100644
--- a/block.c
+++ b/block.c
@@ -547,6 +547,51 @@ int bdrv_create_file(const char *filename, QemuOpts *opts, 
Error **errp)
 return ret;
 }
 
+/**
+ * Helper that checks if a given path represents a regular
+ * local file.
+ */
+bool bdrv_path_is_regular_file(const char *path)
+{
+struct stat st;
+
+return (stat(path, &st) == 0) && S_ISREG(st.st_mode);
+}
+
+/**
+ * Co-routine function that erases a regular file. Its original
+ * intent is as a implementation of bdrv_co_delete_file for
+ * the "luks" driver that can leave created files behind in the
+ * file system when the authentication fails.
+ *
+ * The function is exposed here, and with 'generic' in its name,
+ * because file removal isn't usually format specific and any other
+ * BlockDriver might want to re-use this function.
+ */
+int coroutine_fn bdrv_co_delete_file_generic(const char *filename,
+ Error **errp)
+{
+int ret;
+
+/* Skip file: protocol prefix */
+strstart(filename, "file:", &filename);
+
+if (!bdrv_path_is_regular_file(filename)) {
+ret = -ENOENT;
+error_setg_errno(errp, -ret, "%s is not a regular file", filename);
+goto done;
+}
+
+ret = unlink(filename);
+if (ret < 0) {
+ret = -errno;
+error_setg_errno(errp, -ret, "Error when deleting file %s", filename);
+}
+
+done:
+return ret;
+}
+
 /**
  * Try to get @bs's logical and physical block size.
  * On success, store them in @bsz struct and return 0.
diff --git a/block/crypto.c b/block/crypto.c
index 3af46b805f..c604c96c93 100644
--- a/block/crypto.c
+++ b/block/crypto.c
@@ -639,6 +639,8 @@ static BlockDriver bdrv_crypto_luks = {
 .bdrv_co_truncate   = block_crypto_co_truncate,
 .create_opts= &block_crypto_create_opts_luks,
 
+.bdrv_co_delete_file = bdrv_co_delete_file_generic,
+
 .bdrv_reopen_prepare = block_crypto_reopen_prepare,
 .bdrv_refresh_limits = block_crypto_refresh_limits,
 .bdrv_co_preadv = block_crypto_co_preadv,
diff --git a/include/block/block.h b/include/block/block.h
index e452988b66..efb77daf9f 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -363,6 +363,9 @@ int bdrv_freeze_backing_chain(BlockDriverState *bs, 
BlockDriverState *base,
   Error **errp);
 void bdrv_unfreeze_backing_chain(BlockDriverState *bs, BlockDriverState *base);
 
+bool bdrv_path_is_regular_file(const char *path);
+int coroutine_fn bdrv_co_delete_file_generic(const char *filename,
+ Error **errp);
 
 typedef struct BdrvCheckResult {
 int corruptions;
diff --git a/include/block/block_int.h b/include/block/block_int.h
index 01e855a066..74abb78ce7 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -309,6 +309,12 @@ struct BlockDriver {
  */
 int coroutine_fn (*bdrv_co_flush)(BlockDriverState *bs);
 
+/*
+ * Delete a local created file.
+ */
+int coroutine_fn (*bdrv_co_delete_file)(const char *filename,
+Error **errp);
+
 /*
  * Flushes all data that was already written to the OS all the way down to
  * the disk (for example file-posix.c calls fsync()).
-- 
2.20.1




[Qemu-devel] [PATCH for-4.0 0/3] target/ppc: Fix pseries.cap-ibs=workaround with TCG

2019-03-22 Thread Greg Kurz
Since recent commit 2782ad4c4102 "target/ppc/spapr: Enable mitigations by
default for pseries-4.0 machine type", some recent distros, eg. fedora29,
fail to boot under TCG because of a kernel panic:

[0.614425] Oops: Exception in kernel mode, sig: 4 [#1]
[0.618832] LE SMP NR_CPUS=1024 NUMA pSeries
[0.621868] Modules linked in:
[0.624958] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 
4.20.16-200.fc29.ppc64le #1
[0.625978] NIP:  c000bf00 LR: c000e268 CTR: 7fff
[0.626572] REGS: c15a3750 TRAP: 0700   Not tainted  
(4.20.16-200.fc29.ppc64le)
[0.626835] MSR:  82089033   CR: 44828222  
XER: 
[0.628497] CFAR: c000bee4 IRQMASK: 1 
[0.628497] GPR00: c001fbc8 c15a39e0 c15a6200 
c1533450 
[0.628497] GPR04: c0003e5819d0 c0003ff15f68  
22f63728 
[0.628497] GPR08:  7fff  
 
[0.628497] GPR12: 8000 c18b 3dc5fd20 
02e75e90 
[0.628497] GPR16: 02e75d40 c0003e594d00 3dc5fd20 
02e90b50 
[0.628497] GPR20: 3e45e800 c1531a80 c1532100 
44828222 
[0.628497] GPR24: c1533450 c1533450 c0003e5819d0 
c10e51e0 
[0.628497] GPR28: c15d5c18 c1531a80 c0003e58 
c1531a80 
[0.631710] NIP [c000bf00] flush_count_cache+0x120/0x2420
[0.631905] LR [c000e268] _switch+0x68/0x180
[0.632585] Call Trace:
[0.633490] [c15a39e0] [c15dbd58] __cpu_online_mask+0x0/0x80 
(unreliable)
[0.634383] [c15a3bc0] [c001fbc8] __switch_to+0x348/0x500
[0.634614] [c15a3c20] [c0c509dc] __schedule+0x2bc/0xac0
[0.634731] [c15a3cf0] [c0c51648] 
preempt_schedule_common+0x38/0x60
[0.634852] [c15a3d10] [c0c516d4] _cond_resched+0x64/0x80
[0.635527] [c15a3d40] [c011a190] 
copy_process.isra.4.part.5+0xc90/0x1d20
[0.635656] [c15a3e40] [c011b414] _do_fork+0xd4/0x470
[0.635772] [c15a3eb0] [c011b88c] kernel_thread+0x3c/0x50
[0.635891] [c15a3ed0] [c0010b08] rest_init+0x98/0xf8
[0.636025] [c15a3f00] [c0fe4084] start_kernel+0x658/0x67c
[0.636163] [c15a3f90] [c000b37c] 
start_here_common+0x1c/0x520
[0.636763] Instruction dump:
[0.640925] 4805 4805 4805 4805 4805 481c 6000 
6000 
[0.641448] 6000 6000 6000 6000 <7d2803a6> 39207fff 7d2903a6 
4c400420 
[0.648580] ---[ end trace 1dcd9494acdef8df ]---
[0.649361] 
[1.657870] Kernel panic - not syncing: Attempted to kill the idle task!

The following error is also printed by QEMU:

Opcode 13 10 10 00 (4c400420) leaked temporaries

The root cause behind the panic is that the linux kernel uses for spectre v2
mitigation a form of the bcctr instruction that we don't support. This gets
triggered when passing cap-ibs=workaround machine option, which is the default
since 2782ad4c4102.

The TCG temp leak comes from some missing tcg_temp_free()s on the
exception path.

This series fixes the leak and adds support for the invalid form of bcctr.
Since this adds yet another user of PPC_SEGMENT_64B to discriminate CPU
models that should expose the _new_ behaviour, the final patch introduces
a helper for that purpose.

--
Greg

---

Greg Kurz (3):
  target/ppc: Fix TCG temporary leaks in gen_bcond()
  target/ppc: Enable "decrement and test CTR" version of bcctr
  target/ppc: Consolidate 64-bit server processor detection in a helper


 hw/ppc/ppc.c |2 +-
 target/ppc/cpu.h |6 +
 target/ppc/helper_regs.h |2 +-
 target/ppc/translate.c   |   58 --
 4 files changed, 48 insertions(+), 20 deletions(-)




[Qemu-devel] [PATCH for-4.0 2/3] target/ppc: Enable "decrement and test CTR" version of bcctr

2019-03-22 Thread Greg Kurz
Even if all ISAs up to v3 indeed mention:

If the "decrement and test CTR" option is specified (BO2=0), the
instruction form is invalid.

The UMs of all existing 64-bit server class processors say:

If BO[2] = 0, the contents of CTR (before any update) are used as the
target address and for the test of the contents of CTR to resolve the
branch. The contents of the CTR are then decremented and written back
to the CTR.

The linux kernel has spectre v2 mitigation code that relies on a
BO[2] = 0 variant of bcctr, which is now activated by default on
spapr, even with TCG. This causes linux guests to panic with
the default machine type under TCG.

Since any CPU model can provide its own behaviour for invalid forms,
we could possibly introduce a new instruction flag to handle this.
In practice, since the behaviour is shared by all 64-bit server
processors starting with 970 up to POWER9, let's reuse the
PPC_SEGMENT_64B flag. Caveat: this may have to be fixed later if
POWER10 introduces a different behaviour.

The existing behaviour of throwing a program interrupt is kept for
all other CPU models.

Signed-off-by: Greg Kurz 
---
 target/ppc/translate.c |   52 ++--
 1 file changed, 37 insertions(+), 15 deletions(-)

diff --git a/target/ppc/translate.c b/target/ppc/translate.c
index aaafa3a715d8..d3aaa6482c6a 100644
--- a/target/ppc/translate.c
+++ b/target/ppc/translate.c
@@ -3747,22 +3747,44 @@ static void gen_bcond(DisasContext *ctx, int type)
 if ((bo & 0x4) == 0) {
 /* Decrement and test CTR */
 TCGv temp = tcg_temp_new();
-if (unlikely(type == BCOND_CTR)) {
-gen_inval_exception(ctx, POWERPC_EXCP_INVAL_INVAL);
-tcg_temp_free(temp);
-tcg_temp_free(target);
-return;
-}
-tcg_gen_subi_tl(cpu_ctr, cpu_ctr, 1);
-if (NARROW_MODE(ctx)) {
-tcg_gen_ext32u_tl(temp, cpu_ctr);
-} else {
-tcg_gen_mov_tl(temp, cpu_ctr);
-}
-if (bo & 0x2) {
-tcg_gen_brcondi_tl(TCG_COND_NE, temp, 0, l1);
+
+if (type == BCOND_CTR) {
+/*
+ * All ISAs up to v3 describe this form of bcctr as invalid but
+ * some processors, ie. 64-bit server processors compliant with
+ * arch 2.x, do implement a "test and decrement" logic instead,
+ * as described in their respective UMs.
+ */
+if (unlikely(!(ctx->insns_flags & PPC_SEGMENT_64B))) {
+gen_inval_exception(ctx, POWERPC_EXCP_INVAL_INVAL);
+tcg_temp_free(temp);
+tcg_temp_free(target);
+return;
+}
+
+if (NARROW_MODE(ctx)) {
+tcg_gen_ext32u_tl(temp, cpu_ctr);
+} else {
+tcg_gen_mov_tl(temp, cpu_ctr);
+}
+if (bo & 0x2) {
+tcg_gen_brcondi_tl(TCG_COND_NE, temp, 0, l1);
+} else {
+tcg_gen_brcondi_tl(TCG_COND_EQ, temp, 0, l1);
+}
+tcg_gen_subi_tl(cpu_ctr, cpu_ctr, 1);
 } else {
-tcg_gen_brcondi_tl(TCG_COND_EQ, temp, 0, l1);
+tcg_gen_subi_tl(cpu_ctr, cpu_ctr, 1);
+if (NARROW_MODE(ctx)) {
+tcg_gen_ext32u_tl(temp, cpu_ctr);
+} else {
+tcg_gen_mov_tl(temp, cpu_ctr);
+}
+if (bo & 0x2) {
+tcg_gen_brcondi_tl(TCG_COND_NE, temp, 0, l1);
+} else {
+tcg_gen_brcondi_tl(TCG_COND_EQ, temp, 0, l1);
+}
 }
 tcg_temp_free(temp);
 }




[Qemu-devel] [PATCH v2 2/3] block.c: adding bdrv_delete_file

2019-03-22 Thread Daniel Henrique Barboza
Using the new 'bdrv_co_delete_file' interface, bdrv_delete_file
can be used in a way similar of the existing bdrv_create_file to
invoke a driver, given by a format @fmt, to clean up a created
file.

The logic is also similar to what is already done in bdrv_create_file:
a qemu_coroutine is created if needed, a specialized function
bdrv_delete_co_entry is used to call the bdrv_co_delete_file
co-routine of the driver, if the driver implements it.

Suggested-by: Daniel P. Berrangé 
Signed-off-by: Daniel Henrique Barboza 
---

@Daniel: I put the 'Suggested-by' tag here aware that what is being
done in this patch wasn't explicitly suggested by you in that review.
However, since it's a consequence of your suggestion, here it is.

If you mind the tag here, let me know and we can remove it.


 block.c   | 72 +++
 include/block/block.h |  3 ++
 2 files changed, 75 insertions(+)

diff --git a/block.c b/block.c
index 2b632baba2..5c7781e471 100644
--- a/block.c
+++ b/block.c
@@ -592,6 +592,78 @@ done:
 return ret;
 }
 
+static void coroutine_fn bdrv_delete_co_entry(void *opaque)
+{
+Error *local_err = NULL;
+int ret;
+
+CreateCo *cco = opaque;
+assert(cco->drv);
+
+ret = cco->drv->bdrv_co_delete_file(cco->filename, &local_err);
+error_propagate(&cco->err, local_err);
+cco->ret = ret;
+}
+
+int bdrv_delete_file(const char *filename, const char *fmt,
+ Error **errp)
+{
+
+BlockDriver *drv = bdrv_find_format(fmt);
+Coroutine *co;
+CreateCo cco = {
+.drv = drv,
+.filename = g_strdup(filename),
+.ret = NOT_DONE,
+.err = NULL,
+};
+int ret;
+
+if (!drv) {
+error_setg(errp, "Unknown file format '%s'", fmt);
+ret = -ENOENT;
+goto out;
+}
+
+if (!drv->bdrv_co_delete_file) {
+error_setg(errp, "Driver '%s' does not support image delete",
+   drv->format_name);
+ret = -ENOTSUP;
+goto out;
+}
+
+if (!drv->bdrv_co_delete_file) {
+error_setg(errp, "Driver '%s' does not support image delete",
+   drv->format_name);
+ret = -ENOTSUP;
+goto out;
+}
+
+if (qemu_in_coroutine()) {
+/* Fast-path if already in coroutine context */
+bdrv_delete_co_entry(&cco);
+} else {
+co = qemu_coroutine_create(bdrv_delete_co_entry, &cco);
+qemu_coroutine_enter(co);
+while (cco.ret == NOT_DONE) {
+aio_poll(qemu_get_aio_context(), true);
+}
+}
+
+ret = cco.ret;
+if (ret < 0) {
+if (cco.err) {
+error_propagate(errp, cco.err);
+} else {
+error_setg_errno(errp, -ret, "Could not delete image");
+}
+}
+
+out:
+g_free(cco.filename);
+return ret;
+}
+
 /**
  * Try to get @bs's logical and physical block size.
  * On success, store them in @bsz struct and return 0.
diff --git a/include/block/block.h b/include/block/block.h
index efb77daf9f..9b66cf00cb 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -366,6 +366,9 @@ void bdrv_unfreeze_backing_chain(BlockDriverState *bs, 
BlockDriverState *base);
 bool bdrv_path_is_regular_file(const char *path);
 int coroutine_fn bdrv_co_delete_file_generic(const char *filename,
  Error **errp);
+int bdrv_delete_file(const char *filename, const char *fmt,
+ Error **errp);
+
 
 typedef struct BdrvCheckResult {
 int corruptions;
-- 
2.20.1




[Qemu-devel] [PATCH v2 3/3] qemu-img.c: clean up created file on img_create failure

2019-03-22 Thread Daniel Henrique Barboza
When using a non-UTF8 secret to create a volume using qemu-img, the
following error happens:

$ qemu-img create -f luks --object 
secret,id=vol_1_encrypt0,file=vol_resize_pool.vol_1.secret.qzVQrI -o 
key-secret=vol_1_encrypt0 /var/tmp/pool_target/vol_1 10240K

Formatting '/var/tmp/pool_target/vol_1', fmt=luks size=10485760 
key-secret=vol_1_encrypt0
qemu-img: /var/tmp/pool_target/vol_1: Data from secret vol_1_encrypt0 is not 
valid UTF-8

However, the created file /var/tmp/pool_target/vol_1 is left behind in the
file system after the failure. This behavior can be observed when creating
the volume using Libvirt, via 'virsh vol-create', and then getting "volume
target path already exist" errors when trying to re-create the volume.

The volume file is created inside block_crypto_co_create_opts_luks, in
block/crypto.c. If the bdrv_create_file() call is successful but any
succeeding step fails*, the existing 'fail' label does not take into
account the created file, leaving it behind.

This patch changes img_create to check if @filename is an existing file
before bdrv_img_create is called. In case of failure, if @filename didn't
exist before, check again for its existence and, if affirmative, erase it
by calling bdrv_delete_file.

* in our case, block_crypto_co_create_generic calls qcrypto_block_create,
which calls qcrypto_block_luks_create, and this function fails when
calling qcrypto_secret_lookup_as_utf8.

Reported-by: Srikanth Aithal 
Suggested-by: Daniel P. Berrangé 
Signed-off-by: Daniel Henrique Barboza 
---
 qemu-img.c | 29 -
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/qemu-img.c b/qemu-img.c
index 5fac840742..03b139b4ac 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -422,11 +422,12 @@ static int img_create(int argc, char **argv)
 uint64_t img_size = -1;
 const char *fmt = "raw";
 const char *base_fmt = NULL;
-const char *filename;
+const char *filename, *path;
 const char *base_filename = NULL;
 char *options = NULL;
 Error *local_err = NULL;
 bool quiet = false;
+bool file_already_existed = false;
 int flags = 0;
 
 for(;;) {
@@ -529,6 +530,15 @@ static int img_create(int argc, char **argv)
 error_exit("Unexpected argument: %s", argv[optind]);
 }
 
+/*
+ * Check if 'filename' represents a local file that already
+ * exists in the file system prior to bdrv_img_create. Strip
+ * the leading 'file:' from the filename if it exists.
+ */
+path = filename;
+strstart(path, "file:", &path);
+file_already_existed = bdrv_path_is_regular_file(path);
+
 bdrv_img_create(filename, fmt, base_filename, base_fmt,
 options, img_size, flags, quiet, &local_err);
 if (local_err) {
@@ -541,6 +551,23 @@ static int img_create(int argc, char **argv)
 
 fail:
 g_free(options);
+/*
+ * If an error occurred and we ended up creating a bogus
+ * 'filename' file, delete it
+ */
+if (!file_already_existed && bdrv_path_is_regular_file(path)) {
+
+int ret = bdrv_delete_file(path, fmt, &local_err);
+/*
+ * ENOTSUP will happen if the block driver doesn't support
+ * 'bdrv_co_delete_file'. ENOENT will happen if the file
+ * doesn't exist. Both are predictable and shouldn't be
+ * reported back to the user.
+ */
+if ((ret < 0) && (ret != -ENOTSUP) && (ret != -ENOENT)) {
+error_reportf_err(local_err, "%s: ", filename);
+}
+}
 return 1;
 }
 
-- 
2.20.1




Re: [Qemu-devel] [PATCH 2/4] target/mips: Fix copy_s. for MIPS big endian host

2019-03-22 Thread Aleksandar Markovic
> From: Mateja Marjanovic 
> Subject: [PATCH 2/4] target/mips: Fix copy_s. for MIPS big endian host
> 
> From: Mateja Marjanovic 
> 
> Signed element copy from MSA registers to GPR when
> executed on a MIPS big endian CPU, didn't pick the
> right element, and was behaving like on little endian.
> 
> Signed-off-by: Mateja Marjanovic 
> ---

>From the title, I gather you are testing on a 32-bit big-endian
host. (If you had tested on a 64-bit host, you would most likely
had said "" rather than .) This means you can
test only MIPS32 MSA, since QEMU can't emulate a 64-bit target
system on a 32-bit host.

But what about COPY_S.D? This instruction is present only in
MIPS64 MSA. If you don't have access to the 64-bit big-endian
host, could you perhaps do some logical analysis of handling
of COPY_S.D on big-endian host?

An almost same question arises for the next patch of course,
regarding COPY_U.D.

Sincerely,
Aleksandar

>  target/mips/msa_helper.c | 7 +++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/target/mips/msa_helper.c b/target/mips/msa_helper.c
> index 421dced..012f373 100644
> --- a/target/mips/msa_helper.c
> +++ b/target/mips/msa_helper.c
> @@ -1435,6 +1435,13 @@ void helper_msa_copy_s_df(CPUMIPSState *env, uint32_t 
> df, uint32_t rd,
>uint32_t ws, uint32_t n)
>  {
>  n %= DF_ELEMENTS(df);
> +#if defined(HOST_WORDS_BIGENDIAN)
> +if (n < DF_ELEMENTS(df) / 2) {
> +n = DF_ELEMENTS(df) / 2 - n - 1;
> +} else {
> +n = 3 * DF_ELEMENTS(df) / 2 - n - 1;
> +}
> +#endif
> 
>  switch (df) {
>  case DF_BYTE:




Re: [Qemu-devel] [PATCH 4/4] target/mips: Fix insert. for MIPS big endian host

2019-03-22 Thread Mateja Marjanovic



On 22.3.19. 18:16, Aleksandar Markovic wrote:

From: Mateja Marjanovic 
Subject: [PATCH 4/4] target/mips: Fix insert. for MIPS big endian host

From: Mateja Marjanovic 

Inserting from GPR to an element in a MSA register when
executed on a MIPS big endian CPU, didn't pick the
right element, and was behaving like on little endian.

Signed-off-by: Mateja Marjanovic 
---

...


@@ -1511,9 +1518,11 @@ void helper_msa_insert_df(CPUMIPSState *env, uint32_t 
df, uint32_t wd,
  case DF_WORD:
  pwd->w[n] = (int32_t)rs;
  break;
+#ifdef TARGET_MIPS64
  case DF_DOUBLE:
  pwd->d[n] = (int64_t)rs;
  break;
+#endif
  default:
  assert(0);
  }

You are right that this case should be under ifdef the way you did.

In fact, this code should be impossible to reach, since there is a check
for MIPS32/64 in translate.c before invoking this helper, so technically
there is no bug. However, it is a latent bag, and also an instance of
"dead code" (for MIPS32). So, you are rightfully removing this case
for MIPS32.

May I just ask you to put this in a separate patch, since this has nothing
to do with endianess etc. (with the title, let's say:

"target/mips: Remove handling of nonexistent flavor of INSERT for MIPS32",

and the commit message

"INSERT.D is present in MIPS64 MSA only. [1] page 

[1] "

)?
You are right, it has nothing to do with the endianness problem. I will 
remove that in v2, and add another patch for that.


Thanks,
Aleksandar

Thanks,
Mateja



Re: [Qemu-devel] [PATCH 1/4] Clean up wrong usage of FALSE and TRUE in places that use bool from stdbool.h

2019-03-22 Thread Eric Blake
On 3/22/19 7:05 AM, JafarAbdi wrote:
> Signed-off-by: JafarAbdi 
> ---

Thank you for your submission - it looks like your first contribution to
qemu.  However, I have some suggestions that will make it easier to get
your patches applied:

- Use a cover letter. Since you sent a series, including a 0/4 cover
letter makes it easier to reply to the series as a whole, and easier for
our continuous integration tools to run tests on your patches (for a
single patch, a cover letter is optional).

- Use distinct subject lines. Reusing the same subject line for four
different patches doesn't help anyone distinguish which patch to
backport in isolation (if only one of the four needs to be applied to a
downstream port).

- Use shorter subject lines. Try to stick to around 60 characters, and
using a 'topic: Description' layout (you can view git log of the file
you are touching to see topics that have been chosen in the past for
that file; for example, THIS patch would be better titled
  authz: fix usage of bool
then use the body to explain how TRUE/FALSE are for glib's (lame)
'gboolean' type only, and everywhere else we prefer  spelling.

- The subject line should say "what" (which you vaguely did, other than
missing the topic part), but the commit body should say "why" (what
problems are you fixing, why should a maintainer include your patch,
etc). You had no commit body other than your Sign-off.

- Your Sign off should be a legal name. I'm not one to argue whether
'JafarAbdi' is (one of) your legal name(s), but without a space it looks
suspicious as if it might be your login name instead, so I'm wondering
if you need to tweak your git settings so that you show up as 'Jafar
Abdi' or whatever other spelling you prefer to go by on legal documents.

>  authz/listfile.c | 2 +-
>  qemu.config  | 2 +
>  qemu.creator | 1 +
>  qemu.files   | 28238 
> +
>  qemu.includes|  2568 +
>  5 files changed, 30810 insertions(+), 1 deletion(-)
>  create mode 100644 qemu.config
>  create mode 100644 qemu.creator
>  create mode 100644 qemu.files
>  create mode 100644 qemu.includes

- Your diffstat is highly unusual. (Thankfully, your email did not
actually include 28238 bogus lines of changes to qemu.files, or it would
have been a lot larger than 6k). Use 'git rebase -i' to polish your
patches before sending, so that you don't have to touch up your emails
to drop cruft that shouldn't be in the commit after all.

- You failed to cc: the maintainer for the file that your patch touches
(for authz, scripts/get_maintainer.pl reports that Dan Berrange should
be listed in cc; which I've done). Git can be configured to auto-cc
maintainers without you having to think about it.

- More patch submission tips at:
https://wiki.qemu.org/Contribute/SubmitAPatch

Good luck!

> 
> diff --git a/authz/listfile.c b/authz/listfile.c
> index d457976..03eaf46 100644
> --- a/authz/listfile.c
> +++ b/authz/listfile.c
> @@ -238,7 +238,7 @@ qauthz_list_file_init(Object *obj)
>  
>  authz->file_watch = -1;
>  #ifdef CONFIG_INOTIFY1
> -authz->refresh = TRUE;
> +authz->refresh = true;
>  #endif
>  }
>  
> 

At any rate, this code change is correct, so if you submit a v2 with an
improved commit message, you can add:

Reviewed-by: Eric Blake 

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



signature.asc
Description: OpenPGP digital signature


[Qemu-devel] [PATCH] hardfloat: fix float32/64 fused multiply-add

2019-03-22 Thread Kito Cheng
hardfloat fused multiply-add might fallback to softfloat mode in some
situation, but it might already changed the value of input operands,
so we must restore those value before fallback.

This bug is catched by running gcc testsuite on RISC-V qemu.

Signed-off-by: Kito Cheng 
---
 fpu/softfloat.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index 4610738..f53f391 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -1596,6 +1596,7 @@ float32_muladd(float32 xa, float32 xb, float32
xc, int flags, float_status *s)
 }
 ur.h = up.h + uc.h;
 } else {
+union_float32 ux = ua, uy = uc;
 if (flags & float_muladd_negate_product) {
 ua.h = -ua.h;
 }
@@ -1608,6 +1609,8 @@ float32_muladd(float32 xa, float32 xb, float32
xc, int flags, float_status *s)
 if (unlikely(f32_is_inf(ur))) {
 s->float_exception_flags |= float_flag_overflow;
 } else if (unlikely(fabsf(ur.h) <= FLT_MIN)) {
+ua.h = ux.h;
+uc.h = uy.h;
 goto soft;
 }
 }
@@ -1662,6 +1665,8 @@ float64_muladd(float64 xa, float64 xb, float64
xc, int flags, float_status *s)
 }
 ur.h = up.h + uc.h;
 } else {
+union_float64 ux = ua, uy = uc;
+
 if (flags & float_muladd_negate_product) {
 ua.h = -ua.h;
 }
@@ -1674,6 +1679,8 @@ float64_muladd(float64 xa, float64 xb, float64
xc, int flags, float_status *s)
 if (unlikely(f64_is_inf(ur))) {
 s->float_exception_flags |= float_flag_overflow;
 } else if (unlikely(fabs(ur.h) <= FLT_MIN)) {
+ua.h = ux.h;
+uc.h = uy.h;
 goto soft;
 }
 }



Re: [Qemu-devel] [PATCH 4/4] target/mips: Fix insert. for MIPS big endian host

2019-03-22 Thread Aleksandar Markovic
> From: Mateja Marjanovic 
> Subject: [PATCH 4/4] target/mips: Fix insert. for MIPS big endian host
> 
> From: Mateja Marjanovic 
> 
> Inserting from GPR to an element in a MSA register when
> executed on a MIPS big endian CPU, didn't pick the
> right element, and was behaving like on little endian.
> 
> Signed-off-by: Mateja Marjanovic 
> ---

...

> @@ -1511,9 +1518,11 @@ void helper_msa_insert_df(CPUMIPSState *env, uint32_t 
> df, uint32_t wd,
>  case DF_WORD:
>  pwd->w[n] = (int32_t)rs;
>  break;
> +#ifdef TARGET_MIPS64
>  case DF_DOUBLE:
>  pwd->d[n] = (int64_t)rs;
>  break;
> +#endif
>  default:
>  assert(0);
>  }

You are right that this case should be under ifdef the way you did.

In fact, this code should be impossible to reach, since there is a check
for MIPS32/64 in translate.c before invoking this helper, so technically
there is no bug. However, it is a latent bag, and also an instance of
"dead code" (for MIPS32). So, you are rightfully removing this case
for MIPS32.

May I just ask you to put this in a separate patch, since this has nothing
to do with endianess etc. (with the title, let's say:

"target/mips: Remove handling of nonexistent flavor of INSERT for MIPS32",

and the commit message

"INSERT.D is present in MIPS64 MSA only. [1] page 

[1] "

)?

Thanks,
Aleksandar



[Qemu-devel] [PATCH 3/3] target/arm: make pmccntr_op_start/finish static

2019-03-22 Thread Andrew Jones
These functions are not used outside helper.c

Signed-off-by: Andrew Jones 
---
 target/arm/cpu.h| 11 ---
 target/arm/helper.c |  4 ++--
 2 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/target/arm/cpu.h b/target/arm/cpu.h
index 5f23c621325c..d4d2836923df 100644
--- a/target/arm/cpu.h
+++ b/target/arm/cpu.h
@@ -992,17 +992,6 @@ static inline bool is_a64(CPUARMState *env)
 int cpu_arm_signal_handler(int host_signum, void *pinfo,
void *puc);
 
-/**
- * pmccntr_op_start/finish
- * @env: CPUARMState
- *
- * Convert the counter in the PMCCNTR between its delta form (the typical mode
- * when it's enabled) and the guest-visible value. These two calls must always
- * surround any action which might affect the counter.
- */
-void pmccntr_op_start(CPUARMState *env);
-void pmccntr_op_finish(CPUARMState *env);
-
 /**
  * pmu_op_start/finish
  * @env: CPUARMState
diff --git a/target/arm/helper.c b/target/arm/helper.c
index fc73488f6cc0..a36f4b3d6997 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -1337,7 +1337,7 @@ static void pmu_update_irq(CPUARMState *env)
  * etc. can be done logically. This is essentially a no-op if the counter is
  * not enabled at the time of the call.
  */
-void pmccntr_op_start(CPUARMState *env)
+static void pmccntr_op_start(CPUARMState *env)
 {
 uint64_t cycles = cycles_get_count(env);
 
@@ -1367,7 +1367,7 @@ void pmccntr_op_start(CPUARMState *env)
  * guest-visible count. A call to pmccntr_op_finish should follow every call to
  * pmccntr_op_start.
  */
-void pmccntr_op_finish(CPUARMState *env)
+static void pmccntr_op_finish(CPUARMState *env)
 {
 if (pmu_counter_enabled(env, 31)) {
 #ifndef CONFIG_USER_ONLY
-- 
2.17.2




[Qemu-devel] [PATCH] target/arm: default config

2019-03-22 Thread Andrew Jones
In the kconfig shuffle arm lost pci-testdev which is used by
kvm-unit-tests. Let's add it back.

Signed-off-by: Andrew Jones 
---
 default-configs/arm-softmmu.mak | 1 +
 1 file changed, 1 insertion(+)

diff --git a/default-configs/arm-softmmu.mak b/default-configs/arm-softmmu.mak
index 2a7efc11674a..613d19a06db2 100644
--- a/default-configs/arm-softmmu.mak
+++ b/default-configs/arm-softmmu.mak
@@ -2,6 +2,7 @@
 
 CONFIG_PCI=y
 CONFIG_PCI_DEVICES=y
+CONFIG_PCI_TESTDEV=y
 CONFIG_VGA=y
 CONFIG_NAND=y
 CONFIG_ECC=y
-- 
2.17.2




[Qemu-devel] target/arm: kvm-unit-tests gicv2 test failures on tcg

2019-03-22 Thread Andrew Jones


Hi TCG GIC developers,

There are a few gicv2 test failures when running over TCG that we don't
see when running over KVM. I don't believe these are regressions - I'm
pretty sure they've been failing since Andre first introduced the tests.
I'm just pointing them out now in case anybody would like to look into
them:

  $ git clone git://git.kernel.org/pub/scm/virt/kvm/kvm-unit-tests.git
  $ cd kvm-unit-tests
  $ ./configure --arch=arm64 --cross-prefix=aarch64-linux-gnu-
  $ make -j
  $ export QEMU=/path/to/qemu-system-aarch64
  $ ./run_tests.sh -g gic
  $ grep FAIL logs/gic*
  logs/gicv2-mmio-3p.log:FAIL: gicv2: mmio: ITARGETSR: bits for 5 non-existent 
CPUs masked
  logs/gicv2-mmio-3p.log:FAIL: gicv2: mmio: ITARGETSR: register content 
preserved (01030207 => 0103020f)
  logs/gicv2-mmio-3p.log:FAIL: gicv2: mmio: ITARGETSR: byte writes successful 
(0x1f => 0x011f020f)
  logs/gicv2-mmio.log:FAIL: gicv2: mmio: ITARGETSR: bits for 4 non-existent 
CPUs masked
  logs/gicv2-mmio.log:FAIL: gicv2: mmio: ITARGETSR: byte writes successful 
(0x1f => 0x011f020f)
  logs/gicv2-mmio-up.log:FAIL: gicv2: mmio: ITARGETSR: register content 
preserved (01010001 => )
  logs/gicv2-mmio-up.log:FAIL: gicv2: mmio: ITARGETSR: byte writes successful 
(0x1f => 0x)

Thanks,
drew



Re: [Qemu-devel] target/arm: kvm-unit-tests gicv2 test failures on tcg

2019-03-22 Thread Peter Maydell
On Fri, 22 Mar 2019 at 16:40, Andrew Jones  wrote:
> Hi TCG GIC developers,
>
> There are a few gicv2 test failures when running over TCG that we don't
> see when running over KVM. I don't believe these are regressions - I'm
> pretty sure they've been failing since Andre first introduced the tests.
> I'm just pointing them out now in case anybody would like to look into
> them:
>
>   $ git clone git://git.kernel.org/pub/scm/virt/kvm/kvm-unit-tests.git
>   $ cd kvm-unit-tests
>   $ ./configure --arch=arm64 --cross-prefix=aarch64-linux-gnu-
>   $ make -j
>   $ export QEMU=/path/to/qemu-system-aarch64
>   $ ./run_tests.sh -g gic
>   $ grep FAIL logs/gic*
>   logs/gicv2-mmio-3p.log:FAIL: gicv2: mmio: ITARGETSR: bits for 5 
> non-existent CPUs masked
>   logs/gicv2-mmio-3p.log:FAIL: gicv2: mmio: ITARGETSR: register content 
> preserved (01030207 => 0103020f)
>   logs/gicv2-mmio-3p.log:FAIL: gicv2: mmio: ITARGETSR: byte writes successful 
> (0x1f => 0x011f020f)
>   logs/gicv2-mmio.log:FAIL: gicv2: mmio: ITARGETSR: bits for 4 non-existent 
> CPUs masked
>   logs/gicv2-mmio.log:FAIL: gicv2: mmio: ITARGETSR: byte writes successful 
> (0x1f => 0x011f020f)
>   logs/gicv2-mmio-up.log:FAIL: gicv2: mmio: ITARGETSR: register content 
> preserved (01010001 => )
>   logs/gicv2-mmio-up.log:FAIL: gicv2: mmio: ITARGETSR: byte writes successful 
> (0x1f => 0x)

Haven't looked at the tests or the GIC code, but I'm guessing from
the logs that these are the usual tendency of and our device models
to implement "bits that should be reserved" in registers as
reads-as-written, relying on the guest code not to set them.
This is strictly incorrect (the GICv2 spec says implementations
must make RAZ/WI bits really read-as-zero) but it seems unlikely
to trip up real world code.

I'm happy to review a patch if somebody wants to write one.

thanks
-- PMM



Re: [Qemu-devel] [PATCH v4 0/8] slirp: clarify license of slirp as BSD-3

2019-03-22 Thread Marc-André Lureau
Hi
On Fri, Mar 22, 2019 at 5:43 PM Marc-André Lureau
 wrote:
>
> Hi,
>
> In order to make slirp a standalone project, the project must have a
> clear license, and be compatible with the GPL or LGPL.
>
> Since commit 2f5f89963186d42a7ded253bc6cf5b32abb45cec ("Remove the
> advertising clause from the slirp license"), slirp is BSD-3. But new
> files have been added under slirp/ with QEMU GPL license since then.
>
> v4:
>  - update SPDX-patches commit titles to differentiate them, as
>suggested by Eric
>  - add a-b & r-b tags
>

This version should be queue-able, hopefully. Samuel, I am not sure if
you are willing to do it.

If no objections, I can also send a pullreq to Peter?

cheers



[Qemu-devel] [PATCH v4 5/8] slirp: clarify license of slirp files using SPDX: implicit via COPYRIGHT

2019-03-22 Thread Marc-André Lureau
Add SPDX license identifier to clarify the license of files with
reference to BSD license from slirp COPYRIGHT file.

Signed-off-by: Marc-André Lureau 
Reviewed-by: Thomas Huth 
---
 slirp/src/debug.h  | 1 +
 slirp/src/if.h | 1 +
 slirp/src/main.h   | 1 +
 slirp/src/misc.h   | 1 +
 slirp/src/sbuf.h   | 1 +
 slirp/src/socket.h | 1 +
 slirp/src/if.c | 1 +
 slirp/src/mbuf.c   | 1 +
 slirp/src/misc.c   | 1 +
 slirp/src/sbuf.c   | 1 +
 slirp/src/socket.c | 1 +
 11 files changed, 11 insertions(+)

diff --git a/slirp/src/debug.h b/slirp/src/debug.h
index 44d922df37..2e503ad7fa 100644
--- a/slirp/src/debug.h
+++ b/slirp/src/debug.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski.
  *
diff --git a/slirp/src/if.h b/slirp/src/if.h
index 69569c10df..8a60c4e052 100644
--- a/slirp/src/if.h
+++ b/slirp/src/if.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski.
  *
diff --git a/slirp/src/main.h b/slirp/src/main.h
index f11d4572b7..a88774215f 100644
--- a/slirp/src/main.h
+++ b/slirp/src/main.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski.
  *
diff --git a/slirp/src/misc.h b/slirp/src/misc.h
index c2ceadb591..4eaa2466d7 100644
--- a/slirp/src/misc.h
+++ b/slirp/src/misc.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski.
  *
diff --git a/slirp/src/sbuf.h b/slirp/src/sbuf.h
index 1cb9a42834..ece616e317 100644
--- a/slirp/src/sbuf.h
+++ b/slirp/src/sbuf.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski.
  *
diff --git a/slirp/src/socket.h b/slirp/src/socket.h
index e4d12cd591..10a0c78a26 100644
--- a/slirp/src/socket.h
+++ b/slirp/src/socket.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski.
  *
diff --git a/slirp/src/if.c b/slirp/src/if.c
index 1830cc396c..b8cddebf66 100644
--- a/slirp/src/if.c
+++ b/slirp/src/if.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski.
  *
diff --git a/slirp/src/mbuf.c b/slirp/src/mbuf.c
index 521c02c967..f079a86d78 100644
--- a/slirp/src/mbuf.c
+++ b/slirp/src/mbuf.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski
  *
diff --git a/slirp/src/misc.c b/slirp/src/misc.c
index 937a418d4e..da41f3bb5f 100644
--- a/slirp/src/misc.c
+++ b/slirp/src/misc.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski.
  *
diff --git a/slirp/src/sbuf.c b/slirp/src/sbuf.c
index 51a9f0cc7d..815823ffbe 100644
--- a/slirp/src/sbuf.c
+++ b/slirp/src/sbuf.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski.
  *
diff --git a/slirp/src/socket.c b/slirp/src/socket.c
index f2428a3ae8..ad58262a06 100644
--- a/slirp/src/socket.c
+++ b/slirp/src/socket.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski.
  *
-- 
2.21.0.4.g36eb1cb9cf




Re: [Qemu-devel] [PATCH 0/3] target/arm: pmu fixes

2019-03-22 Thread Andrew Jones
On Fri, Mar 22, 2019 at 05:23:30PM +0100, Andrew Jones wrote:
> The first two patches fix a regression I found when running
> the arm (as opposed to arm64) pmu kvm-unit-tests test on tcg,
> 
>   $ git clone git://git.kernel.org/pub/scm/virt/kvm/kvm-unit-tests.git
>   $ cd kvm-unit-tests
>   $ ./configure --arch=arm --cross-prefix=arm-linux-gnu-
>   $ make -j
>   $ export QEMU=/path/to/qemu-system-arm or qemu-system-aarch64
>   $ arm/run arm/pmu.flat
> 
> After checking the QEMU code I found it's also reproducible with
> the arm64 test if the PMU is removed,
> 
>   $ ./configure --arch=arm64 --cross-prefix=aarch64-linux-gnu-
>   $ make -j
>   $ export QEMU=/path/to/qemu-system-aarch64
>   $ arm/run arm/pmu.flat -cpu cortex-a57,pmu=off

Small correction here: I had to also hack the unit test to not
bail out when it didn't see a PMU advertised in the ID register.

diff --git a/arm/pmu.c b/arm/pmu.c
index 1de7d77d184f..185ff77244ed 100644
--- a/arm/pmu.c
+++ b/arm/pmu.c
@@ -291,8 +291,9 @@ int main(int argc, char *argv[])
cpi = atol(argv[1]);
 
if (!pmu_probe()) {
-  printf("No PMU found, test skipped...\n");
-  return report_summary();
+//  printf("No PMU found, test skipped...\n");
+  printf("No PMU found, let's crash!\n");
+//  return report_summary();
}
 
report_prefix_push("pmu");

> 
> Those tests used to pass, but now QEMU was crashing. I've broken
> the fix into two patches because the second patch is a bit of
> an RFC since I don't know if it's safe to enable all
> ARM_FEATURE_PMU code for PMUv2. Maybe that feature is only for
> PMUv3? This patch also enables the pmu cpu property to work with
> those cpu types, i.e. we can now do '-cpu cortex-a15,pmu=off' to
> remove the pmu. Although it wasn't clear to me if the PMU is
> optional (permitted to be removed) on those cpu types from the
> manuals.
> 
> The last patch is just a trivial cleanup.
> 
> Andrew Jones (3):
>   target/arm: fix crash on pmu register access
>   target/arm: cortex-a7 and cortex-a15 have pmus
>   target/arm: make pmccntr_op_start/finish static
> 
>  target/arm/cpu.c|  3 +++
>  target/arm/cpu.h| 11 ---
>  target/arm/helper.c |  8 ++--
>  3 files changed, 9 insertions(+), 13 deletions(-)
> 
> -- 
> 2.17.2
> 



[Qemu-devel] [PATCH v4 6/8] slirp: clarify license of slirp files using SPDX: implicit via unstated

2019-03-22 Thread Marc-André Lureau
Add SPDX license identifier to clarify the license of files without
explicit license header.

Signed-off-by: Marc-André Lureau 
Reviewed-by: Thomas Huth 
---
 slirp/src/bootp.h  | 1 +
 slirp/src/ip6.h| 1 +
 slirp/src/ip6_icmp.h   | 1 +
 slirp/src/libslirp.h   | 1 +
 slirp/src/slirp.h  | 1 +
 slirp/src/stream.h | 1 +
 slirp/src/tftp.h   | 1 +
 slirp/src/ip6_icmp.c   | 1 +
 slirp/src/ip6_input.c  | 1 +
 slirp/src/ip6_output.c | 1 +
 slirp/src/ndp_table.c  | 1 +
 slirp/src/udp6.c   | 1 +
 12 files changed, 12 insertions(+)

diff --git a/slirp/src/bootp.h b/slirp/src/bootp.h
index 4043489835..d881ad620a 100644
--- a/slirp/src/bootp.h
+++ b/slirp/src/bootp.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /* bootp/dhcp defines */
 
 #ifndef SLIRP_BOOTP_H
diff --git a/slirp/src/ip6.h b/slirp/src/ip6.h
index 1b3364f960..33683c8e20 100644
--- a/slirp/src/ip6.h
+++ b/slirp/src/ip6.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 2013
  * Guillaume Subiron, Yann Bordenave, Serigne Modou Wagne.
diff --git a/slirp/src/ip6_icmp.h b/slirp/src/ip6_icmp.h
index e8ed753db5..d8d13e30fc 100644
--- a/slirp/src/ip6_icmp.h
+++ b/slirp/src/ip6_icmp.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 2013
  * Guillaume Subiron, Yann Bordenave, Serigne Modou Wagne.
diff --git a/slirp/src/libslirp.h b/slirp/src/libslirp.h
index 2d13950065..3b28764bec 100644
--- a/slirp/src/libslirp.h
+++ b/slirp/src/libslirp.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 #ifndef LIBSLIRP_H
 #define LIBSLIRP_H
 
diff --git a/slirp/src/slirp.h b/slirp/src/slirp.h
index 8068ba1d1e..39580934f3 100644
--- a/slirp/src/slirp.h
+++ b/slirp/src/slirp.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 #ifndef SLIRP_H
 #define SLIRP_H
 
diff --git a/slirp/src/stream.h b/slirp/src/stream.h
index 985334c043..08bb5b6610 100644
--- a/slirp/src/stream.h
+++ b/slirp/src/stream.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 #ifndef STREAM_H_
 #define STREAM_H_
 
diff --git a/slirp/src/tftp.h b/slirp/src/tftp.h
index a4c4a64e64..3fe3b70205 100644
--- a/slirp/src/tftp.h
+++ b/slirp/src/tftp.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /* tftp defines */
 
 #ifndef SLIRP_TFTP_H
diff --git a/slirp/src/ip6_icmp.c b/slirp/src/ip6_icmp.c
index c1e3d30470..5642457fdd 100644
--- a/slirp/src/ip6_icmp.c
+++ b/slirp/src/ip6_icmp.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 2013
  * Guillaume Subiron, Yann Bordenave, Serigne Modou Wagne.
diff --git a/slirp/src/ip6_input.c b/slirp/src/ip6_input.c
index 1b8c003c66..d9d2b7e9cd 100644
--- a/slirp/src/ip6_input.c
+++ b/slirp/src/ip6_input.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 2013
  * Guillaume Subiron, Yann Bordenave, Serigne Modou Wagne.
diff --git a/slirp/src/ip6_output.c b/slirp/src/ip6_output.c
index 19d1ae7748..b86110662c 100644
--- a/slirp/src/ip6_output.c
+++ b/slirp/src/ip6_output.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 2013
  * Guillaume Subiron, Yann Bordenave, Serigne Modou Wagne.
diff --git a/slirp/src/ndp_table.c b/slirp/src/ndp_table.c
index 34ea4fdf1f..78324877e2 100644
--- a/slirp/src/ndp_table.c
+++ b/slirp/src/ndp_table.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 2013
  * Guillaume Subiron, Yann Bordenave, Serigne Modou Wagne.
diff --git a/slirp/src/udp6.c b/slirp/src/udp6.c
index be5cba1f54..bfcc7ec6fa 100644
--- a/slirp/src/udp6.c
+++ b/slirp/src/udp6.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 2013
  * Guillaume Subiron
-- 
2.21.0.4.g36eb1cb9cf




[Qemu-devel] [PATCH v4 1/8] slirp: update COPYRIGHT to use full 3-Clause BSD License

2019-03-22 Thread Marc-André Lureau
According to commit 2f5f89963186d42a7ded253bc6cf5b32abb45cec ("Remove
the advertising clause from the slirp license"), Danny Gasparovski
gave permission to license slirp code under 3-clause BSD license:

Subject: RE: Slirp license
Date: Thu, 8 Jan 2009 10:51:00 +1100
From: "Gasparovski, Daniel" 
To: "Richard Fontana" 

I have no objection to having Slirp code in QEMU be licensed under
the 3-clause BSD license.

slirp/COPYRIGHT's initial version in 2004 (commit 5fafdf24) listed
only 3 clauses BUT used the poisonous advertising clause for clause 3
which is the controversial clause of non-free 4-clause (that is, it
appears that the BSD-4 license was copied, and then the WRONG clause
was deleted, when creating COPYRIGHT.  Perhaps explained as an easy
mistake to make since 3-clause was created by removing clause 3 of the
4-clause, where you sometimes see the three-clause version with
clauses 1, 2, 4; but more commonly see a renumbered version with
clauses 1, 2, 3 to close the gap. If you pay attention only to clause
numbers instead of content, it can be easy to confuse which clause to
delete to go from 4-clause to 3-clause).

Commit 2f5f89963 removed the poisonous wrong clause on
the grounds of moving from 4-clause to 3-clause; but did not add the
missing clause, which makes it LOOK like the 2-clause version.  But I
think we have a decent enough trail showing the intent for 3-clause.

Signed-off-by: Marc-André Lureau 
Reviewed-by: Eric Blake 
Reviewed-by: Thomas Huth 
---
 slirp/COPYRIGHT | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/slirp/COPYRIGHT b/slirp/COPYRIGHT
index 1bc83d497e..9863ea31cb 100644
--- a/slirp/COPYRIGHT
+++ b/slirp/COPYRIGHT
@@ -25,6 +25,9 @@ The copyright terms and conditions:
  2. Redistributions in binary form must reproduce the above copyright
 notice, this list of conditions and the following disclaimer in the
 documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the copyright holder nor the names of its
+contributors may be used to endorse or promote products derived
+from this software without specific prior written permission.
 
  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-- 
2.21.0.4.g36eb1cb9cf




[Qemu-devel] [PATCH v4 3/8] slirp: clarify license of slirp files using SPDX: explicit BSD

2019-03-22 Thread Marc-André Lureau
Add SPDX license identifier to clarify the license of files with
explicit 3-clause BSD license header.

Signed-off-by: Marc-André Lureau 
Reviewed-by: Thomas Huth 
---
 slirp/src/dhcpv6.h | 1 +
 slirp/src/ip.h | 1 +
 slirp/src/ip_icmp.h| 1 +
 slirp/src/mbuf.h   | 1 +
 slirp/src/ncsi-pkt.h   | 1 +
 slirp/src/qtailq.h | 1 +
 slirp/src/tcp.h| 1 +
 slirp/src/tcp_timer.h  | 1 +
 slirp/src/tcp_var.h| 1 +
 slirp/src/tcpip.h  | 1 +
 slirp/src/udp.h| 1 +
 slirp/src/vmstate.h| 1 +
 slirp/src/cksum.c  | 1 +
 slirp/src/dhcpv6.c | 1 +
 slirp/src/ip_icmp.c| 1 +
 slirp/src/ip_input.c   | 1 +
 slirp/src/ip_output.c  | 1 +
 slirp/src/ncsi.c   | 1 +
 slirp/src/tcp_input.c  | 1 +
 slirp/src/tcp_output.c | 1 +
 slirp/src/tcp_subr.c   | 1 +
 slirp/src/tcp_timer.c  | 1 +
 slirp/src/udp.c| 1 +
 slirp/src/vmstate.c| 1 +
 24 files changed, 24 insertions(+)

diff --git a/slirp/src/dhcpv6.h b/slirp/src/dhcpv6.h
index af0e193b06..dc26a93cff 100644
--- a/slirp/src/dhcpv6.h
+++ b/slirp/src/dhcpv6.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Definitions and prototypes for SLIRP stateless DHCPv6
  *
diff --git a/slirp/src/ip.h b/slirp/src/ip.h
index 73a4d2a3d2..1484de1176 100644
--- a/slirp/src/ip.h
+++ b/slirp/src/ip.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1982, 1986, 1993
  * The Regents of the University of California.  All rights reserved.
diff --git a/slirp/src/ip_icmp.h b/slirp/src/ip_icmp.h
index a4e5b8b265..05d85c59dd 100644
--- a/slirp/src/ip_icmp.h
+++ b/slirp/src/ip_icmp.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1982, 1986, 1993
  * The Regents of the University of California.  All rights reserved.
diff --git a/slirp/src/mbuf.h b/slirp/src/mbuf.h
index e2d443418a..732c85c63c 100644
--- a/slirp/src/mbuf.h
+++ b/slirp/src/mbuf.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1982, 1986, 1988, 1993
  * The Regents of the University of California.  All rights reserved.
diff --git a/slirp/src/ncsi-pkt.h b/slirp/src/ncsi-pkt.h
index 3867feb1d3..4c0be39f6e 100644
--- a/slirp/src/ncsi-pkt.h
+++ b/slirp/src/ncsi-pkt.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright Gavin Shan, IBM Corporation 2016.
  *
diff --git a/slirp/src/qtailq.h b/slirp/src/qtailq.h
index a89b0c439a..d8aa0e19a4 100644
--- a/slirp/src/qtailq.h
+++ b/slirp/src/qtailq.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*  $NetBSD: queue.h,v 1.52 2009/04/20 09:56:08 mschuett Exp $ */
 
 /*
diff --git a/slirp/src/tcp.h b/slirp/src/tcp.h
index 47aaea6c5b..79d3251bb5 100644
--- a/slirp/src/tcp.h
+++ b/slirp/src/tcp.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1982, 1986, 1993
  * The Regents of the University of California.  All rights reserved.
diff --git a/slirp/src/tcp_timer.h b/slirp/src/tcp_timer.h
index b25b3911d7..709f63987a 100644
--- a/slirp/src/tcp_timer.h
+++ b/slirp/src/tcp_timer.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1982, 1986, 1993
  * The Regents of the University of California.  All rights reserved.
diff --git a/slirp/src/tcp_var.h b/slirp/src/tcp_var.h
index 27ef1a51cb..162be6e95e 100644
--- a/slirp/src/tcp_var.h
+++ b/slirp/src/tcp_var.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1982, 1986, 1993, 1994
  * The Regents of the University of California.  All rights reserved.
diff --git a/slirp/src/tcpip.h b/slirp/src/tcpip.h
index 07dbf2c432..560a86417c 100644
--- a/slirp/src/tcpip.h
+++ b/slirp/src/tcpip.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1982, 1986, 1993
  * The Regents of the University of California.  All rights reserved.
diff --git a/slirp/src/udp.h b/slirp/src/udp.h
index 3d29504caa..29c0297179 100644
--- a/slirp/src/udp.h
+++ b/slirp/src/udp.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1982, 1986, 1993
  * The Regents of the University of California.  All rights reserved.
diff --git a/slirp/src/vmstate.h b/slirp/src/vmstate.h
index 21157b5ec2..44efea7b50 100644
--- a/slirp/src/vmstate.h
+++ b/slirp/src/vmstate.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * QEMU migration/snapshot declarations
  *
diff --git a/slirp/src/cksum.c b/slirp/src/cksum.c
index 25bfa67348..9599f6a280 100644
--- a/slirp/src/cksum.c
+++ b/slirp/src/cksum.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1988, 1992, 1993
  * The Regents of the University of California.  All rights reserved.
diff --git a/slirp/src/dhcpv6.c b/slirp/src/dhcpv6.c
index df350e9f26..3c8f420912 100644
--- a/slirp/src/dhcpv6.c
+++ b/slirp/src/dhcpv6.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * SLIR

Re: [Qemu-devel] [PATCH v4 0/8] slirp: clarify license of slirp as BSD-3

2019-03-22 Thread Samuel Thibault
Marc-André Lureau, le ven. 22 mars 2019 17:46:12 +0100, a ecrit:
> On Fri, Mar 22, 2019 at 5:43 PM Marc-André Lureau
>  wrote:
> >
> > Hi,
> >
> > In order to make slirp a standalone project, the project must have a
> > clear license, and be compatible with the GPL or LGPL.
> >
> > Since commit 2f5f89963186d42a7ded253bc6cf5b32abb45cec ("Remove the
> > advertising clause from the slirp license"), slirp is BSD-3. But new
> > files have been added under slirp/ with QEMU GPL license since then.
> >
> > v4:
> >  - update SPDX-patches commit titles to differentiate them, as
> >suggested by Eric
> >  - add a-b & r-b tags
> >
> 
> This version should be queue-able, hopefully. Samuel, I am not sure if
> you are willing to do it.
> 
> If no objections, I can also send a pullreq to Peter?

I don't see a use for going through my tree :)

Samuel



[Qemu-devel] [PATCH v4 4/8] slirp: clarify license of slirp files using SPDX: explicit MIT

2019-03-22 Thread Marc-André Lureau
Add SPDX license identifier to clarify the license of files with
explicit MIT license header.

Signed-off-by: Marc-André Lureau 
Reviewed-by: Thomas Huth 
---
 slirp/src/util.h  | 1 +
 slirp/src/arp_table.c | 1 +
 slirp/src/bootp.c | 1 +
 slirp/src/dnssearch.c | 1 +
 slirp/src/slirp.c | 1 +
 slirp/src/state.c | 1 +
 slirp/src/stream.c| 1 +
 slirp/src/tftp.c  | 1 +
 slirp/src/util.c  | 1 +
 9 files changed, 9 insertions(+)

diff --git a/slirp/src/util.h b/slirp/src/util.h
index e94ee4e7f1..01f1e0e068 100644
--- a/slirp/src/util.h
+++ b/slirp/src/util.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: MIT */
 /*
  * Copyright (c) 2003-2008 Fabrice Bellard
  * Copyright (c) 2010-2019 Red Hat, Inc.
diff --git a/slirp/src/arp_table.c b/slirp/src/arp_table.c
index 58eafdcfd8..9d7a59eb2c 100644
--- a/slirp/src/arp_table.c
+++ b/slirp/src/arp_table.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: MIT */
 /*
  * ARP table
  *
diff --git a/slirp/src/bootp.c b/slirp/src/bootp.c
index d396849a05..b208e3b216 100644
--- a/slirp/src/bootp.c
+++ b/slirp/src/bootp.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: MIT */
 /*
  * QEMU BOOTP/DHCP server
  *
diff --git a/slirp/src/dnssearch.c b/slirp/src/dnssearch.c
index c459cece8d..12c488971e 100644
--- a/slirp/src/dnssearch.c
+++ b/slirp/src/dnssearch.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: MIT */
 /*
  * Domain search option for DHCP (RFC 3397)
  *
diff --git a/slirp/src/slirp.c b/slirp/src/slirp.c
index 18af670a0a..169c85b906 100644
--- a/slirp/src/slirp.c
+++ b/slirp/src/slirp.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: MIT */
 /*
  * libslirp glue
  *
diff --git a/slirp/src/state.c b/slirp/src/state.c
index c3e3f0b671..09cea3590e 100644
--- a/slirp/src/state.c
+++ b/slirp/src/state.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: MIT */
 /*
  * libslirp
  *
diff --git a/slirp/src/stream.c b/slirp/src/stream.c
index d114dde334..9c1764c0b7 100644
--- a/slirp/src/stream.c
+++ b/slirp/src/stream.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: MIT */
 /*
  * libslirp io streams
  *
diff --git a/slirp/src/tftp.c b/slirp/src/tftp.c
index 2d8f978786..2071dca2a6 100644
--- a/slirp/src/tftp.c
+++ b/slirp/src/tftp.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: MIT */
 /*
  * tftp.c - a simple, read-only tftp server for qemu
  *
diff --git a/slirp/src/util.c b/slirp/src/util.c
index 5ec2fa87ab..60bb200801 100644
--- a/slirp/src/util.c
+++ b/slirp/src/util.c
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: MIT */
 /*
  * util.c (mostly based on QEMU os-win32.c)
  *
-- 
2.21.0.4.g36eb1cb9cf




[Qemu-devel] [PATCH v4 7/8] slirp: remove reference to COPYRIGHT file

2019-03-22 Thread Marc-André Lureau
The slirp COPYRIGHT file is a BSD-3 license. Instead of referring to
another project file, the SPDX license notice present in all source
files states that unequivocally.

Signed-off-by: Marc-André Lureau 
Reviewed-by: Eric Blake 
---
 slirp/src/debug.h  | 3 ---
 slirp/src/if.h | 3 ---
 slirp/src/main.h   | 3 ---
 slirp/src/misc.h   | 3 ---
 slirp/src/sbuf.h   | 3 ---
 slirp/src/socket.h | 3 ---
 slirp/src/if.c | 3 ---
 slirp/src/ip_input.c   | 3 ---
 slirp/src/ip_output.c  | 3 ---
 slirp/src/mbuf.c   | 3 ---
 slirp/src/misc.c   | 3 ---
 slirp/src/sbuf.c   | 3 ---
 slirp/src/socket.c | 3 ---
 slirp/src/tcp_input.c  | 3 ---
 slirp/src/tcp_output.c | 3 ---
 slirp/src/tcp_subr.c   | 3 ---
 16 files changed, 48 deletions(-)

diff --git a/slirp/src/debug.h b/slirp/src/debug.h
index 2e503ad7fa..c95fd8ffd2 100644
--- a/slirp/src/debug.h
+++ b/slirp/src/debug.h
@@ -1,9 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski.
- *
- * Please read the file COPYRIGHT for the
- * terms and conditions of the copyright.
  */
 
 #ifndef DEBUG_H_
diff --git a/slirp/src/if.h b/slirp/src/if.h
index 8a60c4e052..b71c37d6ea 100644
--- a/slirp/src/if.h
+++ b/slirp/src/if.h
@@ -1,9 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski.
- *
- * Please read the file COPYRIGHT for the
- * terms and conditions of the copyright.
  */
 
 #ifndef IF_H
diff --git a/slirp/src/main.h b/slirp/src/main.h
index a88774215f..3b3f883703 100644
--- a/slirp/src/main.h
+++ b/slirp/src/main.h
@@ -1,9 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski.
- *
- * Please read the file COPYRIGHT for the
- * terms and conditions of the copyright.
  */
 
 #ifndef SLIRP_MAIN_H
diff --git a/slirp/src/misc.h b/slirp/src/misc.h
index 4eaa2466d7..23b7490448 100644
--- a/slirp/src/misc.h
+++ b/slirp/src/misc.h
@@ -1,9 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski.
- *
- * Please read the file COPYRIGHT for the
- * terms and conditions of the copyright.
  */
 
 #ifndef MISC_H
diff --git a/slirp/src/sbuf.h b/slirp/src/sbuf.h
index ece616e317..337af1bbde 100644
--- a/slirp/src/sbuf.h
+++ b/slirp/src/sbuf.h
@@ -1,9 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski.
- *
- * Please read the file COPYRIGHT for the
- * terms and conditions of the copyright.
  */
 
 #ifndef SBUF_H
diff --git a/slirp/src/socket.h b/slirp/src/socket.h
index 10a0c78a26..25403898cd 100644
--- a/slirp/src/socket.h
+++ b/slirp/src/socket.h
@@ -1,9 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski.
- *
- * Please read the file COPYRIGHT for the
- * terms and conditions of the copyright.
  */
 
 #ifndef SLIRP_SOCKET_H
diff --git a/slirp/src/if.c b/slirp/src/if.c
index b8cddebf66..6eaac7292a 100644
--- a/slirp/src/if.c
+++ b/slirp/src/if.c
@@ -1,9 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski.
- *
- * Please read the file COPYRIGHT for the
- * terms and conditions of the copyright.
  */
 
 #include "slirp.h"
diff --git a/slirp/src/ip_input.c b/slirp/src/ip_input.c
index 6ad6765938..a714fecd58 100644
--- a/slirp/src/ip_input.c
+++ b/slirp/src/ip_input.c
@@ -34,9 +34,6 @@
 /*
  * Changes and additions relating to SLiRP are
  * Copyright (c) 1995 Danny Gasparovski.
- *
- * Please read the file COPYRIGHT for the
- * terms and conditions of the copyright.
  */
 
 #include "slirp.h"
diff --git a/slirp/src/ip_output.c b/slirp/src/ip_output.c
index 927efb..8560197cf6 100644
--- a/slirp/src/ip_output.c
+++ b/slirp/src/ip_output.c
@@ -34,9 +34,6 @@
 /*
  * Changes and additions relating to SLiRP are
  * Copyright (c) 1995 Danny Gasparovski.
- *
- * Please read the file COPYRIGHT for the
- * terms and conditions of the copyright.
  */
 
 #include "slirp.h"
diff --git a/slirp/src/mbuf.c b/slirp/src/mbuf.c
index f079a86d78..800406ca9e 100644
--- a/slirp/src/mbuf.c
+++ b/slirp/src/mbuf.c
@@ -1,9 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski
- *
- * Please read the file COPYRIGHT for the
- * terms and conditions of the copyright.
  */
 
 /*
diff --git a/slirp/src/misc.c b/slirp/src/misc.c
index da41f3bb5f..7c5db0e0aa 100644
--- a/slirp/src/misc.c
+++ b/slirp/src/misc.c
@@ -1,9 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski.
- *
- * Please read the file COPYRIGHT for the
- * terms and conditions of the copyright.
  */
 
 #include "slirp.h"
diff --git a/slirp/src/sbuf.c b/slirp/src/sbuf.c
index 815823ffbe..9c0b31b513 100644
--- a/slirp/src/sbuf.c
+++ b/slirp/src/sbuf.c
@@ -1,9 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause */
 /*
  * Copyright (c) 1995 Danny Gasparovski.
- *
- * Please read the file COPYRIGHT for the
- * terms an

[Qemu-devel] [PATCH v4 8/8] slirp: is not maintained by Kelly Price for a long time

2019-03-22 Thread Marc-André Lureau
slirp has been maintained by the QEMU maintainers and will be
maintained under an independent project soon.

Reviewed-by: Eric Blake 
Signed-off-by: Kelly Price 
Signed-off-by: Marc-André Lureau 
---
 slirp/COPYRIGHT | 2 --
 1 file changed, 2 deletions(-)

diff --git a/slirp/COPYRIGHT b/slirp/COPYRIGHT
index 9863ea31cb..ed49512dbc 100644
--- a/slirp/COPYRIGHT
+++ b/slirp/COPYRIGHT
@@ -1,8 +1,6 @@
 Slirp was written by Danny Gasparovski.
 Copyright (c), 1995,1996 All Rights Reserved.
 
-Slirp is maintained by Kelly Price 
-
 Slirp is free software; "free" as in you don't have to pay for it, and you
 are free to do whatever you want with it.  I do not accept any donations,
 monetary or otherwise, for Slirp.  Instead, I would ask you to pass this
-- 
2.21.0.4.g36eb1cb9cf




[Qemu-devel] [PATCH v4 0/8] slirp: clarify license of slirp as BSD-3

2019-03-22 Thread Marc-André Lureau
Hi,

In order to make slirp a standalone project, the project must have a
clear license, and be compatible with the GPL or LGPL.

Since commit 2f5f89963186d42a7ded253bc6cf5b32abb45cec ("Remove the
advertising clause from the slirp license"), slirp is BSD-3. But new
files have been added under slirp/ with QEMU GPL license since then.

v4:
 - update SPDX-patches commit titles to differentiate them, as
   suggested by Eric
 - add a-b & r-b tags

v3:
 - add preliminary "slirp: update COPYRIGHT to use full 3-Clause BSD
   License"
 - split "slirp: clarify license of slirp files using SPDX" patch,
 - fix SPDX for files with MIT license header
 - add r-b tags, wording/spelling changes

v2:
 - split the initial patch to add BSD-3 header & then SPDX lines
 - do not modify existing copyright headers without copyright holder
   authorization
 - drop the weak/ambiguous notice to the COPYRIGHT file
 - added a RFC patch to remove Kelly Price from the maintainer duties

Marc-André Lureau (8):
  slirp: update COPYRIGHT to use full 3-Clause BSD License
  slirp: relicense GPL files to BSD-3
  slirp: clarify license of slirp files using SPDX: explicit BSD
  slirp: clarify license of slirp files using SPDX: explicit MIT
  slirp: clarify license of slirp files using SPDX: implicit via
COPYRIGHT
  slirp: clarify license of slirp files using SPDX: implicit via
unstated
  slirp: remove reference to COPYRIGHT file
  slirp: is not maintained by Kelly Price for a long time

 slirp/src/bootp.h  |  1 +
 slirp/src/debug.h  |  4 +---
 slirp/src/dhcpv6.h | 32 +--
 slirp/src/if.h |  4 +---
 slirp/src/ip.h |  1 +
 slirp/src/ip6.h|  1 +
 slirp/src/ip6_icmp.h   |  1 +
 slirp/src/ip_icmp.h|  1 +
 slirp/src/libslirp.h   |  1 +
 slirp/src/main.h   |  4 +---
 slirp/src/mbuf.h   |  1 +
 slirp/src/misc.h   |  4 +---
 slirp/src/ncsi-pkt.h   | 34 +
 slirp/src/qtailq.h |  1 +
 slirp/src/sbuf.h   |  4 +---
 slirp/src/slirp.h  |  1 +
 slirp/src/socket.h |  4 +---
 slirp/src/stream.h |  1 +
 slirp/src/tcp.h|  1 +
 slirp/src/tcp_timer.h  |  1 +
 slirp/src/tcp_var.h|  1 +
 slirp/src/tcpip.h  |  1 +
 slirp/src/tftp.h   |  1 +
 slirp/src/udp.h|  1 +
 slirp/src/util.h   |  1 +
 slirp/src/vmstate.h| 43 +++---
 slirp/src/arp_table.c  |  1 +
 slirp/src/bootp.c  |  1 +
 slirp/src/cksum.c  |  1 +
 slirp/src/dhcpv6.c | 38 +++--
 slirp/src/dnssearch.c  |  1 +
 slirp/src/if.c |  4 +---
 slirp/src/ip6_icmp.c   |  1 +
 slirp/src/ip6_input.c  |  1 +
 slirp/src/ip6_output.c |  1 +
 slirp/src/ip_icmp.c|  1 +
 slirp/src/ip_input.c   |  4 +---
 slirp/src/ip_output.c  |  4 +---
 slirp/src/mbuf.c   |  4 +---
 slirp/src/misc.c   |  4 +---
 slirp/src/ncsi.c   | 32 +--
 slirp/src/ndp_table.c  |  1 +
 slirp/src/sbuf.c   |  4 +---
 slirp/src/slirp.c  |  1 +
 slirp/src/socket.c |  4 +---
 slirp/src/state.c  |  1 +
 slirp/src/stream.c |  1 +
 slirp/src/tcp_input.c  |  4 +---
 slirp/src/tcp_output.c |  4 +---
 slirp/src/tcp_subr.c   |  4 +---
 slirp/src/tcp_timer.c  |  1 +
 slirp/src/tftp.c   |  1 +
 slirp/src/udp.c|  1 +
 slirp/src/udp6.c   |  1 +
 slirp/src/util.c   |  1 +
 slirp/src/vmstate.c| 32 +--
 slirp/COPYRIGHT|  5 +++--
 57 files changed, 229 insertions(+), 85 deletions(-)

-- 
2.21.0.4.g36eb1cb9cf




[Qemu-devel] [PATCH v4 2/8] slirp: relicense GPL files to BSD-3

2019-03-22 Thread Marc-André Lureau
In order to make slirp a standalone project, the project must have a
clear license, and be compatible with the GPL or LGPL.

Since commit 2f5f89963186d42a7ded253bc6cf5b32abb45cec ("Remove the
advertising clause from the slirp license"), slirp is BSD-3. But new
files have been added under slirp/ with QEMU GPL license since then.

The copyright holders have been asked to relicense files to BSD-3 and
gave their permission:

- slirp/dhcpv6.{c,h}

Subject: Re: Clearing slirp/ license
To: "Marc-André Lureau" , QEMU 
, Thomas Huth 
Cc: Peter Maydell , Samuel Thibault 

References: 
From: "Cédric Le Goater" 
Message-ID: 
Date: Mon, 11 Mar 2019 16:23:25 +0100

> Could you reply that you have no objection in relicensing those files
> are 3-Clause BSD?

Fine for me. You can change the license of slirp/ncsi.c and
slirp/ncsi-pkt.hto a 3-Clause BSD.

Thanks,

C.

Subject: Re: [Qemu-devel] Clearing slirp/ license
To: Peter Maydell , Shan Gavin 
Cc: Alexey Kardashevskiy , "Marc-André Lureau" 
, Gavin Shan , Thomas 
Huth , QEMU , Samuel Thibault 

References: 
 
 
 
 
 

From: "Cédric Le Goater" 
Message-ID: <4ddf6031-0df1-b3b5-965e-a181266e4...@kaod.org>
Date: Tue, 12 Mar 2019 11:49:21 +0100

> Is the code in question copyright you personally, or copyright
> IBM as your employer at the time ? If the latter, it is IBM that
> would need to approve the relicensing.

That was done. I had our legal team approve the change of license.

Thanks,

C.

From: Shan Gavin 
Date: Tue, 12 Mar 2019 15:04:54 +0800
Message-ID: 
Subject: Re: [Qemu-devel] Clearing slirp/ license
To: Alexey Kardashevskiy 
Cc: "Marc-André Lureau" , "Cédric Le Goater" 
, gws...@linux.vnet.ibm.com, Peter Maydell 
, Thomas Huth , QEMU 
, Samuel Thibault 

> Gavin, could you reply that you have no objection in relicensing
> ncsi-pkt.h as 3-Clause BSD?

No objection. Please go ahead with the relicensing.

Cheers,
Gavin

- ncsi.c, ncsi-pkt.h

Subject: Re: Clearing slirp/ license
To: "Marc-André Lureau" , QEMU 
, "Cédric Le Goater" 
Cc: Peter Maydell , Samuel Thibault 

References: 
From: Thomas Huth 
Message-ID: 
Date: Wed, 13 Feb 2019 12:30:32 +0100

> Could you reply that you have no objection in relicensing those files
> are 3-Clause BSD?

Ok, for the records: I'm fine if you change the license of dhcpv6.[ch]
to either 3-Clause BSD or 2-Clause BSD.

 Thomas

- vmstate.{c,h}

From: Juan Quintela 
To: "Marc-André Lureau" 
Cc: QEMU , Peter Maydell , 
Samuel Thibault 
Subject: Re: Clearing slirp/ license
Date: Tue, 12 Mar 2019 12:43:17 +0100
Message-ID: <87k1h4qpwq@trasno.org>

> Juan, Could you reply that you have no objection in relicensing the
> vmstate files as 3-Clause BSD?

No problem at all on my side.

Later, Juan.

Signed-off-by: Marc-André Lureau 
Reviewed-by: Eric Blake 
[ for the NC-SI files ]
Reviewed-by: Cédric Le Goater 
Acked-by: Thomas Huth 
---
 slirp/src/dhcpv6.h   | 31 +--
 slirp/src/ncsi-pkt.h | 33 +
 slirp/src/vmstate.h  | 42 +++---
 slirp/src/dhcpv6.c   | 37 +++--
 slirp/src/ncsi.c | 31 +--
 slirp/src/vmstate.c  | 31 +--
 6 files changed, 170 insertions(+), 35 deletions(-)

diff --git a/slirp/src/dhcpv6.h b/slirp/src/dhcpv6.h
index 3373f6cb89..af0e193b06 100644
--- a/slirp/src/dhcpv6.h
+++ b/slirp/src/dhcpv6.h
@@ -3,8 +3,35 @@
  *
  * Copyright 2016 Thomas Huth, Red Hat Inc.
  *
- * This work is licensed under the terms of the GNU GPL, version 2
- * or later. See the COPYING file in the top-level directory.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT L

[Qemu-devel] [PATCH 0/3] target/arm: pmu fixes

2019-03-22 Thread Andrew Jones
The first two patches fix a regression I found when running
the arm (as opposed to arm64) pmu kvm-unit-tests test on tcg,

  $ git clone git://git.kernel.org/pub/scm/virt/kvm/kvm-unit-tests.git
  $ cd kvm-unit-tests
  $ ./configure --arch=arm --cross-prefix=arm-linux-gnu-
  $ make -j
  $ export QEMU=/path/to/qemu-system-arm or qemu-system-aarch64
  $ arm/run arm/pmu.flat

After checking the QEMU code I found it's also reproducible with
the arm64 test if the PMU is removed,

  $ ./configure --arch=arm64 --cross-prefix=aarch64-linux-gnu-
  $ make -j
  $ export QEMU=/path/to/qemu-system-aarch64
  $ arm/run arm/pmu.flat -cpu cortex-a57,pmu=off

Those tests used to pass, but now QEMU was crashing. I've broken
the fix into two patches because the second patch is a bit of
an RFC since I don't know if it's safe to enable all
ARM_FEATURE_PMU code for PMUv2. Maybe that feature is only for
PMUv3? This patch also enables the pmu cpu property to work with
those cpu types, i.e. we can now do '-cpu cortex-a15,pmu=off' to
remove the pmu. Although it wasn't clear to me if the PMU is
optional (permitted to be removed) on those cpu types from the
manuals.

The last patch is just a trivial cleanup.

Andrew Jones (3):
  target/arm: fix crash on pmu register access
  target/arm: cortex-a7 and cortex-a15 have pmus
  target/arm: make pmccntr_op_start/finish static

 target/arm/cpu.c|  3 +++
 target/arm/cpu.h| 11 ---
 target/arm/helper.c |  8 ++--
 3 files changed, 9 insertions(+), 13 deletions(-)

-- 
2.17.2




[Qemu-devel] [PATCH 2/3] target/arm: cortex-a7 and cortex-a15 have pmus

2019-03-22 Thread Andrew Jones
cortex-a7 and cortex-a15 have pmus (PMUv2) and they advertise
them in ID_DFR0. Let's allow them to function. This also enables
the pmu cpu property to work with these cpu types, i.e. we can
now do '-cpu cortex-a15,pmu=off' to remove the pmu.

Signed-off-by: Andrew Jones 
---
 target/arm/cpu.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index 96f0ff0ec727..504a4771fbd3 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -1109,6 +1109,7 @@ static void arm_cpu_realizefn(DeviceState *dev, Error 
**errp)
 #endif
 } else {
 cpu->id_aa64dfr0 &= ~0xf00;
+cpu->id_dfr0 &= ~(0xf << 24);
 cpu->pmceid0 = 0;
 cpu->pmceid1 = 0;
 }
@@ -1744,6 +1745,7 @@ static void cortex_a7_initfn(Object *obj)
 set_feature(&cpu->env, ARM_FEATURE_CBAR_RO);
 set_feature(&cpu->env, ARM_FEATURE_EL2);
 set_feature(&cpu->env, ARM_FEATURE_EL3);
+set_feature(&cpu->env, ARM_FEATURE_PMU);
 cpu->kvm_target = QEMU_KVM_ARM_TARGET_CORTEX_A7;
 cpu->midr = 0x410fc075;
 cpu->reset_fpsid = 0x41023075;
@@ -1789,6 +1791,7 @@ static void cortex_a15_initfn(Object *obj)
 set_feature(&cpu->env, ARM_FEATURE_CBAR_RO);
 set_feature(&cpu->env, ARM_FEATURE_EL2);
 set_feature(&cpu->env, ARM_FEATURE_EL3);
+set_feature(&cpu->env, ARM_FEATURE_PMU);
 cpu->kvm_target = QEMU_KVM_ARM_TARGET_CORTEX_A15;
 cpu->midr = 0x412fc0f1;
 cpu->reset_fpsid = 0x410430f0;
-- 
2.17.2




Re: [Qemu-devel] [PATCH] qcow2: avoid lseek on block_status if possible

2019-03-22 Thread Vladimir Sementsov-Ogievskiy
25.01.2019 17:21, Vladimir Sementsov-Ogievskiy wrote:
> drv_co_block_status digs bs->file for additional, more accurate search
> for hole inside region, reported as DATA by bs since 5daa74a6ebc.
> 
> This accuracy is not free: assume we have qcow2 disk. Actually, qcow2
> knows, where are holes and where is data. But every block_status
> request calls lseek additionally. Assume a big disk, full of
> data, in any iterative copying block job (or img convert) we'll call
> lseek(HOLE) on every iteration, and each of these lseeks will have to
> iterate through all metadata up to the end of file. It's obviously
> ineffective behavior. And for many scenarios we don't need this lseek
> at all.
> 
> However, lseek is needed when we have metadata-preallocated image.
> 
> So, let's detect metadata-preallocation case and don't dig qcow2's
> protocol file in other cases.
> 
> The idea is to compare allocation size in POV of filesystem with
> allocations size in POV of Qcow2 (by refcounts). If allocation in fs is
> significantly lower, consider it as metadata-preallocation case.
> 
> Suggested-by: Denis V. Lunev 
> Signed-off-by: Vladimir Sementsov-Ogievskiy 
> ---
> 
> Hi!
> 
> So, to continue talk about lseek/no lseek when qcow2 block_status reports
> DATA.
> 
> Results on tmpfs:
> cached is lseek cache by Kevin
> detect is this patch
> no lseek is just remove block_status query on bs->file->bs in
>   bdrv_co_block_status
> 
>  +-++++--+
>  | | master | cached | detect | no lseek |
>  +-++++--+
>  | test.qcow2  | 80 | 40 | 0.169  | 0.162|
>  +-++++--+
>  | test_forward.qcow2  | 79 | 0.171  | 0.169  | 0.163|
>  +-++++--+
>  | test_prealloc.qcow2 | 0.054  | 0.053  | 0.055  | 0.263|
>  +-++++--+
> 
>   block/qcow2.h |  1 +
>   include/block/block_int.h |  7 +++
>   block/io.c|  3 ++-
>   block/qcow2-refcount.c| 36 
>   block/qcow2.c |  7 +++
>   5 files changed, 53 insertions(+), 1 deletion(-)
> 
> diff --git a/block/qcow2.h b/block/qcow2.h
> index 438a1dee9e..d7113ed44c 100644
> --- a/block/qcow2.h
> +++ b/block/qcow2.h
> @@ -610,6 +610,7 @@ int qcow2_change_refcount_order(BlockDriverState *bs, int 
> refcount_order,
>   void *cb_opaque, Error **errp);
>   int qcow2_shrink_reftable(BlockDriverState *bs);
>   int64_t qcow2_get_last_cluster(BlockDriverState *bs, int64_t size);
> +int qcow2_detect_metadata_preallocation(BlockDriverState *bs);
>   
>   /* qcow2-cluster.c functions */
>   int qcow2_grow_l1_table(BlockDriverState *bs, uint64_t min_size,
> diff --git a/include/block/block_int.h b/include/block/block_int.h
> index f605622216..c895ca7169 100644
> --- a/include/block/block_int.h
> +++ b/include/block/block_int.h
> @@ -59,6 +59,12 @@
>   
>   #define BLOCK_PROBE_BUF_SIZE512
>   
> +typedef enum BdrvYesNoUnknown {
> +BDRV_UNKNOWN = 0,
> +BDRV_NO,
> +BDRV_YES,
> +} BdrvYesNoUnknown;
> +
>   enum BdrvTrackedRequestType {
>   BDRV_TRACKED_READ,
>   BDRV_TRACKED_WRITE,
> @@ -682,6 +688,7 @@ struct BlockDriverState {
>   bool probed;/* if true, format was probed rather than specified */
>   bool force_share; /* if true, always allow all shared permissions */
>   bool implicit;  /* if true, this filter node was automatically inserted 
> */
> +BdrvYesNoUnknown metadata_preallocation;
>   
>   BlockDriver *drv; /* NULL means no media */
>   void *opaque;
> diff --git a/block/io.c b/block/io.c
> index bd9d688f8b..815661750a 100644
> --- a/block/io.c
> +++ b/block/io.c
> @@ -2186,7 +2186,8 @@ static int coroutine_fn 
> bdrv_co_block_status(BlockDriverState *bs,
>   }
>   }
>   
> -if (want_zero && local_file && local_file != bs &&
> +if (want_zero && bs->metadata_preallocation != BDRV_NO &&
> +local_file && local_file != bs &&
>   (ret & BDRV_BLOCK_DATA) && !(ret & BDRV_BLOCK_ZERO) &&
>   (ret & BDRV_BLOCK_OFFSET_VALID)) {
>   int64_t file_pnum;
> diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
> index 1c63ac244a..008196d849 100644
> --- a/block/qcow2-refcount.c
> +++ b/block/qcow2-refcount.c
> @@ -3379,3 +3379,39 @@ int64_t qcow2_get_last_cluster(BlockDriverState *bs, 
> int64_t size)
>   "There are no references in the refcount 
> table.");
>   return -EIO;
>   }
> +
> +int qcow2_detect_metadata_preallocation(BlockDriverState *bs)
> +{
> +BDRVQcow2State *s = bs->opaque;
> +int64_t i, end_cluster, cluster_count = 0;
> +int64_t file_length, real_allocation, metadata_allocation, file_tail;
> +u

Re: [Qemu-devel] [PATCH 0/5] trace-events: Clean up

2019-03-22 Thread Stefan Hajnoczi
On Thu, Mar 14, 2019 at 07:09:24PM +0100, Markus Armbruster wrote:
> Markus Armbruster (5):
>   trace-events: Consistently point to docs/devel/tracing.txt
>   trace-events: Shorten file names in comments
>   scripts/cleanup-trace-events: Update for current practice
>   trace-events: Delete unused trace points
>   trace-events: Fix attribution of trace points to source
> 
>  accel/kvm/trace-events  |  2 +-
>  accel/tcg/trace-events  |  2 +-
>  audio/trace-events  |  6 +--
>  authz/trace-events  | 10 ++---
>  block/trace-events  | 49 +++
>  chardev/trace-events|  4 +-
>  crypto/trace-events | 10 ++---
>  hw/9pfs/trace-events|  2 +-
>  hw/acpi/trace-events|  6 +--
>  hw/alpha/trace-events   |  2 +-
>  hw/arm/trace-events | 17 +++-
>  hw/audio/trace-events   |  6 +--
>  hw/block/dataplane/trace-events |  2 +-
>  hw/block/trace-events   | 15 ---
>  hw/char/trace-events| 24 +--
>  hw/display/trace-events | 28 ++---
>  hw/dma/trace-events |  6 +--
>  hw/gpio/trace-events|  2 +-
>  hw/hppa/trace-events|  2 +-
>  hw/i2c/trace-events |  2 +-
>  hw/i386/trace-events| 10 ++---
>  hw/i386/xen/trace-events|  6 ++-
>  hw/ide/trace-events | 23 +--
>  hw/input/trace-events   | 16 
>  hw/intc/trace-events| 35 -
>  hw/isa/trace-events |  4 +-
>  hw/mem/trace-events |  4 +-
>  hw/misc/macio/trace-events  |  9 ++---
>  hw/misc/trace-events| 40 +--
>  hw/net/trace-events | 42 ++--
>  hw/nvram/trace-events   |  4 +-
>  hw/pci-host/trace-events|  6 +--
>  hw/pci/trace-events |  6 +--
>  hw/ppc/trace-events | 40 +--
>  hw/rdma/trace-events|  4 +-
>  hw/rdma/vmw/trace-events|  4 +-
>  hw/s390x/trace-events   |  4 +-
>  hw/scsi/trace-events| 22 +--
>  hw/sd/trace-events  | 13 +++---
>  hw/sparc/trace-events   |  6 +--
>  hw/sparc64/trace-events |  6 +--
>  hw/timer/trace-events   | 24 +--
>  hw/tpm/trace-events | 12 +++---
>  hw/usb/trace-events | 22 +--
>  hw/vfio/trace-events| 15 ---
>  hw/virtio/trace-events  | 10 ++---
>  hw/watchdog/trace-events|  2 +-
>  hw/xen/trace-events |  6 +--
>  io/trace-events | 12 +++---
>  linux-user/trace-events |  3 +-
>  migration/trace-events  | 70 ++---
>  nbd/trace-events| 10 ++---
>  net/trace-events| 10 ++---
>  qapi/trace-events   |  4 +-
>  qom/trace-events|  2 +-
>  scripts/cleanup-trace-events.pl | 19 ++---
>  scsi/trace-events   |  4 +-
>  target/arm/trace-events |  4 +-
>  target/hppa/trace-events|  4 +-
>  target/i386/trace-events|  4 +-
>  target/mips/trace-events|  2 +-
>  target/ppc/trace-events |  2 +-
>  target/s390x/trace-events   | 10 ++---
>  target/sparc/trace-events   |  8 ++--
>  trace-events| 13 +-
>  ui/trace-events | 19 +
>  util/trace-events   | 28 ++---
>  67 files changed, 420 insertions(+), 400 deletions(-)

I have folded in your Patch 1 commit description clarification.

Thanks, applied to my tracing tree:
https://github.com/stefanha/qemu/commits/tracing

Stefan


signature.asc
Description: PGP signature


[Qemu-devel] [PATCH 1/3] target/arm: fix crash on pmu register access

2019-03-22 Thread Andrew Jones
Fix a QEMU NULL derefence that occurs when the guest attempts to
enable PMU counters with a non-v8 cpu model or a v8 cpu model
which has not configured a PMU.

Fixes: 4e7beb0cc0f3 ("target/arm: Add a timer to predict PMU counter overflow")
Signed-off-by: Andrew Jones 
---
 target/arm/helper.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/target/arm/helper.c b/target/arm/helper.c
index c8d3c213b6b7..fc73488f6cc0 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -1259,6 +1259,10 @@ static bool pmu_counter_enabled(CPUARMState *env, 
uint8_t counter)
 int el = arm_current_el(env);
 uint8_t hpmn = env->cp15.mdcr_el2 & MDCR_HPMN;
 
+if (!arm_feature(env, ARM_FEATURE_PMU)) {
+return false;
+}
+
 if (!arm_feature(env, ARM_FEATURE_EL2) ||
 (counter < hpmn || counter == 31)) {
 e = env->cp15.c9_pmcr & PMCRE;
-- 
2.17.2




[Qemu-devel] [PATCH 3/4] target/mips: Fix copy_u. for MIPS big endian host

2019-03-22 Thread Mateja Marjanovic
From: Mateja Marjanovic 

Unsigned element copy from MSA registers to GPR when
executed on a MIPS big endian CPU, didn't pick the
right element, and was behaving like on little endian.

Signed-off-by: Mateja Marjanovic 
---
 target/mips/msa_helper.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/target/mips/msa_helper.c b/target/mips/msa_helper.c
index 012f373..8caf186 100644
--- a/target/mips/msa_helper.c
+++ b/target/mips/msa_helper.c
@@ -1467,6 +1467,13 @@ void helper_msa_copy_u_df(CPUMIPSState *env, uint32_t 
df, uint32_t rd,
   uint32_t ws, uint32_t n)
 {
 n %= DF_ELEMENTS(df);
+#if defined(HOST_WORDS_BIGENDIAN)
+if (n < DF_ELEMENTS(df) / 2) {
+n = DF_ELEMENTS(df) / 2 - n - 1;
+} else {
+n = 3 * DF_ELEMENTS(df) / 2 - n - 1;
+}
+#endif
 
 switch (df) {
 case DF_BYTE:
-- 
2.7.4




Re: [Qemu-devel] [PATCH 0/2] trace: fix compilation issues for QEMU 4.0.0

2019-03-22 Thread Stefan Hajnoczi
On Thu, Mar 21, 2019 at 05:08:29PM +, Stefan Hajnoczi wrote:
> These patches fix compilation issues spotted by Markus Armbruster
> .  See the patches for details.
> 
> Stefan Hajnoczi (2):
>   trace: handle tracefs path truncation
>   trace: avoid SystemTap dtrace(1) warnings on empty files
> 
>  trace/ftrace.c| 12 ++--
>  scripts/tracetool/format/d.py |  5 +
>  2 files changed, 15 insertions(+), 2 deletions(-)
> 
> -- 
> 2.20.1
> 

Thanks, applied to my tracing tree:
https://github.com/stefanha/qemu/commits/tracing

Stefan


signature.asc
Description: PGP signature


[Qemu-devel] [PATCH 4/4] target/mips: Fix insert. for MIPS big endian host

2019-03-22 Thread Mateja Marjanovic
From: Mateja Marjanovic 

Inserting from GPR to an element in a MSA register when
executed on a MIPS big endian CPU, didn't pick the
right element, and was behaving like on little endian.

Signed-off-by: Mateja Marjanovic 
---
 target/mips/msa_helper.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/target/mips/msa_helper.c b/target/mips/msa_helper.c
index 8caf186..0049191 100644
--- a/target/mips/msa_helper.c
+++ b/target/mips/msa_helper.c
@@ -1500,6 +1500,13 @@ void helper_msa_insert_df(CPUMIPSState *env, uint32_t 
df, uint32_t wd,
 {
 wr_t *pwd = &(env->active_fpu.fpr[wd].wr);
 target_ulong rs = env->active_tc.gpr[rs_num];
+#if defined(HOST_WORDS_BIGENDIAN)
+if (n < DF_ELEMENTS(df) / 2) {
+n = DF_ELEMENTS(df) / 2 - n - 1;
+} else {
+n = 3 * DF_ELEMENTS(df) / 2 - n - 1;
+}
+#endif
 
 switch (df) {
 case DF_BYTE:
@@ -1511,9 +1518,11 @@ void helper_msa_insert_df(CPUMIPSState *env, uint32_t 
df, uint32_t wd,
 case DF_WORD:
 pwd->w[n] = (int32_t)rs;
 break;
+#ifdef TARGET_MIPS64
 case DF_DOUBLE:
 pwd->d[n] = (int64_t)rs;
 break;
+#endif
 default:
 assert(0);
 }
-- 
2.7.4




Re: [Qemu-devel] [PATCH] RISC-V: fix single stepping over ret and other branching instructions

2019-03-22 Thread Richard Henderson
On 3/22/19 4:22 AM, Fabien Chouteau wrote:
> +/* Wrapper around tcg_gen_exit_tb that handles single stepping */
> +static void exit_tb(DisasContext *ctx, TranslationBlock *tb, unsigned idx)
> +{
> +if (ctx->base.singlestep_enabled) {
> +gen_exception_debug();
> +} else {
> +tcg_gen_exit_tb(tb, idx);
> +}
> +}

You should remove the TB and idx parameters here and pass NULL, 0 to
tcg_gen_exit_tb.

> @@ -138,14 +158,10 @@ static void gen_goto_tb(DisasContext *ctx, int n, 
> target_ulong dest)
>  /* chaining is only allowed when the jump is to the same page */
>  tcg_gen_goto_tb(n);
>  tcg_gen_movi_tl(cpu_pc, dest);
> -tcg_gen_exit_tb(ctx->base.tb, n);
> +exit_tb(ctx, ctx->base.tb, n);

Because this is the only non-zero use, and it is already protected by
use_goto_tb, which includes the single-step check.

Because goto_tb(n) must be paired with exit_tb(tb, n), and vice-versa.


r~



[Qemu-devel] [PATCH 2/4] target/mips: Fix copy_s. for MIPS big endian host

2019-03-22 Thread Mateja Marjanovic
From: Mateja Marjanovic 

Signed element copy from MSA registers to GPR when
executed on a MIPS big endian CPU, didn't pick the
right element, and was behaving like on little endian.

Signed-off-by: Mateja Marjanovic 
---
 target/mips/msa_helper.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/target/mips/msa_helper.c b/target/mips/msa_helper.c
index 421dced..012f373 100644
--- a/target/mips/msa_helper.c
+++ b/target/mips/msa_helper.c
@@ -1435,6 +1435,13 @@ void helper_msa_copy_s_df(CPUMIPSState *env, uint32_t 
df, uint32_t rd,
   uint32_t ws, uint32_t n)
 {
 n %= DF_ELEMENTS(df);
+#if defined(HOST_WORDS_BIGENDIAN)
+if (n < DF_ELEMENTS(df) / 2) {
+n = DF_ELEMENTS(df) / 2 - n - 1;
+} else {
+n = 3 * DF_ELEMENTS(df) / 2 - n - 1;
+}
+#endif
 
 switch (df) {
 case DF_BYTE:
-- 
2.7.4




[Qemu-devel] [PATCH 1/4] target/mips: Fix . MSA instructions for MIPS big endian host

2019-03-22 Thread Mateja Marjanovic
From: Mateja Marjanovic 

Load and store MSA instructions when executed on a MIPS
big endian CPU, didn't change the endianness, and were
behaving like on little endian.

Signed-off-by: Mateja Marjanovic 
---
 target/mips/op_helper.c | 79 ++---
 1 file changed, 55 insertions(+), 24 deletions(-)

diff --git a/target/mips/op_helper.c b/target/mips/op_helper.c
index 0f272a5..5441ab2 100644
--- a/target/mips/op_helper.c
+++ b/target/mips/op_helper.c
@@ -4371,18 +4371,37 @@ FOP_CONDN_S(sne,  (float32_lt(fst1, fst0, 
&env->active_fpu.fp_status)
 #define MEMOP_IDX(DF)
 #endif
 
-#define MSA_LD_DF(DF, TYPE, LD_INSN, ...)   \
-void helper_msa_ld_ ## TYPE(CPUMIPSState *env, uint32_t wd, \
-target_ulong addr)  \
-{   \
-wr_t *pwd = &(env->active_fpu.fpr[wd].wr);  \
-wr_t wx;\
-int i;  \
-MEMOP_IDX(DF)   \
-for (i = 0; i < DF_ELEMENTS(DF); i++) { \
-wx.TYPE[i] = LD_INSN(env, addr + (i << DF), ##__VA_ARGS__); \
-}   \
-memcpy(pwd, &wx, sizeof(wr_t)); \
+#if defined(HOST_WORDS_BIGENDIAN)
+bool big_endian = 1;
+#else
+bool big_endian = 0;
+#endif
+
+#define MSA_LD_DF(DF, TYPE, LD_INSN, ...)   \
+void helper_msa_ld_ ## TYPE(CPUMIPSState *env, uint32_t wd, \
+target_ulong addr)  \
+{   \
+wr_t *pwd = &(env->active_fpu.fpr[wd].wr);  \
+wr_t wx;\
+int i, k;   \
+MEMOP_IDX(DF)   \
+if (!big_endian) {  \
+for (i = 0; i < DF_ELEMENTS(DF); i++) { \
+wx.TYPE[i] = LD_INSN(env, addr + (i << DF), ##__VA_ARGS__); \
+}   \
+} else {\
+for (i = 0; i < DF_ELEMENTS(DF); i++) { \
+if (i < DF_ELEMENTS(DF) / 2) {  \
+k = DF_ELEMENTS(DF) / 2 - i - 1;\
+wx.TYPE[i] = LD_INSN(env, addr + (k << DF), ##__VA_ARGS__); \
+} else {\
+k = 3 * DF_ELEMENTS(DF) / 2 - i - 1;\
+wx.TYPE[i] = LD_INSN(env, addr + (k << DF), ##__VA_ARGS__); \
+}   \
+}   \
+}   \
+\
+memcpy(pwd, &wx, sizeof(wr_t)); \
 }
 
 #if !defined(CONFIG_USER_ONLY)
@@ -4417,18 +4436,30 @@ static inline void ensure_writable_pages(CPUMIPSState 
*env,
 #endif
 }
 
-#define MSA_ST_DF(DF, TYPE, ST_INSN, ...)   \
-void helper_msa_st_ ## TYPE(CPUMIPSState *env, uint32_t wd, \
-target_ulong addr)  \
-{   \
-wr_t *pwd = &(env->active_fpu.fpr[wd].wr);  \
-int mmu_idx = cpu_mmu_index(env, false);   \
-int i;  \
-MEMOP_IDX(DF)   \
-ensure_writable_pages(env, addr, mmu_idx, GETPC()); \
-for (i = 0; i < DF_ELEMENTS(DF); i++) { \
-ST_INSN(env, addr + (i << DF), pwd->TYPE[i], ##__VA_ARGS__);\
-}   \
+#define MSA_ST_DF(DF, TYPE, ST_INSN, ...)\
+void helper_msa_st_ ## TYPE(CPUMIPSState *env, uint32_t wd,  \
+target_ulong addr)   \
+{\
+wr_t *pwd = &(env->active_fpu.fpr[wd].wr

[Qemu-devel] [PATCH 0/4] target/mips: Add support for MSA instructions on a big endian host

2019-03-22 Thread Mateja Marjanovic
From: Mateja Marjanovic 

Change endianness when the host machine has a big endian CPU, for
MSA instructions ., copy_., insert..

Mateja Marjanovic (4):
  target/mips: Fix . MSA instructions for MIPS big
endian host
  target/mips: Fix copy_s. for MIPS big endian host
  target/mips: Fix copy_u. for MIPS big endian host
  target/mips: Fix insert. for MIPS big endian host

 target/mips/msa_helper.c | 23 ++
 target/mips/op_helper.c  | 79 +---
 2 files changed, 78 insertions(+), 24 deletions(-)

-- 
2.7.4




Re: [Qemu-devel] [PATCH 1/2] iotests: 030 TestParallelOps non-shared base node

2019-03-22 Thread Alberto Garcia
On Thu 21 Mar 2019 03:51:12 PM CET, Alberto Garcia  wrote:

> I was checking the tests that run commit and stream in parallel in
> 030, but they do commit on the upper images and stream on the lower
> ones, so that's safe. I'll try to run them the other way around
> because we might have a problem there.

I considered these scenarios with the following backing chain:

   E <- D <- C <- B <- A

1) stream from C to A, then commit from C to E

   This fails because qmp_block_commit() checks for op blockers in C's
   overlay (B), which is blocked by the stream block job.
   ("Node 'B' is busy: block device is in use by block job: stream")

2) commit from C to E, then stream from C to A

   This fails because the commit job inserts a filter between C and B
   and the bdrv_freeze_backing_chain(bs, base) call in stream_start()
   fails.

   However! I found this crash in a couple of occasions, I believe that
   it happens if the commit job finishes before block_stream, but I need
   to debug it further to see why the previous error didn't happen.

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x559aca6e745d in stream_prepare (job=0x559acdafad70) at 
block/stream.c:80
80  base_fmt = base->drv->format_name;
(gdb) print base
$1 = (BlockDriverState *) 0x559acd070240
(gdb) print base->drv
$2 = (BlockDriver *) 0xb5b5b5b5b5b5b5b5
(gdb) bt
#0  0x559aca6e745d in stream_prepare (job=0x559acdafad70) at 
block/stream.c:80
#1  0x559aca973a40 in job_prepare (job=0x559acdafad70) at job.c:771
#2  0x559aca9722fd in job_txn_apply (txn=0x559acd01e6d0, fn=0x559aca973a03 
) at job.c:146
#3  0x559aca973ad2 in job_do_finalize (job=0x559acdafad70) at job.c:788
#4  0x559aca973ca0 in job_completed_txn_success (job=0x559acdafad70) at 
job.c:842
#5  0x559aca973d3d in job_completed (job=0x559acdafad70) at job.c:855
#6  0x559aca973d8c in job_exit (opaque=0x559acdafad70) at job.c:874
#7  0x559acaa99c55 in aio_bh_call (bh=0x559acd3247f0) at util/async.c:90
#8  0x559acaa99ced in aio_bh_poll (ctx=0x559accfb9a30) at util/async.c:118
#9  0x559acaa9ebc0 in aio_dispatch (ctx=0x559accfb9a30) at 
util/aio-posix.c:460
#10 0x559acaa9a088 in aio_ctx_dispatch (source=0x559accfb9a30, 
callback=0x0, user_data=0x0) at util/async.c:261
#11 0x7f7d8e7787f7 in g_main_context_dispatch () from 
/lib/x86_64-linux-gnu/libglib-2.0.so.0
#12 0x559acaa9d4bf in glib_pollfds_poll () at util/main-loop.c:222
#13 0x559acaa9d539 in os_host_main_loop_wait (timeout=0) at 
util/main-loop.c:245
#14 0x559acaa9d63e in main_loop_wait (nonblocking=0) at util/main-loop.c:521
#15 0x559aca6c0ace in main_loop () at vl.c:1969
#16 0x559aca6c7db3 in main (argc=18, argv=0x7ffe11ee6d58, 
envp=0x7ffe11ee6df0) at vl.c:4589

So we need to look into this :( but I'd say that it seems that stream
should not need 'base' at all, just the node on top of it.

Berto



Re: [Qemu-devel] [qemu-s390x] [PATCH] hw/s390x: fix clang compilation on 32bit machines

2019-03-22 Thread Halil Pasic
On Mon, 18 Mar 2019 22:08:50 +0100
Philippe Mathieu-Daudé  wrote:

> Le lun. 18 mars 2019 11:34, Marcel Apfelbaum  a
> écrit :
> 
> > Hi Christian,
> >
> > On 3/18/19 11:27 AM, Christian Borntraeger wrote:
> > >
> > > On 16.03.19 12:09, Philippe Mathieu-Daudé wrote:
> > >> Hi Marcel,
> > >>
> > >> On 3/16/19 10:50 AM, Marcel Apfelbaum wrote:
> > >>> Configuring QEMU with:
> > >>>  configure --cc=clang --target-list=s390x-softmmu
> > >>> And compiling it using a 32 bit machine leads to:
> > >> Because there sizeof(ram_addr_t) = sizeof(uintptr_t) = 32.
> > >>
> > >>>  hw/s390x/s390-virtio-ccw.c:175:27: error: implicit conversion from
> > >>>'unsigned long long' to 'ram_addr_t' (aka 'unsigned int')
> > changes value
> > >>>from 8796091973632 to 4293918720 [-Werror,-Wconstant-conversion]
> > >>>  chunk = MIN(size, KVM_SLOT_MAX_BYTES);
> > >>>~ ~~^~~
> > >> The comment 1 line earlier is:
> > >>
> > >>  /* KVM does not allow memslots >= 8 TB */
> > >>
> > >> Clang is correct, this KVM_SLOT_MAX_BYTES is incorrect on a 32bit s390,
> > >> you need a 64bit system.

Sorry guys for the long wait. We are decimated by flue at the moment.

IMHO Clang is wrong about this. The value put in chunk is guaranteed to
fit unsigned int.

Namely


static void s390_memory_init(ram_addr_t mem_size)   
{   
MemoryRegion *sysmem = get_system_memory(); 
ram_addr_t chunk, offset = 0;   
unsigned int number = 0;
gchar *name;

/* allocate RAM for core */ 
name = g_strdup_printf("s390.ram"); 
while (mem_size) {  
MemoryRegion *ram = g_new(MemoryRegion, 1); 
uint64_t size = mem_size;

The most significant 32 bits of size are zeros because mem_size
is effectively uint. 

/* KVM does not allow memslots >= 8 TB */   
chunk = MIN(size, KVM_SLOT_MAX_BYTES);

Thus the result of MIN() is guaranteed to fit into chunk despite of its
type being wider.

> > > KVM is only supported on 64bit s390.
> > >
> >
> > So maybe the fix I proposed is enough.
> >
> 
> Enough to silent a warning due to a bug, as confirmed Christian KVM code
> should be reachable on 32 bit hosts.
> Safer would it be to fix the bug.



IMHO there is no bug! Thus I think Marcel's fix is sufficient. A simple
cast to ram_addr_t could be even simpler, but I did not check if that
silences Clang. @Marcel would you like to try that out?

> 
> >
> > >
> > >> Per Hacking:
> > >>
> > >>Use hwaddr for guest physical addresses except pcibus_t
> > >>for PCI addresses.  In addition, ram_addr_t is a QEMU internal
> > address
> > >>space that maps guest RAM physical addresses into an intermediate
> > >>address space that can map to host virtual address spaces.  Generally
> > >>speaking, the size of guest memory can always fit into ram_addr_t but
> > >>it would not be correct to store an actual guest physical address in
> > a
> > >>ram_addr_t.
> > >>
> > >> My understanding is we should not use ram_addr_t with KVM but rather
> > >> hwaddr, but I'm not sure.

I tend to agree with you. The usage of the types is IMHO messy in the
function under discussion. But I'm not a memory guy, and I would hate to
make calls on this.

> > >>
> > >> I don't know about s390, if 32bit host is supported or supports KVM.
> > >> If it is, maybe this could work:
> > >>
> > >> I don't think the following is clean:
> > >>
> > >> #if TARGET_LONG_BITS == 32
> > >> # define KVM_SLOT_MAX_BYTES RAM_ADDR_MAX
> > >> #else
> > >> # define KVM_SLOT_MAX_BYTES \
> > >>   ((KVM_MEM_MAX_NR_PAGES * TARGET_PAGE_SIZE) & SEG_MSK)
> > >> #endif
> > >>
> > >> But checking ifdef CONFIG_KVM might be clever:
> > >>
> > >> -- >8 --
> > >> @@ -161,7 +161,7 @@ static void virtio_ccw_register_hcalls(void)
> > >>   static void s390_memory_init(ram_addr_t mem_size)
> > >>   {
> > >>   MemoryRegion *sysmem = get_system_memory();
> > >> -ram_addr_t chunk, offset = 0;
> > >> +hwaddr offset = 0;
> > >>   unsigned int number = 0;
> > >>   gchar *name;
> > >>
> > >> @@ -169,14 +169,16 @@ static void s390_memory_init(ram_addr_t mem_size)
> > >>   name = g_strdup_printf("s390.ram");
> > >>   while (mem_size) {
> > >>   MemoryRegion *ram = g_new(MemoryRegion, 1);
> > >> -  

Re: [Qemu-devel] [PULL 0/5] x86 queue for -rc1

2019-03-22 Thread Peter Maydell
On Thu, 21 Mar 2019 at 19:36, Eduardo Habkost  wrote:
>
> The following changes since commit 62a172e6a77d9072bb1a18f295ce0fcf4b90a4f2:
>
>   Update version for v4.0.0-rc0 release (2019-03-19 17:17:22 +)
>
> are available in the Git repository at:
>
>   git://github.com/ehabkost/qemu.git tags/x86-next-pull-request
>
> for you to fetch changes up to 21ee4787e53367590f284915bf4c30c684e65bdf:
>
>   docs: add note about stibp CPU feature for spectre v2 (2019-03-20 12:18:15 
> -0300)
>
> 
> x86 queue for -rc1
>
> A few fixes that missed -rc0:
> * CPU model documentation updates (Daniel P. Berrangé)
> * Fix bogus OSPKE warnings (Eduardo Habkost)
> * Work around KVM bugs when handing arch_capabilities
>   (Eduardo Habkost)
>

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/4.0
for any user-visible changes.

-- PMM



Re: [Qemu-devel] [PATCH] migration: avoid copying ignore-shared ramblock when in incoming migration

2019-03-22 Thread Dr. David Alan Gilbert
* Peter Maydell (peter.mayd...@linaro.org) wrote:
> On Fri, 22 Mar 2019 at 10:12, Dr. David Alan Gilbert
>  wrote:
> > Right, so in Catherine's patch there's a simple in_incoming_migration
> > and checking ramblock_is_ignored
> 
> Mmm, but I think it is in the wrong place. It is being checked
> in address_space_write_rom_internal(). Either we want to
> suppress any and all writes to these RAM blocks, in which
> case I don't think that function covers all the ways that
> code can get hold of a RAM block and write to it; or we are
> confident that only the ROM blobs are an issue, in which
> case it is too low in the call stack and we should do the
> check in rom_reset().
> 
> Are there any other cases where we might write to RAM
> during reset/migration ? I thought of "user write via
> the debug stub or monitor", but perhaps those either
> can't happen or we define them as user error. But I
> there might be some other obscure cases, which perhaps
> argues for doing this at the lowest level possible.

Right, the thought of the 'might be other obscure cases'
is why in Yury's 'QEMU may write to system_memory before guest starts'
patch he marks all shared regions as read-only to see what
hits it.

I'm not sure; tbh inserting this type of check at the lowest
level seems a bit invasive so I'd prefer doing it at the ROM blocks
level; but we are bound to hit those obscure cases and then
the failure is a real pain to debug when you find something
has overwritten some of the RAM.

Dave

> thanks
> -- PMM
--
Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK



Re: [Qemu-devel] [PATCH for-4.0? 0/6] block: Fix slow pre-zeroing in qemu-img convert

2019-03-22 Thread Eric Blake
On 3/22/19 9:21 AM, Eric Blake wrote:
> On 3/22/19 8:21 AM, Kevin Wolf wrote:
>> If qemu-img convert sees that the target image isn't zero-initialised
>> yet, it tries to do an efficient zero write for the whole image first
>> to save the overhead of repeated explicit zero writes during the
>> conversion. Obviously, this provides only an advantage if the
>> pre-zeroing is actually efficient. Otherwise, we can end up writing
>> zeroes slowly while zeroing out the whole image, and then overwrite the
>> same blocks again with real data, potentially doubling the written data.
>>
>> Additionally, commit 9776f0db changed NBD to advertise for all NBD
>> devices that zero writes with unmap is supported for all NBD devices, no
>> matter whether the storage of NBD server actually can do this or whether
>> we would fall back to explicit zero writes.
>>
>> This series adds a new BDRV_REQ_NO_FALLBACK flag for writing zeroes,
>> which makes the request return an error if it can't guarantee that we
>> don't end up running a slow fallback path.
>>
>> For NBD, this means that we still support zero writes from guests, but
>> qemu-img convert will not try to use it to zero out the whole image.
>> This is potentially suboptimal if the server does actually support
>> efficient zero writes. We'd need an NBD protocol extension to transfer
>> this flag so we can re-enable the qemu-img convert feature for the NBD
>> driver without regressing on storage that can't provide efficient zero
>> writes.
> 
> I haven't reviewed closely yet, but the summary is sane, so:
> Acked-by: Eric Blake 
> 
> and I'll be cross-posting another mail soon with the desired NBD
> protocol extension.

I also meant to add - since the performance slowdown is so noticeable,
and we are still at -rc0, I think this series is reasonable as 4.0
material as a bug fix (performance bugs rank lower than correctness
bugs, but they are still bugs)

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



signature.asc
Description: OpenPGP digital signature


[Qemu-devel] [PATCH 2/3] filemon: ensure watch IDs are unique to QFileMonitor scope

2019-03-22 Thread Daniel P . Berrangé
The watch IDs are mistakenly only unique within the scope of the
directory being monitored. This is not useful for clients which are
monitoring multiple directories. They require watch IDs to be unique
globally within the QFileMonitor scope.

Reviewed-by: Marc-André Lureau 
Tested-by: Bandan Das 
Reviewed-by: Bandan Das 
Signed-off-by: Daniel P. Berrangé 
---
 tests/test-util-filemonitor.c | 116 +++---
 util/filemonitor-inotify.c|   5 +-
 2 files changed, 110 insertions(+), 11 deletions(-)

diff --git a/tests/test-util-filemonitor.c b/tests/test-util-filemonitor.c
index ea3715a8f4..71a7cf5de0 100644
--- a/tests/test-util-filemonitor.c
+++ b/tests/test-util-filemonitor.c
@@ -35,6 +35,8 @@ enum {
 QFILE_MONITOR_TEST_OP_RENAME,
 QFILE_MONITOR_TEST_OP_TOUCH,
 QFILE_MONITOR_TEST_OP_UNLINK,
+QFILE_MONITOR_TEST_OP_MKDIR,
+QFILE_MONITOR_TEST_OP_RMDIR,
 };
 
 typedef struct {
@@ -298,6 +300,54 @@ test_file_monitor_events(void)
   .eventid = QFILE_MONITOR_EVENT_DELETED },
 
 
+{ .type = QFILE_MONITOR_TEST_OP_MKDIR,
+  .filesrc = "fish", },
+{ .type = QFILE_MONITOR_TEST_OP_EVENT,
+  .filesrc = "fish", .watchid = 0,
+  .eventid = QFILE_MONITOR_EVENT_CREATED },
+
+
+{ .type = QFILE_MONITOR_TEST_OP_ADD_WATCH,
+  .filesrc = "fish/", .watchid = 4 },
+{ .type = QFILE_MONITOR_TEST_OP_ADD_WATCH,
+  .filesrc = "fish/one.txt", .watchid = 5 },
+{ .type = QFILE_MONITOR_TEST_OP_CREATE,
+  .filesrc = "fish/one.txt", },
+{ .type = QFILE_MONITOR_TEST_OP_EVENT,
+  .filesrc = "one.txt", .watchid = 4,
+  .eventid = QFILE_MONITOR_EVENT_CREATED },
+{ .type = QFILE_MONITOR_TEST_OP_EVENT,
+  .filesrc = "one.txt", .watchid = 5,
+  .eventid = QFILE_MONITOR_EVENT_CREATED },
+
+
+{ .type = QFILE_MONITOR_TEST_OP_DEL_WATCH,
+  .filesrc = "fish/one.txt", .watchid = 5 },
+{ .type = QFILE_MONITOR_TEST_OP_RENAME,
+  .filesrc = "fish/one.txt", .filedst = "two.txt", },
+{ .type = QFILE_MONITOR_TEST_OP_EVENT,
+  .filesrc = "one.txt", .watchid = 4,
+  .eventid = QFILE_MONITOR_EVENT_DELETED },
+{ .type = QFILE_MONITOR_TEST_OP_EVENT,
+  .filesrc = "two.txt", .watchid = 0,
+  .eventid = QFILE_MONITOR_EVENT_CREATED },
+{ .type = QFILE_MONITOR_TEST_OP_EVENT,
+  .filesrc = "two.txt", .watchid = 2,
+  .eventid = QFILE_MONITOR_EVENT_CREATED },
+
+
+{ .type = QFILE_MONITOR_TEST_OP_RMDIR,
+  .filesrc = "fish", },
+{ .type = QFILE_MONITOR_TEST_OP_EVENT,
+  .filesrc = "", .watchid = 4,
+  .eventid = QFILE_MONITOR_EVENT_IGNORED },
+{ .type = QFILE_MONITOR_TEST_OP_EVENT,
+  .filesrc = "fish", .watchid = 0,
+  .eventid = QFILE_MONITOR_EVENT_DELETED },
+{ .type = QFILE_MONITOR_TEST_OP_DEL_WATCH,
+  .filesrc = "fish", .watchid = 4 },
+
+
 { .type = QFILE_MONITOR_TEST_OP_UNLINK,
   .filesrc = "two.txt", },
 { .type = QFILE_MONITOR_TEST_OP_EVENT,
@@ -366,6 +416,8 @@ test_file_monitor_events(void)
 int fd;
 int watchid;
 struct utimbuf ubuf;
+char *watchdir;
+const char *watchfile;
 
 pathsrc = g_strdup_printf("%s/%s", dir, op->filesrc);
 if (op->filedst) {
@@ -378,13 +430,26 @@ test_file_monitor_events(void)
 g_printerr("Add watch %s %s %d\n",
dir, op->filesrc, op->watchid);
 }
+if (op->filesrc && strchr(op->filesrc, '/')) {
+watchdir = g_strdup_printf("%s/%s", dir, op->filesrc);
+watchfile = strrchr(watchdir, '/');
+*(char *)watchfile = '\0';
+watchfile++;
+if (*watchfile == '\0') {
+watchfile = NULL;
+}
+} else {
+watchdir = g_strdup(dir);
+watchfile = op->filesrc;
+}
 watchid =
 qemu_file_monitor_add_watch(mon,
-dir,
-op->filesrc,
+watchdir,
+watchfile,
 qemu_file_monitor_test_handler,
 &data,
 &local_err);
+g_free(watchdir);
 if (watchid < 0) {
 g_printerr("Unable to add watch %s",
error_get_pretty(local_err));
@@ -400,9 +465,17 @@ test_file_monitor_events(void)
 if (debug) {
 g_printerr("Del watch %s %d\n", dir, op->watchid);
 }
+if (op->filesrc && strchr(op->filesrc, '/')) {
+watchdir = g_strdup_printf("%s/%s", dir, 

[Qemu-devel] [PATCH 0/3] filemon: various fixes / improvements to file monitor for USB MTP

2019-03-22 Thread Daniel P . Berrangé
Previously posted in 2 separate pieces at

  https://lists.gnu.org/archive/html/qemu-devel/2019-03/msg04885.html
  https://lists.gnu.org/archive/html/qemu-devel/2019-03/msg05833.html

And a failed pull request

  https://lists.gnu.org/archive/html/qemu-devel/2019-03/msg06035.html

The last patch had bigger changes in the test suite than anticipated,
so needs a explicit new review before I can justify re-trying the PULL
request

Daniel P. Berrangé (3):
  tests: refactor file monitor test to make it more understandable
  filemon: ensure watch IDs are unique to QFileMonitor scope
  filemon: fix watch IDs to avoid potential wraparound issues

 authz/listfile.c  |   2 +-
 hw/usb/dev-mtp.c  |  10 +-
 include/authz/listfile.h  |   2 +-
 include/qemu/filemonitor.h|  16 +-
 tests/test-util-filemonitor.c | 648 +-
 util/filemonitor-inotify.c|  26 +-
 util/filemonitor-stub.c   |   4 +-
 util/trace-events |   6 +-
 8 files changed, 354 insertions(+), 360 deletions(-)

-- 
2.20.1




Re: [Qemu-devel] [PATCH v8 05/16] gdbstub: add multiprocess support to vCont packets

2019-03-22 Thread Luc Michel
On 3/22/19 2:29 PM, Jan Kiszka wrote:
> On 07.12.18 10:01, Luc Michel wrote:
>> Add the gdb_first_attached_cpu() and gdb_next_attached_cpu() to iterate
>> over all the CPUs in currently attached processes.
>>
>> Add the gdb_first_cpu_in_process() and gdb_next_cpu_in_process() to
>> iterate over CPUs of a given process.
>>
>> Use them to add multiprocess extension support to vCont packets.
>>
>> Signed-off-by: Luc Michel 
>> Reviewed-by: Philippe Mathieu-Daudé 
>> Reviewed-by: Edgar E. Iglesias 
>> Acked-by: Alistair Francis 
>> ---
>>   gdbstub.c | 117 +++---
>>   1 file changed, 102 insertions(+), 15 deletions(-)
>>
>> diff --git a/gdbstub.c b/gdbstub.c
>> index 911faa225a..77b3dbb2c8 100644
>> --- a/gdbstub.c
>> +++ b/gdbstub.c
>> @@ -721,10 +721,40 @@ static CPUState *find_cpu(uint32_t thread_id)
>>   }
>>   
>>   return NULL;
>>   }
>>   
>> +static CPUState *get_first_cpu_in_process(const GDBState *s,
>> +  GDBProcess *process)
>> +{
>> +CPUState *cpu;
>> +
>> +CPU_FOREACH(cpu) {
>> +if (gdb_get_cpu_pid(s, cpu) == process->pid) {
>> +return cpu;
>> +}
>> +}
>> +
>> +return NULL;
>> +}
>> +
>> +static CPUState *gdb_next_cpu_in_process(const GDBState *s, CPUState *cpu)
>> +{
>> +uint32_t pid = gdb_get_cpu_pid(s, cpu);
>> +cpu = CPU_NEXT(cpu);
>> +
>> +while (cpu) {
>> +if (gdb_get_cpu_pid(s, cpu) == pid) {
>> +break;
>> +}
>> +
>> +cpu = CPU_NEXT(cpu);
>> +}
>> +
>> +return cpu;
>> +}
>> +
>>   static CPUState *gdb_get_cpu(const GDBState *s, uint32_t pid, uint32_t tid)
>>   {
>>   GDBProcess *process;
>>   CPUState *cpu;
>>   
>> @@ -750,10 +780,41 @@ static CPUState *gdb_get_cpu(const GDBState *s, 
>> uint32_t pid, uint32_t tid)
>>   }
>>   
>>   return cpu;
>>   }
>>   
>> +/* Return the cpu following @cpu, while ignoring
>> + * unattached processes.
>> + */
>> +static CPUState *gdb_next_attached_cpu(const GDBState *s, CPUState *cpu)
>> +{
>> +cpu = CPU_NEXT(cpu);
>> +
>> +while (cpu) {
>> +if (gdb_get_cpu_process(s, cpu)->attached) {
>> +break;
>> +}
>> +
>> +cpu = CPU_NEXT(cpu);
>> +}
>> +
>> +return cpu;
>> +}
>> +
>> +/* Return the first attached cpu */
>> +static CPUState *gdb_first_attached_cpu(const GDBState *s)
>> +{
>> +CPUState *cpu = first_cpu;
>> +GDBProcess *process = gdb_get_cpu_process(s, cpu);
>> +
>> +if (!process->attached) {
>> +return gdb_next_attached_cpu(s, cpu);
>> +}
>> +
>> +return cpu;
>> +}
>> +
>>   static const char *get_feature_xml(const char *p, const char **newp,
>>  CPUClass *cc)
>>   {
>>   size_t len;
>>   int i;
>> @@ -1088,14 +1149,16 @@ static int is_query_packet(const char *p, const char 
>> *query, char separator)
>>* returns -ENOTSUP if a command is unsupported, -EINVAL or -ERANGE if 
>> there is
>>* a format error, 0 on success.
>>*/
>>   static int gdb_handle_vcont(GDBState *s, const char *p)
>>   {
>> -int res, idx, signal = 0;
>> +int res, signal = 0;
>>   char cur_action;
>>   char *newstates;
>>   unsigned long tmp;
>> +uint32_t pid, tid;
>> +GDBProcess *process;
>>   CPUState *cpu;
>>   #ifdef CONFIG_USER_ONLY
>>   int max_cpus = 1; /* global variable max_cpus exists only in system 
>> mode */
>>   
>>   CPU_FOREACH(cpu) {
>> @@ -1134,29 +1197,52 @@ static int gdb_handle_vcont(GDBState *s, const char 
>> *p)
>>   } else if (cur_action != 'c' && cur_action != 's') {
>>   /* unknown/invalid/unsupported command */
>>   res = -ENOTSUP;
>>   goto out;
>>   }
>> -/* thread specification. special values: (none), -1 = all; 0 = any 
>> */
>> -if ((p[0] == ':' && p[1] == '-' && p[2] == '1') || (p[0] != ':')) {
>> -if (*p == ':') {
>> -p += 3;
>> -}
>> -for (idx = 0; idx < max_cpus; idx++) {
>> -if (newstates[idx] == 1) {
>> -newstates[idx] = cur_action;
>> +
>> +if (*p++ != ':') {
>> +res = -ENOTSUP;
>> +goto out;
>> +}
>> +
>> +switch (read_thread_id(p, &p, &pid, &tid)) {
>> +case GDB_READ_THREAD_ERR:
>> +res = -EINVAL;
>> +goto out;
>> +
>> +case GDB_ALL_PROCESSES:
>> +cpu = gdb_first_attached_cpu(s);
>> +while (cpu) {
>> +if (newstates[cpu->cpu_index] == 1) {
>> +newstates[cpu->cpu_index] = cur_action;
>>   }
>> +
>> +cpu = gdb_next_attached_cpu(s, cpu);
>>   }
>> -} else if (*p == ':') {
>> -p++;
>> -res = qemu_strtoul(p, &p, 16, &tmp);
>> -if (res) {
>> +break;
>> +
>> +

Re: [Qemu-devel] [RFC PATCH] scripts/decodetree.py: Fix variable-length ISA

2019-03-22 Thread Yoshinori Sato
On Thu, 21 Mar 2019 10:43:37 +0900,
Richard Henderson wrote:
> 
> On 3/20/19 7:27 AM, Yoshinori Sato wrote:
> > Hi.
> > I found some problem in tested RX instructions.
> > It is usable in RX instructions, but I think that there
> > is a better fix because I am not familiar with Python.
> 
> The patch itself look ok, but needs some changes.
> 
> > I fixed three point.
> > - Added ctx to !function args.
> 
> This seems fine.  But it needs either
> 
> (1) A command-line option, or
> (2) Changes to all existing users in the tree.
> 
> Otherwise the build breaks for the other targets.
> 
> > - Fixed group operaiton. varinsns required width field.
> > - Fixed symbol in decode_load_bytes args.
> 
> Thanks.  I can fold these fixes into v2 of the varinsns patches.
>

OK. Thanks.

> 
> r~
> 

-- 
Yosinori Sato



[Qemu-devel] [PATCH 3/3] filemon: fix watch IDs to avoid potential wraparound issues

2019-03-22 Thread Daniel P . Berrangé
Watch IDs are allocated from incrementing a int counter against
the QFileMonitor object. In very long life QEMU processes with
a huge amount of USB MTP activity creating & deleting directories
it is just about conceivable that the int counter can wrap
around. This would result in incorrect behaviour of the file
monitor watch APIs due to clashing watch IDs.

Instead of trying to detect this situation, this patch changes
the way watch IDs are allocated. It is turned into an int64_t
variable where the high 32 bits are set from the underlying
inotify "int" ID. This gives an ID that is guaranteed unique
for the directory as a whole, and we can rely on the kernel
to enforce this. QFileMonitor then sets the low 32 bits from
a per-directory counter.

The USB MTP device only sets watches on the directory as a
whole, not files within, so there is no risk of guest
triggered wrap around on the low 32 bits.

Signed-off-by: Daniel P. Berrangé 
---
 authz/listfile.c  |   2 +-
 hw/usb/dev-mtp.c  |  10 +--
 include/authz/listfile.h  |   2 +-
 include/qemu/filemonitor.h|  16 ++---
 tests/test-util-filemonitor.c | 128 +++---
 util/filemonitor-inotify.c|  25 +++
 util/filemonitor-stub.c   |   4 +-
 util/trace-events |   6 +-
 8 files changed, 103 insertions(+), 90 deletions(-)

diff --git a/authz/listfile.c b/authz/listfile.c
index d4579767e7..bc2b58ef6d 100644
--- a/authz/listfile.c
+++ b/authz/listfile.c
@@ -93,7 +93,7 @@ qauthz_list_file_load(QAuthZListFile *fauthz, Error **errp)
 
 
 static void
-qauthz_list_file_event(int wd G_GNUC_UNUSED,
+qauthz_list_file_event(int64_t wd G_GNUC_UNUSED,
QFileMonitorEvent ev G_GNUC_UNUSED,
const char *name G_GNUC_UNUSED,
void *opaque)
diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c
index 06e376bcd2..0cce3f53fe 100644
--- a/hw/usb/dev-mtp.c
+++ b/hw/usb/dev-mtp.c
@@ -170,7 +170,7 @@ struct MTPObject {
 char *path;
 struct stat  stat;
 /* file monitor watch id */
-int  watchid;
+int64_t  watchid;
 MTPObject*parent;
 uint32_t nchildren;
 QLIST_HEAD(, MTPObject) children;
@@ -498,7 +498,7 @@ static MTPObject *usb_mtp_object_lookup_name(MTPObject 
*parent,
 return NULL;
 }
 
-static MTPObject *usb_mtp_object_lookup_id(MTPState *s, int id)
+static MTPObject *usb_mtp_object_lookup_id(MTPState *s, int64_t id)
 {
 MTPObject *iter;
 
@@ -511,7 +511,7 @@ static MTPObject *usb_mtp_object_lookup_id(MTPState *s, int 
id)
 return NULL;
 }
 
-static void file_monitor_event(int id,
+static void file_monitor_event(int64_t id,
QFileMonitorEvent ev,
const char *name,
void *opaque)
@@ -625,8 +625,8 @@ static void usb_mtp_object_readdir(MTPState *s, MTPObject 
*o)
 }
 
 if (s->file_monitor) {
-int id = qemu_file_monitor_add_watch(s->file_monitor, o->path, NULL,
- file_monitor_event, s, &err);
+int64_t id = qemu_file_monitor_add_watch(s->file_monitor, o->path, 
NULL,
+ file_monitor_event, s, &err);
 if (id == -1) {
 error_report("usb-mtp: failed to add watch for %s: %s", o->path,
  error_get_pretty(err));
diff --git a/include/authz/listfile.h b/include/authz/listfile.h
index ebbd5a4288..0d618c903c 100644
--- a/include/authz/listfile.h
+++ b/include/authz/listfile.h
@@ -92,7 +92,7 @@ struct QAuthZListFile {
 char *filename;
 bool refresh;
 QFileMonitor *file_monitor;
-int file_watch;
+int64_t file_watch;
 };
 
 
diff --git a/include/qemu/filemonitor.h b/include/qemu/filemonitor.h
index cd031832ed..64267d09b2 100644
--- a/include/qemu/filemonitor.h
+++ b/include/qemu/filemonitor.h
@@ -52,7 +52,7 @@ typedef enum {
  * empty.
  *
  */
-typedef void (*QFileMonitorHandler)(int id,
+typedef void (*QFileMonitorHandler)(int64_t id,
 QFileMonitorEvent event,
 const char *filename,
 void *opaque);
@@ -103,12 +103,12 @@ void qemu_file_monitor_free(QFileMonitor *mon);
  *
  * Returns: a positive integer watch ID, or -1 on error
  */
-int qemu_file_monitor_add_watch(QFileMonitor *mon,
-const char *dirpath,
-const char *filename,
-QFileMonitorHandler cb,
-void *opaque,
-Error **errp);
+int64_t qemu_file_monitor_add_watch(QFileMonitor *mon,
+const char *dirpath,
+const char *filename,
+QFileMonitorHandler cb,
+void *opaque,
+

Re: [Qemu-devel] [PATCH RFC v3 00/11] Add RX archtecture support

2019-03-22 Thread Yoshinori Sato
On Thu, 21 Mar 2019 10:35:07 +0900,
Richard Henderson wrote:
> 
> On 3/20/19 7:05 AM, Yoshinori Sato wrote:
> > OK. fixed another way.
> > But RX big-endian mode only data access.
> > So operand value always little-endian order.
> 
> Oh that is convenient.
> Therefore the operand can always be put together by pieces.  E.g.
> 
> -%b4_dsp_16 0:16 !function=dsp16
> -%b4_bdsp   0:24 !function=bdsp_a
> +%b4_dsp16  0:s8 8:8
> +%b4_dsp24  0:s8 8:8 16:8
> 
> Also note the 's' qualifier that defines signed fields.
> 
> -%b2_bdsp   16:8 !function=bdsp_b
> ...
> -@b2_bcnd_b  cd:4   &bcnd dsp=%b2_bdsp sz=2
> -@b2_bra_b      &jdsp dsp=%b2_bdsp sz=2
> +@b2_bcnd_b  cd:4 dsp:s8&bcnd sz=2
> +@b2_bra_b    dsp:s8&jdsp sz=2
>

OK.

> 
> >>> +/* push rs */
> >>> +static bool trans_PUSH_r(DisasContext *ctx, arg_PUSH_r *a)
> >>> +{
> >>> +if (a->rs != 0) {
> >>> +tcg_gen_subi_i32(cpu_regs[0], cpu_regs[0], 4);
> >>> +rx_gen_ldst(a->sz, RX_MEMORY_ST, cpu_regs[a->rs], cpu_regs[0]);
> >>> +} else {
> >>> +tcg_gen_mov_i32(ctx->src, cpu_regs[a->rs]);
> >>> +tcg_gen_subi_i32(cpu_regs[0], cpu_regs[0], 4);
> >>> +rx_gen_ldst(a->sz, RX_MEMORY_ST, ctx->src, cpu_regs[0]);
> >>> +}
> >>> +return true;
> >>
> >> As far as I can see the THEN and ELSE cases have identical operation.
> > 
> > It little different.
> > In the case of r0, the value before decrementing is stored in memory.
> > I added comment.
> 
> What I mean is that the sequence that you use for r0 could also be used for 
> all
> other rN.
> 
> I understand that RX does not have an mmu, but the normal way we handle this 
> is
> 
>   tcg_gen_subi_i32(addr, cpu_regs[0], 4);
>   rx_gen_st(a->sz, cpu_regs[a->rs], addr);
>   tcg_gen_mov_i32(cpu_regs[0], addr);
> 
> so that the stack pointer is not modified if the store raises an exception.
>

r0 is stack pointer.
The push / pop instructions read and write the address indicated by r0.

This part is complicated, so let's fix it a little more.
It should be able to expand into transfer instruction of
pre-decrement and post-increment.
> 
> r~
> 

-- 
Yosinori Sato



[Qemu-devel] [PATCH 1/3] tests: refactor file monitor test to make it more understandable

2019-03-22 Thread Daniel P . Berrangé
The current file monitor unit tests are too clever for their own good
making it hard to understand the desired output.

Instead of trying to infer the expected events, explicitly list the
events we expect in the operation sequence.

Instead of dynamically building a matrix of tests, just have one giant
operation sequence that validates all scenarios in a single test.

Reviewed-by: Marc-André Lureau 
Signed-off-by: Daniel P. Berrangé 
---
 tests/test-util-filemonitor.c | 534 +-
 1 file changed, 208 insertions(+), 326 deletions(-)

diff --git a/tests/test-util-filemonitor.c b/tests/test-util-filemonitor.c
index 5d95cea5ee..ea3715a8f4 100644
--- a/tests/test-util-filemonitor.c
+++ b/tests/test-util-filemonitor.c
@@ -26,6 +26,9 @@
 #include 
 
 enum {
+QFILE_MONITOR_TEST_OP_ADD_WATCH,
+QFILE_MONITOR_TEST_OP_DEL_WATCH,
+QFILE_MONITOR_TEST_OP_EVENT,
 QFILE_MONITOR_TEST_OP_CREATE,
 QFILE_MONITOR_TEST_OP_APPEND,
 QFILE_MONITOR_TEST_OP_TRUNC,
@@ -38,20 +41,10 @@ typedef struct {
 int type;
 const char *filesrc;
 const char *filedst;
+int watchid;
+int eventid;
 } QFileMonitorTestOp;
 
-typedef struct {
-const char *file;
-} QFileMonitorTestWatch;
-
-typedef struct {
-gsize nwatches;
-const QFileMonitorTestWatch *watches;
-
-gsize nops;
-const QFileMonitorTestOp *ops;
-} QFileMonitorTestPlan;
-
 typedef struct {
 int id;
 QFileMonitorEvent event;
@@ -67,6 +60,7 @@ typedef struct {
 static QemuMutex evlock;
 static bool evstopping;
 static bool evrunning;
+static bool debug;
 
 /*
  * Main function for a background thread that is
@@ -200,9 +194,125 @@ qemu_file_monitor_test_expect(QFileMonitorTestData *data,
 
 
 static void
-test_file_monitor_events(const void *opaque)
+test_file_monitor_events(void)
 {
-const QFileMonitorTestPlan *plan = opaque;
+QFileMonitorTestOp ops[] = {
+{ .type = QFILE_MONITOR_TEST_OP_ADD_WATCH,
+  .filesrc = NULL, .watchid = 0 },
+{ .type = QFILE_MONITOR_TEST_OP_ADD_WATCH,
+  .filesrc = "one.txt", .watchid = 1 },
+{ .type = QFILE_MONITOR_TEST_OP_ADD_WATCH,
+  .filesrc = "two.txt", .watchid = 2 },
+
+
+{ .type = QFILE_MONITOR_TEST_OP_CREATE,
+  .filesrc = "one.txt", },
+{ .type = QFILE_MONITOR_TEST_OP_EVENT,
+  .filesrc = "one.txt", .watchid = 0,
+  .eventid = QFILE_MONITOR_EVENT_CREATED },
+{ .type = QFILE_MONITOR_TEST_OP_EVENT,
+  .filesrc = "one.txt", .watchid = 1,
+  .eventid = QFILE_MONITOR_EVENT_CREATED },
+
+
+{ .type = QFILE_MONITOR_TEST_OP_CREATE,
+  .filesrc = "two.txt", },
+{ .type = QFILE_MONITOR_TEST_OP_EVENT,
+  .filesrc = "two.txt", .watchid = 0,
+  .eventid = QFILE_MONITOR_EVENT_CREATED },
+{ .type = QFILE_MONITOR_TEST_OP_EVENT,
+  .filesrc = "two.txt", .watchid = 2,
+  .eventid = QFILE_MONITOR_EVENT_CREATED },
+
+
+{ .type = QFILE_MONITOR_TEST_OP_CREATE,
+  .filesrc = "three.txt", },
+{ .type = QFILE_MONITOR_TEST_OP_EVENT,
+  .filesrc = "three.txt", .watchid = 0,
+  .eventid = QFILE_MONITOR_EVENT_CREATED },
+
+
+{ .type = QFILE_MONITOR_TEST_OP_UNLINK,
+  .filesrc = "three.txt", },
+{ .type = QFILE_MONITOR_TEST_OP_EVENT,
+  .filesrc = "three.txt", .watchid = 0,
+  .eventid = QFILE_MONITOR_EVENT_DELETED },
+
+
+{ .type = QFILE_MONITOR_TEST_OP_RENAME,
+  .filesrc = "one.txt", .filedst = "two.txt" },
+{ .type = QFILE_MONITOR_TEST_OP_EVENT,
+  .filesrc = "one.txt", .watchid = 0,
+  .eventid = QFILE_MONITOR_EVENT_DELETED },
+{ .type = QFILE_MONITOR_TEST_OP_EVENT,
+  .filesrc = "one.txt", .watchid = 1,
+  .eventid = QFILE_MONITOR_EVENT_DELETED },
+{ .type = QFILE_MONITOR_TEST_OP_EVENT,
+  .filesrc = "two.txt", .watchid = 0,
+  .eventid = QFILE_MONITOR_EVENT_CREATED },
+{ .type = QFILE_MONITOR_TEST_OP_EVENT,
+  .filesrc = "two.txt", .watchid = 2,
+  .eventid = QFILE_MONITOR_EVENT_CREATED },
+
+
+{ .type = QFILE_MONITOR_TEST_OP_APPEND,
+  .filesrc = "two.txt", },
+{ .type = QFILE_MONITOR_TEST_OP_EVENT,
+  .filesrc = "two.txt", .watchid = 0,
+  .eventid = QFILE_MONITOR_EVENT_MODIFIED },
+{ .type = QFILE_MONITOR_TEST_OP_EVENT,
+  .filesrc = "two.txt", .watchid = 2,
+  .eventid = QFILE_MONITOR_EVENT_MODIFIED },
+
+
+{ .type = QFILE_MONITOR_TEST_OP_TOUCH,
+  .filesrc = "two.txt", },
+{ .type = QFILE_MONITOR_TEST_OP_EVENT,
+  .filesrc = "two.txt", .watchid = 0,
+  .eventid = QFILE_MONITOR_EVENT_ATTRIBUTES },
+{ .type = QFILE_MONITOR_TEST_OP_EVENT,
+  .filesrc = "two.txt", .watchid = 2,
+  .eventid = QFILE_MONITOR_EVENT_ATTRIBUTES },
+
+
+{ .type = QFILE_MONITOR_TEST_OP_DEL_WATCH,
+

Re: [Qemu-devel] [PATCH v8 05/16] gdbstub: add multiprocess support to vCont packets

2019-03-22 Thread Jan Kiszka

On 22.03.19 15:01, Luc Michel wrote:

On 3/22/19 2:29 PM, Jan Kiszka wrote:

On 07.12.18 10:01, Luc Michel wrote:

Add the gdb_first_attached_cpu() and gdb_next_attached_cpu() to iterate
over all the CPUs in currently attached processes.

Add the gdb_first_cpu_in_process() and gdb_next_cpu_in_process() to
iterate over CPUs of a given process.

Use them to add multiprocess extension support to vCont packets.

Signed-off-by: Luc Michel 
Reviewed-by: Philippe Mathieu-Daudé 
Reviewed-by: Edgar E. Iglesias 
Acked-by: Alistair Francis 
---
   gdbstub.c | 117 +++---
   1 file changed, 102 insertions(+), 15 deletions(-)

diff --git a/gdbstub.c b/gdbstub.c
index 911faa225a..77b3dbb2c8 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -721,10 +721,40 @@ static CPUState *find_cpu(uint32_t thread_id)
   }
   
   return NULL;

   }
   
+static CPUState *get_first_cpu_in_process(const GDBState *s,

+  GDBProcess *process)
+{
+CPUState *cpu;
+
+CPU_FOREACH(cpu) {
+if (gdb_get_cpu_pid(s, cpu) == process->pid) {
+return cpu;
+}
+}
+
+return NULL;
+}
+
+static CPUState *gdb_next_cpu_in_process(const GDBState *s, CPUState *cpu)
+{
+uint32_t pid = gdb_get_cpu_pid(s, cpu);
+cpu = CPU_NEXT(cpu);
+
+while (cpu) {
+if (gdb_get_cpu_pid(s, cpu) == pid) {
+break;
+}
+
+cpu = CPU_NEXT(cpu);
+}
+
+return cpu;
+}
+
   static CPUState *gdb_get_cpu(const GDBState *s, uint32_t pid, uint32_t tid)
   {
   GDBProcess *process;
   CPUState *cpu;
   
@@ -750,10 +780,41 @@ static CPUState *gdb_get_cpu(const GDBState *s, uint32_t pid, uint32_t tid)

   }
   
   return cpu;

   }
   
+/* Return the cpu following @cpu, while ignoring

+ * unattached processes.
+ */
+static CPUState *gdb_next_attached_cpu(const GDBState *s, CPUState *cpu)
+{
+cpu = CPU_NEXT(cpu);
+
+while (cpu) {
+if (gdb_get_cpu_process(s, cpu)->attached) {
+break;
+}
+
+cpu = CPU_NEXT(cpu);
+}
+
+return cpu;
+}
+
+/* Return the first attached cpu */
+static CPUState *gdb_first_attached_cpu(const GDBState *s)
+{
+CPUState *cpu = first_cpu;
+GDBProcess *process = gdb_get_cpu_process(s, cpu);
+
+if (!process->attached) {
+return gdb_next_attached_cpu(s, cpu);
+}
+
+return cpu;
+}
+
   static const char *get_feature_xml(const char *p, const char **newp,
  CPUClass *cc)
   {
   size_t len;
   int i;
@@ -1088,14 +1149,16 @@ static int is_query_packet(const char *p, const char 
*query, char separator)
* returns -ENOTSUP if a command is unsupported, -EINVAL or -ERANGE if there 
is
* a format error, 0 on success.
*/
   static int gdb_handle_vcont(GDBState *s, const char *p)
   {
-int res, idx, signal = 0;
+int res, signal = 0;
   char cur_action;
   char *newstates;
   unsigned long tmp;
+uint32_t pid, tid;
+GDBProcess *process;
   CPUState *cpu;
   #ifdef CONFIG_USER_ONLY
   int max_cpus = 1; /* global variable max_cpus exists only in system mode 
*/
   
   CPU_FOREACH(cpu) {

@@ -1134,29 +1197,52 @@ static int gdb_handle_vcont(GDBState *s, const char *p)
   } else if (cur_action != 'c' && cur_action != 's') {
   /* unknown/invalid/unsupported command */
   res = -ENOTSUP;
   goto out;
   }
-/* thread specification. special values: (none), -1 = all; 0 = any */
-if ((p[0] == ':' && p[1] == '-' && p[2] == '1') || (p[0] != ':')) {
-if (*p == ':') {
-p += 3;
-}
-for (idx = 0; idx < max_cpus; idx++) {
-if (newstates[idx] == 1) {
-newstates[idx] = cur_action;
+
+if (*p++ != ':') {
+res = -ENOTSUP;
+goto out;
+}
+
+switch (read_thread_id(p, &p, &pid, &tid)) {
+case GDB_READ_THREAD_ERR:
+res = -EINVAL;
+goto out;
+
+case GDB_ALL_PROCESSES:
+cpu = gdb_first_attached_cpu(s);
+while (cpu) {
+if (newstates[cpu->cpu_index] == 1) {
+newstates[cpu->cpu_index] = cur_action;
   }
+
+cpu = gdb_next_attached_cpu(s, cpu);
   }
-} else if (*p == ':') {
-p++;
-res = qemu_strtoul(p, &p, 16, &tmp);
-if (res) {
+break;
+
+case GDB_ALL_THREADS:
+process = gdb_get_process(s, pid);
+
+if (!process->attached) {
+res = -EINVAL;
   goto out;
   }
   
-/* 0 means any thread, so we pick the first valid CPU */

-cpu = tmp ? find_cpu(tmp) : first_cpu;
+cpu = get_first_cpu_in_process(s, process);
+while (cpu) {
+   

Re: [Qemu-devel] question about 9pfs fsdriver types

2019-03-22 Thread Greg Kurz
On Fri, 22 Mar 2019 11:57:04 +0200
"П, Алексей"  wrote:

> Hi there. Cannot find any info and examples about "proxy" and "handle"
> types of fsdriver of virtfs. Can anyone advise me description of?
> Witrh regards/

Hi,

The "handle" backend was deprecated in QEMU 2.12, for various reasons...
requires elevated privileges, broken symlinks, no known users. The code
got removed for upcoming QEMU 4.0.

About "proxy", maybe I'll try to find some time to update the wiki
at https://wiki.qemu.org/Documentation/9psetup .

In the meantime, here's an example:

1) start the helper as root in some shell

$ sudo virtfs-proxy-helper -n -p /var/tmp/test \
-s /var/tmp/virtfs-proxy-sock \
-u $(id -u) -g $(id -g)
Started

2) start QEMU in some other shell

$ qemu-system-x864_64 ${YOUR_FAVORITE_CMDLINE_ARGUMENTS} \
-fsdev proxy,id=fs0,socket=/var/tmp/virtfs-proxy-sock \
-device virtio-9p-pci,fsdev=fs0,mount_tag=${SOME_TAG}

Cheers,

--
Greg



Re: [Qemu-devel] [PATCH 0/6] block: Fix slow pre-zeroing in qemu-img convert

2019-03-22 Thread Eric Blake
On 3/22/19 8:21 AM, Kevin Wolf wrote:
> If qemu-img convert sees that the target image isn't zero-initialised
> yet, it tries to do an efficient zero write for the whole image first
> to save the overhead of repeated explicit zero writes during the
> conversion. Obviously, this provides only an advantage if the
> pre-zeroing is actually efficient. Otherwise, we can end up writing
> zeroes slowly while zeroing out the whole image, and then overwrite the
> same blocks again with real data, potentially doubling the written data.
> 
> Additionally, commit 9776f0db changed NBD to advertise for all NBD
> devices that zero writes with unmap is supported for all NBD devices, no
> matter whether the storage of NBD server actually can do this or whether
> we would fall back to explicit zero writes.
> 
> This series adds a new BDRV_REQ_NO_FALLBACK flag for writing zeroes,
> which makes the request return an error if it can't guarantee that we
> don't end up running a slow fallback path.
> 
> For NBD, this means that we still support zero writes from guests, but
> qemu-img convert will not try to use it to zero out the whole image.
> This is potentially suboptimal if the server does actually support
> efficient zero writes. We'd need an NBD protocol extension to transfer
> this flag so we can re-enable the qemu-img convert feature for the NBD
> driver without regressing on storage that can't provide efficient zero
> writes.

I haven't reviewed closely yet, but the summary is sane, so:
Acked-by: Eric Blake 

and I'll be cross-posting another mail soon with the desired NBD
protocol extension.

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



signature.asc
Description: OpenPGP digital signature


Re: [Qemu-devel] [RFC PATCH 0/2] implement the failover feature for assigned network devices

2019-03-22 Thread no-reply
Patchew URL: 
https://patchew.org/QEMU/20190322134447.14831-1-jfreim...@redhat.com/



Hi,

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

Type: series
Message-id: 20190322134447.14831-1-jfreim...@redhat.com
Subject: [Qemu-devel] [RFC PATCH 0/2] implement the failover feature for 
assigned network devices

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 * [new tag] patchew/20190322134447.14831-1-jfreim...@redhat.com -> 
patchew/20190322134447.14831-1-jfreim...@redhat.com
Switched to a new branch 'test'
4aa7f06 net/virtio: add failover support
5d2911f qdev/qbus: Add hidden device support

=== OUTPUT BEGIN ===
1/2 Checking commit 5d2911f6d6d4 (qdev/qbus: Add hidden device support)
ERROR: trailing whitespace
#22: FILE: hw/core/qdev.c:218:
+$

ERROR: that open brace { should be on the previous line
#30: FILE: hw/core/qdev.c:226:
+if (match_found)
+{

ERROR: that open brace { should be on the previous line
#36: FILE: hw/core/qdev.c:232:
+if (!match_found)
+{

WARNING: Block comments use a leading /* on a separate line
#89: FILE: include/hw/qdev-core.h:161:
+/* This callback is called just upon init of the DeviceState

ERROR: line over 90 characters
#93: FILE: include/hw/qdev-core.h:165:
+void (*should_be_hidden)(DeviceListener *listener, QemuOpts 
*device_opts,bool *match_found, bool *res);

ERROR: space required after that ',' (ctx:VxV)
#93: FILE: include/hw/qdev-core.h:165:
+void (*should_be_hidden)(DeviceListener *listener, QemuOpts 
*device_opts,bool *match_found, bool *res);
 ^

ERROR: that open brace { should be on the previous line
#123: FILE: qdev-monitor.c:576:
+if (strcmp(name, "standby") == 0)
+{

ERROR: that open brace { should be on the previous line
#126: FILE: qdev-monitor.c:579:
+if (qdev_should_hide_device(opts, errp) && errp && !*errp)
+{

ERROR: that open brace { should be on the previous line
#130: FILE: qdev-monitor.c:583:
+else if (errp && *errp)
+{

ERROR: else should follow close brace '}'
#130: FILE: qdev-monitor.c:583:
+}
+else if (errp && *errp)

ERROR: that open brace { should be on the previous line
#140: FILE: qdev-monitor.c:593:
+if (qemu_opt_foreach(opts, has_standby_device, opts, err) == 0)
+{

ERROR: trailing whitespace
#155: FILE: qdev-monitor.c:607:
+$

ERROR: that open brace { should be on the previous line
#156: FILE: qdev-monitor.c:608:
+if (opts && should_hide_device(opts, &err))
+{

ERROR: that open brace { should be on the previous line
#158: FILE: qdev-monitor.c:610:
+if(err)
+{

ERROR: space required before the open parenthesis '('
#158: FILE: qdev-monitor.c:610:
+if(err)

ERROR: that open brace { should be on the previous line
#173: FILE: qdev-monitor.c:688:
+if (dev)
+{

ERROR: that open brace { should be on the previous line
#202: FILE: vl.c:2343:
+} else if (dev)
+{

total: 16 errors, 1 warnings, 165 lines checked

Patch 1/2 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

2/2 Checking commit 4aa7f06bed23 (net/virtio: add failover support)
ERROR: that open brace { should be on the previous line
#73: FILE: hw/net/virtio-net.c:2650:
+if (!n->primary_dev && err)
+{

WARNING: line over 80 characters
#82: FILE: hw/net/virtio-net.c:2659:
+static void virtio_net_handle_migration_primary(VirtIONet *n, MigrationState * 
s)

WARNING: Block comments use a leading /* on a separate line
#88: FILE: hw/net/virtio-net.c:2665:
+/* Request unplug

WARNING: Block comments should align the * on each line
#91: FILE: hw/net/virtio-net.c:2668:
+ *
+*/

ERROR: that open brace { should be on the previous line
#93: FILE: hw/net/virtio-net.c:2670:
+if (!err)
+{

ERROR: that open brace { should be on the previous line
#99: FILE: hw/net/virtio-net.c:2676:
+if (should_be_hidden && !n->primary_dev)
+{

ERROR: that open brace { should be on the previous line
#104: FILE: hw/net/virtio-net.c:2681:
+else
+{

ERROR: else should follow close brace '}'
#104: FILE: hw/net/virtio-net.c:2681:
+}
+else

ERROR: space required after that ',' (ctx:VxV)
#114: FILE: hw/net/virtio-net.c:2691:
+virtio_net_handle_migration_primary(n,s);
  ^

ERROR: line over 90 characters
#117: FILE: hw/net/virtio-net.c:2694:
+static void virtio_net_primary_should_be_hidden(DeviceListener *listener, 
QemuOpts *de

[Qemu-devel] [PATCH 1/6] block: Remove error messages in bdrv_make_zero()

2019-03-22 Thread Kevin Wolf
There is only a single caller of bdrv_make_zero(), which is qemu-img
convert. If the function fails, we just fall back to a different method
of zeroing out blocks on the target image. There is no good reason to
print error messages on stderr when the higher level operation will
actually succeed.

Signed-off-by: Kevin Wolf 
---
 block/io.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/block/io.c b/block/io.c
index 2ba603c7bc..952372c2bb 100644
--- a/block/io.c
+++ b/block/io.c
@@ -909,8 +909,6 @@ int bdrv_make_zero(BdrvChild *child, BdrvRequestFlags flags)
 }
 ret = bdrv_block_status(bs, offset, bytes, &bytes, NULL, NULL);
 if (ret < 0) {
-error_report("error getting block status at offset %" PRId64 ": 
%s",
- offset, strerror(-ret));
 return ret;
 }
 if (ret & BDRV_BLOCK_ZERO) {
@@ -919,8 +917,6 @@ int bdrv_make_zero(BdrvChild *child, BdrvRequestFlags flags)
 }
 ret = bdrv_pwrite_zeroes(child, offset, bytes, flags);
 if (ret < 0) {
-error_report("error writing zeroes at offset %" PRId64 ": %s",
- offset, strerror(-ret));
 return ret;
 }
 offset += bytes;
-- 
2.20.1




[Qemu-devel] [RFC PATCH 2/2] net/virtio: add failover support

2019-03-22 Thread Jens Freimann
From: Sameeh Jubran 

---
 hw/net/virtio-net.c| 95 ++
 include/hw/virtio/virtio-net.h |  7 +++
 2 files changed, 102 insertions(+)

diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 7e2c2a6f6a..880420a673 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -12,6 +12,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/atomic.h"
 #include "qemu/iov.h"
 #include "hw/virtio/virtio.h"
 #include "net/net.h"
@@ -19,6 +20,7 @@
 #include "net/tap.h"
 #include "qemu/error-report.h"
 #include "qemu/timer.h"
+#include "qemu/option.h"
 #include "hw/virtio/virtio-net.h"
 #include "net/vhost_net.h"
 #include "net/announce.h"
@@ -29,6 +31,8 @@
 #include "migration/misc.h"
 #include "standard-headers/linux/ethtool.h"
 #include "trace.h"
+#include "monitor/qdev.h"
+#include "hw/pci/pci.h"
 
 #define VIRTIO_NET_VM_VERSION11
 
@@ -364,6 +368,9 @@ static void virtio_net_set_status(struct VirtIODevice 
*vdev, uint8_t status)
 }
 }
 
+
+static void virtio_net_primary_plug_timer(void *opaque);
+
 static void virtio_net_set_link_status(NetClientState *nc)
 {
 VirtIONet *n = qemu_get_nic_opaque(nc);
@@ -786,6 +793,14 @@ static void virtio_net_set_features(VirtIODevice *vdev, 
uint64_t features)
 } else {
 memset(n->vlans, 0xff, MAX_VLAN >> 3);
 }
+
+if (virtio_has_feature(features, VIRTIO_NET_F_STANDBY)) {
+atomic_set(&n->primary_should_be_hidden, false);
+if (n->primary_device_timer)
+timer_mod(n->primary_device_timer,
+qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) +
+4000);
+}
 }
 
 static int virtio_net_handle_rx_mode(VirtIONet *n, uint8_t cmd,
@@ -2626,6 +2641,74 @@ void virtio_net_set_netclient_name(VirtIONet *n, const 
char *name,
 n->netclient_type = g_strdup(type);
 }
 
+static void virtio_net_primary_plug_timer(void *opaque)
+{
+VirtIONet *n = opaque;
+Error *err = NULL;
+
+n->primary_dev = qdev_device_add(n->primary_device_opts, &err);
+if (!n->primary_dev && err)
+{
+if (n->primary_device_timer)
+timer_mod(n->primary_device_timer,
+qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) +
+100);
+}
+}
+
+static void virtio_net_handle_migration_primary(VirtIONet *n, MigrationState * 
s)
+{
+Error *err = NULL;
+bool should_be_hidden = atomic_read(&n->primary_should_be_hidden);
+
+if (migration_in_setup(s) && !should_be_hidden && n->primary_dev) {
+/* Request unplug
+ *
+ *
+*/
+qdev_unplug(n->primary_dev, &err);
+if (!err)
+{
+atomic_set(&n->primary_should_be_hidden, true);
+n->primary_dev = NULL;
+}
+} else if (migration_has_failed(s)) {
+if (should_be_hidden && !n->primary_dev)
+{
+/* We already unplugged the device let's plugged it back */
+n->primary_dev = qdev_device_add(n->primary_device_opts, &err);
+}
+else
+{
+}
+}
+}
+
+static void migration_state_notifier(Notifier *notifier, void *data)
+{
+MigrationState *s = data;
+VirtIONet *n = container_of(notifier, VirtIONet, migration_state);
+virtio_net_handle_migration_primary(n,s);
+}
+
+static void virtio_net_primary_should_be_hidden(DeviceListener *listener, 
QemuOpts *device_opts,
+bool *match_found, bool *res)
+{
+   VirtIONet *n = container_of(listener, VirtIONet, primary_listener);
+   const char * dev_id = qemu_opts_id(device_opts);
+
+*match_found = !strcmp(n->net_conf.primary_id_str ,dev_id);
+if (atomic_read(&n->primary_should_be_hidden) && 
!strcmp(qemu_opt_get(device_opts, "driver"), "vfio-pci")
+&& *match_found)
+{
+n->primary_device_opts = device_opts;
+*res = true;
+return;
+}
+
+*res = false;
+}
+
 static void virtio_net_device_realize(DeviceState *dev, Error **errp)
 {
 VirtIODevice *vdev = VIRTIO_DEVICE(dev);
@@ -2656,6 +2739,17 @@ static void virtio_net_device_realize(DeviceState *dev, 
Error **errp)
 n->host_features |= (1ULL << VIRTIO_NET_F_SPEED_DUPLEX);
 }
 
+if (n->net_conf.primary_id_str) {
+n->primary_listener.should_be_hidden = 
virtio_net_primary_should_be_hidden;
+atomic_set(&n->primary_should_be_hidden, true);
+device_listener_register(&n->primary_listener);
+n->migration_state.notify = migration_state_notifier;
+add_migration_state_change_notifier(&n->migration_state);
+n->host_features |= (1ULL << VIRTIO_NET_F_STANDBY);
+n->primary_device_timer = timer_new_ms(QEMU_CLOCK_VIRTUAL,
+ virtio_net_primary_plug_timer, n);
+}
+
 virtio_net_set_config_size(n, n->host_features);
 virtio_init(vdev, "virtio-net", VIRTIO_ID_NET, n->config_size);
 
@@ -2885,6 +2979,7 @@ static Property virtio_net_properties[] = {
  true),
 DEFINE_PROP_INT32("speed

[Qemu-devel] [RFC PATCH 1/2] qdev/qbus: Add hidden device support

2019-03-22 Thread Jens Freimann
From: Sameeh Jubran 

Signed-off-by: Jens Freimann 
---
 hw/core/qdev.c | 27 
 hw/pci/pci.c   |  1 +
 include/hw/pci/pci.h   |  2 ++
 include/hw/qdev-core.h |  8 +++
 qdev-monitor.c | 48 ++
 vl.c   |  7 --
 6 files changed, 87 insertions(+), 6 deletions(-)

diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index f9b6efe509..5e1c8f0120 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -211,6 +211,33 @@ void device_listener_unregister(DeviceListener *listener)
 QTAILQ_REMOVE(&device_listeners, listener, link);
 }
 
+bool qdev_should_hide_device(QemuOpts *opts, Error **errp)
+{
+bool res = false;
+bool match_found = false;
+
+DeviceListener *listener;
+
+QTAILQ_FOREACH(listener, &device_listeners, link) {
+   if (listener->should_be_hidden) {
+listener->should_be_hidden(listener, opts, &match_found, &res);
+}
+
+if (match_found)
+{
+break;
+}
+}
+/* No suitable pair device was found */
+if (!match_found)
+{
+error_setg(errp, "An error occurred: Couln't attach to standby device"
+" Please note that the primary device should be"
+" must be placed after the standby device in the command line");
+}
+return res;
+}
+
 void qdev_set_legacy_instance_id(DeviceState *dev, int alias_id,
  int required_for_version)
 {
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 35451c1e99..67b1b7c500 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -70,6 +70,7 @@ static Property pci_props[] = {
 QEMU_PCIE_LNKSTA_DLLLA_BITNR, true),
 DEFINE_PROP_BIT("x-pcie-extcap-init", PCIDevice, cap_present,
 QEMU_PCIE_EXTCAP_INIT_BITNR, true),
+DEFINE_PROP_STRING("standby", PCIDevice, standby_id_str),
 DEFINE_PROP_END_OF_LIST()
 };
 
diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index d87f5f93e9..f75dace1ec 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -351,6 +351,8 @@ struct PCIDevice {
 MSIVectorUseNotifier msix_vector_use_notifier;
 MSIVectorReleaseNotifier msix_vector_release_notifier;
 MSIVectorPollNotifier msix_vector_poll_notifier;
+
+char *standby_id_str;
 };
 
 void pci_register_bar(PCIDevice *pci_dev, int region_num,
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index 33ed3b8dde..e3b11f5503 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -144,6 +144,7 @@ struct DeviceState {
 char *canonical_path;
 bool realized;
 bool pending_deleted_event;
+bool hidden;
 QemuOpts *opts;
 int hotplugged;
 BusState *parent_bus;
@@ -157,6 +158,11 @@ struct DeviceState {
 struct DeviceListener {
 void (*realize)(DeviceListener *listener, DeviceState *dev);
 void (*unrealize)(DeviceListener *listener, DeviceState *dev);
+/* This callback is called just upon init of the DeviceState
+ * and can be used by a standby device for informing qdev if this
+ * device should be hidden by checking the device opts
+ */
+void (*should_be_hidden)(DeviceListener *listener, QemuOpts 
*device_opts,bool *match_found, bool *res);
 QTAILQ_ENTRY(DeviceListener) link;
 };
 
@@ -453,4 +459,6 @@ static inline bool qbus_is_hotpluggable(BusState *bus)
 void device_listener_register(DeviceListener *listener);
 void device_listener_unregister(DeviceListener *listener);
 
+bool qdev_should_hide_device(QemuOpts *opts, Error **errp);
+
 #endif
diff --git a/qdev-monitor.c b/qdev-monitor.c
index d4320986a2..f4cfc8d4a1 100644
--- a/qdev-monitor.c
+++ b/qdev-monitor.c
@@ -33,6 +33,7 @@
 #include "qemu/option.h"
 #include "sysemu/block-backend.h"
 #include "migration/misc.h"
+#include "migration/migration.h"
 
 /*
  * Aliases were a bad idea from the start.  Let's keep them
@@ -569,13 +570,49 @@ void qdev_set_id(DeviceState *dev, const char *id)
 }
 }
 
+static int has_standby_device(void *opaque, const char *name, const char 
*value,
+Error **errp)
+{
+if (strcmp(name, "standby") == 0)
+{
+QemuOpts *opts = (QemuOpts *)opaque;
+if (qdev_should_hide_device(opts, errp) && errp && !*errp)
+{
+return 1;
+}
+else if (errp && *errp)
+{
+return -1;
+}
+}
+return 0;
+}
+
+static bool should_hide_device(QemuOpts *opts, Error **err)
+{
+if (qemu_opt_foreach(opts, has_standby_device, opts, err) == 0)
+{
+return false;
+}
+return true;
+}
+
 DeviceState *qdev_device_add(QemuOpts *opts, Error **errp)
 {
 DeviceClass *dc;
 const char *driver, *path;
-DeviceState *dev;
+DeviceState *dev = NULL;
 BusState *bus = NULL;
 Error *err = NULL;
+
+if (opts && should_hide_device(opts, &err))
+{
+if(err)
+{
+goto err_del_dev;
+}
+return NU

[Qemu-devel] [PATCH 3/6] block: Advertise BDRV_REQ_NO_FALLBACK in filter drivers

2019-03-22 Thread Kevin Wolf
Filter drivers that support .bdrv_co_pwrite_zeroes can safely advertise
BDRV_REQ_NO_FALLBACK because they just forward the request flags to
their child node.

Signed-off-by: Kevin Wolf 
---
 block/blkdebug.c | 2 +-
 block/copy-on-read.c | 7 +++
 block/mirror.c   | 3 ++-
 block/raw-format.c   | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/block/blkdebug.c b/block/blkdebug.c
index 1ea835c2b9..efd9441625 100644
--- a/block/blkdebug.c
+++ b/block/blkdebug.c
@@ -401,7 +401,7 @@ static int blkdebug_open(BlockDriverState *bs, QDict 
*options, int flags,
 bs->supported_write_flags = BDRV_REQ_WRITE_UNCHANGED |
 (BDRV_REQ_FUA & bs->file->bs->supported_write_flags);
 bs->supported_zero_flags = BDRV_REQ_WRITE_UNCHANGED |
-((BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP) &
+((BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP | BDRV_REQ_NO_FALLBACK) &
 bs->file->bs->supported_zero_flags);
 ret = -EINVAL;
 
diff --git a/block/copy-on-read.c b/block/copy-on-read.c
index d670fec42b..53972b1da3 100644
--- a/block/copy-on-read.c
+++ b/block/copy-on-read.c
@@ -34,12 +34,11 @@ static int cor_open(BlockDriverState *bs, QDict *options, 
int flags,
 }
 
 bs->supported_write_flags = BDRV_REQ_WRITE_UNCHANGED |
-(BDRV_REQ_FUA &
-bs->file->bs->supported_write_flags);
+(BDRV_REQ_FUA & bs->file->bs->supported_write_flags);
 
 bs->supported_zero_flags = BDRV_REQ_WRITE_UNCHANGED |
-   ((BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP) &
-bs->file->bs->supported_zero_flags);
+((BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP | BDRV_REQ_NO_FALLBACK) &
+bs->file->bs->supported_zero_flags);
 
 return 0;
 }
diff --git a/block/mirror.c b/block/mirror.c
index eb9a4cdf56..ff15cfb197 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -1548,7 +1548,8 @@ static void mirror_start_job(const char *job_id, 
BlockDriverState *bs,
 }
 mirror_top_bs->total_sectors = bs->total_sectors;
 mirror_top_bs->supported_write_flags = BDRV_REQ_WRITE_UNCHANGED;
-mirror_top_bs->supported_zero_flags = BDRV_REQ_WRITE_UNCHANGED;
+mirror_top_bs->supported_zero_flags = BDRV_REQ_WRITE_UNCHANGED |
+  BDRV_REQ_NO_FALLBACK;
 bs_opaque = g_new0(MirrorBDSOpaque, 1);
 mirror_top_bs->opaque = bs_opaque;
 bdrv_set_aio_context(mirror_top_bs, bdrv_get_aio_context(bs));
diff --git a/block/raw-format.c b/block/raw-format.c
index cec29986cc..385cdc2490 100644
--- a/block/raw-format.c
+++ b/block/raw-format.c
@@ -434,7 +434,7 @@ static int raw_open(BlockDriverState *bs, QDict *options, 
int flags,
 bs->supported_write_flags = BDRV_REQ_WRITE_UNCHANGED |
 (BDRV_REQ_FUA & bs->file->bs->supported_write_flags);
 bs->supported_zero_flags = BDRV_REQ_WRITE_UNCHANGED |
-((BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP) &
+((BDRV_REQ_FUA | BDRV_REQ_MAY_UNMAP | BDRV_REQ_NO_FALLBACK) &
 bs->file->bs->supported_zero_flags);
 
 if (bs->probed && !bdrv_is_read_only(bs)) {
-- 
2.20.1




[Qemu-devel] [PATCH 2/6] block: Add BDRV_REQ_NO_FALLBACK

2019-03-22 Thread Kevin Wolf
For qemu-img convert, we want an operation that zeroes out the whole
image if this can be done efficiently, but that returns an error
otherwise so we don't write explicit zeroes and immediately overwrite
them with the real data, potentially doubling the amount of data to be
written.

Signed-off-by: Kevin Wolf 
---
 include/block/block.h |  7 ++-
 block/io.c| 12 +++-
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/include/block/block.h b/include/block/block.h
index e452988b66..c7a26199aa 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -83,8 +83,13 @@ typedef enum {
  */
 BDRV_REQ_SERIALISING= 0x80,
 
+/* Execute the request only if the operation can be offloaded or otherwise
+ * be executed efficiently, but return an error instead of using a slow
+ * fallback. */
+BDRV_REQ_NO_FALLBACK= 0x100,
+
 /* Mask of valid flags */
-BDRV_REQ_MASK   = 0xff,
+BDRV_REQ_MASK   = 0x1ff,
 } BdrvRequestFlags;
 
 typedef struct BlockSizes {
diff --git a/block/io.c b/block/io.c
index 952372c2bb..dfc153b8d8 100644
--- a/block/io.c
+++ b/block/io.c
@@ -1015,6 +1015,7 @@ static int coroutine_fn 
bdrv_driver_preadv(BlockDriverState *bs,
 unsigned int nb_sectors;
 
 assert(!(flags & ~BDRV_REQ_MASK));
+assert(!(flags & BDRV_REQ_NO_FALLBACK));
 
 if (!drv) {
 return -ENOMEDIUM;
@@ -1061,6 +1062,7 @@ static int coroutine_fn 
bdrv_driver_pwritev(BlockDriverState *bs,
 int ret;
 
 assert(!(flags & ~BDRV_REQ_MASK));
+assert(!(flags & BDRV_REQ_NO_FALLBACK));
 
 if (!drv) {
 return -ENOMEDIUM;
@@ -1467,6 +1469,10 @@ static int coroutine_fn 
bdrv_co_do_pwrite_zeroes(BlockDriverState *bs,
 return -ENOMEDIUM;
 }
 
+if ((flags & ~bs->supported_zero_flags) & BDRV_REQ_NO_FALLBACK) {
+return -ENOTSUP;
+}
+
 assert(alignment % bs->bl.request_alignment == 0);
 head = offset % alignment;
 tail = (offset + bytes) % alignment;
@@ -1510,7 +1516,7 @@ static int coroutine_fn 
bdrv_co_do_pwrite_zeroes(BlockDriverState *bs,
 assert(!bs->supported_zero_flags);
 }
 
-if (ret == -ENOTSUP) {
+if (ret == -ENOTSUP && !(flags & BDRV_REQ_NO_FALLBACK)) {
 /* Fall back to bounce buffer if write zeroes is unsupported */
 BdrvRequestFlags write_flags = flags & ~BDRV_REQ_ZERO_WRITE;
 
@@ -2949,6 +2955,10 @@ static int coroutine_fn bdrv_co_copy_range_internal(
 BdrvTrackedRequest req;
 int ret;
 
+/* TODO We can support BDRV_REQ_NO_FALLBACK here */
+assert(!(read_flags & BDRV_REQ_NO_FALLBACK));
+assert(!(write_flags & BDRV_REQ_NO_FALLBACK));
+
 if (!dst || !dst->bs) {
 return -ENOMEDIUM;
 }
-- 
2.20.1




[Qemu-devel] [PATCH 5/6] qemu-img: Use BDRV_REQ_NO_FALLBACK for pre-zeroing

2019-03-22 Thread Kevin Wolf
If qemu-img convert sees that the target image isn't zero-initialised
yet, it tries to do an efficient zero write for the whole image first
to save the overhead of repeated explicit zero writes during the
conversion. Obviously, this provides only an advantage if the
pre-zeroing is actually efficient. Otherwise, we can end up writing
zeroes slowly while zeroing out the whole image, and then overwrite the
same blocks again with real data, potentially doubling the written data.

Pass BDRV_REQ_NO_FALLBACK to blk_make_zero() to avoid this case. If we
can't efficiently zero out, we'll instead write explicit zeroes only if
there is no data to be written to a block.

Signed-off-by: Kevin Wolf 
---
 qemu-img.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qemu-img.c b/qemu-img.c
index 5fac840742..8ee63daeae 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -1932,7 +1932,7 @@ static int convert_do_copy(ImgConvertState *s)
 if (!s->has_zero_init && !s->target_has_backing &&
 bdrv_can_write_zeroes_with_unmap(blk_bs(s->target)))
 {
-ret = blk_make_zero(s->target, BDRV_REQ_MAY_UNMAP);
+ret = blk_make_zero(s->target, BDRV_REQ_MAY_UNMAP | 
BDRV_REQ_NO_FALLBACK);
 if (ret == 0) {
 s->has_zero_init = true;
 }
-- 
2.20.1




[Qemu-devel] [RFC PATCH 0/2] implement the failover feature for assigned network devices

2019-03-22 Thread Jens Freimann
This is another attempt at implementing the host side of the
net_failover concept
(https://www.kernel.org/doc/html/latest/networking/net_failover.html)

The general idea is that we have a pair of devices, a vfio-pci and a
emulated device. Before migration the vfio device is unplugged and data
flows to the emulated device, on the target side another vfio-pci device
is plugged in to take over the data-path. In the guest the net_failover
module will pair net devices with the same MAC address.

* In the first patch the infrastructure for hiding the device is added
  for the qbus and qdev APIs. A "hidden" boolean is added to the device
  state and it is set based on a callback to the standby device which
  registers itself for handling the assessment: "should the primary device
  be hidden?" by cross validating the ids of the devices.

* In the second patch the virtio-net uses the API to hide the vfio
  device and unhides it when the feature is acked.

Previous discussion: https://patchwork.ozlabs.org/cover/989098/

To summarize concerns/feedback from previous discussion:
1.- guest OS can reject or worse _delay_ unplug by any amount of time.
  Migration might get stuck for unpredictable time with unclear reason.
  This approach combines two tricky things, hot/unplug and migration. 
  -> We can surprise-remove the PCI device and in QEMU we can do all
 necessary rollbacks transparent to management software. Will it be
 easy, probably not.
2. PCI devices are a precious ressource. The primary device should never
  be added to QEMU if it won't be used by guest instead of hiding it in
  QEMU. 
  -> We only hotplug the device when the standby feature bit was
 negotiated. We save the device cmdline options until we need it for
 qdev_device_add()
 Hiding a device can be a useful concept to model. For example a
 pci device in a powered-off slot could be marked as hidden until the slot 
is
 powered on (mst).
3. Management layer software should handle this. Open Stack already has
  components/code to handle unplug/replug VFIO devices and metadata to
  provide to the guest for detecting which devices should be paired.
  -> An approach that includes all software from firmware to
 higher-level management software wasn't tried in the last years. This is
 an attempt to keep it simple and contained in QEMU as much as possible.
4. Hotplugging a device and then making it part of a failover setup is
   not possible
  -> addressed by extending qdev hotplug functions to check for hidden
 attribute, so e.g. device_add can be used to plug a device.

There are still some open issues:

Migration: I'm looking for something like a pre-migration hook that I
could use to unplug the vfio-pci device. I tried with a migration
notifier but it is called to late, i.e. after migration is aborted due
to vfio-pci marked unmigrateable. I worked around this by setting it
to migrateable and used a migration notifier on the virtio-net device.

Commandline: There is a dependency between vfio-pci and virtio-net
devices. One points to the other via new parameters
primar= and standby=''. This means
that the primary device needs to be specified after standby device on 
the qemu command line. Not sure how to solve this. 

Error handling: Patches don't cover all possible error scenarios yet.

I have tested this with a mlx5 NIC and was able to migrate the VM with
above mentioned workarounds for open problems.

Command line example:

qemu-system-x86_64 -enable-kvm -m 3072 -smp 3 \
-machine q35,kernel-irqchip=split -cpu host   \
-k fr   \
-serial stdio   \
-net none \
-qmp unix:/tmp/qmp.socket,server,nowait \
-monitor telnet:127.0.0.1:,server,nowait \
-device pcie-root-port,id=root0,multifunction=on,chassis=0,addr=0xa \
-device pcie-root-port,id=root1,bus=pcie.0,chassis=1 \
-device pcie-root-port,id=root2,bus=pcie.0,chassis=2 \
-netdev 
tap,script=/root/bin/bridge.sh,downscript=no,id=hostnet1,vhost=on \
-device 
virtio-net-pci,netdev=hostnet1,id=net1,mac=52:54:00:6f:55:cc,bus=root2,primary=hostdev0
 \  
   
-device vfio-pci,host=5e:00.2,id=hostdev0,bus=root1,standby=net1 \
/root/rhel-guest-image-8.0-1781.x86_64.qcow2

I'm grateful for any remarks or ideas!

Thanks!

regards,
Jens 

Sameeh Jubran (2):
  qdev/qbus: Add hidden device support
  net/virtio: add failover support

 hw/core/qdev.c | 27 ++
 hw/net/virtio-net.c| 95 ++
 hw/pci/pci.c   |  1 +
 include/hw/pci/pci.h   |  2 +
 include/hw/qdev-core.h |  8 +++
 include/hw/virtio/virtio-net.h |  7 +++
 qdev-monitor.c | 48 +++--
 vl.c   |  7 ++-
 8 files changed, 189 insertions(+), 6 deletions(-)

-- 
2.20.1




Re: [Qemu-devel] [PATCH v1] exec: check the range in the address_space_unmap routine

2019-03-22 Thread Peter Maydell
On Fri, 22 Mar 2019 at 13:19, Dima Stepanov  wrote:
>
> In case of the virtio-blk communication, can get the following assertion
> for the specifically crafted virtio packet:
>   qemu-system-x86_64: exec.c:3725: address_space_unmap: Assertion `mr !=
>   NULL' failed.
> This assertion is triggered if the length of the first descriptor in the
> block request chain (block command descriptor) is more than block command
> size. In this case the hw/block/virtio-blk.c:virtio_blk_handle_request()
> routine calls the iov_discard_front() function and the iov base and size
> are changed. As a result the address can not be found during the
> address_space_unmap() call.
>
> The fix is to check the whole address range in the address_space_unmap
> function.
>
> Signed-off-by: Dima Stepanov 
> ---
>  exec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/exec.c b/exec.c
> index 86a38d3..0eeb018 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -3717,7 +3717,7 @@ void *address_space_map(AddressSpace *as,
>  void address_space_unmap(AddressSpace *as, void *buffer, hwaddr len,
>   int is_write, hwaddr access_len)
>  {
> -if (buffer != bounce.buffer) {
> +if ((buffer < bounce.buffer) || (buffer + access_len > bounce.buffer + 
> bounce.len)) {
>  MemoryRegion *mr;
>  ram_addr_t addr1;

A quick look at the xen_invalidate_map_cache_entry() implementation
suggests that it also assumes that the address passed to
address_space_unmap() must be the same address that was
originally handed out via address_space_map().

So I think we either need to also change the Xen code, or
we need to fix this at the virtio level by having it keep
track of the buffer it was handed so it can unmap it.

thanks
-- PMM



[Qemu-devel] [PATCH 6/6] qemu-io: Add write -n for BDRV_REQ_NO_FALLBACK

2019-03-22 Thread Kevin Wolf
This makes the new BDRV_REQ_NO_FALLBACK flag available in the qemu-io
write command.

Signed-off-by: Kevin Wolf 
---
 qemu-io-cmds.c | 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c
index 35dcdcf413..09750a23ce 100644
--- a/qemu-io-cmds.c
+++ b/qemu-io-cmds.c
@@ -946,6 +946,7 @@ static void write_help(void)
 " -b, -- write to the VM state rather than the virtual disk\n"
 " -c, -- write compressed data with blk_write_compressed\n"
 " -f, -- use Force Unit Access semantics\n"
+" -n, -- with -z, don't allow slow fallback\n"
 " -p, -- ignored for backwards compatibility\n"
 " -P, -- use different pattern to fill file\n"
 " -C, -- report statistics in a machine parsable format\n"
@@ -964,7 +965,7 @@ static const cmdinfo_t write_cmd = {
 .perm   = BLK_PERM_WRITE,
 .argmin = 2,
 .argmax = -1,
-.args   = "[-bcCfquz] [-P pattern] off len",
+.args   = "[-bcCfnquz] [-P pattern] off len",
 .oneline= "writes a number of bytes at a specified offset",
 .help   = write_help,
 };
@@ -983,7 +984,7 @@ static int write_f(BlockBackend *blk, int argc, char **argv)
 int64_t total = 0;
 int pattern = 0xcd;
 
-while ((c = getopt(argc, argv, "bcCfpP:quz")) != -1) {
+while ((c = getopt(argc, argv, "bcCfnpP:quz")) != -1) {
 switch (c) {
 case 'b':
 bflag = true;
@@ -997,6 +998,9 @@ static int write_f(BlockBackend *blk, int argc, char **argv)
 case 'f':
 flags |= BDRV_REQ_FUA;
 break;
+case 'n':
+flags |= BDRV_REQ_NO_FALLBACK;
+break;
 case 'p':
 /* Ignored for backwards compatibility */
 break;
@@ -1037,6 +1041,11 @@ static int write_f(BlockBackend *blk, int argc, char 
**argv)
 return -EINVAL;
 }
 
+if ((flags & BDRV_REQ_NO_FALLBACK) && !zflag) {
+printf("-n requires -z to be specified\n");
+return -EINVAL;
+}
+
 if ((flags & BDRV_REQ_MAY_UNMAP) && !zflag) {
 printf("-u requires -z to be specified\n");
 return -EINVAL;
-- 
2.20.1




[Qemu-devel] [PATCH 0/6] block: Fix slow pre-zeroing in qemu-img convert

2019-03-22 Thread Kevin Wolf
If qemu-img convert sees that the target image isn't zero-initialised
yet, it tries to do an efficient zero write for the whole image first
to save the overhead of repeated explicit zero writes during the
conversion. Obviously, this provides only an advantage if the
pre-zeroing is actually efficient. Otherwise, we can end up writing
zeroes slowly while zeroing out the whole image, and then overwrite the
same blocks again with real data, potentially doubling the written data.

Additionally, commit 9776f0db changed NBD to advertise for all NBD
devices that zero writes with unmap is supported for all NBD devices, no
matter whether the storage of NBD server actually can do this or whether
we would fall back to explicit zero writes.

This series adds a new BDRV_REQ_NO_FALLBACK flag for writing zeroes,
which makes the request return an error if it can't guarantee that we
don't end up running a slow fallback path.

For NBD, this means that we still support zero writes from guests, but
qemu-img convert will not try to use it to zero out the whole image.
This is potentially suboptimal if the server does actually support
efficient zero writes. We'd need an NBD protocol extension to transfer
this flag so we can re-enable the qemu-img convert feature for the NBD
driver without regressing on storage that can't provide efficient zero
writes.

Kevin Wolf (6):
  block: Remove error messages in bdrv_make_zero()
  block: Add BDRV_REQ_NO_FALLBACK
  block: Advertise BDRV_REQ_NO_FALLBACK in filter drivers
  file-posix: Support BDRV_REQ_NO_FALLBACK for zero writes
  qemu-img: Use BDRV_REQ_NO_FALLBACK for pre-zeroing
  qemu-io: Add write -n for BDRV_REQ_NO_FALLBACK

 include/block/block.h   |  7 ++-
 include/block/raw-aio.h |  1 +
 block/blkdebug.c|  2 +-
 block/copy-on-read.c|  7 +++
 block/file-posix.c  | 24 
 block/io.c  | 16 +++-
 block/mirror.c  |  3 ++-
 block/raw-format.c  |  2 +-
 qemu-img.c  |  2 +-
 qemu-io-cmds.c  | 13 +++--
 10 files changed, 53 insertions(+), 24 deletions(-)

-- 
2.20.1




  1   2   >