Re: [Qemu-devel] [PATCH 26/34] hw/net/ne2000: extract ne2k-isa code from i386/pc to ne2000-isa.c

2017-09-22 Thread David Gibson
On Fri, Sep 22, 2017 at 01:01:03PM -0300, Philippe Mathieu-Daudé wrote:
> - add "hw/net/ne2000-isa.h" (and new entry in MAINTAINERS)
> - remove the old i386 dependency
> 
> Signed-off-by: Philippe Mathieu-Daudé 

ppc portion

Acked-by: David Gibson 

> ---
>  hw/net/ne2000.h |  3 +++
>  include/hw/i386/pc.h| 20 
>  include/hw/net/ne2000-isa.h | 33 +
>  hw/i386/pc.c|  1 +
>  hw/mips/mips_r4k.c  |  1 +
>  hw/net/ne2000-isa.c |  6 ++
>  hw/net/ne2000.c |  2 --
>  hw/ppc/prep.c   |  1 +
>  MAINTAINERS |  1 +
>  9 files changed, 42 insertions(+), 26 deletions(-)
>  create mode 100644 include/hw/net/ne2000-isa.h
> 
> diff --git a/hw/net/ne2000.h b/hw/net/ne2000.h
> index d213dccae3..adb8021bd1 100644
> --- a/hw/net/ne2000.h
> +++ b/hw/net/ne2000.h
> @@ -1,6 +1,9 @@
>  #ifndef HW_NE2000_H
>  #define HW_NE2000_H
>  
> +#include "hw/hw.h"
> +#include "net/net.h"
> +
>  #define NE2000_PMEM_SIZE(32*1024)
>  #define NE2000_PMEM_START   (16*1024)
>  #define NE2000_PMEM_END (NE2000_PMEM_SIZE+NE2000_PMEM_START)
> diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
> index 6a2e947332..020792c2e8 100644
> --- a/include/hw/i386/pc.h
> +++ b/include/hw/i386/pc.h
> @@ -291,26 +291,6 @@ PCIBus *find_i440fx(void);
>  extern PCIDevice *piix4_dev;
>  int piix4_init(PCIBus *bus, ISABus **isa_bus, int devfn);
>  
> -/* ne2000.c */
> -static inline bool isa_ne2000_init(ISABus *bus, int base, int irq, NICInfo 
> *nd)
> -{
> -DeviceState *dev;
> -ISADevice *isadev;
> -
> -qemu_check_nic_model(nd, "ne2k_isa");
> -
> -isadev = isa_try_create(bus, "ne2k_isa");
> -if (!isadev) {
> -return false;
> -}
> -dev = DEVICE(isadev);
> -qdev_prop_set_uint32(dev, "iobase", base);
> -qdev_prop_set_uint32(dev, "irq",irq);
> -qdev_set_nic_properties(dev, nd);
> -qdev_init_nofail(dev);
> -return true;
> -}
> -
>  /* pc_sysfw.c */
>  void pc_system_firmware_init(MemoryRegion *rom_memory,
>   bool isapc_ram_fw);
> diff --git a/include/hw/net/ne2000-isa.h b/include/hw/net/ne2000-isa.h
> new file mode 100644
> index 00..ff2bed9c95
> --- /dev/null
> +++ b/include/hw/net/ne2000-isa.h
> @@ -0,0 +1,33 @@
> +/*
> + * QEMU NE2000 emulation -- isa bus windup
> + *
> + * Copyright (c) 2003-2004 Fabrice Bellard
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + */
> +#include "hw/hw.h"
> +#include "hw/qdev.h"
> +#include "hw/isa/isa.h"
> +#include "net/net.h"
> +
> +#define TYPE_ISA_NE2000 "ne2k_isa"
> +
> +static inline ISADevice *isa_ne2000_init(ISABus *bus, int base, int irq,
> + NICInfo *nd)
> +{
> +ISADevice *d;
> +
> +qemu_check_nic_model(nd, "ne2k_isa");
> +
> +d = isa_try_create(bus, TYPE_ISA_NE2000);
> +if (d) {
> +DeviceState *dev = DEVICE(d);
> +
> +qdev_prop_set_uint32(dev, "iobase", base);
> +qdev_prop_set_uint32(dev, "irq",irq);
> +qdev_set_nic_properties(dev, nd);
> +qdev_init_nofail(dev);
> +}
> +return d;
> +}
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index 788844e0de..085577e066 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -71,6 +71,7 @@
>  #include "qom/cpu.h"
>  #include "hw/nmi.h"
>  #include "hw/i386/intel_iommu.h"
> +#include "hw/net/ne2000-isa.h"
>  
>  /* debug PC/ISA interrupts */
>  //#define DEBUG_IRQ
> diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c
> index 349da59912..33ff89f02c 100644
> --- a/hw/mips/mips_r4k.c
> +++ b/hw/mips/mips_r4k.c
> @@ -18,6 +18,7 @@
>  #include "hw/char/serial.h"
>  #include "hw/isa/isa.h"
>  #include "net/net.h"
> +#include "hw/net/ne2000-isa.h"
>  #include "sysemu/sysemu.h"
>  #include "hw/boards.h"
>  #include "hw/block/flash.h"
> diff --git a/hw/net/ne2000-isa.c b/hw/net/ne2000-isa.c
> index f3455339ee..70e5c1d3d4 100644
> --- a/hw/net/ne2000-isa.c
> +++ b/hw/net/ne2000-isa.c
> @@ -22,17 +22,15 @@
>   * THE SOFTWARE.
>   */
>  #include "qemu/osdep.h"
> -#include "hw/hw.h"
> -#include "hw/i386/pc.h"
>  #include "hw/isa/isa.h"
> +#include "hw/net/ne2000-isa.h"
>  #include "hw/qdev.h"
> -#include "net/net.h"
>  #include "ne2000.h"
> +#include "sysemu/sysemu.h"
>  #include "exec/address-spaces.h"
>  #include "qapi/error.h"
>  #include "qapi/visitor.h"
>  
> -#define TYPE_ISA_NE2000 "ne2k_isa"
>  #define ISA_NE2000(obj) OBJECT_CHECK(ISANE2000State, (obj), TYPE_ISA_NE2000)
>  
>  typedef struct ISANE2000State {
> diff --git a/hw/net/ne2000.c b/hw/net/ne2000.c
> index 798d681e25..29bd4adb3f 100644
> --- a/hw/net/ne2000.c
> +++ b/hw/net/ne2000.c
> @@ -22,9 +22,7 @@
>   * THE SOFTWARE.
>   */
>  #include "qemu/osdep.h"
> -#include "hw/hw.h"
>  #include "hw/pci/pci.h"
> -#include "net/net.h"
>  #include 

Re: [Qemu-devel] [PATCH 2/2] ppc: remove all unused CPU definitions

2017-09-22 Thread David Gibson
On Wed, Sep 20, 2017 at 08:52:21PM +0200, Thomas Huth wrote:
> On 19.09.2017 23:36, John Snow wrote:
> > Remove *all* unused CPU definitions as indicated by compile-time
> > `#if 0` constructs.
> > 
> > Signed-off-by: John Snow 
> > ---
> >  target/ppc/cpu-models.h | 223 
> > 
> >  1 file changed, 223 deletions(-)
> > 
> > diff --git a/target/ppc/cpu-models.h b/target/ppc/cpu-models.h
> > index b34b512..248f833 100644
> > --- a/target/ppc/cpu-models.h
> > +++ b/target/ppc/cpu-models.h
> [...]
> > @@ -234,24 +105,11 @@ enum {
> >  CPU_POWERPC_440GXb = 0x51B21851,
> >  CPU_POWERPC_440GXc = 0x51B21892,
> >  CPU_POWERPC_440GXf = 0x51B21894,
> > -#if 0
> > -CPU_POWERPC_440S   = xxx,
> > -#endif
> >  CPU_POWERPC_440SP  = 0x53221850,
> >  CPU_POWERPC_440SP2 = 0x53221891,
> >  CPU_POWERPC_440SPE = 0x53421890,
> >  /* PowerPC 460 family */
> > -#if 0
> > -/* Generic PowerPC 464 */
> > -#define CPU_POWERPC_464  CPU_POWERPC_464H90
> > -#endif
> >  /* PowerPC 464 microcontrolers */
> > -#if 0
> > -CPU_POWERPC_464H90 = xxx,
> > -#endif
> > -#if 0
> > -CPU_POWERPC_464H90FP   = xxx,
> > -#endif
> 
> I think you could also remove the "/* PowerPC 460 family */" and "/*
> PowerPC 464 microcontrolers */" lines now.
> 
> Anyway:
> 
> Reviewed-by: Thomas Huth 

Yes, I've made that extra change and applied.

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson


signature.asc
Description: PGP signature


Re: [Qemu-devel] [PATCH 30/34] hw/net/pcnet: use TYPE_PCI_PCNET

2017-09-22 Thread David Gibson
On Fri, Sep 22, 2017 at 01:01:07PM -0300, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé 

ppc portion

Acked-by: David Gibson 

> ---
>  include/hw/net/pci.h | 1 +
>  hw/mips/mips_malta.c | 2 +-
>  hw/net/pcnet-pci.c   | 3 +--
>  hw/ppc/prep.c| 3 ++-
>  4 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/include/hw/net/pci.h b/include/hw/net/pci.h
> index 92111f86f3..5ad5487a91 100644
> --- a/include/hw/net/pci.h
> +++ b/include/hw/net/pci.h
> @@ -15,6 +15,7 @@
>  
>  #define TYPE_PCI_E1000  "e1000"
>  #define TYPE_PCI_E1000E "e1000e"
> +#define TYPE_PCI_PCNET  "pcnet"
>  
>  PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *rootbus,
> const char *default_model,
> diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
> index fb6a2f9363..921678fdb0 100644
> --- a/hw/mips/mips_malta.c
> +++ b/hw/mips/mips_malta.c
> @@ -597,7 +597,7 @@ static void network_init(PCIBus *pci_bus)
>  /* The malta board has a PCNet card using PCI SLOT 11 */
>  default_devaddr = "0b";
>  
> -pci_nic_init_nofail(nd, pci_bus, "pcnet", default_devaddr);
> +pci_nic_init_nofail(nd, pci_bus, TYPE_PCI_PCNET, default_devaddr);
>  }
>  }
>  
> diff --git a/hw/net/pcnet-pci.c b/hw/net/pcnet-pci.c
> index 0acf8a4879..878e2c89c1 100644
> --- a/hw/net/pcnet-pci.c
> +++ b/hw/net/pcnet-pci.c
> @@ -29,6 +29,7 @@
>  
>  #include "qemu/osdep.h"
>  #include "hw/pci/pci.h"
> +#include "hw/net/pci.h"
>  #include "net/net.h"
>  #include "hw/loader.h"
>  #include "qemu/timer.h"
> @@ -46,8 +47,6 @@
>  //#define PCNET_DEBUG_TMD
>  //#define PCNET_DEBUG_MATCH
>  
> -#define TYPE_PCI_PCNET "pcnet"
> -
>  #define PCI_PCNET(obj) \
>   OBJECT_CHECK(PCIPCNetState, (obj), TYPE_PCI_PCNET)
>  
> diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
> index fb330a1769..b2c7a62ebc 100644
> --- a/hw/ppc/prep.c
> +++ b/hw/ppc/prep.c
> @@ -44,6 +44,7 @@
>  #include "hw/input/i8042.h"
>  #include "hw/isa/pc87312.h"
>  #include "hw/net/ne2000-isa.h"
> +#include "hw/net/pci.h"
>  #include "sysemu/block-backend.h"
>  #include "sysemu/arch_init.h"
>  #include "sysemu/kvm.h"
> @@ -800,7 +801,7 @@ static void ibm_40p_init(MachineState *machine)
>  pci_vga_init(pci_bus);
>  
>  for (i = 0; i < nb_nics; i++) {
> -pci_nic_init_nofail(_table[i], pci_bus, "pcnet",
> +pci_nic_init_nofail(_table[i], pci_bus, TYPE_PCI_PCNET,
>  i == 0 ? "3" : NULL);
>  }
>  }

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson


signature.asc
Description: PGP signature


Re: [Qemu-devel] [PATCH 22/34] hw/input/i8042: extract API from hw/i386/pc.h

2017-09-22 Thread David Gibson
On Fri, Sep 22, 2017 at 12:40:02PM -0300, Philippe Mathieu-Daudé wrote:
> - include vmmouse
> - add entries in MAINTAINERS (pckbd.c, i8042.h)
> 
> Signed-off-by: Philippe Mathieu-Daudé 

ppc portions

Acked-by: David Gibson 

> ---
>  include/hw/i386/pc.h | 11 ---
>  include/hw/input/i8042.h | 30 ++
>  hw/alpha/dp264.c |  3 ++-
>  hw/i386/pc.c |  5 +++--
>  hw/input/pckbd.c |  2 +-
>  hw/input/vmmouse.c   |  3 +--
>  hw/mips/mips_fulong2e.c  |  3 ++-
>  hw/mips/mips_jazz.c  |  1 +
>  hw/mips/mips_malta.c |  3 ++-
>  hw/mips/mips_r4k.c   |  3 ++-
>  hw/misc/vmport.c |  1 +
>  hw/ppc/prep.c|  5 +++--
>  hw/sparc64/sun4u.c   |  3 ++-
>  hw/unicore32/puv3.c  |  1 +
>  MAINTAINERS  |  4 +++-
>  15 files changed, 54 insertions(+), 24 deletions(-)
>  create mode 100644 include/hw/input/i8042.h
> 
> diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
> index 25ba378bd8..6a2e947332 100644
> --- a/include/hw/i386/pc.h
> +++ b/include/hw/i386/pc.h
> @@ -193,17 +193,6 @@ static inline void vmport_init(ISABus *bus)
>  }
>  
>  void vmport_register(unsigned char command, VMPortReadFunc *func, void 
> *opaque);
> -void vmmouse_get_data(uint32_t *data);
> -void vmmouse_set_data(const uint32_t *data);
> -
> -/* pckbd.c */
> -#define I8042_A20_LINE "a20"
> -
> -void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,
> -   MemoryRegion *region, ram_addr_t size,
> -   hwaddr mask);
> -void i8042_isa_mouse_fake_event(void *opaque);
> -void i8042_setup_a20_line(ISADevice *dev, qemu_irq a20_out);
>  
>  /* pc.c */
>  extern int fd_bootchk;
> diff --git a/include/hw/input/i8042.h b/include/hw/input/i8042.h
> new file mode 100644
> index 00..836417304b
> --- /dev/null
> +++ b/include/hw/input/i8042.h
> @@ -0,0 +1,30 @@
> +/*
> + * QEMU PS/2 Controller
> + *
> + * Copyright (c) 2003 Fabrice Bellard
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + */
> +#ifndef HW_INPUT_I8042_H
> +#define HW_INPUT_I8042_H
> +
> +#include "hw/hw.h"
> +#include "hw/isa/isa.h"
> +
> +#define TYPE_I8042 "i8042"
> +
> +#define I8042_A20_LINE "a20"
> +
> +void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,
> +   MemoryRegion *region, ram_addr_t size,
> +   hwaddr mask);
> +void i8042_isa_mouse_fake_event(void *opaque);
> +void i8042_setup_a20_line(ISADevice *dev, qemu_irq a20_out);
> +
> +#define TYPE_VMMOUSE "vmmouse"
> +
> +void vmmouse_get_data(uint32_t *data);
> +void vmmouse_set_data(const uint32_t *data);
> +
> +#endif /* HW_INPUT_I8042_H */
> diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c
> index 1bd5243648..2253990654 100644
> --- a/hw/alpha/dp264.c
> +++ b/hw/alpha/dp264.c
> @@ -19,6 +19,7 @@
>  #include "hw/timer/mc146818rtc.h"
>  #include "hw/ide.h"
>  #include "hw/timer/i8254.h"
> +#include "hw/input/i8042.h"
>  #include "hw/char/serial.h"
>  #include "qemu/cutils.h"
>  
> @@ -82,7 +83,7 @@ static void clipper_init(MachineState *machine)
>  rtc_init(isa_bus, 1900, rtc_irq);
>  
>  i8254_pit_init(isa_bus, 0x40, 0, NULL);
> -isa_create_simple(isa_bus, "i8042");
> +isa_create_simple(isa_bus, TYPE_I8042);
>  
>  /* VGA setup.  Don't bother loading the bios.  */
>  pci_vga_init(pci_bus);
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index 5cb0ae67cd..3aa10c780b 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -40,6 +40,7 @@
>  #include "multiboot.h"
>  #include "hw/timer/mc146818rtc.h"
>  #include "hw/timer/i8254.h"
> +#include "hw/input/i8042.h"
>  #include "hw/audio/pcspk.h"
>  #include "hw/pci/msi.h"
>  #include "hw/sysbus.h"
> @@ -1564,11 +1565,11 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq 
> *gsi,
>  parallel_hds_isa_init(isa_bus, MAX_PARALLEL_PORTS);
>  
>  a20_line = qemu_allocate_irqs(handle_a20_line_change, first_cpu, 2);
> -i8042 = isa_create_simple(isa_bus, "i8042");
> +i8042 = isa_create_simple(isa_bus, TYPE_I8042);
>  i8042_setup_a20_line(i8042, a20_line[0]);
>  if (!no_vmport) {
>  vmport_init(isa_bus);
> -vmmouse = isa_try_create(isa_bus, "vmmouse");
> +vmmouse = isa_try_create(isa_bus, TYPE_VMMOUSE);
>  } else {
>  vmmouse = NULL;
>  }
> diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c
> index c479f827b6..f17f18e51b 100644
> --- a/hw/input/pckbd.c
> +++ b/hw/input/pckbd.c
> @@ -26,6 +26,7 @@
>  #include "hw/isa/isa.h"
>  #include "hw/i386/pc.h"
>  #include "hw/input/ps2.h"
> +#include "hw/input/i8042.h"
>  #include "sysemu/sysemu.h"
>  
>  /* debug PC keyboard */
> @@ -480,7 +481,6 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,
>  qemu_register_reset(kbd_reset, s);
>  }
>  
> -#define TYPE_I8042 "i8042"
>  #define I8042(obj) OBJECT_CHECK(ISAKBDState, (obj), TYPE_I8042)

Re: [Qemu-devel] [PATCH 27/34] hw/pci: declare pci_nic_init_nofail() in "hw/net/pci.h"

2017-09-22 Thread David Gibson
On Fri, Sep 22, 2017 at 01:01:04PM -0300, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé 

ppc portions

Acked-by: David Gibson 
> ---
>  hw/pci/pci_internal.h | 16 +++
>  include/hw/net/pci.h  | 20 +
>  include/hw/pci/pci.h  |  4 ---
>  hw/arm/virt.c |  1 +
>  hw/mips/mips_malta.c  |  1 +
>  hw/pci/pci.c  | 67 ++--
>  hw/pci/pci_nic.c  | 77 
> +++
>  hw/ppc/e500.c |  1 +
>  hw/ppc/spapr.c|  1 +
>  hw/pci/Makefile.objs  |  1 +
>  10 files changed, 120 insertions(+), 69 deletions(-)
>  create mode 100644 hw/pci/pci_internal.h
>  create mode 100644 include/hw/net/pci.h
>  create mode 100644 hw/pci/pci_nic.c
> 
> diff --git a/hw/pci/pci_internal.h b/hw/pci/pci_internal.h
> new file mode 100644
> index 00..d967468767
> --- /dev/null
> +++ b/hw/pci/pci_internal.h
> @@ -0,0 +1,16 @@
> +/*
> + * QEMU PCI internal
> + *
> + * Copyright (c) 2005 Fabrice Bellard
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + */
> +#ifndef QEMU_HW_PCI_INTERNAL_H
> +#define QEMU_HW_PCI_INTERNAL_H
> +
> +#include "hw/pci/pci_bus.h"
> +
> +PCIBus *pci_get_bus_devfn(int *devfnp, PCIBus *root, const char *devaddr);
> +
> +#endif
> diff --git a/include/hw/net/pci.h b/include/hw/net/pci.h
> new file mode 100644
> index 00..529591b7f3
> --- /dev/null
> +++ b/include/hw/net/pci.h
> @@ -0,0 +1,20 @@
> +/*
> + * QEMU network devices
> + *
> + * Copyright (c) 2005 Fabrice Bellard
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + */
> +#ifndef QEMU_HW_NET_PCI_H
> +#define QEMU_HW_NET_PCI_H
> +
> +#include "net/net.h"
> +#include "hw/pci/pci.h"
> +#include "hw/pci/pci_bus.h"
> +
> +PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *rootbus,
> +   const char *default_model,
> +   const char *default_devaddr);
> +
> +#endif
> diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
> index aa7ef9cf69..6a0f7b5472 100644
> --- a/include/hw/pci/pci.h
> +++ b/include/hw/pci/pci.h
> @@ -422,10 +422,6 @@ void pci_device_set_intx_routing_notifier(PCIDevice *dev,
>PCIINTxRoutingNotifier notifier);
>  void pci_device_reset(PCIDevice *dev);
>  
> -PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *rootbus,
> -   const char *default_model,
> -   const char *default_devaddr);
> -
>  PCIDevice *pci_vga_init(PCIBus *bus);
>  
>  int pci_bus_num(PCIBus *s);
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index 9e18b410d7..39fab3acb9 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -35,6 +35,7 @@
>  #include "hw/arm/primecell.h"
>  #include "hw/arm/virt.h"
>  #include "hw/devices.h"
> +#include "hw/net/pci.h"
>  #include "net/net.h"
>  #include "sysemu/block-backend.h"
>  #include "sysemu/device_tree.h"
> diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
> index 6945fa47c3..fb6a2f9363 100644
> --- a/hw/mips/mips_malta.c
> +++ b/hw/mips/mips_malta.c
> @@ -48,6 +48,7 @@
>  #include "hw/timer/mc146818rtc.h"
>  #include "hw/input/i8042.h"
>  #include "hw/timer/i8254.h"
> +#include "hw/net/pci.h"
>  #include "sysemu/blockdev.h"
>  #include "exec/address-spaces.h"
>  #include "hw/sysbus.h" /* SysBusDevice */
> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
> index 1e6fb88eba..9b678c8fd0 100644
> --- a/hw/pci/pci.c
> +++ b/hw/pci/pci.c
> @@ -28,7 +28,6 @@
>  #include "hw/pci/pci_bus.h"
>  #include "hw/pci/pci_host.h"
>  #include "monitor/monitor.h"
> -#include "net/net.h"
>  #include "sysemu/sysemu.h"
>  #include "hw/loader.h"
>  #include "qemu/error-report.h"
> @@ -41,6 +40,7 @@
>  #include "hw/hotplug.h"
>  #include "hw/boards.h"
>  #include "qemu/cutils.h"
> +#include "pci_internal.h"
>  
>  //#define DEBUG_PCI
>  #ifdef DEBUG_PCI
> @@ -671,8 +671,7 @@ static int pci_parse_devaddr(const char *addr, int *domp, 
> int *busp,
>  return 0;
>  }
>  
> -static PCIBus *pci_get_bus_devfn(int *devfnp, PCIBus *root,
> - const char *devaddr)
> +PCIBus *pci_get_bus_devfn(int *devfnp, PCIBus *root, const char *devaddr)
>  {
>  int dom, bus;
>  unsigned slot;
> @@ -1812,68 +1811,6 @@ PciInfoList *qmp_query_pci(Error **errp)
>  return head;
>  }
>  
> -static const char * const pci_nic_models[] = {
> -"ne2k_pci",
> -"i82551",
> -"i82557b",
> -"i82559er",
> -"rtl8139",
> -"e1000",
> -"pcnet",
> -"virtio",
> -"sungem",
> -NULL
> -};
> -
> -static const char * const pci_nic_names[] = {
> -"ne2k_pci",
> -"i82551",
> -"i82557b",
> -"i82559er",
> -"rtl8139",
> -"e1000",
> -"pcnet",
> -   

Re: [Qemu-devel] [PATCH 06/34] ppc: remove duplicated includes

2017-09-22 Thread David Gibson
On Fri, Sep 22, 2017 at 12:39:46PM -0300, Philippe Mathieu-Daudé wrote:
> applied using ./scripts/clean-includes
> 
> not needed since 7ebaf795560
> 
> Signed-off-by: Philippe Mathieu-Daudé 

Acked-by: David Gibson 

> ---
>  hw/ppc/spapr_hcall.c | 1 -
>  target/ppc/kvm.c | 3 ---
>  2 files changed, 4 deletions(-)
> 
> diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
> index 57bb411394..2aeee28fe6 100644
> --- a/hw/ppc/spapr_hcall.c
> +++ b/hw/ppc/spapr_hcall.c
> @@ -13,7 +13,6 @@
>  #include "trace.h"
>  #include "kvm_ppc.h"
>  #include "hw/ppc/spapr_ovec.h"
> -#include "qemu/error-report.h"
>  #include "mmu-book3s-v3.h"
>  
>  struct SPRSyncState {
> diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
> index 1deaf106d2..c9105af393 100644
> --- a/target/ppc/kvm.c
> +++ b/target/ppc/kvm.c
> @@ -47,9 +47,6 @@
>  #include "sysemu/hostmem.h"
>  #include "qemu/cutils.h"
>  #include "qemu/mmap-alloc.h"
> -#if defined(TARGET_PPC64)
> -#include "hw/ppc/spapr_cpu_core.h"
> -#endif
>  #include "elf.h"
>  #include "sysemu/kvm_int.h"
>  

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson


signature.asc
Description: PGP signature


Re: [Qemu-devel] [PATCH 1/2] ppc: remove unused CPU definitions

2017-09-22 Thread David Gibson
On Wed, Sep 20, 2017 at 08:47:43PM +0200, Thomas Huth wrote:
> On 19.09.2017 23:36, John Snow wrote:
> > Following commit aef77960, remove now-unused definitions from
> > cpu-models.h.
> > 
> > Signed-off-by: John Snow 
> > ---
> >  target/ppc/cpu-models.h | 32 
> >  1 file changed, 32 deletions(-)
> > 
> > diff --git a/target/ppc/cpu-models.h b/target/ppc/cpu-models.h
> > index df31d7f..b34b512 100644
> > --- a/target/ppc/cpu-models.h
> > +++ b/target/ppc/cpu-models.h
> > @@ -291,34 +291,6 @@ enum {
> >  #endif
> >  CPU_POWERPC_e200z5 = 0x8100,
> >  CPU_POWERPC_e200z6 = 0x8112,
> > -/* MPC55xx microcontrollers */
> > -#define CPU_POWERPC_MPC55xx  CPU_POWERPC_MPC5567
> > -#if 0
> > -#define CPU_POWERPC_MPC5514E CPU_POWERPC_MPC5514E_v1
> > -#define CPU_POWERPC_MPC5514E_v0  CPU_POWERPC_e200z0
> > -#define CPU_POWERPC_MPC5514E_v1  CPU_POWERPC_e200z1
> > -#define CPU_POWERPC_MPC5514G CPU_POWERPC_MPC5514G_v1
> > -#define CPU_POWERPC_MPC5514G_v0  CPU_POWERPC_e200z0
> > -#define CPU_POWERPC_MPC5514G_v1  CPU_POWERPC_e200z1
> > -#define CPU_POWERPC_MPC5515S CPU_POWERPC_e200z1
> > -#define CPU_POWERPC_MPC5516E CPU_POWERPC_MPC5516E_v1
> > -#define CPU_POWERPC_MPC5516E_v0  CPU_POWERPC_e200z0
> > -#define CPU_POWERPC_MPC5516E_v1  CPU_POWERPC_e200z1
> > -#define CPU_POWERPC_MPC5516G CPU_POWERPC_MPC5516G_v1
> > -#define CPU_POWERPC_MPC5516G_v0  CPU_POWERPC_e200z0
> > -#define CPU_POWERPC_MPC5516G_v1  CPU_POWERPC_e200z1
> > -#define CPU_POWERPC_MPC5516S CPU_POWERPC_e200z1
> > -#endif
> > -#if 0
> > -#define CPU_POWERPC_MPC5533  CPU_POWERPC_e200z3
> > -#define CPU_POWERPC_MPC5534  CPU_POWERPC_e200z3
> > -#endif
> > -#define CPU_POWERPC_MPC5553  CPU_POWERPC_e200z6
> > -#define CPU_POWERPC_MPC5554  CPU_POWERPC_e200z6
> > -#define CPU_POWERPC_MPC5561  CPU_POWERPC_e200z6
> > -#define CPU_POWERPC_MPC5565  CPU_POWERPC_e200z6
> > -#define CPU_POWERPC_MPC5566  CPU_POWERPC_e200z6
> > -#define CPU_POWERPC_MPC5567  CPU_POWERPC_e200z6
> >  /* e300 family */
> >  /* e300 cores */
> >  CPU_POWERPC_e300c1 = 0x00830010,
> > @@ -326,11 +298,7 @@ enum {
> >  CPU_POWERPC_e300c3 = 0x00850010,
> >  CPU_POWERPC_e300c4 = 0x00860010,
> >  /* MPC83xx microcontrollers */
> 
> I think you should also remove the above comment now?
> 
> > -#define CPU_POWERPC_MPC831x  CPU_POWERPC_e300c3
> > -#define CPU_POWERPC_MPC832x  CPU_POWERPC_e300c2
> >  #define CPU_POWERPC_MPC834x  CPU_POWERPC_e300c1
> > -#define CPU_POWERPC_MPC835x  CPU_POWERPC_e300c1
> > -#define CPU_POWERPC_MPC836x  CPU_POWERPC_e300c1
> >  #define CPU_POWERPC_MPC837x  CPU_POWERPC_e300c4
> >  /* e500 family */
> >  /* e500 cores  */
> 
> With the above comment removed:
> 
> Reviewed-by: Thomas Huth 

No, there's still one entry left in that subsection, so the comment
should stay.  Applied.

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson


signature.asc
Description: PGP signature


Re: [Qemu-devel] [PATCH 28/34] hw/net/e1000: use TYPE_PCI_E1000

2017-09-22 Thread David Gibson
On Fri, Sep 22, 2017 at 01:01:05PM -0300, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé 

ppc portion

Acked-by: David Gibson 

> ---
>  include/hw/net/pci.h   | 2 ++
>  hw/alpha/dp264.c   | 3 ++-
>  hw/i386/pc.c   | 3 ++-
>  hw/ppc/ppc440_bamboo.c | 3 ++-
>  4 files changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/include/hw/net/pci.h b/include/hw/net/pci.h
> index 529591b7f3..b24b5257a5 100644
> --- a/include/hw/net/pci.h
> +++ b/include/hw/net/pci.h
> @@ -13,6 +13,8 @@
>  #include "hw/pci/pci.h"
>  #include "hw/pci/pci_bus.h"
>  
> +#define TYPE_PCI_E1000  "e1000"
> +
>  PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *rootbus,
> const char *default_model,
> const char *default_devaddr);
> diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c
> index df6dadf13f..65947fe1bf 100644
> --- a/hw/alpha/dp264.c
> +++ b/hw/alpha/dp264.c
> @@ -21,6 +21,7 @@
>  #include "hw/timer/i8254.h"
>  #include "hw/input/i8042.h"
>  #include "hw/char/serial.h"
> +#include "hw/net/pci.h"
>  #include "qemu/cutils.h"
>  
>  #define MAX_IDE_BUS 2
> @@ -93,7 +94,7 @@ static void clipper_init(MachineState *machine)
>  
>  /* Network setup.  e1000 is good enough, failing Tulip support.  */
>  for (i = 0; i < nb_nics; i++) {
> -pci_nic_init_nofail(_table[i], pci_bus, "e1000", NULL);
> +pci_nic_init_nofail(_table[i], pci_bus, TYPE_PCI_E1000, NULL);
>  }
>  
>  /* IDE disk setup.  */
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index 085577e066..3cdeb148aa 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -72,6 +72,7 @@
>  #include "hw/nmi.h"
>  #include "hw/i386/intel_iommu.h"
>  #include "hw/net/ne2000-isa.h"
> +#include "hw/net/pci.h"
>  
>  /* debug PC/ISA interrupts */
>  //#define DEBUG_IRQ
> @@ -1606,7 +1607,7 @@ void pc_nic_init(ISABus *isa_bus, PCIBus *pci_bus)
>  if (!pci_bus || (nd->model && strcmp(nd->model, "ne2k_isa") == 0)) {
>  pc_init_ne2k_isa(isa_bus, nd);
>  } else {
> -pci_nic_init_nofail(nd, pci_bus, "e1000", NULL);
> +pci_nic_init_nofail(nd, pci_bus, TYPE_PCI_E1000, NULL);
>  }
>  }
>  rom_reset_order_override();
> diff --git a/hw/ppc/ppc440_bamboo.c b/hw/ppc/ppc440_bamboo.c
> index f92d47f28d..6387dbda9f 100644
> --- a/hw/ppc/ppc440_bamboo.c
> +++ b/hw/ppc/ppc440_bamboo.c
> @@ -24,6 +24,7 @@
>  #include "elf.h"
>  #include "exec/address-spaces.h"
>  #include "hw/char/serial.h"
> +#include "hw/net/pci.h"
>  #include "hw/ppc/ppc.h"
>  #include "ppc405.h"
>  #include "sysemu/sysemu.h"
> @@ -248,7 +249,7 @@ static void bamboo_init(MachineState *machine)
>  for (i = 0; i < nb_nics; i++) {
>  /* There are no PCI NICs on the Bamboo board, but there are
>   * PCI slots, so we can pick whatever default model we want. */
> -pci_nic_init_nofail(_table[i], pcibus, "e1000", NULL);
> +pci_nic_init_nofail(_table[i], pcibus, TYPE_PCI_E1000, NULL);
>  }
>  }
>  

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson


signature.asc
Description: PGP signature


Re: [Qemu-devel] [PATCH 32/34] hw/net/ne2000: use TYPE_PCI_NE2000

2017-09-22 Thread David Gibson
On Fri, Sep 22, 2017 at 01:01:09PM -0300, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé 

ppc portions

Acked-by: David Gibson 

> ---
>  include/hw/net/pci.h  | 1 +
>  hw/net/ne2000.c   | 3 ++-
>  hw/ppc/mac_newworld.c | 3 ++-
>  hw/ppc/mac_oldworld.c | 3 ++-
>  hw/ppc/prep.c | 2 +-
>  hw/sparc64/sun4u.c| 3 ++-
>  6 files changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/include/hw/net/pci.h b/include/hw/net/pci.h
> index 43ed3b0145..da733dd1d9 100644
> --- a/include/hw/net/pci.h
> +++ b/include/hw/net/pci.h
> @@ -15,6 +15,7 @@
>  
>  #define TYPE_PCI_E1000  "e1000"
>  #define TYPE_PCI_E1000E "e1000e"
> +#define TYPE_PCI_NE2000 "ne2k_pci"
>  #define TYPE_PCI_PCNET  "pcnet"
>  #define TYPE_PCI_RTL8139"rtl8139"
>  
> diff --git a/hw/net/ne2000.c b/hw/net/ne2000.c
> index 29bd4adb3f..b0a664d302 100644
> --- a/hw/net/ne2000.c
> +++ b/hw/net/ne2000.c
> @@ -23,6 +23,7 @@
>   */
>  #include "qemu/osdep.h"
>  #include "hw/pci/pci.h"
> +#include "hw/net/pci.h"
>  #include "ne2000.h"
>  #include "hw/loader.h"
>  #include "sysemu/sysemu.h"
> @@ -779,7 +780,7 @@ static void ne2000_class_init(ObjectClass *klass, void 
> *data)
>  }
>  
>  static const TypeInfo ne2000_info = {
> -.name  = "ne2k_pci",
> +.name  = TYPE_PCI_NE2000,
>  .parent= TYPE_PCI_DEVICE,
>  .instance_size = sizeof(PCINE2000State),
>  .class_init= ne2000_class_init,
> diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
> index 33b46cb50b..2afc35c27f 100644
> --- a/hw/ppc/mac_newworld.c
> +++ b/hw/ppc/mac_newworld.c
> @@ -55,6 +55,7 @@
>  #include "hw/ppc/mac_dbdma.h"
>  #include "hw/timer/m48t59.h"
>  #include "hw/pci/pci.h"
> +#include "hw/net/pci.h"
>  #include "net/net.h"
>  #include "sysemu/sysemu.h"
>  #include "hw/boards.h"
> @@ -435,7 +436,7 @@ static void ppc_core99_init(MachineState *machine)
>  }
>  
>  for (i = 0; i < nb_nics; i++) {
> -pci_nic_init_nofail(_table[i], pci_bus, "ne2k_pci", NULL);
> +pci_nic_init_nofail(_table[i], pci_bus, TYPE_PCI_NE2000, NULL);
>  }
>  
>  /* The NewWorld NVRAM is not located in the MacIO device */
> diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
> index 193b9047d9..8096e5a126 100644
> --- a/hw/ppc/mac_oldworld.c
> +++ b/hw/ppc/mac_oldworld.c
> @@ -34,6 +34,7 @@
>  #include "net/net.h"
>  #include "hw/isa/isa.h"
>  #include "hw/pci/pci.h"
> +#include "hw/net/pci.h"
>  #include "hw/boards.h"
>  #include "hw/nvram/fw_cfg.h"
>  #include "hw/char/escc.h"
> @@ -278,7 +279,7 @@ static void ppc_heathrow_init(MachineState *machine)
>   escc_mem, 0, memory_region_size(escc_mem));
>  
>  for(i = 0; i < nb_nics; i++)
> -pci_nic_init_nofail(_table[i], pci_bus, "ne2k_pci", NULL);
> +pci_nic_init_nofail(_table[i], pci_bus, TYPE_PCI_NE2000, NULL);
>  
>  
>  ide_drive_get(hd, ARRAY_SIZE(hd));
> diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
> index b2c7a62ebc..103beafef3 100644
> --- a/hw/ppc/prep.c
> +++ b/hw/ppc/prep.c
> @@ -636,7 +636,7 @@ static void ppc_prep_init(MachineState *machine)
>  isa_ne2000_init(isa_bus, ne2000_io[i], ne2000_irq[i],
>  _table[i]);
>  } else {
> -pci_nic_init_nofail(_table[i], pci_bus, "ne2k_pci", NULL);
> +pci_nic_init_nofail(_table[i], pci_bus, TYPE_PCI_NE2000, 
> NULL);
>  }
>  }
>  
> diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
> index fd10741607..67879c5135 100644
> --- a/hw/sparc64/sun4u.c
> +++ b/hw/sparc64/sun4u.c
> @@ -32,6 +32,7 @@
>  #include "hw/char/serial.h"
>  #include "hw/timer/m48t59.h"
>  #include "hw/input/i8042.h"
> +#include "hw/net/pci.h"
>  #include "hw/block/fdc.h"
>  #include "net/net.h"
>  #include "qemu/timer.h"
> @@ -476,7 +477,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
>  
>  onboard_nic_idx = i;
>  } else {
> -pci_nic_init_nofail(nd, pci_bus, "ne2k_pci", NULL);
> +pci_nic_init_nofail(nd, pci_bus, TYPE_PCI_NE2000, NULL);
>  }
>  }
>  onboard_nic_idx = MAX(onboard_nic_idx, 0);

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson


signature.asc
Description: PGP signature


Re: [Qemu-devel] [PATCH 01/34] hw: use "qemu/osdep.h" as first #include in source files

2017-09-22 Thread David Gibson
On Fri, Sep 22, 2017 at 12:39:41PM -0300, Philippe Mathieu-Daudé wrote:
> applied using ./scripts/clean-includes
> 
> Signed-off-by: Philippe Mathieu-Daudé 

ppc portion

Acked-by: David Gibson 

> ---
>  hw/acpi/ipmi-stub.c | 1 +
>  hw/audio/fmopl.c| 1 -
>  hw/cpu/core.c   | 1 +
>  hw/ppc/spapr_cpu_core.c | 1 +
>  hw/smbios/smbios_type_38-stub.c | 1 +
>  hw/vfio/ccw.c   | 2 +-
>  hw/virtio/vhost-vsock.c | 2 +-
>  7 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/acpi/ipmi-stub.c b/hw/acpi/ipmi-stub.c
> index 98b6dcee0d..f525f71c2d 100644
> --- a/hw/acpi/ipmi-stub.c
> +++ b/hw/acpi/ipmi-stub.c
> @@ -7,6 +7,7 @@
>   * See the COPYING file in the top-level directory.
>   */
>  
> +#include "qemu/osdep.h"
>  #include "hw/acpi/ipmi.h"
>  
>  void build_acpi_ipmi_devices(Aml *table, BusState *bus)
> diff --git a/hw/audio/fmopl.c b/hw/audio/fmopl.c
> index 5cfb6a96dd..9f50a89b4a 100644
> --- a/hw/audio/fmopl.c
> +++ b/hw/audio/fmopl.c
> @@ -34,7 +34,6 @@
>  #include 
>  //#include "driver.h"/* use M.A.M.E. */
>  #include "fmopl.h"
> -#include "qemu/osdep.h"
>  #ifndef PI
>  #define PI 3.14159265358979323846
>  #endif
> diff --git a/hw/cpu/core.c b/hw/cpu/core.c
> index bd578ab80c..7e42e2c87a 100644
> --- a/hw/cpu/core.c
> +++ b/hw/cpu/core.c
> @@ -6,6 +6,7 @@
>   * This work is licensed under the terms of the GNU GPL, version 2 or later.
>   * See the COPYING file in the top-level directory.
>   */
> +#include "qemu/osdep.h"
>  #include "hw/cpu/core.h"
>  #include "qapi/visitor.h"
>  #include "qapi/error.h"
> diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
> index c08ee7571a..4a4f0c60fe 100644
> --- a/hw/ppc/spapr_cpu_core.c
> +++ b/hw/ppc/spapr_cpu_core.c
> @@ -6,6 +6,7 @@
>   * This work is licensed under the terms of the GNU GPL, version 2 or later.
>   * See the COPYING file in the top-level directory.
>   */
> +#include "qemu/osdep.h"
>  #include "hw/cpu/core.h"
>  #include "hw/ppc/spapr_cpu_core.h"
>  #include "target/ppc/cpu.h"
> diff --git a/hw/smbios/smbios_type_38-stub.c b/hw/smbios/smbios_type_38-stub.c
> index 9528c2c28e..5b83c9b1f1 100644
> --- a/hw/smbios/smbios_type_38-stub.c
> +++ b/hw/smbios/smbios_type_38-stub.c
> @@ -7,6 +7,7 @@
>   * See the COPYING file in the top-level directory.
>   */
>  
> +#include "qemu/osdep.h"
>  #include "hw/smbios/ipmi.h"
>  
>  void smbios_build_type_38_table(void)
> diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c
> index a8baadf57a..4810fa0b50 100644
> --- a/hw/vfio/ccw.c
> +++ b/hw/vfio/ccw.c
> @@ -11,11 +11,11 @@
>   * directory.
>   */
>  
> +#include "qemu/osdep.h"
>  #include 
>  #include 
>  #include 
>  
> -#include "qemu/osdep.h"
>  #include "qapi/error.h"
>  #include "hw/sysbus.h"
>  #include "hw/vfio/vfio.h"
> diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c
> index 49e0022533..c11c1eb83e 100644
> --- a/hw/virtio/vhost-vsock.c
> +++ b/hw/virtio/vhost-vsock.c
> @@ -11,8 +11,8 @@
>   * top-level directory.
>   */
>  
> -#include 
>  #include "qemu/osdep.h"
> +#include 
>  #include "standard-headers/linux/virtio_vsock.h"
>  #include "qapi/error.h"
>  #include "hw/virtio/virtio-bus.h"

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson


signature.asc
Description: PGP signature


Re: [Qemu-devel] [PATCH 24/34] hw/timer/mc146818: rename rtc_init() -> mc146818_init()

2017-09-22 Thread David Gibson
On Fri, Sep 22, 2017 at 01:01:01PM -0300, Philippe Mathieu-Daudé wrote:
> and remove the old i386/pc dependency
> 
> Signed-off-by: Philippe Mathieu-Daudé 

Reviewed-by: David Gibson 

> ---
>  include/hw/timer/mc146818rtc.h | 3 ++-
>  hw/alpha/dp264.c   | 2 +-
>  hw/i386/pc.c   | 2 +-
>  hw/isa/i82378.c| 3 ++-
>  hw/mips/mips_fulong2e.c| 2 +-
>  hw/mips/mips_jazz.c| 2 +-
>  hw/mips/mips_malta.c   | 2 +-
>  hw/mips/mips_r4k.c | 2 +-
>  hw/ppc/pnv.c   | 2 +-
>  hw/timer/mc146818rtc.c | 2 +-
>  10 files changed, 12 insertions(+), 10 deletions(-)
> 
> diff --git a/include/hw/timer/mc146818rtc.h b/include/hw/timer/mc146818rtc.h
> index 7c8e64b203..fe6ed63f71 100644
> --- a/include/hw/timer/mc146818rtc.h
> +++ b/include/hw/timer/mc146818rtc.h
> @@ -6,7 +6,8 @@
>  
>  #define TYPE_MC146818_RTC "mc146818rtc"
>  
> -ISADevice *rtc_init(ISABus *bus, int base_year, qemu_irq intercept_irq);
> +ISADevice *mc146818_rtc_init(ISABus *bus, int base_year,
> + qemu_irq intercept_irq);
>  void rtc_set_memory(ISADevice *dev, int addr, int val);
>  int rtc_get_memory(ISADevice *dev, int addr);
>  
> diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c
> index 2253990654..df6dadf13f 100644
> --- a/hw/alpha/dp264.c
> +++ b/hw/alpha/dp264.c
> @@ -80,7 +80,7 @@ static void clipper_init(MachineState *machine)
> clipper_pci_map_irq);
>  
>  /* Since we have an SRM-compatible PALcode, use the SRM epoch.  */
> -rtc_init(isa_bus, 1900, rtc_irq);
> +mc146818_rtc_init(isa_bus, 1900, rtc_irq);
>  
>  i8254_pit_init(isa_bus, 0x40, 0, NULL);
>  isa_create_simple(isa_bus, TYPE_I8042);
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index 76d4be5991..788844e0de 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -1545,7 +1545,7 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq 
> *gsi,
>  rtc_irq = qdev_get_gpio_in(hpet, HPET_LEGACY_RTC_INT);
>  }
>  }
> -*rtc_state = rtc_init(isa_bus, 2000, rtc_irq);
> +*rtc_state = mc146818_rtc_init(isa_bus, 2000, rtc_irq);
>  
>  qemu_register_boot_set(pc_boot_set, *rtc_state);
>  
> diff --git a/hw/isa/i82378.c b/hw/isa/i82378.c
> index 7a8baef23c..14b006cadc 100644
> --- a/hw/isa/i82378.c
> +++ b/hw/isa/i82378.c
> @@ -21,6 +21,7 @@
>  #include "hw/pci/pci.h"
>  #include "hw/i386/pc.h"
>  #include "hw/timer/i8254.h"
> +#include "hw/timer/mc146818rtc.h"
>  #include "hw/audio/pcspk.h"
>  
>  #define TYPE_I82378 "i82378"
> @@ -106,7 +107,7 @@ static void i82378_realize(PCIDevice *pci, Error **errp)
>  isa = isa_create_simple(isabus, "i82374");
>  
>  /* timer */
> -isa_create_simple(isabus, "mc146818rtc");
> +isa_create_simple(isabus, TYPE_MC146818_RTC);
>  }
>  
>  static void i82378_init(Object *obj)
> diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c
> index 6dc6a0ac18..7ebbffa8f2 100644
> --- a/hw/mips/mips_fulong2e.c
> +++ b/hw/mips/mips_fulong2e.c
> @@ -371,7 +371,7 @@ static void mips_fulong2e_init(MachineState *machine)
>  /* Super I/O */
>  isa_create_simple(isa_bus, TYPE_I8042);
>  
> -rtc_init(isa_bus, 2000, NULL);
> +mc146818_rtc_init(isa_bus, 2000, NULL);
>  
>  serial_hds_isa_init(isa_bus, 0, MAX_SERIAL_PORTS);
>  parallel_hds_isa_init(isa_bus, 1);
> diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c
> index 1b54602c1d..439bbd71fe 100644
> --- a/hw/mips/mips_jazz.c
> +++ b/hw/mips/mips_jazz.c
> @@ -295,7 +295,7 @@ static void mips_jazz_init(MachineState *machine,
>  fdctrl_init_sysbus(qdev_get_gpio_in(rc4030, 1), -1, 0x80003000, fds);
>  
>  /* Real time clock */
> -rtc_init(isa_bus, 1980, NULL);
> +mc146818_rtc_init(isa_bus, 1980, NULL);
>  memory_region_init_io(rtc, NULL, _ops, NULL, "rtc", 0x1000);
>  memory_region_add_subregion(address_space, 0x80004000, rtc);
>  
> diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
> index 050da36f1d..6945fa47c3 100644
> --- a/hw/mips/mips_malta.c
> +++ b/hw/mips/mips_malta.c
> @@ -1225,7 +1225,7 @@ void mips_malta_init(MachineState *machine)
>  /* Super I/O */
>  isa_create_simple(isa_bus, TYPE_I8042);
>  
> -rtc_init(isa_bus, 2000, NULL);
> +mc146818_rtc_init(isa_bus, 2000, NULL);
>  serial_hds_isa_init(isa_bus, 0, 2);
>  parallel_hds_isa_init(isa_bus, 1);
>  
> diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c
> index 946097a31f..349da59912 100644
> --- a/hw/mips/mips_r4k.c
> +++ b/hw/mips/mips_r4k.c
> @@ -279,7 +279,7 @@ void mips_r4k_init(MachineState *machine)
>  i8259 = i8259_init(isa_bus, env->irq[2]);
>  isa_bus_irqs(isa_bus, i8259);
>  
> -rtc_init(isa_bus, 2000, NULL);
> +mc146818_rtc_init(isa_bus, 2000, NULL);
>  
>  pit = i8254_pit_init(isa_bus, 0x40, 0, NULL);
>  
> diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
> index 47221158d4..d188b899c5 100644
> --- 

Re: [Qemu-devel] [PATCH 25/34] hw/timer/m48t59: use TYPE_M48T59_ISA, add entries to MAINTAINERS

2017-09-22 Thread David Gibson
On Fri, Sep 22, 2017 at 01:01:02PM -0300, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé 

ppc portion

Acked-by: David Gibson 

> ---
>  include/hw/timer/m48t59.h | 2 ++
>  hw/ppc/prep.c | 2 +-
>  hw/timer/m48t59-isa.c | 2 +-
>  MAINTAINERS   | 2 ++
>  4 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/include/hw/timer/m48t59.h b/include/hw/timer/m48t59.h
> index db5e43a8da..069bb045d7 100644
> --- a/include/hw/timer/m48t59.h
> +++ b/include/hw/timer/m48t59.h
> @@ -25,6 +25,8 @@ typedef struct NvramClass {
>  void (*toggle_lock)(Nvram *obj, int lock);
>  } NvramClass;
>  
> +#define TYPE_M48T59_ISA "isa-m48t59"
> +
>  Nvram *m48t59_init_isa(ISABus *bus, uint32_t io_base, uint16_t size,
> int base_year, int type);
>  Nvram *m48t59_init(qemu_irq IRQ, hwaddr mem_base,
> diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
> index 16f4537093..1f8ef4819b 100644
> --- a/hw/ppc/prep.c
> +++ b/hw/ppc/prep.c
> @@ -777,7 +777,7 @@ static void ibm_40p_init(MachineState *machine)
>  /* add some more devices */
>  if (defaults_enabled()) {
>  isa_create_simple(isa_bus, TYPE_I8042);
> -m48t59 = NVRAM(isa_create_simple(isa_bus, "isa-m48t59"));
> +m48t59 = NVRAM(isa_create_simple(isa_bus, TYPE_M48T59_ISA));
>  
>  dev = DEVICE(isa_create(isa_bus, "cs4231a"));
>  qdev_prop_set_uint32(dev, "iobase", 0x830);
> diff --git a/hw/timer/m48t59-isa.c b/hw/timer/m48t59-isa.c
> index ea1ba703d7..077346f7ca 100644
> --- a/hw/timer/m48t59-isa.c
> +++ b/hw/timer/m48t59-isa.c
> @@ -49,7 +49,7 @@ typedef struct M48txxISADeviceClass {
>  
>  static M48txxInfo m48txx_isa_info[] = {
>  {
> -.bus_name = "isa-m48t59",
> +.bus_name = TYPE_M48T59_ISA,
>  .model = 59,
>  .size = 0x2000,
>  }
> diff --git a/MAINTAINERS b/MAINTAINERS
> index a79723601c..3cb6bc190c 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -708,6 +708,8 @@ F: hw/pci-host/prep.[hc]
>  F: hw/isa/i82378.c
>  F: hw/isa/pc87312.[hc]
>  F: hw/dma/i82374.c
> +F: hw/timer/m48t59-isa.c
> +F: include/hw/timer/m48t59.h
>  F: pc-bios/ppc_rom.bin
>  
>  sPAPR

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson


signature.asc
Description: PGP signature


Re: [Qemu-devel] [PATCH] qga-win: don't hang if vss hold writes timeout

2017-09-22 Thread Tomoki Sekiyama
2017-09-23 12:11 GMT+09:00 Chen Hanxiao :

>
> 在 2017-09-23 05:12:20,"Tomoki Sekiyama"  写道:
>
> >
> > Thanks for your patch.
> > Which version of Windows have you found the hang?
> >
> >
>   I tested on win08, win 08 r2 and win2012.
>

Thank you for the info.

The patch looks good to me.

Regards,
Tomoki


> QGA versions:
>
>   Use the latest qga-win from
>   https://fedorapeople.org/groups/virt/virtio-win/direct-
> downloads/archive-qemu-ga/qemu-ga-win-7.4.5-1/
>
>   and stable branch from
>   https://fedorapeople.org/groups/virt/virtio-win/direct-
> downloads/archive-virtio/virtio-win-0.1.126-2/virtio-win-0.1.126.iso
>
>   All of them have the same behavior.
>
> How to reproduce:
>
>   Copy a big file in guest (from d: to c:), then do fsfreeze when IO is in
> progress.
>
>   At this time, we had a very chance to see that qga hang for a long time.
>
>   Libvirt will not recieve a reply.
>   qemu-ga service even don't answer `net stop` command.
>
>
> Regards,
> - Chen
>
>
>
> > Regards,
> > Tomoki
> >
> >
> > 2017-09-22 11:46 GMT+09:00 Chen Hanxiao :
> >
> > From: Chen Hanxiao 
> >
> >
> >
> > When VM is in a heavy IO, if the command "guest-fsfreeze-freeze"
> >
> > is executed, VSS may timeout when trying to hold writes.
> >
> >
> >
> > Inside guest, Event ID 12298(VSS_ERROR_HOLD_WRITES_TIMEOUT)
> >
> > is logged in the Event Viewer.
> >
> >
> >
> > At that time, if we call AbortBackup, qga may hang forever.
> >
> >
> >
> > This patch will solve this issues.
> >
> >
> >
> > Signed-off-by: Chen Hanxiao 
> >
> > ---
> >
> >  qga/vss-win32/requester.cpp | 12 
> >
> >  1 file changed, 12 insertions(+)
> >
> >
> >
> > diff --git a/qga/vss-win32/requester.cpp b/qga/vss-win32/requester.cpp
> >
> > index 301762d..3d9c971 100644
> >
> > --- a/qga/vss-win32/requester.cpp
> >
> > +++ b/qga/vss-win32/requester.cpp
> >
> > @@ -419,6 +419,16 @@ void requester_freeze(int *num_vols, ErrorSet
> *errset)
> >
> >  break;
> >
> >  }
> >
> >  }
> >
> > +
> >
> > +if (wait_status == WAIT_TIMEOUT) {
> >
> > +err_set(errset, E_FAIL,
> >
> > +"timeout when try to receive Frozen event from VSS
> provider");
> >
> > +/* If we are here, VSS had timeout.
> >
> > + * Don't call AbortBackup, just return directly.
> >
> > + */
> >
> > +goto out1;
> >
> > +}
> >
> > +
> >
> >  if (wait_status != WAIT_OBJECT_0) {
> >
> >  err_set(errset, E_FAIL,
> >
> >  "couldn't receive Frozen event from VSS provider");
> >
> > @@ -432,6 +442,8 @@ out:
> >
> >  if (vss_ctx.pVssbc) {
> >
> >  vss_ctx.pVssbc->AbortBackup();
> >
> >  }
> >
> > +
> >
> > +out1:
> >
> >  requester_cleanup();
> >
> >  CoUninitialize();
> >
> >  }
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


Re: [Qemu-devel] [PATCH] qga-win: don't hang if vss hold writes timeout

2017-09-22 Thread Chen Hanxiao

在 2017-09-23 05:12:20,"Tomoki Sekiyama"  写道:
 
> 
> Thanks for your patch.
> Which version of Windows have you found the hang?
> 
> 
  I tested on win08, win 08 r2 and win2012.

QGA versions:

  Use the latest qga-win from 
  
https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-qemu-ga/qemu-ga-win-7.4.5-1/
 
  and stable branch from
  
https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/virtio-win-0.1.126-2/virtio-win-0.1.126.iso

  All of them have the same behavior.

How to reproduce:

  Copy a big file in guest (from d: to c:), then do fsfreeze when IO is in 
progress.

  At this time, we had a very chance to see that qga hang for a long time.

  Libvirt will not recieve a reply.
  qemu-ga service even don't answer `net stop` command.


Regards,
- Chen
 
  

> Regards,
> Tomoki
> 
> 
> 2017-09-22 11:46 GMT+09:00 Chen Hanxiao :
> 
> From: Chen Hanxiao 
> 
> 
> 
> When VM is in a heavy IO, if the command "guest-fsfreeze-freeze"
> 
> is executed, VSS may timeout when trying to hold writes.
> 
> 
> 
> Inside guest, Event ID 12298(VSS_ERROR_HOLD_WRITES_TIMEOUT)
> 
> is logged in the Event Viewer.
> 
> 
> 
> At that time, if we call AbortBackup, qga may hang forever.
> 
> 
> 
> This patch will solve this issues.
> 
> 
> 
> Signed-off-by: Chen Hanxiao 
> 
> ---
> 
>  qga/vss-win32/requester.cpp | 12 
> 
>  1 file changed, 12 insertions(+)
> 
> 
> 
> diff --git a/qga/vss-win32/requester.cpp b/qga/vss-win32/requester.cpp
> 
> index 301762d..3d9c971 100644
> 
> --- a/qga/vss-win32/requester.cpp
> 
> +++ b/qga/vss-win32/requester.cpp
> 
> @@ -419,6 +419,16 @@ void requester_freeze(int *num_vols, ErrorSet *errset)
> 
>              break;
> 
>          }
> 
>      }
> 
> +
> 
> +    if (wait_status == WAIT_TIMEOUT) {
> 
> +        err_set(errset, E_FAIL,
> 
> +                "timeout when try to receive Frozen event from VSS 
> provider");
> 
> +        /* If we are here, VSS had timeout.
> 
> +         * Don't call AbortBackup, just return directly.
> 
> +         */
> 
> +        goto out1;
> 
> +    }
> 
> +
> 
>      if (wait_status != WAIT_OBJECT_0) {
> 
>          err_set(errset, E_FAIL,
> 
>                  "couldn't receive Frozen event from VSS provider");
> 
> @@ -432,6 +442,8 @@ out:
> 
>      if (vss_ctx.pVssbc) {
> 
>          vss_ctx.pVssbc->AbortBackup();
> 
>      }
> 
> +
> 
> +out1:
> 
>      requester_cleanup();
> 
>      CoUninitialize();
> 
>  }





















Re: [Qemu-devel] [PATCH 01/20] nvic: Clear the vector arrays and prigroup on reset

2017-09-22 Thread Richard Henderson
On 09/22/2017 09:59 AM, Peter Maydell wrote:
> Reset for devices does not include an automatic clear of the
> device state (unlike CPU state, where most of the state
> structure is cleared to zero). Add some missing initialization
> of NVIC state that meant that the device was left in the wrong
> state if the guest did a warm reset.
> 
> (In particular, since we were resetting the computed state like
> s->exception_prio but not all the state it was computed
> from like s->vectors[x].active, the NVIC wound up in an
> inconsistent state that could later trigger assertion failures.)
> 
> Signed-off-by: Peter Maydell 
> ---
>  hw/intc/armv7m_nvic.c | 5 +
>  1 file changed, 5 insertions(+)

Reviewed-by: Richard Henderson 


r~



[Qemu-devel] [PATCH] chardev/baum: fix baum that releases brlapi twice

2017-09-22 Thread Liang Yan
Error process of baum_chr_open needs to set brlapi null, so it won't
get released twice in char_braille_finalize, which will cause
"/usr/bin/qemu-system-x86_64: double free or corruption (!prev)"

Signed-off-by: Liang Yan 
---
 chardev/baum.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/chardev/baum.c b/chardev/baum.c
index 302dd9666c..67fd783a59 100644
--- a/chardev/baum.c
+++ b/chardev/baum.c
@@ -643,6 +643,7 @@ static void baum_chr_open(Chardev *chr,
 error_setg(errp, "brlapi__openConnection: %s",
brlapi_strerror(brlapi_error_location()));
 g_free(handle);
+baum->brlapi = NULL;
 return;
 }
 baum->deferred_init = 0;
-- 
2.14.1




Re: [Qemu-devel] [PATCH] qga-win: don't hang if vss hold writes timeout

2017-09-22 Thread Tomoki Sekiyama
Thanks for your patch.
Which version of Windows have you found the hang?

Regards,
Tomoki

2017-09-22 11:46 GMT+09:00 Chen Hanxiao :

> From: Chen Hanxiao 
>
> When VM is in a heavy IO, if the command "guest-fsfreeze-freeze"
> is executed, VSS may timeout when trying to hold writes.
>
> Inside guest, Event ID 12298(VSS_ERROR_HOLD_WRITES_TIMEOUT)
> is logged in the Event Viewer.
>
> At that time, if we call AbortBackup, qga may hang forever.
>
> This patch will solve this issues.
>
> Signed-off-by: Chen Hanxiao 
> ---
>  qga/vss-win32/requester.cpp | 12 
>  1 file changed, 12 insertions(+)
>
> diff --git a/qga/vss-win32/requester.cpp b/qga/vss-win32/requester.cpp
> index 301762d..3d9c971 100644
> --- a/qga/vss-win32/requester.cpp
> +++ b/qga/vss-win32/requester.cpp
> @@ -419,6 +419,16 @@ void requester_freeze(int *num_vols, ErrorSet *errset)
>  break;
>  }
>  }
> +
> +if (wait_status == WAIT_TIMEOUT) {
> +err_set(errset, E_FAIL,
> +"timeout when try to receive Frozen event from VSS
> provider");
> +/* If we are here, VSS had timeout.
> + * Don't call AbortBackup, just return directly.
> + */
> +goto out1;
> +}
> +
>  if (wait_status != WAIT_OBJECT_0) {
>  err_set(errset, E_FAIL,
>  "couldn't receive Frozen event from VSS provider");
> @@ -432,6 +442,8 @@ out:
>  if (vss_ctx.pVssbc) {
>  vss_ctx.pVssbc->AbortBackup();
>  }
> +
> +out1:
>  requester_cleanup();
>  CoUninitialize();
>  }
> --
> 2.7.5
>
>


Re: [Qemu-devel] [PATCH] pci: allow 32-bit PCI IO accesses to pass through the PCI bridge

2017-09-22 Thread Laszlo Ersek
On 09/22/17 14:18, Mark Cave-Ayland wrote:
> Whilst the underlying PCI bridge implementation supports 32-bit PCI IO
> accesses, unfortunately they are truncated at the legacy 64K limit.
> 
> Signed-off-by: Mark Cave-Ayland 
> ---
>  hw/pci/pci_bridge.c |3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/pci/pci_bridge.c b/hw/pci/pci_bridge.c
> index 17feae5..a47d257 100644
> --- a/hw/pci/pci_bridge.c
> +++ b/hw/pci/pci_bridge.c
> @@ -379,7 +379,8 @@ void pci_bridge_initfn(PCIDevice *dev, const char 
> *typename)
>  sec_bus->address_space_mem = >address_space_mem;
>  memory_region_init(>address_space_mem, OBJECT(br), "pci_bridge_pci", 
> UINT64_MAX);
>  sec_bus->address_space_io = >address_space_io;
> -memory_region_init(>address_space_io, OBJECT(br), "pci_bridge_io", 
> 65536);
> +memory_region_init(>address_space_io, OBJECT(br), "pci_bridge_io",
> +   UINT32_MAX);
>  br->windows = pci_bridge_region_init(br);
>  QLIST_INIT(_bus->child);
>  QLIST_INSERT_HEAD(>child, sec_bus, sibling);
> 

Based on the commit message, I assume this change is guest-visible. If
so, should it be made dependent on a compat property, so that it doesn't
cause problems with migration?

Thanks,
Laszlo



Re: [Qemu-devel] [PATCH] pci: allow 32-bit PCI IO accesses to pass through the PCI bridge

2017-09-22 Thread Richard Henderson
On 09/22/2017 07:18 AM, Mark Cave-Ayland wrote:
> Whilst the underlying PCI bridge implementation supports 32-bit PCI IO
> accesses, unfortunately they are truncated at the legacy 64K limit.
> 
> Signed-off-by: Mark Cave-Ayland 
> ---
>  hw/pci/pci_bridge.c |3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Reviewed-by: Richard Henderson 


r~



Re: [Qemu-devel] [PATCH] MAINTAINERS: Fix subsystem name for "Build and test automation"

2017-09-22 Thread Eric Blake
On 09/21/2017 10:30 PM, Fam Zheng wrote:

>>>  Build and test automation
>>>  -
>>> +Build and test automation
>>
>> Would it make sense to use something more specific here? Like "Travis
>> and Docker" or so? ... in case we add other subsections in the future?
> 
> Unless we are to split off (i.e. more people volunteering maintaining a 
> certain
> subset), the list will just go on and on in this line. For not it's already
> going to be "Travis, Shippable, Docker and VM test".. so I think a generic
> description here is okay, though the duplication is a bit odd (but I don't 
> have
> a better idea).

Or we could make a generic section of "Build, Tests, and Documentation",
and merge in the "Build system architecture" of the
immediately-subsequent "Documentation" section, as well as possibly any
future sections for someone to maintain top-level build-related files
(including MAINTAINERS itself...), so that we have just one larger
section with multiple sub-sections, instead of two sections each with
one sub-section.

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



signature.asc
Description: OpenPGP digital signature


Re: [Qemu-devel] [PATCH] block/qcow2-bitmap: fix use of uninitialized pointer

2017-09-22 Thread Eric Blake
On 09/22/2017 09:43 AM, Vladimir Sementsov-Ogievskiy wrote:
> Without initialization to zero dirty_bitmap field may be not zero
> for a bitmap which should not be stored and
> qcow2_store_persistent_dirty_bitmaps will erroneously call
> store_bitmap for it which leads to SYGSEGV on bdrv_dirty_bitmap_name.

s/SYG/SIG/

Introduced in commit 5f72826e, therefore it impacts 2.10, so:

CC: qemu-sta...@nongnu.org

> 
> Signed-off-by: Vladimir Sementsov-Ogievskiy 
> ---
>  block/qcow2-bitmap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Eric Blake 

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



signature.asc
Description: OpenPGP digital signature


Re: [Qemu-devel] [PATCH v2 3/4] fw_cfg: write vmcoreinfo details

2017-09-22 Thread kbuild test robot
Hi Marc-André,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.14-rc1 next-20170922]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/marcandre-lureau-redhat-com/fw_cfg-add-DMA-operations-etc-vmcoreinfo-support/20170922-182716
config: x86_64-randconfig-ws0-09230003 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

>> ERROR: "paddr_vmcoreinfo_note" [drivers/firmware/qemu_fw_cfg.ko] undefined!

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [Qemu-devel] [RFC v2 33/33] migration: init dst in migration_object_init too

2017-09-22 Thread Dr. David Alan Gilbert
* Peter Xu (pet...@redhat.com) wrote:
> Though we may not need it, now we init both the src/dst migration
> objects in migration_object_init() so that even incoming migration
> object would be thread safe (it was not).
> 
> Signed-off-by: Peter Xu 

Reviewed-by: Dr. David Alan Gilbert 

> ---
>  migration/migration.c | 27 ++-
>  1 file changed, 14 insertions(+), 13 deletions(-)
> 
> diff --git a/migration/migration.c b/migration/migration.c
> index 5812478..7e9ccf0 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -103,6 +103,7 @@ enum mig_rp_message_type {
> dynamic creation of migration */
>  
>  static MigrationState *current_migration;
> +static MigrationIncomingState *current_incoming;
>  
>  static bool migration_object_check(MigrationState *ms, Error **errp);
>  
> @@ -128,6 +129,17 @@ void migration_object_init(void)
>  if (ms->enforce_config_section) {
>  current_migration->send_configuration = true;
>  }
> +
> +/*
> + * Init the migrate incoming object as well no matter whether
> + * we'll use it or not.
> + */
> +current_incoming = g_new0(MigrationIncomingState, 1);
> +current_incoming->state = MIGRATION_STATUS_NONE;
> +qemu_mutex_init(_incoming->rp_mutex);
> +qemu_event_init(_incoming->main_thread_load_event, false);
> +qemu_sem_init(_incoming->postcopy_pause_sem_dst, 0);
> +qemu_sem_init(_incoming->postcopy_pause_sem_fault, 0);
>  }
>  
>  /* For outgoing */
> @@ -140,19 +152,8 @@ MigrationState *migrate_get_current(void)
>  
>  MigrationIncomingState *migration_incoming_get_current(void)
>  {
> -static bool once;
> -static MigrationIncomingState mis_current;
> -
> -if (!once) {
> -mis_current.state = MIGRATION_STATUS_NONE;
> -memset(_current, 0, sizeof(MigrationIncomingState));
> -qemu_mutex_init(_current.rp_mutex);
> -qemu_event_init(_current.main_thread_load_event, false);
> -qemu_sem_init(_current.postcopy_pause_sem_dst, 0);
> -qemu_sem_init(_current.postcopy_pause_sem_fault, 0);
> -once = true;
> -}
> -return _current;
> +assert(current_incoming);
> +return current_incoming;
>  }
>  
>  void migration_incoming_state_destroy(void)
> -- 
> 2.7.4
> 
> 
--
Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK



Re: [Qemu-devel] nbd structured reply

2017-09-22 Thread Eric Blake
On 09/22/2017 09:57 AM, Vladimir Sementsov-Ogievskiy wrote:

>> If you have suggestions for improving the NBD spec wording, feel free to
>> propose a doc patch.
>>
> 
> Thanks, now I understand.. However I don't have good idea of wording..
> 
> 
> Another thing: server can send several error and success chunks on
> CMD_READ..

Yes, and that is intentional. A server that spawns sub-tasks to read
portions of the request to various parallel workers, and then sends
those responses back to the client as sub-tasks finish, can indeed send
multiple errors before sending the final chunk complete message.

> 
> The obvious behavior of client is to fail the whole read if it received
> one error chunk.

Yes, the read has failed if the client sees at least one error chunk.
The read is not successful unless there are no error chunks, and the
server has sent chunks describing every portion of the request (the
server is not allowed to send chunks that overlap, nor to send a
successful chunk after sending an error for the same offset, nor to send
a success message if it has not covered the entire request - but IS
allowed to send multiple error chunks).

> And, actually, client is not interesting in all following chunks for
> this request.

Perhaps not, but the client is not in control of how much the server
sends, so it must gracefully deal with the remaining traffic from the
server while waiting for the server to finally send the last chunk.

> I think
> we need some additional negotiation flag for this, which says that error
> chunk
> must be final.

Why? It adds complexity, for no real reason.  (Read errors are not
common, so it is okay if dealing with read errors requires more network
traffic than normal).

> 
> May be we need also a method (command) to cancel one of inflight
> requests, but it
> is not so important.

Again, that would add complexity that may be really hard to justify (we
want to be able to implement stateless servers; a server that has to
parse a second message from a client requesting to abort an in-flight
command has to track state).  So I don't think it is worth it.

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



signature.asc
Description: OpenPGP digital signature


Re: [Qemu-devel] [RFC v2 32/33] migration: allow migrate_incoming for paused VM

2017-09-22 Thread Dr. David Alan Gilbert
* Peter Xu (pet...@redhat.com) wrote:
> migrate_incoming command is previously only used when we were providing
> "-incoming defer" in the command line, to defer the incoming migration
> channel creation.
> 
> However there is similar requirement when we are paused during postcopy
> migration. The old incoming channel might have been destroyed already.
> We may need another new channel for the recovery to happen.
> 
> This patch leveraged the same interface, but allows the user to specify
> incoming migration channel even for paused postcopy.
> 
> Meanwhile, now migration listening ports are always detached manually
> using the tag, rather than using return values of dispatchers.
> 
> Signed-off-by: Peter Xu 
> ---
>  migration/exec.c  |  2 +-
>  migration/fd.c|  2 +-
>  migration/migration.c | 39 +--
>  migration/socket.c|  2 +-
>  4 files changed, 32 insertions(+), 13 deletions(-)
> 
> diff --git a/migration/exec.c b/migration/exec.c
> index ef1fb4c..26fc37d 100644
> --- a/migration/exec.c
> +++ b/migration/exec.c
> @@ -49,7 +49,7 @@ static gboolean exec_accept_incoming_migration(QIOChannel 
> *ioc,
>  {
>  migration_channel_process_incoming(ioc);
>  object_unref(OBJECT(ioc));
> -return FALSE; /* unregister */
> +return TRUE; /* keep it registered */
>  }
>  
>  /*
> diff --git a/migration/fd.c b/migration/fd.c
> index e9a548c..7d0aefa 100644
> --- a/migration/fd.c
> +++ b/migration/fd.c
> @@ -49,7 +49,7 @@ static gboolean fd_accept_incoming_migration(QIOChannel 
> *ioc,
>  {
>  migration_channel_process_incoming(ioc);
>  object_unref(OBJECT(ioc));
> -return FALSE; /* unregister */
> +return TRUE; /* keep it registered */
>  }
>  
>  /*
> diff --git a/migration/migration.c b/migration/migration.c
> index daf356b..5812478 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -175,6 +175,17 @@ void migration_incoming_state_destroy(void)
>  qemu_event_destroy(>main_thread_load_event);
>  }
>  
> +static bool migrate_incoming_detach_listen(MigrationIncomingState *mis)
> +{
> +if (mis->listen_task_tag) {
> +/* Never fail */
> +g_source_remove(mis->listen_task_tag);
> +mis->listen_task_tag = 0;
> +return true;
> +}
> +return false;
> +}
> +
>  static void migrate_generate_event(int new_state)
>  {
>  if (migrate_use_events()) {
> @@ -432,10 +443,9 @@ void migration_fd_process_incoming(QEMUFile *f)
>  
>  /*
>   * When reach here, we should not need the listening port any
> - * more. We'll detach the listening task soon, let's reset the
> - * listen task tag.
> + * more.  Detach the listening port explicitly.
>   */
> -mis->listen_task_tag = 0;
> +migrate_incoming_detach_listen(mis);
>  }
>  
>  /*
> @@ -1291,14 +1301,25 @@ void migrate_del_blocker(Error *reason)
>  void qmp_migrate_incoming(const char *uri, Error **errp)
>  {
>  Error *local_err = NULL;
> -static bool once = true;
> +MigrationIncomingState *mis = migration_incoming_get_current();
>  
> -if (!deferred_incoming) {
> -error_setg(errp, "For use with '-incoming defer'");
> +if (!deferred_incoming &&
> +mis->state != MIGRATION_STATUS_POSTCOPY_PAUSED) {
> +error_setg(errp, "For use with '-incoming defer'"
> +   " or PAUSED postcopy migration only.");
>  return;
>  }
> -if (!once) {
> -error_setg(errp, "The incoming migration has already been started");

What guards against someone doing a migrate_incoming after the succesful
completion of an incoming migration?
Also with RDMA the following won't happen so I'm not quite sure what
state we're in.

When we get to non-blocking commands it's also a bit interesting - we
could be getting an accept on the main thread at just the same time
this is going down the OOB side.

Dave

> +
> +/*
> + * Destroy existing listening task if exist. Logically this should
> + * not really happen at all (for either deferred migration or
> + * postcopy migration, we should both detached the listening
> + * task). So raise an error but still we safely detach it.
> + */
> +if (migrate_incoming_detach_listen(mis)) {
> +error_report("%s: detected existing listen channel, "
> + "while it should not exist", __func__);
> +/* Continue */
>  }
>  
>  qemu_start_incoming_migration(uri, _err);
> @@ -1307,8 +1328,6 @@ void qmp_migrate_incoming(const char *uri, Error **errp)
>  error_propagate(errp, local_err);
>  return;
>  }
> -
> -once = false;
>  }
>  
>  bool migration_is_blocked(Error **errp)
> diff --git a/migration/socket.c b/migration/socket.c
> index 6ee51ef..e3e453f 100644
> --- a/migration/socket.c
> +++ b/migration/socket.c
> @@ -154,7 +154,7 @@ static gboolean 
> socket_accept_incoming_migration(QIOChannel *ioc,
>  out:
>  /* Close listening 

Re: [Qemu-devel] [PULL 28/36] tests: Add ubuntu.i386 image

2017-09-22 Thread Programmingkid

> On Sep 22, 2017, at 9:18 AM, Daniel P. Berrange  wrote:
> 
> On Fri, Sep 22, 2017 at 08:44:05PM +0800, Fam Zheng wrote:
>> On Fri, 09/22 08:10, Programmingkid wrote:
>>> Could a Darwin test be added? Both x86 and PowerPC versions would be great.
>> 
>> It's nice to cover macOS in our test, but to be honest I don't know how to do
>> it. If there isn't any copyright problem, and if there are instructions
>> available in wiki.qemu.org descirbing how to create such a guest step by step
>> like [1], we can add one.
> 
> AFAICT we can not just provide or host OS-X images and let individual
> devs run the without it being a license violation, so best avoided.

Actually Darwin and Mac OS X are not the same. Darwin is this minimalistic 
environment and Mac OS X is built on top of that environment. There would be no 
license problems when using Darwin only.

> IMHO it easier to just rely on Travis' OS-X builders for testing OS-X
> platform builds, so that licensing compliance is their responsibility.

That might work for the x86 version of Mac OS X, but there doesn't appear to be 
any support for the PowerPC version of Mac OS X.




Re: [Qemu-devel] [PATCH] scripts/orderfile: keep MAINTAINERS at bottom

2017-09-22 Thread Eric Blake
On 09/22/2017 11:13 AM, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé 
> ---
>  scripts/git.orderfile | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/scripts/git.orderfile b/scripts/git.orderfile
> index ac699700b1..34619769c2 100644
> --- a/scripts/git.orderfile
> +++ b/scripts/git.orderfile
> @@ -27,3 +27,4 @@ Makefile*
>  # code
>  *.c
>  
> +MAINTAINERS

Well, after any file that matches above, but before any file that
doesn't match any pattern, so not strictly the end.

But why not earlier with the build system?  Generally, if you are going
to add a file, you are going to also tweak a Makefile to get it to build
- at which point, a MAINTAINERS tweak feels more on par with a Makefile
tweak.

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



signature.asc
Description: OpenPGP digital signature


Re: [Qemu-devel] [PULL 28/36] tests: Add ubuntu.i386 image

2017-09-22 Thread Programmingkid

> On Sep 22, 2017, at 8:44 AM, Fam Zheng  wrote:
> 
> On Fri, 09/22 08:10, Programmingkid wrote:
>> Could a Darwin test be added? Both x86 and PowerPC versions would be great.
> 
> It's nice to cover macOS in our test, but to be honest I don't know how to do
> it. If there isn't any copyright problem, and if there are instructions
> available in wiki.qemu.org descirbing how to create such a guest step by step
> like [1], we can add one.
> 
> [1]: https://wiki.qemu.org/Hosts/BSD
> 
> Fam

Mac OS X is built on top of Darwin. Darwin is completely open source and free. 
There are no copyright issues because it is released under the Apple Public 
Source License. 

I think I can make the directions available in the wiki soon. 


Re: [Qemu-devel] [RFC v2 29/33] migration: return incoming task tag for exec

2017-09-22 Thread Dr. David Alan Gilbert
* Peter Xu (pet...@redhat.com) wrote:
> Return the async task tag for exec typed incoming migration in
> exec_start_incoming_migration().
> 
> Signed-off-by: Peter Xu 

Reviewed-by: Dr. David Alan Gilbert 

> ---
>  migration/exec.c | 18 +++---
>  migration/exec.h |  2 +-
>  2 files changed, 12 insertions(+), 8 deletions(-)
> 
> diff --git a/migration/exec.c b/migration/exec.c
> index 08b599e..ef1fb4c 100644
> --- a/migration/exec.c
> +++ b/migration/exec.c
> @@ -52,7 +52,11 @@ static gboolean exec_accept_incoming_migration(QIOChannel 
> *ioc,
>  return FALSE; /* unregister */
>  }
>  
> -void exec_start_incoming_migration(const char *command, Error **errp)
> +/*
> + * Returns the tag ID of the watch that is attached to global main
> + * loop (>0), or zero if failure detected.
> + */
> +guint exec_start_incoming_migration(const char *command, Error **errp)
>  {
>  QIOChannel *ioc;
>  const char *argv[] = { "/bin/sh", "-c", command, NULL };
> @@ -62,13 +66,13 @@ void exec_start_incoming_migration(const char *command, 
> Error **errp)
>  O_RDWR,
>  errp));
>  if (!ioc) {
> -return;
> +return 0;
>  }
>  
>  qio_channel_set_name(ioc, "migration-exec-incoming");
> -qio_channel_add_watch(ioc,
> -  G_IO_IN,
> -  exec_accept_incoming_migration,
> -  NULL,
> -  NULL);
> +return qio_channel_add_watch(ioc,
> + G_IO_IN,
> + exec_accept_incoming_migration,
> + NULL,
> + NULL);
>  }
> diff --git a/migration/exec.h b/migration/exec.h
> index b210ffd..0a7aada 100644
> --- a/migration/exec.h
> +++ b/migration/exec.h
> @@ -19,7 +19,7 @@
>  
>  #ifndef QEMU_MIGRATION_EXEC_H
>  #define QEMU_MIGRATION_EXEC_H
> -void exec_start_incoming_migration(const char *host_port, Error **errp);
> +guint exec_start_incoming_migration(const char *host_port, Error **errp);
>  
>  void exec_start_outgoing_migration(MigrationState *s, const char *host_port,
> Error **errp);
> -- 
> 2.7.4
> 
> 
--
Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK



Re: [Qemu-devel] [RFC v2 31/33] migration: store listen task tag

2017-09-22 Thread Dr. David Alan Gilbert
* Peter Xu (pet...@redhat.com) wrote:
> Store the task tag for migration types: tcp/unix/fd/exec in current
> MigrationIncomingState struct.
> 
> For defered migration, no need to store task tag since there is no task
> running in the main loop at all. For RDMA, let's mark it as todo.
> 
> Signed-off-by: Peter Xu 

Reviewed-by: Dr. David Alan Gilbert 

> ---
>  migration/migration.c | 22 ++
>  migration/migration.h |  2 ++
>  2 files changed, 20 insertions(+), 4 deletions(-)
> 
> diff --git a/migration/migration.c b/migration/migration.c
> index c9b7085..daf356b 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -171,6 +171,7 @@ void migration_incoming_state_destroy(void)
>  mis->from_src_file = NULL;
>  }
>  
> +mis->listen_task_tag = 0;
>  qemu_event_destroy(>main_thread_load_event);
>  }
>  
> @@ -265,25 +266,31 @@ int migrate_send_rp_req_pages(MigrationIncomingState 
> *mis, const char *rbname,
>  void qemu_start_incoming_migration(const char *uri, Error **errp)
>  {
>  const char *p;
> +guint task_tag = 0;
> +MigrationIncomingState *mis = migration_incoming_get_current();
>  
>  qapi_event_send_migration(MIGRATION_STATUS_SETUP, _abort);
>  if (!strcmp(uri, "defer")) {
>  deferred_incoming_migration(errp);
>  } else if (strstart(uri, "tcp:", )) {
> -tcp_start_incoming_migration(p, errp);
> +task_tag = tcp_start_incoming_migration(p, errp);
>  #ifdef CONFIG_RDMA
>  } else if (strstart(uri, "rdma:", )) {
> +/* TODO: store task tag for RDMA migrations */
>  rdma_start_incoming_migration(p, errp);
>  #endif
>  } else if (strstart(uri, "exec:", )) {
> -exec_start_incoming_migration(p, errp);
> +task_tag = exec_start_incoming_migration(p, errp);
>  } else if (strstart(uri, "unix:", )) {
> -unix_start_incoming_migration(p, errp);
> +task_tag = unix_start_incoming_migration(p, errp);
>  } else if (strstart(uri, "fd:", )) {
> -fd_start_incoming_migration(p, errp);
> +task_tag = fd_start_incoming_migration(p, errp);
>  } else {
>  error_setg(errp, "unknown migration protocol: %s", uri);
> +return;
>  }
> +
> +mis->listen_task_tag = task_tag;
>  }
>  
>  static void process_incoming_migration_bh(void *opaque)
> @@ -422,6 +429,13 @@ void migration_fd_process_incoming(QEMUFile *f)
>  co = qemu_coroutine_create(process_incoming_migration_co, f);
>  qemu_coroutine_enter(co);
>  }
> +
> +/*
> + * When reach here, we should not need the listening port any
> + * more. We'll detach the listening task soon, let's reset the
> + * listen task tag.
> + */
> +mis->listen_task_tag = 0;
>  }
>  
>  /*
> diff --git a/migration/migration.h b/migration/migration.h
> index d041369..1f4faef 100644
> --- a/migration/migration.h
> +++ b/migration/migration.h
> @@ -26,6 +26,8 @@
>  /* State for the incoming migration */
>  struct MigrationIncomingState {
>  QEMUFile *from_src_file;
> +/* Task tag for incoming listen port. Valid when >0. */
> +guint listen_task_tag;
>  
>  /*
>   * Free at the start of the main state load, set as the main thread 
> finishes
> -- 
> 2.7.4
> 
> 
--
Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK



Re: [Qemu-devel] [RFC v2 30/33] migration: return incoming task tag for fd

2017-09-22 Thread Dr. David Alan Gilbert
* Peter Xu (pet...@redhat.com) wrote:
> Allow to return the task tag in fd_start_incoming_migration().
> 
> Signed-off-by: Peter Xu 

Reviewed-by: Dr. David Alan Gilbert 

> ---
>  migration/fd.c | 18 +++---
>  migration/fd.h |  2 +-
>  2 files changed, 12 insertions(+), 8 deletions(-)
> 
> diff --git a/migration/fd.c b/migration/fd.c
> index 30f5258..e9a548c 100644
> --- a/migration/fd.c
> +++ b/migration/fd.c
> @@ -52,7 +52,11 @@ static gboolean fd_accept_incoming_migration(QIOChannel 
> *ioc,
>  return FALSE; /* unregister */
>  }
>  
> -void fd_start_incoming_migration(const char *infd, Error **errp)
> +/*
> + * Returns the tag ID of the watch that is attached to global main
> + * loop (>0), or zero if failure detected.
> + */
> +guint fd_start_incoming_migration(const char *infd, Error **errp)
>  {
>  QIOChannel *ioc;
>  int fd;
> @@ -63,13 +67,13 @@ void fd_start_incoming_migration(const char *infd, Error 
> **errp)
>  ioc = qio_channel_new_fd(fd, errp);
>  if (!ioc) {
>  close(fd);
> -return;
> +return 0;
>  }
>  
>  qio_channel_set_name(QIO_CHANNEL(ioc), "migration-fd-incoming");
> -qio_channel_add_watch(ioc,
> -  G_IO_IN,
> -  fd_accept_incoming_migration,
> -  NULL,
> -  NULL);
> +return qio_channel_add_watch(ioc,
> + G_IO_IN,
> + fd_accept_incoming_migration,
> + NULL,
> + NULL);
>  }
> diff --git a/migration/fd.h b/migration/fd.h
> index a14a63c..94cdea8 100644
> --- a/migration/fd.h
> +++ b/migration/fd.h
> @@ -16,7 +16,7 @@
>  
>  #ifndef QEMU_MIGRATION_FD_H
>  #define QEMU_MIGRATION_FD_H
> -void fd_start_incoming_migration(const char *path, Error **errp);
> +guint fd_start_incoming_migration(const char *path, Error **errp);
>  
>  void fd_start_outgoing_migration(MigrationState *s, const char *fdname,
>   Error **errp);
> -- 
> 2.7.4
> 
> 
--
Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK



Re: [Qemu-devel] [PATCH 30/34] hw/net/pcnet: use TYPE_PCI_PCNET

2017-09-22 Thread Hervé Poussineau

Le 22/09/2017 à 18:01, Philippe Mathieu-Daudé a écrit :

Signed-off-by: Philippe Mathieu-Daudé 
---
  include/hw/net/pci.h | 1 +
  hw/mips/mips_malta.c | 2 +-
  hw/net/pcnet-pci.c   | 3 +--
  hw/ppc/prep.c| 3 ++-
  4 files changed, 5 insertions(+), 4 deletions(-)


Reviewed-by: Hervé Poussineau 




Re: [Qemu-devel] [PATCH 32/34] hw/net/ne2000: use TYPE_PCI_NE2000

2017-09-22 Thread Hervé Poussineau

Le 22/09/2017 à 18:01, Philippe Mathieu-Daudé a écrit :

Signed-off-by: Philippe Mathieu-Daudé 
---
  include/hw/net/pci.h  | 1 +
  hw/net/ne2000.c   | 3 ++-
  hw/ppc/mac_newworld.c | 3 ++-
  hw/ppc/mac_oldworld.c | 3 ++-
  hw/ppc/prep.c | 2 +-
  hw/sparc64/sun4u.c| 3 ++-
  6 files changed, 10 insertions(+), 5 deletions(-)


Reviewed-by: Hervé Poussineau 




Re: [Qemu-devel] [PATCH 24/34] hw/timer/mc146818: rename rtc_init() -> mc146818_init()

2017-09-22 Thread Hervé Poussineau

Le 22/09/2017 à 18:01, Philippe Mathieu-Daudé a écrit :

and remove the old i386/pc dependency

Signed-off-by: Philippe Mathieu-Daudé 
---
  include/hw/timer/mc146818rtc.h | 3 ++-
  hw/alpha/dp264.c   | 2 +-
  hw/i386/pc.c   | 2 +-
  hw/isa/i82378.c| 3 ++-
  hw/mips/mips_fulong2e.c| 2 +-
  hw/mips/mips_jazz.c| 2 +-
  hw/mips/mips_malta.c   | 2 +-
  hw/mips/mips_r4k.c | 2 +-
  hw/ppc/pnv.c   | 2 +-
  hw/timer/mc146818rtc.c | 2 +-
  10 files changed, 12 insertions(+), 10 deletions(-)


Reviewed-by: Hervé Poussineau 




Re: [Qemu-devel] [PATCH 22/34] hw/input/i8042: extract API from hw/i386/pc.h

2017-09-22 Thread Hervé Poussineau

Le 22/09/2017 à 17:40, Philippe Mathieu-Daudé a écrit :

- include vmmouse
- add entries in MAINTAINERS (pckbd.c, i8042.h)

Signed-off-by: Philippe Mathieu-Daudé 
---
  include/hw/i386/pc.h | 11 ---
  include/hw/input/i8042.h | 30 ++
  hw/alpha/dp264.c |  3 ++-
  hw/i386/pc.c |  5 +++--
  hw/input/pckbd.c |  2 +-
  hw/input/vmmouse.c   |  3 +--
  hw/mips/mips_fulong2e.c  |  3 ++-
  hw/mips/mips_jazz.c  |  1 +
  hw/mips/mips_malta.c |  3 ++-
  hw/mips/mips_r4k.c   |  3 ++-
  hw/misc/vmport.c |  1 +
  hw/ppc/prep.c|  5 +++--
  hw/sparc64/sun4u.c   |  3 ++-
  hw/unicore32/puv3.c  |  1 +
  MAINTAINERS  |  4 +++-
  15 files changed, 54 insertions(+), 24 deletions(-)
  create mode 100644 include/hw/input/i8042.h


Reviewed-by: Hervé Poussineau 




Re: [Qemu-devel] [RFC v2 28/33] migration: return incoming task tag for sockets

2017-09-22 Thread Dr. David Alan Gilbert
* Peter Xu (pet...@redhat.com) wrote:
> For socket based incoming migration, we attached a background task onto
> main loop to handle the acception of connections. We never had a way to
> destroy it before, only if we finished the migration.
> 
> Let's allow socket_start_incoming_migration() to return the source tag
> of the listening async work, so that we may be able to clean it up in
> the future.
> 
> Signed-off-by: Peter Xu 
> ---
>  migration/socket.c | 36 
>  migration/socket.h |  4 ++--
>  2 files changed, 26 insertions(+), 14 deletions(-)
> 
> diff --git a/migration/socket.c b/migration/socket.c
> index 9fc6cb3..6ee51ef 100644
> --- a/migration/socket.c
> +++ b/migration/socket.c
> @@ -158,8 +158,12 @@ out:
>  }
>  
>  
> -static void socket_start_incoming_migration(SocketAddress *saddr,
> -Error **errp)
> +/*
> + * Returns the tag ID of the watch that is attached to global main
> + * loop (>0), or zero if failure detected.
> + */
> +static guint socket_start_incoming_migration(SocketAddress *saddr,
> + Error **errp)
>  {
>  QIOChannelSocket *listen_ioc = qio_channel_socket_new();
>  
> @@ -168,30 +172,38 @@ static void 
> socket_start_incoming_migration(SocketAddress *saddr,
>  
>  if (qio_channel_socket_listen_sync(listen_ioc, saddr, errp) < 0) {
>  object_unref(OBJECT(listen_ioc));
> -return;
> +return 0;
>  }
>  
> -qio_channel_add_watch(QIO_CHANNEL(listen_ioc),
> -  G_IO_IN,
> -  socket_accept_incoming_migration,
> -  listen_ioc,
> -  (GDestroyNotify)object_unref);
> +return qio_channel_add_watch(QIO_CHANNEL(listen_ioc),
> + G_IO_IN,
> + socket_accept_incoming_migration,
> + listen_ioc,
> + (GDestroyNotify)object_unref);
>  }
>  
> -void tcp_start_incoming_migration(const char *host_port, Error **errp)
> +guint tcp_start_incoming_migration(const char *host_port, Error **errp)
>  {
>  Error *err = NULL;
>  SocketAddress *saddr = tcp_build_address(host_port, );
> +guint tag;
> +
>  if (!err) {
> -socket_start_incoming_migration(saddr, );
> +tag = socket_start_incoming_migration(saddr, );
>  }

I'd be tempted to initialise that tag = 0   for the case where
there's an error; but OK.

Reviewed-by: Dr. David Alan Gilbert 

>  error_propagate(errp, err);
>  qapi_free_SocketAddress(saddr);
> +
> +return tag;
>  }
>  
> -void unix_start_incoming_migration(const char *path, Error **errp)
> +guint unix_start_incoming_migration(const char *path, Error **errp)
>  {
>  SocketAddress *saddr = unix_build_address(path);
> -socket_start_incoming_migration(saddr, errp);
> +guint tag;
> +
> +tag = socket_start_incoming_migration(saddr, errp);
>  qapi_free_SocketAddress(saddr);
> +
> +return tag;
>  }
> diff --git a/migration/socket.h b/migration/socket.h
> index 6b91e9d..bc8a59a 100644
> --- a/migration/socket.h
> +++ b/migration/socket.h
> @@ -16,12 +16,12 @@
>  
>  #ifndef QEMU_MIGRATION_SOCKET_H
>  #define QEMU_MIGRATION_SOCKET_H
> -void tcp_start_incoming_migration(const char *host_port, Error **errp);
> +guint tcp_start_incoming_migration(const char *host_port, Error **errp);
>  
>  void tcp_start_outgoing_migration(MigrationState *s, const char *host_port,
>Error **errp);
>  
> -void unix_start_incoming_migration(const char *path, Error **errp);
> +guint unix_start_incoming_migration(const char *path, Error **errp);
>  
>  void unix_start_outgoing_migration(MigrationState *s, const char *path,
> Error **errp);
> -- 
> 2.7.4
> 
> 
--
Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK



Re: [Qemu-devel] [PATCH 26/34] hw/net/ne2000: extract ne2k-isa code from i386/pc to ne2000-isa.c

2017-09-22 Thread Hervé Poussineau

Le 22/09/2017 à 18:01, Philippe Mathieu-Daudé a écrit :

- add "hw/net/ne2000-isa.h" (and new entry in MAINTAINERS)
- remove the old i386 dependency

Signed-off-by: Philippe Mathieu-Daudé 
---
  hw/net/ne2000.h |  3 +++
  include/hw/i386/pc.h| 20 
  include/hw/net/ne2000-isa.h | 33 +
  hw/i386/pc.c|  1 +
  hw/mips/mips_r4k.c  |  1 +
  hw/net/ne2000-isa.c |  6 ++
  hw/net/ne2000.c |  2 --
  hw/ppc/prep.c   |  1 +
  MAINTAINERS |  1 +
  9 files changed, 42 insertions(+), 26 deletions(-)
  create mode 100644 include/hw/net/ne2000-isa.h


Reviewed-by: Hervé Poussineau 




Re: [Qemu-devel] [PATCH 25/34] hw/timer/m48t59: use TYPE_M48T59_ISA, add entries to MAINTAINERS

2017-09-22 Thread Hervé Poussineau

Le 22/09/2017 à 18:01, Philippe Mathieu-Daudé a écrit :

Signed-off-by: Philippe Mathieu-Daudé 
---
  include/hw/timer/m48t59.h | 2 ++
  hw/ppc/prep.c | 2 +-
  hw/timer/m48t59-isa.c | 2 +-
  MAINTAINERS   | 2 ++
  4 files changed, 6 insertions(+), 2 deletions(-)


Reviewed-by: Hervé Poussineau 




Re: [Qemu-devel] [PATCH 21/34] hw/display/vga: remove the old i386/pc dependency

2017-09-22 Thread Hervé Poussineau

Le 22/09/2017 à 17:40, Philippe Mathieu-Daudé a écrit :

move public API to "hw/display/vga.h" and private registers
to "hw/display/vga_int_regs.h"

Signed-off-by: Philippe Mathieu-Daudé 
---
./scripts/get_maintainer.pl -f hw/display/vga*
get_maintainer.pl: No maintainers found...

  hw/display/vga_int.h |  3 ++-
  hw/display/{vga.h => vga_int_regs.h} |  0
  include/hw/display/vga.h | 25 +
  include/hw/i386/pc.h | 12 
  hw/display/vga-isa-mm.c  |  4 +---
  hw/display/vga-isa.c |  2 +-
  hw/display/vga.c |  4 ++--
  hw/mips/mips_jazz.c  |  1 +
  vl.c |  2 +-
  9 files changed, 33 insertions(+), 20 deletions(-)
  rename hw/display/{vga.h => vga_int_regs.h} (100%)
  create mode 100644 include/hw/display/vga.h



Reviewed-by: Hervé Poussineau 




Re: [Qemu-devel] [PATCH 20/34] hw/timer/i8254: rename pit_init() -> i8254_pit_init()

2017-09-22 Thread Hervé Poussineau

Le 22/09/2017 à 17:40, Philippe Mathieu-Daudé a écrit :

- add entry for i82378 in MAINTAINERS
- remove the old i386/pc dependency

Signed-off-by: Philippe Mathieu-Daudé 
---
  include/hw/timer/i8254.h  | 5 +++--
  include/hw/timer/i8254_internal.h | 2 +-
  hw/alpha/dp264.c  | 2 +-
  hw/i386/pc.c  | 2 +-
  hw/isa/i82378.c   | 2 +-
  hw/mips/mips_fulong2e.c   | 2 +-
  hw/mips/mips_jazz.c   | 2 +-
  hw/mips/mips_malta.c  | 2 +-
  hw/mips/mips_r4k.c| 2 +-
  hw/timer/i8254.c  | 1 -
  hw/timer/i8254_common.c   | 1 -
  MAINTAINERS   | 1 +
  12 files changed, 12 insertions(+), 12 deletions(-)



Reviewed-by: Hervé Poussineau 



Re: [Qemu-devel] [RFC v2 27/33] migration: free SocketAddress where allocated

2017-09-22 Thread Dr. David Alan Gilbert
* Peter Xu (pet...@redhat.com) wrote:
> Freeing the SocketAddress struct in socket_start_incoming_migration is
> slightly confusing. Let's free the address in the same context where we
> allocated it.
> 
> Signed-off-by: Peter Xu 

Reviewed-by: Dr. David Alan Gilbert 

> ---
>  migration/socket.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/migration/socket.c b/migration/socket.c
> index 757d382..9fc6cb3 100644
> --- a/migration/socket.c
> +++ b/migration/socket.c
> @@ -168,7 +168,6 @@ static void socket_start_incoming_migration(SocketAddress 
> *saddr,
>  
>  if (qio_channel_socket_listen_sync(listen_ioc, saddr, errp) < 0) {
>  object_unref(OBJECT(listen_ioc));
> -qapi_free_SocketAddress(saddr);
>  return;
>  }
>  
> @@ -177,7 +176,6 @@ static void socket_start_incoming_migration(SocketAddress 
> *saddr,
>socket_accept_incoming_migration,
>listen_ioc,
>(GDestroyNotify)object_unref);
> -qapi_free_SocketAddress(saddr);
>  }
>  
>  void tcp_start_incoming_migration(const char *host_port, Error **errp)
> @@ -188,10 +186,12 @@ void tcp_start_incoming_migration(const char 
> *host_port, Error **errp)
>  socket_start_incoming_migration(saddr, );
>  }
>  error_propagate(errp, err);
> +qapi_free_SocketAddress(saddr);
>  }
>  
>  void unix_start_incoming_migration(const char *path, Error **errp)
>  {
>  SocketAddress *saddr = unix_build_address(path);
>  socket_start_incoming_migration(saddr, errp);
> +qapi_free_SocketAddress(saddr);
>  }
> -- 
> 2.7.4
> 
> 
--
Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK



Re: [Qemu-devel] [RFC PATCH] qdev: Mark devices as non-hotpluggable by default

2017-09-22 Thread Cédric Le Goater
On 09/22/2017 09:47 AM, Thomas Huth wrote:
> On 21.09.2017 20:50, Eduardo Habkost wrote:
>> On Tue, Sep 19, 2017 at 10:55:53AM +0200, Thomas Huth wrote:
>>> Historically we've marked all devices as hotpluggable by default. However,
>>> most devices are not hotpluggable, and you also need a HotplugHandler to
>>> support these devices. So if the user tries to "device_add" or "device_del"
>>> such a non-hotpluggable device during runtime, either nothing really usable
>>> happens, or QEMU even crashes/aborts unexpectedly (see for example commit
>>> 84ebd3e8c7d4fe955b - "Mark diag288 watchdog as non-hotpluggable").
>>> So let's change this dangerous default behaviour and mark the devices as
>>> non-hotpluggable by default. Certain parent devices classes which are known
>>> as hotpluggable (e.g. PCI, USB, etc.) are marked with "hotpluggable = true",
>>> so that devices that are derived from these classes continue to work as
>>> expected.
>>
>> These seem to be missing:
>> * TYPE_CPU (or at least TYPE_X86_CPU and TYPE_S390_CPU)
>> * TYPE_VIRTIO_SERIAL_PORT
>> * TYPE_CCID_CARD
>> * TYPE_XENSYSDEV
> 
> Thanks for the detailed examination, Eduardo! I'll rework my patch
> accordingly...
> 
>> Also, I don't think we need to set it for TYPE_CPU_CORE, just for
>> TYPE_SPAPR_CPU_CORE.
> 
> Ok - you're likely right. There is one other consumer of TYPE_CPU_CORE
> beside spapr, which is the pnv machine, and as far as I can see, it does
> not support CPU hotplugging yet. So it indeed makes more sense to set
> this in TYPE_SPAPR_CPU_CORE only.

I don't think pnv will ever support CPU hotplugging. The HW platform 
doesn't but CPU hot unplugging should be as CPU can fail and that
is supported by the firmware and Linux.

But I guess the right decision for pnv now is to just not support
CPU hotplug.

Thanks,

C. 



[Qemu-devel] [PULL v3 00/32] Misc patches for 2017-09-22

2017-09-22 Thread Paolo Bonzini
The following changes since commit b62b7ed0fc9c58e373b8946c9bd2e193be98dae6:

  Merge remote-tracking branch 'remotes/gkurz/tags/for-upstream' into staging 
(2017-09-20 20:33:48 +0100)

are available in the git repository at:

  git://github.com/bonzini/qemu.git tags/for-upstream

for you to fetch changes up to bb86d05f4afab3ebfee2e897e295d61dbd8cc28e:

  chardev: remove context in chr_update_read_handler (2017-09-22 21:07:27 +0200)


* Speed up AddressSpaceDispatch creation (Alexey)
* Fix kvm.c assert (David)
* Memory fixes and further speedup (me)
* Persistent reservation manager infrastructure (me)
* virtio-serial: add enable_backend callback (Pavel)
* chardev GMainContext fixes (Peter)


Alexey Kardashevskiy (17):
  exec: Explicitly export target AS from address_space_translate_internal
  memory: Open code FlatView rendering
  memory: Move FlatView allocation to a helper
  memory: Move AddressSpaceDispatch from AddressSpace to FlatView
  memory: Remove AddressSpace pointer from AddressSpaceDispatch
  memory: Switch memory from using AddressSpace to FlatView
  memory: Cleanup after switching to FlatView
  memory: Rename mem_begin/mem_commit/mem_add helpers
  memory: Store physical root MR in FlatView
  memory: Alloc dispatch tree where topology is generared
  memory: Move address_space_update_ioeventfds
  memory: Share FlatView's and dispatch trees between address spaces
  memory: Do not allocate FlatView in address_space_init
  memory: Rework "info mtree" to print flat views and dispatch trees
  memory: Get rid of address_space_init_shareable
  memory: Create FlatView directly
  memory: Share special empty FlatView

David Hildenbrand (1):
  kvm: drop wrong assertion creating problems with pflash

KONRAD Frederic (1):
  memory: avoid a name clash with access macro

Paolo Bonzini (8):
  atomic: update documentation
  memory: avoid "resurrection" of dead FlatViews
  memory: trace FlatView creation and destruction
  memory: seek FlatView sharing candidates among children subregions
  scsi, file-posix: add support for persistent reservation management
  scsi: build qemu-pr-helper
  scsi: add multipath support to qemu-pr-helper
  scsi: add persistent reservation manager using qemu-pr-helper

Pavel Butsykin (1):
  virtio-serial: add enable_backend callback

Peter Xu (4):
  chardev: new qemu_chr_be_update_read_handlers()
  chardev: add Chardev.gcontext field
  chardev: use per-dev context for io_add_watch_poll
  chardev: remove context in chr_update_read_handler

 Makefile  |7 +-
 Makefile.objs |1 +
 accel/kvm/kvm-all.c   |1 -
 block/file-posix.c|   30 ++
 chardev/char-fd.c |5 +-
 chardev/char-fe.c |7 +-
 chardev/char-pty.c|5 +-
 chardev/char-socket.c |7 +-
 chardev/char-udp.c|5 +-
 chardev/char.c|   11 +
 configure |   60 ++-
 cpus.c|5 +-
 docs/devel/atomics.txt|   14 +-
 docs/interop/pr-helper.rst|   83 +++
 docs/pr-manager.rst   |  111 
 exec.c|  330 +++-
 hmp-commands-info.hx  |7 +-
 hw/arm/armv7m.c   |9 +-
 hw/char/virtio-console.c  |   21 +
 hw/char/virtio-serial-bus.c   |7 +
 hw/intc/openpic_kvm.c |2 +-
 include/chardev/char.h|   13 +-
 include/exec/memory-internal.h|   16 +-
 include/exec/memory.h |   75 ++-
 include/hw/arm/armv7m.h   |2 +-
 include/hw/virtio/virtio-serial.h |3 +
 include/qemu/atomic.h |8 +
 include/qemu/typedefs.h   |1 +
 include/scsi/pr-manager.h |   56 ++
 include/scsi/utils.h  |4 +
 memory.c  |  378 ++---
 monitor.c |3 +-
 qapi/block-core.json  |4 +
 scsi/Makefile.objs|2 +
 scsi/pr-helper.h  |   41 ++
 scsi/pr-manager-helper.c  |  302 +++
 scsi/pr-manager.c |  109 
 scsi/qemu-pr-helper.c | 1075 +
 scsi/trace-events |3 +
 scsi/utils.c  |   10 +
 target/arm/cpu.c  |   16 +-
 target/i386/cpu.c |5 +-
 trace-events  |3 +
 vl.c  |3 +-
 44 files changed, 2550 insertions(+), 310 deletions(-)
 create mode 100644 docs/interop/pr-helper.rst
 create mode 100644 docs/pr-manager.rst
 create mode 100644 include/scsi/pr-manager.h
 create 

Re: [Qemu-devel] [PULL 00/32] Misc patches for 2017-09-22 (v2)

2017-09-22 Thread Paolo Bonzini
On 22/09/2017 20:09, Peter Maydell wrote:
> On 22 September 2017 at 16:04, Paolo Bonzini  wrote:
>> The following changes since commit b62b7ed0fc9c58e373b8946c9bd2e193be98dae6:
>>
>>   Merge remote-tracking branch 'remotes/gkurz/tags/for-upstream' into 
>> staging (2017-09-20 20:33:48 +0100)
>>
>> are available in the git repository at:
>>
>>   git://github.com/bonzini/qemu.git tags/for-upstream
>>
>> for you to fetch changes up to 8acf7b48e0098198057db048340606c7fbfc6518:
>>
>>   chardev: remove context in chr_update_read_handler (2017-09-22 14:03:27 
>> +0200)
>>
>> v2 fixes some issues with the new qemu-pr-helper.  make install and systemd
>> socket activation were broken.  I have now backported it to the Fedora QEMU
>> packages to shake out any distro-level issues.
>>
>> 
>> * Speed up AddressSpaceDispatch creation (Alexey)
>> * Fix kvm.c assert (David)
>> * Memory fixes and further speedup (me)
>> * Persistent reservation manager infrastructure (me)
>> * virtio-serial: add enable_backend callback (Pavel)
>> * chardev GMainContext fixes (Peter)
> 
> In today's episode of "compiler whinges" we have
> 
> /home/pm215/qemu/scsi/qemu-pr-helper.c: In function ‘main’:
> /home/pm215/qemu/scsi/qemu-pr-helper.c:912:5: error: comparison is
> always true due to limited range of data type [-Werror=type-limits]
>  while ((ch = getopt_long(argc, argv, sopt, lopt, _ind)) != -1) {
>  ^
> 
> (reported by the gcc on my ppc64, s390x, aarch64, aarch32 setups).
> 
> This one's a genuine bug, I think: ch is a char, which is unsigned on
> these systems, and so the loop would never terminate.

Yes, it is a bug.  I copied the line from qemu-nbd, but qemu-nbd has
"int ch".

Paolo



Re: [Qemu-devel] [PATCH RFC] accel: default to an actually available accelerator

2017-09-22 Thread Eduardo Habkost
On Mon, Sep 11, 2017 at 01:51:54PM +0200, Paolo Bonzini wrote:
> On 07/09/2017 10:11, Kevin Wolf wrote:
> > Am 06.09.2017 um 13:29 hat Cornelia Huck geschrieben:
> >> On Wed,  6 Sep 2017 11:49:27 +0200
> >> Cornelia Huck  wrote:
> >>
> >>> configure_accelerator() falls back to tcg if no accelerator has
> >>> been specified. Formerly, we could be sure that tcg is always
> >>> available; however, with --disable-tcg, this is not longer true,
> >>> and you are not able to start qemu without explicitly specifying
> >>> another accelerator on those builds.
> >>>
> >>> Instead, choose an accelerator in the order tcg->kvm->xen->hax.
> >>>
> >>> Signed-off-by: Cornelia Huck 
> >>> ---
> >>>
> >>> RFC mainly because this breaks iotest 186 in a different way on a
> >>> tcg-less x86_64 build: Before, it fails with "-machine accel=tcg: No
> >>> accelerator found"; afterwards, there seems to be a difference in
> >>> output due to different autogenerated devices. Not sure how to handle
> >>> that.
> >>>
> >>> cc:ing some hopefully interested folks (-ENOMAINTAINER again).
> >>>
> >>> ---
> >>>  accel/accel.c  | 22 --
> >>>  arch_init.c| 17 +
> >>>  include/sysemu/arch_init.h |  2 ++
> >>>  qemu-options.hx|  6 --
> >>>  4 files changed, 43 insertions(+), 4 deletions(-)
> >>>
> >>> diff --git a/accel/accel.c b/accel/accel.c
> >>> index 8ae40e1e13..26a3f32627 100644
> >>> --- a/accel/accel.c
> >>> +++ b/accel/accel.c
> >>> @@ -68,6 +68,25 @@ static int accel_init_machine(AccelClass *acc, 
> >>> MachineState *ms)
> >>>  return ret;
> >>>  }
> >>>  
> >>> +static const char *default_accelerator(void)
> >>> +{
> >>> +if (tcg_available()) {
> >>> +return "tcg";
> >>> +}
> >>> +if (kvm_available()) {
> >>> +return "kvm";
> >>> +}
> >>> +if (xen_available()) {
> >>> +return "xen";
> >>> +}
> >>> +if (hax_available()) {
> >>> +return "hax";
> >>> +}
> >>> +/* configure makes sure we have at least one accelerator */
> >>> +g_assert(false);
> >>> +return "";
> >>> +}
> >>> +
> >>>  void configure_accelerator(MachineState *ms)
> >>>  {
> >>>  const char *accel, *p;
> >>> @@ -79,8 +98,7 @@ void configure_accelerator(MachineState *ms)
> >>>  
> >>>  accel = qemu_opt_get(qemu_get_machine_opts(), "accel");
> >>>  if (accel == NULL) {
> >>> -/* Use the default "accelerator", tcg */
> >>> -accel = "tcg";
> >>> +accel = default_accelerator();
> >>
> >> It actually may be easier to just switch the default to
> >> "tcg:kvm:xen:hax". Haven't tested that, though.
> > 
> > This would have been my first thought and looks a bit simpler, so if
> > it works, I'd go for it.
> > 
> > But the real reason why I'm replying: Should we add changing the default
> > to "kvm:tcg" to the list of planned 3.0 changes? I am part of the group
> > that intentionally uses TCG occasionally, but I think the majority of
> > users wants to use KVM (or whatever the fastest option is on their
> > system) whenever it is available.
> 
> Yes, the only thing to be clarified is the default family/model/stepping
> for "-accel kvm".  "-cpu qemu64" with KVM uses an AMD f/m/s and Intel as
> the vendor, and some software (IIRC the GMP testsuite or something like
> that) doesn't like it.  We should probably change qemu64 to a core2
> f/m/s or something like that when running under KVM.  Eduardo?

The current f/m/s was supposed to make sense for both AMD and
Intel CPUs, to avoid requiring per-cpu-vendor defaults.  If we
find a more recent f/m/s combination that still makes some sense
for both vendors, changing it will be very simple.

Long term, however, we should probably add per-cpu-vendor
defaults to make this more flexible.

-- 
Eduardo



Re: [Qemu-devel] [PULL 00/32] Misc patches for 2017-09-22 (v2)

2017-09-22 Thread Peter Maydell
On 22 September 2017 at 16:04, Paolo Bonzini  wrote:
> The following changes since commit b62b7ed0fc9c58e373b8946c9bd2e193be98dae6:
>
>   Merge remote-tracking branch 'remotes/gkurz/tags/for-upstream' into staging 
> (2017-09-20 20:33:48 +0100)
>
> are available in the git repository at:
>
>   git://github.com/bonzini/qemu.git tags/for-upstream
>
> for you to fetch changes up to 8acf7b48e0098198057db048340606c7fbfc6518:
>
>   chardev: remove context in chr_update_read_handler (2017-09-22 14:03:27 
> +0200)
>
> v2 fixes some issues with the new qemu-pr-helper.  make install and systemd
> socket activation were broken.  I have now backported it to the Fedora QEMU
> packages to shake out any distro-level issues.
>
> 
> * Speed up AddressSpaceDispatch creation (Alexey)
> * Fix kvm.c assert (David)
> * Memory fixes and further speedup (me)
> * Persistent reservation manager infrastructure (me)
> * virtio-serial: add enable_backend callback (Pavel)
> * chardev GMainContext fixes (Peter)

In today's episode of "compiler whinges" we have

/home/pm215/qemu/scsi/qemu-pr-helper.c: In function ‘main’:
/home/pm215/qemu/scsi/qemu-pr-helper.c:912:5: error: comparison is
always true due to limited range of data type [-Werror=type-limits]
 while ((ch = getopt_long(argc, argv, sopt, lopt, _ind)) != -1) {
 ^

(reported by the gcc on my ppc64, s390x, aarch64, aarch32 setups).

This one's a genuine bug, I think: ch is a char, which is unsigned on
these systems, and so the loop would never terminate.

thanks
-- PMM



Re: [Qemu-devel] [Qemu-trivial] [PATCH 23/34] hw/dma/i8257: rename DMA_init() to i8257_dma_init()

2017-09-22 Thread Philippe Mathieu-Daudé

On 09/22/2017 02:43 PM, Hervé Poussineau wrote:

Le 22/09/2017 à 18:01, Philippe Mathieu-Daudé a écrit :

[...]

+void i8257_dma_init(ISABus *bus, int high_page_enable);
+


As you're changing the DMA_init prototype, can you add an Error **errp 
parameter, and pass _abort in each caller?


See http://lists.gnu.org/archive/html/qemu-devel/2017-09/msg00262.html 
for more details


If Eduardo doesn't have a patch ready I can do it.



Re: [Qemu-devel] [PATCH 13/34] hw/ide: remove old i386 dependency

2017-09-22 Thread John Snow


On 09/22/2017 11:39 AM, Philippe Mathieu-Daudé wrote:
> and remove a duplicated include
> 
> Signed-off-by: Philippe Mathieu-Daudé 

Acked-by: John Snow 



Re: [Qemu-devel] [PATCH v2 3/4] fw_cfg: write vmcoreinfo details

2017-09-22 Thread kbuild test robot
Hi Marc-André,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.14-rc1 next-20170922]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/marcandre-lureau-redhat-com/fw_cfg-add-DMA-operations-etc-vmcoreinfo-support/20170922-182716
config: i386-randconfig-c0-0956 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All errors (new ones prefixed by >>):

   drivers/firmware/qemu_fw_cfg.o: In function `fw_cfg_register_dir_entries':
>> qemu_fw_cfg.c:(.text+0x8af): undefined reference to `paddr_vmcoreinfo_note'

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [Qemu-devel] [PATCH 02/34] hw: remove "qemu/osdep.h" from header files

2017-09-22 Thread Philippe Mathieu-Daudé

On 09/22/2017 01:07 PM, Peter Maydell wrote:

On 22 September 2017 at 16:39, Philippe Mathieu-Daudé  wrote:

while here, add entries for ppc4xx_i2c in MAINTAINERS

applied using ./scripts/clean-includes

Signed-off-by: Philippe Mathieu-Daudé 
---


This is doing two things at once and would ideally be
two patches. Still,


OK I'll split "while here" patches.



Reviewed-by: Peter Maydell 


Thanks!



Re: [Qemu-devel] [PATCH 23/34] hw/dma/i8257: rename DMA_init() to i8257_dma_init()

2017-09-22 Thread Hervé Poussineau

Hi,

Le 22/09/2017 à 18:01, Philippe Mathieu-Daudé a écrit :

- move the header from hw/isa/ to hw/dma/
- add entry for i82374 in MAINTAINERS
- remove the old i386/pc dependency

Signed-off-by: Philippe Mathieu-Daudé 
---
  include/hw/{isa/i8257.h => dma/i8257_dma.h} | 6 ++
  include/hw/isa/isa.h| 2 --
  hw/dma/i82374.c | 3 ++-
  hw/dma/i8257.c  | 4 ++--
  hw/i386/pc.c| 3 ++-
  hw/mips/mips_fulong2e.c | 3 ++-
  hw/mips/mips_jazz.c | 3 ++-
  hw/mips/mips_malta.c| 3 ++-
  hw/sparc/sun4m.c| 4 
  hw/sparc64/sun4u.c  | 4 
  MAINTAINERS | 2 ++
  11 files changed, 20 insertions(+), 17 deletions(-)
  rename include/hw/{isa/i8257.h => dma/i8257_dma.h} (86%)

diff --git a/include/hw/isa/i8257.h b/include/hw/dma/i8257_dma.h
similarity index 86%
rename from include/hw/isa/i8257.h
rename to include/hw/dma/i8257_dma.h
index 88a2766a3f..0041565177 100644
--- a/include/hw/isa/i8257.h
+++ b/include/hw/dma/i8257_dma.h
@@ -1,6 +1,10 @@
  #ifndef HW_I8257_H
  #define HW_I8257_H
  
+#include "hw/hw.h"

+#include "hw/isa/isa.h"
+#include "exec/ioport.h"
+
  #define TYPE_I8257 "i8257"
  
  typedef struct I8257Regs {

@@ -40,4 +44,6 @@ typedef struct I8257State {
  PortioList portio_pageh;
  } I8257State;
  
+void i8257_dma_init(ISABus *bus, int high_page_enable);

+


As you're changing the DMA_init prototype, can you add an Error **errp 
parameter,
and pass _abort in each caller?

See http://lists.gnu.org/archive/html/qemu-devel/2017-09/msg00262.html for more 
details

Hervé


  #endif
diff --git a/include/hw/isa/isa.h b/include/hw/isa/isa.h
index 95593408ef..b9dbab24b4 100644
--- a/include/hw/isa/isa.h
+++ b/include/hw/isa/isa.h
@@ -151,6 +151,4 @@ static inline ISABus *isa_bus_from_device(ISADevice *d)
  return ISA_BUS(qdev_get_parent_bus(DEVICE(d)));
  }
  
-/* i8257.c */

-void DMA_init(ISABus *bus, int high_page_enable);
  #endif
diff --git a/hw/dma/i82374.c b/hw/dma/i82374.c
index 6c0f975df0..4048bedcf2 100644
--- a/hw/dma/i82374.c
+++ b/hw/dma/i82374.c
@@ -24,6 +24,7 @@
  
  #include "qemu/osdep.h"

  #include "hw/isa/isa.h"
+#include "hw/dma/i8257_dma.h"
  
  #define TYPE_I82374 "i82374"

  #define I82374(obj) OBJECT_CHECK(I82374State, (obj), TYPE_I82374)
@@ -123,7 +124,7 @@ static void i82374_realize(DeviceState *dev, Error **errp)
  portio_list_add(>port_list, isa_address_space_io(>parent_obj),
  s->iobase);
  
-DMA_init(isa_bus_from_device(ISA_DEVICE(dev)), 1);

+i8257_dma_init(isa_bus_from_device(ISA_DEVICE(dev)), 1);
  memset(s->commands, 0, sizeof(s->commands));
  }
  
diff --git a/hw/dma/i8257.c b/hw/dma/i8257.c

index bd23e893bf..a8f26b003b 100644
--- a/hw/dma/i8257.c
+++ b/hw/dma/i8257.c
@@ -24,7 +24,7 @@
  #include "qemu/osdep.h"
  #include "hw/hw.h"
  #include "hw/isa/isa.h"
-#include "hw/isa/i8257.h"
+#include "hw/dma/i8257_dma.h"
  #include "qemu/main-loop.h"
  #include "trace.h"
  
@@ -622,7 +622,7 @@ static void i8257_register_types(void)
  
  type_init(i8257_register_types)
  
-void DMA_init(ISABus *bus, int high_page_enable)

+void i8257_dma_init(ISABus *bus, int high_page_enable)
  {
  ISADevice *isa1, *isa2;
  DeviceState *d;
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 3aa10c780b..76d4be5991 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -39,6 +39,7 @@
  #include "elf.h"
  #include "multiboot.h"
  #include "hw/timer/mc146818rtc.h"
+#include "hw/dma/i8257_dma.h"
  #include "hw/timer/i8254.h"
  #include "hw/input/i8042.h"
  #include "hw/audio/pcspk.h"
@@ -1582,7 +1583,7 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
  port92_init(port92, a20_line[1]);
  g_free(a20_line);
  
-DMA_init(isa_bus, 0);

+i8257_dma_init(isa_bus, 0);
  
  for(i = 0; i < MAX_FD; i++) {

  fd[i] = drive_get(IF_FLOPPY, 0, i);
diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c
index a35745a407..6dc6a0ac18 100644
--- a/hw/mips/mips_fulong2e.c
+++ b/hw/mips/mips_fulong2e.c
@@ -22,6 +22,7 @@
  #include "qapi/error.h"
  #include "hw/hw.h"
  #include "hw/i386/pc.h"
+#include "hw/dma/i8257_dma.h"
  #include "hw/char/serial.h"
  #include "hw/block/fdc.h"
  #include "net/net.h"
@@ -365,7 +366,7 @@ static void mips_fulong2e_init(MachineState *machine)
  
  /* init other devices */

  pit = i8254_pit_init(isa_bus, 0x40, 0, NULL);
-DMA_init(isa_bus, 0);
+i8257_dma_init(isa_bus, 0);
  
  /* Super I/O */

  isa_create_simple(isa_bus, TYPE_I8042);
diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c
index 1bbef7eeb5..1b54602c1d 100644
--- a/hw/mips/mips_jazz.c
+++ b/hw/mips/mips_jazz.c
@@ -27,6 +27,7 @@
  #include "hw/mips/mips.h"
  #include "hw/mips/cpudevs.h"
  #include "hw/i386/pc.h"
+#include "hw/dma/i8257_dma.h"
  

[Qemu-devel] qemu-ppc 'tweq' vs gdb

2017-09-22 Thread John Reiser

"qemu-ppc -g 1234 foo" emulating the 32-bit PowerPC instruction 0x7c88
("tweq r0,r0") terminates with "fatal: Tried to call a TRAP".
Instead, when co-operating with gdbserver (-g ) then qemu-ppc
should generate a SIGTRAP, just like real execution under gdb.

The "tweq r0,r0" and others are useful as compiled-in breakpoints,
particularly when the location is within just-in-time compiled code.
They also can be used without gdb (in which case execution aborts
if the trap is true), and even with gdb if the condition is false
then they are thousands of times faster than a gdb breakpoint
that has a conditional stop.

--
John



Re: [Qemu-devel] [PATCH v5 0/7] Generalize MDIO framework

2017-09-22 Thread Alistair Francis
On Fri, Sep 22, 2017 at 10:13 AM, Philippe Mathieu-Daudé
 wrote:
> Hi,
>
> I have a follow up series using multiples PHY on the MDIO bus based on this
> series.

I haven't looked at this yet, but it looks interesting.

We actually have this concept merged in our tree and it works pretty
well. You can see it here:
https://github.com/Xilinx/qemu/tree/master/hw/mdio

Thanks,
Alistair

>
> Regards,
>
> Phil.
>
> Grant's previous work:
> http://lists.nongnu.org/archive/html/qemu-devel/2013-02/msg00257.html
>
> "There is more work to be done, particularly in moving to the common GPIO api,
>  but that work can be done as a follow on patch series."
>
> Grant Likely (7):
>   hw/mdio: Generalize etraxfs MDIO bitbanging emulation
>   hw/mdio: Add PHY register definition
>   hw/mdio: Generalize phy initialization routine
>   hw/mdio: Mask out read-only bits.
>   hw/mdio: Refactor bitbanging state machine
>   hw/mdio: Add VMState support
>   hw/mdio: Use bitbang core for smc91c111 network device
>
>  include/hw/net/mdio.h   | 124 +
>  hw/net/etraxfs_eth.c| 291 
> +---
>  hw/net/mdio.c   | 280 ++
>  hw/net/smc91c111.c  |  27 -
>  hw/net/xilinx_axienet.c | 189 +--
>  hw/net/Makefile.objs|   2 +
>  6 files changed, 438 insertions(+), 475 deletions(-)
>  create mode 100644 include/hw/net/mdio.h
>  create mode 100644 hw/net/mdio.c
>
> --
> 2.14.1
>
>



Re: [Qemu-devel] [Qemu-arm] [PATCH 17/20] target/arm: Implement SG instruction

2017-09-22 Thread Peter Maydell
On 22 September 2017 at 16:00, Peter Maydell  wrote:
> Implement the SG instruction, which we emulate 'by hand' in the
> exception handling code path.

I've just realised that this patch is correct as far as it goes
but it only implements the common path case for SG (where it is
in S memory and executed by a CPU in NS state). There is
also defined behaviour for:
 * SG in NS memory (behaves as a NOP)
 * SG in S memory and CPU already secure (clears IT bits and
   does nothing else)

Those can be implemented in translate.c in the usual way;
I'll put a patch for that in the next set (or in a respin
of this set).

thanks
-- PMM



[Qemu-devel] [PATCH v5 4/7] hw/mdio: Mask out read-only bits.

2017-09-22 Thread Philippe Mathieu-Daudé
From: Grant Likely 

The RST and ANEG_RST bits are commands, not settings. An operating
system will get confused (or at least u-boot does) if those bits remain
set after writing to them. Therefore, mask them out on write.

Similarly, no bits in the ID1, ID2, and remote capability registers are
writeable; so mask them out also.

Signed-off-by: Grant Likely 
Signed-off-by: Philippe Mathieu-Daudé 
[PMD: just rebased]
---
 include/hw/net/mdio.h |  1 +
 hw/net/mdio.c | 16 
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/include/hw/net/mdio.h b/include/hw/net/mdio.h
index b3b4f497c0..ed1879a728 100644
--- a/include/hw/net/mdio.h
+++ b/include/hw/net/mdio.h
@@ -53,6 +53,7 @@
 
 struct qemu_phy {
 uint32_t regs[NUM_PHY_REGS];
+const uint16_t *regs_readonly_mask; /* 0=writable, 1=read-only */
 
 int link;
 
diff --git a/hw/net/mdio.c b/hw/net/mdio.c
index 33bfbb4623..89a6a3a590 100644
--- a/hw/net/mdio.c
+++ b/hw/net/mdio.c
@@ -109,17 +109,24 @@ static unsigned int mdio_phy_read(struct qemu_phy *phy, 
unsigned int req)
 
 static void mdio_phy_write(struct qemu_phy *phy, unsigned int req, unsigned 
int data)
 {
-int regnum;
+int regnum = req & 0x1f;
+uint16_t mask = phy->regs_readonly_mask[regnum];
 
-regnum = req & 0x1f;
-D(printf("%s reg[%d] = %x\n", __func__, regnum, data));
+D(printf("%s reg[%d] = %x; mask=%x\n", __func__, regnum, data, mask));
 switch (regnum) {
 default:
-phy->regs[regnum] = data;
+phy->regs[regnum] = (phy->regs[regnum] & mask) | (data & ~mask);
 break;
 }
 }
 
+static const uint16_t default_readonly_mask[32] = {
+[PHY_CTRL] = PHY_CTRL_RST | PHY_CTRL_ANEG_RST,
+[PHY_ID1] = 0x,
+[PHY_ID2] = 0x,
+[PHY_LP_ABILITY] = 0x,
+};
+
 void mdio_phy_init(struct qemu_phy *phy, uint16_t id1, uint16_t id2)
 {
 phy->regs[PHY_CTRL] = 0x3100;
@@ -128,6 +135,7 @@ void mdio_phy_init(struct qemu_phy *phy, uint16_t id1, 
uint16_t id2)
 phy->regs[PHY_ID2] = id2;
 /* Autonegotiation advertisement reg. */
 phy->regs[PHY_AUTONEG_ADV] = 0x01e1;
+phy->regs_readonly_mask = default_readonly_mask;
 phy->link = 1;
 
 phy->read = mdio_phy_read;
-- 
2.14.1




[Qemu-devel] [PATCH v5 7/7] hw/mdio: Use bitbang core for smc91c111 network device

2017-09-22 Thread Philippe Mathieu-Daudé
From: Grant Likely 

The smc91c111 device has bitbanged MDIO access, but the model doesn't
yet implement it. This patch uses the generalized bitbang MDIO support
pulled out of etraxfs Ethernet driver.

The MDIO state machine is driven by changes in state to the clock
control bit in the management register. The PHY model emulated is
currently trivial (being whatever was done for the etraxfs driver), but
it is enough to get an OS to recognize a PHY as being present.

Tested with the versatilepb model with U-Boot and the Linux Kernel as
client software.

Updated .version_id and .minimum_version_id fields because this patch
add fields to the state structure.

Signed-off-by: Grant Likely 
Signed-off-by: Philippe Mathieu-Daudé 
[PMD: just rebased]
---
 hw/net/smc91c111.c | 27 ++-
 1 file changed, 22 insertions(+), 5 deletions(-)

diff --git a/hw/net/smc91c111.c b/hw/net/smc91c111.c
index 3b16dcf5a1..b5cc493f9f 100644
--- a/hw/net/smc91c111.c
+++ b/hw/net/smc91c111.c
@@ -11,6 +11,7 @@
 #include "hw/sysbus.h"
 #include "net/net.h"
 #include "hw/devices.h"
+#include "hw/net/mdio.h"
 /* For crc32 */
 #include 
 
@@ -49,12 +50,16 @@ typedef struct {
 uint8_t int_level;
 uint8_t int_mask;
 MemoryRegion mmio;
+
+/* MDIO bus and the attached phy */
+struct qemu_mdio mdio_bus;
+struct qemu_phy phy;
 } smc91c111_state;
 
 static const VMStateDescription vmstate_smc91c111 = {
 .name = "smc91c111",
-.version_id = 1,
-.minimum_version_id = 1,
+.version_id = 2,
+.minimum_version_id = 2,
 .fields = (VMStateField[]) {
 VMSTATE_UINT16(tcr, smc91c111_state),
 VMSTATE_UINT16(rcr, smc91c111_state),
@@ -76,6 +81,8 @@ static const VMStateDescription vmstate_smc91c111 = {
 VMSTATE_BUFFER_UNSAFE(data, smc91c111_state, 0, NUM_PACKETS * 2048),
 VMSTATE_UINT8(int_level, smc91c111_state),
 VMSTATE_UINT8(int_mask, smc91c111_state),
+VMSTATE_MDIO(mdio_bus, smc91c111_state),
+VMSTATE_MDIO_PHY(phy, smc91c111_state),
 VMSTATE_END_OF_LIST()
 }
 };
@@ -466,7 +473,15 @@ static void smc91c111_writeb(void *opaque, hwaddr offset,
 /* Multicast table.  */
 /* Not implemented.  */
 return;
-case 8: case 9: /* Management Interface.  */
+case 8: /* Management Interface.  */
+/* Update MDIO data line status; but only if output is enabled */
+if (value & 8) {
+mdio_bitbang_set_data(>mdio_bus, !!(value & 1));
+}
+/* Process the clock */
+mdio_bitbang_set_clk(>mdio_bus, value & 4);
+return;
+case 9: /* Management Interface.  */
 /* Not implemented.  */
 return;
 case 12: /* Early receive.  */
@@ -606,8 +621,7 @@ static uint32_t smc91c111_readb(void *opaque, hwaddr offset)
 /* Not implemented.  */
 return 0;
 case 8: /* Management Interface.  */
-/* Not implemented.  */
-return 0x30;
+return 0x30 | (mdio_bitbang_get_data(>mdio_bus) ? 2 : 0);
 case 9:
 return 0x33;
 case 10: /* Revision.  */
@@ -774,6 +788,9 @@ static int smc91c111_init1(SysBusDevice *sbd)
 s->nic = qemu_new_nic(_smc91c111_info, >conf,
   object_get_typename(OBJECT(dev)), dev->id, s);
 qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a);
+
+mdio_phy_init(>phy, 0x0016, 0xf84);
+mdio_attach(>mdio_bus, >phy, 0);
 /* ??? Save/restore.  */
 return 0;
 }
-- 
2.14.1




[Qemu-devel] [PATCH v5 6/7] hw/mdio: Add VMState support

2017-09-22 Thread Philippe Mathieu-Daudé
From: Grant Likely 

The MDIO model needs to have VMState support before it can be used by
devices that support VMState. This patch adds VMState macros for both
qemu_mdio and qemu_phy.

Signed-off-by: Grant Likely 
Signed-off-by: Philippe Mathieu-Daudé 
[PMD: just rebased]
---
 include/hw/net/mdio.h | 22 ++
 hw/net/mdio.c | 30 ++
 2 files changed, 52 insertions(+)

diff --git a/include/hw/net/mdio.h b/include/hw/net/mdio.h
index 7fca19784e..b94e5ec337 100644
--- a/include/hw/net/mdio.h
+++ b/include/hw/net/mdio.h
@@ -25,6 +25,8 @@
  * THE SOFTWARE.
  */
 
+#include "migration/vmstate.h"
+
 /* PHY MII Register/Bit Definitions */
 /* PHY Registers defined by IEEE */
 #define PHY_CTRL 0x00 /* Control Register */
@@ -61,6 +63,16 @@ struct qemu_phy {
 void (*write)(struct qemu_phy *phy, unsigned int req, uint16_t data);
 };
 
+extern const VMStateDescription vmstate_mdio_phy;
+
+#define VMSTATE_MDIO_PHY(_field, _state) {   \
+.name   = (stringify(_field)),   \
+.size   = sizeof(struct qemu_phy),   \
+.vmsd   = _mdio_phy, \
+.flags  = VMS_STRUCT,\
+.offset = vmstate_offset_value(_state, _field, struct qemu_phy), \
+}
+
 struct qemu_mdio {
 /* bitbanging state machine */
 bool mdc;
@@ -83,6 +95,16 @@ struct qemu_mdio {
 struct qemu_phy *devs[32];
 };
 
+extern const VMStateDescription vmstate_mdio;
+
+#define VMSTATE_MDIO(_field, _state) { \
+.name   = (stringify(_field)), \
+.size   = sizeof(struct qemu_mdio),\
+.vmsd   = _mdio,   \
+.flags  = VMS_STRUCT,  \
+.offset = vmstate_offset_value(_state, _field, struct qemu_mdio),  \
+}
+
 void mdio_phy_init(struct qemu_phy *phy, uint16_t id1, uint16_t id2);
 void mdio_attach(struct qemu_mdio *bus, struct qemu_phy *phy,
  unsigned int addr);
diff --git a/hw/net/mdio.c b/hw/net/mdio.c
index 96e10fada0..6c13cc7272 100644
--- a/hw/net/mdio.c
+++ b/hw/net/mdio.c
@@ -248,3 +248,33 @@ void mdio_bitbang_set_clk(struct qemu_mdio *bus, bool mdc)
 break;
 }
 }
+
+const VMStateDescription vmstate_mdio = {
+.name = "mdio",
+.version_id = 1,
+.minimum_version_id = 1,
+.minimum_version_id_old = 1,
+.fields = (VMStateField[]) {
+VMSTATE_BOOL(mdc, struct qemu_mdio),
+VMSTATE_BOOL(mdio, struct qemu_mdio),
+VMSTATE_UINT32(state, struct qemu_mdio),
+VMSTATE_UINT16(cnt, struct qemu_mdio),
+VMSTATE_UINT16(addr, struct qemu_mdio),
+VMSTATE_UINT16(opc, struct qemu_mdio),
+VMSTATE_UINT16(req, struct qemu_mdio),
+VMSTATE_UINT32(shiftreg, struct qemu_mdio),
+VMSTATE_END_OF_LIST()
+}
+};
+
+const VMStateDescription vmstate_mdio_phy = {
+.name = "mdio",
+.version_id = 1,
+.minimum_version_id = 1,
+.minimum_version_id_old = 1,
+.fields = (VMStateField[]) {
+VMSTATE_UINT16_ARRAY(regs, struct qemu_phy, 32),
+VMSTATE_BOOL(link, struct qemu_phy),
+VMSTATE_END_OF_LIST()
+}
+};
-- 
2.14.1




[Qemu-devel] [PATCH v5 2/7] hw/mdio: Add PHY register definition

2017-09-22 Thread Philippe Mathieu-Daudé
From: Grant Likely 

Trivial patch to add #defines for defined PHY register address and bit fields

Signed-off-by: Grant Likely 
Signed-off-by: Philippe Mathieu-Daudé 
---
 include/hw/net/mdio.h | 24 ++--
 hw/net/mdio.c |  8 
 2 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/include/hw/net/mdio.h b/include/hw/net/mdio.h
index ac36aed3c3..7ffa4389b9 100644
--- a/include/hw/net/mdio.h
+++ b/include/hw/net/mdio.h
@@ -25,14 +25,34 @@
  * THE SOFTWARE.
  */
 
-/* PHY Advertisement control register */
+/* PHY MII Register/Bit Definitions */
+/* PHY Registers defined by IEEE */
+#define PHY_CTRL 0x00 /* Control Register */
+#define PHY_STATUS   0x01 /* Status Regiser */
+#define PHY_ID1  0x02 /* Phy Id Reg (word 1) */
+#define PHY_ID2  0x03 /* Phy Id Reg (word 2) */
+#define PHY_AUTONEG_ADV  0x04 /* Autoneg Advertisement */
+#define PHY_LP_ABILITY   0x05 /* Link Partner Ability (Base Page) */
+#define PHY_AUTONEG_EXP  0x06 /* Autoneg Expansion Reg */
+#define PHY_NEXT_PAGE_TX 0x07 /* Next Page TX */
+#define PHY_LP_NEXT_PAGE 0x08 /* Link Partner Next Page */
+#define PHY_1000T_CTRL   0x09 /* 1000Base-T Control Reg */
+#define PHY_1000T_STATUS 0x0A /* 1000Base-T Status Reg */
+#define PHY_EXT_STATUS   0x0F /* Extended Status Reg */
+
+#define NUM_PHY_REGS 0x20  /* 5 bit address bus (0-0x1F) */
+
+#define PHY_CTRL_RST0x8000 /* PHY reset command */
+#define PHY_CTRL_ANEG_RST   0x0200 /* Autonegotiation reset command */
+
+/* PHY Advertisement control and remote capability registers (same bitfields) 
*/
 #define PHY_ADVERTISE_10HALF0x0020  /* Try for 10mbps half-duplex  */
 #define PHY_ADVERTISE_10FULL0x0040  /* Try for 10mbps full-duplex  */
 #define PHY_ADVERTISE_100HALF   0x0080  /* Try for 100mbps half-duplex */
 #define PHY_ADVERTISE_100FULL   0x0100  /* Try for 100mbps full-duplex */
 
 struct qemu_phy {
-uint32_t regs[32];
+uint32_t regs[NUM_PHY_REGS];
 
 int link;
 
diff --git a/hw/net/mdio.c b/hw/net/mdio.c
index 3763fcc8af..3d70d99077 100644
--- a/hw/net/mdio.c
+++ b/hw/net/mdio.c
@@ -122,12 +122,12 @@ static void tdk_write(struct qemu_phy *phy, unsigned int 
req, unsigned int data)
 
 void tdk_init(struct qemu_phy *phy)
 {
-phy->regs[0] = 0x3100;
+phy->regs[PHY_CTRL] = 0x3100;
 /* PHY Id. */
-phy->regs[2] = 0x0300;
-phy->regs[3] = 0xe400;
+phy->regs[PHY_ID1] = 0x0300;
+phy->regs[PHY_ID2] = 0xe400;
 /* Autonegotiation advertisement reg. */
-phy->regs[4] = 0x01e1;
+phy->regs[PHY_AUTONEG_ADV] = 0x01e1;
 phy->link = 1;
 
 phy->read = tdk_read;
-- 
2.14.1




[Qemu-devel] [PATCH v5 3/7] hw/mdio: Generalize phy initialization routine

2017-09-22 Thread Philippe Mathieu-Daudé
From: Grant Likely 

There really isn't anything tdk-specific about tdk_init() other than the
phy id registers. The function should instead be generalized for any
phy, at least as far as the ID registers are concerned. For the most
part the read/write behaviour should be very similar across PHYs.

This patch renames tdk_{read,write,init}() to mdio_phy_*() so it can be
used for any PHY.

More work definitely needs to be done here to make it easy to override
the default behaviour for specific PHYs, but this at least is a
reasonable start.

Signed-off-by: Grant Likely 
Signed-off-by: Philippe Mathieu-Daudé 
[PMD: just rebased]
---
 include/hw/net/mdio.h   |  2 +-
 hw/net/etraxfs_eth.c|  2 +-
 hw/net/mdio.c   | 14 +++---
 hw/net/xilinx_axienet.c |  2 +-
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/include/hw/net/mdio.h b/include/hw/net/mdio.h
index 7ffa4389b9..b3b4f497c0 100644
--- a/include/hw/net/mdio.h
+++ b/include/hw/net/mdio.h
@@ -86,7 +86,7 @@ struct qemu_mdio {
 struct qemu_phy *devs[32];
 };
 
-void tdk_init(struct qemu_phy *phy);
+void mdio_phy_init(struct qemu_phy *phy, uint16_t id1, uint16_t id2);
 void mdio_attach(struct qemu_mdio *bus, struct qemu_phy *phy,
  unsigned int addr);
 uint16_t mdio_read_req(struct qemu_mdio *bus, uint8_t addr, uint8_t req);
diff --git a/hw/net/etraxfs_eth.c b/hw/net/etraxfs_eth.c
index f8d8f8441d..4c5415771f 100644
--- a/hw/net/etraxfs_eth.c
+++ b/hw/net/etraxfs_eth.c
@@ -333,7 +333,7 @@ static int fs_eth_init(SysBusDevice *sbd)
 qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a);
 
 
-tdk_init(>phy);
+mdio_phy_init(>phy, 0x0300, 0xe400);
 mdio_attach(>mdio_bus, >phy, s->phyaddr);
 return 0;
 }
diff --git a/hw/net/mdio.c b/hw/net/mdio.c
index 3d70d99077..33bfbb4623 100644
--- a/hw/net/mdio.c
+++ b/hw/net/mdio.c
@@ -43,7 +43,7 @@
  * linux driver (PHYID and Diagnostics reg).
  * TODO: Add friendly names for the register nums.
  */
-static unsigned int tdk_read(struct qemu_phy *phy, unsigned int req)
+static unsigned int mdio_phy_read(struct qemu_phy *phy, unsigned int req)
 {
 int regnum;
 unsigned r = 0;
@@ -107,7 +107,7 @@ static unsigned int tdk_read(struct qemu_phy *phy, unsigned 
int req)
 return r;
 }
 
-static void tdk_write(struct qemu_phy *phy, unsigned int req, unsigned int 
data)
+static void mdio_phy_write(struct qemu_phy *phy, unsigned int req, unsigned 
int data)
 {
 int regnum;
 
@@ -120,18 +120,18 @@ static void tdk_write(struct qemu_phy *phy, unsigned int 
req, unsigned int data)
 }
 }
 
-void tdk_init(struct qemu_phy *phy)
+void mdio_phy_init(struct qemu_phy *phy, uint16_t id1, uint16_t id2)
 {
 phy->regs[PHY_CTRL] = 0x3100;
 /* PHY Id. */
-phy->regs[PHY_ID1] = 0x0300;
-phy->regs[PHY_ID2] = 0xe400;
+phy->regs[PHY_ID1] = id1;
+phy->regs[PHY_ID2] = id2;
 /* Autonegotiation advertisement reg. */
 phy->regs[PHY_AUTONEG_ADV] = 0x01e1;
 phy->link = 1;
 
-phy->read = tdk_read;
-phy->write = tdk_write;
+phy->read = mdio_phy_read;
+phy->write = mdio_phy_write;
 }
 
 void mdio_attach(struct qemu_mdio *bus, struct qemu_phy *phy, unsigned int 
addr)
diff --git a/hw/net/xilinx_axienet.c b/hw/net/xilinx_axienet.c
index 1e859fdaae..408cd6e675 100644
--- a/hw/net/xilinx_axienet.c
+++ b/hw/net/xilinx_axienet.c
@@ -791,7 +791,7 @@ static void xilinx_enet_realize(DeviceState *dev, Error 
**errp)
   object_get_typename(OBJECT(dev)), dev->id, s);
 qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a);
 
-tdk_init(>TEMAC.phy);
+mdio_phy_init(>TEMAC.phy, 0x0300, 0xe400);
 mdio_attach(>TEMAC.mdio_bus, >TEMAC.phy, s->c_phyaddr);
 
 s->TEMAC.parent = s;
-- 
2.14.1




[Qemu-devel] [PATCH v5 1/7] hw/mdio: Generalize etraxfs MDIO bitbanging emulation

2017-09-22 Thread Philippe Mathieu-Daudé
From: Grant Likely 

The etraxfs and Xilinx axienet Ethernet models implement quite a nice
MDIO core that supports both bitbanging and direct register access. This
change factors the common code out into a separate file. There are no
functional changes here, just movement of code.

The etraxfs and axienet are slightly different. The etraxfs version
includes the bitbang state processing, but the axienet version has a
minor enhancement for read/write of phy registers without using bitbang
state variables.  This patch generalizes the etraxfs version, with the
axienet change backported in.

Signed-off-by: Grant Likely 
Signed-off-by: Philippe Mathieu-Daudé 
[PMD: rebased with a minor checkpatch fix]
---
 include/hw/net/mdio.h   |  76 +
 hw/net/etraxfs_eth.c| 278 +---
 hw/net/mdio.c   | 262 +
 hw/net/xilinx_axienet.c | 187 +---
 hw/net/Makefile.objs|   2 +
 5 files changed, 344 insertions(+), 461 deletions(-)
 create mode 100644 include/hw/net/mdio.h
 create mode 100644 hw/net/mdio.c

diff --git a/include/hw/net/mdio.h b/include/hw/net/mdio.h
new file mode 100644
index 00..ac36aed3c3
--- /dev/null
+++ b/include/hw/net/mdio.h
@@ -0,0 +1,76 @@
+#ifndef BITBANG_MDIO_H
+#define BITBANG_MDIO_H
+
+/*
+ * QEMU Bitbang Ethernet MDIO bus & PHY controllers.
+ *
+ * Copyright (c) 2008 Edgar E. Iglesias, Axis Communications AB.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to 
deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/* PHY Advertisement control register */
+#define PHY_ADVERTISE_10HALF0x0020  /* Try for 10mbps half-duplex  */
+#define PHY_ADVERTISE_10FULL0x0040  /* Try for 10mbps full-duplex  */
+#define PHY_ADVERTISE_100HALF   0x0080  /* Try for 100mbps half-duplex */
+#define PHY_ADVERTISE_100FULL   0x0100  /* Try for 100mbps full-duplex */
+
+struct qemu_phy {
+uint32_t regs[32];
+
+int link;
+
+unsigned int (*read)(struct qemu_phy *phy, unsigned int req);
+void (*write)(struct qemu_phy *phy, unsigned int req, unsigned int data);
+};
+
+struct qemu_mdio {
+/* bus. */
+int mdc;
+int mdio;
+
+/* decoder.  */
+enum {
+PREAMBLE,
+SOF,
+OPC,
+ADDR,
+REQ,
+TURNAROUND,
+DATA
+} state;
+unsigned int drive;
+
+unsigned int cnt;
+unsigned int addr;
+unsigned int opc;
+unsigned int req;
+unsigned int data;
+
+struct qemu_phy *devs[32];
+};
+
+void tdk_init(struct qemu_phy *phy);
+void mdio_attach(struct qemu_mdio *bus, struct qemu_phy *phy,
+ unsigned int addr);
+uint16_t mdio_read_req(struct qemu_mdio *bus, uint8_t addr, uint8_t req);
+void mdio_write_req(struct qemu_mdio *bus, uint8_t addr, uint8_t req, uint16_t 
data);
+void mdio_cycle(struct qemu_mdio *bus);
+
+#endif
diff --git a/hw/net/etraxfs_eth.c b/hw/net/etraxfs_eth.c
index 013c8d0a41..f8d8f8441d 100644
--- a/hw/net/etraxfs_eth.c
+++ b/hw/net/etraxfs_eth.c
@@ -26,287 +26,11 @@
 #include "hw/sysbus.h"
 #include "net/net.h"
 #include "hw/cris/etraxfs.h"
+#include "hw/net/mdio.h"
 #include "qemu/error-report.h"
 
 #define D(x)
 
-/* Advertisement control register. */
-#define ADVERTISE_10HALF0x0020  /* Try for 10mbps half-duplex  */
-#define ADVERTISE_10FULL0x0040  /* Try for 10mbps full-duplex  */
-#define ADVERTISE_100HALF   0x0080  /* Try for 100mbps half-duplex */
-#define ADVERTISE_100FULL   0x0100  /* Try for 100mbps full-duplex */
-
-/*
- * The MDIO extensions in the TDK PHY model were reversed engineered from the
- * linux driver (PHYID and Diagnostics reg).
- * TODO: Add friendly names for the register nums.
- */
-struct qemu_phy
-{
-uint32_t regs[32];
-
-int link;
-
-unsigned int (*read)(struct qemu_phy *phy, unsigned int req);
-void (*write)(struct qemu_phy *phy, unsigned int 

[Qemu-devel] [PATCH v5 5/7] hw/mdio: Refactor bitbanging state machine

2017-09-22 Thread Philippe Mathieu-Daudé
From: Grant Likely 

The MDIO state machine has a moderate amount of duplicate code in the
state processing that can be consolidated. This patch does so and
reorganizes it a bit so that far less code is required. Most of the
states simply stream a fixed number of bits in as a single integer and
can be handled by a common processing function that checks for
completion of the state and returns the streamed in value.

Changes include:
- Move clock state change tracking into core code
- Use a common shift register for clocking data in and out
- Create separate mdc & mdio accessor functions
  - will be replaced with GPIO connection in a follow-on patch

Signed-off-by: Grant Likely 
Signed-off-by: Philippe Mathieu-Daudé 
[PMD: just rebased]
---
 include/hw/net/mdio.h |  41 ---
 hw/net/etraxfs_eth.c  |  11 ++--
 hw/net/mdio.c | 140 ++
 3 files changed, 87 insertions(+), 105 deletions(-)

diff --git a/include/hw/net/mdio.h b/include/hw/net/mdio.h
index ed1879a728..7fca19784e 100644
--- a/include/hw/net/mdio.h
+++ b/include/hw/net/mdio.h
@@ -52,37 +52,33 @@
 #define PHY_ADVERTISE_100FULL   0x0100  /* Try for 100mbps full-duplex */
 
 struct qemu_phy {
-uint32_t regs[NUM_PHY_REGS];
+uint16_t regs[NUM_PHY_REGS];
 const uint16_t *regs_readonly_mask; /* 0=writable, 1=read-only */
 
-int link;
+bool link;
 
-unsigned int (*read)(struct qemu_phy *phy, unsigned int req);
-void (*write)(struct qemu_phy *phy, unsigned int req, unsigned int data);
+uint16_t (*read)(struct qemu_phy *phy, unsigned int req);
+void (*write)(struct qemu_phy *phy, unsigned int req, uint16_t data);
 };
 
 struct qemu_mdio {
-/* bus. */
-int mdc;
-int mdio;
-
-/* decoder.  */
+/* bitbanging state machine */
+bool mdc;
+bool mdio;
 enum {
 PREAMBLE,
-SOF,
 OPC,
 ADDR,
 REQ,
 TURNAROUND,
 DATA
 } state;
-unsigned int drive;
 
-unsigned int cnt;
-unsigned int addr;
-unsigned int opc;
-unsigned int req;
-unsigned int data;
+uint16_t cnt; /* Bit count for current state */
+uint16_t addr; /* PHY Address; retrieved during ADDR state */
+uint16_t opc; /* Operation; 2:read */
+uint16_t req; /* Register address */
+uint32_t shiftreg; /* shift register; bits in to or out from PHY */
 
 struct qemu_phy *devs[32];
 };
@@ -91,7 +87,16 @@ void mdio_phy_init(struct qemu_phy *phy, uint16_t id1, 
uint16_t id2);
 void mdio_attach(struct qemu_mdio *bus, struct qemu_phy *phy,
  unsigned int addr);
 uint16_t mdio_read_req(struct qemu_mdio *bus, uint8_t addr, uint8_t req);
-void mdio_write_req(struct qemu_mdio *bus, uint8_t addr, uint8_t req, uint16_t 
data);
-void mdio_cycle(struct qemu_mdio *bus);
+void mdio_write_req(struct qemu_mdio *bus, uint8_t addr, uint8_t req,
+uint16_t data);
+void mdio_bitbang_set_clk(struct qemu_mdio *bus, bool mdc);
+static inline void mdio_bitbang_set_data(struct qemu_mdio *bus, bool mdio)
+{
+bus->mdio = mdio;
+}
+static inline bool mdio_bitbang_get_data(struct qemu_mdio *bus)
+{
+return bus->mdio;
+}
 
 #endif
diff --git a/hw/net/etraxfs_eth.c b/hw/net/etraxfs_eth.c
index 4c5415771f..1b518ea16e 100644
--- a/hw/net/etraxfs_eth.c
+++ b/hw/net/etraxfs_eth.c
@@ -119,7 +119,7 @@ eth_read(void *opaque, hwaddr addr, unsigned int size)
 
 switch (addr) {
 case R_STAT:
-r = eth->mdio_bus.mdio & 1;
+r = mdio_bitbang_get_data(>mdio_bus);
 break;
 default:
 r = eth->regs[addr];
@@ -177,13 +177,10 @@ eth_write(void *opaque, hwaddr addr,
 case RW_MGM_CTRL:
 /* Attach an MDIO/PHY abstraction.  */
 if (value & 2) {
-eth->mdio_bus.mdio = value & 1;
+mdio_bitbang_set_data(>mdio_bus, value & 1);
 }
-if (eth->mdio_bus.mdc != (value & 4)) {
-mdio_cycle(>mdio_bus);
-eth_validate_duplex(eth);
-}
-eth->mdio_bus.mdc = !!(value & 4);
+mdio_bitbang_set_clk(>mdio_bus, value & 4);
+eth_validate_duplex(eth);
 eth->regs[addr] = value;
 break;
 
diff --git a/hw/net/mdio.c b/hw/net/mdio.c
index 89a6a3a590..96e10fada0 100644
--- a/hw/net/mdio.c
+++ b/hw/net/mdio.c
@@ -43,7 +43,7 @@
  * linux driver (PHYID and Diagnostics reg).
  * TODO: Add friendly names for the register nums.
  */
-static unsigned int mdio_phy_read(struct qemu_phy *phy, unsigned int req)
+static uint16_t mdio_phy_read(struct qemu_phy *phy, unsigned int req)
 {
 int regnum;
 unsigned r = 0;
@@ -107,7 +107,8 @@ static unsigned int mdio_phy_read(struct qemu_phy *phy, 
unsigned int req)
 return r;
 }
 
-static void mdio_phy_write(struct qemu_phy *phy, unsigned int req, unsigned 
int data)
+static void mdio_phy_write(struct qemu_phy *phy, unsigned int req,
+ 

[Qemu-devel] [PATCH v5 0/7] Generalize MDIO framework

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

I have a follow up series using multiples PHY on the MDIO bus based on this
series.

Regards,

Phil.

Grant's previous work:
http://lists.nongnu.org/archive/html/qemu-devel/2013-02/msg00257.html

"There is more work to be done, particularly in moving to the common GPIO api,
 but that work can be done as a follow on patch series."

Grant Likely (7):
  hw/mdio: Generalize etraxfs MDIO bitbanging emulation
  hw/mdio: Add PHY register definition
  hw/mdio: Generalize phy initialization routine
  hw/mdio: Mask out read-only bits.
  hw/mdio: Refactor bitbanging state machine
  hw/mdio: Add VMState support
  hw/mdio: Use bitbang core for smc91c111 network device

 include/hw/net/mdio.h   | 124 +
 hw/net/etraxfs_eth.c| 291 +---
 hw/net/mdio.c   | 280 ++
 hw/net/smc91c111.c  |  27 -
 hw/net/xilinx_axienet.c | 189 +--
 hw/net/Makefile.objs|   2 +
 6 files changed, 438 insertions(+), 475 deletions(-)
 create mode 100644 include/hw/net/mdio.h
 create mode 100644 hw/net/mdio.c

-- 
2.14.1




Re: [Qemu-devel] [RFC 6/6] linux-user: update default socket.h

2017-09-22 Thread Laurent Vivier
Le 22/09/2017 à 16:02, Carlo Marcelo Arenas Belón a écrit :
> * enable SO_REUSEPORT as a sideeffect and add SO_GET_FILTER alias
> * make sure 64bit version for ppc is also supported

As previously TARGET_PPC64 is not needed.

And you should move powerpc bits to linux-user/ppc/sockbits.h

Thanks,
Laurent

> Signed-off-by: Carlo Marcelo Arenas Belón 
> ---
>  linux-user/socket.h | 61 
> ++---
>  1 file changed, 49 insertions(+), 12 deletions(-)
> 
> diff --git a/linux-user/socket.h b/linux-user/socket.h
> index 6fd486c6b1..c37c10822a 100644
> --- a/linux-user/socket.h
> +++ b/linux-user/socket.h
> @@ -27,8 +27,8 @@
>  #define TARGET_SO_PRIORITY 12
>  #define TARGET_SO_LINGER   13
>  #define TARGET_SO_BSDCOMPAT14
> -/* To add :#define TARGET_SO_REUSEPORT 15 */
> -#if defined(TARGET_PPC)
> +#define TARGET_SO_REUSEPORT15
> +#if defined(TARGET_PPC) || defined(TARGET_PPC64)
>  #define TARGET_SO_RCVLOWAT 16
>  #define TARGET_SO_SNDLOWAT 17
>  #define TARGET_SO_RCVTIMEO 18
> @@ -49,21 +49,58 @@
>  #define TARGET_SO_SECURITY_ENCRYPTION_TRANSPORT23
>  #define TARGET_SO_SECURITY_ENCRYPTION_NETWORK  24
>  
> -#define TARGET_SO_BINDTODEVICE 25
> +#define TARGET_SO_BINDTODEVICE25
>  
>  /* Socket filtering */
> -#define TARGET_SO_ATTACH_FILTER26
> -#define TARGET_SO_DETACH_FILTER27
> +#define TARGET_SO_ATTACH_FILTER   26
> +#define TARGET_SO_DETACH_FILTER   27
> +#define TARGET_SO_GET_FILTER  TARGET_SO_ATTACH_FILTER
>  
> -#define TARGET_SO_PEERNAME 28
> -#define TARGET_SO_TIMESTAMP29
> -#define TARGET_SCM_TIMESTAMP   TARGET_SO_TIMESTAMP
> +#define TARGET_SO_PEERNAME28
> +#define TARGET_SO_TIMESTAMP   29
> +#define TARGET_SCM_TIMESTAMP  TARGET_SO_TIMESTAMP
>  
> -#define TARGET_SO_ACCEPTCONN   30
> +#define TARGET_SO_ACCEPTCONN  30
>  
> -#define TARGET_SO_PEERSEC  31
> +#define TARGET_SO_PEERSEC 31
> +#define TARGET_SO_PASSSEC 34
> +#define TARGET_SO_TIMESTAMPNS 35
> +#define TARGET_SCM_TIMESTAMPNSTARGET_SO_TIMESTAMPNS
> +
> +#define TARGET_SO_MARK36
> +
> +#define TARGET_SO_TIMESTAMPING37
> +#define TARGET_SCM_TIMESTAMPING   TARGET_SO_TIMESTAMPING
> +
> +#define TARGET_SO_PROTOCOL38
> +#define TARGET_SO_DOMAIN  39
> +
> +#define TARGET_SO_RXQ_OVFL40
> +
> +#define TARGET_SO_WIFI_STATUS 41
> +#define TARGET_SCM_WIFI_STATUSTARGET_SO_WIFI_STATUS
> +#define TARGET_SO_PEEK_OFF42
> +
> +#define TARGET_SO_NOFCS   43
> +#define TARGET_SO_LOCK_FILTER 44
> +#define TARGET_SO_SELECT_ERR_QUEUE45
> +#define TARGET_SO_BUSY_POLL   46
> +#define TARGET_SO_MAX_PACING_RATE 47
> +#define TARGET_SO_BPF_EXTENSIONS  48
> +#define TARGET_SO_INCOMING_CPU49
> +#define TARGET_SO_ATTACH_BPF  50
> +#define TARGET_SO_DETACH_BPF  TARGET_SO_DETACH_FILTER
> +#define TARGET_SO_ATTACH_REUSEPORT_CBPF   51
> +#define TARGET_SO_ATTACH_REUSEPORT_EBPF   52
> +#define TARGET_SO_CNX_ADVICE  53
> +#define TARGET_SCM_TIMESTAMPING_OPT_STATS 54
> +#define TARGET_SO_MEMINFO 55
> +#define TARGET_SO_INCOMING_NAPI_ID56
> +#define TARGET_SO_COOKIE  57
> +#define TARGET_SCM_TIMESTAMPING_PKTINFO   58
> +#define TARGET_SO_PEERGROUPS  59
> +#define TARGET_SO_ZEROCOPY60
>  
> -#define TARGET_SO_PASSSEC  34
>  #endif
>  
>  #ifndef ARCH_HAS_SOCKET_TYPES
> @@ -94,6 +131,6 @@
>  };
>  
>  #define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1)
> -#define TARGET_SOCK_TYPE_MASK0xf  /* Covers up to TARGET_SOCK_MAX-1. 
> */
> +#define TARGET_SOCK_TYPE_MASK  0xf  /* Covers up to TARGET_SOCK_MAX - 1. 
> */
>  
>  #endif
> 




Re: [Qemu-devel] [RFC 5/6] linux-user: fix 64bit versions of sparc and mips

2017-09-22 Thread Laurent Vivier
Le 22/09/2017 à 16:02, Carlo Marcelo Arenas Belón a écrit :
> Signed-off-by: Carlo Marcelo Arenas Belón 
> ---
>  linux-user/mips64/sockbits.h  | 1 +
>  linux-user/socket.h   | 4 ++--
>  linux-user/sparc64/sockbits.h | 1 +

Who includes the two new files?

Moreover TARGET_MIPS/TARGET_SPARC (base arch) are always defined when
TARGET_MIPS64/TARGET_SPARC64 (target arch) are defined.

So I think this patch is useless.

Thanks,
Laurent

>  3 files changed, 4 insertions(+), 2 deletions(-)
>  create mode 100644 linux-user/mips64/sockbits.h
>  create mode 100644 linux-user/sparc64/sockbits.h
> 
> diff --git a/linux-user/mips64/sockbits.h b/linux-user/mips64/sockbits.h
> new file mode 100644
> index 00..e6b6d31ac9
> --- /dev/null
> +++ b/linux-user/mips64/sockbits.h
> @@ -0,0 +1 @@
> +#include "../mips/sockbits.h"
> diff --git a/linux-user/socket.h b/linux-user/socket.h
> index dfa692286b..6fd486c6b1 100644
> --- a/linux-user/socket.h
> +++ b/linux-user/socket.h
> @@ -1,10 +1,10 @@
> -#if defined(TARGET_MIPS)
> +#if defined(TARGET_MIPS) || defined(TARGET_MIPS64)
>  #include "mips/sockbits.h"
>  #elif defined(TARGET_ALPHA)
>  #include "alpha/sockbits.h"
>  #elif defined(TARGET_HPPA)
>  #include "hppa/sockbits.h"
> -#elif defined(TARGET_SPARC)
> +#elif defined(TARGET_SPARC) || defined(TARGET_SPARC64)
>  #include "sparc/sockbits.h"
>  #else
>  
> diff --git a/linux-user/sparc64/sockbits.h b/linux-user/sparc64/sockbits.h
> new file mode 100644
> index 00..658899e4d3
> --- /dev/null
> +++ b/linux-user/sparc64/sockbits.h
> @@ -0,0 +1 @@
> +#include "../sparc/sockbits.h"
> 




Re: [Qemu-devel] [PATCH 14/34] hw/ipmi: remove old i386 dependency

2017-09-22 Thread Corey Minyard

On 09/22/2017 10:39 AM, Philippe Mathieu-Daudé wrote:

Signed-off-by: Philippe Mathieu-Daudé 


As mentioned before, I applied this series and did some basic testing, so

Reviewed-by: Corey Minyard 
Tested-by: Corey Minyard 


---
  hw/ipmi/isa_ipmi_bt.c  | 1 -
  hw/ipmi/isa_ipmi_kcs.c | 1 -
  2 files changed, 2 deletions(-)

diff --git a/hw/ipmi/isa_ipmi_bt.c b/hw/ipmi/isa_ipmi_bt.c
index 2fcc3d2e7c..e098fd5206 100644
--- a/hw/ipmi/isa_ipmi_bt.c
+++ b/hw/ipmi/isa_ipmi_bt.c
@@ -26,7 +26,6 @@
  #include "hw/hw.h"
  #include "hw/ipmi/ipmi.h"
  #include "hw/isa/isa.h"
-#include "hw/i386/pc.h"
  
  /* Control register */

  #define IPMI_BT_CLR_WR_BIT 0
diff --git a/hw/ipmi/isa_ipmi_kcs.c b/hw/ipmi/isa_ipmi_kcs.c
index 80444977a0..689587b65d 100644
--- a/hw/ipmi/isa_ipmi_kcs.c
+++ b/hw/ipmi/isa_ipmi_kcs.c
@@ -26,7 +26,6 @@
  #include "hw/hw.h"
  #include "hw/ipmi/ipmi.h"
  #include "hw/isa/isa.h"
-#include "hw/i386/pc.h"
  
  #define IPMI_KCS_OBF_BIT0

  #define IPMI_KCS_IBF_BIT1






Re: [Qemu-devel] [PATCH 02/34] hw: remove "qemu/osdep.h" from header files

2017-09-22 Thread Corey Minyard

On 09/22/2017 11:07 AM, Peter Maydell wrote:

On 22 September 2017 at 16:39, Philippe Mathieu-Daudé  wrote:

while here, add entries for ppc4xx_i2c in MAINTAINERS

applied using ./scripts/clean-includes

Signed-off-by: Philippe Mathieu-Daudé 
---

This is doing two things at once and would ideally be
two patches. Still,


I agree.


Reviewed-by: Peter Maydell 


I applied this series and did some basic testing, so

Reviewed-by: Corey Minyard 
Tested-by: Corey Minyard 


thanks
-- PMM






Re: [Qemu-devel] [RFC 4/6] linux-user: refactor socket.h for sparc

2017-09-22 Thread Laurent Vivier
Le 22/09/2017 à 16:02, Carlo Marcelo Arenas Belón a écrit :
> fixes SOL_SOCKET and SO_LINGER at least

And fix TARGET_SOCK_NONBLOCK and TARGET_SOCK_CLOEXEC values.

> 
> Signed-off-by: Carlo Marcelo Arenas Belón 
> ---
>  linux-user/socket.h |  46 ++--
>  linux-user/sparc/sockbits.h | 104 
> 
>  2 files changed, 107 insertions(+), 43 deletions(-)
>  create mode 100644 linux-user/sparc/sockbits.h
> 
> diff --git a/linux-user/socket.h b/linux-user/socket.h
> index 036270a6e4..dfa692286b 100644
> --- a/linux-user/socket.h
> +++ b/linux-user/socket.h
> @@ -4,50 +4,10 @@
>  #include "alpha/sockbits.h"
>  #elif defined(TARGET_HPPA)
>  #include "hppa/sockbits.h"
> +#elif defined(TARGET_SPARC)
> +#include "sparc/sockbits.h"
>  #else
>  
> -#if defined(TARGET_SPARC)
> -/** sock_type - Socket types
> - *
> - * Please notice that for binary compat reasons SPARC has to
> - * override the enum sock_type in include/linux/net.h, so
> - * we define ARCH_HAS_SOCKET_TYPES here.
> - *
> - * @SOCK_DGRAM - datagram (conn.less) socket
> - * @SOCK_STREAM - stream (connection) socket
> - * @SOCK_RAW - raw socket
> - * @SOCK_RDM - reliably-delivered message
> - * @SOCK_SEQPACKET - sequential packet socket
> - * @SOCK_DCCP - Datagram Congestion Control Protocol socket
> - * @SOCK_PACKET - linux specific way of getting packets at the dev level.
> - *For writing rarp and other similar things on the user
> - *level.
> - * @SOCK_CLOEXEC - sets the close-on-exec (FD_CLOEXEC) flag.
> - * @SOCK_NONBLOCK - sets the O_NONBLOCK file status flag.
> - */
> -
> -#define ARCH_HAS_SOCKET_TYPES  1
> -
> -enum sock_type {
> -   TARGET_SOCK_STREAM  = 1,
> -   TARGET_SOCK_DGRAM   = 2,
> -   TARGET_SOCK_RAW = 3,
> -   TARGET_SOCK_RDM = 4,
> -   TARGET_SOCK_SEQPACKET   = 5,
> -   TARGET_SOCK_DCCP= 6,
> -   TARGET_SOCK_PACKET  = 10,
> -   TARGET_SOCK_CLOEXEC = 02000,
> -   TARGET_SOCK_NONBLOCK= 04,
> -};
...
> +enum sock_type {
> +TARGET_SOCK_STREAM  = 1,
> +TARGET_SOCK_DGRAM   = 2,
> +TARGET_SOCK_RAW = 3,
> +TARGET_SOCK_RDM = 4,
> +TARGET_SOCK_SEQPACKET   = 5,
> +TARGET_SOCK_DCCP= 6,
> +TARGET_SOCK_PACKET  = 10,
> +TARGET_SOCK_CLOEXEC = 0x40,
> +TARGET_SOCK_NONBLOCK= 0x4000,
> +};
> +
> +#define TARGET_SOCK_MAX (TARGET_SOCK_PACKET + 1)
> +#define TARGET_SOCK_TYPE_MASK 0xf  /* Covers up to TARGET_SOCK_MAX - 1. */
> +
> +#define ARCH_HAS_SOCKET_TYPES 1
> 

Reviewed-by: Laurent Vivier 



Re: [Qemu-devel] [PATCH 09/34] misc: avoid "include/" in include path

2017-09-22 Thread Peter Maydell
On 22 September 2017 at 16:39, Philippe Mathieu-Daudé  wrote:
> while here, remove unused #include from aspeed_smc.h
>
> Signed-off-by: Philippe Mathieu-Daudé 
> ---
>  hw/input/adb.c  | 2 +-
>  hw/ssi/aspeed_smc.c | 3 +--
>  numa.c  | 1 -
>  3 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/hw/input/adb.c b/hw/input/adb.c
> index fcca3a8eb9..924a3f9fd5 100644
> --- a/hw/input/adb.c
> +++ b/hw/input/adb.c
> @@ -24,8 +24,8 @@
>  #include "qemu/osdep.h"
>  #include "hw/hw.h"
>  #include "hw/input/adb.h"
> +#include "hw/input/adb-keys.h"
>  #include "ui/console.h"
> -#include "include/hw/input/adb-keys.h"
>  #include "ui/input.h"
>  #include "sysemu/sysemu.h"
>
> diff --git a/hw/ssi/aspeed_smc.c b/hw/ssi/aspeed_smc.c
> index cb515730c5..5059396bc6 100644
> --- a/hw/ssi/aspeed_smc.c
> +++ b/hw/ssi/aspeed_smc.c
> @@ -26,8 +26,7 @@
>  #include "hw/sysbus.h"
>  #include "sysemu/sysemu.h"
>  #include "qemu/log.h"
> -#include "include/qemu/error-report.h"
> -#include "exec/address-spaces.h"
> +#include "qemu/error-report.h"
>
>  #include "hw/ssi/aspeed_smc.h"
>
> diff --git a/numa.c b/numa.c
> index 100a67febf..ebc553b5d9 100644
> --- a/numa.c
> +++ b/numa.c
> @@ -29,7 +29,6 @@
>  #include "qemu/bitmap.h"
>  #include "qom/cpu.h"
>  #include "qemu/error-report.h"
> -#include "include/exec/cpu-common.h" /* for RAM_ADDR_FMT */
>  #include "qapi-visit.h"
>  #include "qapi/opts-visitor.h"
>  #include "hw/boards.h"
> --
> 2.14.1

"while here" usually indicates a patch should be split.

Otherwise
Reviewed-by: Peter Maydell 

thanks
-- PMM



Re: [Qemu-devel] [PATCH 07/34] i386/hax: remove duplicated includes

2017-09-22 Thread Peter Maydell
On 22 September 2017 at 16:39, Philippe Mathieu-Daudé  wrote:
> applied using ./scripts/clean-includes
>
> Signed-off-by: Philippe Mathieu-Daudé 
> ---
>  include/sysemu/hax.h  | 1 -
>  target/i386/hax-darwin.h  | 3 ---
>  target/i386/hax-windows.h | 2 --
>  target/i386/hax-darwin.c  | 8 ++--
>  4 files changed, 2 insertions(+), 12 deletions(-)

I suspect the includes in hax-windows.h could be trimmed a bit
more (since we're guaranteed that if CONFIG_WIN32 then we've
included sysemu/os-win32.h), but this is fine as it stands.

Reviewed-by: Peter Maydell 

thanks
-- PMM



Re: [Qemu-devel] [PATCH 08/34] nios2: remove duplicated includes

2017-09-22 Thread Peter Maydell
On 22 September 2017 at 16:39, Philippe Mathieu-Daudé  wrote:
> applied using ./scripts/clean-includes
>
> Signed-off-by: Philippe Mathieu-Daudé 
> ---
>  target/nios2/cpu.h   | 1 -
>  disas/nios2.c| 3 ---
>  hw/nios2/boot.c  | 1 -
>  target/nios2/helper.c| 7 ++-
>  target/nios2/op_helper.c | 1 +
>  target/nios2/translate.c | 1 +
>  6 files changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/target/nios2/cpu.h b/target/nios2/cpu.h
> index 50d803a217..fda02c39b9 100644
> --- a/target/nios2/cpu.h
> +++ b/target/nios2/cpu.h
> @@ -20,7 +20,6 @@
>  #ifndef CPU_NIOS2_H
>  #define CPU_NIOS2_H
>
> -#include "qemu/osdep.h"
>  #include "qemu-common.h"
>
>  #define TARGET_LONG_BITS 32
> diff --git a/disas/nios2.c b/disas/nios2.c
> index b342936d21..de11f04cc4 100644
> --- a/disas/nios2.c
> +++ b/disas/nios2.c
> @@ -1756,7 +1756,6 @@ extern const int nios2_num_r2_reg_range_mappings;
>  #endif /* _NIOS2_H */
>
>  /*#include "sysdep.h"
> -#include 
>  #include "opcode/nios2.h"
>  */
>  /* Register string table */
> @@ -2521,8 +2520,6 @@ const int nios2_num_r2_reg_range_mappings = 8;
>  #include "dis-asm.h"
>  #include "opcode/nios2.h"
>  #include "libiberty.h"
> -#include 
> -#include 
>  */

These are in commented out bits of code anyway, but I guess it doesn't
hurt and it'll prevent the script complaining later.

>  /* No symbol table is available when this code runs out in an embedded
> system as when it is used for disassembler support in a monitor.  */
> diff --git a/hw/nios2/boot.c b/hw/nios2/boot.c
> index 2b31f5b844..94f436e7fb 100644
> --- a/hw/nios2/boot.c
> +++ b/hw/nios2/boot.c
> @@ -34,7 +34,6 @@
>  #include "qemu/option.h"
>  #include "qemu/config-file.h"
>  #include "qemu/error-report.h"
> -#include "qemu-common.h"
>  #include "sysemu/device_tree.h"
>  #include "sysemu/sysemu.h"
>  #include "hw/loader.h"
> diff --git a/target/nios2/helper.c b/target/nios2/helper.c
> index ef9ee05798..9f741a8f19 100644
> --- a/target/nios2/helper.c
> +++ b/target/nios2/helper.c
> @@ -18,12 +18,9 @@
>   * 
>   */
>
> -#include 
> -#include 
> -#include 
> -
> -#include "cpu.h"
>  #include "qemu/osdep.h"
> +
> +#include "cpu.h"
>  #include "qemu/host-utils.h"
>  #include "qapi/error.h"
>  #include "exec/exec-all.h"
> diff --git a/target/nios2/op_helper.c b/target/nios2/op_helper.c
> index efb1c489c9..c853aeae02 100644
> --- a/target/nios2/op_helper.c
> +++ b/target/nios2/op_helper.c
> @@ -18,6 +18,7 @@
>   * 
>   */
>
> +#include "qemu/osdep.h"
>  #include "cpu.h"
>  #include "exec/helper-proto.h"
>  #include "exec/cpu_ldst.h"
> diff --git a/target/nios2/translate.c b/target/nios2/translate.c
> index 6b0961837d..796d399bd1 100644
> --- a/target/nios2/translate.c
> +++ b/target/nios2/translate.c
> @@ -21,6 +21,7 @@
>   * 
>   */
>
> +#include "qemu/osdep.h"
>  #include "cpu.h"
>  #include "tcg-op.h"
>  #include "exec/exec-all.h"

Reviewed-by: Peter Maydell 

thanks
-- PMM



Re: [Qemu-devel] [RFC 3/6] linux-user: refactor socket.h for mips

2017-09-22 Thread Laurent Vivier
Le 22/09/2017 à 16:02, Carlo Marcelo Arenas Belón a écrit :
> fresh bits from linux 4.14, redefine SO_STYLE and {SO,SCM}_TIMESTAMP to
> the target values and enables SO_REUSEPORT

And you fix TARGET_SOCK_NONBLOCK value.

Reviewed-by: Laurent Vivier 



Re: [Qemu-devel] [PATCH 06/34] ppc: remove duplicated includes

2017-09-22 Thread Peter Maydell
On 22 September 2017 at 16:39, Philippe Mathieu-Daudé  wrote:
> applied using ./scripts/clean-includes
>
> not needed since 7ebaf795560
>
> Signed-off-by: Philippe Mathieu-Daudé 
> ---
>  hw/ppc/spapr_hcall.c | 1 -
>  target/ppc/kvm.c | 3 ---
>  2 files changed, 4 deletions(-)
>
> diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
> index 57bb411394..2aeee28fe6 100644
> --- a/hw/ppc/spapr_hcall.c
> +++ b/hw/ppc/spapr_hcall.c
> @@ -13,7 +13,6 @@
>  #include "trace.h"
>  #include "kvm_ppc.h"
>  #include "hw/ppc/spapr_ovec.h"
> -#include "qemu/error-report.h"
>  #include "mmu-book3s-v3.h"
>
>  struct SPRSyncState {
> diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
> index 1deaf106d2..c9105af393 100644
> --- a/target/ppc/kvm.c
> +++ b/target/ppc/kvm.c
> @@ -47,9 +47,6 @@
>  #include "sysemu/hostmem.h"
>  #include "qemu/cutils.h"
>  #include "qemu/mmap-alloc.h"
> -#if defined(TARGET_PPC64)
> -#include "hw/ppc/spapr_cpu_core.h"
> -#endif
>  #include "elf.h"
>  #include "sysemu/kvm_int.h"
>
> --

Reviewed-by: Peter Maydell 

thanks
-- PMM



Re: [Qemu-devel] [PATCH 05/34] misc: remove duplicated includes

2017-09-22 Thread Peter Maydell
On 22 September 2017 at 16:39, Philippe Mathieu-Daudé  wrote:
> exec: housekeeping (funny since 02d0e095031)
>
> applied using ./scripts/clean-includes
>
> Signed-off-by: Philippe Mathieu-Daudé 
> ---
>  accel/tcg/translate-all.c  | 1 -
>  exec.c | 3 ---
>  hw/arm/spitz.c | 1 -
>  hw/char/xen_console.c  | 1 -
>  hw/core/machine.c  | 1 -
>  hw/s390x/css.c | 1 -
>  target/openrisc/exception_helper.c | 1 -
>  tests/vhost-user-test.c| 1 -
>  util/qemu-sockets.c| 1 -
>  vl.c   | 1 -
>  10 files changed, 12 deletions(-)

Reviewed-by: Peter Maydell 

thanks
-- PMM



Re: [Qemu-devel] [PULL 0/2] Python next patches

2017-09-22 Thread Peter Maydell
On 22 September 2017 at 15:42, Eduardo Habkost  wrote:
> The following changes since commit 9ee660e7c138595224b65ddc1c5712549f0a278c:
>
>   Merge remote-tracking branch 'remotes/yongbok/tags/mips-20170921' into 
> staging (2017-09-21 14:40:32 +0100)
>
> are available in the git repository at:
>
>   git://github.com/ehabkost/qemu.git tags/python-next-pull-request
>
> for you to fetch changes up to ad904f6689f1ced282b413cb904c166f294a73ee:
>
>   MAINTAINERS: Add Python scripts (2017-09-22 11:39:55 -0300)
>
> 
> Python queue, 2017-09-22
>
> * MAINTAINERS update
> * Fix logging issue on test scripts using qemu.py
>
> 
>
> Eduardo Habkost (2):
>   qemu.py: Call logging.basicConfig() automatically
>   MAINTAINERS: Add Python scripts
>
>  scripts/qemu.py | 3 +++
>  MAINTAINERS | 8 
>  2 files changed, 11 insertions(+)

Applied, thanks.

-- PMM



Re: [Qemu-devel] SunOS support

2017-09-22 Thread Peter Tribble
On Fri, Sep 22, 2017 at 5:10 PM, Peter Maydell 
wrote:

> On 22 September 2017 at 16:51, Paolo Bonzini  wrote:
> > On 22/09/2017 14:05, Peter Maydell wrote:
> >> On 20 September 2017 at 19:50, Peter Tribble 
> wrote:
> >>> To introduce myself: I'm a member of the illumos community (the
> successor
> >>> to OpenSolaris, to those unfamiliar with us), and I maintain my own
> illumos
> >>> distribution.
> >>>
> >>> Having seen the scary 'SUPPORT FOR THIS HOST OS WILL GO AWAY'
> >>> message, I'm reaching out to see what needs to be done so that support
> for
> >>> SunOS (not just illumos, I include Oracle's Solaris in the same family)
> >>> needs to be kept and, where possible, enhanced.
> >>>
> >>> I'm willing to act as a contact in this effort, and can work with
> others in
> >>> the illumos community to see if there are other resources we can bring
> to bear.
> >>
> >> Hi; thanks for getting in touch with us. Kamil Rytarowski (who I've
> >> cc'd) is also interested in keeping Solaris-variant support working.
> >>
> >> Essentially what we need as upstream is:
> >>  * access to a machine which we can use for our continuous
> >>integration build testing, so we don't break compile
> >>support for the platform. This is ideally a machine that
> >>somebody else admins and we just use (because we don't
> >>want to become solaris/illumos admins ;-)), but failing
> >>that, instructions on how to get a VM running under
> >>KVM on Linux would also be OK (that's how we've ended
> >>up handling the BSDs)
> >
> > I would even reverse the order since now we're handling the BSDs using
> > the VM test infrastructure.  Let's say having both would be best.
>
> I only have the one beefy machine to run VMs on, so the more
> OSes we handle via VMs the more overloaded it gets. Also,
> everything we have as a VM is another thing I have to maintain
> and presumably update from time to time...
>

Well, we have options.

Tribblix (http://www.tribblix.org/) is probably the easiest and lightest for
a VM. Works fine under KVM (not virtio-scsi, and I've had issues with
virtio networking). Just download the iso, install with

./live_install -B c1t0d0 kitchen-sink qemu

and you're good to go. (That's assuming you have network connectivity
during install, and I'm guessing at the probable disk device. Adding qemu
ought to grab all the dependencies.)

It's not too hard to give access to a running machine, although I
personally don't have any available right now (I could run one up
on AWS). Or the good folks at Joyent might be able to help out - I
can certainly ask them.

-- 
-Peter Tribble
http://www.petertribble.co.uk/ - http://ptribble.blogspot.com/


Re: [Qemu-devel] [PATCH 03/34] block: remove "qemu/osdep.h" from header file

2017-09-22 Thread Peter Maydell
On 22 September 2017 at 16:39, Philippe Mathieu-Daudé  wrote:
> applied using ./scripts/clean-includes
>
> Signed-off-by: Philippe Mathieu-Daudé 
> ---
>  block/dmg.h | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/block/dmg.h b/block/dmg.h
> index b592d6fa8b..2ecf239ba5 100644
> --- a/block/dmg.h
> +++ b/block/dmg.h
> @@ -26,7 +26,6 @@
>  #ifndef BLOCK_DMG_H
>  #define BLOCK_DMG_H
>
> -#include "qemu/osdep.h"
>  #include "qemu-common.h"
>  #include "block/block_int.h"
>  #include 
> --

Reviewed-by: Peter Maydell 

thanks
-- PMM



Re: [Qemu-devel] [PATCH 04/34] misc: remove headers implicitly included

2017-09-22 Thread Peter Maydell
On 22 September 2017 at 16:39, Philippe Mathieu-Daudé  wrote:
> applied using ./scripts/clean-includes
>
> Signed-off-by: Philippe Mathieu-Daudé 

Reviewed-by: Peter Maydell 

thanks
-- PMM



Re: [Qemu-devel] [RFC 2/6] linux-user: refactor socket.h for alpha

2017-09-22 Thread Laurent Vivier
Le 22/09/2017 à 16:02, Carlo Marcelo Arenas Belón a écrit :
> based on fresh bits from linux 4.14 and therefore enabling SO_REUSEPORT
> as a side effect
> 
> Signed-off-by: Carlo Marcelo Arenas Belón 
> ---
>  linux-user/alpha/sockbits.h | 104 
> 
>  linux-user/socket.h | 104 
> +---
>  2 files changed, 105 insertions(+), 103 deletions(-)
>  create mode 100644 linux-user/alpha/sockbits.h
> 
> diff --git a/linux-user/alpha/sockbits.h b/linux-user/alpha/sockbits.h
> new file mode 100644
> index 00..768579a1f7
> --- /dev/null
> +++ b/linux-user/alpha/sockbits.h
> @@ -0,0 +1,104 @@
...
> +enum sock_type {
> +TARGET_SOCK_STREAM  = 1,
> +TARGET_SOCK_DGRAM   = 2,
> +TARGET_SOCK_RAW = 3,
> +TARGET_SOCK_RDM = 4,
> +TARGET_SOCK_SEQPACKET   = 5,
> +TARGET_SOCK_DCCP= 6,
> +TARGET_SOCK_PACKET  = 10,
> +TARGET_SOCK_CLOEXEC = 01000,
> +TARGET_SOCK_NONBLOCK= 0x4000,

You change the value of TARGET_SOCK_NONBLOCK, it's correct but you
should say that in the commit messages.

...
> -enum sock_type {
> -   TARGET_SOCK_STREAM  = 1,
> -   TARGET_SOCK_DGRAM   = 2,
> -   TARGET_SOCK_RAW = 3,
> -   TARGET_SOCK_RDM = 4,
> -   TARGET_SOCK_SEQPACKET   = 5,
> -   TARGET_SOCK_DCCP= 6,
> -   TARGET_SOCK_PACKET  = 10,
> -   TARGET_SOCK_CLOEXEC = 01000,
> -   TARGET_SOCK_NONBLOCK= 0100,
> -};

Thanks,
Laurent



[Qemu-devel] [PATCH] scripts/orderfile: keep MAINTAINERS at bottom

2017-09-22 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé 
---
 scripts/git.orderfile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/git.orderfile b/scripts/git.orderfile
index ac699700b1..34619769c2 100644
--- a/scripts/git.orderfile
+++ b/scripts/git.orderfile
@@ -27,3 +27,4 @@ Makefile*
 # code
 *.c
 
+MAINTAINERS
-- 
2.14.1




Re: [Qemu-devel] [PATCH 01/34] hw: use "qemu/osdep.h" as first #include in source files

2017-09-22 Thread Peter Maydell
On 22 September 2017 at 16:39, Philippe Mathieu-Daudé  wrote:
> applied using ./scripts/clean-includes
>
> Signed-off-by: Philippe Mathieu-Daudé 
> ---
>  hw/acpi/ipmi-stub.c | 1 +
>  hw/audio/fmopl.c| 1 -
>  hw/cpu/core.c   | 1 +
>  hw/ppc/spapr_cpu_core.c | 1 +
>  hw/smbios/smbios_type_38-stub.c | 1 +
>  hw/vfio/ccw.c   | 2 +-
>  hw/virtio/vhost-vsock.c | 2 +-
>  7 files changed, 6 insertions(+), 3 deletions(-)
>

Reviewed-by: Peter Maydell 

thanks
-- PMM



[Qemu-devel] [PATCH 32/34] hw/net/ne2000: use TYPE_PCI_NE2000

2017-09-22 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé 
---
 include/hw/net/pci.h  | 1 +
 hw/net/ne2000.c   | 3 ++-
 hw/ppc/mac_newworld.c | 3 ++-
 hw/ppc/mac_oldworld.c | 3 ++-
 hw/ppc/prep.c | 2 +-
 hw/sparc64/sun4u.c| 3 ++-
 6 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/include/hw/net/pci.h b/include/hw/net/pci.h
index 43ed3b0145..da733dd1d9 100644
--- a/include/hw/net/pci.h
+++ b/include/hw/net/pci.h
@@ -15,6 +15,7 @@
 
 #define TYPE_PCI_E1000  "e1000"
 #define TYPE_PCI_E1000E "e1000e"
+#define TYPE_PCI_NE2000 "ne2k_pci"
 #define TYPE_PCI_PCNET  "pcnet"
 #define TYPE_PCI_RTL8139"rtl8139"
 
diff --git a/hw/net/ne2000.c b/hw/net/ne2000.c
index 29bd4adb3f..b0a664d302 100644
--- a/hw/net/ne2000.c
+++ b/hw/net/ne2000.c
@@ -23,6 +23,7 @@
  */
 #include "qemu/osdep.h"
 #include "hw/pci/pci.h"
+#include "hw/net/pci.h"
 #include "ne2000.h"
 #include "hw/loader.h"
 #include "sysemu/sysemu.h"
@@ -779,7 +780,7 @@ static void ne2000_class_init(ObjectClass *klass, void 
*data)
 }
 
 static const TypeInfo ne2000_info = {
-.name  = "ne2k_pci",
+.name  = TYPE_PCI_NE2000,
 .parent= TYPE_PCI_DEVICE,
 .instance_size = sizeof(PCINE2000State),
 .class_init= ne2000_class_init,
diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
index 33b46cb50b..2afc35c27f 100644
--- a/hw/ppc/mac_newworld.c
+++ b/hw/ppc/mac_newworld.c
@@ -55,6 +55,7 @@
 #include "hw/ppc/mac_dbdma.h"
 #include "hw/timer/m48t59.h"
 #include "hw/pci/pci.h"
+#include "hw/net/pci.h"
 #include "net/net.h"
 #include "sysemu/sysemu.h"
 #include "hw/boards.h"
@@ -435,7 +436,7 @@ static void ppc_core99_init(MachineState *machine)
 }
 
 for (i = 0; i < nb_nics; i++) {
-pci_nic_init_nofail(_table[i], pci_bus, "ne2k_pci", NULL);
+pci_nic_init_nofail(_table[i], pci_bus, TYPE_PCI_NE2000, NULL);
 }
 
 /* The NewWorld NVRAM is not located in the MacIO device */
diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
index 193b9047d9..8096e5a126 100644
--- a/hw/ppc/mac_oldworld.c
+++ b/hw/ppc/mac_oldworld.c
@@ -34,6 +34,7 @@
 #include "net/net.h"
 #include "hw/isa/isa.h"
 #include "hw/pci/pci.h"
+#include "hw/net/pci.h"
 #include "hw/boards.h"
 #include "hw/nvram/fw_cfg.h"
 #include "hw/char/escc.h"
@@ -278,7 +279,7 @@ static void ppc_heathrow_init(MachineState *machine)
  escc_mem, 0, memory_region_size(escc_mem));
 
 for(i = 0; i < nb_nics; i++)
-pci_nic_init_nofail(_table[i], pci_bus, "ne2k_pci", NULL);
+pci_nic_init_nofail(_table[i], pci_bus, TYPE_PCI_NE2000, NULL);
 
 
 ide_drive_get(hd, ARRAY_SIZE(hd));
diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
index b2c7a62ebc..103beafef3 100644
--- a/hw/ppc/prep.c
+++ b/hw/ppc/prep.c
@@ -636,7 +636,7 @@ static void ppc_prep_init(MachineState *machine)
 isa_ne2000_init(isa_bus, ne2000_io[i], ne2000_irq[i],
 _table[i]);
 } else {
-pci_nic_init_nofail(_table[i], pci_bus, "ne2k_pci", NULL);
+pci_nic_init_nofail(_table[i], pci_bus, TYPE_PCI_NE2000, NULL);
 }
 }
 
diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
index fd10741607..67879c5135 100644
--- a/hw/sparc64/sun4u.c
+++ b/hw/sparc64/sun4u.c
@@ -32,6 +32,7 @@
 #include "hw/char/serial.h"
 #include "hw/timer/m48t59.h"
 #include "hw/input/i8042.h"
+#include "hw/net/pci.h"
 #include "hw/block/fdc.h"
 #include "net/net.h"
 #include "qemu/timer.h"
@@ -476,7 +477,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
 
 onboard_nic_idx = i;
 } else {
-pci_nic_init_nofail(nd, pci_bus, "ne2k_pci", NULL);
+pci_nic_init_nofail(nd, pci_bus, TYPE_PCI_NE2000, NULL);
 }
 }
 onboard_nic_idx = MAX(onboard_nic_idx, 0);
-- 
2.14.1




Re: [Qemu-devel] [PATCH v7 8/8] tpm: Added support for TPM emulator

2017-09-22 Thread Stefan Berger

On 09/22/2017 08:33 AM, Amarnath Valluri wrote:

This change introduces a new TPM backend driver that can communicate with
swtpm(software TPM emulator) using unix domain socket interface. QEMU talks to
TPM emulator using socket based chardev backend device.


talks to the TPM emulator using QEMU's socket-based chardev backend device.



Swtpm uses two Unix sockets for communications, one for plain TPM commands and
responses, and one for out-of-band control messages. QEMU passes data socket
been used over the control channel.


QEMU passes the data socket to be used over the control channel.

Some comments below. I'll give it a try once we merge the fd passing 
into swtpm.





The swtpm and associated tools can be found here:
 https://github.com/stefanberger/swtpm

The swtpm's control channel protocol specification can be found here:
 https://github.com/stefanberger/swtpm/wiki/Control-Channel-Specification

Usage:
 # setup TPM state directory
 mkdir /tmp/mytpm
 chown -R tss:root /tmp/mytpm
 /usr/bin/swtpm_setup --tpm-state /tmp/mytpm --createek

 # Ask qemu to use TPM emulator with given tpm state directory
 qemu-system-x86_64 \
 [...] \
 -chardev socket,id=chrtpm,path=/tmp/swtpm-sock \
 -tpmdev emulator,id=tpm0,chardev=chrtpm \
 -device tpm-tis,tpmdev=tpm0 \
 [...]

Signed-off-by: Amarnath Valluri 
---
  configure |  15 +-
  hmp.c |   5 +
  hw/tpm/Makefile.objs  |   1 +
  hw/tpm/tpm_emulator.c | 649 ++
  hw/tpm/tpm_ioctl.h| 246 +++
  qapi/tpm.json |  21 +-
  qemu-options.hx   |  22 +-
  7 files changed, 950 insertions(+), 9 deletions(-)
  create mode 100644 hw/tpm/tpm_emulator.c
  create mode 100644 hw/tpm/tpm_ioctl.h

diff --git a/configure b/configure
index cb0f7ed..ce2df2d 100755
--- a/configure
+++ b/configure
@@ -3461,10 +3461,15 @@ fi
  ##
  # TPM passthrough is only on x86 Linux

-if test "$targetos" = Linux && test "$cpu" = i386 -o "$cpu" = x86_64; then
-  tpm_passthrough=$tpm
+if test "$targetos" = Linux; then
+  tpm_emulator=$tpm
+  if test "$cpu" = i386 -o "$cpu" = x86_64; then
+tpm_passthrough=$tpm
+  else
+tpm_passthrough=no
+  fi
  else
-  tpm_passthrough=no
+  tpm_emulator=no
  fi

  ##
@@ -5359,6 +5364,7 @@ echo "gcov enabled  $gcov"
  echo "TPM support   $tpm"
  echo "libssh2 support   $libssh2"
  echo "TPM passthrough   $tpm_passthrough"
+echo "TPM emulator  $tpm_emulator"
  echo "QOM debugging $qom_cast_debug"
  echo "Live block migration $live_block_migration"
  echo "lzo support   $lzo"
@@ -5943,6 +5949,9 @@ if test "$tpm" = "yes"; then
if test "$tpm_passthrough" = "yes"; then
  echo "CONFIG_TPM_PASSTHROUGH=y" >> $config_host_mak
fi
+  if test "$tpm_emulator" = "yes"; then
+echo "CONFIG_TPM_EMULATOR=y" >> $config_host_mak
+  fi
  fi

  echo "TRACE_BACKENDS=$trace_backends" >> $config_host_mak
diff --git a/hmp.c b/hmp.c
index cf62b2e..7e69eca 100644
--- a/hmp.c
+++ b/hmp.c
@@ -995,6 +995,7 @@ void hmp_info_tpm(Monitor *mon, const QDict *qdict)
  Error *err = NULL;
  unsigned int c = 0;
  TPMPassthroughOptions *tpo;
+TPMEmulatorOptions *teo;

  info_list = qmp_query_tpm();
  if (err) {
@@ -1024,6 +1025,10 @@ void hmp_info_tpm(Monitor *mon, const QDict *qdict)
 tpo->has_cancel_path ? ",cancel-path=" : "",
 tpo->has_cancel_path ? tpo->cancel_path : "");
  break;
+case TPM_TYPE_EMULATOR:
+teo = ti->options->u.emulator.data;
+monitor_printf(mon, ",chardev=%s", teo->chardev);
+break;
  case TPM_TYPE__MAX:
  break;
  }
diff --git a/hw/tpm/Makefile.objs b/hw/tpm/Makefile.objs
index 64cecc3..41f0b7a 100644
--- a/hw/tpm/Makefile.objs
+++ b/hw/tpm/Makefile.objs
@@ -1,2 +1,3 @@
  common-obj-$(CONFIG_TPM_TIS) += tpm_tis.o
  common-obj-$(CONFIG_TPM_PASSTHROUGH) += tpm_passthrough.o tpm_util.o
+common-obj-$(CONFIG_TPM_EMULATOR) += tpm_emulator.o tpm_util.o
diff --git a/hw/tpm/tpm_emulator.c b/hw/tpm/tpm_emulator.c
new file mode 100644
index 000..c02bbe2
--- /dev/null
+++ b/hw/tpm/tpm_emulator.c
@@ -0,0 +1,649 @@
+/*
+ *  emulator TPM driver


Emulator


+ *
+ *  Copyright (c) 2017 Intel Corporation
+ *  Author: Amarnath Valluri 
+ *
+ *  Copyright (c) 2010 - 2013 IBM Corporation
+ *  Authors:
+ *Stefan Berger 
+ *
+ *  Copyright (C) 2011 IAIK, Graz University of Technology
+ *Author: Andreas Niederl
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later 

Re: [Qemu-devel] [RFC 1/6] linux-user: update hppa sockbits

2017-09-22 Thread Laurent Vivier
Le 22/09/2017 à 16:02, Carlo Marcelo Arenas Belón a écrit :
> updated to match arch/parisc/include/uapi/asm/socket.h from linux 4.14
> 
> Signed-off-by: Carlo Marcelo Arenas Belón 
> ---
>  linux-user/hppa/sockbits.h | 148 
> +++--
>  linux-user/socket.h|   2 +-
>  2 files changed, 78 insertions(+), 72 deletions(-)
> 
> diff --git a/linux-user/hppa/sockbits.h b/linux-user/hppa/sockbits.h
> index 5044619e16..3dab31a76a 100644
> --- a/linux-user/hppa/sockbits.h
> +++ b/linux-user/hppa/sockbits.h
> @@ -1,71 +1,77 @@
> -#define TARGET_SOL_SOCKET  0x
> +#define TARGET_SOL_SOCKET   0x
>  
> -#define TARGET_SO_DEBUG0x0001
> -#define TARGET_SO_REUSEADDR0x0004
> -#define TARGET_SO_KEEPALIVE0x0008
> -#define TARGET_SO_DONTROUTE0x0010
> -#define TARGET_SO_BROADCAST0x0020
> -#define TARGET_SO_LINGER   0x0080
> -#define TARGET_SO_OOBINLINE0x0100
> -#define TARGET_SO_REUSEPORT0x0200
> -#define TARGET_SO_SNDBUF   0x1001
> -#define TARGET_SO_RCVBUF   0x1002
> -#define TARGET_SO_SNDBUFFORCE  0x100a
> -#define TARGET_SO_RCVBUFFORCE  0x100b
> -#define TARGET_SO_SNDLOWAT 0x1003
> -#define TARGET_SO_RCVLOWAT 0x1004
> -#define TARGET_SO_SNDTIMEO 0x1005
> -#define TARGET_SO_RCVTIMEO 0x1006
> -#define TARGET_SO_ERROR0x1007
> -#define TARGET_SO_TYPE 0x1008
> -#define TARGET_SO_PROTOCOL 0x1028
> -#define TARGET_SO_DOMAIN   0x1029
> -#define TARGET_SO_PEERNAME 0x2000
> -#define TARGET_SO_NO_CHECK 0x400b
> -#define TARGET_SO_PRIORITY 0x400c
> -#define TARGET_SO_BSDCOMPAT0x400e
> -#define TARGET_SO_PASSCRED 0x4010
> -#define TARGET_SO_PEERCRED 0x4011
> -#define TARGET_SO_TIMESTAMP0x4012
> -#define TARGET_SCM_TIMESTAMP   TARGET_SO_TIMESTAMP
> -#define TARGET_SO_TIMESTAMPNS  0x4013
> -#define TARGET_SCM_TIMESTAMPNS TARGET_SO_TIMESTAMPNS
> +#define TARGET_SO_DEBUG 0x0001
> +#define TARGET_SO_REUSEADDR 0x0004
> +#define TARGET_SO_KEEPALIVE 0x0008
> +#define TARGET_SO_DONTROUTE 0x0010
> +#define TARGET_SO_BROADCAST 0x0020
> +#define TARGET_SO_LINGER0x0080
> +#define TARGET_SO_OOBINLINE 0x0100
> +#define TARGET_SO_REUSEPORT 0x0200
> +#define TARGET_SO_SNDBUF0x1001
> +#define TARGET_SO_RCVBUF0x1002
> +#define TARGET_SO_SNDBUFFORCE   0x100a
> +#define TARGET_SO_RCVBUFFORCE   0x100b
> +#define TARGET_SO_SNDLOWAT  0x1003
> +#define TARGET_SO_RCVLOWAT  0x1004
> +#define TARGET_SO_SNDTIMEO  0x1005
> +#define TARGET_SO_RCVTIMEO  0x1006
> +#define TARGET_SO_ERROR 0x1007
> +#define TARGET_SO_TYPE  0x1008
> +#define TARGET_SO_PROTOCOL  0x1028
> +#define TARGET_SO_DOMAIN0x1029
> +#define TARGET_SO_PEERNAME  0x2000
> +#define TARGET_SO_NO_CHECK  0x400b
> +#define TARGET_SO_PRIORITY  0x400c
> +#define TARGET_SO_BSDCOMPAT 0x400e
> +#define TARGET_SO_PASSCRED  0x4010
> +#define TARGET_SO_PEERCRED  0x4011
> +#define TARGET_SO_TIMESTAMP 0x4012
> +#define TARGET_SCM_TIMESTAMPTARGET_SO_TIMESTAMP
> +#define TARGET_SO_TIMESTAMPNS   0x4013
> +#define TARGET_SCM_TIMESTAMPNS  TARGET_SO_TIMESTAMPNS
>  
> -#define TARGET_SO_SECURITY_AUTHENTICATION  0x4016
> -#define TARGET_SO_SECURITY_ENCRYPTION_TRANSPORT0x4017
> -#define TARGET_SO_SECURITY_ENCRYPTION_NETWORK  0x4018
> +#define TARGET_SO_SECURITY_AUTHENTICATION   0x4016
> +#define TARGET_SO_SECURITY_ENCRYPTION_TRANSPORT 0x4017
> +#define TARGET_SO_SECURITY_ENCRYPTION_NETWORK   0x4018
>  
> -#define TARGET_SO_BINDTODEVICE 0x4019
> -#define TARGET_SO_ATTACH_FILTER0x401a
> -#define TARGET_SO_DETACH_FILTER0x401b
> -#define TARGET_SO_GET_FILTER   TARGET_SO_ATTACH_FILTER
> -#define TARGET_SO_ACCEPTCONN   0x401c
> -#define TARGET_SO_PEERSEC  0x401d
> -#define TARGET_SO_PASSSEC  0x401e
> -#define TARGET_SO_MARK 0x401f
> -#define TARGET_SO_TIMESTAMPING 0x4020
> -#define TARGET_SCM_TIMESTAMPINGTARGET_SO_TIMESTAMPING
> -#define TARGET_SO_RXQ_OVFL 0x4021
> -#define TARGET_SO_WIFI_STATUS  0x4022
> -#define TARGET_SCM_WIFI_STATUS TARGET_SO_WIFI_STATUS
> -#define TARGET_SO_PEEK_OFF 0x4023
> -#define TARGET_SO_NOFCS0x4024
> -#define TARGET_SO_LOCK_FILTER  0x4025
> -#define TARGET_SO_SELECT_ERR_QUEUE 0x4026
> -#define 

[Qemu-devel] [PATCH 34/34] misc: drop old i386 dependency

2017-09-22 Thread Philippe Mathieu-Daudé
while here, add an entry for wdt_ib700 in MAINTAINERS

Signed-off-by: Philippe Mathieu-Daudé 
---
 hw/char/debugcon.c  | 1 -
 hw/intc/lm32_pic.c  | 1 -
 hw/moxie/moxiesim.c | 1 -
 hw/sparc/sun4m.c| 1 -
 hw/watchdog/wdt_ib700.c | 1 -
 MAINTAINERS | 1 +
 6 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/hw/char/debugcon.c b/hw/char/debugcon.c
index 95ccec6f8b..e2abc61b04 100644
--- a/hw/char/debugcon.c
+++ b/hw/char/debugcon.c
@@ -29,7 +29,6 @@
 #include "hw/hw.h"
 #include "chardev/char-fe.h"
 #include "hw/isa/isa.h"
-#include "hw/i386/pc.h"
 
 #define TYPE_ISA_DEBUGCON_DEVICE "isa-debugcon"
 #define ISA_DEBUGCON_DEVICE(obj) \
diff --git a/hw/intc/lm32_pic.c b/hw/intc/lm32_pic.c
index 09e15115fb..db6c7afc2f 100644
--- a/hw/intc/lm32_pic.c
+++ b/hw/intc/lm32_pic.c
@@ -20,7 +20,6 @@
 #include "qemu/osdep.h"
 
 #include "hw/hw.h"
-#include "hw/i386/pc.h"
 #include "monitor/monitor.h"
 #include "hw/sysbus.h"
 #include "trace.h"
diff --git a/hw/moxie/moxiesim.c b/hw/moxie/moxiesim.c
index 5ea8dd3a93..5c9a4211ac 100644
--- a/hw/moxie/moxiesim.c
+++ b/hw/moxie/moxiesim.c
@@ -30,7 +30,6 @@
 #include "cpu.h"
 #include "hw/sysbus.h"
 #include "hw/hw.h"
-#include "hw/i386/pc.h"
 #include "hw/isa/isa.h"
 #include "net/net.h"
 #include "sysemu/sysemu.h"
diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
index a4ba3d2917..f6fda6eb13 100644
--- a/hw/sparc/sun4m.c
+++ b/hw/sparc/sun4m.c
@@ -36,7 +36,6 @@
 #include "net/net.h"
 #include "hw/boards.h"
 #include "hw/scsi/esp.h"
-#include "hw/i386/pc.h"
 #include "hw/isa/isa.h"
 #include "hw/nvram/sun_nvram.h"
 #include "hw/nvram/chrp_nvram.h"
diff --git a/hw/watchdog/wdt_ib700.c b/hw/watchdog/wdt_ib700.c
index 532afe89e7..d045032bf4 100644
--- a/hw/watchdog/wdt_ib700.c
+++ b/hw/watchdog/wdt_ib700.c
@@ -25,7 +25,6 @@
 #include "sysemu/watchdog.h"
 #include "hw/hw.h"
 #include "hw/isa/isa.h"
-#include "hw/i386/pc.h"
 
 /*#define IB700_DEBUG 1*/
 
diff --git a/MAINTAINERS b/MAINTAINERS
index 37917af0f0..3b767e4012 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -852,6 +852,7 @@ F: hw/misc/pc-testdev.c
 F: hw/timer/hpet*
 F: hw/timer/i8254*
 F: hw/timer/mc146818rtc*
+F: hw/watchdog/wdt_ib700.c
 F: include/hw/dma/i8257_dma.h
 F: include/hw/i2c/pm_smbus.h
 F: include/hw/input/i8042.h
-- 
2.14.1




[Qemu-devel] [PATCH 27/34] hw/pci: declare pci_nic_init_nofail() in "hw/net/pci.h"

2017-09-22 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé 
---
 hw/pci/pci_internal.h | 16 +++
 include/hw/net/pci.h  | 20 +
 include/hw/pci/pci.h  |  4 ---
 hw/arm/virt.c |  1 +
 hw/mips/mips_malta.c  |  1 +
 hw/pci/pci.c  | 67 ++--
 hw/pci/pci_nic.c  | 77 +++
 hw/ppc/e500.c |  1 +
 hw/ppc/spapr.c|  1 +
 hw/pci/Makefile.objs  |  1 +
 10 files changed, 120 insertions(+), 69 deletions(-)
 create mode 100644 hw/pci/pci_internal.h
 create mode 100644 include/hw/net/pci.h
 create mode 100644 hw/pci/pci_nic.c

diff --git a/hw/pci/pci_internal.h b/hw/pci/pci_internal.h
new file mode 100644
index 00..d967468767
--- /dev/null
+++ b/hw/pci/pci_internal.h
@@ -0,0 +1,16 @@
+/*
+ * QEMU PCI internal
+ *
+ * Copyright (c) 2005 Fabrice Bellard
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+#ifndef QEMU_HW_PCI_INTERNAL_H
+#define QEMU_HW_PCI_INTERNAL_H
+
+#include "hw/pci/pci_bus.h"
+
+PCIBus *pci_get_bus_devfn(int *devfnp, PCIBus *root, const char *devaddr);
+
+#endif
diff --git a/include/hw/net/pci.h b/include/hw/net/pci.h
new file mode 100644
index 00..529591b7f3
--- /dev/null
+++ b/include/hw/net/pci.h
@@ -0,0 +1,20 @@
+/*
+ * QEMU network devices
+ *
+ * Copyright (c) 2005 Fabrice Bellard
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+#ifndef QEMU_HW_NET_PCI_H
+#define QEMU_HW_NET_PCI_H
+
+#include "net/net.h"
+#include "hw/pci/pci.h"
+#include "hw/pci/pci_bus.h"
+
+PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *rootbus,
+   const char *default_model,
+   const char *default_devaddr);
+
+#endif
diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index aa7ef9cf69..6a0f7b5472 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -422,10 +422,6 @@ void pci_device_set_intx_routing_notifier(PCIDevice *dev,
   PCIINTxRoutingNotifier notifier);
 void pci_device_reset(PCIDevice *dev);
 
-PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *rootbus,
-   const char *default_model,
-   const char *default_devaddr);
-
 PCIDevice *pci_vga_init(PCIBus *bus);
 
 int pci_bus_num(PCIBus *s);
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 9e18b410d7..39fab3acb9 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -35,6 +35,7 @@
 #include "hw/arm/primecell.h"
 #include "hw/arm/virt.h"
 #include "hw/devices.h"
+#include "hw/net/pci.h"
 #include "net/net.h"
 #include "sysemu/block-backend.h"
 #include "sysemu/device_tree.h"
diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index 6945fa47c3..fb6a2f9363 100644
--- a/hw/mips/mips_malta.c
+++ b/hw/mips/mips_malta.c
@@ -48,6 +48,7 @@
 #include "hw/timer/mc146818rtc.h"
 #include "hw/input/i8042.h"
 #include "hw/timer/i8254.h"
+#include "hw/net/pci.h"
 #include "sysemu/blockdev.h"
 #include "exec/address-spaces.h"
 #include "hw/sysbus.h" /* SysBusDevice */
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 1e6fb88eba..9b678c8fd0 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -28,7 +28,6 @@
 #include "hw/pci/pci_bus.h"
 #include "hw/pci/pci_host.h"
 #include "monitor/monitor.h"
-#include "net/net.h"
 #include "sysemu/sysemu.h"
 #include "hw/loader.h"
 #include "qemu/error-report.h"
@@ -41,6 +40,7 @@
 #include "hw/hotplug.h"
 #include "hw/boards.h"
 #include "qemu/cutils.h"
+#include "pci_internal.h"
 
 //#define DEBUG_PCI
 #ifdef DEBUG_PCI
@@ -671,8 +671,7 @@ static int pci_parse_devaddr(const char *addr, int *domp, 
int *busp,
 return 0;
 }
 
-static PCIBus *pci_get_bus_devfn(int *devfnp, PCIBus *root,
- const char *devaddr)
+PCIBus *pci_get_bus_devfn(int *devfnp, PCIBus *root, const char *devaddr)
 {
 int dom, bus;
 unsigned slot;
@@ -1812,68 +1811,6 @@ PciInfoList *qmp_query_pci(Error **errp)
 return head;
 }
 
-static const char * const pci_nic_models[] = {
-"ne2k_pci",
-"i82551",
-"i82557b",
-"i82559er",
-"rtl8139",
-"e1000",
-"pcnet",
-"virtio",
-"sungem",
-NULL
-};
-
-static const char * const pci_nic_names[] = {
-"ne2k_pci",
-"i82551",
-"i82557b",
-"i82559er",
-"rtl8139",
-"e1000",
-"pcnet",
-"virtio-net-pci",
-"sungem",
-NULL
-};
-
-/* Initialize a PCI NIC.  */
-PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *rootbus,
-   const char *default_model,
-   const char *default_devaddr)
-{
-const char *devaddr = nd->devaddr ? nd->devaddr : default_devaddr;
-PCIBus *bus;
-PCIDevice *pci_dev;
-DeviceState *dev;
-int devfn;
-int i;
-
-if 

Re: [Qemu-devel] SunOS support

2017-09-22 Thread Peter Maydell
On 22 September 2017 at 16:51, Paolo Bonzini  wrote:
> On 22/09/2017 14:05, Peter Maydell wrote:
>> On 20 September 2017 at 19:50, Peter Tribble  wrote:
>>> To introduce myself: I'm a member of the illumos community (the successor
>>> to OpenSolaris, to those unfamiliar with us), and I maintain my own illumos
>>> distribution.
>>>
>>> Having seen the scary 'SUPPORT FOR THIS HOST OS WILL GO AWAY'
>>> message, I'm reaching out to see what needs to be done so that support for
>>> SunOS (not just illumos, I include Oracle's Solaris in the same family)
>>> needs to be kept and, where possible, enhanced.
>>>
>>> I'm willing to act as a contact in this effort, and can work with others in
>>> the illumos community to see if there are other resources we can bring to 
>>> bear.
>>
>> Hi; thanks for getting in touch with us. Kamil Rytarowski (who I've
>> cc'd) is also interested in keeping Solaris-variant support working.
>>
>> Essentially what we need as upstream is:
>>  * access to a machine which we can use for our continuous
>>integration build testing, so we don't break compile
>>support for the platform. This is ideally a machine that
>>somebody else admins and we just use (because we don't
>>want to become solaris/illumos admins ;-)), but failing
>>that, instructions on how to get a VM running under
>>KVM on Linux would also be OK (that's how we've ended
>>up handling the BSDs)
>
> I would even reverse the order since now we're handling the BSDs using
> the VM test infrastructure.  Let's say having both would be best.

I only have the one beefy machine to run VMs on, so the more
OSes we handle via VMs the more overloaded it gets. Also,
everything we have as a VM is another thing I have to maintain
and presumably update from time to time...

thanks
-- PMM



[Qemu-devel] [PATCH 26/34] hw/net/ne2000: extract ne2k-isa code from i386/pc to ne2000-isa.c

2017-09-22 Thread Philippe Mathieu-Daudé
- add "hw/net/ne2000-isa.h" (and new entry in MAINTAINERS)
- remove the old i386 dependency

Signed-off-by: Philippe Mathieu-Daudé 
---
 hw/net/ne2000.h |  3 +++
 include/hw/i386/pc.h| 20 
 include/hw/net/ne2000-isa.h | 33 +
 hw/i386/pc.c|  1 +
 hw/mips/mips_r4k.c  |  1 +
 hw/net/ne2000-isa.c |  6 ++
 hw/net/ne2000.c |  2 --
 hw/ppc/prep.c   |  1 +
 MAINTAINERS |  1 +
 9 files changed, 42 insertions(+), 26 deletions(-)
 create mode 100644 include/hw/net/ne2000-isa.h

diff --git a/hw/net/ne2000.h b/hw/net/ne2000.h
index d213dccae3..adb8021bd1 100644
--- a/hw/net/ne2000.h
+++ b/hw/net/ne2000.h
@@ -1,6 +1,9 @@
 #ifndef HW_NE2000_H
 #define HW_NE2000_H
 
+#include "hw/hw.h"
+#include "net/net.h"
+
 #define NE2000_PMEM_SIZE(32*1024)
 #define NE2000_PMEM_START   (16*1024)
 #define NE2000_PMEM_END (NE2000_PMEM_SIZE+NE2000_PMEM_START)
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 6a2e947332..020792c2e8 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -291,26 +291,6 @@ PCIBus *find_i440fx(void);
 extern PCIDevice *piix4_dev;
 int piix4_init(PCIBus *bus, ISABus **isa_bus, int devfn);
 
-/* ne2000.c */
-static inline bool isa_ne2000_init(ISABus *bus, int base, int irq, NICInfo *nd)
-{
-DeviceState *dev;
-ISADevice *isadev;
-
-qemu_check_nic_model(nd, "ne2k_isa");
-
-isadev = isa_try_create(bus, "ne2k_isa");
-if (!isadev) {
-return false;
-}
-dev = DEVICE(isadev);
-qdev_prop_set_uint32(dev, "iobase", base);
-qdev_prop_set_uint32(dev, "irq",irq);
-qdev_set_nic_properties(dev, nd);
-qdev_init_nofail(dev);
-return true;
-}
-
 /* pc_sysfw.c */
 void pc_system_firmware_init(MemoryRegion *rom_memory,
  bool isapc_ram_fw);
diff --git a/include/hw/net/ne2000-isa.h b/include/hw/net/ne2000-isa.h
new file mode 100644
index 00..ff2bed9c95
--- /dev/null
+++ b/include/hw/net/ne2000-isa.h
@@ -0,0 +1,33 @@
+/*
+ * QEMU NE2000 emulation -- isa bus windup
+ *
+ * Copyright (c) 2003-2004 Fabrice Bellard
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+#include "hw/hw.h"
+#include "hw/qdev.h"
+#include "hw/isa/isa.h"
+#include "net/net.h"
+
+#define TYPE_ISA_NE2000 "ne2k_isa"
+
+static inline ISADevice *isa_ne2000_init(ISABus *bus, int base, int irq,
+ NICInfo *nd)
+{
+ISADevice *d;
+
+qemu_check_nic_model(nd, "ne2k_isa");
+
+d = isa_try_create(bus, TYPE_ISA_NE2000);
+if (d) {
+DeviceState *dev = DEVICE(d);
+
+qdev_prop_set_uint32(dev, "iobase", base);
+qdev_prop_set_uint32(dev, "irq",irq);
+qdev_set_nic_properties(dev, nd);
+qdev_init_nofail(dev);
+}
+return d;
+}
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 788844e0de..085577e066 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -71,6 +71,7 @@
 #include "qom/cpu.h"
 #include "hw/nmi.h"
 #include "hw/i386/intel_iommu.h"
+#include "hw/net/ne2000-isa.h"
 
 /* debug PC/ISA interrupts */
 //#define DEBUG_IRQ
diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c
index 349da59912..33ff89f02c 100644
--- a/hw/mips/mips_r4k.c
+++ b/hw/mips/mips_r4k.c
@@ -18,6 +18,7 @@
 #include "hw/char/serial.h"
 #include "hw/isa/isa.h"
 #include "net/net.h"
+#include "hw/net/ne2000-isa.h"
 #include "sysemu/sysemu.h"
 #include "hw/boards.h"
 #include "hw/block/flash.h"
diff --git a/hw/net/ne2000-isa.c b/hw/net/ne2000-isa.c
index f3455339ee..70e5c1d3d4 100644
--- a/hw/net/ne2000-isa.c
+++ b/hw/net/ne2000-isa.c
@@ -22,17 +22,15 @@
  * THE SOFTWARE.
  */
 #include "qemu/osdep.h"
-#include "hw/hw.h"
-#include "hw/i386/pc.h"
 #include "hw/isa/isa.h"
+#include "hw/net/ne2000-isa.h"
 #include "hw/qdev.h"
-#include "net/net.h"
 #include "ne2000.h"
+#include "sysemu/sysemu.h"
 #include "exec/address-spaces.h"
 #include "qapi/error.h"
 #include "qapi/visitor.h"
 
-#define TYPE_ISA_NE2000 "ne2k_isa"
 #define ISA_NE2000(obj) OBJECT_CHECK(ISANE2000State, (obj), TYPE_ISA_NE2000)
 
 typedef struct ISANE2000State {
diff --git a/hw/net/ne2000.c b/hw/net/ne2000.c
index 798d681e25..29bd4adb3f 100644
--- a/hw/net/ne2000.c
+++ b/hw/net/ne2000.c
@@ -22,9 +22,7 @@
  * THE SOFTWARE.
  */
 #include "qemu/osdep.h"
-#include "hw/hw.h"
 #include "hw/pci/pci.h"
-#include "net/net.h"
 #include "ne2000.h"
 #include "hw/loader.h"
 #include "sysemu/sysemu.h"
diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
index 1f8ef4819b..fb330a1769 100644
--- a/hw/ppc/prep.c
+++ b/hw/ppc/prep.c
@@ -43,6 +43,7 @@
 #include "hw/timer/mc146818rtc.h"
 #include "hw/input/i8042.h"
 #include "hw/isa/pc87312.h"
+#include "hw/net/ne2000-isa.h"
 #include "sysemu/block-backend.h"
 #include "sysemu/arch_init.h"
 #include "sysemu/kvm.h"
diff --git a/MAINTAINERS b/MAINTAINERS
index 

[Qemu-devel] [PATCH 33/34] hw/alpha: remove old i386 dependency

2017-09-22 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé 
---
 hw/alpha/alpha_sys.h | 2 --
 hw/alpha/pci.c   | 2 ++
 hw/alpha/typhoon.c   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/alpha/alpha_sys.h b/hw/alpha/alpha_sys.h
index b6d8369ed7..ac685c1c46 100644
--- a/hw/alpha/alpha_sys.h
+++ b/hw/alpha/alpha_sys.h
@@ -5,8 +5,6 @@
 
 #include "target/alpha/cpu-qom.h"
 #include "hw/pci/pci.h"
-#include "hw/pci/pci_host.h"
-#include "hw/ide.h"
 #include "hw/i386/pc.h"
 #include "hw/irq.h"
 
diff --git a/hw/alpha/pci.c b/hw/alpha/pci.c
index 8dde637bfe..c370762ea6 100644
--- a/hw/alpha/pci.c
+++ b/hw/alpha/pci.c
@@ -8,6 +8,8 @@
 
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "hw/pci/pci.h"
+#include "hw/pci/pci_host.h"
 #include "alpha_sys.h"
 #include "qemu/log.h"
 #include "sysemu/sysemu.h"
diff --git a/hw/alpha/typhoon.c b/hw/alpha/typhoon.c
index ae11e012c7..75ac4ed354 100644
--- a/hw/alpha/typhoon.c
+++ b/hw/alpha/typhoon.c
@@ -11,9 +11,9 @@
 #include "cpu.h"
 #include "hw/hw.h"
 #include "hw/devices.h"
+#include "hw/pci/pci_host.h"
 #include "sysemu/sysemu.h"
 #include "alpha_sys.h"
-#include "exec/address-spaces.h"
 
 
 #define TYPE_TYPHOON_PCI_HOST_BRIDGE "typhoon-pcihost"
-- 
2.14.1




Re: [Qemu-devel] [PATCH 16/34] hw/tpm: remove old i386 dependency

2017-09-22 Thread Stefan Berger

On 09/22/2017 11:39 AM, Philippe Mathieu-Daudé wrote:

Signed-off-by: Philippe Mathieu-Daudé 


Reviewed-by: Stefan Berger 


---
  hw/tpm/tpm_passthrough.c | 1 -
  hw/tpm/tpm_tis.c | 1 -
  2 files changed, 2 deletions(-)

diff --git a/hw/tpm/tpm_passthrough.c b/hw/tpm/tpm_passthrough.c
index 9234eb3459..461f551a0c 100644
--- a/hw/tpm/tpm_passthrough.c
+++ b/hw/tpm/tpm_passthrough.c
@@ -29,7 +29,6 @@
  #include "sysemu/tpm_backend.h"
  #include "tpm_int.h"
  #include "hw/hw.h"
-#include "hw/i386/pc.h"
  #include "sysemu/tpm_backend_int.h"
  #include "tpm_tis.h"
  #include "tpm_util.h"
diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
index a6440fef91..a3a93f7229 100644
--- a/hw/tpm/tpm_tis.c
+++ b/hw/tpm/tpm_tis.c
@@ -28,7 +28,6 @@
  #include "sysemu/block-backend.h"
  #include "exec/address-spaces.h"
  #include "hw/hw.h"
-#include "hw/i386/pc.h"
  #include "hw/pci/pci_ids.h"
  #include "tpm_tis.h"
  #include "qapi/error.h"






[Qemu-devel] [PATCH 28/34] hw/net/e1000: use TYPE_PCI_E1000

2017-09-22 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé 
---
 include/hw/net/pci.h   | 2 ++
 hw/alpha/dp264.c   | 3 ++-
 hw/i386/pc.c   | 3 ++-
 hw/ppc/ppc440_bamboo.c | 3 ++-
 4 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/include/hw/net/pci.h b/include/hw/net/pci.h
index 529591b7f3..b24b5257a5 100644
--- a/include/hw/net/pci.h
+++ b/include/hw/net/pci.h
@@ -13,6 +13,8 @@
 #include "hw/pci/pci.h"
 #include "hw/pci/pci_bus.h"
 
+#define TYPE_PCI_E1000  "e1000"
+
 PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *rootbus,
const char *default_model,
const char *default_devaddr);
diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c
index df6dadf13f..65947fe1bf 100644
--- a/hw/alpha/dp264.c
+++ b/hw/alpha/dp264.c
@@ -21,6 +21,7 @@
 #include "hw/timer/i8254.h"
 #include "hw/input/i8042.h"
 #include "hw/char/serial.h"
+#include "hw/net/pci.h"
 #include "qemu/cutils.h"
 
 #define MAX_IDE_BUS 2
@@ -93,7 +94,7 @@ static void clipper_init(MachineState *machine)
 
 /* Network setup.  e1000 is good enough, failing Tulip support.  */
 for (i = 0; i < nb_nics; i++) {
-pci_nic_init_nofail(_table[i], pci_bus, "e1000", NULL);
+pci_nic_init_nofail(_table[i], pci_bus, TYPE_PCI_E1000, NULL);
 }
 
 /* IDE disk setup.  */
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 085577e066..3cdeb148aa 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -72,6 +72,7 @@
 #include "hw/nmi.h"
 #include "hw/i386/intel_iommu.h"
 #include "hw/net/ne2000-isa.h"
+#include "hw/net/pci.h"
 
 /* debug PC/ISA interrupts */
 //#define DEBUG_IRQ
@@ -1606,7 +1607,7 @@ void pc_nic_init(ISABus *isa_bus, PCIBus *pci_bus)
 if (!pci_bus || (nd->model && strcmp(nd->model, "ne2k_isa") == 0)) {
 pc_init_ne2k_isa(isa_bus, nd);
 } else {
-pci_nic_init_nofail(nd, pci_bus, "e1000", NULL);
+pci_nic_init_nofail(nd, pci_bus, TYPE_PCI_E1000, NULL);
 }
 }
 rom_reset_order_override();
diff --git a/hw/ppc/ppc440_bamboo.c b/hw/ppc/ppc440_bamboo.c
index f92d47f28d..6387dbda9f 100644
--- a/hw/ppc/ppc440_bamboo.c
+++ b/hw/ppc/ppc440_bamboo.c
@@ -24,6 +24,7 @@
 #include "elf.h"
 #include "exec/address-spaces.h"
 #include "hw/char/serial.h"
+#include "hw/net/pci.h"
 #include "hw/ppc/ppc.h"
 #include "ppc405.h"
 #include "sysemu/sysemu.h"
@@ -248,7 +249,7 @@ static void bamboo_init(MachineState *machine)
 for (i = 0; i < nb_nics; i++) {
 /* There are no PCI NICs on the Bamboo board, but there are
  * PCI slots, so we can pick whatever default model we want. */
-pci_nic_init_nofail(_table[i], pcibus, "e1000", NULL);
+pci_nic_init_nofail(_table[i], pcibus, TYPE_PCI_E1000, NULL);
 }
 }
 
-- 
2.14.1




[Qemu-devel] [PATCH 24/34] hw/timer/mc146818: rename rtc_init() -> mc146818_init()

2017-09-22 Thread Philippe Mathieu-Daudé
and remove the old i386/pc dependency

Signed-off-by: Philippe Mathieu-Daudé 
---
 include/hw/timer/mc146818rtc.h | 3 ++-
 hw/alpha/dp264.c   | 2 +-
 hw/i386/pc.c   | 2 +-
 hw/isa/i82378.c| 3 ++-
 hw/mips/mips_fulong2e.c| 2 +-
 hw/mips/mips_jazz.c| 2 +-
 hw/mips/mips_malta.c   | 2 +-
 hw/mips/mips_r4k.c | 2 +-
 hw/ppc/pnv.c   | 2 +-
 hw/timer/mc146818rtc.c | 2 +-
 10 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/include/hw/timer/mc146818rtc.h b/include/hw/timer/mc146818rtc.h
index 7c8e64b203..fe6ed63f71 100644
--- a/include/hw/timer/mc146818rtc.h
+++ b/include/hw/timer/mc146818rtc.h
@@ -6,7 +6,8 @@
 
 #define TYPE_MC146818_RTC "mc146818rtc"
 
-ISADevice *rtc_init(ISABus *bus, int base_year, qemu_irq intercept_irq);
+ISADevice *mc146818_rtc_init(ISABus *bus, int base_year,
+ qemu_irq intercept_irq);
 void rtc_set_memory(ISADevice *dev, int addr, int val);
 int rtc_get_memory(ISADevice *dev, int addr);
 
diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c
index 2253990654..df6dadf13f 100644
--- a/hw/alpha/dp264.c
+++ b/hw/alpha/dp264.c
@@ -80,7 +80,7 @@ static void clipper_init(MachineState *machine)
clipper_pci_map_irq);
 
 /* Since we have an SRM-compatible PALcode, use the SRM epoch.  */
-rtc_init(isa_bus, 1900, rtc_irq);
+mc146818_rtc_init(isa_bus, 1900, rtc_irq);
 
 i8254_pit_init(isa_bus, 0x40, 0, NULL);
 isa_create_simple(isa_bus, TYPE_I8042);
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 76d4be5991..788844e0de 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1545,7 +1545,7 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
 rtc_irq = qdev_get_gpio_in(hpet, HPET_LEGACY_RTC_INT);
 }
 }
-*rtc_state = rtc_init(isa_bus, 2000, rtc_irq);
+*rtc_state = mc146818_rtc_init(isa_bus, 2000, rtc_irq);
 
 qemu_register_boot_set(pc_boot_set, *rtc_state);
 
diff --git a/hw/isa/i82378.c b/hw/isa/i82378.c
index 7a8baef23c..14b006cadc 100644
--- a/hw/isa/i82378.c
+++ b/hw/isa/i82378.c
@@ -21,6 +21,7 @@
 #include "hw/pci/pci.h"
 #include "hw/i386/pc.h"
 #include "hw/timer/i8254.h"
+#include "hw/timer/mc146818rtc.h"
 #include "hw/audio/pcspk.h"
 
 #define TYPE_I82378 "i82378"
@@ -106,7 +107,7 @@ static void i82378_realize(PCIDevice *pci, Error **errp)
 isa = isa_create_simple(isabus, "i82374");
 
 /* timer */
-isa_create_simple(isabus, "mc146818rtc");
+isa_create_simple(isabus, TYPE_MC146818_RTC);
 }
 
 static void i82378_init(Object *obj)
diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c
index 6dc6a0ac18..7ebbffa8f2 100644
--- a/hw/mips/mips_fulong2e.c
+++ b/hw/mips/mips_fulong2e.c
@@ -371,7 +371,7 @@ static void mips_fulong2e_init(MachineState *machine)
 /* Super I/O */
 isa_create_simple(isa_bus, TYPE_I8042);
 
-rtc_init(isa_bus, 2000, NULL);
+mc146818_rtc_init(isa_bus, 2000, NULL);
 
 serial_hds_isa_init(isa_bus, 0, MAX_SERIAL_PORTS);
 parallel_hds_isa_init(isa_bus, 1);
diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c
index 1b54602c1d..439bbd71fe 100644
--- a/hw/mips/mips_jazz.c
+++ b/hw/mips/mips_jazz.c
@@ -295,7 +295,7 @@ static void mips_jazz_init(MachineState *machine,
 fdctrl_init_sysbus(qdev_get_gpio_in(rc4030, 1), -1, 0x80003000, fds);
 
 /* Real time clock */
-rtc_init(isa_bus, 1980, NULL);
+mc146818_rtc_init(isa_bus, 1980, NULL);
 memory_region_init_io(rtc, NULL, _ops, NULL, "rtc", 0x1000);
 memory_region_add_subregion(address_space, 0x80004000, rtc);
 
diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index 050da36f1d..6945fa47c3 100644
--- a/hw/mips/mips_malta.c
+++ b/hw/mips/mips_malta.c
@@ -1225,7 +1225,7 @@ void mips_malta_init(MachineState *machine)
 /* Super I/O */
 isa_create_simple(isa_bus, TYPE_I8042);
 
-rtc_init(isa_bus, 2000, NULL);
+mc146818_rtc_init(isa_bus, 2000, NULL);
 serial_hds_isa_init(isa_bus, 0, 2);
 parallel_hds_isa_init(isa_bus, 1);
 
diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c
index 946097a31f..349da59912 100644
--- a/hw/mips/mips_r4k.c
+++ b/hw/mips/mips_r4k.c
@@ -279,7 +279,7 @@ void mips_r4k_init(MachineState *machine)
 i8259 = i8259_init(isa_bus, env->irq[2]);
 isa_bus_irqs(isa_bus, i8259);
 
-rtc_init(isa_bus, 2000, NULL);
+mc146818_rtc_init(isa_bus, 2000, NULL);
 
 pit = i8254_pit_init(isa_bus, 0x40, 0, NULL);
 
diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index 47221158d4..d188b899c5 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -647,7 +647,7 @@ static void ppc_powernv_init(MachineState *machine)
 serial_hds_isa_init(pnv->isa_bus, 0, MAX_SERIAL_PORTS);
 
 /* Create an RTC ISA device too */
-rtc_init(pnv->isa_bus, 2000, NULL);
+mc146818_rtc_init(pnv->isa_bus, 2000, NULL);
 
 /* OpenPOWER systems use a IPMI SEL Event message to notify the
  * host to powerdown 

Re: [Qemu-devel] [PATCH 02/34] hw: remove "qemu/osdep.h" from header files

2017-09-22 Thread Peter Maydell
On 22 September 2017 at 16:39, Philippe Mathieu-Daudé  wrote:
> while here, add entries for ppc4xx_i2c in MAINTAINERS
>
> applied using ./scripts/clean-includes
>
> Signed-off-by: Philippe Mathieu-Daudé 
> ---

This is doing two things at once and would ideally be
two patches. Still,

Reviewed-by: Peter Maydell 

thanks
-- PMM



[Qemu-devel] [PATCH 30/34] hw/net/pcnet: use TYPE_PCI_PCNET

2017-09-22 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé 
---
 include/hw/net/pci.h | 1 +
 hw/mips/mips_malta.c | 2 +-
 hw/net/pcnet-pci.c   | 3 +--
 hw/ppc/prep.c| 3 ++-
 4 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/include/hw/net/pci.h b/include/hw/net/pci.h
index 92111f86f3..5ad5487a91 100644
--- a/include/hw/net/pci.h
+++ b/include/hw/net/pci.h
@@ -15,6 +15,7 @@
 
 #define TYPE_PCI_E1000  "e1000"
 #define TYPE_PCI_E1000E "e1000e"
+#define TYPE_PCI_PCNET  "pcnet"
 
 PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *rootbus,
const char *default_model,
diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index fb6a2f9363..921678fdb0 100644
--- a/hw/mips/mips_malta.c
+++ b/hw/mips/mips_malta.c
@@ -597,7 +597,7 @@ static void network_init(PCIBus *pci_bus)
 /* The malta board has a PCNet card using PCI SLOT 11 */
 default_devaddr = "0b";
 
-pci_nic_init_nofail(nd, pci_bus, "pcnet", default_devaddr);
+pci_nic_init_nofail(nd, pci_bus, TYPE_PCI_PCNET, default_devaddr);
 }
 }
 
diff --git a/hw/net/pcnet-pci.c b/hw/net/pcnet-pci.c
index 0acf8a4879..878e2c89c1 100644
--- a/hw/net/pcnet-pci.c
+++ b/hw/net/pcnet-pci.c
@@ -29,6 +29,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/pci/pci.h"
+#include "hw/net/pci.h"
 #include "net/net.h"
 #include "hw/loader.h"
 #include "qemu/timer.h"
@@ -46,8 +47,6 @@
 //#define PCNET_DEBUG_TMD
 //#define PCNET_DEBUG_MATCH
 
-#define TYPE_PCI_PCNET "pcnet"
-
 #define PCI_PCNET(obj) \
  OBJECT_CHECK(PCIPCNetState, (obj), TYPE_PCI_PCNET)
 
diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
index fb330a1769..b2c7a62ebc 100644
--- a/hw/ppc/prep.c
+++ b/hw/ppc/prep.c
@@ -44,6 +44,7 @@
 #include "hw/input/i8042.h"
 #include "hw/isa/pc87312.h"
 #include "hw/net/ne2000-isa.h"
+#include "hw/net/pci.h"
 #include "sysemu/block-backend.h"
 #include "sysemu/arch_init.h"
 #include "sysemu/kvm.h"
@@ -800,7 +801,7 @@ static void ibm_40p_init(MachineState *machine)
 pci_vga_init(pci_bus);
 
 for (i = 0; i < nb_nics; i++) {
-pci_nic_init_nofail(_table[i], pci_bus, "pcnet",
+pci_nic_init_nofail(_table[i], pci_bus, TYPE_PCI_PCNET,
 i == 0 ? "3" : NULL);
 }
 }
-- 
2.14.1




[Qemu-devel] [PATCH 31/34] hw/net/rtl8139: use TYPE_PCI_RTL8139

2017-09-22 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé 
---
 include/hw/net/pci.h| 1 +
 hw/arm/realview.c   | 3 ++-
 hw/arm/versatilepb.c| 3 ++-
 hw/mips/mips_fulong2e.c | 3 ++-
 hw/net/rtl8139.c| 7 +++
 hw/sh4/r2d.c| 5 +++--
 6 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/include/hw/net/pci.h b/include/hw/net/pci.h
index 5ad5487a91..43ed3b0145 100644
--- a/include/hw/net/pci.h
+++ b/include/hw/net/pci.h
@@ -16,6 +16,7 @@
 #define TYPE_PCI_E1000  "e1000"
 #define TYPE_PCI_E1000E "e1000e"
 #define TYPE_PCI_PCNET  "pcnet"
+#define TYPE_PCI_RTL8139"rtl8139"
 
 PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *rootbus,
const char *default_model,
diff --git a/hw/arm/realview.c b/hw/arm/realview.c
index 87cd1e583c..35f0da28e4 100644
--- a/hw/arm/realview.c
+++ b/hw/arm/realview.c
@@ -20,6 +20,7 @@
 #include "sysemu/sysemu.h"
 #include "hw/boards.h"
 #include "hw/i2c/i2c.h"
+#include "hw/net/pci.h"
 #include "sysemu/block-backend.h"
 #include "exec/address-spaces.h"
 #include "qemu/error-report.h"
@@ -269,7 +270,7 @@ static void realview_init(MachineState *machine,
 done_nic = 1;
 } else {
 if (pci_bus) {
-pci_nic_init_nofail(nd, pci_bus, "rtl8139", NULL);
+pci_nic_init_nofail(nd, pci_bus, TYPE_PCI_RTL8139, NULL);
 }
 }
 }
diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c
index 418792cd02..297aad78e1 100644
--- a/hw/arm/versatilepb.c
+++ b/hw/arm/versatilepb.c
@@ -18,6 +18,7 @@
 #include "sysemu/sysemu.h"
 #include "hw/pci/pci.h"
 #include "hw/i2c/i2c.h"
+#include "hw/net/pci.h"
 #include "hw/boards.h"
 #include "sysemu/block-backend.h"
 #include "exec/address-spaces.h"
@@ -271,7 +272,7 @@ static void versatile_init(MachineState *machine, int 
board_id)
 smc91c111_init(nd, 0x1001, sic[25]);
 done_smc = 1;
 } else {
-pci_nic_init_nofail(nd, pci_bus, "rtl8139", NULL);
+pci_nic_init_nofail(nd, pci_bus, TYPE_PCI_RTL8139, NULL);
 }
 }
 if (machine_usb(machine)) {
diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c
index 7ebbffa8f2..fe618953c9 100644
--- a/hw/mips/mips_fulong2e.c
+++ b/hw/mips/mips_fulong2e.c
@@ -44,6 +44,7 @@
 #include "hw/timer/mc146818rtc.h"
 #include "hw/timer/i8254.h"
 #include "hw/input/i8042.h"
+#include "hw/net/pci.h"
 #include "sysemu/blockdev.h"
 #include "exec/address-spaces.h"
 #include "sysemu/qtest.h"
@@ -253,7 +254,7 @@ static void network_init (PCIBus *pci_bus)
 default_devaddr = "07";
 }
 
-pci_nic_init_nofail(nd, pci_bus, "rtl8139", default_devaddr);
+pci_nic_init_nofail(nd, pci_bus, TYPE_PCI_RTL8139, default_devaddr);
 }
 }
 
diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
index 3be24bbee7..0f952eceba 100644
--- a/hw/net/rtl8139.c
+++ b/hw/net/rtl8139.c
@@ -59,6 +59,7 @@
 #include "net/net.h"
 #include "net/eth.h"
 #include "hw/loader.h"
+#include "hw/net/pci.h"
 #include "sysemu/sysemu.h"
 #include "qemu/iov.h"
 
@@ -90,10 +91,8 @@ static inline GCC_FMT_ATTR(1, 2) int DPRINTF(const char 
*fmt, ...)
 }
 #endif
 
-#define TYPE_RTL8139 "rtl8139"
-
 #define RTL8139(obj) \
- OBJECT_CHECK(RTL8139State, (obj), TYPE_RTL8139)
+ OBJECT_CHECK(RTL8139State, (obj), TYPE_PCI_RTL8139)
 
 /* Symbolic offsets to registers. */
 enum RTL8139_registers {
@@ -3437,7 +3436,7 @@ static void rtl8139_class_init(ObjectClass *klass, void 
*data)
 }
 
 static const TypeInfo rtl8139_info = {
-.name  = TYPE_RTL8139,
+.name  = TYPE_PCI_RTL8139,
 .parent= TYPE_PCI_DEVICE,
 .instance_size = sizeof(RTL8139State),
 .class_init= rtl8139_class_init,
diff --git a/hw/sh4/r2d.c b/hw/sh4/r2d.c
index 16b9ed2db2..dde60b2bc2 100644
--- a/hw/sh4/r2d.c
+++ b/hw/sh4/r2d.c
@@ -39,6 +39,7 @@
 #include "hw/ide.h"
 #include "hw/loader.h"
 #include "hw/usb.h"
+#include "hw/net/pci.h"
 #include "hw/block/flash.h"
 #include "sysemu/block-backend.h"
 #include "exec/address-spaces.h"
@@ -303,8 +304,8 @@ static void r2d_init(MachineState *machine)
 
 /* NIC: rtl8139 on-board, and 2 slots. */
 for (i = 0; i < nb_nics; i++)
-pci_nic_init_nofail(_table[i], pci_bus,
-"rtl8139", i==0 ? "2" : NULL);
+pci_nic_init_nofail(_table[i], pci_bus, TYPE_PCI_RTL8139,
+i == 0 ? "2" : NULL);
 
 /* USB keyboard */
 usb_create_simple(usb_bus_find(-1), "usb-kbd");
-- 
2.14.1




[Qemu-devel] [PATCH 25/34] hw/timer/m48t59: use TYPE_M48T59_ISA, add entries to MAINTAINERS

2017-09-22 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé 
---
 include/hw/timer/m48t59.h | 2 ++
 hw/ppc/prep.c | 2 +-
 hw/timer/m48t59-isa.c | 2 +-
 MAINTAINERS   | 2 ++
 4 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/include/hw/timer/m48t59.h b/include/hw/timer/m48t59.h
index db5e43a8da..069bb045d7 100644
--- a/include/hw/timer/m48t59.h
+++ b/include/hw/timer/m48t59.h
@@ -25,6 +25,8 @@ typedef struct NvramClass {
 void (*toggle_lock)(Nvram *obj, int lock);
 } NvramClass;
 
+#define TYPE_M48T59_ISA "isa-m48t59"
+
 Nvram *m48t59_init_isa(ISABus *bus, uint32_t io_base, uint16_t size,
int base_year, int type);
 Nvram *m48t59_init(qemu_irq IRQ, hwaddr mem_base,
diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c
index 16f4537093..1f8ef4819b 100644
--- a/hw/ppc/prep.c
+++ b/hw/ppc/prep.c
@@ -777,7 +777,7 @@ static void ibm_40p_init(MachineState *machine)
 /* add some more devices */
 if (defaults_enabled()) {
 isa_create_simple(isa_bus, TYPE_I8042);
-m48t59 = NVRAM(isa_create_simple(isa_bus, "isa-m48t59"));
+m48t59 = NVRAM(isa_create_simple(isa_bus, TYPE_M48T59_ISA));
 
 dev = DEVICE(isa_create(isa_bus, "cs4231a"));
 qdev_prop_set_uint32(dev, "iobase", 0x830);
diff --git a/hw/timer/m48t59-isa.c b/hw/timer/m48t59-isa.c
index ea1ba703d7..077346f7ca 100644
--- a/hw/timer/m48t59-isa.c
+++ b/hw/timer/m48t59-isa.c
@@ -49,7 +49,7 @@ typedef struct M48txxISADeviceClass {
 
 static M48txxInfo m48txx_isa_info[] = {
 {
-.bus_name = "isa-m48t59",
+.bus_name = TYPE_M48T59_ISA,
 .model = 59,
 .size = 0x2000,
 }
diff --git a/MAINTAINERS b/MAINTAINERS
index a79723601c..3cb6bc190c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -708,6 +708,8 @@ F: hw/pci-host/prep.[hc]
 F: hw/isa/i82378.c
 F: hw/isa/pc87312.[hc]
 F: hw/dma/i82374.c
+F: hw/timer/m48t59-isa.c
+F: include/hw/timer/m48t59.h
 F: pc-bios/ppc_rom.bin
 
 sPAPR
-- 
2.14.1




[Qemu-devel] [PATCH 29/34] hw/net/e1000e: use TYPE_PCI_E1000E

2017-09-22 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé 
---
 include/hw/net/pci.h | 1 +
 hw/net/e1000e.c  | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/include/hw/net/pci.h b/include/hw/net/pci.h
index b24b5257a5..92111f86f3 100644
--- a/include/hw/net/pci.h
+++ b/include/hw/net/pci.h
@@ -14,6 +14,7 @@
 #include "hw/pci/pci_bus.h"
 
 #define TYPE_PCI_E1000  "e1000"
+#define TYPE_PCI_E1000E "e1000e"
 
 PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *rootbus,
const char *default_model,
diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c
index 6c42b4478c..494f8cced6 100644
--- a/hw/net/e1000e.c
+++ b/hw/net/e1000e.c
@@ -40,6 +40,7 @@
 #include "sysemu/sysemu.h"
 #include "hw/pci/msi.h"
 #include "hw/pci/msix.h"
+#include "hw/net/pci.h"
 
 #include "hw/net/e1000_regs.h"
 
@@ -49,8 +50,7 @@
 #include "trace.h"
 #include "qapi/error.h"
 
-#define TYPE_E1000E "e1000e"
-#define E1000E(obj) OBJECT_CHECK(E1000EState, (obj), TYPE_E1000E)
+#define E1000E(obj) OBJECT_CHECK(E1000EState, (obj), TYPE_PCI_E1000E)
 
 typedef struct E1000EState {
 PCIDevice parent_obj;
@@ -703,7 +703,7 @@ static void e1000e_instance_init(Object *obj)
 }
 
 static const TypeInfo e1000e_info = {
-.name = TYPE_E1000E,
+.name =   TYPE_PCI_E1000E,
 .parent = TYPE_PCI_DEVICE,
 .instance_size = sizeof(E1000EState),
 .class_init = e1000e_class_init,
-- 
2.14.1




[Qemu-devel] [PATCH 23/34] hw/dma/i8257: rename DMA_init() to i8257_dma_init()

2017-09-22 Thread Philippe Mathieu-Daudé
- move the header from hw/isa/ to hw/dma/
- add entry for i82374 in MAINTAINERS
- remove the old i386/pc dependency

Signed-off-by: Philippe Mathieu-Daudé 
---
 include/hw/{isa/i8257.h => dma/i8257_dma.h} | 6 ++
 include/hw/isa/isa.h| 2 --
 hw/dma/i82374.c | 3 ++-
 hw/dma/i8257.c  | 4 ++--
 hw/i386/pc.c| 3 ++-
 hw/mips/mips_fulong2e.c | 3 ++-
 hw/mips/mips_jazz.c | 3 ++-
 hw/mips/mips_malta.c| 3 ++-
 hw/sparc/sun4m.c| 4 
 hw/sparc64/sun4u.c  | 4 
 MAINTAINERS | 2 ++
 11 files changed, 20 insertions(+), 17 deletions(-)
 rename include/hw/{isa/i8257.h => dma/i8257_dma.h} (86%)

diff --git a/include/hw/isa/i8257.h b/include/hw/dma/i8257_dma.h
similarity index 86%
rename from include/hw/isa/i8257.h
rename to include/hw/dma/i8257_dma.h
index 88a2766a3f..0041565177 100644
--- a/include/hw/isa/i8257.h
+++ b/include/hw/dma/i8257_dma.h
@@ -1,6 +1,10 @@
 #ifndef HW_I8257_H
 #define HW_I8257_H
 
+#include "hw/hw.h"
+#include "hw/isa/isa.h"
+#include "exec/ioport.h"
+
 #define TYPE_I8257 "i8257"
 
 typedef struct I8257Regs {
@@ -40,4 +44,6 @@ typedef struct I8257State {
 PortioList portio_pageh;
 } I8257State;
 
+void i8257_dma_init(ISABus *bus, int high_page_enable);
+
 #endif
diff --git a/include/hw/isa/isa.h b/include/hw/isa/isa.h
index 95593408ef..b9dbab24b4 100644
--- a/include/hw/isa/isa.h
+++ b/include/hw/isa/isa.h
@@ -151,6 +151,4 @@ static inline ISABus *isa_bus_from_device(ISADevice *d)
 return ISA_BUS(qdev_get_parent_bus(DEVICE(d)));
 }
 
-/* i8257.c */
-void DMA_init(ISABus *bus, int high_page_enable);
 #endif
diff --git a/hw/dma/i82374.c b/hw/dma/i82374.c
index 6c0f975df0..4048bedcf2 100644
--- a/hw/dma/i82374.c
+++ b/hw/dma/i82374.c
@@ -24,6 +24,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/isa/isa.h"
+#include "hw/dma/i8257_dma.h"
 
 #define TYPE_I82374 "i82374"
 #define I82374(obj) OBJECT_CHECK(I82374State, (obj), TYPE_I82374)
@@ -123,7 +124,7 @@ static void i82374_realize(DeviceState *dev, Error **errp)
 portio_list_add(>port_list, isa_address_space_io(>parent_obj),
 s->iobase);
 
-DMA_init(isa_bus_from_device(ISA_DEVICE(dev)), 1);
+i8257_dma_init(isa_bus_from_device(ISA_DEVICE(dev)), 1);
 memset(s->commands, 0, sizeof(s->commands));
 }
 
diff --git a/hw/dma/i8257.c b/hw/dma/i8257.c
index bd23e893bf..a8f26b003b 100644
--- a/hw/dma/i8257.c
+++ b/hw/dma/i8257.c
@@ -24,7 +24,7 @@
 #include "qemu/osdep.h"
 #include "hw/hw.h"
 #include "hw/isa/isa.h"
-#include "hw/isa/i8257.h"
+#include "hw/dma/i8257_dma.h"
 #include "qemu/main-loop.h"
 #include "trace.h"
 
@@ -622,7 +622,7 @@ static void i8257_register_types(void)
 
 type_init(i8257_register_types)
 
-void DMA_init(ISABus *bus, int high_page_enable)
+void i8257_dma_init(ISABus *bus, int high_page_enable)
 {
 ISADevice *isa1, *isa2;
 DeviceState *d;
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 3aa10c780b..76d4be5991 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -39,6 +39,7 @@
 #include "elf.h"
 #include "multiboot.h"
 #include "hw/timer/mc146818rtc.h"
+#include "hw/dma/i8257_dma.h"
 #include "hw/timer/i8254.h"
 #include "hw/input/i8042.h"
 #include "hw/audio/pcspk.h"
@@ -1582,7 +1583,7 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
 port92_init(port92, a20_line[1]);
 g_free(a20_line);
 
-DMA_init(isa_bus, 0);
+i8257_dma_init(isa_bus, 0);
 
 for(i = 0; i < MAX_FD; i++) {
 fd[i] = drive_get(IF_FLOPPY, 0, i);
diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c
index a35745a407..6dc6a0ac18 100644
--- a/hw/mips/mips_fulong2e.c
+++ b/hw/mips/mips_fulong2e.c
@@ -22,6 +22,7 @@
 #include "qapi/error.h"
 #include "hw/hw.h"
 #include "hw/i386/pc.h"
+#include "hw/dma/i8257_dma.h"
 #include "hw/char/serial.h"
 #include "hw/block/fdc.h"
 #include "net/net.h"
@@ -365,7 +366,7 @@ static void mips_fulong2e_init(MachineState *machine)
 
 /* init other devices */
 pit = i8254_pit_init(isa_bus, 0x40, 0, NULL);
-DMA_init(isa_bus, 0);
+i8257_dma_init(isa_bus, 0);
 
 /* Super I/O */
 isa_create_simple(isa_bus, TYPE_I8042);
diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c
index 1bbef7eeb5..1b54602c1d 100644
--- a/hw/mips/mips_jazz.c
+++ b/hw/mips/mips_jazz.c
@@ -27,6 +27,7 @@
 #include "hw/mips/mips.h"
 #include "hw/mips/cpudevs.h"
 #include "hw/i386/pc.h"
+#include "hw/dma/i8257_dma.h"
 #include "hw/char/serial.h"
 #include "hw/isa/isa.h"
 #include "hw/block/fdc.h"
@@ -223,7 +224,7 @@ static void mips_jazz_init(MachineState *machine,
 /* ISA devices */
 i8259 = i8259_init(isa_bus, env->irq[4]);
 isa_bus_irqs(isa_bus, i8259);
-DMA_init(isa_bus, 0);
+i8257_dma_init(isa_bus, 0);
 pit = i8254_pit_init(isa_bus, 0x40, 0, NULL);
 

Re: [Qemu-devel] [PATCH] docker: add installation to build tests

2017-09-22 Thread Paolo Bonzini
On 22/09/2017 14:47, Fam Zheng wrote:
> On Fri, 09/22 13:42, Paolo Bonzini wrote:
>> Drop ccache on Fedora, because it fails on RHEL 7.4, it is not used
>> by any other distro and it is not particularly useful on throwaway
>> containers.
> 
> I wonder what exactly failed with ccache? Patchew relies on it to speed up
> compiling every series on the list. The ccache db is not throwaway with that 
> in
> mind - git grep for CCACHE_DIR.

Got it.  For some reason the ccache dir in ~/.cache was owned by root.
I zapped it and now it works, so I've sent v2.

Paolo



Re: [Qemu-devel] SunOS support

2017-09-22 Thread Paolo Bonzini
On 22/09/2017 14:05, Peter Maydell wrote:
> On 20 September 2017 at 19:50, Peter Tribble  wrote:
>> To introduce myself: I'm a member of the illumos community (the successor
>> to OpenSolaris, to those unfamiliar with us), and I maintain my own illumos
>> distribution.
>>
>> Having seen the scary 'SUPPORT FOR THIS HOST OS WILL GO AWAY'
>> message, I'm reaching out to see what needs to be done so that support for
>> SunOS (not just illumos, I include Oracle's Solaris in the same family)
>> needs to be kept and, where possible, enhanced.
>>
>> I'm willing to act as a contact in this effort, and can work with others in
>> the illumos community to see if there are other resources we can bring to 
>> bear.
> 
> Hi; thanks for getting in touch with us. Kamil Rytarowski (who I've
> cc'd) is also interested in keeping Solaris-variant support working.
> 
> Essentially what we need as upstream is:
>  * access to a machine which we can use for our continuous
>integration build testing, so we don't break compile
>support for the platform. This is ideally a machine that
>somebody else admins and we just use (because we don't
>want to become solaris/illumos admins ;-)), but failing
>that, instructions on how to get a VM running under
>KVM on Linux would also be OK (that's how we've ended
>up handling the BSDs)

I would even reverse the order since now we're handling the BSDs using
the VM test infrastructure.  Let's say having both would be best.

Paolo

>  * somebody to look at the places where 'make && make check'
>currently fails and submit upstream patches for them. Kamil
>has been doing a great job here but would probably
>appreciate extra help :-)
>  * somebody who's willing to be listed in our MAINTAINERS file
>as maintaining the port, so we can ask them questions if/when
>any platform-specific issues come up in future
> 
> Overall we're happy to continue to support hosts that people
> are still using -- we just want to avoid blindly maintaining
> code for platforms we can't test and where we don't have
> any idea if anybody's even using it (for instance we just
> dropped the support for AIX and for Itanium CPUs...)
> 
> thanks
> -- PMM
> 




Re: [Qemu-devel] [RFC PATCH qemu] virtio-pci: Replace modern_as with direct access to modern_bar

2017-09-22 Thread Paolo Bonzini
On 22/09/2017 17:12, Alexey Kardashevskiy wrote:
> The modern bar is accessed now via yet another address space created just
> for that purpose and it does not really need FlatView and dispatch tree
> as it has a single memory region so it is just a waste of memory. Things
> get even worse when there are dozens or hundreds of virtio-pci devices -
> since these address spaces are global, changing any of them triggers
> rebuilding all address spaces.
> 
> This replaces indirect accesses to the modern BAR with a simple lookup
> and direct calls to memory_region_dispatch_read/write.
> 
> This is expected to save lots of memory at boot time after applying:
> [Qemu-devel] [PULL 00/32] Misc changes for 2017-09-22
> 
> Signed-off-by: Alexey Kardashevskiy 
> ---

There used to be this patch:
https://marc.info/?l=linux-virtualization=142363659531278=raw

> What is the easiest way to test it? Git history suggests that only
> SeaBIOS supports this, is this still correct?
> 
> What is best to do if MR is not found (and is it possible in practice)?
> assert or redirect to unassigned memory?

Do nothing at all, I think.

I haven't thought much about the endian switches, but it looks good
apart from that.

Paolo

> ---
>  hw/virtio/virtio-pci.h | 17 +++-
>  hw/virtio/virtio-pci.c | 71 
> --
>  2 files changed, 50 insertions(+), 38 deletions(-)
> 
> diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h
> index 69f5959623..12d3a90686 100644
> --- a/hw/virtio/virtio-pci.h
> +++ b/hw/virtio/virtio-pci.h
> @@ -155,15 +155,18 @@ typedef struct VirtIOPCIQueue {
>  struct VirtIOPCIProxy {
>  PCIDevice pci_dev;
>  MemoryRegion bar;
> -VirtIOPCIRegion common;
> -VirtIOPCIRegion isr;
> -VirtIOPCIRegion device;
> -VirtIOPCIRegion notify;
> -VirtIOPCIRegion notify_pio;
> +union {
> +struct {
> +VirtIOPCIRegion common;
> +VirtIOPCIRegion isr;
> +VirtIOPCIRegion device;
> +VirtIOPCIRegion notify;
> +VirtIOPCIRegion notify_pio;
> +};
> +VirtIOPCIRegion regs[5];
> +};
>  MemoryRegion modern_bar;
>  MemoryRegion io_bar;
> -MemoryRegion modern_cfg;
> -AddressSpace modern_as;
>  uint32_t legacy_io_bar_idx;
>  uint32_t msix_bar_idx;
>  uint32_t modern_io_bar_idx;
> diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
> index 8b0d6b69cd..0fcb8589f7 100644
> --- a/hw/virtio/virtio-pci.c
> +++ b/hw/virtio/virtio-pci.c
> @@ -545,6 +545,24 @@ static const MemoryRegionOps virtio_pci_config_ops = {
>  .endianness = DEVICE_LITTLE_ENDIAN,
>  };
>  
> +static MemoryRegion *virtio_address_space_lookup(VirtIOPCIProxy *proxy,
> + hwaddr *off, int len)
> +{
> +int i;
> +VirtIOPCIRegion *reg;
> +
> +for (i = 0; i < ARRAY_SIZE(proxy->regs); ++i) {
> +reg = >regs[i];
> +if (*off >= reg->offset &&
> +*off + len <= reg->offset + reg->size) {
> +*off -= reg->offset;
> +return >mr;
> +}
> +}
> +
> +return NULL;
> +}
> +
>  /* Below are generic functions to do memcpy from/to an address space,
>   * without byteswaps, with input validation.
>   *
> @@ -558,63 +576,68 @@ static const MemoryRegionOps virtio_pci_config_ops = {
>   * Note: host pointer must be aligned.
>   */
>  static
> -void virtio_address_space_write(AddressSpace *as, hwaddr addr,
> +void virtio_address_space_write(VirtIOPCIProxy *proxy, hwaddr addr,
>  const uint8_t *buf, int len)
>  {
> -uint32_t val;
> +uint64_t val;
> +MemoryRegion *mr;
>  
>  /* address_space_* APIs assume an aligned address.
>   * As address is under guest control, handle illegal values.
>   */
>  addr &= ~(len - 1);
>  
> +mr = virtio_address_space_lookup(proxy, , len);
> +assert(mr);
> +
>  /* Make sure caller aligned buf properly */
>  assert(!(((uintptr_t)buf) & (len - 1)));
>  
>  switch (len) {
>  case 1:
>  val = pci_get_byte(buf);
> -address_space_stb(as, addr, val, MEMTXATTRS_UNSPECIFIED, NULL);
>  break;
>  case 2:
> -val = pci_get_word(buf);
> -address_space_stw_le(as, addr, val, MEMTXATTRS_UNSPECIFIED, NULL);
> +val = cpu_to_le16(pci_get_word(buf));
>  break;
>  case 4:
> -val = pci_get_long(buf);
> -address_space_stl_le(as, addr, val, MEMTXATTRS_UNSPECIFIED, NULL);
> +val = cpu_to_le32(pci_get_long(buf));
>  break;
>  default:
>  /* As length is under guest control, handle illegal values. */
> -break;
> +return;
>  }
> +memory_region_dispatch_write(mr, addr, val, len, MEMTXATTRS_UNSPECIFIED);
>  }
>  
>  static void
> -virtio_address_space_read(AddressSpace *as, hwaddr addr, uint8_t *buf, int 
> len)
> 

  1   2   3   4   5   >