]> git.proxmox.com Git - mirror_qemu.git/log
mirror_qemu.git
6 years agotarget/mips: Add emulation of nanoMIPS 16-bit load and store instructions
Yongbok Kim [Mon, 6 Aug 2018 16:59:50 +0000 (18:59 +0200)]
target/mips: Add emulation of nanoMIPS 16-bit load and store instructions

Add emulation of LWXS16, LB16, SB16, LBU16, LH16, SH16, LHU16, LW16, LWSP16,
LW4X4, SW4X4, LWGP16, SWSP16, SW16, and SWGP16 instructions.

Signed-off-by: Yongbok Kim <yongbok.kim@mips.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Stefan Markovic <smarkovic@wavecomp.com>
Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
6 years agotarget/mips: Add emulation of nanoMIPS 16-bit misc instructions
Yongbok Kim [Thu, 2 Aug 2018 14:16:09 +0000 (16:16 +0200)]
target/mips: Add emulation of nanoMIPS 16-bit misc instructions

Add emulation of misc nanoMIPS 16-bit instructions.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Yongbok Kim <yongbok.kim@mips.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Stefan Markovic <smarkovic@wavecomp.com>
6 years agotarget/mips: Add emulation of nanoMIPS 16-bit shift instructions
Yongbok Kim [Thu, 2 Aug 2018 14:16:08 +0000 (16:16 +0200)]
target/mips: Add emulation of nanoMIPS 16-bit shift instructions

Add emulation of nanoMIPS 16-bit shift instructions.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Yongbok Kim <yongbok.kim@mips.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Stefan Markovic <smarkovic@wavecomp.com>
6 years agotarget/mips: Add emulation of nanoMIPS 16-bit branch instructions
Stefan Markovic [Thu, 2 Aug 2018 14:16:07 +0000 (16:16 +0200)]
target/mips: Add emulation of nanoMIPS 16-bit branch instructions

Add emulation of nanoMIPS 16-bit branch instructions.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Yongbok Kim <yongbok.kim@mips.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Stefan Markovic <smarkovic@wavecomp.com>
6 years agotarget/mips: Add emulation of nanoMIPS 16-bit arithmetic instructions
Yongbok Kim [Thu, 2 Aug 2018 14:16:06 +0000 (16:16 +0200)]
target/mips: Add emulation of nanoMIPS 16-bit arithmetic instructions

Add emulation of nanoMIPS 16-bit arithmetic instructions.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Yongbok Kim <yongbok.kim@mips.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Stefan Markovic <smarkovic@wavecomp.com>
6 years agotarget/mips: Add nanoMIPS decoding and extraction utilities
Aleksandar Markovic [Thu, 2 Aug 2018 14:16:05 +0000 (16:16 +0200)]
target/mips: Add nanoMIPS decoding and extraction utilities

Add some basic utility functions and macros for nanoMIPS decoding
engine.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Yongbok Kim <yongbok.kim@mips.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Stefan Markovic <smarkovic@wavecomp.com>
6 years agotarget/mips: Add placeholder and invocation of decode_nanomips_opc()
Aleksandar Markovic [Thu, 2 Aug 2018 14:16:04 +0000 (16:16 +0200)]
target/mips: Add placeholder and invocation of decode_nanomips_opc()

Add empty body and invocation of decode_nanomips_opc() if the bit
ISA_NANOMIPS32 is set in ctx->insn_flags.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Yongbok Kim <yongbok.kim@mips.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Stefan Markovic <smarkovic@wavecomp.com>
6 years agotarget/mips: Prevent switching mode related to Config3 ISA bit for nanoMIPS
Stefan Markovic [Mon, 20 Aug 2018 10:00:27 +0000 (12:00 +0200)]
target/mips: Prevent switching mode related to Config3 ISA bit for nanoMIPS

Only if Config3.ISA is 3 (microMIPS), the mode should be switched in
cpu_state_reset(). Config3.ISA is 1 for nanoMIPS processors, and no mode
change should happen.

Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
6 years agotarget/mips: Add nanoMIPS DSP ASE opcodes
Stefan Markovic [Fri, 13 Jul 2018 06:40:22 +0000 (08:40 +0200)]
target/mips: Add nanoMIPS DSP ASE opcodes

Add nanoMIPS opcodes for DSP ASE instruction pools and instructions.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Stefan Markovic <smarkovic@wavecomp.com>
6 years agotarget/mips: Add nanoMIPS base instruction set opcodes
Yongbok Kim [Thu, 2 Aug 2018 14:16:02 +0000 (16:16 +0200)]
target/mips: Add nanoMIPS base instruction set opcodes

Add nanoMIPS opcodes. nanoMIPS instruction are organized by so-called
instruction pools. Each pool contains a set of opcodes, that in turn
can be instruction opcodes or instruction pool opcodes.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Yongbok Kim <yongbok.kim@mips.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Stefan Markovic <smarkovic@wavecomp.com>
6 years agotarget/mips: Add preprocessor constants for nanoMIPS
Aleksandar Markovic [Thu, 2 Aug 2018 14:16:01 +0000 (16:16 +0200)]
target/mips: Add preprocessor constants for nanoMIPS

Add ISA_NANOMIPS32 and CPU_NANOMIPS32 preprocessor constants.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Yongbok Kim <yongbok.kim@mips.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Stefan Markovic <smarkovic@wavecomp.com>
6 years agoMerge remote-tracking branch 'remotes/juanquintela/tags/check/20180822' into staging
Peter Maydell [Fri, 24 Aug 2018 13:46:31 +0000 (14:46 +0100)]
Merge remote-tracking branch 'remotes/juanquintela/tags/check/20180822' into staging

check/next for 20180822

# gpg: Signature made Wed 22 Aug 2018 09:03:40 BST
# gpg:                using RSA key F487EF185872D723
# gpg: Good signature from "Juan Quintela <quintela@redhat.com>"
# gpg:                 aka "Juan Quintela <quintela@trasno.org>"
# Primary key fingerprint: 1899 FF8E DEBF 58CC EE03  4B82 F487 EF18 5872 D723

* remotes/juanquintela/tags/check/20180822:
  check: Only test tpm devices when they are compiled in
  check: Only test usb-ehci when it is compiled in
  check: Only test usb-uhci devices when they are compiled in
  check: Only test usb-ohci when it is compiled in
  check: Only test nvme when it is compiled in
  check: Only test pvpanic when it is compiled in
  check: Only test wdt_ib700 when it is compiled in
  check: Only test sdhci when it is compiled in
  check: Only test i82801b11 when it is compiled in
  check: Only test ioh3420 when it is compiled in
  check: Only test ipack when it is compiled in
  check: Only test hda when it is compiled in
  check: Only test ac97 when it is compiled in
  check: Only test es1370 when it is compiled in
  check: Only test rtl8139 when it is compiled in
  check: Only test pcnet when it is compiled in
  check: Only test eepro100 when it is compiled in
  check: Only test ne2000 when it is compiled in
  check: Only test vmxnet3 when it is compiled in

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoMerge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20180824-1' into...
Peter Maydell [Fri, 24 Aug 2018 12:29:07 +0000 (13:29 +0100)]
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20180824-1' into staging

target-arm queue:
 * Fix rounding errors in scaling float-to-int and int-to-float operations
 * Connect virtualization-related IRQs and memory regions of GICv2
   in boards that use Cortex-A7 or Cortex-A15
 * Support taking exceptions to AArch32 Hyp mode
 * Clear CPSR.IL and CPSR.J on 32-bit exception entry
   (a minor bug fix that won't affect non-buggy guest code)
 * mps2-an505: Implement various missing devices:
   dual timer, watchdogs, counters in the FPGAIO registers,
   some missing ID/control registers, TrustZone Master Security
   Controllers, PL081 DMA controllers, PL022 SPI controllers
 * correct ID register values for mps2-an385, -an511, -an505
 * fix some hardcoded tabs in untouched backwaters of the
   target/arm codebase
 * raspi: Refactor framebuffer property handling code and implement
   support for the virtual framebuffer/viewport

# gpg: Signature made Fri 24 Aug 2018 13:19:04 BST
# gpg:                using RSA key 3C2525ED14360CDE
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>"
# gpg:                 aka "Peter Maydell <pmaydell@gmail.com>"
# gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>"
# Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83  15CF 3C25 25ED 1436 0CDE

* remotes/pmaydell/tags/pull-target-arm-20180824-1: (52 commits)
  hw/arm/mps2: Fix ID register errors on AN511 and AN385
  hw/display/bcm2835_fb: Validate bcm2835_fb_mbox_push() config
  hw/display/bcm2835_fb: Validate config settings
  hw/display/bcm2835_fb: Fix handling of virtual framebuffer
  hw/display/bcm2835_fb: Abstract out calculation of pitch, size
  hw/display/bcm2835_fb: Reset resolution, etc correctly
  hw/display/bcm2835_fb: Drop unused size and pitch fields
  hw/misc/bcm2835_property: Track fb settings using BCM2835FBConfig
  hw/misc/bcm2835_fb: Move config fields to their own struct
  target/arm: Remove a handful of stray tabs
  target/arm: Untabify iwmmxt_helper.c
  target/arm: Untabify translate.c
  hw/arm/mps2-tz: Fix MPS2 SCC config register values
  hw/arm/mps2-tz: Instantiate SPI controllers
  hw/ssi/pl022: Correct wrong DMACR and ICR handling
  hw/ssi/pl022: Correct wrong value for PL022_INT_RT
  hw/ssi/pl022: Use DeviceState::realize rather than SysBusDevice::init
  hw/ssi/pl022: Don't directly call vmstate_register()
  hw/ssi/pl022: Set up reset function in class init
  hw/ssi/pl022: Allow use as embedded-struct device
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agohw/arm/mps2: Fix ID register errors on AN511 and AN385
Peter Maydell [Fri, 24 Aug 2018 12:17:50 +0000 (13:17 +0100)]
hw/arm/mps2: Fix ID register errors on AN511 and AN385

Fix MPS2 SCC config register values for the mps2-an511
and mps2-an385 boards:
 * the SCC_AID bits [23:20] specify the FPGA build target board revision,
   and the SCC_CFG4 register specifies the actual board revision, so
   these should have matching values. Claim to be board revision C,
   consistently -- we had the revision in the wrong part of SCC_AID.
 * SCC_ID bits [15:4] should be the board number in hex, not decimal

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20180823175225.22612-1-peter.maydell@linaro.org

6 years agohw/display/bcm2835_fb: Validate bcm2835_fb_mbox_push() config
Peter Maydell [Fri, 24 Aug 2018 12:17:50 +0000 (13:17 +0100)]
hw/display/bcm2835_fb: Validate bcm2835_fb_mbox_push() config

Refactor bcm2835_fb_mbox_push() to work by calling
bcm2835_fb_validate_config() and bcm2835_fb_reconfigure(),
so that config set this way is also validated.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20180814144436.679-9-peter.maydell@linaro.org

6 years agohw/display/bcm2835_fb: Validate config settings
Peter Maydell [Fri, 24 Aug 2018 12:17:50 +0000 (13:17 +0100)]
hw/display/bcm2835_fb: Validate config settings

Validate the config settings that the guest tries to set.

The wiki page documentation is not really accurate here:
generally rather than failing requests to set bad parameters,
the hardware will just clip them to something sensible.

Validate the most important parameters: sizes and
the viewport offsets. This prevents the framebuffer
code from trying to read out-of-range memory.

In the property handling code, we validate the new parameters every
time we encounter a tag that sets them. This means we validate the
config multiple times if the request includes multiple config-setting
tags, but the code would require significant restructuring to do a
validation only once but still return the clipped settings for
get-parameter tags and the buffer allocation tag.

Validation of settings made via the older bcm2835_fb_mbox_push()
function will be done in the next commit.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20180814144436.679-8-peter.maydell@linaro.org

6 years agohw/display/bcm2835_fb: Fix handling of virtual framebuffer
Peter Maydell [Fri, 24 Aug 2018 12:17:49 +0000 (13:17 +0100)]
hw/display/bcm2835_fb: Fix handling of virtual framebuffer

The raspi framebuffir in bcm2835_fb supports the definition
of a virtual "viewport", which is smaller than the full
physical framebuffer size and at an adjustable offset within
it. Only the viewport area is sent to the screen. This allows
the guest to do things like double buffering, or scrolling
by adjusting the viewport origin. Currently QEMU doesn't
implement this at all.

Add support for this feature:
 * the property mailbox code needs to distinguish the
   virtual width/height from the physical width/height
 * the framebuffer code needs to do something with the
   virtual width/height/origin information

Note that the wiki documentation on the semantics of the
virtual and physical height and width has it the wrong way
around -- the virtual size is the size of the allocated
buffer, and the physical size is the size of the display,
so the virtual size is always the same as or larger than
the physical.

If the viewport size is set smaller than the physical
screen size, we ignore the viewport settings completely
and just display the physical screen area.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20180814144436.679-7-peter.maydell@linaro.org

6 years agohw/display/bcm2835_fb: Abstract out calculation of pitch, size
Peter Maydell [Fri, 24 Aug 2018 12:17:49 +0000 (13:17 +0100)]
hw/display/bcm2835_fb: Abstract out calculation of pitch, size

Abstract out the calculation of the pitch and size of the
framebuffer into functions that operate on the BCM2835FBConfig
struct -- these are about to get a little more complicated
when we add support for virtual and physical sizes differing.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20180814144436.679-6-peter.maydell@linaro.org

6 years agohw/display/bcm2835_fb: Reset resolution, etc correctly
Peter Maydell [Fri, 24 Aug 2018 12:17:49 +0000 (13:17 +0100)]
hw/display/bcm2835_fb: Reset resolution, etc correctly

The bcm2835_fb's initial resolution and other parameters are set
via QOM properties. We should reset to those initial values on
device reset, which means we need to save the QOM property
values somewhere that they are not overwritten by guest
changes to the framebuffer configuration.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20180814144436.679-5-peter.maydell@linaro.org

6 years agohw/display/bcm2835_fb: Drop unused size and pitch fields
Peter Maydell [Fri, 24 Aug 2018 12:17:49 +0000 (13:17 +0100)]
hw/display/bcm2835_fb: Drop unused size and pitch fields

The BCM2835FBState struct has a 'pitch' field which is a
cached copy of xres * (bpp >> 3), and a 'size' field which is
a cached copy of pitch * yres. However we don't actually do
anything with these fields; delete them. We retain the
now-unused slots in the VMState struct for migration
compatibility.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20180814144436.679-4-peter.maydell@linaro.org

6 years agohw/misc/bcm2835_property: Track fb settings using BCM2835FBConfig
Peter Maydell [Fri, 24 Aug 2018 12:17:48 +0000 (13:17 +0100)]
hw/misc/bcm2835_property: Track fb settings using BCM2835FBConfig

Refactor the fb property setting code so that rather than
using a set of pointers to local variables to track
whether a config value has been updated in the current
mbox and if so what its new value is, we just copy
all the current settings of the fb at the start, and
then update that copy as we go along, before asking
the fb to switch to it at the end.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20180814144436.679-3-peter.maydell@linaro.org

6 years agohw/misc/bcm2835_fb: Move config fields to their own struct
Peter Maydell [Fri, 24 Aug 2018 12:17:48 +0000 (13:17 +0100)]
hw/misc/bcm2835_fb: Move config fields to their own struct

The handling of framebuffer properties in the bcm2835_property code
is a bit clumsy, because for each of the many fb related properties
we try to track the value we're about to set and whether we're going
to be setting a value, and then we hand all the new values off
to the framebuffer via a function which takes them all as separate
arguments. It would be simpler if the property code could easily
copy all the framebuffer's current settings, update them with
the new specified values and then ask the framebuffer to switch
to the new set.

As the first part of this refactoring, pull all the fb config
settings fields in BCM2835FBState out into their own struct.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20180814144436.679-2-peter.maydell@linaro.org

6 years agotarget/arm: Remove a handful of stray tabs
Peter Maydell [Fri, 24 Aug 2018 12:17:48 +0000 (13:17 +0100)]
target/arm: Remove a handful of stray tabs

Following the bulk conversion of the iwMMXt code, there are
just a handful of hard coded tabs in target/arm; fix them.
This is a whitespace-only patch.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20180821165215.29069-4-peter.maydell@linaro.org

6 years agotarget/arm: Untabify iwmmxt_helper.c
Peter Maydell [Fri, 24 Aug 2018 12:17:48 +0000 (13:17 +0100)]
target/arm: Untabify iwmmxt_helper.c

Untabify the arm iwmmxt_helper.c.  This affects only the iwMMXt code.
We've never touched that code in years, so it's not going to get
fixed up by our "change when touched" process, and a bulk change is
not going to be too disruptive.

This commit was produced using Emacs "untabify" (plus one
by-hand removal of a space to fix a checkpatch nit); it is
a whitespace-only change.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20180821165215.29069-3-peter.maydell@linaro.org

6 years agotarget/arm: Untabify translate.c
Peter Maydell [Fri, 24 Aug 2018 12:17:47 +0000 (13:17 +0100)]
target/arm: Untabify translate.c

Untabify the arm translate.c. This affects only some lines,
mostly comments, in the iwMMXt code. We've never touched
that code in years, so it's not going to get fixed up
by our "change when touched" process, and a bulk change
is not going to be too disruptive.

This commit was produced using Emacs "untabify"; it is
a whitespace-only change.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20180821165215.29069-2-peter.maydell@linaro.org

6 years agohw/arm/mps2-tz: Fix MPS2 SCC config register values
Peter Maydell [Fri, 24 Aug 2018 12:17:47 +0000 (13:17 +0100)]
hw/arm/mps2-tz: Fix MPS2 SCC config register values

Some of the config register values we were setting for the MPS2 SCC
weren't correct:
 * the SCC_AID bits [23:20] specify the FPGA build target board revision,
   and the SCC_CFG4 register specifies the actual board revision, so
   these should have matching values. Claim to be board revision C,
   consistently -- we had the revision in the wrong part of SCC_AID.
 * SCC_ID bits [15:4] should be 0x505, not decimal 505

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20180820141116.9118-23-peter.maydell@linaro.org
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6 years agohw/arm/mps2-tz: Instantiate SPI controllers
Peter Maydell [Fri, 24 Aug 2018 12:17:47 +0000 (13:17 +0100)]
hw/arm/mps2-tz: Instantiate SPI controllers

The SPI controllers in the MPS2 AN505 board are PL022s.
We have a model of the PL022, so create these devices.

We don't currently model the LCD controller that sits behind
one of the PL022s; the others are intended to control devices
that sit on the FPGA's general purpose SPI connector or
"shield" expansion connectors.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20180820141116.9118-22-peter.maydell@linaro.org
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6 years agohw/ssi/pl022: Correct wrong DMACR and ICR handling
Peter Maydell [Fri, 24 Aug 2018 12:17:46 +0000 (13:17 +0100)]
hw/ssi/pl022: Correct wrong DMACR and ICR handling

In the PL022, register offset 0x20 is the ICR, a write-only
interrupt-clear register.  Register offset 0x24 is DMACR, the DMA
control register.  We were incorrectly implementing (a stub version
of) DMACR at 0x20, and not implementing anything at 0x24.  Fix this
bug.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20180820141116.9118-21-peter.maydell@linaro.org
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6 years agohw/ssi/pl022: Correct wrong value for PL022_INT_RT
Peter Maydell [Fri, 24 Aug 2018 12:17:46 +0000 (13:17 +0100)]
hw/ssi/pl022: Correct wrong value for PL022_INT_RT

The PL022 interrupt registers have bits allocated as:
 0: ROR (receive overrun)
 1: RT (receive timeout)
 2: RX (receive FIFO half full or less)
 3: TX (transmit FIFO half full or less)

A cut and paste error meant we had the wrong value for
the PL022_INT_RT constant. This bug doesn't affect device
behaviour, because we don't implement the receive timeout
feature and so never set that interrupt bit.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20180820141116.9118-20-peter.maydell@linaro.org
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6 years agohw/ssi/pl022: Use DeviceState::realize rather than SysBusDevice::init
Peter Maydell [Fri, 24 Aug 2018 12:17:45 +0000 (13:17 +0100)]
hw/ssi/pl022: Use DeviceState::realize rather than SysBusDevice::init

Move from the legacy SysBusDevice::init method to using
DeviceState::realize.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20180820141116.9118-19-peter.maydell@linaro.org
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6 years agohw/ssi/pl022: Don't directly call vmstate_register()
Peter Maydell [Fri, 24 Aug 2018 12:17:45 +0000 (13:17 +0100)]
hw/ssi/pl022: Don't directly call vmstate_register()

Use the DeviceState vmsd pointer rather than calling vmstate_register()
directly.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20180820141116.9118-18-peter.maydell@linaro.org
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6 years agohw/ssi/pl022: Set up reset function in class init
Peter Maydell [Fri, 24 Aug 2018 12:17:45 +0000 (13:17 +0100)]
hw/ssi/pl022: Set up reset function in class init

Currently the PL022 calls pl022_reset() from its class init
function. Make it register a DeviceState reset method instead,
so that we reset the device on system reset.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20180820141116.9118-17-peter.maydell@linaro.org
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6 years agohw/ssi/pl022: Allow use as embedded-struct device
Peter Maydell [Fri, 24 Aug 2018 12:17:44 +0000 (13:17 +0100)]
hw/ssi/pl022: Allow use as embedded-struct device

Create a new include file for the pl022's device struct,
type macros, etc, so that it can be instantiated using
the "embedded struct" coding style.

While we're adding the new file to MAINTAINERS, add
also the .c file, which was missing an entry.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20180820141116.9118-16-peter.maydell@linaro.org
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6 years agohw/arm/mps2-tz: Create PL081s and MSCs
Peter Maydell [Fri, 24 Aug 2018 12:17:44 +0000 (13:17 +0100)]
hw/arm/mps2-tz: Create PL081s and MSCs

The AN505 FPGA image includes four PL081 DMA controllers, each
of which is gated by a Master Security Controller that allows
the guest to prevent a non-secure DMA controller from accessing
memory that is used by secure guest code. Create and wire
up these devices.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20180820141116.9118-15-peter.maydell@linaro.org
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6 years agohw/arm/iotkit: Wire up the lines for MSCs
Peter Maydell [Fri, 24 Aug 2018 12:17:44 +0000 (13:17 +0100)]
hw/arm/iotkit: Wire up the lines for MSCs

The IoTKit doesn't have any MSCs itself but it does need
some wiring to connect the external signals from MSCs
in the outer board model up to the registers and the
NVIC IRQ line.

We also need to expose a MemoryRegion corresponding to
the AHB bus, so that MSCs in the outer board model can
use that as their downstream port. (In the FPGA this is
the "AHB Slave Expansion" ports shown in the block
diagram in the AN505 documentation.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20180820141116.9118-14-peter.maydell@linaro.org
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6 years agohw/misc/iotkit-secctl: Wire up registers for controlling MSCs
Peter Maydell [Fri, 24 Aug 2018 12:17:44 +0000 (13:17 +0100)]
hw/misc/iotkit-secctl: Wire up registers for controlling MSCs

The IoTKit does not have any Master Security Contollers itself,
but it does provide registers in the secure privilege control
block which allow control of MSCs in the external system.
Add support for these registers.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20180820141116.9118-13-peter.maydell@linaro.org
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6 years agohw/misc/tz-msc: Model TrustZone Master Security Controller
Peter Maydell [Fri, 24 Aug 2018 12:17:43 +0000 (13:17 +0100)]
hw/misc/tz-msc: Model TrustZone Master Security Controller

Implement a model of the TrustZone Master Securtiy Controller,
as documented in the Arm CoreLink SIE-200 System IP for
Embedded TRM  (DDI0571G):
  https://developer.arm.com/products/architecture/m-profile/docs/ddi0571/g

The MSC is intended to sit in front of a device which can
be a bus master (eg a DMA controller) and programmably gate
its transactions. This allows a bus-mastering device to be
controlled by non-secure code but still restricted from
making accesses to addresses which are secure-only.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20180820141116.9118-12-peter.maydell@linaro.org
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6 years agohw/misc/iotkit: Wire up the sysctl and sysinfo register blocks
Peter Maydell [Fri, 24 Aug 2018 12:17:43 +0000 (13:17 +0100)]
hw/misc/iotkit: Wire up the sysctl and sysinfo register blocks

Wire up the system control element's register banks
(sysctl and sysinfo).

This is the last of the previously completely unimplemented
components in the IoTKit.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20180820141116.9118-11-peter.maydell@linaro.org

6 years agohw/misc/iotkit-sysinfo: Implement IoTKit system information block
Peter Maydell [Fri, 24 Aug 2018 12:17:43 +0000 (13:17 +0100)]
hw/misc/iotkit-sysinfo: Implement IoTKit system information block

Implement the IoTKit system control element's system information
block; this is just a pair of read-only version/config registers,
plus the usual PID/CID ID registers.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20180820141116.9118-10-peter.maydell@linaro.org

6 years agohw/misc/iotkit-sysctl: Implement IoTKit system control element
Peter Maydell [Fri, 24 Aug 2018 12:17:42 +0000 (13:17 +0100)]
hw/misc/iotkit-sysctl: Implement IoTKit system control element

The Arm IoTKit includes a system control element which
provides a block of read-only ID registers and a block
of read-write control registers. Implement a minimal
version of this.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20180820141116.9118-9-peter.maydell@linaro.org

6 years agohw/arm/iotkit: Wire up the S32KTIMER
Peter Maydell [Fri, 24 Aug 2018 12:17:42 +0000 (13:17 +0100)]
hw/arm/iotkit: Wire up the S32KTIMER

The IoTKit has a CMSDK timer device that runs on the S32KCLK.
Create this and wire it up.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20180820141116.9118-8-peter.maydell@linaro.org

6 years agohw/arm/iotkit: Wire up the watchdogs
Peter Maydell [Fri, 24 Aug 2018 12:17:42 +0000 (13:17 +0100)]
hw/arm/iotkit: Wire up the watchdogs

The IoTKit includes three different instances of the
CMSDK APB watchdog; create and wire them up.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20180820141116.9118-7-peter.maydell@linaro.org

6 years agohw/arm/mps2: Wire up dual-timer in mps2-an385 and mps2-an511
Peter Maydell [Fri, 24 Aug 2018 12:17:42 +0000 (13:17 +0100)]
hw/arm/mps2: Wire up dual-timer in mps2-an385 and mps2-an511

The MPS2 FPGA images for the Cortex-M3 (mps2-an385 and mps2-511)
both include a CMSDK dual-timer module. Wire this up.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20180820141116.9118-6-peter.maydell@linaro.org

6 years agohw/arm/iotkit: Wire up the dualtimer
Peter Maydell [Fri, 24 Aug 2018 12:17:41 +0000 (13:17 +0100)]
hw/arm/iotkit: Wire up the dualtimer

Now we have a model of the CMSDK dual timer, we can wire it
up in the IoTKit.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20180820141116.9118-5-peter.maydell@linaro.org

6 years agohw/timer/cmsdk-apb-dualtimer: Implement CMSDK dual timer module
Peter Maydell [Fri, 24 Aug 2018 12:17:41 +0000 (13:17 +0100)]
hw/timer/cmsdk-apb-dualtimer: Implement CMSDK dual timer module

The Arm Cortex-M System Design Kit includes a "dual-input timer module"
which combines two programmable down-counters. Implement a model
of this device.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20180820141116.9118-4-peter.maydell@linaro.org

6 years agohw/misc/mps2-fpgaio: Implement PSCNTR and COUNTER
Peter Maydell [Fri, 24 Aug 2018 12:17:40 +0000 (13:17 +0100)]
hw/misc/mps2-fpgaio: Implement PSCNTR and COUNTER

In the MPS2 FPGAIO, PSCNTR is a free-running downcounter with
a reload value configured via the PRESCALE register, and
COUNTER counts up by 1 every time PSCNTR reaches zero.
Implement these counters.

We can just increment the counters migration subsection's
version ID because we only added it in the previous commit,
so no released QEMU versions will be using it.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20180820141116.9118-3-peter.maydell@linaro.org

6 years agohw/misc/mps2-fpgaio: Implement 1Hz and 100Hz counters
Peter Maydell [Fri, 24 Aug 2018 12:17:40 +0000 (13:17 +0100)]
hw/misc/mps2-fpgaio: Implement 1Hz and 100Hz counters

The MPS2 FPGAIO block includes some simple free-running counters.
Implement these.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20180820141116.9118-2-peter.maydell@linaro.org

6 years agohw/arm/boot: AArch32 kernels should be started in Hyp mode if available
Peter Maydell [Fri, 24 Aug 2018 12:17:39 +0000 (13:17 +0100)]
hw/arm/boot: AArch32 kernels should be started in Hyp mode if available

The kernel booting specification for an AArch32 kernel requires that
it is booted in Hyp mode if available; otherwise the kernel can't
enable KVM. We were incorrectly leaving the kernel in SVC mode.
If we're booting an AArch32 kernel in the Nonsecure state and Hyp
mode is available, start in it.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
Message-id: 20180820153020.21478-7-peter.maydell@linaro.org

6 years agotarget/arm: Clear CPSR.IL and CPSR.J on 32-bit exception entry
Peter Maydell [Fri, 24 Aug 2018 12:17:38 +0000 (13:17 +0100)]
target/arm: Clear CPSR.IL and CPSR.J on 32-bit exception entry

On 32-bit exception entry, CPSR.J must always be set to 0
(see v7A Arm ARM DDI0406C.c B1.8.5). CPSR.IL must also
be cleared on 32-bit exception entry (see v8A Arm ARM
DDI0487C.a G1.10).

Clear these bits. (This fixes a bug which will never be noticed
by non-buggy guests.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
Message-id: 20180820153020.21478-6-peter.maydell@linaro.org

6 years agotarget/arm: Implement support for taking exceptions to Hyp mode
Peter Maydell [Fri, 24 Aug 2018 12:17:38 +0000 (13:17 +0100)]
target/arm: Implement support for taking exceptions to Hyp mode

Implement the necessary support code for taking exceptions
to Hyp mode in AArch32.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
Message-id: 20180820153020.21478-5-peter.maydell@linaro.org

6 years agotarget/arm: Factor out code for taking an AArch32 exception
Peter Maydell [Fri, 24 Aug 2018 12:17:37 +0000 (13:17 +0100)]
target/arm: Factor out code for taking an AArch32 exception

Factor out the code which changes the CPU state so as to
actually take an exception to AArch32. We're going to want
to use this for handling exception entry to Hyp mode.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
Message-id: 20180820153020.21478-4-peter.maydell@linaro.org

6 years agotarget/arm: Implement AArch32 HCR and HCR2
Peter Maydell [Fri, 24 Aug 2018 12:17:37 +0000 (13:17 +0100)]
target/arm: Implement AArch32 HCR and HCR2

The AArch32 HCR and HCR2 registers alias HCR_EL2
bits [31:0] and [63:32]; implement them.

Since HCR2 exists in ARMv8 but not ARMv7, we need new
regdef arrays for "we have EL3, not EL2, we're ARMv8"
and "we have EL2, we're ARMv8" to hold the definitions.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
Message-id: 20180820153020.21478-3-peter.maydell@linaro.org

6 years agotarget/arm: Implement RAZ/WI HACTLR2
Peter Maydell [Fri, 24 Aug 2018 12:17:36 +0000 (13:17 +0100)]
target/arm: Implement RAZ/WI HACTLR2

The v8 AArch32 HACTLR2 register maps to bits [63:32] of ACTLR_EL2.
We implement ACTLR_EL2 as RAZ/WI, so make HACTLR2 also RAZ/WI.
(We put the regdef next to ACTLR_EL2 as a reminder in case we
ever make ACTLR_EL2 something other than RAZ/WI).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
Message-id: 20180820153020.21478-2-peter.maydell@linaro.org

6 years agohw/arm/vexpress: Add "virtualization" property controlling presence of EL2
Peter Maydell [Fri, 24 Aug 2018 12:17:35 +0000 (13:17 +0100)]
hw/arm/vexpress: Add "virtualization" property controlling presence of EL2

Add a "virtualization" property to the vexpress-a15 board,
controlling presence of EL2. As with EL3, we default to
enabling it, but the user can disable it if they have an
older guest which can't cope with it being present.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
Message-id: 20180821132811.17675-10-peter.maydell@linaro.org

6 years agohw/arm/vexpress: Don't set info->secure_boot if CPU doesn't have EL3
Peter Maydell [Fri, 24 Aug 2018 12:17:35 +0000 (13:17 +0100)]
hw/arm/vexpress: Don't set info->secure_boot if CPU doesn't have EL3

Don't request that the arm_load_kernel() code should boot in secure
state if the CPU doesn't have a secure state. Currently this
doesn't make a difference because the boot.c code only examines
the secure_boot flag in code guarded by an ARM_FEATURE_EL3 check,
but upcoming changes for supporting booting into Hyp mode will
change that.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
Message-id: 20180821132811.17675-9-peter.maydell@linaro.org

6 years agohw/cpu/a15mpcore: If CPU has EL2, enable it on the GIC and wire it up
Peter Maydell [Fri, 24 Aug 2018 12:17:34 +0000 (13:17 +0100)]
hw/cpu/a15mpcore: If CPU has EL2, enable it on the GIC and wire it up

For the A15MPCore internal peripheral object, we handle GIC
security extensions support by checking whether the CPUs
have EL3 enabled; if so then we enable it also on the GIC.
Handle the virtualization extensions in the same way: if the
CPU has EL2 then enable it on the GIC and wire up the
virtualization-specific memory regions and the maintenance
interrupt.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
Message-id: 20180821132811.17675-8-peter.maydell@linaro.org

6 years agohw/arm/fsl-imx6ul: Connect VIRQ and VFIQ
Peter Maydell [Fri, 24 Aug 2018 12:17:34 +0000 (13:17 +0100)]
hw/arm/fsl-imx6ul: Connect VIRQ and VFIQ

Connect the VIRQ and VFIQ lines from the GIC to the CPU;
these exist always for both CPU and GIC whether the
virtualization extensions are enabled or not, so we
can just unconditionally connect them.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
Message-id: 20180821132811.17675-7-peter.maydell@linaro.org

6 years agohw/arm/fsl-imx6ul: Connect VIRQ and VFIQ
Peter Maydell [Fri, 24 Aug 2018 12:17:33 +0000 (13:17 +0100)]
hw/arm/fsl-imx6ul: Connect VIRQ and VFIQ

Connect the VIRQ and VFIQ lines from the GIC to the CPU;
these exist always for both CPU and GIC whether the
virtualization extensions are enabled or not, so we
can just unconditionally connect them.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
Message-id: 20180821132811.17675-6-peter.maydell@linaro.org

6 years agohw/arm/highbank: Connect VIRQ and VFIQ
Peter Maydell [Fri, 24 Aug 2018 12:17:33 +0000 (13:17 +0100)]
hw/arm/highbank: Connect VIRQ and VFIQ

Connect the VIRQ and VFIQ lines from the GIC to the CPU;
these exist always for both CPU and GIC whether the
virtualization extensions are enabled or not, so we
can just unconditionally connect them.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
Message-id: 20180821132811.17675-5-peter.maydell@linaro.org

6 years agohw/arm/vexpress: Connect VIRQ and VFIQ
Peter Maydell [Fri, 24 Aug 2018 12:17:32 +0000 (13:17 +0100)]
hw/arm/vexpress: Connect VIRQ and VFIQ

Connect the VIRQ and VFIQ lines from the GIC to the CPU;
these exist always for both CPU and GIC whether the
virtualization extensions are enabled or not, so we
can just unconditionally connect them.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
Message-id: 20180821132811.17675-4-peter.maydell@linaro.org

6 years agohw/intc/arm_gic: Make per-cpu GICH memory regions 0x200 bytes large
Peter Maydell [Fri, 24 Aug 2018 12:17:31 +0000 (13:17 +0100)]
hw/intc/arm_gic: Make per-cpu GICH memory regions 0x200 bytes large

Reduce the size of the per-cpu GICH memory regions from 0x1000
to 0x200. The registers only cover 0x200 bytes, and the Cortex-A15
wants to map them at a spacing of 0x200 bytes apart. Having the
region be too large interferes with mapping them like that, so
reduce it.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
Message-id: 20180821132811.17675-3-peter.maydell@linaro.org

6 years agotarget/arm: Use the float-to-int-scale softfloat routines
Richard Henderson [Fri, 24 Aug 2018 12:17:31 +0000 (13:17 +0100)]
target/arm: Use the float-to-int-scale softfloat routines

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20180814002653.12828-5-richard.henderson@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agotarget/arm: Use the int-to-float-scale softfloat routines
Richard Henderson [Fri, 24 Aug 2018 12:17:30 +0000 (13:17 +0100)]
target/arm: Use the int-to-float-scale softfloat routines

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20180814002653.12828-4-richard.henderson@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agosoftfloat: Add scaling float-to-int routines
Richard Henderson [Fri, 24 Aug 2018 12:17:30 +0000 (13:17 +0100)]
softfloat: Add scaling float-to-int routines

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20180814002653.12828-3-richard.henderson@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agosoftfloat: Add scaling int-to-float routines
Richard Henderson [Fri, 24 Aug 2018 12:17:29 +0000 (13:17 +0100)]
softfloat: Add scaling int-to-float routines

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20180814002653.12828-2-richard.henderson@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agotests/vm: Increase timeout waiting for VM to boot to 5 minutes
Peter Maydell [Thu, 23 Aug 2018 11:21:53 +0000 (12:21 +0100)]
tests/vm: Increase timeout waiting for VM to boot to 5 minutes

The VM tests currently have a timeout of 2 minutes for trying
to connect to ssh. Since the guest VM has to boot from cold
to the point of accepting inbound ssh during this time, if the
host machine is heavily loaded it can spuriously time out.
Increase the timeout from 2 to 5 minutes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Fam Zheng <famz@redhat.com>
Message-id: 20180823112153.15279-1-peter.maydell@linaro.org

6 years agoMerge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
Peter Maydell [Thu, 23 Aug 2018 18:03:53 +0000 (19:03 +0100)]
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging

* x86 TCG fixes for 64-bit call gates (Andrew)
* qumu-guest-agent freeze-hook tweak (Christian)
* pm_smbus improvements (Corey)
* Move validation to pre_plug for pc-dimm (David)
* Fix memory leaks (Eduardo, Marc-André)
* synchronization profiler (Emilio)
* Convert the CPU list to RCU (Emilio)
* LSI support for PPR Extended Message (George)
* vhost-scsi support for protection information (Greg)
* Mark mptsas as a storage device in the help (Guenter)
* checkpatch tweak cherry-picked from Linux (me)
* Typos, cleanups and dead-code removal (Julia, Marc-André)
* qemu-pr-helper support for old libmultipath (Murilo)
* Annotate fallthroughs (me)
* MemoryRegionOps cleanup (me, Peter)
* Make s390 qtests independent from libqos, which doesn't actually support it (me)
* Make cpu_get_ticks independent from BQL (me)
* Introspection fixes (Thomas)
* Support QEMU_MODULE_DIR environment variable (ryang)

# gpg: Signature made Thu 23 Aug 2018 17:46:30 BST
# gpg:                using RSA key BFFBD25F78C7AE83
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>"
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>"
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
#      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83

* remotes/bonzini/tags/for-upstream: (69 commits)
  KVM: cleanup unnecessary #ifdef KVM_CAP_...
  target/i386: update MPX flags when CPL changes
  i2c: pm_smbus: Add the ability to force block transfer enable
  i2c: pm_smbus: Don't delay host status register busy bit when interrupts are enabled
  i2c: pm_smbus: Add interrupt handling
  i2c: pm_smbus: Add block transfer capability
  i2c: pm_smbus: Make the I2C block read command read-only
  i2c: pm_smbus: Fix the semantics of block I2C transfers
  i2c: pm_smbus: Clean up some style issues
  pc-dimm: assign and verify the "addr" property during pre_plug
  pc: drop memory region alignment check for 0
  util/oslib-win32: indicate alignment for qemu_anon_ram_alloc()
  pc-dimm: assign and verify the "slot" property during pre_plug
  ipmi: Use proper struct reference for BT vmstate
  vhost-scsi: expose 't10_pi' property for VIRTIO_SCSI_F_T10_PI
  vhost-scsi: unify vhost-scsi get_features implementations
  vhost-user-scsi: move host_features into VHostSCSICommon
  cpus: allow cpu_get_ticks out of BQL
  cpus: protect TimerState writes with a spinlock
  seqlock: add QemuLockable support
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6 years agoKVM: cleanup unnecessary #ifdef KVM_CAP_...
Paolo Bonzini [Tue, 21 Aug 2018 08:09:56 +0000 (10:09 +0200)]
KVM: cleanup unnecessary #ifdef KVM_CAP_...

The capability macros are always defined, since they come from kernel
headers that are copied into the QEMU tree.  Remove the unnecessary #ifdefs.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agotarget/i386: update MPX flags when CPL changes
Paolo Bonzini [Tue, 21 Aug 2018 07:46:30 +0000 (09:46 +0200)]
target/i386: update MPX flags when CPL changes

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agoi2c: pm_smbus: Add the ability to force block transfer enable
Corey Minyard [Mon, 20 Aug 2018 20:26:08 +0000 (15:26 -0500)]
i2c: pm_smbus: Add the ability to force block transfer enable

The PIIX4 hardware has block transfer buffer always enabled in
the hardware, but the i801 does not.  Add a parameter to pm_smbus_init
to force on the block transfer so the PIIX4 handler can enable this
by default, as it was disabled by default before.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <1534796770-10295-9-git-send-email-minyard@acm.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agoi2c: pm_smbus: Don't delay host status register busy bit when interrupts are enabled
Corey Minyard [Mon, 20 Aug 2018 20:26:07 +0000 (15:26 -0500)]
i2c: pm_smbus: Don't delay host status register busy bit when interrupts are enabled

Change 880b1ffe6ec2f0ae "smbus: do not immediately complete commands"
changed pm_smbus to delay setting the host busy bit until the status
register was read, to work around a bug in AMIBIOS.  Unfortunately,
when interrupts are enabled, the status register will never get read
and the processing will never happen.

Modify the code to only delay setting the host busy bit if interrupts
are not enabled.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
Cc: Hervé Poussineau <hpoussin@reactos.org>
Cc: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <1534796770-10295-8-git-send-email-minyard@acm.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agoi2c: pm_smbus: Add interrupt handling
Corey Minyard [Mon, 20 Aug 2018 20:26:06 +0000 (15:26 -0500)]
i2c: pm_smbus: Add interrupt handling

Add the necessary code so that interrupts actually work from
the pm_smbus device.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <1534796770-10295-7-git-send-email-minyard@acm.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agoi2c: pm_smbus: Add block transfer capability
Corey Minyard [Mon, 20 Aug 2018 20:26:04 +0000 (15:26 -0500)]
i2c: pm_smbus: Add block transfer capability

There was no block transfer code in pm_smbus.c, and it is needed
for some devices.  So add it.

This adds both byte-by-byte block transfers and buffered block
transfers.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <1534796770-10295-5-git-send-email-minyard@acm.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agoi2c: pm_smbus: Make the I2C block read command read-only
Corey Minyard [Mon, 20 Aug 2018 20:26:03 +0000 (15:26 -0500)]
i2c: pm_smbus: Make the I2C block read command read-only

It did have write capability, but the manual says the behavior
with write enabled is undefined.  So just set an error in this
case.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <1534796770-10295-4-git-send-email-minyard@acm.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agoi2c: pm_smbus: Fix the semantics of block I2C transfers
Corey Minyard [Mon, 20 Aug 2018 20:26:02 +0000 (15:26 -0500)]
i2c: pm_smbus: Fix the semantics of block I2C transfers

The I2C block transfer commands was not implemented correctly, it
read a length byte and such like it was an smbus transfer.

So fix the smbus_read_block() and smbus_write_block() functions
so they can properly handle I2C transfers, and normal SMBus
transfers (for upcoming changes).  Pass in a transfer size and
a bool to know whether to use the size byte (like SMBus) or use
the length given (like I2C).

Signed-off-by: Corey Minyard <cminyard@mvista.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <1534796770-10295-3-git-send-email-minyard@acm.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agoi2c: pm_smbus: Clean up some style issues
Corey Minyard [Mon, 20 Aug 2018 20:26:01 +0000 (15:26 -0500)]
i2c: pm_smbus: Clean up some style issues

Fix some spacing issues, remove extraneous comments, add some
defines instead of hard-coding numbers.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <1534796770-10295-2-git-send-email-minyard@acm.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agopc-dimm: assign and verify the "addr" property during pre_plug
David Hildenbrand [Wed, 1 Aug 2018 13:34:44 +0000 (15:34 +0200)]
pc-dimm: assign and verify the "addr" property during pre_plug

We can assign and verify the address before realizing and trying to plug.
reading/writing the address property should never fail for DIMMs, so let's
reduce error handling a bit by using &error_abort. Getting access to the
memory region now might however fail. So forward errors from
get_memory_region() properly.

As all memory devices should use the alignment of the underlying memory
region for guest physical address asignment, do detection of the
alignment in pc_dimm_pre_plug(), but allow pc.c to overwrite the
alignment for compatibility handling.

Reviewed-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20180801133444.11269-5-david@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agopc: drop memory region alignment check for 0
David Hildenbrand [Wed, 1 Aug 2018 13:34:43 +0000 (15:34 +0200)]
pc: drop memory region alignment check for 0

All applicable memory regions always have an alignment > 0. All memory
backends result in file_ram_alloc() or qemu_anon_ram_alloc() getting
called, setting the alignment to > 0.

So a PCDIMM memory region always has an alignment > 0. NVDIMM copy the
alignment of the original memory memory region into the handcrafted memory
region that will be used at this place.

So the check for 0 can be dropped and we can reduce the special
handling.

Dropping this check makes factoring out of alignment handling easier as
compat handling only has to look at pcmc->enforce_aligned_dimm and not
care about the alignment of the memory region.

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20180801133444.11269-4-david@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agoutil/oslib-win32: indicate alignment for qemu_anon_ram_alloc()
David Hildenbrand [Wed, 1 Aug 2018 13:34:42 +0000 (15:34 +0200)]
util/oslib-win32: indicate alignment for qemu_anon_ram_alloc()

Let's set the alignment just like for the posix variant. This will
implicitly set the alignment of the underlying memory region and
therefore make memory_region_get_alignment(mr) return something > 0 for
all memory backends applicable to PCDIMM/NVDIMM.

The allocation granularity is ususally 64k, while the page size is 4k.
The documentation of VirtualAlloc is not really comprehensible in case
only MEM_COMMIT is specified without an address. We'll detect the actual
values and then go for the bigger one. The expection is, that it will
always be 64k aligned. (The assumption is that MEM_COMMIT does an
implicit MEM_RESERVE, so the address will always be aligned to the
allocation granularity. And the allocation granularity is always bigger
than the page size).

This will allow us to drop special handling in pc.c for
memory_region_get_alignment(mr) == 0, as we can then assume that it is
always set (and AFAICS >= getpagesize()).

For pc in pc_memory_plug(), under Windows TARGET_PAGE_SIZE == getpagesize(),
therefore alignment of DIMMs will not change, and therefore also not the
guest physical memory layout.

For spapr in spapr_memory_plug(), an alignment of 0 would have been used
until now. As QEMU_ALIGN_UP will crash with the alignment being 0, this
never worked, so we don't have to care about compatibility handling.

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20180801133444.11269-3-david@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agopc-dimm: assign and verify the "slot" property during pre_plug
David Hildenbrand [Wed, 1 Aug 2018 13:34:41 +0000 (15:34 +0200)]
pc-dimm: assign and verify the "slot" property during pre_plug

We can assign and verify the slot before realizing and trying to plug.
reading/writing the slot property should never fail, so let's reduce
error handling a bit by using &error_abort.

To do this during pre_plug, add and use (x86, ppc) pc_dimm_pre_plug().

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20180801133444.11269-2-david@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agoipmi: Use proper struct reference for BT vmstate
Corey Minyard [Mon, 20 Aug 2018 20:57:24 +0000 (15:57 -0500)]
ipmi: Use proper struct reference for BT vmstate

The vmstate for isa_ipmi_bt was referencing into the bt structure,
instead create a bt structure separate and use that.

The version 1 of the BT transfer was fairly broken, if a migration
occured during an IPMI operation, it is likely the migration would
be corrupted because I misunderstood the VMSTATE_VBUFFER_UINT32()
handling, I thought it handled transferring the length field,
too.  So I just remove support for that.  I doubt anyone is using
it at this point.

This also removes the transfer of use_irq, since that should come
from configuration.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <1534798644-13587-1-git-send-email-minyard@acm.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agovhost-scsi: expose 't10_pi' property for VIRTIO_SCSI_F_T10_PI
Greg Edwards [Wed, 8 Aug 2018 19:52:35 +0000 (13:52 -0600)]
vhost-scsi: expose 't10_pi' property for VIRTIO_SCSI_F_T10_PI

Allow toggling on/off the VIRTIO_SCSI_F_T10_PI feature bit for both
vhost-scsi and vhost-user-scsi devices.

Signed-off-by: Greg Edwards <gedwards@ddn.com>
Message-Id: <20180808195235.5843-4-gedwards@ddn.com>
Reviewed-by: Felipe Franciosi <felipe@nutanix.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agovhost-scsi: unify vhost-scsi get_features implementations
Greg Edwards [Wed, 8 Aug 2018 19:52:34 +0000 (13:52 -0600)]
vhost-scsi: unify vhost-scsi get_features implementations

Move the enablement of preset host features into the common
vhost_scsi_common_get_features() function.  This is in preparation for
having vhost-scsi also make use of host_features.

Signed-off-by: Greg Edwards <gedwards@ddn.com>
Message-Id: <20180808195235.5843-3-gedwards@ddn.com>
Reviewed-by: Felipe Franciosi <felipe@nutanix.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agovhost-user-scsi: move host_features into VHostSCSICommon
Greg Edwards [Wed, 8 Aug 2018 19:52:33 +0000 (13:52 -0600)]
vhost-user-scsi: move host_features into VHostSCSICommon

In preparation for having vhost-scsi also make use of host_features,
move it from struct VHostUserSCSI into struct VHostSCSICommon.

Signed-off-by: Greg Edwards <gedwards@ddn.com>
Message-Id: <20180808195235.5843-2-gedwards@ddn.com>
Reviewed-by: Felipe Franciosi <felipe@nutanix.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agocpus: allow cpu_get_ticks out of BQL
Paolo Bonzini [Sat, 18 Aug 2018 07:36:16 +0000 (09:36 +0200)]
cpus: allow cpu_get_ticks out of BQL

Because of cpu_ticks_prev, we cannot use a seqlock.  But then the conversion
is even easier. :)

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agocpus: protect TimerState writes with a spinlock
Paolo Bonzini [Tue, 14 Aug 2018 07:57:16 +0000 (09:57 +0200)]
cpus: protect TimerState writes with a spinlock

In the next patch, we will need to write cpu_ticks_offset from any
thread, even outside the BQL.  Currently, it is protected by the BQL
just because cpu_enable_ticks and cpu_disable_ticks happen to hold it,
but the critical sections are well delimited and it's easy to remove
the BQL dependency.

Add a spinlock that matches vm_clock_seqlock, and hold it when writing
to the TimerState.  This also lets us fix cpu_update_icount when 64-bit
atomics are not available.

Fields of TiemrState are reordered to avoid padding.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agoseqlock: add QemuLockable support
Paolo Bonzini [Tue, 14 Aug 2018 07:48:29 +0000 (09:48 +0200)]
seqlock: add QemuLockable support

A shortcut when the seqlock write is protected by a spinlock or any mutex
other than the BQL.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agocpus: protect all icount computation with seqlock
Paolo Bonzini [Tue, 14 Aug 2018 07:31:58 +0000 (09:31 +0200)]
cpus: protect all icount computation with seqlock

Move the icount->ns computation to cpu_get_icount, and make
cpu_get_icount_locked return the raw value.  This makes the
atomic_read__nocheck safe, because it now happens always inside a
seqlock and any torn reads will be retried.  qemu_icount_bias and
icount_time_shift also need to be accessed with atomics.  At the
same time, however, you don't need atomic_read within the writer,
because no concurrent writes are possible.

The fix to vmstate lets us keep the struct nicely packed.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agomodule: Use QEMU_MODULE_DIR as a search path
ryang [Wed, 4 Jul 2018 18:10:10 +0000 (14:10 -0400)]
module: Use QEMU_MODULE_DIR as a search path

The current paths for modules are CONFIG_QEMU_MODDIR and paths relative
to the executable. Qemu and its modules can be installed and executed in
paths that are different from these search paths. This change allows
a search path to be specified by environment variable.

An example usage for this is postmarketOS[1]. This is a build environment
for Alpine Linux. It sets up Alpine Linux in a chroot environment.
Alpine's Qemu packages are installed in the chroot. The Alpine Linux Qemu
package is used to test compiled Alpine Linux system images. This way there
isn't a reliance on the which ever version of Qemu the host system / distro
provides.

postmarketOS executes Qemu on host system outside of the chroot
The Qemu module search path needs to point to the location of the
chroot relative to the host system.

e.g.
The root of the Alpine Linux chroot is:
~/.local/var/pmbootstrap/chroot_native/

Alpine's Qemu is installed at
~/.local/var/pmbootstrap/chroot_native/usr/bin/

The Qemu module search path needs to be:
QEMU_MODULE_DIR=~/.local/var/pmbootstrap/chroot_native/usr/lib/qemu/

[1] https://postmarketos.org/

Signed-off-by: ryang <decatf@gmail.com>
Message-Id: <20180704181010.GA918@computer>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agoqemu-guest-agent: freeze-hook to ignore dpkg files as well
Christian Ehrhardt [Wed, 13 Dec 2017 10:17:52 +0000 (11:17 +0100)]
qemu-guest-agent: freeze-hook to ignore dpkg files as well

The hook already skips a set of rpm upgrade artifacts.
Do the same with such files that might be created by dpkg.

Fixes: https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1484990
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Message-Id: <1513160272-15921-1-git-send-email-christian.ehrhardt@canonical.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agohw/intc/apic: Switch away from old_mmio
Peter Maydell [Fri, 3 Aug 2018 10:19:43 +0000 (11:19 +0100)]
hw/intc/apic: Switch away from old_mmio

Switch the apic away from using the old_mmio MemoryRegionOps
accessor functions.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20180803101943.23722-1-peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agoqom: convert the CPU list to RCU
Emilio G. Cota [Sun, 19 Aug 2018 09:13:35 +0000 (05:13 -0400)]
qom: convert the CPU list to RCU

Iterating over the list without using atomics is undefined behaviour,
since the list can be modified concurrently by other threads (e.g.
every time a new thread is created in user-mode).

Fix it by implementing the CPU list as an RCU QTAILQ. This requires
a little bit of extra work to traverse list in reverse order (see
previous patch), but other than that the conversion is trivial.

Signed-off-by: Emilio G. Cota <cota@braap.org>
Message-Id: <20180819091335.22863-12-cota@braap.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agospapr: do not use CPU_FOREACH_REVERSE
Emilio G. Cota [Sun, 19 Aug 2018 09:13:34 +0000 (05:13 -0400)]
spapr: do not use CPU_FOREACH_REVERSE

This paves the way for implementing the CPU list with an RCU list,
which cannot be traversed in reverse order.

Note that this is the only caller of CPU_FOREACH_REVERSE.

Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Emilio G. Cota <cota@braap.org>
Message-Id: <20180819091335.22863-11-cota@braap.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agotests: add test-rcu-tailq
Emilio G. Cota [Sun, 19 Aug 2018 09:13:33 +0000 (05:13 -0400)]
tests: add test-rcu-tailq

Signed-off-by: Emilio G. Cota <cota@braap.org>
Message-Id: <20180819091335.22863-10-cota@braap.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agotests: add test-list-simpleq
Emilio G. Cota [Sun, 19 Aug 2018 09:13:32 +0000 (05:13 -0400)]
tests: add test-list-simpleq

Signed-off-by: Emilio G. Cota <cota@braap.org>
Message-Id: <20180819091335.22863-9-cota@braap.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agotest-rcu-list: abstract the list implementation
Emilio G. Cota [Sun, 19 Aug 2018 09:13:31 +0000 (05:13 -0400)]
test-rcu-list: abstract the list implementation

So that we can test other implementations.

Signed-off-by: Emilio G. Cota <cota@braap.org>
Message-Id: <20180819091335.22863-8-cota@braap.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agotest-rcu-list: access goflag with atomics
Emilio G. Cota [Sun, 19 Aug 2018 09:13:29 +0000 (05:13 -0400)]
test-rcu-list: access goflag with atomics

Instead of declaring it volatile.

Signed-off-by: Emilio G. Cota <cota@braap.org>
Message-Id: <20180819091335.22863-6-cota@braap.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agorcu_queue: add RCU QTAILQ
Emilio G. Cota [Sun, 19 Aug 2018 09:13:28 +0000 (05:13 -0400)]
rcu_queue: add RCU QTAILQ

Signed-off-by: Emilio G. Cota <cota@braap.org>
Message-Id: <20180819091335.22863-5-cota@braap.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agorcu_queue: add RCU QSIMPLEQ
Emilio G. Cota [Sun, 19 Aug 2018 09:13:27 +0000 (05:13 -0400)]
rcu_queue: add RCU QSIMPLEQ

Signed-off-by: Emilio G. Cota <cota@braap.org>
Message-Id: <20180819091335.22863-4-cota@braap.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 years agorcu_queue: remove barrier from QLIST_EMPTY_RCU
Emilio G. Cota [Sun, 19 Aug 2018 09:13:26 +0000 (05:13 -0400)]
rcu_queue: remove barrier from QLIST_EMPTY_RCU

It's unnecessary because the pointer isn't dereferenced.

Signed-off-by: Emilio G. Cota <cota@braap.org>
Message-Id: <20180819091335.22863-3-cota@braap.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>