OSDN Git Service

qmiga/qemu.git
3 years agoMakefile: remove obsolete edk2 exception from "clean" rule
Laszlo Ersek [Mon, 7 Sep 2020 22:05:44 +0000 (00:05 +0200)]
Makefile: remove obsolete edk2 exception from "clean" rule

The file "BaseTools/Source/Python/UPT/Dll/sqlite3.dll" was removed in edk2
commit 26e2b295ec7a ("BaseTools:Remove unused
BaseTools\Source\Python\UPT\Dll", 2019-05-08), part of edk2-stable201905,
so skipping it in the outermost in-tree "clean" rule is unnecessary.

Remove the obsolete pathname reference.

Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugs.launchpad.net/qemu/+bug/1852196
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200908072939.30178-2-lersek@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
3 years agoMerge remote-tracking branch 'remotes/stsquad/tags/pull-testing-fixes-100920-1' into...
Peter Maydell [Sat, 12 Sep 2020 21:54:32 +0000 (22:54 +0100)]
Merge remote-tracking branch 'remotes/stsquad/tags/pull-testing-fixes-100920-1' into staging

Various misc and testing fixes:

  - Expand CODING_STYLE.rst a little more
  - usb-host build fix
  - allow check-softfloat unit tests without TCG
  - simplify mips imm_branch so compiler isn't confused
  - mark ppc64abi32 for deprecation
  - more compiler soothing in pch_rev_id
  - allow acceptance to skip missing binaries
  - more a bunch of plugins to contrib

# gpg: Signature made Thu 10 Sep 2020 10:51:05 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-fixes-100920-1:
  plugins: move the more involved plugins to contrib
  tests/acceptance: Add Test.fetch_asset(cancel_on_missing=True)
  tests: bump avocado version
  hw/i386: make explicit clearing of pch_rev_id
  configure: don't enable ppc64abi32-linux-user by default
  docs/system/deprecated: mark ppc64abi32-linux-user for deprecation
  target/mips: simplify gen_compute_imm_branch logic
  tests/meson.build: fp tests don't need CONFIG_TCG
  usb-host: restrict workaround to new libusb versions
  CODING_STYLE.rst: flesh out our naming conventions.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
3 years agoMerge remote-tracking branch 'remotes/berrange-gitlab/tags/crypt-perf-pull-request...
Peter Maydell [Sat, 12 Sep 2020 20:17:22 +0000 (21:17 +0100)]
Merge remote-tracking branch 'remotes/berrange-gitlab/tags/crypt-perf-pull-request' into staging

Improve performance of crypto cipher subsystem

# gpg: Signature made Thu 10 Sep 2020 11:05:18 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-gitlab/tags/crypt-perf-pull-request:
  crypto/gcrypt: Split QCryptoCipherGcrypt into subclasses
  crypto/nettle: Split QCryptoCipherNettle into subclasses
  crypto/builtin: Split QCryptoCipherBuiltin into subclasses
  crypto/builtin: Split and simplify AES_encrypt_cbc
  crypto/builtin: Move AES_cbc_encrypt into cipher-builtin.inc.c
  crypto/builtin: Merge qcrypto_cipher_aes_{ecb,xts}_{en,de}crypt
  crypto/builtin: Remove odd-sized AES block handling
  crypto: Constify cipher data tables
  crypto: Move cipher->driver init to qcrypto_*_cipher_ctx_new
  crypto: Allocate QCryptoCipher with the subclass
  crypto: Use the correct const type for driver
  crypto: Move QCryptoCipherDriver typedef to crypto/cipher.h
  crypto/nettle: Fix xts_encrypt arguments
  crypto: Remove redundant includes
  crypto: Rename cipher include files to .c.inc
  crypto: Assume blocksize is a power of 2
  tests: fix output message formatting for crypto benchmarks

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
3 years agoMerge remote-tracking branch 'remotes/vivier2/tags/trivial-branch-for-5.2-pull-reques...
Peter Maydell [Sat, 12 Sep 2020 13:23:15 +0000 (14:23 +0100)]
Merge remote-tracking branch 'remotes/vivier2/tags/trivial-branch-for-5.2-pull-request' into staging

trivial patches pull request 20200911

# gpg: Signature made Fri 11 Sep 2020 20:32:27 BST
# gpg:                using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C
# gpg:                issuer "laurent@vivier.eu"
# gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full]
# gpg:                 aka "Laurent Vivier <laurent@vivier.eu>" [full]
# gpg:                 aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [full]
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C

* remotes/vivier2/tags/trivial-branch-for-5.2-pull-request:
  target/i386/kvm: Add missing fallthrough comment
  util/hexdump: Reorder qemu_hexdump() arguments
  util/hexdump: Convert to take a void pointer argument
  hw/arm/pxa2xx: Add missing fallthrough comment
  target/i386/kvm: Rename host_tsx_blacklisted() as host_tsx_broken()
  test-vmstate: remove unnecessary code in match_interval_mapping_node
  hw: hyperv: vmbus: Fix 32bit compilation
  kconfig: fix comment referring to old Makefiles
  meson.build: tweak sdl-image error message
  hw/net/e1000e: Remove duplicated write handler for FLSWDATA register
  hw/net/e1000e: Remove overwritten read handler for STATUS register
  Makefile: Skip the meson subdir in cscope/TAGS/ctags
  Makefile: Drop extra phony cscope
  hw/gpio/max7310: Replace disabled printf() by qemu_log_mask(UNIMP)
  hw/gpio/omap_gpio: Replace fprintf() by qemu_log_mask(GUEST_ERROR)
  hw/acpi/tco: Remove unused definitions
  hw/isa/isa-bus: Replace hw_error() by assert()
  hw/mips/fuloong2e: Convert pointless error message to an assert()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
# Conflicts:
# net/colo-compare.c

3 years agotarget/i386/kvm: Add missing fallthrough comment
Thomas Huth [Fri, 11 Sep 2020 12:53:01 +0000 (14:53 +0200)]
target/i386/kvm: Add missing fallthrough comment

Let's make this file compilable with -Werror=implicit-fallthrough :
Looking at the code, it seems like the fallthrough is intended here,
so we should add the corresponding "/* fallthrough */" comment here.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200911125301.413081-1-thuth@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
3 years agoutil/hexdump: Reorder qemu_hexdump() arguments
Philippe Mathieu-Daudé [Sat, 22 Aug 2020 18:09:50 +0000 (20:09 +0200)]
util/hexdump: Reorder qemu_hexdump() arguments

qemu_hexdump()'s pointer to the buffer and length of the
buffer are closely related arguments but are widely separated
in the argument list order (also, the format of <stdio.h>
function prototypes is usually to have the FILE* argument
coming first).

Reorder the arguments as "fp, prefix, buf, size" which is
more logical.

Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Message-Id: <20200822180950.1343963-3-f4bug@amsat.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
3 years agoutil/hexdump: Convert to take a void pointer argument
Philippe Mathieu-Daudé [Sat, 22 Aug 2020 18:09:49 +0000 (20:09 +0200)]
util/hexdump: Convert to take a void pointer argument

Most uses of qemu_hexdump() do not take an array of char
as input, forcing use of cast. Since we can use this
helper to dump any kind of buffer, use a pointer to void
argument instead.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Message-Id: <20200822180950.1343963-2-f4bug@amsat.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
3 years agohw/arm/pxa2xx: Add missing fallthrough comment
Thomas Huth [Fri, 11 Sep 2020 12:18:44 +0000 (14:18 +0200)]
hw/arm/pxa2xx: Add missing fallthrough comment

Let's make this file compilable with -Werror=implicit-fallthrough :
Looking at the code, it seems like the fallthrough is intended here,
so we should add the corresponding "/* fallthrough */" comment here.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20200911121844.404434-1-thuth@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
3 years agoMerge remote-tracking branch 'remotes/ehabkost/tags/machine-next-pull-request' into...
Peter Maydell [Fri, 11 Sep 2020 18:26:51 +0000 (19:26 +0100)]
Merge remote-tracking branch 'remotes/ehabkost/tags/machine-next-pull-request' into staging

QOM boilerplate cleanup

Documentation build fix:
* memory: Remove kernel-doc comment marker (Eduardo Habkost)

QOM cleanups:
* Rename QOM macros for consistency between
  TYPE_* and type checking constants (Eduardo Habkost)

QOM new macros:
* OBJECT_DECLARE_* and OBJECT_DEFINE_* macros (Daniel P. Berrangé)
* DECLARE_*_CHECKER macros (Eduardo Habkost)

Automated QOM boilerplate changes:
* Automated changes to use DECLARE_*_CHECKER (Eduardo Habkost
* Automated changes to use OBJECT_DECLARE* (Eduardo Habkost)

# gpg: Signature made Thu 10 Sep 2020 19:17:49 BST
# gpg:                using RSA key 5A322FD5ABC4D3DBACCFD1AA2807936F984DC5A6
# gpg:                issuer "ehabkost@redhat.com"
# gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>" [full]
# Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF  D1AA 2807 936F 984D C5A6

* remotes/ehabkost/tags/machine-next-pull-request: (33 commits)
  virtio-vga: Use typedef name for instance_size
  vhost-user-vga: Use typedef name for instance_size
  xilinx_axienet: Use typedef name for instance_size
  lpc_ich9: Use typedef name for instance_size
  omap_intc: Use typedef name for instance_size
  xilinx_axidma: Use typedef name for instance_size
  tusb6010: Rename TUSB to TUSB6010
  pc87312: Rename TYPE_PC87312_SUPERIO to TYPE_PC87312
  vfio: Rename PCI_VFIO to VFIO_PCI
  usb: Rename USB_SERIAL_DEV to USB_SERIAL
  sabre: Rename SABRE_DEVICE to SABRE
  rs6000_mc: Rename RS6000MC_DEVICE to RS6000MC
  filter-rewriter: Rename FILTER_COLO_REWRITER to FILTER_REWRITER
  esp: Rename ESP_STATE to ESP
  ahci: Rename ICH_AHCI to ICH9_AHCI
  vmgenid: Rename VMGENID_DEVICE to TYPE_VMGENID
  vfio: Rename VFIO_AP_DEVICE_TYPE to TYPE_VFIO_AP_DEVICE
  dev-smartcard-reader: Rename CCID_DEV_NAME to TYPE_USB_CCID_DEV
  ap-device: Rename AP_DEVICE_TYPE to TYPE_AP_DEVICE
  gpex: Fix type checking function name
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
3 years agoMerge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
Peter Maydell [Fri, 11 Sep 2020 13:47:49 +0000 (14:47 +0100)]
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging

Block layer patches:

- qemu-img create: Fail gracefully when backing file is an empty string
- Fixes related to filter block nodes ("Deal with filters" series)
- block/nvme: Various cleanups required to use multiple queues
- block/nvme: Use NvmeBar structure from "block/nvme.h"
- file-win32: Fix "locking" option
- iotests: Allow running from different directory

# gpg: Signature made Thu 10 Sep 2020 10:11:19 BST
# gpg:                using RSA key DC3DEB159A9AF95D3D7456FE7F09B272C88F2FD6
# gpg:                issuer "kwolf@redhat.com"
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" [full]
# Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6

* remotes/kevin/tags/for-upstream: (65 commits)
  block/qcow2-cluster: Add missing "fallthrough" annotation
  block/nvme: Pair doorbell registers
  block/nvme: Use generic NvmeBar structure
  block/nvme: Group controller registers in NVMeRegs structure
  file-win32: Fix "locking" option
  iotests: Allow running from different directory
  iotests: Test committing to overridden backing
  iotests: Add test for commit in sub directory
  iotests: Add filter mirror test cases
  iotests: Add filter commit test cases
  iotests: Let complete_and_wait() work with commit
  iotests: Test that qcow2's data-file is flushed
  block: Leave BDS.backing_{file,format} constant
  block: Inline bdrv_co_block_status_from_*()
  blockdev: Fix active commit choice
  block: Drop backing_bs()
  qemu-img: Use child access functions
  nbd: Use CAF when looking for dirty bitmap
  commit: Deal with filters
  backup: Deal with filters
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
3 years agotarget/i386/kvm: Rename host_tsx_blacklisted() as host_tsx_broken()
Philippe Mathieu-Daudé [Thu, 10 Sep 2020 07:01:31 +0000 (09:01 +0200)]
target/i386/kvm: Rename host_tsx_blacklisted() as host_tsx_broken()

In order to use inclusive terminology, rename host_tsx_blacklisted()
as host_tsx_broken().

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200910070131.435543-7-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
3 years agotest-vmstate: remove unnecessary code in match_interval_mapping_node
Pan Nengyuan [Thu, 10 Sep 2020 02:38:18 +0000 (10:38 +0800)]
test-vmstate: remove unnecessary code in match_interval_mapping_node

'str' is not used in match_interval_mapping_node(), remove it.

Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20200910023818.11880-1-pannengyuan@huawei.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
3 years agohw: hyperv: vmbus: Fix 32bit compilation
Jon Doron [Wed, 15 Jul 2020 08:43:26 +0000 (11:43 +0300)]
hw: hyperv: vmbus: Fix 32bit compilation

Fix 32-bit build error for vmbus:

  hw/hyperv/vmbus.c: In function ‘gpadl_iter_io’:
  hw/hyperv/vmbus.c:383:13: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
  383 |         p = (void *)(((uintptr_t)iter->map & TARGET_PAGE_MASK) | off_in_page);
      |             ^
  cc1: all warnings being treated as errors

Fixes: 0d71f7082d7 ("vmbus: vmbus implementation")
Signed-off-by: Jon Doron <arilou@gmail.com>
Tested-by: Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>
Reviewed-by: Aleksandar Markovic <aleksandar.qemu.devel@gmail.com>
Message-Id: <20200715084326.678715-3-arilou@gmail.com>
[lv: updated with commit description from <20200906050113.2783642-1-richard.henderson@linaro.org>]
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
3 years agokconfig: fix comment referring to old Makefiles
Paolo Bonzini [Tue, 8 Sep 2020 09:42:44 +0000 (11:42 +0200)]
kconfig: fix comment referring to old Makefiles

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200908094244.26327-1-pbonzini@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
3 years agomeson.build: tweak sdl-image error message
Sergei Trofimovich [Tue, 8 Sep 2020 07:40:16 +0000 (08:40 +0100)]
meson.build: tweak sdl-image error message

Before the change missing SDL was reported as:

    ../meson.build:253:4: ERROR: Expected 1 arguments, got 2.

After the error as:

    ../meson.build:258:4: ERROR: Problem encountered: sdl-image required, but SDL was not found

CC: Paolo Bonzini <pbonzini@redhat.com>
CC: "Marc-André Lureau" <marcandre.lureau@redhat.com>
CC: "Philippe Mathieu-Daudé" <philmd@redhat.com>
CC: Rafael Kitover <rkitover@gmail.com>
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200908074016.2593596-1-slyfox@gentoo.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
3 years agohw/net/e1000e: Remove duplicated write handler for FLSWDATA register
Philippe Mathieu-Daudé [Fri, 4 Sep 2020 13:14:02 +0000 (15:14 +0200)]
hw/net/e1000e: Remove duplicated write handler for FLSWDATA register

The FLSWDATA register writeop handler is initialized twice:

  3067 #define e1000e_putreg(x)    [x] = e1000e_mac_writereg
  3068 typedef void (*writeops)(E1000ECore *, int, uint32_t);
  3069 static const writeops e1000e_macreg_writeops[] = {
  ....
  3102     e1000e_putreg(FLSWDATA),
  ....
  3145     e1000e_putreg(FLSWDATA),

To avoid confusion, remove the duplicated initialization.

Fixes: 6f3fbe4ed0 ("net: Introduce e1000e device emulation")
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
Message-Id: <20200904131402.590055-3-f4bug@amsat.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
3 years agohw/net/e1000e: Remove overwritten read handler for STATUS register
Philippe Mathieu-Daudé [Fri, 4 Sep 2020 13:14:01 +0000 (15:14 +0200)]
hw/net/e1000e: Remove overwritten read handler for STATUS register

The STATUS register readop handler is initialized first with
the generic e1000e_mac_readreg() handler:

  2861 #define e1000e_getreg(x)    [x] = e1000e_mac_readreg
  2862 typedef uint32_t (*readops)(E1000ECore *, int);
  2863 static const readops e1000e_macreg_readops[] = {
  ....
  2919     e1000e_getreg(STATUS),

Then overwritten with the specific e1000e_get_status handler:

  3018     [STATUS]  = e1000e_get_status,

To avoid confusion, remove the overwritten initialization.

6f3fbe4ed0 ("net: Introduce e1000e device emulation")
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
Message-Id: <20200904131402.590055-2-f4bug@amsat.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
3 years agoMakefile: Skip the meson subdir in cscope/TAGS/ctags
Greg Kurz [Thu, 3 Sep 2020 19:47:55 +0000 (21:47 +0200)]
Makefile: Skip the meson subdir in cscope/TAGS/ctags

If the meson submodule is present, we don't really want to index its
source code. Consolidate the find command in a single place and use
it for cscope, ctags and etags. Note that this now causes ctags and
etags to also index assembly files, but this is okay since they both
have been supporting assembly since 2001 at least.

Signed-off-by: Greg Kurz <groug@kaod.org>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <159916247553.691541.10480293747685886851.stgit@bahia.lan>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
3 years agoMakefile: Drop extra phony cscope
Greg Kurz [Thu, 3 Sep 2020 19:47:48 +0000 (21:47 +0200)]
Makefile: Drop extra phony cscope

Commit d79864058a64 added a dedicated phony line for cscope.

Fixes: d79864058a64 ("Makefile: Add back TAGS/ctags/cscope rules")
Signed-off-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <159916246865.691541.16619858522304817323.stgit@bahia.lan>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
3 years agoMerge remote-tracking branch 'remotes/stefanha/tags/tracing-pull-request' into staging
Peter Maydell [Thu, 10 Sep 2020 10:45:13 +0000 (11:45 +0100)]
Merge remote-tracking branch 'remotes/stefanha/tags/tracing-pull-request' into staging

Pull request

v2:
 * Rebased after meson and resolved conflict in "softmmu: Add missing trace-events file"
 * Dropped "meson: Don't make object files for dtrace on macOS" (already merged via Paolo's tree)

# gpg: Signature made Thu 10 Sep 2020 09:09:47 BST
# gpg:                using RSA key 8695A8BFD3F97CDAAC35775A9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" [full]
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>" [full]
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* remotes/stefanha/tags/tracing-pull-request:
  trace-events: Fix attribution of trace points to source
  trace-events: Delete unused trace points
  scripts/cleanup-trace-events: Emit files in alphabetical order
  scripts/cleanup-trace-events: Fix for vcpu property
  net/colo: Match is-enabled probe to tracepoint
  scripts/tracetool: Use void pointer for vcpu
  scripts/tracetool: Fix dtrace generation for macOS
  softmmu: Add missing trace-events file

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
3 years agocrypto/gcrypt: Split QCryptoCipherGcrypt into subclasses
Richard Henderson [Fri, 28 Aug 2020 17:05:23 +0000 (10:05 -0700)]
crypto/gcrypt: Split QCryptoCipherGcrypt into subclasses

With gcrypt, most of the dispatch happens in the library,
so there aren't many classes to create.  However, we can
still create separate dispatch for CTR mode, and for
CONFIG_QEMU_PRIVATE_XTS, which avoids needing to check
for these modes at runtime.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agocrypto/nettle: Split QCryptoCipherNettle into subclasses
Richard Henderson [Fri, 28 Aug 2020 17:05:22 +0000 (10:05 -0700)]
crypto/nettle: Split QCryptoCipherNettle into subclasses

Use separate classes for each cipher entry point: des_rfb, des3,
aes128, aes192, aes256, cast128, serpent, and twofish.

Generate wrappers for XTS only for CONFIG_QEMU_PRIVATE_XTS.
This eliminates unreachable wrappers for DES_RFB, DES3 and
CAST128, which have blocksizes that do not allow XTS mode.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agocrypto/builtin: Split QCryptoCipherBuiltin into subclasses
Richard Henderson [Fri, 28 Aug 2020 17:05:21 +0000 (10:05 -0700)]
crypto/builtin: Split QCryptoCipherBuiltin into subclasses

We had a second set of function pointers in QCryptoCipherBuiltin,
which are redundant with QCryptoCipherDriver.  Split the AES and
DES implementations to avoid one level of indirection.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agocrypto/builtin: Split and simplify AES_encrypt_cbc
Richard Henderson [Fri, 28 Aug 2020 17:05:20 +0000 (10:05 -0700)]
crypto/builtin: Split and simplify AES_encrypt_cbc

Split into encrypt/decrypt functions, dropping the "enc" argument.
Now that the function is private to this file, we know that "len"
is a multiple of AES_BLOCK_SIZE.  So drop the odd block size code.

Name the functions do_aes_*crypt_cbc to match the *_ecb functions.
Reorder and re-type the arguments to match as well.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agocrypto/builtin: Move AES_cbc_encrypt into cipher-builtin.inc.c
Richard Henderson [Fri, 28 Aug 2020 17:05:19 +0000 (10:05 -0700)]
crypto/builtin: Move AES_cbc_encrypt into cipher-builtin.inc.c

By making the function private, we will be able to make further
simplifications.  Re-indent the migrated code and fix the missing
braces for CODING_STYLE.

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agocrypto/builtin: Merge qcrypto_cipher_aes_{ecb,xts}_{en,de}crypt
Richard Henderson [Fri, 28 Aug 2020 17:05:18 +0000 (10:05 -0700)]
crypto/builtin: Merge qcrypto_cipher_aes_{ecb,xts}_{en,de}crypt

There's no real reason we need two separate helper functions here.
Standardize on the function signature required for xts_encrypt.
Rename to do_aes_{en,de}crypt_ecb, since the helper does not
itself do anything with respect to xts.

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agocrypto/builtin: Remove odd-sized AES block handling
Richard Henderson [Fri, 28 Aug 2020 17:05:17 +0000 (10:05 -0700)]
crypto/builtin: Remove odd-sized AES block handling

We verified that the data block is properly sized modulo
AES_BLOCK_SIZE within qcrypto_builtin_cipher_{en,de}crypt.
Therefore we will never have to handle odd sized blocks.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agocrypto: Constify cipher data tables
Richard Henderson [Fri, 28 Aug 2020 17:05:16 +0000 (10:05 -0700)]
crypto: Constify cipher data tables

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agocrypto: Move cipher->driver init to qcrypto_*_cipher_ctx_new
Richard Henderson [Fri, 28 Aug 2020 17:05:15 +0000 (10:05 -0700)]
crypto: Move cipher->driver init to qcrypto_*_cipher_ctx_new

The class vtable should be set by the class initializer.
This will also allow additional subclassing, reducing the
amount of indirection in the hierarchy.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agocrypto: Allocate QCryptoCipher with the subclass
Richard Henderson [Fri, 28 Aug 2020 17:05:14 +0000 (10:05 -0700)]
crypto: Allocate QCryptoCipher with the subclass

Merge the allocation of "opaque" into the allocation of "cipher".
This is step one in reducing the indirection in these classes.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agocrypto: Use the correct const type for driver
Richard Henderson [Fri, 28 Aug 2020 17:05:13 +0000 (10:05 -0700)]
crypto: Use the correct const type for driver

This allows the in memory structures to be read-only.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agocrypto: Move QCryptoCipherDriver typedef to crypto/cipher.h
Richard Henderson [Fri, 28 Aug 2020 17:05:12 +0000 (10:05 -0700)]
crypto: Move QCryptoCipherDriver typedef to crypto/cipher.h

Allow the use in QCryptoCipher to be properly typed with
the opaque struct pointer.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agocrypto/nettle: Fix xts_encrypt arguments
Richard Henderson [Fri, 28 Aug 2020 17:05:11 +0000 (10:05 -0700)]
crypto/nettle: Fix xts_encrypt arguments

The fourth argument to xts_encrypt should be the decrypt
callback; we were accidentally passing encrypt twice.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agocrypto: Remove redundant includes
Richard Henderson [Fri, 28 Aug 2020 17:05:10 +0000 (10:05 -0700)]
crypto: Remove redundant includes

Both qemu/osdep.h and cipherpriv.h have already been
included by the parent cipher.c.

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agocrypto: Rename cipher include files to .c.inc
Richard Henderson [Fri, 28 Aug 2020 17:05:09 +0000 (10:05 -0700)]
crypto: Rename cipher include files to .c.inc

QEMU standard procedure for included c files is to use *.c.inc.
E.g. there are a different set of checks that are applied.

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agocrypto: Assume blocksize is a power of 2
Richard Henderson [Fri, 28 Aug 2020 17:05:08 +0000 (10:05 -0700)]
crypto: Assume blocksize is a power of 2

The check in the encode/decode path using full division has a
noticeable amount of overhead.  By asserting the blocksize is
a power of 2, we can reduce this check to a mask.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agotests: fix output message formatting for crypto benchmarks
Daniel P. Berrangé [Wed, 9 Sep 2020 12:01:45 +0000 (13:01 +0100)]
tests: fix output message formatting for crypto benchmarks

The output was changed from g_print to g_test_message in

  commit 24441f912e67233d9c52ce6b459ed75de2484525
  Author: Marc-André Lureau <marcandre.lureau@redhat.com>
  Date:   Fri Aug 28 15:07:30 2020 +0400

    tests: do not print benchmark output to stdout

    As this makes the TAP output invalid. Use g_test_message().

The functions do not result in equivalent output. The g_print
statements were putting all the information on a single line
for ease of interpretation. The change to g_test_message split
the output across many lines making it painful to read.

The opportunity is used to tweak the information printed to be
more consistent across tests.

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
3 years agoplugins: move the more involved plugins to contrib
Alex Bennée [Wed, 9 Sep 2020 11:27:41 +0000 (12:27 +0100)]
plugins: move the more involved plugins to contrib

We have an exploding complexity problem in the testing so lets just
move the more involved plugins into contrib. tests/plugins still exist
for the basic plugins that exercise the API. We restore the old
pre-meson style Makefile for contrib as it also doubles as a guide for
out-of-tree plugin builds.

While we are at it add some examples to the documentation and a
specific plugins build target.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20200909112742.25730-11-alex.bennee@linaro.org>

3 years agotests/acceptance: Add Test.fetch_asset(cancel_on_missing=True)
Philippe Mathieu-Daudé [Wed, 9 Sep 2020 11:27:40 +0000 (12:27 +0100)]
tests/acceptance: Add Test.fetch_asset(cancel_on_missing=True)

Invert the default of avocado.Test.fetch_asset 'cancel_on_missing'
keyword: accept missing artefacts by default. If a test is certain
an artifact can't be missing, it will set cancel_on_missing=False.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20200908202352.298506-3-philmd@redhat.com>
Message-Id: <20200909112742.25730-10-alex.bennee@linaro.org>

3 years agotests: bump avocado version
Pavel Dovgalyuk [Wed, 9 Sep 2020 11:27:39 +0000 (12:27 +0100)]
tests: bump avocado version

Reverse debugging test uses gdb remote client of avocado framework.
This client was fixed since the currently used version 76.
Therefore this patch bumps the version to 81 and fixes command
line version compatibility issue.

Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Cleber Rosa <crosa@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
Reviewed-by: Cleber Rosa <crosa@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <159903462803.28509.16851113546106095750.stgit@pasha-ThinkPad-X280>
Message-Id: <20200908202352.298506-2-philmd@redhat.com>
Message-Id: <20200909112742.25730-9-alex.bennee@linaro.org>

3 years agohw/i386: make explicit clearing of pch_rev_id
Alex Bennée [Wed, 9 Sep 2020 11:27:38 +0000 (12:27 +0100)]
hw/i386: make explicit clearing of pch_rev_id

Some compilers (notably the Xenial gcc in Travis) fail to spot that
this will always be set if pch_dev_id != 0xffff. Given this is setup
code and using _Pragma to override is equally as ugly lets just remove
the doubt from the compilers mind.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200909112742.25730-8-alex.bennee@linaro.org>

3 years agoconfigure: don't enable ppc64abi32-linux-user by default
Alex Bennée [Wed, 9 Sep 2020 11:27:37 +0000 (12:27 +0100)]
configure: don't enable ppc64abi32-linux-user by default

The user can still enable this explicitly but they will get a warning
at the end of configure for their troubles. This also drops any builds
of ppc64abi32 from our CI tests.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20200909112742.25730-7-alex.bennee@linaro.org>

3 years agodocs/system/deprecated: mark ppc64abi32-linux-user for deprecation
Alex Bennée [Wed, 9 Sep 2020 11:27:36 +0000 (12:27 +0100)]
docs/system/deprecated: mark ppc64abi32-linux-user for deprecation

It's buggy and we are not sure anyone uses it.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Message-Id: <20200909112742.25730-6-alex.bennee@linaro.org>

3 years agotarget/mips: simplify gen_compute_imm_branch logic
Alex Bennée [Wed, 9 Sep 2020 11:27:35 +0000 (12:27 +0100)]
target/mips: simplify gen_compute_imm_branch logic

One of the Travis builds was complaining about:

  qemu/include/tcg/tcg.h:437:12: error: ‘cond’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
       return (TCGCond)(c ^ 1);
  ../target/mips/translate.c:20031:13: note: ‘cond’ was declared here
       TCGCond cond;

Rather than figure out exactly which one was causing the complaint I
just defaulted to TCG_COND_ALWAYS and allowed that state to double up
for the now defunct bcond_compute variable.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20200909112742.25730-5-alex.bennee@linaro.org>

3 years agotests/meson.build: fp tests don't need CONFIG_TCG
Alex Bennée [Wed, 9 Sep 2020 11:27:34 +0000 (12:27 +0100)]
tests/meson.build: fp tests don't need CONFIG_TCG

As the tests build only softfloat.c no actual TCG machinary is needed
to test them (as is evidenced by GCC check-softfloat). Might as well
fix the wording on Travis while at it.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20200909112742.25730-4-alex.bennee@linaro.org>

3 years agousb-host: restrict workaround to new libusb versions
Gerd Hoffmann [Wed, 9 Sep 2020 11:27:33 +0000 (12:27 +0100)]
usb-host: restrict workaround to new libusb versions

Fixes build failures with old kernels (USBDEVFS_GET_SPEED missing),
on the assumtion that distros with old kernels also have old libusb.

Reported-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200902081445.3291-1-kraxel@redhat.com>
Message-Id: <20200909112742.25730-3-alex.bennee@linaro.org>

3 years agoCODING_STYLE.rst: flesh out our naming conventions.
Alex Bennée [Wed, 9 Sep 2020 11:27:32 +0000 (12:27 +0100)]
CODING_STYLE.rst: flesh out our naming conventions.

Mention a few of the more common naming conventions we follow in the
code base including common variable names and function prefix and
suffix examples.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20200909112742.25730-2-alex.bennee@linaro.org>

3 years agoblock/qcow2-cluster: Add missing "fallthrough" annotation
Thomas Huth [Tue, 8 Sep 2020 07:00:28 +0000 (09:00 +0200)]
block/qcow2-cluster: Add missing "fallthrough" annotation

When compiling with -Werror=implicit-fallthrough, the compiler currently
complains:

../../devel/qemu/block/qcow2-cluster.c: In function ‘cluster_needs_new_alloc’:
../../devel/qemu/block/qcow2-cluster.c:1320:12: error: this statement may fall
 through [-Werror=implicit-fallthrough=]
         if (l2_entry & QCOW_OFLAG_COPIED) {
            ^
../../devel/qemu/block/qcow2-cluster.c:1323:5: note: here
     case QCOW2_CLUSTER_UNALLOCATED:
     ^~~~

It's quite obvious that the fallthrough is intended here, so let's add
a comment to silence the compiler warning.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20200908070028.193298-1-thuth@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
3 years agoblock/nvme: Pair doorbell registers
Philippe Mathieu-Daudé [Fri, 4 Sep 2020 12:41:30 +0000 (14:41 +0200)]
block/nvme: Pair doorbell registers

For each queue doorbell registers are paired as:
- Submission Queue Tail Doorbell
- Completion Queue Head Doorbell

Reflect that in the NVMeRegs structure, and adapt
nvme_create_queue_pair() accordingly.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200904124130.583838-4-philmd@redhat.com>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Reviewed-by: Fam Zheng <fam@euphon.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
3 years agoblock/nvme: Use generic NvmeBar structure
Philippe Mathieu-Daudé [Fri, 4 Sep 2020 12:41:29 +0000 (14:41 +0200)]
block/nvme: Use generic NvmeBar structure

Commit f3c507adcd7 ("NVMe: Initial commit for new storage interface")
introduced the NvmeBar structure. Unfortunately in commit bdd6a90a9e5
("block: Add VFIO based NVMe driver") we duplicated it.

Apparently in commit a3d9a352d48 ("block: Move NVMe constants to
a separate header") we tried to unify headers but forgot to remove
the structure declared in the block/nvme.c source file.

Do it now, and remove the structure size check which is redundant
with the header check added in commit 74e18435c0e ("hw/block/nvme:
Align I/O BAR to 4 KiB").

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200904124130.583838-3-philmd@redhat.com>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Reviewed-by: Fam Zheng <fam@euphon.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
3 years agoblock/nvme: Group controller registers in NVMeRegs structure
Philippe Mathieu-Daudé [Fri, 4 Sep 2020 12:41:28 +0000 (14:41 +0200)]
block/nvme: Group controller registers in NVMeRegs structure

We want to use the NvmeBar structure from "block/nvme.h" in the
next commit. As a preliminary step, group all the NVMe controller
registers in the 'ctrl' field, keeping the doorbells registers
out of it.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200904124130.583838-2-philmd@redhat.com>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Reviewed-by: Fam Zheng <fam@euphon.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
3 years agofile-win32: Fix "locking" option
Kevin Wolf [Mon, 7 Sep 2020 09:27:39 +0000 (11:27 +0200)]
file-win32: Fix "locking" option

The intended behaviour was that locking=off/auto work and have no
effect (to remain compatible with file-posix), whereas locking=on would
return an error. Unfortunately, the code forgot to remove "locking" from
the options QDict, so any attempt to use the option would fail.

Replace the option parsing code for "locking" with something that is
part of the raw_runtime_opts QemuOptsList (so it is properly removed
from the QDict) and looks more like file-posix.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20200907092739.9988-1-kwolf@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
3 years agoiotests: Allow running from different directory
Kevin Wolf [Wed, 2 Sep 2020 11:03:26 +0000 (13:03 +0200)]
iotests: Allow running from different directory

It is convenient to be able to edit the tests and run them without
changing the current working directory back and forth. Instead of
assuming that $PWD is the qemu-iotests build directory, derive the build
directory from the executed script.

This allows 'check' to find the required files even when called from
another directory. The scratch directory will still be in the current
working directory.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20200902110326.257115-1-kwolf@redhat.com>
Reviewed-by: Claudio Fontana <cfontana@suse.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
3 years agovirtio-vga: Use typedef name for instance_size
Eduardo Habkost [Mon, 24 Aug 2020 21:59:36 +0000 (17:59 -0400)]
virtio-vga: Use typedef name for instance_size

This makes the code consistent with the rest of QOM code in QEMU,
and will make automated conversion to type declaration macros
simpler.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Message-Id: <20200824215936.2961951-7-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
3 years agovhost-user-vga: Use typedef name for instance_size
Eduardo Habkost [Mon, 24 Aug 2020 21:59:35 +0000 (17:59 -0400)]
vhost-user-vga: Use typedef name for instance_size

This makes the code consistent with the rest of QOM code in QEMU,
and will make automated conversion to type declaration macros
simpler.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20200824215936.2961951-6-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
3 years agoxilinx_axienet: Use typedef name for instance_size
Eduardo Habkost [Mon, 24 Aug 2020 21:59:34 +0000 (17:59 -0400)]
xilinx_axienet: Use typedef name for instance_size

This makes the code consistent with the rest of QOM code in QEMU,
and will make automated conversion to type declaration macros
simpler.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20200824215936.2961951-5-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
3 years agolpc_ich9: Use typedef name for instance_size
Eduardo Habkost [Mon, 24 Aug 2020 21:59:33 +0000 (17:59 -0400)]
lpc_ich9: Use typedef name for instance_size

This makes the code consistent with the rest of QOM code in QEMU,
and will make automated conversion to type declaration macros
simpler.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20200824215936.2961951-4-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
3 years agoomap_intc: Use typedef name for instance_size
Eduardo Habkost [Mon, 24 Aug 2020 21:59:32 +0000 (17:59 -0400)]
omap_intc: Use typedef name for instance_size

This makes the code consistent with the rest of QOM code in QEMU,
and will make automated conversion to type declaration macros
simpler.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20200824215936.2961951-3-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
3 years agoxilinx_axidma: Use typedef name for instance_size
Eduardo Habkost [Mon, 24 Aug 2020 21:59:31 +0000 (17:59 -0400)]
xilinx_axidma: Use typedef name for instance_size

This makes the code consistent with the rest of QOM code in QEMU,
and will make automated conversion to type declaration macros
simpler.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20200824215936.2961951-2-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
3 years agotusb6010: Rename TUSB to TUSB6010
Eduardo Habkost [Thu, 3 Sep 2020 18:01:28 +0000 (14:01 -0400)]
tusb6010: Rename TUSB to TUSB6010

Make type checking function name consistent with the TYPE_TUSB6010
constant and QOM type name ("tusb6010").

Suggested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Suggested-by: "Daniel P. Berrangé" <berrange@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200903180128.1523959-9-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
3 years agopc87312: Rename TYPE_PC87312_SUPERIO to TYPE_PC87312
Eduardo Habkost [Wed, 2 Sep 2020 22:42:28 +0000 (18:42 -0400)]
pc87312: Rename TYPE_PC87312_SUPERIO to TYPE_PC87312

This will make the type name constant consistent with the name of
the type checking macro.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Hervé Poussineau <hpoussin@reactos.org>
Message-Id: <20200902224311.1321159-21-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
3 years agovfio: Rename PCI_VFIO to VFIO_PCI
Eduardo Habkost [Wed, 2 Sep 2020 22:43:03 +0000 (18:43 -0400)]
vfio: Rename PCI_VFIO to VFIO_PCI

Make the type checking macro name consistent with the TYPE_*
constant.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Message-Id: <20200902224311.1321159-56-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
3 years agousb: Rename USB_SERIAL_DEV to USB_SERIAL
Eduardo Habkost [Wed, 2 Sep 2020 22:43:01 +0000 (18:43 -0400)]
usb: Rename USB_SERIAL_DEV to USB_SERIAL

Make the type checking macro name consistent with the TYPE_*
constant.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200902224311.1321159-54-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
3 years agosabre: Rename SABRE_DEVICE to SABRE
Eduardo Habkost [Wed, 2 Sep 2020 22:42:56 +0000 (18:42 -0400)]
sabre: Rename SABRE_DEVICE to SABRE

Make the type checking macro name consistent with the TYPE_*
constant.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20200902224311.1321159-49-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
3 years agors6000_mc: Rename RS6000MC_DEVICE to RS6000MC
Eduardo Habkost [Wed, 2 Sep 2020 22:42:55 +0000 (18:42 -0400)]
rs6000_mc: Rename RS6000MC_DEVICE to RS6000MC

Make the type checking macro name consistent with the TYPE_*
constant.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Hervé Poussineau <hpoussin@reactos.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20200902224311.1321159-48-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
3 years agofilter-rewriter: Rename FILTER_COLO_REWRITER to FILTER_REWRITER
Eduardo Habkost [Wed, 2 Sep 2020 22:42:48 +0000 (18:42 -0400)]
filter-rewriter: Rename FILTER_COLO_REWRITER to FILTER_REWRITER

Make the type checking macro name consistent with the TYPE_*
constant.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Zhang Chen <chen.zhang@intel.com>
Message-Id: <20200902224311.1321159-41-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
3 years agoesp: Rename ESP_STATE to ESP
Eduardo Habkost [Wed, 2 Sep 2020 22:42:47 +0000 (18:42 -0400)]
esp: Rename ESP_STATE to ESP

Make the type checking macro name consistent with the TYPE_*
constant.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Hervé Poussineau <hpoussin@reactos.org>
Message-Id: <20200902224311.1321159-40-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
3 years agoahci: Rename ICH_AHCI to ICH9_AHCI
Eduardo Habkost [Wed, 2 Sep 2020 22:42:40 +0000 (18:42 -0400)]
ahci: Rename ICH_AHCI to ICH9_AHCI

Make the type checking macro name consistent with the TYPE_*
constant.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200902224311.1321159-33-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
3 years agovmgenid: Rename VMGENID_DEVICE to TYPE_VMGENID
Eduardo Habkost [Wed, 2 Sep 2020 22:42:18 +0000 (18:42 -0400)]
vmgenid: Rename VMGENID_DEVICE to TYPE_VMGENID

This will make the type name constant consistent with the name of
the type checking macro.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200902224311.1321159-11-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
3 years agovfio: Rename VFIO_AP_DEVICE_TYPE to TYPE_VFIO_AP_DEVICE
Eduardo Habkost [Wed, 2 Sep 2020 22:42:16 +0000 (18:42 -0400)]
vfio: Rename VFIO_AP_DEVICE_TYPE to TYPE_VFIO_AP_DEVICE

This will make the type name constant consistent with the name of
the type checking macro.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20200902224311.1321159-9-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
3 years agodev-smartcard-reader: Rename CCID_DEV_NAME to TYPE_USB_CCID_DEV
Eduardo Habkost [Wed, 2 Sep 2020 22:42:14 +0000 (18:42 -0400)]
dev-smartcard-reader: Rename CCID_DEV_NAME to TYPE_USB_CCID_DEV

This will make the type name constant consistent with the name of
the type checking macro.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200902224311.1321159-7-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
3 years agoap-device: Rename AP_DEVICE_TYPE to TYPE_AP_DEVICE
Eduardo Habkost [Wed, 2 Sep 2020 22:42:13 +0000 (18:42 -0400)]
ap-device: Rename AP_DEVICE_TYPE to TYPE_AP_DEVICE

This will make the type name constant consistent with the name of
the type checking macro.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20200902224311.1321159-6-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
3 years agotrace-events: Fix attribution of trace points to source
Markus Armbruster [Thu, 6 Aug 2020 14:13:34 +0000 (16:13 +0200)]
trace-events: Fix attribution of trace points to source

Some trace points are attributed to the wrong source file.  Happens
when we neglect to update trace-events for code motion, or add events
in the wrong place, or misspell the file name.

Clean up with help of scripts/cleanup-trace-events.pl.  Funnies
requiring manual post-processing:

* accel/tcg/cputlb.c trace points are in trace-events.

* block.c and blockdev.c trace points are in block/trace-events.

* hw/block/nvme.c uses the preprocessor to hide its trace point use
  from cleanup-trace-events.pl.

* hw/tpm/tpm_spapr.c uses pseudo trace point tpm_spapr_show_buffer to
  guard debug code.

* include/hw/xen/xen_common.h trace points are in hw/xen/trace-events.

* linux-user/trace-events abbreviates a tedious list of filenames to
  */signal.c.

* net/colo-compare and net/filter-rewriter.c use pseudo trace points
  colo_compare_miscompare and colo_filter_rewriter_debug to guard
  debug code.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20200806141334.3646302-5-armbru@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
3 years agotrace-events: Delete unused trace points
Markus Armbruster [Thu, 6 Aug 2020 14:13:33 +0000 (16:13 +0200)]
trace-events: Delete unused trace points

Tracked down with the help of scripts/cleanup-trace-events.pl.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-id: 20200806141334.3646302-4-armbru@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
3 years agoscripts/cleanup-trace-events: Emit files in alphabetical order
Markus Armbruster [Thu, 6 Aug 2020 14:13:32 +0000 (16:13 +0200)]
scripts/cleanup-trace-events: Emit files in alphabetical order

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-id: 20200806141334.3646302-3-armbru@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
3 years agoscripts/cleanup-trace-events: Fix for vcpu property
Markus Armbruster [Thu, 6 Aug 2020 14:13:31 +0000 (16:13 +0200)]
scripts/cleanup-trace-events: Fix for vcpu property

Commit a44cf524f8 "scripts/cleanup-trace-events: Update for current
practice" limited search to the input file's directory.  That's wrong
for events with the vcpu property, because these can only be defined
in root directory.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-id: 20200806141334.3646302-2-armbru@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
3 years agonet/colo: Match is-enabled probe to tracepoint
Roman Bolshakov [Fri, 17 Jul 2020 09:35:17 +0000 (12:35 +0300)]
net/colo: Match is-enabled probe to tracepoint

Build of QEMU with dtrace fails on macOS:

  LINK    x86_64-softmmu/qemu-system-x86_64
error: probe colo_compare_miscompare doesn't exist
error: Could not register probes
ld: error creating dtrace DOF section for architecture x86_64

The reason of the error is explained by Adam Leventhal [1]:

  Note that is-enabled probes don't have the stability magic so I'm not
  sure how things would work if only is-enabled probes were used.

net/colo code uses is-enabled probes to determine if other probes should
be used but colo_compare_miscompare itself is not used explicitly.
Linker doesn't include the symbol and build fails.

The issue can be resolved if is-enabled probe matches the actual trace
point that is used inside the test. Packet dump toggle is replaced with
a compile-time conditional definition.

1. http://markmail.org/message/6grq2ygr5nwdwsnb

Fixes: f4b618360e ("colo-compare: add TCP, UDP, ICMP packet comparison")
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: Cameron Esfahani <dirty@apple.com>
Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Zhang Chen <chen.zhang@intel.com>
Message-id: 20200717093517.73397-5-r.bolshakov@yadro.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
3 years agoscripts/tracetool: Use void pointer for vcpu
Roman Bolshakov [Fri, 17 Jul 2020 09:35:15 +0000 (12:35 +0300)]
scripts/tracetool: Use void pointer for vcpu

dtrace on macOS complains that CPUState * is used for a few probes:

  dtrace: failed to compile script trace-dtrace-root.dtrace: line 130: syntax error near "CPUState"

A comment in scripts/tracetool/__init__.py mentions that:

  We only want to allow standard C types or fixed sized
  integer types. We don't want QEMU specific types
  as we can't assume trace backends can resolve all the
  typedefs

Fixes: 3d211d9f4dbee ("trace: Add 'vcpu' event property to trace guest vCPU")
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Message-id: 20200717093517.73397-3-r.bolshakov@yadro.com
Cc: Cameron Esfahani <dirty@apple.com>
Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
3 years agoscripts/tracetool: Fix dtrace generation for macOS
Roman Bolshakov [Fri, 17 Jul 2020 09:35:14 +0000 (12:35 +0300)]
scripts/tracetool: Fix dtrace generation for macOS

dtrace USDT is fully supported since OS X 10.6. There are a few
peculiarities compared to other dtrace flavors.

1. It doesn't accept empty files.
2. It doesn't recognize bool type but accepts C99 _Bool.
3. It converts int8_t * in probe points to char * in
   header files and introduces [-Wpointer-sign] warning.

Cc: Cameron Esfahani <dirty@apple.com>
Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20200717093517.73397-2-r.bolshakov@yadro.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
3 years agosoftmmu: Add missing trace-events file
Philippe Mathieu-Daudé [Wed, 5 Aug 2020 13:02:20 +0000 (15:02 +0200)]
softmmu: Add missing trace-events file

Commit c7f419f584 moved softmmu-only files out of the root
directory, but forgot to move the trace events, which should
no longer be generated to "trace-root.h". Fix that by adding
softmmu/trace-events.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Claudio Fontana <cfontana@suse.de>
Reviewed-by: Claudio Fontana <cfontana@suse.de>
Message-id: 20200805130221.24487-1-philmd@redhat.com

[Rebased onto meson.
--Stefan]

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
3 years agohw/gpio/max7310: Replace disabled printf() by qemu_log_mask(UNIMP)
Philippe Mathieu-Daudé [Tue, 1 Sep 2020 10:42:34 +0000 (12:42 +0200)]
hw/gpio/max7310: Replace disabled printf() by qemu_log_mask(UNIMP)

Replace disabled printf() by qemu_log_mask(UNIMP).

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20200901104234.92159-3-f4bug@amsat.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
3 years agohw/gpio/omap_gpio: Replace fprintf() by qemu_log_mask(GUEST_ERROR)
Philippe Mathieu-Daudé [Tue, 1 Sep 2020 10:42:33 +0000 (12:42 +0200)]
hw/gpio/omap_gpio: Replace fprintf() by qemu_log_mask(GUEST_ERROR)

Replace fprintf() by qemu_log_mask(LOG_GUEST_ERROR).

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20200901104234.92159-2-f4bug@amsat.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
3 years agogpex: Fix type checking function name
Eduardo Habkost [Wed, 2 Sep 2020 22:42:09 +0000 (18:42 -0400)]
gpex: Fix type checking function name

This looks like a copy/paste mistake: the instance type checking
macro for TYPE_GPEX_ROOT_DEVICE was named MCH_PCI_DEVICE.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200902224311.1321159-2-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
3 years agoUse OBJECT_DECLARE_SIMPLE_TYPE when possible
Eduardo Habkost [Mon, 31 Aug 2020 21:07:40 +0000 (17:07 -0400)]
Use OBJECT_DECLARE_SIMPLE_TYPE when possible

Generated using:

 $ ./scripts/codeconverter/converter.py -i \
   --pattern=ObjectDeclareType $(git grep -l '' -- '*.[ch]')

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20200831210740.126168-19-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
3 years agoUse OBJECT_DECLARE_TYPE where possible
Eduardo Habkost [Mon, 31 Aug 2020 21:07:37 +0000 (17:07 -0400)]
Use OBJECT_DECLARE_TYPE where possible

Replace DECLARE_OBJ_CHECKERS with OBJECT_DECLARE_TYPE where the
typedefs can be safely removed.

Generated running:

$ ./scripts/codeconverter/converter.py -i \
  --pattern=DeclareObjCheckers $(git grep -l '' -- '*.[ch]')

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20200831210740.126168-16-ehabkost@redhat.com>
Message-Id: <20200831210740.126168-17-ehabkost@redhat.com>
Message-Id: <20200831210740.126168-18-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
3 years agoUse DECLARE_*CHECKER* when possible (--force mode)
Eduardo Habkost [Mon, 31 Aug 2020 21:07:36 +0000 (17:07 -0400)]
Use DECLARE_*CHECKER* when possible (--force mode)

Separate run of the TypeCheckMacro converter using the --force
flag, for the cases where typedefs weren't found in the same
header nor in typedefs.h.

Generated initially using:

 $ ./scripts/codeconverter/converter.py --force -i \
   --pattern=TypeCheckMacro $(git grep -l '' -- '*.[ch]')

Then each case was manually reviewed, and a comment was added
indicating what's unusual about those type checking
macros/functions.  Despite not following the usual pattern, the
changes in this patch were found to be safe.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20200831210740.126168-15-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
3 years agoUse DECLARE_*CHECKER* macros
Eduardo Habkost [Mon, 31 Aug 2020 21:07:33 +0000 (17:07 -0400)]
Use DECLARE_*CHECKER* macros

Generated using:

 $ ./scripts/codeconverter/converter.py -i \
   --pattern=TypeCheckMacro $(git grep -l '' -- '*.[ch]')

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Message-Id: <20200831210740.126168-12-ehabkost@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Message-Id: <20200831210740.126168-13-ehabkost@redhat.com>
Message-Id: <20200831210740.126168-14-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
3 years agoMove QOM typedefs and add missing includes
Eduardo Habkost [Thu, 3 Sep 2020 20:43:22 +0000 (16:43 -0400)]
Move QOM typedefs and add missing includes

Some typedefs and macros are defined after the type check macros.
This makes it difficult to automatically replace their
definitions with OBJECT_DECLARE_TYPE.

Patch generated using:

 $ ./scripts/codeconverter/converter.py -i \
   --pattern=QOMStructTypedefSplit $(git grep -l '' -- '*.[ch]')

which will split "typdef struct { ... } TypedefName"
declarations.

Followed by:

 $ ./scripts/codeconverter/converter.py -i --pattern=MoveSymbols \
    $(git grep -l '' -- '*.[ch]')

which will:
- move the typedefs and #defines above the type check macros
- add missing #include "qom/object.h" lines if necessary

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Message-Id: <20200831210740.126168-9-ehabkost@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Message-Id: <20200831210740.126168-10-ehabkost@redhat.com>
Message-Id: <20200831210740.126168-11-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
3 years agohw/acpi/tco: Remove unused definitions
Philippe Mathieu-Daudé [Tue, 1 Sep 2020 10:19:50 +0000 (12:19 +0200)]
hw/acpi/tco: Remove unused definitions

TCO_DEBUG() and DEBUG definitions are not used, remove them.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20200901101951.85892-1-f4bug@amsat.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
3 years agohw/isa/isa-bus: Replace hw_error() by assert()
Philippe Mathieu-Daudé [Tue, 1 Sep 2020 10:40:43 +0000 (12:40 +0200)]
hw/isa/isa-bus: Replace hw_error() by assert()

As we can never have more than ISA_NUM_IRQS (16) ISA IRQs,
replace the not very interesting hw_error() call by an
assert() which is more useful to debug condition that can
not happen.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20200901104043.91383-6-f4bug@amsat.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
3 years agohw/mips/fuloong2e: Convert pointless error message to an assert()
Philippe Mathieu-Daudé [Tue, 1 Sep 2020 10:40:40 +0000 (12:40 +0200)]
hw/mips/fuloong2e: Convert pointless error message to an assert()

Displaying "vt82c686b_init error" doesn't give any hint about why
this call failed. As this message targets developers and not users,
replace the pointless error message by a call to assert() which
will provide more useful information.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Huacai Chen <chenhc@lemote.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20200901104043.91383-3-f4bug@amsat.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
3 years agoDelete duplicate QOM typedefs
Eduardo Habkost [Mon, 31 Aug 2020 21:07:29 +0000 (17:07 -0400)]
Delete duplicate QOM typedefs

Generated using:

 $ ./scripts/codeconverter/converter.py -i \
   --pattern=QOMDuplicatedTypedefs $(git grep -l '' -- '*.[ch]')

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20200831210740.126168-8-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
3 years agocodeconverter: script for automating QOM code cleanups
Eduardo Habkost [Mon, 31 Aug 2020 21:07:28 +0000 (17:07 -0400)]
codeconverter: script for automating QOM code cleanups

This started as a simple script that scanned for regular
expressions, but became more and more complex when exceptions to
the rules were found.

I don't know if this should be maintained in the QEMU source tree
long term (maybe it can be reused for other code transformations
that Coccinelle can't handle).  In either case, this is included
as part of the patch series to document how exactly the automated
code transformations in the next patches were done.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20200831210740.126168-7-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
3 years agoqom: Make type checker functions accept const pointers
Eduardo Habkost [Mon, 31 Aug 2020 21:07:27 +0000 (17:07 -0400)]
qom: Make type checker functions accept const pointers

The existing type check macros all unconditionally drop const
qualifiers from their arguments.  Keep this behavior in the
macros generated by DECLARE_*CHECKER* by now.

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20200831210740.126168-6-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
3 years agoqom: DECLARE_*_CHECKERS macros
Eduardo Habkost [Mon, 31 Aug 2020 21:07:26 +0000 (17:07 -0400)]
qom: DECLARE_*_CHECKERS macros

Sometimes the typedefs are buried inside another header, but
we want to benefit from the automatic definition of type cast
functions.  Introduce macros that will let type checkers be
defined when typedefs are already available.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20200831210740.126168-5-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
3 years agoqom: Allow class type name to be specified in OBJECT_DECLARE*
Eduardo Habkost [Mon, 31 Aug 2020 21:07:25 +0000 (17:07 -0400)]
qom: Allow class type name to be specified in OBJECT_DECLARE*

Many QOM types don't follow the Type/TypeClass pattern
on the instance/struct names.  Let the class struct name
be specified in the OBJECT_DECLARE* macros.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20200831210740.126168-4-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
3 years agoqom: provide convenient macros for declaring and defining types
Daniel P. Berrangé [Mon, 31 Aug 2020 21:07:24 +0000 (17:07 -0400)]
qom: provide convenient macros for declaring and defining types

When creating new QOM types, there is a lot of boilerplate code that
must be repeated using a standard pattern. This is tedious to write
and liable to suffer from subtle inconsistencies. Thus it would
benefit from some simple automation.

QOM was loosely inspired by GLib's GObject, and indeed GObject suffers
from the same burden of boilerplate code, but has long provided a set of
macros to eliminate this burden in the source implementation. More
recently it has also provided a set of macros to eliminate this burden
in the header declaration.

In GLib there are the G_DECLARE_* and G_DEFINE_* family of macros
for the header declaration and source implementation respectively:

  https://developer.gnome.org/gobject/stable/chapter-gobject.html
  https://developer.gnome.org/gobject/stable/howto-gobject.html

This patch takes inspiration from GObject to provide the equivalent
functionality for QOM.

In the header file, instead of:

    typedef struct MyDevice MyDevice;
    typedef struct MyDeviceClass MyDeviceClass;

    G_DEFINE_AUTOPTR_CLEANUP_FUNC(MyDeviceClass, object_unref)

    #define MY_DEVICE_GET_CLASS(void *obj) \
            OBJECT_GET_CLASS(MyDeviceClass, obj, TYPE_MY_DEVICE)
    #define MY_DEVICE_CLASS(void *klass) \
            OBJECT_CLASS_CHECK(MyDeviceClass, klass, TYPE_MY_DEVICE)
    #define MY_DEVICE(void *obj)
            OBJECT_CHECK(MyDevice, obj, TYPE_MY_DEVICE)

    struct MyDeviceClass {
        DeviceClass parent_class;
    };

We now have

    OBJECT_DECLARE_SIMPLE_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE)

In cases where the class needs some virtual methods, it can be left
to be implemented manually using

    OBJECT_DECLARE_TYPE(MyDevice, my_device, MY_DEVICE)

Note that these macros are including support for g_autoptr() for the
object types, which is something previously only supported for variables
declared as the base Object * type.

Meanwhile in the source file, instead of:

    static void my_device_finalize(Object *obj);
    static void my_device_class_init(ObjectClass *oc, void *data);
    static void my_device_init(Object *obj);

    static const TypeInfo my_device_info = {
        .parent = TYPE_DEVICE,
        .name = TYPE_MY_DEVICE,
        .instance_size = sizeof(MyDevice),
        .instance_init = my_device_init,
        .instance_finalize = my_device_finalize,
        .class_size = sizeof(MyDeviceClass),
        .class_init = my_device_class_init,
    };

    static void
    my_device_register_types(void)
    {
        type_register_static(&my_device_info);
    }
    type_init(my_device_register_types);

We now have

    OBJECT_DEFINE_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE)

Or, if a class needs to implement interfaces:

    OBJECT_DEFINE_TYPE_WITH_INTERFACES(MyDevice, my_device, MY_DEVICE, DEVICE,
                                       { TYPE_USER_CREATABLE }, { NULL })

Or, if a class needs to be abstract

    OBJECT_DEFINE_ABSTRACT_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE)

IOW, in both cases the maintainer now only has to think about the
interesting part of the code which implements useful functionality
and avoids much of the boilerplate.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20200723181410.3145233-3-berrange@redhat.com>
[ehabkost: Fix G_DEFINE_AUTOPTR_CLEANUP_FUNC usage]
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20200831210740.126168-3-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
3 years agoqom: make object_ref/unref use a void * instead of Object *.
Daniel P. Berrangé [Mon, 31 Aug 2020 21:07:23 +0000 (17:07 -0400)]
qom: make object_ref/unref use a void * instead of Object *.

The object_ref/unref methods are intended for use with any subclass of
the base Object. Using "Object *" in the signature is not adding any
meaningful level of type safety, since callers simply use "OBJECT(ptr)"
and this expands to an unchecked cast "(Object *)".

By using "void *" we enable the object_unref() method to be used to
provide support for g_autoptr() with any subclass.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20200723181410.3145233-2-berrange@redhat.com>
Message-Id: <20200831210740.126168-2-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
3 years agomemory: Remove kernel-doc comment marker
Eduardo Habkost [Tue, 8 Sep 2020 17:36:50 +0000 (13:36 -0400)]
memory: Remove kernel-doc comment marker

The IOMMUMemoryRegionClass struct documentation was never in the
kernel-doc format.  Stop pretending it is, by removing the "/**"
comment marker.

This fixes a documentation build error introduced when we split
the IOMMUMemoryRegionClass typedef from the struct declaration.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200908173650.3293057-1-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
3 years agoMerge remote-tracking branch 'remotes/kraxel/tags/sirius/ipxe-20200908-pull-request...
Peter Maydell [Tue, 8 Sep 2020 20:21:13 +0000 (21:21 +0100)]
Merge remote-tracking branch 'remotes/kraxel/tags/sirius/ipxe-20200908-pull-request' into staging

ipxe: update to aug 2020 snapshot.

# gpg: Signature made Tue 08 Sep 2020 07:09:26 BST
# gpg:                using RSA key 4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full]
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>" [full]
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full]
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/sirius/ipxe-20200908-pull-request:
  ipxe: update binaries
  ipxe: drop ia32 efi roms
  ipxe: update submodule

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>