Commit graph

74177 commits

Author SHA1 Message Date
Marc-André Lureau 4cc76287d8 lance: replace PROP_PTR with PROP_LINK
The device remains non-user creatable since it is a sysbus device.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2020-01-07 17:24:29 +04:00
Marc-André Lureau 0fe4bb3241 vmmouse: replace PROP_PTR with PROP_LINK
While at it, use the expected type.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2020-01-07 17:24:29 +04:00
Marc-André Lureau 0ed40f16a1 sm501: make SerialMM a child, export chardev property
Embed the SerialMM sybus device, and re-export its "chardev" property.
That way, we can get rid of PROP_PTR "chr-state" and better track
devices relationship.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2020-01-07 17:24:29 +04:00
Marc-André Lureau d9259178fe mips: use sysbus_mmio_get_region() instead of internal fields
Register the memory region with sysbus_init_mmio() and look it up with
sysbus_mmio_get_region() to avoid accessing internal device fields.

Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2020-01-07 17:24:29 +04:00
Marc-André Lureau 4f1733d4c0 mips: use sysbus_add_io()
sysbus devices should use the associated helper function instead of
calling memory_region_add_subregion() manually. This simplifies
slightly the code.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2020-01-07 17:24:29 +04:00
Marc-André Lureau f90f2cf7ae mips: baudbase is 115200 by default
(The default value is set for TYPE_SERIAL in serial_properties)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
2020-01-07 17:24:29 +04:00
Marc-André Lureau 9fac5d88ee mips: inline serial_init()
The function is specific to mipssim, let's inline it.

(when inlining, we use a DeviceState variable instead of SerialIO, as
it is the most common type used, and avoids having too many casts)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
2020-01-07 17:24:29 +04:00
Marc-André Lureau 10315a7089 serial: make SerialIO a sysbus device
Make serial IO a proper sysbus device, similar to serial MM.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2020-01-07 17:24:29 +04:00
Marc-André Lureau 9bc7176c8c serial-mm: use sysbus facilities
Make SerialMM a regular sysbus device, by registering the irq, and the
mmio region. Reexport the internal serial properties.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2020-01-07 17:24:29 +04:00
Marc-André Lureau 80b2eed95d serial-mm: add endianness property
Add a qdev property for endianness, so memory region setup can be done
in realize.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2020-01-07 17:24:29 +04:00
Marc-André Lureau 17fd1a6490 serial-mm: add "regshift" property
And a property and rename "it_shift" field to "regshift", as it seems
to be more popular (and I don't know what "it" stands for).

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2020-01-07 17:24:21 +04:00
Marc-André Lureau 490a9d9b36 serial: start making SerialMM a sysbus device
Memory mapped serial device is in fact a sysbus device. The following
patches will make use of sysbus facilities for resource and
registration. In particular, "serial-mm: use sysbus facilities" will
move internal serial realization to serial_mm_realize callback to
follow qdev best practices.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2020-01-07 17:23:30 +04:00
Laurent Vivier 18b6102e51 target/m68k: only change valid bits in CACR
This is used by netBSD (and MacOS ROM) to detect the MMU type

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Thomas Huth <huth@tuxfamily.org>
Message-Id: <20191220172415.35838-1-laurent@vivier.eu>
[lv: add a comment before m680x0_cpu_common()]
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-01-07 14:21:18 +01:00
Marc-André Lureau b9975000a0 serial: replace serial_exit_core() with unrealize
Instead of calling serial_exit_core() directly, use the QDev unrealize
callback.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2020-01-07 16:50:48 +04:00
Marc-André Lureau c9808d6028 serial: realize the serial device
Instead of calling serial_realize_core(), use the QDev realize
callback.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2020-01-07 16:50:48 +04:00
Marc-André Lureau 96651db423 serial: add "baudbase" property
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2020-01-07 16:50:48 +04:00
Marc-André Lureau ff22c588f4 serial: add "chardev" property
This is more QOM-friendly, callers may set/get the property themself.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2020-01-07 16:50:48 +04:00
Marc-André Lureau 4cc017e505 serial: register vmsd with DeviceClass
Migration from old to new code works, however the other way fails for
devices that use serial_init/serial_mm_init with "base", used as
instance_id previously.

(with qdev_set_legacy_instance_id, the alias_id is only used in
savevm.c:find_se(), and thus can only be used to match against
"legacy" instance id values. On new code, instance_id is generated
incrementally from 0 with calculate_new_instance_id(), based on
"qdev-path/vmsd-name")

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: xiaoqiang zhao <zxq_yx_007@163.com>
2020-01-07 16:50:42 +04:00
Marc-André Lureau 7781b88ee4 serial: initial qom-ification
Make SerialState a device (the following patches will introduce IO/MM
sysbus serial devices)

None of the serial_{,mm}_init() callers actually free the returned
value (even if they did, it would be quite harmless), so we can change
the object allocation at will.

However, the devices that embed SerialState must now have their field
QOM-initialized manually (isa, pci, pci-multi).

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2020-01-07 16:50:15 +04:00
Marc-André Lureau 4305d4825c serial-pci-multi: factor out multi_serial_get_port_count()
Common function to be reused in next patch.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2020-01-07 16:50:15 +04:00
Marc-André Lureau 1e419ee68f chardev: generate an internal id when none given
Internally, qemu may create chardev without ID. Those will not be
looked up with qemu_chr_find(), which prevents using qdev_prop_set_chr().

Use id_generate(), to generate an internal name (prefixed with #), so
no conflict exist with user-named chardev.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: xiaoqiang zhao <zxq_yx_007@163.com>
2020-01-07 16:50:09 +04:00
Jason A. Donenfeld e24e58e8ac q800: implement mac rom reset function for BIOS-less mode
On Linux, calling `reboot(RB_AUTOBOOT);` will result in
arch/m68k/mac/misc.c's mac_reset function being called. That in turn
looks at the rombase (or uses 0x40800000 is there's no rombase), adds
0xa, and jumps to that address. At the moment, there's nothing there, so
the kernel just crashes when trying to reboot. So, this commit adds a
very simple implementation at that location, which just writes to via2
to power down. We also correct the value of ROMBASE while we're at it.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20200102120150.281082-1-Jason@zx2c4.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2020-01-07 13:35:53 +01:00
Laurent Vivier eb064db94c q800: add a block backend to the PRAM
This allows to save and restore the content of the PRAM.
It may be useful if we want to check the configuration or to change it.

The backend is added using mtd interface, for instance:

    ... -drive file=pram.img,format=raw,if=mtd ...

where pram.img is the file where the data will be stored, its size must
be 256 bytes.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20191219201439.84804-3-laurent@vivier.eu>
2020-01-07 13:35:53 +01:00
Laurent Vivier b2619c158a q800: fix mac_via RTC PRAM commands
The command byte is not decoded correctly.

This patch reworks the RTC/PRAM interface and fixes the problem.
It adds a comment before the function to explain how are encoded commands
and some trace-events to ease debugging.

Bug: https://bugs.launchpad.net/qemu/+bug/1856549
Fixes: 6dca62a000 ("hw/m68k: add VIA support")
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Message-Id: <20191219201439.84804-2-laurent@vivier.eu>
2020-01-07 13:35:53 +01:00
Marc-André Lureau a35c6ccc06 sysbus: remove outdated comment
The init callback is no more since commit
817a17fc60 ("core/sysbus: remove the
SysBusDeviceClass::init path")

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2020-01-07 16:06:59 +04:00
Marc-André Lureau 7e83a77f96 sysbus: remove unused sysbus_try_create*
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2020-01-07 16:06:59 +04:00
Philippe Mathieu-Daudé 7aca3782d9 hw/display/sm501: Always map the UART0
The SM501 is a Mobile Multimedia Companion Chip with 2 UARTs.
This model only implements the first UART. Being part of the
chipset, the UART block is always mapped in memory, regardless
of whether we provide a chardev backend.

Since commit 12051d82f, qemu_chr_fe_init() accepts a NULL chardev.
Let's remove the chardev check and always map the UART in the
chipset memory.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20191122133623.13004-1-philmd@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2020-01-07 16:06:59 +04:00
Philippe Mathieu-Daudé c9c6b2e1c4 hw/rtc/mc146818: Add missing dependency on ISA Bus
The MC146818 sits on an ISA bus. Since it can not be used
without it, select ISA in the Kconfig.

Fixes: 82f5181777 ("kconfig: introduce kconfig files", 2019-03-07)
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20191224111628.3551-1-philmd@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-01-07 12:23:10 +01:00
Peter Maydell a8f2c60cef VFIO fixes 2020-01-06
- Fix irqchip notifier de-registration if not registered (Peter Xu)
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.14 (GNU/Linux)
 
 iQIcBAABAgAGBQJeE615AAoJECObm247sIsi+IgQALBY5KS4d9tSlMjpR8WgGXTW
 wWLkOhuPdb4l+DIKivmYBO5XtXjsKTE6YMIsTkeOPZWVP/daEQvm8pxHFcxh5jXl
 riRLt1OWPP/MJ0umLmuNleKCfSkTyyAW9IDz72Pwink/Uebuy4IYAv8vWWtlPEUl
 72Pt4H3WfW/MYBOc01DrTOz9V10RS+e+tf+HtnEWmGXf6tWEj+8qx7dZh6+O8F+n
 skGbHFDReL4jumeNynYNVcaMuMVXwrZ0OHi1I1Tebe3XBLn/3cQq/lepKaTrKjVh
 UdYqp6XY9gcOKl7+xUxf7Ov1++LLbKfrxXViH1PHbs8e1QgpRdEe8cSDJK3eTgrg
 H7tCF6IJ5pzcU+lGjAsVmHJxL6GXZtHqHxzxx1mKC5mNBcqjUbVCyX1Wak4XqUQd
 0ccaSIt/msPcIlvq/YWaHaEp7YBFnSntVBLqjCuWKc+8QEVUhUJYI2XNViNt86Xz
 9T2b3c6234tWVXGIYAt5YSj0MCokPBi2aT82P3b6AS02pS3riu63JkiwtckJhGOQ
 5ASIF8RuPg9TsVIb8gPEl2xyiEZ6LFF4WtVQIbzih3zSllTO9i1pVKvjZ0HGaHF/
 angF/oyYYPk+xLMdx5kgUccR8hMOj2wcfrySwL72SCOI4eFSuRY7X7Ctio947pXE
 BI7YlltIuccOkJe4kmUl
 =Uxch
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/awilliam/tags/vfio-fixes-20200106.0' into staging

VFIO fixes 2020-01-06

 - Fix irqchip notifier de-registration if not registered (Peter Xu)

# gpg: Signature made Mon 06 Jan 2020 21:58:17 GMT
# gpg:                using RSA key 239B9B6E3BB08B22
# gpg: Good signature from "Alex Williamson <alex.williamson@redhat.com>" [full]
# gpg:                 aka "Alex Williamson <alex@shazbot.org>" [full]
# gpg:                 aka "Alex Williamson <alwillia@redhat.com>" [full]
# gpg:                 aka "Alex Williamson <alex.l.williamson@gmail.com>" [full]
# Primary key fingerprint: 42F6 C04E 540B D1A9 9E7B  8A90 239B 9B6E 3BB0 8B22

* remotes/awilliam/tags/vfio-fixes-20200106.0:
  vfio/pci: Don't remove irqchip notifier if not registered

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-01-07 11:09:54 +00:00
Philippe Mathieu-Daudé 7bebc358df hw/nvram/Kconfig: Restrict CHRP NVRAM to machines using OpenBIOS or SLOF
Only the OpenBIOS and SLOF firmwares use the CHRP NVRAM layout.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20191231183216.6781-14-philmd@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-01-07 12:08:39 +01:00
Philippe Mathieu-Daudé 3fd0305eaf hw/nvram/Kconfig: Add an entry for the NMC93xx EEPROM
The NMC93xx EEPROM is only used by few NIC cards and the
Am53C974 SCSI controller.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20191231183216.6781-13-philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-01-07 12:08:39 +01:00
Philippe Mathieu-Daudé b0048f7609 hw/ppc/Kconfig: Only select FDT helper for machines using it
Not all machines use the ppc_create_page_sizes_prop() helper.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20191231183216.6781-12-philmd@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-01-07 12:08:39 +01:00
Philippe Mathieu-Daudé 032757adaa hw/ppc/Kconfig: Only select fw_cfg with machines using OpenBIOS
The fw_cfg helpers are only used by machines using OpenBIOS.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20191231183216.6781-11-philmd@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-01-07 12:08:39 +01:00
Philippe Mathieu-Daudé 7496975722 hw/ppc/Makefile: Simplify the sPAPR PCI objects rule
The CONFIG_PSERIES already selects CONFIG_PCI.
Simplify the Makefile rules.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20191231183216.6781-10-philmd@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-01-07 12:08:39 +01:00
Philippe Mathieu-Daudé 45b0bd1095 hw/ppc/Kconfig: Let the Xilinx Virtex5 ML507 use the PPC-440 devices
When configured with --without-default-devices, the build fails:

    LINK    ppc-softmmu/qemu-system-ppc
  /usr/bin/ld: hw/ppc/virtex_ml507.o: in function `ppc440_init_xilinx':
  hw/ppc/virtex_ml507.c:112: undefined reference to `ppcuic_init'
  collect2: error: ld returned 1 exit status
  make[1]: *** [Makefile:206: qemu-system-ppc] Error 1
  make: *** [Makefile:483: ppc-softmmu/all] Error 2

Fix by selecting the PPC4XX config.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20191231183216.6781-9-philmd@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-01-07 12:08:39 +01:00
Philippe Mathieu-Daudé def9119efe hw/ppc/Kconfig: Let the Sam460ex board use the PowerPC 405 devices
When configured with --without-default-devices, the build fails:

    LINK    ppc-softmmu/qemu-system-ppc
  /usr/bin/ld: hw/ppc/sam460ex.o: in function `sam460ex_init':
  hw/ppc/sam460ex.c:313: undefined reference to `ppc4xx_plb_init'
  /usr/bin/ld: hw/ppc/sam460ex.c:353: undefined reference to `ppc405_ebc_init'
  collect2: error: ld returned 1 exit status
  make[1]: *** [Makefile:206: qemu-system-ppc] Error 1

Fix by selecting the PPC405 config.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20191231183216.6781-8-philmd@redhat.com>
Reviewed-by: BALATON Zoltan <balaton@eik.bme.hu>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-01-07 12:08:39 +01:00
Philippe Mathieu-Daudé a0297be4be hw/ppc/Kconfig: Restrict the MPC I2C controller to e500-based platforms
Only the PowerPC e500-based platforms use the MPC I2C controller.
Do not build it for the other machines.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20191231183216.6781-7-philmd@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-01-07 12:08:39 +01:00
Philippe Mathieu-Daudé ff2efdcdc1 hw/i386/Kconfig: Let the MicroVM machine select the SERIAL_ISA config
When configured with --without-default-devices, the build fails:

     LINK    x86_64-softmmu/qemu-system-x86_64
  /usr/bin/ld: hw/i386/microvm.o: in function `microvm_devices_init':
  hw/i386/microvm.c:157: undefined reference to `serial_hds_isa_init'
  collect2: error: ld returned 1 exit status
  make[1]: *** [Makefile:206: qemu-system-x86_64] Error 1
  make: *** [Makefile:483: x86_64-softmmu/all] Error 2

While the MicroVM machine only uses the ISA serial port when the
MICROVM_MACHINE_ISA_SERIAL property is set, it has to be linked
with it. Replace the 'imply' Kconfig rule by a 'select'.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20191231183216.6781-4-philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-01-07 12:08:39 +01:00
Philippe Mathieu-Daudé 48ca2c4aa1 hw/intc/i8259: Fix Kconfig dependency on ISA bus
The 8259 Interrupt Controller sits on a ISA bus.
Add the missing dependency to fix:

    LINK    x86_64-softmmu/qemu-system-x86_64
  /usr/bin/ld: ../hw/intc/i8259_common.o: in function `pic_common_realize':
  hw/intc/i8259_common.c:84: undefined reference to `isa_register_ioport'
  /usr/bin/ld: hw/intc/i8259_common.c:86: undefined reference to `isa_register_ioport'
  /usr/bin/ld: ../hw/intc/i8259_common.o: in function `i8259_init_chip':
  hw/intc/i8259_common.c:97: undefined reference to `isa_create'
  collect2: error: ld returned 1 exit status
  make[1]: *** [Makefile:206: qemu-system-x86_64] Error 1

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20191231183216.6781-3-philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-01-07 12:08:39 +01:00
Philippe Mathieu-Daudé be3d7ee960 hw/usb/redirect: Do not link 'usb-redir' device when USB not enabled
The 'usb-redir' device requires the USB core code to work. Do not
link it when there is no USB support. This fixes:

  $ qemu-system-tricore -M tricore_testboard -device usb-redir
  qemu-system-tricore: -device usb-redir: No 'usb-bus' bus found for device 'usb-redir'

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20191231183216.6781-2-philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-01-07 12:08:39 +01:00
Philippe Mathieu-Daudé dccdaa1f75 hw/timer/Kconfig: Intel 8254 PIT depends of ISA bus
Since i8254_common.c calls isa_register_ioport() from "hw/isa/isa.h"
we can not select it when ISA_BUS is disabled. Add a 'depends on'
clause.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200106171912.16523-1-philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-01-07 12:08:39 +01:00
Peter Wu a88c40f02a hw/i386/pc: fix regression in parsing vga cmdline parameter
When the 'vga=' parameter is succeeded by another parameter, QEMU 4.2.0
would refuse to start with a rather cryptic message:

    $ qemu-system-x86_64 -kernel /boot/vmlinuz-linux -append 'vga=792 quiet'
    qemu: can't parse 'vga' parameter: Invalid argument

It was not clear whether this applied to the '-vga std' parameter or the
'-append' one. Fix the parsing regression and clarify the error.

Fixes: 133ef074bd ("hw/i386/pc: replace use of strtol with qemu_strtoui in x86_load_linux()")
Cc: Sergio Lopez <slp@redhat.com>
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
Message-Id: <20191221162124.1159291-1-peter@lekensteyn.nl>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-01-07 12:08:39 +01:00
Philippe Mathieu-Daudé 218fc2b5c8 hw/i386/x86-iommu: Add missing stubs
In commit 6c730e4af9 we introduced a stub to build the MicroVM
machine without Intel IOMMU. This stub is incomplete for the
other PC machines. Add the missing stubs.

Fixes: 6c730e4af9 ("pc: stubify x86 iommu", 2019-12-17)
Reported-by: Travis-CI
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20191220154225.25879-1-philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-01-07 12:08:39 +01:00
Pavel Dovgalyuk 878ec29b9c replay: record and replay random number sources
Record/replay feature of icount allows deterministic running of execution
scenarios. Some CPUs and peripheral devices read random numbers from
external sources making deterministic execution impossible.
This patch adds recording and replaying of random read operations
into guest-random module, which is used by the virtual hardware.

Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
Message-Id: <157675984852.14505.15709141760677102489.stgit@pasha-Precision-3630-Tower>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-01-07 12:08:39 +01:00
Pavel Dovgalyuk fc6b2dbac1 replay: check other timers for icount limit
Record/replay can stall when there are no virtual devices that generate
events - it just uses all the time for vCPU thread. Therefore main loop
has to wait too much for the vCPU thread, because they are synchronized
in rr mode.
This patch does not let creating too long vCPU executions without
interrupting to main loop. It checks realtime timers that always exits
to control user input.

Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
Message-Id: <157675958855.14346.18049977447896411847.stgit@pasha-Precision-3630-Tower>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-01-07 12:08:39 +01:00
Denis Plotnikov 3817261eb9 hw: fix using 4.2 compat in 5.0 machine types for i440fx/q35
5.0 machine type uses 4.2 compats. This seems to be incorrect, since
the latests machine type by now is 5.0 and it should use its own
compat or shouldn't use any relying on the defaults.
Seems, like this appeared because of some problems on merge/rebase.

Signed-off-by: Denis Plotnikov <dplotnikov@virtuozzo.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20191223072856.5369-1-dplotnikov@virtuozzo.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-01-07 12:08:39 +01:00
Xiaoyao Li d1972be13f accel/kvm: Make "kernel_irqchip" default on
Commit 11bc4a13d1 ("kvm: convert "-machine kernel_irqchip" to an
accelerator property") moves kernel_irqchip property from "-machine" to
"-accel kvm", but it forgets to set the default value of
kernel_irqchip_allowed and kernel_irqchip_split.

Also cleaning up the three useless members (kernel_irqchip_allowed,
kernel_irqchip_required, kernel_irqchip_split) in struct MachineState.

Fixes: 11bc4a13d1 ("kvm: convert "-machine kernel_irqchip" to an accelerator property")
Reported-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Message-Id: <20191228104326.21732-1-xiaoyao.li@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-01-07 12:08:39 +01:00
Michal Privoznik 8f54bbd0b4 x86: Check for machine state object class before typecasting it
In ed9e923c3c ("x86: move SMM property to X86MachineState", 2019-12-17)
In v4.2.0-246-ged9e923c3c the SMM property was moved from PC
machine class to x86 machine class. Makes sense, but the change
was too aggressive: in target/i386/kvm.c:kvm_arch_init() it
altered check which sets SMRAM if given machine has SMM enabled.
The line that detects whether given machine object is class of
PC_MACHINE was removed from the check. This makes qemu try to
enable SMRAM for all machine types, which is not what we want.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Fixes: ed9e923c3c ("x86: move SMM property to X86MachineState", 2019-12-17)
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <7cc91bab3191bfd7e071bdd3fdf7fe2a2991deb0.1577692822.git.mprivozn@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-01-07 12:08:38 +01:00
Peter Maydell cdbc5c51c8 target/xtensa improvements for v5.0:
- fix ps.ring use in MPU configs;
 - use MPU background map from the configuration overlay.
 -----BEGIN PGP SIGNATURE-----
 
 iQJHBAABCgAxFiEEK2eFS5jlMn3N6xfYUfnMkfg/oEQFAl4TkeETHGpjbXZia2Jj
 QGdtYWlsLmNvbQAKCRBR+cyR+D+gRJNkD/99d3a+ounDKt1yADRvJCt2wYdjAltC
 eiuxqzjWzRWyY6rlTwpMuvpVAS3Gz0m1rF38PTtfARRorLkvgEMVELsQ0Dn7FNq9
 c4yd8dUBFi6G2fXVshzUJe4y9YUENg6OPwO9DAltqwIm8V1XTwNhKvFyBrg3l8NW
 JJp8USCZH1JAvmcpB8T5RM7K2oBOLFIZurLFUNlUPlcdt968wIbDYQLCpz8olpc0
 Jd5LqtV+IFfWwbeUOkSD2iM7kcD+HSPZZUbcokCkADLHHWqgMgQAXBScj42yA8O/
 Vt7SSPAZm0H+VSQPdSH2R8W4CRne4txtIdk7z7xa8xqBntDmyjvaJv4gqzeW5XP0
 DKbLj6UYmztCxwGKcS+JU54sVmMxrioVWFtLqRdF6d7/rEXXP7OM0wEbdvw8nccE
 aTLHnMV1MhmycA1PSdB06gGzfDVG6mkysftoYo2rZdTis4XR3WUxcayZyMgQnQHu
 7zJn3L5FE0N/5eebrigqOMinm9ukz6SKj+fJY+qJCEGRrZW64EsDCsgrpKRBuXRL
 Idq1mi/hmm1GjPOrp1U2y2JZ1sz62p9GyabzzYRGSbyUl+ERlwx6QOpKUOUvvlyq
 P78cvdiLsOSO5rG3j1t83IhVH1KMc21b3L/BupyUEqSSFFx6rvS5KEor6lgZq180
 MbOkKFUWswLGGw==
 =G4de
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/xtensa/tags/20200106-xtensa' into staging

target/xtensa improvements for v5.0:

- fix ps.ring use in MPU configs;
- use MPU background map from the configuration overlay.

# gpg: Signature made Mon 06 Jan 2020 20:00:33 GMT
# gpg:                using RSA key 2B67854B98E5327DCDEB17D851F9CC91F83FA044
# gpg:                issuer "jcmvbkbc@gmail.com"
# gpg: Good signature from "Max Filippov <filippov@cadence.com>" [unknown]
# gpg:                 aka "Max Filippov <max.filippov@cogentembedded.com>" [full]
# gpg:                 aka "Max Filippov <jcmvbkbc@gmail.com>" [full]
# Primary key fingerprint: 2B67 854B 98E5 327D CDEB  17D8 51F9 CC91 F83F A044

* remotes/xtensa/tags/20200106-xtensa:
  target/xtensa: use MPU background map from core configuration
  target/xtensa: import xtensa/config/core-isa.h
  target/xtensa: fix ps.ring use in MPU configs

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-01-07 10:31:07 +00:00
Peter Xu 0446f81217 vfio/pci: Don't remove irqchip notifier if not registered
The kvm irqchip notifier is only registered if the device supports
INTx, however it's unconditionally removed.  If the assigned device
does not support INTx, this will cause QEMU to crash when unplugging
the device from the system.  Change it to conditionally remove the
notifier only if the notify hook is setup.

CC: Eduardo Habkost <ehabkost@redhat.com>
CC: David Gibson <david@gibson.dropbear.id.au>
CC: Alex Williamson <alex.williamson@redhat.com>
Cc: qemu-stable@nongnu.org # v4.2
Reported-by: yanghliu@redhat.com
Debugged-by: Eduardo Habkost <ehabkost@redhat.com>
Fixes: c5478fea27 ("vfio/pci: Respond to KVM irqchip change notifier")
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1782678
Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Greg Kurz <groug@kaod.org>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2020-01-06 14:19:42 -07:00