]> Git Repo - qemu.git/log
qemu.git
6 years agohw/misc/tz-mpc.c: Implement registers
Peter Maydell [Fri, 22 Jun 2018 12:28:39 +0000 (13:28 +0100)]
hw/misc/tz-mpc.c: Implement registers

Implement the missing registers for the TZ MPC.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Eric Auger <[email protected]>
Message-id: 20180620132032[email protected]

6 years agohw/misc/tz-mpc.c: Implement the Arm TrustZone Memory Protection Controller
Peter Maydell [Fri, 22 Jun 2018 12:28:39 +0000 (13:28 +0100)]
hw/misc/tz-mpc.c: Implement the Arm TrustZone Memory Protection Controller

Implement the Arm TrustZone Memory Protection Controller, which sits
in front of RAM and allows secure software to configure it to either
pass through or reject transactions.

We implement the MPC as a QEMU IOMMU, which will direct transactions
either through to the devices and memory behind it or to a special
"never works" AddressSpace if they are blocked.

This initial commit implements the skeleton of the device:
 * it always permits accesses
 * it doesn't implement most of the registers
 * it doesn't implement the interrupt or other behaviour
   for blocked transactions

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Alex Bennée <[email protected]>
Reviewed-by: Eric Auger <[email protected]>
Message-id: 20180620132032[email protected]

6 years agoxlnx-zynqmp: Swap Cortex-R5 for Cortex-R5F
Edgar E. Iglesias [Fri, 22 Jun 2018 12:28:38 +0000 (13:28 +0100)]
xlnx-zynqmp: Swap Cortex-R5 for Cortex-R5F

The ZynqMP has Cortex-R5Fs with the optional FPU enabled.

Reviewed-by: KONRAD Frederic <[email protected]>
Reviewed-by: Alistair Francis <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Edgar E. Iglesias <[email protected]>
Message-id: 20180529124707[email protected]
Signed-off-by: Peter Maydell <[email protected]>
6 years agotarget-arm: Add the Cortex-R5F
Edgar E. Iglesias [Fri, 22 Jun 2018 12:28:38 +0000 (13:28 +0100)]
target-arm: Add the Cortex-R5F

Add the Cortex-R5F with the optional FPU enabled.

Reviewed-by: KONRAD Frederic <[email protected]>
Reviewed-by: Alistair Francis <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Edgar E. Iglesias <[email protected]>
Message-id: 20180529124707[email protected]
Signed-off-by: Peter Maydell <[email protected]>
6 years agohw/arm/virt: Increase max_cpus to 512
Eric Auger [Fri, 22 Jun 2018 12:28:38 +0000 (13:28 +0100)]
hw/arm/virt: Increase max_cpus to 512

virt 3.0 now allows up to 512 vcpus whereas for earlier machine
types, max_cpus was set to 255 and any attempt to start the
machine with vcpus > 255 was rejected at a very early stage,
in vl.c/main level.

512 is the max supported by KVM. Anyway the actual vcpu count
that can be achieved depends on other parameters such as the
acceleration mode, the vgic version, the host kernel version.
Those are discovered later on.

Signed-off-by: Eric Auger <[email protected]>
Reviewed-by: Andrew Jones <[email protected]>
Message-id: 1529072910[email protected]
Signed-off-by: Peter Maydell <[email protected]>
6 years agohw/arm/virt: Use 256MB ECAM region by default
Eric Auger [Fri, 22 Jun 2018 12:28:37 +0000 (13:28 +0100)]
hw/arm/virt: Use 256MB ECAM region by default

With this patch, virt-3.0 machine uses a new 256MB ECAM region
by default instead of the legacy 16MB one, if highmem is set
(LPAE supported by the guest) and (!firmware_loaded || aarch64).

Indeed aarch32 mode FW may not support this high ECAM region.

Signed-off-by: Eric Auger <[email protected]>
Reviewed-by: Laszlo Ersek <[email protected]>
Reviewed-by: Andrew Jones <[email protected]>
Message-id: 1529072910[email protected]
Signed-off-by: Peter Maydell <[email protected]>
6 years agohw/arm/virt: Add virt-3.0 machine type
Eric Auger [Fri, 22 Jun 2018 12:28:37 +0000 (13:28 +0100)]
hw/arm/virt: Add virt-3.0 machine type

Add virt-3.0 machine type.

Signed-off-by: Eric Auger <[email protected]>
Reviewed-by: Laszlo Ersek <[email protected]>
Reviewed-by: Andrew Jones <[email protected]>
Message-id: 1529072910[email protected]
Signed-off-by: Peter Maydell <[email protected]>
6 years agohw/arm/virt: Add a new 256MB ECAM region
Eric Auger [Fri, 22 Jun 2018 12:28:37 +0000 (13:28 +0100)]
hw/arm/virt: Add a new 256MB ECAM region

This patch defines a new ECAM region located after the 256GB limit.

The virt machine state is augmented with a new highmem_ecam field
which guards the usage of this new ECAM region instead of the legacy
16MB one. With the highmem ECAM region, up to 256 PCIe buses can be
used.

Signed-off-by: Eric Auger <[email protected]>
Reviewed-by: Laszlo Ersek <[email protected]>
Reviewed-by: Andrew Jones <[email protected]>
Message-id: 1529072910[email protected]
Signed-off-by: Peter Maydell <[email protected]>
6 years agohw/arm/virt: Register two redistributor regions when necessary
Eric Auger [Fri, 22 Jun 2018 12:28:37 +0000 (13:28 +0100)]
hw/arm/virt: Register two redistributor regions when necessary

With a VGICv3 KVM device, if the number of vcpus exceeds the
capacity of the legacy redistributor region (123 redistributors),
we now attempt to register a second redistributor region. Up to
512 redistributors can fit in this latter on top of the 123 allowed
by the legacy redistributor region.

Registering this second redistributor region is possible if the
host kernel supports the following VGICv3 KVM device group/attribute:
KVM_DEV_ARM_VGIC_GRP_ADDR/KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION.

In case the host kernel does not support the registration of several
redistributor regions and the requested number of vcpus exceeds the
capacity of the legacy redistributor region, the GICv3 device
initialization fails with a proper error message and qemu exits.

At the moment the max number of vcpus still is capped by the
virt machine class max_cpus.

Signed-off-by: Eric Auger <[email protected]>
Reviewed-by: Andrew Jones <[email protected]>
Message-id: 1529072910[email protected]
Signed-off-by: Peter Maydell <[email protected]>
6 years agohw/arm/virt-acpi-build: Advertise one or two GICR structures
Eric Auger [Fri, 22 Jun 2018 12:28:36 +0000 (13:28 +0100)]
hw/arm/virt-acpi-build: Advertise one or two GICR structures

Depending on the number of smp_cpus we now register one or two
GICR structures.

Signed-off-by: Eric Auger <[email protected]>
Reviewed-by: Andrew Jones <[email protected]>
Message-id: 1529072910[email protected]
Signed-off-by: Peter Maydell <[email protected]>
6 years agohw/arm/virt: GICv3 DT node with one or two redistributor regions
Eric Auger [Fri, 22 Jun 2018 12:28:36 +0000 (13:28 +0100)]
hw/arm/virt: GICv3 DT node with one or two redistributor regions

This patch allows the creation of a GICv3 node with 1 or 2
redistributor regions depending on the number of smu_cpus.
The second redistributor region is located just after the
existing RAM region, at 256GB and contains up to up to 512 vcpus.

Please refer to kernel documentation for further node details:
Documentation/devicetree/bindings/interrupt-controller/arm,gic-v3.txt

Signed-off-by: Eric Auger <[email protected]>
Reviewed-by: Andrew Jones <[email protected]>
Message-id: 1529072910[email protected]
Signed-off-by: Peter Maydell <[email protected]>
6 years agohw/intc/arm_gicv3_kvm: Get prepared to handle multiple redist regions
Eric Auger [Fri, 22 Jun 2018 12:28:36 +0000 (13:28 +0100)]
hw/intc/arm_gicv3_kvm: Get prepared to handle multiple redist regions

Let's check if KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION is supported.
If not, we check the number of redist region is equal to 1 and use the
legacy KVM_VGIC_V3_ADDR_TYPE_REDIST attribute. Otherwise we use
the new attribute and allow to register multiple regions to the
KVM device.

Signed-off-by: Eric Auger <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Reviewed-by: Andrew Jones <[email protected]>
Message-id: 1529072910[email protected]
Signed-off-by: Peter Maydell <[email protected]>
6 years agohw/intc/arm_gicv3: Introduce redist-region-count array property
Eric Auger [Fri, 22 Jun 2018 12:28:36 +0000 (13:28 +0100)]
hw/intc/arm_gicv3: Introduce redist-region-count array property

To prepare for multiple redistributor regions, we introduce
an array of uint32_t properties that stores the redistributor
count of each redistributor region.

Non accelerated VGICv3 only supports a single redistributor region.
The capacity of all redist regions is checked against the number of
vcpus.

Machvirt is updated to set those properties, ie. a single
redistributor region with count set to the number of vcpus
capped by 123.

Signed-off-by: Eric Auger <[email protected]>
Reviewed-by: Andrew Jones <[email protected]>
Message-id: 1529072910[email protected]
Signed-off-by: Peter Maydell <[email protected]>
6 years agotarget/arm: Allow KVM device address overwriting
Eric Auger [Fri, 22 Jun 2018 12:28:35 +0000 (13:28 +0100)]
target/arm: Allow KVM device address overwriting

for KVM_VGIC_V3_ADDR_TYPE_REDIST_REGION attribute, the attribute
data pointed to by kvm_device_attr.addr is a OR of the
redistributor region address and other fields such as the index
of the redistributor region and the number of redistributors the
region can contain.

The existing machine init done notifier framework sets the address
field to the actual address of the device and does not allow to OR
this value with other fields.

This patch extends the KVMDevice struct with a new kda_addr_ormask
member. Its value is passed at registration time and OR'ed with the
resolved address on kvm_arm_set_device_addr().

Signed-off-by: Eric Auger <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Message-id: 1529072910[email protected]
Signed-off-by: Peter Maydell <[email protected]>
6 years agolinux-headers: Update to kernel mainline commit b357bf602
Eric Auger [Fri, 22 Jun 2018 12:28:35 +0000 (13:28 +0100)]
linux-headers: Update to kernel mainline commit b357bf602

Update our kernel headers to mainline commit
b357bf6023a948cf6a9472f07a1b0caac0e4f8e8
("Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm")

Signed-off-by: Eric Auger <[email protected]>
Message-id: 1529072910[email protected]
[PMM:  clarified commit message]
Signed-off-by: Peter Maydell <[email protected]>
6 years agotarget-arm: fix a segmentation fault due to illegal memory access
Zheng Xiang [Fri, 22 Jun 2018 12:28:35 +0000 (13:28 +0100)]
target-arm: fix a segmentation fault due to illegal memory access

The elements of kvm_devices_head list are freed in kvm_arm_machine_init_done(),
but we still access these illegal memory in kvm_arm_devlistener_del().

This will cause segment fault when booting guest with MALLOC_PERTURB_=1.

Signed-off-by: Zheng Xiang <[email protected]>
Message-id: 20180619075821[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
6 years agotarget/arm: Minor cleanup for ARMv6-M 32-bit instructions
Julia Suvorova [Fri, 22 Jun 2018 12:28:34 +0000 (13:28 +0100)]
target/arm: Minor cleanup for ARMv6-M 32-bit instructions

The arrays were made static, "if" was simplified because V7M and V8M
define V6 feature.

Signed-off-by: Julia Suvorova <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
Message-id: 20180618214604[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
6 years agohw/intc/arm_gicv3: fix an extra left-shift when reading IPRIORITYR
Amol Surati [Fri, 22 Jun 2018 12:28:34 +0000 (13:28 +0100)]
hw/intc/arm_gicv3: fix an extra left-shift when reading IPRIORITYR

When either GICD_IPRIORITYR or GICR_IPRIORITYR is read as a 32-bit
register, the post left-shift operator in the for loop causes an
extra shift after the least significant byte has been placed.

The 32-bit value actually returned is therefore the expected value
shifted left by 8 bits.

Signed-off-by: Amol Surati <[email protected]>
Message-id: 20180614054857[email protected]
Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
6 years agoMerge remote-tracking branch 'remotes/dgilbert/tags/pull-hmp-20180621' into staging
Peter Maydell [Fri, 22 Jun 2018 12:27:45 +0000 (13:27 +0100)]
Merge remote-tracking branch 'remotes/dgilbert/tags/pull-hmp-20180621' into staging

HMP pull 2018-06-21

Minor fixes and reenable preconfig

# gpg: Signature made Thu 21 Jun 2018 17:43:09 BST
# gpg:                using RSA key 0516331EBC5BFDE7
# gpg: Good signature from "Dr. David Alan Gilbert (RH2) <[email protected]>"
# Primary key fingerprint: 45F5 C71B 4A0C B7FB 977A  9FA9 0516 331E BC5B FDE7

* remotes/dgilbert/tags/pull-hmp-20180621:
  hmp: Allow HMP in preconfig state again
  hmp: add exit_preconfig
  hmp: Add commands for preconfig
  qmp: Enable a few commands in preconfig state
  hmp: Restrict auto-complete in preconfig
  hmp: Allow help on preconfig commands
  hmp: Add flag for preconfig commands
  hmp-commands: use long for begin and length in dump-guest-memory
  monitor: report entirety of hmp command on error

Signed-off-by: Peter Maydell <[email protected]>
6 years agoMerge remote-tracking branch 'remotes/stsquad/tags/pull-tcg-testing-revivial-210618...
Peter Maydell [Fri, 22 Jun 2018 09:57:47 +0000 (10:57 +0100)]
Merge remote-tracking branch 'remotes/stsquad/tags/pull-tcg-testing-revivial-210618-2' into staging

Add check-tcg machinary

This restores the ability to run TCG smoke tests by using our docker
infrastructure to support cross building simple tests. It represents
the first step to making better cross-architecture testing available
straight from the source tree ;-)

v2
  - fix quoting of target_compiler
  - make docker.py Py3 safe
  - tweak .travis.yml recipe
  - don't probe docker when HAVE_USER_DOCKER not set

# gpg: Signature made Thu 21 Jun 2018 07:23:45 BST
# gpg:                using RSA key FBD0DB095A9E2A44
# gpg: Good signature from "Alex Bennée (Master Work Key) <[email protected]>"
# Primary key fingerprint: 6685 AE99 E751 67BC AFC8  DF35 FBD0 DB09 5A9E 2A44

* remotes/stsquad/tags/pull-tcg-testing-revivial-210618-2: (57 commits)
  .travis.yml: add check-tcg test
  tests/docker/Makefile.include: only force SID to NOCACHE if old
  docker: docker.py adding age check command
  tests/Makefile: call sub-makes with SKIP_DOCKER_BUILD=1
  docker: docker.py add check sub-command
  docker: docker.py don't conflate checksums for extra_files
  docker: docker.py use "version" to probe usage
  tests: add top-level make dependency for docker builds
  tests/tcg/i386: extend timeout for runcom test
  tests/tcg: override runners for broken tests
  tests/tcg: add run, diff, and skip helper macros
  tests/Makefile.include: add [build|clean|check]-tcg targets
  Makefile.target: add (clean-/build-)guest-tests targets
  tests/tcg/Makefile: update to be called from Makefile.target
  tests/tcg: enable building for PowerPC
  docker: move debian-powerpc-cross to sid based build
  tests/tcg: enable building for RISCV64
  tests/tcg: enable building for mips64
  tests/tcg: enable building for sparc64
  tests/tcg: enable building for sh4
  ...

Signed-off-by: Peter Maydell <[email protected]>
6 years agoMerge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2018-06-20-v2' into staging
Peter Maydell [Fri, 22 Jun 2018 08:58:29 +0000 (09:58 +0100)]
Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2018-06-20-v2' into staging

nbd patches for 2018-06-20

Add experimental x-nbd-server-add-bitmap to expose a disabled
bitmap over NBD, in preparation for a pull model incremental
backup scheme. Also fix a corner case protocol issue with
NBD_CMD_BLOCK_STATUS, and add new NBD_CMD_CACHE.

- Eric Blake: tests: Simplify .gitignore
- Eric Blake: nbd/server: Reject 0-length block status request
- Vladimir Sementsov-Ogievskiy: 0/6 NBD export bitmaps
- Vladimir Sementsov-Ogievskiy: nbd/server: introduce NBD_CMD_CACHE

# gpg: Signature made Thu 21 Jun 2018 15:53:55 BST
# gpg:                using RSA key A7A16B4A2527436A
# gpg: Good signature from "Eric Blake <[email protected]>"
# gpg:                 aka "Eric Blake (Free Software Programmer) <[email protected]>"
# gpg:                 aka "[jpeg image of size 6874]"
# Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2  F3AA A7A1 6B4A 2527 436A

* remotes/ericb/tags/pull-nbd-2018-06-20-v2:
  nbd/server: introduce NBD_CMD_CACHE
  docs/interop: add nbd.txt
  qapi: new qmp command nbd-server-add-bitmap
  nbd/server: implement dirty bitmap export
  nbd/server: add nbd_meta_empty_or_pattern helper
  nbd/server: refactor NBDExportMetaContexts
  nbd/server: fix trace
  nbd/server: Reject 0-length block status request
  tests: Simplify .gitignore

Signed-off-by: Peter Maydell <[email protected]>
6 years agospapr: Don't rewrite mmu capabilities in KVM mode
David Gibson [Mon, 16 Apr 2018 06:19:52 +0000 (16:19 +1000)]
spapr: Don't rewrite mmu capabilities in KVM mode

Currently during KVM initialization on POWER, kvm_fixup_page_sizes()
rewrites a bunch of information in the cpu state to reflect the
capabilities of the host MMU and KVM.  This overwrites the information
that's already there reflecting how the TCG implementation of the MMU will
operate.

This means that we can get guest-visibly different behaviour between KVM
and TCG (and between different KVM implementations).  That's bad.  It also
prevents migration between KVM and TCG.

The pseries machine type now has filtering of the pagesizes it allows the
guest to use which means it can present a consistent model of the MMU
across all accelerators.

So, we can now replace kvm_fixup_page_sizes() with kvm_check_mmu() which
merely verifies that the expected cpu model can be faithfully handled by
KVM, rather than updating the cpu model to match KVM.

We call kvm_check_mmu() from the spapr cpu reset code.  This is a hack:
conceptually it makes more sense where fixup_page_sizes() was - in the KVM
cpu init path.  However, doing that would require moving the platform's
pagesize filtering much earlier, which would require a lot of work making
further adjustments.  There wouldn't be a lot of concrete point to doing
that, since the only KVM implementation which has the awkward MMU
restrictions is KVM HV, which can only work with an spapr guest anyway.

Signed-off-by: David Gibson <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
6 years agospapr: Limit available pagesizes to provide a consistent guest environment
David Gibson [Mon, 16 Apr 2018 06:47:19 +0000 (16:47 +1000)]
spapr: Limit available pagesizes to provide a consistent guest environment

KVM HV has some limitations (deriving from the hardware) that mean not all
host-cpu supported pagesizes may be usable in the guest.  At present this
means that KVM guests and TCG guests may see different available page sizes
even if they notionally have the same vcpu model.  This is confusing and
also prevents migration between TCG and KVM.

This patch makes the environment consistent by always allowing the same set
of pagesizes.  Since we can't remove the KVM limitations, we do this by
always applying the same limitations it has, even to TCG guests.

Signed-off-by: David Gibson <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
6 years agotarget/ppc: Add ppc_hash64_filter_pagesizes()
David Gibson [Mon, 26 Mar 2018 04:01:22 +0000 (15:01 +1100)]
target/ppc: Add ppc_hash64_filter_pagesizes()

The paravirtualized PAPR platform sometimes needs to restrict the guest to
using only some of the page sizes actually supported by the host's MMU.
At the moment this is handled in KVM specific code, but for consistency we
want to apply the same limitations to all accelerators.

This makes a start on this by providing a helper function in the cpu code
to allow platform code to remove some of the cpu's page size definitions
via a caller supplied callback.

Signed-off-by: David Gibson <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
6 years agospapr: Use maximum page size capability to simplify memory backend checking
David Gibson [Wed, 18 Apr 2018 04:21:45 +0000 (14:21 +1000)]
spapr: Use maximum page size capability to simplify memory backend checking

The way we used to handle KVM allowable guest pagesizes for PAPR guests
required some convoluted checking of memory attached to the guest.

The allowable pagesizes advertised to the guest cpus depended on the memory
which was attached at boot, but then we needed to ensure that any memory
later hotplugged didn't change which pagesizes were allowed.

Now that we have an explicit machine option to control the allowable
maximum pagesize we can simplify this.  We just check all memory backends
against that declared pagesize.  We check base and cold-plugged memory at
reset time, and hotplugged memory at pre_plug() time.

Signed-off-by: David Gibson <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
6 years agospapr: Maximum (HPT) pagesize property
David Gibson [Fri, 16 Mar 2018 08:19:13 +0000 (19:19 +1100)]
spapr: Maximum (HPT) pagesize property

The way the POWER Hash Page Table (HPT) MMU is virtualized by KVM HV means
that every page that the guest puts in the pagetables must be truly
physically contiguous, not just GPA-contiguous.  In effect this means that
an HPT guest can't use any pagesizes greater than the host page size used
to back its memory.

At present we handle this by changing what we advertise to the guest based
on the backing pagesizes.  This is pretty bad, because it means the guest
sees a different environment depending on what should be host configuration
details.

As a start on fixing this, we add a new capability parameter to the
pseries machine type which gives the maximum allowed pagesizes for an
HPT guest.  For now we just create and validate the parameter without
making it do anything.

For backwards compatibility, on older machine types we set it to the max
available page size for the host.  For the 3.0 machine type, we fix it to
16, the intention being to only allow HPT pagesizes up to 64kiB by default
in future.

Signed-off-by: David Gibson <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
6 years agopseries: Update SLOF firmware image to qemu-slof-20180621
Alexey Kardashevskiy [Thu, 21 Jun 2018 09:05:58 +0000 (19:05 +1000)]
pseries: Update SLOF firmware image to qemu-slof-20180621

The changes are:
1. fixed broken_sc1;
2. added switching between boot consoles;
3. added PXE boot.

The full list is:
 > lib/libnet/pxelinux: Fix two off-by-one bugs in the pxelinux.cfg parser
 > lib/libnet/pxelinux: Make the size handling for pxelinux_load_cfg more logical
 > libc: Add a simple implementation of an assert() function
 > libnet: Support UUID-based pxelinux.cfg file names
 > slof: Add a helper function to get the contents of a property in C code
 > libnet: Add support for DHCPv4 options 209 and 210
 > libnet: Wire up pxelinux.cfg network booting
 > libnet: Add functions for downloading and parsing pxelinux.cfg files
 > libnet: Put code for determing TFTP error strings into a separate function
 > libc: Add the snprintf() function
 > libnet: Pass ip_version via struct filename_ip
 > resolve ihandle and xt handle in the input command (like for the output)
 > Fix output word
 > obp-tftp: Make sure to not overwrite paflof in memory
 > libnet: Get rid of unused huge_load and block_size parameters
 > libc: Check for NULL pointers in free()
 > libc: Implement strrchr()
 > libnet: Get rid of unnecessary (char *) casts
 > broken_sc1: check for H_PRIVILEGE
 > OF: Use new property "stdout-path" for boot console

Signed-off-by: Alexey Kardashevskiy <[email protected]>
Signed-off-by: David Gibson <[email protected]>
6 years agoMerge remote-tracking branch 'remotes/rth/tags/pull-tcg-20180615' into staging
Peter Maydell [Thu, 21 Jun 2018 16:54:26 +0000 (17:54 +0100)]
Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20180615' into staging

TCG patch queue:

Workaround macos assembler lossage.
Eliminate tb_lock.
Fix TB code generation overflow.

# gpg: Signature made Fri 15 Jun 2018 20:40:56 BST
# gpg:                using RSA key 64DF38E8AF7E215F
# gpg: Good signature from "Richard Henderson <[email protected]>"
# Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A  05C0 64DF 38E8 AF7E 215F

* remotes/rth/tags/pull-tcg-20180615:
  tcg: Reduce max TB opcode count
  tcg: remove tb_lock
  translate-all: remove tb_lock mention from cpu_restore_state_from_tb
  cputlb: remove tb_lock from tlb_flush functions
  translate-all: protect TB jumps with a per-destination-TB lock
  translate-all: discard TB when tb_link_page returns an existing matching TB
  translate-all: introduce assert_no_pages_locked
  translate-all: add page_locked assertions
  translate-all: use per-page locking in !user-mode
  translate-all: move tb_invalidate_phys_page_range up in the file
  translate-all: work page-by-page in tb_invalidate_phys_range_1
  translate-all: remove hole in PageDesc
  translate-all: make l1_map lockless
  translate-all: iterate over TBs in a page with PAGE_FOR_EACH_TB
  tcg: move tb_ctx.tb_phys_invalidate_count to tcg_ctx
  tcg: track TBs with per-region BST's
  qht: return existing entry when qht_insert fails
  qht: require a default comparison function
  tcg/i386: Use byte form of xgetbv instruction

Signed-off-by: Peter Maydell <[email protected]>
6 years agonbd/server: introduce NBD_CMD_CACHE
Vladimir Sementsov-Ogievskiy [Fri, 13 Apr 2018 14:31:56 +0000 (17:31 +0300)]
nbd/server: introduce NBD_CMD_CACHE

Handle nbd CACHE command. Just do read, without sending read data back.
Cache mechanism should be done by exported node driver chain.

Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Message-Id: <20180413143156[email protected]>
Reviewed-by: Eric Blake <[email protected]>
[eblake: fix two missing case labels in switch statements]
Signed-off-by: Eric Blake <[email protected]>
6 years agodocs/interop: add nbd.txt
Vladimir Sementsov-Ogievskiy [Sat, 9 Jun 2018 15:17:58 +0000 (18:17 +0300)]
docs/interop: add nbd.txt

Describe new metadata namespace: "qemu".

Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Message-Id: <20180609151758[email protected]>
Reviewed-by: Eric Blake <[email protected]>
[eblake: grammar tweaks]
Signed-off-by: Eric Blake <[email protected]>
6 years agoqapi: new qmp command nbd-server-add-bitmap
Vladimir Sementsov-Ogievskiy [Sat, 9 Jun 2018 15:17:57 +0000 (18:17 +0300)]
qapi: new qmp command nbd-server-add-bitmap

For now, the actual command ix x-nbd-server-add-bitmap, reflecting
the fact that we are still working on libvirt code that proves the
command works as needed, and also the fact that we may remove
bitmap-export-name (and just require that the exported name be the
bitmap name).

Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Message-Id: <20180609151758[email protected]>
Reviewed-by: Eric Blake <[email protected]>
[eblake: make the command experimental by adding x- prefix]
Signed-off-by: Eric Blake <[email protected]>
6 years agonbd/server: implement dirty bitmap export
Vladimir Sementsov-Ogievskiy [Sat, 9 Jun 2018 15:17:56 +0000 (18:17 +0300)]
nbd/server: implement dirty bitmap export

Handle a new NBD meta namespace: "qemu", and corresponding queries:
"qemu:dirty-bitmap:<export bitmap name>".

With the new metadata context negotiated, BLOCK_STATUS query will reply
with dirty-bitmap data, converted to extents. The new public function
nbd_export_bitmap selects which bitmap to export. For now, only one bitmap
may be exported.

Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Message-Id: <20180609151758[email protected]>
Reviewed-by: Eric Blake <[email protected]>
[eblake: wording tweaks, minor cleanups, additional tracing]
Signed-off-by: Eric Blake <[email protected]>
6 years agonbd/server: add nbd_meta_empty_or_pattern helper
Vladimir Sementsov-Ogievskiy [Tue, 19 Jun 2018 21:55:09 +0000 (16:55 -0500)]
nbd/server: add nbd_meta_empty_or_pattern helper

Add nbd_meta_pattern() and nbd_meta_empty_or_pattern() helpers for
metadata query parsing. nbd_meta_pattern() will be reused for the
"qemu" namespace in following patches.

Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Message-Id: <20180609151758[email protected]>
Reviewed-by: Eric Blake <[email protected]>
[eblake: comment tweaks]
Signed-off-by: Eric Blake <[email protected]>
6 years agonbd/server: refactor NBDExportMetaContexts
Vladimir Sementsov-Ogievskiy [Sat, 9 Jun 2018 15:17:54 +0000 (18:17 +0300)]
nbd/server: refactor NBDExportMetaContexts

Use NBDExport pointer instead of just export name: there is no need to
store a duplicated name in the struct; moreover, NBDExport will be used
further.

Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Message-Id: <20180609151758[email protected]>
Reviewed-by: Eric Blake <[email protected]>
[eblake: commit message grammar tweak]
Signed-off-by: Eric Blake <[email protected]>
6 years agonbd/server: fix trace
Vladimir Sementsov-Ogievskiy [Sat, 9 Jun 2018 15:17:53 +0000 (18:17 +0300)]
nbd/server: fix trace

Return code = 1 doesn't mean that we parsed base:allocation. Use
correct traces in both -parsed and -skipped cases.

Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Message-Id: <20180609151758[email protected]>
Reviewed-by: Eric Blake <[email protected]>
[eblake: comment tweaks]
Signed-off-by: Eric Blake <[email protected]>
6 years agonbd/server: Reject 0-length block status request
Eric Blake [Thu, 21 Jun 2018 12:49:37 +0000 (07:49 -0500)]
nbd/server: Reject 0-length block status request

The NBD spec says that behavior is unspecified if the client
requests 0 length for block status; but since the structured
reply is documenting as returning a non-zero length, it's
easier to just diagnose this with an EINVAL error than to
figure out what to return.

CC: [email protected]
Signed-off-by: Eric Blake <[email protected]>
Message-Id: <20180621124937[email protected]>
Reviewed-by: Vladimir Sementsov-Ogievskiy <[email protected]>
6 years agotests: Simplify .gitignore
Eric Blake [Tue, 19 Jun 2018 20:39:18 +0000 (15:39 -0500)]
tests: Simplify .gitignore

Commit 0bcc8e5b was yet another instance of 'git status' reporting
dirty files after an in-tree build, thanks to the new binary
tests/check-block-qdict.

Instead of piecemeal exemptions of each new binary as they are
added, let's use git's negative globbing feature to exempt ALL
files that have a 'test-' or 'check-' prefix, except for the ones
ending in '.c' or '.sh'.  We still have a couple of generated
files that then need (re-)exclusion, but the overall list is a
LOT shorter, and less prone to needing future edits.

Signed-off-by: Eric Blake <[email protected]>
Message-Id: <20180619203918[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
6 years agohmp: Allow HMP in preconfig state again
Dr. David Alan Gilbert [Wed, 20 Jun 2018 15:39:47 +0000 (16:39 +0100)]
hmp: Allow HMP in preconfig state again

Now we can cope with preconfig in HMP, reenable by reverting
commit 71dc578e116599ea73c8a2a4e693134702ec0e83.

Signed-off-by: Dr. David Alan Gilbert <[email protected]>
Reviewed-by: Peter Xu <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Message-Id: <20180620153947[email protected]>
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
6 years agohmp: add exit_preconfig
Dr. David Alan Gilbert [Wed, 20 Jun 2018 15:39:46 +0000 (16:39 +0100)]
hmp: add exit_preconfig

Add the exit_preconfig command to return to normality.

Signed-off-by: Dr. David Alan Gilbert <[email protected]>
Reviewed-by: Peter Xu <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Message-Id: <20180620153947[email protected]>
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
6 years agohmp: Add commands for preconfig
Dr. David Alan Gilbert [Wed, 20 Jun 2018 15:39:45 +0000 (16:39 +0100)]
hmp: Add commands for preconfig

Allow a bunch of the info commands to be used in preconfig.

version, chardev, name, uuid,memdev, iothreads
  Were enabled in QMP in the previous patch from Igor

status, hotpluggable_cpus
  Was enabled in the original allow-preconfig series

history
  is HMP specific

qom-tree
  Don't have a QMP equivalent

Also enable the qom commands qom-list and qom-set.

Signed-off-by: Dr. David Alan Gilbert <[email protected]>
Message-Id: <20180620153947[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
  Dropped info numa as per Igor's 2018-06-21 review

6 years agoqmp: Enable a few commands in preconfig state
Igor Mammedov [Wed, 20 Jun 2018 15:39:44 +0000 (16:39 +0100)]
qmp: Enable a few commands in preconfig state

Commands query-chardev, query-version, query-name, query-uuid,
query-iothreads, query-memdev are informational and do not depend on
the machine being initialized.  Make them available in preconfig
runstate to make the latter a little bit more useful.
The generic qom commands don't depend on the machine being initialized
either; so enabled qom-list, qom-get, qom-set, qom-list-types,
qom-list-properties.

Signed-off-by: Igor Mammedov <[email protected]>
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Message-Id: <20180620153947[email protected]>
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
6 years agohmp: Restrict auto-complete in preconfig
Dr. David Alan Gilbert [Wed, 20 Jun 2018 15:39:43 +0000 (16:39 +0100)]
hmp: Restrict auto-complete in preconfig

Don't show the commands that aren't available.

Signed-off-by: Dr. David Alan Gilbert <[email protected]>
Reviewed-by: Peter Xu <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Message-Id: <20180620153947[email protected]>
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
6 years agohmp: Allow help on preconfig commands
Dr. David Alan Gilbert [Wed, 20 Jun 2018 15:39:42 +0000 (16:39 +0100)]
hmp: Allow help on preconfig commands

Allow the 'help' command in preconfig state but
make it only list the preconfig commands.

Signed-off-by: Dr. David Alan Gilbert <[email protected]>
Reviewed-by: Peter Xu <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Message-Id: <20180620153947[email protected]>
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
6 years agohmp: Add flag for preconfig commands
Dr. David Alan Gilbert [Wed, 20 Jun 2018 15:39:41 +0000 (16:39 +0100)]
hmp: Add flag for preconfig commands

Add a flag to command definitions to allow them to be used in preconfig
and check it.
If users try to use commands that aren't available, tell them to use
the exit_preconfig comand we're adding in a few patches.

Signed-off-by: Dr. David Alan Gilbert <[email protected]>
Reviewed-by: Markus Armbruster <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Message-Id: <20180620153947[email protected]>
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
6 years agohmp-commands: use long for begin and length in dump-guest-memory
Suraj Jitindar Singh [Wed, 20 Jun 2018 00:32:02 +0000 (10:32 +1000)]
hmp-commands: use long for begin and length in dump-guest-memory

The dump-guest-memory command is used to dump an area of guest memory
to a file, the piece of memory is specified by a begin address and
a length. These parameters are specified as ints and thus have a maximum
value of 4GB. This means you can't dump the guest memory past the first
4GB and instead get:
(qemu) dump-guest-memory tmp 0x100000000 0x100000000
'dump-guest-memory' has failed: integer is for 32-bit values
Try "help dump-guest-memory" for more information

This limitation is imposed in monitor_parse_arguments() since they are
both ints. hmp_dump_guest_memory() uses 64 bit quantities to store both
the begin and length values. Thus specify begin and length as long so
that the entire guest memory space can be dumped.

Signed-off-by: Suraj Jitindar Singh <[email protected]>
Message-Id: <20180620003202[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
6 years agotarget/ppc: Add missing opcode for icbt on PPC440
BALATON Zoltan [Tue, 19 Jun 2018 08:52:15 +0000 (10:52 +0200)]
target/ppc: Add missing opcode for icbt on PPC440

According to PPC440 User Manual PPC440 has multiple opcodes for icbt
instruction: one for compatibility with older cores and two 440
specific opcodes one of which is defined in BookE. QEMU only
implements two of these, add the missing one.

Signed-off-by: BALATON Zoltan <[email protected]>
Signed-off-by: David Gibson <[email protected]>
6 years agoppc4xx_i2c: Implement directcntl register
BALATON Zoltan [Tue, 19 Jun 2018 08:52:15 +0000 (10:52 +0200)]
ppc4xx_i2c: Implement directcntl register

As well as being able to generate its own i2c transactions, the ppc4xx
i2c controller has a DIRECTCNTL register which allows explicit control
of the i2c lines.

Using this register an OS can directly bitbang i2c operations. In
order to let emulated i2c devices respond to this, we need to wire up
the DIRECTCNTL register to qemu's bitbanged i2c handling code.

Signed-off-by: BALATON Zoltan <[email protected]>
Signed-off-by: David Gibson <[email protected]>
6 years agoppc4xx_i2c: Remove unimplemented sdata and intr registers
BALATON Zoltan [Tue, 19 Jun 2018 08:52:15 +0000 (10:52 +0200)]
ppc4xx_i2c: Remove unimplemented sdata and intr registers

We don't emulate slave mode so related registers are not needed.
[lh]sadr are only retained to avoid too many warnings and simplify
debugging but sdata is not even correct because device has a 4 byte
FIFO instead so just remove this unimplemented register for now.

The intr register is also not implemented correctly, it is for
diagnostics and normally not even visible on device without explicitly
enabling it. As no guests are known to need this remove it as well.

Signed-off-by: BALATON Zoltan <[email protected]>
Signed-off-by: David Gibson <[email protected]>
6 years agosm501: Fix hardware cursor color conversion
Sebastian Bauer [Mon, 18 Jun 2018 21:38:16 +0000 (23:38 +0200)]
sm501: Fix hardware cursor color conversion

According to the sm501 specs the hardware cursor colors are to be given in
the rgb565 format, but the code currently interprets them as bgr565.

Therefore, the colors of the hardware cursors are wrong in the QEMU
display, e.g., the standard mouse pointer of AmigaOS appears blue instead
of red. This change fixes this issue by replacing the existing naive
bgr565 => rgb888 conversion with a standard rgb565 => rgb888 one that also
scales the color component values properly.

Signed-off-by: Sebastian Bauer <[email protected]>
Signed-off-by: David Gibson <[email protected]>
6 years agofpu_helper.c: fix helper_fpscr_clrbit() function
John Arbuckle [Mon, 18 Jun 2018 15:50:24 +0000 (11:50 -0400)]
fpu_helper.c: fix helper_fpscr_clrbit() function

Fix the helper_fpscr_clrbit() function so it correctly sets the FEX
and VX bits.

Determining the value for the Floating Point Status and Control
Register's (FPSCR) FEX bit is suppose to be done like this:

FEX = (VX & VE) | (OX & OE) | (UX & UE) | (ZX & ZE) | (XX & XE))

It is described as "the logical OR of all the floating-point exception
bits masked by their respective enable bits". It was not implemented
correctly. The value of FEX would stay on even when all other bits
were set to off.

The VX bit is described as "the logical OR of all of the invalid
operation exceptions". This bit was also not implemented correctly. It
too would stay on when all the other bits were set to off.

My main source of information is an IBM document called:

PowerPC Microprocessor Family:
The Programming Environments for 32-Bit Microprocessors

Page 62 is where the FPSCR information is located.

This is an older copy than the one I use but it is still very useful:
https://www.pdfdrive.net/powerpc-microprocessor-family-the-programming-environments-for-32-e3087633.html

I use a G3 and G5 iMac to compare bit values with QEMU. This patch
fixed all the problems I was having with these bits.

Signed-off-by: John Arbuckle <[email protected]>
[dwg: Re-wrapped commit message]
Signed-off-by: David Gibson <[email protected]>
6 years agospapr: remove unused spapr_irq routines
Cédric Le Goater [Mon, 18 Jun 2018 17:34:01 +0000 (19:34 +0200)]
spapr: remove unused spapr_irq routines

spapr_irq_alloc_block and spapr_irq_alloc() are now deprecated.

Signed-off-by: Cédric Le Goater <[email protected]>
Reviewed-by: David Gibson <[email protected]>
Signed-off-by: David Gibson <[email protected]>
6 years agospapr: split the IRQ allocation sequence
Cédric Le Goater [Mon, 18 Jun 2018 17:34:00 +0000 (19:34 +0200)]
spapr: split the IRQ allocation sequence

Today, when a device requests for IRQ number in a sPAPR machine, the
spapr_irq_alloc() routine first scans the ICSState status array to
find an empty slot and then performs the assignement of the selected
numbers. Split this sequence in two distinct routines : spapr_irq_find()
for lookups and spapr_irq_claim() for claiming the IRQ numbers.

This will ease the introduction of a static layout of IRQ numbers.

Signed-off-by: Cédric Le Goater <[email protected]>
Signed-off-by: David Gibson <[email protected]>
6 years agotarget/ppc: Add kvmppc_hpt_needs_host_contiguous_pages() helper
David Gibson [Thu, 14 Jun 2018 02:11:08 +0000 (12:11 +1000)]
target/ppc: Add kvmppc_hpt_needs_host_contiguous_pages() helper

KVM HV has a restriction that for HPT mode guests, guest pages must be hpa
contiguous as well as gpa contiguous.  We have to account for that in
various places.  We determine whether we're subject to this restriction
from the SMMU information exposed by KVM.

Planned cleanups to the way we handle this will require knowing whether
this restriction is in play in wider parts of the code.  So, expose a
helper function which returns it.

This does mean some redundant calls to kvm_get_smmu_info(), but they'll go
away again with future cleanups.

Signed-off-by: David Gibson <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
6 years agospapr: Add cpu_apply hook to capabilities
David Gibson [Wed, 28 Mar 2018 03:45:44 +0000 (14:45 +1100)]
spapr: Add cpu_apply hook to capabilities

spapr capabilities have an apply hook to actually activate (or deactivate)
the feature in the system at reset time.  However, a number of capabilities
affect the setup of cpus, and need to be applied to each of them -
including hotplugged cpus for extra complication.  To make this simpler,
add an optional cpu_apply hook that is called from spapr_cpu_reset().

Signed-off-by: David Gibson <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
6 years agospapr: Compute effective capability values earlier
David Gibson [Thu, 14 Jun 2018 06:37:28 +0000 (16:37 +1000)]
spapr: Compute effective capability values earlier

Previously, the effective values of the various spapr capability flags
were only determined at machine reset time.  That was a lazy way of making
sure it was after cpu initialization so it could use the cpu object to
inform the defaults.

But we've now improved the compat checking code so that we don't need to
instantiate the cpus to use it.  That lets us move the resolution of the
capability defaults much earlier.

This is going to be necessary for some future capabilities.

Signed-off-by: David Gibson <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
6 years agotarget/ppc: Allow cpu compatiblity checks based on type, not instance
David Gibson [Thu, 14 Jun 2018 06:33:58 +0000 (16:33 +1000)]
target/ppc: Allow cpu compatiblity checks based on type, not instance

ppc_check_compat() is used in a number of places to check if a cpu object
supports a certain compatiblity mode, subject to various constraints.

It takes a PowerPCCPU *, however it really only depends on the cpu's class.
We have upcoming cases where it would be useful to make compatibility
checks before we fully instantiate the cpu objects.

ppc_type_check_compat() will now make an equivalent check, but based on a
CPU's QOM typename instead of an instantiated CPU object.

We make use of the new interface in several places in spapr, where we're
essentially making a global check, rather than one specific to a particular
cpu.  This avoids some ugly uses of first_cpu to grab a "representative"
instance.

Signed-off-by: David Gibson <[email protected]>
Reviewed-by: Greg Kurz <[email protected]>
Reviewed-by: Cédric Le Goater <[email protected]>
6 years agoppc/pnv: consolidate the creation of the ISA bus device tree
Cédric Le Goater [Mon, 18 Jun 2018 17:05:40 +0000 (19:05 +0200)]
ppc/pnv: consolidate the creation of the ISA bus device tree

The device tree node of the ISA bus was being partially done in
different places. Move all the nodes creation under the same routine.

Signed-off-by: Cédric Le Goater <[email protected]>
Signed-off-by: David Gibson <[email protected]>
6 years agoppc/pnv: introduce Pnv8Chip and Pnv9Chip models
Cédric Le Goater [Mon, 18 Jun 2018 17:05:39 +0000 (19:05 +0200)]
ppc/pnv: introduce Pnv8Chip and Pnv9Chip models

It introduces a base PnvChip class from which the specific processor
chip classes, Pnv8Chip and Pnv9Chip, inherit. Each of them needs to
define an init and a realize routine which will create the controllers
of the target processor. For the moment, the base PnvChip class
handles the XSCOM bus and the cores.

Signed-off-by: Cédric Le Goater <[email protected]>
Signed-off-by: David Gibson <[email protected]>
6 years agospapr_cpu_core: migrate VPA related state
Greg Kurz [Mon, 18 Jun 2018 12:26:49 +0000 (14:26 +0200)]
spapr_cpu_core: migrate VPA related state

QEMU implements the "Shared Processor LPAR" (SPLPAR) option, which allows
the hypervisor to time-slice a physical processor into multiple virtual
processor. The intent is to allow more guests to run, and to optimize
processor utilization.

The guest OS can cede idle VCPUs, so that their processing capacity may
be used by other VCPUs, with the H_CEDE hcall. The guest OS can also
optimize spinlocks, by confering the time-slice of a spinning VCPU to the
spinlock holder if it's currently notrunning, with the H_CONFER hcall.

Both hcalls depend on a "Virtual Processor Area" (VPA) to be registered
by the guest OS, generally during early boot. Other per-VCPU areas can
be registered: the "SLB Shadow Buffer" which allows a more efficient
dispatching of VCPUs, and the "Dispatch Trace Log Buffer" (DTL) which
is used to compute time stolen by the hypervisor. Both DTL and SLB Shadow
areas depend on the VPA to be registered.

The VPA/SLB Shadow/DTL are state that QEMU should migrate, but this doesn't
happen, for no apparent reason other than it was just never coded. This
causes the features listed above to stop working after migration, and it
breaks the logic of the H_REGISTER_VPA hcall in the destination.

The VPA is set at the guest request, ie, we don't have to migrate
it before the guest has actually set it. This patch hence adds an
"spapr_cpu/vpa" subsection to the recently introduced per-CPU machine
data migration stream.

Since DTL and SLB Shadow are optional and both depend on VPA, they get
their own subsections "spapr_cpu/vpa/slb_shadow" and "spapr_cpu/vpa/dtl"
hanging from the "spapr_cpu/vpa" subsection.

Note that this won't break migration to older QEMUs. Is is already handled
by only registering the vmstate handler for per-CPU data with newer machine
types.

Signed-off-by: Greg Kurz <[email protected]>
Signed-off-by: David Gibson <[email protected]>
6 years agospapr_cpu_core: migrate per-CPU data
Greg Kurz [Mon, 18 Jun 2018 12:26:35 +0000 (14:26 +0200)]
spapr_cpu_core: migrate per-CPU data

A per-CPU machine data pointer was recently added to PowerPCCPU. The
motivation is to to hide platform specific details from the core CPU
code. This per-CPU data can hold state which is relevant to the guest
though, eg, Virtual Processor Areas, and we should migrate this state.

This patch adds the plumbing so that we can migrate the per-CPU data
for PAPR guests. We only do this for newer machine types for the sake
of backward compatibility. No state is migrated for the moment: the
vmstate_spapr_cpu_state structure will be populated by subsequent
patches.

Signed-off-by: Greg Kurz <[email protected]>
[dwg: Fix some trivial spelling and spacing errors]
Signed-off-by: David Gibson <[email protected]>
6 years agoppc/pnv: introduce a new isa_create() operation to the chip model
Cédric Le Goater [Fri, 15 Jun 2018 15:25:34 +0000 (17:25 +0200)]
ppc/pnv: introduce a new isa_create() operation to the chip model

This moves the details of the ISA bus creation under the LPC model but
more important, the new PnvChip operation will let us choose the chip
class to use when we introduce the different chip classes for Power9
and Power8. It hides away the processor chip controllers from the
machine.

Signed-off-by: Cédric Le Goater <[email protected]>
Signed-off-by: David Gibson <[email protected]>
6 years agoppc/pnv: introduce a new intc_create() operation to the chip model
Cédric Le Goater [Fri, 15 Jun 2018 15:25:33 +0000 (17:25 +0200)]
ppc/pnv: introduce a new intc_create() operation to the chip model

On Power9, the thread interrupt presenter has a different type and is
linked to the chip owning the cores.

Signed-off-by: Cédric Le Goater <[email protected]>
Signed-off-by: David Gibson <[email protected]>
6 years agomonitor: report entirety of hmp command on error
Collin Walling [Mon, 7 May 2018 14:30:54 +0000 (10:30 -0400)]
monitor: report entirety of hmp command on error

When a user incorrectly provides an hmp command, an error response will be
printed that prompts the user to try "help <command name>". However, when
the command contains multiple parts e.g. "info uuid xyz", only the last
whitespace delimited string will be reported (in this example "info" will
be dropped and the message will read "Try "help uuid" for more information",
which is incorrect).

Let's correct this by capturing the entirety of the command from the command
line -- excluding any extraneous characters.

Reported-by: Mikhail Fokin <[email protected]>
Signed-off-by: Collin Walling <[email protected]>
Message-Id: <ee680f5e-ac9a-479d-f65e-9f8ae9cfe5d4@linux.ibm.com>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
6 years ago.travis.yml: add check-tcg test
Alex Bennée [Wed, 18 Apr 2018 15:55:37 +0000 (16:55 +0100)]
.travis.yml: add check-tcg test

Signed-off-by: Alex Bennée <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
6 years agotests/docker/Makefile.include: only force SID to NOCACHE if old
Alex Bennée [Tue, 12 Jun 2018 20:29:40 +0000 (21:29 +0100)]
tests/docker/Makefile.include: only force SID to NOCACHE if old

Now we can check the age of a docker image we can be a little more
intelligent about re-building Sid images and only force NOCACHE if
it is "old".

Signed-off-by: Alex Bennée <[email protected]>
6 years agodocker: docker.py adding age check command
Alex Bennée [Tue, 12 Jun 2018 20:28:45 +0000 (21:28 +0100)]
docker: docker.py adding age check command

This is useful for querying if an image is too old.

Signed-off-by: Alex Bennée <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
6 years agotests/Makefile: call sub-makes with SKIP_DOCKER_BUILD=1
Alex Bennée [Fri, 15 Jun 2018 18:20:55 +0000 (19:20 +0100)]
tests/Makefile: call sub-makes with SKIP_DOCKER_BUILD=1

As we now ensure all the images we are going to use are built in the
top level make file lets not over complicate things by running the
full script again. We do run the check script just in case someone
deletes the docker image while we are running.

Signed-off-by: Alex Bennée <[email protected]>
6 years agodocker: docker.py add check sub-command
Alex Bennée [Fri, 8 Jun 2018 15:20:48 +0000 (16:20 +0100)]
docker: docker.py add check sub-command

This command allows you to check if we need to re-build a docker
image. If the image isn't in the repository or the checksums don't
match then we return false and some text (for processing in
makefiles).

Signed-off-by: Alex Bennée <[email protected]>
6 years agodocker: docker.py don't conflate checksums for extra_files
Alex Bennée [Fri, 8 Jun 2018 14:20:25 +0000 (15:20 +0100)]
docker: docker.py don't conflate checksums for extra_files

This just gets confusing especially as the helper function doesn't
even take into account any extra files (or the executable). Currently
the actual check just ignores them and also passes the result through
_dockerfile_preprocess so we fix that too.

Signed-off-by: Alex Bennée <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
6 years agodocker: docker.py use "version" to probe usage
Alex Bennée [Mon, 18 Jun 2018 10:14:40 +0000 (11:14 +0100)]
docker: docker.py use "version" to probe usage

The "images" command is a fairly heavyweight command to run as it
involves searching the whole docker file-system inventory. On a
machine with a lot of images this makes start-up fairly expensive.

Signed-off-by: Alex Bennée <[email protected]>
6 years agotests: add top-level make dependency for docker builds
Alex Bennée [Fri, 8 Jun 2018 11:12:46 +0000 (12:12 +0100)]
tests: add top-level make dependency for docker builds

One problem with satisfying your docker dependencies in a sub-make it
you might end up trying to satisfy the dependency multiple times. This
is especially a problem with debian-sid based cross compilers and CI
setups. We solve this by doing a docker build pass at the top level
before any sub-makes are called.

We still need to satisfy dependencies in the Makefile.target call so
people can run tests from individual target directories. We introduce
a new Makefile.probe which gets called for each PROBE_TARGET and
allows us to build up the list. It does require multiply including
config-target.mak which shouldn't cause any issues as it shouldn't
define anything that clashes with config-host.mak. However we undefine
a few key variables each time around.

Signed-off-by: Alex Bennée <[email protected]>
6 years agotests/tcg/i386: extend timeout for runcom test
Alex Bennée [Mon, 18 Jun 2018 09:34:20 +0000 (10:34 +0100)]
tests/tcg/i386: extend timeout for runcom test

The Travis hardware can be a little slow and the runcom test is fairly
heavy in calculating pi. Lets double the timeout so we don't trip up
during CI by mistake.

Signed-off-by: Alex Bennée <[email protected]>
6 years agotests/tcg: override runners for broken tests
Alex Bennée [Tue, 24 Apr 2018 14:21:50 +0000 (15:21 +0100)]
tests/tcg: override runners for broken tests

To get a clean run of check-tcg these tests are currently skipped:

  - hello-mips for mips
  - linux-test for sparc

Signed-off-by: Alex Bennée <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
6 years agotests/tcg: add run, diff, and skip helper macros
Alex Bennée [Mon, 21 May 2018 09:38:37 +0000 (10:38 +0100)]
tests/tcg: add run, diff, and skip helper macros

As we aren't using the default runners for all the test cases it is
easy to miss out things like timeouts. To help with this we add some
helpers and use them so we only need to make core changes in one
place.

Signed-off-by: Alex Bennée <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
6 years agotests/Makefile.include: add [build|clean|check]-tcg targets
Alex Bennée [Fri, 6 Apr 2018 21:08:36 +0000 (22:08 +0100)]
tests/Makefile.include: add [build|clean|check]-tcg targets

This will ensure all linux-user targets build their guest test
programs and ensure check-tcg will run the respective tests.

Signed-off-by: Alex Bennée <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
6 years agoMakefile.target: add (clean-/build-)guest-tests targets
Alex Bennée [Fri, 6 Apr 2018 10:08:37 +0000 (11:08 +0100)]
Makefile.target: add (clean-/build-)guest-tests targets

Now all the build infrastructure is in place we can build tests for
each guest that we support. That support mainly depends on having
cross compilers installed or docker setup. To keep all the logic for
that together we put the rules in tests/tcg/Makefile.include and
include it from the main Makefile.target.

Signed-off-by: Alex Bennée <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
6 years agotests/tcg/Makefile: update to be called from Makefile.target
Alex Bennée [Fri, 6 Apr 2018 12:32:18 +0000 (13:32 +0100)]
tests/tcg/Makefile: update to be called from Makefile.target

This make is now invoked from each individual target make with the
appropriate CC and EXTRA_CFLAGS set for each guest. It then includes
additional Makefile.targets from:

  - tests/tcg/multiarch (always)
  - tests/tcg/$(TARGET_BASE_ARCH) (if available)
  - tests/tcg/$(TARGET_NAME)

The order is important as the later Makefile's may want to suppress
TESTS from its base arch profile. Each included Makefile.target is
responsible for adding TESTS as well as defining any special build
instructions for individual tests.

Signed-off-by: Alex Bennée <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
6 years agotests/tcg: enable building for PowerPC
Alex Bennée [Thu, 24 May 2018 21:28:45 +0000 (22:28 +0100)]
tests/tcg: enable building for PowerPC

Now we have restored debian-image-powerpc-cross using Debian SID
compilers we can build for 32 bit powerpc. Although PPC32 supports a
range of pages sizes currently only 4k works so the others are
commented out for now.

We can also merge the ppc64 support under the base architecture
directory to avoid too much proliferation of directories.

Signed-off-by: Alex Bennée <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
6 years agodocker: move debian-powerpc-cross to sid based build
Alex Bennée [Thu, 24 May 2018 21:12:15 +0000 (22:12 +0100)]
docker: move debian-powerpc-cross to sid based build

The original Jessie based cross builder hasn't worked for a while. The
state of the libraries is still perilous for cross-building QEMU but
we can use it for building TCG tests.

The debian-apt-fake.sh script can also be dropped as it is no longer
used.

Signed-off-by: Alex Bennée <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
6 years agotests/tcg: enable building for RISCV64
Alex Bennée [Tue, 24 Apr 2018 15:41:18 +0000 (16:41 +0100)]
tests/tcg: enable building for RISCV64

As before, using Debian SID compilers.

Signed-off-by: Alex Bennée <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
6 years agotests/tcg: enable building for mips64
Alex Bennée [Mon, 23 Apr 2018 15:57:48 +0000 (16:57 +0100)]
tests/tcg: enable building for mips64

As before, using Debian SID compilers.

Signed-off-by: Alex Bennée <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
6 years agotests/tcg: enable building for sparc64
Alex Bennée [Mon, 23 Apr 2018 15:49:09 +0000 (16:49 +0100)]
tests/tcg: enable building for sparc64

As before, using Debian SID compilers.

Signed-off-by: Alex Bennée <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
6 years agotests/tcg: enable building for sh4
Alex Bennée [Mon, 23 Apr 2018 15:25:06 +0000 (16:25 +0100)]
tests/tcg: enable building for sh4

As before, using Debian SID compilers. While the compiler can be
coerced into generating big-endian code it seems the linker can't deal
with it so we only enable the building for little endian SH4.

Signed-off-by: Alex Bennée <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
6 years agotests/tcg: enable building for m68k
Alex Bennée [Mon, 23 Apr 2018 15:08:36 +0000 (16:08 +0100)]
tests/tcg: enable building for m68k

As before, using Debian SID compilers.

Signed-off-by: Alex Bennée <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
6 years agotests/tcg: enable building for HPPA
Alex Bennée [Mon, 23 Apr 2018 15:00:13 +0000 (16:00 +0100)]
tests/tcg: enable building for HPPA

Signed-off-by: Alex Bennée <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
6 years agotests/tcg/alpha: add Alpha specific tests
Alex Bennée [Mon, 23 Apr 2018 14:48:06 +0000 (15:48 +0100)]
tests/tcg/alpha: add Alpha specific tests

These tests did use their own crt.o stub however that is a little
stone age so we drop crt.S and just statically link to the cross
compilers libraries.

Signed-off-by: Alex Bennée <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
6 years agotests/tcg: enable building for Alpha
Alex Bennée [Mon, 23 Apr 2018 12:54:09 +0000 (13:54 +0100)]
tests/tcg: enable building for Alpha

We can't use our normal Debian based compilers as Alpha isn't an
officially supported architecture. However it is available as a port
and fortunately cross compilers for all these targets are included in
Debian Sid, the perpetual rolling/unstable/testing version of Debian.

Signed-off-by: Alex Bennée <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
6 years agotests/tcg: enable building for ppc64
Alex Bennée [Tue, 10 Apr 2018 16:45:56 +0000 (17:45 +0100)]
tests/tcg: enable building for ppc64

Currently this just enables building the multiarch tests.

Signed-off-by: Alex Bennée <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
6 years agotests/tcg: enable building for s390x
Alex Bennée [Fri, 6 Apr 2018 20:43:57 +0000 (21:43 +0100)]
tests/tcg: enable building for s390x

This doesn't add any additional tests but enables building the
multiarch tests for s390x.

Signed-off-by: Alex Bennée <[email protected]>
Acked-by: Cornelia Huck <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: David Hildenbrand <[email protected]>
6 years agotests/tcg/mips: include common mips hello-mips
Alex Bennée [Tue, 17 Apr 2018 10:31:02 +0000 (11:31 +0100)]
tests/tcg/mips: include common mips hello-mips

Signed-off-by: Alex Bennée <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
6 years agotests/docker/Makefile.include: fix mipsel-cross dependancy
Alex Bennée [Mon, 11 Jun 2018 10:17:13 +0000 (11:17 +0100)]
tests/docker/Makefile.include: fix mipsel-cross dependancy

This got broken in commit 4319db7 but generally only shows up when you
try and do massive parallel builds on fresh machines.

Signed-off-by: Alex Bennée <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
6 years agotests/tcg: enable building for MIPS
Alex Bennée [Tue, 17 Apr 2018 13:55:17 +0000 (14:55 +0100)]
tests/tcg: enable building for MIPS

This doesn't add any additional tests but enables building the
multiarch tests for MIPS using docker cross compilers. We don't have a
cross compiler for mips64 big endian though.

Signed-off-by: Alex Bennée <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
6 years agotests/tcg: move MIPS specific tests into subdir
Alex Bennée [Thu, 5 Apr 2018 14:50:08 +0000 (15:50 +0100)]
tests/tcg: move MIPS specific tests into subdir

These only need to be built for MIPS guests.

Signed-off-by: Alex Bennée <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
6 years agotests/tcg/arm: add fcvt test cases for AArch32/64
Alex Bennée [Fri, 13 Apr 2018 16:08:26 +0000 (17:08 +0100)]
tests/tcg/arm: add fcvt test cases for AArch32/64

This runs through the usual float to float conversions and crucially
also runs with ARM Alternative Half Precision Format.

Signed-off-by: Alex Bennée <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
6 years agotests/tcg: enable building for AArch64
Alex Bennée [Wed, 9 May 2018 09:31:30 +0000 (10:31 +0100)]
tests/tcg: enable building for AArch64

We only have compilers for the (default) little endian variants.

Signed-off-by: Alex Bennée <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
6 years agotests/tcg/arm: fix up test-arm-iwmmxt test
Alex Bennée [Fri, 13 Apr 2018 13:56:17 +0000 (14:56 +0100)]
tests/tcg/arm: fix up test-arm-iwmmxt test

We need to rename the source file to a .S so we can do a single-line
assemble and link invocation. We also specify the additional CFLAGS
for the compile as it's a non-standard ARM binary.

Signed-off-by: Alex Bennée <[email protected]>
[rth: force fpu configuration]
Signed-off-by: Richard Henderson <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
6 years agotests/tcg: enable building for ARM
Alex Bennée [Mon, 7 May 2018 20:53:43 +0000 (21:53 +0100)]
tests/tcg: enable building for ARM

This allows us to use the docker cross compiler image to build these
tests.

Signed-off-by: Alex Bennée <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
6 years agotests/tcg: move ARM specific tests into subdir
Alex Bennée [Thu, 5 Apr 2018 14:45:32 +0000 (15:45 +0100)]
tests/tcg: move ARM specific tests into subdir

These only need to be built for ARM guests.

Signed-off-by: Alex Bennée <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
6 years agotests/tcg/i386/test-i386: fix printf format
Alex Bennée [Fri, 13 Apr 2018 16:17:37 +0000 (17:17 +0100)]
tests/tcg/i386/test-i386: fix printf format

Signed-off-by: Alex Bennée <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
6 years agotests/tcg/i386/test-i386: use modern vector_size attributes
Alex Bennée [Fri, 13 Apr 2018 16:16:00 +0000 (17:16 +0100)]
tests/tcg/i386/test-i386: use modern vector_size attributes

The compiler complains about the old __mode__ style attributes.

Signed-off-by: Alex Bennée <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
This page took 0.096334 seconds and 4 git commands to generate.