]> git.proxmox.com Git - mirror_qemu.git/log
mirror_qemu.git
4 years agopseries: do not allow memory-less/cpu-less NUMA node
Laurent Vivier [Fri, 30 Aug 2019 16:13:45 +0000 (18:13 +0200)]
pseries: do not allow memory-less/cpu-less NUMA node

When we hotplug a CPU on memory-less/cpu-less node, the linux kernel
crashes.

This happens because linux kernel needs to know the NUMA topology at
start to be able to initialize the distance lookup table.

On pseries, the topology is provided by the firmware via the existing
CPUs and memory information. Thus a node without memory and CPU cannot be
discovered by the kernel.

To avoid the kernel crash, do not allow to start pseries with empty
nodes.

Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Message-Id: <20190830161345.22436-1-lvivier@redhat.com>
[dwg: Rework to cope with movement of numa state from globals to MachineState]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
4 years agoMerge remote-tracking branch 'remotes/amarkovic/tags/mips-queue-oct-01-2019' into...
Peter Maydell [Tue, 1 Oct 2019 15:21:42 +0000 (16:21 +0100)]
Merge remote-tracking branch 'remotes/amarkovic/tags/mips-queue-oct-01-2019' into staging

MIPS queue for October 1st, 2019

# gpg: Signature made Tue 01 Oct 2019 16:10:43 BST
# gpg:                using RSA key D4972A8967F75A65
# gpg: Good signature from "Aleksandar Markovic <amarkovic@wavecomp.com>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 8526 FBF1 5DA3 811F 4A01  DD75 D497 2A89 67F7 5A65

* remotes/amarkovic/tags/mips-queue-oct-01-2019:
  target/mips: msa: Move helpers for <AND|NOR|OR|XOR>.V
  target/mips: msa: Simplify and move helper for MOVE.V
  target/mips: msa: Split helpers for MOD_<S|U>.<B|H|W|D>
  target/mips: msa: Split helpers for DIV_<S|U>.<B|H|W|D>
  target/mips: msa: Split helpers for CLT_<S|U>.<B|H|W|D>
  target/mips: msa: Split helpers for CLE_<S|U>.<B|H|W|D>
  target/mips: msa: Split helpers for CEQ.<B|H|W|D>
  target/mips: msa: Split helpers for AVER_<S|U>.<B|H|W|D>
  target/mips: msa: Split helpers for AVE_<S|U>.<B|H|W|D>
  target/mips: msa: Split helpers for B<CLR|NEG|SEL>.<B|H|W|D>
  target/mips: msa: Unroll loops and demacro <BMNZ|BMZ|BSEL>.V
  target/mips: msa: Split helpers for BINS<L|R>.<B|H|W|D>
  target/mips: msa: Split helpers for PCNT.<B|H|W|D>
  target/mips: msa: Split helpers for <NLOC|NLZC>.<B|H|W|D>
  target/mips: Clean up translate.c
  target/mips: Clean up mips-defs.h
  target/mips: Clean up kvm_mips.h
  target/mips: Clean up internal.h

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/mips: msa: Move helpers for <AND|NOR|OR|XOR>.V
Aleksandar Markovic [Wed, 25 Sep 2019 12:46:12 +0000 (14:46 +0200)]
target/mips: msa: Move helpers for <AND|NOR|OR|XOR>.V

Cosmetic reorganization.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Message-Id: <1569415572-19635-21-git-send-email-aleksandar.markovic@rt-rk.com>

4 years agotarget/mips: msa: Simplify and move helper for MOVE.V
Aleksandar Markovic [Wed, 25 Sep 2019 12:46:11 +0000 (14:46 +0200)]
target/mips: msa: Simplify and move helper for MOVE.V

Achieves clearer code and slightly better performance.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Message-Id: <1569415572-19635-20-git-send-email-aleksandar.markovic@rt-rk.com>

4 years agotarget/mips: msa: Split helpers for MOD_<S|U>.<B|H|W|D>
Aleksandar Markovic [Wed, 25 Sep 2019 12:46:10 +0000 (14:46 +0200)]
target/mips: msa: Split helpers for MOD_<S|U>.<B|H|W|D>

Achieves clearer code and slightly better performance.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Message-Id: <1569415572-19635-19-git-send-email-aleksandar.markovic@rt-rk.com>

4 years agotarget/mips: msa: Split helpers for DIV_<S|U>.<B|H|W|D>
Aleksandar Markovic [Wed, 25 Sep 2019 12:46:09 +0000 (14:46 +0200)]
target/mips: msa: Split helpers for DIV_<S|U>.<B|H|W|D>

Achieves clearer code and slightly better performance.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Message-Id: <1569415572-19635-18-git-send-email-aleksandar.markovic@rt-rk.com>

4 years agotarget/mips: msa: Split helpers for CLT_<S|U>.<B|H|W|D>
Aleksandar Markovic [Wed, 25 Sep 2019 12:46:08 +0000 (14:46 +0200)]
target/mips: msa: Split helpers for CLT_<S|U>.<B|H|W|D>

Achieves clearer code and slightly better performance.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Message-Id: <1569415572-19635-17-git-send-email-aleksandar.markovic@rt-rk.com>

4 years agotarget/mips: msa: Split helpers for CLE_<S|U>.<B|H|W|D>
Aleksandar Markovic [Wed, 25 Sep 2019 12:46:07 +0000 (14:46 +0200)]
target/mips: msa: Split helpers for CLE_<S|U>.<B|H|W|D>

Achieves clearer code and slightly better performance.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Message-Id: <1569415572-19635-16-git-send-email-aleksandar.markovic@rt-rk.com>

4 years agotarget/mips: msa: Split helpers for CEQ.<B|H|W|D>
Aleksandar Markovic [Wed, 25 Sep 2019 12:46:06 +0000 (14:46 +0200)]
target/mips: msa: Split helpers for CEQ.<B|H|W|D>

Achieves clearer code and slightly better performance.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Message-Id: <1569415572-19635-15-git-send-email-aleksandar.markovic@rt-rk.com>

4 years agotarget/mips: msa: Split helpers for AVER_<S|U>.<B|H|W|D>
Aleksandar Markovic [Wed, 25 Sep 2019 12:46:05 +0000 (14:46 +0200)]
target/mips: msa: Split helpers for AVER_<S|U>.<B|H|W|D>

Achieves clearer code and slightly better performance.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Message-Id: <1569415572-19635-14-git-send-email-aleksandar.markovic@rt-rk.com>

4 years agotarget/mips: msa: Split helpers for AVE_<S|U>.<B|H|W|D>
Aleksandar Markovic [Wed, 25 Sep 2019 12:46:04 +0000 (14:46 +0200)]
target/mips: msa: Split helpers for AVE_<S|U>.<B|H|W|D>

Achieves clearer code and slightly better performance.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Message-Id: <1569415572-19635-13-git-send-email-aleksandar.markovic@rt-rk.com>

4 years agotarget/mips: msa: Split helpers for B<CLR|NEG|SEL>.<B|H|W|D>
Aleksandar Markovic [Wed, 25 Sep 2019 12:46:03 +0000 (14:46 +0200)]
target/mips: msa: Split helpers for B<CLR|NEG|SEL>.<B|H|W|D>

Achieves clearer code and slightly better performance.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Message-Id: <1569415572-19635-12-git-send-email-aleksandar.markovic@rt-rk.com>

4 years agotarget/mips: msa: Unroll loops and demacro <BMNZ|BMZ|BSEL>.V
Aleksandar Markovic [Wed, 25 Sep 2019 12:46:02 +0000 (14:46 +0200)]
target/mips: msa: Unroll loops and demacro <BMNZ|BMZ|BSEL>.V

Achieves clearer code and slightly better performance.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Message-Id: <1569415572-19635-11-git-send-email-aleksandar.markovic@rt-rk.com>

4 years agotarget/mips: msa: Split helpers for BINS<L|R>.<B|H|W|D>
Aleksandar Markovic [Wed, 25 Sep 2019 12:46:01 +0000 (14:46 +0200)]
target/mips: msa: Split helpers for BINS<L|R>.<B|H|W|D>

Achieves clearer code and slightly better performance.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Message-Id: <1569415572-19635-10-git-send-email-aleksandar.markovic@rt-rk.com>

4 years agotarget/mips: msa: Split helpers for PCNT.<B|H|W|D>
Aleksandar Markovic [Wed, 25 Sep 2019 12:46:00 +0000 (14:46 +0200)]
target/mips: msa: Split helpers for PCNT.<B|H|W|D>

Achieves clearer code and slightly better performance.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Message-Id: <1569415572-19635-9-git-send-email-aleksandar.markovic@rt-rk.com>

4 years agotarget/mips: msa: Split helpers for <NLOC|NLZC>.<B|H|W|D>
Aleksandar Markovic [Wed, 25 Sep 2019 12:45:59 +0000 (14:45 +0200)]
target/mips: msa: Split helpers for <NLOC|NLZC>.<B|H|W|D>

Achieves clearer code and slightly better performance.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Message-Id: <1569415572-19635-8-git-send-email-aleksandar.markovic@rt-rk.com>

4 years agotarget/mips: Clean up translate.c
Aleksandar Markovic [Tue, 24 Sep 2019 13:26:37 +0000 (15:26 +0200)]
target/mips: Clean up translate.c

Mostly fix errors and warnings reported by 'checkpatch.pl -f'.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <1569331602-2586-7-git-send-email-aleksandar.markovic@rt-rk.com>

4 years agotarget/mips: Clean up mips-defs.h
Aleksandar Markovic [Tue, 24 Sep 2019 13:26:35 +0000 (15:26 +0200)]
target/mips: Clean up mips-defs.h

Mostly fix errors and warnings reported by 'checkpatch.pl -f'.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <1569331602-2586-5-git-send-email-aleksandar.markovic@rt-rk.com>

4 years agotarget/mips: Clean up kvm_mips.h
Aleksandar Markovic [Tue, 24 Sep 2019 13:26:34 +0000 (15:26 +0200)]
target/mips: Clean up kvm_mips.h

Mostly fix errors and warnings reported by 'checkpatch.pl -f'.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <1569331602-2586-4-git-send-email-aleksandar.markovic@rt-rk.com>

4 years agotarget/mips: Clean up internal.h
Aleksandar Markovic [Tue, 24 Sep 2019 13:26:33 +0000 (15:26 +0200)]
target/mips: Clean up internal.h

Mostly fix errors and warnings reported by 'checkpatch.pl -f'.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Aleksandar Rikalo <arikalo@wavecomp.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <1569331602-2586-3-git-send-email-aleksandar.markovic@rt-rk.com>

4 years agoMerge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2019-10-01' into...
Peter Maydell [Tue, 1 Oct 2019 12:13:38 +0000 (13:13 +0100)]
Merge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2019-10-01' into staging

- Fix and re-enable the usb-hcd-ehci-test
- Silence a Coverity warning in hw/m68k/next-cube.c
- Fix crash that can occur when using bad binaries with "-kernel"
- Disallow colons in the "-accel" parameter

# gpg: Signature made Tue 01 Oct 2019 11:03:13 BST
# gpg:                using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5
# gpg:                issuer "thuth@redhat.com"
# gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full]
# gpg:                 aka "Thomas Huth <thuth@redhat.com>" [full]
# gpg:                 aka "Thomas Huth <huth@tuxfamily.org>" [full]
# gpg:                 aka "Thomas Huth <th.huth@posteo.de>" [unknown]
# Primary key fingerprint: 27B8 8847 EEE0 2501 18F3  EAB9 2ED9 D774 FE70 2DB5

* remotes/huth-gitlab/tags/pull-request-2019-10-01:
  Disallow colons in the parameter of "-accel"
  hw/core/loader: Fix possible crash in rom_copy()
  hw/m68k/next-cube: Avoid static RTC variables and introduce control register
  tests: fix echi/ehci typo
  tests: fix usb-hcd-ehci-test compilation

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agoMerge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2019-09-28' into staging
Peter Maydell [Tue, 1 Oct 2019 10:40:15 +0000 (11:40 +0100)]
Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2019-09-28' into staging

QAPI patches for 2019-09-28

# gpg: Signature made Sat 28 Sep 2019 16:18:13 BST
# gpg:                using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
# gpg:                issuer "armbru@redhat.com"
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>" [full]
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* remotes/armbru/tags/pull-qapi-2019-09-28: (27 commits)
  qapi: Improve source file read error handling
  qapi: Improve reporting of redefinition
  qapi: Improve reporting of missing documentation comment
  qapi: Eliminate check_keys(), rename check_known_keys()
  qapi: Improve reporting of invalid 'if' further
  qapi: Avoid redundant definition references in error messages
  qapi: Improve reporting of missing / unknown definition keys
  qapi: Improve reporting of invalid flags
  qapi: Improve reporting of invalid 'if' errors
  qapi: Move context-free checking to the proper place
  qapi: Move context-sensitive checking to the proper place
  qapi: Inline check_name() into check_union()
  qapi: Plumb info to the QAPISchemaMember
  qapi: Make check_type()'s array case a bit more obvious
  qapi: Move check for reserved names out of add_name()
  qapi: Report invalid '*' prefix like any other invalid name
  qapi: Use check_name_str() where it suffices
  qapi: Improve reporting of invalid name errors
  qapi: Reorder check_FOO() parameters for consistency
  qapi: Improve reporting of member name clashes
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agoDisallow colons in the parameter of "-accel"
Thomas Huth [Mon, 23 Sep 2019 12:00:29 +0000 (14:00 +0200)]
Disallow colons in the parameter of "-accel"

Everybody who used something like "-machine accel=kvm:tcg" in the past
might be tempted to specify a similar list with the -accel parameter,
too, for example "-accel kvm:tcg". However, this is not how this
options is thought to be used, since each "-accel" should only take care
of one specific accelerator.

In the long run, we really should rework the "-accel" code completely,
so that it does not set "-machine accel=..." anymore internally, but
is completely independent from "-machine". For the short run, let's
make sure that users cannot use "-accel xyz:tcg", so that we avoid
that we have to deal with such cases in the wild later.

Message-Id: <20190930123505.11607-1-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
4 years agohw/core/loader: Fix possible crash in rom_copy()
Thomas Huth [Wed, 25 Sep 2019 12:16:43 +0000 (14:16 +0200)]
hw/core/loader: Fix possible crash in rom_copy()

Both, "rom->addr" and "addr" are derived from the binary image
that can be loaded with the "-kernel" paramer. The code in
rom_copy() then calculates:

    d = dest + (rom->addr - addr);

and uses "d" as destination in a memcpy() some lines later. Now with
bad kernel images, it is possible that rom->addr is smaller than addr,
thus "rom->addr - addr" gets negative and the memcpy() then tries to
copy contents from the image to a bad memory location. This could
maybe be used to inject code from a kernel image into the QEMU binary,
so we better fix it with an additional sanity check here.

Cc: qemu-stable@nongnu.org
Reported-by: Guangming Liu
Buglink: https://bugs.launchpad.net/qemu/+bug/1844635
Message-Id: <20190925130331.27825-1-thuth@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
4 years agohw/m68k/next-cube: Avoid static RTC variables and introduce control register
Thomas Huth [Sat, 21 Sep 2019 09:17:38 +0000 (11:17 +0200)]
hw/m68k/next-cube: Avoid static RTC variables and introduce control register

Coverity currently complains that the "if (0x00 & (0x80 >> (phase - 8))"
in next-cube.c can never be true. Right it is. The "0x00" is meant as value
of the control register of the RTC, which is currently not implemented yet.
Thus, let's add a register variable for this now. However, the RTC
registers are currently defined as static variables in nextscr2_write(),
which is quite ugly. Thus let's also move the RTC variables to the main
machine state instead. In the long run, we should likely even refactor
the whole RTC code into a separate device in a separate file, but that's
something for calm winter nights later... as a first step, cleaning up
the static variables and shutting up the warning from Coverity should
be sufficient.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20190921091738.26953-1-huth@tuxfamily.org>
Signed-off-by: Thomas Huth <huth@tuxfamily.org>
4 years agotests: fix echi/ehci typo
Marc-André Lureau [Thu, 26 Sep 2019 11:19:55 +0000 (15:19 +0400)]
tests: fix echi/ehci typo

While at it, simplify using $(land).

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20190926111955.17276-3-marcandre.lureau@redhat.com>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Fixes: dad5ddcea3b661 ("check: Only test usb-ehci when it is compiled in")
Signed-off-by: Thomas Huth <thuth@redhat.com>
4 years agotests: fix usb-hcd-ehci-test compilation
Marc-André Lureau [Thu, 26 Sep 2019 11:19:54 +0000 (15:19 +0400)]
tests: fix usb-hcd-ehci-test compilation

Fixes commit
e5758de4e836c3b2edc2befd904651fc6967d74f ("tests/libqtest: Make
qtest_qmp_device_add/del independent from global_qtest")

and commit
dd210749727530cdef7c335040edbf81c3c5d041 ("tests/libqtest: Use
libqtest-single.h in tests that require global_qtest").

Cc: Thomas Huth <thuth@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20190926111955.17276-2-marcandre.lureau@redhat.com>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
4 years agoMerge remote-tracking branch 'remotes/borntraeger/tags/s390x-20190930' into staging
Peter Maydell [Mon, 30 Sep 2019 13:21:56 +0000 (14:21 +0100)]
Merge remote-tracking branch 'remotes/borntraeger/tags/s390x-20190930' into staging

- do not abuse memory_region_allocate_system_memory and split the memory
  according to KVM memslots in KVM code instead (Paolo, Igor)
- change splitting to split at 4TB (Christian)
- do not claim s390 (31bit) support in configure (Thomas)
- sclp error checking (Janosch, Claudio)
- new s390 pci maintainer (Matt, Collin)
- fix s390 pci (again) (Matt)

# gpg: Signature made Mon 30 Sep 2019 12:52:51 BST
# gpg:                using RSA key 117BBC80B5A61C7C
# gpg: Good signature from "Christian Borntraeger (IBM) <borntraeger@de.ibm.com>" [full]
# Primary key fingerprint: F922 9381 A334 08F9 DBAB  FBCA 117B BC80 B5A6 1C7C

* remotes/borntraeger/tags/s390x-20190930:
  s390/kvm: split kvm mem slots at 4TB
  s390: do not call memory_region_allocate_system_memory() multiple times
  kvm: split too big memory section on several memslots
  kvm: clear dirty bitmaps from all overlapping memslots
  kvm: extract kvm_log_clear_one_slot
  configure: Remove s390 (31-bit mode) from the list of supported CPUs
  s390x: sclp: Report insufficient SCCB length
  s390x: sclp: fix error handling for oversize control blocks
  s390x: sclp: boundary check
  s390x: sclp: refactor invalid command check
  s390: PCI: fix IOMMU region init
  MAINTAINERS: Update S390 PCI Maintainer

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agos390/kvm: split kvm mem slots at 4TB
Christian Borntraeger [Wed, 25 Sep 2019 07:45:50 +0000 (09:45 +0200)]
s390/kvm: split kvm mem slots at 4TB

Instead of splitting at an unaligned address, we can simply split at
4TB.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Acked-by: Igor Mammedov <imammedo@redhat.com>
4 years agos390: do not call memory_region_allocate_system_memory() multiple times
Igor Mammedov [Tue, 24 Sep 2019 14:47:51 +0000 (10:47 -0400)]
s390: do not call memory_region_allocate_system_memory() multiple times

s390 was trying to solve limited KVM memslot size issue by abusing
memory_region_allocate_system_memory(), which breaks API contract
where the function might be called only once.

Beside an invalid use of API, the approach also introduced migration
issue, since RAM chunks for each KVM_SLOT_MAX_BYTES are transferred in
migration stream as separate RAMBlocks.

After discussion [1], it was agreed to break migration from older
QEMU for guest with RAM >8Tb (as it was relatively new (since 2.12)
and considered to be not actually used downstream).
Migration should keep working for guests with less than 8TB and for
more than 8TB with QEMU 4.2 and newer binary.
In case user tries to migrate more than 8TB guest, between incompatible
QEMU versions, migration should fail gracefully due to non-exiting
RAMBlock ID or RAMBlock size mismatch.

Taking in account above and that now KVM code is able to split too
big MemorySection into several memslots, partially revert commit
 (bb223055b s390-ccw-virtio: allow for systems larger that 7.999TB)
and use kvm_set_max_memslot_size() to set KVMSlot size to
KVM_SLOT_MAX_BYTES.

1) [PATCH RFC v2 4/4] s390: do not call  memory_region_allocate_system_memory() multiple times

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20190924144751.24149-5-imammedo@redhat.com>
Acked-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
4 years agokvm: split too big memory section on several memslots
Igor Mammedov [Tue, 24 Sep 2019 14:47:50 +0000 (10:47 -0400)]
kvm: split too big memory section on several memslots

Max memslot size supported by kvm on s390 is 8Tb,
move logic of splitting RAM in chunks upto 8T to KVM code.

This way it will hide KVM specific restrictions in KVM code
and won't affect board level design decisions. Which would allow
us to avoid misusing memory_region_allocate_system_memory() API
and eventually use a single hostmem backend for guest RAM.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20190924144751.24149-4-imammedo@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
4 years agokvm: clear dirty bitmaps from all overlapping memslots
Paolo Bonzini [Tue, 24 Sep 2019 14:47:49 +0000 (10:47 -0400)]
kvm: clear dirty bitmaps from all overlapping memslots

Currently MemoryRegionSection has 1:1 mapping to KVMSlot.
However next patch will allow splitting MemoryRegionSection into
several KVMSlot-s, make sure that kvm_physical_log_slot_clear()
is able to handle such 1:N mapping.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Message-Id: <20190924144751.24149-3-imammedo@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
4 years agokvm: extract kvm_log_clear_one_slot
Paolo Bonzini [Tue, 24 Sep 2019 14:47:48 +0000 (10:47 -0400)]
kvm: extract kvm_log_clear_one_slot

We may need to clear the dirty bitmap for more than one KVM memslot.
First do some code movement with no semantic change.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Message-Id: <20190924144751.24149-2-imammedo@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
[fixup line break]

4 years agoconfigure: Remove s390 (31-bit mode) from the list of supported CPUs
Thomas Huth [Sat, 28 Sep 2019 19:03:34 +0000 (21:03 +0200)]
configure: Remove s390 (31-bit mode) from the list of supported CPUs

On IBM Z, KVM in the kernel is only implemented for 64-bit mode, and
with regards to TCG, we also only support 64-bit host CPUs (see the
check at the beginning of tcg/s390/tcg-target.inc.c), so we should
remove s390 (without "x", i.e. the old 31-bit mode CPUs) from the
list of supported CPUs.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20190928190334.6897-1-thuth@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
4 years agos390x: sclp: Report insufficient SCCB length
Claudio Imbrenda [Fri, 27 Sep 2019 13:33:23 +0000 (15:33 +0200)]
s390x: sclp: Report insufficient SCCB length

Return the correct error code when the SCCB buffer is too small to
contain all of the output, for the Read SCP Information and
Read CPU Information commands.

Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Reviewed-by: Jason J. Herne <jjherne@linux.ibm.com>
Message-Id: <1569591203-15258-5-git-send-email-imbrenda@linux.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
4 years agos390x: sclp: fix error handling for oversize control blocks
Janosch Frank [Fri, 27 Sep 2019 13:33:22 +0000 (15:33 +0200)]
s390x: sclp: fix error handling for oversize control blocks

Requests over 4k are not a spec exception.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Jason J. Herne <jjherne@linux.ibm.com>
Message-Id: <1569591203-15258-4-git-send-email-imbrenda@linux.ibm.com>
Acked-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
4 years agos390x: sclp: boundary check
Janosch Frank [Fri, 27 Sep 2019 13:33:21 +0000 (15:33 +0200)]
s390x: sclp: boundary check

All sclp codes need to be checked for page boundary violations.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Jason J. Herne <jjherne@linux.ibm.com>
Message-Id: <1569591203-15258-3-git-send-email-imbrenda@linux.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
4 years agos390x: sclp: refactor invalid command check
Janosch Frank [Fri, 27 Sep 2019 13:33:20 +0000 (15:33 +0200)]
s390x: sclp: refactor invalid command check

Invalid command checking has to be done before the boundary check,
refactoring it now allows to insert the boundary check at the correct
place later.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Jason J. Herne <jjherne@linux.ibm.com>
Message-Id: <1569591203-15258-2-git-send-email-imbrenda@linux.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
4 years agos390: PCI: fix IOMMU region init
Matthew Rosato [Thu, 26 Sep 2019 14:10:36 +0000 (10:10 -0400)]
s390: PCI: fix IOMMU region init

The fix in dbe9cf606c shrinks the IOMMU memory region to a size
that seems reasonable on the surface, however is actually too
small as it is based against a 0-mapped address space.  This
causes breakage with small guests as they can overrun the IOMMU window.

Let's go back to the prior method of initializing iommu for now.

Fixes: dbe9cf606c ("s390x/pci: Set the iommu region size mpcifc request")
Cc: qemu-stable@nongnu.org
Reviewed-by: Pierre Morel <pmorel@linux.ibm.com>
Reported-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Tested-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reported-by: Stefan Zimmerman <stzi@linux.ibm.com>
Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
Message-Id: <1569507036-15314-1-git-send-email-mjrosato@linux.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
4 years agoMAINTAINERS: Update S390 PCI Maintainer
Matthew Rosato [Fri, 27 Sep 2019 13:21:01 +0000 (09:21 -0400)]
MAINTAINERS: Update S390 PCI Maintainer

As discussed previously with Collin, I will take over maintaining
s390 pci.

Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
Message-Id: <1569590461-12562-1-git-send-email-mjrosato@linux.ibm.com>
Acked-by: Collin Walling <walling@linux.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
4 years agoMerge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20190927' into...
Peter Maydell [Mon, 30 Sep 2019 10:02:22 +0000 (11:02 +0100)]
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20190927' into staging

target-arm queue:
 * Fix the CBAR register implementation for Cortex-A53,
   Cortex-A57, Cortex-A72
 * Fix direct booting of Linux kernels on emulated CPUs
   which have an AArch32 EL3 (incorrect NSACR settings
   meant they could not access the FPU)
 * semihosting cleanup: do more work at translate time
   and less work at runtime

# gpg: Signature made Fri 27 Sep 2019 15:32:43 BST
# gpg:                using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE
# gpg:                issuer "peter.maydell@linaro.org"
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>" [ultimate]
# gpg:                 aka "Peter Maydell <pmaydell@gmail.com>" [ultimate]
# gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>" [ultimate]
# Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83  15CF 3C25 25ED 1436 0CDE

* remotes/pmaydell/tags/pull-target-arm-20190927:
  hw/arm/boot: Use the IEC binary prefix definitions
  hw/arm/boot.c: Set NSACR.{CP11,CP10} for NS kernel boots
  tests/tcg: add linux-user semihosting smoke test for ARM
  target/arm: remove run-time semihosting checks for linux-user
  target/arm: remove run time semihosting checks
  target/arm: handle A-profile semihosting at translate time
  target/arm: handle M-profile semihosting at translate time
  tests/tcg: clean-up some comments after the de-tangling
  target/arm: fix CBAR register for AArch64 CPUs

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
# Conflicts:
# tests/tcg/arm/Makefile.target

4 years agoqapi: Improve source file read error handling
Markus Armbruster [Fri, 27 Sep 2019 13:46:39 +0000 (15:46 +0200)]
qapi: Improve source file read error handling

qapi-gen.py crashes when it can't open the main schema file, and when
it can't read from any schema file.  Lazy.

Change QAPISchema.__init__() to take a file name instead of a file
object.  Move the open code from _include() to __init__(), so it's
used for the main schema file, too.

Move the read into the try for good measure, and rephrase the error
message.

Reporting open or read failure for the main schema file needs a
QAPISourceInfo representing "no source".  Make QAPISourceInfo cope
with fname=None.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190927134639.4284-27-armbru@redhat.com>

4 years agoqapi: Improve reporting of redefinition
Markus Armbruster [Fri, 27 Sep 2019 13:46:38 +0000 (15:46 +0200)]
qapi: Improve reporting of redefinition

Point to the previous definition, unless it's a built-in.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190927134639.4284-26-armbru@redhat.com>

4 years agoqapi: Improve reporting of missing documentation comment
Markus Armbruster [Fri, 27 Sep 2019 13:46:37 +0000 (15:46 +0200)]
qapi: Improve reporting of missing documentation comment

Have check_exprs() check this later, so the error message gains an "in
definition line".  Tweak the error message.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190927134639.4284-25-armbru@redhat.com>

4 years agoqapi: Eliminate check_keys(), rename check_known_keys()
Markus Armbruster [Fri, 27 Sep 2019 13:46:36 +0000 (15:46 +0200)]
qapi: Eliminate check_keys(), rename check_known_keys()

check_keys() has become a trivial wrapper for check_known_keys().
Eliminate it.

This makes its name available.  Rename check_known_keys().

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190927134639.4284-24-armbru@redhat.com>

4 years agoqapi: Improve reporting of invalid 'if' further
Markus Armbruster [Fri, 27 Sep 2019 13:46:35 +0000 (15:46 +0200)]
qapi: Improve reporting of invalid 'if' further

check_if()'s errors don't point to the offending part of the
expression.  For instance:

    tests/qapi-schema/alternate-branch-if-invalid.json:2: 'if' condition ' ' makes no sense

Other check_FOO() do, with the help of a @source argument.  Make
check_if() do that, too.  The example above improves to:

    tests/qapi-schema/alternate-branch-if-invalid.json:2: 'if' condition ' ' of 'data' member 'branch' makes no sense

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190927134639.4284-23-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agoqapi: Avoid redundant definition references in error messages
Markus Armbruster [Fri, 27 Sep 2019 13:46:34 +0000 (15:46 +0200)]
qapi: Avoid redundant definition references in error messages

Many error messages refer to the offending definition even though
they're preceded by an "in definition" line.  Rephrase them.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190927134639.4284-22-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
4 years agoqapi: Improve reporting of missing / unknown definition keys
Markus Armbruster [Fri, 27 Sep 2019 13:46:33 +0000 (15:46 +0200)]
qapi: Improve reporting of missing / unknown definition keys

Have check_exprs() call check_keys() later, so its error messages gain
an "in definition" line.

Both check_keys() and check_name_is_str() check the definition's name
is a string.  Since check_keys() now runs after check_name_is_str()
rather than before, its check is dead.  Bury it.  Checking values in
check_keys() is unclean anyway.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190927134639.4284-21-armbru@redhat.com>

4 years agoqapi: Improve reporting of invalid flags
Markus Armbruster [Fri, 27 Sep 2019 13:46:32 +0000 (15:46 +0200)]
qapi: Improve reporting of invalid flags

Split check_flags() off check_keys() and have check_exprs() call it
later, so its error messages gain an "in definition" line.  Tweak the
error messages.

Checking values in a function named check_keys() is unclean anyway.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190927134639.4284-20-armbru@redhat.com>

4 years agoqapi: Improve reporting of invalid 'if' errors
Markus Armbruster [Fri, 27 Sep 2019 13:46:31 +0000 (15:46 +0200)]
qapi: Improve reporting of invalid 'if' errors

Move check_if() from check_keys() to check_exprs() and call it later,
so its error messages gain an "in definition" line.

Checking values in a function named check_keys() is unclean anyway.
The original sin was commit 0545f6b887 "qapi: Better error messages
for bad expressions", which checks the value of key 'name'.  More
sinning in commit 2cbf09925a "qapi: More rigorous checking for type
safety bypass", commit c818408e44 "qapi: Implement boxed types for
commands/events", and commit 967c885108 "qapi: add 'if' to top-level
expressions".  This commit does penance for the latter.  The next
commits will do penance for the others.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190927134639.4284-19-armbru@redhat.com>

4 years agoqapi: Move context-free checking to the proper place
Markus Armbruster [Fri, 27 Sep 2019 13:46:30 +0000 (15:46 +0200)]
qapi: Move context-free checking to the proper place

QAPISchemaCommand.check() and QAPISchemaEvent().check() check 'data'
is present when 'boxed': true.  That's context-free.  Move to
check_command() and check_event().

Tweak the error message while there.

check_exprs() & friends now check exactly what qapi-code-gen.txt calls
the second layer of syntax.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190927134639.4284-18-armbru@redhat.com>

4 years agoqapi: Move context-sensitive checking to the proper place
Markus Armbruster [Fri, 27 Sep 2019 13:46:29 +0000 (15:46 +0200)]
qapi: Move context-sensitive checking to the proper place

When we introduced the QAPISchema intermediate representation (commit
ac88219a6c7), we took a shortcut: we left check_exprs() & friends
alone instead of moving semantic checks into the
QAPISchemaFOO.check().  The .check() assert check_exprs() did its job.

Time to finish the conversion job.  Move exactly the context-sensitive
checks to the .check().  They replace assertions there.  Context-free
checks stay put.

Fixes the misleading optional tag error demonstrated by test
flat-union-optional-discriminator.

A few other error message improve.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190927134639.4284-17-armbru@redhat.com>

4 years agoqapi: Inline check_name() into check_union()
Markus Armbruster [Fri, 27 Sep 2019 13:46:28 +0000 (15:46 +0200)]
qapi: Inline check_name() into check_union()

check_name() consists of check_name_is_str() and check_name_str().
check_union() relies on the latter to catch optional discriminators.
The next commit will replace that by a more straightforward check.
Inlining check_name() into check_union() now should make that easier
to review.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190927134639.4284-16-armbru@redhat.com>

4 years agoqapi: Plumb info to the QAPISchemaMember
Markus Armbruster [Fri, 27 Sep 2019 13:46:27 +0000 (15:46 +0200)]
qapi: Plumb info to the QAPISchemaMember

Future commits will need info in the .check() methods of
QAPISchemaMember and its descendants.  Get it there.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190927134639.4284-15-armbru@redhat.com>

4 years agoqapi: Make check_type()'s array case a bit more obvious
Markus Armbruster [Fri, 27 Sep 2019 13:46:26 +0000 (15:46 +0200)]
qapi: Make check_type()'s array case a bit more obvious

check_type() checks the array's contents, then peels off the array and
falls through to the "not array" code without resetting allow_array
and allow_dict to False.  Works because the peeled value is a string,
and allow_array and allow_dict aren't used then.  Tidy up anyway:
recurse instead, defaulting allow_array and allow_dict to False.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190927134639.4284-14-armbru@redhat.com>

4 years agoqapi: Move check for reserved names out of add_name()
Markus Armbruster [Fri, 27 Sep 2019 13:46:25 +0000 (15:46 +0200)]
qapi: Move check for reserved names out of add_name()

The checks for reserved names are spread far and wide.  Move one from
add_name() to new check_defn_name_str().  This is a first step towards
collecting them all in dedicated name checking functions next to
check_name().

While there, drop the quotes around the meta-type in
check_name_str()'s error messages: "'command' uses ... name 'NAME'"
becomes "command uses ... name 'NAME'".

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190927134639.4284-13-armbru@redhat.com>

4 years agoqapi: Report invalid '*' prefix like any other invalid name
Markus Armbruster [Fri, 27 Sep 2019 13:46:24 +0000 (15:46 +0200)]
qapi: Report invalid '*' prefix like any other invalid name

The special "does not allow optional name" error is well meant, but
confusing in practice.  Drop it.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190927134639.4284-12-armbru@redhat.com>

4 years agoqapi: Use check_name_str() where it suffices
Markus Armbruster [Fri, 27 Sep 2019 13:46:23 +0000 (15:46 +0200)]
qapi: Use check_name_str() where it suffices

Replace check_name() by check_name_str() where the name is known to be
a string.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190927134639.4284-11-armbru@redhat.com>

4 years agoqapi: Improve reporting of invalid name errors
Markus Armbruster [Fri, 27 Sep 2019 13:46:22 +0000 (15:46 +0200)]
qapi: Improve reporting of invalid name errors

Split check_name() into check_name_is_str() and check_name_str(), keep
check_name() as a wrapper.

Move add_name()'s call into its caller check_exprs(), and inline.

This permits delaying check_name_str() there, so its error message
gains an "in definition" line.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190927134639.4284-10-armbru@redhat.com>

4 years agoqapi: Reorder check_FOO() parameters for consistency
Markus Armbruster [Fri, 27 Sep 2019 13:46:21 +0000 (15:46 +0200)]
qapi: Reorder check_FOO() parameters for consistency

Most check_FOO() take the thing being checked as first argument.
check_name(), check_type(), check_known_keys() don't.  Clean that up.

While there, drop a "Todo" comment that should have been dropped in
commit 87adbbffd4 "qapi: add a dictionary form for TYPE".

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190927134639.4284-9-armbru@redhat.com>

4 years agoqapi: Improve reporting of member name clashes
Markus Armbruster [Fri, 27 Sep 2019 13:46:20 +0000 (15:46 +0200)]
qapi: Improve reporting of member name clashes

We report name clashes like this:

    struct-base-clash.json: In struct 'Sub':
    struct-base-clash.json:5: 'name' (member of Sub) collides with 'name' (member of Base)

The "(member of Sub)" is redundant with "In struct 'Sub'".  Comes from
QAPISchemaMember.describe().  Pass info to it, so it can detect the
redundancy and avoid it.  Result:

    struct-base-clash.json: In struct 'Sub':
    struct-base-clash.json:5: member 'name' collides with member 'name' of type 'Base'

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190927134639.4284-8-armbru@redhat.com>

4 years agoqapi: Change frontend error messages to start with lower case
Markus Armbruster [Fri, 27 Sep 2019 13:46:19 +0000 (15:46 +0200)]
qapi: Change frontend error messages to start with lower case

Starting error messages with a capital letter complicates things when
text can get interpolated both at the beginning and in the middle of
an error message.  The next patch will do that.  Switch to lower case
to keep it simpler.

For what it's worth, the GNU Coding Standards advise the message
"should not begin with a capital letter when it follows a program name
and/or file name, because that isn’t the beginning of a sentence. (The
sentence conceptually starts at the beginning of the line.)"

While there, avoid breaking lines containing multiple arguments in the
middle of an argument.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190927134639.4284-7-armbru@redhat.com>

4 years agoqapi: Clean up member name case checking
Markus Armbruster [Fri, 27 Sep 2019 13:46:18 +0000 (15:46 +0200)]
qapi: Clean up member name case checking

QAPISchemaMember.check_clash() checks for member names that map to the
same c_name().  Takes care of rejecting duplicate names.

It also checks a naming rule: no uppercase in member names.  That's a
rather odd place to do it.  Enforcing naming rules is
check_name_str()'s job.

qapi-code-gen.txt specifies the name case rule applies to the name as
it appears in the schema.  check_clash() checks c_name(name) instead.
No difference, as c_name() leaves alone case, but unclean.

Move the name case check into check_name_str(), less the c_name().
New argument @permit_upper suppresses it.  Pass permit_upper=True for
definitions (which are not members), and when the member's owner is
whitelisted with pragma name-case-whitelist.

Bonus: name-case-whitelist now applies to a union's inline base, too.
Update qapi/qapi-schema.json pragma to whitelist union CpuInfo instead
of CpuInfo's implicit base type's name q_obj_CpuInfo-base.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190927134639.4284-6-armbru@redhat.com>

4 years agoqapi: Prefix frontend errors with an "in definition" line
Markus Armbruster [Fri, 27 Sep 2019 13:46:17 +0000 (15:46 +0200)]
qapi: Prefix frontend errors with an "in definition" line

We take pains to include the offending expression in error messages,
e.g.

    tests/qapi-schema/alternate-any.json:2: alternate 'Alt' member 'one' cannot use type 'any'

But not always:

    tests/qapi-schema/enum-if-invalid.json:2: 'if' condition must be a string or a list of strings

Instead of improving them one by one, report the offending expression
whenever it is known, like this:

    tests/qapi-schema/enum-if-invalid.json: In enum 'TestIfEnum':
    tests/qapi-schema/enum-if-invalid.json:2: 'if' condition must be a string or a list of strings

Error messages that mention the offending expression become a bit
redundant, e.g.

    tests/qapi-schema/alternate-any.json: In alternate 'Alt':
    tests/qapi-schema/alternate-any.json:2: alternate 'Alt' member 'one' cannot use type 'any'

I'll take care of that later in this series.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190927134639.4284-5-armbru@redhat.com>

4 years agoqapi: New QAPISourceInfo, replacing dict
Markus Armbruster [Fri, 27 Sep 2019 13:46:16 +0000 (15:46 +0200)]
qapi: New QAPISourceInfo, replacing dict

We track source locations with a dict of the form

    {'file': FNAME, 'line': LINENO, 'parent': PARENT}

where PARENT is None for the main file, and the include directive's
source location for included files.

This is serviceable enough, but the next commit will add information,
and that's going to come out cleaner if we turn this into a class.  So
do that.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190927134639.4284-4-armbru@redhat.com>

4 years agoqapi: Rename .owner to .defined_in
Markus Armbruster [Fri, 27 Sep 2019 13:46:15 +0000 (15:46 +0200)]
qapi: Rename .owner to .defined_in

QAPISchemaMember.owner is the name of the defining entity.  That's a
confusing name when an object type inherits members from a base type.
Rename it to .defined_in.  Rename .set_owner() and ._pretty_owner() to
match.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190927134639.4284-3-armbru@redhat.com>

4 years agoqapi: Tighten QAPISchemaFOO.check() assertions
Markus Armbruster [Fri, 27 Sep 2019 13:46:14 +0000 (15:46 +0200)]
qapi: Tighten QAPISchemaFOO.check() assertions

When we introduced the QAPISchema intermediate representation (commit
ac88219a6c7), we took a shortcut: we left check_exprs() & friends
alone instead of moving semantic checks into the
QAPISchemaFOO.check().  check_exprs() still checks and reports errors,
and the .check() assert check_exprs() did the job.  There are a few
gaps, though.

QAPISchemaArrayType.check() neglects to assert the element type is not
an array.  Add the assertion.

QAPISchemaObjectTypeVariants.check() neglects to assert the tag member
is not optional.  Add the assertion.

It neglects to assert the tag member is not conditional.  Add the
assertion.

It neglects to assert we actually have variants.  Add the assertion.

It asserts the variants are object types, but neglects to assert they
don't have variants.  Tighten the assertion.

QAPISchemaObjectTypeVariants.check_clash() has the same issue.
However, it can run only after .check().  Delete the assertion instead
of tightening it.

QAPISchemaAlternateType.check() neglects to assert the branch types
don't conflict.  Fixing that isn't trivial, so add just a TODO comment
for now.  It'll be resolved later in this series.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20190927134639.4284-2-armbru@redhat.com>

4 years agoqmp-dispatch: Use CommandNotFound error for disabled commands
Michal Privoznik [Fri, 30 Aug 2019 13:29:45 +0000 (15:29 +0200)]
qmp-dispatch: Use CommandNotFound error for disabled commands

If a command is disabled an error is reported.  But due to usage of
error_setg() the class of the error is GenericError which does not
help callers in distinguishing this case from a case where a qmp
command fails regularly due to other reasons.

We used to use class CommandDisabled until the great error
simplification (commit de253f1491 for QMP and commit 93b91c59db for
qemu-ga, both v1.2.0).

Use CommandNotFound error class, which is close enough.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Message-Id: <faeb030e6a1044f0fd88208edfdb1c5fafe5def9.1567171655.git.mprivozn@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
[Test update squashed in, commit message tweaked]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
4 years agoMerge remote-tracking branch 'remotes/berrange/tags/qcrypto-next-pull-request' into...
Peter Maydell [Fri, 27 Sep 2019 15:53:29 +0000 (16:53 +0100)]
Merge remote-tracking branch 'remotes/berrange/tags/qcrypto-next-pull-request' into staging

Refactoring of LUKS support to facilitate keyslot updates

No current functional change is expected with this series.

# gpg: Signature made Fri 27 Sep 2019 10:58:54 BST
# gpg:                using RSA key DAF3A6FDB26B62912D0E8E3FBE86EBB415104FDF
# gpg: Good signature from "Daniel P. Berrange <dan@berrange.com>" [full]
# gpg:                 aka "Daniel P. Berrange <berrange@redhat.com>" [full]
# Primary key fingerprint: DAF3 A6FD B26B 6291 2D0E  8E3F BE86 EBB4 1510 4FDF

* remotes/berrange/tags/qcrypto-next-pull-request:
  qcrypto-luks: more rigorous header checking
  qcrypto-luks: simplify the math used for keyslot locations
  qcrypto-luks: extract store key function
  qcrypto-luks: extract check and parse header
  qcrypto-luks: extract store and load header
  qcrypto-luks: purge unused error codes from open callback
  qcrypto-luks: use the parsed encryption settings in QCryptoBlockLUKS
  qcrypto-luks: pass keyslot index rather that pointer to the keyslot
  qcrypto-luks: simplify masterkey and masterkey length
  qcrypto-luks: don't overwrite cipher_mode in header
  qcrypto-luks: rename some fields in QCryptoBlockLUKSHeader

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agoMerge remote-tracking branch 'remotes/stsquad/tags/pull-testing-next-260919-1' into...
Peter Maydell [Fri, 27 Sep 2019 14:43:41 +0000 (15:43 +0100)]
Merge remote-tracking branch 'remotes/stsquad/tags/pull-testing-next-260919-1' into staging

Testing updates plus alpha FP fixes:

  - fix alpha handling of FtoI overflow
  - various docker cleanups
  - fix docker.py cleanup race
  - fix podman invocation
  - tests/tcg: add float and record/replay tests
  - remove unused docker images
  - expand documentation for check-tcg

# gpg: Signature made Thu 26 Sep 2019 19:33:38 BST
# gpg:                using RSA key 6685AE99E75167BCAFC8DF35FBD0DB095A9E2A44
# gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>" [full]
# Primary key fingerprint: 6685 AE99 E751 67BC AFC8  DF35 FBD0 DB09 5A9E 2A44

* remotes/stsquad/tags/pull-testing-next-260919-1: (28 commits)
  tests/docker: remove debian-powerpc-user-cross
  docker: move tests from python2 to python3
  docker: remove unused debian-sid
  docker: remove unused debian-ports
  docker: remove 'deprecated' image definitions
  docker: remove unused debian8 partial image
  docker: remove debian8-mxe definitions
  target/i386: Fix broken build with WHPX enabled
  docs/devel: add "check-tcg" to testing.rst
  configure: preserve PKG_CONFIG for subdir builds
  tests/tcg: add simple record/replay smoke test for aarch64
  tests/tcg: add generic version of float_convs
  tests/tcg: add float_madds test to multiarch
  tests/tcg: re-enable linux-test for ppc64abi32
  tests/tcg: clean-up some comments after the de-tangling
  podman: fix command invocation
  tests/docker: reduce scary warnings by cleaning up clean up
  tests/docker: remove python2.7 from debian9-mxe
  tests/docker: fix DOCKER_PARTIAL_IMAGES
  tests/docker: add sanitizers back to clang build
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agohw/arm/boot: Use the IEC binary prefix definitions
Philippe Mathieu-Daudé [Mon, 23 Sep 2019 13:11:08 +0000 (15:11 +0200)]
hw/arm/boot: Use the IEC binary prefix definitions

IEC binary prefixes ease code review: the unit is explicit.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20190923131108.21459-1-philmd@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agohw/arm/boot.c: Set NSACR.{CP11,CP10} for NS kernel boots
Peter Maydell [Fri, 20 Sep 2019 17:40:39 +0000 (18:40 +0100)]
hw/arm/boot.c: Set NSACR.{CP11,CP10} for NS kernel boots

If we're booting a Linux kernel directly into Non-Secure
state on a CPU which has Secure state, then make sure we
set the NSACR CP11 and CP10 bits, so that Non-Secure is allowed
to access the FPU. Otherwise an AArch32 kernel will UNDEF as
soon as it tries to use the FPU.

It used to not matter that we didn't do this until commit
fc1120a7f5f2d4b6, where we implemented actually honouring
these NSACR bits.

The problem only exists for CPUs where EL3 is AArch32; the
equivalent AArch64 trap bits are in CPTR_EL3 and are "0 to
not trap, 1 to trap", so the reset value of the register
permits NS access, unlike NSACR.

Fixes: fc1120a7f5
Fixes: https://bugs.launchpad.net/qemu/+bug/1844597
Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20190920174039.3916-1-peter.maydell@linaro.org

4 years agotests/tcg: add linux-user semihosting smoke test for ARM
Alex Bennée [Thu, 19 Sep 2019 13:18:41 +0000 (14:18 +0100)]
tests/tcg: add linux-user semihosting smoke test for ARM

We already use semihosting for the system stuff so this is a simple
smoke test to ensure we are working OK on linux-user.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-id: 20190913151845.12582-7-alex.bennee@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: remove run-time semihosting checks for linux-user
Alex Bennée [Thu, 19 Sep 2019 13:18:41 +0000 (14:18 +0100)]
target/arm: remove run-time semihosting checks for linux-user

Now we do all our checking at translate time we can make cpu_loop a
little bit simpler. We also introduce a simple linux-user semihosting
test case to defend the functionality. The out-of-tree softmmu based
semihosting tests are still more comprehensive.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-id: 20190913151845.12582-6-alex.bennee@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: remove run time semihosting checks
Alex Bennée [Thu, 19 Sep 2019 13:18:41 +0000 (14:18 +0100)]
target/arm: remove run time semihosting checks

Now we do all our checking and use a common EXCP_SEMIHOST for
semihosting operations we can make helper code a lot simpler.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20190913151845.12582-5-alex.bennee@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: handle A-profile semihosting at translate time
Alex Bennée [Thu, 19 Sep 2019 13:18:40 +0000 (14:18 +0100)]
target/arm: handle A-profile semihosting at translate time

As for the other semihosting calls we can resolve this at translate
time.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20190913151845.12582-4-alex.bennee@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: handle M-profile semihosting at translate time
Alex Bennée [Thu, 19 Sep 2019 13:18:40 +0000 (14:18 +0100)]
target/arm: handle M-profile semihosting at translate time

We do this for other semihosting calls so we might as well do it for
M-profile as well.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20190913151845.12582-3-alex.bennee@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotests/tcg: clean-up some comments after the de-tangling
Alex Bennée [Thu, 19 Sep 2019 13:18:40 +0000 (14:18 +0100)]
tests/tcg: clean-up some comments after the de-tangling

These were missed in the recent de-tangling so have been updated to be
more actuate. I've also built up ARM_TESTS in a manner similar to
AARCH64_TESTS for better consistency.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20190913151845.12582-2-alex.bennee@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotarget/arm: fix CBAR register for AArch64 CPUs
Luc Michel [Thu, 19 Sep 2019 13:18:40 +0000 (14:18 +0100)]
target/arm: fix CBAR register for AArch64 CPUs

For AArch64 CPUs with a CBAR register, we have two views for it:
  - in AArch64 state, the CBAR_EL1 register (S3_1_C15_C3_0), returns the
    full 64 bits CBAR value
  - in AArch32 state, the CBAR register (cp15, opc1=1, CRn=15, CRm=3, opc2=0)
    returns a 32 bits view such that:
      CBAR = CBAR_EL1[31:18] 0..0 CBAR_EL1[43:32]

This commit fixes the current implementation where:
  - CBAR_EL1 was returning the 32 bits view instead of the full 64 bits
    value,
  - CBAR was returning a truncated 32 bits version of the full 64 bits
    one, instead of the 32 bits view
  - CBAR was declared as cp15, opc1=4, CRn=15, CRm=0, opc2=0, which is
    the CBAR register found in the ARMv7 Cortex-Ax CPUs, but not in
    ARMv8 CPUs.

Signed-off-by: Luc Michel <luc.michel@greensocs.com>
Message-id: 20190912110103.1417887-1-luc.michel@greensocs.com
[PMM: Added a comment about the two different kinds of CBAR]
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agoMerge remote-tracking branch 'remotes/rth/tags/pull-tcg-20190925' into staging
Peter Maydell [Fri, 27 Sep 2019 10:10:49 +0000 (11:10 +0100)]
Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20190925' into staging

Fixes for TLB_BSWAP
Coversion of NOTDIRTY and ROM handling to cputlb
Followup cleanups to cputlb

# gpg: Signature made Wed 25 Sep 2019 19:41:17 BST
# gpg:                using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F
# gpg:                issuer "richard.henderson@linaro.org"
# gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>" [full]
# Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A  05C0 64DF 38E8 AF7E 215F

* remotes/rth/tags/pull-tcg-20190925:
  cputlb: Pass retaddr to tb_check_watchpoint
  cputlb: Pass retaddr to tb_invalidate_phys_page_fast
  cputlb: Remove tb_invalidate_phys_page_range is_cpu_write_access
  cputlb: Remove cpu->mem_io_vaddr
  cputlb: Handle TLB_NOTDIRTY in probe_access
  cputlb: Merge and move memory_notdirty_write_{prepare,complete}
  cputlb: Partially inline memory_region_section_get_iotlb
  cputlb: Move NOTDIRTY handling from I/O path to TLB path
  cputlb: Move ROM handling from I/O path to TLB path
  exec: Adjust notdirty tracing
  cputlb: Introduce TLB_BSWAP
  cputlb: Split out load/store_memop
  cputlb: Use qemu_build_not_reached in load/store_helpers
  qemu/compiler.h: Add qemu_build_not_reached
  cputlb: Disable __always_inline__ without optimization
  exec: Use TARGET_PAGE_BITS_MIN for TLB flags

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 years agotests/docker: remove debian-powerpc-user-cross
Alex Bennée [Tue, 24 Sep 2019 18:44:18 +0000 (19:44 +0100)]
tests/docker: remove debian-powerpc-user-cross

Despite our attempts in 4d26c7fef4 to keep this going it still gets in
the way of "make docker-test-build" completing because of course we
can't build a modern QEMU with the image. Let's put the thing out of
its misery and remove it.

People who really care about building on powerpc can still use the
binfmt_misc support to manually build an image (or just run the build
from pre this commit).

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
4 years agodocker: move tests from python2 to python3
John Snow [Mon, 23 Sep 2019 18:11:40 +0000 (14:11 -0400)]
docker: move tests from python2 to python3

As part of the push to drop python2 support, replace any explicit python2
dependencies with python3 versions.

For centos, python2 still exists as an implicit dependency, but by adding
python3 we will be able to build even if the configure script begins to
require python 3.5+.

Tested with centos7, fedora, ubuntu, ubuntu1804, and debian 9 (amd64).
Tested under a custom configure script that requires Python 3.5+.

the travis dockerfile is also moved to using python3, which was tested
by running `make docker-test-build@travis`, which I hope is sufficient.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20190923181140.7235-7-jsnow@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Cleber Rosa <crosa@redhat.com>
Tested-by: Cleber Rosa <crosa@redhat.com>
4 years agodocker: remove unused debian-sid
John Snow [Mon, 23 Sep 2019 18:11:39 +0000 (14:11 -0400)]
docker: remove unused debian-sid

debian-sid is listed as a partial image, so we cannot run tests against it.
Since it isn't used by any other testable image, remove it for now as it
is prone to bitrot.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20190923181140.7235-6-jsnow@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agodocker: remove unused debian-ports
John Snow [Mon, 23 Sep 2019 18:11:38 +0000 (14:11 -0400)]
docker: remove unused debian-ports

debian-ports is listed as a partial image, so we cannot run tests against it.
Since it isn't used by any other testable image, remove it for now as it
is prone to bitrot.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20190923181140.7235-5-jsnow@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agodocker: remove 'deprecated' image definitions
John Snow [Mon, 23 Sep 2019 18:11:37 +0000 (14:11 -0400)]
docker: remove 'deprecated' image definitions

There isn't a debian.dockerfile anymore,
so perform some ghost-busting.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20190923181140.7235-4-jsnow@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agodocker: remove unused debian8 partial image
John Snow [Mon, 23 Sep 2019 18:11:36 +0000 (14:11 -0400)]
docker: remove unused debian8 partial image

debian8 partial base is also not consumed by any image, so remove it.
For QEMU's development cycle, we only support debian9 (stretch) and
debian10 (buster).

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20190923181140.7235-3-jsnow@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
4 years agodocker: remove debian8-mxe definitions
John Snow [Mon, 23 Sep 2019 18:11:35 +0000 (14:11 -0400)]
docker: remove debian8-mxe definitions

We don't have a debian8-mxe dockerfile anymore.

Fixes: 67bd36beda1ae
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20190923181140.7235-2-jsnow@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
4 years agotarget/i386: Fix broken build with WHPX enabled
Philippe Mathieu-Daudé [Fri, 20 Sep 2019 11:33:27 +0000 (13:33 +0200)]
target/i386: Fix broken build with WHPX enabled

The WHPX build is broken since commit 12e9493df92 which removed the
"hw/boards.h" where MachineState is declared:

  $ ./configure \
     --enable-hax --enable-whpx

  $ make x86_64-softmmu/all
  [...]
    CC      x86_64-softmmu/target/i386/whpx-all.o
  target/i386/whpx-all.c: In function 'whpx_accel_init':
  target/i386/whpx-all.c:1378:25: error: dereferencing pointer to
  incomplete type 'MachineState' {aka 'struct MachineState'}
       whpx->mem_quota = ms->ram_size;
                           ^~
  make[1]: *** [rules.mak:69: target/i386/whpx-all.o] Error 1
    CC      x86_64-softmmu/trace/generated-helpers.o
  make[1]: Target 'all' not remade because of errors.
  make: *** [Makefile:471: x86_64-softmmu/all] Error 2

Restore this header, partially reverting commit 12e9493df92.

Fixes: 12e9493df92
Reported-by: Ilias Maratos <i.maratos@gmail.com>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20190920113329.16787-2-philmd@redhat.com>

4 years agodocs/devel: add "check-tcg" to testing.rst
Alex Bennée [Thu, 19 Sep 2019 13:36:35 +0000 (14:36 +0100)]
docs/devel: add "check-tcg" to testing.rst

It was pointed out we haven't documented the check-tcg part of the
build system. Attempt to rectify that now.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
4 years agoconfigure: preserve PKG_CONFIG for subdir builds
Alex Bennée [Thu, 19 Sep 2019 13:07:36 +0000 (14:07 +0100)]
configure: preserve PKG_CONFIG for subdir builds

The slirp sub-module complains about not being able to find the glib
library on cross-compiles because it is using the default pkg-config
tool (which isn't installed in our cross-build docker images).
Preserve PKG_CONFIG in our host config and pass it down to slirp.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests/tcg: add simple record/replay smoke test for aarch64
Alex Bennée [Wed, 18 Sep 2019 13:31:42 +0000 (14:31 +0100)]
tests/tcg: add simple record/replay smoke test for aarch64

This adds two new tests that re-use the memory test to check basic
record replay functionality is still working. We have to define our
own runners rather than using the default pattern as we want to change
the test name but re-use the memory binary.

We declare the test binaries as PHONY as they don't really exist.

[AJB: A better test would output some sort of timer value or other
otherwise variable value so we could compare the record and replay
outputs and ensure they match]

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: Pavel Dovgalyuk <dovgaluk@ispras.ru>
4 years agotests/tcg: add generic version of float_convs
Alex Bennée [Mon, 16 Sep 2019 13:50:56 +0000 (14:50 +0100)]
tests/tcg: add generic version of float_convs

This is broadly similar to the existing fcvt test for ARM but using
the generic float testing framework. We should be able to pare down
the ARM fcvt test case to purely half-precision with or without the
Alt HP provision.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests/tcg: add float_madds test to multiarch
Alex Bennée [Fri, 13 Sep 2019 11:12:17 +0000 (12:12 +0100)]
tests/tcg: add float_madds test to multiarch

This is a generic floating point multiply and accumulate test for
single precision floating point values. I've split of the common float
functions into a helper library so additional tests can use the same
common code.

As I don't have references for all architectures I've allowed some
flexibility for tests to pass without reference files. They can be
added as we get collect them.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests/tcg: re-enable linux-test for ppc64abi32
Alex Bennée [Mon, 16 Sep 2019 09:24:05 +0000 (10:24 +0100)]
tests/tcg: re-enable linux-test for ppc64abi32

Now we have fixed the signal delivary bug we can remove this horrible
hack from the system.

Cc: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests/tcg: clean-up some comments after the de-tangling
Alex Bennée [Wed, 11 Sep 2019 16:49:55 +0000 (17:49 +0100)]
tests/tcg: clean-up some comments after the de-tangling

These were missed in the recent de-tangling so have been updated to be
more actuate. I've also built up ARM_TESTS in a manner similar to
AARCH64_TESTS for better consistency.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agopodman: fix command invocation
John Snow [Fri, 13 Sep 2019 19:38:21 +0000 (15:38 -0400)]
podman: fix command invocation

Oops; there's no argv here.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20190913193821.17756-1-jsnow@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Cleber Rosa <crosa@redhat.com>
Tested-by: Cleber Rosa <crosa@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Tested-by: Thomas Huth <thuth@redhat.com>
4 years agotests/docker: reduce scary warnings by cleaning up clean up
Alex Bennée [Thu, 19 Sep 2019 16:51:27 +0000 (17:51 +0100)]
tests/docker: reduce scary warnings by cleaning up clean up

There was in the clean-up code caused by attempting to inspect images
which finished before we got there. Clean up the clean up code by:

  - only track the one instance at a time
  - use --filter for docker ps instead of doing it by hand
  - just call docker rm -f to be done with it
  - use uuid.uuid4() for a random uid

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
4 years agotests/docker: remove python2.7 from debian9-mxe
John Snow [Wed, 18 Sep 2019 22:25:46 +0000 (18:25 -0400)]
tests/docker: remove python2.7 from debian9-mxe

When it was based on debian8 which uses python-minimal, it needed this.
It no longer does.

Goodbye, python2.7.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20190918222546.11696-1-jsnow@redhat.com>
[AJB: fixed up commit message]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4 years agotests/docker: fix DOCKER_PARTIAL_IMAGES
Alex Bennée [Mon, 16 Sep 2019 17:54:33 +0000 (18:54 +0100)]
tests/docker: fix DOCKER_PARTIAL_IMAGES

Finger trouble in a previous clean-up inadvertently set
DEBIAN_PARTIAL_IMAGES instead of DOCKER_PARTIAL_IMAGES. Also fix the
typo to debian-9-mxe.

Fixes: 44d5a8bf5d2
Signed-off-by: John Snow <jsnow@redhat.com>
[AJB: merged fix from Message-Id: <20190917185537.25417-1-jsnow@redhat.com>]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Cleber Rosa <crosa@redhat.com>
4 years agotests/docker: add sanitizers back to clang build
John Snow [Thu, 12 Sep 2019 01:44:42 +0000 (21:44 -0400)]
tests/docker: add sanitizers back to clang build

Fedora23 is but a distant twinkle. The sanitizer works again, and even
if not, we have --enable-sanitizers now.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20190912014442.5757-1-jsnow@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>