All of lore.kernel.org
 help / color / mirror / Atom feed
* [PULL 00/92] Misc patches for 2020-09-24
@ 2020-09-24  9:21 Paolo Bonzini
  2020-09-24  9:21 ` [PULL 01/92] tests: add missing genh dependency Paolo Bonzini
                   ` (93 more replies)
  0 siblings, 94 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:21 UTC (permalink / raw)
  To: qemu-devel

The following changes since commit 0fc0142828b5bc965790a1c5c6e241897d3387cb:

  Merge remote-tracking branch 'remotes/kraxel/tags/input-20200921-pull-request' into staging (2020-09-22 21:11:10 +0100)

are available in the Git repository at:

  https://gitlab.com/bonzini/qemu.git tags/for-upstream

for you to fetch changes up to f40b138ec74bfdaf50f77e46e4b9c10a38f43db6:

  Merge tag 'pull-cap-20200922' of https://github.com/rth7680/qemu into HEAD (2020-09-23 14:39:20 -0400)

----------------------------------------------------------------
* SCSI fix (Dmitry, Li Feng, Li Qiang)
* memory API fixes (Eduardo)
* removal of deprecated '-numa node', 'cpu-add', '-smp' (Igor)
* ACPI fix for VMBus (Jon)
* relocatable install (myself)
* always remove docker containers (myself)
* serial cleanups (Philippe)
* vmware cpuid leaf for tsc and apic frequency (Sunil)
* KVM_FEATURE_ASYNC_PF_INT support (Vitaly)
* i386 XSAVE bugfix (Xiaoyao)
* QOM developer documentation in docs/devel (Eduardo)
* new checkpatch tests (Dov)
* x86_64 syscall fix (Douglas)
* interrupt-based APF fix (Vitaly)
* always create kvmclock (Vitaly)
* fix bios-tables-test (Eduardo)
* KVM PV features cleanup (myself)
* CAN FD (Pavel)

meson:
* fixes (Marc-André, Max, Stefan, Alexander, myself)
* submodule and environment CFLAGS overhaul (myself)
* moved libmpathpersist, cocoa, malloc tests (myself)
* support for 0.56 introspected test dependencies (myself)

----------------------------------------------------------------
Alexander Bulekov (1):
      oss-fuzz: move linker arg to fix coverage-build

Anthony PERARD (1):
      meson: fix installation of keymaps

Claudio Fontana (1):
      tests: add missing genh dependency

Daniel P. Berrangé (1):
      char: fix logging when chardev write fails

Dmitry Fomichev (1):
      scsi-generic: Fix HM-zoned device scan

Douglas Crosher (1):
      helper_syscall x86_64: clear exception_is_int

Dov Murik (1):
      checkpatch: Detect '%#' or '%0#' in printf-style format strings

Eduardo Habkost (10):
      memory: Convert IOMMUMemoryRegionClass doc comment to kernel-doc
      qom: Document all function parameters in doc comments
      qom: Use kernel-doc private/public tags in structs
      qom: Use ``code`` Sphinx syntax where appropriate
      qom: Add kernel-doc markup to introduction doc comment
      qom: Reformat section titles using Sphinx syntax
      qom: Indent existing code examples
      qom: Add code block markup to all code blocks
      docs: Create docs/devel/qom.rst
      bios-tables-test: Remove kernel-irqchip=off option

Igor Mammedov (5):
      numa: drop support for '-numa node' (without memory specified)
      doc: Cleanup "'-mem-path' fallback to RAM" deprecation text
      numa: remove fixup numa_state->num_nodes to MAX_NODES
      smp: drop support for deprecated (invalid topologies)
      cphp: remove deprecated cpu-add command(s)

Jan Charvat (5):
      net/can: Initial host SocketCan support for CAN FD.
      hw/net/can: sja1000 ignore CAN FD frames
      net/can: Add can_dlc2len and can_len2dlc for CAN FD.
      hw/net/can/ctucafd: Add CTU CAN FD core register definitions.
      hw/net/can: CTU CAN FD IP open hardware core emulation.

Jon Doron (1):
      acpi: i386: Move VMBus DSDT entry to SB

Li Feng (1):
      vhost-scsi: support inflight io track

Li Qiang (2):
      hw: megasas: return -1 when 'megasas_map_sgl' fails
      hw: megasas: consider 'iov_count=0' is an error in megasas_map_sgl

Marc-André Lureau (2):
      meson: fix MSI rule
      meson: error out if qemu_suffix starts with /

Paolo Bonzini (34):
      meson: clean up build_by_default
      ninjatool: rebuild multi-output targets if outputs are missing
      meson: move libudev test
      meson: move libmpathpersist test
      meson: extend libmpathpersist test for static linking
      configure: move malloc_trim/tcmalloc/jemalloc to meson
      configure: fix --meson=/path/to/meson
      configure: move cocoa option to Meson
      configure: do not limit Hypervisor.framework test to Darwin
      meson: qtest: set "depends" correctly
      mtest2make: add support for introspected test dependencies
      meson: report accelerator support
      oslib: do not call g_strdup from qemu_get_exec_dir
      fuzz: use qemu_get_exec_dir
      oslib-posix: default exec_dir to bindir
      cutils: introduce get_relocated_path
      oslib-posix: relocate path to /var
      module: relocate path to modules
      net: relocate paths to helpers and scripts
      vl: relocate paths to data directories
      vl: relocate path to configuration file
      qemu-bridge-helper: relocate path to default ACL
      qga: relocate path to default configuration and hook
      ui: relocate paths to icons and translations
      configure: use a platform-neutral prefix
      configure: fix performance regression due to PIC objects
      tests/tcg: reinstate or replace desired parts of rules.mak
      configure: cleanup invocation of submodule Make
      configure: cleanup CFLAGS and LDFLAGS for submodules
      configure: do not clobber environment CFLAGS/CXXFLAGS/LDFLAGS
      configure: consistently pass CFLAGS/CXXFLAGS/LDFLAGS to meson
      docs: Move object.h overview doc comment to qom.rst
      target/i386: kvm: do not use kvm_check_extension to find paravirtual capabilities
      Merge tag 'pull-cap-20200922' of https://github.com/rth7680/qemu into HEAD

Pavel Pisa (2):
      hw/net/can: Documentation for CTU CAN FD IP open hardware core emulation.
      hw/net/can: Correct Kconfig dependencies

Philippe Mathieu-Daudé (16):
      configure: Do not intent to build WHPX on 32-bit host
      hw/mips/mipssim: Use MMIO serial device on fake ISA I/O
      hw/char/serial: Remove TYPE_SERIAL_IO
      hw/char/serial: Assert serial_ioport_read/write offset fits 8 bytes
      hw/char/serial: Replace commented DPRINTF() by trace event
      hw/char/serial: Remove old DEBUG_SERIAL commented code
      hw/char/serial: Rename I/O read/write trace events
      hw/char/serial: Make 'wakeup' property boolean
      hw/char/serial-{isa, pci}: Alias QDEV properties from generic serial object
      hw/i386/q35: Remove unreachable Xen code on Q35 machine
      exec: Remove MemoryRegion::global_locking field
      hw/i386/xen: Rename X86/PC specific function as xen_hvm_init_pc()
      sysemu/xen: Add missing 'exec/cpu-common.h' header for ram_addr_t type
      stubs: Split accelerator / hardware related stubs
      hw/xen: Split x86-specific declaration from generic hardware ones
      typedefs: Restrict PCMachineState to 'hw/i386/pc.h'

Stefan Hajnoczi (2):
      MAINTAINERS: add Paolo Bonzini as RCU maintainer
      configure: rename QEMU_GA_MSI_ENABLED to CONFIG_QGA_MSI

Stefano Garzarella (1):
      checkpatch: avoid error on cover letter files

Sunil Muthuswamy (1):
      WHPX: vmware cpuid leaf for tsc and apic frequency

Vitaly Kuznetsov (3):
      target/i386: support KVM_FEATURE_ASYNC_PF_INT
      target/i386: Fix VM migration when interrupt based APF is enabled
      target/i386: always create kvmclock device

Xiaoyao Li (1):
      i386/cpu: Clear FEAT_XSAVE_COMP_{LO,HI} when XSAVE is not available

 MAINTAINERS                           |  18 +
 Makefile                              |  37 +-
 accel/stubs/xen-stub.c                |  41 +-
 accel/tcg/cputlb.c                    |   4 +-
 accel/tcg/translate-all.c             |  24 +-
 capstone                              |   2 +-
 chardev/char.c                        |  13 +
 configure                             | 377 ++++---------
 disas.c                               | 695 ++++++------------------
 disas/capstone.c                      | 326 ++++++++++++
 disas/meson.build                     |   1 +
 docs/can.txt                          | 113 +++-
 docs/devel/build-system.rst           |   5 +
 docs/devel/index.rst                  |   1 +
 docs/devel/qom.rst                    | 378 +++++++++++++
 docs/system/deprecated.rst            |  95 ++--
 exec.c                                |   2 +-
 hmp-commands.hx                       |  15 -
 hw/char/serial-isa.c                  |   4 +-
 hw/char/serial-pci.c                  |   3 +-
 hw/char/serial.c                      |  65 +--
 hw/char/trace-events                  |   5 +-
 hw/core/machine-hmp-cmds.c            |  12 -
 hw/core/machine-qmp-cmds.c            |  12 -
 hw/core/machine.c                     |  17 +-
 hw/core/numa.c                        |  59 ---
 hw/i386/acpi-build.c                  |  12 +-
 hw/i386/kvm/clock.c                   |   7 +-
 hw/i386/microvm.c                     |   2 +-
 hw/i386/pc.c                          |  44 +-
 hw/i386/pc_piix.c                     |  17 +-
 hw/i386/pc_q35.c                      |  19 +-
 hw/i386/xen/xen-hvm.c                 |   3 +-
 hw/mips/mipssim.c                     |   5 +-
 hw/net/Kconfig                        |  16 +-
 hw/net/can/can_sja1000.c              |  31 +-
 hw/net/can/ctu_can_fd_frame.h         | 189 +++++++
 hw/net/can/ctu_can_fd_regs.h          | 971 ++++++++++++++++++++++++++++++++++
 hw/net/can/ctucan_core.c              | 696 ++++++++++++++++++++++++
 hw/net/can/ctucan_core.h              | 127 +++++
 hw/net/can/ctucan_pci.c               | 281 ++++++++++
 hw/net/can/meson.build                |   2 +
 hw/ppc/spapr.c                        |   1 -
 hw/s390x/s390-virtio-ccw.c            |  12 -
 hw/scsi/megasas.c                     |   6 +-
 hw/scsi/scsi-generic.c                |  10 +-
 hw/scsi/vhost-scsi-common.c           |  27 +
 include/disas/dis-asm.h               | 104 ++--
 include/disas/disas.h                 |   2 +-
 include/exec/log.h                    |   4 +-
 include/exec/memory.h                 |  64 ++-
 include/hw/boards.h                   |   3 -
 include/hw/char/serial.h              |  11 +-
 include/hw/i386/pc.h                  |   8 +-
 include/hw/kvm/clock.h                |   4 +-
 include/hw/virtio/vhost-scsi-common.h |   2 +
 include/hw/xen/xen-x86.h              |  15 +
 include/hw/xen/xen.h                  |   2 -
 include/monitor/hmp.h                 |   1 -
 include/net/can_emu.h                 |  12 +-
 include/net/net.h                     |   4 +-
 include/qemu-common.h                 |   1 -
 include/qemu/cutils.h                 |  12 +
 include/qemu/osdep.h                  |   8 +-
 include/qemu/typedefs.h               |   1 -
 include/qom/object.h                  | 547 ++++---------------
 include/scsi/constants.h              |   1 +
 include/sysemu/numa.h                 |   4 -
 include/sysemu/sysemu.h               |   2 +-
 include/sysemu/xen.h                  |   2 +
 meson.build                           | 339 ++++++++++--
 meson_options.txt                     |  13 +
 net/can/can_core.c                    |  36 ++
 net/can/can_socketcan.c               |  47 +-
 net/tap.c                             |  26 +-
 os-posix.c                            |  24 -
 os-win32.c                            |  11 -
 pc-bios/keymaps/meson.build           |   2 +
 qapi/machine.json                     |  24 -
 qemu-bridge-helper.c                  |   9 +-
 qga/main.c                            |   8 +-
 qga/meson.build                       |   1 +
 scripts/checkpatch.pl                 |  12 +-
 scripts/mtest2make.py                 |  19 +-
 scripts/ninjatool.py                  |   3 +
 softmmu/memory.c                      |   6 -
 softmmu/vl.c                          |  43 +-
 stubs/meson.build                     |   1 +
 stubs/xen-hw-stub.c                   |  50 ++
 target/i386/cpu.c                     |   6 +-
 target/i386/cpu.h                     |   1 +
 target/i386/kvm.c                     |  45 +-
 target/i386/kvm_i386.h                |   1 +
 target/i386/machine.c                 |  19 +
 target/i386/seg_helper.c              |   1 +
 target/i386/whp-dispatch.h            |   3 +-
 target/i386/whpx-all.c                |  96 +++-
 target/s390x/cpu.c                    |   4 +
 tcg/tcg.c                             |   4 +-
 tests/fp/meson.build                  |   2 -
 tests/meson.build                     |   9 +-
 tests/qemu-iotests/meson.build        |   3 +-
 tests/qtest/bios-tables-test.c        |   3 +-
 tests/qtest/cpu-plug-test.c           | 100 +---
 tests/qtest/fuzz/fuzz.c               |  12 +-
 tests/qtest/meson.build               |   8 +-
 tests/qtest/test-hmp.c                |   1 -
 tests/tcg/Makefile.qemu               |  13 +-
 tests/tcg/configure.sh                |   4 +-
 trace/meson.build                     |   1 -
 ui/gtk.c                              |  10 +-
 ui/meson.build                        |   2 +-
 ui/sdl2.c                             |   9 +-
 ui/shader/meson.build                 |   1 -
 util/cutils.c                         |  61 +++
 util/module.c                         |  10 +-
 util/oslib-posix.c                    |  35 +-
 util/oslib-win32.c                    |  14 +-
 118 files changed, 4618 insertions(+), 2150 deletions(-)
 create mode 100644 disas/capstone.c
 create mode 100644 docs/devel/qom.rst
 create mode 100644 hw/net/can/ctu_can_fd_frame.h
 create mode 100644 hw/net/can/ctu_can_fd_regs.h
 create mode 100644 hw/net/can/ctucan_core.c
 create mode 100644 hw/net/can/ctucan_core.h
 create mode 100644 hw/net/can/ctucan_pci.c
 create mode 100644 include/hw/xen/xen-x86.h
 create mode 100644 stubs/xen-hw-stub.c
-- 
2.26.2



^ permalink raw reply	[flat|nested] 101+ messages in thread

* [PULL 01/92] tests: add missing genh dependency
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
@ 2020-09-24  9:21 ` Paolo Bonzini
  2020-09-24  9:21 ` [PULL 02/92] meson: clean up build_by_default Paolo Bonzini
                   ` (92 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Claudio Fontana

From: Claudio Fontana <cfontana@suse.de>

Fix high-parallelism builds by forcing all generated headers
to be created before tests are compiled.

Reported-by: Claudio Fontana <cfontana@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Tested-by: Claudio Fontana <cfontana@suse.de>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 tests/meson.build | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/meson.build b/tests/meson.build
index 8c3e930687..70203890a1 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -56,7 +56,7 @@ test_qapi_files = custom_target('Test QAPI files',
 # perhaps change qapi_gen to replace / with _, like Meson itself does?
 subdir('include')
 
-libtestqapi = static_library('testqapi', sources: [test_qapi_files, test_qapi_outputs_extra])
+libtestqapi = static_library('testqapi', sources: [test_qapi_files, genh, test_qapi_outputs_extra])
 testqapi = declare_dependency(link_with: libtestqapi)
 
 testblock = declare_dependency(dependencies: [block], sources: 'iothread.c')
@@ -229,7 +229,7 @@ foreach test_name, extra: tests
     src += test_ss.all_sources()
     deps += test_ss.all_dependencies()
   endif
-  exe = executable(test_name, src, dependencies: deps)
+  exe = executable(test_name, src, genh, dependencies: deps)
 
   test(test_name, exe,
        depends: test_deps.get(test_name, []),
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 02/92] meson: clean up build_by_default
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
  2020-09-24  9:21 ` [PULL 01/92] tests: add missing genh dependency Paolo Bonzini
@ 2020-09-24  9:21 ` Paolo Bonzini
  2020-09-24  9:21 ` [PULL 03/92] ninjatool: rebuild multi-output targets if outputs are missing Paolo Bonzini
                   ` (91 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: Max Reitz

Build all executables by default except for the known-broken ones.

This also allows running qemu-iotests without manually building
socket_scm_helper.

Reported-by: Max Reitz <mreitz@redhat.com>
Tested-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 docs/devel/build-system.rst    | 5 +++++
 tests/fp/meson.build           | 2 --
 tests/meson.build              | 5 ++---
 tests/qemu-iotests/meson.build | 3 +--
 trace/meson.build              | 1 -
 ui/shader/meson.build          | 1 -
 6 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/docs/devel/build-system.rst b/docs/devel/build-system.rst
index 08e85c69e1..2ee368fad6 100644
--- a/docs/devel/build-system.rst
+++ b/docs/devel/build-system.rst
@@ -193,6 +193,11 @@ compilation as possible. The Meson "sourceset" functionality is used
 to list the files and their dependency on various configuration  
 symbols.
 
+All executables are built by default, except for some `contrib/`
+binaries that are known to fail to build on some platforms (for example
+32-bit or big-endian platforms).  Tests are also built by default,
+though that might change in the future.
+
 Various subsystems that are common to both tools and emulators have
 their own sourceset, for example `block_ss` for the block device subsystem,
 `chardev_ss` for the character device subsystem, etc.  These sourcesets
diff --git a/tests/fp/meson.build b/tests/fp/meson.build
index 8779a17aab..24739ad421 100644
--- a/tests/fp/meson.build
+++ b/tests/fp/meson.build
@@ -541,7 +541,6 @@ fpcflags += [
 fptest = executable(
   'fp-test',
   ['fp-test.c', tfdir / 'slowfloat.c', '../../fpu/softfloat.c'],
-  build_by_default: false,
   link_with: [libtestfloat, libsoftfloat],
   dependencies: [qemuutil],
   include_directories: [sfinc, include_directories(tfdir)],
@@ -628,7 +627,6 @@ test('fp-test:mulAdd', fptest,
 fpbench = executable(
   'fp-bench',
   ['fp-bench.c', '../../fpu/softfloat.c'],
-  build_by_default: false,
   link_with: [libtestfloat, libsoftfloat],
   dependencies: [qemuutil],
   include_directories: [sfinc, include_directories(tfdir)],
diff --git a/tests/meson.build b/tests/meson.build
index 70203890a1..116d9a2654 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -248,12 +248,11 @@ foreach bench_name, deps: benchs
             suite: ['speed'])
 endforeach
 
-if have_tools and 'CONFIG_VHOST_USER' in config_host
+if have_tools and 'CONFIG_VHOST_USER' in config_host and 'CONFIG_LINUX' in config_host
   executable('vhost-user-bridge',
              sources: files('vhost-user-bridge.c'),
              link_with: [libvhost_user],
-             dependencies: [qemuutil],
-             build_by_default: false)
+             dependencies: [qemuutil])
 endif
 
 if have_system and 'CONFIG_POSIX' in config_host
diff --git a/tests/qemu-iotests/meson.build b/tests/qemu-iotests/meson.build
index 60470936b4..67aed1e492 100644
--- a/tests/qemu-iotests/meson.build
+++ b/tests/qemu-iotests/meson.build
@@ -1,6 +1,5 @@
 if 'CONFIG_LINUX' in config_host
-    socket_scm_helper = executable('socket_scm_helper', 'socket_scm_helper.c',
-                                    build_by_default: false)
+    socket_scm_helper = executable('socket_scm_helper', 'socket_scm_helper.c')
 else
     socket_scm_helper = []
 endif
diff --git a/trace/meson.build b/trace/meson.build
index b36937d3a6..d5fc45c628 100644
--- a/trace/meson.build
+++ b/trace/meson.build
@@ -70,7 +70,6 @@ foreach d : [
                 output: d[0],
                 input: meson.source_root() / 'trace-events',
                 command: [ tracetool, '--group=root', '--format=@0@'.format(d[1]), '@INPUT@' ],
-                build_by_default: true, # to be removed when added to a target
                 capture: true)
   specific_ss.add(gen)
 endforeach
diff --git a/ui/shader/meson.build b/ui/shader/meson.build
index f69e44ed89..592bf596b9 100644
--- a/ui/shader/meson.build
+++ b/ui/shader/meson.build
@@ -9,7 +9,6 @@ foreach e : shaders
   genh += custom_target(output,
                 output: output,
                 capture: true,
-                build_by_default: true, # to be removed when added to a target
                 input: files('@0@.@1@'.format(e[0], e[1])),
                 command: [shaderinclude, '@INPUT0@'])
 endforeach
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 03/92] ninjatool: rebuild multi-output targets if outputs are missing
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
  2020-09-24  9:21 ` [PULL 01/92] tests: add missing genh dependency Paolo Bonzini
  2020-09-24  9:21 ` [PULL 02/92] meson: clean up build_by_default Paolo Bonzini
@ 2020-09-24  9:21 ` Paolo Bonzini
  2020-09-24  9:21 ` [PULL 04/92] meson: fix MSI rule Paolo Bonzini
                   ` (90 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: Markus Armbruster

The "stamp file trick" used to group targets of a single multi-output rule
prevents the user from deleting one such target in order to force its
rebuild.  Doing so will not touch the stamp file, and therefore only
the dummy ":" command will be executed.

With this patch, ninjatool writes rules that force-rebuild the stamp
file if any of its outputs are missing.  Rebuilding the missing
target therefore causes the stamp file to be rebuilt too.

Reported-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 scripts/ninjatool.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/scripts/ninjatool.py b/scripts/ninjatool.py
index 627a1cab45..6f0e35c727 100755
--- a/scripts/ninjatool.py
+++ b/scripts/ninjatool.py
@@ -908,6 +908,9 @@ class Ninja2Make(NinjaParserEventsWithVars):
             else:
                 stamp = '%s@%s.stamp' % (rule, sha1_text(targets)[0:11])
             self.print('%s: %s; @:' % (targets, stamp))
+            self.print('ifneq (%s, $(wildcard %s))' % (targets, targets))
+            self.print('.PHONY: %s' % (stamp, ))
+            self.print('endif')
             self.print('%s: %s | %s; ${ninja-command-restat}' % (stamp, inputs, orderonly))
             self.rule_targets[rule].append(stamp)
             self.stamp_targets[rule].append(stamp)
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 04/92] meson: fix MSI rule
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (2 preceding siblings ...)
  2020-09-24  9:21 ` [PULL 03/92] ninjatool: rebuild multi-output targets if outputs are missing Paolo Bonzini
@ 2020-09-24  9:21 ` Paolo Bonzini
  2020-09-24  9:21 ` [PULL 05/92] meson: error out if qemu_suffix starts with / Paolo Bonzini
                   ` (89 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

The environment variables can't be passed through an env: argument
yet (meson#2723), use 'env' as suggested in:
https://github.com/mesonbuild/meson/issues/2723#issuecomment-348630957

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 qga/meson.build | 1 +
 1 file changed, 1 insertion(+)

diff --git a/qga/meson.build b/qga/meson.build
index e5c5778a3e..c10a0526b2 100644
--- a/qga/meson.build
+++ b/qga/meson.build
@@ -70,6 +70,7 @@ if targetos == 'windows'
                             output: 'qemu-ga-@0@.msi'.format(config_host['ARCH']),
                             depends: deps,
                             command: [
+                              find_program('env'),
                               'QEMU_GA_VERSION=' + config_host['QEMU_GA_VERSION'],
                               'QEMU_GA_MANUFACTURER=' + config_host['QEMU_GA_MANUFACTURER'],
                               'QEMU_GA_DISTRO=' + config_host['QEMU_GA_DISTRO'],
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 05/92] meson: error out if qemu_suffix starts with /
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (3 preceding siblings ...)
  2020-09-24  9:21 ` [PULL 04/92] meson: fix MSI rule Paolo Bonzini
@ 2020-09-24  9:21 ` Paolo Bonzini
  2020-09-24  9:21 ` [PULL 06/92] WHPX: vmware cpuid leaf for tsc and apic frequency Paolo Bonzini
                   ` (88 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Since the variable is used for path concatenation, the result would
ignore the prefix directory altogether.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 meson.build | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/meson.build b/meson.build
index f4d1ab1096..bb4259e7f0 100644
--- a/meson.build
+++ b/meson.build
@@ -17,6 +17,11 @@ config_host = keyval.load(meson.current_build_dir() / 'config-host.mak')
 enable_modules = 'CONFIG_MODULES' in config_host
 enable_static = 'CONFIG_STATIC' in config_host
 build_docs = 'BUILD_DOCS' in config_host
+
+if get_option('qemu_suffix').startswith('/')
+  error('qemu_suffix cannot start with a /')
+endif
+
 qemu_datadir = get_option('datadir') / get_option('qemu_suffix')
 qemu_docdir = get_option('docdir') / get_option('qemu_suffix')
 config_host_data = configuration_data()
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 06/92] WHPX: vmware cpuid leaf for tsc and apic frequency
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (4 preceding siblings ...)
  2020-09-24  9:21 ` [PULL 05/92] meson: error out if qemu_suffix starts with / Paolo Bonzini
@ 2020-09-24  9:21 ` Paolo Bonzini
  2020-09-24  9:21 ` [PULL 07/92] configure: Do not intent to build WHPX on 32-bit host Paolo Bonzini
                   ` (87 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: Sunil Muthuswamy

From: Sunil Muthuswamy <sunilmut@microsoft.com>

Newer versions of WHPX provide the capability to query the tsc
and apic frequency. Expose these through the vmware cpuid leaf.
This patch doesnt support setting the tsc frequency; that will
come as a separate fix.

Signed-off-by: Sunil Muthuswamy <sunilmut@microsoft.com>
Message-Id: <SN4PR2101MB08808DFDDC3F442BBEAADFF4C0710@SN4PR2101MB0880.namprd21.prod.outlook.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target/i386/whp-dispatch.h |  3 +-
 target/i386/whpx-all.c     | 96 +++++++++++++++++++++++++++++++++-----
 2 files changed, 87 insertions(+), 12 deletions(-)

diff --git a/target/i386/whp-dispatch.h b/target/i386/whp-dispatch.h
index e4695c349f..b18aba20ed 100644
--- a/target/i386/whp-dispatch.h
+++ b/target/i386/whp-dispatch.h
@@ -2,10 +2,11 @@
 #define WHP_DISPATCH_H
 
 #include <windows.h>
-
 #include <WinHvPlatform.h>
 #include <WinHvEmulation.h>
 
+#define WHV_E_UNKNOWN_CAPABILITY 0x80370300L
+
 #define LIST_WINHVPLATFORM_FUNCTIONS(X) \
   X(HRESULT, WHvGetCapability, (WHV_CAPABILITY_CODE CapabilityCode, VOID* CapabilityBuffer, UINT32 CapabilityBufferSizeInBytes, UINT32* WrittenSizeInBytes)) \
   X(HRESULT, WHvCreatePartition, (WHV_PARTITION_HANDLE* Partition)) \
diff --git a/target/i386/whpx-all.c b/target/i386/whpx-all.c
index c78baac6df..3fad7928e8 100644
--- a/target/i386/whpx-all.c
+++ b/target/i386/whpx-all.c
@@ -27,6 +27,8 @@
 #include <WinHvPlatform.h>
 #include <WinHvEmulation.h>
 
+#define HYPERV_APIC_BUS_FREQUENCY      (200000000ULL)
+
 struct whpx_state {
     uint64_t mem_quota;
     WHV_PARTITION_HANDLE partition;
@@ -1061,6 +1063,18 @@ static int whpx_vcpu_run(CPUState *cpu)
             cpu_x86_cpuid(env, cpuid_fn, 0, (UINT32 *)&rax, (UINT32 *)&rbx,
                 (UINT32 *)&rcx, (UINT32 *)&rdx);
             switch (cpuid_fn) {
+            case 0x40000000:
+                /* Expose the vmware cpu frequency cpuid leaf */
+                rax = 0x40000010;
+                rbx = rcx = rdx = 0;
+                break;
+
+            case 0x40000010:
+                rax = env->tsc_khz;
+                rbx = env->apic_bus_freq / 1000; /* Hz to KHz */
+                rcx = rdx = 0;
+                break;
+
             case 0x80000001:
                 /* Remove any support of OSVW */
                 rcx &= ~CPUID_EXT3_OSVW;
@@ -1191,8 +1205,12 @@ int whpx_init_vcpu(CPUState *cpu)
 {
     HRESULT hr;
     struct whpx_state *whpx = &whpx_global;
-    struct whpx_vcpu *vcpu;
+    struct whpx_vcpu *vcpu = NULL;
     Error *local_error = NULL;
+    struct CPUX86State *env = (CPUArchState *)(cpu->env_ptr);
+    X86CPU *x86_cpu = X86_CPU(cpu);
+    UINT64 freq = 0;
+    int ret;
 
     /* Add migration blockers for all unsupported features of the
      * Windows Hypervisor Platform
@@ -1207,7 +1225,8 @@ int whpx_init_vcpu(CPUState *cpu)
             error_report_err(local_error);
             migrate_del_blocker(whpx_migration_blocker);
             error_free(whpx_migration_blocker);
-            return -EINVAL;
+            ret = -EINVAL;
+            goto error;
         }
     }
 
@@ -1215,7 +1234,8 @@ int whpx_init_vcpu(CPUState *cpu)
 
     if (!vcpu) {
         error_report("WHPX: Failed to allocte VCPU context.");
-        return -ENOMEM;
+        ret = -ENOMEM;
+        goto error;
     }
 
     hr = whp_dispatch.WHvEmulatorCreateEmulator(
@@ -1224,8 +1244,8 @@ int whpx_init_vcpu(CPUState *cpu)
     if (FAILED(hr)) {
         error_report("WHPX: Failed to setup instruction completion support,"
                      " hr=%08lx", hr);
-        g_free(vcpu);
-        return -EINVAL;
+        ret = -EINVAL;
+        goto error;
     }
 
     hr = whp_dispatch.WHvCreateVirtualProcessor(
@@ -1234,17 +1254,72 @@ int whpx_init_vcpu(CPUState *cpu)
         error_report("WHPX: Failed to create a virtual processor,"
                      " hr=%08lx", hr);
         whp_dispatch.WHvEmulatorDestroyEmulator(vcpu->emulator);
-        g_free(vcpu);
-        return -EINVAL;
+        ret = -EINVAL;
+        goto error;
     }
 
-    vcpu->interruptable = true;
+    /*
+     * vcpu's TSC frequency is either specified by user, or use the value
+     * provided by Hyper-V if the former is not present. In the latter case, we
+     * query it from Hyper-V and record in env->tsc_khz, so that vcpu's TSC
+     * frequency can be migrated later via this field.
+     */
+    if (!env->tsc_khz) {
+        hr = whp_dispatch.WHvGetCapability(
+            WHvCapabilityCodeProcessorClockFrequency, &freq, sizeof(freq),
+                NULL);
+        if (hr != WHV_E_UNKNOWN_CAPABILITY) {
+            if (FAILED(hr)) {
+                printf("WHPX: Failed to query tsc frequency, hr=0x%08lx\n", hr);
+            } else {
+                env->tsc_khz = freq / 1000; /* Hz to KHz */
+            }
+        }
+    }
 
+    env->apic_bus_freq = HYPERV_APIC_BUS_FREQUENCY;
+    hr = whp_dispatch.WHvGetCapability(
+        WHvCapabilityCodeInterruptClockFrequency, &freq, sizeof(freq), NULL);
+    if (hr != WHV_E_UNKNOWN_CAPABILITY) {
+        if (FAILED(hr)) {
+            printf("WHPX: Failed to query apic bus frequency hr=0x%08lx\n", hr);
+        } else {
+            env->apic_bus_freq = freq;
+        }
+    }
+
+    /*
+     * If the vmware cpuid frequency leaf option is set, and we have a valid
+     * tsc value, trap the corresponding cpuid's.
+     */
+    if (x86_cpu->vmware_cpuid_freq && env->tsc_khz) {
+        UINT32 cpuidExitList[] = {1, 0x80000001, 0x40000000, 0x40000010};
+
+        hr = whp_dispatch.WHvSetPartitionProperty(
+                whpx->partition,
+                WHvPartitionPropertyCodeCpuidExitList,
+                cpuidExitList,
+                RTL_NUMBER_OF(cpuidExitList) * sizeof(UINT32));
+
+        if (FAILED(hr)) {
+            error_report("WHPX: Failed to set partition CpuidExitList hr=%08lx",
+                        hr);
+            ret = -EINVAL;
+            goto error;
+        }
+    }
+
+    vcpu->interruptable = true;
     cpu->vcpu_dirty = true;
     cpu->hax_vcpu = (struct hax_vcpu_state *)vcpu;
     qemu_add_vm_change_state_handler(whpx_cpu_update_state, cpu->env_ptr);
 
     return 0;
+
+error:
+    g_free(vcpu);
+
+    return ret;
 }
 
 int whpx_vcpu_exec(CPUState *cpu)
@@ -1493,6 +1568,7 @@ static int whpx_accel_init(MachineState *ms)
     WHV_CAPABILITY whpx_cap;
     UINT32 whpx_cap_size;
     WHV_PARTITION_PROPERTY prop;
+    UINT32 cpuidExitList[] = {1, 0x80000001};
 
     whpx = &whpx_global;
 
@@ -1551,7 +1627,6 @@ static int whpx_accel_init(MachineState *ms)
         goto error;
     }
 
-    UINT32 cpuidExitList[] = {1, 0x80000001};
     hr = whp_dispatch.WHvSetPartitionProperty(
         whpx->partition,
         WHvPartitionPropertyCodeCpuidExitList,
@@ -1579,14 +1654,13 @@ static int whpx_accel_init(MachineState *ms)
     printf("Windows Hypervisor Platform accelerator is operational\n");
     return 0;
 
-  error:
+error:
 
     if (NULL != whpx->partition) {
         whp_dispatch.WHvDeletePartition(whpx->partition);
         whpx->partition = NULL;
     }
 
-
     return ret;
 }
 
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 07/92] configure: Do not intent to build WHPX on 32-bit host
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (5 preceding siblings ...)
  2020-09-24  9:21 ` [PULL 06/92] WHPX: vmware cpuid leaf for tsc and apic frequency Paolo Bonzini
@ 2020-09-24  9:21 ` Paolo Bonzini
  2020-09-24  9:21 ` [PULL 08/92] MAINTAINERS: add Paolo Bonzini as RCU maintainer Paolo Bonzini
                   ` (86 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: Stefan Weil, Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

Hyper-V is available on 64-bit versions of Windows,
do not try to build its support on 32-bit versions.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20200910054516.405777-1-f4bug@amsat.org>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index e8e8e984f2..db9ec3231f 100755
--- a/configure
+++ b/configure
@@ -2985,7 +2985,10 @@ fi
 
 ##########################################
 # Windows Hypervisor Platform accelerator (WHPX) check
-if test "$whpx" != "no" ; then
+if test "$whpx" = "yes" && test "$ARCH" != "x86_64"; then
+  error_exit "WHPX requires 64-bit host"
+fi
+if test "$whpx" != "no" && test "$ARCH" = "x86_64"; then
     if check_include "WinHvPlatform.h" && check_include "WinHvEmulation.h"; then
         whpx="yes"
     else
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 08/92] MAINTAINERS: add Paolo Bonzini as RCU maintainer
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (6 preceding siblings ...)
  2020-09-24  9:21 ` [PULL 07/92] configure: Do not intent to build WHPX on 32-bit host Paolo Bonzini
@ 2020-09-24  9:21 ` Paolo Bonzini
  2020-09-24  9:21 ` [PULL 09/92] target/i386: support KVM_FEATURE_ASYNC_PF_INT Paolo Bonzini
                   ` (85 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: Stefan Hajnoczi

From: Stefan Hajnoczi <stefanha@redhat.com>

The RCU code that Paolo maintains is missing a MAINTAINERS file entry.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20200909090851.14458-1-stefanha@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 MAINTAINERS | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 3d17cad19a..9b01385484 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2310,6 +2310,14 @@ F: softmmu/cpus.c
 F: softmmu/cpu-throttle.c
 F: qapi/run-state.json
 
+Read, Copy, Update (RCU)
+M: Paolo Bonzini <pbonzini@redhat.com>
+S: Maintained
+F: include/qemu/rcu*.h
+F: tests/rcutorture.c
+F: tests/test-rcu-*.c
+F: util/rcu.c
+
 Human Monitor (HMP)
 M: Dr. David Alan Gilbert <dgilbert@redhat.com>
 S: Maintained
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 09/92] target/i386: support KVM_FEATURE_ASYNC_PF_INT
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (7 preceding siblings ...)
  2020-09-24  9:21 ` [PULL 08/92] MAINTAINERS: add Paolo Bonzini as RCU maintainer Paolo Bonzini
@ 2020-09-24  9:21 ` Paolo Bonzini
  2020-09-24  9:21 ` [PULL 10/92] memory: Convert IOMMUMemoryRegionClass doc comment to kernel-doc Paolo Bonzini
                   ` (84 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: Vitaly Kuznetsov

From: Vitaly Kuznetsov <vkuznets@redhat.com>

Linux-5.8 introduced interrupt based mechanism for 'page ready' events
delivery and disabled the old, #PF based one (see commit 2635b5c4a0e4
"KVM: x86: interrupt based APF 'page ready' event delivery"). Linux
guest switches to using in in 5.9 (see commit b1d405751cd5 "KVM: x86:
Switch KVM guest to using interrupts for page ready APF delivery").
The feature has a new KVM_FEATURE_ASYNC_PF_INT bit assigned and
the interrupt vector is set in MSR_KVM_ASYNC_PF_INT MSR. Support this
in QEMU.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Message-Id: <20200908141206.357450-1-vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target/i386/cpu.c     |  4 +++-
 target/i386/cpu.h     |  1 +
 target/i386/kvm.c     | 10 ++++++++++
 target/i386/machine.c | 19 +++++++++++++++++++
 4 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 1c58f764dc..23e9a17a04 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -799,7 +799,7 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
             "kvmclock", "kvm-nopiodelay", "kvm-mmu", "kvmclock",
             "kvm-asyncpf", "kvm-steal-time", "kvm-pv-eoi", "kvm-pv-unhalt",
             NULL, "kvm-pv-tlb-flush", NULL, "kvm-pv-ipi",
-            "kvm-poll-control", "kvm-pv-sched-yield", NULL, NULL,
+            "kvm-poll-control", "kvm-pv-sched-yield", "kvm-asyncpf-int", NULL,
             NULL, NULL, NULL, NULL,
             NULL, NULL, NULL, NULL,
             "kvmclock-stable-bit", NULL, NULL, NULL,
@@ -4105,6 +4105,7 @@ static PropValue kvm_default_props[] = {
     { "kvmclock", "on" },
     { "kvm-nopiodelay", "on" },
     { "kvm-asyncpf", "on" },
+    { "kvm-asyncpf-int", "on" },
     { "kvm-steal-time", "on" },
     { "kvm-pv-eoi", "on" },
     { "kvmclock-stable-bit", "on" },
@@ -6988,6 +6989,7 @@ static void x86_cpu_initfn(Object *obj)
     object_property_add_alias(obj, "kvm_nopiodelay", obj, "kvm-nopiodelay");
     object_property_add_alias(obj, "kvm_mmu", obj, "kvm-mmu");
     object_property_add_alias(obj, "kvm_asyncpf", obj, "kvm-asyncpf");
+    object_property_add_alias(obj, "kvm_asyncpf_int", obj, "kvm-asyncpf-int");
     object_property_add_alias(obj, "kvm_steal_time", obj, "kvm-steal-time");
     object_property_add_alias(obj, "kvm_pv_eoi", obj, "kvm-pv-eoi");
     object_property_add_alias(obj, "kvm_pv_unhalt", obj, "kvm-pv-unhalt");
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index f519d2bfd4..51c1d5f60a 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -1492,6 +1492,7 @@ typedef struct CPUX86State {
     uint64_t wall_clock_msr;
     uint64_t steal_time_msr;
     uint64_t async_pf_en_msr;
+    uint64_t async_pf_int_msr;
     uint64_t pv_eoi_en_msr;
     uint64_t poll_control_msr;
 
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index 9efb07e7c8..06c2025c67 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -287,6 +287,7 @@ static const struct kvm_para_features {
     { KVM_CAP_NOP_IO_DELAY, KVM_FEATURE_NOP_IO_DELAY },
     { KVM_CAP_PV_MMU, KVM_FEATURE_MMU_OP },
     { KVM_CAP_ASYNC_PF, KVM_FEATURE_ASYNC_PF },
+    { KVM_CAP_ASYNC_PF_INT, KVM_FEATURE_ASYNC_PF_INT },
 };
 
 static int get_para_features(KVMState *s)
@@ -2821,6 +2822,9 @@ static int kvm_put_msrs(X86CPU *cpu, int level)
         if (env->features[FEAT_KVM] & (1 << KVM_FEATURE_ASYNC_PF)) {
             kvm_msr_entry_add(cpu, MSR_KVM_ASYNC_PF_EN, env->async_pf_en_msr);
         }
+        if (env->features[FEAT_KVM] & (1 << KVM_FEATURE_ASYNC_PF_INT)) {
+            kvm_msr_entry_add(cpu, MSR_KVM_ASYNC_PF_EN, env->async_pf_int_msr);
+        }
         if (env->features[FEAT_KVM] & (1 << KVM_FEATURE_PV_EOI)) {
             kvm_msr_entry_add(cpu, MSR_KVM_PV_EOI_EN, env->pv_eoi_en_msr);
         }
@@ -3206,6 +3210,9 @@ static int kvm_get_msrs(X86CPU *cpu)
     if (env->features[FEAT_KVM] & (1 << KVM_FEATURE_ASYNC_PF)) {
         kvm_msr_entry_add(cpu, MSR_KVM_ASYNC_PF_EN, 0);
     }
+    if (env->features[FEAT_KVM] & (1 << KVM_FEATURE_ASYNC_PF_INT)) {
+        kvm_msr_entry_add(cpu, MSR_KVM_ASYNC_PF_INT, 0);
+    }
     if (env->features[FEAT_KVM] & (1 << KVM_FEATURE_PV_EOI)) {
         kvm_msr_entry_add(cpu, MSR_KVM_PV_EOI_EN, 0);
     }
@@ -3446,6 +3453,9 @@ static int kvm_get_msrs(X86CPU *cpu)
         case MSR_KVM_ASYNC_PF_EN:
             env->async_pf_en_msr = msrs[i].data;
             break;
+        case MSR_KVM_ASYNC_PF_INT:
+            env->async_pf_int_msr = msrs[i].data;
+            break;
         case MSR_KVM_PV_EOI_EN:
             env->pv_eoi_en_msr = msrs[i].data;
             break;
diff --git a/target/i386/machine.c b/target/i386/machine.c
index b1acf7d0ef..233e46bb70 100644
--- a/target/i386/machine.c
+++ b/target/i386/machine.c
@@ -394,6 +394,13 @@ static bool async_pf_msr_needed(void *opaque)
     return cpu->env.async_pf_en_msr != 0;
 }
 
+static bool async_pf_int_msr_needed(void *opaque)
+{
+    X86CPU *cpu = opaque;
+
+    return cpu->env.async_pf_int_msr != 0;
+}
+
 static bool pv_eoi_msr_needed(void *opaque)
 {
     X86CPU *cpu = opaque;
@@ -467,6 +474,17 @@ static const VMStateDescription vmstate_async_pf_msr = {
     }
 };
 
+static const VMStateDescription vmstate_async_pf_int_msr = {
+    .name = "cpu/async_pf_int_msr",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .needed = async_pf_int_msr_needed,
+    .fields = (VMStateField[]) {
+        VMSTATE_UINT64(env.async_pf_int_msr, X86CPU),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
 static const VMStateDescription vmstate_pv_eoi_msr = {
     .name = "cpu/async_pv_eoi_msr",
     .version_id = 1,
@@ -1438,6 +1456,7 @@ VMStateDescription vmstate_x86_cpu = {
     .subsections = (const VMStateDescription*[]) {
         &vmstate_exception_info,
         &vmstate_async_pf_msr,
+        &vmstate_async_pf_int_msr,
         &vmstate_pv_eoi_msr,
         &vmstate_steal_time_msr,
         &vmstate_poll_control_msr,
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 10/92] memory: Convert IOMMUMemoryRegionClass doc comment to kernel-doc
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (8 preceding siblings ...)
  2020-09-24  9:21 ` [PULL 09/92] target/i386: support KVM_FEATURE_ASYNC_PF_INT Paolo Bonzini
@ 2020-09-24  9:21 ` Paolo Bonzini
  2020-09-24  9:21 ` [PULL 11/92] vhost-scsi: support inflight io track Paolo Bonzini
                   ` (83 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: Eduardo Habkost, Philippe Mathieu-Daudé

From: Eduardo Habkost <ehabkost@redhat.com>

Convert the existing documentation comments of
IOMMUMemoryRegionClass to kernel-doc format so their contents
will appear in the API reference at docs/devel/memory.html.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20200908201129.3407568-1-ehabkost@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/exec/memory.h | 50 +++++++++++++++++++++++++++++++++++--------
 1 file changed, 41 insertions(+), 9 deletions(-)

diff --git a/include/exec/memory.h b/include/exec/memory.h
index f1bb2a7df5..ec9edee742 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -228,8 +228,11 @@ enum IOMMUMemoryRegionAttr {
  * attributes and the output TLB entry depends on the transaction
  * attributes, we represent this using IOMMU indexes. Each index
  * selects a particular translation table that the IOMMU has:
+ *
  *   @attrs_to_index returns the IOMMU index for a set of transaction attributes
+ *
  *   @translate takes an input address and an IOMMU index
+ *
  * and the mapping returned can only depend on the input address and the
  * IOMMU index.
  *
@@ -238,10 +241,13 @@ enum IOMMUMemoryRegionAttr {
  * for secure transactions and one for non-secure transactions.
  */
 struct IOMMUMemoryRegionClass {
-    /* private */
+    /* private: */
     MemoryRegionClass parent_class;
 
-    /*
+    /* public: */
+    /**
+     * @translate:
+     *
      * Return a TLB entry that contains a given address.
      *
      * The IOMMUAccessFlags indicated via @flag are optional and may
@@ -262,26 +268,38 @@ struct IOMMUMemoryRegionClass {
      * information when the IOMMU mapping changes.
      *
      * @iommu: the IOMMUMemoryRegion
+     *
      * @hwaddr: address to be translated within the memory region
-     * @flag: requested access permissions
+     *
+     * @flag: requested access permission
+     *
      * @iommu_idx: IOMMU index for the translation
      */
     IOMMUTLBEntry (*translate)(IOMMUMemoryRegion *iommu, hwaddr addr,
                                IOMMUAccessFlags flag, int iommu_idx);
-    /* Returns minimum supported page size in bytes.
+    /**
+     * @get_min_page_size:
+     *
+     * Returns minimum supported page size in bytes.
+     *
      * If this method is not provided then the minimum is assumed to
      * be TARGET_PAGE_SIZE.
      *
      * @iommu: the IOMMUMemoryRegion
      */
     uint64_t (*get_min_page_size)(IOMMUMemoryRegion *iommu);
-    /* Called when IOMMU Notifier flag changes (ie when the set of
+    /**
+     * @notify_flag_changed:
+     *
+     * Called when IOMMU Notifier flag changes (ie when the set of
      * events which IOMMU users are requesting notification for changes).
      * Optional method -- need not be provided if the IOMMU does not
      * need to know exactly which events must be notified.
      *
      * @iommu: the IOMMUMemoryRegion
+     *
      * @old_flags: events which previously needed to be notified
+     *
      * @new_flags: events which now need to be notified
      *
      * Returns 0 on success, or a negative errno; in particular
@@ -293,7 +311,10 @@ struct IOMMUMemoryRegionClass {
                                IOMMUNotifierFlag old_flags,
                                IOMMUNotifierFlag new_flags,
                                Error **errp);
-    /* Called to handle memory_region_iommu_replay().
+    /**
+     * @replay:
+     *
+     * Called to handle memory_region_iommu_replay().
      *
      * The default implementation of memory_region_iommu_replay() is to
      * call the IOMMU translate method for every page in the address space
@@ -310,7 +331,10 @@ struct IOMMUMemoryRegionClass {
      */
     void (*replay)(IOMMUMemoryRegion *iommu, IOMMUNotifier *notifier);
 
-    /* Get IOMMU misc attributes. This is an optional method that
+    /**
+     * @get_attr:
+     *
+     * Get IOMMU misc attributes. This is an optional method that
      * can be used to allow users of the IOMMU to get implementation-specific
      * information. The IOMMU implements this method to handle calls
      * by IOMMU users to memory_region_iommu_get_attr() by filling in
@@ -319,7 +343,9 @@ struct IOMMUMemoryRegionClass {
      * memory_region_iommu_get_attr() will always return -EINVAL.
      *
      * @iommu: the IOMMUMemoryRegion
+     *
      * @attr: attribute being queried
+     *
      * @data: memory to fill in with the attribute data
      *
      * Returns 0 on success, or a negative errno; in particular
@@ -328,7 +354,10 @@ struct IOMMUMemoryRegionClass {
     int (*get_attr)(IOMMUMemoryRegion *iommu, enum IOMMUMemoryRegionAttr attr,
                     void *data);
 
-    /* Return the IOMMU index to use for a given set of transaction attributes.
+    /**
+     * @attrs_to_index:
+     *
+     * Return the IOMMU index to use for a given set of transaction attributes.
      *
      * Optional method: if an IOMMU only supports a single IOMMU index then
      * the default implementation of memory_region_iommu_attrs_to_index()
@@ -341,7 +370,10 @@ struct IOMMUMemoryRegionClass {
      */
     int (*attrs_to_index)(IOMMUMemoryRegion *iommu, MemTxAttrs attrs);
 
-    /* Return the number of IOMMU indexes this IOMMU supports.
+    /**
+     * @num_indexes:
+     *
+     * Return the number of IOMMU indexes this IOMMU supports.
      *
      * Optional method: if this method is not provided, then
      * memory_region_iommu_num_indexes() will return 1, indicating that
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 11/92] vhost-scsi: support inflight io track
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (9 preceding siblings ...)
  2020-09-24  9:21 ` [PULL 10/92] memory: Convert IOMMUMemoryRegionClass doc comment to kernel-doc Paolo Bonzini
@ 2020-09-24  9:21 ` Paolo Bonzini
  2020-09-24  9:21 ` [PULL 12/92] acpi: i386: Move VMBus DSDT entry to SB Paolo Bonzini
                   ` (82 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: Li Feng

From: Li Feng <fengli@smartx.com>

Qemu will send GET_INFLIGHT_FD and SET_INFLIGH_FD to backend, and
the backend setup the inflight memory to track the io.

Change-Id: I805d6189996f7a1b44c65f0b12ef7473b1789510
Signed-off-by: Li Feng <fengli@smartx.com>
Message-Id: <20200909122021.1055174-1-fengli@smartx.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/scsi/vhost-scsi-common.c           | 27 +++++++++++++++++++++++++++
 include/hw/virtio/vhost-scsi-common.h |  2 ++
 2 files changed, 29 insertions(+)

diff --git a/hw/scsi/vhost-scsi-common.c b/hw/scsi/vhost-scsi-common.c
index 8ec49d7fef..767f827e55 100644
--- a/hw/scsi/vhost-scsi-common.c
+++ b/hw/scsi/vhost-scsi-common.c
@@ -32,6 +32,8 @@ int vhost_scsi_common_start(VHostSCSICommon *vsc)
     BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev)));
     VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);
 
+    VirtIOSCSICommon *vs = (VirtIOSCSICommon *)vsc;
+
     if (!k->set_guest_notifiers) {
         error_report("binding does not support guest notifiers");
         return -ENOSYS;
@@ -49,6 +51,23 @@ int vhost_scsi_common_start(VHostSCSICommon *vsc)
     }
 
     vsc->dev.acked_features = vdev->guest_features;
+
+    assert(vsc->inflight == NULL);
+    vsc->inflight = g_new0(struct vhost_inflight, 1);
+    ret = vhost_dev_get_inflight(&vsc->dev,
+                                 vs->conf.virtqueue_size,
+                                 vsc->inflight);
+    if (ret < 0) {
+        error_report("Error get inflight: %d", -ret);
+        goto err_guest_notifiers;
+    }
+
+    ret = vhost_dev_set_inflight(&vsc->dev, vsc->inflight);
+    if (ret < 0) {
+        error_report("Error set inflight: %d", -ret);
+        goto err_guest_notifiers;
+    }
+
     ret = vhost_dev_start(&vsc->dev, vdev);
     if (ret < 0) {
         error_report("Error start vhost dev");
@@ -66,6 +85,9 @@ int vhost_scsi_common_start(VHostSCSICommon *vsc)
     return ret;
 
 err_guest_notifiers:
+    g_free(vsc->inflight);
+    vsc->inflight = NULL;
+
     k->set_guest_notifiers(qbus->parent, vsc->dev.nvqs, false);
 err_host_notifiers:
     vhost_dev_disable_notifiers(&vsc->dev, vdev);
@@ -89,6 +111,11 @@ void vhost_scsi_common_stop(VHostSCSICommon *vsc)
     }
     assert(ret >= 0);
 
+    if (vsc->inflight) {
+        vhost_dev_free_inflight(vsc->inflight);
+        vsc->inflight = NULL;
+    }
+
     vhost_dev_disable_notifiers(&vsc->dev, vdev);
 }
 
diff --git a/include/hw/virtio/vhost-scsi-common.h b/include/hw/virtio/vhost-scsi-common.h
index 0c8909d12a..18f115527c 100644
--- a/include/hw/virtio/vhost-scsi-common.h
+++ b/include/hw/virtio/vhost-scsi-common.h
@@ -35,6 +35,8 @@ struct VHostSCSICommon {
     int lun;
     uint64_t host_features;
     bool migratable;
+
+    struct vhost_inflight *inflight;
 };
 
 int vhost_scsi_common_start(VHostSCSICommon *vsc);
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 12/92] acpi: i386: Move VMBus DSDT entry to SB
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (10 preceding siblings ...)
  2020-09-24  9:21 ` [PULL 11/92] vhost-scsi: support inflight io track Paolo Bonzini
@ 2020-09-24  9:21 ` Paolo Bonzini
  2020-09-24  9:21 ` [PULL 13/92] numa: drop support for '-numa node' (without memory specified) Paolo Bonzini
                   ` (81 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: Igor Mammedov, Jon Doron

From: Jon Doron <arilou@gmail.com>

Signed-off-by: Jon Doron <arilou@gmail.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20200715084326.678715-2-arilou@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/i386/acpi-build.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 0e0535d2e3..60722fb8b0 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -975,7 +975,6 @@ static Aml *build_vmbus_device_aml(VMBusBridge *vmbus_bridge)
 
 static void build_isa_devices_aml(Aml *table)
 {
-    VMBusBridge *vmbus_bridge = vmbus_bridge_find();
     bool ambiguous;
     Object *obj = object_resolve_path_type("", TYPE_ISA_BUS, &ambiguous);
     Aml *scope;
@@ -986,10 +985,6 @@ static void build_isa_devices_aml(Aml *table)
     build_acpi_ipmi_devices(scope, BUS(obj), "\\_SB.PCI0.ISA");
     isa_build_aml(ISA_BUS(obj), scope);
 
-    if (vmbus_bridge) {
-        aml_append(scope, build_vmbus_device_aml(vmbus_bridge));
-    }
-
     aml_append(table, scope);
 }
 
@@ -1485,6 +1480,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
     PCIBus *bus = NULL;
     TPMIf *tpm = tpm_find();
     int i;
+    VMBusBridge *vmbus_bridge = vmbus_bridge_find();
 
     dsdt = init_aml_allocator();
 
@@ -1526,6 +1522,12 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
         }
     }
 
+    if (vmbus_bridge) {
+        sb_scope = aml_scope("_SB");
+        aml_append(sb_scope, build_vmbus_device_aml(vmbus_bridge));
+        aml_append(dsdt, sb_scope);
+    }
+
     if (pcmc->legacy_cpu_hotplug) {
         build_legacy_cpu_hotplug_aml(dsdt, machine, pm->cpu_hp_io_base);
     } else {
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 13/92] numa: drop support for '-numa node' (without memory specified)
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (11 preceding siblings ...)
  2020-09-24  9:21 ` [PULL 12/92] acpi: i386: Move VMBus DSDT entry to SB Paolo Bonzini
@ 2020-09-24  9:21 ` Paolo Bonzini
  2020-09-24  9:21 ` [PULL 14/92] doc: Cleanup "'-mem-path' fallback to RAM" deprecation text Paolo Bonzini
                   ` (80 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: Igor Mammedov

From: Igor Mammedov <imammedo@redhat.com>

it was deprecated since 4.1
commit 4bb4a2732e (numa: deprecate implict memory distribution between nodes)

Users of existing VMs, wishing to preserve the same RAM distribution,
should configure it explicitly using ``-numa node,memdev`` options.
Current RAM distribution can be retrieved using HMP command
`info numa` and if separate memory devices (pc|nv-dimm) are present
use `info memory-device` and subtract device memory from output of
`info numa`.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20200911084410.788171-2-imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 docs/system/deprecated.rst | 23 +++++++++-------
 hw/core/machine.c          |  1 -
 hw/core/numa.c             | 55 --------------------------------------
 hw/i386/pc_piix.c          |  1 -
 hw/i386/pc_q35.c           |  1 -
 hw/ppc/spapr.c             |  1 -
 include/hw/boards.h        |  2 --
 include/sysemu/numa.h      |  4 ---
 8 files changed, 14 insertions(+), 74 deletions(-)

diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst
index 808c334fe7..6422230fe2 100644
--- a/docs/system/deprecated.rst
+++ b/docs/system/deprecated.rst
@@ -104,15 +104,6 @@ error in the future.
 The ``-realtime mlock=on|off`` argument has been replaced by the
 ``-overcommit mem-lock=on|off`` argument.
 
-``-numa`` node (without memory specified) (since 4.1)
-'''''''''''''''''''''''''''''''''''''''''''''''''''''
-
-Splitting RAM by default between NUMA nodes has the same issues as ``mem``
-parameter described above with the difference that the role of the user plays
-QEMU using implicit generic or board specific splitting rule.
-Use ``memdev`` with *memory-backend-ram* backend or ``mem`` (if
-it's supported by used machine type) to define mapping explicitly instead.
-
 ``-mem-path`` fallback to RAM (since 4.1)
 '''''''''''''''''''''''''''''''''''''''''
 
@@ -625,6 +616,20 @@ error when ``-u`` is not used.
 Command line options
 --------------------
 
+``-numa`` node (without memory specified) (removed 5.2)
+'''''''''''''''''''''''''''''''''''''''''''''''''''''''
+
+Splitting RAM by default between NUMA nodes had the same issues as ``mem``
+parameter with the difference that the role of the user plays QEMU using
+implicit generic or board specific splitting rule.
+Use ``memdev`` with *memory-backend-ram* backend or ``mem`` (if
+it's supported by used machine type) to define mapping explictly instead.
+Users of existing VMs, wishing to preserve the same RAM distribution, should
+configure it explicitly using ``-numa node,memdev`` options. Current RAM
+distribution can be retrieved using HMP command ``info numa`` and if separate
+memory devices (pc|nv-dimm) are present use ``info memory-device`` and subtract
+device memory from output of ``info numa``.
+
 ``-numa node,mem=``\ *size* (removed in 5.1)
 ''''''''''''''''''''''''''''''''''''''''''''
 
diff --git a/hw/core/machine.c b/hw/core/machine.c
index ea26d61237..f70d388e86 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -797,7 +797,6 @@ static void machine_class_init(ObjectClass *oc, void *data)
      * On Linux, each node's border has to be 8MB aligned
      */
     mc->numa_mem_align_shift = 23;
-    mc->numa_auto_assign_ram = numa_default_auto_assign_ram;
 
     object_class_property_add_str(oc, "kernel",
         machine_get_kernel, machine_set_kernel);
diff --git a/hw/core/numa.c b/hw/core/numa.c
index f9593ec716..706c1e84c6 100644
--- a/hw/core/numa.c
+++ b/hw/core/numa.c
@@ -611,42 +611,6 @@ static void complete_init_numa_distance(MachineState *ms)
     }
 }
 
-void numa_legacy_auto_assign_ram(MachineClass *mc, NodeInfo *nodes,
-                                 int nb_nodes, ram_addr_t size)
-{
-    int i;
-    uint64_t usedmem = 0;
-
-    /* Align each node according to the alignment
-     * requirements of the machine class
-     */
-
-    for (i = 0; i < nb_nodes - 1; i++) {
-        nodes[i].node_mem = (size / nb_nodes) &
-                            ~((1 << mc->numa_mem_align_shift) - 1);
-        usedmem += nodes[i].node_mem;
-    }
-    nodes[i].node_mem = size - usedmem;
-}
-
-void numa_default_auto_assign_ram(MachineClass *mc, NodeInfo *nodes,
-                                  int nb_nodes, ram_addr_t size)
-{
-    int i;
-    uint64_t usedmem = 0, node_mem;
-    uint64_t granularity = size / nb_nodes;
-    uint64_t propagate = 0;
-
-    for (i = 0; i < nb_nodes - 1; i++) {
-        node_mem = (granularity + propagate) &
-                   ~((1 << mc->numa_mem_align_shift) - 1);
-        propagate = granularity + propagate - node_mem;
-        nodes[i].node_mem = node_mem;
-        usedmem += node_mem;
-    }
-    nodes[i].node_mem = size - usedmem;
-}
-
 static void numa_init_memdev_container(MachineState *ms, MemoryRegion *ram)
 {
     int i;
@@ -717,25 +681,6 @@ void numa_complete_configuration(MachineState *ms)
             ms->numa_state->num_nodes = MAX_NODES;
         }
 
-        /* If no memory size is given for any node, assume the default case
-         * and distribute the available memory equally across all nodes
-         */
-        for (i = 0; i < ms->numa_state->num_nodes; i++) {
-            if (numa_info[i].node_mem != 0) {
-                break;
-            }
-        }
-        if (i == ms->numa_state->num_nodes) {
-            assert(mc->numa_auto_assign_ram);
-            mc->numa_auto_assign_ram(mc, numa_info,
-                                     ms->numa_state->num_nodes, ram_size);
-            if (!qtest_enabled()) {
-                warn_report("Default splitting of RAM between nodes is deprecated,"
-                            " Use '-numa node,memdev' to explictly define RAM"
-                            " allocation per node");
-            }
-        }
-
         numa_total = 0;
         for (i = 0; i < ms->numa_state->num_nodes; i++) {
             numa_total += numa_info[i].node_mem;
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 6f3e78bb60..c6057905fa 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -565,7 +565,6 @@ static void pc_i440fx_2_9_machine_options(MachineClass *m)
     pc_i440fx_2_10_machine_options(m);
     compat_props_add(m->compat_props, hw_compat_2_9, hw_compat_2_9_len);
     compat_props_add(m->compat_props, pc_compat_2_9, pc_compat_2_9_len);
-    m->numa_auto_assign_ram = numa_legacy_auto_assign_ram;
 }
 
 DEFINE_I440FX_MACHINE(v2_9, "pc-i440fx-2.9", NULL,
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 622d039717..11ab5bd7be 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -494,7 +494,6 @@ static void pc_q35_2_10_machine_options(MachineClass *m)
     pc_q35_2_11_machine_options(m);
     compat_props_add(m->compat_props, hw_compat_2_10, hw_compat_2_10_len);
     compat_props_add(m->compat_props, pc_compat_2_10, pc_compat_2_10_len);
-    m->numa_auto_assign_ram = numa_legacy_auto_assign_ram;
     m->auto_enable_numa_with_memhp = false;
 }
 
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 9bce1892b5..12fd92373d 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -4737,7 +4737,6 @@ static void spapr_machine_2_9_class_options(MachineClass *mc)
     spapr_machine_2_10_class_options(mc);
     compat_props_add(mc->compat_props, hw_compat_2_9, hw_compat_2_9_len);
     compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat));
-    mc->numa_auto_assign_ram = numa_legacy_auto_assign_ram;
     smc->pre_2_10_has_unused_icps = true;
     smc->resize_hpt_default = SPAPR_RESIZE_HPT_DISABLED;
 }
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 56aa1ca335..777621fb30 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -203,8 +203,6 @@ struct MachineClass {
     strList *allowed_dynamic_sysbus_devices;
     bool auto_enable_numa_with_memhp;
     bool auto_enable_numa_with_memdev;
-    void (*numa_auto_assign_ram)(MachineClass *mc, NodeInfo *nodes,
-                                 int nb_nodes, ram_addr_t size);
     bool ignore_boot_device_suffixes;
     bool smbus_no_migration_support;
     bool nvdimm_supported;
diff --git a/include/sysemu/numa.h b/include/sysemu/numa.h
index ad58ee88f7..4173ef2afa 100644
--- a/include/sysemu/numa.h
+++ b/include/sysemu/numa.h
@@ -106,10 +106,6 @@ void parse_numa_hmat_cache(MachineState *ms, NumaHmatCacheOptions *node,
 void numa_complete_configuration(MachineState *ms);
 void query_numa_node_mem(NumaNodeMem node_mem[], MachineState *ms);
 extern QemuOptsList qemu_numa_opts;
-void numa_legacy_auto_assign_ram(MachineClass *mc, NodeInfo *nodes,
-                                 int nb_nodes, ram_addr_t size);
-void numa_default_auto_assign_ram(MachineClass *mc, NodeInfo *nodes,
-                                  int nb_nodes, ram_addr_t size);
 void numa_cpu_pre_plug(const struct CPUArchId *slot, DeviceState *dev,
                        Error **errp);
 bool numa_uses_legacy_mem(void);
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 14/92] doc: Cleanup "'-mem-path' fallback to RAM" deprecation text
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (12 preceding siblings ...)
  2020-09-24  9:21 ` [PULL 13/92] numa: drop support for '-numa node' (without memory specified) Paolo Bonzini
@ 2020-09-24  9:21 ` Paolo Bonzini
  2020-09-24  9:21 ` [PULL 15/92] numa: remove fixup numa_state->num_nodes to MAX_NODES Paolo Bonzini
                   ` (79 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: Igor Mammedov

From: Igor Mammedov <imammedo@redhat.com>

it was actually removed in 5.0,
commit 68a86dc15c (numa: remove deprecated -mem-path fallback to anonymous RAM)
clean up forgotten remnants in docs.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20200911084410.788171-3-imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 docs/system/deprecated.rst | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst
index 6422230fe2..e78d03038f 100644
--- a/docs/system/deprecated.rst
+++ b/docs/system/deprecated.rst
@@ -104,17 +104,6 @@ error in the future.
 The ``-realtime mlock=on|off`` argument has been replaced by the
 ``-overcommit mem-lock=on|off`` argument.
 
-``-mem-path`` fallback to RAM (since 4.1)
-'''''''''''''''''''''''''''''''''''''''''
-
-Currently if guest RAM allocation from file pointed by ``mem-path``
-fails, QEMU falls back to allocating from RAM, which might result
-in unpredictable behavior since the backing file specified by the user
-is ignored. In the future, users will be responsible for making sure
-the backing storage specified with ``-mem-path`` can actually provide
-the guest RAM configured with ``-m`` and QEMU will fail to start up if
-RAM allocation is unsuccessful.
-
 RISC-V ``-bios`` (since 5.1)
 ''''''''''''''''''''''''''''
 
@@ -647,6 +636,16 @@ New machine versions (since 5.1) will not accept the option but it will still
 work with old machine types. User can check the QAPI schema to see if the legacy
 option is supported by looking at MachineInfo::numa-mem-supported property.
 
+``-mem-path`` fallback to RAM (removed in 5.0)
+''''''''''''''''''''''''''''''''''''''''''''''
+
+If guest RAM allocation from file pointed by ``mem-path`` failed,
+QEMU was falling back to allocating from RAM, which might have resulted
+in unpredictable behavior since the backing file specified by the user
+as ignored. Currently, users are responsible for making sure the backing storage
+specified with ``-mem-path`` can actually provide the guest RAM configured with
+``-m`` and QEMU fails to start up if RAM allocation is unsuccessful.
+
 Block devices
 -------------
 
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 15/92] numa: remove fixup numa_state->num_nodes to MAX_NODES
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (13 preceding siblings ...)
  2020-09-24  9:21 ` [PULL 14/92] doc: Cleanup "'-mem-path' fallback to RAM" deprecation text Paolo Bonzini
@ 2020-09-24  9:21 ` Paolo Bonzini
  2020-09-24  9:21 ` [PULL 16/92] hw/mips/mipssim: Use MMIO serial device on fake ISA I/O Paolo Bonzini
                   ` (78 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: Igor Mammedov

From: Igor Mammedov <imammedo@redhat.com>

current code permits only nodeids in [0..MAX_NODES) range
due to nodeid check in

  parse_numa_node()
      if (nodenr >= MAX_NODES) {
          error_setg(errp, "Max number of NUMA nodes reached: %"

so subj fixup is not reachable, drop it.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <20200911084410.788171-4-imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/core/numa.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/hw/core/numa.c b/hw/core/numa.c
index 706c1e84c6..7d5d413001 100644
--- a/hw/core/numa.c
+++ b/hw/core/numa.c
@@ -677,10 +677,6 @@ void numa_complete_configuration(MachineState *ms)
     if (ms->numa_state->num_nodes > 0) {
         uint64_t numa_total;
 
-        if (ms->numa_state->num_nodes > MAX_NODES) {
-            ms->numa_state->num_nodes = MAX_NODES;
-        }
-
         numa_total = 0;
         for (i = 0; i < ms->numa_state->num_nodes; i++) {
             numa_total += numa_info[i].node_mem;
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 16/92] hw/mips/mipssim: Use MMIO serial device on fake ISA I/O
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (14 preceding siblings ...)
  2020-09-24  9:21 ` [PULL 15/92] numa: remove fixup numa_state->num_nodes to MAX_NODES Paolo Bonzini
@ 2020-09-24  9:21 ` Paolo Bonzini
  2020-09-24  9:21 ` [PULL 17/92] hw/char/serial: Remove TYPE_SERIAL_IO Paolo Bonzini
                   ` (77 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Richard Henderson, Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <philmd@redhat.com>

The 'mipssim' is not a real hardware, it is a simulator.

There is an ISA MMIO space mapped at 0x1fd00000, however
this is not a real ISA bus (no ISA IRQ). So can not use
the TYPE_ISA_SERIAL device...
Instead we have been using a plain MMIO device, but named
it IO.

TYPE_SERIAL_IO is a subset of TYPE_SERIAL_MM, using
regshift=0 and endianness=DEVICE_LITTLE_ENDIAN.

Directly use the TYPE_SERIAL_MM device, enforcing the
regshift/endianness values. 'regshift' default is already
'0'. 'endianness' is meaningless for 8-bit accesses.

This change breaks migration back compatibility, but
this is not an issue for the mipssim machine.

Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20200907011538.818996-2-philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/mips/mipssim.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/hw/mips/mipssim.c b/hw/mips/mipssim.c
index 1b3b762203..5d4ad74828 100644
--- a/hw/mips/mipssim.c
+++ b/hw/mips/mipssim.c
@@ -216,10 +216,11 @@ mips_mipssim_init(MachineState *machine)
      * MIPS CPU INT2, which is interrupt 4.
      */
     if (serial_hd(0)) {
-        DeviceState *dev = qdev_new(TYPE_SERIAL_IO);
+        DeviceState *dev = qdev_new(TYPE_SERIAL_MM);
 
         qdev_prop_set_chr(dev, "chardev", serial_hd(0));
-        qdev_set_legacy_instance_id(dev, 0x3f8, 2);
+        qdev_prop_set_uint8(dev, "regshift", 0);
+        qdev_prop_set_uint8(dev, "endianness", DEVICE_LITTLE_ENDIAN);
         sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
         sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, env->irq[4]);
         sysbus_add_io(SYS_BUS_DEVICE(dev), 0x3f8,
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 17/92] hw/char/serial: Remove TYPE_SERIAL_IO
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (15 preceding siblings ...)
  2020-09-24  9:21 ` [PULL 16/92] hw/mips/mipssim: Use MMIO serial device on fake ISA I/O Paolo Bonzini
@ 2020-09-24  9:21 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 18/92] configure: rename QEMU_GA_MSI_ENABLED to CONFIG_QGA_MSI Paolo Bonzini
                   ` (76 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Richard Henderson, Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <philmd@redhat.com>

TYPE_SERIAL_IO is a subset of TYPE_SERIAL_MM, and it is
not used anymore. Remove it.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20200907011538.818996-3-philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/char/serial.c         | 41 ----------------------------------------
 include/hw/char/serial.h |  9 ---------
 2 files changed, 50 deletions(-)

diff --git a/hw/char/serial.c b/hw/char/serial.c
index 2386479492..fd80ae5592 100644
--- a/hw/char/serial.c
+++ b/hw/char/serial.c
@@ -985,46 +985,6 @@ const MemoryRegionOps serial_io_ops = {
     .endianness = DEVICE_LITTLE_ENDIAN,
 };
 
-static void serial_io_realize(DeviceState *dev, Error **errp)
-{
-    SerialIO *sio = SERIAL_IO(dev);
-    SerialState *s = &sio->serial;
-
-    if (!qdev_realize(DEVICE(s), NULL, errp)) {
-        return;
-    }
-
-    memory_region_init_io(&s->io, OBJECT(dev), &serial_io_ops, s, "serial", 8);
-    sysbus_init_mmio(SYS_BUS_DEVICE(sio), &s->io);
-    sysbus_init_irq(SYS_BUS_DEVICE(sio), &s->irq);
-}
-
-static void serial_io_class_init(ObjectClass *klass, void* data)
-{
-    DeviceClass *dc = DEVICE_CLASS(klass);
-
-    dc->realize = serial_io_realize;
-    /* No dc->vmsd: class has no migratable state */
-}
-
-static void serial_io_instance_init(Object *o)
-{
-    SerialIO *sio = SERIAL_IO(o);
-
-    object_initialize_child(o, "serial", &sio->serial, TYPE_SERIAL);
-
-    qdev_alias_all_properties(DEVICE(&sio->serial), o);
-}
-
-
-static const TypeInfo serial_io_info = {
-    .name = TYPE_SERIAL_IO,
-    .parent = TYPE_SYS_BUS_DEVICE,
-    .instance_size = sizeof(SerialIO),
-    .instance_init = serial_io_instance_init,
-    .class_init = serial_io_class_init,
-};
-
 static Property serial_properties[] = {
     DEFINE_PROP_CHR("chardev", SerialState, chr),
     DEFINE_PROP_UINT32("baudbase", SerialState, baudbase, 115200),
@@ -1178,7 +1138,6 @@ static const TypeInfo serial_mm_info = {
 static void serial_register_types(void)
 {
     type_register_static(&serial_info);
-    type_register_static(&serial_io_info);
     type_register_static(&serial_mm_info);
 }
 
diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h
index db4f9af18c..23bd7d3dde 100644
--- a/include/hw/char/serial.h
+++ b/include/hw/char/serial.h
@@ -90,12 +90,6 @@ struct SerialMM {
     uint8_t endianness;
 };
 
-struct SerialIO {
-    SysBusDevice parent;
-
-    SerialState serial;
-};
-
 extern const VMStateDescription vmstate_serial;
 extern const MemoryRegionOps serial_io_ops;
 
@@ -107,9 +101,6 @@ OBJECT_DECLARE_SIMPLE_TYPE(SerialState, SERIAL)
 #define TYPE_SERIAL_MM "serial-mm"
 OBJECT_DECLARE_SIMPLE_TYPE(SerialMM, SERIAL_MM)
 
-#define TYPE_SERIAL_IO "serial-io"
-OBJECT_DECLARE_SIMPLE_TYPE(SerialIO, SERIAL_IO)
-
 SerialMM *serial_mm_init(MemoryRegion *address_space,
                          hwaddr base, int regshift,
                          qemu_irq irq, int baudbase,
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 18/92] configure: rename QEMU_GA_MSI_ENABLED to CONFIG_QGA_MSI
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (16 preceding siblings ...)
  2020-09-24  9:21 ` [PULL 17/92] hw/char/serial: Remove TYPE_SERIAL_IO Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 19/92] hw/char/serial: Assert serial_ioport_read/write offset fits 8 bytes Paolo Bonzini
                   ` (75 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Stefan Hajnoczi

From: Stefan Hajnoczi <stefanha@redhat.com>

The QEMU_GA_MSI_ENABLED config-host.mak variable is emitted by
./configure. meson.build actually checks for CONFIG_QGA_MSI_ENABLED:

  summary_info += {'QGA MSI support':   config_host.has_key('CONFIG_QGA_MSI_ENABLED')}

Rename QEMU_GA_MSI_ENABLED to CONFIG_QGA_MSI for consistency with
CONFIG_QGA_VSS. Also use 'y' instead of 'yes' for consistency.

This fixes the feature summary printed by meson.build.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20200914095231.621068-4-stefanha@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 Makefile    | 2 +-
 configure   | 2 +-
 meson.build | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 7c60b9dcb8..42d90cb597 100644
--- a/Makefile
+++ b/Makefile
@@ -285,7 +285,7 @@ endif
 ifdef CONFIG_WIN32
 	@echo  'Windows targets:'
 	$(call print-help,installer,Build NSIS-based installer for QEMU)
-ifdef QEMU_GA_MSI_ENABLED
+ifdef CONFIG_QGA_MSI
 	$(call print-help,msi,Build MSI-based installer for qemu-ga)
 endif
 	@echo  ''
diff --git a/configure b/configure
index db9ec3231f..01fce2e94b 100755
--- a/configure
+++ b/configure
@@ -6576,7 +6576,7 @@ if test "$mingw32" = "yes" ; then
     echo "CONFIG_QGA_NTDDSCSI=y" >> $config_host_mak
   fi
   if test "$guest_agent_msi" = "yes"; then
-    echo "QEMU_GA_MSI_ENABLED=yes" >> $config_host_mak
+    echo "CONFIG_QGA_MSI=y" >> $config_host_mak
     echo "QEMU_GA_MSI_MINGW_DLL_PATH=${QEMU_GA_MSI_MINGW_DLL_PATH}" >> $config_host_mak
     echo "QEMU_GA_MSI_WITH_VSS=${QEMU_GA_MSI_WITH_VSS}" >> $config_host_mak
     echo "QEMU_GA_MSI_ARCH=${QEMU_GA_MSI_ARCH}" >> $config_host_mak
diff --git a/meson.build b/meson.build
index bb4259e7f0..c48ca0d12a 100644
--- a/meson.build
+++ b/meson.build
@@ -1482,7 +1482,7 @@ if targetos == 'windows'
   endif
   summary_info += {'QGA VSS support':   config_host.has_key('CONFIG_QGA_VSS')}
   summary_info += {'QGA w32 disk info': config_host.has_key('CONFIG_QGA_NTDDSCSI')}
-  summary_info += {'QGA MSI support':   config_host.has_key('CONFIG_QGA_MSI_ENABLED')}
+  summary_info += {'QGA MSI support':   config_host.has_key('CONFIG_QGA_MSI')}
 endif
 summary_info += {'seccomp support':   config_host.has_key('CONFIG_SECCOMP')}
 summary_info += {'coroutine backend': config_host['CONFIG_COROUTINE_BACKEND']}
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 19/92] hw/char/serial: Assert serial_ioport_read/write offset fits 8 bytes
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (17 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 18/92] configure: rename QEMU_GA_MSI_ENABLED to CONFIG_QGA_MSI Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-11-18 15:40   ` Peter Maydell
  2020-09-24  9:22 ` [PULL 20/92] hw/char/serial: Replace commented DPRINTF() by trace event Paolo Bonzini
                   ` (74 subsequent siblings)
  93 siblings, 1 reply; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Richard Henderson, Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

The serial device has 8 registers, each 8-bit. The MemoryRegionOps
'serial_io_ops' is initialized with max_access_size=1, and all
memory_region_init_io() callers correctly set the region size to
8 bytes:
- serial_io_realize
- serial_isa_realizefn
- serial_pci_realize
- multi_serial_pci_realize

It is safe to assert the offset argument of serial_ioport_read()
and serial_ioport_write() is always less than 8.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20200907015535.827885-2-f4bug@amsat.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/char/serial.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/char/serial.c b/hw/char/serial.c
index fd80ae5592..840da89de7 100644
--- a/hw/char/serial.c
+++ b/hw/char/serial.c
@@ -344,7 +344,7 @@ static void serial_ioport_write(void *opaque, hwaddr addr, uint64_t val,
 {
     SerialState *s = opaque;
 
-    addr &= 7;
+    assert(size == 1 && addr < 8);
     trace_serial_ioport_write(addr, val);
     switch(addr) {
     default:
@@ -485,7 +485,7 @@ static uint64_t serial_ioport_read(void *opaque, hwaddr addr, unsigned size)
     SerialState *s = opaque;
     uint32_t ret;
 
-    addr &= 7;
+    assert(size == 1 && addr < 8);
     switch(addr) {
     default:
     case 0:
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 20/92] hw/char/serial: Replace commented DPRINTF() by trace event
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (18 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 19/92] hw/char/serial: Assert serial_ioport_read/write offset fits 8 bytes Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 21/92] hw/char/serial: Remove old DEBUG_SERIAL commented code Paolo Bonzini
                   ` (73 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Richard Henderson, Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

Convert the old debug PRINTF() call to display the UART
baudrate to a trace event.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20200907015535.827885-3-f4bug@amsat.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/char/serial.c     | 4 +---
 hw/char/trace-events | 1 +
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/hw/char/serial.c b/hw/char/serial.c
index 840da89de7..e8029f840a 100644
--- a/hw/char/serial.c
+++ b/hw/char/serial.c
@@ -187,9 +187,7 @@ static void serial_update_parameters(SerialState *s)
     ssp.stop_bits = stop_bits;
     s->char_transmit_time =  (NANOSECONDS_PER_SECOND / speed) * frame_size;
     qemu_chr_fe_ioctl(&s->chr, CHR_IOCTL_SERIAL_SET_PARAMS, &ssp);
-
-    DPRINTF("speed=%.2f parity=%c data=%d stop=%d\n",
-           speed, parity, data_bits, stop_bits);
+    trace_serial_update_parameters(speed, parity, data_bits, stop_bits);
 }
 
 static void serial_update_msl(SerialState *s)
diff --git a/hw/char/trace-events b/hw/char/trace-events
index 2442a9f7d5..17304bef26 100644
--- a/hw/char/trace-events
+++ b/hw/char/trace-events
@@ -7,6 +7,7 @@ parallel_ioport_write(const char *desc, uint16_t addr, uint8_t value) "write [%s
 # serial.c
 serial_ioport_read(uint16_t addr, uint8_t value) "read addr 0x%02x val 0x%02x"
 serial_ioport_write(uint16_t addr, uint8_t value) "write addr 0x%02x val 0x%02x"
+serial_update_parameters(uint64_t baudrate, char parity, int data_bits, int stop_bits) "baudrate=%"PRIu64" parity='%c' data=%d stop=%d"
 
 # virtio-serial-bus.c
 virtio_serial_send_control_event(unsigned int port, uint16_t event, uint16_t value) "port %u, event %u, value %u"
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 21/92] hw/char/serial: Remove old DEBUG_SERIAL commented code
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (19 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 20/92] hw/char/serial: Replace commented DPRINTF() by trace event Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 22/92] hw/char/serial: Rename I/O read/write trace events Paolo Bonzini
                   ` (72 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Richard Henderson, Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

All useful DPRINTF() calls have been converted to trace
events.  Remove a pointless one in the IOEventHandler,
and drop the DEBUG_SERIAL ifdef'ry.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20200907015535.827885-4-f4bug@amsat.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/char/serial.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/hw/char/serial.c b/hw/char/serial.c
index e8029f840a..26f7fa8a21 100644
--- a/hw/char/serial.c
+++ b/hw/char/serial.c
@@ -36,8 +36,6 @@
 #include "trace.h"
 #include "hw/qdev-properties.h"
 
-//#define DEBUG_SERIAL
-
 #define UART_LCR_DLAB	0x80	/* Divisor latch access bit */
 
 #define UART_IER_MSI	0x08	/* Enable Modem status interrupt */
@@ -102,14 +100,6 @@
 
 #define MAX_XMIT_RETRY      4
 
-#ifdef DEBUG_SERIAL
-#define DPRINTF(fmt, ...) \
-do { fprintf(stderr, "serial: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...) \
-do {} while (0)
-#endif
-
 static void serial_receive1(void *opaque, const uint8_t *buf, int size);
 static void serial_xmit(SerialState *s);
 
@@ -636,7 +626,6 @@ static void serial_receive1(void *opaque, const uint8_t *buf, int size)
 static void serial_event(void *opaque, QEMUChrEvent event)
 {
     SerialState *s = opaque;
-    DPRINTF("event %x\n", event);
     if (event == CHR_EVENT_BREAK)
         serial_receive_break(s);
 }
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 22/92] hw/char/serial: Rename I/O read/write trace events
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (20 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 21/92] hw/char/serial: Remove old DEBUG_SERIAL commented code Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 23/92] hw/char/serial: Make 'wakeup' property boolean Paolo Bonzini
                   ` (71 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Richard Henderson, Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

The serial_mm_read/write() handlers from the TYPE_SERIAL_MM device
call the serial_ioport_read/write() handlers with shifted offset.

When looking at the trace events from this MMIO device, it is
confusing to read the accesses as I/O. Simplify using generic
trace event names which make sense the various uses.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20200907015535.827885-5-f4bug@amsat.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/char/serial.c     | 4 ++--
 hw/char/trace-events | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/char/serial.c b/hw/char/serial.c
index 26f7fa8a21..7b5ef872bd 100644
--- a/hw/char/serial.c
+++ b/hw/char/serial.c
@@ -333,7 +333,7 @@ static void serial_ioport_write(void *opaque, hwaddr addr, uint64_t val,
     SerialState *s = opaque;
 
     assert(size == 1 && addr < 8);
-    trace_serial_ioport_write(addr, val);
+    trace_serial_write(addr, val);
     switch(addr) {
     default:
     case 0:
@@ -550,7 +550,7 @@ static uint64_t serial_ioport_read(void *opaque, hwaddr addr, unsigned size)
         ret = s->scr;
         break;
     }
-    trace_serial_ioport_read(addr, ret);
+    trace_serial_read(addr, ret);
     return ret;
 }
 
diff --git a/hw/char/trace-events b/hw/char/trace-events
index 17304bef26..609df10fed 100644
--- a/hw/char/trace-events
+++ b/hw/char/trace-events
@@ -5,8 +5,8 @@ parallel_ioport_read(const char *desc, uint16_t addr, uint8_t value) "read [%s]
 parallel_ioport_write(const char *desc, uint16_t addr, uint8_t value) "write [%s] addr 0x%02x val 0x%02x"
 
 # serial.c
-serial_ioport_read(uint16_t addr, uint8_t value) "read addr 0x%02x val 0x%02x"
-serial_ioport_write(uint16_t addr, uint8_t value) "write addr 0x%02x val 0x%02x"
+serial_read(uint16_t addr, uint8_t value) "read addr 0x%02x val 0x%02x"
+serial_write(uint16_t addr, uint8_t value) "write addr 0x%02x val 0x%02x"
 serial_update_parameters(uint64_t baudrate, char parity, int data_bits, int stop_bits) "baudrate=%"PRIu64" parity='%c' data=%d stop=%d"
 
 # virtio-serial-bus.c
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 23/92] hw/char/serial: Make 'wakeup' property boolean
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (21 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 22/92] hw/char/serial: Rename I/O read/write trace events Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 24/92] hw/char/serial-{isa, pci}: Alias QDEV properties from generic serial object Paolo Bonzini
                   ` (70 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Richard Henderson, Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

Make the "wakeup" property introduced in commit 9826fd597df
("suspend: make serial ports wakeup the guest") a boolean.

As we want to reuse the generic serial properties in the
ISA model (next commit), expose this property.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20200907015535.827885-6-f4bug@amsat.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/char/serial-isa.c     | 2 +-
 hw/char/serial.c         | 1 +
 include/hw/char/serial.h | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/hw/char/serial-isa.c b/hw/char/serial-isa.c
index 32c2fc0ebe..fc8ff7823a 100644
--- a/hw/char/serial-isa.c
+++ b/hw/char/serial-isa.c
@@ -117,7 +117,7 @@ static Property serial_isa_properties[] = {
     DEFINE_PROP_UINT32("iobase",  ISASerialState, iobase,  -1),
     DEFINE_PROP_UINT32("irq",    ISASerialState, isairq,  -1),
     DEFINE_PROP_CHR("chardev",   ISASerialState, state.chr),
-    DEFINE_PROP_UINT32("wakeup", ISASerialState, state.wakeup, 0),
+    DEFINE_PROP_BOOL("wakeup",   ISASerialState, state.wakeup, false),
     DEFINE_PROP_END_OF_LIST(),
 };
 
diff --git a/hw/char/serial.c b/hw/char/serial.c
index 7b5ef872bd..4386adabd4 100644
--- a/hw/char/serial.c
+++ b/hw/char/serial.c
@@ -975,6 +975,7 @@ const MemoryRegionOps serial_io_ops = {
 static Property serial_properties[] = {
     DEFINE_PROP_CHR("chardev", SerialState, chr),
     DEFINE_PROP_UINT32("baudbase", SerialState, baudbase, 115200),
+    DEFINE_PROP_BOOL("wakeup", SerialState, wakeup, false),
     DEFINE_PROP_END_OF_LIST(),
 };
 
diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h
index 23bd7d3dde..8ba7eca3d6 100644
--- a/include/hw/char/serial.h
+++ b/include/hw/char/serial.h
@@ -61,7 +61,7 @@ struct SerialState {
     uint32_t baudbase;
     uint32_t tsr_retry;
     guint watch_tag;
-    uint32_t wakeup;
+    bool wakeup;
 
     /* Time when the last byte was successfully sent out of the tsr */
     uint64_t last_xmit_ts;
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 24/92] hw/char/serial-{isa, pci}: Alias QDEV properties from generic serial object
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (22 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 23/92] hw/char/serial: Make 'wakeup' property boolean Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 25/92] scsi-generic: Fix HM-zoned device scan Paolo Bonzini
                   ` (69 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Richard Henderson, Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

Instead of overwritting the properties of the generic 'state'
object, alias them.
Note we can now propagate the "baudbase" property.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20200907015535.827885-7-f4bug@amsat.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/char/serial-isa.c | 4 ++--
 hw/char/serial-pci.c | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/hw/char/serial-isa.c b/hw/char/serial-isa.c
index fc8ff7823a..1b8b303079 100644
--- a/hw/char/serial-isa.c
+++ b/hw/char/serial-isa.c
@@ -116,8 +116,6 @@ static Property serial_isa_properties[] = {
     DEFINE_PROP_UINT32("index",  ISASerialState, index,   -1),
     DEFINE_PROP_UINT32("iobase",  ISASerialState, iobase,  -1),
     DEFINE_PROP_UINT32("irq",    ISASerialState, isairq,  -1),
-    DEFINE_PROP_CHR("chardev",   ISASerialState, state.chr),
-    DEFINE_PROP_BOOL("wakeup",   ISASerialState, state.wakeup, false),
     DEFINE_PROP_END_OF_LIST(),
 };
 
@@ -138,6 +136,8 @@ static void serial_isa_initfn(Object *o)
     ISASerialState *self = ISA_SERIAL(o);
 
     object_initialize_child(o, "serial", &self->state, TYPE_SERIAL);
+
+    qdev_alias_all_properties(DEVICE(&self->state), o);
 }
 
 static const TypeInfo serial_isa_info = {
diff --git a/hw/char/serial-pci.c b/hw/char/serial-pci.c
index b0520a5a09..93d6f99244 100644
--- a/hw/char/serial-pci.c
+++ b/hw/char/serial-pci.c
@@ -82,7 +82,6 @@ static const VMStateDescription vmstate_pci_serial = {
 };
 
 static Property serial_pci_properties[] = {
-    DEFINE_PROP_CHR("chardev",  PCISerialState, state.chr),
     DEFINE_PROP_UINT8("prog_if",  PCISerialState, prog_if, 0x02),
     DEFINE_PROP_END_OF_LIST(),
 };
@@ -107,6 +106,8 @@ static void serial_pci_init(Object *o)
     PCISerialState *ps = PCI_SERIAL(o);
 
     object_initialize_child(o, "serial", &ps->state, TYPE_SERIAL);
+
+    qdev_alias_all_properties(DEVICE(&ps->state), o);
 }
 
 static const TypeInfo serial_pci_info = {
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 25/92] scsi-generic: Fix HM-zoned device scan
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (23 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 24/92] hw/char/serial-{isa, pci}: Alias QDEV properties from generic serial object Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 26/92] hw: megasas: return -1 when 'megasas_map_sgl' fails Paolo Bonzini
                   ` (68 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Dmitry Fomichev, Johannes Thumshirn

From: Dmitry Fomichev <dmitry.fomichev@wdc.com>

Several important steps during device scan depend on SCSI type of the
device. For example, max_transfer property is only determined and
assigned if the device has the type of TYPE_DISK.

Host-managed ZBC disks retain most of the properties of regular SCSI
drives, but they have their own SCSI device type, 0x14. This prevents
the proper assignment of max_transfer property for HM-zoned devices in
scsi-generic driver leading to I/O errors if the maximum i/o size
calculated at the guest exceeds the host value.

To fix this, define TYPE_ZBC to have the standard value from SCSI ZBC
standard spec. Several scan steps that were previously done only for
TYPE_DISK devices, are now performed for the SCSI devices having
TYPE_ZBC too.

Reported-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Message-Id: <20200811225122.17342-3-dmitry.fomichev@wdc.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/scsi/scsi-generic.c   | 10 ++++++----
 include/scsi/constants.h |  1 +
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
index 86ed0a3822..2cb23ca891 100644
--- a/hw/scsi/scsi-generic.c
+++ b/hw/scsi/scsi-generic.c
@@ -162,7 +162,8 @@ static void scsi_handle_inquiry_reply(SCSIGenericReq *r, SCSIDevice *s)
         }
     }
 
-    if (s->type == TYPE_DISK && (r->req.cmd.buf[1] & 0x01)) {
+    if ((s->type == TYPE_DISK || s->type == TYPE_ZBC) &&
+        (r->req.cmd.buf[1] & 0x01)) {
         page = r->req.cmd.buf[2];
         if (page == 0xb0) {
             uint32_t max_transfer =
@@ -299,10 +300,11 @@ static void scsi_read_complete(void * opaque, int ret)
     }
     blk_set_guest_block_size(s->conf.blk, s->blocksize);
 
-    /* Patch MODE SENSE device specific parameters if the BDS is opened
+    /*
+     * Patch MODE SENSE device specific parameters if the BDS is opened
      * readonly.
      */
-    if ((s->type == TYPE_DISK || s->type == TYPE_TAPE) &&
+    if ((s->type == TYPE_DISK || s->type == TYPE_TAPE || s->type == TYPE_ZBC) &&
         blk_is_read_only(s->conf.blk) &&
         (r->req.cmd.buf[0] == MODE_SENSE ||
          r->req.cmd.buf[0] == MODE_SENSE_10) &&
@@ -617,7 +619,7 @@ static void scsi_generic_read_device_identification(SCSIDevice *s)
 void scsi_generic_read_device_inquiry(SCSIDevice *s)
 {
     scsi_generic_read_device_identification(s);
-    if (s->type == TYPE_DISK) {
+    if (s->type == TYPE_DISK || s->type == TYPE_ZBC) {
         scsi_generic_set_vpd_bl_emulation(s);
     } else {
         s->needs_vpd_bl_emulation = false;
diff --git a/include/scsi/constants.h b/include/scsi/constants.h
index 874176019e..2a32c08b5e 100644
--- a/include/scsi/constants.h
+++ b/include/scsi/constants.h
@@ -218,6 +218,7 @@
 #define TYPE_ENCLOSURE      0x0d    /* Enclosure Services Device */
 #define TYPE_RBC            0x0e    /* Simplified Direct-Access Device */
 #define TYPE_OSD            0x11    /* Object-storage Device */
+#define TYPE_ZBC            0x14    /* Host-managed Zoned SCSI Device */
 #define TYPE_WLUN           0x1e    /* Well known LUN */
 #define TYPE_NOT_PRESENT    0x1f
 #define TYPE_INACTIVE       0x20
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 26/92] hw: megasas: return -1 when 'megasas_map_sgl' fails
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (24 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 25/92] scsi-generic: Fix HM-zoned device scan Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 27/92] hw: megasas: consider 'iov_count=0' is an error in megasas_map_sgl Paolo Bonzini
                   ` (67 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Li Qiang

From: Li Qiang <liq3ea@163.com>

The caller of 'megasas_map_sgl' will only check if the return
is zero or not. If it return 0 it means success, as in the next
patch we will consider 'iov_count=0' is an error, so let's
return -1 to indicate a failure.

Signed-off-by: Li Qiang <liq3ea@163.com>
Message-Id: <20200815141940.44025-2-liq3ea@163.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/scsi/megasas.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
index e90c00823a..4cc709d2c6 100644
--- a/hw/scsi/megasas.c
+++ b/hw/scsi/megasas.c
@@ -280,7 +280,7 @@ static int megasas_map_sgl(MegasasState *s, MegasasCmd *cmd, union mfi_sgl *sgl)
     if (iov_count > MEGASAS_MAX_SGE) {
         trace_megasas_iovec_sgl_overflow(cmd->index, iov_count,
                                          MEGASAS_MAX_SGE);
-        return iov_count;
+        return -1;
     }
     pci_dma_sglist_init(&cmd->qsg, PCI_DEVICE(s), iov_count);
     for (i = 0; i < iov_count; i++) {
@@ -310,7 +310,7 @@ static int megasas_map_sgl(MegasasState *s, MegasasCmd *cmd, union mfi_sgl *sgl)
     return 0;
 unmap:
     qemu_sglist_destroy(&cmd->qsg);
-    return iov_count - i;
+    return -1;
 }
 
 /*
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 27/92] hw: megasas: consider 'iov_count=0' is an error in megasas_map_sgl
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (25 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 26/92] hw: megasas: return -1 when 'megasas_map_sgl' fails Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 28/92] i386/cpu: Clear FEAT_XSAVE_COMP_{LO, HI} when XSAVE is not available Paolo Bonzini
                   ` (66 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alexander Bulekov, Li Qiang

From: Li Qiang <liq3ea@163.com>

Currently in 'megasas_map_sgl' when 'iov_count=0' will just return
success however the 'cmd' doens't contain any iov. This will cause
the assert in 'scsi_dma_complete' failed. This is because in
'dma_blk_cb' the 'dbs->sg_cur_index == dbs->sg->nsg' will be true
and just call 'dma_complete'. However now there is no aiocb returned.

This fixes the LP#1878263:

-->https://bugs.launchpad.net/qemu/+bug/1878263

Reported-by: Alexander Bulekov <alxndr@bu.edu>
Signed-off-by: Li Qiang <liq3ea@163.com>
Message-Id: <20200815141940.44025-3-liq3ea@163.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/scsi/megasas.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
index 4cc709d2c6..e24c12d7ee 100644
--- a/hw/scsi/megasas.c
+++ b/hw/scsi/megasas.c
@@ -277,7 +277,7 @@ static int megasas_map_sgl(MegasasState *s, MegasasCmd *cmd, union mfi_sgl *sgl)
 
     cmd->flags = le16_to_cpu(cmd->frame->header.flags);
     iov_count = cmd->frame->header.sge_count;
-    if (iov_count > MEGASAS_MAX_SGE) {
+    if (!iov_count || iov_count > MEGASAS_MAX_SGE) {
         trace_megasas_iovec_sgl_overflow(cmd->index, iov_count,
                                          MEGASAS_MAX_SGE);
         return -1;
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 28/92] i386/cpu: Clear FEAT_XSAVE_COMP_{LO, HI} when XSAVE is not available
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (26 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 27/92] hw: megasas: consider 'iov_count=0' is an error in megasas_map_sgl Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 29/92] meson: move libudev test Paolo Bonzini
                   ` (65 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Xiaoyao Li

From: Xiaoyao Li <xiaoyao.li@intel.com>

Per Intel SDM vol 1, 13.2, if CPUID.1:ECX.XSAVE[bit 26] is 0, the
processor provides no further enumeration through CPUID function 0DH.
QEMU does not do this for "-cpu host,-xsave".

Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Message-Id: <20200716082019.215316-2-xiaoyao.li@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target/i386/cpu.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 23e9a17a04..7eb708bedb 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -6268,6 +6268,8 @@ static void x86_cpu_enable_xsave_components(X86CPU *cpu)
     uint64_t mask;
 
     if (!(env->features[FEAT_1_ECX] & CPUID_EXT_XSAVE)) {
+        env->features[FEAT_XSAVE_COMP_LO] = 0;
+        env->features[FEAT_XSAVE_COMP_HI] = 0;
         return;
     }
 
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 29/92] meson: move libudev test
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (27 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 28/92] i386/cpu: Clear FEAT_XSAVE_COMP_{LO, HI} when XSAVE is not available Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 30/92] meson: move libmpathpersist test Paolo Bonzini
                   ` (64 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure   | 14 --------------
 meson.build |  7 ++++---
 2 files changed, 4 insertions(+), 17 deletions(-)

diff --git a/configure b/configure
index 01fce2e94b..c05d1a04e9 100755
--- a/configure
+++ b/configure
@@ -908,7 +908,6 @@ Linux)
   linux_user="yes"
   kvm="yes"
   QEMU_INCLUDES="-isystem ${source_path}/linux-headers -Ilinux-headers $QEMU_INCLUDES"
-  libudev="yes"
 ;;
 esac
 
@@ -6286,15 +6285,6 @@ if test "$libnfs" != "no" ; then
 fi
 
 ##########################################
-# Do we have libudev
-if test "$libudev" != "no" ; then
-  if $pkg_config libudev && test "$static" != "yes"; then
-    libudev="yes"
-    libudev_libs=$($pkg_config --libs libudev)
-  else
-    libudev="no"
-  fi
-fi
 
 # Exclude --warn-common with TSan to suppress warnings from the TSan libraries.
 if test "$solaris" = "no" && test "$tsan" = "no"; then
@@ -7463,10 +7453,6 @@ if test "$gcov" = "yes" ; then
   echo "CONFIG_GCOV=y" >> $config_host_mak
 fi
 
-if test "$libudev" != "no"; then
-    echo "CONFIG_LIBUDEV=y" >> $config_host_mak
-    echo "LIBUDEV_LIBS=$libudev_libs" >> $config_host_mak
-fi
 if test "$fuzzing" != "no"; then
     echo "CONFIG_FUZZ=y" >> $config_host_mak
 fi
diff --git a/meson.build b/meson.build
index c48ca0d12a..76e1f90943 100644
--- a/meson.build
+++ b/meson.build
@@ -257,8 +257,8 @@ if 'CONFIG_CURL' in config_host
                             link_args: config_host['CURL_LIBS'].split())
 endif
 libudev = not_found
-if 'CONFIG_LIBUDEV' in config_host
-  libudev = declare_dependency(link_args: config_host['LIBUDEV_LIBS'].split())
+if target_os == 'linux'
+  libudev = dependency('libudev', static: enable_static)
 endif
 brlapi = not_found
 if 'CONFIG_BRLAPI' in config_host
@@ -440,6 +440,7 @@ has_gettid = cc.has_function('gettid')
 
 # Create config-host.h
 
+config_host_data.set('CONFIG_LIBUDEV', libudev.found())
 config_host_data.set('CONFIG_SDL', sdl.found())
 config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())
 config_host_data.set('CONFIG_VNC', vnc.found())
@@ -1520,7 +1521,7 @@ summary_info += {'sheepdog support':  config_host.has_key('CONFIG_SHEEPDOG')}
 summary_info += {'capstone':          config_host.has_key('CONFIG_CAPSTONE')}
 summary_info += {'libpmem support':   config_host.has_key('CONFIG_LIBPMEM')}
 summary_info += {'libdaxctl support': config_host.has_key('CONFIG_LIBDAXCTL')}
-summary_info += {'libudev':           config_host.has_key('CONFIG_LIBUDEV')}
+summary_info += {'libudev':           libudev.found()}
 summary_info += {'default devices':   config_host['CONFIG_MINIKCONF_MODE'] == '--defconfig'}
 summary_info += {'plugin support':    config_host.has_key('CONFIG_PLUGIN')}
 summary_info += {'fuzzing support':   config_host.has_key('CONFIG_FUZZ')}
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 30/92] meson: move libmpathpersist test
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (28 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 29/92] meson: move libudev test Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 31/92] meson: extend libmpathpersist test for static linking Paolo Bonzini
                   ` (63 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel

This is the first compiler/linker test that has been moved to Meson.
Add more section headings to keep things clearer.

This also fixes static linking to libmpathpersist, which has a
dependency on libmultipath but no pkg-config file to describe it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure         | 77 +++----------------------------------------
 meson.build       | 83 ++++++++++++++++++++++++++++++++++++++++++-----
 meson_options.txt |  2 ++
 3 files changed, 81 insertions(+), 81 deletions(-)

diff --git a/configure b/configure
index c05d1a04e9..6cffe0fde8 100755
--- a/configure
+++ b/configure
@@ -403,7 +403,7 @@ netmap="no"
 sdl="auto"
 sdl_image="auto"
 virtfs=""
-mpath=""
+mpath="auto"
 vnc="enabled"
 sparse="no"
 vde=""
@@ -1116,9 +1116,9 @@ for opt do
   ;;
   --enable-virtfs) virtfs="yes"
   ;;
-  --disable-mpath) mpath="no"
+  --disable-mpath) mpath="disabled"
   ;;
-  --enable-mpath) mpath="yes"
+  --enable-mpath) mpath="enabled"
   ;;
   --disable-vnc) vnc="disabled"
   ;;
@@ -3851,57 +3851,6 @@ if test "$modules" = yes; then
     fi
 fi
 
-##########################################
-# libmpathpersist probe
-
-if test "$mpath" != "no" ; then
-  # probe for the new API
-  cat > $TMPC <<EOF
-#include <libudev.h>
-#include <mpath_persist.h>
-unsigned mpath_mx_alloc_len = 1024;
-int logsink;
-static struct config *multipath_conf;
-extern struct udev *udev;
-extern struct config *get_multipath_config(void);
-extern void put_multipath_config(struct config *conf);
-struct udev *udev;
-struct config *get_multipath_config(void) { return multipath_conf; }
-void put_multipath_config(struct config *conf) { }
-
-int main(void) {
-    udev = udev_new();
-    multipath_conf = mpath_lib_init();
-    return 0;
-}
-EOF
-  if compile_prog "" "-ludev -lmultipath -lmpathpersist" ; then
-    mpathpersist=yes
-    mpathpersist_new_api=yes
-  else
-    # probe for the old API
-    cat > $TMPC <<EOF
-#include <libudev.h>
-#include <mpath_persist.h>
-unsigned mpath_mx_alloc_len = 1024;
-int logsink;
-int main(void) {
-    struct udev *udev = udev_new();
-    mpath_lib_init(udev);
-    return 0;
-}
-EOF
-    if compile_prog "" "-ludev -lmultipath -lmpathpersist" ; then
-      mpathpersist=yes
-      mpathpersist_new_api=no
-    else
-      mpathpersist=no
-    fi
-  fi
-else
-  mpathpersist=no
-fi
-
 ##########################################
 # pthread probe
 PTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
@@ -6343,23 +6292,11 @@ if test "$softmmu" = yes ; then
       fi
       virtfs=no
     fi
-    if test "$mpath" != no && test "$mpathpersist" = yes ; then
-      mpath=yes
-    else
-      if test "$mpath" = yes; then
-        error_exit "Multipath requires libmpathpersist devel"
-      fi
-      mpath=no
-    fi
   else
     if test "$virtfs" = yes; then
       error_exit "VirtFS is supported only on Linux"
     fi
     virtfs=no
-    if test "$mpath" = yes; then
-      error_exit "Multipath is supported only on Linux"
-    fi
-    mpath=no
   fi
 fi
 
@@ -6900,12 +6837,6 @@ fi
 if test "$virtfs" = "yes" ; then
   echo "CONFIG_VIRTFS=y" >> $config_host_mak
 fi
-if test "$mpath" = "yes" ; then
-  echo "CONFIG_MPATH=y" >> $config_host_mak
-  if test "$mpathpersist_new_api" = "yes"; then
-    echo "CONFIG_MPATH_NEW_API=y" >> $config_host_mak
-  fi
-fi
 if test "$vhost_scsi" = "yes" ; then
   echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
 fi
@@ -7995,7 +7926,7 @@ NINJA=${ninja:-$PWD/ninjatool} $meson setup \
         -Dstrip=$(if test "$strip_opt" = yes; then echo true; else echo false; fi) \
         -Db_pie=$(if test "$pie" = yes; then echo true; else echo false; fi) \
         -Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \
-	-Dsdl=$sdl -Dsdl_image=$sdl_image \
+	-Dmpath=$mpath -Dsdl=$sdl -Dsdl_image=$sdl_image \
 	-Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \
 	-Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f\
         $cross_arg \
diff --git a/meson.build b/meson.build
index 76e1f90943..86b6fe49c4 100644
--- a/meson.build
+++ b/meson.build
@@ -86,6 +86,14 @@ if 'SPARSE_CFLAGS' in config_host
                        'compile_commands.json'])
 endif
 
+###########################################
+# Target-specific checks and dependencies #
+###########################################
+
+if targetos != 'linux' and get_option('mpath').enabled()
+  error('Multipath is supported only on Linux')
+endif
+
 m = cc.find_library('m', required: false)
 util = cc.find_library('util', required: false)
 winmm = []
@@ -117,6 +125,11 @@ elif targetos == 'haiku'
             cc.find_library('network'),
             cc.find_library('bsd')]
 endif
+
+################
+# Dependencies #
+################
+
 # The path to glib.h is added to all compilation commands.  This was
 # grandfathered in from the QEMU Makefiles.
 add_project_arguments(config_host['GLIB_CFLAGS'].split(),
@@ -223,10 +236,6 @@ if 'CONFIG_SPICE' in config_host
                              link_args: config_host['SPICE_LIBS'].split())
 endif
 rt = cc.find_library('rt', required: false)
-libmpathpersist = not_found
-if config_host.has_key('CONFIG_MPATH')
-  libmpathpersist = cc.find_library('mpathpersist')
-endif
 libdl = not_found
 if 'CONFIG_PLUGIN' in config_host
   libdl = cc.find_library('dl', required: true)
@@ -257,9 +266,65 @@ if 'CONFIG_CURL' in config_host
                             link_args: config_host['CURL_LIBS'].split())
 endif
 libudev = not_found
-if target_os == 'linux'
-  libudev = dependency('libudev', static: enable_static)
+if targetos == 'linux'
+  libudev = dependency('libudev',
+                       required: get_option('mpath').enabled(),
+                       static: enable_static)
+endif
+
+mpathpersist = not_found
+mpathpersist_new_api = false
+if targetos == 'linux' and not get_option('mpath').disabled()
+  mpath_test_source_new = '''
+    #include <libudev.h>
+    #include <mpath_persist.h>
+    unsigned mpath_mx_alloc_len = 1024;
+    int logsink;
+    static struct config *multipath_conf;
+    extern struct udev *udev;
+    extern struct config *get_multipath_config(void);
+    extern void put_multipath_config(struct config *conf);
+    struct udev *udev;
+    struct config *get_multipath_config(void) { return multipath_conf; }
+    void put_multipath_config(struct config *conf) { }
+    int main(void) {
+        udev = udev_new();
+        multipath_conf = mpath_lib_init();
+        return 0;
+    }'''
+  mpath_test_source_old = '''
+      #include <libudev.h>
+      #include <mpath_persist.h>
+      unsigned mpath_mx_alloc_len = 1024;
+      int logsink;
+      int main(void) {
+          struct udev *udev = udev_new();
+          mpath_lib_init(udev);
+          return 0;
+      }'''
+  libmultipath = cc.find_library('multipath',
+                                 required: get_option('mpath'),
+                                 static: enable_static)
+  libmpathpersist = cc.find_library('mpathpersist',
+                                    required: get_option('mpath'),
+                                    static: enable_static)
+  if libmultipath.found() and libmpathpersist.found() and libudev.found()
+    mpathlibs = [libmultipath, libmpathpersist, libudev]
+    if cc.links(mpath_test_source_new, dependencies: mpathlibs)
+      mpathpersist = declare_dependency(dependencies: mpathlibs)
+      mpathpersist_new_api = true
+    elif cc.links(mpath_test_source_old, dependencies: mpathlibs)
+      mpathpersist = declare_dependency(dependencies: mpathlibs)
+    else
+      if get_option('mpath').enabled()
+        error('Cannot detect libmpathpersist API')
+      else
+        warning('Cannot detect libmpathpersist API, disabling')
+      endif
+    endif
+  endif
 endif
+
 brlapi = not_found
 if 'CONFIG_BRLAPI' in config_host
   brlapi = declare_dependency(link_args: config_host['BRLAPI_LIBS'].split())
@@ -441,6 +506,8 @@ has_gettid = cc.has_function('gettid')
 # Create config-host.h
 
 config_host_data.set('CONFIG_LIBUDEV', libudev.found())
+config_host_data.set('CONFIG_MPATH', mpathpersist.found())
+config_host_data.set('CONFIG_MPATH_NEW_API', mpathpersist_new_api)
 config_host_data.set('CONFIG_SDL', sdl.found())
 config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())
 config_host_data.set('CONFIG_VNC', vnc.found())
@@ -1190,7 +1257,7 @@ if have_tools
 
     executable('qemu-pr-helper', files('scsi/qemu-pr-helper.c', 'scsi/utils.c'),
                dependencies: [authz, crypto, io, qom, qemuutil,
-                              libcap_ng, libudev, libmpathpersist],
+                              libcap_ng, mpathpersist],
                install: true)
   endif
 
@@ -1412,7 +1479,7 @@ summary_info += {'Audio drivers':     config_host['CONFIG_AUDIO_DRIVERS']}
 summary_info += {'Block whitelist (rw)': config_host['CONFIG_BDRV_RW_WHITELIST']}
 summary_info += {'Block whitelist (ro)': config_host['CONFIG_BDRV_RO_WHITELIST']}
 summary_info += {'VirtFS support':    config_host.has_key('CONFIG_VIRTFS')}
-summary_info += {'Multipath support': config_host.has_key('CONFIG_MPATH')}
+summary_info += {'Multipath support': mpathpersist.found()}
 summary_info += {'VNC support':       vnc.found()}
 if vnc.found()
   summary_info += {'VNC SASL support':  sasl.found()}
diff --git a/meson_options.txt b/meson_options.txt
index 543cf70043..b38a6ae92a 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -6,6 +6,8 @@ option('docdir', type : 'string', value : 'doc',
 option('gettext', type : 'boolean', value : true,
        description: 'Localization of the GTK+ user interface')
 
+option('mpath', type : 'feature', value : 'auto',
+       description: 'Multipath persistent reservation passthrough')
 option('sdl', type : 'feature', value : 'auto',
        description: 'SDL user interface')
 option('sdl_image', type : 'feature', value : 'auto',
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 31/92] meson: extend libmpathpersist test for static linking
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (29 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 30/92] meson: move libmpathpersist test Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 32/92] configure: move malloc_trim/tcmalloc/jemalloc to meson Paolo Bonzini
                   ` (62 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel

libmultipath has a dependency on libdevmapper, so
include it as well when static linking.  It seems that
the rabbit hole ends there.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 meson.build | 27 +++++++++++++++++++--------
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/meson.build b/meson.build
index 86b6fe49c4..eff3fb0f72 100644
--- a/meson.build
+++ b/meson.build
@@ -302,14 +302,25 @@ if targetos == 'linux' and not get_option('mpath').disabled()
           mpath_lib_init(udev);
           return 0;
       }'''
-  libmultipath = cc.find_library('multipath',
-                                 required: get_option('mpath'),
-                                 static: enable_static)
-  libmpathpersist = cc.find_library('mpathpersist',
-                                    required: get_option('mpath'),
-                                    static: enable_static)
-  if libmultipath.found() and libmpathpersist.found() and libudev.found()
-    mpathlibs = [libmultipath, libmpathpersist, libudev]
+  mpathlibs = [libudev]
+  if enable_static
+    mpathlibs += cc.find_library('devmapper',
+                                   required: get_option('mpath'),
+                                   static: enable_static)
+  endif
+  mpathlibs += cc.find_library('multipath',
+                               required: get_option('mpath'),
+                               static: enable_static)
+  mpathlibs += cc.find_library('mpathpersist',
+                               required: get_option('mpath'),
+                               static: enable_static)
+  foreach lib: mpathlibs
+    if not lib.found()
+      mpathlibs = []
+      break
+    endif
+  endforeach
+  if mpathlibs.length() > 0
     if cc.links(mpath_test_source_new, dependencies: mpathlibs)
       mpathpersist = declare_dependency(dependencies: mpathlibs)
       mpathpersist_new_api = true
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 32/92] configure: move malloc_trim/tcmalloc/jemalloc to meson
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (30 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 31/92] meson: extend libmpathpersist test for static linking Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 33/92] configure: fix --meson=/path/to/meson Paolo Bonzini
                   ` (61 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Stefan Hajnoczi

Because LIBS is not used anymore, tcmalloc/jemalloc does
not work with binaries whose description is in Meson.
The fix is simply to move them to Meson too.

For consistency with other configure options, specifying
--enable-malloc-trim together with --enable-{tc,je}malloc
becomes a fatal error.

Reported-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure         | 84 +++++------------------------------------------
 meson.build       | 28 +++++++++++++---
 meson_options.txt |  5 +++
 3 files changed, 38 insertions(+), 79 deletions(-)

diff --git a/configure b/configure
index 6cffe0fde8..a65663d531 100755
--- a/configure
+++ b/configure
@@ -549,7 +549,7 @@ skip_meson=no
 gettext=""
 
 bogus_os="no"
-malloc_trim=""
+malloc_trim="auto"
 
 # parse CC options first
 for opt do
@@ -1228,9 +1228,9 @@ for opt do
   ;;
   --enable-tcg) tcg="yes"
   ;;
-  --disable-malloc-trim) malloc_trim="no"
+  --disable-malloc-trim) malloc_trim="disabled"
   ;;
-  --enable-malloc-trim) malloc_trim="yes"
+  --enable-malloc-trim) malloc_trim="enabled"
   ;;
   --disable-spice) spice="no"
   ;;
@@ -4383,77 +4383,14 @@ EOF
   fi
 fi
 
+malloc=system
 if test "$tcmalloc" = "yes" && test "$jemalloc" = "yes" ; then
     echo "ERROR: tcmalloc && jemalloc can't be used at the same time"
     exit 1
-fi
-
-# Even if malloc_trim() is available, these non-libc memory allocators
-# do not support it.
-if test "$tcmalloc" = "yes" || test "$jemalloc" = "yes" ; then
-    if test "$malloc_trim" = "yes" ; then
-        echo "Disabling malloc_trim with non-libc memory allocator"
-    fi
-    malloc_trim="no"
-fi
-
-#######################################
-# malloc_trim
-
-if test "$malloc_trim" != "no" ; then
-    cat > $TMPC << EOF
-#include <malloc.h>
-int main(void) { malloc_trim(0); return 0; }
-EOF
-    if compile_prog "" "" ; then
-        malloc_trim="yes"
-    else
-        malloc_trim="no"
-    fi
-fi
-
-##########################################
-# tcmalloc probe
-
-if test "$tcmalloc" = "yes" ; then
-  cat > $TMPC << EOF
-#include <stdlib.h>
-int main(void) {
-    void *tmp = malloc(1);
-    if (tmp != NULL) {
-        return 0;
-    }
-    return 1;
-}
-EOF
-
-  if compile_prog "" "-ltcmalloc" ; then
-    LIBS="-ltcmalloc $LIBS"
-  else
-    feature_not_found "tcmalloc" "install gperftools devel"
-  fi
-fi
-
-##########################################
-# jemalloc probe
-
-if test "$jemalloc" = "yes" ; then
-  cat > $TMPC << EOF
-#include <stdlib.h>
-int main(void) {
-    void *tmp = malloc(1);
-    if (tmp != NULL) {
-        return 0;
-    }
-    return 1;
-}
-EOF
-
-  if compile_prog "" "-ljemalloc" ; then
-    LIBS="-ljemalloc $LIBS"
-  else
-    feature_not_found "jemalloc" "install jemalloc devel"
-  fi
+elif test "$tcmalloc" = "yes" ; then
+    malloc=tcmalloc
+elif test "$jemalloc" = "yes" ; then
+    malloc=jemalloc
 fi
 
 ##########################################
@@ -6951,10 +6888,6 @@ if test "$gbm" = "yes" ; then
 fi
 
 
-if test "$malloc_trim" = "yes" ; then
-  echo "CONFIG_MALLOC_TRIM=y" >> $config_host_mak
-fi
-
 if test "$avx2_opt" = "yes" ; then
   echo "CONFIG_AVX2_OPT=y" >> $config_host_mak
 fi
@@ -7926,6 +7859,7 @@ NINJA=${ninja:-$PWD/ninjatool} $meson setup \
         -Dstrip=$(if test "$strip_opt" = yes; then echo true; else echo false; fi) \
         -Db_pie=$(if test "$pie" = yes; then echo true; else echo false; fi) \
         -Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \
+	-Dmalloc=$malloc -Dmalloc_trim=$malloc_trim \
 	-Dmpath=$mpath -Dsdl=$sdl -Dsdl_image=$sdl_image \
 	-Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \
 	-Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f\
diff --git a/meson.build b/meson.build
index eff3fb0f72..08ebfca6d0 100644
--- a/meson.build
+++ b/meson.build
@@ -514,6 +514,26 @@ keyutils = dependency('libkeyutils', required: false,
 
 has_gettid = cc.has_function('gettid')
 
+# Malloc tests
+
+malloc = []
+if get_option('malloc') == 'system'
+  has_malloc_trim = \
+    not get_option('malloc_trim').disabled() and \
+    cc.links('''#include <malloc.h>
+                int main(void) { malloc_trim(0); return 0; }''')
+else
+  has_malloc_trim = false
+  malloc = cc.find_library(get_option('malloc'), required: true)
+endif
+if not has_malloc_trim and get_option('malloc_trim').enabled()
+  if get_option('malloc') == 'system'
+    error('malloc_trim not available on this platform.')
+  else
+    error('malloc_trim not available with non-libc memory allocator')
+  endif
+endif
+
 # Create config-host.h
 
 config_host_data.set('CONFIG_LIBUDEV', libudev.found())
@@ -528,6 +548,7 @@ config_host_data.set('CONFIG_VNC_SASL', sasl.found())
 config_host_data.set('CONFIG_XKBCOMMON', xkbcommon.found())
 config_host_data.set('CONFIG_KEYUTILS', keyutils.found())
 config_host_data.set('CONFIG_GETTID', has_gettid)
+config_host_data.set('CONFIG_MALLOC_TRIM', has_malloc_trim)
 config_host_data.set('QEMU_VERSION', '"@0@"'.format(meson.project_version()))
 config_host_data.set('QEMU_VERSION_MAJOR', meson.project_version().split('.')[0])
 config_host_data.set('QEMU_VERSION_MINOR', meson.project_version().split('.')[1])
@@ -896,7 +917,7 @@ util_ss.add_all(trace_ss)
 util_ss = util_ss.apply(config_all, strict: false)
 libqemuutil = static_library('qemuutil',
                              sources: util_ss.sources() + stub_ss.sources() + genh,
-                             dependencies: [util_ss.dependencies(), m, glib, socket])
+                             dependencies: [util_ss.dependencies(), m, glib, socket, malloc])
 qemuutil = declare_dependency(link_with: libqemuutil,
                               sources: genh + version_res)
 
@@ -1520,7 +1541,7 @@ summary_info += {'Install blobs':     config_host.has_key('INSTALL_BLOBS')}
 #  summary_info += {'TCG debug enabled': config_host.has_key('CONFIG_DEBUG_TCG')}
 #  summary_info += {'TCG interpreter':   config_host.has_key('CONFIG_TCG_INTERPRETER')}
 #endif
-summary_info += {'malloc trim support': config_host.has_key('CONFIG_MALLOC_TRIM')}
+summary_info += {'malloc trim support': has_malloc_trim}
 summary_info += {'RDMA support':      config_host.has_key('CONFIG_RDMA')}
 summary_info += {'PVRDMA support':    config_host.has_key('CONFIG_PVRDMA')}
 summary_info += {'fdt support':       config_host.has_key('CONFIG_FDT')}
@@ -1582,8 +1603,7 @@ summary_info += {'lzfse support':     config_host.has_key('CONFIG_LZFSE')}
 summary_info += {'zstd support':      config_host.has_key('CONFIG_ZSTD')}
 summary_info += {'NUMA host support': config_host.has_key('CONFIG_NUMA')}
 summary_info += {'libxml2':           config_host.has_key('CONFIG_LIBXML2')}
-summary_info += {'tcmalloc support':  config_host.has_key('CONFIG_TCMALLOC')}
-summary_info += {'jemalloc support':  config_host.has_key('CONFIG_JEMALLOC')}
+summary_info += {'memory allocator':  get_option('malloc')}
 summary_info += {'avx2 optimization': config_host.has_key('CONFIG_AVX2_OPT')}
 summary_info += {'avx512f optimization': config_host.has_key('CONFIG_AVX512F_OPT')}
 summary_info += {'replication support': config_host.has_key('CONFIG_REPLICATION')}
diff --git a/meson_options.txt b/meson_options.txt
index b38a6ae92a..8a59ec263d 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -6,6 +6,11 @@ option('docdir', type : 'string', value : 'doc',
 option('gettext', type : 'boolean', value : true,
        description: 'Localization of the GTK+ user interface')
 
+option('malloc_trim', type : 'feature', value : 'auto',
+       description: 'enable libc malloc_trim() for memory optimization')
+option('malloc', type : 'combo', choices : ['system', 'tcmalloc', 'jemalloc'],
+       value: 'system', description: 'choose memory allocator to use')
+
 option('mpath', type : 'feature', value : 'auto',
        description: 'Multipath persistent reservation passthrough')
 option('sdl', type : 'feature', value : 'auto',
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 33/92] configure: fix --meson=/path/to/meson
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (31 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 32/92] configure: move malloc_trim/tcmalloc/jemalloc to meson Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 34/92] configure: move cocoa option to Meson Paolo Bonzini
                   ` (60 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Richard Henderson

Due to a cut-and-paste error, the path to a user-specified meson
was ignored and replaced by whatever was in the path.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index a65663d531..50ddfdeb20 100755
--- a/configure
+++ b/configure
@@ -2015,7 +2015,7 @@ case "$meson" in
         fi
         meson="$python ${source_path}/meson/meson.py"
         ;;
-    *) meson=$(command -v meson) ;;
+    *) meson=$(command -v "$meson") ;;
 esac
 
 # Probe for ninja (used for compdb)
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 34/92] configure: move cocoa option to Meson
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (32 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 33/92] configure: fix --meson=/path/to/meson Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 35/92] configure: do not limit Hypervisor.framework test to Darwin Paolo Bonzini
                   ` (59 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Christophe de Dinechin, Richard Henderson

While detection of the framework was already there, moving
the option allows for better error reporting.

Reported-by: Christophe de Dinechin <dinechin@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure         | 17 +++++++----------
 meson.build       |  9 +++++++--
 meson_options.txt |  2 ++
 ui/meson.build    |  2 +-
 4 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/configure b/configure
index 50ddfdeb20..f3a2f43250 100755
--- a/configure
+++ b/configure
@@ -457,7 +457,7 @@ bsd="no"
 linux="no"
 solaris="no"
 profiler="no"
-cocoa="no"
+cocoa="auto"
 softmmu="yes"
 linux_user="no"
 bsd_user="no"
@@ -875,7 +875,7 @@ Darwin)
     QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
     QEMU_LDFLAGS="-arch x86_64 $QEMU_LDFLAGS"
   fi
-  cocoa="yes"
+  cocoa="enabled"
   audio_drv_list="coreaudio try-sdl"
   audio_possible_drivers="coreaudio sdl"
   QEMU_LDFLAGS="-framework CoreFoundation -framework IOKit $QEMU_LDFLAGS"
@@ -1246,10 +1246,10 @@ for opt do
   ;;
   --enable-profiler) profiler="yes"
   ;;
-  --disable-cocoa) cocoa="no"
+  --disable-cocoa) cocoa="disabled"
   ;;
   --enable-cocoa)
-      cocoa="yes" ;
+      cocoa="enabled" ;
       audio_drv_list="coreaudio $(echo $audio_drv_list | sed s,coreaudio,,g)"
   ;;
   --disable-system) softmmu="no"
@@ -2391,8 +2391,8 @@ fi
 # cocoa implies not SDL or GTK
 # (the cocoa UI code currently assumes it is always the active UI
 # and doesn't interact well with other UI frontend code)
-if test "$cocoa" = "yes"; then
-    if test "$sdl" = "yes"; then
+if test "$cocoa" = "enabled"; then
+    if test "$sdl" = "enabled"; then
         error_exit "Cocoa and SDL UIs cannot both be enabled at once"
     fi
     if test "$gtk" = "yes"; then
@@ -6556,9 +6556,6 @@ if test "$have_x11" = "yes" && test "$need_x11" = "yes"; then
   echo "X11_CFLAGS=$x11_cflags" >> $config_host_mak
   echo "X11_LIBS=$x11_libs" >> $config_host_mak
 fi
-if test "$cocoa" = "yes" ; then
-  echo "CONFIG_COCOA=y" >> $config_host_mak
-fi
 if test "$iconv" = "yes" ; then
   echo "CONFIG_ICONV=y" >> $config_host_mak
   echo "ICONV_CFLAGS=$iconv_cflags" >> $config_host_mak
@@ -7860,7 +7857,7 @@ NINJA=${ninja:-$PWD/ninjatool} $meson setup \
         -Db_pie=$(if test "$pie" = yes; then echo true; else echo false; fi) \
         -Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \
 	-Dmalloc=$malloc -Dmalloc_trim=$malloc_trim \
-	-Dmpath=$mpath -Dsdl=$sdl -Dsdl_image=$sdl_image \
+	-Dcocoa=$cocoa -Dmpath=$mpath -Dsdl=$sdl -Dsdl_image=$sdl_image \
 	-Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \
 	-Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f\
         $cross_arg \
diff --git a/meson.build b/meson.build
index 08ebfca6d0..1e7d2f9a0a 100644
--- a/meson.build
+++ b/meson.build
@@ -101,7 +101,7 @@ socket = []
 version_res = []
 coref = []
 iokit = []
-cocoa = []
+cocoa = not_found
 hvf = []
 if targetos == 'windows'
   socket = cc.find_library('ws2_32')
@@ -114,7 +114,7 @@ if targetos == 'windows'
 elif targetos == 'darwin'
   coref = dependency('appleframeworks', modules: 'CoreFoundation')
   iokit = dependency('appleframeworks', modules: 'IOKit')
-  cocoa = dependency('appleframeworks', modules: 'Cocoa')
+  cocoa = dependency('appleframeworks', modules: 'Cocoa', required: get_option('cocoa'))
   hvf = dependency('appleframeworks', modules: 'Hypervisor')
 elif targetos == 'sunos'
   socket = [cc.find_library('socket'),
@@ -126,6 +126,10 @@ elif targetos == 'haiku'
             cc.find_library('bsd')]
 endif
 
+if not cocoa.found() and get_option('cocoa').enabled()
+  error('Cocoa not available on this platform')
+endif
+
 ################
 # Dependencies #
 ################
@@ -536,6 +540,7 @@ endif
 
 # Create config-host.h
 
+config_host_data.set('CONFIG_COCOA', cocoa.found())
 config_host_data.set('CONFIG_LIBUDEV', libudev.found())
 config_host_data.set('CONFIG_MPATH', mpathpersist.found())
 config_host_data.set('CONFIG_MPATH_NEW_API', mpathpersist_new_api)
diff --git a/meson_options.txt b/meson_options.txt
index 8a59ec263d..46ea1d889a 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -11,6 +11,8 @@ option('malloc_trim', type : 'feature', value : 'auto',
 option('malloc', type : 'combo', choices : ['system', 'tcmalloc', 'jemalloc'],
        value: 'system', description: 'choose memory allocator to use')
 
+option('cocoa', type : 'feature', value : 'auto',
+       description: 'Cocoa user interface (macOS only)')
 option('mpath', type : 'feature', value : 'auto',
        description: 'Multipath persistent reservation passthrough')
 option('sdl', type : 'feature', value : 'auto',
diff --git a/ui/meson.build b/ui/meson.build
index dd6c110136..8a080c38e3 100644
--- a/ui/meson.build
+++ b/ui/meson.build
@@ -15,7 +15,7 @@ softmmu_ss.add(files(
 
 softmmu_ss.add(when: 'CONFIG_LINUX', if_true: files('input-linux.c'))
 softmmu_ss.add(when: 'CONFIG_SPICE', if_true: files('spice-core.c', 'spice-input.c', 'spice-display.c'))
-softmmu_ss.add(when: [cocoa, 'CONFIG_COCOA'], if_true: files('cocoa.m'))
+softmmu_ss.add(when: cocoa, if_true: files('cocoa.m'))
 
 vnc_ss = ss.source_set()
 vnc_ss.add(files(
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 35/92] configure: do not limit Hypervisor.framework test to Darwin
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (33 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 34/92] configure: move cocoa option to Meson Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 36/92] meson: qtest: set "depends" correctly Paolo Bonzini
                   ` (58 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Christophe de Dinechin, Richard Henderson

Because the target/i386/hvf/meson.build rule culls hvf support
on non-Darwin systems, a --enable-hvf build is succeeding.
To fix this, just try the compilation test every time someone
passes --enable-hvf.

Reported-by: Christophe de Dinechin <dinechin@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/configure b/configure
index f3a2f43250..161d0604bb 100755
--- a/configure
+++ b/configure
@@ -870,7 +870,7 @@ Darwin)
   bsd="yes"
   darwin="yes"
   hax="yes"
-  hvf="yes"
+  hvf=""
   if [ "$cpu" = "x86_64" ] ; then
     QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
     QEMU_LDFLAGS="-arch x86_64 $QEMU_LDFLAGS"
@@ -5822,16 +5822,18 @@ fi
 
 #################################################
 # Check to see if we have the Hypervisor framework
-if [ "$darwin" = "yes" ] ; then
+if [ "$hvf" != "no" ] ; then
   cat > $TMPC << EOF
 #include <Hypervisor/hv.h>
 int main() { return 0;}
 EOF
   if ! compile_object ""; then
+    if test "$hvf" = "yes"; then
+	error_exit "Hypervisor.framework not available"
+    fi
     hvf='no'
   else
     hvf='yes'
-    QEMU_LDFLAGS="-framework Hypervisor $QEMU_LDFLAGS"
   fi
 fi
 
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 36/92] meson: qtest: set "depends" correctly
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (34 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 35/92] configure: do not limit Hypervisor.framework test to Darwin Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 37/92] mtest2make: add support for introspected test dependencies Paolo Bonzini
                   ` (57 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Thomas Huth

This does not have any effect on Meson's behavior itself, since "meson test"
always rebuilds everything (that is one reason why we are not using it...).
However, mtest2make can use this information to do a selective rebuild
for the requested suite.

Cc: Thomas Huth <thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 meson.build             | 7 ++++---
 tests/qtest/meson.build | 8 +++++++-
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/meson.build b/meson.build
index 1e7d2f9a0a..6abb8bbcb1 100644
--- a/meson.build
+++ b/meson.build
@@ -1088,7 +1088,7 @@ common_all = static_library('common',
 
 feature_to_c = find_program('scripts/feature_to_c.sh')
 
-emulators = []
+emulators = {}
 foreach target : target_dirs
   config_target = config_target_mak[target]
   target_name = config_target['TARGET_NAME']
@@ -1207,7 +1207,8 @@ foreach target : target_dirs
     }]
   endif
   foreach exe: execs
-    emulators += executable(exe['name'], exe['sources'],
+    emulators += {exe['name']:
+         executable(exe['name'], exe['sources'],
                install: true,
                c_args: c_args,
                dependencies: arch_deps + deps + exe['dependencies'],
@@ -1216,6 +1217,7 @@ foreach target : target_dirs
                link_depends: [block_syms, qemu_syms] + exe.get('link_depends', []),
                link_args: link_args,
                gui_app: exe['gui'])
+    }
 
     if 'CONFIG_TRACE_SYSTEMTAP' in config_host
       foreach stp: [
@@ -1261,7 +1263,6 @@ if xkbcommon.found()
                            dependencies: [qemuutil, xkbcommon], install: have_tools)
 endif
 
-qemu_block_tools = []
 if have_tools
   qemu_img = executable('qemu-img', [files('qemu-img.c'), hxdep],
              dependencies: [authz, block, crypto, io, qom, qemuutil], install: true)
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
index 874b5be62b..4f7757ee93 100644
--- a/tests/qtest/meson.build
+++ b/tests/qtest/meson.build
@@ -228,10 +228,15 @@ foreach dir : target_dirs
   endif
 
   target_base = dir.split('-')[0]
+  qtest_emulator = emulators['qemu-system-' + target_base]
   qtests = get_variable('qtests_' + target_base, []) + qtests_generic
 
+  test_deps = []
   qtest_env = environment()
-  qtest_env.set('QTEST_QEMU_IMG', './qemu-img')
+  if have_tools
+    qtest_env.set('QTEST_QEMU_IMG', './qemu-img')
+    test_deps += [qemu_img]
+  endif
   qtest_env.set('G_TEST_DBUS_DAEMON', meson.source_root() / 'tests/dbus-vmstate-daemon.sh')
   qtest_env.set('QTEST_QEMU_BINARY', './qemu-system-' + target_base)
   
@@ -248,6 +253,7 @@ foreach dir : target_dirs
     # FIXME: missing dependency on the emulator binary and qemu-img
     test('qtest-@0@: @1@'.format(target_base, test),
          qtest_executables[test],
+         depends: [test_deps, qtest_emulator],
          env: qtest_env,
          args: ['--tap', '-k'],
          protocol: 'tap',
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 37/92] mtest2make: add support for introspected test dependencies
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (35 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 36/92] meson: qtest: set "depends" correctly Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 38/92] meson: report accelerator support Paolo Bonzini
                   ` (56 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel

Right now all "make check" targets depend blindly on "all".  If Meson
is 0.56.0 or newer, we can use the correct dependencies using the new
"depends" entry in "meson introspect --tests".

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 Makefile              |  2 +-
 scripts/mtest2make.py | 19 +++++++++++++++----
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 42d90cb597..897246d77c 100644
--- a/Makefile
+++ b/Makefile
@@ -78,7 +78,7 @@ ${ninja-targets-c_COMPILER} ${ninja-targets-cpp_COMPILER}: .var.command += -MP
 # reread (and MESON won't be empty anymore).
 ifneq ($(MESON),)
 Makefile.mtest: build.ninja scripts/mtest2make.py
-	$(MESON) introspect --tests --benchmarks | $(PYTHON) scripts/mtest2make.py > $@
+	$(MESON) introspect --targets --tests --benchmarks | $(PYTHON) scripts/mtest2make.py > $@
 -include Makefile.mtest
 endif
 
diff --git a/scripts/mtest2make.py b/scripts/mtest2make.py
index 9cbb2e374d..c3489a4605 100644
--- a/scripts/mtest2make.py
+++ b/scripts/mtest2make.py
@@ -5,6 +5,7 @@
 # Author: Paolo Bonzini <pbonzini@redhat.com>
 
 from collections import defaultdict
+import itertools
 import json
 import os
 import shlex
@@ -36,7 +37,7 @@ SPEED = quick
 introspect = json.load(sys.stdin)
 i = 0
 
-def process_tests(test, suites):
+def process_tests(test, targets, suites):
     global i
     env = ' '.join(('%s=%s' % (shlex.quote(k), shlex.quote(v))
                     for k, v in test['env'].items()))
@@ -58,12 +59,19 @@ def process_tests(test, suites):
     i += 1
     if test['workdir'] is not None:
         print('.test.dir.%d := %s' % (i, shlex.quote(test['workdir'])))
+
+    if 'depends' in test:
+        deps = (targets.get(x, []) for x in test['depends'])
+        deps = itertools.chain.from_iterable(deps)
+    else:
+        deps = ['all']
+
     print('.test.name.%d := %s' % (i, test['name']))
     print('.test.driver.%d := %s' % (i, driver))
     print('.test.env.%d := $(.test.env) %s' % (i, env))
     print('.test.cmd.%d := %s' % (i, cmd))
     print('.PHONY: run-test-%d' % (i,))
-    print('run-test-%d: all' % (i,))
+    print('run-test-%d: %s' % (i, ' '.join(deps)))
     print('\t@$(call .test.run,%d,$(.test.output-format))' % (i,))
 
     test_suites = test['suite'] or ['default']
@@ -102,16 +110,19 @@ def emit_suite(name, suite, prefix):
     print('.tests += $(.test.$(SPEED).%s)' % (target, ))
     print('endif')
 
+targets = {t['id']: [os.path.relpath(f) for f in t['filename']]
+           for t in introspect['targets']}
+
 testsuites = defaultdict(Suite)
 for test in introspect['tests']:
-    process_tests(test, testsuites)
+    process_tests(test, targets, testsuites)
 emit_prolog(testsuites, 'check')
 for name, suite in testsuites.items():
     emit_suite(name, suite, 'check')
 
 benchsuites = defaultdict(Suite)
 for test in introspect['benchmarks']:
-    process_tests(test, benchsuites)
+    process_tests(test, targets, benchsuites)
 emit_prolog(benchsuites, 'bench')
 for name, suite in benchsuites.items():
     emit_suite(name, suite, 'bench')
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 38/92] meson: report accelerator support
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (36 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 37/92] mtest2make: add support for introspected test dependencies Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 39/92] oslib: do not call g_strdup from qemu_get_exec_dir Paolo Bonzini
                   ` (55 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Andrew Jones

Note that the "real" support is reported.  A configuration like
--disable-system --enable-kvm will report "no" for "KVM support" because
no KVM-supported target is being compiled.

Reported-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 meson.build | 35 ++++++++++++++++++++++++-----------
 1 file changed, 24 insertions(+), 11 deletions(-)

diff --git a/meson.build b/meson.build
index 6abb8bbcb1..fedf44ed79 100644
--- a/meson.build
+++ b/meson.build
@@ -583,6 +583,7 @@ endforeach
 genh += configure_file(output: 'config-host.h', configuration: config_host_data)
 
 minikconf = find_program('scripts/minikconf.py')
+config_all = {}
 config_all_devices = {}
 config_all_disas = {}
 config_devices_mak_list = []
@@ -638,6 +639,14 @@ kconfig_external_symbols = [
 ]
 ignored = ['TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_DIRS']
 
+accel_symbols = [
+  'CONFIG_KVM',
+  'CONFIG_HAX',
+  'CONFIG_HVF',
+  'CONFIG_TCG',
+  'CONFIG_WHPX'
+]
+
 foreach target : target_dirs
   config_target = keyval.load(meson.current_build_dir() / target / 'config-target.mak')
 
@@ -666,6 +675,11 @@ foreach target : target_dirs
       config_target_data.set(k, v)
     endif
   endforeach
+  foreach sym: accel_symbols
+    if config_target.has_key(sym)
+      config_all += { sym: 'y' }
+    endif
+  endforeach
   config_target_h += {target: configure_file(output: target + '-config-target.h',
                                                configuration: config_target_data)}
 
@@ -710,7 +724,7 @@ endforeach
 # targets that are not built for this compilation.  The CONFIG_ALL
 # pseudo symbol replaces it.
 
-config_all = config_all_devices
+config_all += config_all_devices
 config_all += config_host
 config_all += config_all_disas
 config_all += {
@@ -1537,16 +1551,15 @@ summary_info += {'Linux AIO support': config_host.has_key('CONFIG_LINUX_AIO')}
 summary_info += {'Linux io_uring support': config_host.has_key('CONFIG_LINUX_IO_URING')}
 summary_info += {'ATTR/XATTR support': config_host.has_key('CONFIG_ATTR')}
 summary_info += {'Install blobs':     config_host.has_key('INSTALL_BLOBS')}
-# TODO: add back KVM/HAX/HVF/WHPX/TCG
-#summary_info += {'KVM support':       have_kvm'}
-#summary_info += {'HAX support':       have_hax'}
-#summary_info += {'HVF support':       have_hvf'}
-#summary_info += {'WHPX support':      have_whpx'}
-#summary_info += {'TCG support':       have_tcg'}
-#if get_option('tcg')
-#  summary_info += {'TCG debug enabled': config_host.has_key('CONFIG_DEBUG_TCG')}
-#  summary_info += {'TCG interpreter':   config_host.has_key('CONFIG_TCG_INTERPRETER')}
-#endif
+summary_info += {'KVM support':       config_all.has_key('CONFIG_KVM')}
+summary_info += {'HAX support':       config_all.has_key('CONFIG_HAX')}
+summary_info += {'HVF support':       config_all.has_key('CONFIG_HVF')}
+summary_info += {'WHPX support':      config_all.has_key('CONFIG_WHPX')}
+summary_info += {'TCG support':       config_all.has_key('CONFIG_TCG')}
+if config_all.has_key('CONFIG_TCG')
+  summary_info += {'TCG debug enabled': config_host.has_key('CONFIG_DEBUG_TCG')}
+  summary_info += {'TCG interpreter':   config_host.has_key('CONFIG_TCG_INTERPRETER')}
+endif
 summary_info += {'malloc trim support': has_malloc_trim}
 summary_info += {'RDMA support':      config_host.has_key('CONFIG_RDMA')}
 summary_info += {'PVRDMA support':    config_host.has_key('CONFIG_PVRDMA')}
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 39/92] oslib: do not call g_strdup from qemu_get_exec_dir
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (37 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 38/92] meson: report accelerator support Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 40/92] fuzz: use qemu_get_exec_dir Paolo Bonzini
                   ` (54 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel

Just return the directory without requiring the caller to free it.
This also removes a bogus check for NULL in os_find_datadir and
module_load_one; g_strdup of a static variable cannot return NULL.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/qemu/osdep.h    |  8 ++------
 os-posix.c              |  6 +-----
 os-win32.c              |  2 +-
 tests/qtest/fuzz/fuzz.c |  4 ++--
 util/module.c           |  7 +------
 util/oslib-posix.c      |  8 +++++---
 util/oslib-win32.c      | 12 ++++++++----
 7 files changed, 20 insertions(+), 27 deletions(-)

diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index dad44be043..f9ec8c84e9 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -597,12 +597,8 @@ char *qemu_get_local_state_pathname(const char *relative_pathname);
  * Try OS specific API first, if not working, parse from argv0. */
 void qemu_init_exec_dir(const char *argv0);
 
-/* Get the saved exec dir.
- *
- * The caller is responsible for releasing the value returned with g_free()
- * after use.
- */
-char *qemu_get_exec_dir(void);
+/* Get the saved exec dir.  */
+const char *qemu_get_exec_dir(void);
 
 /**
  * qemu_getauxval:
diff --git a/os-posix.c b/os-posix.c
index 0bfd8e2d3c..36e344c544 100644
--- a/os-posix.c
+++ b/os-posix.c
@@ -90,13 +90,9 @@ void os_setup_signal_handling(void)
  */
 char *os_find_datadir(void)
 {
-    g_autofree char *exec_dir = NULL;
     g_autofree char *dir = NULL;
 
-    exec_dir = qemu_get_exec_dir();
-    g_return_val_if_fail(exec_dir != NULL, NULL);
-
-    dir = g_build_filename(exec_dir, "pc-bios", NULL);
+    dir = g_build_filename(qemu_get_exec_dir(), "pc-bios", NULL);
     if (g_file_test(dir, G_FILE_TEST_IS_DIR)) {
         return g_steal_pointer(&dir);
     }
diff --git a/os-win32.c b/os-win32.c
index c9c3afe648..eb8501b9e5 100644
--- a/os-win32.c
+++ b/os-win32.c
@@ -65,7 +65,7 @@ void os_setup_early_signal_handling(void)
  */
 char *os_find_datadir(void)
 {
-    return qemu_get_exec_dir();
+    return g_strdup(qemu_get_exec_dir());
 }
 
 void os_set_line_buffering(void)
diff --git a/tests/qtest/fuzz/fuzz.c b/tests/qtest/fuzz/fuzz.c
index 7f266ffc63..d3a3ccdec9 100644
--- a/tests/qtest/fuzz/fuzz.c
+++ b/tests/qtest/fuzz/fuzz.c
@@ -143,7 +143,8 @@ int LLVMFuzzerInitialize(int *argc, char ***argv, char ***envp)
 {
 
     char *target_name;
-    char *bindir, *datadir;
+    const char *bindir;
+    char *datadir;
     bool serialize = false;
 
     /* Initialize qgraph and modules */
@@ -166,7 +167,6 @@ int LLVMFuzzerInitialize(int *argc, char ***argv, char ***envp)
          */
         bindir = g_path_get_dirname(**argv);
         datadir = g_build_filename(bindir, "pc-bios", NULL);
-        g_free(bindir);
         if (g_file_test(datadir, G_FILE_TEST_IS_DIR)) {
             qemu_add_data_dir(datadir);
         }
diff --git a/util/module.c b/util/module.c
index 34772e7d87..9ffe83bb32 100644
--- a/util/module.c
+++ b/util/module.c
@@ -172,7 +172,6 @@ bool module_load_one(const char *prefix, const char *lib_name)
 
 #ifdef CONFIG_MODULES
     char *fname = NULL;
-    char *exec_dir;
 #ifdef CONFIG_MODULE_UPGRADES
     char *version_dir;
 #endif
@@ -199,13 +198,12 @@ bool module_load_one(const char *prefix, const char *lib_name)
         return true;
     }
 
-    exec_dir = qemu_get_exec_dir();
     search_dir = getenv("QEMU_MODULE_DIR");
     if (search_dir != NULL) {
         dirs[n_dirs++] = g_strdup_printf("%s", search_dir);
     }
     dirs[n_dirs++] = g_strdup_printf("%s", CONFIG_QEMU_MODDIR);
-    dirs[n_dirs++] = g_strdup_printf("%s", exec_dir ? : "");
+    dirs[n_dirs++] = g_strdup(qemu_get_exec_dir());
 
 #ifdef CONFIG_MODULE_UPGRADES
     version_dir = g_strcanon(g_strdup(QEMU_PKGVERSION),
@@ -216,9 +214,6 @@ bool module_load_one(const char *prefix, const char *lib_name)
 
     assert(n_dirs <= ARRAY_SIZE(dirs));
 
-    g_free(exec_dir);
-    exec_dir = NULL;
-
     for (i = 0; i < n_dirs; i++) {
         fname = g_strdup_printf("%s/%s%s",
                 dirs[i], module_name, CONFIG_HOST_DSOSUF);
diff --git a/util/oslib-posix.c b/util/oslib-posix.c
index f5f676f079..18531fc859 100644
--- a/util/oslib-posix.c
+++ b/util/oslib-posix.c
@@ -366,7 +366,9 @@ void qemu_init_exec_dir(const char *argv0)
     char *p = NULL;
     char buf[PATH_MAX];
 
-    assert(!exec_dir[0]);
+    if (exec_dir[0]) {
+        return;
+    }
 
 #if defined(__linux__)
     {
@@ -439,9 +441,9 @@ void qemu_init_exec_dir(const char *argv0)
     g_free(dir);
 }
 
-char *qemu_get_exec_dir(void)
+const char *qemu_get_exec_dir(void)
 {
-    return g_strdup(exec_dir);
+    return exec_dir;
 }
 
 static void sigbus_handler(int signal)
diff --git a/util/oslib-win32.c b/util/oslib-win32.c
index c654dafd93..1a33912944 100644
--- a/util/oslib-win32.c
+++ b/util/oslib-win32.c
@@ -315,7 +315,7 @@ void qemu_set_tty_echo(int fd, bool echo)
     }
 }
 
-static char exec_dir[PATH_MAX];
+static char *exec_dir;
 
 void qemu_init_exec_dir(const char *argv0)
 {
@@ -324,6 +324,10 @@ void qemu_init_exec_dir(const char *argv0)
     char buf[MAX_PATH];
     DWORD len;
 
+    if (exec_dir) {
+        return;
+    }
+
     len = GetModuleFileName(NULL, buf, sizeof(buf) - 1);
     if (len == 0) {
         return;
@@ -336,13 +340,13 @@ void qemu_init_exec_dir(const char *argv0)
     }
     *p = 0;
     if (access(buf, R_OK) == 0) {
-        pstrcpy(exec_dir, sizeof(exec_dir), buf);
+        exec_dir = g_strdup(buf);
     }
 }
 
-char *qemu_get_exec_dir(void)
+const char *qemu_get_exec_dir(void)
 {
-    return g_strdup(exec_dir);
+    return exec_dir;
 }
 
 #if !GLIB_CHECK_VERSION(2, 50, 0)
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 40/92] fuzz: use qemu_get_exec_dir
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (38 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 39/92] oslib: do not call g_strdup from qemu_get_exec_dir Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 41/92] oslib-posix: default exec_dir to bindir Paolo Bonzini
                   ` (53 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alexander Bulekov, Thomas Huth

Make things consistent with how softmmu/vl.c uses os_find_datadir.
Initializing the path to the executables will also be needed for
get_relocatable_path to work.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Alexander Bulekov <alxndr@bu.edu>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/qtest/fuzz/fuzz.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/qtest/fuzz/fuzz.c b/tests/qtest/fuzz/fuzz.c
index d3a3ccdec9..c4dc5fa629 100644
--- a/tests/qtest/fuzz/fuzz.c
+++ b/tests/qtest/fuzz/fuzz.c
@@ -153,6 +153,7 @@ int LLVMFuzzerInitialize(int *argc, char ***argv, char ***envp)
     module_call_init(MODULE_INIT_QOM);
     module_call_init(MODULE_INIT_LIBQOS);
 
+    qemu_init_exec_dir(**argv);
     target_name = strstr(**argv, "-target-");
     if (target_name) {        /* The binary name specifies the target */
         target_name += strlen("-target-");
@@ -165,7 +166,7 @@ int LLVMFuzzerInitialize(int *argc, char ***argv, char ***envp)
          * location of the executable. Using this we add exec_dir/pc-bios to
          * the datadirs.
          */
-        bindir = g_path_get_dirname(**argv);
+        bindir = qemu_get_exec_dir();
         datadir = g_build_filename(bindir, "pc-bios", NULL);
         if (g_file_test(datadir, G_FILE_TEST_IS_DIR)) {
             qemu_add_data_dir(datadir);
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 41/92] oslib-posix: default exec_dir to bindir
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (39 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 40/92] fuzz: use qemu_get_exec_dir Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 42/92] cutils: introduce get_relocated_path Paolo Bonzini
                   ` (52 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel

If the exec_dir cannot be retrieved, just assume it's the installation
directory that was specified at configure time.  This makes it simpler
to reason about what the callers will do if they get back an empty
path.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 meson.build        |  2 +-
 util/oslib-posix.c | 23 ++++++++---------------
 util/oslib-win32.c |  4 +++-
 3 files changed, 12 insertions(+), 17 deletions(-)

diff --git a/meson.build b/meson.build
index fedf44ed79..9a4ade7f98 100644
--- a/meson.build
+++ b/meson.build
@@ -560,7 +560,7 @@ config_host_data.set('QEMU_VERSION_MINOR', meson.project_version().split('.')[1]
 config_host_data.set('QEMU_VERSION_MICRO', meson.project_version().split('.')[2])
 
 arrays = ['CONFIG_AUDIO_DRIVERS', 'CONFIG_BDRV_RW_WHITELIST', 'CONFIG_BDRV_RO_WHITELIST']
-strings = ['HOST_DSOSUF', 'CONFIG_IASL', 'qemu_confdir', 'qemu_datadir',
+strings = ['HOST_DSOSUF', 'CONFIG_IASL', 'bindir', 'qemu_confdir', 'qemu_datadir',
            'qemu_moddir', 'qemu_localstatedir', 'qemu_helperdir', 'qemu_localedir',
            'qemu_icondir', 'qemu_desktopdir', 'qemu_firmwarepath']
 foreach k, v: config_host
diff --git a/util/oslib-posix.c b/util/oslib-posix.c
index 18531fc859..1739930e65 100644
--- a/util/oslib-posix.c
+++ b/util/oslib-posix.c
@@ -358,15 +358,14 @@ void qemu_set_tty_echo(int fd, bool echo)
     tcsetattr(fd, TCSANOW, &tty);
 }
 
-static char exec_dir[PATH_MAX];
+static const char *exec_dir;
 
 void qemu_init_exec_dir(const char *argv0)
 {
-    char *dir;
     char *p = NULL;
     char buf[PATH_MAX];
 
-    if (exec_dir[0]) {
+    if (exec_dir) {
         return;
     }
 
@@ -425,20 +424,14 @@ void qemu_init_exec_dir(const char *argv0)
 #endif
     /* If we don't have any way of figuring out the actual executable
        location then try argv[0].  */
-    if (!p) {
-        if (!argv0) {
-            return;
-        }
+    if (!p && argv0) {
         p = realpath(argv0, buf);
-        if (!p) {
-            return;
-        }
     }
-    dir = g_path_get_dirname(p);
-
-    pstrcpy(exec_dir, sizeof(exec_dir), dir);
-
-    g_free(dir);
+    if (p) {
+        exec_dir = g_path_get_dirname(p);
+    } else {
+        exec_dir = CONFIG_BINDIR;
+    }
 }
 
 const char *qemu_get_exec_dir(void)
diff --git a/util/oslib-win32.c b/util/oslib-win32.c
index 1a33912944..051afb217b 100644
--- a/util/oslib-win32.c
+++ b/util/oslib-win32.c
@@ -315,7 +315,7 @@ void qemu_set_tty_echo(int fd, bool echo)
     }
 }
 
-static char *exec_dir;
+static const char *exec_dir;
 
 void qemu_init_exec_dir(const char *argv0)
 {
@@ -341,6 +341,8 @@ void qemu_init_exec_dir(const char *argv0)
     *p = 0;
     if (access(buf, R_OK) == 0) {
         exec_dir = g_strdup(buf);
+    } else {
+        exec_dir = CONFIG_BINDIR;
     }
 }
 
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 42/92] cutils: introduce get_relocated_path
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (40 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 41/92] oslib-posix: default exec_dir to bindir Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-11-02 18:05   ` Peter Maydell
  2020-09-24  9:22 ` [PULL 43/92] oslib-posix: relocate path to /var Paolo Bonzini
                   ` (51 subsequent siblings)
  93 siblings, 1 reply; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel

Add the function that will compute a relocated version of the
directories in CONFIG_QEMU_*DIR and CONFIG_QEMU_*PATH.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/qemu/cutils.h | 12 +++++++++
 meson.build           |  4 +--
 util/cutils.c         | 61 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 75 insertions(+), 2 deletions(-)

diff --git a/include/qemu/cutils.h b/include/qemu/cutils.h
index eb59852dfd..3a86ec0321 100644
--- a/include/qemu/cutils.h
+++ b/include/qemu/cutils.h
@@ -184,4 +184,16 @@ int uleb128_decode_small(const uint8_t *in, uint32_t *n);
  */
 int qemu_pstrcmp0(const char **str1, const char **str2);
 
+
+/**
+ * get_relocated_path:
+ * @dir: the directory (typically a `CONFIG_*DIR` variable) to be relocated.
+ *
+ * Returns a path for @dir that uses the directory of the running executable
+ * as the prefix.  For example, if `bindir` is `/usr/bin` and @dir is
+ * `/usr/share/qemu`, the function will append `../share/qemu` to the
+ * directory that contains the running executable and return the result.
+ */
+char *get_relocated_path(const char *dir);
+
 #endif
diff --git a/meson.build b/meson.build
index 9a4ade7f98..ace15dc8c0 100644
--- a/meson.build
+++ b/meson.build
@@ -560,9 +560,9 @@ config_host_data.set('QEMU_VERSION_MINOR', meson.project_version().split('.')[1]
 config_host_data.set('QEMU_VERSION_MICRO', meson.project_version().split('.')[2])
 
 arrays = ['CONFIG_AUDIO_DRIVERS', 'CONFIG_BDRV_RW_WHITELIST', 'CONFIG_BDRV_RO_WHITELIST']
-strings = ['HOST_DSOSUF', 'CONFIG_IASL', 'bindir', 'qemu_confdir', 'qemu_datadir',
+strings = ['HOST_DSOSUF', 'CONFIG_IASL', 'bindir', 'prefix', 'qemu_confdir', 'qemu_datadir',
            'qemu_moddir', 'qemu_localstatedir', 'qemu_helperdir', 'qemu_localedir',
-           'qemu_icondir', 'qemu_desktopdir', 'qemu_firmwarepath']
+           'qemu_icondir', 'qemu_desktopdir', 'qemu_firmwarepath', 'sysconfdir']
 foreach k, v: config_host
   if arrays.contains(k)
     if v != ''
diff --git a/util/cutils.c b/util/cutils.c
index 36ce712271..8da34e04b0 100644
--- a/util/cutils.c
+++ b/util/cutils.c
@@ -889,3 +889,64 @@ int qemu_pstrcmp0(const char **str1, const char **str2)
 {
     return g_strcmp0(*str1, *str2);
 }
+
+static inline bool starts_with_prefix(const char *dir)
+{
+    size_t prefix_len = strlen(CONFIG_PREFIX);
+    return !memcmp(dir, CONFIG_PREFIX, prefix_len) &&
+        (!dir[prefix_len] || G_IS_DIR_SEPARATOR(dir[prefix_len]));
+}
+
+/* Return the next path component in dir, and store its length in *p_len.  */
+static inline const char *next_component(const char *dir, int *p_len)
+{
+    int len;
+    while (*dir && G_IS_DIR_SEPARATOR(*dir)) {
+        dir++;
+    }
+    len = 0;
+    while (dir[len] && !G_IS_DIR_SEPARATOR(dir[len])) {
+        len++;
+    }
+    *p_len = len;
+    return dir;
+}
+
+char *get_relocated_path(const char *dir)
+{
+    size_t prefix_len = strlen(CONFIG_PREFIX);
+    const char *bindir = CONFIG_BINDIR;
+    const char *exec_dir = qemu_get_exec_dir();
+    GString *result;
+    int len_dir, len_bindir;
+
+    /* Fail if qemu_init_exec_dir was not called.  */
+    assert(exec_dir[0]);
+    if (!starts_with_prefix(dir) || !starts_with_prefix(bindir)) {
+        return strdup(dir);
+    }
+
+    result = g_string_new(exec_dir);
+
+    /* Advance over common components.  */
+    len_dir = len_bindir = prefix_len;
+    do {
+        dir += len_dir;
+        bindir += len_bindir;
+        dir = next_component(dir, &len_dir);
+        bindir = next_component(bindir, &len_bindir);
+    } while (len_dir == len_bindir && !memcmp(dir, bindir, len_dir));
+
+    /* Ascend from bindir to the common prefix with dir.  */
+    while (len_bindir) {
+        bindir += len_bindir;
+        g_string_append(result, "/..");
+        bindir = next_component(bindir, &len_bindir);
+    }
+
+    if (*dir) {
+        assert(G_IS_DIR_SEPARATOR(dir[-1]));
+        g_string_append(result, dir - 1);
+    }
+    return result->str;
+}
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 43/92] oslib-posix: relocate path to /var
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (41 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 42/92] cutils: introduce get_relocated_path Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 44/92] module: relocate path to modules Paolo Bonzini
                   ` (50 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Philippe Mathieu-Daudé

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 util/oslib-posix.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/util/oslib-posix.c b/util/oslib-posix.c
index 1739930e65..f15234b5c0 100644
--- a/util/oslib-posix.c
+++ b/util/oslib-posix.c
@@ -339,8 +339,10 @@ int qemu_pipe(int pipefd[2])
 char *
 qemu_get_local_state_pathname(const char *relative_pathname)
 {
-    return g_strdup_printf("%s/%s", CONFIG_QEMU_LOCALSTATEDIR,
-                           relative_pathname);
+    g_autofree char *dir = g_strdup_printf("%s/%s",
+                                           CONFIG_QEMU_LOCALSTATEDIR,
+                                           relative_pathname);
+    return get_relocated_path(dir);
 }
 
 void qemu_set_tty_echo(int fd, bool echo)
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 44/92] module: relocate path to modules
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (42 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 43/92] oslib-posix: relocate path to /var Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 45/92] net: relocate paths to helpers and scripts Paolo Bonzini
                   ` (49 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 util/module.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/util/module.c b/util/module.c
index 9ffe83bb32..a44ec38d93 100644
--- a/util/module.c
+++ b/util/module.c
@@ -19,6 +19,7 @@
 #endif
 #include "qemu/queue.h"
 #include "qemu/module.h"
+#include "qemu/cutils.h"
 #ifdef CONFIG_MODULE_UPGRADES
 #include "qemu-version.h"
 #endif
@@ -202,7 +203,7 @@ bool module_load_one(const char *prefix, const char *lib_name)
     if (search_dir != NULL) {
         dirs[n_dirs++] = g_strdup_printf("%s", search_dir);
     }
-    dirs[n_dirs++] = g_strdup_printf("%s", CONFIG_QEMU_MODDIR);
+    dirs[n_dirs++] = get_relocated_path(CONFIG_QEMU_MODDIR);
     dirs[n_dirs++] = g_strdup(qemu_get_exec_dir());
 
 #ifdef CONFIG_MODULE_UPGRADES
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 45/92] net: relocate paths to helpers and scripts
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (43 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 44/92] module: relocate path to modules Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 46/92] vl: relocate paths to data directories Paolo Bonzini
                   ` (48 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/net/net.h |  4 ++--
 net/tap.c         | 26 +++++++++++++++++++-------
 2 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/include/net/net.h b/include/net/net.h
index e7ef42d62b..897b2d7595 100644
--- a/include/net/net.h
+++ b/include/net/net.h
@@ -209,8 +209,8 @@ void netdev_add(QemuOpts *opts, Error **errp);
 int net_hub_id_for_client(NetClientState *nc, int *id);
 NetClientState *net_hub_port_find(int hub_id);
 
-#define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup"
-#define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown"
+#define DEFAULT_NETWORK_SCRIPT CONFIG_SYSCONFDIR "/qemu-ifup"
+#define DEFAULT_NETWORK_DOWN_SCRIPT CONFIG_SYSCONFDIR "/qemu-ifdown"
 #define DEFAULT_BRIDGE_HELPER CONFIG_QEMU_HELPERDIR "/qemu-bridge-helper"
 #define DEFAULT_BRIDGE_INTERFACE "br0"
 
diff --git a/net/tap.c b/net/tap.c
index 14dc904fca..04ce72dd2f 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -478,6 +478,7 @@ static int net_bridge_run_helper(const char *helper, const char *bridge,
                                  Error **errp)
 {
     sigset_t oldmask, mask;
+    g_autofree char *default_helper = NULL;
     int pid, status;
     char *args[5];
     char **parg;
@@ -487,6 +488,10 @@ static int net_bridge_run_helper(const char *helper, const char *bridge,
     sigaddset(&mask, SIGCHLD);
     sigprocmask(SIG_BLOCK, &mask, &oldmask);
 
+    if (!helper) {
+        helper = default_helper = get_relocated_path(DEFAULT_BRIDGE_HELPER);
+    }
+
     if (socketpair(PF_UNIX, SOCK_STREAM, 0, sv) == -1) {
         error_setg_errno(errp, errno, "socketpair() failed");
         return -1;
@@ -588,8 +593,7 @@ int net_init_bridge(const Netdev *netdev, const char *name,
 
     assert(netdev->type == NET_CLIENT_DRIVER_BRIDGE);
     bridge = &netdev->u.bridge;
-
-    helper = bridge->has_helper ? bridge->helper : DEFAULT_BRIDGE_HELPER;
+    helper = bridge->has_helper ? bridge->helper : NULL;
     br     = bridge->has_br     ? bridge->br     : DEFAULT_BRIDGE_INTERFACE;
 
     fd = net_bridge_run_helper(helper, br, errp);
@@ -773,8 +777,8 @@ int net_init_tap(const Netdev *netdev, const char *name,
     const NetdevTapOptions *tap;
     int fd, vnet_hdr = 0, i = 0, queues;
     /* for the no-fd, no-helper case */
-    const char *script = NULL; /* suppress wrong "uninit'd use" gcc warning */
-    const char *downscript = NULL;
+    const char *script;
+    const char *downscript;
     Error *err = NULL;
     const char *vhostfdname;
     char ifname[128];
@@ -784,6 +788,8 @@ int net_init_tap(const Netdev *netdev, const char *name,
     tap = &netdev->u.tap;
     queues = tap->has_queues ? tap->queues : 1;
     vhostfdname = tap->has_vhostfd ? tap->vhostfd : NULL;
+    script = tap->has_script ? tap->script : NULL;
+    downscript = tap->has_downscript ? tap->downscript : NULL;
 
     /* QEMU hubs do not support multiqueue tap, in this case peer is set.
      * For -netdev, peer is always NULL. */
@@ -934,13 +940,19 @@ free_fail:
             return -1;
         }
     } else {
+        g_autofree char *default_script = NULL;
+        g_autofree char *default_downscript = NULL;
         if (tap->has_vhostfds) {
             error_setg(errp, "vhostfds= is invalid if fds= wasn't specified");
             return -1;
         }
-        script = tap->has_script ? tap->script : DEFAULT_NETWORK_SCRIPT;
-        downscript = tap->has_downscript ? tap->downscript :
-            DEFAULT_NETWORK_DOWN_SCRIPT;
+
+        if (!script) {
+            script = default_script = get_relocated_path(DEFAULT_NETWORK_SCRIPT);
+        }
+        if (!downscript) {
+            downscript = default_downscript = get_relocated_path(DEFAULT_NETWORK_SCRIPT);
+        }
 
         if (tap->has_ifname) {
             pstrcpy(ifname, sizeof ifname, tap->ifname);
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 46/92] vl: relocate paths to data directories
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (44 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 45/92] net: relocate paths to helpers and scripts Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 47/92] vl: relocate path to configuration file Paolo Bonzini
                   ` (47 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel

As an additional advantage, the logic is now unified between
POSIX and Win32 systems.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/qemu-common.h   |  1 -
 include/sysemu/sysemu.h |  2 +-
 os-posix.c              | 20 --------------------
 os-win32.c              | 11 -----------
 softmmu/vl.c            | 40 ++++++++++++++++++++++++++++------------
 tests/qtest/fuzz/fuzz.c |  5 +++--
 6 files changed, 32 insertions(+), 47 deletions(-)

diff --git a/include/qemu-common.h b/include/qemu-common.h
index 9cfd62669b..a9b11f59c4 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -131,7 +131,6 @@ char *qemu_find_file(int type, const char *name);
 
 /* OS specific functions */
 void os_setup_early_signal_handling(void);
-char *os_find_datadir(void);
 int os_parse_cmd_args(int index, const char *optarg);
 
 /*
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 4b6a5c459c..817ff4cf75 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -14,7 +14,7 @@ extern const char *qemu_name;
 extern QemuUUID qemu_uuid;
 extern bool qemu_uuid_set;
 
-void qemu_add_data_dir(const char *path);
+void qemu_add_data_dir(char *path);
 
 void qemu_add_exit_notifier(Notifier *notify);
 void qemu_remove_exit_notifier(Notifier *notify);
diff --git a/os-posix.c b/os-posix.c
index 36e344c544..1de2839554 100644
--- a/os-posix.c
+++ b/os-posix.c
@@ -80,26 +80,6 @@ void os_setup_signal_handling(void)
     sigaction(SIGTERM, &act, NULL);
 }
 
-/*
- * Find a likely location for support files using the location of the binary.
- * When running from the build tree this will be "$bindir/pc-bios".
- * Otherwise, this is CONFIG_QEMU_DATADIR.
- *
- * The caller must use g_free() to free the returned data when it is
- * no longer required.
- */
-char *os_find_datadir(void)
-{
-    g_autofree char *dir = NULL;
-
-    dir = g_build_filename(qemu_get_exec_dir(), "pc-bios", NULL);
-    if (g_file_test(dir, G_FILE_TEST_IS_DIR)) {
-        return g_steal_pointer(&dir);
-    }
-
-    return g_strdup(CONFIG_QEMU_DATADIR);
-}
-
 void os_set_proc_name(const char *s)
 {
 #if defined(PR_SET_NAME)
diff --git a/os-win32.c b/os-win32.c
index eb8501b9e5..fd1137bab1 100644
--- a/os-win32.c
+++ b/os-win32.c
@@ -57,17 +57,6 @@ void os_setup_early_signal_handling(void)
     atexit(os_undo_timer_resolution);
 }
 
-/*
- * Look for support files in the same directory as the executable.
- *
- * The caller must use g_free() to free the returned data when it is
- * no longer required.
- */
-char *os_find_datadir(void)
-{
-    return g_strdup(qemu_get_exec_dir());
-}
-
 void os_set_line_buffering(void)
 {
     setbuf(stdout, NULL);
diff --git a/softmmu/vl.c b/softmmu/vl.c
index f7b103467c..c872657e60 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -2005,7 +2005,7 @@ char *qemu_find_file(int type, const char *name)
     return NULL;
 }
 
-void qemu_add_data_dir(const char *path)
+void qemu_add_data_dir(char *path)
 {
     int i;
 
@@ -2017,10 +2017,11 @@ void qemu_add_data_dir(const char *path)
     }
     for (i = 0; i < data_dir_idx; i++) {
         if (strcmp(data_dir[i], path) == 0) {
-            return; /* duplicate */
+            g_free(path); /* duplicate */
+            return;
         }
     }
-    data_dir[data_dir_idx++] = g_strdup(path);
+    data_dir[data_dir_idx++] = path;
 }
 
 static inline bool nonempty_str(const char *str)
@@ -2829,6 +2830,26 @@ static void create_default_memdev(MachineState *ms, const char *path)
                             &error_fatal);
 }
 
+/*
+ * Find a likely location for support files using the location of the binary.
+ * When running from the build tree this will be "$bindir/pc-bios".
+ * Otherwise, this is CONFIG_QEMU_DATADIR (possibly relocated).
+ *
+ * The caller must use g_free() to free the returned data when it is
+ * no longer required.
+ */
+static char *find_datadir(void)
+{
+    g_autofree char *dir = NULL;
+
+    dir = g_build_filename(qemu_get_exec_dir(), "pc-bios", NULL);
+    if (g_file_test(dir, G_FILE_TEST_IS_DIR)) {
+        return g_steal_pointer(&dir);
+    }
+
+    return get_relocated_path(CONFIG_QEMU_DATADIR);
+}
+
 void qemu_init(int argc, char **argv, char **envp)
 {
     int i;
@@ -2862,7 +2883,7 @@ void qemu_init(int argc, char **argv, char **envp)
     Error *main_loop_err = NULL;
     Error *err = NULL;
     bool list_data_dirs = false;
-    char *dir, **dirs;
+    char **dirs;
     const char *mem_path = NULL;
     bool have_custom_ram_size;
     BlockdevOptionsQueue bdo_queue = QSIMPLEQ_HEAD_INITIALIZER(bdo_queue);
@@ -3195,7 +3216,7 @@ void qemu_init(int argc, char **argv, char **envp)
                 if (is_help_option(optarg)) {
                     list_data_dirs = true;
                 } else {
-                    qemu_add_data_dir(optarg);
+                    qemu_add_data_dir(g_strdup(optarg));
                 }
                 break;
             case QEMU_OPTION_bios:
@@ -3927,17 +3948,12 @@ void qemu_init(int argc, char **argv, char **envp)
     /* add configured firmware directories */
     dirs = g_strsplit(CONFIG_QEMU_FIRMWAREPATH, G_SEARCHPATH_SEPARATOR_S, 0);
     for (i = 0; dirs[i] != NULL; i++) {
-        qemu_add_data_dir(dirs[i]);
+        qemu_add_data_dir(get_relocated_path(dirs[i]));
     }
     g_strfreev(dirs);
 
     /* try to find datadir relative to the executable path */
-    dir = os_find_datadir();
-    qemu_add_data_dir(dir);
-    g_free(dir);
-
-    /* add the datadir specified when building */
-    qemu_add_data_dir(CONFIG_QEMU_DATADIR);
+    qemu_add_data_dir(find_datadir());
 
     /* -L help lists the data directories and exits. */
     if (list_data_dirs) {
diff --git a/tests/qtest/fuzz/fuzz.c b/tests/qtest/fuzz/fuzz.c
index c4dc5fa629..d926c490c5 100644
--- a/tests/qtest/fuzz/fuzz.c
+++ b/tests/qtest/fuzz/fuzz.c
@@ -170,8 +170,9 @@ int LLVMFuzzerInitialize(int *argc, char ***argv, char ***envp)
         datadir = g_build_filename(bindir, "pc-bios", NULL);
         if (g_file_test(datadir, G_FILE_TEST_IS_DIR)) {
             qemu_add_data_dir(datadir);
-        }
-        g_free(datadir);
+        } else {
+            g_free(datadir);
+	}
     } else if (*argc > 1) {  /* The target is specified as an argument */
         target_name = (*argv)[1];
         if (!strstr(target_name, "--fuzz-target=")) {
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 47/92] vl: relocate path to configuration file
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (45 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 46/92] vl: relocate paths to data directories Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 48/92] qemu-bridge-helper: relocate path to default ACL Paolo Bonzini
                   ` (46 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Philippe Mathieu-Daudé

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 softmmu/vl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/softmmu/vl.c b/softmmu/vl.c
index c872657e60..c4f9671c48 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -2676,8 +2676,9 @@ static int global_init_func(void *opaque, QemuOpts *opts, Error **errp)
 static int qemu_read_default_config_file(void)
 {
     int ret;
+    g_autofree char *file = get_relocated_path(CONFIG_QEMU_CONFDIR "/qemu.conf");
 
-    ret = qemu_read_config_file(CONFIG_QEMU_CONFDIR "/qemu.conf");
+    ret = qemu_read_config_file(file);
     if (ret < 0 && ret != -ENOENT) {
         return ret;
     }
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 48/92] qemu-bridge-helper: relocate path to default ACL
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (46 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 47/92] vl: relocate path to configuration file Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 49/92] qga: relocate path to default configuration and hook Paolo Bonzini
                   ` (45 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 qemu-bridge-helper.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/qemu-bridge-helper.c b/qemu-bridge-helper.c
index 88b26747fc..a26e1663f0 100644
--- a/qemu-bridge-helper.c
+++ b/qemu-bridge-helper.c
@@ -40,6 +40,7 @@
 #endif
 
 #include "qemu/queue.h"
+#include "qemu/cutils.h"
 
 #include "net/tap-linux.h"
 
@@ -245,6 +246,7 @@ int main(int argc, char **argv)
     ACLList acl_list;
     int access_allowed, access_denied;
     int ret = EXIT_SUCCESS;
+    g_autofree char *acl_file = NULL;
 
 #ifdef CONFIG_LIBCAP_NG
     /* if we're run from an suid binary, immediately drop privileges preserving
@@ -257,6 +259,8 @@ int main(int argc, char **argv)
     }
 #endif
 
+    qemu_init_exec_dir(argv[0]);
+
     /* parse arguments */
     for (index = 1; index < argc; index++) {
         if (strcmp(argv[index], "--use-vnet") == 0) {
@@ -282,9 +286,10 @@ int main(int argc, char **argv)
 
     /* parse default acl file */
     QSIMPLEQ_INIT(&acl_list);
-    if (parse_acl_file(DEFAULT_ACL_FILE, &acl_list) == -1) {
+    acl_file = get_relocated_path(DEFAULT_ACL_FILE);
+    if (parse_acl_file(acl_file, &acl_list) == -1) {
         fprintf(stderr, "failed to parse default acl file `%s'\n",
-                DEFAULT_ACL_FILE);
+                acl_file);
         ret = EXIT_FAILURE;
         goto cleanup;
     }
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 49/92] qga: relocate path to default configuration and hook
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (47 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 48/92] qemu-bridge-helper: relocate path to default ACL Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 50/92] ui: relocate paths to icons and translations Paolo Bonzini
                   ` (44 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 qga/main.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/qga/main.c b/qga/main.c
index 3febf3b0fd..740f5f7303 100644
--- a/qga/main.c
+++ b/qga/main.c
@@ -29,6 +29,7 @@
 #include "qapi/error.h"
 #include "channel.h"
 #include "qemu/bswap.h"
+#include "qemu/cutils.h"
 #include "qemu/help_option.h"
 #include "qemu/sockets.h"
 #include "qemu/systemd.h"
@@ -968,7 +969,7 @@ static void config_load(GAConfig *config)
 {
     GError *gerr = NULL;
     GKeyFile *keyfile;
-    const char *conf = g_getenv("QGA_CONF") ?: QGA_CONF_DEFAULT;
+    g_autofree char *conf = g_strdup(g_getenv("QGA_CONF")) ?: get_relocated_path(QGA_CONF_DEFAULT);
 
     /* read system config */
     keyfile = g_key_file_new();
@@ -1027,7 +1028,7 @@ end:
     if (gerr &&
         !(gerr->domain == G_FILE_ERROR && gerr->code == G_FILE_ERROR_NOENT)) {
         g_critical("error loading configuration from path: %s, %s",
-                   QGA_CONF_DEFAULT, gerr->message);
+                   conf, gerr->message);
         exit(EXIT_FAILURE);
     }
     g_clear_error(&gerr);
@@ -1141,7 +1142,7 @@ static void config_parse(GAConfig *config, int argc, char **argv)
 #ifdef CONFIG_FSFREEZE
         case 'F':
             g_free(config->fsfreeze_hook);
-            config->fsfreeze_hook = g_strdup(optarg ?: QGA_FSFREEZE_HOOK_DEFAULT);
+            config->fsfreeze_hook = optarg ? g_strdup(optarg) : get_relocated_path(QGA_FSFREEZE_HOOK_DEFAULT);
             break;
 #endif
         case 't':
@@ -1463,6 +1464,7 @@ int main(int argc, char **argv)
 
     config->log_level = G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL;
 
+    qemu_init_exec_dir(argv[0]);
     qga_qmp_init_marshal(&ga_commands);
 
     init_dfl_pathnames();
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 50/92] ui: relocate paths to icons and translations
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (48 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 49/92] qga: relocate path to default configuration and hook Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 51/92] configure: use a platform-neutral prefix Paolo Bonzini
                   ` (43 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Philippe Mathieu-Daudé

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 ui/gtk.c  | 10 ++++++++--
 ui/sdl2.c |  9 +++++++--
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/ui/gtk.c b/ui/gtk.c
index 1c59de2af4..b11594d817 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -51,6 +51,7 @@
 #include <math.h>
 
 #include "trace.h"
+#include "qemu/cutils.h"
 #include "ui/input.h"
 #include "sysemu/runstate.h"
 #include "sysemu/sysemu.h"
@@ -2202,6 +2203,7 @@ static void gtk_display_init(DisplayState *ds, DisplayOptions *opts)
     GtkDisplayState *s = g_malloc0(sizeof(*s));
     GdkDisplay *window_display;
     GtkIconTheme *theme;
+    char *dir;
 
     if (!gtkinit) {
         fprintf(stderr, "gtk initialization failed\n");
@@ -2211,7 +2213,9 @@ static void gtk_display_init(DisplayState *ds, DisplayOptions *opts)
     s->opts = opts;
 
     theme = gtk_icon_theme_get_default();
-    gtk_icon_theme_prepend_search_path(theme, CONFIG_QEMU_ICONDIR);
+    dir = get_relocated_path(CONFIG_QEMU_ICONDIR);
+    gtk_icon_theme_prepend_search_path(theme, dir);
+    g_free(dir);
     g_set_prgname("qemu");
 
     s->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
@@ -2227,7 +2231,9 @@ static void gtk_display_init(DisplayState *ds, DisplayOptions *opts)
      * sure that we don't accidentally break implicit assumptions.  */
     setlocale(LC_MESSAGES, "");
     setlocale(LC_CTYPE, "C.UTF-8");
-    bindtextdomain("qemu", CONFIG_QEMU_LOCALEDIR);
+    dir = get_relocated_path(CONFIG_QEMU_LOCALEDIR);
+    bindtextdomain("qemu", dir);
+    g_free(dir);
     bind_textdomain_codeset("qemu", "UTF-8");
     textdomain("qemu");
 
diff --git a/ui/sdl2.c b/ui/sdl2.c
index b23a8f0a8e..abad7f981e 100644
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -25,6 +25,7 @@
 
 #include "qemu/osdep.h"
 #include "qemu/module.h"
+#include "qemu/cutils.h"
 #include "ui/console.h"
 #include "ui/input.h"
 #include "ui/sdl2.h"
@@ -795,6 +796,7 @@ static void sdl2_display_init(DisplayState *ds, DisplayOptions *o)
     int i;
     SDL_SysWMinfo info;
     SDL_Surface *icon = NULL;
+    char *dir;
 
     assert(o->type == DISPLAY_TYPE_SDL);
 
@@ -868,15 +870,18 @@ static void sdl2_display_init(DisplayState *ds, DisplayOptions *o)
     }
 
 #ifdef CONFIG_SDL_IMAGE
-    icon = IMG_Load(CONFIG_QEMU_ICONDIR "/hicolor/128x128/apps/qemu.png");
+    dir = get_relocated_path(CONFIG_QEMU_ICONDIR "/hicolor/128x128/apps/qemu.png");
+    icon = IMG_Load(dir);
 #else
     /* Load a 32x32x4 image. White pixels are transparent. */
-    icon = SDL_LoadBMP(CONFIG_QEMU_ICONDIR "/hicolor/32x32/apps/qemu.bmp");
+    dir = get_relocated_path(CONFIG_QEMU_ICONDIR "/hicolor/32x32/apps/qemu.bmp");
+    icon = SDL_LoadBMP(dir);
     if (icon) {
         uint32_t colorkey = SDL_MapRGB(icon->format, 255, 255, 255);
         SDL_SetColorKey(icon, SDL_TRUE, colorkey);
     }
 #endif
+    g_free(dir);
     if (icon) {
         SDL_SetWindowIcon(sdl2_console[0].real_window, icon);
     }
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 51/92] configure: use a platform-neutral prefix
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (49 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 50/92] ui: relocate paths to icons and translations Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 52/92] hw/i386/q35: Remove unreachable Xen code on Q35 machine Paolo Bonzini
                   ` (42 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel

Now that the installation is relocatable, there is no need to compile a
Windows-format prefix into Win32 binaries.  Instead, the prefix will
only be used to compute installation-relative paths, and it can be
any string.

Drop the "Program Files" path completely: it is only usable on English
versions of Windows; therefore, using the NSIS installer to get the
"correct" path to the Program Files folder is recommended, and NSIS
works just as well with any prefix.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure | 30 +++++++++++-------------------
 1 file changed, 11 insertions(+), 19 deletions(-)

diff --git a/configure b/configure
index 161d0604bb..fee5faa054 100755
--- a/configure
+++ b/configure
@@ -969,7 +969,7 @@ if test "$mingw32" = "yes" ; then
   # MinGW needs -mthreads for TLS and macro _MT.
   CFLAGS="-mthreads $CFLAGS"
   write_c_skeleton;
-  prefix="c:/Program Files/QEMU"
+  prefix="/qemu"
   qemu_suffix=""
   libs_qga="-lws2_32 -lwinmm -lpowrprof -lwtsapi32 -lwininet -liphlpapi -lnetapi32 $libs_qga"
 fi
@@ -7802,17 +7802,9 @@ echo "strip = $(meson_quote $strip)" >> $cross
 echo "windres = $(meson_quote $windres)" >> $cross
 if test -n "$cross_prefix"; then
     cross_arg="--cross-file config-meson.cross"
-    # Hack: Meson expects an absolute path for the *build* machine
-    # for the prefix, so add a slash in front of a Windows path that
-    # includes a drive letter.
-    #
-    # See https://github.com/mesonbuild/meson/issues/7577.
     echo "[host_machine]" >> $cross
     if test "$mingw32" = "yes" ; then
         echo "system = 'windows'" >> $cross
-        case $prefix in
-            ?:*) pre_prefix=/ ;;
-        esac
     fi
     if test "$linux" = "yes" ; then
         echo "system = 'linux'" >> $cross
@@ -7841,16 +7833,16 @@ mv $cross config-meson.cross
 
 rm -rf meson-private meson-info meson-logs
 NINJA=${ninja:-$PWD/ninjatool} $meson setup \
-        --prefix "${pre_prefix}$prefix" \
-        --libdir "${pre_prefix}$libdir" \
-        --libexecdir "${pre_prefix}$libexecdir" \
-        --bindir "${pre_prefix}$bindir" \
-        --includedir "${pre_prefix}$includedir" \
-        --datadir "${pre_prefix}$datadir" \
-        --mandir "${pre_prefix}$mandir" \
-        --sysconfdir "${pre_prefix}$sysconfdir" \
-        --localstatedir "${pre_prefix}$local_statedir" \
-        -Ddocdir="${pre_prefix}$docdir" \
+        --prefix "$prefix" \
+        --libdir "$libdir" \
+        --libexecdir "$libexecdir" \
+        --bindir "$bindir" \
+        --includedir "$includedir" \
+        --datadir "$datadir" \
+        --mandir "$mandir" \
+        --sysconfdir "$sysconfdir" \
+        --localstatedir "$local_statedir" \
+        -Ddocdir="$docdir" \
         -Dqemu_suffix="$qemu_suffix" \
         -Doptimization=$(if test "$debug" = yes; then echo 0; else echo 2; fi) \
         -Ddebug=$(if test "$debug_info" = yes; then echo true; else echo false; fi) \
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 52/92] hw/i386/q35: Remove unreachable Xen code on Q35 machine
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (50 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 51/92] configure: use a platform-neutral prefix Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 53/92] exec: Remove MemoryRegion::global_locking field Paolo Bonzini
                   ` (41 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony PERARD, Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <philmd@redhat.com>

Xen accelerator requires specific changes to a machine to be able
to use it. See for example the 'Xen PC' machine configure its PCI
bus calling pc_xen_hvm_init_pci(). There is no 'Xen Q35' machine
declared. This code was probably added while introducing the Q35
machine, based on the existing PC machine (see commit df2d8b3ed4
"Introduce q35 pc based chipset emulator"). Remove the unreachable
code to simplify this file.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Acked-by: Anthony PERARD <anthony.perard@citrix.com>
Message-Id: <20200722082517.18708-1-philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/i386/pc_q35.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 11ab5bd7be..a4a37b26c5 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -34,9 +34,7 @@
 #include "sysemu/arch_init.h"
 #include "hw/i2c/smbus_eeprom.h"
 #include "hw/rtc/mc146818rtc.h"
-#include "hw/xen/xen.h"
 #include "sysemu/kvm.h"
-#include "sysemu/xen.h"
 #include "hw/kvm/clock.h"
 #include "hw/pci-host/q35.h"
 #include "hw/qdev-properties.h"
@@ -179,10 +177,6 @@ static void pc_q35_init(MachineState *machine)
         x86ms->below_4g_mem_size = machine->ram_size;
     }
 
-    if (xen_enabled()) {
-        xen_hvm_init(pcms, &ram_memory);
-    }
-
     x86_cpus_init(x86ms, pcmc->default_cpu_version);
 
     kvmclock_create();
@@ -208,10 +202,7 @@ static void pc_q35_init(MachineState *machine)
     }
 
     /* allocate ram and load rom/bios */
-    if (!xen_enabled()) {
-        pc_memory_init(pcms, get_system_memory(),
-                       rom_memory, &ram_memory);
-    }
+    pc_memory_init(pcms, get_system_memory(), rom_memory, &ram_memory);
 
     /* create pci host bus */
     q35_host = Q35_HOST_DEVICE(qdev_new(TYPE_Q35_HOST_DEVICE));
@@ -271,7 +262,7 @@ static void pc_q35_init(MachineState *machine)
 
     assert(pcms->vmport != ON_OFF_AUTO__MAX);
     if (pcms->vmport == ON_OFF_AUTO_AUTO) {
-        pcms->vmport = xen_enabled() ? ON_OFF_AUTO_OFF : ON_OFF_AUTO_ON;
+        pcms->vmport = ON_OFF_AUTO_ON;
     }
 
     /* init basic PC hardware */
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 53/92] exec: Remove MemoryRegion::global_locking field
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (51 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 52/92] hw/i386/q35: Remove unreachable Xen code on Q35 machine Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 54/92] checkpatch: avoid error on cover letter files Paolo Bonzini
                   ` (40 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel
  Cc: Alexander Bulekov, Philippe Mathieu-Daudé, Stefan Hajnoczi

From: Philippe Mathieu-Daudé <philmd@redhat.com>

Last uses of memory_region_clear_global_locking() have been
removed in commit 7070e085d4 ("acpi: mark PMTIMER as unlocked")
and commit 08565552f7 ("cputlb: Move NOTDIRTY handling from I/O
path to TLB path").
Remove memory_region_clear_global_locking() and the now unused
'global_locking' field in MemoryRegion.

Reported-by: Alexander Bulekov <alxndr@bu.edu>
Suggested-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20200806150726.962-1-philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 accel/tcg/cputlb.c    |  4 ++--
 exec.c                |  2 +-
 include/exec/memory.h | 14 --------------
 softmmu/memory.c      |  6 ------
 4 files changed, 3 insertions(+), 23 deletions(-)

diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
index 6489abbf8c..4657a3b8a6 100644
--- a/accel/tcg/cputlb.c
+++ b/accel/tcg/cputlb.c
@@ -1053,7 +1053,7 @@ static uint64_t io_readx(CPUArchState *env, CPUIOTLBEntry *iotlbentry,
         cpu_io_recompile(cpu, retaddr);
     }
 
-    if (mr->global_locking && !qemu_mutex_iothread_locked()) {
+    if (!qemu_mutex_iothread_locked()) {
         qemu_mutex_lock_iothread();
         locked = true;
     }
@@ -1114,7 +1114,7 @@ static void io_writex(CPUArchState *env, CPUIOTLBEntry *iotlbentry,
      */
     save_iotlb_data(cpu, iotlbentry->addr, section, mr_offset);
 
-    if (mr->global_locking && !qemu_mutex_iothread_locked()) {
+    if (!qemu_mutex_iothread_locked()) {
         qemu_mutex_lock_iothread();
         locked = true;
     }
diff --git a/exec.c b/exec.c
index e34b602bdf..bc55a92292 100644
--- a/exec.c
+++ b/exec.c
@@ -3136,7 +3136,7 @@ static bool prepare_mmio_access(MemoryRegion *mr)
     bool unlocked = !qemu_mutex_iothread_locked();
     bool release_lock = false;
 
-    if (unlocked && mr->global_locking) {
+    if (unlocked) {
         qemu_mutex_lock_iothread();
         unlocked = false;
         release_lock = true;
diff --git a/include/exec/memory.h b/include/exec/memory.h
index ec9edee742..9f6468f346 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -404,7 +404,6 @@ struct MemoryRegion {
     bool nonvolatile;
     bool rom_device;
     bool flush_coalesced_mmio;
-    bool global_locking;
     uint8_t dirty_log_mask;
     bool is_iommu;
     RAMBlock *ram_block;
@@ -1738,19 +1737,6 @@ void memory_region_set_flush_coalesced(MemoryRegion *mr);
  */
 void memory_region_clear_flush_coalesced(MemoryRegion *mr);
 
-/**
- * memory_region_clear_global_locking: Declares that access processing does
- *                                     not depend on the QEMU global lock.
- *
- * By clearing this property, accesses to the memory region will be processed
- * outside of QEMU's global lock (unless the lock is held on when issuing the
- * access request). In this case, the device model implementing the access
- * handlers is responsible for synchronization of concurrency.
- *
- * @mr: the memory region to be updated.
- */
-void memory_region_clear_global_locking(MemoryRegion *mr);
-
 /**
  * memory_region_add_eventfd: Request an eventfd to be triggered when a word
  *                            is written to a location.
diff --git a/softmmu/memory.c b/softmmu/memory.c
index d030eb6f7c..31b0c5250e 100644
--- a/softmmu/memory.c
+++ b/softmmu/memory.c
@@ -1221,7 +1221,6 @@ static void memory_region_initfn(Object *obj)
     mr->ops = &unassigned_mem_ops;
     mr->enabled = true;
     mr->romd_mode = true;
-    mr->global_locking = true;
     mr->destructor = memory_region_destructor_none;
     QTAILQ_INIT(&mr->subregions);
     QTAILQ_INIT(&mr->coalesced);
@@ -2277,11 +2276,6 @@ void memory_region_clear_flush_coalesced(MemoryRegion *mr)
     }
 }
 
-void memory_region_clear_global_locking(MemoryRegion *mr)
-{
-    mr->global_locking = false;
-}
-
 static bool userspace_eventfd_warning;
 
 void memory_region_add_eventfd(MemoryRegion *mr,
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 54/92] checkpatch: avoid error on cover letter files
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (52 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 53/92] exec: Remove MemoryRegion::global_locking field Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 55/92] meson: fix installation of keymaps Paolo Bonzini
                   ` (39 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Stefano Garzarella

From: Stefano Garzarella <sgarzare@redhat.com>

Running checkpatch on a directory that contains a cover letter reports
this error:

    Checking /tmp/tmpbnngauy3/0000-cover-letter.patch...
    ERROR: Does not appear to be a unified-diff format patch

    total: 1 errors, 0 warnings, 0 lines checked

Let's skip cover letter as it is already done in the Linux kernel
commits 06330fc40e3f ("checkpatch: avoid NOT_UNIFIED_DIFF errors
on cover-letter.patch files") and a08ffbef4ab7 ("checkpatch: fix
ignoring cover-letter logic").

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Message-Id: <20200917170212.92672-1-sgarzare@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 50910899f2..22bb634c8e 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3005,7 +3005,7 @@ sub process {
 		return 1;
 	}
 
-	if (!$is_patch) {
+	if (!$is_patch && $filename !~ /cover-letter\.patch$/) {
 		ERROR("Does not appear to be a unified-diff format patch\n");
 	}
 
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 55/92] meson: fix installation of keymaps
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (53 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 54/92] checkpatch: avoid error on cover letter files Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 56/92] configure: fix performance regression due to PIC objects Paolo Bonzini
                   ` (38 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony PERARD

From: Anthony PERARD <anthony.perard@citrix.com>

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>

Message-Id: <20200918130354.1879275-1-anthony.perard@citrix.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 pc-bios/keymaps/meson.build | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/pc-bios/keymaps/meson.build b/pc-bios/keymaps/meson.build
index 2e2e0dfa3b..05eda6c0d2 100644
--- a/pc-bios/keymaps/meson.build
+++ b/pc-bios/keymaps/meson.build
@@ -47,6 +47,7 @@ foreach km, args: keymaps
                        build_by_default: true,
                        output: km,
                        command: [native_qemu_keymap, '-f', '@OUTPUT@', args.split()],
+                       install: true,
                        install_dir: qemu_datadir / 'keymaps')
   else
     # copy from source tree
@@ -55,6 +56,7 @@ foreach km, args: keymaps
                        input: km,
                        output: km,
                        command: ['cp', '@INPUT@', '@OUTPUT@'],
+                       install: true,
                        install_dir: qemu_datadir / 'keymaps')
   endif
 endforeach
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 56/92] configure: fix performance regression due to PIC objects
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (54 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 55/92] meson: fix installation of keymaps Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 57/92] oss-fuzz: move linker arg to fix coverage-build Paolo Bonzini
                   ` (37 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Ahmed Karaman

Because most files in QEMU are grouped into static libraries, Meson conservatively
compiles them with -fPIC.  This is overkill and produces slowdowns up to 20% on
some TCG tests.

As a stopgap measure, use the b_staticpic option to limit the slowdown to
--enable-pie.  https://github.com/mesonbuild/meson/pull/7760 will allow
us to use b_staticpic=false and let Meson do the right thing.

Reported-by: Ahmed Karaman <ahmedkrmn@outlook.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20200919155639.1045857-1-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configure b/configure
index fee5faa054..ac0dfdfac5 100755
--- a/configure
+++ b/configure
@@ -7849,6 +7849,7 @@ NINJA=${ninja:-$PWD/ninjatool} $meson setup \
         -Dwerror=$(if test "$werror" = yes; then echo true; else echo false; fi) \
         -Dstrip=$(if test "$strip_opt" = yes; then echo true; else echo false; fi) \
         -Db_pie=$(if test "$pie" = yes; then echo true; else echo false; fi) \
+        -Db_staticpic=$(if test "$pie" = yes; then echo true; else echo false; fi) \
         -Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \
 	-Dmalloc=$malloc -Dmalloc_trim=$malloc_trim \
 	-Dcocoa=$cocoa -Dmpath=$mpath -Dsdl=$sdl -Dsdl_image=$sdl_image \
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 57/92] oss-fuzz: move linker arg to fix coverage-build
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (55 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 56/92] configure: fix performance regression due to PIC objects Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 58/92] tests/tcg: reinstate or replace desired parts of rules.mak Paolo Bonzini
                   ` (36 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alexander Bulekov

From: Alexander Bulekov <alxndr@bu.edu>

The order of the add_project_link_arguments calls impacts which
arguments are placed between --start-group and --end-group.
OSS-Fuzz coverage builds seem to just add these to CFLAGS:
-fprofile-instr-generate -fcoverage-mapping pthread -Wl,--no-as-needed
-Wl,-ldl -Wl,-lm Wno-unused-command-line-argument

The -Wl,-ldl flag that is enough to shift the fork_fuzz.ld linker-script
back into the linker group. Move the linker-script meson call before the
other calls to make sure the flag is placed correctly.

Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
Message-Id: <20200909220516.614222-1-alxndr@bu.edu>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 meson.build | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/meson.build b/meson.build
index ace15dc8c0..9aeefa60fb 100644
--- a/meson.build
+++ b/meson.build
@@ -54,6 +54,14 @@ configure_file(input: files('scripts/ninjatool.py'),
 # Compiler flags #
 ##################
 
+# Specify linker-script with add_project_link_arguments so that it is not placed
+# within a linker --start-group/--end-group pair
+if 'CONFIG_FUZZ' in config_host
+   add_project_link_arguments(['-Wl,-T,',
+                               (meson.current_source_dir() / 'tests/qtest/fuzz/fork_fuzz.ld')],
+                              native: false, language: ['c', 'cpp', 'objc'])
+endif
+
 add_project_arguments(config_host['QEMU_CFLAGS'].split(),
                       native: false, language: ['c', 'objc'])
 add_project_arguments(config_host['QEMU_CXXFLAGS'].split(),
@@ -63,13 +71,6 @@ add_project_link_arguments(config_host['QEMU_LDFLAGS'].split(),
 add_project_arguments(config_host['QEMU_INCLUDES'].split(),
                       language: ['c', 'cpp', 'objc'])
 
-# Specify linker-script with add_project_link_arguments so that it is not placed
-# within a linker --start-group/--end-group pair
-if 'CONFIG_FUZZ' in config_host
-   add_project_link_arguments(['-Wl,-T,',
-                               (meson.current_source_dir() / 'tests/qtest/fuzz/fork_fuzz.ld')],
-                              native: false, language: ['c', 'cpp', 'objc'])
-endif
 
 link_language = meson.get_external_property('link_language', 'cpp')
 if link_language == 'cpp'
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 58/92] tests/tcg: reinstate or replace desired parts of rules.mak
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (56 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 57/92] oss-fuzz: move linker arg to fix coverage-build Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 59/92] configure: cleanup invocation of submodule Make Paolo Bonzini
                   ` (35 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alex Bennée

Commit 660f79309303d696531ffb394719dfab3e0c42c0 was a bit overzealous
with respect to tests/tcg, which needed quiet-command and $(BUILD_DIR).
Reinstate quiet-command, and replace $(BUILD_DIR) with just the
current directory.

Reported-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/tcg/Makefile.qemu | 13 ++++++++++++-
 tests/tcg/configure.sh  |  4 ++--
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/tests/tcg/Makefile.qemu b/tests/tcg/Makefile.qemu
index 0332bad10f..c096c611a2 100644
--- a/tests/tcg/Makefile.qemu
+++ b/tests/tcg/Makefile.qemu
@@ -11,9 +11,20 @@
 # The configure script fills in extra information about
 # useful docker images or alternative compiler flags.
 
+# Usage: $(call quiet-command,command and args,"NAME","args to print")
+# This will run "command and args", and either:
+#  if V=1 just print the whole command and args
+#  otherwise print the 'quiet' output in the format "  NAME     args to print"
+# NAME should be a short name of the command, 7 letters or fewer.
+# If called with only a single argument, will print nothing in quiet mode.
+quiet-command-run = $(if $(V),,$(if $2,printf "  %-7s %s\n" $2 $3 && ))$1
+quiet-@ = $(if $(V),,@)
+quiet-command = $(quiet-@)$(call quiet-command-run,$1,$2,$3)
+
 CROSS_CC_GUEST:=
 DOCKER_IMAGE:=
--include $(BUILD_DIR)/tests/tcg/config-$(TARGET).mak
+
+-include tests/tcg/config-$(TARGET).mak
 
 GUEST_BUILD=
 TCG_MAKE=../Makefile.target
diff --git a/tests/tcg/configure.sh b/tests/tcg/configure.sh
index 598a50cd4f..be51bdb5a4 100755
--- a/tests/tcg/configure.sh
+++ b/tests/tcg/configure.sh
@@ -193,11 +193,11 @@ for target in $target_list; do
   case $target in
     *-linux-user | *-bsd-user)
       echo "CONFIG_USER_ONLY=y" >> $config_target_mak
-      echo "QEMU=\$(BUILD_DIR)/qemu-$arch" >> $config_target_mak
+      echo "QEMU=$PWD/qemu-$arch" >> $config_target_mak
       ;;
     *-softmmu)
       echo "CONFIG_SOFTMMU=y" >> $config_target_mak
-      echo "QEMU=\$(BUILD_DIR)/qemu-system-$arch" >> $config_target_mak
+      echo "QEMU=$PWD/qemu-system-$arch" >> $config_target_mak
       ;;
   esac
 
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 59/92] configure: cleanup invocation of submodule Make
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (57 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 58/92] tests/tcg: reinstate or replace desired parts of rules.mak Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 60/92] configure: cleanup CFLAGS and LDFLAGS for submodules Paolo Bonzini
                   ` (34 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Richard Henderson

Move common command line options to SUBDIR_MAKEFLAGS, thus simplifying
the rules themselves.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 Makefile | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/Makefile b/Makefile
index 897246d77c..f83226e0e1 100644
--- a/Makefile
+++ b/Makefile
@@ -137,7 +137,13 @@ configure: ;
 .PHONY: all clean distclean install \
 	recurse-all dist msi FORCE
 
-SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory --quiet)
+SUBMODULE_CFLAGS = $(QEMU_CFLAGS) $(CFLAGS)
+SUBDIR_MAKEFLAGS = $(if $(V),,--no-print-directory --quiet)
+SUBDIR_HOST_VARS = 							\
+	PKG_CONFIG="$(PKG_CONFIG)" 					\
+	CC="$(CC)" AR="$(AR)" LD="$(LD)" RANLIB="$(RANLIB)"		\
+	CFLAGS="$(SUBMODULE_CFLAGS)" LDFLAGS="$(SUBMODULE_LDFLAGS)"	\
+	ARFLAGS="$(ARFLAGS)"
 
 include $(SRC_PATH)/tests/Makefile.include
 
@@ -146,12 +152,12 @@ Makefile: $(addsuffix /all, $(SUBDIRS))
 
 # LIBFDT_lib="": avoid breaking existing trees with objects requiring -fPIC
 DTC_MAKE_ARGS=-I$(SRC_PATH)/dtc VPATH=$(SRC_PATH)/dtc -C dtc V="$(V)" LIBFDT_lib=""
-DTC_CFLAGS=$(CFLAGS) $(QEMU_CFLAGS)
 DTC_CPPFLAGS=-I$(SRC_PATH)/dtc/libfdt
 
 .PHONY: dtc/all
 dtc/all: .git-submodule-status dtc/libfdt
-	$(call quiet-command,$(MAKE) $(DTC_MAKE_ARGS) CPPFLAGS="$(DTC_CPPFLAGS)" CFLAGS="$(DTC_CFLAGS)" LDFLAGS="$(QEMU_LDFLAGS)" ARFLAGS="$(ARFLAGS)" CC="$(CC)" AR="$(AR)" LD="$(LD)" $(SUBDIR_MAKEFLAGS) libfdt,)
+	$(call quiet-command,$(MAKE) $(DTC_MAKE_ARGS)			\
+            CPPFLAGS="$(DTC_CPPFLAGS)" $(SUBDIR_MAKEFLAGS) $(SUBDIR_HOST_VARS) libfdt,)
 
 dtc/%: .git-submodule-status
 	@mkdir -p $@
@@ -161,7 +167,7 @@ dtc/%: .git-submodule-status
 # Therefore we replicate some of the logic in the sub-makefile.
 # Remove all the extra -Warning flags that QEMU uses that Capstone doesn't;
 # no need to annoy QEMU developers with such things.
-CAP_CFLAGS = $(patsubst -W%,,$(CFLAGS) $(QEMU_CFLAGS)) $(CAPSTONE_CFLAGS)
+CAP_CFLAGS := $(patsubst -W%,,$(SUBMODULE_CFLAGS)) $(CAPSTONE_CFLAGS)
 CAP_CFLAGS += -DCAPSTONE_USE_SYS_DYN_MEM
 CAP_CFLAGS += -DCAPSTONE_HAS_ARM
 CAP_CFLAGS += -DCAPSTONE_HAS_ARM64
@@ -169,16 +175,17 @@ CAP_CFLAGS += -DCAPSTONE_HAS_POWERPC
 CAP_CFLAGS += -DCAPSTONE_HAS_X86
 
 .PHONY: capstone/all
+capstone/all: SUBMODULE_CFLAGS = $(CAP_CFLAGS)
 capstone/all: .git-submodule-status
-	$(call quiet-command,$(MAKE) -C $(SRC_PATH)/capstone CAPSTONE_SHARED=no BUILDDIR="$(BUILD_DIR)/capstone" CC="$(CC)" AR="$(AR)" LD="$(LD)" RANLIB="$(RANLIB)" CFLAGS="$(CAP_CFLAGS)" $(SUBDIR_MAKEFLAGS) $(BUILD_DIR)/capstone/$(LIBCAPSTONE))
+	$(call quiet-command,$(MAKE) -C $(SRC_PATH)/capstone 		\
+            CAPSTONE_SHARED=no BUILDDIR="$(BUILD_DIR)/capstone" 	\
+            $(SUBDIR_MAKEFLAGS) $(SUBDIR_HOST_VARS) $(BUILD_DIR)/capstone/$(LIBCAPSTONE))
 
 .PHONY: slirp/all
 slirp/all: .git-submodule-status
 	$(call quiet-command,$(MAKE) -C $(SRC_PATH)/slirp		\
-		BUILD_DIR="$(BUILD_DIR)/slirp" 			\
-		PKG_CONFIG="$(PKG_CONFIG)" 				\
-		CC="$(CC)" AR="$(AR)" 	LD="$(LD)" RANLIB="$(RANLIB)"	\
-		CFLAGS="$(QEMU_CFLAGS) $(CFLAGS)" LDFLAGS="$(QEMU_LDFLAGS)")
+		BUILD_DIR="$(BUILD_DIR)/slirp" 				\
+		$(SUBDIR_MAKEFLAGS) $(SUBDIR_HOST_VARS))
 
 ROM_DIRS = $(addprefix pc-bios/, $(ROMS))
 ROM_DIRS_RULES=$(foreach t, all clean, $(addsuffix /$(t), $(ROM_DIRS)))
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 60/92] configure: cleanup CFLAGS and LDFLAGS for submodules
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (58 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 59/92] configure: cleanup invocation of submodule Make Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 61/92] configure: do not clobber environment CFLAGS/CXXFLAGS/LDFLAGS Paolo Bonzini
                   ` (33 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Richard Henderson

The -g and -O2 flags that configure adds to CFLAGS are only used by submodules,
so do not put anymore the confusing CFLAGS variable in config-host.mak and
replace it with more explicit SUBMODULE_CFLAGS variable.

There was also no equivalent SUBMODULE_LDFLAGS variable, add it.  This would
theoretically help with LTO if we want -g and -O2 options on the command line.
I say "theoretically" because submodules should not be linking anything; but
since we were passing an "LD" variable we might as well get its flags right.

CFLAGS are now synthesized in the configuration summary as a quick way to present
--enable-debug and --enable-debug-info.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 Makefile    |  1 -
 configure   | 20 ++++++++++++++++----
 meson.build |  3 ++-
 3 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index f83226e0e1..61ab93f05a 100644
--- a/Makefile
+++ b/Makefile
@@ -137,7 +137,6 @@ configure: ;
 .PHONY: all clean distclean install \
 	recurse-all dist msi FORCE
 
-SUBMODULE_CFLAGS = $(QEMU_CFLAGS) $(CFLAGS)
 SUBDIR_MAKEFLAGS = $(if $(V),,--no-print-directory --quiet)
 SUBDIR_HOST_VARS = 							\
 	PKG_CONFIG="$(PKG_CONFIG)" 					\
diff --git a/configure b/configure
index ac0dfdfac5..9b7232f9d2 100755
--- a/configure
+++ b/configure
@@ -6112,12 +6112,23 @@ elif test "$fortify_source" = "yes" ; then
   QEMU_CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
   debug=no
 fi
+
+SUBMODULE_CFLAGS=-Wall
+SUBMODULE_LDFLAGS=
+if test "$pie" = "yes"; then
+  SUBMODULE_CFLAGS="$SUBMODULE_CFLAGS -fPIE"
+  SUBMODULE_LDFLAGS="$SUBMODULE_LDFLAGS -pie"
+else
+  SUBMODULE_CFLAGS="$SUBMODULE_CFLAGS $CFLAGS_NOPIE"
+  SUBMODULE_LDFLAGS="$SUBMODULE_LDFLAGS $LDFLAGS_NOPIE"
+fi
 if test "$debug_info" = "yes"; then
-  CFLAGS="-g $CFLAGS"
-  LDFLAGS="-g $LDFLAGS"
+  SUBMODULE_CFLAGS="$SUBMODULE_CFLAGS -g"
+  SUBMODULE_LDFLAGS="$SUBMODULE_LDFLAGS -g"
 fi
 if test "$debug" = "no"; then
-  CFLAGS="-O2 $CFLAGS"
+  SUBMODULE_CFLAGS="$SUBMODULE_CFLAGS -O2"
+  SUBMODULE_LDFLAGS="$SUBMODULE_LDFLAGS -O2"
 fi
 
 case "$ARCH" in
@@ -7292,7 +7303,8 @@ echo "RANLIB=$ranlib" >> $config_host_mak
 echo "NM=$nm" >> $config_host_mak
 echo "PKG_CONFIG=$pkg_config_exe" >> $config_host_mak
 echo "WINDRES=$windres" >> $config_host_mak
-echo "CFLAGS=$CFLAGS" >> $config_host_mak
+echo "SUBMODULE_CFLAGS=$CFLAGS \$(QEMU_CFLAGS) $SUBMODULE_CFLAGS" >> $config_host_mak
+echo "SUBMODULE_LDFLAGS=$LDFLAGS \$(QEMU_LDFLAGS) $SUBMODULE_LDFLAGS" >> $config_host_mak
 echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak
 echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
 echo "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak
diff --git a/meson.build b/meson.build
index 9aeefa60fb..cb0113ee90 100644
--- a/meson.build
+++ b/meson.build
@@ -1471,7 +1471,8 @@ if targetos == 'darwin'
   summary_info += {'Objective-C compiler': meson.get_compiler('objc').cmd_array()[0]}
 endif
 summary_info += {'ARFLAGS':           config_host['ARFLAGS']}
-summary_info += {'CFLAGS':            config_host['CFLAGS']}
+summary_info += {'CFLAGS':            '-O' + get_option('optimization')
+                                           + (get_option('debug') ? ' -g' : '')}
 summary_info += {'QEMU_CFLAGS':       config_host['QEMU_CFLAGS']}
 summary_info += {'QEMU_LDFLAGS':      config_host['QEMU_LDFLAGS']}
 summary_info += {'make':              config_host['MAKE']}
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 61/92] configure: do not clobber environment CFLAGS/CXXFLAGS/LDFLAGS
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (59 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 60/92] configure: cleanup CFLAGS and LDFLAGS for submodules Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 62/92] configure: consistently pass CFLAGS/CXXFLAGS/LDFLAGS to meson Paolo Bonzini
                   ` (32 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Richard Henderson

If the CFLAGS, CXXFLAGS or LDFLAGS variables are present in the environment,
any modification made within the configure script is passed down to Meson.
This is particularly undesirable for the "-pie" option, since it overrides
"-shared" and thus messes up the linker flags for shared modules.

Using a separate variable therefore fixes the bug, while clarifying that
the scope of these CFLAGS is just the configure script.

Reported-by: Frederic Bezies
Analyzed-by: Toolybird
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/configure b/configure
index 9b7232f9d2..a0575f1db1 100755
--- a/configure
+++ b/configure
@@ -155,7 +155,7 @@ update_cxxflags() {
     # options which some versions of GCC's C++ compiler complain about
     # because they only make sense for C programs.
     QEMU_CXXFLAGS="$QEMU_CXXFLAGS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS"
-    CXXFLAGS=$(echo "$CFLAGS" | sed s/-std=gnu99/-std=gnu++11/)
+    CONFIGURE_CXXFLAGS=$(echo "$CONFIGURE_CFLAGS" | sed s/-std=gnu99/-std=gnu++11/)
     for arg in $QEMU_CFLAGS; do
         case $arg in
             -Wstrict-prototypes|-Wmissing-prototypes|-Wnested-externs|\
@@ -170,13 +170,14 @@ update_cxxflags() {
 
 compile_object() {
   local_cflags="$1"
-  do_cc $CFLAGS $QEMU_CFLAGS $local_cflags -c -o $TMPO $TMPC
+  do_cc $CFLAGS $CONFIGURE_CFLAGS $QEMU_CFLAGS $local_cflags -c -o $TMPO $TMPC
 }
 
 compile_prog() {
   local_cflags="$1"
   local_ldflags="$2"
-  do_cc $CFLAGS $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $QEMU_LDFLAGS $local_ldflags
+  do_cc $CFLAGS $CONFIGURE_CFLAGS $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC \
+      $LDFLAGS $CONFIGURE_LDFLAGS $QEMU_LDFLAGS $local_ldflags
 }
 
 # symbolically link $1 to $2.  Portable version of "ln -sf".
@@ -639,7 +640,10 @@ QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
 QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
 QEMU_INCLUDES="-iquote . -iquote ${source_path} -iquote ${source_path}/accel/tcg -iquote ${source_path}/include"
 QEMU_INCLUDES="$QEMU_INCLUDES -iquote ${source_path}/disas/libvixl"
-CFLAGS="-std=gnu99 -Wall"
+
+# Flags that are needed during configure but later taken care of by Meson
+CONFIGURE_CFLAGS="-std=gnu99 -Wall"
+CONFIGURE_LDFLAGS=
 
 
 check_define() {
@@ -967,7 +971,7 @@ if test "$mingw32" = "yes" ; then
   EXESUF=".exe"
   HOST_DSOSUF=".dll"
   # MinGW needs -mthreads for TLS and macro _MT.
-  CFLAGS="-mthreads $CFLAGS"
+  CONFIGURE_CFLAGS="-mthreads $CONFIGURE_CFLAGS"
   write_c_skeleton;
   prefix="/qemu"
   qemu_suffix=""
@@ -2234,7 +2238,7 @@ fi
 
 if test "$static" = "yes"; then
   if test "$pie" != "no" && compile_prog "-Werror -fPIE -DPIE" "-static-pie"; then
-    CFLAGS="-fPIE -DPIE $CFLAGS"
+    CONFIGURE_CFLAGS="-fPIE -DPIE $CONFIGURE_CFLAGS"
     QEMU_LDFLAGS="-static-pie $QEMU_LDFLAGS"
     pie="yes"
   elif test "$pie" = "yes"; then
@@ -2244,11 +2248,11 @@ if test "$static" = "yes"; then
     pie="no"
   fi
 elif test "$pie" = "no"; then
-  CFLAGS="$CFLAGS_NOPIE $CFLAGS"
-  LDFLAGS="$LDFLAGS_NOPIE $LDFLAGS"
+  CONFIGURE_CFLAGS="$CFLAGS_NOPIE $CONFIGURE_CFLAGS"
+  CONFIGURE_LDFLAGS="$LDFLAGS_NOPIE $CONFIGURE_LDFLAGS"
 elif compile_prog "-Werror -fPIE -DPIE" "-pie"; then
-  CFLAGS="-fPIE -DPIE $CFLAGS"
-  LDFLAGS="-pie $LDFLAGS"
+  CONFIGURE_CFLAGS="-fPIE -DPIE $CONFIGURE_CFLAGS"
+  CONFIGURE_LDFLAGS="-pie $CONFIGURE_LDFLAGS"
   pie="yes"
 elif test "$pie" = "yes"; then
   error_exit "PIE not available due to missing toolchain support"
@@ -3812,7 +3816,7 @@ EOF
 if ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then
     if cc_has_warning_flag "-Wno-unknown-attributes"; then
         glib_cflags="-Wno-unknown-attributes $glib_cflags"
-        CFLAGS="-Wno-unknown-attributes $CFLAGS"
+        CONFIGURE_CFLAGS="-Wno-unknown-attributes $CONFIGURE_CFLAGS"
     fi
 fi
 
@@ -3832,7 +3836,7 @@ EOF
 if ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then
     if cc_has_warning_flag "-Wno-unused-function"; then
         glib_cflags="$glib_cflags -Wno-unused-function"
-        CFLAGS="$CFLAGS -Wno-unused-function"
+        CONFIGURE_CFLAGS="$CONFIGURE_CFLAGS -Wno-unused-function"
     fi
 fi
 
@@ -6370,7 +6374,7 @@ EOF
 
     update_cxxflags
 
-    if do_cxx $CXXFLAGS $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $QEMU_LDFLAGS; then
+    if do_cxx $CXXFLAGS $CONFIGURE_CXXFLAGS $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $QEMU_LDFLAGS; then
         # C++ compiler $cxx works ok with C compiler $cc
         :
     else
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 62/92] configure: consistently pass CFLAGS/CXXFLAGS/LDFLAGS to meson
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (60 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 61/92] configure: do not clobber environment CFLAGS/CXXFLAGS/LDFLAGS Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 63/92] smp: drop support for deprecated (invalid topologies) Paolo Bonzini
                   ` (31 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Richard Henderson

Environment variables like CFLAGS are easy to accidentally change.  Meson
warns if that happens, but in a project with a lot of configuration that
is easy to lose.  It is also surprising behavior since meson caches -D
options and remembers those on reconfiguration (which we rely on,
since configure options become -D options).

By placing the user-provided CFLAGS, CXXFLAGS and LDFLAGS in the
cross file, we at least get consistent behavior.  These environment
variables are still ugly and not really recommended, but there are
distros that rely on them.  For the gory details, refer to
https://github.com/mesonbuild/meson/issues/4664.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure   | 25 +++++++++++++++----------
 meson.build | 14 ++++++++++++--
 2 files changed, 27 insertions(+), 12 deletions(-)

diff --git a/configure b/configure
index a0575f1db1..1129ddb8a1 100755
--- a/configure
+++ b/configure
@@ -7798,24 +7798,29 @@ echo "export PYTHON='$python'" >> "$iotests_common_env"
 if test "$skip_meson" = no; then
 cross="config-meson.cross.new"
 meson_quote() {
-    echo "['$(echo $* | sed "s/ /','/g")']"
+    echo "'$(echo $* | sed "s/ /','/g")'"
 }
 
 echo "# Automatically generated by configure - do not modify" > $cross
 echo "[properties]" >> $cross
 test -z "$cxx" && echo "link_language = 'c'" >> $cross
+echo "[built-in options]" >> $cross
+echo "c_args = [${CFLAGS:+$(meson_quote $CFLAGS)}]" >> $cross
+echo "cpp_args = [${CXXFLAGS:+$(meson_quote $CXXFLAGS)}]" >> $cross
+echo "c_link_args = [${LDFLAGS:+$(meson_quote $LDFLAGS)}]" >> $cross
+echo "cpp_link_args = [${LDFLAGS:+$(meson_quote $LDFLAGS)}]" >> $cross
 echo "[binaries]" >> $cross
-echo "c = $(meson_quote $cc)" >> $cross
-test -n "$cxx" && echo "cpp = $(meson_quote $cxx)" >> $cross
-echo "ar = $(meson_quote $ar)" >> $cross
-echo "nm = $(meson_quote $nm)" >> $cross
-echo "pkgconfig = $(meson_quote $pkg_config_exe)" >> $cross
-echo "ranlib = $(meson_quote $ranlib)" >> $cross
+echo "c = [$(meson_quote $cc)]" >> $cross
+test -n "$cxx" && echo "cpp = [$(meson_quote $cxx)]" >> $cross
+echo "ar = [$(meson_quote $ar)]" >> $cross
+echo "nm = [$(meson_quote $nm)]" >> $cross
+echo "pkgconfig = [$(meson_quote $pkg_config_exe)]" >> $cross
+echo "ranlib = [$(meson_quote $ranlib)]" >> $cross
 if has $sdl2_config; then
-  echo "sdl2-config = $(meson_quote $sdl2_config)" >> $cross
+  echo "sdl2-config = [$(meson_quote $sdl2_config)]" >> $cross
 fi
-echo "strip = $(meson_quote $strip)" >> $cross
-echo "windres = $(meson_quote $windres)" >> $cross
+echo "strip = [$(meson_quote $strip)]" >> $cross
+echo "windres = [$(meson_quote $windres)]" >> $cross
 if test -n "$cross_prefix"; then
     cross_arg="--cross-file config-meson.cross"
     echo "[host_machine]" >> $cross
diff --git a/meson.build b/meson.build
index cb0113ee90..4c73f4093a 100644
--- a/meson.build
+++ b/meson.build
@@ -1471,8 +1471,18 @@ if targetos == 'darwin'
   summary_info += {'Objective-C compiler': meson.get_compiler('objc').cmd_array()[0]}
 endif
 summary_info += {'ARFLAGS':           config_host['ARFLAGS']}
-summary_info += {'CFLAGS':            '-O' + get_option('optimization')
-                                           + (get_option('debug') ? ' -g' : '')}
+summary_info += {'CFLAGS':            ' '.join(get_option('c_args')
+                                               + ['-O' + get_option('optimization')]
+                                               + (get_option('debug') ? ['-g'] : []))}
+if link_language == 'cpp'
+  summary_info += {'CXXFLAGS':        ' '.join(get_option('cpp_args')
+                                               + ['-O' + get_option('optimization')]
+                                               + (get_option('debug') ? ['-g'] : []))}
+endif
+link_args = get_option(link_language + '_link_args')
+if link_args.length() > 0
+  summary_info += {'LDFLAGS':         ' '.join(link_args)}
+endif
 summary_info += {'QEMU_CFLAGS':       config_host['QEMU_CFLAGS']}
 summary_info += {'QEMU_LDFLAGS':      config_host['QEMU_LDFLAGS']}
 summary_info += {'make':              config_host['MAKE']}
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 63/92] smp: drop support for deprecated (invalid topologies)
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (61 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 62/92] configure: consistently pass CFLAGS/CXXFLAGS/LDFLAGS to meson Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 64/92] cphp: remove deprecated cpu-add command(s) Paolo Bonzini
                   ` (30 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Igor Mammedov

From: Igor Mammedov <imammedo@redhat.com>

it's was deprecated since 3.1

Support for invalid topologies is removed, the user must ensure
that topologies described with -smp include all possible cpus,
i.e. (sockets * cores * threads) == maxcpus or QEMU will
exit with error.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Acked-by:
Message-Id: <20200911133202.938754-1-imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 docs/system/deprecated.rst | 26 +++++++++++++-------------
 hw/core/machine.c          | 16 ++++------------
 hw/i386/pc.c               | 16 ++++------------
 3 files changed, 21 insertions(+), 37 deletions(-)

diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst
index e78d03038f..17703d18fd 100644
--- a/docs/system/deprecated.rst
+++ b/docs/system/deprecated.rst
@@ -47,19 +47,6 @@ The 'file' driver for drives is no longer appropriate for character or host
 devices and will only accept regular files (S_IFREG). The correct driver
 for these file types is 'host_cdrom' or 'host_device' as appropriate.
 
-``-smp`` (invalid topologies) (since 3.1)
-'''''''''''''''''''''''''''''''''''''''''
-
-CPU topology properties should describe whole machine topology including
-possible CPUs.
-
-However, historically it was possible to start QEMU with an incorrect topology
-where *n* <= *sockets* * *cores* * *threads* < *maxcpus*,
-which could lead to an incorrect topology enumeration by the guest.
-Support for invalid topologies will be removed, the user must ensure
-topologies described with -smp include all possible cpus, i.e.
-*sockets* * *cores* * *threads* = *maxcpus*.
-
 ``-vnc acl`` (since 4.0.0)
 ''''''''''''''''''''''''''
 
@@ -646,6 +633,19 @@ as ignored. Currently, users are responsible for making sure the backing storage
 specified with ``-mem-path`` can actually provide the guest RAM configured with
 ``-m`` and QEMU fails to start up if RAM allocation is unsuccessful.
 
+``-smp`` (invalid topologies) (removed 5.2)
+'''''''''''''''''''''''''''''''''''''''''''
+
+CPU topology properties should describe whole machine topology including
+possible CPUs.
+
+However, historically it was possible to start QEMU with an incorrect topology
+where *n* <= *sockets* * *cores* * *threads* < *maxcpus*,
+which could lead to an incorrect topology enumeration by the guest.
+Support for invalid topologies is removed, the user must ensure
+topologies described with -smp include all possible cpus, i.e.
+*sockets* * *cores* * *threads* = *maxcpus*.
+
 Block devices
 -------------
 
diff --git a/hw/core/machine.c b/hw/core/machine.c
index f70d388e86..d25149685e 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -754,23 +754,15 @@ static void smp_parse(MachineState *ms, QemuOpts *opts)
             exit(1);
         }
 
-        if (sockets * cores * threads > ms->smp.max_cpus) {
-            error_report("cpu topology: "
-                         "sockets (%u) * cores (%u) * threads (%u) > "
-                         "maxcpus (%u)",
+        if (sockets * cores * threads != ms->smp.max_cpus) {
+            error_report("Invalid CPU topology: "
+                         "sockets (%u) * cores (%u) * threads (%u) "
+                         "!= maxcpus (%u)",
                          sockets, cores, threads,
                          ms->smp.max_cpus);
             exit(1);
         }
 
-        if (sockets * cores * threads != ms->smp.max_cpus) {
-            warn_report("Invalid CPU topology deprecated: "
-                        "sockets (%u) * cores (%u) * threads (%u) "
-                        "!= maxcpus (%u)",
-                        sockets, cores, threads,
-                        ms->smp.max_cpus);
-        }
-
         ms->smp.cpus = cpus;
         ms->smp.cores = cores;
         ms->smp.threads = threads;
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index b55369357e..1e2ab5ebe7 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -746,23 +746,15 @@ void pc_smp_parse(MachineState *ms, QemuOpts *opts)
             exit(1);
         }
 
-        if (sockets * dies * cores * threads > ms->smp.max_cpus) {
-            error_report("cpu topology: "
-                         "sockets (%u) * dies (%u) * cores (%u) * threads (%u) > "
-                         "maxcpus (%u)",
+        if (sockets * dies * cores * threads != ms->smp.max_cpus) {
+            error_report("Invalid CPU topology deprecated: "
+                         "sockets (%u) * dies (%u) * cores (%u) * threads (%u) "
+                         "!= maxcpus (%u)",
                          sockets, dies, cores, threads,
                          ms->smp.max_cpus);
             exit(1);
         }
 
-        if (sockets * dies * cores * threads != ms->smp.max_cpus) {
-            warn_report("Invalid CPU topology deprecated: "
-                        "sockets (%u) * dies (%u) * cores (%u) * threads (%u) "
-                        "!= maxcpus (%u)",
-                        sockets, dies, cores, threads,
-                        ms->smp.max_cpus);
-        }
-
         ms->smp.cpus = cpus;
         ms->smp.cores = cores;
         ms->smp.threads = threads;
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 64/92] cphp: remove deprecated cpu-add command(s)
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (62 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 63/92] smp: drop support for deprecated (invalid topologies) Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 65/92] char: fix logging when chardev write fails Paolo Bonzini
                   ` (29 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel
  Cc: Igor Mammedov, Thomas Huth, Cornelia Huck,
	Dr . David Alan Gilbert, Michal Privoznik

From: Igor Mammedov <imammedo@redhat.com>

These were deprecated since 4.0, remove both HMP and QMP variants.

Users should use device_add command instead. To get list of
possible CPUs and options, use 'info hotpluggable-cpus' HMP
or query-hotpluggable-cpus QMP command.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Acked-by: Cornelia Huck <cohuck@redhat.com>
Message-Id: <20200915120403.1074579-1-imammedo@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 docs/system/deprecated.rst  |  25 +++++----
 hmp-commands.hx             |  15 ------
 hw/core/machine-hmp-cmds.c  |  12 -----
 hw/core/machine-qmp-cmds.c  |  12 -----
 hw/i386/pc.c                |  27 ----------
 hw/i386/pc_piix.c           |   1 -
 hw/s390x/s390-virtio-ccw.c  |  12 -----
 include/hw/boards.h         |   1 -
 include/hw/i386/pc.h        |   1 -
 include/monitor/hmp.h       |   1 -
 qapi/machine.json           |  24 ---------
 tests/qtest/cpu-plug-test.c | 100 ++++--------------------------------
 tests/qtest/test-hmp.c      |   1 -
 13 files changed, 21 insertions(+), 211 deletions(-)

diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst
index 17703d18fd..2bede67b04 100644
--- a/docs/system/deprecated.rst
+++ b/docs/system/deprecated.rst
@@ -251,13 +251,6 @@ The ``query-cpus`` command is replaced by the ``query-cpus-fast`` command.
 The ``arch`` output member of the ``query-cpus-fast`` command is
 replaced by the ``target`` output member.
 
-``cpu-add`` (since 4.0)
-'''''''''''''''''''''''
-
-Use ``device_add`` for hotplugging vCPUs instead of ``cpu-add``.  See
-documentation of ``query-hotpluggable-cpus`` for additional
-details.
-
 ``query-events`` (since 4.0)
 ''''''''''''''''''''''''''''
 
@@ -273,12 +266,6 @@ the 'wait' field, which is only applicable to sockets in server mode
 Human Monitor Protocol (HMP) commands
 -------------------------------------
 
-``cpu-add`` (since 4.0)
-'''''''''''''''''''''''
-
-Use ``device_add`` for hotplugging vCPUs instead of ``cpu-add``.  See
-documentation of ``query-hotpluggable-cpus`` for additional details.
-
 ``acl_show``, ``acl_reset``, ``acl_policy``, ``acl_add``, ``acl_remove`` (since 4.0.0)
 ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 
@@ -496,6 +483,12 @@ QEMU Machine Protocol (QMP) commands
 The "autoload" parameter has been ignored since 2.12.0. All bitmaps
 are automatically loaded from qcow2 images.
 
+``cpu-add`` (removed in 5.2)
+''''''''''''''''''''''''''''
+
+Use ``device_add`` for hotplugging vCPUs instead of ``cpu-add``.  See
+documentation of ``query-hotpluggable-cpus`` for additional details.
+
 Human Monitor Protocol (HMP) commands
 -------------------------------------
 
@@ -505,6 +498,12 @@ The ``hub_id`` parameter of ``hostfwd_add`` / ``hostfwd_remove`` (removed in 5.0
 The ``[hub_id name]`` parameter tuple of the 'hostfwd_add' and
 'hostfwd_remove' HMP commands has been replaced by ``netdev_id``.
 
+``cpu-add`` (removed in 5.2)
+''''''''''''''''''''''''''''
+
+Use ``device_add`` for hotplugging vCPUs instead of ``cpu-add``.  See
+documentation of ``query-hotpluggable-cpus`` for additional details.
+
 Guest Emulator ISAs
 -------------------
 
diff --git a/hmp-commands.hx b/hmp-commands.hx
index 27c4bbe0f2..1088d64503 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -1761,21 +1761,6 @@ SRST
   Executes a qemu-io command on the given block device.
 ERST
 
-    {
-        .name       = "cpu-add",
-        .args_type  = "id:i",
-        .params     = "id",
-        .help       = "add cpu (deprecated, use device_add instead)",
-        .cmd        = hmp_cpu_add,
-    },
-
-SRST
-``cpu-add`` *id*
-  Add CPU with id *id*.  This command is deprecated, please
-  +use ``device_add`` instead. For details, refer to
-  'docs/cpu-hotplug.rst'.
-ERST
-
     {
         .name       = "qom-list",
         .args_type  = "path:s?",
diff --git a/hw/core/machine-hmp-cmds.c b/hw/core/machine-hmp-cmds.c
index 39999c47c5..f4092b98cc 100644
--- a/hw/core/machine-hmp-cmds.c
+++ b/hw/core/machine-hmp-cmds.c
@@ -46,18 +46,6 @@ void hmp_info_cpus(Monitor *mon, const QDict *qdict)
     qapi_free_CpuInfoFastList(cpu_list);
 }
 
-void hmp_cpu_add(Monitor *mon, const QDict *qdict)
-{
-    int cpuid;
-    Error *err = NULL;
-
-    error_report("cpu_add is deprecated, please use device_add instead");
-
-    cpuid = qdict_get_int(qdict, "id");
-    qmp_cpu_add(cpuid, &err);
-    hmp_handle_error(mon, err);
-}
-
 void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict)
 {
     Error *err = NULL;
diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c
index 21551221ad..5362c80a18 100644
--- a/hw/core/machine-qmp-cmds.c
+++ b/hw/core/machine-qmp-cmds.c
@@ -284,18 +284,6 @@ HotpluggableCPUList *qmp_query_hotpluggable_cpus(Error **errp)
     return machine_query_hotpluggable_cpus(ms);
 }
 
-void qmp_cpu_add(int64_t id, Error **errp)
-{
-    MachineClass *mc;
-
-    mc = MACHINE_GET_CLASS(current_machine);
-    if (mc->hot_add_cpu) {
-        mc->hot_add_cpu(current_machine, id, errp);
-    } else {
-        error_setg(errp, "Not supported");
-    }
-}
-
 void qmp_set_numa_node(NumaOptions *cmd, Error **errp)
 {
     if (!runstate_check(RUN_STATE_PRECONFIG)) {
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 1e2ab5ebe7..50e8317342 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -769,32 +769,6 @@ void pc_smp_parse(MachineState *ms, QemuOpts *opts)
     }
 }
 
-void pc_hot_add_cpu(MachineState *ms, const int64_t id, Error **errp)
-{
-    X86MachineState *x86ms = X86_MACHINE(ms);
-    int64_t apic_id = x86_cpu_apic_id_from_index(x86ms, id);
-    Error *local_err = NULL;
-
-    if (id < 0) {
-        error_setg(errp, "Invalid CPU id: %" PRIi64, id);
-        return;
-    }
-
-    if (apic_id >= ACPI_CPU_HOTPLUG_ID_LIMIT) {
-        error_setg(errp, "Unable to add CPU: %" PRIi64
-                   ", resulting APIC ID (%" PRIi64 ") is too large",
-                   id, apic_id);
-        return;
-    }
-
-
-    x86_cpu_new(X86_MACHINE(ms), apic_id, &local_err);
-    if (local_err) {
-        error_propagate(errp, local_err);
-        return;
-    }
-}
-
 static
 void pc_machine_done(Notifier *notifier, void *data)
 {
@@ -1691,7 +1665,6 @@ static void pc_machine_class_init(ObjectClass *oc, void *data)
     mc->auto_enable_numa_with_memdev = true;
     mc->has_hotpluggable_cpus = true;
     mc->default_boot_order = "cad";
-    mc->hot_add_cpu = pc_hot_add_cpu;
     mc->smp_parse = pc_smp_parse;
     mc->block_default_type = IF_IDE;
     mc->max_cpus = 255;
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index c6057905fa..32c5d95762 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -751,7 +751,6 @@ static void pc_i440fx_1_4_machine_options(MachineClass *m)
 {
     pc_i440fx_1_5_machine_options(m);
     m->hw_version = "1.4.0";
-    m->hot_add_cpu = NULL;
     compat_props_add(m->compat_props, pc_compat_1_4, pc_compat_1_4_len);
 }
 
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index 3106bbea33..28266a3a35 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -553,17 +553,6 @@ static HotplugHandler *s390_get_hotplug_handler(MachineState *machine,
     return NULL;
 }
 
-static void s390_hot_add_cpu(MachineState *machine,
-                             const int64_t id, Error **errp)
-{
-    ObjectClass *oc;
-
-    g_assert(machine->possible_cpus->cpus[0].cpu);
-    oc = OBJECT_CLASS(CPU_GET_CLASS(machine->possible_cpus->cpus[0].cpu));
-
-    s390x_new_cpu(object_class_get_name(oc), id, errp);
-}
-
 static void s390_nmi(NMIState *n, int cpu_index, Error **errp)
 {
     CPUState *cs = qemu_get_cpu(cpu_index);
@@ -604,7 +593,6 @@ static void ccw_machine_class_init(ObjectClass *oc, void *data)
     s390mc->hpage_1m_allowed = true;
     mc->init = ccw_init;
     mc->reset = s390_machine_reset;
-    mc->hot_add_cpu = s390_hot_add_cpu;
     mc->block_default_type = IF_VIRTIO;
     mc->no_cdrom = 1;
     mc->no_floppy = 1;
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 777621fb30..bf53e8a16e 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -168,7 +168,6 @@ struct MachineClass {
     void (*init)(MachineState *state);
     void (*reset)(MachineState *state);
     void (*wakeup)(MachineState *state);
-    void (*hot_add_cpu)(MachineState *state, const int64_t id, Error **errp);
     int (*kvm_type)(MachineState *machine, const char *arg);
     void (*smp_parse)(MachineState *ms, QemuOpts *opts);
 
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index b2da2c8d2b..c71b02cafd 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -132,7 +132,6 @@ extern int fd_bootchk;
 
 void pc_acpi_smi_interrupt(void *opaque, int irq, int level);
 
-void pc_hot_add_cpu(MachineState *ms, const int64_t id, Error **errp);
 void pc_smp_parse(MachineState *ms, QemuOpts *opts);
 
 void pc_guest_info_init(PCMachineState *pcms);
diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
index c986cfd28b..642e9e91f9 100644
--- a/include/monitor/hmp.h
+++ b/include/monitor/hmp.h
@@ -89,7 +89,6 @@ void hmp_chardev_add(Monitor *mon, const QDict *qdict);
 void hmp_chardev_change(Monitor *mon, const QDict *qdict);
 void hmp_chardev_remove(Monitor *mon, const QDict *qdict);
 void hmp_chardev_send_break(Monitor *mon, const QDict *qdict);
-void hmp_cpu_add(Monitor *mon, const QDict *qdict);
 void hmp_object_add(Monitor *mon, const QDict *qdict);
 void hmp_object_del(Monitor *mon, const QDict *qdict);
 void hmp_info_memdev(Monitor *mon, const QDict *qdict);
diff --git a/qapi/machine.json b/qapi/machine.json
index 0ac1880e4a..d8ed096e9a 100644
--- a/qapi/machine.json
+++ b/qapi/machine.json
@@ -307,30 +307,6 @@
 ##
 { 'command': 'query-cpus-fast', 'returns': [ 'CpuInfoFast' ] }
 
-##
-# @cpu-add:
-#
-# Adds CPU with specified ID.
-#
-# @id: ID of CPU to be created, valid values [0..max_cpus)
-#
-# Features:
-# @deprecated: This command is deprecated.  Use `device_add` instead.
-#              See the `query-hotpluggable-cpus` command for details.
-#
-# Returns: Nothing on success
-#
-# Since: 1.5
-#
-# Example:
-#
-# -> { "execute": "cpu-add", "arguments": { "id": 2 } }
-# <- { "return": {} }
-#
-##
-{ 'command': 'cpu-add', 'data': {'id': 'int'},
-  'features': [ 'deprecated' ] }
-
 ##
 # @MachineInfo:
 #
diff --git a/tests/qtest/cpu-plug-test.c b/tests/qtest/cpu-plug-test.c
index e8ffbbce4b..a1c689414b 100644
--- a/tests/qtest/cpu-plug-test.c
+++ b/tests/qtest/cpu-plug-test.c
@@ -25,54 +25,6 @@ struct PlugTestData {
 };
 typedef struct PlugTestData PlugTestData;
 
-static void test_plug_with_cpu_add(gconstpointer data)
-{
-    const PlugTestData *s = data;
-    char *args;
-    QDict *response;
-    unsigned int i;
-
-    args = g_strdup_printf("-machine %s -cpu %s "
-                           "-smp 1,sockets=%u,cores=%u,threads=%u,maxcpus=%u",
-                           s->machine, s->cpu_model,
-                           s->sockets, s->cores, s->threads, s->maxcpus);
-    qtest_start(args);
-
-    for (i = 1; i < s->maxcpus; i++) {
-        response = qmp("{ 'execute': 'cpu-add',"
-                       "  'arguments': { 'id': %d } }", i);
-        g_assert(response);
-        g_assert(!qdict_haskey(response, "error"));
-        qobject_unref(response);
-    }
-
-    qtest_end();
-    g_free(args);
-}
-
-static void test_plug_without_cpu_add(gconstpointer data)
-{
-    const PlugTestData *s = data;
-    char *args;
-    QDict *response;
-
-    args = g_strdup_printf("-machine %s -cpu %s "
-                           "-smp 1,sockets=%u,cores=%u,threads=%u,maxcpus=%u",
-                           s->machine, s->cpu_model,
-                           s->sockets, s->cores, s->threads, s->maxcpus);
-    qtest_start(args);
-
-    response = qmp("{ 'execute': 'cpu-add',"
-                   "  'arguments': { 'id': %d } }",
-                   s->sockets * s->cores * s->threads);
-    g_assert(response);
-    g_assert(qdict_haskey(response, "error"));
-    qobject_unref(response);
-
-    qtest_end();
-    g_free(args);
-}
-
 static void test_plug_with_device_add(gconstpointer data)
 {
     const PlugTestData *td = data;
@@ -144,36 +96,13 @@ static void add_pc_test_case(const char *mname)
     data->cores = 3;
     data->threads = 2;
     data->maxcpus = data->sockets * data->cores * data->threads;
-    if (g_str_has_suffix(mname, "-1.4") ||
-        (strcmp(mname, "pc-1.3") == 0) ||
-        (strcmp(mname, "pc-1.2") == 0) ||
-        (strcmp(mname, "pc-1.1") == 0) ||
-        (strcmp(mname, "pc-1.0") == 0)) {
-        path = g_strdup_printf("cpu-plug/%s/init/%ux%ux%u&maxcpus=%u",
-                               mname, data->sockets, data->cores,
-                               data->threads, data->maxcpus);
-        qtest_add_data_func_full(path, data, test_plug_without_cpu_add,
-                                 test_data_free);
-        g_free(path);
-    } else {
-        PlugTestData *data2 = g_memdup(data, sizeof(PlugTestData));
-
-        data2->machine = g_strdup(data->machine);
-        data2->device_model = g_strdup(data->device_model);
 
-        path = g_strdup_printf("cpu-plug/%s/cpu-add/%ux%ux%u&maxcpus=%u",
-                               mname, data->sockets, data->cores,
-                               data->threads, data->maxcpus);
-        qtest_add_data_func_full(path, data, test_plug_with_cpu_add,
-                                 test_data_free);
-        g_free(path);
-        path = g_strdup_printf("cpu-plug/%s/device-add/%ux%ux%u&maxcpus=%u",
-                               mname, data2->sockets, data2->cores,
-                               data2->threads, data2->maxcpus);
-        qtest_add_data_func_full(path, data2, test_plug_with_device_add,
-                                 test_data_free);
-        g_free(path);
-    }
+    path = g_strdup_printf("cpu-plug/%s/device-add/%ux%ux%u&maxcpus=%u",
+                           mname, data->sockets, data->cores,
+                           data->threads, data->maxcpus);
+    qtest_add_data_func_full(path, data, test_plug_with_device_add,
+                             test_data_free);
+    g_free(path);
 }
 
 static void add_pseries_test_case(const char *mname)
@@ -205,7 +134,7 @@ static void add_pseries_test_case(const char *mname)
 static void add_s390x_test_case(const char *mname)
 {
     char *path;
-    PlugTestData *data, *data2;
+    PlugTestData *data;
 
     if (!g_str_has_prefix(mname, "s390-ccw-virtio-")) {
         return;
@@ -220,21 +149,10 @@ static void add_s390x_test_case(const char *mname)
     data->threads = 1;
     data->maxcpus = data->sockets * data->cores * data->threads;
 
-    data2 = g_memdup(data, sizeof(PlugTestData));
-    data2->machine = g_strdup(data->machine);
-    data2->device_model = g_strdup(data->device_model);
-
-    path = g_strdup_printf("cpu-plug/%s/cpu-add/%ux%ux%u&maxcpus=%u",
+    path = g_strdup_printf("cpu-plug/%s/device-add/%ux%ux%u&maxcpus=%u",
                            mname, data->sockets, data->cores,
                            data->threads, data->maxcpus);
-    qtest_add_data_func_full(path, data, test_plug_with_cpu_add,
-                             test_data_free);
-    g_free(path);
-
-    path = g_strdup_printf("cpu-plug/%s/device-add/%ux%ux%u&maxcpus=%u",
-                           mname, data2->sockets, data2->cores,
-                           data2->threads, data2->maxcpus);
-    qtest_add_data_func_full(path, data2, test_plug_with_device_add,
+    qtest_add_data_func_full(path, data, test_plug_with_device_add,
                              test_data_free);
     g_free(path);
 }
diff --git a/tests/qtest/test-hmp.c b/tests/qtest/test-hmp.c
index aea1384bac..94a8023173 100644
--- a/tests/qtest/test-hmp.c
+++ b/tests/qtest/test-hmp.c
@@ -27,7 +27,6 @@ static const char *hmp_cmds[] = {
     "chardev-change testchardev1 ringbuf",
     "chardev-remove testchardev1",
     "commit all",
-    "cpu-add 1",
     "cpu 0",
     "device_add ?",
     "device_add usb-mouse,id=mouse1",
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 65/92] char: fix logging when chardev write fails
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (63 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 64/92] cphp: remove deprecated cpu-add command(s) Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 66/92] qom: Document all function parameters in doc comments Paolo Bonzini
                   ` (28 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Marc-André Lureau, Daniel P. Berrangé

From: Daniel P. Berrangé <berrange@redhat.com>

The qemu_chr_write_buffer() method sends data to the chardev backend for
writing, and then also writes to the log file. In case the chardev
backend only writes part of the data buffer, we need to make sure we
only log the same subset. qemu_chr_write_buffer() will be invoked again
later to write the rest of the buffer.

In the case the chardev backend returns an error though, no further
attempts to likely to be made to write the data. We must therefore write
the entire buffer to the log immediately.

An example where this is important is with the socket backend. This will
return -1 for all writes if no client is currently connected. We still
wish to write data to the log file when no client is present though.
This used to work because the chardev would return "len" to pretend it
had written all data when no client is connected, but this changed to
return an error in

  commit 271094474b65de1ad7aaf729938de3d9b9d0d36f
  Author: Dima Stepanov <dimastep@yandex-team.ru>
  Date: Thu May 28 12:11:18 2020 +0300

    char-socket: return -1 in case of disconnect during tcp_chr_write

and this broke the logging, resulting in all data being discarded when
no client is present.

Fixes: https://bugs.launchpad.net/qemu/+bug/1893691
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 chardev/char.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/chardev/char.c b/chardev/char.c
index 6b85099c03..78553125d3 100644
--- a/chardev/char.c
+++ b/chardev/char.c
@@ -138,7 +138,20 @@ static int qemu_chr_write_buffer(Chardev *s,
         }
     }
     if (*offset > 0) {
+        /*
+         * If some data was written by backend, we should
+         * only log what was actually written. This method
+         * may be invoked again to write the remaining
+         * method, thus we'll log the remainder at that time.
+         */
         qemu_chr_write_log(s, buf, *offset);
+    } else if (res < 0) {
+        /*
+         * If a fatal error was reported by the backend,
+         * assume this method won't be invoked again with
+         * this buffer, so log it all right away.
+         */
+        qemu_chr_write_log(s, buf, len);
     }
     qemu_mutex_unlock(&s->chr_write_lock);
 
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 66/92] qom: Document all function parameters in doc comments
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (64 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 65/92] char: fix logging when chardev write fails Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 67/92] qom: Use kernel-doc private/public tags in structs Paolo Bonzini
                   ` (27 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Eduardo Habkost

From: Eduardo Habkost <ehabkost@redhat.com>

kernel-doc requires all function parameters to be documented, so
document them all.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20200910221526.10041-2-ehabkost@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/qom/object.h | 47 ++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 45 insertions(+), 2 deletions(-)

diff --git a/include/qom/object.h b/include/qom/object.h
index 19cccd3f5f..fe0c9b7735 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -1179,6 +1179,11 @@ Object *object_dynamic_cast(Object *obj, const char *typename);
 
 /**
  * object_dynamic_cast_assert:
+ * @obj: The object to cast.
+ * @typename: The @typename to cast to.
+ * @file: Source code file where function was called
+ * @line: Source code line where function was called
+ * @func: Name of function where this function was called
  *
  * See object_dynamic_cast() for a description of the parameters of this
  * function.  The only difference in behavior is that this function asserts
@@ -1255,6 +1260,9 @@ type_init(do_qemu_init_ ## type_array)
  * object_class_dynamic_cast_assert:
  * @klass: The #ObjectClass to attempt to cast.
  * @typename: The QOM typename of the class to cast to.
+ * @file: Source code file where function was called
+ * @line: Source code line where function was called
+ * @func: Name of function where this function was called
  *
  * See object_class_dynamic_cast() for a description of the parameters
  * of this function.  The only difference in behavior is that this function
@@ -1406,6 +1414,23 @@ ObjectProperty *object_property_try_add(Object *obj, const char *name,
  * object_property_add:
  * Same as object_property_try_add() with @errp hardcoded to
  * &error_abort.
+ *
+ * @obj: the object to add a property to
+ * @name: the name of the property.  This can contain any character except for
+ *  a forward slash.  In general, you should use hyphens '-' instead of
+ *  underscores '_' when naming properties.
+ * @type: the type name of the property.  This namespace is pretty loosely
+ *   defined.  Sub namespaces are constructed by using a prefix and then
+ *   to angle brackets.  For instance, the type 'virtio-net-pci' in the
+ *   'link' namespace would be 'link<virtio-net-pci>'.
+ * @get: The getter to be called to read a property.  If this is NULL, then
+ *   the property cannot be read.
+ * @set: the setter to be called to write a property.  If this is NULL,
+ *   then the property cannot be written.
+ * @release: called when the property is removed from the object.  This is
+ *   meant to allow a property to free its opaque upon object
+ *   destruction.  This may be NULL.
+ * @opaque: an opaque pointer to pass to the callbacks for the property
  */
 ObjectProperty *object_property_add(Object *obj, const char *name,
                                     const char *type,
@@ -1479,6 +1504,7 @@ typedef struct ObjectPropertyIterator {
 
 /**
  * object_property_iter_init:
+ * @iter: the iterator instance
  * @obj: the object
  *
  * Initializes an iterator for traversing all properties
@@ -1507,6 +1533,7 @@ void object_property_iter_init(ObjectPropertyIterator *iter,
 
 /**
  * object_class_property_iter_init:
+ * @iter: the iterator instance
  * @klass: the class
  *
  * Initializes an iterator for traversing all properties
@@ -1554,6 +1581,7 @@ bool object_property_get(Object *obj, const char *name, Visitor *v,
 
 /**
  * object_property_set_str:
+ * @obj: the object
  * @name: the name of the property
  * @value: the value to be written to the property
  * @errp: returns an error if this function fails
@@ -1580,6 +1608,7 @@ char *object_property_get_str(Object *obj, const char *name,
 
 /**
  * object_property_set_link:
+ * @obj: the object
  * @name: the name of the property
  * @value: the value to be written to the property
  * @errp: returns an error if this function fails
@@ -1610,6 +1639,7 @@ Object *object_property_get_link(Object *obj, const char *name,
 
 /**
  * object_property_set_bool:
+ * @obj: the object
  * @name: the name of the property
  * @value: the value to be written to the property
  * @errp: returns an error if this function fails
@@ -1635,6 +1665,7 @@ bool object_property_get_bool(Object *obj, const char *name,
 
 /**
  * object_property_set_int:
+ * @obj: the object
  * @name: the name of the property
  * @value: the value to be written to the property
  * @errp: returns an error if this function fails
@@ -1660,6 +1691,7 @@ int64_t object_property_get_int(Object *obj, const char *name,
 
 /**
  * object_property_set_uint:
+ * @obj: the object
  * @name: the name of the property
  * @value: the value to be written to the property
  * @errp: returns an error if this function fails
@@ -1783,6 +1815,7 @@ Object *object_get_internal_root(void);
 
 /**
  * object_get_canonical_path_component:
+ * @obj: the object
  *
  * Returns: The final component in the object's canonical path.  The canonical
  * path is the path within the composition tree starting from the root.
@@ -1792,6 +1825,7 @@ const char *object_get_canonical_path_component(const Object *obj);
 
 /**
  * object_get_canonical_path:
+ * @obj: the object
  *
  * Returns: The canonical path for a object, newly allocated.  This is
  * the path within the composition tree starting from the root.  Use
@@ -1881,6 +1915,10 @@ ObjectProperty *object_property_try_add_child(Object *obj, const char *name,
 
 /**
  * object_property_add_child:
+ * @obj: the object to add a property to
+ * @name: the name of the property
+ * @child: the child object
+ *
  * Same as object_property_try_add_child() with @errp hardcoded to
  * &error_abort
  */
@@ -1898,13 +1936,17 @@ typedef enum {
 
 /**
  * object_property_allow_set_link:
+ * @obj: the object to add a property to
+ * @name: the name of the property
+ * @child: the child object
+ * @errp: pointer to error object
  *
  * The default implementation of the object_property_add_link() check()
  * callback function.  It allows the link property to be set and never returns
  * an error.
  */
-void object_property_allow_set_link(const Object *, const char *,
-                                    Object *, Error **);
+void object_property_allow_set_link(const Object *obj, const char *name,
+                                    Object *child, Error **errp);
 
 /**
  * object_property_add_link:
@@ -1998,6 +2040,7 @@ ObjectProperty *object_class_property_add_bool(ObjectClass *klass,
  * @obj: the object to add a property to
  * @name: the name of the property
  * @typename: the name of the enum data type
+ * @lookup: enum value namelookup table
  * @get: the getter or %NULL if the property is write-only.
  * @set: the setter or %NULL if the property is read-only
  *
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 67/92] qom: Use kernel-doc private/public tags in structs
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (65 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 66/92] qom: Document all function parameters in doc comments Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 68/92] qom: Use ``code`` Sphinx syntax where appropriate Paolo Bonzini
                   ` (26 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Eduardo Habkost

From: Eduardo Habkost <ehabkost@redhat.com>

Use kernel-doc syntax for indicating private and public struct
fields.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20200910221526.10041-3-ehabkost@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/qom/object.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/qom/object.h b/include/qom/object.h
index fe0c9b7735..473dc21bf4 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -520,7 +520,7 @@ typedef void (ObjectFree)(void *obj);
  */
 struct ObjectClass
 {
-    /*< private >*/
+    /* private: */
     Type type;
     GSList *interfaces;
 
@@ -546,7 +546,7 @@ struct ObjectClass
  */
 struct Object
 {
-    /*< private >*/
+    /* private: */
     ObjectClass *class;
     ObjectFree *free;
     GHashTable *properties;
@@ -908,7 +908,7 @@ struct InterfaceInfo {
 struct InterfaceClass
 {
     ObjectClass parent_class;
-    /*< private >*/
+    /* private: */
     ObjectClass *concrete_class;
     Type interface_type;
 };
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 68/92] qom: Use ``code`` Sphinx syntax where appropriate
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (66 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 67/92] qom: Use kernel-doc private/public tags in structs Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 69/92] qom: Add kernel-doc markup to introduction doc comment Paolo Bonzini
                   ` (25 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Eduardo Habkost

From: Eduardo Habkost <ehabkost@redhat.com>

Replace gtkdoc markup with Sphinx ``code`` syntax.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20200910221526.10041-4-ehabkost@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/qom/object.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/qom/object.h b/include/qom/object.h
index 473dc21bf4..f1e8cb5398 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -203,8 +203,8 @@ typedef struct InterfaceInfo InterfaceInfo;
  * an interface instance should always be of incomplete type in order to be
  * sure it cannot be dereferenced.  That is, you should define the
  * 'typedef struct SomethingIf SomethingIf' so that you can pass around
- * 'SomethingIf *si' arguments, but not define a 'struct SomethingIf { ... }'.
- * The only things you can validly do with a 'SomethingIf *' are to pass it as
+ * ``SomethingIf *si`` arguments, but not define a ``struct SomethingIf { ... }``.
+ * The only things you can validly do with a ``SomethingIf *`` are to pass it as
  * an argument to a method on its corresponding SomethingIfClass, or to
  * dynamically cast it to an object that implements the interface.
  *
@@ -301,7 +301,7 @@ typedef struct InterfaceInfo InterfaceInfo;
  *
  * Alternatively, object_class_by_name() can be used to obtain the class and
  * its non-overridden methods for a specific type. This would correspond to
- * |[ MyClass::method(...) ]| in C++.
+ * ``MyClass::method(...)`` in C++.
  *
  * The first example of such a QOM method was #CPUClass.reset,
  * another example is #DeviceClass.realize.
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 69/92] qom: Add kernel-doc markup to introduction doc comment
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (67 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 68/92] qom: Use ``code`` Sphinx syntax where appropriate Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 70/92] qom: Reformat section titles using Sphinx syntax Paolo Bonzini
                   ` (24 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Eduardo Habkost

From: Eduardo Habkost <ehabkost@redhat.com>

Add DOC: section keyword to introduction doc comment, so it will
be rendered by kernel-doc.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20200910221526.10041-5-ehabkost@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/qom/object.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/include/qom/object.h b/include/qom/object.h
index f1e8cb5398..c6e3d5d80c 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -29,9 +29,7 @@ typedef struct InterfaceInfo InterfaceInfo;
 #define TYPE_OBJECT "object"
 
 /**
- * SECTION:object.h
- * @title:Base Object Type System
- * @short_description: interfaces for creating new types and objects
+ * DOC:
  *
  * The QEMU Object Model provides a framework for registering user creatable
  * types and instantiating objects from those types.  QOM provides the following
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 70/92] qom: Reformat section titles using Sphinx syntax
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (68 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 69/92] qom: Add kernel-doc markup to introduction doc comment Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 71/92] qom: Indent existing code examples Paolo Bonzini
                   ` (23 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Eduardo Habkost

From: Eduardo Habkost <ehabkost@redhat.com>

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20200910221526.10041-6-ehabkost@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/qom/object.h | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/include/qom/object.h b/include/qom/object.h
index c6e3d5d80c..5418464de4 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -120,7 +120,8 @@ typedef struct InterfaceInfo InterfaceInfo;
  *   </programlisting>
  * </example>
  *
- * # Class Initialization #
+ * Class Initialization
+ * ====================
  *
  * Before an object is initialized, the class for the object must be
  * initialized.  There is only one class object for all instance objects
@@ -193,7 +194,8 @@ typedef struct InterfaceInfo InterfaceInfo;
  *   </programlisting>
  * </example>
  *
- * # Interfaces #
+ * Interfaces
+ * ==========
  *
  * Interfaces allow a limited form of multiple inheritance.  Instances are
  * similar to normal types except for the fact that are only defined by
@@ -206,7 +208,8 @@ typedef struct InterfaceInfo InterfaceInfo;
  * an argument to a method on its corresponding SomethingIfClass, or to
  * dynamically cast it to an object that implements the interface.
  *
- * # Methods #
+ * Methods
+ * =======
  *
  * A <emphasis>method</emphasis> is a function within the namespace scope of
  * a class. It usually operates on the object instance by passing it as a
@@ -304,7 +307,8 @@ typedef struct InterfaceInfo InterfaceInfo;
  * The first example of such a QOM method was #CPUClass.reset,
  * another example is #DeviceClass.realize.
  *
- * # Standard type declaration and definition macros #
+ * Standard type declaration and definition macros
+ * ===============================================
  *
  * A lot of the code outlined above follows a standard pattern and naming
  * convention. To reduce the amount of boilerplate code that needs to be
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 71/92] qom: Indent existing code examples
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (69 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 70/92] qom: Reformat section titles using Sphinx syntax Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 72/92] qom: Add code block markup to all code blocks Paolo Bonzini
                   ` (22 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Eduardo Habkost

From: Eduardo Habkost <ehabkost@redhat.com>

This indents existing code examples that are not indented yet,
just to make future conversion to Sphinx markup easier to review.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20200910221526.10041-7-ehabkost@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/qom/object.h | 376 +++++++++++++++++++++----------------------
 1 file changed, 188 insertions(+), 188 deletions(-)

diff --git a/include/qom/object.h b/include/qom/object.h
index 5418464de4..d96ac334c8 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -41,34 +41,34 @@ typedef struct InterfaceInfo InterfaceInfo;
  *
  * <example>
  *   <title>Creating a minimal type</title>
- *   <programlisting>
- * #include "qdev.h"
- *
- * #define TYPE_MY_DEVICE "my-device"
- *
- * // No new virtual functions: we can reuse the typedef for the
- * // superclass.
- * typedef DeviceClass MyDeviceClass;
- * typedef struct MyDevice
- * {
- *     DeviceState parent;
- *
- *     int reg0, reg1, reg2;
- * } MyDevice;
- *
- * static const TypeInfo my_device_info = {
- *     .name = TYPE_MY_DEVICE,
- *     .parent = TYPE_DEVICE,
- *     .instance_size = sizeof(MyDevice),
- * };
- *
- * static void my_device_register_types(void)
- * {
- *     type_register_static(&my_device_info);
- * }
- *
- * type_init(my_device_register_types)
- *   </programlisting>
+ *      <programlisting>
+ *    #include "qdev.h"
+ *
+ *    #define TYPE_MY_DEVICE "my-device"
+ *
+ *    // No new virtual functions: we can reuse the typedef for the
+ *    // superclass.
+ *    typedef DeviceClass MyDeviceClass;
+ *    typedef struct MyDevice
+ *    {
+ *        DeviceState parent;
+ *
+ *        int reg0, reg1, reg2;
+ *    } MyDevice;
+ *
+ *    static const TypeInfo my_device_info = {
+ *        .name = TYPE_MY_DEVICE,
+ *        .parent = TYPE_DEVICE,
+ *        .instance_size = sizeof(MyDevice),
+ *    };
+ *
+ *    static void my_device_register_types(void)
+ *    {
+ *        type_register_static(&my_device_info);
+ *    }
+ *
+ *    type_init(my_device_register_types)
+ *      </programlisting>
  * </example>
  *
  * In the above example, we create a simple type that is described by #TypeInfo.
@@ -79,22 +79,22 @@ typedef struct InterfaceInfo InterfaceInfo;
  * DEFINE_TYPES()
  *
  * <example>
- *   <programlisting>
- * static const TypeInfo device_types_info[] = {
- *     {
- *         .name = TYPE_MY_DEVICE_A,
- *         .parent = TYPE_DEVICE,
- *         .instance_size = sizeof(MyDeviceA),
- *     },
- *     {
- *         .name = TYPE_MY_DEVICE_B,
- *         .parent = TYPE_DEVICE,
- *         .instance_size = sizeof(MyDeviceB),
- *     },
- * };
- *
- * DEFINE_TYPES(device_types_info)
- *   </programlisting>
+ *      <programlisting>
+ *    static const TypeInfo device_types_info[] = {
+ *        {
+ *            .name = TYPE_MY_DEVICE_A,
+ *            .parent = TYPE_DEVICE,
+ *            .instance_size = sizeof(MyDeviceA),
+ *        },
+ *        {
+ *            .name = TYPE_MY_DEVICE_B,
+ *            .parent = TYPE_DEVICE,
+ *            .instance_size = sizeof(MyDeviceB),
+ *        },
+ *    };
+ *
+ *    DEFINE_TYPES(device_types_info)
+ *      </programlisting>
  * </example>
  *
  * Every type has an #ObjectClass associated with it.  #ObjectClass derivatives
@@ -143,22 +143,22 @@ typedef struct InterfaceInfo InterfaceInfo;
  *
  * <example>
  *   <title>Overriding a virtual function</title>
- *   <programlisting>
- * #include "qdev.h"
- *
- * void my_device_class_init(ObjectClass *klass, void *class_data)
- * {
- *     DeviceClass *dc = DEVICE_CLASS(klass);
- *     dc->reset = my_device_reset;
- * }
- *
- * static const TypeInfo my_device_info = {
- *     .name = TYPE_MY_DEVICE,
- *     .parent = TYPE_DEVICE,
- *     .instance_size = sizeof(MyDevice),
- *     .class_init = my_device_class_init,
- * };
- *   </programlisting>
+ *      <programlisting>
+ *    #include "qdev.h"
+ *
+ *    void my_device_class_init(ObjectClass *klass, void *class_data)
+ *    {
+ *        DeviceClass *dc = DEVICE_CLASS(klass);
+ *        dc->reset = my_device_reset;
+ *    }
+ *
+ *    static const TypeInfo my_device_info = {
+ *        .name = TYPE_MY_DEVICE,
+ *        .parent = TYPE_DEVICE,
+ *        .instance_size = sizeof(MyDevice),
+ *        .class_init = my_device_class_init,
+ *    };
+ *      </programlisting>
  * </example>
  *
  * Introducing new virtual methods requires a class to define its own
@@ -167,31 +167,31 @@ typedef struct InterfaceInfo InterfaceInfo;
  *
  * <example>
  *   <title>Defining an abstract class</title>
- *   <programlisting>
- * #include "qdev.h"
- *
- * typedef struct MyDeviceClass
- * {
- *     DeviceClass parent;
- *
- *     void (*frobnicate) (MyDevice *obj);
- * } MyDeviceClass;
- *
- * static const TypeInfo my_device_info = {
- *     .name = TYPE_MY_DEVICE,
- *     .parent = TYPE_DEVICE,
- *     .instance_size = sizeof(MyDevice),
- *     .abstract = true, // or set a default in my_device_class_init
- *     .class_size = sizeof(MyDeviceClass),
- * };
- *
- * void my_device_frobnicate(MyDevice *obj)
- * {
- *     MyDeviceClass *klass = MY_DEVICE_GET_CLASS(obj);
- *
- *     klass->frobnicate(obj);
- * }
- *   </programlisting>
+ *      <programlisting>
+ *    #include "qdev.h"
+ *
+ *    typedef struct MyDeviceClass
+ *    {
+ *        DeviceClass parent;
+ *
+ *        void (*frobnicate) (MyDevice *obj);
+ *    } MyDeviceClass;
+ *
+ *    static const TypeInfo my_device_info = {
+ *        .name = TYPE_MY_DEVICE,
+ *        .parent = TYPE_DEVICE,
+ *        .instance_size = sizeof(MyDevice),
+ *        .abstract = true, // or set a default in my_device_class_init
+ *        .class_size = sizeof(MyDeviceClass),
+ *    };
+ *
+ *    void my_device_frobnicate(MyDevice *obj)
+ *    {
+ *        MyDeviceClass *klass = MY_DEVICE_GET_CLASS(obj);
+ *
+ *        klass->frobnicate(obj);
+ *    }
+ *      </programlisting>
  * </example>
  *
  * Interfaces
@@ -236,68 +236,68 @@ typedef struct InterfaceInfo InterfaceInfo;
  *
  * <example>
  *   <title>Overriding a virtual method</title>
- *   <programlisting>
- * typedef struct MyState MyState;
- *
- * typedef void (*MyDoSomething)(MyState *obj);
- *
- * typedef struct MyClass {
- *     ObjectClass parent_class;
- *
- *     MyDoSomething do_something;
- * } MyClass;
- *
- * static void my_do_something(MyState *obj)
- * {
- *     // do something
- * }
- *
- * static void my_class_init(ObjectClass *oc, void *data)
- * {
- *     MyClass *mc = MY_CLASS(oc);
- *
- *     mc->do_something = my_do_something;
- * }
- *
- * static const TypeInfo my_type_info = {
- *     .name = TYPE_MY,
- *     .parent = TYPE_OBJECT,
- *     .instance_size = sizeof(MyState),
- *     .class_size = sizeof(MyClass),
- *     .class_init = my_class_init,
- * };
- *
- * typedef struct DerivedClass {
- *     MyClass parent_class;
- *
- *     MyDoSomething parent_do_something;
- * } DerivedClass;
- *
- * static void derived_do_something(MyState *obj)
- * {
- *     DerivedClass *dc = DERIVED_GET_CLASS(obj);
- *
- *     // do something here
- *     dc->parent_do_something(obj);
- *     // do something else here
- * }
- *
- * static void derived_class_init(ObjectClass *oc, void *data)
- * {
- *     MyClass *mc = MY_CLASS(oc);
- *     DerivedClass *dc = DERIVED_CLASS(oc);
- *
- *     dc->parent_do_something = mc->do_something;
- *     mc->do_something = derived_do_something;
- * }
- *
- * static const TypeInfo derived_type_info = {
- *     .name = TYPE_DERIVED,
- *     .parent = TYPE_MY,
- *     .class_size = sizeof(DerivedClass),
- *     .class_init = derived_class_init,
- * };
- *   </programlisting>
+ *      <programlisting>
+ *    typedef struct MyState MyState;
+ *
+ *    typedef void (*MyDoSomething)(MyState *obj);
+ *
+ *    typedef struct MyClass {
+ *        ObjectClass parent_class;
+ *
+ *        MyDoSomething do_something;
+ *    } MyClass;
+ *
+ *    static void my_do_something(MyState *obj)
+ *    {
+ *        // do something
+ *    }
+ *
+ *    static void my_class_init(ObjectClass *oc, void *data)
+ *    {
+ *        MyClass *mc = MY_CLASS(oc);
+ *
+ *        mc->do_something = my_do_something;
+ *    }
+ *
+ *    static const TypeInfo my_type_info = {
+ *        .name = TYPE_MY,
+ *        .parent = TYPE_OBJECT,
+ *        .instance_size = sizeof(MyState),
+ *        .class_size = sizeof(MyClass),
+ *        .class_init = my_class_init,
+ *    };
+ *
+ *    typedef struct DerivedClass {
+ *        MyClass parent_class;
+ *
+ *        MyDoSomething parent_do_something;
+ *    } DerivedClass;
+ *
+ *    static void derived_do_something(MyState *obj)
+ *    {
+ *        DerivedClass *dc = DERIVED_GET_CLASS(obj);
+ *
+ *        // do something here
+ *        dc->parent_do_something(obj);
+ *        // do something else here
+ *    }
+ *
+ *    static void derived_class_init(ObjectClass *oc, void *data)
+ *    {
+ *        MyClass *mc = MY_CLASS(oc);
+ *        DerivedClass *dc = DERIVED_CLASS(oc);
+ *
+ *        dc->parent_do_something = mc->do_something;
+ *        mc->do_something = derived_do_something;
+ *    }
+ *
+ *    static const TypeInfo derived_type_info = {
+ *        .name = TYPE_DERIVED,
+ *        .parent = TYPE_MY,
+ *        .class_size = sizeof(DerivedClass),
+ *        .class_init = derived_class_init,
+ *    };
+ *      </programlisting>
  * </example>
  *
  * Alternatively, object_class_by_name() can be used to obtain the class and
@@ -984,24 +984,24 @@ Object *object_new(const char *typename);
  *
  * <example>
  *   <title>Creating an object with properties</title>
- *   <programlisting>
- *   Error *err = NULL;
- *   Object *obj;
- *
- *   obj = object_new_with_props(TYPE_MEMORY_BACKEND_FILE,
- *                               object_get_objects_root(),
- *                               "hostmem0",
- *                               &err,
- *                               "share", "yes",
- *                               "mem-path", "/dev/shm/somefile",
- *                               "prealloc", "yes",
- *                               "size", "1048576",
- *                               NULL);
- *
- *   if (!obj) {
- *     error_reportf_err(err, "Cannot create memory backend: ");
- *   }
- *   </programlisting>
+ *      <programlisting>
+ *      Error *err = NULL;
+ *      Object *obj;
+ *
+ *      obj = object_new_with_props(TYPE_MEMORY_BACKEND_FILE,
+ *                                  object_get_objects_root(),
+ *                                  "hostmem0",
+ *                                  &err,
+ *                                  "share", "yes",
+ *                                  "mem-path", "/dev/shm/somefile",
+ *                                  "prealloc", "yes",
+ *                                  "size", "1048576",
+ *                                  NULL);
+ *
+ *      if (!obj) {
+ *        error_reportf_err(err, "Cannot create memory backend: ");
+ *      }
+ *      </programlisting>
  * </example>
  *
  * The returned object will have one stable reference maintained
@@ -1053,20 +1053,20 @@ void object_apply_compat_props(Object *obj);
  *
  * <example>
  *   <title>Update an object's properties</title>
- *   <programlisting>
- *   Error *err = NULL;
- *   Object *obj = ...get / create object...;
- *
- *   if (!object_set_props(obj,
- *                         &err,
- *                         "share", "yes",
- *                         "mem-path", "/dev/shm/somefile",
- *                         "prealloc", "yes",
- *                         "size", "1048576",
- *                         NULL)) {
- *     error_reportf_err(err, "Cannot set properties: ");
- *   }
- *   </programlisting>
+ *      <programlisting>
+ *      Error *err = NULL;
+ *      Object *obj = ...get / create object...;
+ *
+ *      if (!object_set_props(obj,
+ *                            &err,
+ *                            "share", "yes",
+ *                            "mem-path", "/dev/shm/somefile",
+ *                            "prealloc", "yes",
+ *                            "size", "1048576",
+ *                            NULL)) {
+ *        error_reportf_err(err, "Cannot set properties: ");
+ *      }
+ *      </programlisting>
  * </example>
  *
  * The returned object will have one stable reference maintained
@@ -1519,15 +1519,15 @@ typedef struct ObjectPropertyIterator {
  *
  * <example>
  *   <title>Using object property iterators</title>
- *   <programlisting>
- *   ObjectProperty *prop;
- *   ObjectPropertyIterator iter;
- *
- *   object_property_iter_init(&iter, obj);
- *   while ((prop = object_property_iter_next(&iter))) {
- *     ... do something with prop ...
- *   }
- *   </programlisting>
+ *      <programlisting>
+ *      ObjectProperty *prop;
+ *      ObjectPropertyIterator iter;
+ *
+ *      object_property_iter_init(&iter, obj);
+ *      while ((prop = object_property_iter_next(&iter))) {
+ *        ... do something with prop ...
+ *      }
+ *      </programlisting>
  * </example>
  */
 void object_property_iter_init(ObjectPropertyIterator *iter,
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 72/92] qom: Add code block markup to all code blocks
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (70 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 71/92] qom: Indent existing code examples Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 73/92] docs: Create docs/devel/qom.rst Paolo Bonzini
                   ` (21 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Eduardo Habkost

From: Eduardo Habkost <ehabkost@redhat.com>

Convert all example/codelisting markup to Sphinx code-block.

There are a few sections where backslashes at the end of lines
break code formatting.  A comment was added noting that this is
an issue.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20200910221526.10041-8-ehabkost@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/qom/object.h | 135 ++++++++++++++++++-------------------------
 1 file changed, 56 insertions(+), 79 deletions(-)

diff --git a/include/qom/object.h b/include/qom/object.h
index d96ac334c8..d839a2c39f 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -31,6 +31,8 @@ typedef struct InterfaceInfo InterfaceInfo;
 /**
  * DOC:
  *
+ * .. highlight:: c
+ *
  * The QEMU Object Model provides a framework for registering user creatable
  * types and instantiating objects from those types.  QOM provides the following
  * features:
@@ -39,9 +41,9 @@ typedef struct InterfaceInfo InterfaceInfo;
  *  - Support for single-inheritance of types
  *  - Multiple inheritance of stateless interfaces
  *
- * <example>
- *   <title>Creating a minimal type</title>
- *      <programlisting>
+ * .. code-block:: c
+ *    :caption: Creating a minimal type
+ *
  *    #include "qdev.h"
  *
  *    #define TYPE_MY_DEVICE "my-device"
@@ -68,8 +70,6 @@ typedef struct InterfaceInfo InterfaceInfo;
  *    }
  *
  *    type_init(my_device_register_types)
- *      </programlisting>
- * </example>
  *
  * In the above example, we create a simple type that is described by #TypeInfo.
  * #TypeInfo describes information about the type including what it inherits
@@ -78,8 +78,8 @@ typedef struct InterfaceInfo InterfaceInfo;
  * Alternatively several static types could be registered using helper macro
  * DEFINE_TYPES()
  *
- * <example>
- *      <programlisting>
+ * .. code-block:: c
+ *
  *    static const TypeInfo device_types_info[] = {
  *        {
  *            .name = TYPE_MY_DEVICE_A,
@@ -94,8 +94,6 @@ typedef struct InterfaceInfo InterfaceInfo;
  *    };
  *
  *    DEFINE_TYPES(device_types_info)
- *      </programlisting>
- * </example>
  *
  * Every type has an #ObjectClass associated with it.  #ObjectClass derivatives
  * are instantiated dynamically but there is only ever one instance for any
@@ -108,17 +106,19 @@ typedef struct InterfaceInfo InterfaceInfo;
  * OBJECT_CHECK() and OBJECT_CLASS_CHECK() to make it easier to convert to a
  * specific type:
  *
- * <example>
- *   <title>Typecasting macros</title>
- *   <programlisting>
+ * .. kernel-doc messes up with the code block below because of the
+ *    backslash at the end of lines.  This will be fixes if we move this
+ *    content to qom.rst.
+ *
+ * .. code-block:: c
+ *    :caption: Typecasting macros
+ *
  *    #define MY_DEVICE_GET_CLASS(obj) \
  *       OBJECT_GET_CLASS(MyDeviceClass, obj, TYPE_MY_DEVICE)
  *    #define MY_DEVICE_CLASS(klass) \
  *       OBJECT_CLASS_CHECK(MyDeviceClass, klass, TYPE_MY_DEVICE)
  *    #define MY_DEVICE(obj) \
  *       OBJECT_CHECK(MyDevice, obj, TYPE_MY_DEVICE)
- *   </programlisting>
- * </example>
  *
  * Class Initialization
  * ====================
@@ -141,9 +141,9 @@ typedef struct InterfaceInfo InterfaceInfo;
  * its virtual functions.  Here is how the above example might be modified
  * to introduce an overridden virtual function:
  *
- * <example>
- *   <title>Overriding a virtual function</title>
- *      <programlisting>
+ * .. code-block:: c
+ *    :caption: Overriding a virtual function
+ *
  *    #include "qdev.h"
  *
  *    void my_device_class_init(ObjectClass *klass, void *class_data)
@@ -158,16 +158,14 @@ typedef struct InterfaceInfo InterfaceInfo;
  *        .instance_size = sizeof(MyDevice),
  *        .class_init = my_device_class_init,
  *    };
- *      </programlisting>
- * </example>
  *
  * Introducing new virtual methods requires a class to define its own
  * struct and to add a .class_size member to the #TypeInfo.  Each method
  * will also have a wrapper function to call it easily:
  *
- * <example>
- *   <title>Defining an abstract class</title>
- *      <programlisting>
+ * .. code-block:: c
+ *    :caption: Defining an abstract class
+ *
  *    #include "qdev.h"
  *
  *    typedef struct MyDeviceClass
@@ -191,8 +189,6 @@ typedef struct InterfaceInfo InterfaceInfo;
  *
  *        klass->frobnicate(obj);
  *    }
- *      </programlisting>
- * </example>
  *
  * Interfaces
  * ==========
@@ -230,13 +226,13 @@ typedef struct InterfaceInfo InterfaceInfo;
  *
  * To invoke the method being overridden, the preferred solution is to store
  * the original value in the overriding class before overriding the method.
- * This corresponds to |[ {super,base}.method(...) ]| in Java and C#
+ * This corresponds to ``{super,base}.method(...)`` in Java and C#
  * respectively; this frees the overriding class from hardcoding its parent
  * class, which someone might choose to change at some point.
  *
- * <example>
- *   <title>Overriding a virtual method</title>
- *      <programlisting>
+ * .. code-block:: c
+ *    :caption: Overriding a virtual method
+ *
  *    typedef struct MyState MyState;
  *
  *    typedef void (*MyDoSomething)(MyState *obj);
@@ -297,8 +293,6 @@ typedef struct InterfaceInfo InterfaceInfo;
  *        .class_size = sizeof(DerivedClass),
  *        .class_init = derived_class_init,
  *    };
- *      </programlisting>
- * </example>
  *
  * Alternatively, object_class_by_name() can be used to obtain the class and
  * its non-overridden methods for a specific type. This would correspond to
@@ -320,18 +314,16 @@ typedef struct InterfaceInfo InterfaceInfo;
  * OBJECT_DECLARE_SIMPLE_TYPE macro is suitable, and is commonly placed
  * in the header file:
  *
- * <example>
- *   <title>Declaring a simple type</title>
- *   <programlisting>
+ * .. code-block:: c
+ *    :caption: Declaring a simple type
+ *
  *     OBJECT_DECLARE_SIMPLE_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE)
- *   </programlisting>
- * </example>
  *
  * This is equivalent to the following:
  *
- * <example>
- *   <title>Expansion from declaring a simple type</title>
- *   <programlisting>
+ * .. code-block:: c
+ *    :caption: Expansion from declaring a simple type
+ *
  *     typedef struct MyDevice MyDevice;
  *     typedef struct MyDeviceClass MyDeviceClass;
  *
@@ -347,8 +339,6 @@ typedef struct InterfaceInfo InterfaceInfo;
  *     struct MyDeviceClass {
  *         DeviceClass parent_class;
  *     };
- *   </programlisting>
- * </example>
  *
  * The 'struct MyDevice' needs to be declared separately.
  * If the type requires virtual functions to be declared in the class
@@ -359,18 +349,16 @@ typedef struct InterfaceInfo InterfaceInfo;
  * To implement the type, the OBJECT_DEFINE macro family is available.
  * In the simple case the OBJECT_DEFINE_TYPE macro is suitable:
  *
- * <example>
- *   <title>Defining a simple type</title>
- *   <programlisting>
+ * .. code-block:: c
+ *    :caption: Defining a simple type
+ *
  *     OBJECT_DEFINE_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE)
- *   </programlisting>
- * </example>
  *
  * This is equivalent to the following:
  *
- * <example>
- *   <title>Expansion from defining a simple type</title>
- *   <programlisting>
+ * .. code-block:: c
+ *    :caption: Expansion from defining a simple type
+ *
  *     static void my_device_finalize(Object *obj);
  *     static void my_device_class_init(ObjectClass *oc, void *data);
  *     static void my_device_init(Object *obj);
@@ -391,8 +379,6 @@ typedef struct InterfaceInfo InterfaceInfo;
  *         type_register_static(&my_device_info);
  *     }
  *     type_init(my_device_register_types);
- *   </programlisting>
- * </example>
  *
  * This is sufficient to get the type registered with the type
  * system, and the three standard methods now need to be implemented
@@ -402,24 +388,20 @@ typedef struct InterfaceInfo InterfaceInfo;
  * OBJECT_DEFINE_TYPE_WITH_INTERFACES() macro can be used instead.
  * This accepts an array of interface type names.
  *
- * <example>
- *   <title>Defining a simple type implementing interfaces</title>
- *   <programlisting>
+ * .. code-block:: c
+ *    :caption: Defining a simple type implementing interfaces
+ *
  *     OBJECT_DEFINE_TYPE_WITH_INTERFACES(MyDevice, my_device,
  *                                        MY_DEVICE, DEVICE,
  *                                        { TYPE_USER_CREATABLE }, { NULL })
- *   </programlisting>
- * </example>
  *
  * If the type is not intended to be instantiated, then then
  * the OBJECT_DEFINE_ABSTRACT_TYPE() macro can be used instead:
  *
- * <example>
- *   <title>Defining a simple type</title>
- *   <programlisting>
+ * .. code-block:: c
+ *    :caption: Defining a simple abstract type
+ *
  *     OBJECT_DEFINE_ABSTRACT_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE)
- *   </programlisting>
- * </example>
  */
 
 
@@ -982,9 +964,9 @@ Object *object_new(const char *typename);
  * object will be marked complete once all the properties have been
  * processed.
  *
- * <example>
- *   <title>Creating an object with properties</title>
- *      <programlisting>
+ * .. code-block:: c
+ *    :caption: Creating an object with properties
+ *
  *      Error *err = NULL;
  *      Object *obj;
  *
@@ -1001,8 +983,6 @@ Object *object_new(const char *typename);
  *      if (!obj) {
  *        error_reportf_err(err, "Cannot create memory backend: ");
  *      }
- *      </programlisting>
- * </example>
  *
  * The returned object will have one stable reference maintained
  * for as long as it is present in the object hierarchy.
@@ -1051,9 +1031,9 @@ void object_apply_compat_props(Object *obj);
  * strings. The propname of %NULL indicates the end of the property
  * list.
  *
- * <example>
- *   <title>Update an object's properties</title>
- *      <programlisting>
+ * .. code-block:: c
+ *    :caption: Update an object's properties
+ *
  *      Error *err = NULL;
  *      Object *obj = ...get / create object...;
  *
@@ -1066,8 +1046,6 @@ void object_apply_compat_props(Object *obj);
  *                            NULL)) {
  *        error_reportf_err(err, "Cannot set properties: ");
  *      }
- *      </programlisting>
- * </example>
  *
  * The returned object will have one stable reference maintained
  * for as long as it is present in the object hierarchy.
@@ -1155,10 +1133,11 @@ bool object_initialize_child_with_propsv(Object *parentobj,
  * object.
  * @type: The name of the type of the object to instantiate.
  *
- * This is like
- * object_initialize_child_with_props(parent, propname,
- *                                    child, sizeof(*child), type,
- *                                    &error_abort, NULL)
+ * This is like::
+ *
+ *   object_initialize_child_with_props(parent, propname,
+ *                                      child, sizeof(*child), type,
+ *                                      &error_abort, NULL)
  */
 #define object_initialize_child(parent, propname, child, type)          \
     object_initialize_child_internal((parent), (propname),              \
@@ -1517,9 +1496,9 @@ typedef struct ObjectPropertyIterator {
  *
  * Typical usage pattern would be
  *
- * <example>
- *   <title>Using object property iterators</title>
- *      <programlisting>
+ * .. code-block:: c
+ *    :caption: Using object property iterators
+ *
  *      ObjectProperty *prop;
  *      ObjectPropertyIterator iter;
  *
@@ -1527,8 +1506,6 @@ typedef struct ObjectPropertyIterator {
  *      while ((prop = object_property_iter_next(&iter))) {
  *        ... do something with prop ...
  *      }
- *      </programlisting>
- * </example>
  */
 void object_property_iter_init(ObjectPropertyIterator *iter,
                                Object *obj);
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 73/92] docs: Create docs/devel/qom.rst
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (71 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 72/92] qom: Add code block markup to all code blocks Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 74/92] docs: Move object.h overview doc comment to qom.rst Paolo Bonzini
                   ` (20 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Eduardo Habkost

From: Eduardo Habkost <ehabkost@redhat.com>

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20200910221526.10041-9-ehabkost@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 docs/devel/index.rst | 1 +
 docs/devel/qom.rst   | 5 +++++
 2 files changed, 6 insertions(+)
 create mode 100644 docs/devel/qom.rst

diff --git a/docs/devel/index.rst b/docs/devel/index.rst
index 04773ce076..c34b43ec28 100644
--- a/docs/devel/index.rst
+++ b/docs/devel/index.rst
@@ -31,3 +31,4 @@ Contents:
    reset
    s390-dasd-ipl
    clocks
+   qom
diff --git a/docs/devel/qom.rst b/docs/devel/qom.rst
new file mode 100644
index 0000000000..dc5be79a4a
--- /dev/null
+++ b/docs/devel/qom.rst
@@ -0,0 +1,5 @@
+===========================
+The QEMU Object Model (QOM)
+===========================
+
+.. kernel-doc:: include/qom/object.h
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 74/92] docs: Move object.h overview doc comment to qom.rst
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (72 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 73/92] docs: Create docs/devel/qom.rst Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 75/92] hw/i386/xen: Rename X86/PC specific function as xen_hvm_init_pc() Paolo Bonzini
                   ` (19 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Eduardo Habkost

Move the whole contents of the overview doc comment from object.h
to qom.rst.

This makes the documentation source easier to read and edit, and
also solves the backslash escaping issue at the typecasting macro
examples.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20200910221526.10041-10-ehabkost@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 docs/devel/qom.rst   | 373 ++++++++++++++++++++++++++++++++++++++++++
 include/qom/object.h | 377 -------------------------------------------
 2 files changed, 373 insertions(+), 377 deletions(-)

diff --git a/docs/devel/qom.rst b/docs/devel/qom.rst
index dc5be79a4a..0b943b2a1a 100644
--- a/docs/devel/qom.rst
+++ b/docs/devel/qom.rst
@@ -2,4 +2,377 @@
 The QEMU Object Model (QOM)
 ===========================
 
+.. highlight:: c
+
+The QEMU Object Model provides a framework for registering user creatable
+types and instantiating objects from those types.  QOM provides the following
+features:
+
+ - System for dynamically registering types
+ - Support for single-inheritance of types
+ - Multiple inheritance of stateless interfaces
+
+.. code-block:: c
+   :caption: Creating a minimal type
+
+   #include "qdev.h"
+
+   #define TYPE_MY_DEVICE "my-device"
+
+   // No new virtual functions: we can reuse the typedef for the
+   // superclass.
+   typedef DeviceClass MyDeviceClass;
+   typedef struct MyDevice
+   {
+       DeviceState parent;
+
+       int reg0, reg1, reg2;
+   } MyDevice;
+
+   static const TypeInfo my_device_info = {
+       .name = TYPE_MY_DEVICE,
+       .parent = TYPE_DEVICE,
+       .instance_size = sizeof(MyDevice),
+   };
+
+   static void my_device_register_types(void)
+   {
+       type_register_static(&my_device_info);
+   }
+
+   type_init(my_device_register_types)
+
+In the above example, we create a simple type that is described by #TypeInfo.
+#TypeInfo describes information about the type including what it inherits
+from, the instance and class size, and constructor/destructor hooks.
+
+Alternatively several static types could be registered using helper macro
+DEFINE_TYPES()
+
+.. code-block:: c
+
+   static const TypeInfo device_types_info[] = {
+       {
+           .name = TYPE_MY_DEVICE_A,
+           .parent = TYPE_DEVICE,
+           .instance_size = sizeof(MyDeviceA),
+       },
+       {
+           .name = TYPE_MY_DEVICE_B,
+           .parent = TYPE_DEVICE,
+           .instance_size = sizeof(MyDeviceB),
+       },
+   };
+
+   DEFINE_TYPES(device_types_info)
+
+Every type has an #ObjectClass associated with it.  #ObjectClass derivatives
+are instantiated dynamically but there is only ever one instance for any
+given type.  The #ObjectClass typically holds a table of function pointers
+for the virtual methods implemented by this type.
+
+Using object_new(), a new #Object derivative will be instantiated.  You can
+cast an #Object to a subclass (or base-class) type using
+object_dynamic_cast().  You typically want to define macro wrappers around
+OBJECT_CHECK() and OBJECT_CLASS_CHECK() to make it easier to convert to a
+specific type:
+
+.. code-block:: c
+   :caption: Typecasting macros
+
+   #define MY_DEVICE_GET_CLASS(obj) \
+      OBJECT_GET_CLASS(MyDeviceClass, obj, TYPE_MY_DEVICE)
+   #define MY_DEVICE_CLASS(klass) \
+      OBJECT_CLASS_CHECK(MyDeviceClass, klass, TYPE_MY_DEVICE)
+   #define MY_DEVICE(obj) \
+      OBJECT_CHECK(MyDevice, obj, TYPE_MY_DEVICE)
+
+Class Initialization
+====================
+
+Before an object is initialized, the class for the object must be
+initialized.  There is only one class object for all instance objects
+that is created lazily.
+
+Classes are initialized by first initializing any parent classes (if
+necessary).  After the parent class object has initialized, it will be
+copied into the current class object and any additional storage in the
+class object is zero filled.
+
+The effect of this is that classes automatically inherit any virtual
+function pointers that the parent class has already initialized.  All
+other fields will be zero filled.
+
+Once all of the parent classes have been initialized, #TypeInfo::class_init
+is called to let the class being instantiated provide default initialize for
+its virtual functions.  Here is how the above example might be modified
+to introduce an overridden virtual function:
+
+.. code-block:: c
+   :caption: Overriding a virtual function
+
+   #include "qdev.h"
+
+   void my_device_class_init(ObjectClass *klass, void *class_data)
+   {
+       DeviceClass *dc = DEVICE_CLASS(klass);
+       dc->reset = my_device_reset;
+   }
+
+   static const TypeInfo my_device_info = {
+       .name = TYPE_MY_DEVICE,
+       .parent = TYPE_DEVICE,
+       .instance_size = sizeof(MyDevice),
+       .class_init = my_device_class_init,
+   };
+
+Introducing new virtual methods requires a class to define its own
+struct and to add a .class_size member to the #TypeInfo.  Each method
+will also have a wrapper function to call it easily:
+
+.. code-block:: c
+   :caption: Defining an abstract class
+
+   #include "qdev.h"
+
+   typedef struct MyDeviceClass
+   {
+       DeviceClass parent;
+
+       void (*frobnicate) (MyDevice *obj);
+   } MyDeviceClass;
+
+   static const TypeInfo my_device_info = {
+       .name = TYPE_MY_DEVICE,
+       .parent = TYPE_DEVICE,
+       .instance_size = sizeof(MyDevice),
+       .abstract = true, // or set a default in my_device_class_init
+       .class_size = sizeof(MyDeviceClass),
+   };
+
+   void my_device_frobnicate(MyDevice *obj)
+   {
+       MyDeviceClass *klass = MY_DEVICE_GET_CLASS(obj);
+
+       klass->frobnicate(obj);
+   }
+
+Interfaces
+==========
+
+Interfaces allow a limited form of multiple inheritance.  Instances are
+similar to normal types except for the fact that are only defined by
+their classes and never carry any state.  As a consequence, a pointer to
+an interface instance should always be of incomplete type in order to be
+sure it cannot be dereferenced.  That is, you should define the
+'typedef struct SomethingIf SomethingIf' so that you can pass around
+``SomethingIf *si`` arguments, but not define a ``struct SomethingIf { ... }``.
+The only things you can validly do with a ``SomethingIf *`` are to pass it as
+an argument to a method on its corresponding SomethingIfClass, or to
+dynamically cast it to an object that implements the interface.
+
+Methods
+=======
+
+A <emphasis>method</emphasis> is a function within the namespace scope of
+a class. It usually operates on the object instance by passing it as a
+strongly-typed first argument.
+If it does not operate on an object instance, it is dubbed
+<emphasis>class method</emphasis>.
+
+Methods cannot be overloaded. That is, the #ObjectClass and method name
+uniquely identity the function to be called; the signature does not vary
+except for trailing varargs.
+
+Methods are always <emphasis>virtual</emphasis>. Overriding a method in
+#TypeInfo.class_init of a subclass leads to any user of the class obtained
+via OBJECT_GET_CLASS() accessing the overridden function.
+The original function is not automatically invoked. It is the responsibility
+of the overriding class to determine whether and when to invoke the method
+being overridden.
+
+To invoke the method being overridden, the preferred solution is to store
+the original value in the overriding class before overriding the method.
+This corresponds to ``{super,base}.method(...)`` in Java and C#
+respectively; this frees the overriding class from hardcoding its parent
+class, which someone might choose to change at some point.
+
+.. code-block:: c
+   :caption: Overriding a virtual method
+
+   typedef struct MyState MyState;
+
+   typedef void (*MyDoSomething)(MyState *obj);
+
+   typedef struct MyClass {
+       ObjectClass parent_class;
+
+       MyDoSomething do_something;
+   } MyClass;
+
+   static void my_do_something(MyState *obj)
+   {
+       // do something
+   }
+
+   static void my_class_init(ObjectClass *oc, void *data)
+   {
+       MyClass *mc = MY_CLASS(oc);
+
+       mc->do_something = my_do_something;
+   }
+
+   static const TypeInfo my_type_info = {
+       .name = TYPE_MY,
+       .parent = TYPE_OBJECT,
+       .instance_size = sizeof(MyState),
+       .class_size = sizeof(MyClass),
+       .class_init = my_class_init,
+   };
+
+   typedef struct DerivedClass {
+       MyClass parent_class;
+
+       MyDoSomething parent_do_something;
+   } DerivedClass;
+
+   static void derived_do_something(MyState *obj)
+   {
+       DerivedClass *dc = DERIVED_GET_CLASS(obj);
+
+       // do something here
+       dc->parent_do_something(obj);
+       // do something else here
+   }
+
+   static void derived_class_init(ObjectClass *oc, void *data)
+   {
+       MyClass *mc = MY_CLASS(oc);
+       DerivedClass *dc = DERIVED_CLASS(oc);
+
+       dc->parent_do_something = mc->do_something;
+       mc->do_something = derived_do_something;
+   }
+
+   static const TypeInfo derived_type_info = {
+       .name = TYPE_DERIVED,
+       .parent = TYPE_MY,
+       .class_size = sizeof(DerivedClass),
+       .class_init = derived_class_init,
+   };
+
+Alternatively, object_class_by_name() can be used to obtain the class and
+its non-overridden methods for a specific type. This would correspond to
+``MyClass::method(...)`` in C++.
+
+The first example of such a QOM method was #CPUClass.reset,
+another example is #DeviceClass.realize.
+
+Standard type declaration and definition macros
+===============================================
+
+A lot of the code outlined above follows a standard pattern and naming
+convention. To reduce the amount of boilerplate code that needs to be
+written for a new type there are two sets of macros to generate the
+common parts in a standard format.
+
+A type is declared using the OBJECT_DECLARE macro family. In types
+which do not require any virtual functions in the class, the
+OBJECT_DECLARE_SIMPLE_TYPE macro is suitable, and is commonly placed
+in the header file:
+
+.. code-block:: c
+   :caption: Declaring a simple type
+
+    OBJECT_DECLARE_SIMPLE_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE)
+
+This is equivalent to the following:
+
+.. code-block:: c
+   :caption: Expansion from declaring a simple type
+
+    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;
+    };
+
+The 'struct MyDevice' needs to be declared separately.
+If the type requires virtual functions to be declared in the class
+struct, then the alternative OBJECT_DECLARE_TYPE() macro can be
+used. This does the same as OBJECT_DECLARE_SIMPLE_TYPE(), but without
+the 'struct MyDeviceClass' definition.
+
+To implement the type, the OBJECT_DEFINE macro family is available.
+In the simple case the OBJECT_DEFINE_TYPE macro is suitable:
+
+.. code-block:: c
+   :caption: Defining a simple type
+
+    OBJECT_DEFINE_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE)
+
+This is equivalent to the following:
+
+.. code-block:: c
+   :caption: Expansion from defining a simple type
+
+    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);
+
+This is sufficient to get the type registered with the type
+system, and the three standard methods now need to be implemented
+along with any other logic required for the type.
+
+If the type needs to implement one or more interfaces, then the
+OBJECT_DEFINE_TYPE_WITH_INTERFACES() macro can be used instead.
+This accepts an array of interface type names.
+
+.. code-block:: c
+   :caption: Defining a simple type implementing interfaces
+
+    OBJECT_DEFINE_TYPE_WITH_INTERFACES(MyDevice, my_device,
+                                       MY_DEVICE, DEVICE,
+                                       { TYPE_USER_CREATABLE }, { NULL })
+
+If the type is not intended to be instantiated, then then
+the OBJECT_DEFINE_ABSTRACT_TYPE() macro can be used instead:
+
+.. code-block:: c
+   :caption: Defining a simple abstract type
+
+    OBJECT_DEFINE_ABSTRACT_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE)
+
+
+
+API Reference
+-------------
+
 .. kernel-doc:: include/qom/object.h
diff --git a/include/qom/object.h b/include/qom/object.h
index d839a2c39f..93b6418dbc 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -28,383 +28,6 @@ typedef struct InterfaceInfo InterfaceInfo;
 
 #define TYPE_OBJECT "object"
 
-/**
- * DOC:
- *
- * .. highlight:: c
- *
- * The QEMU Object Model provides a framework for registering user creatable
- * types and instantiating objects from those types.  QOM provides the following
- * features:
- *
- *  - System for dynamically registering types
- *  - Support for single-inheritance of types
- *  - Multiple inheritance of stateless interfaces
- *
- * .. code-block:: c
- *    :caption: Creating a minimal type
- *
- *    #include "qdev.h"
- *
- *    #define TYPE_MY_DEVICE "my-device"
- *
- *    // No new virtual functions: we can reuse the typedef for the
- *    // superclass.
- *    typedef DeviceClass MyDeviceClass;
- *    typedef struct MyDevice
- *    {
- *        DeviceState parent;
- *
- *        int reg0, reg1, reg2;
- *    } MyDevice;
- *
- *    static const TypeInfo my_device_info = {
- *        .name = TYPE_MY_DEVICE,
- *        .parent = TYPE_DEVICE,
- *        .instance_size = sizeof(MyDevice),
- *    };
- *
- *    static void my_device_register_types(void)
- *    {
- *        type_register_static(&my_device_info);
- *    }
- *
- *    type_init(my_device_register_types)
- *
- * In the above example, we create a simple type that is described by #TypeInfo.
- * #TypeInfo describes information about the type including what it inherits
- * from, the instance and class size, and constructor/destructor hooks.
- *
- * Alternatively several static types could be registered using helper macro
- * DEFINE_TYPES()
- *
- * .. code-block:: c
- *
- *    static const TypeInfo device_types_info[] = {
- *        {
- *            .name = TYPE_MY_DEVICE_A,
- *            .parent = TYPE_DEVICE,
- *            .instance_size = sizeof(MyDeviceA),
- *        },
- *        {
- *            .name = TYPE_MY_DEVICE_B,
- *            .parent = TYPE_DEVICE,
- *            .instance_size = sizeof(MyDeviceB),
- *        },
- *    };
- *
- *    DEFINE_TYPES(device_types_info)
- *
- * Every type has an #ObjectClass associated with it.  #ObjectClass derivatives
- * are instantiated dynamically but there is only ever one instance for any
- * given type.  The #ObjectClass typically holds a table of function pointers
- * for the virtual methods implemented by this type.
- *
- * Using object_new(), a new #Object derivative will be instantiated.  You can
- * cast an #Object to a subclass (or base-class) type using
- * object_dynamic_cast().  You typically want to define macro wrappers around
- * OBJECT_CHECK() and OBJECT_CLASS_CHECK() to make it easier to convert to a
- * specific type:
- *
- * .. kernel-doc messes up with the code block below because of the
- *    backslash at the end of lines.  This will be fixes if we move this
- *    content to qom.rst.
- *
- * .. code-block:: c
- *    :caption: Typecasting macros
- *
- *    #define MY_DEVICE_GET_CLASS(obj) \
- *       OBJECT_GET_CLASS(MyDeviceClass, obj, TYPE_MY_DEVICE)
- *    #define MY_DEVICE_CLASS(klass) \
- *       OBJECT_CLASS_CHECK(MyDeviceClass, klass, TYPE_MY_DEVICE)
- *    #define MY_DEVICE(obj) \
- *       OBJECT_CHECK(MyDevice, obj, TYPE_MY_DEVICE)
- *
- * Class Initialization
- * ====================
- *
- * Before an object is initialized, the class for the object must be
- * initialized.  There is only one class object for all instance objects
- * that is created lazily.
- *
- * Classes are initialized by first initializing any parent classes (if
- * necessary).  After the parent class object has initialized, it will be
- * copied into the current class object and any additional storage in the
- * class object is zero filled.
- *
- * The effect of this is that classes automatically inherit any virtual
- * function pointers that the parent class has already initialized.  All
- * other fields will be zero filled.
- *
- * Once all of the parent classes have been initialized, #TypeInfo::class_init
- * is called to let the class being instantiated provide default initialize for
- * its virtual functions.  Here is how the above example might be modified
- * to introduce an overridden virtual function:
- *
- * .. code-block:: c
- *    :caption: Overriding a virtual function
- *
- *    #include "qdev.h"
- *
- *    void my_device_class_init(ObjectClass *klass, void *class_data)
- *    {
- *        DeviceClass *dc = DEVICE_CLASS(klass);
- *        dc->reset = my_device_reset;
- *    }
- *
- *    static const TypeInfo my_device_info = {
- *        .name = TYPE_MY_DEVICE,
- *        .parent = TYPE_DEVICE,
- *        .instance_size = sizeof(MyDevice),
- *        .class_init = my_device_class_init,
- *    };
- *
- * Introducing new virtual methods requires a class to define its own
- * struct and to add a .class_size member to the #TypeInfo.  Each method
- * will also have a wrapper function to call it easily:
- *
- * .. code-block:: c
- *    :caption: Defining an abstract class
- *
- *    #include "qdev.h"
- *
- *    typedef struct MyDeviceClass
- *    {
- *        DeviceClass parent;
- *
- *        void (*frobnicate) (MyDevice *obj);
- *    } MyDeviceClass;
- *
- *    static const TypeInfo my_device_info = {
- *        .name = TYPE_MY_DEVICE,
- *        .parent = TYPE_DEVICE,
- *        .instance_size = sizeof(MyDevice),
- *        .abstract = true, // or set a default in my_device_class_init
- *        .class_size = sizeof(MyDeviceClass),
- *    };
- *
- *    void my_device_frobnicate(MyDevice *obj)
- *    {
- *        MyDeviceClass *klass = MY_DEVICE_GET_CLASS(obj);
- *
- *        klass->frobnicate(obj);
- *    }
- *
- * Interfaces
- * ==========
- *
- * Interfaces allow a limited form of multiple inheritance.  Instances are
- * similar to normal types except for the fact that are only defined by
- * their classes and never carry any state.  As a consequence, a pointer to
- * an interface instance should always be of incomplete type in order to be
- * sure it cannot be dereferenced.  That is, you should define the
- * 'typedef struct SomethingIf SomethingIf' so that you can pass around
- * ``SomethingIf *si`` arguments, but not define a ``struct SomethingIf { ... }``.
- * The only things you can validly do with a ``SomethingIf *`` are to pass it as
- * an argument to a method on its corresponding SomethingIfClass, or to
- * dynamically cast it to an object that implements the interface.
- *
- * Methods
- * =======
- *
- * A <emphasis>method</emphasis> is a function within the namespace scope of
- * a class. It usually operates on the object instance by passing it as a
- * strongly-typed first argument.
- * If it does not operate on an object instance, it is dubbed
- * <emphasis>class method</emphasis>.
- *
- * Methods cannot be overloaded. That is, the #ObjectClass and method name
- * uniquely identity the function to be called; the signature does not vary
- * except for trailing varargs.
- *
- * Methods are always <emphasis>virtual</emphasis>. Overriding a method in
- * #TypeInfo.class_init of a subclass leads to any user of the class obtained
- * via OBJECT_GET_CLASS() accessing the overridden function.
- * The original function is not automatically invoked. It is the responsibility
- * of the overriding class to determine whether and when to invoke the method
- * being overridden.
- *
- * To invoke the method being overridden, the preferred solution is to store
- * the original value in the overriding class before overriding the method.
- * This corresponds to ``{super,base}.method(...)`` in Java and C#
- * respectively; this frees the overriding class from hardcoding its parent
- * class, which someone might choose to change at some point.
- *
- * .. code-block:: c
- *    :caption: Overriding a virtual method
- *
- *    typedef struct MyState MyState;
- *
- *    typedef void (*MyDoSomething)(MyState *obj);
- *
- *    typedef struct MyClass {
- *        ObjectClass parent_class;
- *
- *        MyDoSomething do_something;
- *    } MyClass;
- *
- *    static void my_do_something(MyState *obj)
- *    {
- *        // do something
- *    }
- *
- *    static void my_class_init(ObjectClass *oc, void *data)
- *    {
- *        MyClass *mc = MY_CLASS(oc);
- *
- *        mc->do_something = my_do_something;
- *    }
- *
- *    static const TypeInfo my_type_info = {
- *        .name = TYPE_MY,
- *        .parent = TYPE_OBJECT,
- *        .instance_size = sizeof(MyState),
- *        .class_size = sizeof(MyClass),
- *        .class_init = my_class_init,
- *    };
- *
- *    typedef struct DerivedClass {
- *        MyClass parent_class;
- *
- *        MyDoSomething parent_do_something;
- *    } DerivedClass;
- *
- *    static void derived_do_something(MyState *obj)
- *    {
- *        DerivedClass *dc = DERIVED_GET_CLASS(obj);
- *
- *        // do something here
- *        dc->parent_do_something(obj);
- *        // do something else here
- *    }
- *
- *    static void derived_class_init(ObjectClass *oc, void *data)
- *    {
- *        MyClass *mc = MY_CLASS(oc);
- *        DerivedClass *dc = DERIVED_CLASS(oc);
- *
- *        dc->parent_do_something = mc->do_something;
- *        mc->do_something = derived_do_something;
- *    }
- *
- *    static const TypeInfo derived_type_info = {
- *        .name = TYPE_DERIVED,
- *        .parent = TYPE_MY,
- *        .class_size = sizeof(DerivedClass),
- *        .class_init = derived_class_init,
- *    };
- *
- * Alternatively, object_class_by_name() can be used to obtain the class and
- * its non-overridden methods for a specific type. This would correspond to
- * ``MyClass::method(...)`` in C++.
- *
- * The first example of such a QOM method was #CPUClass.reset,
- * another example is #DeviceClass.realize.
- *
- * Standard type declaration and definition macros
- * ===============================================
- *
- * A lot of the code outlined above follows a standard pattern and naming
- * convention. To reduce the amount of boilerplate code that needs to be
- * written for a new type there are two sets of macros to generate the
- * common parts in a standard format.
- *
- * A type is declared using the OBJECT_DECLARE macro family. In types
- * which do not require any virtual functions in the class, the
- * OBJECT_DECLARE_SIMPLE_TYPE macro is suitable, and is commonly placed
- * in the header file:
- *
- * .. code-block:: c
- *    :caption: Declaring a simple type
- *
- *     OBJECT_DECLARE_SIMPLE_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE)
- *
- * This is equivalent to the following:
- *
- * .. code-block:: c
- *    :caption: Expansion from declaring a simple type
- *
- *     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;
- *     };
- *
- * The 'struct MyDevice' needs to be declared separately.
- * If the type requires virtual functions to be declared in the class
- * struct, then the alternative OBJECT_DECLARE_TYPE() macro can be
- * used. This does the same as OBJECT_DECLARE_SIMPLE_TYPE(), but without
- * the 'struct MyDeviceClass' definition.
- *
- * To implement the type, the OBJECT_DEFINE macro family is available.
- * In the simple case the OBJECT_DEFINE_TYPE macro is suitable:
- *
- * .. code-block:: c
- *    :caption: Defining a simple type
- *
- *     OBJECT_DEFINE_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE)
- *
- * This is equivalent to the following:
- *
- * .. code-block:: c
- *    :caption: Expansion from defining a simple type
- *
- *     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);
- *
- * This is sufficient to get the type registered with the type
- * system, and the three standard methods now need to be implemented
- * along with any other logic required for the type.
- *
- * If the type needs to implement one or more interfaces, then the
- * OBJECT_DEFINE_TYPE_WITH_INTERFACES() macro can be used instead.
- * This accepts an array of interface type names.
- *
- * .. code-block:: c
- *    :caption: Defining a simple type implementing interfaces
- *
- *     OBJECT_DEFINE_TYPE_WITH_INTERFACES(MyDevice, my_device,
- *                                        MY_DEVICE, DEVICE,
- *                                        { TYPE_USER_CREATABLE }, { NULL })
- *
- * If the type is not intended to be instantiated, then then
- * the OBJECT_DEFINE_ABSTRACT_TYPE() macro can be used instead:
- *
- * .. code-block:: c
- *    :caption: Defining a simple abstract type
- *
- *     OBJECT_DEFINE_ABSTRACT_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE)
- */
-
-
 typedef struct ObjectProperty ObjectProperty;
 
 /**
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 75/92] hw/i386/xen: Rename X86/PC specific function as xen_hvm_init_pc()
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (73 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 74/92] docs: Move object.h overview doc comment to qom.rst Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 76/92] sysemu/xen: Add missing 'exec/cpu-common.h' header for ram_addr_t type Paolo Bonzini
                   ` (18 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <philmd@redhat.com>

xen_hvm_init() is only meanful to initialize a X86/PC machine,
rename it as xen_hvm_init_pc().

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200908155530.249806-3-philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 accel/stubs/xen-stub.c | 2 +-
 hw/i386/pc_piix.c      | 6 +++---
 hw/i386/xen/xen-hvm.c  | 2 +-
 include/hw/xen/xen.h   | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/accel/stubs/xen-stub.c b/accel/stubs/xen-stub.c
index 8ae658acff..fa3dddbce5 100644
--- a/accel/stubs/xen-stub.c
+++ b/accel/stubs/xen-stub.c
@@ -46,7 +46,7 @@ void xen_register_framebuffer(MemoryRegion *mr)
 {
 }
 
-void xen_hvm_init(PCMachineState *pcms, MemoryRegion **ram_memory)
+void xen_hvm_init_pc(PCMachineState *pcms, MemoryRegion **ram_memory)
 {
 }
 
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 32c5d95762..9eaf8d6e0d 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -117,8 +117,8 @@ static void pc_init1(MachineState *machine,
      *    so legacy non-PAE guests can get as much memory as possible in
      *    the 32bit address space below 4G.
      *
-     *  - Note that Xen has its own ram setp code in xen_ram_init(),
-     *    called via xen_hvm_init().
+     *  - Note that Xen has its own ram setup code in xen_ram_init(),
+     *    called via xen_hvm_init_pc().
      *
      * Examples:
      *    qemu -M pc-1.7 -m 4G    (old default)    -> 3584M low,  512M high
@@ -127,7 +127,7 @@ static void pc_init1(MachineState *machine,
      *    qemu -M pc,max-ram-below-4g=4G -m 3968M  -> 3968M low (=4G-128M)
      */
     if (xen_enabled()) {
-        xen_hvm_init(pcms, &ram_memory);
+        xen_hvm_init_pc(pcms, &ram_memory);
     } else {
         if (!pcms->max_ram_below_4g) {
             pcms->max_ram_below_4g = 0xe0000000; /* default: 3.5G */
diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c
index cde981bad6..49748cda3f 100644
--- a/hw/i386/xen/xen-hvm.c
+++ b/hw/i386/xen/xen-hvm.c
@@ -1395,7 +1395,7 @@ static int xen_map_ioreq_server(XenIOState *state)
     return 0;
 }
 
-void xen_hvm_init(PCMachineState *pcms, MemoryRegion **ram_memory)
+void xen_hvm_init_pc(PCMachineState *pcms, MemoryRegion **ram_memory)
 {
     MachineState *ms = MACHINE(pcms);
     unsigned int max_cpus = ms->smp.max_cpus;
diff --git a/include/hw/xen/xen.h b/include/hw/xen/xen.h
index 771dd447f2..b2b459964c 100644
--- a/include/hw/xen/xen.h
+++ b/include/hw/xen/xen.h
@@ -30,7 +30,7 @@ qemu_irq *xen_interrupt_controller_init(void);
 
 void xenstore_store_pv_console_info(int i, struct Chardev *chr);
 
-void xen_hvm_init(PCMachineState *pcms, MemoryRegion **ram_memory);
+void xen_hvm_init_pc(PCMachineState *pcms, MemoryRegion **ram_memory);
 
 void xen_register_framebuffer(struct MemoryRegion *mr);
 
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 76/92] sysemu/xen: Add missing 'exec/cpu-common.h' header for ram_addr_t type
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (74 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 75/92] hw/i386/xen: Rename X86/PC specific function as xen_hvm_init_pc() Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:22 ` [PULL 77/92] stubs: Split accelerator / hardware related stubs Paolo Bonzini
                   ` (17 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <philmd@redhat.com>

As this header use the ram_addr_t type, it has to include
"exec/cpu-common.h" to avoid odd errors such:

  include/sysemu/xen.h:35:44: error: unknown type name 'ram_addr_t'; did you mean 'in_addr_t'?
   35 | static inline void xen_hvm_modified_memory(ram_addr_t start, ram_addr_t length)
      |                                            ^~~~~~~~~~
      |                                            in_addr_t

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200908155530.249806-4-philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/sysemu/xen.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/sysemu/xen.h b/include/sysemu/xen.h
index 2c2c429ea8..0ca25697e4 100644
--- a/include/sysemu/xen.h
+++ b/include/sysemu/xen.h
@@ -8,6 +8,8 @@
 #ifndef SYSEMU_XEN_H
 #define SYSEMU_XEN_H
 
+#include "exec/cpu-common.h"
+
 #ifdef NEED_CPU_H
 # ifdef CONFIG_XEN
 #  define CONFIG_XEN_IS_POSSIBLE
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 77/92] stubs: Split accelerator / hardware related stubs
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (75 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 76/92] sysemu/xen: Add missing 'exec/cpu-common.h' header for ram_addr_t type Paolo Bonzini
@ 2020-09-24  9:22 ` Paolo Bonzini
  2020-09-24  9:23 ` [PULL 78/92] hw/xen: Split x86-specific declaration from generic hardware ones Paolo Bonzini
                   ` (16 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <philmd@redhat.com>

Move hardware stubs unrelated from the accelerator to xen-hw-stub.c.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200908155530.249806-5-philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 MAINTAINERS            |  1 +
 accel/stubs/xen-stub.c | 41 +----------------------------------
 stubs/meson.build      |  1 +
 stubs/xen-hw-stub.c    | 49 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 52 insertions(+), 40 deletions(-)
 create mode 100644 stubs/xen-hw-stub.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 9b01385484..40e6133022 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -480,6 +480,7 @@ F: include/hw/block/dataplane/xen*
 F: include/hw/xen/
 F: include/sysemu/xen.h
 F: include/sysemu/xen-mapcache.h
+F: stubs/xen-hw-stub.c
 
 Guest CPU Cores (HAXM)
 ---------------------
diff --git a/accel/stubs/xen-stub.c b/accel/stubs/xen-stub.c
index fa3dddbce5..7ba0b697f4 100644
--- a/accel/stubs/xen-stub.c
+++ b/accel/stubs/xen-stub.c
@@ -6,50 +6,11 @@
  */
 
 #include "qemu/osdep.h"
-#include "hw/xen/xen.h"
+#include "sysemu/xen.h"
 #include "qapi/qapi-commands-misc.h"
 
 bool xen_allowed;
 
-void xenstore_store_pv_console_info(int i, Chardev *chr)
-{
-}
-
-int xen_pci_slot_get_pirq(PCIDevice *pci_dev, int irq_num)
-{
-    return -1;
-}
-
-void xen_piix3_set_irq(void *opaque, int irq_num, int level)
-{
-}
-
-void xen_piix_pci_write_config_client(uint32_t address, uint32_t val, int len)
-{
-}
-
-void xen_hvm_inject_msi(uint64_t addr, uint32_t data)
-{
-}
-
-int xen_is_pirq_msi(uint32_t msi_data)
-{
-    return 0;
-}
-
-qemu_irq *xen_interrupt_controller_init(void)
-{
-    return NULL;
-}
-
-void xen_register_framebuffer(MemoryRegion *mr)
-{
-}
-
-void xen_hvm_init_pc(PCMachineState *pcms, MemoryRegion **ram_memory)
-{
-}
-
 void qmp_xen_set_global_dirty_log(bool enable, Error **errp)
 {
 }
diff --git a/stubs/meson.build b/stubs/meson.build
index e0b322bc28..5730f1d967 100644
--- a/stubs/meson.build
+++ b/stubs/meson.build
@@ -46,4 +46,5 @@ stub_ss.add(files('vm-stop.c'))
 stub_ss.add(files('win32-kbd-hook.c'))
 if have_system
   stub_ss.add(files('semihost.c'))
+  stub_ss.add(files('xen-hw-stub.c'))
 endif
diff --git a/stubs/xen-hw-stub.c b/stubs/xen-hw-stub.c
new file mode 100644
index 0000000000..d14efef49e
--- /dev/null
+++ b/stubs/xen-hw-stub.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2014       Citrix Systems UK Ltd.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include "qemu/osdep.h"
+#include "hw/xen/xen.h"
+
+void xenstore_store_pv_console_info(int i, Chardev *chr)
+{
+}
+
+int xen_pci_slot_get_pirq(PCIDevice *pci_dev, int irq_num)
+{
+    return -1;
+}
+
+void xen_piix3_set_irq(void *opaque, int irq_num, int level)
+{
+}
+
+void xen_piix_pci_write_config_client(uint32_t address, uint32_t val, int len)
+{
+}
+
+void xen_hvm_inject_msi(uint64_t addr, uint32_t data)
+{
+}
+
+int xen_is_pirq_msi(uint32_t msi_data)
+{
+    return 0;
+}
+
+qemu_irq *xen_interrupt_controller_init(void)
+{
+    return NULL;
+}
+
+void xen_register_framebuffer(MemoryRegion *mr)
+{
+}
+
+void xen_hvm_init_pc(PCMachineState *pcms, MemoryRegion **ram_memory)
+{
+}
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 78/92] hw/xen: Split x86-specific declaration from generic hardware ones
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (76 preceding siblings ...)
  2020-09-24  9:22 ` [PULL 77/92] stubs: Split accelerator / hardware related stubs Paolo Bonzini
@ 2020-09-24  9:23 ` Paolo Bonzini
  2020-09-24  9:23 ` [PULL 79/92] typedefs: Restrict PCMachineState to 'hw/i386/pc.h' Paolo Bonzini
                   ` (15 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <philmd@redhat.com>

xen_hvm_init() is restricted to the X86 architecture.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200908155530.249806-6-philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/i386/pc_piix.c        |  2 +-
 hw/i386/xen/xen-hvm.c    |  1 +
 include/hw/xen/xen-x86.h | 15 +++++++++++++++
 include/hw/xen/xen.h     |  2 --
 stubs/xen-hw-stub.c      |  1 +
 5 files changed, 18 insertions(+), 3 deletions(-)
 create mode 100644 include/hw/xen/xen-x86.h

diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 9eaf8d6e0d..7d5aa6d1ba 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -46,7 +46,7 @@
 #include "hw/sysbus.h"
 #include "sysemu/arch_init.h"
 #include "hw/i2c/smbus_eeprom.h"
-#include "hw/xen/xen.h"
+#include "hw/xen/xen-x86.h"
 #include "exec/memory.h"
 #include "exec/address-spaces.h"
 #include "hw/acpi/acpi.h"
diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c
index 49748cda3f..e03c59e53d 100644
--- a/hw/i386/xen/xen-hvm.c
+++ b/hw/i386/xen/xen-hvm.c
@@ -22,6 +22,7 @@
 #include "hw/xen/xen_common.h"
 #include "hw/xen/xen-legacy-backend.h"
 #include "hw/xen/xen-bus.h"
+#include "hw/xen/xen-x86.h"
 #include "qapi/error.h"
 #include "qapi/qapi-commands-misc.h"
 #include "qemu/error-report.h"
diff --git a/include/hw/xen/xen-x86.h b/include/hw/xen/xen-x86.h
new file mode 100644
index 0000000000..85e3db1b8d
--- /dev/null
+++ b/include/hw/xen/xen-x86.h
@@ -0,0 +1,15 @@
+/*
+ * Xen X86-specific
+ *
+ * Copyright 2020 Red Hat, Inc.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+#ifndef QEMU_HW_XEN_X86_H
+#define QEMU_HW_XEN_X86_H
+
+#include "hw/i386/pc.h"
+
+void xen_hvm_init_pc(PCMachineState *pcms, MemoryRegion **ram_memory);
+
+#endif /* QEMU_HW_XEN_X86_H */
diff --git a/include/hw/xen/xen.h b/include/hw/xen/xen.h
index b2b459964c..1406648ca5 100644
--- a/include/hw/xen/xen.h
+++ b/include/hw/xen/xen.h
@@ -30,8 +30,6 @@ qemu_irq *xen_interrupt_controller_init(void);
 
 void xenstore_store_pv_console_info(int i, struct Chardev *chr);
 
-void xen_hvm_init_pc(PCMachineState *pcms, MemoryRegion **ram_memory);
-
 void xen_register_framebuffer(struct MemoryRegion *mr);
 
 #endif /* QEMU_HW_XEN_H */
diff --git a/stubs/xen-hw-stub.c b/stubs/xen-hw-stub.c
index d14efef49e..2ea8190921 100644
--- a/stubs/xen-hw-stub.c
+++ b/stubs/xen-hw-stub.c
@@ -8,6 +8,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/xen/xen.h"
+#include "hw/xen/xen-x86.h"
 
 void xenstore_store_pv_console_info(int i, Chardev *chr)
 {
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 79/92] typedefs: Restrict PCMachineState to 'hw/i386/pc.h'
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (77 preceding siblings ...)
  2020-09-24  9:23 ` [PULL 78/92] hw/xen: Split x86-specific declaration from generic hardware ones Paolo Bonzini
@ 2020-09-24  9:23 ` Paolo Bonzini
  2020-09-24  9:23 ` [PULL 80/92] checkpatch: Detect '%#' or '%0#' in printf-style format strings Paolo Bonzini
                   ` (14 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <philmd@redhat.com>

The PCMachineState type is only used under hw/i386/.
We don't need to forward-declare it for all architectures,
restrict it to the X86 one.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200908155530.249806-7-philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/hw/i386/pc.h    | 4 ++--
 include/qemu/typedefs.h | 1 -
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index c71b02cafd..8699029053 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -20,7 +20,7 @@
  * @boot_cpus: number of present VCPUs
  * @smp_dies: number of dies per one package
  */
-struct PCMachineState {
+typedef struct PCMachineState {
     /*< private >*/
     X86MachineState parent_obj;
 
@@ -50,7 +50,7 @@ struct PCMachineState {
 
     /* ACPI Memory hotplug IO base address */
     hwaddr memhp_io_base;
-};
+} PCMachineState;
 
 #define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device"
 #define PC_MACHINE_MAX_RAM_BELOW_4G "max-ram-below-4g"
diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h
index 427027a970..6281eae3b5 100644
--- a/include/qemu/typedefs.h
+++ b/include/qemu/typedefs.h
@@ -90,7 +90,6 @@ typedef struct PCIExpressDevice PCIExpressDevice;
 typedef struct PCIExpressHost PCIExpressHost;
 typedef struct PCIHostDeviceAddress PCIHostDeviceAddress;
 typedef struct PCIHostState PCIHostState;
-typedef struct PCMachineState PCMachineState;
 typedef struct PostcopyDiscardState PostcopyDiscardState;
 typedef struct Property Property;
 typedef struct PropertyInfo PropertyInfo;
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 80/92] checkpatch: Detect '%#' or '%0#' in printf-style format strings
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (78 preceding siblings ...)
  2020-09-24  9:23 ` [PULL 79/92] typedefs: Restrict PCMachineState to 'hw/i386/pc.h' Paolo Bonzini
@ 2020-09-24  9:23 ` Paolo Bonzini
  2020-09-24  9:23 ` [PULL 81/92] helper_syscall x86_64: clear exception_is_int Paolo Bonzini
                   ` (13 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: Dov Murik, Philippe Mathieu-Daudé

From: Dov Murik <dovmurik@linux.vnet.ibm.com>

According to the coding style document, we should use literal '0x' prefix
instead of printf's '#' flag (which appears as '%#' or '%0#' in the format
string).  Add a checkpatch rule to enforce that.

Note that checkpatch already had a similar rule for trace-events files.

Example usage:

  $ scripts/checkpatch.pl --file chardev/baum.c
  ...
  ERROR: Don't use '#' flag of printf format ('%#') in format strings, use '0x' prefix instead
  #366: FILE: chardev/baum.c:366:
  +            DPRINTF("Broken packet %#2x, tossing\n", req); \
  ...
  ERROR: Don't use '#' flag of printf format ('%#') in format strings, use '0x' prefix instead
  #472: FILE: chardev/baum.c:472:
  +        DPRINTF("unrecognized request %0#2x\n", req);
  ...

Signed-off-by: Dov Murik <dovmurik@linux.vnet.ibm.com>
Message-Id: <20200914172623.72955-1-dovmurik@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 scripts/checkpatch.pl | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 22bb634c8e..83967d9c6e 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2880,14 +2880,20 @@ sub process {
 				$herecurr);
 		}
 
-# check for %L{u,d,i} in strings
+# format strings checks
 		my $string;
 		while ($line =~ /(?:^|")([X\t]*)(?:"|$)/g) {
 			$string = substr($rawline, $-[1], $+[1] - $-[1]);
 			$string =~ s/%%/__/g;
+			# check for %L{u,d,i} in strings
 			if ($string =~ /(?<!%)%L[udi]/) {
 				ERROR("\%Ld/%Lu are not-standard C, use %lld/%llu\n" . $herecurr);
-				last;
+			}
+			# check for %# or %0# in printf-style format strings
+			if ($string =~ /(?<!%)%0?#/) {
+				ERROR("Don't use '#' flag of printf format " .
+				      "('%#') in format strings, use '0x' " .
+				      "prefix instead\n" . $herecurr);
 			}
 		}
 
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 81/92] helper_syscall x86_64: clear exception_is_int
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (79 preceding siblings ...)
  2020-09-24  9:23 ` [PULL 80/92] checkpatch: Detect '%#' or '%0#' in printf-style format strings Paolo Bonzini
@ 2020-09-24  9:23 ` Paolo Bonzini
  2020-09-24  9:23 ` [PULL 82/92] target/i386: Fix VM migration when interrupt based APF is enabled Paolo Bonzini
                   ` (12 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: Douglas Crosher

From: Douglas Crosher <dtc-ubuntu@scieneer.com>

The exception_is_int flag may be set on entry to helper_syscall,
e.g. after a prior interrupt that has returned, and processing
EXCP_SYSCALL as an interrupt causes it to fail so clear this flag.

Signed-off-by: Douglas Crosher <dtc-ubuntu@scieneer.com>
Message-Id: <a7dab33e-eda6-f988-52e9-f3d32db7538d@scieneer.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target/i386/seg_helper.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/target/i386/seg_helper.c b/target/i386/seg_helper.c
index b96de068ca..be88938c2a 100644
--- a/target/i386/seg_helper.c
+++ b/target/i386/seg_helper.c
@@ -975,6 +975,7 @@ void helper_syscall(CPUX86State *env, int next_eip_addend)
     CPUState *cs = env_cpu(env);
 
     cs->exception_index = EXCP_SYSCALL;
+    env->exception_is_int = 0;
     env->exception_next_eip = env->eip + next_eip_addend;
     cpu_loop_exit(cs);
 }
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 82/92] target/i386: Fix VM migration when interrupt based APF is enabled
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (80 preceding siblings ...)
  2020-09-24  9:23 ` [PULL 81/92] helper_syscall x86_64: clear exception_is_int Paolo Bonzini
@ 2020-09-24  9:23 ` Paolo Bonzini
  2020-09-24  9:23 ` [PULL 83/92] target/i386: always create kvmclock device Paolo Bonzini
                   ` (11 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: Vitaly Kuznetsov

From: Vitaly Kuznetsov <vkuznets@redhat.com>

VM with  interrupt based APF enabled fails to migrate:
qemu-system-x86_64: error: failed to set MSR 0x4b564d02 to 0xf3

We have two issues:
1) There is a typo in kvm_put_msrs() and we write async_pf_int_msr
to MSR_KVM_ASYNC_PF_EN (instead of MSR_KVM_ASYNC_PF_INT)

2) We restore MSR_KVM_ASYNC_PF_EN before MSR_KVM_ASYNC_PF_INT is set
and this violates the check in KVM.

Re-order MSR_KVM_ASYNC_PF_EN/MSR_KVM_ASYNC_PF_INT setting (and
kvm_get_msrs() for consistency) and fix the typo.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Message-Id: <20200917102316.814804-1-vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target/i386/kvm.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index 06c2025c67..b327e8706f 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -2819,12 +2819,12 @@ static int kvm_put_msrs(X86CPU *cpu, int level)
         kvm_msr_entry_add(cpu, MSR_IA32_TSC, env->tsc);
         kvm_msr_entry_add(cpu, MSR_KVM_SYSTEM_TIME, env->system_time_msr);
         kvm_msr_entry_add(cpu, MSR_KVM_WALL_CLOCK, env->wall_clock_msr);
+        if (env->features[FEAT_KVM] & (1 << KVM_FEATURE_ASYNC_PF_INT)) {
+            kvm_msr_entry_add(cpu, MSR_KVM_ASYNC_PF_INT, env->async_pf_int_msr);
+        }
         if (env->features[FEAT_KVM] & (1 << KVM_FEATURE_ASYNC_PF)) {
             kvm_msr_entry_add(cpu, MSR_KVM_ASYNC_PF_EN, env->async_pf_en_msr);
         }
-        if (env->features[FEAT_KVM] & (1 << KVM_FEATURE_ASYNC_PF_INT)) {
-            kvm_msr_entry_add(cpu, MSR_KVM_ASYNC_PF_EN, env->async_pf_int_msr);
-        }
         if (env->features[FEAT_KVM] & (1 << KVM_FEATURE_PV_EOI)) {
             kvm_msr_entry_add(cpu, MSR_KVM_PV_EOI_EN, env->pv_eoi_en_msr);
         }
@@ -3207,12 +3207,12 @@ static int kvm_get_msrs(X86CPU *cpu)
 #endif
     kvm_msr_entry_add(cpu, MSR_KVM_SYSTEM_TIME, 0);
     kvm_msr_entry_add(cpu, MSR_KVM_WALL_CLOCK, 0);
-    if (env->features[FEAT_KVM] & (1 << KVM_FEATURE_ASYNC_PF)) {
-        kvm_msr_entry_add(cpu, MSR_KVM_ASYNC_PF_EN, 0);
-    }
     if (env->features[FEAT_KVM] & (1 << KVM_FEATURE_ASYNC_PF_INT)) {
         kvm_msr_entry_add(cpu, MSR_KVM_ASYNC_PF_INT, 0);
     }
+    if (env->features[FEAT_KVM] & (1 << KVM_FEATURE_ASYNC_PF)) {
+        kvm_msr_entry_add(cpu, MSR_KVM_ASYNC_PF_EN, 0);
+    }
     if (env->features[FEAT_KVM] & (1 << KVM_FEATURE_PV_EOI)) {
         kvm_msr_entry_add(cpu, MSR_KVM_PV_EOI_EN, 0);
     }
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 83/92] target/i386: always create kvmclock device
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (81 preceding siblings ...)
  2020-09-24  9:23 ` [PULL 82/92] target/i386: Fix VM migration when interrupt based APF is enabled Paolo Bonzini
@ 2020-09-24  9:23 ` Paolo Bonzini
  2020-09-24  9:23 ` [PULL 84/92] bios-tables-test: Remove kernel-irqchip=off option Paolo Bonzini
                   ` (10 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: Antoine Damhet, Vitaly Kuznetsov

From: Vitaly Kuznetsov <vkuznets@redhat.com>

QEMU's kvmclock device is only created when KVM PV feature bits for
kvmclock (KVM_FEATURE_CLOCKSOURCE/KVM_FEATURE_CLOCKSOURCE2) are
exposed to the guest. With 'kvm=off' cpu flag the device is not
created and we don't call KVM_GET_CLOCK/KVM_SET_CLOCK upon migration.
It was reported that without these call at least Hyper-V TSC page
clocksouce (which can be enabled independently) gets broken after
migration.

Switch to creating kvmclock QEMU device unconditionally, it seems
to always make sense to call KVM_GET_CLOCK/KVM_SET_CLOCK on migration.
Use KVM_CAP_ADJUST_CLOCK check instead of CPUID feature bits.

Reported-by: Antoine Damhet <antoine.damhet@blade-group.com>
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Message-Id: <20200922151934.899555-1-vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/i386/kvm/clock.c    | 7 +++++--
 hw/i386/microvm.c      | 2 +-
 hw/i386/pc.c           | 1 +
 hw/i386/pc_piix.c      | 7 +++++--
 hw/i386/pc_q35.c       | 5 ++++-
 include/hw/i386/pc.h   | 3 +++
 include/hw/kvm/clock.h | 4 ++--
 target/i386/kvm.c      | 5 +++++
 target/i386/kvm_i386.h | 1 +
 9 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c
index 7b296ae192..24fe5091b6 100644
--- a/hw/i386/kvm/clock.c
+++ b/hw/i386/kvm/clock.c
@@ -329,11 +329,14 @@ static const TypeInfo kvmclock_info = {
 };
 
 /* Note: Must be called after VCPU initialization. */
-void kvmclock_create(void)
+void kvmclock_create(bool create_always)
 {
     X86CPU *cpu = X86_CPU(first_cpu);
 
-    if (kvm_enabled() &&
+    if (!kvm_enabled() || !kvm_has_adjust_clock())
+        return;
+
+    if (create_always ||
         cpu->env.features[FEAT_KVM] & ((1ULL << KVM_FEATURE_CLOCKSOURCE) |
                                        (1ULL << KVM_FEATURE_CLOCKSOURCE2))) {
         sysbus_create_simple(TYPE_KVM_CLOCK, -1, NULL);
diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c
index 60d3272230..aedcae3426 100644
--- a/hw/i386/microvm.c
+++ b/hw/i386/microvm.c
@@ -125,7 +125,7 @@ static void microvm_devices_init(MicrovmMachineState *mms)
 
     ioapic_init_gsi(gsi_state, "machine");
 
-    kvmclock_create();
+    kvmclock_create(true);
 
     mms->virtio_irq_base = x86_machine_is_acpi_enabled(x86ms) ? 16 : 5;
     for (i = 0; i < VIRTIO_NUM_TRANSPORTS; i++) {
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 50e8317342..da2ebc3fa0 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1655,6 +1655,7 @@ static void pc_machine_class_init(ObjectClass *oc, void *data)
     pcmc->acpi_data_size = 0x20000 + 0x8000;
     pcmc->linuxboot_dma_enabled = true;
     pcmc->pvh_enabled = true;
+    pcmc->kvmclock_create_always = true;
     assert(!mc->get_hotplug_handler);
     mc->get_hotplug_handler = pc_get_hotplug_handler;
     mc->hotplug_allowed = pc_hotplug_allowed;
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 7d5aa6d1ba..3c2ae0612b 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -158,8 +158,8 @@ static void pc_init1(MachineState *machine,
 
     x86_cpus_init(x86ms, pcmc->default_cpu_version);
 
-    if (kvm_enabled() && pcmc->kvmclock_enabled) {
-        kvmclock_create();
+    if (pcmc->kvmclock_enabled) {
+        kvmclock_create(pcmc->kvmclock_create_always);
     }
 
     if (pcmc->pci_enabled) {
@@ -440,11 +440,14 @@ DEFINE_I440FX_MACHINE(v5_2, "pc-i440fx-5.2", NULL,
 
 static void pc_i440fx_5_1_machine_options(MachineClass *m)
 {
+    PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
+
     pc_i440fx_5_2_machine_options(m);
     m->alias = NULL;
     m->is_default = false;
     compat_props_add(m->compat_props, hw_compat_5_1, hw_compat_5_1_len);
     compat_props_add(m->compat_props, pc_compat_5_1, pc_compat_5_1_len);
+    pcmc->kvmclock_create_always = false;
 }
 
 DEFINE_I440FX_MACHINE(v5_1, "pc-i440fx-5.1", NULL,
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index a4a37b26c5..b885c93aef 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -179,7 +179,7 @@ static void pc_q35_init(MachineState *machine)
 
     x86_cpus_init(x86ms, pcmc->default_cpu_version);
 
-    kvmclock_create();
+    kvmclock_create(pcmc->kvmclock_create_always);
 
     /* pci enabled */
     if (pcmc->pci_enabled) {
@@ -357,10 +357,13 @@ DEFINE_Q35_MACHINE(v5_2, "pc-q35-5.2", NULL,
 
 static void pc_q35_5_1_machine_options(MachineClass *m)
 {
+    PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
+
     pc_q35_5_2_machine_options(m);
     m->alias = NULL;
     compat_props_add(m->compat_props, hw_compat_5_1, hw_compat_5_1_len);
     compat_props_add(m->compat_props, pc_compat_5_1, pc_compat_5_1_len);
+    pcmc->kvmclock_create_always = false;
 }
 
 DEFINE_Q35_MACHINE(v5_1, "pc-q35-5.1", NULL,
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 8699029053..84639d0ebc 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -118,6 +118,9 @@ struct PCMachineClass {
 
     /* use PVH to load kernels that support this feature */
     bool pvh_enabled;
+
+    /* create kvmclock device even when KVM PV features are not exposed */
+    bool kvmclock_create_always;
 };
 
 #define TYPE_PC_MACHINE "generic-pc-machine"
diff --git a/include/hw/kvm/clock.h b/include/hw/kvm/clock.h
index 81c66b2302..7994071c4f 100644
--- a/include/hw/kvm/clock.h
+++ b/include/hw/kvm/clock.h
@@ -15,11 +15,11 @@
 
 #ifdef CONFIG_KVM
 
-void kvmclock_create(void);
+void kvmclock_create(bool create_always);
 
 #else /* CONFIG_KVM */
 
-static inline void kvmclock_create(void)
+static inline void kvmclock_create(bool create_always)
 {
 }
 
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index b327e8706f..4fc6e8b9d5 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -143,6 +143,11 @@ bool kvm_has_adjust_clock_stable(void)
     return (ret == KVM_CLOCK_TSC_STABLE);
 }
 
+bool kvm_has_adjust_clock(void)
+{
+    return kvm_check_extension(kvm_state, KVM_CAP_ADJUST_CLOCK);
+}
+
 bool kvm_has_exception_payload(void)
 {
     return has_exception_payload;
diff --git a/target/i386/kvm_i386.h b/target/i386/kvm_i386.h
index 064b8798a2..0fce4e51d2 100644
--- a/target/i386/kvm_i386.h
+++ b/target/i386/kvm_i386.h
@@ -34,6 +34,7 @@
 
 bool kvm_allows_irq0_override(void);
 bool kvm_has_smm(void);
+bool kvm_has_adjust_clock(void);
 bool kvm_has_adjust_clock_stable(void);
 bool kvm_has_exception_payload(void);
 void kvm_synchronize_all_tsc(void);
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 84/92] bios-tables-test: Remove kernel-irqchip=off option
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (82 preceding siblings ...)
  2020-09-24  9:23 ` [PULL 83/92] target/i386: always create kvmclock device Paolo Bonzini
@ 2020-09-24  9:23 ` Paolo Bonzini
  2020-09-24  9:23 ` [PULL 85/92] target/i386: kvm: do not use kvm_check_extension to find paravirtual capabilities Paolo Bonzini
                   ` (9 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: Eduardo Habkost

From: Eduardo Habkost <ehabkost@redhat.com>

We don't need to use kernel-irqchip=off for irq0 override if IRQ
routing is supported by the host, which is the case since 2009
(IRQ routing was added to KVM in Linux v2.6.30).

This is a more straightforward fix for Launchpad bug #1896263, as
it doesn't require increasing the complexity of the MSR code.
kernel-irqchip=off is for debugging only and there's no need to
increase the complexity of the code just to work around an issue
that was already fixed in the kernel.

Fixes: https://bugs.launchpad.net/bugs/1896263
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20200922194732.2100510-1-ehabkost@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/qtest/bios-tables-test.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
index a9c8d478ae..27e8f0a1cb 100644
--- a/tests/qtest/bios-tables-test.c
+++ b/tests/qtest/bios-tables-test.c
@@ -663,8 +663,7 @@ static void test_acpi_one(const char *params, test_data *data)
             data->uefi_fl1, data->uefi_fl2, data->cd, params ? params : "");
 
     } else {
-        /* Disable kernel irqchip to be able to override apic irq0. */
-        args = g_strdup_printf("-machine %s,kernel-irqchip=off %s -accel tcg "
+        args = g_strdup_printf("-machine %s %s -accel tcg "
             "-net none -display none %s "
             "-drive id=hd0,if=none,file=%s,format=raw "
             "-device %s,drive=hd0 ",
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 85/92] target/i386: kvm: do not use kvm_check_extension to find paravirtual capabilities
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (83 preceding siblings ...)
  2020-09-24  9:23 ` [PULL 84/92] bios-tables-test: Remove kernel-irqchip=off option Paolo Bonzini
@ 2020-09-24  9:23 ` Paolo Bonzini
  2020-09-24  9:23 ` [PULL 86/92] net/can: Initial host SocketCan support for CAN FD Paolo Bonzini
                   ` (8 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:23 UTC (permalink / raw)
  To: qemu-devel

Paravirtualized features have been listed in KVM_GET_SUPPORTED_CPUID since
Linux 2.6.35 (commit 84478c829d0f, "KVM: x86: export paravirtual cpuid flags
in KVM_GET_SUPPORTED_CPUID", 2010-05-19).  It has been more than 10 years,
so remove the fallback code.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target/i386/kvm.c | 32 --------------------------------
 1 file changed, 32 deletions(-)

diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index 4fc6e8b9d5..f6dae4cfb6 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -284,30 +284,6 @@ static struct kvm_cpuid2 *get_supported_cpuid(KVMState *s)
     return cpuid;
 }
 
-static const struct kvm_para_features {
-    int cap;
-    int feature;
-} para_features[] = {
-    { KVM_CAP_CLOCKSOURCE, KVM_FEATURE_CLOCKSOURCE },
-    { KVM_CAP_NOP_IO_DELAY, KVM_FEATURE_NOP_IO_DELAY },
-    { KVM_CAP_PV_MMU, KVM_FEATURE_MMU_OP },
-    { KVM_CAP_ASYNC_PF, KVM_FEATURE_ASYNC_PF },
-    { KVM_CAP_ASYNC_PF_INT, KVM_FEATURE_ASYNC_PF_INT },
-};
-
-static int get_para_features(KVMState *s)
-{
-    int i, features = 0;
-
-    for (i = 0; i < ARRAY_SIZE(para_features); i++) {
-        if (kvm_check_extension(s, para_features[i].cap)) {
-            features |= (1 << para_features[i].feature);
-        }
-    }
-
-    return features;
-}
-
 static bool host_tsx_broken(void)
 {
     int family, model, stepping;\
@@ -367,13 +343,11 @@ uint32_t kvm_arch_get_supported_cpuid(KVMState *s, uint32_t function,
     struct kvm_cpuid2 *cpuid;
     uint32_t ret = 0;
     uint32_t cpuid_1_edx;
-    bool found = false;
 
     cpuid = get_supported_cpuid(s);
 
     struct kvm_cpuid_entry2 *entry = cpuid_find_entry(cpuid, function, index);
     if (entry) {
-        found = true;
         ret = cpuid_entry_get_reg(entry, reg);
     }
 
@@ -448,12 +422,6 @@ uint32_t kvm_arch_get_supported_cpuid(KVMState *s, uint32_t function,
         }
     } else if (function == KVM_CPUID_FEATURES && reg == R_EDX) {
         ret |= 1U << KVM_HINTS_REALTIME;
-        found = 1;
-    }
-
-    /* fallback for older kernels */
-    if ((function == KVM_CPUID_FEATURES) && !found) {
-        ret = get_para_features(s);
     }
 
     return ret;
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 86/92] net/can: Initial host SocketCan support for CAN FD.
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (84 preceding siblings ...)
  2020-09-24  9:23 ` [PULL 85/92] target/i386: kvm: do not use kvm_check_extension to find paravirtual capabilities Paolo Bonzini
@ 2020-09-24  9:23 ` Paolo Bonzini
  2020-09-24  9:23 ` [PULL 87/92] hw/net/can: sja1000 ignore CAN FD frames Paolo Bonzini
                   ` (7 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: Vikram Garhwal, Jan Charvat, Pavel Pisa

From: Jan Charvat <charvj10@fel.cvut.cz>

Signed-off-by: Jan Charvat <charvj10@fel.cvut.cz>
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Reviewed-by: Vikram Garhwal <fnu.vikram@xilinx.com>
Message-Id: <41383d4eb3f35586c696a8e29c4dff4031a81338.1600069689.git.pisa@cmp.felk.cvut.cz>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/net/can/can_sja1000.c |  2 ++
 include/net/can_emu.h    |  8 ++++++-
 net/can/can_socketcan.c  | 47 +++++++++++++++++++++++++++++++++++++---
 3 files changed, 53 insertions(+), 4 deletions(-)

diff --git a/hw/net/can/can_sja1000.c b/hw/net/can/can_sja1000.c
index 299932998a..ec66d4232d 100644
--- a/hw/net/can/can_sja1000.c
+++ b/hw/net/can/can_sja1000.c
@@ -268,6 +268,7 @@ static void buff2frame_pel(const uint8_t *buff, qemu_can_frame *frame)
 {
     uint8_t i;
 
+    frame->flags = 0;
     frame->can_id = 0;
     if (buff[0] & 0x40) { /* RTR */
         frame->can_id = QEMU_CAN_RTR_FLAG;
@@ -303,6 +304,7 @@ static void buff2frame_bas(const uint8_t *buff, qemu_can_frame *frame)
 {
     uint8_t i;
 
+    frame->flags = 0;
     frame->can_id = ((buff[0] << 3) & (0xff << 3)) + ((buff[1] >> 5) & 0x07);
     if (buff[1] & 0x10) { /* RTR */
         frame->can_id = QEMU_CAN_RTR_FLAG;
diff --git a/include/net/can_emu.h b/include/net/can_emu.h
index 743c6647c1..cab98ee8ec 100644
--- a/include/net/can_emu.h
+++ b/include/net/can_emu.h
@@ -46,7 +46,8 @@ typedef uint32_t qemu_canid_t;
 typedef struct qemu_can_frame {
     qemu_canid_t    can_id;  /* 32 bit CAN_ID + EFF/RTR/ERR flags */
     uint8_t         can_dlc; /* data length code: 0 .. 8 */
-    uint8_t         data[8] QEMU_ALIGNED(8);
+    uint8_t         flags;
+    uint8_t         data[64] QEMU_ALIGNED(8);
 } qemu_can_frame;
 
 /* Keep defines for QEMU separate from Linux ones for now */
@@ -58,6 +59,10 @@ typedef struct qemu_can_frame {
 #define QEMU_CAN_SFF_MASK 0x000007FFU /* standard frame format (SFF) */
 #define QEMU_CAN_EFF_MASK 0x1FFFFFFFU /* extended frame format (EFF) */
 
+#define QEMU_CAN_FRMF_BRS     0x01 /* bit rate switch (2nd bitrate for data) */
+#define QEMU_CAN_FRMF_ESI     0x02 /* error state ind. of transmitting node */
+#define QEMU_CAN_FRMF_TYPE_FD 0x10 /* internal bit ind. of CAN FD frame */
+
 /**
  * struct qemu_can_filter - CAN ID based filter in can_register().
  * @can_id:   relevant bits of CAN ID which are not masked out.
@@ -97,6 +102,7 @@ struct CanBusClientState {
     char *model;
     char *name;
     void (*destructor)(CanBusClientState *);
+    bool fd_mode;
 };
 
 #define TYPE_CAN_BUS "can-bus"
diff --git a/net/can/can_socketcan.c b/net/can/can_socketcan.c
index ce8c2549ed..92b1f79385 100644
--- a/net/can/can_socketcan.c
+++ b/net/can/can_socketcan.c
@@ -103,6 +103,14 @@ static void can_host_socketcan_read(void *opaque)
         return;
     }
 
+    if (!ch->bus_client.fd_mode) {
+        c->buf[0].flags = 0;
+    } else {
+        if (c->bufcnt > CAN_MTU) {
+            c->buf[0].flags |= QEMU_CAN_FRMF_TYPE_FD;
+        }
+    }
+
     can_bus_client_send(&ch->bus_client, c->buf, 1);
 
     if (DEBUG_CAN) {
@@ -121,12 +129,21 @@ static ssize_t can_host_socketcan_receive(CanBusClientState *client,
     CanHostState *ch = container_of(client, CanHostState, bus_client);
     CanHostSocketCAN *c = CAN_HOST_SOCKETCAN(ch);
 
-    size_t len = sizeof(qemu_can_frame);
+    size_t len;
     int res;
 
     if (c->fd < 0) {
         return -1;
     }
+    if (frames->flags & QEMU_CAN_FRMF_TYPE_FD) {
+        if (!ch->bus_client.fd_mode) {
+            return 0;
+        }
+        len = CANFD_MTU;
+    } else {
+        len = CAN_MTU;
+
+    }
 
     res = write(c->fd, frames, len);
 
@@ -172,6 +189,8 @@ static void can_host_socketcan_connect(CanHostState *ch, Error **errp)
 {
     CanHostSocketCAN *c = CAN_HOST_SOCKETCAN(ch);
     int s; /* can raw socket */
+    int mtu;
+    int enable_canfd = 1;
     struct sockaddr_can addr;
     struct ifreq ifr;
 
@@ -185,13 +204,34 @@ static void can_host_socketcan_connect(CanHostState *ch, Error **errp)
     addr.can_family = AF_CAN;
     memset(&ifr.ifr_name, 0, sizeof(ifr.ifr_name));
     strcpy(ifr.ifr_name, c->ifname);
+    /* check if the frame fits into the CAN netdevice */
     if (ioctl(s, SIOCGIFINDEX, &ifr) < 0) {
         error_setg_errno(errp, errno,
-                         "SocketCAN host interface %s not available", c->ifname);
+                         "SocketCAN host interface %s not available",
+                         c->ifname);
         goto fail;
     }
     addr.can_ifindex = ifr.ifr_ifindex;
 
+    if (ioctl(s, SIOCGIFMTU, &ifr) < 0) {
+        error_setg_errno(errp, errno,
+                         "SocketCAN host interface %s SIOCGIFMTU failed",
+                         c->ifname);
+        goto fail;
+    }
+    mtu = ifr.ifr_mtu;
+
+    if (mtu >= CANFD_MTU) {
+        /* interface is ok - try to switch the socket into CAN FD mode */
+        if (setsockopt(s, SOL_CAN_RAW, CAN_RAW_FD_FRAMES,
+                        &enable_canfd, sizeof(enable_canfd))) {
+            warn_report("SocketCAN host interface %s enabling CAN FD failed",
+                        c->ifname);
+        } else {
+            c->parent.bus_client.fd_mode = true;
+        }
+    }
+
     c->err_mask = 0xffffffff; /* Receive error frame. */
     setsockopt(s, SOL_CAN_RAW, CAN_RAW_ERR_FILTER,
                    &c->err_mask, sizeof(c->err_mask));
@@ -232,7 +272,8 @@ static char *can_host_socketcan_get_if(Object *obj, Error **errp)
     return g_strdup(c->ifname);
 }
 
-static void can_host_socketcan_set_if(Object *obj, const char *value, Error **errp)
+static void can_host_socketcan_set_if(Object *obj, const char *value,
+                                      Error **errp)
 {
     CanHostSocketCAN *c = CAN_HOST_SOCKETCAN(obj);
     struct ifreq ifr;
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 87/92] hw/net/can: sja1000 ignore CAN FD frames
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (85 preceding siblings ...)
  2020-09-24  9:23 ` [PULL 86/92] net/can: Initial host SocketCan support for CAN FD Paolo Bonzini
@ 2020-09-24  9:23 ` Paolo Bonzini
  2020-09-24  9:23 ` [PULL 88/92] net/can: Add can_dlc2len and can_len2dlc for CAN FD Paolo Bonzini
                   ` (6 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: Vikram Garhwal, Jan Charvat, Pavel Pisa

From: Jan Charvat <charvj10@fel.cvut.cz>

Signed-off-by: Jan Charvat <charvj10@fel.cvut.cz>
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Reviewed-by: Vikram Garhwal <fnu.vikram@xilinx.com>
Message-Id: <48d9ebf6b64e7652851c12fe4566e06b44803372.1600069689.git.pisa@cmp.felk.cvut.cz>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/net/can/can_sja1000.c | 29 +++++++++++++++++++++++------
 1 file changed, 23 insertions(+), 6 deletions(-)

diff --git a/hw/net/can/can_sja1000.c b/hw/net/can/can_sja1000.c
index ec66d4232d..42d2f99dfb 100644
--- a/hw/net/can/can_sja1000.c
+++ b/hw/net/can/can_sja1000.c
@@ -323,11 +323,16 @@ static void buff2frame_bas(const uint8_t *buff, qemu_can_frame *frame)
 static int frame2buff_pel(const qemu_can_frame *frame, uint8_t *buff)
 {
     int i;
+    int dlen = frame->can_dlc;
 
     if (frame->can_id & QEMU_CAN_ERR_FLAG) { /* error frame, NOT support now. */
         return -1;
     }
 
+    if (dlen > 8) {
+        return -1;
+    }
+
     buff[0] = 0x0f & frame->can_dlc; /* DLC */
     if (frame->can_id & QEMU_CAN_RTR_FLAG) { /* RTR */
         buff[0] |= (1 << 6);
@@ -338,18 +343,18 @@ static int frame2buff_pel(const qemu_can_frame *frame, uint8_t *buff)
         buff[2] = extract32(frame->can_id, 13, 8); /* ID.20~ID.13 */
         buff[3] = extract32(frame->can_id, 5, 8);  /* ID.12~ID.05 */
         buff[4] = extract32(frame->can_id, 0, 5) << 3; /* ID.04~ID.00,xxx */
-        for (i = 0; i < frame->can_dlc; i++) {
+        for (i = 0; i < dlen; i++) {
             buff[5 + i] = frame->data[i];
         }
-        return frame->can_dlc + 5;
+        return dlen + 5;
     } else { /* SFF */
         buff[1] = extract32(frame->can_id, 3, 8); /* ID.10~ID.03 */
         buff[2] = extract32(frame->can_id, 0, 3) << 5; /* ID.02~ID.00,xxxxx */
-        for (i = 0; i < frame->can_dlc; i++) {
+        for (i = 0; i < dlen; i++) {
             buff[3 + i] = frame->data[i];
         }
 
-        return frame->can_dlc + 3;
+        return dlen + 3;
     }
 
     return -1;
@@ -358,6 +363,7 @@ static int frame2buff_pel(const qemu_can_frame *frame, uint8_t *buff)
 static int frame2buff_bas(const qemu_can_frame *frame, uint8_t *buff)
 {
     int i;
+    int dlen = frame->can_dlc;
 
      /*
       * EFF, no support for BasicMode
@@ -369,17 +375,21 @@ static int frame2buff_bas(const qemu_can_frame *frame, uint8_t *buff)
         return -1;
     }
 
+    if (dlen > 8) {
+        return -1;
+    }
+
     buff[0] = extract32(frame->can_id, 3, 8); /* ID.10~ID.03 */
     buff[1] = extract32(frame->can_id, 0, 3) << 5; /* ID.02~ID.00,xxxxx */
     if (frame->can_id & QEMU_CAN_RTR_FLAG) { /* RTR */
         buff[1] |= (1 << 4);
     }
     buff[1] |= frame->can_dlc & 0x0f;
-    for (i = 0; i < frame->can_dlc; i++) {
+    for (i = 0; i < dlen; i++) {
         buff[2 + i] = frame->data[i];
     }
 
-    return frame->can_dlc + 2;
+    return dlen + 2;
 }
 
 static void can_sja_update_pel_irq(CanSJA1000State *s)
@@ -766,6 +776,13 @@ ssize_t can_sja_receive(CanBusClientState *client, const qemu_can_frame *frames,
     if (frames_cnt <= 0) {
         return 0;
     }
+    if (frame->flags & QEMU_CAN_FRMF_TYPE_FD) {
+        if (DEBUG_FILTER) {
+            can_display_msg("[cansja]: ignor fd frame ", frame);
+        }
+        return 1;
+    }
+
     if (DEBUG_FILTER) {
         can_display_msg("[cansja]: receive ", frame);
     }
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 88/92] net/can: Add can_dlc2len and can_len2dlc for CAN FD.
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (86 preceding siblings ...)
  2020-09-24  9:23 ` [PULL 87/92] hw/net/can: sja1000 ignore CAN FD frames Paolo Bonzini
@ 2020-09-24  9:23 ` Paolo Bonzini
  2020-09-24  9:23 ` [PULL 89/92] hw/net/can/ctucafd: Add CTU CAN FD core register definitions Paolo Bonzini
                   ` (5 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: Vikram Garhwal, Jan Charvat, Pavel Pisa

From: Jan Charvat <charvj10@fel.cvut.cz>

Signed-off-by: Jan Charvat <charvj10@fel.cvut.cz>
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Reviewed-by: Vikram Garhwal <fnu.vikram@xilinx.com>
Message-Id: <0a2efc6ef9c458505952ed230e49ae25cad7f324.1600069689.git.pisa@cmp.felk.cvut.cz>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/net/can_emu.h |  4 ++++
 net/can/can_core.c    | 36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/include/net/can_emu.h b/include/net/can_emu.h
index cab98ee8ec..6f9b206bb5 100644
--- a/include/net/can_emu.h
+++ b/include/net/can_emu.h
@@ -122,4 +122,8 @@ int can_bus_client_set_filters(CanBusClientState *,
                                const struct qemu_can_filter *filters,
                                size_t filters_cnt);
 
+uint8_t can_dlc2len(uint8_t can_dlc);
+
+uint8_t can_len2dlc(uint8_t len);
+
 #endif
diff --git a/net/can/can_core.c b/net/can/can_core.c
index 90f4d8576a..0115d78794 100644
--- a/net/can/can_core.c
+++ b/net/can/can_core.c
@@ -33,6 +33,42 @@
 #include "net/can_emu.h"
 #include "qom/object_interfaces.h"
 
+/* CAN DLC to real data length conversion helpers */
+
+static const uint8_t dlc2len[] = {
+    0, 1, 2, 3, 4, 5, 6, 7,
+    8, 12, 16, 20, 24, 32, 48, 64
+};
+
+/* get data length from can_dlc with sanitized can_dlc */
+uint8_t can_dlc2len(uint8_t can_dlc)
+{
+    return dlc2len[can_dlc & 0x0F];
+}
+
+static const uint8_t len2dlc[] = {
+    0, 1, 2, 3, 4, 5, 6, 7, 8,                              /* 0 - 8 */
+    9, 9, 9, 9,                                             /* 9 - 12 */
+    10, 10, 10, 10,                                         /* 13 - 16 */
+    11, 11, 11, 11,                                         /* 17 - 20 */
+    12, 12, 12, 12,                                         /* 21 - 24 */
+    13, 13, 13, 13, 13, 13, 13, 13,                         /* 25 - 32 */
+    14, 14, 14, 14, 14, 14, 14, 14,                         /* 33 - 40 */
+    14, 14, 14, 14, 14, 14, 14, 14,                         /* 41 - 48 */
+    15, 15, 15, 15, 15, 15, 15, 15,                         /* 49 - 56 */
+    15, 15, 15, 15, 15, 15, 15, 15                          /* 57 - 64 */
+};
+
+/* map the sanitized data length to an appropriate data length code */
+uint8_t can_len2dlc(uint8_t len)
+{
+    if (unlikely(len > 64)) {
+        return 0xF;
+    }
+
+    return len2dlc[len];
+}
+
 struct CanBusState {
     Object object;
 
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 89/92] hw/net/can/ctucafd: Add CTU CAN FD core register definitions.
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (87 preceding siblings ...)
  2020-09-24  9:23 ` [PULL 88/92] net/can: Add can_dlc2len and can_len2dlc for CAN FD Paolo Bonzini
@ 2020-09-24  9:23 ` Paolo Bonzini
  2020-09-24  9:23 ` [PULL 90/92] hw/net/can: CTU CAN FD IP open hardware core emulation Paolo Bonzini
                   ` (4 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: Jan Charvat, Pavel Pisa

From: Jan Charvat <charvj10@fel.cvut.cz>

Definitions of registers and CAN FD frame message box of CTU CAN FD
IP core are generated the specification in CACTUS/IP-XACT format.

CTU CAN FD IP core repository

  https://gitlab.fel.cvut.cz/canbus/ctucanfd_ip_core

The location of the CTU CAN IP core specification within
IP core design

  spec/CTU/ip/CAN_FD_IP_Core/2.1/CAN_FD_IP_Core.2.1.xml

The header files are generated by pyXact_generator designed
by Ondrej Ille which is based on ipyxact_parser.

The specification is source of header files for driver and emulation,
documentation and VHDL registers map implementation.

Signed-off-by: Jan Charvat <charvj10@fel.cvut.cz>
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Message-Id: <97ae620f724bf1d76f127aaf628f7aec3af0a11c.1600069689.git.pisa@cmp.felk.cvut.cz>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/net/can/ctu_can_fd_frame.h | 189 +++++++
 hw/net/can/ctu_can_fd_regs.h  | 971 ++++++++++++++++++++++++++++++++++
 2 files changed, 1160 insertions(+)
 create mode 100644 hw/net/can/ctu_can_fd_frame.h
 create mode 100644 hw/net/can/ctu_can_fd_regs.h

diff --git a/hw/net/can/ctu_can_fd_frame.h b/hw/net/can/ctu_can_fd_frame.h
new file mode 100644
index 0000000000..04d956c84e
--- /dev/null
+++ b/hw/net/can/ctu_can_fd_frame.h
@@ -0,0 +1,189 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*******************************************************************************
+ *
+ * CTU CAN FD IP Core
+ *
+ * Copyright (C) 2015-2018 Ondrej Ille <ondrej.ille@gmail.com> FEE CTU
+ * Copyright (C) 2018-2020 Ondrej Ille <ondrej.ille@gmail.com> self-funded
+ * Copyright (C) 2018-2019 Martin Jerabek <martin.jerabek01@gmail.com> FEE CTU
+ * Copyright (C) 2018-2020 Pavel Pisa <pisa@cmp.felk.cvut.cz> FEE CTU/self-funded
+ *
+ * Project advisors:
+ *     Jiri Novak <jnovak@fel.cvut.cz>
+ *     Pavel Pisa <pisa@cmp.felk.cvut.cz>
+ *
+ * Department of Measurement         (http://meas.fel.cvut.cz/)
+ * Faculty of Electrical Engineering (http://www.fel.cvut.cz)
+ * Czech Technical University        (http://www.cvut.cz/)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ ******************************************************************************/
+
+/* This file is autogenerated, DO NOT EDIT! */
+
+#ifndef __CTU_CAN_FD_CAN_FD_FRAME_FORMAT__
+#define __CTU_CAN_FD_CAN_FD_FRAME_FORMAT__
+
+/* CAN_Frame_format memory map */
+enum ctu_can_fd_can_frame_format {
+	CTU_CAN_FD_FRAME_FORM_W        = 0x0,
+	CTU_CAN_FD_IDENTIFIER_W        = 0x4,
+	CTU_CAN_FD_TIMESTAMP_L_W       = 0x8,
+	CTU_CAN_FD_TIMESTAMP_U_W       = 0xc,
+	CTU_CAN_FD_DATA_1_4_W         = 0x10,
+	CTU_CAN_FD_DATA_5_8_W         = 0x14,
+	CTU_CAN_FD_DATA_61_64_W       = 0x4c,
+};
+
+
+/* Register descriptions: */
+union ctu_can_fd_frame_form_w {
+	uint32_t u32;
+	struct ctu_can_fd_frame_form_w_s {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+  /* FRAME_FORM_W */
+		uint32_t dlc                     : 4;
+		uint32_t reserved_4              : 1;
+		uint32_t rtr                     : 1;
+		uint32_t ide                     : 1;
+		uint32_t fdf                     : 1;
+		uint32_t reserved_8              : 1;
+		uint32_t brs                     : 1;
+		uint32_t esi_rsv                 : 1;
+		uint32_t rwcnt                   : 5;
+		uint32_t reserved_31_16         : 16;
+#else
+		uint32_t reserved_31_16         : 16;
+		uint32_t rwcnt                   : 5;
+		uint32_t esi_rsv                 : 1;
+		uint32_t brs                     : 1;
+		uint32_t reserved_8              : 1;
+		uint32_t fdf                     : 1;
+		uint32_t ide                     : 1;
+		uint32_t rtr                     : 1;
+		uint32_t reserved_4              : 1;
+		uint32_t dlc                     : 4;
+#endif
+	} s;
+};
+
+enum ctu_can_fd_frame_form_w_rtr {
+	NO_RTR_FRAME       = 0x0,
+	RTR_FRAME          = 0x1,
+};
+
+enum ctu_can_fd_frame_form_w_ide {
+	BASE           = 0x0,
+	EXTENDED       = 0x1,
+};
+
+enum ctu_can_fd_frame_form_w_fdf {
+	NORMAL_CAN       = 0x0,
+	FD_CAN           = 0x1,
+};
+
+enum ctu_can_fd_frame_form_w_brs {
+	BR_NO_SHIFT       = 0x0,
+	BR_SHIFT          = 0x1,
+};
+
+enum ctu_can_fd_frame_form_w_esi_rsv {
+	ESI_ERR_ACTIVE       = 0x0,
+	ESI_ERR_PASIVE       = 0x1,
+};
+
+union ctu_can_fd_identifier_w {
+	uint32_t u32;
+	struct ctu_can_fd_identifier_w_s {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+  /* IDENTIFIER_W */
+		uint32_t identifier_ext         : 18;
+		uint32_t identifier_base        : 11;
+		uint32_t reserved_31_29          : 3;
+#else
+		uint32_t reserved_31_29          : 3;
+		uint32_t identifier_base        : 11;
+		uint32_t identifier_ext         : 18;
+#endif
+	} s;
+};
+
+union ctu_can_fd_timestamp_l_w {
+	uint32_t u32;
+	struct ctu_can_fd_timestamp_l_w_s {
+  /* TIMESTAMP_L_W */
+		uint32_t time_stamp_31_0        : 32;
+	} s;
+};
+
+union ctu_can_fd_timestamp_u_w {
+	uint32_t u32;
+	struct ctu_can_fd_timestamp_u_w_s {
+  /* TIMESTAMP_U_W */
+		uint32_t timestamp_l_w          : 32;
+	} s;
+};
+
+union ctu_can_fd_data_1_4_w {
+	uint32_t u32;
+	struct ctu_can_fd_data_1_4_w_s {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+  /* DATA_1_4_W */
+		uint32_t data_1                  : 8;
+		uint32_t data_2                  : 8;
+		uint32_t data_3                  : 8;
+		uint32_t data_4                  : 8;
+#else
+		uint32_t data_4                  : 8;
+		uint32_t data_3                  : 8;
+		uint32_t data_2                  : 8;
+		uint32_t data_1                  : 8;
+#endif
+	} s;
+};
+
+union ctu_can_fd_data_5_8_w {
+	uint32_t u32;
+	struct ctu_can_fd_data_5_8_w_s {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+  /* DATA_5_8_W */
+		uint32_t data_5                  : 8;
+		uint32_t data_6                  : 8;
+		uint32_t data_7                  : 8;
+		uint32_t data_8                  : 8;
+#else
+		uint32_t data_8                  : 8;
+		uint32_t data_7                  : 8;
+		uint32_t data_6                  : 8;
+		uint32_t data_5                  : 8;
+#endif
+	} s;
+};
+
+union ctu_can_fd_data_61_64_w {
+	uint32_t u32;
+	struct ctu_can_fd_data_61_64_w_s {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+  /* DATA_61_64_W */
+		uint32_t data_61                 : 8;
+		uint32_t data_62                 : 8;
+		uint32_t data_63                 : 8;
+		uint32_t data_64                 : 8;
+#else
+		uint32_t data_64                 : 8;
+		uint32_t data_63                 : 8;
+		uint32_t data_62                 : 8;
+		uint32_t data_61                 : 8;
+#endif
+	} s;
+};
+
+#endif
diff --git a/hw/net/can/ctu_can_fd_regs.h b/hw/net/can/ctu_can_fd_regs.h
new file mode 100644
index 0000000000..450f4b9fb3
--- /dev/null
+++ b/hw/net/can/ctu_can_fd_regs.h
@@ -0,0 +1,971 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*******************************************************************************
+ *
+ * CTU CAN FD IP Core
+ *
+ * Copyright (C) 2015-2018 Ondrej Ille <ondrej.ille@gmail.com> FEE CTU
+ * Copyright (C) 2018-2020 Ondrej Ille <ondrej.ille@gmail.com> self-funded
+ * Copyright (C) 2018-2019 Martin Jerabek <martin.jerabek01@gmail.com> FEE CTU
+ * Copyright (C) 2018-2020 Pavel Pisa <pisa@cmp.felk.cvut.cz> FEE CTU/self-funded
+ *
+ * Project advisors:
+ *     Jiri Novak <jnovak@fel.cvut.cz>
+ *     Pavel Pisa <pisa@cmp.felk.cvut.cz>
+ *
+ * Department of Measurement         (http://meas.fel.cvut.cz/)
+ * Faculty of Electrical Engineering (http://www.fel.cvut.cz)
+ * Czech Technical University        (http://www.cvut.cz/)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ ******************************************************************************/
+
+/* This file is autogenerated, DO NOT EDIT! */
+
+#ifndef __CTU_CAN_FD_CAN_FD_REGISTER_MAP__
+#define __CTU_CAN_FD_CAN_FD_REGISTER_MAP__
+
+/* CAN_Registers memory map */
+enum ctu_can_fd_can_registers {
+	CTU_CAN_FD_DEVICE_ID             = 0x0,
+	CTU_CAN_FD_VERSION               = 0x2,
+	CTU_CAN_FD_MODE                  = 0x4,
+	CTU_CAN_FD_SETTINGS              = 0x6,
+	CTU_CAN_FD_STATUS                = 0x8,
+	CTU_CAN_FD_COMMAND               = 0xc,
+	CTU_CAN_FD_INT_STAT             = 0x10,
+	CTU_CAN_FD_INT_ENA_SET          = 0x14,
+	CTU_CAN_FD_INT_ENA_CLR          = 0x18,
+	CTU_CAN_FD_INT_MASK_SET         = 0x1c,
+	CTU_CAN_FD_INT_MASK_CLR         = 0x20,
+	CTU_CAN_FD_BTR                  = 0x24,
+	CTU_CAN_FD_BTR_FD               = 0x28,
+	CTU_CAN_FD_EWL                  = 0x2c,
+	CTU_CAN_FD_ERP                  = 0x2d,
+	CTU_CAN_FD_FAULT_STATE          = 0x2e,
+	CTU_CAN_FD_REC                  = 0x30,
+	CTU_CAN_FD_TEC                  = 0x32,
+	CTU_CAN_FD_ERR_NORM             = 0x34,
+	CTU_CAN_FD_ERR_FD               = 0x36,
+	CTU_CAN_FD_CTR_PRES             = 0x38,
+	CTU_CAN_FD_FILTER_A_MASK        = 0x3c,
+	CTU_CAN_FD_FILTER_A_VAL         = 0x40,
+	CTU_CAN_FD_FILTER_B_MASK        = 0x44,
+	CTU_CAN_FD_FILTER_B_VAL         = 0x48,
+	CTU_CAN_FD_FILTER_C_MASK        = 0x4c,
+	CTU_CAN_FD_FILTER_C_VAL         = 0x50,
+	CTU_CAN_FD_FILTER_RAN_LOW       = 0x54,
+	CTU_CAN_FD_FILTER_RAN_HIGH      = 0x58,
+	CTU_CAN_FD_FILTER_CONTROL       = 0x5c,
+	CTU_CAN_FD_FILTER_STATUS        = 0x5e,
+	CTU_CAN_FD_RX_MEM_INFO          = 0x60,
+	CTU_CAN_FD_RX_POINTERS          = 0x64,
+	CTU_CAN_FD_RX_STATUS            = 0x68,
+	CTU_CAN_FD_RX_SETTINGS          = 0x6a,
+	CTU_CAN_FD_RX_DATA              = 0x6c,
+	CTU_CAN_FD_TX_STATUS            = 0x70,
+	CTU_CAN_FD_TX_COMMAND           = 0x74,
+	CTU_CAN_FD_TX_PRIORITY          = 0x78,
+	CTU_CAN_FD_ERR_CAPT             = 0x7c,
+	CTU_CAN_FD_ALC                  = 0x7e,
+	CTU_CAN_FD_TRV_DELAY            = 0x80,
+	CTU_CAN_FD_SSP_CFG              = 0x82,
+	CTU_CAN_FD_RX_FR_CTR            = 0x84,
+	CTU_CAN_FD_TX_FR_CTR            = 0x88,
+	CTU_CAN_FD_DEBUG_REGISTER       = 0x8c,
+	CTU_CAN_FD_YOLO_REG             = 0x90,
+	CTU_CAN_FD_TIMESTAMP_LOW        = 0x94,
+	CTU_CAN_FD_TIMESTAMP_HIGH       = 0x98,
+	CTU_CAN_FD_TXTB1_DATA_1        = 0x100,
+	CTU_CAN_FD_TXTB1_DATA_2        = 0x104,
+	CTU_CAN_FD_TXTB1_DATA_20       = 0x14c,
+	CTU_CAN_FD_TXTB2_DATA_1        = 0x200,
+	CTU_CAN_FD_TXTB2_DATA_2        = 0x204,
+	CTU_CAN_FD_TXTB2_DATA_20       = 0x24c,
+	CTU_CAN_FD_TXTB3_DATA_1        = 0x300,
+	CTU_CAN_FD_TXTB3_DATA_2        = 0x304,
+	CTU_CAN_FD_TXTB3_DATA_20       = 0x34c,
+	CTU_CAN_FD_TXTB4_DATA_1        = 0x400,
+	CTU_CAN_FD_TXTB4_DATA_2        = 0x404,
+	CTU_CAN_FD_TXTB4_DATA_20       = 0x44c,
+};
+
+
+/* Register descriptions: */
+union ctu_can_fd_device_id_version {
+	uint32_t u32;
+	struct ctu_can_fd_device_id_version_s {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+  /* DEVICE_ID */
+		uint32_t device_id              : 16;
+  /* VERSION */
+		uint32_t ver_minor               : 8;
+		uint32_t ver_major               : 8;
+#else
+		uint32_t ver_major               : 8;
+		uint32_t ver_minor               : 8;
+		uint32_t device_id              : 16;
+#endif
+	} s;
+};
+
+enum ctu_can_fd_device_id_device_id {
+	CTU_CAN_FD_ID    = 0xcafd,
+};
+
+union ctu_can_fd_mode_settings {
+	uint32_t u32;
+	struct ctu_can_fd_mode_settings_s {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+  /* MODE */
+		uint32_t rst                     : 1;
+		uint32_t lom                     : 1;
+		uint32_t stm                     : 1;
+		uint32_t afm                     : 1;
+		uint32_t fde                     : 1;
+		uint32_t reserved_6_5            : 2;
+		uint32_t acf                     : 1;
+		uint32_t tstm                    : 1;
+		uint32_t reserved_15_9           : 7;
+  /* SETTINGS */
+		uint32_t rtrle                   : 1;
+		uint32_t rtrth                   : 4;
+		uint32_t ilbp                    : 1;
+		uint32_t ena                     : 1;
+		uint32_t nisofd                  : 1;
+		uint32_t pex                     : 1;
+		uint32_t reserved_31_25          : 7;
+#else
+		uint32_t reserved_31_25          : 7;
+		uint32_t pex                     : 1;
+		uint32_t nisofd                  : 1;
+		uint32_t ena                     : 1;
+		uint32_t ilbp                    : 1;
+		uint32_t rtrth                   : 4;
+		uint32_t rtrle                   : 1;
+		uint32_t reserved_15_9           : 7;
+		uint32_t tstm                    : 1;
+		uint32_t acf                     : 1;
+		uint32_t reserved_6_5            : 2;
+		uint32_t fde                     : 1;
+		uint32_t afm                     : 1;
+		uint32_t stm                     : 1;
+		uint32_t lom                     : 1;
+		uint32_t rst                     : 1;
+#endif
+	} s;
+};
+
+enum ctu_can_fd_mode_lom {
+	LOM_DISABLED       = 0x0,
+	LOM_ENABLED        = 0x1,
+};
+
+enum ctu_can_fd_mode_stm {
+	STM_DISABLED       = 0x0,
+	STM_ENABLED        = 0x1,
+};
+
+enum ctu_can_fd_mode_afm {
+	AFM_DISABLED       = 0x0,
+	AFM_ENABLED        = 0x1,
+};
+
+enum ctu_can_fd_mode_fde {
+	FDE_DISABLE       = 0x0,
+	FDE_ENABLE        = 0x1,
+};
+
+enum ctu_can_fd_mode_acf {
+	ACF_DISABLED       = 0x0,
+	ACF_ENABLED        = 0x1,
+};
+
+enum ctu_can_fd_settings_rtrle {
+	RTRLE_DISABLED       = 0x0,
+	RTRLE_ENABLED        = 0x1,
+};
+
+enum ctu_can_fd_settings_ilbp {
+	INT_LOOP_DISABLED       = 0x0,
+	INT_LOOP_ENABLED        = 0x1,
+};
+
+enum ctu_can_fd_settings_ena {
+	CTU_CAN_DISABLED       = 0x0,
+	CTU_CAN_ENABLED        = 0x1,
+};
+
+enum ctu_can_fd_settings_nisofd {
+	ISO_FD           = 0x0,
+	NON_ISO_FD       = 0x1,
+};
+
+enum ctu_can_fd_settings_pex {
+	PROTOCOL_EXCEPTION_DISABLED       = 0x0,
+	PROTOCOL_EXCEPTION_ENABLED        = 0x1,
+};
+
+union ctu_can_fd_status {
+	uint32_t u32;
+	struct ctu_can_fd_status_s {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+  /* STATUS */
+		uint32_t rxne                    : 1;
+		uint32_t dor                     : 1;
+		uint32_t txnf                    : 1;
+		uint32_t eft                     : 1;
+		uint32_t rxs                     : 1;
+		uint32_t txs                     : 1;
+		uint32_t ewl                     : 1;
+		uint32_t idle                    : 1;
+		uint32_t reserved_31_8          : 24;
+#else
+		uint32_t reserved_31_8          : 24;
+		uint32_t idle                    : 1;
+		uint32_t ewl                     : 1;
+		uint32_t txs                     : 1;
+		uint32_t rxs                     : 1;
+		uint32_t eft                     : 1;
+		uint32_t txnf                    : 1;
+		uint32_t dor                     : 1;
+		uint32_t rxne                    : 1;
+#endif
+	} s;
+};
+
+union ctu_can_fd_command {
+	uint32_t u32;
+	struct ctu_can_fd_command_s {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+		uint32_t reserved_1_0            : 2;
+  /* COMMAND */
+		uint32_t rrb                     : 1;
+		uint32_t cdo                     : 1;
+		uint32_t ercrst                  : 1;
+		uint32_t rxfcrst                 : 1;
+		uint32_t txfcrst                 : 1;
+		uint32_t reserved_31_7          : 25;
+#else
+		uint32_t reserved_31_7          : 25;
+		uint32_t txfcrst                 : 1;
+		uint32_t rxfcrst                 : 1;
+		uint32_t ercrst                  : 1;
+		uint32_t cdo                     : 1;
+		uint32_t rrb                     : 1;
+		uint32_t reserved_1_0            : 2;
+#endif
+	} s;
+};
+
+union ctu_can_fd_int_stat {
+	uint32_t u32;
+	struct ctu_can_fd_int_stat_s {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+  /* INT_STAT */
+		uint32_t rxi                     : 1;
+		uint32_t txi                     : 1;
+		uint32_t ewli                    : 1;
+		uint32_t doi                     : 1;
+		uint32_t fcsi                    : 1;
+		uint32_t ali                     : 1;
+		uint32_t bei                     : 1;
+		uint32_t ofi                     : 1;
+		uint32_t rxfi                    : 1;
+		uint32_t bsi                     : 1;
+		uint32_t rbnei                   : 1;
+		uint32_t txbhci                  : 1;
+		uint32_t reserved_31_12         : 20;
+#else
+		uint32_t reserved_31_12         : 20;
+		uint32_t txbhci                  : 1;
+		uint32_t rbnei                   : 1;
+		uint32_t bsi                     : 1;
+		uint32_t rxfi                    : 1;
+		uint32_t ofi                     : 1;
+		uint32_t bei                     : 1;
+		uint32_t ali                     : 1;
+		uint32_t fcsi                    : 1;
+		uint32_t doi                     : 1;
+		uint32_t ewli                    : 1;
+		uint32_t txi                     : 1;
+		uint32_t rxi                     : 1;
+#endif
+	} s;
+};
+
+union ctu_can_fd_int_ena_set {
+	uint32_t u32;
+	struct ctu_can_fd_int_ena_set_s {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+  /* INT_ENA_SET */
+		uint32_t int_ena_set            : 12;
+		uint32_t reserved_31_12         : 20;
+#else
+		uint32_t reserved_31_12         : 20;
+		uint32_t int_ena_set            : 12;
+#endif
+	} s;
+};
+
+union ctu_can_fd_int_ena_clr {
+	uint32_t u32;
+	struct ctu_can_fd_int_ena_clr_s {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+  /* INT_ENA_CLR */
+		uint32_t int_ena_clr            : 12;
+		uint32_t reserved_31_12         : 20;
+#else
+		uint32_t reserved_31_12         : 20;
+		uint32_t int_ena_clr            : 12;
+#endif
+	} s;
+};
+
+union ctu_can_fd_int_mask_set {
+	uint32_t u32;
+	struct ctu_can_fd_int_mask_set_s {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+  /* INT_MASK_SET */
+		uint32_t int_mask_set           : 12;
+		uint32_t reserved_31_12         : 20;
+#else
+		uint32_t reserved_31_12         : 20;
+		uint32_t int_mask_set           : 12;
+#endif
+	} s;
+};
+
+union ctu_can_fd_int_mask_clr {
+	uint32_t u32;
+	struct ctu_can_fd_int_mask_clr_s {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+  /* INT_MASK_CLR */
+		uint32_t int_mask_clr           : 12;
+		uint32_t reserved_31_12         : 20;
+#else
+		uint32_t reserved_31_12         : 20;
+		uint32_t int_mask_clr           : 12;
+#endif
+	} s;
+};
+
+union ctu_can_fd_btr {
+	uint32_t u32;
+	struct ctu_can_fd_btr_s {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+  /* BTR */
+		uint32_t prop                    : 7;
+		uint32_t ph1                     : 6;
+		uint32_t ph2                     : 6;
+		uint32_t brp                     : 8;
+		uint32_t sjw                     : 5;
+#else
+		uint32_t sjw                     : 5;
+		uint32_t brp                     : 8;
+		uint32_t ph2                     : 6;
+		uint32_t ph1                     : 6;
+		uint32_t prop                    : 7;
+#endif
+	} s;
+};
+
+union ctu_can_fd_btr_fd {
+	uint32_t u32;
+	struct ctu_can_fd_btr_fd_s {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+  /* BTR_FD */
+		uint32_t prop_fd                 : 6;
+		uint32_t reserved_6              : 1;
+		uint32_t ph1_fd                  : 5;
+		uint32_t reserved_12             : 1;
+		uint32_t ph2_fd                  : 5;
+		uint32_t reserved_18             : 1;
+		uint32_t brp_fd                  : 8;
+		uint32_t sjw_fd                  : 5;
+#else
+		uint32_t sjw_fd                  : 5;
+		uint32_t brp_fd                  : 8;
+		uint32_t reserved_18             : 1;
+		uint32_t ph2_fd                  : 5;
+		uint32_t reserved_12             : 1;
+		uint32_t ph1_fd                  : 5;
+		uint32_t reserved_6              : 1;
+		uint32_t prop_fd                 : 6;
+#endif
+	} s;
+};
+
+union ctu_can_fd_ewl_erp_fault_state {
+	uint32_t u32;
+	struct ctu_can_fd_ewl_erp_fault_state_s {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+  /* EWL */
+		uint32_t ew_limit                : 8;
+  /* ERP */
+		uint32_t erp_limit               : 8;
+  /* FAULT_STATE */
+		uint32_t era                     : 1;
+		uint32_t erp                     : 1;
+		uint32_t bof                     : 1;
+		uint32_t reserved_31_19         : 13;
+#else
+		uint32_t reserved_31_19         : 13;
+		uint32_t bof                     : 1;
+		uint32_t erp                     : 1;
+		uint32_t era                     : 1;
+		uint32_t erp_limit               : 8;
+		uint32_t ew_limit                : 8;
+#endif
+	} s;
+};
+
+union ctu_can_fd_rec_tec {
+	uint32_t u32;
+	struct ctu_can_fd_rec_tec_s {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+  /* REC */
+		uint32_t rec_val                 : 9;
+		uint32_t reserved_15_9           : 7;
+  /* TEC */
+		uint32_t tec_val                 : 9;
+		uint32_t reserved_31_25          : 7;
+#else
+		uint32_t reserved_31_25          : 7;
+		uint32_t tec_val                 : 9;
+		uint32_t reserved_15_9           : 7;
+		uint32_t rec_val                 : 9;
+#endif
+	} s;
+};
+
+union ctu_can_fd_err_norm_err_fd {
+	uint32_t u32;
+	struct ctu_can_fd_err_norm_err_fd_s {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+  /* ERR_NORM */
+		uint32_t err_norm_val           : 16;
+  /* ERR_FD */
+		uint32_t err_fd_val             : 16;
+#else
+		uint32_t err_fd_val             : 16;
+		uint32_t err_norm_val           : 16;
+#endif
+	} s;
+};
+
+union ctu_can_fd_ctr_pres {
+	uint32_t u32;
+	struct ctu_can_fd_ctr_pres_s {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+  /* CTR_PRES */
+		uint32_t ctpv                    : 9;
+		uint32_t ptx                     : 1;
+		uint32_t prx                     : 1;
+		uint32_t enorm                   : 1;
+		uint32_t efd                     : 1;
+		uint32_t reserved_31_13         : 19;
+#else
+		uint32_t reserved_31_13         : 19;
+		uint32_t efd                     : 1;
+		uint32_t enorm                   : 1;
+		uint32_t prx                     : 1;
+		uint32_t ptx                     : 1;
+		uint32_t ctpv                    : 9;
+#endif
+	} s;
+};
+
+union ctu_can_fd_filter_a_mask {
+	uint32_t u32;
+	struct ctu_can_fd_filter_a_mask_s {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+  /* FILTER_A_MASK */
+		uint32_t bit_mask_a_val         : 29;
+		uint32_t reserved_31_29          : 3;
+#else
+		uint32_t reserved_31_29          : 3;
+		uint32_t bit_mask_a_val         : 29;
+#endif
+	} s;
+};
+
+union ctu_can_fd_filter_a_val {
+	uint32_t u32;
+	struct ctu_can_fd_filter_a_val_s {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+  /* FILTER_A_VAL */
+		uint32_t bit_val_a_val          : 29;
+		uint32_t reserved_31_29          : 3;
+#else
+		uint32_t reserved_31_29          : 3;
+		uint32_t bit_val_a_val          : 29;
+#endif
+	} s;
+};
+
+union ctu_can_fd_filter_b_mask {
+	uint32_t u32;
+	struct ctu_can_fd_filter_b_mask_s {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+  /* FILTER_B_MASK */
+		uint32_t bit_mask_b_val         : 29;
+		uint32_t reserved_31_29          : 3;
+#else
+		uint32_t reserved_31_29          : 3;
+		uint32_t bit_mask_b_val         : 29;
+#endif
+	} s;
+};
+
+union ctu_can_fd_filter_b_val {
+	uint32_t u32;
+	struct ctu_can_fd_filter_b_val_s {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+  /* FILTER_B_VAL */
+		uint32_t bit_val_b_val          : 29;
+		uint32_t reserved_31_29          : 3;
+#else
+		uint32_t reserved_31_29          : 3;
+		uint32_t bit_val_b_val          : 29;
+#endif
+	} s;
+};
+
+union ctu_can_fd_filter_c_mask {
+	uint32_t u32;
+	struct ctu_can_fd_filter_c_mask_s {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+  /* FILTER_C_MASK */
+		uint32_t bit_mask_c_val         : 29;
+		uint32_t reserved_31_29          : 3;
+#else
+		uint32_t reserved_31_29          : 3;
+		uint32_t bit_mask_c_val         : 29;
+#endif
+	} s;
+};
+
+union ctu_can_fd_filter_c_val {
+	uint32_t u32;
+	struct ctu_can_fd_filter_c_val_s {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+  /* FILTER_C_VAL */
+		uint32_t bit_val_c_val          : 29;
+		uint32_t reserved_31_29          : 3;
+#else
+		uint32_t reserved_31_29          : 3;
+		uint32_t bit_val_c_val          : 29;
+#endif
+	} s;
+};
+
+union ctu_can_fd_filter_ran_low {
+	uint32_t u32;
+	struct ctu_can_fd_filter_ran_low_s {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+  /* FILTER_RAN_LOW */
+		uint32_t bit_ran_low_val        : 29;
+		uint32_t reserved_31_29          : 3;
+#else
+		uint32_t reserved_31_29          : 3;
+		uint32_t bit_ran_low_val        : 29;
+#endif
+	} s;
+};
+
+union ctu_can_fd_filter_ran_high {
+	uint32_t u32;
+	struct ctu_can_fd_filter_ran_high_s {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+  /* FILTER_RAN_HIGH */
+		uint32_t bit_ran_high_val       : 29;
+		uint32_t reserved_31_29          : 3;
+#else
+		uint32_t reserved_31_29          : 3;
+		uint32_t bit_ran_high_val       : 29;
+#endif
+	} s;
+};
+
+union ctu_can_fd_filter_control_filter_status {
+	uint32_t u32;
+	struct ctu_can_fd_filter_control_filter_status_s {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+  /* FILTER_CONTROL */
+		uint32_t fanb                    : 1;
+		uint32_t fane                    : 1;
+		uint32_t fafb                    : 1;
+		uint32_t fafe                    : 1;
+		uint32_t fbnb                    : 1;
+		uint32_t fbne                    : 1;
+		uint32_t fbfb                    : 1;
+		uint32_t fbfe                    : 1;
+		uint32_t fcnb                    : 1;
+		uint32_t fcne                    : 1;
+		uint32_t fcfb                    : 1;
+		uint32_t fcfe                    : 1;
+		uint32_t frnb                    : 1;
+		uint32_t frne                    : 1;
+		uint32_t frfb                    : 1;
+		uint32_t frfe                    : 1;
+  /* FILTER_STATUS */
+		uint32_t sfa                     : 1;
+		uint32_t sfb                     : 1;
+		uint32_t sfc                     : 1;
+		uint32_t sfr                     : 1;
+		uint32_t reserved_31_20         : 12;
+#else
+		uint32_t reserved_31_20         : 12;
+		uint32_t sfr                     : 1;
+		uint32_t sfc                     : 1;
+		uint32_t sfb                     : 1;
+		uint32_t sfa                     : 1;
+		uint32_t frfe                    : 1;
+		uint32_t frfb                    : 1;
+		uint32_t frne                    : 1;
+		uint32_t frnb                    : 1;
+		uint32_t fcfe                    : 1;
+		uint32_t fcfb                    : 1;
+		uint32_t fcne                    : 1;
+		uint32_t fcnb                    : 1;
+		uint32_t fbfe                    : 1;
+		uint32_t fbfb                    : 1;
+		uint32_t fbne                    : 1;
+		uint32_t fbnb                    : 1;
+		uint32_t fafe                    : 1;
+		uint32_t fafb                    : 1;
+		uint32_t fane                    : 1;
+		uint32_t fanb                    : 1;
+#endif
+	} s;
+};
+
+union ctu_can_fd_rx_mem_info {
+	uint32_t u32;
+	struct ctu_can_fd_rx_mem_info_s {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+  /* RX_MEM_INFO */
+		uint32_t rx_buff_size           : 13;
+		uint32_t reserved_15_13          : 3;
+		uint32_t rx_mem_free            : 13;
+		uint32_t reserved_31_29          : 3;
+#else
+		uint32_t reserved_31_29          : 3;
+		uint32_t rx_mem_free            : 13;
+		uint32_t reserved_15_13          : 3;
+		uint32_t rx_buff_size           : 13;
+#endif
+	} s;
+};
+
+union ctu_can_fd_rx_pointers {
+	uint32_t u32;
+	struct ctu_can_fd_rx_pointers_s {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+  /* RX_POINTERS */
+		uint32_t rx_wpp                 : 12;
+		uint32_t reserved_15_12          : 4;
+		uint32_t rx_rpp                 : 12;
+		uint32_t reserved_31_28          : 4;
+#else
+		uint32_t reserved_31_28          : 4;
+		uint32_t rx_rpp                 : 12;
+		uint32_t reserved_15_12          : 4;
+		uint32_t rx_wpp                 : 12;
+#endif
+	} s;
+};
+
+union ctu_can_fd_rx_status_rx_settings {
+	uint32_t u32;
+	struct ctu_can_fd_rx_status_rx_settings_s {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+  /* RX_STATUS */
+		uint32_t rxe                     : 1;
+		uint32_t rxf                     : 1;
+		uint32_t reserved_3_2            : 2;
+		uint32_t rxfrc                  : 11;
+		uint32_t reserved_15             : 1;
+  /* RX_SETTINGS */
+		uint32_t rtsop                   : 1;
+		uint32_t reserved_31_17         : 15;
+#else
+		uint32_t reserved_31_17         : 15;
+		uint32_t rtsop                   : 1;
+		uint32_t reserved_15             : 1;
+		uint32_t rxfrc                  : 11;
+		uint32_t reserved_3_2            : 2;
+		uint32_t rxf                     : 1;
+		uint32_t rxe                     : 1;
+#endif
+	} s;
+};
+
+enum ctu_can_fd_rx_settings_rtsop {
+	RTS_END       = 0x0,
+	RTS_BEG       = 0x1,
+};
+
+union ctu_can_fd_rx_data {
+	uint32_t u32;
+	struct ctu_can_fd_rx_data_s {
+  /* RX_DATA */
+		uint32_t rx_data                : 32;
+	} s;
+};
+
+union ctu_can_fd_tx_status {
+	uint32_t u32;
+	struct ctu_can_fd_tx_status_s {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+  /* TX_STATUS */
+		uint32_t tx1s                    : 4;
+		uint32_t tx2s                    : 4;
+		uint32_t tx3s                    : 4;
+		uint32_t tx4s                    : 4;
+		uint32_t reserved_31_16         : 16;
+#else
+		uint32_t reserved_31_16         : 16;
+		uint32_t tx4s                    : 4;
+		uint32_t tx3s                    : 4;
+		uint32_t tx2s                    : 4;
+		uint32_t tx1s                    : 4;
+#endif
+	} s;
+};
+
+enum ctu_can_fd_tx_status_tx1s {
+	TXT_RDY        = 0x1,
+	TXT_TRAN       = 0x2,
+	TXT_ABTP       = 0x3,
+	TXT_TOK        = 0x4,
+	TXT_ERR        = 0x6,
+	TXT_ABT        = 0x7,
+	TXT_ETY        = 0x8,
+};
+
+union ctu_can_fd_tx_command {
+	uint32_t u32;
+	struct ctu_can_fd_tx_command_s {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+  /* TX_COMMAND */
+		uint32_t txce                    : 1;
+		uint32_t txcr                    : 1;
+		uint32_t txca                    : 1;
+		uint32_t reserved_7_3            : 5;
+		uint32_t txb1                    : 1;
+		uint32_t txb2                    : 1;
+		uint32_t txb3                    : 1;
+		uint32_t txb4                    : 1;
+		uint32_t reserved_31_12         : 20;
+#else
+		uint32_t reserved_31_12         : 20;
+		uint32_t txb4                    : 1;
+		uint32_t txb3                    : 1;
+		uint32_t txb2                    : 1;
+		uint32_t txb1                    : 1;
+		uint32_t reserved_7_3            : 5;
+		uint32_t txca                    : 1;
+		uint32_t txcr                    : 1;
+		uint32_t txce                    : 1;
+#endif
+	} s;
+};
+
+union ctu_can_fd_tx_priority {
+	uint32_t u32;
+	struct ctu_can_fd_tx_priority_s {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+  /* TX_PRIORITY */
+		uint32_t txt1p                   : 3;
+		uint32_t reserved_3              : 1;
+		uint32_t txt2p                   : 3;
+		uint32_t reserved_7              : 1;
+		uint32_t txt3p                   : 3;
+		uint32_t reserved_11             : 1;
+		uint32_t txt4p                   : 3;
+		uint32_t reserved_31_15         : 17;
+#else
+		uint32_t reserved_31_15         : 17;
+		uint32_t txt4p                   : 3;
+		uint32_t reserved_11             : 1;
+		uint32_t txt3p                   : 3;
+		uint32_t reserved_7              : 1;
+		uint32_t txt2p                   : 3;
+		uint32_t reserved_3              : 1;
+		uint32_t txt1p                   : 3;
+#endif
+	} s;
+};
+
+union ctu_can_fd_err_capt_alc {
+	uint32_t u32;
+	struct ctu_can_fd_err_capt_alc_s {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+  /* ERR_CAPT */
+		uint32_t err_pos                 : 5;
+		uint32_t err_type                : 3;
+		uint32_t reserved_15_8           : 8;
+  /* ALC */
+		uint32_t alc_bit                 : 5;
+		uint32_t alc_id_field            : 3;
+		uint32_t reserved_31_24          : 8;
+#else
+		uint32_t reserved_31_24          : 8;
+		uint32_t alc_id_field            : 3;
+		uint32_t alc_bit                 : 5;
+		uint32_t reserved_15_8           : 8;
+		uint32_t err_type                : 3;
+		uint32_t err_pos                 : 5;
+#endif
+	} s;
+};
+
+enum ctu_can_fd_err_capt_err_pos {
+	ERC_POS_SOF         = 0x0,
+	ERC_POS_ARB         = 0x1,
+	ERC_POS_CTRL        = 0x2,
+	ERC_POS_DATA        = 0x3,
+	ERC_POS_CRC         = 0x4,
+	ERC_POS_ACK         = 0x5,
+	ERC_POS_EOF         = 0x6,
+	ERC_POS_ERR         = 0x7,
+	ERC_POS_OVRL        = 0x8,
+	ERC_POS_OTHER      = 0x1f,
+};
+
+enum ctu_can_fd_err_capt_err_type {
+	ERC_BIT_ERR        = 0x0,
+	ERC_CRC_ERR        = 0x1,
+	ERC_FRM_ERR        = 0x2,
+	ERC_ACK_ERR        = 0x3,
+	ERC_STUF_ERR       = 0x4,
+};
+
+enum ctu_can_fd_alc_alc_id_field {
+	ALC_RSVD            = 0x0,
+	ALC_BASE_ID         = 0x1,
+	ALC_SRR_RTR         = 0x2,
+	ALC_IDE             = 0x3,
+	ALC_EXTENSION       = 0x4,
+	ALC_RTR             = 0x5,
+};
+
+union ctu_can_fd_trv_delay_ssp_cfg {
+	uint32_t u32;
+	struct ctu_can_fd_trv_delay_ssp_cfg_s {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+  /* TRV_DELAY */
+		uint32_t trv_delay_value         : 7;
+		uint32_t reserved_15_7           : 9;
+  /* SSP_CFG */
+		uint32_t ssp_offset              : 8;
+		uint32_t ssp_src                 : 2;
+		uint32_t reserved_31_26          : 6;
+#else
+		uint32_t reserved_31_26          : 6;
+		uint32_t ssp_src                 : 2;
+		uint32_t ssp_offset              : 8;
+		uint32_t reserved_15_7           : 9;
+		uint32_t trv_delay_value         : 7;
+#endif
+	} s;
+};
+
+enum ctu_can_fd_ssp_cfg_ssp_src {
+	SSP_SRC_MEAS_N_OFFSET       = 0x0,
+	SSP_SRC_NO_SSP              = 0x1,
+	SSP_SRC_OFFSET              = 0x2,
+};
+
+union ctu_can_fd_rx_fr_ctr {
+	uint32_t u32;
+	struct ctu_can_fd_rx_fr_ctr_s {
+  /* RX_FR_CTR */
+		uint32_t rx_fr_ctr_val          : 32;
+	} s;
+};
+
+union ctu_can_fd_tx_fr_ctr {
+	uint32_t u32;
+	struct ctu_can_fd_tx_fr_ctr_s {
+  /* TX_FR_CTR */
+		uint32_t tx_fr_ctr_val          : 32;
+	} s;
+};
+
+union ctu_can_fd_debug_register {
+	uint32_t u32;
+	struct ctu_can_fd_debug_register_s {
+#ifdef __LITTLE_ENDIAN_BITFIELD
+  /* DEBUG_REGISTER */
+		uint32_t stuff_count             : 3;
+		uint32_t destuff_count           : 3;
+		uint32_t pc_arb                  : 1;
+		uint32_t pc_con                  : 1;
+		uint32_t pc_dat                  : 1;
+		uint32_t pc_stc                  : 1;
+		uint32_t pc_crc                  : 1;
+		uint32_t pc_crcd                 : 1;
+		uint32_t pc_ack                  : 1;
+		uint32_t pc_ackd                 : 1;
+		uint32_t pc_eof                  : 1;
+		uint32_t pc_int                  : 1;
+		uint32_t pc_susp                 : 1;
+		uint32_t pc_ovr                  : 1;
+		uint32_t pc_sof                  : 1;
+		uint32_t reserved_31_19         : 13;
+#else
+		uint32_t reserved_31_19         : 13;
+		uint32_t pc_sof                  : 1;
+		uint32_t pc_ovr                  : 1;
+		uint32_t pc_susp                 : 1;
+		uint32_t pc_int                  : 1;
+		uint32_t pc_eof                  : 1;
+		uint32_t pc_ackd                 : 1;
+		uint32_t pc_ack                  : 1;
+		uint32_t pc_crcd                 : 1;
+		uint32_t pc_crc                  : 1;
+		uint32_t pc_stc                  : 1;
+		uint32_t pc_dat                  : 1;
+		uint32_t pc_con                  : 1;
+		uint32_t pc_arb                  : 1;
+		uint32_t destuff_count           : 3;
+		uint32_t stuff_count             : 3;
+#endif
+	} s;
+};
+
+union ctu_can_fd_yolo_reg {
+	uint32_t u32;
+	struct ctu_can_fd_yolo_reg_s {
+  /* YOLO_REG */
+		uint32_t yolo_val               : 32;
+	} s;
+};
+
+union ctu_can_fd_timestamp_low {
+	uint32_t u32;
+	struct ctu_can_fd_timestamp_low_s {
+  /* TIMESTAMP_LOW */
+		uint32_t timestamp_low          : 32;
+	} s;
+};
+
+union ctu_can_fd_timestamp_high {
+	uint32_t u32;
+	struct ctu_can_fd_timestamp_high_s {
+  /* TIMESTAMP_HIGH */
+		uint32_t timestamp_high         : 32;
+	} s;
+};
+
+#endif
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 90/92] hw/net/can: CTU CAN FD IP open hardware core emulation.
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (88 preceding siblings ...)
  2020-09-24  9:23 ` [PULL 89/92] hw/net/can/ctucafd: Add CTU CAN FD core register definitions Paolo Bonzini
@ 2020-09-24  9:23 ` Paolo Bonzini
  2020-11-02 16:32   ` Peter Maydell
  2020-09-24  9:23 ` [PULL 91/92] hw/net/can: Documentation for " Paolo Bonzini
                   ` (3 subsequent siblings)
  93 siblings, 1 reply; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: Jan Charvat, Pavel Pisa

From: Jan Charvat <charvj10@fel.cvut.cz>

The implementation of the model of complete open-source/design/hardware
CAN FD controller. The IP core project has been started and is maintained
by Ondrej Ille at Czech Technical University in Prague.

CTU CAN FD project pages:
	https://gitlab.fel.cvut.cz/canbus/ctucanfd_ip_core

CAN bus CTU FEE Projects Listing page:
	http://canbus.pages.fel.cvut.cz/

The core is mapped to PCIe card same as on one of its real hardware
adaptations. The device implementing two CTU CAN FD ip cores
is instantiated after CAN bus definition

	-object can-bus,id=canbus0-bus

by QEMU parameters

	-device ctucan_pci,canbus0=canbus0-bus,canbus1=canbus0-bus

Signed-off-by: Jan Charvat <charvj10@fel.cvut.cz>
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Message-Id: <23e3ca4dcb2cc9900991016910a6cab7686c0e31.1600069689.git.pisa@cmp.felk.cvut.cz>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/net/Kconfig           |  11 +
 hw/net/can/ctucan_core.c | 696 +++++++++++++++++++++++++++++++++++++++
 hw/net/can/ctucan_core.h | 127 +++++++
 hw/net/can/ctucan_pci.c  | 281 ++++++++++++++++
 hw/net/can/meson.build   |   2 +
 5 files changed, 1117 insertions(+)
 create mode 100644 hw/net/can/ctucan_core.c
 create mode 100644 hw/net/can/ctucan_core.h
 create mode 100644 hw/net/can/ctucan_pci.c

diff --git a/hw/net/Kconfig b/hw/net/Kconfig
index e43c96dae0..225d948841 100644
--- a/hw/net/Kconfig
+++ b/hw/net/Kconfig
@@ -143,3 +143,14 @@ config CAN_SJA1000
     default y if PCI_DEVICES
     depends on PCI
     select CAN_BUS
+
+config CAN_CTUCANFD
+    bool
+    default y if PCI_DEVICES
+    select CAN_BUS
+
+config CAN_CTUCANFD_PCI
+    bool
+    default y if PCI_DEVICES
+    depends on PCI && CAN_CTUCANFD
+    select CAN_BUS
diff --git a/hw/net/can/ctucan_core.c b/hw/net/can/ctucan_core.c
new file mode 100644
index 0000000000..d20835cd7e
--- /dev/null
+++ b/hw/net/can/ctucan_core.c
@@ -0,0 +1,696 @@
+/*
+ * CTU CAN FD PCI device emulation
+ * http://canbus.pages.fel.cvut.cz/
+ *
+ * Copyright (c) 2019 Jan Charvat (jancharvat.charvat@gmail.com)
+ *
+ * Based on Kvaser PCI CAN device (SJA1000 based) emulation implemented by
+ * Jin Yang and Pavel Pisa
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "qemu/osdep.h"
+#include "qemu/log.h"
+#include "chardev/char.h"
+#include "hw/irq.h"
+#include "migration/vmstate.h"
+#include "net/can_emu.h"
+
+#include "ctucan_core.h"
+
+#ifndef DEBUG_CAN
+#define DEBUG_CAN 0
+#endif /*DEBUG_CAN*/
+
+#define DPRINTF(fmt, ...) \
+    do { \
+        if (DEBUG_CAN) { \
+            qemu_log("[ctucan]: " fmt , ## __VA_ARGS__); \
+        } \
+    } while (0)
+
+static void ctucan_buff2frame(const uint8_t *buff, qemu_can_frame *frame)
+{
+    frame->can_id = 0;
+    frame->can_dlc = 0;
+    frame->flags = 0;
+
+    if (buff == NULL) {
+        return;
+    }
+    {
+        union ctu_can_fd_frame_form_w frame_form_w;
+        union ctu_can_fd_identifier_w identifier_w;
+        unsigned int ide;
+        uint32_t w;
+
+        w = le32_to_cpu(*(uint32_t *)buff);
+        frame_form_w = (union ctu_can_fd_frame_form_w)w;
+        frame->can_dlc = can_dlc2len(frame_form_w.s.dlc);
+
+        w = le32_to_cpu(*(uint32_t *)(buff + 4));
+        identifier_w = (union ctu_can_fd_identifier_w)w;
+
+        ide = frame_form_w.s.ide;
+        if (ide) {
+            frame->can_id = (identifier_w.s.identifier_base << 18) |
+                            identifier_w.s.identifier_ext;
+            frame->can_id |= QEMU_CAN_EFF_FLAG;
+        } else {
+            frame->can_id = identifier_w.s.identifier_base;
+        }
+
+        if (frame_form_w.s.esi_rsv) {
+            frame->flags |= QEMU_CAN_FRMF_ESI;
+        }
+
+        if (frame_form_w.s.rtr) {
+            frame->can_id |= QEMU_CAN_RTR_FLAG;
+        }
+
+        if (frame_form_w.s.fdf) {   /*CAN FD*/
+            frame->flags |= QEMU_CAN_FRMF_TYPE_FD;
+            if (frame_form_w.s.brs) {
+                frame->flags |= QEMU_CAN_FRMF_BRS;
+            }
+        }
+    }
+
+    memcpy(frame->data, buff + 0x10, 0x40);
+}
+
+
+static int ctucan_frame2buff(const qemu_can_frame *frame, uint8_t *buff)
+{
+    unsigned int bytes_cnt = -1;
+    memset(buff, 0, CTUCAN_MSG_MAX_LEN * sizeof(*buff));
+
+    if (frame == NULL) {
+        return bytes_cnt;
+    }
+    {
+        union ctu_can_fd_frame_form_w frame_form_w;
+        union ctu_can_fd_identifier_w identifier_w;
+
+        frame_form_w.u32 = 0;
+        identifier_w.u32 = 0;
+
+        bytes_cnt = frame->can_dlc;
+        bytes_cnt = (bytes_cnt + 3) & ~3;
+        bytes_cnt += 16;
+        frame_form_w.s.rwcnt = (bytes_cnt >> 2) - 1;
+
+        frame_form_w.s.dlc = can_len2dlc(frame->can_dlc);
+
+        if (frame->can_id & QEMU_CAN_EFF_FLAG) {
+            frame_form_w.s.ide = 1;
+            identifier_w.s.identifier_base =
+                                    (frame->can_id & 0x1FFC0000) >> 18;
+            identifier_w.s.identifier_ext = frame->can_id & 0x3FFFF;
+        } else {
+            identifier_w.s.identifier_base = frame->can_id & 0x7FF;
+        }
+
+        if (frame->flags & QEMU_CAN_FRMF_ESI) {
+            frame_form_w.s.esi_rsv = 1;
+        }
+
+        if (frame->can_id & QEMU_CAN_RTR_FLAG) {
+            frame_form_w.s.rtr = 1;
+        }
+
+        if (frame->flags & QEMU_CAN_FRMF_TYPE_FD) {  /*CAN FD*/
+           frame_form_w.s.fdf = 1;
+            if (frame->flags & QEMU_CAN_FRMF_BRS) {
+                frame_form_w.s.brs = 1;
+            }
+        }
+        *(uint32_t *)buff = cpu_to_le32(frame_form_w.u32);
+        *(uint32_t *)(buff + 4) = cpu_to_le32(identifier_w.u32);
+    }
+
+    memcpy(buff + 0x10, frame->data, 0x40);
+
+    return bytes_cnt;
+}
+
+static void ctucan_update_irq(CtuCanCoreState *s)
+{
+    union ctu_can_fd_int_stat int_rq;
+
+    int_rq.u32 = 0;
+
+    if (s->rx_status_rx_settings.s.rxfrc) {
+        int_rq.s.rbnei = 1;
+    }
+
+    int_rq.u32 &= ~s->int_mask.u32;
+    s->int_stat.u32 |= int_rq.u32;
+    if (s->int_stat.u32 & s->int_ena.u32) {
+        qemu_irq_raise(s->irq);
+    } else {
+        qemu_irq_lower(s->irq);
+    }
+}
+
+static void ctucan_update_txnf(CtuCanCoreState *s)
+{
+    int i;
+    int txnf;
+    unsigned int buff_st;
+
+    txnf = 0;
+
+    for (i = 0; i < CTUCAN_CORE_TXBUF_NUM; i++) {
+        buff_st = (s->tx_status.u32 >> (i * 4)) & 0xf;
+        if (buff_st == TXT_ETY) {
+            txnf = 1;
+        }
+    }
+    s->status.s.txnf = txnf;
+}
+
+void ctucan_hardware_reset(CtuCanCoreState *s)
+{
+    DPRINTF("Hardware reset in progress!!!\n");
+    int i;
+    unsigned int buff_st;
+    uint32_t buff_st_mask;
+
+    s->tx_status.u32 = 0;
+    for (i = 0; i < CTUCAN_CORE_TXBUF_NUM; i++) {
+        buff_st_mask = 0xf << (i * 4);
+        buff_st = TXT_ETY;
+        s->tx_status.u32 = (s->tx_status.u32 & ~buff_st_mask) |
+            (buff_st << (i * 4));
+    }
+    s->status.s.idle = 1;
+
+    ctucan_update_txnf(s);
+
+    s->rx_status_rx_settings.u32 = 0;
+    s->rx_tail_pos = 0;
+    s->rx_cnt = 0;
+    s->rx_frame_rem = 0;
+
+    /* Flush RX buffer */
+    s->rx_tail_pos = 0;
+    s->rx_cnt = 0;
+    s->rx_frame_rem = 0;
+
+    /* Set on progdokum reset value */
+    s->mode_settings.u32 = 0;
+    s->mode_settings.s.fde = 1;
+
+    s->int_stat.u32 = 0;
+    s->int_ena.u32 = 0;
+    s->int_mask.u32 = 0;
+
+    s->rx_status_rx_settings.u32 = 0;
+    s->rx_status_rx_settings.s.rxe = 0;
+
+    s->rx_fr_ctr.u32 = 0;
+    s->tx_fr_ctr.u32 = 0;
+
+    s->yolo_reg.s.yolo_val = 3735928559;
+
+    qemu_irq_lower(s->irq);
+}
+
+static void ctucan_send_ready_buffers(CtuCanCoreState *s)
+{
+    qemu_can_frame frame;
+    uint8_t *pf;
+    int buff2tx_idx;
+    uint32_t tx_prio_max;
+    unsigned int buff_st;
+    uint32_t buff_st_mask;
+
+    if (!s->mode_settings.s.ena) {
+        return;
+    }
+
+    do {
+        union ctu_can_fd_int_stat int_stat;
+        int i;
+        buff2tx_idx = -1;
+        tx_prio_max = 0;
+
+        for (i = 0; i < CTUCAN_CORE_TXBUF_NUM; i++) {
+            uint32_t prio;
+
+            buff_st_mask = 0xf << (i * 4);
+            buff_st = (s->tx_status.u32 >> (i * 4)) & 0xf;
+
+            if (buff_st != TXT_RDY) {
+                continue;
+            }
+            prio = (s->tx_priority.u32 >> (i * 4)) & 0x7;
+            if (tx_prio_max < prio) {
+                tx_prio_max = prio;
+                buff2tx_idx = i;
+            }
+        }
+        if (buff2tx_idx == -1) {
+            break;
+        }
+        buff_st_mask = 0xf << (buff2tx_idx * 4);
+        buff_st = (s->tx_status.u32 >> (buff2tx_idx * 4)) & 0xf;
+        int_stat.u32 = 0;
+        buff_st = TXT_RDY;
+        pf = s->tx_buffer[buff2tx_idx].data;
+        ctucan_buff2frame(pf, &frame);
+        s->status.s.idle = 0;
+        s->status.s.txs = 1;
+        can_bus_client_send(&s->bus_client, &frame, 1);
+        s->status.s.idle = 1;
+        s->status.s.txs = 0;
+        s->tx_fr_ctr.s.tx_fr_ctr_val++;
+        buff_st = TXT_TOK;
+        int_stat.s.txi = 1;
+        int_stat.s.txbhci = 1;
+        s->int_stat.u32 |= int_stat.u32 & ~s->int_mask.u32;
+        s->tx_status.u32 = (s->tx_status.u32 & ~buff_st_mask) |
+                        (buff_st << (buff2tx_idx * 4));
+    } while (1);
+}
+
+#define CTUCAN_CORE_TXBUFF_SPAN \
+            (CTU_CAN_FD_TXTB2_DATA_1 - CTU_CAN_FD_TXTB1_DATA_1)
+
+void ctucan_mem_write(CtuCanCoreState *s, hwaddr addr, uint64_t val,
+                       unsigned size)
+{
+    int              i;
+
+    DPRINTF("write 0x%02llx addr 0x%02x\n",
+            (unsigned long long)val, (unsigned int)addr);
+
+    if (addr > CTUCAN_CORE_MEM_SIZE) {
+        return;
+    }
+
+    if (addr >= CTU_CAN_FD_TXTB1_DATA_1) {
+        int buff_num;
+        addr -= CTU_CAN_FD_TXTB1_DATA_1;
+        buff_num = addr / CTUCAN_CORE_TXBUFF_SPAN;
+        addr %= CTUCAN_CORE_TXBUFF_SPAN;
+        if (buff_num < CTUCAN_CORE_TXBUF_NUM) {
+            uint32_t *bufp = (uint32_t *)(s->tx_buffer[buff_num].data + addr);
+            *bufp = cpu_to_le32(val);
+        }
+    } else {
+        switch (addr & ~3) {
+        case CTU_CAN_FD_MODE:
+            s->mode_settings.u32 = (uint32_t)val;
+            if (s->mode_settings.s.rst) {
+                ctucan_hardware_reset(s);
+                s->mode_settings.s.rst = 0;
+            }
+            break;
+        case CTU_CAN_FD_COMMAND:
+        {
+            union ctu_can_fd_command command;
+            command.u32 = (uint32_t)val;
+            if (command.s.cdo) {
+                s->status.s.dor = 0;
+            }
+            if (command.s.rrb) {
+                s->rx_tail_pos = 0;
+                s->rx_cnt = 0;
+                s->rx_frame_rem = 0;
+                s->rx_status_rx_settings.s.rxfrc = 0;
+            }
+            if (command.s.txfcrst) {
+                s->tx_fr_ctr.s.tx_fr_ctr_val = 0;
+            }
+            if (command.s.rxfcrst) {
+                s->rx_fr_ctr.s.rx_fr_ctr_val = 0;
+            }
+            break;
+        }
+        case CTU_CAN_FD_INT_STAT:
+            s->int_stat.u32 &= ~(uint32_t)val;
+            break;
+        case CTU_CAN_FD_INT_ENA_SET:
+            s->int_ena.u32 |= (uint32_t)val;
+            break;
+        case CTU_CAN_FD_INT_ENA_CLR:
+            s->int_ena.u32 &= ~(uint32_t)val;
+            break;
+        case CTU_CAN_FD_INT_MASK_SET:
+            s->int_mask.u32 |= (uint32_t)val;
+            break;
+        case CTU_CAN_FD_INT_MASK_CLR:
+            s->int_mask.u32 &= ~(uint32_t)val;
+            break;
+        case CTU_CAN_FD_TX_COMMAND:
+            if (s->mode_settings.s.ena) {
+                union ctu_can_fd_tx_command tx_command;
+                union ctu_can_fd_tx_command mask;
+                unsigned int buff_st;
+                uint32_t buff_st_mask;
+
+                tx_command.u32 = (uint32_t)val;
+                mask.u32 = 0;
+                mask.s.txb1 = 1;
+
+                for (i = 0; i < CTUCAN_CORE_TXBUF_NUM; i++) {
+                    if (!(tx_command.u32 & (mask.u32 << i))) {
+                        continue;
+                    }
+                    buff_st_mask = 0xf << (i * 4);
+                    buff_st = (s->tx_status.u32 >> (i * 4)) & 0xf;
+                    if (tx_command.s.txca) {
+                        if (buff_st == TXT_RDY) {
+                            buff_st = TXT_ABT;
+                        }
+                    }
+                    if (tx_command.s.txcr) {
+                        if ((buff_st == TXT_TOK) || (buff_st == TXT_ERR) ||
+                            (buff_st == TXT_ABT) || (buff_st == TXT_ETY))
+                            buff_st = TXT_RDY;
+                    }
+                    if (tx_command.s.txce) {
+                        if ((buff_st == TXT_TOK) || (buff_st == TXT_ERR) ||
+                            (buff_st == TXT_ABT))
+                            buff_st = TXT_ETY;
+                    }
+                    s->tx_status.u32 = (s->tx_status.u32 & ~buff_st_mask) |
+                                        (buff_st << (i * 4));
+                }
+
+                ctucan_send_ready_buffers(s);
+                ctucan_update_txnf(s);
+            }
+            break;
+        case CTU_CAN_FD_TX_PRIORITY:
+            s->tx_priority.u32 = (uint32_t)val;
+            break;
+        }
+
+        ctucan_update_irq(s);
+    }
+
+    return;
+}
+
+uint64_t ctucan_mem_read(CtuCanCoreState *s, hwaddr addr, unsigned size)
+{
+    uint32_t val = 0;
+
+    DPRINTF("read addr 0x%02x ...\n", (unsigned int)addr);
+
+    if (addr > CTUCAN_CORE_MEM_SIZE) {
+        return 0;
+    }
+
+    switch (addr & ~3) {
+    case CTU_CAN_FD_DEVICE_ID:
+        {
+            union ctu_can_fd_device_id_version idver;
+            idver.u32 = 0;
+            idver.s.device_id = CTU_CAN_FD_ID;
+            idver.s.ver_major = 2;
+            idver.s.ver_minor = 2;
+            val = idver.u32;
+        }
+        break;
+    case CTU_CAN_FD_MODE:
+        val = s->mode_settings.u32;
+        break;
+    case CTU_CAN_FD_STATUS:
+        val = s->status.u32;
+        break;
+    case CTU_CAN_FD_INT_STAT:
+        val = s->int_stat.u32;
+        break;
+    case CTU_CAN_FD_INT_ENA_SET:
+    case CTU_CAN_FD_INT_ENA_CLR:
+        val = s->int_ena.u32;
+        break;
+    case CTU_CAN_FD_INT_MASK_SET:
+    case CTU_CAN_FD_INT_MASK_CLR:
+        val = s->int_mask.u32;
+        break;
+    case CTU_CAN_FD_RX_MEM_INFO:
+        s->rx_mem_info.u32 = 0;
+        s->rx_mem_info.s.rx_buff_size = CTUCAN_RCV_BUF_LEN >> 2;
+        s->rx_mem_info.s.rx_mem_free = (CTUCAN_RCV_BUF_LEN -
+                                        s->rx_cnt) >> 2;
+        val = s->rx_mem_info.u32;
+        break;
+    case CTU_CAN_FD_RX_POINTERS:
+    {
+        uint32_t rx_head_pos = s->rx_tail_pos + s->rx_cnt;
+        rx_head_pos %= CTUCAN_RCV_BUF_LEN;
+        s->rx_pointers.s.rx_wpp = rx_head_pos;
+        s->rx_pointers.s.rx_rpp = s->rx_tail_pos;
+        val = s->rx_pointers.u32;
+        break;
+    }
+    case CTU_CAN_FD_RX_STATUS:
+    case CTU_CAN_FD_RX_SETTINGS:
+        if (!s->rx_status_rx_settings.s.rxfrc) {
+            s->rx_status_rx_settings.s.rxe = 1;
+        } else {
+            s->rx_status_rx_settings.s.rxe = 0;
+        }
+        if (((s->rx_cnt + 3) & ~3) == CTUCAN_RCV_BUF_LEN) {
+            s->rx_status_rx_settings.s.rxf = 1;
+        } else {
+            s->rx_status_rx_settings.s.rxf = 0;
+        }
+        val = s->rx_status_rx_settings.u32;
+        break;
+    case CTU_CAN_FD_RX_DATA:
+        if (s->rx_cnt) {
+            memcpy(&val, s->rx_buff + s->rx_tail_pos, 4);
+            val = le32_to_cpu(val);
+            if (!s->rx_frame_rem) {
+                union ctu_can_fd_frame_form_w frame_form_w;
+                frame_form_w.u32 = val;
+                s->rx_frame_rem = frame_form_w.s.rwcnt * 4 + 4;
+            }
+            s->rx_cnt -= 4;
+            s->rx_frame_rem -= 4;
+            if (!s->rx_frame_rem) {
+                s->rx_status_rx_settings.s.rxfrc--;
+                if (!s->rx_status_rx_settings.s.rxfrc) {
+                    s->status.s.rxne = 0;
+                    s->status.s.idle = 1;
+                    s->status.s.rxs = 0;
+                }
+            }
+            s->rx_tail_pos = (s->rx_tail_pos + 4) % CTUCAN_RCV_BUF_LEN;
+        } else {
+            val = 0;
+        }
+        break;
+    case CTU_CAN_FD_TX_STATUS:
+        val = s->tx_status.u32;
+        break;
+    case CTU_CAN_FD_TX_PRIORITY:
+        val = s->tx_priority.u32;
+        break;
+    case CTU_CAN_FD_RX_FR_CTR:
+        val = s->rx_fr_ctr.s.rx_fr_ctr_val;
+        break;
+    case CTU_CAN_FD_TX_FR_CTR:
+        val = s->tx_fr_ctr.s.tx_fr_ctr_val;
+        break;
+    case CTU_CAN_FD_YOLO_REG:
+        val = s->yolo_reg.s.yolo_val;
+        break;
+    }
+
+    val >>= ((addr & 3) << 3);
+    if (size < 8) {
+        val &= ((uint64_t)1 << (size << 3)) - 1;
+    }
+
+    return val;
+}
+
+bool ctucan_can_receive(CanBusClientState *client)
+{
+    CtuCanCoreState *s = container_of(client, CtuCanCoreState, bus_client);
+
+    if (!s->mode_settings.s.ena) {
+        return false;
+    }
+
+    return true; /* always return true, when operation mode */
+}
+
+ssize_t ctucan_receive(CanBusClientState *client, const qemu_can_frame *frames,
+                        size_t frames_cnt)
+{
+    CtuCanCoreState *s = container_of(client, CtuCanCoreState, bus_client);
+    static uint8_t rcv[CTUCAN_MSG_MAX_LEN];
+    int i;
+    int ret = -1;
+    const qemu_can_frame *frame = frames;
+    union ctu_can_fd_int_stat int_stat;
+    int_stat.u32 = 0;
+
+    if (frames_cnt <= 0) {
+        return 0;
+    }
+
+    ret = ctucan_frame2buff(frame, rcv);
+
+    if (s->rx_cnt + ret > CTUCAN_RCV_BUF_LEN) { /* Data overrun. */
+        s->status.s.dor = 1;
+        int_stat.s.doi = 1;
+        s->int_stat.u32 |= int_stat.u32 & ~s->int_mask.u32;
+        ctucan_update_irq(s);
+        DPRINTF("Receive FIFO overrun\n");
+        return ret;
+    }
+    s->status.s.idle = 0;
+    s->status.s.rxs = 1;
+    int_stat.s.rxi = 1;
+    if (((s->rx_cnt + 3) & ~3) == CTUCAN_RCV_BUF_LEN) {
+        int_stat.s.rxfi = 1;
+    }
+    s->int_stat.u32 |= int_stat.u32 & ~s->int_mask.u32;
+    s->rx_fr_ctr.s.rx_fr_ctr_val++;
+    s->rx_status_rx_settings.s.rxfrc++;
+    for (i = 0; i < ret; i++) {
+        s->rx_buff[(s->rx_tail_pos + s->rx_cnt) % CTUCAN_RCV_BUF_LEN] = rcv[i];
+        s->rx_cnt++;
+    }
+    s->status.s.rxne = 1;
+
+    ctucan_update_irq(s);
+
+    return 1;
+}
+
+static CanBusClientInfo ctucan_bus_client_info = {
+    .can_receive = ctucan_can_receive,
+    .receive = ctucan_receive,
+};
+
+
+int ctucan_connect_to_bus(CtuCanCoreState *s, CanBusState *bus)
+{
+    s->bus_client.info = &ctucan_bus_client_info;
+
+    if (!bus) {
+        return -EINVAL;
+    }
+
+    if (can_bus_insert_client(bus, &s->bus_client) < 0) {
+        return -1;
+    }
+
+    return 0;
+}
+
+void ctucan_disconnect(CtuCanCoreState *s)
+{
+    can_bus_remove_client(&s->bus_client);
+}
+
+int ctucan_init(CtuCanCoreState *s, qemu_irq irq)
+{
+    s->irq = irq;
+
+    qemu_irq_lower(s->irq);
+
+    ctucan_hardware_reset(s);
+
+    return 0;
+}
+
+const VMStateDescription vmstate_qemu_ctucan_tx_buffer = {
+    .name = "qemu_ctucan_tx_buffer",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .minimum_version_id_old = 1,
+    .fields = (VMStateField[]) {
+        VMSTATE_UINT8_ARRAY(data, CtuCanCoreMsgBuffer, CTUCAN_CORE_MSG_MAX_LEN),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
+static int ctucan_post_load(void *opaque, int version_id)
+{
+    CtuCanCoreState *s = opaque;
+    ctucan_update_irq(s);
+    return 0;
+}
+
+/* VMState is needed for live migration of QEMU images */
+const VMStateDescription vmstate_ctucan = {
+    .name = "ctucan",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .minimum_version_id_old = 1,
+    .post_load = ctucan_post_load,
+    .fields = (VMStateField[]) {
+        VMSTATE_UINT32(mode_settings.u32, CtuCanCoreState),
+        VMSTATE_UINT32(status.u32, CtuCanCoreState),
+        VMSTATE_UINT32(int_stat.u32, CtuCanCoreState),
+        VMSTATE_UINT32(int_ena.u32, CtuCanCoreState),
+        VMSTATE_UINT32(int_mask.u32, CtuCanCoreState),
+        VMSTATE_UINT32(brt.u32, CtuCanCoreState),
+        VMSTATE_UINT32(brt_fd.u32, CtuCanCoreState),
+        VMSTATE_UINT32(ewl_erp_fault_state.u32, CtuCanCoreState),
+        VMSTATE_UINT32(rec_tec.u32, CtuCanCoreState),
+        VMSTATE_UINT32(err_norm_err_fd.u32, CtuCanCoreState),
+        VMSTATE_UINT32(ctr_pres.u32, CtuCanCoreState),
+        VMSTATE_UINT32(filter_a_mask.u32, CtuCanCoreState),
+        VMSTATE_UINT32(filter_a_val.u32, CtuCanCoreState),
+        VMSTATE_UINT32(filter_b_mask.u32, CtuCanCoreState),
+        VMSTATE_UINT32(filter_b_val.u32, CtuCanCoreState),
+        VMSTATE_UINT32(filter_c_mask.u32, CtuCanCoreState),
+        VMSTATE_UINT32(filter_c_val.u32, CtuCanCoreState),
+        VMSTATE_UINT32(filter_ran_low.u32, CtuCanCoreState),
+        VMSTATE_UINT32(filter_ran_high.u32, CtuCanCoreState),
+        VMSTATE_UINT32(filter_control_filter_status.u32, CtuCanCoreState),
+        VMSTATE_UINT32(rx_mem_info.u32, CtuCanCoreState),
+        VMSTATE_UINT32(rx_pointers.u32, CtuCanCoreState),
+        VMSTATE_UINT32(rx_status_rx_settings.u32, CtuCanCoreState),
+        VMSTATE_UINT32(tx_status.u32, CtuCanCoreState),
+        VMSTATE_UINT32(tx_priority.u32, CtuCanCoreState),
+        VMSTATE_UINT32(err_capt_alc.u32, CtuCanCoreState),
+        VMSTATE_UINT32(trv_delay_ssp_cfg.u32, CtuCanCoreState),
+        VMSTATE_UINT32(rx_fr_ctr.u32, CtuCanCoreState),
+        VMSTATE_UINT32(tx_fr_ctr.u32, CtuCanCoreState),
+        VMSTATE_UINT32(debug_register.u32, CtuCanCoreState),
+        VMSTATE_UINT32(yolo_reg.u32, CtuCanCoreState),
+        VMSTATE_UINT32(timestamp_low.u32, CtuCanCoreState),
+        VMSTATE_UINT32(timestamp_high.u32, CtuCanCoreState),
+
+        VMSTATE_STRUCT_ARRAY(tx_buffer, CtuCanCoreState,
+                CTUCAN_CORE_TXBUF_NUM, 0, vmstate_qemu_ctucan_tx_buffer,
+                CtuCanCoreMsgBuffer),
+
+        VMSTATE_BUFFER(rx_buff, CtuCanCoreState),
+        VMSTATE_UINT32(rx_tail_pos, CtuCanCoreState),
+        VMSTATE_UINT32(rx_cnt, CtuCanCoreState),
+        VMSTATE_UINT32(rx_frame_rem, CtuCanCoreState),
+
+        VMSTATE_END_OF_LIST()
+    }
+};
diff --git a/hw/net/can/ctucan_core.h b/hw/net/can/ctucan_core.h
new file mode 100644
index 0000000000..f21cb1c5ec
--- /dev/null
+++ b/hw/net/can/ctucan_core.h
@@ -0,0 +1,127 @@
+/*
+ * CTU CAN FD device emulation
+ * http://canbus.pages.fel.cvut.cz/
+ *
+ * Copyright (c) 2019 Jan Charvat (jancharvat.charvat@gmail.com)
+ *
+ * Based on Kvaser PCI CAN device (SJA1000 based) emulation implemented by
+ * Jin Yang and Pavel Pisa
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#ifndef HW_CAN_CTUCAN_CORE_H
+#define HW_CAN_CTUCAN_CORE_H
+
+#include "exec/hwaddr.h"
+#include "net/can_emu.h"
+
+
+#ifndef __LITTLE_ENDIAN_BITFIELD
+#define __LITTLE_ENDIAN_BITFIELD 1
+#endif
+
+#include "ctu_can_fd_frame.h"
+#include "ctu_can_fd_regs.h"
+
+#define CTUCAN_CORE_MEM_SIZE       0x500
+
+/* The max size for a message in FIFO */
+#define CTUCAN_MSG_MAX_LEN        (CTU_CAN_FD_DATA_1_4_W + 64)
+/* The receive buffer size. */
+#define CTUCAN_RCV_BUF_LEN        (1024 * 8)
+
+
+/* The max size for a message buffer */
+#define CTUCAN_CORE_MSG_MAX_LEN       0x50
+/* The receive buffer size. */
+#define CTUCAN_CORE_RCV_BUF_LEN       0x1000
+
+#define CTUCAN_CORE_TXBUF_NUM            4
+
+typedef struct CtuCanCoreMsgBuffer {
+    uint8_t data[CTUCAN_CORE_MSG_MAX_LEN];
+} CtuCanCoreMsgBuffer;
+
+typedef struct CtuCanCoreState {
+    union ctu_can_fd_mode_settings                  mode_settings;
+    union ctu_can_fd_status                         status;
+    union ctu_can_fd_int_stat                       int_stat;
+    union ctu_can_fd_int_ena_set                    int_ena;
+    union ctu_can_fd_int_mask_set                   int_mask;
+    union ctu_can_fd_btr                            brt;
+    union ctu_can_fd_btr_fd                         brt_fd;
+    union ctu_can_fd_ewl_erp_fault_state            ewl_erp_fault_state;
+    union ctu_can_fd_rec_tec                        rec_tec;
+    union ctu_can_fd_err_norm_err_fd                err_norm_err_fd;
+    union ctu_can_fd_ctr_pres                       ctr_pres;
+    union ctu_can_fd_filter_a_mask                  filter_a_mask;
+    union ctu_can_fd_filter_a_val                   filter_a_val;
+    union ctu_can_fd_filter_b_mask                  filter_b_mask;
+    union ctu_can_fd_filter_b_val                   filter_b_val;
+    union ctu_can_fd_filter_c_mask                  filter_c_mask;
+    union ctu_can_fd_filter_c_val                   filter_c_val;
+    union ctu_can_fd_filter_ran_low                 filter_ran_low;
+    union ctu_can_fd_filter_ran_high                filter_ran_high;
+    union ctu_can_fd_filter_control_filter_status   filter_control_filter_status;
+    union ctu_can_fd_rx_mem_info                    rx_mem_info;
+    union ctu_can_fd_rx_pointers                    rx_pointers;
+    union ctu_can_fd_rx_status_rx_settings          rx_status_rx_settings;
+    union ctu_can_fd_tx_status                      tx_status;
+    union ctu_can_fd_tx_priority                    tx_priority;
+    union ctu_can_fd_err_capt_alc                   err_capt_alc;
+    union ctu_can_fd_trv_delay_ssp_cfg              trv_delay_ssp_cfg;
+    union ctu_can_fd_rx_fr_ctr                      rx_fr_ctr;
+    union ctu_can_fd_tx_fr_ctr                      tx_fr_ctr;
+    union ctu_can_fd_debug_register                 debug_register;
+    union ctu_can_fd_yolo_reg                       yolo_reg;
+    union ctu_can_fd_timestamp_low                  timestamp_low;
+    union ctu_can_fd_timestamp_high                 timestamp_high;
+
+    CtuCanCoreMsgBuffer tx_buffer[CTUCAN_CORE_TXBUF_NUM];
+
+    uint8_t         rx_buff[CTUCAN_RCV_BUF_LEN];  /* 32~95 .. 64bytes Rx FIFO */
+    uint32_t        rx_tail_pos;        /* Count by bytes. */
+    uint32_t        rx_cnt;        /* Count by bytes. */
+    uint32_t        rx_frame_rem;
+
+    qemu_irq        irq;
+    CanBusClientState bus_client;
+} CtuCanCoreState;
+
+void ctucan_hardware_reset(CtuCanCoreState *s);
+
+void ctucan_mem_write(CtuCanCoreState *s, hwaddr addr, uint64_t val,
+                       unsigned size);
+
+uint64_t ctucan_mem_read(CtuCanCoreState *s, hwaddr addr, unsigned size);
+
+int ctucan_connect_to_bus(CtuCanCoreState *s, CanBusState *bus);
+
+void ctucan_disconnect(CtuCanCoreState *s);
+
+int ctucan_init(CtuCanCoreState *s, qemu_irq irq);
+
+bool ctucan_can_receive(CanBusClientState *client);
+
+ssize_t ctucan_receive(CanBusClientState *client,
+                        const qemu_can_frame *frames, size_t frames_cnt);
+
+extern const VMStateDescription vmstate_ctucan;
+
+#endif
diff --git a/hw/net/can/ctucan_pci.c b/hw/net/can/ctucan_pci.c
new file mode 100644
index 0000000000..f1c86cd06a
--- /dev/null
+++ b/hw/net/can/ctucan_pci.c
@@ -0,0 +1,281 @@
+/*
+ * CTU CAN FD PCI device emulation
+ * http://canbus.pages.fel.cvut.cz/
+ *
+ * Copyright (c) 2019 Jan Charvat (jancharvat.charvat@gmail.com)
+ *
+ * Based on Kvaser PCI CAN device (SJA1000 based) emulation implemented by
+ * Jin Yang and Pavel Pisa
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "qemu/osdep.h"
+#include "qemu/event_notifier.h"
+#include "qemu/module.h"
+#include "qemu/thread.h"
+#include "qemu/sockets.h"
+#include "qapi/error.h"
+#include "chardev/char.h"
+#include "hw/irq.h"
+#include "hw/pci/pci.h"
+#include "hw/qdev-properties.h"
+#include "migration/vmstate.h"
+#include "net/can_emu.h"
+
+#include "ctucan_core.h"
+
+#define TYPE_CTUCAN_PCI_DEV "ctucan_pci"
+
+typedef struct CtuCanPCIState CtuCanPCIState;
+DECLARE_INSTANCE_CHECKER(CtuCanPCIState, CTUCAN_PCI_DEV,
+                         TYPE_CTUCAN_PCI_DEV)
+
+#define CTUCAN_PCI_CORE_COUNT     2
+#define CTUCAN_PCI_CORE_RANGE     0x10000
+
+#define CTUCAN_PCI_BAR_COUNT      2
+
+#define CTUCAN_PCI_BYTES_PER_CORE 0x4000
+
+#ifndef PCI_VENDOR_ID_TEDIA
+#define PCI_VENDOR_ID_TEDIA 0x1760
+#endif
+
+#define PCI_DEVICE_ID_TEDIA_CTUCAN_VER21 0xff00
+
+#define CTUCAN_BAR0_RANGE 0x8000
+#define CTUCAN_BAR0_CTUCAN_ID 0x0000
+#define CTUCAN_BAR0_CRA_BASE  0x4000
+#define CYCLONE_IV_CRA_A2P_IE (0x0050)
+
+#define CTUCAN_WITHOUT_CTUCAN_ID  0
+#define CTUCAN_WITH_CTUCAN_ID     1
+
+struct CtuCanPCIState {
+    /*< private >*/
+    PCIDevice       dev;
+    /*< public >*/
+    MemoryRegion    ctucan_io[CTUCAN_PCI_BAR_COUNT];
+
+    CtuCanCoreState ctucan_state[CTUCAN_PCI_CORE_COUNT];
+    qemu_irq        irq;
+
+    char            *model; /* The model that support, only SJA1000 now. */
+    CanBusState     *canbus[CTUCAN_PCI_CORE_COUNT];
+};
+
+static void ctucan_pci_reset(DeviceState *dev)
+{
+    CtuCanPCIState *d = CTUCAN_PCI_DEV(dev);
+    int i;
+
+    for (i = 0 ; i < CTUCAN_PCI_CORE_COUNT; i++) {
+        ctucan_hardware_reset(&d->ctucan_state[i]);
+    }
+}
+
+static uint64_t ctucan_pci_id_cra_io_read(void *opaque, hwaddr addr,
+                                          unsigned size)
+{
+    if (addr >= 4) {
+        return 0;
+    }
+
+    uint64_t tmp = 0xC0000000 + CTUCAN_PCI_CORE_COUNT;
+    tmp >>= ((addr & 3) << 3);
+    if (size < 8) {
+        tmp &= ((uint64_t)1 << (size << 3)) - 1;
+    }
+    return tmp;
+}
+
+static void ctucan_pci_id_cra_io_write(void *opaque, hwaddr addr, uint64_t data,
+                             unsigned size)
+{
+
+}
+
+static uint64_t ctucan_pci_cores_io_read(void *opaque, hwaddr addr,
+                                          unsigned size)
+{
+    CtuCanPCIState *d = opaque;
+    CtuCanCoreState *s;
+    hwaddr core_num = addr / CTUCAN_PCI_BYTES_PER_CORE;
+
+    if (core_num >= CTUCAN_PCI_CORE_COUNT) {
+        return 0;
+    }
+
+    s = &d->ctucan_state[core_num];
+
+    return ctucan_mem_read(s, addr % CTUCAN_PCI_BYTES_PER_CORE, size);
+}
+
+static void ctucan_pci_cores_io_write(void *opaque, hwaddr addr, uint64_t data,
+                             unsigned size)
+{
+    CtuCanPCIState *d = opaque;
+    CtuCanCoreState *s;
+    hwaddr core_num = addr / CTUCAN_PCI_BYTES_PER_CORE;
+
+    if (core_num >= CTUCAN_PCI_CORE_COUNT) {
+        return;
+    }
+
+    s = &d->ctucan_state[core_num];
+
+    return ctucan_mem_write(s, addr % CTUCAN_PCI_BYTES_PER_CORE, data, size);
+}
+
+static const MemoryRegionOps ctucan_pci_id_cra_io_ops = {
+    .read = ctucan_pci_id_cra_io_read,
+    .write = ctucan_pci_id_cra_io_write,
+    .endianness = DEVICE_LITTLE_ENDIAN,
+    .impl.min_access_size = 1,
+    .impl.max_access_size = 4,
+    .valid.min_access_size = 1,
+    .valid.max_access_size = 4,
+};
+
+static const MemoryRegionOps ctucan_pci_cores_io_ops = {
+    .read = ctucan_pci_cores_io_read,
+    .write = ctucan_pci_cores_io_write,
+    .endianness = DEVICE_LITTLE_ENDIAN,
+    .impl.min_access_size = 1,
+    .impl.max_access_size = 4,
+    .valid.min_access_size = 1,
+    .valid.max_access_size = 4,
+};
+
+static void ctucan_pci_realize(PCIDevice *pci_dev, Error **errp)
+{
+    CtuCanPCIState *d = CTUCAN_PCI_DEV(pci_dev);
+    uint8_t *pci_conf;
+    int i;
+
+    pci_conf = pci_dev->config;
+    pci_conf[PCI_INTERRUPT_PIN] = 0x01; /* interrupt pin A */
+
+    d->irq = pci_allocate_irq(&d->dev);
+
+    for (i = 0 ; i < CTUCAN_PCI_CORE_COUNT; i++) {
+        ctucan_init(&d->ctucan_state[i], d->irq);
+    }
+
+    for (i = 0 ; i < CTUCAN_PCI_CORE_COUNT; i++) {
+        if (ctucan_connect_to_bus(&d->ctucan_state[i], d->canbus[i]) < 0) {
+            error_setg(errp, "ctucan_connect_to_bus failed");
+            return;
+        }
+    }
+
+    memory_region_init_io(&d->ctucan_io[0], OBJECT(d),
+                          &ctucan_pci_id_cra_io_ops, d,
+                          "ctucan_pci-core0", CTUCAN_BAR0_RANGE);
+    memory_region_init_io(&d->ctucan_io[1], OBJECT(d),
+                          &ctucan_pci_cores_io_ops, d,
+                          "ctucan_pci-core1", CTUCAN_PCI_CORE_RANGE);
+
+    for (i = 0 ; i < CTUCAN_PCI_BAR_COUNT; i++) {
+        pci_register_bar(&d->dev, i, PCI_BASE_ADDRESS_MEM_MASK & 0,
+                         &d->ctucan_io[i]);
+    }
+}
+
+static void ctucan_pci_exit(PCIDevice *pci_dev)
+{
+    CtuCanPCIState *d = CTUCAN_PCI_DEV(pci_dev);
+    int i;
+
+    for (i = 0 ; i < CTUCAN_PCI_CORE_COUNT; i++) {
+        ctucan_disconnect(&d->ctucan_state[i]);
+    }
+
+    qemu_free_irq(d->irq);
+}
+
+static const VMStateDescription vmstate_ctucan_pci = {
+    .name = "ctucan_pci",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .minimum_version_id_old = 1,
+    .fields = (VMStateField[]) {
+        VMSTATE_PCI_DEVICE(dev, CtuCanPCIState),
+        VMSTATE_STRUCT(ctucan_state[0], CtuCanPCIState, 0, vmstate_ctucan,
+                       CtuCanCoreState),
+#if CTUCAN_PCI_CORE_COUNT >= 2
+        VMSTATE_STRUCT(ctucan_state[1], CtuCanPCIState, 0, vmstate_ctucan,
+                       CtuCanCoreState),
+#endif
+        VMSTATE_END_OF_LIST()
+    }
+};
+
+static void ctucan_pci_instance_init(Object *obj)
+{
+    CtuCanPCIState *d = CTUCAN_PCI_DEV(obj);
+
+    object_property_add_link(obj, "canbus0", TYPE_CAN_BUS,
+                             (Object **)&d->canbus[0],
+                             qdev_prop_allow_set_link_before_realize, 0);
+#if CTUCAN_PCI_CORE_COUNT >= 2
+    object_property_add_link(obj, "canbus1", TYPE_CAN_BUS,
+                             (Object **)&d->canbus[1],
+                             qdev_prop_allow_set_link_before_realize, 0);
+#endif
+}
+
+static void ctucan_pci_class_init(ObjectClass *klass, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(klass);
+    PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
+
+    k->realize = ctucan_pci_realize;
+    k->exit = ctucan_pci_exit;
+    k->vendor_id = PCI_VENDOR_ID_TEDIA;
+    k->device_id = PCI_DEVICE_ID_TEDIA_CTUCAN_VER21;
+    k->revision = 0x00;
+    k->class_id = 0x000c09;
+    k->subsystem_vendor_id = PCI_VENDOR_ID_TEDIA;
+    k->subsystem_id = PCI_DEVICE_ID_TEDIA_CTUCAN_VER21;
+    dc->desc = "CTU CAN PCI";
+    dc->vmsd = &vmstate_ctucan_pci;
+    set_bit(DEVICE_CATEGORY_MISC, dc->categories);
+    dc->reset = ctucan_pci_reset;
+}
+
+static const TypeInfo ctucan_pci_info = {
+    .name          = TYPE_CTUCAN_PCI_DEV,
+    .parent        = TYPE_PCI_DEVICE,
+    .instance_size = sizeof(CtuCanPCIState),
+    .class_init    = ctucan_pci_class_init,
+    .instance_init = ctucan_pci_instance_init,
+    .interfaces = (InterfaceInfo[]) {
+        { INTERFACE_CONVENTIONAL_PCI_DEVICE },
+        { },
+    },
+};
+
+static void ctucan_pci_register_types(void)
+{
+    type_register_static(&ctucan_pci_info);
+}
+
+type_init(ctucan_pci_register_types)
diff --git a/hw/net/can/meson.build b/hw/net/can/meson.build
index c9cfeb7954..714951f375 100644
--- a/hw/net/can/meson.build
+++ b/hw/net/can/meson.build
@@ -2,3 +2,5 @@ softmmu_ss.add(when: 'CONFIG_CAN_SJA1000', if_true: files('can_sja1000.c'))
 softmmu_ss.add(when: 'CONFIG_CAN_PCI', if_true: files('can_kvaser_pci.c'))
 softmmu_ss.add(when: 'CONFIG_CAN_PCI', if_true: files('can_pcm3680_pci.c'))
 softmmu_ss.add(when: 'CONFIG_CAN_PCI', if_true: files('can_mioe3680_pci.c'))
+softmmu_ss.add(when: 'CONFIG_CAN_CTUCANFD', if_true: files('ctucan_core.c'))
+softmmu_ss.add(when: 'CONFIG_CAN_CTUCANFD_PCI', if_true: files('ctucan_pci.c'))
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 91/92] hw/net/can: Documentation for CTU CAN FD IP open hardware core emulation.
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (89 preceding siblings ...)
  2020-09-24  9:23 ` [PULL 90/92] hw/net/can: CTU CAN FD IP open hardware core emulation Paolo Bonzini
@ 2020-09-24  9:23 ` Paolo Bonzini
  2020-09-24  9:23 ` [PULL 92/92] hw/net/can: Correct Kconfig dependencies Paolo Bonzini
                   ` (2 subsequent siblings)
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: Pavel Pisa

From: Pavel Pisa <pisa@cmp.felk.cvut.cz>

Updated MAINTAINERS for CAN bus related emulation as well.

Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Message-Id: <6d1b8db69efc4e5cfad702d2150e1960e8f63572.1600069689.git.pisa@cmp.felk.cvut.cz>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 MAINTAINERS  |   9 ++++
 docs/can.txt | 113 ++++++++++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 111 insertions(+), 11 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 40e6133022..3d32d82cab 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2089,6 +2089,15 @@ F: hw/rx/
 F: include/hw/intc/rx_icu.h
 F: include/hw/rx/
 
+CAN bus subsystem and hardware
+M: Pavel Pisa <pisa@cmp.felk.cvut.cz>
+M: Vikram Garhwal <fnu.vikram@xilinx.com>
+S: Maintained
+W: https://canbus.pages.fel.cvut.cz/
+F: net/can/*
+F: hw/net/can/*
+F: include/net/can_*.h
+
 Subsystems
 ----------
 Audio
diff --git a/docs/can.txt b/docs/can.txt
index 11ed8f2d68..5838f6620c 100644
--- a/docs/can.txt
+++ b/docs/can.txt
@@ -8,13 +8,22 @@ can be connected to host system CAN API (at this time only Linux
 SocketCAN is supported).
 
 The concept of busses is generic and different CAN controllers
-can be implemented for it but at this time only SJA1000 chip
-controller is implemented.
+can be implemented.
+
+The initial submission implemented SJA1000 controller which
+is common and well supported by by drivers for the most operating
+systems.
 
 The PCI addon card hardware has been selected as the first CAN
 interface to implement because such device can be easily connected
 to systems with different CPU architectures (x86, PowerPC, Arm, etc.).
 
+In 2020, CTU CAN FD controller model has been added as part
+of the bachelor theses of Jan Charvat. This controller is complete
+open-source/design/hardware solution. The core designer
+of the project is Ondrej Ille, the financial support has been
+provided by CTU, and more companies including Volkswagen subsidiaries.
+
 The project has been initially started in frame of RTEMS GSoC 2013
 slot by Jin Yang under our mentoring  The initial idea was to provide generic
 CAN subsystem for RTEMS. But lack of common environment for code and RTEMS
@@ -22,8 +31,8 @@ testing lead to goal change to provide environment which provides complete
 emulated environment for testing and RTEMS GSoC slot has been donated
 to work on CAN hardware emulation on QEMU.
 
-Examples how to use CAN emulation
-=================================
+Examples how to use CAN emulation for SJA1000 based borads
+==========================================================
 
 When QEMU with CAN PCI support is compiled then one of the next
 CAN boards can be selected
@@ -90,18 +99,100 @@ traffic with "candump" command which is included in "can-utils".
 
   candump can0
 
+CTU CAN FD support examples
+===========================
+
+This open-source core provides CAN FD support. CAN FD drames are
+delivered even to the host systems when SocketCAN interface is found
+CAN FD capable.
+
+The PCIe borad emulation is provided for now (the device identifier is
+ctucan_pci). The defauld build defines two CTU CAN FD cores
+on the board.
+
+Example how to connect the canbus0-bus (virtual wire) to the host
+Linux system (SocketCAN used) and to both CTU CAN FD cores emulated
+on the corresponding PCI card expects that host system CAN bus
+is setup according to the previous SJA1000 section.
+
+  qemu-system-x86_64 -enable-kvm -kernel /boot/vmlinuz-4.19.52+ \
+      -initrd ramdisk.cpio \
+      -virtfs local,path=shareddir,security_model=none,mount_tag=shareddir \
+      -vga cirrus \
+      -append "console=ttyS0" \
+      -object can-bus,id=canbus0-bus \
+      -object can-host-socketcan,if=can0,canbus=canbus0-bus,id=canbus0-socketcan \
+      -device ctucan_pci,canbus0=canbus0-bus,canbus1=canbus0-bus \
+      -nographic
+
+Setup of CTU CAN FD controller in a guest Linux system
+
+  insmod ctucanfd.ko || modprobe ctucanfd
+  insmod ctucanfd_pci.ko || modprobe ctucanfd_pci
+
+  for ifc in /sys/class/net/can* ; do
+    if [ -e  $ifc/device/vendor ] ; then
+      if ! grep -q 0x1760 $ifc/device/vendor ; then
+        continue;
+      fi
+    else
+      continue;
+    fi
+    if [ -e  $ifc/device/device ] ; then
+       if ! grep -q 0xff00 $ifc/device/device ; then
+         continue;
+       fi
+    else
+      continue;
+    fi
+    ifc=$(basename $ifc)
+    /bin/ip link set $ifc type can bitrate 1000000 dbitrate 10000000 fd on
+    /bin/ip link set $ifc up
+  done
+
+The test can run for example
+
+  candump can1
+
+in the guest system and next commands in the host system for basic CAN
+
+  cangen can0
+
+for CAN FD without bitrate switch
+
+  cangen can0 -f
+
+and with bitrate switch
+
+  cangen can0 -b
+
+The test can be run viceversa, generate messages in the guest system and capture them
+in the host one and much more combinations.
+
 Links to other resources
 ========================
 
- (1) Repository with development branch can-pci at Czech Technical University
-     https://gitlab.fel.cvut.cz/canbus/qemu-canbus
- (2) GitHub repository with can-pci and our other changes included
+ (1) CAN related projects at Czech Technical University, Faculty of Electrical Engineering
+     http://canbus.pages.fel.cvut.cz/
+ (2) Repository with development can-pci branch at Czech Technical University
      https://gitlab.fel.cvut.cz/canbus/qemu-canbus
  (3) RTEMS page describing project
      https://devel.rtems.org/wiki/Developer/Simulators/QEMU/CANEmulation
  (4) RTLWS 2015 article about the project and its use with CANopen emulation
-     http://rtime.felk.cvut.cz/publications/public/rtlws2015-qemu-can.pdf
-     Slides
-     http://rtime.felk.cvut.cz/publications/public/rtlws2015-qemu-can-slides.pdf
- (5) Linux SocketCAN utilities
+     http://cmp.felk.cvut.cz/~pisa/can/doc/rtlws-17-pisa-qemu-can.pdf
+ (5) GNU/Linux, CAN and CANopen in Real-time Control Applications
+     Slides from LinuxDays 2017 (include updated RTLWS 2015 content)
+     https://www.linuxdays.cz/2017/video/Pavel_Pisa-CAN_canopen.pdf
+ (6) Linux SocketCAN utilities
      https://github.com/linux-can/can-utils/
+ (7) CTU CAN FD project including core VHDL design, Linux driver,
+     test utilities etc.
+     https://gitlab.fel.cvut.cz/canbus/ctucanfd_ip_core
+ (8) CTU CAN FD Core Datasheet Documentation
+     http://canbus.pages.fel.cvut.cz/ctucanfd_ip_core/Progdokum.pdf
+ (9) CTU CAN FD Core System Architecture Documentation
+     http://canbus.pages.fel.cvut.cz/ctucanfd_ip_core/ctu_can_fd_architecture.pdf
+ (10) CTU CAN FD Driver Documentation
+     http://canbus.pages.fel.cvut.cz/ctucanfd_ip_core/driver_doc/ctucanfd-driver.html
+ (11) Integration with PCIe interfacing for Intel/Altera Cyclone IV based board
+     https://gitlab.fel.cvut.cz/canbus/pcie-ctu_can_fd
-- 
2.26.2




^ permalink raw reply related	[flat|nested] 101+ messages in thread

* [PULL 92/92] hw/net/can: Correct Kconfig dependencies
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (90 preceding siblings ...)
  2020-09-24  9:23 ` [PULL 91/92] hw/net/can: Documentation for " Paolo Bonzini
@ 2020-09-24  9:23 ` Paolo Bonzini
  2020-09-24 11:16 ` [PULL 00/92] Misc patches for 2020-09-24 no-reply
  2020-09-25 10:08 ` Peter Maydell
  93 siblings, 0 replies; 101+ messages in thread
From: Paolo Bonzini @ 2020-09-24  9:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: Pavel Pisa

From: Pavel Pisa <pisa@cmp.felk.cvut.cz>

The original CAN_PCI config option enables multiple SJA1000 PCI boards
emulation build. These boards bridge SJA1000 into I/O or memory
address space of the host CPU and depend on SJA1000 emulation.

Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Message-Id: <dd332de687bfe52bbec37f5de1d861fb8e620d74.1600069689.git.pisa@cmp.felk.cvut.cz>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/net/Kconfig | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/hw/net/Kconfig b/hw/net/Kconfig
index 225d948841..6d795ec752 100644
--- a/hw/net/Kconfig
+++ b/hw/net/Kconfig
@@ -132,16 +132,15 @@ config ROCKER
 config CAN_BUS
     bool
 
-config CAN_PCI
+config CAN_SJA1000
     bool
     default y if PCI_DEVICES
-    depends on PCI
     select CAN_BUS
 
-config CAN_SJA1000
+config CAN_PCI
     bool
     default y if PCI_DEVICES
-    depends on PCI
+    depends on PCI && CAN_SJA1000
     select CAN_BUS
 
 config CAN_CTUCANFD
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 101+ messages in thread

* Re: [PULL 00/92] Misc patches for 2020-09-24
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (91 preceding siblings ...)
  2020-09-24  9:23 ` [PULL 92/92] hw/net/can: Correct Kconfig dependencies Paolo Bonzini
@ 2020-09-24 11:16 ` no-reply
  2020-09-25 10:08 ` Peter Maydell
  93 siblings, 0 replies; 101+ messages in thread
From: no-reply @ 2020-09-24 11:16 UTC (permalink / raw)
  To: pbonzini; +Cc: qemu-devel

Patchew URL: https://patchew.org/QEMU/20200924092314.1722645-1-pbonzini@redhat.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 20200924092314.1722645-1-pbonzini@redhat.com
Subject: [PULL 00/92] Misc patches for 2020-09-24

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

From https://github.com/patchew-project/qemu
 * [new tag]         patchew/20200924092314.1722645-1-pbonzini@redhat.com -> patchew/20200924092314.1722645-1-pbonzini@redhat.com
Switched to a new branch 'test'
f6e976e hw/net/can: Correct Kconfig dependencies
87b5476 hw/net/can: Documentation for CTU CAN FD IP open hardware core emulation.
199b86c hw/net/can: CTU CAN FD IP open hardware core emulation.
001d107 hw/net/can/ctucafd: Add CTU CAN FD core register definitions.
ce63d2f net/can: Add can_dlc2len and can_len2dlc for CAN FD.
bfd9b0f hw/net/can: sja1000 ignore CAN FD frames
93fae52 net/can: Initial host SocketCan support for CAN FD.
fb0df91 target/i386: kvm: do not use kvm_check_extension to find paravirtual capabilities
8456e45 bios-tables-test: Remove kernel-irqchip=off option
188de8a target/i386: always create kvmclock device
cabd19f target/i386: Fix VM migration when interrupt based APF is enabled
8dd5ca7 helper_syscall x86_64: clear exception_is_int
bea6d0a checkpatch: Detect '%#' or '%0#' in printf-style format strings
be93aa3 typedefs: Restrict PCMachineState to 'hw/i386/pc.h'
61c1077 hw/xen: Split x86-specific declaration from generic hardware ones
6882631 stubs: Split accelerator / hardware related stubs
8d7bdfa sysemu/xen: Add missing 'exec/cpu-common.h' header for ram_addr_t type
659b275 hw/i386/xen: Rename X86/PC specific function as xen_hvm_init_pc()
f57b6de docs: Move object.h overview doc comment to qom.rst
7e8e7ee docs: Create docs/devel/qom.rst
3b88ade qom: Add code block markup to all code blocks
9f68c77 qom: Indent existing code examples
bc30ad0 qom: Reformat section titles using Sphinx syntax
29e7478 qom: Add kernel-doc markup to introduction doc comment
c656cb3 qom: Use ``code`` Sphinx syntax where appropriate
0cd5622 qom: Use kernel-doc private/public tags in structs
9f8ff2e qom: Document all function parameters in doc comments
33b4d80 char: fix logging when chardev write fails
341f695 cphp: remove deprecated cpu-add command(s)
087b857 smp: drop support for deprecated (invalid topologies)
ca0c6b2 configure: consistently pass CFLAGS/CXXFLAGS/LDFLAGS to meson
0a5a1cb configure: do not clobber environment CFLAGS/CXXFLAGS/LDFLAGS
b1ef2b6 configure: cleanup CFLAGS and LDFLAGS for submodules
f6173ba configure: cleanup invocation of submodule Make
f6886b4 tests/tcg: reinstate or replace desired parts of rules.mak
d636c8f oss-fuzz: move linker arg to fix coverage-build
4435f5d configure: fix performance regression due to PIC objects
4a28540 meson: fix installation of keymaps
6ab9e90 checkpatch: avoid error on cover letter files
59438a9 exec: Remove MemoryRegion::global_locking field
5dc9111 hw/i386/q35: Remove unreachable Xen code on Q35 machine
9f3bf04 configure: use a platform-neutral prefix
6000994 ui: relocate paths to icons and translations
1f0a839 qga: relocate path to default configuration and hook
de9124d qemu-bridge-helper: relocate path to default ACL
81910b9 vl: relocate path to configuration file
3a64111 vl: relocate paths to data directories
86d9868 net: relocate paths to helpers and scripts
3b6fe40 module: relocate path to modules
89ed2fb oslib-posix: relocate path to /var
3d3ca22 cutils: introduce get_relocated_path
20a4c61 oslib-posix: default exec_dir to bindir
6969a44 fuzz: use qemu_get_exec_dir
224d554 oslib: do not call g_strdup from qemu_get_exec_dir
546d881 meson: report accelerator support
a64070a mtest2make: add support for introspected test dependencies
ff350df meson: qtest: set "depends" correctly
05beb8d configure: do not limit Hypervisor.framework test to Darwin
9f5d01b configure: move cocoa option to Meson
2b4838a configure: fix --meson=/path/to/meson
41c01f4 configure: move malloc_trim/tcmalloc/jemalloc to meson
eaad719 meson: extend libmpathpersist test for static linking
af4a176 meson: move libmpathpersist test
c058b66 meson: move libudev test
56f3e63 i386/cpu: Clear FEAT_XSAVE_COMP_{LO, HI} when XSAVE is not available
af7124b hw: megasas: consider 'iov_count=0' is an error in megasas_map_sgl
d142d55 hw: megasas: return -1 when 'megasas_map_sgl' fails
1fb9b5b scsi-generic: Fix HM-zoned device scan
815d129 hw/char/serial-{isa, pci}: Alias QDEV properties from generic serial object
94e460f hw/char/serial: Make 'wakeup' property boolean
fdcbbeb hw/char/serial: Rename I/O read/write trace events
8bff385 hw/char/serial: Remove old DEBUG_SERIAL commented code
ac06e99 hw/char/serial: Replace commented DPRINTF() by trace event
a94d7fd hw/char/serial: Assert serial_ioport_read/write offset fits 8 bytes
957b1ad configure: rename QEMU_GA_MSI_ENABLED to CONFIG_QGA_MSI
a48b050 hw/char/serial: Remove TYPE_SERIAL_IO
e00d895 hw/mips/mipssim: Use MMIO serial device on fake ISA I/O
c6d1bf9 numa: remove fixup numa_state->num_nodes to MAX_NODES
f559fee doc: Cleanup "'-mem-path' fallback to RAM" deprecation text
5e3bb06 numa: drop support for '-numa node' (without memory specified)
2662b62 acpi: i386: Move VMBus DSDT entry to SB
6f13839 vhost-scsi: support inflight io track
384e57c memory: Convert IOMMUMemoryRegionClass doc comment to kernel-doc
318c672 target/i386: support KVM_FEATURE_ASYNC_PF_INT
25ffa76 MAINTAINERS: add Paolo Bonzini as RCU maintainer
7c36de3 configure: Do not intent to build WHPX on 32-bit host
3b1b18f WHPX: vmware cpuid leaf for tsc and apic frequency
8cfccd7 meson: error out if qemu_suffix starts with /
c133858 meson: fix MSI rule
751efc0 ninjatool: rebuild multi-output targets if outputs are missing
39a147d meson: clean up build_by_default
46fae10 tests: add missing genh dependency

=== OUTPUT BEGIN ===
1/92 Checking commit 46fae10dee1c (tests: add missing genh dependency)
2/92 Checking commit 39a147d7fef6 (meson: clean up build_by_default)
3/92 Checking commit 751efc0eda24 (ninjatool: rebuild multi-output targets if outputs are missing)
4/92 Checking commit c1338581e41b (meson: fix MSI rule)
5/92 Checking commit 8cfccd7592d6 (meson: error out if qemu_suffix starts with /)
6/92 Checking commit 3b1b18ff5acd (WHPX: vmware cpuid leaf for tsc and apic frequency)
7/92 Checking commit 7c36de3def3f (configure: Do not intent to build WHPX on 32-bit host)
ERROR: Doubly-encoded UTF-8
#10: 
    Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

total: 1 errors, 0 warnings, 11 lines checked

Patch 7/92 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

8/92 Checking commit 25ffa76b7e89 (MAINTAINERS: add Paolo Bonzini as RCU maintainer)
9/92 Checking commit 318c67240bbc (target/i386: support KVM_FEATURE_ASYNC_PF_INT)
10/92 Checking commit 384e57cb0984 (memory: Convert IOMMUMemoryRegionClass doc comment to kernel-doc)
11/92 Checking commit 6f13839d5d6f (vhost-scsi: support inflight io track)
12/92 Checking commit 2662b62f6126 (acpi: i386: Move VMBus DSDT entry to SB)
13/92 Checking commit 5e3bb0625843 (numa: drop support for '-numa node' (without memory specified))
14/92 Checking commit f559fee2ba0f (doc: Cleanup "'-mem-path' fallback to RAM" deprecation text)
15/92 Checking commit c6d1bf96b1fe (numa: remove fixup numa_state->num_nodes to MAX_NODES)
16/92 Checking commit e00d8959f49d (hw/mips/mipssim: Use MMIO serial device on fake ISA I/O)
17/92 Checking commit a48b050397cd (hw/char/serial: Remove TYPE_SERIAL_IO)
18/92 Checking commit 957b1ad4186b (configure: rename QEMU_GA_MSI_ENABLED to CONFIG_QGA_MSI)
19/92 Checking commit a94d7fdcc745 (hw/char/serial: Assert serial_ioport_read/write offset fits 8 bytes)
20/92 Checking commit ac06e993704b (hw/char/serial: Replace commented DPRINTF() by trace event)
21/92 Checking commit 8bff38520169 (hw/char/serial: Remove old DEBUG_SERIAL commented code)
22/92 Checking commit fdcbbeb50c60 (hw/char/serial: Rename I/O read/write trace events)
23/92 Checking commit 94e460fd4d1c (hw/char/serial: Make 'wakeup' property boolean)
24/92 Checking commit 815d129ee533 (hw/char/serial-{isa, pci}: Alias QDEV properties from generic serial object)
25/92 Checking commit 1fb9b5bed8c2 (scsi-generic: Fix HM-zoned device scan)
26/92 Checking commit d142d554285f (hw: megasas: return -1 when 'megasas_map_sgl' fails)
27/92 Checking commit af7124b2f7f4 (hw: megasas: consider 'iov_count=0' is an error in megasas_map_sgl)
28/92 Checking commit 56f3e63c1f32 (i386/cpu: Clear FEAT_XSAVE_COMP_{LO, HI} when XSAVE is not available)
29/92 Checking commit c058b66f6305 (meson: move libudev test)
30/92 Checking commit af4a176b85de (meson: move libmpathpersist test)
31/92 Checking commit eaad719e4b89 (meson: extend libmpathpersist test for static linking)
32/92 Checking commit 41c01f4dbfd5 (configure: move malloc_trim/tcmalloc/jemalloc to meson)
33/92 Checking commit 2b4838ad3518 (configure: fix --meson=/path/to/meson)
34/92 Checking commit 9f5d01b19e26 (configure: move cocoa option to Meson)
35/92 Checking commit 05beb8d46170 (configure: do not limit Hypervisor.framework test to Darwin)
36/92 Checking commit ff350dfc4da2 (meson: qtest: set "depends" correctly)
37/92 Checking commit a64070ad2130 (mtest2make: add support for introspected test dependencies)
38/92 Checking commit 546d8813dbcf (meson: report accelerator support)
39/92 Checking commit 224d55461734 (oslib: do not call g_strdup from qemu_get_exec_dir)
40/92 Checking commit 6969a4473ea1 (fuzz: use qemu_get_exec_dir)
41/92 Checking commit 20a4c6199e12 (oslib-posix: default exec_dir to bindir)
42/92 Checking commit 3d3ca2298f2f (cutils: introduce get_relocated_path)
43/92 Checking commit 89ed2fb377dd (oslib-posix: relocate path to /var)
44/92 Checking commit 3b6fe405ca17 (module: relocate path to modules)
45/92 Checking commit 86d986800e89 (net: relocate paths to helpers and scripts)
WARNING: line over 80 characters
#93: FILE: net/tap.c:951:
+            script = default_script = get_relocated_path(DEFAULT_NETWORK_SCRIPT);

WARNING: line over 80 characters
#96: FILE: net/tap.c:954:
+            downscript = default_downscript = get_relocated_path(DEFAULT_NETWORK_SCRIPT);

total: 0 errors, 2 warnings, 76 lines checked

Patch 45/92 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
46/92 Checking commit 3a64111752bb (vl: relocate paths to data directories)
ERROR: code indent should never use tabs
#195: FILE: tests/qtest/fuzz/fuzz.c:175:
+^I}$

total: 1 errors, 0 warnings, 151 lines checked

Patch 46/92 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

47/92 Checking commit 81910b98f5f6 (vl: relocate path to configuration file)
WARNING: line over 80 characters
#19: FILE: softmmu/vl.c:2679:
+    g_autofree char *file = get_relocated_path(CONFIG_QEMU_CONFDIR "/qemu.conf");

total: 0 errors, 1 warnings, 10 lines checked

Patch 47/92 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
48/92 Checking commit de9124d26827 (qemu-bridge-helper: relocate path to default ACL)
49/92 Checking commit 1f0a83903f04 (qga: relocate path to default configuration and hook)
ERROR: line over 90 characters
#27: FILE: qga/main.c:972:
+    g_autofree char *conf = g_strdup(g_getenv("QGA_CONF")) ?: get_relocated_path(QGA_CONF_DEFAULT);

ERROR: line over 90 characters
#45: FILE: qga/main.c:1145:
+            config->fsfreeze_hook = optarg ? g_strdup(optarg) : get_relocated_path(QGA_FSFREEZE_HOOK_DEFAULT);

total: 2 errors, 0 warnings, 38 lines checked

Patch 49/92 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

50/92 Checking commit 6000994d978a (ui: relocate paths to icons and translations)
WARNING: line over 80 characters
#78: FILE: ui/sdl2.c:873:
+    dir = get_relocated_path(CONFIG_QEMU_ICONDIR "/hicolor/128x128/apps/qemu.png");

WARNING: line over 80 characters
#83: FILE: ui/sdl2.c:877:
+    dir = get_relocated_path(CONFIG_QEMU_ICONDIR "/hicolor/32x32/apps/qemu.bmp");

total: 0 errors, 2 warnings, 68 lines checked

Patch 50/92 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
51/92 Checking commit 9f3bf0434597 (configure: use a platform-neutral prefix)
52/92 Checking commit 5dc91113fffc (hw/i386/q35: Remove unreachable Xen code on Q35 machine)
53/92 Checking commit 59438a9442d2 (exec: Remove MemoryRegion::global_locking field)
54/92 Checking commit 6ab9e90b601f (checkpatch: avoid error on cover letter files)
55/92 Checking commit 4a28540714f8 (meson: fix installation of keymaps)
56/92 Checking commit 4435f5dd0990 (configure: fix performance regression due to PIC objects)
57/92 Checking commit d636c8f9caa4 (oss-fuzz: move linker arg to fix coverage-build)
58/92 Checking commit f6886b47acaf (tests/tcg: reinstate or replace desired parts of rules.mak)
59/92 Checking commit f6173ba1cc99 (configure: cleanup invocation of submodule Make)
60/92 Checking commit b1ef2b6d62e2 (configure: cleanup CFLAGS and LDFLAGS for submodules)
61/92 Checking commit 0a5a1cbd0da4 (configure: do not clobber environment CFLAGS/CXXFLAGS/LDFLAGS)
62/92 Checking commit ca0c6b2e6c81 (configure: consistently pass CFLAGS/CXXFLAGS/LDFLAGS to meson)
63/92 Checking commit 087b8571616f (smp: drop support for deprecated (invalid topologies))
64/92 Checking commit 341f69529f65 (cphp: remove deprecated cpu-add command(s))
65/92 Checking commit 33b4d804ba0a (char: fix logging when chardev write fails)
66/92 Checking commit 9f8ff2e02d25 (qom: Document all function parameters in doc comments)
67/92 Checking commit 0cd5622395f3 (qom: Use kernel-doc private/public tags in structs)
68/92 Checking commit c656cb310817 (qom: Use ``code`` Sphinx syntax where appropriate)
WARNING: line over 80 characters
#24: FILE: include/qom/object.h:206:
+ * ``SomethingIf *si`` arguments, but not define a ``struct SomethingIf { ... }``.

total: 0 errors, 1 warnings, 18 lines checked

Patch 68/92 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
69/92 Checking commit 29e7478e3fa6 (qom: Add kernel-doc markup to introduction doc comment)
70/92 Checking commit bc30ad090f2a (qom: Reformat section titles using Sphinx syntax)
71/92 Checking commit 9f68c77e7c15 (qom: Indent existing code examples)
72/92 Checking commit 3b88adec8e00 (qom: Add code block markup to all code blocks)
73/92 Checking commit 7e8e7ee5848f (docs: Create docs/devel/qom.rst)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#22: 
new file mode 100644

total: 0 errors, 1 warnings, 9 lines checked

Patch 73/92 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
74/92 Checking commit f57b6de5f5d7 (docs: Move object.h overview doc comment to qom.rst)
75/92 Checking commit 659b2758d02e (hw/i386/xen: Rename X86/PC specific function as xen_hvm_init_pc())
76/92 Checking commit 8d7bdfaba295 (sysemu/xen: Add missing 'exec/cpu-common.h' header for ram_addr_t type)
77/92 Checking commit 68826310c65c (stubs: Split accelerator / hardware related stubs)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#93: 
new file mode 100644

total: 0 errors, 1 warnings, 112 lines checked

Patch 77/92 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
78/92 Checking commit 61c1077f0636 (hw/xen: Split x86-specific declaration from generic hardware ones)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#40: 
new file mode 100644

total: 0 errors, 1 warnings, 45 lines checked

Patch 78/92 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
79/92 Checking commit be93aa30e367 (typedefs: Restrict PCMachineState to 'hw/i386/pc.h')
80/92 Checking commit bea6d0ae685e (checkpatch: Detect '%#' or '%0#' in printf-style format strings)
81/92 Checking commit 8dd5ca713939 (helper_syscall x86_64: clear exception_is_int)
82/92 Checking commit cabd19f8e8ad (target/i386: Fix VM migration when interrupt based APF is enabled)
83/92 Checking commit 188de8a0efe7 (target/i386: always create kvmclock device)
84/92 Checking commit 8456e4516711 (bios-tables-test: Remove kernel-irqchip=off option)
85/92 Checking commit fb0df91c3f60 (target/i386: kvm: do not use kvm_check_extension to find paravirtual capabilities)
86/92 Checking commit 93fae526677b (net/can: Initial host SocketCan support for CAN FD.)
87/92 Checking commit bfd9b0f08187 (hw/net/can: sja1000 ignore CAN FD frames)
88/92 Checking commit ce63d2f5fbe1 (net/can: Add can_dlc2len and can_len2dlc for CAN FD.)
89/92 Checking commit 001d10707e11 (hw/net/can/ctucafd: Add CTU CAN FD core register definitions.)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#32: 
new file mode 100644

WARNING: Block comments use a leading /* on a separate line
#38: FILE: hw/net/can/ctu_can_fd_frame.h:2:
+/*******************************************************************************

WARNING: line over 80 characters
#45: FILE: hw/net/can/ctu_can_fd_frame.h:9:
+ * Copyright (C) 2018-2020 Pavel Pisa <pisa@cmp.felk.cvut.cz> FEE CTU/self-funded

WARNING: architecture specific defines should be avoided
#68: FILE: hw/net/can/ctu_can_fd_frame.h:32:
+#ifndef __CTU_CAN_FD_CAN_FD_FRAME_FORMAT__

ERROR: code indent should never use tabs
#73: FILE: hw/net/can/ctu_can_fd_frame.h:37:
+^ICTU_CAN_FD_FRAME_FORM_W        = 0x0,$

ERROR: code indent should never use tabs
#74: FILE: hw/net/can/ctu_can_fd_frame.h:38:
+^ICTU_CAN_FD_IDENTIFIER_W        = 0x4,$

ERROR: code indent should never use tabs
#75: FILE: hw/net/can/ctu_can_fd_frame.h:39:
+^ICTU_CAN_FD_TIMESTAMP_L_W       = 0x8,$

ERROR: code indent should never use tabs
#76: FILE: hw/net/can/ctu_can_fd_frame.h:40:
+^ICTU_CAN_FD_TIMESTAMP_U_W       = 0xc,$

ERROR: code indent should never use tabs
#77: FILE: hw/net/can/ctu_can_fd_frame.h:41:
+^ICTU_CAN_FD_DATA_1_4_W         = 0x10,$

ERROR: code indent should never use tabs
#78: FILE: hw/net/can/ctu_can_fd_frame.h:42:
+^ICTU_CAN_FD_DATA_5_8_W         = 0x14,$

ERROR: code indent should never use tabs
#79: FILE: hw/net/can/ctu_can_fd_frame.h:43:
+^ICTU_CAN_FD_DATA_61_64_W       = 0x4c,$

ERROR: code indent should never use tabs
#85: FILE: hw/net/can/ctu_can_fd_frame.h:49:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#86: FILE: hw/net/can/ctu_can_fd_frame.h:50:
+^Istruct ctu_can_fd_frame_form_w_s {$

WARNING: architecture specific defines should be avoided
#87: FILE: hw/net/can/ctu_can_fd_frame.h:51:
+#ifdef __LITTLE_ENDIAN_BITFIELD

ERROR: code indent should never use tabs
#89: FILE: hw/net/can/ctu_can_fd_frame.h:53:
+^I^Iuint32_t dlc                     : 4;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#89: FILE: hw/net/can/ctu_can_fd_frame.h:53:
+               uint32_t dlc                     : 4;
                                                 ^

ERROR: code indent should never use tabs
#90: FILE: hw/net/can/ctu_can_fd_frame.h:54:
+^I^Iuint32_t reserved_4              : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#90: FILE: hw/net/can/ctu_can_fd_frame.h:54:
+               uint32_t reserved_4              : 1;
                                                 ^

ERROR: code indent should never use tabs
#91: FILE: hw/net/can/ctu_can_fd_frame.h:55:
+^I^Iuint32_t rtr                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#91: FILE: hw/net/can/ctu_can_fd_frame.h:55:
+               uint32_t rtr                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#92: FILE: hw/net/can/ctu_can_fd_frame.h:56:
+^I^Iuint32_t ide                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#92: FILE: hw/net/can/ctu_can_fd_frame.h:56:
+               uint32_t ide                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#93: FILE: hw/net/can/ctu_can_fd_frame.h:57:
+^I^Iuint32_t fdf                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#93: FILE: hw/net/can/ctu_can_fd_frame.h:57:
+               uint32_t fdf                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#94: FILE: hw/net/can/ctu_can_fd_frame.h:58:
+^I^Iuint32_t reserved_8              : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#94: FILE: hw/net/can/ctu_can_fd_frame.h:58:
+               uint32_t reserved_8              : 1;
                                                 ^

ERROR: code indent should never use tabs
#95: FILE: hw/net/can/ctu_can_fd_frame.h:59:
+^I^Iuint32_t brs                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#95: FILE: hw/net/can/ctu_can_fd_frame.h:59:
+               uint32_t brs                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#96: FILE: hw/net/can/ctu_can_fd_frame.h:60:
+^I^Iuint32_t esi_rsv                 : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#96: FILE: hw/net/can/ctu_can_fd_frame.h:60:
+               uint32_t esi_rsv                 : 1;
                                                 ^

ERROR: code indent should never use tabs
#97: FILE: hw/net/can/ctu_can_fd_frame.h:61:
+^I^Iuint32_t rwcnt                   : 5;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#97: FILE: hw/net/can/ctu_can_fd_frame.h:61:
+               uint32_t rwcnt                   : 5;
                                                 ^

ERROR: code indent should never use tabs
#98: FILE: hw/net/can/ctu_can_fd_frame.h:62:
+^I^Iuint32_t reserved_31_16         : 16;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#98: FILE: hw/net/can/ctu_can_fd_frame.h:62:
+               uint32_t reserved_31_16         : 16;
                                                ^

ERROR: code indent should never use tabs
#100: FILE: hw/net/can/ctu_can_fd_frame.h:64:
+^I^Iuint32_t reserved_31_16         : 16;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#100: FILE: hw/net/can/ctu_can_fd_frame.h:64:
+               uint32_t reserved_31_16         : 16;
                                                ^

ERROR: code indent should never use tabs
#101: FILE: hw/net/can/ctu_can_fd_frame.h:65:
+^I^Iuint32_t rwcnt                   : 5;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#101: FILE: hw/net/can/ctu_can_fd_frame.h:65:
+               uint32_t rwcnt                   : 5;
                                                 ^

ERROR: code indent should never use tabs
#102: FILE: hw/net/can/ctu_can_fd_frame.h:66:
+^I^Iuint32_t esi_rsv                 : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#102: FILE: hw/net/can/ctu_can_fd_frame.h:66:
+               uint32_t esi_rsv                 : 1;
                                                 ^

ERROR: code indent should never use tabs
#103: FILE: hw/net/can/ctu_can_fd_frame.h:67:
+^I^Iuint32_t brs                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#103: FILE: hw/net/can/ctu_can_fd_frame.h:67:
+               uint32_t brs                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#104: FILE: hw/net/can/ctu_can_fd_frame.h:68:
+^I^Iuint32_t reserved_8              : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#104: FILE: hw/net/can/ctu_can_fd_frame.h:68:
+               uint32_t reserved_8              : 1;
                                                 ^

ERROR: code indent should never use tabs
#105: FILE: hw/net/can/ctu_can_fd_frame.h:69:
+^I^Iuint32_t fdf                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#105: FILE: hw/net/can/ctu_can_fd_frame.h:69:
+               uint32_t fdf                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#106: FILE: hw/net/can/ctu_can_fd_frame.h:70:
+^I^Iuint32_t ide                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#106: FILE: hw/net/can/ctu_can_fd_frame.h:70:
+               uint32_t ide                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#107: FILE: hw/net/can/ctu_can_fd_frame.h:71:
+^I^Iuint32_t rtr                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#107: FILE: hw/net/can/ctu_can_fd_frame.h:71:
+               uint32_t rtr                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#108: FILE: hw/net/can/ctu_can_fd_frame.h:72:
+^I^Iuint32_t reserved_4              : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#108: FILE: hw/net/can/ctu_can_fd_frame.h:72:
+               uint32_t reserved_4              : 1;
                                                 ^

ERROR: code indent should never use tabs
#109: FILE: hw/net/can/ctu_can_fd_frame.h:73:
+^I^Iuint32_t dlc                     : 4;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#109: FILE: hw/net/can/ctu_can_fd_frame.h:73:
+               uint32_t dlc                     : 4;
                                                 ^

ERROR: code indent should never use tabs
#111: FILE: hw/net/can/ctu_can_fd_frame.h:75:
+^I} s;$

ERROR: code indent should never use tabs
#115: FILE: hw/net/can/ctu_can_fd_frame.h:79:
+^INO_RTR_FRAME       = 0x0,$

ERROR: code indent should never use tabs
#116: FILE: hw/net/can/ctu_can_fd_frame.h:80:
+^IRTR_FRAME          = 0x1,$

ERROR: code indent should never use tabs
#120: FILE: hw/net/can/ctu_can_fd_frame.h:84:
+^IBASE           = 0x0,$

ERROR: code indent should never use tabs
#121: FILE: hw/net/can/ctu_can_fd_frame.h:85:
+^IEXTENDED       = 0x1,$

ERROR: code indent should never use tabs
#125: FILE: hw/net/can/ctu_can_fd_frame.h:89:
+^INORMAL_CAN       = 0x0,$

ERROR: code indent should never use tabs
#126: FILE: hw/net/can/ctu_can_fd_frame.h:90:
+^IFD_CAN           = 0x1,$

ERROR: code indent should never use tabs
#130: FILE: hw/net/can/ctu_can_fd_frame.h:94:
+^IBR_NO_SHIFT       = 0x0,$

ERROR: code indent should never use tabs
#131: FILE: hw/net/can/ctu_can_fd_frame.h:95:
+^IBR_SHIFT          = 0x1,$

ERROR: code indent should never use tabs
#135: FILE: hw/net/can/ctu_can_fd_frame.h:99:
+^IESI_ERR_ACTIVE       = 0x0,$

ERROR: code indent should never use tabs
#136: FILE: hw/net/can/ctu_can_fd_frame.h:100:
+^IESI_ERR_PASIVE       = 0x1,$

ERROR: code indent should never use tabs
#140: FILE: hw/net/can/ctu_can_fd_frame.h:104:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#141: FILE: hw/net/can/ctu_can_fd_frame.h:105:
+^Istruct ctu_can_fd_identifier_w_s {$

WARNING: architecture specific defines should be avoided
#142: FILE: hw/net/can/ctu_can_fd_frame.h:106:
+#ifdef __LITTLE_ENDIAN_BITFIELD

ERROR: code indent should never use tabs
#144: FILE: hw/net/can/ctu_can_fd_frame.h:108:
+^I^Iuint32_t identifier_ext         : 18;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#144: FILE: hw/net/can/ctu_can_fd_frame.h:108:
+               uint32_t identifier_ext         : 18;
                                                ^

ERROR: code indent should never use tabs
#145: FILE: hw/net/can/ctu_can_fd_frame.h:109:
+^I^Iuint32_t identifier_base        : 11;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#145: FILE: hw/net/can/ctu_can_fd_frame.h:109:
+               uint32_t identifier_base        : 11;
                                                ^

ERROR: code indent should never use tabs
#146: FILE: hw/net/can/ctu_can_fd_frame.h:110:
+^I^Iuint32_t reserved_31_29          : 3;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#146: FILE: hw/net/can/ctu_can_fd_frame.h:110:
+               uint32_t reserved_31_29          : 3;
                                                 ^

ERROR: code indent should never use tabs
#148: FILE: hw/net/can/ctu_can_fd_frame.h:112:
+^I^Iuint32_t reserved_31_29          : 3;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#148: FILE: hw/net/can/ctu_can_fd_frame.h:112:
+               uint32_t reserved_31_29          : 3;
                                                 ^

ERROR: code indent should never use tabs
#149: FILE: hw/net/can/ctu_can_fd_frame.h:113:
+^I^Iuint32_t identifier_base        : 11;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#149: FILE: hw/net/can/ctu_can_fd_frame.h:113:
+               uint32_t identifier_base        : 11;
                                                ^

ERROR: code indent should never use tabs
#150: FILE: hw/net/can/ctu_can_fd_frame.h:114:
+^I^Iuint32_t identifier_ext         : 18;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#150: FILE: hw/net/can/ctu_can_fd_frame.h:114:
+               uint32_t identifier_ext         : 18;
                                                ^

ERROR: code indent should never use tabs
#152: FILE: hw/net/can/ctu_can_fd_frame.h:116:
+^I} s;$

ERROR: code indent should never use tabs
#156: FILE: hw/net/can/ctu_can_fd_frame.h:120:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#157: FILE: hw/net/can/ctu_can_fd_frame.h:121:
+^Istruct ctu_can_fd_timestamp_l_w_s {$

ERROR: code indent should never use tabs
#159: FILE: hw/net/can/ctu_can_fd_frame.h:123:
+^I^Iuint32_t time_stamp_31_0        : 32;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#159: FILE: hw/net/can/ctu_can_fd_frame.h:123:
+               uint32_t time_stamp_31_0        : 32;
                                                ^

ERROR: code indent should never use tabs
#160: FILE: hw/net/can/ctu_can_fd_frame.h:124:
+^I} s;$

ERROR: code indent should never use tabs
#164: FILE: hw/net/can/ctu_can_fd_frame.h:128:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#165: FILE: hw/net/can/ctu_can_fd_frame.h:129:
+^Istruct ctu_can_fd_timestamp_u_w_s {$

ERROR: code indent should never use tabs
#167: FILE: hw/net/can/ctu_can_fd_frame.h:131:
+^I^Iuint32_t timestamp_l_w          : 32;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#167: FILE: hw/net/can/ctu_can_fd_frame.h:131:
+               uint32_t timestamp_l_w          : 32;
                                                ^

ERROR: code indent should never use tabs
#168: FILE: hw/net/can/ctu_can_fd_frame.h:132:
+^I} s;$

ERROR: code indent should never use tabs
#172: FILE: hw/net/can/ctu_can_fd_frame.h:136:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#173: FILE: hw/net/can/ctu_can_fd_frame.h:137:
+^Istruct ctu_can_fd_data_1_4_w_s {$

WARNING: architecture specific defines should be avoided
#174: FILE: hw/net/can/ctu_can_fd_frame.h:138:
+#ifdef __LITTLE_ENDIAN_BITFIELD

ERROR: code indent should never use tabs
#176: FILE: hw/net/can/ctu_can_fd_frame.h:140:
+^I^Iuint32_t data_1                  : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#176: FILE: hw/net/can/ctu_can_fd_frame.h:140:
+               uint32_t data_1                  : 8;
                                                 ^

ERROR: code indent should never use tabs
#177: FILE: hw/net/can/ctu_can_fd_frame.h:141:
+^I^Iuint32_t data_2                  : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#177: FILE: hw/net/can/ctu_can_fd_frame.h:141:
+               uint32_t data_2                  : 8;
                                                 ^

ERROR: code indent should never use tabs
#178: FILE: hw/net/can/ctu_can_fd_frame.h:142:
+^I^Iuint32_t data_3                  : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#178: FILE: hw/net/can/ctu_can_fd_frame.h:142:
+               uint32_t data_3                  : 8;
                                                 ^

ERROR: code indent should never use tabs
#179: FILE: hw/net/can/ctu_can_fd_frame.h:143:
+^I^Iuint32_t data_4                  : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#179: FILE: hw/net/can/ctu_can_fd_frame.h:143:
+               uint32_t data_4                  : 8;
                                                 ^

ERROR: code indent should never use tabs
#181: FILE: hw/net/can/ctu_can_fd_frame.h:145:
+^I^Iuint32_t data_4                  : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#181: FILE: hw/net/can/ctu_can_fd_frame.h:145:
+               uint32_t data_4                  : 8;
                                                 ^

ERROR: code indent should never use tabs
#182: FILE: hw/net/can/ctu_can_fd_frame.h:146:
+^I^Iuint32_t data_3                  : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#182: FILE: hw/net/can/ctu_can_fd_frame.h:146:
+               uint32_t data_3                  : 8;
                                                 ^

ERROR: code indent should never use tabs
#183: FILE: hw/net/can/ctu_can_fd_frame.h:147:
+^I^Iuint32_t data_2                  : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#183: FILE: hw/net/can/ctu_can_fd_frame.h:147:
+               uint32_t data_2                  : 8;
                                                 ^

ERROR: code indent should never use tabs
#184: FILE: hw/net/can/ctu_can_fd_frame.h:148:
+^I^Iuint32_t data_1                  : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#184: FILE: hw/net/can/ctu_can_fd_frame.h:148:
+               uint32_t data_1                  : 8;
                                                 ^

ERROR: code indent should never use tabs
#186: FILE: hw/net/can/ctu_can_fd_frame.h:150:
+^I} s;$

ERROR: code indent should never use tabs
#190: FILE: hw/net/can/ctu_can_fd_frame.h:154:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#191: FILE: hw/net/can/ctu_can_fd_frame.h:155:
+^Istruct ctu_can_fd_data_5_8_w_s {$

WARNING: architecture specific defines should be avoided
#192: FILE: hw/net/can/ctu_can_fd_frame.h:156:
+#ifdef __LITTLE_ENDIAN_BITFIELD

ERROR: code indent should never use tabs
#194: FILE: hw/net/can/ctu_can_fd_frame.h:158:
+^I^Iuint32_t data_5                  : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#194: FILE: hw/net/can/ctu_can_fd_frame.h:158:
+               uint32_t data_5                  : 8;
                                                 ^

ERROR: code indent should never use tabs
#195: FILE: hw/net/can/ctu_can_fd_frame.h:159:
+^I^Iuint32_t data_6                  : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#195: FILE: hw/net/can/ctu_can_fd_frame.h:159:
+               uint32_t data_6                  : 8;
                                                 ^

ERROR: code indent should never use tabs
#196: FILE: hw/net/can/ctu_can_fd_frame.h:160:
+^I^Iuint32_t data_7                  : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#196: FILE: hw/net/can/ctu_can_fd_frame.h:160:
+               uint32_t data_7                  : 8;
                                                 ^

ERROR: code indent should never use tabs
#197: FILE: hw/net/can/ctu_can_fd_frame.h:161:
+^I^Iuint32_t data_8                  : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#197: FILE: hw/net/can/ctu_can_fd_frame.h:161:
+               uint32_t data_8                  : 8;
                                                 ^

ERROR: code indent should never use tabs
#199: FILE: hw/net/can/ctu_can_fd_frame.h:163:
+^I^Iuint32_t data_8                  : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#199: FILE: hw/net/can/ctu_can_fd_frame.h:163:
+               uint32_t data_8                  : 8;
                                                 ^

ERROR: code indent should never use tabs
#200: FILE: hw/net/can/ctu_can_fd_frame.h:164:
+^I^Iuint32_t data_7                  : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#200: FILE: hw/net/can/ctu_can_fd_frame.h:164:
+               uint32_t data_7                  : 8;
                                                 ^

ERROR: code indent should never use tabs
#201: FILE: hw/net/can/ctu_can_fd_frame.h:165:
+^I^Iuint32_t data_6                  : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#201: FILE: hw/net/can/ctu_can_fd_frame.h:165:
+               uint32_t data_6                  : 8;
                                                 ^

ERROR: code indent should never use tabs
#202: FILE: hw/net/can/ctu_can_fd_frame.h:166:
+^I^Iuint32_t data_5                  : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#202: FILE: hw/net/can/ctu_can_fd_frame.h:166:
+               uint32_t data_5                  : 8;
                                                 ^

ERROR: code indent should never use tabs
#204: FILE: hw/net/can/ctu_can_fd_frame.h:168:
+^I} s;$

ERROR: code indent should never use tabs
#208: FILE: hw/net/can/ctu_can_fd_frame.h:172:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#209: FILE: hw/net/can/ctu_can_fd_frame.h:173:
+^Istruct ctu_can_fd_data_61_64_w_s {$

WARNING: architecture specific defines should be avoided
#210: FILE: hw/net/can/ctu_can_fd_frame.h:174:
+#ifdef __LITTLE_ENDIAN_BITFIELD

ERROR: code indent should never use tabs
#212: FILE: hw/net/can/ctu_can_fd_frame.h:176:
+^I^Iuint32_t data_61                 : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#212: FILE: hw/net/can/ctu_can_fd_frame.h:176:
+               uint32_t data_61                 : 8;
                                                 ^

ERROR: code indent should never use tabs
#213: FILE: hw/net/can/ctu_can_fd_frame.h:177:
+^I^Iuint32_t data_62                 : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#213: FILE: hw/net/can/ctu_can_fd_frame.h:177:
+               uint32_t data_62                 : 8;
                                                 ^

ERROR: code indent should never use tabs
#214: FILE: hw/net/can/ctu_can_fd_frame.h:178:
+^I^Iuint32_t data_63                 : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#214: FILE: hw/net/can/ctu_can_fd_frame.h:178:
+               uint32_t data_63                 : 8;
                                                 ^

ERROR: code indent should never use tabs
#215: FILE: hw/net/can/ctu_can_fd_frame.h:179:
+^I^Iuint32_t data_64                 : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#215: FILE: hw/net/can/ctu_can_fd_frame.h:179:
+               uint32_t data_64                 : 8;
                                                 ^

ERROR: code indent should never use tabs
#217: FILE: hw/net/can/ctu_can_fd_frame.h:181:
+^I^Iuint32_t data_64                 : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#217: FILE: hw/net/can/ctu_can_fd_frame.h:181:
+               uint32_t data_64                 : 8;
                                                 ^

ERROR: code indent should never use tabs
#218: FILE: hw/net/can/ctu_can_fd_frame.h:182:
+^I^Iuint32_t data_63                 : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#218: FILE: hw/net/can/ctu_can_fd_frame.h:182:
+               uint32_t data_63                 : 8;
                                                 ^

ERROR: code indent should never use tabs
#219: FILE: hw/net/can/ctu_can_fd_frame.h:183:
+^I^Iuint32_t data_62                 : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#219: FILE: hw/net/can/ctu_can_fd_frame.h:183:
+               uint32_t data_62                 : 8;
                                                 ^

ERROR: code indent should never use tabs
#220: FILE: hw/net/can/ctu_can_fd_frame.h:184:
+^I^Iuint32_t data_61                 : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#220: FILE: hw/net/can/ctu_can_fd_frame.h:184:
+               uint32_t data_61                 : 8;
                                                 ^

ERROR: code indent should never use tabs
#222: FILE: hw/net/can/ctu_can_fd_frame.h:186:
+^I} s;$

WARNING: Block comments use a leading /* on a separate line
#233: FILE: hw/net/can/ctu_can_fd_regs.h:2:
+/*******************************************************************************

WARNING: line over 80 characters
#240: FILE: hw/net/can/ctu_can_fd_regs.h:9:
+ * Copyright (C) 2018-2020 Pavel Pisa <pisa@cmp.felk.cvut.cz> FEE CTU/self-funded

WARNING: architecture specific defines should be avoided
#263: FILE: hw/net/can/ctu_can_fd_regs.h:32:
+#ifndef __CTU_CAN_FD_CAN_FD_REGISTER_MAP__

ERROR: code indent should never use tabs
#268: FILE: hw/net/can/ctu_can_fd_regs.h:37:
+^ICTU_CAN_FD_DEVICE_ID             = 0x0,$

ERROR: code indent should never use tabs
#269: FILE: hw/net/can/ctu_can_fd_regs.h:38:
+^ICTU_CAN_FD_VERSION               = 0x2,$

ERROR: code indent should never use tabs
#270: FILE: hw/net/can/ctu_can_fd_regs.h:39:
+^ICTU_CAN_FD_MODE                  = 0x4,$

ERROR: code indent should never use tabs
#271: FILE: hw/net/can/ctu_can_fd_regs.h:40:
+^ICTU_CAN_FD_SETTINGS              = 0x6,$

ERROR: code indent should never use tabs
#272: FILE: hw/net/can/ctu_can_fd_regs.h:41:
+^ICTU_CAN_FD_STATUS                = 0x8,$

ERROR: code indent should never use tabs
#273: FILE: hw/net/can/ctu_can_fd_regs.h:42:
+^ICTU_CAN_FD_COMMAND               = 0xc,$

ERROR: code indent should never use tabs
#274: FILE: hw/net/can/ctu_can_fd_regs.h:43:
+^ICTU_CAN_FD_INT_STAT             = 0x10,$

ERROR: code indent should never use tabs
#275: FILE: hw/net/can/ctu_can_fd_regs.h:44:
+^ICTU_CAN_FD_INT_ENA_SET          = 0x14,$

ERROR: code indent should never use tabs
#276: FILE: hw/net/can/ctu_can_fd_regs.h:45:
+^ICTU_CAN_FD_INT_ENA_CLR          = 0x18,$

ERROR: code indent should never use tabs
#277: FILE: hw/net/can/ctu_can_fd_regs.h:46:
+^ICTU_CAN_FD_INT_MASK_SET         = 0x1c,$

ERROR: code indent should never use tabs
#278: FILE: hw/net/can/ctu_can_fd_regs.h:47:
+^ICTU_CAN_FD_INT_MASK_CLR         = 0x20,$

ERROR: code indent should never use tabs
#279: FILE: hw/net/can/ctu_can_fd_regs.h:48:
+^ICTU_CAN_FD_BTR                  = 0x24,$

ERROR: code indent should never use tabs
#280: FILE: hw/net/can/ctu_can_fd_regs.h:49:
+^ICTU_CAN_FD_BTR_FD               = 0x28,$

ERROR: code indent should never use tabs
#281: FILE: hw/net/can/ctu_can_fd_regs.h:50:
+^ICTU_CAN_FD_EWL                  = 0x2c,$

ERROR: code indent should never use tabs
#282: FILE: hw/net/can/ctu_can_fd_regs.h:51:
+^ICTU_CAN_FD_ERP                  = 0x2d,$

ERROR: code indent should never use tabs
#283: FILE: hw/net/can/ctu_can_fd_regs.h:52:
+^ICTU_CAN_FD_FAULT_STATE          = 0x2e,$

ERROR: code indent should never use tabs
#284: FILE: hw/net/can/ctu_can_fd_regs.h:53:
+^ICTU_CAN_FD_REC                  = 0x30,$

ERROR: code indent should never use tabs
#285: FILE: hw/net/can/ctu_can_fd_regs.h:54:
+^ICTU_CAN_FD_TEC                  = 0x32,$

ERROR: code indent should never use tabs
#286: FILE: hw/net/can/ctu_can_fd_regs.h:55:
+^ICTU_CAN_FD_ERR_NORM             = 0x34,$

ERROR: code indent should never use tabs
#287: FILE: hw/net/can/ctu_can_fd_regs.h:56:
+^ICTU_CAN_FD_ERR_FD               = 0x36,$

ERROR: code indent should never use tabs
#288: FILE: hw/net/can/ctu_can_fd_regs.h:57:
+^ICTU_CAN_FD_CTR_PRES             = 0x38,$

ERROR: code indent should never use tabs
#289: FILE: hw/net/can/ctu_can_fd_regs.h:58:
+^ICTU_CAN_FD_FILTER_A_MASK        = 0x3c,$

ERROR: code indent should never use tabs
#290: FILE: hw/net/can/ctu_can_fd_regs.h:59:
+^ICTU_CAN_FD_FILTER_A_VAL         = 0x40,$

ERROR: code indent should never use tabs
#291: FILE: hw/net/can/ctu_can_fd_regs.h:60:
+^ICTU_CAN_FD_FILTER_B_MASK        = 0x44,$

ERROR: code indent should never use tabs
#292: FILE: hw/net/can/ctu_can_fd_regs.h:61:
+^ICTU_CAN_FD_FILTER_B_VAL         = 0x48,$

ERROR: code indent should never use tabs
#293: FILE: hw/net/can/ctu_can_fd_regs.h:62:
+^ICTU_CAN_FD_FILTER_C_MASK        = 0x4c,$

ERROR: code indent should never use tabs
#294: FILE: hw/net/can/ctu_can_fd_regs.h:63:
+^ICTU_CAN_FD_FILTER_C_VAL         = 0x50,$

ERROR: code indent should never use tabs
#295: FILE: hw/net/can/ctu_can_fd_regs.h:64:
+^ICTU_CAN_FD_FILTER_RAN_LOW       = 0x54,$

ERROR: code indent should never use tabs
#296: FILE: hw/net/can/ctu_can_fd_regs.h:65:
+^ICTU_CAN_FD_FILTER_RAN_HIGH      = 0x58,$

ERROR: code indent should never use tabs
#297: FILE: hw/net/can/ctu_can_fd_regs.h:66:
+^ICTU_CAN_FD_FILTER_CONTROL       = 0x5c,$

ERROR: code indent should never use tabs
#298: FILE: hw/net/can/ctu_can_fd_regs.h:67:
+^ICTU_CAN_FD_FILTER_STATUS        = 0x5e,$

ERROR: code indent should never use tabs
#299: FILE: hw/net/can/ctu_can_fd_regs.h:68:
+^ICTU_CAN_FD_RX_MEM_INFO          = 0x60,$

ERROR: code indent should never use tabs
#300: FILE: hw/net/can/ctu_can_fd_regs.h:69:
+^ICTU_CAN_FD_RX_POINTERS          = 0x64,$

ERROR: code indent should never use tabs
#301: FILE: hw/net/can/ctu_can_fd_regs.h:70:
+^ICTU_CAN_FD_RX_STATUS            = 0x68,$

ERROR: code indent should never use tabs
#302: FILE: hw/net/can/ctu_can_fd_regs.h:71:
+^ICTU_CAN_FD_RX_SETTINGS          = 0x6a,$

ERROR: code indent should never use tabs
#303: FILE: hw/net/can/ctu_can_fd_regs.h:72:
+^ICTU_CAN_FD_RX_DATA              = 0x6c,$

ERROR: code indent should never use tabs
#304: FILE: hw/net/can/ctu_can_fd_regs.h:73:
+^ICTU_CAN_FD_TX_STATUS            = 0x70,$

ERROR: code indent should never use tabs
#305: FILE: hw/net/can/ctu_can_fd_regs.h:74:
+^ICTU_CAN_FD_TX_COMMAND           = 0x74,$

ERROR: code indent should never use tabs
#306: FILE: hw/net/can/ctu_can_fd_regs.h:75:
+^ICTU_CAN_FD_TX_PRIORITY          = 0x78,$

ERROR: code indent should never use tabs
#307: FILE: hw/net/can/ctu_can_fd_regs.h:76:
+^ICTU_CAN_FD_ERR_CAPT             = 0x7c,$

ERROR: code indent should never use tabs
#308: FILE: hw/net/can/ctu_can_fd_regs.h:77:
+^ICTU_CAN_FD_ALC                  = 0x7e,$

ERROR: code indent should never use tabs
#309: FILE: hw/net/can/ctu_can_fd_regs.h:78:
+^ICTU_CAN_FD_TRV_DELAY            = 0x80,$

ERROR: code indent should never use tabs
#310: FILE: hw/net/can/ctu_can_fd_regs.h:79:
+^ICTU_CAN_FD_SSP_CFG              = 0x82,$

ERROR: code indent should never use tabs
#311: FILE: hw/net/can/ctu_can_fd_regs.h:80:
+^ICTU_CAN_FD_RX_FR_CTR            = 0x84,$

ERROR: code indent should never use tabs
#312: FILE: hw/net/can/ctu_can_fd_regs.h:81:
+^ICTU_CAN_FD_TX_FR_CTR            = 0x88,$

ERROR: code indent should never use tabs
#313: FILE: hw/net/can/ctu_can_fd_regs.h:82:
+^ICTU_CAN_FD_DEBUG_REGISTER       = 0x8c,$

ERROR: code indent should never use tabs
#314: FILE: hw/net/can/ctu_can_fd_regs.h:83:
+^ICTU_CAN_FD_YOLO_REG             = 0x90,$

ERROR: code indent should never use tabs
#315: FILE: hw/net/can/ctu_can_fd_regs.h:84:
+^ICTU_CAN_FD_TIMESTAMP_LOW        = 0x94,$

ERROR: code indent should never use tabs
#316: FILE: hw/net/can/ctu_can_fd_regs.h:85:
+^ICTU_CAN_FD_TIMESTAMP_HIGH       = 0x98,$

ERROR: code indent should never use tabs
#317: FILE: hw/net/can/ctu_can_fd_regs.h:86:
+^ICTU_CAN_FD_TXTB1_DATA_1        = 0x100,$

ERROR: code indent should never use tabs
#318: FILE: hw/net/can/ctu_can_fd_regs.h:87:
+^ICTU_CAN_FD_TXTB1_DATA_2        = 0x104,$

ERROR: code indent should never use tabs
#319: FILE: hw/net/can/ctu_can_fd_regs.h:88:
+^ICTU_CAN_FD_TXTB1_DATA_20       = 0x14c,$

ERROR: code indent should never use tabs
#320: FILE: hw/net/can/ctu_can_fd_regs.h:89:
+^ICTU_CAN_FD_TXTB2_DATA_1        = 0x200,$

ERROR: code indent should never use tabs
#321: FILE: hw/net/can/ctu_can_fd_regs.h:90:
+^ICTU_CAN_FD_TXTB2_DATA_2        = 0x204,$

ERROR: code indent should never use tabs
#322: FILE: hw/net/can/ctu_can_fd_regs.h:91:
+^ICTU_CAN_FD_TXTB2_DATA_20       = 0x24c,$

ERROR: code indent should never use tabs
#323: FILE: hw/net/can/ctu_can_fd_regs.h:92:
+^ICTU_CAN_FD_TXTB3_DATA_1        = 0x300,$

ERROR: code indent should never use tabs
#324: FILE: hw/net/can/ctu_can_fd_regs.h:93:
+^ICTU_CAN_FD_TXTB3_DATA_2        = 0x304,$

ERROR: code indent should never use tabs
#325: FILE: hw/net/can/ctu_can_fd_regs.h:94:
+^ICTU_CAN_FD_TXTB3_DATA_20       = 0x34c,$

ERROR: code indent should never use tabs
#326: FILE: hw/net/can/ctu_can_fd_regs.h:95:
+^ICTU_CAN_FD_TXTB4_DATA_1        = 0x400,$

ERROR: code indent should never use tabs
#327: FILE: hw/net/can/ctu_can_fd_regs.h:96:
+^ICTU_CAN_FD_TXTB4_DATA_2        = 0x404,$

ERROR: code indent should never use tabs
#328: FILE: hw/net/can/ctu_can_fd_regs.h:97:
+^ICTU_CAN_FD_TXTB4_DATA_20       = 0x44c,$

ERROR: code indent should never use tabs
#334: FILE: hw/net/can/ctu_can_fd_regs.h:103:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#335: FILE: hw/net/can/ctu_can_fd_regs.h:104:
+^Istruct ctu_can_fd_device_id_version_s {$

WARNING: architecture specific defines should be avoided
#336: FILE: hw/net/can/ctu_can_fd_regs.h:105:
+#ifdef __LITTLE_ENDIAN_BITFIELD

ERROR: code indent should never use tabs
#338: FILE: hw/net/can/ctu_can_fd_regs.h:107:
+^I^Iuint32_t device_id              : 16;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#338: FILE: hw/net/can/ctu_can_fd_regs.h:107:
+               uint32_t device_id              : 16;
                                                ^

ERROR: code indent should never use tabs
#340: FILE: hw/net/can/ctu_can_fd_regs.h:109:
+^I^Iuint32_t ver_minor               : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#340: FILE: hw/net/can/ctu_can_fd_regs.h:109:
+               uint32_t ver_minor               : 8;
                                                 ^

ERROR: code indent should never use tabs
#341: FILE: hw/net/can/ctu_can_fd_regs.h:110:
+^I^Iuint32_t ver_major               : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#341: FILE: hw/net/can/ctu_can_fd_regs.h:110:
+               uint32_t ver_major               : 8;
                                                 ^

ERROR: code indent should never use tabs
#343: FILE: hw/net/can/ctu_can_fd_regs.h:112:
+^I^Iuint32_t ver_major               : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#343: FILE: hw/net/can/ctu_can_fd_regs.h:112:
+               uint32_t ver_major               : 8;
                                                 ^

ERROR: code indent should never use tabs
#344: FILE: hw/net/can/ctu_can_fd_regs.h:113:
+^I^Iuint32_t ver_minor               : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#344: FILE: hw/net/can/ctu_can_fd_regs.h:113:
+               uint32_t ver_minor               : 8;
                                                 ^

ERROR: code indent should never use tabs
#345: FILE: hw/net/can/ctu_can_fd_regs.h:114:
+^I^Iuint32_t device_id              : 16;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#345: FILE: hw/net/can/ctu_can_fd_regs.h:114:
+               uint32_t device_id              : 16;
                                                ^

ERROR: code indent should never use tabs
#347: FILE: hw/net/can/ctu_can_fd_regs.h:116:
+^I} s;$

ERROR: code indent should never use tabs
#351: FILE: hw/net/can/ctu_can_fd_regs.h:120:
+^ICTU_CAN_FD_ID    = 0xcafd,$

ERROR: code indent should never use tabs
#355: FILE: hw/net/can/ctu_can_fd_regs.h:124:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#356: FILE: hw/net/can/ctu_can_fd_regs.h:125:
+^Istruct ctu_can_fd_mode_settings_s {$

WARNING: architecture specific defines should be avoided
#357: FILE: hw/net/can/ctu_can_fd_regs.h:126:
+#ifdef __LITTLE_ENDIAN_BITFIELD

ERROR: code indent should never use tabs
#359: FILE: hw/net/can/ctu_can_fd_regs.h:128:
+^I^Iuint32_t rst                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#359: FILE: hw/net/can/ctu_can_fd_regs.h:128:
+               uint32_t rst                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#360: FILE: hw/net/can/ctu_can_fd_regs.h:129:
+^I^Iuint32_t lom                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#360: FILE: hw/net/can/ctu_can_fd_regs.h:129:
+               uint32_t lom                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#361: FILE: hw/net/can/ctu_can_fd_regs.h:130:
+^I^Iuint32_t stm                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#361: FILE: hw/net/can/ctu_can_fd_regs.h:130:
+               uint32_t stm                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#362: FILE: hw/net/can/ctu_can_fd_regs.h:131:
+^I^Iuint32_t afm                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#362: FILE: hw/net/can/ctu_can_fd_regs.h:131:
+               uint32_t afm                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#363: FILE: hw/net/can/ctu_can_fd_regs.h:132:
+^I^Iuint32_t fde                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#363: FILE: hw/net/can/ctu_can_fd_regs.h:132:
+               uint32_t fde                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#364: FILE: hw/net/can/ctu_can_fd_regs.h:133:
+^I^Iuint32_t reserved_6_5            : 2;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#364: FILE: hw/net/can/ctu_can_fd_regs.h:133:
+               uint32_t reserved_6_5            : 2;
                                                 ^

ERROR: code indent should never use tabs
#365: FILE: hw/net/can/ctu_can_fd_regs.h:134:
+^I^Iuint32_t acf                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#365: FILE: hw/net/can/ctu_can_fd_regs.h:134:
+               uint32_t acf                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#366: FILE: hw/net/can/ctu_can_fd_regs.h:135:
+^I^Iuint32_t tstm                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#366: FILE: hw/net/can/ctu_can_fd_regs.h:135:
+               uint32_t tstm                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#367: FILE: hw/net/can/ctu_can_fd_regs.h:136:
+^I^Iuint32_t reserved_15_9           : 7;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#367: FILE: hw/net/can/ctu_can_fd_regs.h:136:
+               uint32_t reserved_15_9           : 7;
                                                 ^

ERROR: code indent should never use tabs
#369: FILE: hw/net/can/ctu_can_fd_regs.h:138:
+^I^Iuint32_t rtrle                   : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#369: FILE: hw/net/can/ctu_can_fd_regs.h:138:
+               uint32_t rtrle                   : 1;
                                                 ^

ERROR: code indent should never use tabs
#370: FILE: hw/net/can/ctu_can_fd_regs.h:139:
+^I^Iuint32_t rtrth                   : 4;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#370: FILE: hw/net/can/ctu_can_fd_regs.h:139:
+               uint32_t rtrth                   : 4;
                                                 ^

ERROR: code indent should never use tabs
#371: FILE: hw/net/can/ctu_can_fd_regs.h:140:
+^I^Iuint32_t ilbp                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#371: FILE: hw/net/can/ctu_can_fd_regs.h:140:
+               uint32_t ilbp                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#372: FILE: hw/net/can/ctu_can_fd_regs.h:141:
+^I^Iuint32_t ena                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#372: FILE: hw/net/can/ctu_can_fd_regs.h:141:
+               uint32_t ena                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#373: FILE: hw/net/can/ctu_can_fd_regs.h:142:
+^I^Iuint32_t nisofd                  : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#373: FILE: hw/net/can/ctu_can_fd_regs.h:142:
+               uint32_t nisofd                  : 1;
                                                 ^

ERROR: code indent should never use tabs
#374: FILE: hw/net/can/ctu_can_fd_regs.h:143:
+^I^Iuint32_t pex                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#374: FILE: hw/net/can/ctu_can_fd_regs.h:143:
+               uint32_t pex                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#375: FILE: hw/net/can/ctu_can_fd_regs.h:144:
+^I^Iuint32_t reserved_31_25          : 7;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#375: FILE: hw/net/can/ctu_can_fd_regs.h:144:
+               uint32_t reserved_31_25          : 7;
                                                 ^

ERROR: code indent should never use tabs
#377: FILE: hw/net/can/ctu_can_fd_regs.h:146:
+^I^Iuint32_t reserved_31_25          : 7;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#377: FILE: hw/net/can/ctu_can_fd_regs.h:146:
+               uint32_t reserved_31_25          : 7;
                                                 ^

ERROR: code indent should never use tabs
#378: FILE: hw/net/can/ctu_can_fd_regs.h:147:
+^I^Iuint32_t pex                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#378: FILE: hw/net/can/ctu_can_fd_regs.h:147:
+               uint32_t pex                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#379: FILE: hw/net/can/ctu_can_fd_regs.h:148:
+^I^Iuint32_t nisofd                  : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#379: FILE: hw/net/can/ctu_can_fd_regs.h:148:
+               uint32_t nisofd                  : 1;
                                                 ^

ERROR: code indent should never use tabs
#380: FILE: hw/net/can/ctu_can_fd_regs.h:149:
+^I^Iuint32_t ena                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#380: FILE: hw/net/can/ctu_can_fd_regs.h:149:
+               uint32_t ena                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#381: FILE: hw/net/can/ctu_can_fd_regs.h:150:
+^I^Iuint32_t ilbp                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#381: FILE: hw/net/can/ctu_can_fd_regs.h:150:
+               uint32_t ilbp                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#382: FILE: hw/net/can/ctu_can_fd_regs.h:151:
+^I^Iuint32_t rtrth                   : 4;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#382: FILE: hw/net/can/ctu_can_fd_regs.h:151:
+               uint32_t rtrth                   : 4;
                                                 ^

ERROR: code indent should never use tabs
#383: FILE: hw/net/can/ctu_can_fd_regs.h:152:
+^I^Iuint32_t rtrle                   : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#383: FILE: hw/net/can/ctu_can_fd_regs.h:152:
+               uint32_t rtrle                   : 1;
                                                 ^

ERROR: code indent should never use tabs
#384: FILE: hw/net/can/ctu_can_fd_regs.h:153:
+^I^Iuint32_t reserved_15_9           : 7;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#384: FILE: hw/net/can/ctu_can_fd_regs.h:153:
+               uint32_t reserved_15_9           : 7;
                                                 ^

ERROR: code indent should never use tabs
#385: FILE: hw/net/can/ctu_can_fd_regs.h:154:
+^I^Iuint32_t tstm                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#385: FILE: hw/net/can/ctu_can_fd_regs.h:154:
+               uint32_t tstm                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#386: FILE: hw/net/can/ctu_can_fd_regs.h:155:
+^I^Iuint32_t acf                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#386: FILE: hw/net/can/ctu_can_fd_regs.h:155:
+               uint32_t acf                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#387: FILE: hw/net/can/ctu_can_fd_regs.h:156:
+^I^Iuint32_t reserved_6_5            : 2;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#387: FILE: hw/net/can/ctu_can_fd_regs.h:156:
+               uint32_t reserved_6_5            : 2;
                                                 ^

ERROR: code indent should never use tabs
#388: FILE: hw/net/can/ctu_can_fd_regs.h:157:
+^I^Iuint32_t fde                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#388: FILE: hw/net/can/ctu_can_fd_regs.h:157:
+               uint32_t fde                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#389: FILE: hw/net/can/ctu_can_fd_regs.h:158:
+^I^Iuint32_t afm                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#389: FILE: hw/net/can/ctu_can_fd_regs.h:158:
+               uint32_t afm                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#390: FILE: hw/net/can/ctu_can_fd_regs.h:159:
+^I^Iuint32_t stm                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#390: FILE: hw/net/can/ctu_can_fd_regs.h:159:
+               uint32_t stm                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#391: FILE: hw/net/can/ctu_can_fd_regs.h:160:
+^I^Iuint32_t lom                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#391: FILE: hw/net/can/ctu_can_fd_regs.h:160:
+               uint32_t lom                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#392: FILE: hw/net/can/ctu_can_fd_regs.h:161:
+^I^Iuint32_t rst                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#392: FILE: hw/net/can/ctu_can_fd_regs.h:161:
+               uint32_t rst                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#394: FILE: hw/net/can/ctu_can_fd_regs.h:163:
+^I} s;$

ERROR: code indent should never use tabs
#398: FILE: hw/net/can/ctu_can_fd_regs.h:167:
+^ILOM_DISABLED       = 0x0,$

ERROR: code indent should never use tabs
#399: FILE: hw/net/can/ctu_can_fd_regs.h:168:
+^ILOM_ENABLED        = 0x1,$

ERROR: code indent should never use tabs
#403: FILE: hw/net/can/ctu_can_fd_regs.h:172:
+^ISTM_DISABLED       = 0x0,$

ERROR: code indent should never use tabs
#404: FILE: hw/net/can/ctu_can_fd_regs.h:173:
+^ISTM_ENABLED        = 0x1,$

ERROR: code indent should never use tabs
#408: FILE: hw/net/can/ctu_can_fd_regs.h:177:
+^IAFM_DISABLED       = 0x0,$

ERROR: code indent should never use tabs
#409: FILE: hw/net/can/ctu_can_fd_regs.h:178:
+^IAFM_ENABLED        = 0x1,$

ERROR: code indent should never use tabs
#413: FILE: hw/net/can/ctu_can_fd_regs.h:182:
+^IFDE_DISABLE       = 0x0,$

ERROR: code indent should never use tabs
#414: FILE: hw/net/can/ctu_can_fd_regs.h:183:
+^IFDE_ENABLE        = 0x1,$

ERROR: code indent should never use tabs
#418: FILE: hw/net/can/ctu_can_fd_regs.h:187:
+^IACF_DISABLED       = 0x0,$

ERROR: code indent should never use tabs
#419: FILE: hw/net/can/ctu_can_fd_regs.h:188:
+^IACF_ENABLED        = 0x1,$

ERROR: code indent should never use tabs
#423: FILE: hw/net/can/ctu_can_fd_regs.h:192:
+^IRTRLE_DISABLED       = 0x0,$

ERROR: code indent should never use tabs
#424: FILE: hw/net/can/ctu_can_fd_regs.h:193:
+^IRTRLE_ENABLED        = 0x1,$

ERROR: code indent should never use tabs
#428: FILE: hw/net/can/ctu_can_fd_regs.h:197:
+^IINT_LOOP_DISABLED       = 0x0,$

ERROR: code indent should never use tabs
#429: FILE: hw/net/can/ctu_can_fd_regs.h:198:
+^IINT_LOOP_ENABLED        = 0x1,$

ERROR: code indent should never use tabs
#433: FILE: hw/net/can/ctu_can_fd_regs.h:202:
+^ICTU_CAN_DISABLED       = 0x0,$

ERROR: code indent should never use tabs
#434: FILE: hw/net/can/ctu_can_fd_regs.h:203:
+^ICTU_CAN_ENABLED        = 0x1,$

ERROR: code indent should never use tabs
#438: FILE: hw/net/can/ctu_can_fd_regs.h:207:
+^IISO_FD           = 0x0,$

ERROR: code indent should never use tabs
#439: FILE: hw/net/can/ctu_can_fd_regs.h:208:
+^INON_ISO_FD       = 0x1,$

ERROR: code indent should never use tabs
#443: FILE: hw/net/can/ctu_can_fd_regs.h:212:
+^IPROTOCOL_EXCEPTION_DISABLED       = 0x0,$

ERROR: code indent should never use tabs
#444: FILE: hw/net/can/ctu_can_fd_regs.h:213:
+^IPROTOCOL_EXCEPTION_ENABLED        = 0x1,$

ERROR: code indent should never use tabs
#448: FILE: hw/net/can/ctu_can_fd_regs.h:217:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#449: FILE: hw/net/can/ctu_can_fd_regs.h:218:
+^Istruct ctu_can_fd_status_s {$

WARNING: architecture specific defines should be avoided
#450: FILE: hw/net/can/ctu_can_fd_regs.h:219:
+#ifdef __LITTLE_ENDIAN_BITFIELD

ERROR: code indent should never use tabs
#452: FILE: hw/net/can/ctu_can_fd_regs.h:221:
+^I^Iuint32_t rxne                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#452: FILE: hw/net/can/ctu_can_fd_regs.h:221:
+               uint32_t rxne                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#453: FILE: hw/net/can/ctu_can_fd_regs.h:222:
+^I^Iuint32_t dor                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#453: FILE: hw/net/can/ctu_can_fd_regs.h:222:
+               uint32_t dor                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#454: FILE: hw/net/can/ctu_can_fd_regs.h:223:
+^I^Iuint32_t txnf                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#454: FILE: hw/net/can/ctu_can_fd_regs.h:223:
+               uint32_t txnf                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#455: FILE: hw/net/can/ctu_can_fd_regs.h:224:
+^I^Iuint32_t eft                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#455: FILE: hw/net/can/ctu_can_fd_regs.h:224:
+               uint32_t eft                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#456: FILE: hw/net/can/ctu_can_fd_regs.h:225:
+^I^Iuint32_t rxs                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#456: FILE: hw/net/can/ctu_can_fd_regs.h:225:
+               uint32_t rxs                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#457: FILE: hw/net/can/ctu_can_fd_regs.h:226:
+^I^Iuint32_t txs                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#457: FILE: hw/net/can/ctu_can_fd_regs.h:226:
+               uint32_t txs                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#458: FILE: hw/net/can/ctu_can_fd_regs.h:227:
+^I^Iuint32_t ewl                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#458: FILE: hw/net/can/ctu_can_fd_regs.h:227:
+               uint32_t ewl                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#459: FILE: hw/net/can/ctu_can_fd_regs.h:228:
+^I^Iuint32_t idle                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#459: FILE: hw/net/can/ctu_can_fd_regs.h:228:
+               uint32_t idle                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#460: FILE: hw/net/can/ctu_can_fd_regs.h:229:
+^I^Iuint32_t reserved_31_8          : 24;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#460: FILE: hw/net/can/ctu_can_fd_regs.h:229:
+               uint32_t reserved_31_8          : 24;
                                                ^

ERROR: code indent should never use tabs
#462: FILE: hw/net/can/ctu_can_fd_regs.h:231:
+^I^Iuint32_t reserved_31_8          : 24;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#462: FILE: hw/net/can/ctu_can_fd_regs.h:231:
+               uint32_t reserved_31_8          : 24;
                                                ^

ERROR: code indent should never use tabs
#463: FILE: hw/net/can/ctu_can_fd_regs.h:232:
+^I^Iuint32_t idle                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#463: FILE: hw/net/can/ctu_can_fd_regs.h:232:
+               uint32_t idle                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#464: FILE: hw/net/can/ctu_can_fd_regs.h:233:
+^I^Iuint32_t ewl                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#464: FILE: hw/net/can/ctu_can_fd_regs.h:233:
+               uint32_t ewl                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#465: FILE: hw/net/can/ctu_can_fd_regs.h:234:
+^I^Iuint32_t txs                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#465: FILE: hw/net/can/ctu_can_fd_regs.h:234:
+               uint32_t txs                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#466: FILE: hw/net/can/ctu_can_fd_regs.h:235:
+^I^Iuint32_t rxs                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#466: FILE: hw/net/can/ctu_can_fd_regs.h:235:
+               uint32_t rxs                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#467: FILE: hw/net/can/ctu_can_fd_regs.h:236:
+^I^Iuint32_t eft                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#467: FILE: hw/net/can/ctu_can_fd_regs.h:236:
+               uint32_t eft                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#468: FILE: hw/net/can/ctu_can_fd_regs.h:237:
+^I^Iuint32_t txnf                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#468: FILE: hw/net/can/ctu_can_fd_regs.h:237:
+               uint32_t txnf                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#469: FILE: hw/net/can/ctu_can_fd_regs.h:238:
+^I^Iuint32_t dor                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#469: FILE: hw/net/can/ctu_can_fd_regs.h:238:
+               uint32_t dor                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#470: FILE: hw/net/can/ctu_can_fd_regs.h:239:
+^I^Iuint32_t rxne                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#470: FILE: hw/net/can/ctu_can_fd_regs.h:239:
+               uint32_t rxne                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#472: FILE: hw/net/can/ctu_can_fd_regs.h:241:
+^I} s;$

ERROR: code indent should never use tabs
#476: FILE: hw/net/can/ctu_can_fd_regs.h:245:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#477: FILE: hw/net/can/ctu_can_fd_regs.h:246:
+^Istruct ctu_can_fd_command_s {$

WARNING: architecture specific defines should be avoided
#478: FILE: hw/net/can/ctu_can_fd_regs.h:247:
+#ifdef __LITTLE_ENDIAN_BITFIELD

ERROR: code indent should never use tabs
#479: FILE: hw/net/can/ctu_can_fd_regs.h:248:
+^I^Iuint32_t reserved_1_0            : 2;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#479: FILE: hw/net/can/ctu_can_fd_regs.h:248:
+               uint32_t reserved_1_0            : 2;
                                                 ^

ERROR: code indent should never use tabs
#481: FILE: hw/net/can/ctu_can_fd_regs.h:250:
+^I^Iuint32_t rrb                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#481: FILE: hw/net/can/ctu_can_fd_regs.h:250:
+               uint32_t rrb                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#482: FILE: hw/net/can/ctu_can_fd_regs.h:251:
+^I^Iuint32_t cdo                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#482: FILE: hw/net/can/ctu_can_fd_regs.h:251:
+               uint32_t cdo                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#483: FILE: hw/net/can/ctu_can_fd_regs.h:252:
+^I^Iuint32_t ercrst                  : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#483: FILE: hw/net/can/ctu_can_fd_regs.h:252:
+               uint32_t ercrst                  : 1;
                                                 ^

ERROR: code indent should never use tabs
#484: FILE: hw/net/can/ctu_can_fd_regs.h:253:
+^I^Iuint32_t rxfcrst                 : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#484: FILE: hw/net/can/ctu_can_fd_regs.h:253:
+               uint32_t rxfcrst                 : 1;
                                                 ^

ERROR: code indent should never use tabs
#485: FILE: hw/net/can/ctu_can_fd_regs.h:254:
+^I^Iuint32_t txfcrst                 : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#485: FILE: hw/net/can/ctu_can_fd_regs.h:254:
+               uint32_t txfcrst                 : 1;
                                                 ^

ERROR: code indent should never use tabs
#486: FILE: hw/net/can/ctu_can_fd_regs.h:255:
+^I^Iuint32_t reserved_31_7          : 25;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#486: FILE: hw/net/can/ctu_can_fd_regs.h:255:
+               uint32_t reserved_31_7          : 25;
                                                ^

ERROR: code indent should never use tabs
#488: FILE: hw/net/can/ctu_can_fd_regs.h:257:
+^I^Iuint32_t reserved_31_7          : 25;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#488: FILE: hw/net/can/ctu_can_fd_regs.h:257:
+               uint32_t reserved_31_7          : 25;
                                                ^

ERROR: code indent should never use tabs
#489: FILE: hw/net/can/ctu_can_fd_regs.h:258:
+^I^Iuint32_t txfcrst                 : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#489: FILE: hw/net/can/ctu_can_fd_regs.h:258:
+               uint32_t txfcrst                 : 1;
                                                 ^

ERROR: code indent should never use tabs
#490: FILE: hw/net/can/ctu_can_fd_regs.h:259:
+^I^Iuint32_t rxfcrst                 : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#490: FILE: hw/net/can/ctu_can_fd_regs.h:259:
+               uint32_t rxfcrst                 : 1;
                                                 ^

ERROR: code indent should never use tabs
#491: FILE: hw/net/can/ctu_can_fd_regs.h:260:
+^I^Iuint32_t ercrst                  : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#491: FILE: hw/net/can/ctu_can_fd_regs.h:260:
+               uint32_t ercrst                  : 1;
                                                 ^

ERROR: code indent should never use tabs
#492: FILE: hw/net/can/ctu_can_fd_regs.h:261:
+^I^Iuint32_t cdo                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#492: FILE: hw/net/can/ctu_can_fd_regs.h:261:
+               uint32_t cdo                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#493: FILE: hw/net/can/ctu_can_fd_regs.h:262:
+^I^Iuint32_t rrb                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#493: FILE: hw/net/can/ctu_can_fd_regs.h:262:
+               uint32_t rrb                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#494: FILE: hw/net/can/ctu_can_fd_regs.h:263:
+^I^Iuint32_t reserved_1_0            : 2;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#494: FILE: hw/net/can/ctu_can_fd_regs.h:263:
+               uint32_t reserved_1_0            : 2;
                                                 ^

ERROR: code indent should never use tabs
#496: FILE: hw/net/can/ctu_can_fd_regs.h:265:
+^I} s;$

ERROR: code indent should never use tabs
#500: FILE: hw/net/can/ctu_can_fd_regs.h:269:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#501: FILE: hw/net/can/ctu_can_fd_regs.h:270:
+^Istruct ctu_can_fd_int_stat_s {$

WARNING: architecture specific defines should be avoided
#502: FILE: hw/net/can/ctu_can_fd_regs.h:271:
+#ifdef __LITTLE_ENDIAN_BITFIELD

ERROR: code indent should never use tabs
#504: FILE: hw/net/can/ctu_can_fd_regs.h:273:
+^I^Iuint32_t rxi                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#504: FILE: hw/net/can/ctu_can_fd_regs.h:273:
+               uint32_t rxi                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#505: FILE: hw/net/can/ctu_can_fd_regs.h:274:
+^I^Iuint32_t txi                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#505: FILE: hw/net/can/ctu_can_fd_regs.h:274:
+               uint32_t txi                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#506: FILE: hw/net/can/ctu_can_fd_regs.h:275:
+^I^Iuint32_t ewli                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#506: FILE: hw/net/can/ctu_can_fd_regs.h:275:
+               uint32_t ewli                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#507: FILE: hw/net/can/ctu_can_fd_regs.h:276:
+^I^Iuint32_t doi                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#507: FILE: hw/net/can/ctu_can_fd_regs.h:276:
+               uint32_t doi                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#508: FILE: hw/net/can/ctu_can_fd_regs.h:277:
+^I^Iuint32_t fcsi                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#508: FILE: hw/net/can/ctu_can_fd_regs.h:277:
+               uint32_t fcsi                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#509: FILE: hw/net/can/ctu_can_fd_regs.h:278:
+^I^Iuint32_t ali                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#509: FILE: hw/net/can/ctu_can_fd_regs.h:278:
+               uint32_t ali                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#510: FILE: hw/net/can/ctu_can_fd_regs.h:279:
+^I^Iuint32_t bei                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#510: FILE: hw/net/can/ctu_can_fd_regs.h:279:
+               uint32_t bei                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#511: FILE: hw/net/can/ctu_can_fd_regs.h:280:
+^I^Iuint32_t ofi                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#511: FILE: hw/net/can/ctu_can_fd_regs.h:280:
+               uint32_t ofi                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#512: FILE: hw/net/can/ctu_can_fd_regs.h:281:
+^I^Iuint32_t rxfi                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#512: FILE: hw/net/can/ctu_can_fd_regs.h:281:
+               uint32_t rxfi                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#513: FILE: hw/net/can/ctu_can_fd_regs.h:282:
+^I^Iuint32_t bsi                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#513: FILE: hw/net/can/ctu_can_fd_regs.h:282:
+               uint32_t bsi                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#514: FILE: hw/net/can/ctu_can_fd_regs.h:283:
+^I^Iuint32_t rbnei                   : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#514: FILE: hw/net/can/ctu_can_fd_regs.h:283:
+               uint32_t rbnei                   : 1;
                                                 ^

ERROR: code indent should never use tabs
#515: FILE: hw/net/can/ctu_can_fd_regs.h:284:
+^I^Iuint32_t txbhci                  : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#515: FILE: hw/net/can/ctu_can_fd_regs.h:284:
+               uint32_t txbhci                  : 1;
                                                 ^

ERROR: code indent should never use tabs
#516: FILE: hw/net/can/ctu_can_fd_regs.h:285:
+^I^Iuint32_t reserved_31_12         : 20;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#516: FILE: hw/net/can/ctu_can_fd_regs.h:285:
+               uint32_t reserved_31_12         : 20;
                                                ^

ERROR: code indent should never use tabs
#518: FILE: hw/net/can/ctu_can_fd_regs.h:287:
+^I^Iuint32_t reserved_31_12         : 20;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#518: FILE: hw/net/can/ctu_can_fd_regs.h:287:
+               uint32_t reserved_31_12         : 20;
                                                ^

ERROR: code indent should never use tabs
#519: FILE: hw/net/can/ctu_can_fd_regs.h:288:
+^I^Iuint32_t txbhci                  : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#519: FILE: hw/net/can/ctu_can_fd_regs.h:288:
+               uint32_t txbhci                  : 1;
                                                 ^

ERROR: code indent should never use tabs
#520: FILE: hw/net/can/ctu_can_fd_regs.h:289:
+^I^Iuint32_t rbnei                   : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#520: FILE: hw/net/can/ctu_can_fd_regs.h:289:
+               uint32_t rbnei                   : 1;
                                                 ^

ERROR: code indent should never use tabs
#521: FILE: hw/net/can/ctu_can_fd_regs.h:290:
+^I^Iuint32_t bsi                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#521: FILE: hw/net/can/ctu_can_fd_regs.h:290:
+               uint32_t bsi                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#522: FILE: hw/net/can/ctu_can_fd_regs.h:291:
+^I^Iuint32_t rxfi                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#522: FILE: hw/net/can/ctu_can_fd_regs.h:291:
+               uint32_t rxfi                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#523: FILE: hw/net/can/ctu_can_fd_regs.h:292:
+^I^Iuint32_t ofi                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#523: FILE: hw/net/can/ctu_can_fd_regs.h:292:
+               uint32_t ofi                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#524: FILE: hw/net/can/ctu_can_fd_regs.h:293:
+^I^Iuint32_t bei                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#524: FILE: hw/net/can/ctu_can_fd_regs.h:293:
+               uint32_t bei                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#525: FILE: hw/net/can/ctu_can_fd_regs.h:294:
+^I^Iuint32_t ali                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#525: FILE: hw/net/can/ctu_can_fd_regs.h:294:
+               uint32_t ali                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#526: FILE: hw/net/can/ctu_can_fd_regs.h:295:
+^I^Iuint32_t fcsi                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#526: FILE: hw/net/can/ctu_can_fd_regs.h:295:
+               uint32_t fcsi                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#527: FILE: hw/net/can/ctu_can_fd_regs.h:296:
+^I^Iuint32_t doi                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#527: FILE: hw/net/can/ctu_can_fd_regs.h:296:
+               uint32_t doi                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#528: FILE: hw/net/can/ctu_can_fd_regs.h:297:
+^I^Iuint32_t ewli                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#528: FILE: hw/net/can/ctu_can_fd_regs.h:297:
+               uint32_t ewli                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#529: FILE: hw/net/can/ctu_can_fd_regs.h:298:
+^I^Iuint32_t txi                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#529: FILE: hw/net/can/ctu_can_fd_regs.h:298:
+               uint32_t txi                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#530: FILE: hw/net/can/ctu_can_fd_regs.h:299:
+^I^Iuint32_t rxi                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#530: FILE: hw/net/can/ctu_can_fd_regs.h:299:
+               uint32_t rxi                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#532: FILE: hw/net/can/ctu_can_fd_regs.h:301:
+^I} s;$

ERROR: code indent should never use tabs
#536: FILE: hw/net/can/ctu_can_fd_regs.h:305:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#537: FILE: hw/net/can/ctu_can_fd_regs.h:306:
+^Istruct ctu_can_fd_int_ena_set_s {$

WARNING: architecture specific defines should be avoided
#538: FILE: hw/net/can/ctu_can_fd_regs.h:307:
+#ifdef __LITTLE_ENDIAN_BITFIELD

ERROR: code indent should never use tabs
#540: FILE: hw/net/can/ctu_can_fd_regs.h:309:
+^I^Iuint32_t int_ena_set            : 12;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#540: FILE: hw/net/can/ctu_can_fd_regs.h:309:
+               uint32_t int_ena_set            : 12;
                                                ^

ERROR: code indent should never use tabs
#541: FILE: hw/net/can/ctu_can_fd_regs.h:310:
+^I^Iuint32_t reserved_31_12         : 20;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#541: FILE: hw/net/can/ctu_can_fd_regs.h:310:
+               uint32_t reserved_31_12         : 20;
                                                ^

ERROR: code indent should never use tabs
#543: FILE: hw/net/can/ctu_can_fd_regs.h:312:
+^I^Iuint32_t reserved_31_12         : 20;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#543: FILE: hw/net/can/ctu_can_fd_regs.h:312:
+               uint32_t reserved_31_12         : 20;
                                                ^

ERROR: code indent should never use tabs
#544: FILE: hw/net/can/ctu_can_fd_regs.h:313:
+^I^Iuint32_t int_ena_set            : 12;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#544: FILE: hw/net/can/ctu_can_fd_regs.h:313:
+               uint32_t int_ena_set            : 12;
                                                ^

ERROR: code indent should never use tabs
#546: FILE: hw/net/can/ctu_can_fd_regs.h:315:
+^I} s;$

ERROR: code indent should never use tabs
#550: FILE: hw/net/can/ctu_can_fd_regs.h:319:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#551: FILE: hw/net/can/ctu_can_fd_regs.h:320:
+^Istruct ctu_can_fd_int_ena_clr_s {$

WARNING: architecture specific defines should be avoided
#552: FILE: hw/net/can/ctu_can_fd_regs.h:321:
+#ifdef __LITTLE_ENDIAN_BITFIELD

ERROR: code indent should never use tabs
#554: FILE: hw/net/can/ctu_can_fd_regs.h:323:
+^I^Iuint32_t int_ena_clr            : 12;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#554: FILE: hw/net/can/ctu_can_fd_regs.h:323:
+               uint32_t int_ena_clr            : 12;
                                                ^

ERROR: code indent should never use tabs
#555: FILE: hw/net/can/ctu_can_fd_regs.h:324:
+^I^Iuint32_t reserved_31_12         : 20;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#555: FILE: hw/net/can/ctu_can_fd_regs.h:324:
+               uint32_t reserved_31_12         : 20;
                                                ^

ERROR: code indent should never use tabs
#557: FILE: hw/net/can/ctu_can_fd_regs.h:326:
+^I^Iuint32_t reserved_31_12         : 20;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#557: FILE: hw/net/can/ctu_can_fd_regs.h:326:
+               uint32_t reserved_31_12         : 20;
                                                ^

ERROR: code indent should never use tabs
#558: FILE: hw/net/can/ctu_can_fd_regs.h:327:
+^I^Iuint32_t int_ena_clr            : 12;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#558: FILE: hw/net/can/ctu_can_fd_regs.h:327:
+               uint32_t int_ena_clr            : 12;
                                                ^

ERROR: code indent should never use tabs
#560: FILE: hw/net/can/ctu_can_fd_regs.h:329:
+^I} s;$

ERROR: code indent should never use tabs
#564: FILE: hw/net/can/ctu_can_fd_regs.h:333:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#565: FILE: hw/net/can/ctu_can_fd_regs.h:334:
+^Istruct ctu_can_fd_int_mask_set_s {$

WARNING: architecture specific defines should be avoided
#566: FILE: hw/net/can/ctu_can_fd_regs.h:335:
+#ifdef __LITTLE_ENDIAN_BITFIELD

ERROR: code indent should never use tabs
#568: FILE: hw/net/can/ctu_can_fd_regs.h:337:
+^I^Iuint32_t int_mask_set           : 12;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#568: FILE: hw/net/can/ctu_can_fd_regs.h:337:
+               uint32_t int_mask_set           : 12;
                                                ^

ERROR: code indent should never use tabs
#569: FILE: hw/net/can/ctu_can_fd_regs.h:338:
+^I^Iuint32_t reserved_31_12         : 20;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#569: FILE: hw/net/can/ctu_can_fd_regs.h:338:
+               uint32_t reserved_31_12         : 20;
                                                ^

ERROR: code indent should never use tabs
#571: FILE: hw/net/can/ctu_can_fd_regs.h:340:
+^I^Iuint32_t reserved_31_12         : 20;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#571: FILE: hw/net/can/ctu_can_fd_regs.h:340:
+               uint32_t reserved_31_12         : 20;
                                                ^

ERROR: code indent should never use tabs
#572: FILE: hw/net/can/ctu_can_fd_regs.h:341:
+^I^Iuint32_t int_mask_set           : 12;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#572: FILE: hw/net/can/ctu_can_fd_regs.h:341:
+               uint32_t int_mask_set           : 12;
                                                ^

ERROR: code indent should never use tabs
#574: FILE: hw/net/can/ctu_can_fd_regs.h:343:
+^I} s;$

ERROR: code indent should never use tabs
#578: FILE: hw/net/can/ctu_can_fd_regs.h:347:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#579: FILE: hw/net/can/ctu_can_fd_regs.h:348:
+^Istruct ctu_can_fd_int_mask_clr_s {$

WARNING: architecture specific defines should be avoided
#580: FILE: hw/net/can/ctu_can_fd_regs.h:349:
+#ifdef __LITTLE_ENDIAN_BITFIELD

ERROR: code indent should never use tabs
#582: FILE: hw/net/can/ctu_can_fd_regs.h:351:
+^I^Iuint32_t int_mask_clr           : 12;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#582: FILE: hw/net/can/ctu_can_fd_regs.h:351:
+               uint32_t int_mask_clr           : 12;
                                                ^

ERROR: code indent should never use tabs
#583: FILE: hw/net/can/ctu_can_fd_regs.h:352:
+^I^Iuint32_t reserved_31_12         : 20;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#583: FILE: hw/net/can/ctu_can_fd_regs.h:352:
+               uint32_t reserved_31_12         : 20;
                                                ^

ERROR: code indent should never use tabs
#585: FILE: hw/net/can/ctu_can_fd_regs.h:354:
+^I^Iuint32_t reserved_31_12         : 20;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#585: FILE: hw/net/can/ctu_can_fd_regs.h:354:
+               uint32_t reserved_31_12         : 20;
                                                ^

ERROR: code indent should never use tabs
#586: FILE: hw/net/can/ctu_can_fd_regs.h:355:
+^I^Iuint32_t int_mask_clr           : 12;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#586: FILE: hw/net/can/ctu_can_fd_regs.h:355:
+               uint32_t int_mask_clr           : 12;
                                                ^

ERROR: code indent should never use tabs
#588: FILE: hw/net/can/ctu_can_fd_regs.h:357:
+^I} s;$

ERROR: code indent should never use tabs
#592: FILE: hw/net/can/ctu_can_fd_regs.h:361:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#593: FILE: hw/net/can/ctu_can_fd_regs.h:362:
+^Istruct ctu_can_fd_btr_s {$

WARNING: architecture specific defines should be avoided
#594: FILE: hw/net/can/ctu_can_fd_regs.h:363:
+#ifdef __LITTLE_ENDIAN_BITFIELD

ERROR: code indent should never use tabs
#596: FILE: hw/net/can/ctu_can_fd_regs.h:365:
+^I^Iuint32_t prop                    : 7;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#596: FILE: hw/net/can/ctu_can_fd_regs.h:365:
+               uint32_t prop                    : 7;
                                                 ^

ERROR: code indent should never use tabs
#597: FILE: hw/net/can/ctu_can_fd_regs.h:366:
+^I^Iuint32_t ph1                     : 6;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#597: FILE: hw/net/can/ctu_can_fd_regs.h:366:
+               uint32_t ph1                     : 6;
                                                 ^

ERROR: code indent should never use tabs
#598: FILE: hw/net/can/ctu_can_fd_regs.h:367:
+^I^Iuint32_t ph2                     : 6;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#598: FILE: hw/net/can/ctu_can_fd_regs.h:367:
+               uint32_t ph2                     : 6;
                                                 ^

ERROR: code indent should never use tabs
#599: FILE: hw/net/can/ctu_can_fd_regs.h:368:
+^I^Iuint32_t brp                     : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#599: FILE: hw/net/can/ctu_can_fd_regs.h:368:
+               uint32_t brp                     : 8;
                                                 ^

ERROR: code indent should never use tabs
#600: FILE: hw/net/can/ctu_can_fd_regs.h:369:
+^I^Iuint32_t sjw                     : 5;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#600: FILE: hw/net/can/ctu_can_fd_regs.h:369:
+               uint32_t sjw                     : 5;
                                                 ^

ERROR: code indent should never use tabs
#602: FILE: hw/net/can/ctu_can_fd_regs.h:371:
+^I^Iuint32_t sjw                     : 5;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#602: FILE: hw/net/can/ctu_can_fd_regs.h:371:
+               uint32_t sjw                     : 5;
                                                 ^

ERROR: code indent should never use tabs
#603: FILE: hw/net/can/ctu_can_fd_regs.h:372:
+^I^Iuint32_t brp                     : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#603: FILE: hw/net/can/ctu_can_fd_regs.h:372:
+               uint32_t brp                     : 8;
                                                 ^

ERROR: code indent should never use tabs
#604: FILE: hw/net/can/ctu_can_fd_regs.h:373:
+^I^Iuint32_t ph2                     : 6;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#604: FILE: hw/net/can/ctu_can_fd_regs.h:373:
+               uint32_t ph2                     : 6;
                                                 ^

ERROR: code indent should never use tabs
#605: FILE: hw/net/can/ctu_can_fd_regs.h:374:
+^I^Iuint32_t ph1                     : 6;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#605: FILE: hw/net/can/ctu_can_fd_regs.h:374:
+               uint32_t ph1                     : 6;
                                                 ^

ERROR: code indent should never use tabs
#606: FILE: hw/net/can/ctu_can_fd_regs.h:375:
+^I^Iuint32_t prop                    : 7;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#606: FILE: hw/net/can/ctu_can_fd_regs.h:375:
+               uint32_t prop                    : 7;
                                                 ^

ERROR: code indent should never use tabs
#608: FILE: hw/net/can/ctu_can_fd_regs.h:377:
+^I} s;$

ERROR: code indent should never use tabs
#612: FILE: hw/net/can/ctu_can_fd_regs.h:381:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#613: FILE: hw/net/can/ctu_can_fd_regs.h:382:
+^Istruct ctu_can_fd_btr_fd_s {$

WARNING: architecture specific defines should be avoided
#614: FILE: hw/net/can/ctu_can_fd_regs.h:383:
+#ifdef __LITTLE_ENDIAN_BITFIELD

ERROR: code indent should never use tabs
#616: FILE: hw/net/can/ctu_can_fd_regs.h:385:
+^I^Iuint32_t prop_fd                 : 6;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#616: FILE: hw/net/can/ctu_can_fd_regs.h:385:
+               uint32_t prop_fd                 : 6;
                                                 ^

ERROR: code indent should never use tabs
#617: FILE: hw/net/can/ctu_can_fd_regs.h:386:
+^I^Iuint32_t reserved_6              : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#617: FILE: hw/net/can/ctu_can_fd_regs.h:386:
+               uint32_t reserved_6              : 1;
                                                 ^

ERROR: code indent should never use tabs
#618: FILE: hw/net/can/ctu_can_fd_regs.h:387:
+^I^Iuint32_t ph1_fd                  : 5;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#618: FILE: hw/net/can/ctu_can_fd_regs.h:387:
+               uint32_t ph1_fd                  : 5;
                                                 ^

ERROR: code indent should never use tabs
#619: FILE: hw/net/can/ctu_can_fd_regs.h:388:
+^I^Iuint32_t reserved_12             : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#619: FILE: hw/net/can/ctu_can_fd_regs.h:388:
+               uint32_t reserved_12             : 1;
                                                 ^

ERROR: code indent should never use tabs
#620: FILE: hw/net/can/ctu_can_fd_regs.h:389:
+^I^Iuint32_t ph2_fd                  : 5;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#620: FILE: hw/net/can/ctu_can_fd_regs.h:389:
+               uint32_t ph2_fd                  : 5;
                                                 ^

ERROR: code indent should never use tabs
#621: FILE: hw/net/can/ctu_can_fd_regs.h:390:
+^I^Iuint32_t reserved_18             : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#621: FILE: hw/net/can/ctu_can_fd_regs.h:390:
+               uint32_t reserved_18             : 1;
                                                 ^

ERROR: code indent should never use tabs
#622: FILE: hw/net/can/ctu_can_fd_regs.h:391:
+^I^Iuint32_t brp_fd                  : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#622: FILE: hw/net/can/ctu_can_fd_regs.h:391:
+               uint32_t brp_fd                  : 8;
                                                 ^

ERROR: code indent should never use tabs
#623: FILE: hw/net/can/ctu_can_fd_regs.h:392:
+^I^Iuint32_t sjw_fd                  : 5;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#623: FILE: hw/net/can/ctu_can_fd_regs.h:392:
+               uint32_t sjw_fd                  : 5;
                                                 ^

ERROR: code indent should never use tabs
#625: FILE: hw/net/can/ctu_can_fd_regs.h:394:
+^I^Iuint32_t sjw_fd                  : 5;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#625: FILE: hw/net/can/ctu_can_fd_regs.h:394:
+               uint32_t sjw_fd                  : 5;
                                                 ^

ERROR: code indent should never use tabs
#626: FILE: hw/net/can/ctu_can_fd_regs.h:395:
+^I^Iuint32_t brp_fd                  : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#626: FILE: hw/net/can/ctu_can_fd_regs.h:395:
+               uint32_t brp_fd                  : 8;
                                                 ^

ERROR: code indent should never use tabs
#627: FILE: hw/net/can/ctu_can_fd_regs.h:396:
+^I^Iuint32_t reserved_18             : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#627: FILE: hw/net/can/ctu_can_fd_regs.h:396:
+               uint32_t reserved_18             : 1;
                                                 ^

ERROR: code indent should never use tabs
#628: FILE: hw/net/can/ctu_can_fd_regs.h:397:
+^I^Iuint32_t ph2_fd                  : 5;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#628: FILE: hw/net/can/ctu_can_fd_regs.h:397:
+               uint32_t ph2_fd                  : 5;
                                                 ^

ERROR: code indent should never use tabs
#629: FILE: hw/net/can/ctu_can_fd_regs.h:398:
+^I^Iuint32_t reserved_12             : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#629: FILE: hw/net/can/ctu_can_fd_regs.h:398:
+               uint32_t reserved_12             : 1;
                                                 ^

ERROR: code indent should never use tabs
#630: FILE: hw/net/can/ctu_can_fd_regs.h:399:
+^I^Iuint32_t ph1_fd                  : 5;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#630: FILE: hw/net/can/ctu_can_fd_regs.h:399:
+               uint32_t ph1_fd                  : 5;
                                                 ^

ERROR: code indent should never use tabs
#631: FILE: hw/net/can/ctu_can_fd_regs.h:400:
+^I^Iuint32_t reserved_6              : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#631: FILE: hw/net/can/ctu_can_fd_regs.h:400:
+               uint32_t reserved_6              : 1;
                                                 ^

ERROR: code indent should never use tabs
#632: FILE: hw/net/can/ctu_can_fd_regs.h:401:
+^I^Iuint32_t prop_fd                 : 6;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#632: FILE: hw/net/can/ctu_can_fd_regs.h:401:
+               uint32_t prop_fd                 : 6;
                                                 ^

ERROR: code indent should never use tabs
#634: FILE: hw/net/can/ctu_can_fd_regs.h:403:
+^I} s;$

ERROR: code indent should never use tabs
#638: FILE: hw/net/can/ctu_can_fd_regs.h:407:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#639: FILE: hw/net/can/ctu_can_fd_regs.h:408:
+^Istruct ctu_can_fd_ewl_erp_fault_state_s {$

WARNING: architecture specific defines should be avoided
#640: FILE: hw/net/can/ctu_can_fd_regs.h:409:
+#ifdef __LITTLE_ENDIAN_BITFIELD

ERROR: code indent should never use tabs
#642: FILE: hw/net/can/ctu_can_fd_regs.h:411:
+^I^Iuint32_t ew_limit                : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#642: FILE: hw/net/can/ctu_can_fd_regs.h:411:
+               uint32_t ew_limit                : 8;
                                                 ^

ERROR: code indent should never use tabs
#644: FILE: hw/net/can/ctu_can_fd_regs.h:413:
+^I^Iuint32_t erp_limit               : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#644: FILE: hw/net/can/ctu_can_fd_regs.h:413:
+               uint32_t erp_limit               : 8;
                                                 ^

ERROR: code indent should never use tabs
#646: FILE: hw/net/can/ctu_can_fd_regs.h:415:
+^I^Iuint32_t era                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#646: FILE: hw/net/can/ctu_can_fd_regs.h:415:
+               uint32_t era                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#647: FILE: hw/net/can/ctu_can_fd_regs.h:416:
+^I^Iuint32_t erp                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#647: FILE: hw/net/can/ctu_can_fd_regs.h:416:
+               uint32_t erp                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#648: FILE: hw/net/can/ctu_can_fd_regs.h:417:
+^I^Iuint32_t bof                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#648: FILE: hw/net/can/ctu_can_fd_regs.h:417:
+               uint32_t bof                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#649: FILE: hw/net/can/ctu_can_fd_regs.h:418:
+^I^Iuint32_t reserved_31_19         : 13;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#649: FILE: hw/net/can/ctu_can_fd_regs.h:418:
+               uint32_t reserved_31_19         : 13;
                                                ^

ERROR: code indent should never use tabs
#651: FILE: hw/net/can/ctu_can_fd_regs.h:420:
+^I^Iuint32_t reserved_31_19         : 13;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#651: FILE: hw/net/can/ctu_can_fd_regs.h:420:
+               uint32_t reserved_31_19         : 13;
                                                ^

ERROR: code indent should never use tabs
#652: FILE: hw/net/can/ctu_can_fd_regs.h:421:
+^I^Iuint32_t bof                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#652: FILE: hw/net/can/ctu_can_fd_regs.h:421:
+               uint32_t bof                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#653: FILE: hw/net/can/ctu_can_fd_regs.h:422:
+^I^Iuint32_t erp                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#653: FILE: hw/net/can/ctu_can_fd_regs.h:422:
+               uint32_t erp                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#654: FILE: hw/net/can/ctu_can_fd_regs.h:423:
+^I^Iuint32_t era                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#654: FILE: hw/net/can/ctu_can_fd_regs.h:423:
+               uint32_t era                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#655: FILE: hw/net/can/ctu_can_fd_regs.h:424:
+^I^Iuint32_t erp_limit               : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#655: FILE: hw/net/can/ctu_can_fd_regs.h:424:
+               uint32_t erp_limit               : 8;
                                                 ^

ERROR: code indent should never use tabs
#656: FILE: hw/net/can/ctu_can_fd_regs.h:425:
+^I^Iuint32_t ew_limit                : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#656: FILE: hw/net/can/ctu_can_fd_regs.h:425:
+               uint32_t ew_limit                : 8;
                                                 ^

ERROR: code indent should never use tabs
#658: FILE: hw/net/can/ctu_can_fd_regs.h:427:
+^I} s;$

ERROR: code indent should never use tabs
#662: FILE: hw/net/can/ctu_can_fd_regs.h:431:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#663: FILE: hw/net/can/ctu_can_fd_regs.h:432:
+^Istruct ctu_can_fd_rec_tec_s {$

WARNING: architecture specific defines should be avoided
#664: FILE: hw/net/can/ctu_can_fd_regs.h:433:
+#ifdef __LITTLE_ENDIAN_BITFIELD

ERROR: code indent should never use tabs
#666: FILE: hw/net/can/ctu_can_fd_regs.h:435:
+^I^Iuint32_t rec_val                 : 9;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#666: FILE: hw/net/can/ctu_can_fd_regs.h:435:
+               uint32_t rec_val                 : 9;
                                                 ^

ERROR: code indent should never use tabs
#667: FILE: hw/net/can/ctu_can_fd_regs.h:436:
+^I^Iuint32_t reserved_15_9           : 7;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#667: FILE: hw/net/can/ctu_can_fd_regs.h:436:
+               uint32_t reserved_15_9           : 7;
                                                 ^

ERROR: code indent should never use tabs
#669: FILE: hw/net/can/ctu_can_fd_regs.h:438:
+^I^Iuint32_t tec_val                 : 9;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#669: FILE: hw/net/can/ctu_can_fd_regs.h:438:
+               uint32_t tec_val                 : 9;
                                                 ^

ERROR: code indent should never use tabs
#670: FILE: hw/net/can/ctu_can_fd_regs.h:439:
+^I^Iuint32_t reserved_31_25          : 7;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#670: FILE: hw/net/can/ctu_can_fd_regs.h:439:
+               uint32_t reserved_31_25          : 7;
                                                 ^

ERROR: code indent should never use tabs
#672: FILE: hw/net/can/ctu_can_fd_regs.h:441:
+^I^Iuint32_t reserved_31_25          : 7;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#672: FILE: hw/net/can/ctu_can_fd_regs.h:441:
+               uint32_t reserved_31_25          : 7;
                                                 ^

ERROR: code indent should never use tabs
#673: FILE: hw/net/can/ctu_can_fd_regs.h:442:
+^I^Iuint32_t tec_val                 : 9;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#673: FILE: hw/net/can/ctu_can_fd_regs.h:442:
+               uint32_t tec_val                 : 9;
                                                 ^

ERROR: code indent should never use tabs
#674: FILE: hw/net/can/ctu_can_fd_regs.h:443:
+^I^Iuint32_t reserved_15_9           : 7;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#674: FILE: hw/net/can/ctu_can_fd_regs.h:443:
+               uint32_t reserved_15_9           : 7;
                                                 ^

ERROR: code indent should never use tabs
#675: FILE: hw/net/can/ctu_can_fd_regs.h:444:
+^I^Iuint32_t rec_val                 : 9;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#675: FILE: hw/net/can/ctu_can_fd_regs.h:444:
+               uint32_t rec_val                 : 9;
                                                 ^

ERROR: code indent should never use tabs
#677: FILE: hw/net/can/ctu_can_fd_regs.h:446:
+^I} s;$

ERROR: code indent should never use tabs
#681: FILE: hw/net/can/ctu_can_fd_regs.h:450:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#682: FILE: hw/net/can/ctu_can_fd_regs.h:451:
+^Istruct ctu_can_fd_err_norm_err_fd_s {$

WARNING: architecture specific defines should be avoided
#683: FILE: hw/net/can/ctu_can_fd_regs.h:452:
+#ifdef __LITTLE_ENDIAN_BITFIELD

ERROR: code indent should never use tabs
#685: FILE: hw/net/can/ctu_can_fd_regs.h:454:
+^I^Iuint32_t err_norm_val           : 16;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#685: FILE: hw/net/can/ctu_can_fd_regs.h:454:
+               uint32_t err_norm_val           : 16;
                                                ^

ERROR: code indent should never use tabs
#687: FILE: hw/net/can/ctu_can_fd_regs.h:456:
+^I^Iuint32_t err_fd_val             : 16;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#687: FILE: hw/net/can/ctu_can_fd_regs.h:456:
+               uint32_t err_fd_val             : 16;
                                                ^

ERROR: code indent should never use tabs
#689: FILE: hw/net/can/ctu_can_fd_regs.h:458:
+^I^Iuint32_t err_fd_val             : 16;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#689: FILE: hw/net/can/ctu_can_fd_regs.h:458:
+               uint32_t err_fd_val             : 16;
                                                ^

ERROR: code indent should never use tabs
#690: FILE: hw/net/can/ctu_can_fd_regs.h:459:
+^I^Iuint32_t err_norm_val           : 16;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#690: FILE: hw/net/can/ctu_can_fd_regs.h:459:
+               uint32_t err_norm_val           : 16;
                                                ^

ERROR: code indent should never use tabs
#692: FILE: hw/net/can/ctu_can_fd_regs.h:461:
+^I} s;$

ERROR: code indent should never use tabs
#696: FILE: hw/net/can/ctu_can_fd_regs.h:465:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#697: FILE: hw/net/can/ctu_can_fd_regs.h:466:
+^Istruct ctu_can_fd_ctr_pres_s {$

WARNING: architecture specific defines should be avoided
#698: FILE: hw/net/can/ctu_can_fd_regs.h:467:
+#ifdef __LITTLE_ENDIAN_BITFIELD

ERROR: code indent should never use tabs
#700: FILE: hw/net/can/ctu_can_fd_regs.h:469:
+^I^Iuint32_t ctpv                    : 9;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#700: FILE: hw/net/can/ctu_can_fd_regs.h:469:
+               uint32_t ctpv                    : 9;
                                                 ^

ERROR: code indent should never use tabs
#701: FILE: hw/net/can/ctu_can_fd_regs.h:470:
+^I^Iuint32_t ptx                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#701: FILE: hw/net/can/ctu_can_fd_regs.h:470:
+               uint32_t ptx                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#702: FILE: hw/net/can/ctu_can_fd_regs.h:471:
+^I^Iuint32_t prx                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#702: FILE: hw/net/can/ctu_can_fd_regs.h:471:
+               uint32_t prx                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#703: FILE: hw/net/can/ctu_can_fd_regs.h:472:
+^I^Iuint32_t enorm                   : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#703: FILE: hw/net/can/ctu_can_fd_regs.h:472:
+               uint32_t enorm                   : 1;
                                                 ^

ERROR: code indent should never use tabs
#704: FILE: hw/net/can/ctu_can_fd_regs.h:473:
+^I^Iuint32_t efd                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#704: FILE: hw/net/can/ctu_can_fd_regs.h:473:
+               uint32_t efd                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#705: FILE: hw/net/can/ctu_can_fd_regs.h:474:
+^I^Iuint32_t reserved_31_13         : 19;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#705: FILE: hw/net/can/ctu_can_fd_regs.h:474:
+               uint32_t reserved_31_13         : 19;
                                                ^

ERROR: code indent should never use tabs
#707: FILE: hw/net/can/ctu_can_fd_regs.h:476:
+^I^Iuint32_t reserved_31_13         : 19;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#707: FILE: hw/net/can/ctu_can_fd_regs.h:476:
+               uint32_t reserved_31_13         : 19;
                                                ^

ERROR: code indent should never use tabs
#708: FILE: hw/net/can/ctu_can_fd_regs.h:477:
+^I^Iuint32_t efd                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#708: FILE: hw/net/can/ctu_can_fd_regs.h:477:
+               uint32_t efd                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#709: FILE: hw/net/can/ctu_can_fd_regs.h:478:
+^I^Iuint32_t enorm                   : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#709: FILE: hw/net/can/ctu_can_fd_regs.h:478:
+               uint32_t enorm                   : 1;
                                                 ^

ERROR: code indent should never use tabs
#710: FILE: hw/net/can/ctu_can_fd_regs.h:479:
+^I^Iuint32_t prx                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#710: FILE: hw/net/can/ctu_can_fd_regs.h:479:
+               uint32_t prx                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#711: FILE: hw/net/can/ctu_can_fd_regs.h:480:
+^I^Iuint32_t ptx                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#711: FILE: hw/net/can/ctu_can_fd_regs.h:480:
+               uint32_t ptx                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#712: FILE: hw/net/can/ctu_can_fd_regs.h:481:
+^I^Iuint32_t ctpv                    : 9;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#712: FILE: hw/net/can/ctu_can_fd_regs.h:481:
+               uint32_t ctpv                    : 9;
                                                 ^

ERROR: code indent should never use tabs
#714: FILE: hw/net/can/ctu_can_fd_regs.h:483:
+^I} s;$

ERROR: code indent should never use tabs
#718: FILE: hw/net/can/ctu_can_fd_regs.h:487:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#719: FILE: hw/net/can/ctu_can_fd_regs.h:488:
+^Istruct ctu_can_fd_filter_a_mask_s {$

WARNING: architecture specific defines should be avoided
#720: FILE: hw/net/can/ctu_can_fd_regs.h:489:
+#ifdef __LITTLE_ENDIAN_BITFIELD

ERROR: code indent should never use tabs
#722: FILE: hw/net/can/ctu_can_fd_regs.h:491:
+^I^Iuint32_t bit_mask_a_val         : 29;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#722: FILE: hw/net/can/ctu_can_fd_regs.h:491:
+               uint32_t bit_mask_a_val         : 29;
                                                ^

ERROR: code indent should never use tabs
#723: FILE: hw/net/can/ctu_can_fd_regs.h:492:
+^I^Iuint32_t reserved_31_29          : 3;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#723: FILE: hw/net/can/ctu_can_fd_regs.h:492:
+               uint32_t reserved_31_29          : 3;
                                                 ^

ERROR: code indent should never use tabs
#725: FILE: hw/net/can/ctu_can_fd_regs.h:494:
+^I^Iuint32_t reserved_31_29          : 3;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#725: FILE: hw/net/can/ctu_can_fd_regs.h:494:
+               uint32_t reserved_31_29          : 3;
                                                 ^

ERROR: code indent should never use tabs
#726: FILE: hw/net/can/ctu_can_fd_regs.h:495:
+^I^Iuint32_t bit_mask_a_val         : 29;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#726: FILE: hw/net/can/ctu_can_fd_regs.h:495:
+               uint32_t bit_mask_a_val         : 29;
                                                ^

ERROR: code indent should never use tabs
#728: FILE: hw/net/can/ctu_can_fd_regs.h:497:
+^I} s;$

ERROR: code indent should never use tabs
#732: FILE: hw/net/can/ctu_can_fd_regs.h:501:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#733: FILE: hw/net/can/ctu_can_fd_regs.h:502:
+^Istruct ctu_can_fd_filter_a_val_s {$

WARNING: architecture specific defines should be avoided
#734: FILE: hw/net/can/ctu_can_fd_regs.h:503:
+#ifdef __LITTLE_ENDIAN_BITFIELD

ERROR: code indent should never use tabs
#736: FILE: hw/net/can/ctu_can_fd_regs.h:505:
+^I^Iuint32_t bit_val_a_val          : 29;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#736: FILE: hw/net/can/ctu_can_fd_regs.h:505:
+               uint32_t bit_val_a_val          : 29;
                                                ^

ERROR: code indent should never use tabs
#737: FILE: hw/net/can/ctu_can_fd_regs.h:506:
+^I^Iuint32_t reserved_31_29          : 3;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#737: FILE: hw/net/can/ctu_can_fd_regs.h:506:
+               uint32_t reserved_31_29          : 3;
                                                 ^

ERROR: code indent should never use tabs
#739: FILE: hw/net/can/ctu_can_fd_regs.h:508:
+^I^Iuint32_t reserved_31_29          : 3;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#739: FILE: hw/net/can/ctu_can_fd_regs.h:508:
+               uint32_t reserved_31_29          : 3;
                                                 ^

ERROR: code indent should never use tabs
#740: FILE: hw/net/can/ctu_can_fd_regs.h:509:
+^I^Iuint32_t bit_val_a_val          : 29;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#740: FILE: hw/net/can/ctu_can_fd_regs.h:509:
+               uint32_t bit_val_a_val          : 29;
                                                ^

ERROR: code indent should never use tabs
#742: FILE: hw/net/can/ctu_can_fd_regs.h:511:
+^I} s;$

ERROR: code indent should never use tabs
#746: FILE: hw/net/can/ctu_can_fd_regs.h:515:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#747: FILE: hw/net/can/ctu_can_fd_regs.h:516:
+^Istruct ctu_can_fd_filter_b_mask_s {$

WARNING: architecture specific defines should be avoided
#748: FILE: hw/net/can/ctu_can_fd_regs.h:517:
+#ifdef __LITTLE_ENDIAN_BITFIELD

ERROR: code indent should never use tabs
#750: FILE: hw/net/can/ctu_can_fd_regs.h:519:
+^I^Iuint32_t bit_mask_b_val         : 29;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#750: FILE: hw/net/can/ctu_can_fd_regs.h:519:
+               uint32_t bit_mask_b_val         : 29;
                                                ^

ERROR: code indent should never use tabs
#751: FILE: hw/net/can/ctu_can_fd_regs.h:520:
+^I^Iuint32_t reserved_31_29          : 3;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#751: FILE: hw/net/can/ctu_can_fd_regs.h:520:
+               uint32_t reserved_31_29          : 3;
                                                 ^

ERROR: code indent should never use tabs
#753: FILE: hw/net/can/ctu_can_fd_regs.h:522:
+^I^Iuint32_t reserved_31_29          : 3;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#753: FILE: hw/net/can/ctu_can_fd_regs.h:522:
+               uint32_t reserved_31_29          : 3;
                                                 ^

ERROR: code indent should never use tabs
#754: FILE: hw/net/can/ctu_can_fd_regs.h:523:
+^I^Iuint32_t bit_mask_b_val         : 29;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#754: FILE: hw/net/can/ctu_can_fd_regs.h:523:
+               uint32_t bit_mask_b_val         : 29;
                                                ^

ERROR: code indent should never use tabs
#756: FILE: hw/net/can/ctu_can_fd_regs.h:525:
+^I} s;$

ERROR: code indent should never use tabs
#760: FILE: hw/net/can/ctu_can_fd_regs.h:529:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#761: FILE: hw/net/can/ctu_can_fd_regs.h:530:
+^Istruct ctu_can_fd_filter_b_val_s {$

WARNING: architecture specific defines should be avoided
#762: FILE: hw/net/can/ctu_can_fd_regs.h:531:
+#ifdef __LITTLE_ENDIAN_BITFIELD

ERROR: code indent should never use tabs
#764: FILE: hw/net/can/ctu_can_fd_regs.h:533:
+^I^Iuint32_t bit_val_b_val          : 29;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#764: FILE: hw/net/can/ctu_can_fd_regs.h:533:
+               uint32_t bit_val_b_val          : 29;
                                                ^

ERROR: code indent should never use tabs
#765: FILE: hw/net/can/ctu_can_fd_regs.h:534:
+^I^Iuint32_t reserved_31_29          : 3;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#765: FILE: hw/net/can/ctu_can_fd_regs.h:534:
+               uint32_t reserved_31_29          : 3;
                                                 ^

ERROR: code indent should never use tabs
#767: FILE: hw/net/can/ctu_can_fd_regs.h:536:
+^I^Iuint32_t reserved_31_29          : 3;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#767: FILE: hw/net/can/ctu_can_fd_regs.h:536:
+               uint32_t reserved_31_29          : 3;
                                                 ^

ERROR: code indent should never use tabs
#768: FILE: hw/net/can/ctu_can_fd_regs.h:537:
+^I^Iuint32_t bit_val_b_val          : 29;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#768: FILE: hw/net/can/ctu_can_fd_regs.h:537:
+               uint32_t bit_val_b_val          : 29;
                                                ^

ERROR: code indent should never use tabs
#770: FILE: hw/net/can/ctu_can_fd_regs.h:539:
+^I} s;$

ERROR: code indent should never use tabs
#774: FILE: hw/net/can/ctu_can_fd_regs.h:543:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#775: FILE: hw/net/can/ctu_can_fd_regs.h:544:
+^Istruct ctu_can_fd_filter_c_mask_s {$

WARNING: architecture specific defines should be avoided
#776: FILE: hw/net/can/ctu_can_fd_regs.h:545:
+#ifdef __LITTLE_ENDIAN_BITFIELD

ERROR: code indent should never use tabs
#778: FILE: hw/net/can/ctu_can_fd_regs.h:547:
+^I^Iuint32_t bit_mask_c_val         : 29;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#778: FILE: hw/net/can/ctu_can_fd_regs.h:547:
+               uint32_t bit_mask_c_val         : 29;
                                                ^

ERROR: code indent should never use tabs
#779: FILE: hw/net/can/ctu_can_fd_regs.h:548:
+^I^Iuint32_t reserved_31_29          : 3;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#779: FILE: hw/net/can/ctu_can_fd_regs.h:548:
+               uint32_t reserved_31_29          : 3;
                                                 ^

ERROR: code indent should never use tabs
#781: FILE: hw/net/can/ctu_can_fd_regs.h:550:
+^I^Iuint32_t reserved_31_29          : 3;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#781: FILE: hw/net/can/ctu_can_fd_regs.h:550:
+               uint32_t reserved_31_29          : 3;
                                                 ^

ERROR: code indent should never use tabs
#782: FILE: hw/net/can/ctu_can_fd_regs.h:551:
+^I^Iuint32_t bit_mask_c_val         : 29;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#782: FILE: hw/net/can/ctu_can_fd_regs.h:551:
+               uint32_t bit_mask_c_val         : 29;
                                                ^

ERROR: code indent should never use tabs
#784: FILE: hw/net/can/ctu_can_fd_regs.h:553:
+^I} s;$

ERROR: code indent should never use tabs
#788: FILE: hw/net/can/ctu_can_fd_regs.h:557:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#789: FILE: hw/net/can/ctu_can_fd_regs.h:558:
+^Istruct ctu_can_fd_filter_c_val_s {$

WARNING: architecture specific defines should be avoided
#790: FILE: hw/net/can/ctu_can_fd_regs.h:559:
+#ifdef __LITTLE_ENDIAN_BITFIELD

ERROR: code indent should never use tabs
#792: FILE: hw/net/can/ctu_can_fd_regs.h:561:
+^I^Iuint32_t bit_val_c_val          : 29;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#792: FILE: hw/net/can/ctu_can_fd_regs.h:561:
+               uint32_t bit_val_c_val          : 29;
                                                ^

ERROR: code indent should never use tabs
#793: FILE: hw/net/can/ctu_can_fd_regs.h:562:
+^I^Iuint32_t reserved_31_29          : 3;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#793: FILE: hw/net/can/ctu_can_fd_regs.h:562:
+               uint32_t reserved_31_29          : 3;
                                                 ^

ERROR: code indent should never use tabs
#795: FILE: hw/net/can/ctu_can_fd_regs.h:564:
+^I^Iuint32_t reserved_31_29          : 3;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#795: FILE: hw/net/can/ctu_can_fd_regs.h:564:
+               uint32_t reserved_31_29          : 3;
                                                 ^

ERROR: code indent should never use tabs
#796: FILE: hw/net/can/ctu_can_fd_regs.h:565:
+^I^Iuint32_t bit_val_c_val          : 29;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#796: FILE: hw/net/can/ctu_can_fd_regs.h:565:
+               uint32_t bit_val_c_val          : 29;
                                                ^

ERROR: code indent should never use tabs
#798: FILE: hw/net/can/ctu_can_fd_regs.h:567:
+^I} s;$

ERROR: code indent should never use tabs
#802: FILE: hw/net/can/ctu_can_fd_regs.h:571:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#803: FILE: hw/net/can/ctu_can_fd_regs.h:572:
+^Istruct ctu_can_fd_filter_ran_low_s {$

WARNING: architecture specific defines should be avoided
#804: FILE: hw/net/can/ctu_can_fd_regs.h:573:
+#ifdef __LITTLE_ENDIAN_BITFIELD

ERROR: code indent should never use tabs
#806: FILE: hw/net/can/ctu_can_fd_regs.h:575:
+^I^Iuint32_t bit_ran_low_val        : 29;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#806: FILE: hw/net/can/ctu_can_fd_regs.h:575:
+               uint32_t bit_ran_low_val        : 29;
                                                ^

ERROR: code indent should never use tabs
#807: FILE: hw/net/can/ctu_can_fd_regs.h:576:
+^I^Iuint32_t reserved_31_29          : 3;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#807: FILE: hw/net/can/ctu_can_fd_regs.h:576:
+               uint32_t reserved_31_29          : 3;
                                                 ^

ERROR: code indent should never use tabs
#809: FILE: hw/net/can/ctu_can_fd_regs.h:578:
+^I^Iuint32_t reserved_31_29          : 3;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#809: FILE: hw/net/can/ctu_can_fd_regs.h:578:
+               uint32_t reserved_31_29          : 3;
                                                 ^

ERROR: code indent should never use tabs
#810: FILE: hw/net/can/ctu_can_fd_regs.h:579:
+^I^Iuint32_t bit_ran_low_val        : 29;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#810: FILE: hw/net/can/ctu_can_fd_regs.h:579:
+               uint32_t bit_ran_low_val        : 29;
                                                ^

ERROR: code indent should never use tabs
#812: FILE: hw/net/can/ctu_can_fd_regs.h:581:
+^I} s;$

ERROR: code indent should never use tabs
#816: FILE: hw/net/can/ctu_can_fd_regs.h:585:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#817: FILE: hw/net/can/ctu_can_fd_regs.h:586:
+^Istruct ctu_can_fd_filter_ran_high_s {$

WARNING: architecture specific defines should be avoided
#818: FILE: hw/net/can/ctu_can_fd_regs.h:587:
+#ifdef __LITTLE_ENDIAN_BITFIELD

ERROR: code indent should never use tabs
#820: FILE: hw/net/can/ctu_can_fd_regs.h:589:
+^I^Iuint32_t bit_ran_high_val       : 29;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#820: FILE: hw/net/can/ctu_can_fd_regs.h:589:
+               uint32_t bit_ran_high_val       : 29;
                                                ^

ERROR: code indent should never use tabs
#821: FILE: hw/net/can/ctu_can_fd_regs.h:590:
+^I^Iuint32_t reserved_31_29          : 3;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#821: FILE: hw/net/can/ctu_can_fd_regs.h:590:
+               uint32_t reserved_31_29          : 3;
                                                 ^

ERROR: code indent should never use tabs
#823: FILE: hw/net/can/ctu_can_fd_regs.h:592:
+^I^Iuint32_t reserved_31_29          : 3;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#823: FILE: hw/net/can/ctu_can_fd_regs.h:592:
+               uint32_t reserved_31_29          : 3;
                                                 ^

ERROR: code indent should never use tabs
#824: FILE: hw/net/can/ctu_can_fd_regs.h:593:
+^I^Iuint32_t bit_ran_high_val       : 29;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#824: FILE: hw/net/can/ctu_can_fd_regs.h:593:
+               uint32_t bit_ran_high_val       : 29;
                                                ^

ERROR: code indent should never use tabs
#826: FILE: hw/net/can/ctu_can_fd_regs.h:595:
+^I} s;$

ERROR: code indent should never use tabs
#830: FILE: hw/net/can/ctu_can_fd_regs.h:599:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#831: FILE: hw/net/can/ctu_can_fd_regs.h:600:
+^Istruct ctu_can_fd_filter_control_filter_status_s {$

WARNING: architecture specific defines should be avoided
#832: FILE: hw/net/can/ctu_can_fd_regs.h:601:
+#ifdef __LITTLE_ENDIAN_BITFIELD

ERROR: code indent should never use tabs
#834: FILE: hw/net/can/ctu_can_fd_regs.h:603:
+^I^Iuint32_t fanb                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#834: FILE: hw/net/can/ctu_can_fd_regs.h:603:
+               uint32_t fanb                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#835: FILE: hw/net/can/ctu_can_fd_regs.h:604:
+^I^Iuint32_t fane                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#835: FILE: hw/net/can/ctu_can_fd_regs.h:604:
+               uint32_t fane                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#836: FILE: hw/net/can/ctu_can_fd_regs.h:605:
+^I^Iuint32_t fafb                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#836: FILE: hw/net/can/ctu_can_fd_regs.h:605:
+               uint32_t fafb                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#837: FILE: hw/net/can/ctu_can_fd_regs.h:606:
+^I^Iuint32_t fafe                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#837: FILE: hw/net/can/ctu_can_fd_regs.h:606:
+               uint32_t fafe                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#838: FILE: hw/net/can/ctu_can_fd_regs.h:607:
+^I^Iuint32_t fbnb                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#838: FILE: hw/net/can/ctu_can_fd_regs.h:607:
+               uint32_t fbnb                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#839: FILE: hw/net/can/ctu_can_fd_regs.h:608:
+^I^Iuint32_t fbne                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#839: FILE: hw/net/can/ctu_can_fd_regs.h:608:
+               uint32_t fbne                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#840: FILE: hw/net/can/ctu_can_fd_regs.h:609:
+^I^Iuint32_t fbfb                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#840: FILE: hw/net/can/ctu_can_fd_regs.h:609:
+               uint32_t fbfb                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#841: FILE: hw/net/can/ctu_can_fd_regs.h:610:
+^I^Iuint32_t fbfe                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#841: FILE: hw/net/can/ctu_can_fd_regs.h:610:
+               uint32_t fbfe                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#842: FILE: hw/net/can/ctu_can_fd_regs.h:611:
+^I^Iuint32_t fcnb                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#842: FILE: hw/net/can/ctu_can_fd_regs.h:611:
+               uint32_t fcnb                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#843: FILE: hw/net/can/ctu_can_fd_regs.h:612:
+^I^Iuint32_t fcne                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#843: FILE: hw/net/can/ctu_can_fd_regs.h:612:
+               uint32_t fcne                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#844: FILE: hw/net/can/ctu_can_fd_regs.h:613:
+^I^Iuint32_t fcfb                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#844: FILE: hw/net/can/ctu_can_fd_regs.h:613:
+               uint32_t fcfb                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#845: FILE: hw/net/can/ctu_can_fd_regs.h:614:
+^I^Iuint32_t fcfe                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#845: FILE: hw/net/can/ctu_can_fd_regs.h:614:
+               uint32_t fcfe                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#846: FILE: hw/net/can/ctu_can_fd_regs.h:615:
+^I^Iuint32_t frnb                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#846: FILE: hw/net/can/ctu_can_fd_regs.h:615:
+               uint32_t frnb                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#847: FILE: hw/net/can/ctu_can_fd_regs.h:616:
+^I^Iuint32_t frne                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#847: FILE: hw/net/can/ctu_can_fd_regs.h:616:
+               uint32_t frne                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#848: FILE: hw/net/can/ctu_can_fd_regs.h:617:
+^I^Iuint32_t frfb                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#848: FILE: hw/net/can/ctu_can_fd_regs.h:617:
+               uint32_t frfb                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#849: FILE: hw/net/can/ctu_can_fd_regs.h:618:
+^I^Iuint32_t frfe                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#849: FILE: hw/net/can/ctu_can_fd_regs.h:618:
+               uint32_t frfe                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#851: FILE: hw/net/can/ctu_can_fd_regs.h:620:
+^I^Iuint32_t sfa                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#851: FILE: hw/net/can/ctu_can_fd_regs.h:620:
+               uint32_t sfa                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#852: FILE: hw/net/can/ctu_can_fd_regs.h:621:
+^I^Iuint32_t sfb                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#852: FILE: hw/net/can/ctu_can_fd_regs.h:621:
+               uint32_t sfb                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#853: FILE: hw/net/can/ctu_can_fd_regs.h:622:
+^I^Iuint32_t sfc                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#853: FILE: hw/net/can/ctu_can_fd_regs.h:622:
+               uint32_t sfc                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#854: FILE: hw/net/can/ctu_can_fd_regs.h:623:
+^I^Iuint32_t sfr                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#854: FILE: hw/net/can/ctu_can_fd_regs.h:623:
+               uint32_t sfr                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#855: FILE: hw/net/can/ctu_can_fd_regs.h:624:
+^I^Iuint32_t reserved_31_20         : 12;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#855: FILE: hw/net/can/ctu_can_fd_regs.h:624:
+               uint32_t reserved_31_20         : 12;
                                                ^

ERROR: code indent should never use tabs
#857: FILE: hw/net/can/ctu_can_fd_regs.h:626:
+^I^Iuint32_t reserved_31_20         : 12;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#857: FILE: hw/net/can/ctu_can_fd_regs.h:626:
+               uint32_t reserved_31_20         : 12;
                                                ^

ERROR: code indent should never use tabs
#858: FILE: hw/net/can/ctu_can_fd_regs.h:627:
+^I^Iuint32_t sfr                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#858: FILE: hw/net/can/ctu_can_fd_regs.h:627:
+               uint32_t sfr                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#859: FILE: hw/net/can/ctu_can_fd_regs.h:628:
+^I^Iuint32_t sfc                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#859: FILE: hw/net/can/ctu_can_fd_regs.h:628:
+               uint32_t sfc                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#860: FILE: hw/net/can/ctu_can_fd_regs.h:629:
+^I^Iuint32_t sfb                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#860: FILE: hw/net/can/ctu_can_fd_regs.h:629:
+               uint32_t sfb                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#861: FILE: hw/net/can/ctu_can_fd_regs.h:630:
+^I^Iuint32_t sfa                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#861: FILE: hw/net/can/ctu_can_fd_regs.h:630:
+               uint32_t sfa                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#862: FILE: hw/net/can/ctu_can_fd_regs.h:631:
+^I^Iuint32_t frfe                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#862: FILE: hw/net/can/ctu_can_fd_regs.h:631:
+               uint32_t frfe                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#863: FILE: hw/net/can/ctu_can_fd_regs.h:632:
+^I^Iuint32_t frfb                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#863: FILE: hw/net/can/ctu_can_fd_regs.h:632:
+               uint32_t frfb                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#864: FILE: hw/net/can/ctu_can_fd_regs.h:633:
+^I^Iuint32_t frne                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#864: FILE: hw/net/can/ctu_can_fd_regs.h:633:
+               uint32_t frne                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#865: FILE: hw/net/can/ctu_can_fd_regs.h:634:
+^I^Iuint32_t frnb                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#865: FILE: hw/net/can/ctu_can_fd_regs.h:634:
+               uint32_t frnb                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#866: FILE: hw/net/can/ctu_can_fd_regs.h:635:
+^I^Iuint32_t fcfe                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#866: FILE: hw/net/can/ctu_can_fd_regs.h:635:
+               uint32_t fcfe                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#867: FILE: hw/net/can/ctu_can_fd_regs.h:636:
+^I^Iuint32_t fcfb                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#867: FILE: hw/net/can/ctu_can_fd_regs.h:636:
+               uint32_t fcfb                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#868: FILE: hw/net/can/ctu_can_fd_regs.h:637:
+^I^Iuint32_t fcne                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#868: FILE: hw/net/can/ctu_can_fd_regs.h:637:
+               uint32_t fcne                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#869: FILE: hw/net/can/ctu_can_fd_regs.h:638:
+^I^Iuint32_t fcnb                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#869: FILE: hw/net/can/ctu_can_fd_regs.h:638:
+               uint32_t fcnb                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#870: FILE: hw/net/can/ctu_can_fd_regs.h:639:
+^I^Iuint32_t fbfe                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#870: FILE: hw/net/can/ctu_can_fd_regs.h:639:
+               uint32_t fbfe                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#871: FILE: hw/net/can/ctu_can_fd_regs.h:640:
+^I^Iuint32_t fbfb                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#871: FILE: hw/net/can/ctu_can_fd_regs.h:640:
+               uint32_t fbfb                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#872: FILE: hw/net/can/ctu_can_fd_regs.h:641:
+^I^Iuint32_t fbne                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#872: FILE: hw/net/can/ctu_can_fd_regs.h:641:
+               uint32_t fbne                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#873: FILE: hw/net/can/ctu_can_fd_regs.h:642:
+^I^Iuint32_t fbnb                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#873: FILE: hw/net/can/ctu_can_fd_regs.h:642:
+               uint32_t fbnb                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#874: FILE: hw/net/can/ctu_can_fd_regs.h:643:
+^I^Iuint32_t fafe                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#874: FILE: hw/net/can/ctu_can_fd_regs.h:643:
+               uint32_t fafe                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#875: FILE: hw/net/can/ctu_can_fd_regs.h:644:
+^I^Iuint32_t fafb                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#875: FILE: hw/net/can/ctu_can_fd_regs.h:644:
+               uint32_t fafb                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#876: FILE: hw/net/can/ctu_can_fd_regs.h:645:
+^I^Iuint32_t fane                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#876: FILE: hw/net/can/ctu_can_fd_regs.h:645:
+               uint32_t fane                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#877: FILE: hw/net/can/ctu_can_fd_regs.h:646:
+^I^Iuint32_t fanb                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#877: FILE: hw/net/can/ctu_can_fd_regs.h:646:
+               uint32_t fanb                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#879: FILE: hw/net/can/ctu_can_fd_regs.h:648:
+^I} s;$

ERROR: code indent should never use tabs
#883: FILE: hw/net/can/ctu_can_fd_regs.h:652:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#884: FILE: hw/net/can/ctu_can_fd_regs.h:653:
+^Istruct ctu_can_fd_rx_mem_info_s {$

WARNING: architecture specific defines should be avoided
#885: FILE: hw/net/can/ctu_can_fd_regs.h:654:
+#ifdef __LITTLE_ENDIAN_BITFIELD

ERROR: code indent should never use tabs
#887: FILE: hw/net/can/ctu_can_fd_regs.h:656:
+^I^Iuint32_t rx_buff_size           : 13;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#887: FILE: hw/net/can/ctu_can_fd_regs.h:656:
+               uint32_t rx_buff_size           : 13;
                                                ^

ERROR: code indent should never use tabs
#888: FILE: hw/net/can/ctu_can_fd_regs.h:657:
+^I^Iuint32_t reserved_15_13          : 3;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#888: FILE: hw/net/can/ctu_can_fd_regs.h:657:
+               uint32_t reserved_15_13          : 3;
                                                 ^

ERROR: code indent should never use tabs
#889: FILE: hw/net/can/ctu_can_fd_regs.h:658:
+^I^Iuint32_t rx_mem_free            : 13;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#889: FILE: hw/net/can/ctu_can_fd_regs.h:658:
+               uint32_t rx_mem_free            : 13;
                                                ^

ERROR: code indent should never use tabs
#890: FILE: hw/net/can/ctu_can_fd_regs.h:659:
+^I^Iuint32_t reserved_31_29          : 3;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#890: FILE: hw/net/can/ctu_can_fd_regs.h:659:
+               uint32_t reserved_31_29          : 3;
                                                 ^

ERROR: code indent should never use tabs
#892: FILE: hw/net/can/ctu_can_fd_regs.h:661:
+^I^Iuint32_t reserved_31_29          : 3;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#892: FILE: hw/net/can/ctu_can_fd_regs.h:661:
+               uint32_t reserved_31_29          : 3;
                                                 ^

ERROR: code indent should never use tabs
#893: FILE: hw/net/can/ctu_can_fd_regs.h:662:
+^I^Iuint32_t rx_mem_free            : 13;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#893: FILE: hw/net/can/ctu_can_fd_regs.h:662:
+               uint32_t rx_mem_free            : 13;
                                                ^

ERROR: code indent should never use tabs
#894: FILE: hw/net/can/ctu_can_fd_regs.h:663:
+^I^Iuint32_t reserved_15_13          : 3;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#894: FILE: hw/net/can/ctu_can_fd_regs.h:663:
+               uint32_t reserved_15_13          : 3;
                                                 ^

ERROR: code indent should never use tabs
#895: FILE: hw/net/can/ctu_can_fd_regs.h:664:
+^I^Iuint32_t rx_buff_size           : 13;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#895: FILE: hw/net/can/ctu_can_fd_regs.h:664:
+               uint32_t rx_buff_size           : 13;
                                                ^

ERROR: code indent should never use tabs
#897: FILE: hw/net/can/ctu_can_fd_regs.h:666:
+^I} s;$

ERROR: code indent should never use tabs
#901: FILE: hw/net/can/ctu_can_fd_regs.h:670:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#902: FILE: hw/net/can/ctu_can_fd_regs.h:671:
+^Istruct ctu_can_fd_rx_pointers_s {$

WARNING: architecture specific defines should be avoided
#903: FILE: hw/net/can/ctu_can_fd_regs.h:672:
+#ifdef __LITTLE_ENDIAN_BITFIELD

ERROR: code indent should never use tabs
#905: FILE: hw/net/can/ctu_can_fd_regs.h:674:
+^I^Iuint32_t rx_wpp                 : 12;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#905: FILE: hw/net/can/ctu_can_fd_regs.h:674:
+               uint32_t rx_wpp                 : 12;
                                                ^

ERROR: code indent should never use tabs
#906: FILE: hw/net/can/ctu_can_fd_regs.h:675:
+^I^Iuint32_t reserved_15_12          : 4;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#906: FILE: hw/net/can/ctu_can_fd_regs.h:675:
+               uint32_t reserved_15_12          : 4;
                                                 ^

ERROR: code indent should never use tabs
#907: FILE: hw/net/can/ctu_can_fd_regs.h:676:
+^I^Iuint32_t rx_rpp                 : 12;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#907: FILE: hw/net/can/ctu_can_fd_regs.h:676:
+               uint32_t rx_rpp                 : 12;
                                                ^

ERROR: code indent should never use tabs
#908: FILE: hw/net/can/ctu_can_fd_regs.h:677:
+^I^Iuint32_t reserved_31_28          : 4;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#908: FILE: hw/net/can/ctu_can_fd_regs.h:677:
+               uint32_t reserved_31_28          : 4;
                                                 ^

ERROR: code indent should never use tabs
#910: FILE: hw/net/can/ctu_can_fd_regs.h:679:
+^I^Iuint32_t reserved_31_28          : 4;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#910: FILE: hw/net/can/ctu_can_fd_regs.h:679:
+               uint32_t reserved_31_28          : 4;
                                                 ^

ERROR: code indent should never use tabs
#911: FILE: hw/net/can/ctu_can_fd_regs.h:680:
+^I^Iuint32_t rx_rpp                 : 12;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#911: FILE: hw/net/can/ctu_can_fd_regs.h:680:
+               uint32_t rx_rpp                 : 12;
                                                ^

ERROR: code indent should never use tabs
#912: FILE: hw/net/can/ctu_can_fd_regs.h:681:
+^I^Iuint32_t reserved_15_12          : 4;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#912: FILE: hw/net/can/ctu_can_fd_regs.h:681:
+               uint32_t reserved_15_12          : 4;
                                                 ^

ERROR: code indent should never use tabs
#913: FILE: hw/net/can/ctu_can_fd_regs.h:682:
+^I^Iuint32_t rx_wpp                 : 12;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#913: FILE: hw/net/can/ctu_can_fd_regs.h:682:
+               uint32_t rx_wpp                 : 12;
                                                ^

ERROR: code indent should never use tabs
#915: FILE: hw/net/can/ctu_can_fd_regs.h:684:
+^I} s;$

ERROR: code indent should never use tabs
#919: FILE: hw/net/can/ctu_can_fd_regs.h:688:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#920: FILE: hw/net/can/ctu_can_fd_regs.h:689:
+^Istruct ctu_can_fd_rx_status_rx_settings_s {$

WARNING: architecture specific defines should be avoided
#921: FILE: hw/net/can/ctu_can_fd_regs.h:690:
+#ifdef __LITTLE_ENDIAN_BITFIELD

ERROR: code indent should never use tabs
#923: FILE: hw/net/can/ctu_can_fd_regs.h:692:
+^I^Iuint32_t rxe                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#923: FILE: hw/net/can/ctu_can_fd_regs.h:692:
+               uint32_t rxe                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#924: FILE: hw/net/can/ctu_can_fd_regs.h:693:
+^I^Iuint32_t rxf                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#924: FILE: hw/net/can/ctu_can_fd_regs.h:693:
+               uint32_t rxf                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#925: FILE: hw/net/can/ctu_can_fd_regs.h:694:
+^I^Iuint32_t reserved_3_2            : 2;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#925: FILE: hw/net/can/ctu_can_fd_regs.h:694:
+               uint32_t reserved_3_2            : 2;
                                                 ^

ERROR: code indent should never use tabs
#926: FILE: hw/net/can/ctu_can_fd_regs.h:695:
+^I^Iuint32_t rxfrc                  : 11;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#926: FILE: hw/net/can/ctu_can_fd_regs.h:695:
+               uint32_t rxfrc                  : 11;
                                                ^

ERROR: code indent should never use tabs
#927: FILE: hw/net/can/ctu_can_fd_regs.h:696:
+^I^Iuint32_t reserved_15             : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#927: FILE: hw/net/can/ctu_can_fd_regs.h:696:
+               uint32_t reserved_15             : 1;
                                                 ^

ERROR: code indent should never use tabs
#929: FILE: hw/net/can/ctu_can_fd_regs.h:698:
+^I^Iuint32_t rtsop                   : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#929: FILE: hw/net/can/ctu_can_fd_regs.h:698:
+               uint32_t rtsop                   : 1;
                                                 ^

ERROR: code indent should never use tabs
#930: FILE: hw/net/can/ctu_can_fd_regs.h:699:
+^I^Iuint32_t reserved_31_17         : 15;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#930: FILE: hw/net/can/ctu_can_fd_regs.h:699:
+               uint32_t reserved_31_17         : 15;
                                                ^

ERROR: code indent should never use tabs
#932: FILE: hw/net/can/ctu_can_fd_regs.h:701:
+^I^Iuint32_t reserved_31_17         : 15;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#932: FILE: hw/net/can/ctu_can_fd_regs.h:701:
+               uint32_t reserved_31_17         : 15;
                                                ^

ERROR: code indent should never use tabs
#933: FILE: hw/net/can/ctu_can_fd_regs.h:702:
+^I^Iuint32_t rtsop                   : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#933: FILE: hw/net/can/ctu_can_fd_regs.h:702:
+               uint32_t rtsop                   : 1;
                                                 ^

ERROR: code indent should never use tabs
#934: FILE: hw/net/can/ctu_can_fd_regs.h:703:
+^I^Iuint32_t reserved_15             : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#934: FILE: hw/net/can/ctu_can_fd_regs.h:703:
+               uint32_t reserved_15             : 1;
                                                 ^

ERROR: code indent should never use tabs
#935: FILE: hw/net/can/ctu_can_fd_regs.h:704:
+^I^Iuint32_t rxfrc                  : 11;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#935: FILE: hw/net/can/ctu_can_fd_regs.h:704:
+               uint32_t rxfrc                  : 11;
                                                ^

ERROR: code indent should never use tabs
#936: FILE: hw/net/can/ctu_can_fd_regs.h:705:
+^I^Iuint32_t reserved_3_2            : 2;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#936: FILE: hw/net/can/ctu_can_fd_regs.h:705:
+               uint32_t reserved_3_2            : 2;
                                                 ^

ERROR: code indent should never use tabs
#937: FILE: hw/net/can/ctu_can_fd_regs.h:706:
+^I^Iuint32_t rxf                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#937: FILE: hw/net/can/ctu_can_fd_regs.h:706:
+               uint32_t rxf                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#938: FILE: hw/net/can/ctu_can_fd_regs.h:707:
+^I^Iuint32_t rxe                     : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#938: FILE: hw/net/can/ctu_can_fd_regs.h:707:
+               uint32_t rxe                     : 1;
                                                 ^

ERROR: code indent should never use tabs
#940: FILE: hw/net/can/ctu_can_fd_regs.h:709:
+^I} s;$

ERROR: code indent should never use tabs
#944: FILE: hw/net/can/ctu_can_fd_regs.h:713:
+^IRTS_END       = 0x0,$

ERROR: code indent should never use tabs
#945: FILE: hw/net/can/ctu_can_fd_regs.h:714:
+^IRTS_BEG       = 0x1,$

ERROR: code indent should never use tabs
#949: FILE: hw/net/can/ctu_can_fd_regs.h:718:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#950: FILE: hw/net/can/ctu_can_fd_regs.h:719:
+^Istruct ctu_can_fd_rx_data_s {$

ERROR: code indent should never use tabs
#952: FILE: hw/net/can/ctu_can_fd_regs.h:721:
+^I^Iuint32_t rx_data                : 32;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#952: FILE: hw/net/can/ctu_can_fd_regs.h:721:
+               uint32_t rx_data                : 32;
                                                ^

ERROR: code indent should never use tabs
#953: FILE: hw/net/can/ctu_can_fd_regs.h:722:
+^I} s;$

ERROR: code indent should never use tabs
#957: FILE: hw/net/can/ctu_can_fd_regs.h:726:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#958: FILE: hw/net/can/ctu_can_fd_regs.h:727:
+^Istruct ctu_can_fd_tx_status_s {$

WARNING: architecture specific defines should be avoided
#959: FILE: hw/net/can/ctu_can_fd_regs.h:728:
+#ifdef __LITTLE_ENDIAN_BITFIELD

ERROR: code indent should never use tabs
#961: FILE: hw/net/can/ctu_can_fd_regs.h:730:
+^I^Iuint32_t tx1s                    : 4;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#961: FILE: hw/net/can/ctu_can_fd_regs.h:730:
+               uint32_t tx1s                    : 4;
                                                 ^

ERROR: code indent should never use tabs
#962: FILE: hw/net/can/ctu_can_fd_regs.h:731:
+^I^Iuint32_t tx2s                    : 4;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#962: FILE: hw/net/can/ctu_can_fd_regs.h:731:
+               uint32_t tx2s                    : 4;
                                                 ^

ERROR: code indent should never use tabs
#963: FILE: hw/net/can/ctu_can_fd_regs.h:732:
+^I^Iuint32_t tx3s                    : 4;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#963: FILE: hw/net/can/ctu_can_fd_regs.h:732:
+               uint32_t tx3s                    : 4;
                                                 ^

ERROR: code indent should never use tabs
#964: FILE: hw/net/can/ctu_can_fd_regs.h:733:
+^I^Iuint32_t tx4s                    : 4;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#964: FILE: hw/net/can/ctu_can_fd_regs.h:733:
+               uint32_t tx4s                    : 4;
                                                 ^

ERROR: code indent should never use tabs
#965: FILE: hw/net/can/ctu_can_fd_regs.h:734:
+^I^Iuint32_t reserved_31_16         : 16;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#965: FILE: hw/net/can/ctu_can_fd_regs.h:734:
+               uint32_t reserved_31_16         : 16;
                                                ^

ERROR: code indent should never use tabs
#967: FILE: hw/net/can/ctu_can_fd_regs.h:736:
+^I^Iuint32_t reserved_31_16         : 16;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#967: FILE: hw/net/can/ctu_can_fd_regs.h:736:
+               uint32_t reserved_31_16         : 16;
                                                ^

ERROR: code indent should never use tabs
#968: FILE: hw/net/can/ctu_can_fd_regs.h:737:
+^I^Iuint32_t tx4s                    : 4;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#968: FILE: hw/net/can/ctu_can_fd_regs.h:737:
+               uint32_t tx4s                    : 4;
                                                 ^

ERROR: code indent should never use tabs
#969: FILE: hw/net/can/ctu_can_fd_regs.h:738:
+^I^Iuint32_t tx3s                    : 4;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#969: FILE: hw/net/can/ctu_can_fd_regs.h:738:
+               uint32_t tx3s                    : 4;
                                                 ^

ERROR: code indent should never use tabs
#970: FILE: hw/net/can/ctu_can_fd_regs.h:739:
+^I^Iuint32_t tx2s                    : 4;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#970: FILE: hw/net/can/ctu_can_fd_regs.h:739:
+               uint32_t tx2s                    : 4;
                                                 ^

ERROR: code indent should never use tabs
#971: FILE: hw/net/can/ctu_can_fd_regs.h:740:
+^I^Iuint32_t tx1s                    : 4;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#971: FILE: hw/net/can/ctu_can_fd_regs.h:740:
+               uint32_t tx1s                    : 4;
                                                 ^

ERROR: code indent should never use tabs
#973: FILE: hw/net/can/ctu_can_fd_regs.h:742:
+^I} s;$

ERROR: code indent should never use tabs
#977: FILE: hw/net/can/ctu_can_fd_regs.h:746:
+^ITXT_RDY        = 0x1,$

ERROR: code indent should never use tabs
#978: FILE: hw/net/can/ctu_can_fd_regs.h:747:
+^ITXT_TRAN       = 0x2,$

ERROR: code indent should never use tabs
#979: FILE: hw/net/can/ctu_can_fd_regs.h:748:
+^ITXT_ABTP       = 0x3,$

ERROR: code indent should never use tabs
#980: FILE: hw/net/can/ctu_can_fd_regs.h:749:
+^ITXT_TOK        = 0x4,$

ERROR: code indent should never use tabs
#981: FILE: hw/net/can/ctu_can_fd_regs.h:750:
+^ITXT_ERR        = 0x6,$

ERROR: code indent should never use tabs
#982: FILE: hw/net/can/ctu_can_fd_regs.h:751:
+^ITXT_ABT        = 0x7,$

ERROR: code indent should never use tabs
#983: FILE: hw/net/can/ctu_can_fd_regs.h:752:
+^ITXT_ETY        = 0x8,$

ERROR: code indent should never use tabs
#987: FILE: hw/net/can/ctu_can_fd_regs.h:756:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#988: FILE: hw/net/can/ctu_can_fd_regs.h:757:
+^Istruct ctu_can_fd_tx_command_s {$

WARNING: architecture specific defines should be avoided
#989: FILE: hw/net/can/ctu_can_fd_regs.h:758:
+#ifdef __LITTLE_ENDIAN_BITFIELD

ERROR: code indent should never use tabs
#991: FILE: hw/net/can/ctu_can_fd_regs.h:760:
+^I^Iuint32_t txce                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#991: FILE: hw/net/can/ctu_can_fd_regs.h:760:
+               uint32_t txce                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#992: FILE: hw/net/can/ctu_can_fd_regs.h:761:
+^I^Iuint32_t txcr                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#992: FILE: hw/net/can/ctu_can_fd_regs.h:761:
+               uint32_t txcr                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#993: FILE: hw/net/can/ctu_can_fd_regs.h:762:
+^I^Iuint32_t txca                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#993: FILE: hw/net/can/ctu_can_fd_regs.h:762:
+               uint32_t txca                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#994: FILE: hw/net/can/ctu_can_fd_regs.h:763:
+^I^Iuint32_t reserved_7_3            : 5;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#994: FILE: hw/net/can/ctu_can_fd_regs.h:763:
+               uint32_t reserved_7_3            : 5;
                                                 ^

ERROR: code indent should never use tabs
#995: FILE: hw/net/can/ctu_can_fd_regs.h:764:
+^I^Iuint32_t txb1                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#995: FILE: hw/net/can/ctu_can_fd_regs.h:764:
+               uint32_t txb1                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#996: FILE: hw/net/can/ctu_can_fd_regs.h:765:
+^I^Iuint32_t txb2                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#996: FILE: hw/net/can/ctu_can_fd_regs.h:765:
+               uint32_t txb2                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#997: FILE: hw/net/can/ctu_can_fd_regs.h:766:
+^I^Iuint32_t txb3                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#997: FILE: hw/net/can/ctu_can_fd_regs.h:766:
+               uint32_t txb3                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#998: FILE: hw/net/can/ctu_can_fd_regs.h:767:
+^I^Iuint32_t txb4                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#998: FILE: hw/net/can/ctu_can_fd_regs.h:767:
+               uint32_t txb4                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#999: FILE: hw/net/can/ctu_can_fd_regs.h:768:
+^I^Iuint32_t reserved_31_12         : 20;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#999: FILE: hw/net/can/ctu_can_fd_regs.h:768:
+               uint32_t reserved_31_12         : 20;
                                                ^

ERROR: code indent should never use tabs
#1001: FILE: hw/net/can/ctu_can_fd_regs.h:770:
+^I^Iuint32_t reserved_31_12         : 20;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1001: FILE: hw/net/can/ctu_can_fd_regs.h:770:
+               uint32_t reserved_31_12         : 20;
                                                ^

ERROR: code indent should never use tabs
#1002: FILE: hw/net/can/ctu_can_fd_regs.h:771:
+^I^Iuint32_t txb4                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1002: FILE: hw/net/can/ctu_can_fd_regs.h:771:
+               uint32_t txb4                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#1003: FILE: hw/net/can/ctu_can_fd_regs.h:772:
+^I^Iuint32_t txb3                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1003: FILE: hw/net/can/ctu_can_fd_regs.h:772:
+               uint32_t txb3                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#1004: FILE: hw/net/can/ctu_can_fd_regs.h:773:
+^I^Iuint32_t txb2                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1004: FILE: hw/net/can/ctu_can_fd_regs.h:773:
+               uint32_t txb2                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#1005: FILE: hw/net/can/ctu_can_fd_regs.h:774:
+^I^Iuint32_t txb1                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1005: FILE: hw/net/can/ctu_can_fd_regs.h:774:
+               uint32_t txb1                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#1006: FILE: hw/net/can/ctu_can_fd_regs.h:775:
+^I^Iuint32_t reserved_7_3            : 5;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1006: FILE: hw/net/can/ctu_can_fd_regs.h:775:
+               uint32_t reserved_7_3            : 5;
                                                 ^

ERROR: code indent should never use tabs
#1007: FILE: hw/net/can/ctu_can_fd_regs.h:776:
+^I^Iuint32_t txca                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1007: FILE: hw/net/can/ctu_can_fd_regs.h:776:
+               uint32_t txca                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#1008: FILE: hw/net/can/ctu_can_fd_regs.h:777:
+^I^Iuint32_t txcr                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1008: FILE: hw/net/can/ctu_can_fd_regs.h:777:
+               uint32_t txcr                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#1009: FILE: hw/net/can/ctu_can_fd_regs.h:778:
+^I^Iuint32_t txce                    : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1009: FILE: hw/net/can/ctu_can_fd_regs.h:778:
+               uint32_t txce                    : 1;
                                                 ^

ERROR: code indent should never use tabs
#1011: FILE: hw/net/can/ctu_can_fd_regs.h:780:
+^I} s;$

ERROR: code indent should never use tabs
#1015: FILE: hw/net/can/ctu_can_fd_regs.h:784:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#1016: FILE: hw/net/can/ctu_can_fd_regs.h:785:
+^Istruct ctu_can_fd_tx_priority_s {$

WARNING: architecture specific defines should be avoided
#1017: FILE: hw/net/can/ctu_can_fd_regs.h:786:
+#ifdef __LITTLE_ENDIAN_BITFIELD

ERROR: code indent should never use tabs
#1019: FILE: hw/net/can/ctu_can_fd_regs.h:788:
+^I^Iuint32_t txt1p                   : 3;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1019: FILE: hw/net/can/ctu_can_fd_regs.h:788:
+               uint32_t txt1p                   : 3;
                                                 ^

ERROR: code indent should never use tabs
#1020: FILE: hw/net/can/ctu_can_fd_regs.h:789:
+^I^Iuint32_t reserved_3              : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1020: FILE: hw/net/can/ctu_can_fd_regs.h:789:
+               uint32_t reserved_3              : 1;
                                                 ^

ERROR: code indent should never use tabs
#1021: FILE: hw/net/can/ctu_can_fd_regs.h:790:
+^I^Iuint32_t txt2p                   : 3;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1021: FILE: hw/net/can/ctu_can_fd_regs.h:790:
+               uint32_t txt2p                   : 3;
                                                 ^

ERROR: code indent should never use tabs
#1022: FILE: hw/net/can/ctu_can_fd_regs.h:791:
+^I^Iuint32_t reserved_7              : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1022: FILE: hw/net/can/ctu_can_fd_regs.h:791:
+               uint32_t reserved_7              : 1;
                                                 ^

ERROR: code indent should never use tabs
#1023: FILE: hw/net/can/ctu_can_fd_regs.h:792:
+^I^Iuint32_t txt3p                   : 3;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1023: FILE: hw/net/can/ctu_can_fd_regs.h:792:
+               uint32_t txt3p                   : 3;
                                                 ^

ERROR: code indent should never use tabs
#1024: FILE: hw/net/can/ctu_can_fd_regs.h:793:
+^I^Iuint32_t reserved_11             : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1024: FILE: hw/net/can/ctu_can_fd_regs.h:793:
+               uint32_t reserved_11             : 1;
                                                 ^

ERROR: code indent should never use tabs
#1025: FILE: hw/net/can/ctu_can_fd_regs.h:794:
+^I^Iuint32_t txt4p                   : 3;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1025: FILE: hw/net/can/ctu_can_fd_regs.h:794:
+               uint32_t txt4p                   : 3;
                                                 ^

ERROR: code indent should never use tabs
#1026: FILE: hw/net/can/ctu_can_fd_regs.h:795:
+^I^Iuint32_t reserved_31_15         : 17;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1026: FILE: hw/net/can/ctu_can_fd_regs.h:795:
+               uint32_t reserved_31_15         : 17;
                                                ^

ERROR: code indent should never use tabs
#1028: FILE: hw/net/can/ctu_can_fd_regs.h:797:
+^I^Iuint32_t reserved_31_15         : 17;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1028: FILE: hw/net/can/ctu_can_fd_regs.h:797:
+               uint32_t reserved_31_15         : 17;
                                                ^

ERROR: code indent should never use tabs
#1029: FILE: hw/net/can/ctu_can_fd_regs.h:798:
+^I^Iuint32_t txt4p                   : 3;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1029: FILE: hw/net/can/ctu_can_fd_regs.h:798:
+               uint32_t txt4p                   : 3;
                                                 ^

ERROR: code indent should never use tabs
#1030: FILE: hw/net/can/ctu_can_fd_regs.h:799:
+^I^Iuint32_t reserved_11             : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1030: FILE: hw/net/can/ctu_can_fd_regs.h:799:
+               uint32_t reserved_11             : 1;
                                                 ^

ERROR: code indent should never use tabs
#1031: FILE: hw/net/can/ctu_can_fd_regs.h:800:
+^I^Iuint32_t txt3p                   : 3;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1031: FILE: hw/net/can/ctu_can_fd_regs.h:800:
+               uint32_t txt3p                   : 3;
                                                 ^

ERROR: code indent should never use tabs
#1032: FILE: hw/net/can/ctu_can_fd_regs.h:801:
+^I^Iuint32_t reserved_7              : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1032: FILE: hw/net/can/ctu_can_fd_regs.h:801:
+               uint32_t reserved_7              : 1;
                                                 ^

ERROR: code indent should never use tabs
#1033: FILE: hw/net/can/ctu_can_fd_regs.h:802:
+^I^Iuint32_t txt2p                   : 3;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1033: FILE: hw/net/can/ctu_can_fd_regs.h:802:
+               uint32_t txt2p                   : 3;
                                                 ^

ERROR: code indent should never use tabs
#1034: FILE: hw/net/can/ctu_can_fd_regs.h:803:
+^I^Iuint32_t reserved_3              : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1034: FILE: hw/net/can/ctu_can_fd_regs.h:803:
+               uint32_t reserved_3              : 1;
                                                 ^

ERROR: code indent should never use tabs
#1035: FILE: hw/net/can/ctu_can_fd_regs.h:804:
+^I^Iuint32_t txt1p                   : 3;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1035: FILE: hw/net/can/ctu_can_fd_regs.h:804:
+               uint32_t txt1p                   : 3;
                                                 ^

ERROR: code indent should never use tabs
#1037: FILE: hw/net/can/ctu_can_fd_regs.h:806:
+^I} s;$

ERROR: code indent should never use tabs
#1041: FILE: hw/net/can/ctu_can_fd_regs.h:810:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#1042: FILE: hw/net/can/ctu_can_fd_regs.h:811:
+^Istruct ctu_can_fd_err_capt_alc_s {$

WARNING: architecture specific defines should be avoided
#1043: FILE: hw/net/can/ctu_can_fd_regs.h:812:
+#ifdef __LITTLE_ENDIAN_BITFIELD

ERROR: code indent should never use tabs
#1045: FILE: hw/net/can/ctu_can_fd_regs.h:814:
+^I^Iuint32_t err_pos                 : 5;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1045: FILE: hw/net/can/ctu_can_fd_regs.h:814:
+               uint32_t err_pos                 : 5;
                                                 ^

ERROR: code indent should never use tabs
#1046: FILE: hw/net/can/ctu_can_fd_regs.h:815:
+^I^Iuint32_t err_type                : 3;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1046: FILE: hw/net/can/ctu_can_fd_regs.h:815:
+               uint32_t err_type                : 3;
                                                 ^

ERROR: code indent should never use tabs
#1047: FILE: hw/net/can/ctu_can_fd_regs.h:816:
+^I^Iuint32_t reserved_15_8           : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1047: FILE: hw/net/can/ctu_can_fd_regs.h:816:
+               uint32_t reserved_15_8           : 8;
                                                 ^

ERROR: code indent should never use tabs
#1049: FILE: hw/net/can/ctu_can_fd_regs.h:818:
+^I^Iuint32_t alc_bit                 : 5;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1049: FILE: hw/net/can/ctu_can_fd_regs.h:818:
+               uint32_t alc_bit                 : 5;
                                                 ^

ERROR: code indent should never use tabs
#1050: FILE: hw/net/can/ctu_can_fd_regs.h:819:
+^I^Iuint32_t alc_id_field            : 3;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1050: FILE: hw/net/can/ctu_can_fd_regs.h:819:
+               uint32_t alc_id_field            : 3;
                                                 ^

ERROR: code indent should never use tabs
#1051: FILE: hw/net/can/ctu_can_fd_regs.h:820:
+^I^Iuint32_t reserved_31_24          : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1051: FILE: hw/net/can/ctu_can_fd_regs.h:820:
+               uint32_t reserved_31_24          : 8;
                                                 ^

ERROR: code indent should never use tabs
#1053: FILE: hw/net/can/ctu_can_fd_regs.h:822:
+^I^Iuint32_t reserved_31_24          : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1053: FILE: hw/net/can/ctu_can_fd_regs.h:822:
+               uint32_t reserved_31_24          : 8;
                                                 ^

ERROR: code indent should never use tabs
#1054: FILE: hw/net/can/ctu_can_fd_regs.h:823:
+^I^Iuint32_t alc_id_field            : 3;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1054: FILE: hw/net/can/ctu_can_fd_regs.h:823:
+               uint32_t alc_id_field            : 3;
                                                 ^

ERROR: code indent should never use tabs
#1055: FILE: hw/net/can/ctu_can_fd_regs.h:824:
+^I^Iuint32_t alc_bit                 : 5;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1055: FILE: hw/net/can/ctu_can_fd_regs.h:824:
+               uint32_t alc_bit                 : 5;
                                                 ^

ERROR: code indent should never use tabs
#1056: FILE: hw/net/can/ctu_can_fd_regs.h:825:
+^I^Iuint32_t reserved_15_8           : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1056: FILE: hw/net/can/ctu_can_fd_regs.h:825:
+               uint32_t reserved_15_8           : 8;
                                                 ^

ERROR: code indent should never use tabs
#1057: FILE: hw/net/can/ctu_can_fd_regs.h:826:
+^I^Iuint32_t err_type                : 3;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1057: FILE: hw/net/can/ctu_can_fd_regs.h:826:
+               uint32_t err_type                : 3;
                                                 ^

ERROR: code indent should never use tabs
#1058: FILE: hw/net/can/ctu_can_fd_regs.h:827:
+^I^Iuint32_t err_pos                 : 5;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1058: FILE: hw/net/can/ctu_can_fd_regs.h:827:
+               uint32_t err_pos                 : 5;
                                                 ^

ERROR: code indent should never use tabs
#1060: FILE: hw/net/can/ctu_can_fd_regs.h:829:
+^I} s;$

ERROR: code indent should never use tabs
#1064: FILE: hw/net/can/ctu_can_fd_regs.h:833:
+^IERC_POS_SOF         = 0x0,$

ERROR: code indent should never use tabs
#1065: FILE: hw/net/can/ctu_can_fd_regs.h:834:
+^IERC_POS_ARB         = 0x1,$

ERROR: code indent should never use tabs
#1066: FILE: hw/net/can/ctu_can_fd_regs.h:835:
+^IERC_POS_CTRL        = 0x2,$

ERROR: code indent should never use tabs
#1067: FILE: hw/net/can/ctu_can_fd_regs.h:836:
+^IERC_POS_DATA        = 0x3,$

ERROR: code indent should never use tabs
#1068: FILE: hw/net/can/ctu_can_fd_regs.h:837:
+^IERC_POS_CRC         = 0x4,$

ERROR: code indent should never use tabs
#1069: FILE: hw/net/can/ctu_can_fd_regs.h:838:
+^IERC_POS_ACK         = 0x5,$

ERROR: code indent should never use tabs
#1070: FILE: hw/net/can/ctu_can_fd_regs.h:839:
+^IERC_POS_EOF         = 0x6,$

ERROR: code indent should never use tabs
#1071: FILE: hw/net/can/ctu_can_fd_regs.h:840:
+^IERC_POS_ERR         = 0x7,$

ERROR: code indent should never use tabs
#1072: FILE: hw/net/can/ctu_can_fd_regs.h:841:
+^IERC_POS_OVRL        = 0x8,$

ERROR: code indent should never use tabs
#1073: FILE: hw/net/can/ctu_can_fd_regs.h:842:
+^IERC_POS_OTHER      = 0x1f,$

ERROR: code indent should never use tabs
#1077: FILE: hw/net/can/ctu_can_fd_regs.h:846:
+^IERC_BIT_ERR        = 0x0,$

ERROR: code indent should never use tabs
#1078: FILE: hw/net/can/ctu_can_fd_regs.h:847:
+^IERC_CRC_ERR        = 0x1,$

ERROR: code indent should never use tabs
#1079: FILE: hw/net/can/ctu_can_fd_regs.h:848:
+^IERC_FRM_ERR        = 0x2,$

ERROR: code indent should never use tabs
#1080: FILE: hw/net/can/ctu_can_fd_regs.h:849:
+^IERC_ACK_ERR        = 0x3,$

ERROR: code indent should never use tabs
#1081: FILE: hw/net/can/ctu_can_fd_regs.h:850:
+^IERC_STUF_ERR       = 0x4,$

ERROR: code indent should never use tabs
#1085: FILE: hw/net/can/ctu_can_fd_regs.h:854:
+^IALC_RSVD            = 0x0,$

ERROR: code indent should never use tabs
#1086: FILE: hw/net/can/ctu_can_fd_regs.h:855:
+^IALC_BASE_ID         = 0x1,$

ERROR: code indent should never use tabs
#1087: FILE: hw/net/can/ctu_can_fd_regs.h:856:
+^IALC_SRR_RTR         = 0x2,$

ERROR: code indent should never use tabs
#1088: FILE: hw/net/can/ctu_can_fd_regs.h:857:
+^IALC_IDE             = 0x3,$

ERROR: code indent should never use tabs
#1089: FILE: hw/net/can/ctu_can_fd_regs.h:858:
+^IALC_EXTENSION       = 0x4,$

ERROR: code indent should never use tabs
#1090: FILE: hw/net/can/ctu_can_fd_regs.h:859:
+^IALC_RTR             = 0x5,$

ERROR: code indent should never use tabs
#1094: FILE: hw/net/can/ctu_can_fd_regs.h:863:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#1095: FILE: hw/net/can/ctu_can_fd_regs.h:864:
+^Istruct ctu_can_fd_trv_delay_ssp_cfg_s {$

WARNING: architecture specific defines should be avoided
#1096: FILE: hw/net/can/ctu_can_fd_regs.h:865:
+#ifdef __LITTLE_ENDIAN_BITFIELD

ERROR: code indent should never use tabs
#1098: FILE: hw/net/can/ctu_can_fd_regs.h:867:
+^I^Iuint32_t trv_delay_value         : 7;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1098: FILE: hw/net/can/ctu_can_fd_regs.h:867:
+               uint32_t trv_delay_value         : 7;
                                                 ^

ERROR: code indent should never use tabs
#1099: FILE: hw/net/can/ctu_can_fd_regs.h:868:
+^I^Iuint32_t reserved_15_7           : 9;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1099: FILE: hw/net/can/ctu_can_fd_regs.h:868:
+               uint32_t reserved_15_7           : 9;
                                                 ^

ERROR: code indent should never use tabs
#1101: FILE: hw/net/can/ctu_can_fd_regs.h:870:
+^I^Iuint32_t ssp_offset              : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1101: FILE: hw/net/can/ctu_can_fd_regs.h:870:
+               uint32_t ssp_offset              : 8;
                                                 ^

ERROR: code indent should never use tabs
#1102: FILE: hw/net/can/ctu_can_fd_regs.h:871:
+^I^Iuint32_t ssp_src                 : 2;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1102: FILE: hw/net/can/ctu_can_fd_regs.h:871:
+               uint32_t ssp_src                 : 2;
                                                 ^

ERROR: code indent should never use tabs
#1103: FILE: hw/net/can/ctu_can_fd_regs.h:872:
+^I^Iuint32_t reserved_31_26          : 6;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1103: FILE: hw/net/can/ctu_can_fd_regs.h:872:
+               uint32_t reserved_31_26          : 6;
                                                 ^

ERROR: code indent should never use tabs
#1105: FILE: hw/net/can/ctu_can_fd_regs.h:874:
+^I^Iuint32_t reserved_31_26          : 6;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1105: FILE: hw/net/can/ctu_can_fd_regs.h:874:
+               uint32_t reserved_31_26          : 6;
                                                 ^

ERROR: code indent should never use tabs
#1106: FILE: hw/net/can/ctu_can_fd_regs.h:875:
+^I^Iuint32_t ssp_src                 : 2;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1106: FILE: hw/net/can/ctu_can_fd_regs.h:875:
+               uint32_t ssp_src                 : 2;
                                                 ^

ERROR: code indent should never use tabs
#1107: FILE: hw/net/can/ctu_can_fd_regs.h:876:
+^I^Iuint32_t ssp_offset              : 8;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1107: FILE: hw/net/can/ctu_can_fd_regs.h:876:
+               uint32_t ssp_offset              : 8;
                                                 ^

ERROR: code indent should never use tabs
#1108: FILE: hw/net/can/ctu_can_fd_regs.h:877:
+^I^Iuint32_t reserved_15_7           : 9;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1108: FILE: hw/net/can/ctu_can_fd_regs.h:877:
+               uint32_t reserved_15_7           : 9;
                                                 ^

ERROR: code indent should never use tabs
#1109: FILE: hw/net/can/ctu_can_fd_regs.h:878:
+^I^Iuint32_t trv_delay_value         : 7;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1109: FILE: hw/net/can/ctu_can_fd_regs.h:878:
+               uint32_t trv_delay_value         : 7;
                                                 ^

ERROR: code indent should never use tabs
#1111: FILE: hw/net/can/ctu_can_fd_regs.h:880:
+^I} s;$

ERROR: code indent should never use tabs
#1115: FILE: hw/net/can/ctu_can_fd_regs.h:884:
+^ISSP_SRC_MEAS_N_OFFSET       = 0x0,$

ERROR: code indent should never use tabs
#1116: FILE: hw/net/can/ctu_can_fd_regs.h:885:
+^ISSP_SRC_NO_SSP              = 0x1,$

ERROR: code indent should never use tabs
#1117: FILE: hw/net/can/ctu_can_fd_regs.h:886:
+^ISSP_SRC_OFFSET              = 0x2,$

ERROR: code indent should never use tabs
#1121: FILE: hw/net/can/ctu_can_fd_regs.h:890:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#1122: FILE: hw/net/can/ctu_can_fd_regs.h:891:
+^Istruct ctu_can_fd_rx_fr_ctr_s {$

ERROR: code indent should never use tabs
#1124: FILE: hw/net/can/ctu_can_fd_regs.h:893:
+^I^Iuint32_t rx_fr_ctr_val          : 32;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1124: FILE: hw/net/can/ctu_can_fd_regs.h:893:
+               uint32_t rx_fr_ctr_val          : 32;
                                                ^

ERROR: code indent should never use tabs
#1125: FILE: hw/net/can/ctu_can_fd_regs.h:894:
+^I} s;$

ERROR: code indent should never use tabs
#1129: FILE: hw/net/can/ctu_can_fd_regs.h:898:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#1130: FILE: hw/net/can/ctu_can_fd_regs.h:899:
+^Istruct ctu_can_fd_tx_fr_ctr_s {$

ERROR: code indent should never use tabs
#1132: FILE: hw/net/can/ctu_can_fd_regs.h:901:
+^I^Iuint32_t tx_fr_ctr_val          : 32;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1132: FILE: hw/net/can/ctu_can_fd_regs.h:901:
+               uint32_t tx_fr_ctr_val          : 32;
                                                ^

ERROR: code indent should never use tabs
#1133: FILE: hw/net/can/ctu_can_fd_regs.h:902:
+^I} s;$

ERROR: code indent should never use tabs
#1137: FILE: hw/net/can/ctu_can_fd_regs.h:906:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#1138: FILE: hw/net/can/ctu_can_fd_regs.h:907:
+^Istruct ctu_can_fd_debug_register_s {$

WARNING: architecture specific defines should be avoided
#1139: FILE: hw/net/can/ctu_can_fd_regs.h:908:
+#ifdef __LITTLE_ENDIAN_BITFIELD

ERROR: code indent should never use tabs
#1141: FILE: hw/net/can/ctu_can_fd_regs.h:910:
+^I^Iuint32_t stuff_count             : 3;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1141: FILE: hw/net/can/ctu_can_fd_regs.h:910:
+               uint32_t stuff_count             : 3;
                                                 ^

ERROR: code indent should never use tabs
#1142: FILE: hw/net/can/ctu_can_fd_regs.h:911:
+^I^Iuint32_t destuff_count           : 3;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1142: FILE: hw/net/can/ctu_can_fd_regs.h:911:
+               uint32_t destuff_count           : 3;
                                                 ^

ERROR: code indent should never use tabs
#1143: FILE: hw/net/can/ctu_can_fd_regs.h:912:
+^I^Iuint32_t pc_arb                  : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1143: FILE: hw/net/can/ctu_can_fd_regs.h:912:
+               uint32_t pc_arb                  : 1;
                                                 ^

ERROR: code indent should never use tabs
#1144: FILE: hw/net/can/ctu_can_fd_regs.h:913:
+^I^Iuint32_t pc_con                  : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1144: FILE: hw/net/can/ctu_can_fd_regs.h:913:
+               uint32_t pc_con                  : 1;
                                                 ^

ERROR: code indent should never use tabs
#1145: FILE: hw/net/can/ctu_can_fd_regs.h:914:
+^I^Iuint32_t pc_dat                  : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1145: FILE: hw/net/can/ctu_can_fd_regs.h:914:
+               uint32_t pc_dat                  : 1;
                                                 ^

ERROR: code indent should never use tabs
#1146: FILE: hw/net/can/ctu_can_fd_regs.h:915:
+^I^Iuint32_t pc_stc                  : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1146: FILE: hw/net/can/ctu_can_fd_regs.h:915:
+               uint32_t pc_stc                  : 1;
                                                 ^

ERROR: code indent should never use tabs
#1147: FILE: hw/net/can/ctu_can_fd_regs.h:916:
+^I^Iuint32_t pc_crc                  : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1147: FILE: hw/net/can/ctu_can_fd_regs.h:916:
+               uint32_t pc_crc                  : 1;
                                                 ^

ERROR: code indent should never use tabs
#1148: FILE: hw/net/can/ctu_can_fd_regs.h:917:
+^I^Iuint32_t pc_crcd                 : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1148: FILE: hw/net/can/ctu_can_fd_regs.h:917:
+               uint32_t pc_crcd                 : 1;
                                                 ^

ERROR: code indent should never use tabs
#1149: FILE: hw/net/can/ctu_can_fd_regs.h:918:
+^I^Iuint32_t pc_ack                  : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1149: FILE: hw/net/can/ctu_can_fd_regs.h:918:
+               uint32_t pc_ack                  : 1;
                                                 ^

ERROR: code indent should never use tabs
#1150: FILE: hw/net/can/ctu_can_fd_regs.h:919:
+^I^Iuint32_t pc_ackd                 : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1150: FILE: hw/net/can/ctu_can_fd_regs.h:919:
+               uint32_t pc_ackd                 : 1;
                                                 ^

ERROR: code indent should never use tabs
#1151: FILE: hw/net/can/ctu_can_fd_regs.h:920:
+^I^Iuint32_t pc_eof                  : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1151: FILE: hw/net/can/ctu_can_fd_regs.h:920:
+               uint32_t pc_eof                  : 1;
                                                 ^

ERROR: code indent should never use tabs
#1152: FILE: hw/net/can/ctu_can_fd_regs.h:921:
+^I^Iuint32_t pc_int                  : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1152: FILE: hw/net/can/ctu_can_fd_regs.h:921:
+               uint32_t pc_int                  : 1;
                                                 ^

ERROR: code indent should never use tabs
#1153: FILE: hw/net/can/ctu_can_fd_regs.h:922:
+^I^Iuint32_t pc_susp                 : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1153: FILE: hw/net/can/ctu_can_fd_regs.h:922:
+               uint32_t pc_susp                 : 1;
                                                 ^

ERROR: code indent should never use tabs
#1154: FILE: hw/net/can/ctu_can_fd_regs.h:923:
+^I^Iuint32_t pc_ovr                  : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1154: FILE: hw/net/can/ctu_can_fd_regs.h:923:
+               uint32_t pc_ovr                  : 1;
                                                 ^

ERROR: code indent should never use tabs
#1155: FILE: hw/net/can/ctu_can_fd_regs.h:924:
+^I^Iuint32_t pc_sof                  : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1155: FILE: hw/net/can/ctu_can_fd_regs.h:924:
+               uint32_t pc_sof                  : 1;
                                                 ^

ERROR: code indent should never use tabs
#1156: FILE: hw/net/can/ctu_can_fd_regs.h:925:
+^I^Iuint32_t reserved_31_19         : 13;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1156: FILE: hw/net/can/ctu_can_fd_regs.h:925:
+               uint32_t reserved_31_19         : 13;
                                                ^

ERROR: code indent should never use tabs
#1158: FILE: hw/net/can/ctu_can_fd_regs.h:927:
+^I^Iuint32_t reserved_31_19         : 13;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1158: FILE: hw/net/can/ctu_can_fd_regs.h:927:
+               uint32_t reserved_31_19         : 13;
                                                ^

ERROR: code indent should never use tabs
#1159: FILE: hw/net/can/ctu_can_fd_regs.h:928:
+^I^Iuint32_t pc_sof                  : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1159: FILE: hw/net/can/ctu_can_fd_regs.h:928:
+               uint32_t pc_sof                  : 1;
                                                 ^

ERROR: code indent should never use tabs
#1160: FILE: hw/net/can/ctu_can_fd_regs.h:929:
+^I^Iuint32_t pc_ovr                  : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1160: FILE: hw/net/can/ctu_can_fd_regs.h:929:
+               uint32_t pc_ovr                  : 1;
                                                 ^

ERROR: code indent should never use tabs
#1161: FILE: hw/net/can/ctu_can_fd_regs.h:930:
+^I^Iuint32_t pc_susp                 : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1161: FILE: hw/net/can/ctu_can_fd_regs.h:930:
+               uint32_t pc_susp                 : 1;
                                                 ^

ERROR: code indent should never use tabs
#1162: FILE: hw/net/can/ctu_can_fd_regs.h:931:
+^I^Iuint32_t pc_int                  : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1162: FILE: hw/net/can/ctu_can_fd_regs.h:931:
+               uint32_t pc_int                  : 1;
                                                 ^

ERROR: code indent should never use tabs
#1163: FILE: hw/net/can/ctu_can_fd_regs.h:932:
+^I^Iuint32_t pc_eof                  : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1163: FILE: hw/net/can/ctu_can_fd_regs.h:932:
+               uint32_t pc_eof                  : 1;
                                                 ^

ERROR: code indent should never use tabs
#1164: FILE: hw/net/can/ctu_can_fd_regs.h:933:
+^I^Iuint32_t pc_ackd                 : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1164: FILE: hw/net/can/ctu_can_fd_regs.h:933:
+               uint32_t pc_ackd                 : 1;
                                                 ^

ERROR: code indent should never use tabs
#1165: FILE: hw/net/can/ctu_can_fd_regs.h:934:
+^I^Iuint32_t pc_ack                  : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1165: FILE: hw/net/can/ctu_can_fd_regs.h:934:
+               uint32_t pc_ack                  : 1;
                                                 ^

ERROR: code indent should never use tabs
#1166: FILE: hw/net/can/ctu_can_fd_regs.h:935:
+^I^Iuint32_t pc_crcd                 : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1166: FILE: hw/net/can/ctu_can_fd_regs.h:935:
+               uint32_t pc_crcd                 : 1;
                                                 ^

ERROR: code indent should never use tabs
#1167: FILE: hw/net/can/ctu_can_fd_regs.h:936:
+^I^Iuint32_t pc_crc                  : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1167: FILE: hw/net/can/ctu_can_fd_regs.h:936:
+               uint32_t pc_crc                  : 1;
                                                 ^

ERROR: code indent should never use tabs
#1168: FILE: hw/net/can/ctu_can_fd_regs.h:937:
+^I^Iuint32_t pc_stc                  : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1168: FILE: hw/net/can/ctu_can_fd_regs.h:937:
+               uint32_t pc_stc                  : 1;
                                                 ^

ERROR: code indent should never use tabs
#1169: FILE: hw/net/can/ctu_can_fd_regs.h:938:
+^I^Iuint32_t pc_dat                  : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1169: FILE: hw/net/can/ctu_can_fd_regs.h:938:
+               uint32_t pc_dat                  : 1;
                                                 ^

ERROR: code indent should never use tabs
#1170: FILE: hw/net/can/ctu_can_fd_regs.h:939:
+^I^Iuint32_t pc_con                  : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1170: FILE: hw/net/can/ctu_can_fd_regs.h:939:
+               uint32_t pc_con                  : 1;
                                                 ^

ERROR: code indent should never use tabs
#1171: FILE: hw/net/can/ctu_can_fd_regs.h:940:
+^I^Iuint32_t pc_arb                  : 1;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1171: FILE: hw/net/can/ctu_can_fd_regs.h:940:
+               uint32_t pc_arb                  : 1;
                                                 ^

ERROR: code indent should never use tabs
#1172: FILE: hw/net/can/ctu_can_fd_regs.h:941:
+^I^Iuint32_t destuff_count           : 3;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1172: FILE: hw/net/can/ctu_can_fd_regs.h:941:
+               uint32_t destuff_count           : 3;
                                                 ^

ERROR: code indent should never use tabs
#1173: FILE: hw/net/can/ctu_can_fd_regs.h:942:
+^I^Iuint32_t stuff_count             : 3;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1173: FILE: hw/net/can/ctu_can_fd_regs.h:942:
+               uint32_t stuff_count             : 3;
                                                 ^

ERROR: code indent should never use tabs
#1175: FILE: hw/net/can/ctu_can_fd_regs.h:944:
+^I} s;$

ERROR: code indent should never use tabs
#1179: FILE: hw/net/can/ctu_can_fd_regs.h:948:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#1180: FILE: hw/net/can/ctu_can_fd_regs.h:949:
+^Istruct ctu_can_fd_yolo_reg_s {$

ERROR: code indent should never use tabs
#1182: FILE: hw/net/can/ctu_can_fd_regs.h:951:
+^I^Iuint32_t yolo_val               : 32;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1182: FILE: hw/net/can/ctu_can_fd_regs.h:951:
+               uint32_t yolo_val               : 32;
                                                ^

ERROR: code indent should never use tabs
#1183: FILE: hw/net/can/ctu_can_fd_regs.h:952:
+^I} s;$

ERROR: code indent should never use tabs
#1187: FILE: hw/net/can/ctu_can_fd_regs.h:956:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#1188: FILE: hw/net/can/ctu_can_fd_regs.h:957:
+^Istruct ctu_can_fd_timestamp_low_s {$

ERROR: code indent should never use tabs
#1190: FILE: hw/net/can/ctu_can_fd_regs.h:959:
+^I^Iuint32_t timestamp_low          : 32;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1190: FILE: hw/net/can/ctu_can_fd_regs.h:959:
+               uint32_t timestamp_low          : 32;
                                                ^

ERROR: code indent should never use tabs
#1191: FILE: hw/net/can/ctu_can_fd_regs.h:960:
+^I} s;$

ERROR: code indent should never use tabs
#1195: FILE: hw/net/can/ctu_can_fd_regs.h:964:
+^Iuint32_t u32;$

ERROR: code indent should never use tabs
#1196: FILE: hw/net/can/ctu_can_fd_regs.h:965:
+^Istruct ctu_can_fd_timestamp_high_s {$

ERROR: code indent should never use tabs
#1198: FILE: hw/net/can/ctu_can_fd_regs.h:967:
+^I^Iuint32_t timestamp_high         : 32;$

ERROR: spaces prohibited around that ':' (ctx:WxW)
#1198: FILE: hw/net/can/ctu_can_fd_regs.h:967:
+               uint32_t timestamp_high         : 32;
                                                ^

ERROR: code indent should never use tabs
#1199: FILE: hw/net/can/ctu_can_fd_regs.h:968:
+^I} s;$

total: 1138 errors, 45 warnings, 1160 lines checked

Patch 89/92 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

90/92 Checking commit 199b86c28b48 (hw/net/can: CTU CAN FD IP open hardware core emulation.)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#53: 
new file mode 100644

WARNING: architecture specific defines should be avoided
#794: FILE: hw/net/can/ctucan_core.h:35:
+#ifndef __LITTLE_ENDIAN_BITFIELD

WARNING: line over 80 characters
#840: FILE: hw/net/can/ctucan_core.h:81:
+    union ctu_can_fd_filter_control_filter_status   filter_control_filter_status;

total: 0 errors, 3 warnings, 1123 lines checked

Patch 90/92 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
91/92 Checking commit 87b5476a6074 (hw/net/can: Documentation for CTU CAN FD IP open hardware core emulation.)
92/92 Checking commit f6e976e67865 (hw/net/can: Correct Kconfig dependencies)
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20200924092314.1722645-1-pbonzini@redhat.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: [PULL 00/92] Misc patches for 2020-09-24
  2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
                   ` (92 preceding siblings ...)
  2020-09-24 11:16 ` [PULL 00/92] Misc patches for 2020-09-24 no-reply
@ 2020-09-25 10:08 ` Peter Maydell
  93 siblings, 0 replies; 101+ messages in thread
From: Peter Maydell @ 2020-09-25 10:08 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU Developers

On Thu, 24 Sep 2020 at 10:27, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> The following changes since commit 0fc0142828b5bc965790a1c5c6e241897d3387cb:
>
>   Merge remote-tracking branch 'remotes/kraxel/tags/input-20200921-pull-request' into staging (2020-09-22 21:11:10 +0100)
>
> are available in the Git repository at:
>
>   https://gitlab.com/bonzini/qemu.git tags/for-upstream
>
> for you to fetch changes up to f40b138ec74bfdaf50f77e46e4b9c10a38f43db6:
>
>   Merge tag 'pull-cap-20200922' of https://github.com/rth7680/qemu into HEAD (2020-09-23 14:39:20 -0400)
>
> ----------------------------------------------------------------
> * SCSI fix (Dmitry, Li Feng, Li Qiang)
> * memory API fixes (Eduardo)
> * removal of deprecated '-numa node', 'cpu-add', '-smp' (Igor)
> * ACPI fix for VMBus (Jon)
> * relocatable install (myself)
> * always remove docker containers (myself)
> * serial cleanups (Philippe)
> * vmware cpuid leaf for tsc and apic frequency (Sunil)
> * KVM_FEATURE_ASYNC_PF_INT support (Vitaly)
> * i386 XSAVE bugfix (Xiaoyao)
> * QOM developer documentation in docs/devel (Eduardo)
> * new checkpatch tests (Dov)
> * x86_64 syscall fix (Douglas)
> * interrupt-based APF fix (Vitaly)
> * always create kvmclock (Vitaly)
> * fix bios-tables-test (Eduardo)
> * KVM PV features cleanup (myself)
> * CAN FD (Pavel)
>
> meson:
> * fixes (Marc-André, Max, Stefan, Alexander, myself)
> * submodule and environment CFLAGS overhaul (myself)
> * moved libmpathpersist, cocoa, malloc tests (myself)
> * support for 0.56 introspected test dependencies (myself)

Conflict in docs/system/deprecated.rst, which was easy
enough to fix up but then git tells me also

# Changes not staged for commit:
#       modified:   capstone (new commits)

so something is weird with the submodule status and I'm
not confident enough to go ahead with committing the
resulting merge commit.

In any case Richard's pullreq fails to build so I imagine if
I got to trying to test yours it would fail with those issues.
This kind of thing is why I prefer merges not to come with
other peoples' pullrequests pre-merged into them.

Can you rebase and resend, please?

(You might also find semantic conflicts with Stefan's
now-merged pullreq that includes the atomic->qatomic
rename; I didn't get far enough to find out.)

thanks
-- PMM


^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: [PULL 90/92] hw/net/can: CTU CAN FD IP open hardware core emulation.
  2020-09-24  9:23 ` [PULL 90/92] hw/net/can: CTU CAN FD IP open hardware core emulation Paolo Bonzini
@ 2020-11-02 16:32   ` Peter Maydell
  0 siblings, 0 replies; 101+ messages in thread
From: Peter Maydell @ 2020-11-02 16:32 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Pavel Pisa, QEMU Developers, Jan Charvat

On Thu, 24 Sep 2020 at 11:21, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> From: Jan Charvat <charvj10@fel.cvut.cz>
>
> The implementation of the model of complete open-source/design/hardware
> CAN FD controller. The IP core project has been started and is maintained
> by Ondrej Ille at Czech Technical University in Prague.
>
> CTU CAN FD project pages:
>         https://gitlab.fel.cvut.cz/canbus/ctucanfd_ip_core
>
> CAN bus CTU FEE Projects Listing page:
>         http://canbus.pages.fel.cvut.cz/
>
> The core is mapped to PCIe card same as on one of its real hardware
> adaptations. The device implementing two CTU CAN FD ip cores
> is instantiated after CAN bus definition
>
>         -object can-bus,id=canbus0-bus
>
> by QEMU parameters
>
>         -device ctucan_pci,canbus0=canbus0-bus,canbus1=canbus0-bus
>
> Signed-off-by: Jan Charvat <charvj10@fel.cvut.cz>
> Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
> Message-Id: <23e3ca4dcb2cc9900991016910a6cab7686c0e31.1600069689.git.pisa@cmp.felk.cvut.cz>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---

Hi; Coverity points out a couple of issues with this code,
one of which looks like a buffer overrun.

First, the minor one:

> +static void ctucan_send_ready_buffers(CtuCanCoreState *s)
> +{
> +    qemu_can_frame frame;
> +    uint8_t *pf;
> +    int buff2tx_idx;
> +    uint32_t tx_prio_max;
> +    unsigned int buff_st;
> +    uint32_t buff_st_mask;
> +
> +    if (!s->mode_settings.s.ena) {
> +        return;
> +    }
> +
> +    do {
> +        union ctu_can_fd_int_stat int_stat;
> +        int i;
> +        buff2tx_idx = -1;
> +        tx_prio_max = 0;
> +
> +        for (i = 0; i < CTUCAN_CORE_TXBUF_NUM; i++) {
> +            uint32_t prio;
> +
> +            buff_st_mask = 0xf << (i * 4);
> +            buff_st = (s->tx_status.u32 >> (i * 4)) & 0xf;

Here we write to buff_st_mask...

> +
> +            if (buff_st != TXT_RDY) {
> +                continue;
> +            }
> +            prio = (s->tx_priority.u32 >> (i * 4)) & 0x7;
> +            if (tx_prio_max < prio) {
> +                tx_prio_max = prio;
> +                buff2tx_idx = i;
> +            }
> +        }
> +        if (buff2tx_idx == -1) {
> +            break;
> +        }
> +        buff_st_mask = 0xf << (buff2tx_idx * 4);

...but we never use it before we overwrite with this assignment,
so the earlier assignment is dead code.

Is there a missing use of the variable in between, or should
the earlier assignment just be deleted ?

> +        buff_st = (s->tx_status.u32 >> (buff2tx_idx * 4)) & 0xf;
> +        int_stat.u32 = 0;
> +        buff_st = TXT_RDY;
> +        pf = s->tx_buffer[buff2tx_idx].data;
> +        ctucan_buff2frame(pf, &frame);
> +        s->status.s.idle = 0;
> +        s->status.s.txs = 1;
> +        can_bus_client_send(&s->bus_client, &frame, 1);
> +        s->status.s.idle = 1;
> +        s->status.s.txs = 0;
> +        s->tx_fr_ctr.s.tx_fr_ctr_val++;
> +        buff_st = TXT_TOK;
> +        int_stat.s.txi = 1;
> +        int_stat.s.txbhci = 1;
> +        s->int_stat.u32 |= int_stat.u32 & ~s->int_mask.u32;
> +        s->tx_status.u32 = (s->tx_status.u32 & ~buff_st_mask) |
> +                        (buff_st << (buff2tx_idx * 4));
> +    } while (1);
> +}

Now here's the buffer overrun:

> +void ctucan_mem_write(CtuCanCoreState *s, hwaddr addr, uint64_t val,
> +                       unsigned size)
> +{
> +    int              i;
> +
> +    DPRINTF("write 0x%02llx addr 0x%02x\n",
> +            (unsigned long long)val, (unsigned int)addr);
> +
> +    if (addr > CTUCAN_CORE_MEM_SIZE) {
> +        return;

Side note, this check should almost certainly be > and not >=
since addresses 0x0..0x499 are OK but 0x500 not.

> +    }
> +
> +    if (addr >= CTU_CAN_FD_TXTB1_DATA_1) {
> +        int buff_num;
> +        addr -= CTU_CAN_FD_TXTB1_DATA_1;
> +        buff_num = addr / CTUCAN_CORE_TXBUFF_SPAN;
> +        addr %= CTUCAN_CORE_TXBUFF_SPAN;
> +        if (buff_num < CTUCAN_CORE_TXBUF_NUM) {
> +            uint32_t *bufp = (uint32_t *)(s->tx_buffer[buff_num].data + addr);
> +            *bufp = cpu_to_le32(val);
> +        }

Here we take the address, and divide it into a buff_num
and an address inside that buffer. CTUCAN_CORE_TXBUFF_SPAN
is (CTU_CAN_FD_TXTB2_DATA_1 - CTU_CAN_FD_TXTB1_DATA_1),
which is 0x200 - 0x100 == 0x100 (256 in decimal).
So after the %= operation, addr can be between 0 and 255.
However, we then use this as an offset into the array
s->tx_buffer[buff_num].data.
tx_buffer is declared as:
    CtuCanCoreMsgBuffer tx_buffer[CTUCAN_CORE_TXBUF_NUM];
and CtuCanCoreMsgBuffer is
typedef struct CtuCanCoreMsgBuffer {
    uint8_t data[CTUCAN_CORE_MSG_MAX_LEN];
} CtuCanCoreMsgBuffer;

But CTUCAN_CORE_MSG_MAX_LEN is defined to be 0x50 (80 bytes),
so the data array is much smaller than the set of offsets
we allow the guest to make into it, and the guest can write
well off the end of the array.

Is the array too small, or should we be guarding the
permitted values of addr the way we do the value of
buff_num ?

Ironically, if we get the check against CTUCAN_CORE_MEM_SIZE
right then it's not actually possible for buff_num to
be >= CTUCAN_CORE_TXBUF_NUM, because CTUCAN_CORE_TXBUF_NUM
is 4, CTUCAN_CORE_MEM_SIZE is 0x500 and CTU_CAN_FD_TXTB1_DATA_1
is 0x100. So that should be assert()ed rather than tested,
I think.


> +        case CTU_CAN_FD_INT_STAT:
> +            s->int_stat.u32 &= ~(uint32_t)val;

Side note: using bitfields like this is non portable.
You have a lot of unions and ifdefs in your header file
as a result, and this in ctu_can_fd_regs.h suggests that
you're assuming little-endian order unconditionally:

#ifndef __LITTLE_ENDIAN_BITFIELD
#define __LITTLE_ENDIAN_BITFIELD 1
#endif

The minimum fix here is to define this only if
!defined(HOST_WORDS_BIGENDIAN) but really you ought
to replace all this code with extract32()/deposit32()
and other logical operations IMHO.

thanks
-- PMM


^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: [PULL 42/92] cutils: introduce get_relocated_path
  2020-09-24  9:22 ` [PULL 42/92] cutils: introduce get_relocated_path Paolo Bonzini
@ 2020-11-02 18:05   ` Peter Maydell
  2020-11-02 18:09     ` Peter Maydell
  0 siblings, 1 reply; 101+ messages in thread
From: Peter Maydell @ 2020-11-02 18:05 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU Developers

On Thu, 24 Sep 2020 at 10:48, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> Add the function that will compute a relocated version of the
> directories in CONFIG_QEMU_*DIR and CONFIG_QEMU_*PATH.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Hi; Coverity (CID 1432882) points out a bug in this code:

>  include/qemu/cutils.h | 12 +++++++++
>  meson.build           |  4 +--
>  util/cutils.c         | 61 +++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 75 insertions(+), 2 deletions(-)
>
> diff --git a/include/qemu/cutils.h b/include/qemu/cutils.h
> index eb59852dfd..3a86ec0321 100644
> --- a/include/qemu/cutils.h
> +++ b/include/qemu/cutils.h
> @@ -184,4 +184,16 @@ int uleb128_decode_small(const uint8_t *in, uint32_t *n);
>   */
>  int qemu_pstrcmp0(const char **str1, const char **str2);
>
> +
> +/**
> + * get_relocated_path:
> + * @dir: the directory (typically a `CONFIG_*DIR` variable) to be relocated.
> + *
> + * Returns a path for @dir that uses the directory of the running executable
> + * as the prefix.  For example, if `bindir` is `/usr/bin` and @dir is
> + * `/usr/share/qemu`, the function will append `../share/qemu` to the
> + * directory that contains the running executable and return the result.
> + */
> +char *get_relocated_path(const char *dir);

Side note -- this function makes it the caller's responsibility
to free the string it returns, but it doesn't mention that in
this documentation comment.

> +

> +char *get_relocated_path(const char *dir)
> +{
> +    size_t prefix_len = strlen(CONFIG_PREFIX);
> +    const char *bindir = CONFIG_BINDIR;
> +    const char *exec_dir = qemu_get_exec_dir();
> +    GString *result;
> +    int len_dir, len_bindir;
> +
> +    /* Fail if qemu_init_exec_dir was not called.  */
> +    assert(exec_dir[0]);
> +    if (!starts_with_prefix(dir) || !starts_with_prefix(bindir)) {
> +        return strdup(dir);

Here we return memory allocated by strdup(), which must be
freed with free()...

> +    }
> +
> +    result = g_string_new(exec_dir);

...but here we allocate and will return a string that must
be freed with g_free(), leaving our caller stuck for how
to tell the difference.

Using g_strdup() instead of strdup() is the easy fix.

thanks
-- PMM


^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: [PULL 42/92] cutils: introduce get_relocated_path
  2020-11-02 18:05   ` Peter Maydell
@ 2020-11-02 18:09     ` Peter Maydell
  0 siblings, 0 replies; 101+ messages in thread
From: Peter Maydell @ 2020-11-02 18:09 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU Developers

On Mon, 2 Nov 2020 at 18:05, Peter Maydell <peter.maydell@linaro.org> wrote:
>
> On Thu, 24 Sep 2020 at 10:48, Paolo Bonzini <pbonzini@redhat.com> wrote:
> >
> > Add the function that will compute a relocated version of the
> > directories in CONFIG_QEMU_*DIR and CONFIG_QEMU_*PATH.
> >
> > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>
> Hi; Coverity (CID 1432882)

Also 1432863 1432865 1432867 1432868 1432870 1432872 1432873
1432877 1432881, as it has helpfully filed a separate issue
for each callsite :-)

thanks
-- PMM


^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: [PULL 19/92] hw/char/serial: Assert serial_ioport_read/write offset fits 8 bytes
  2020-09-24  9:22 ` [PULL 19/92] hw/char/serial: Assert serial_ioport_read/write offset fits 8 bytes Paolo Bonzini
@ 2020-11-18 15:40   ` Peter Maydell
  2020-11-18 17:08     ` Paolo Bonzini
  0 siblings, 1 reply; 101+ messages in thread
From: Peter Maydell @ 2020-11-18 15:40 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Richard Henderson, QEMU Developers, Philippe Mathieu-Daudé

On Thu, 24 Sep 2020 at 10:40, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> From: Philippe Mathieu-Daudé <f4bug@amsat.org>
>
> The serial device has 8 registers, each 8-bit. The MemoryRegionOps
> 'serial_io_ops' is initialized with max_access_size=1, and all
> memory_region_init_io() callers correctly set the region size to
> 8 bytes:
> - serial_io_realize
> - serial_isa_realizefn
> - serial_pci_realize
> - multi_serial_pci_realize
>
> It is safe to assert the offset argument of serial_ioport_read()
> and serial_ioport_write() is always less than 8.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> Message-Id: <20200907015535.827885-2-f4bug@amsat.org>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  hw/char/serial.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/char/serial.c b/hw/char/serial.c
> index fd80ae5592..840da89de7 100644
> --- a/hw/char/serial.c
> +++ b/hw/char/serial.c
> @@ -344,7 +344,7 @@ static void serial_ioport_write(void *opaque, hwaddr addr, uint64_t val,
>  {
>      SerialState *s = opaque;
>
> -    addr &= 7;
> +    assert(size == 1 && addr < 8);
>      trace_serial_ioport_write(addr, val);
>      switch(addr) {
>      default:

Bug report https://bugs.launchpad.net/qemu/+bug/1904331
points out that the addition of this assert() makes obvious
that either the assert is wrong or some code later in the
function which is looking at size must be dead:
            if (size == 1) {
                s->divider = (s->divider & 0xff00) | val;
            } else {
                s->divider = val;
            }

Presumably it's the if() that should be fixed ?

thanks
-- PMM


^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: [PULL 19/92] hw/char/serial: Assert serial_ioport_read/write offset fits 8 bytes
  2020-11-18 15:40   ` Peter Maydell
@ 2020-11-18 17:08     ` Paolo Bonzini
  2020-11-18 18:37       ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 101+ messages in thread
From: Paolo Bonzini @ 2020-11-18 17:08 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Richard Henderson, QEMU Developers, Philippe Mathieu-Daudé

On 18/11/20 16:40, Peter Maydell wrote:
> On Thu, 24 Sep 2020 at 10:40, Paolo Bonzini <pbonzini@redhat.com> wrote:
>>
>> From: Philippe Mathieu-Daudé <f4bug@amsat.org>
>>
>> The serial device has 8 registers, each 8-bit. The MemoryRegionOps
>> 'serial_io_ops' is initialized with max_access_size=1, and all
>> memory_region_init_io() callers correctly set the region size to
>> 8 bytes:
>> - serial_io_realize
>> - serial_isa_realizefn
>> - serial_pci_realize
>> - multi_serial_pci_realize
>>
>> It is safe to assert the offset argument of serial_ioport_read()
>> and serial_ioport_write() is always less than 8.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>> Message-Id: <20200907015535.827885-2-f4bug@amsat.org>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> ---
>>   hw/char/serial.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/hw/char/serial.c b/hw/char/serial.c
>> index fd80ae5592..840da89de7 100644
>> --- a/hw/char/serial.c
>> +++ b/hw/char/serial.c
>> @@ -344,7 +344,7 @@ static void serial_ioport_write(void *opaque, hwaddr addr, uint64_t val,
>>   {
>>       SerialState *s = opaque;
>>
>> -    addr &= 7;
>> +    assert(size == 1 && addr < 8);
>>       trace_serial_ioport_write(addr, val);
>>       switch(addr) {
>>       default:
> 
> Bug report https://bugs.launchpad.net/qemu/+bug/1904331
> points out that the addition of this assert() makes obvious
> that either the assert is wrong or some code later in the
> function which is looking at size must be dead:
>              if (size == 1) {
>                  s->divider = (s->divider & 0xff00) | val;
>              } else {
>                  s->divider = val;
>              }
> 
> Presumably it's the if() that should be fixed ?

It can be dropped, because serial_io_ops has

     .impl = {
         .min_access_size = 1,
         .max_access_size = 1,
     },

Therefore, a 16-bit write to addr==0 is automatically split into an 
8-byte write to addr==0 and one to addr=1.  Together, the two set the 
full 16 bits of s->divider.

Thanks,

Paolo



^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: [PULL 19/92] hw/char/serial: Assert serial_ioport_read/write offset fits 8 bytes
  2020-11-18 17:08     ` Paolo Bonzini
@ 2020-11-18 18:37       ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 101+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-11-18 18:37 UTC (permalink / raw)
  To: Paolo Bonzini, Peter Maydell; +Cc: Richard Henderson, QEMU Developers

On 11/18/20 6:08 PM, Paolo Bonzini wrote:
> On 18/11/20 16:40, Peter Maydell wrote:
>> On Thu, 24 Sep 2020 at 10:40, Paolo Bonzini <pbonzini@redhat.com> wrote:
>>>
>>> From: Philippe Mathieu-Daudé <f4bug@amsat.org>
>>>
>>> The serial device has 8 registers, each 8-bit. The MemoryRegionOps
>>> 'serial_io_ops' is initialized with max_access_size=1, and all
>>> memory_region_init_io() callers correctly set the region size to
>>> 8 bytes:
>>> - serial_io_realize
>>> - serial_isa_realizefn
>>> - serial_pci_realize
>>> - multi_serial_pci_realize
>>>
>>> It is safe to assert the offset argument of serial_ioport_read()
>>> and serial_ioport_write() is always less than 8.
>>>
>>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>>> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>>> Message-Id: <20200907015535.827885-2-f4bug@amsat.org>
>>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>>> ---
>>>   hw/char/serial.c | 4 ++--
>>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/hw/char/serial.c b/hw/char/serial.c
>>> index fd80ae5592..840da89de7 100644
>>> --- a/hw/char/serial.c
>>> +++ b/hw/char/serial.c
>>> @@ -344,7 +344,7 @@ static void serial_ioport_write(void *opaque,
>>> hwaddr addr, uint64_t val,
>>>   {
>>>       SerialState *s = opaque;
>>>
>>> -    addr &= 7;
>>> +    assert(size == 1 && addr < 8);
>>>       trace_serial_ioport_write(addr, val);
>>>       switch(addr) {
>>>       default:
>>
>> Bug report https://bugs.launchpad.net/qemu/+bug/1904331
>> points out that the addition of this assert() makes obvious
>> that either the assert is wrong or some code later in the
>> function which is looking at size must be dead:
>>              if (size == 1) {
>>                  s->divider = (s->divider & 0xff00) | val;
>>              } else {
>>                  s->divider = val;
>>              }
>>
>> Presumably it's the if() that should be fixed ?
> 
> It can be dropped, because serial_io_ops has
> 
>     .impl = {
>         .min_access_size = 1,
>         .max_access_size = 1,
>     },
> 
> Therefore, a 16-bit write to addr==0 is automatically split into an
> 8-byte write to addr==0 and one to addr=1.  Together, the two set the
> full 16 bits of s->divider.

Since commit 5ec3a23e6c8 ("serial: convert PIO to new memory api
read/write") =)

> 
> Thanks,
> 
> Paolo
> 
> 


^ permalink raw reply	[flat|nested] 101+ messages in thread

end of thread, other threads:[~2020-11-18 19:00 UTC | newest]

Thread overview: 101+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-24  9:21 [PULL 00/92] Misc patches for 2020-09-24 Paolo Bonzini
2020-09-24  9:21 ` [PULL 01/92] tests: add missing genh dependency Paolo Bonzini
2020-09-24  9:21 ` [PULL 02/92] meson: clean up build_by_default Paolo Bonzini
2020-09-24  9:21 ` [PULL 03/92] ninjatool: rebuild multi-output targets if outputs are missing Paolo Bonzini
2020-09-24  9:21 ` [PULL 04/92] meson: fix MSI rule Paolo Bonzini
2020-09-24  9:21 ` [PULL 05/92] meson: error out if qemu_suffix starts with / Paolo Bonzini
2020-09-24  9:21 ` [PULL 06/92] WHPX: vmware cpuid leaf for tsc and apic frequency Paolo Bonzini
2020-09-24  9:21 ` [PULL 07/92] configure: Do not intent to build WHPX on 32-bit host Paolo Bonzini
2020-09-24  9:21 ` [PULL 08/92] MAINTAINERS: add Paolo Bonzini as RCU maintainer Paolo Bonzini
2020-09-24  9:21 ` [PULL 09/92] target/i386: support KVM_FEATURE_ASYNC_PF_INT Paolo Bonzini
2020-09-24  9:21 ` [PULL 10/92] memory: Convert IOMMUMemoryRegionClass doc comment to kernel-doc Paolo Bonzini
2020-09-24  9:21 ` [PULL 11/92] vhost-scsi: support inflight io track Paolo Bonzini
2020-09-24  9:21 ` [PULL 12/92] acpi: i386: Move VMBus DSDT entry to SB Paolo Bonzini
2020-09-24  9:21 ` [PULL 13/92] numa: drop support for '-numa node' (without memory specified) Paolo Bonzini
2020-09-24  9:21 ` [PULL 14/92] doc: Cleanup "'-mem-path' fallback to RAM" deprecation text Paolo Bonzini
2020-09-24  9:21 ` [PULL 15/92] numa: remove fixup numa_state->num_nodes to MAX_NODES Paolo Bonzini
2020-09-24  9:21 ` [PULL 16/92] hw/mips/mipssim: Use MMIO serial device on fake ISA I/O Paolo Bonzini
2020-09-24  9:21 ` [PULL 17/92] hw/char/serial: Remove TYPE_SERIAL_IO Paolo Bonzini
2020-09-24  9:22 ` [PULL 18/92] configure: rename QEMU_GA_MSI_ENABLED to CONFIG_QGA_MSI Paolo Bonzini
2020-09-24  9:22 ` [PULL 19/92] hw/char/serial: Assert serial_ioport_read/write offset fits 8 bytes Paolo Bonzini
2020-11-18 15:40   ` Peter Maydell
2020-11-18 17:08     ` Paolo Bonzini
2020-11-18 18:37       ` Philippe Mathieu-Daudé
2020-09-24  9:22 ` [PULL 20/92] hw/char/serial: Replace commented DPRINTF() by trace event Paolo Bonzini
2020-09-24  9:22 ` [PULL 21/92] hw/char/serial: Remove old DEBUG_SERIAL commented code Paolo Bonzini
2020-09-24  9:22 ` [PULL 22/92] hw/char/serial: Rename I/O read/write trace events Paolo Bonzini
2020-09-24  9:22 ` [PULL 23/92] hw/char/serial: Make 'wakeup' property boolean Paolo Bonzini
2020-09-24  9:22 ` [PULL 24/92] hw/char/serial-{isa, pci}: Alias QDEV properties from generic serial object Paolo Bonzini
2020-09-24  9:22 ` [PULL 25/92] scsi-generic: Fix HM-zoned device scan Paolo Bonzini
2020-09-24  9:22 ` [PULL 26/92] hw: megasas: return -1 when 'megasas_map_sgl' fails Paolo Bonzini
2020-09-24  9:22 ` [PULL 27/92] hw: megasas: consider 'iov_count=0' is an error in megasas_map_sgl Paolo Bonzini
2020-09-24  9:22 ` [PULL 28/92] i386/cpu: Clear FEAT_XSAVE_COMP_{LO, HI} when XSAVE is not available Paolo Bonzini
2020-09-24  9:22 ` [PULL 29/92] meson: move libudev test Paolo Bonzini
2020-09-24  9:22 ` [PULL 30/92] meson: move libmpathpersist test Paolo Bonzini
2020-09-24  9:22 ` [PULL 31/92] meson: extend libmpathpersist test for static linking Paolo Bonzini
2020-09-24  9:22 ` [PULL 32/92] configure: move malloc_trim/tcmalloc/jemalloc to meson Paolo Bonzini
2020-09-24  9:22 ` [PULL 33/92] configure: fix --meson=/path/to/meson Paolo Bonzini
2020-09-24  9:22 ` [PULL 34/92] configure: move cocoa option to Meson Paolo Bonzini
2020-09-24  9:22 ` [PULL 35/92] configure: do not limit Hypervisor.framework test to Darwin Paolo Bonzini
2020-09-24  9:22 ` [PULL 36/92] meson: qtest: set "depends" correctly Paolo Bonzini
2020-09-24  9:22 ` [PULL 37/92] mtest2make: add support for introspected test dependencies Paolo Bonzini
2020-09-24  9:22 ` [PULL 38/92] meson: report accelerator support Paolo Bonzini
2020-09-24  9:22 ` [PULL 39/92] oslib: do not call g_strdup from qemu_get_exec_dir Paolo Bonzini
2020-09-24  9:22 ` [PULL 40/92] fuzz: use qemu_get_exec_dir Paolo Bonzini
2020-09-24  9:22 ` [PULL 41/92] oslib-posix: default exec_dir to bindir Paolo Bonzini
2020-09-24  9:22 ` [PULL 42/92] cutils: introduce get_relocated_path Paolo Bonzini
2020-11-02 18:05   ` Peter Maydell
2020-11-02 18:09     ` Peter Maydell
2020-09-24  9:22 ` [PULL 43/92] oslib-posix: relocate path to /var Paolo Bonzini
2020-09-24  9:22 ` [PULL 44/92] module: relocate path to modules Paolo Bonzini
2020-09-24  9:22 ` [PULL 45/92] net: relocate paths to helpers and scripts Paolo Bonzini
2020-09-24  9:22 ` [PULL 46/92] vl: relocate paths to data directories Paolo Bonzini
2020-09-24  9:22 ` [PULL 47/92] vl: relocate path to configuration file Paolo Bonzini
2020-09-24  9:22 ` [PULL 48/92] qemu-bridge-helper: relocate path to default ACL Paolo Bonzini
2020-09-24  9:22 ` [PULL 49/92] qga: relocate path to default configuration and hook Paolo Bonzini
2020-09-24  9:22 ` [PULL 50/92] ui: relocate paths to icons and translations Paolo Bonzini
2020-09-24  9:22 ` [PULL 51/92] configure: use a platform-neutral prefix Paolo Bonzini
2020-09-24  9:22 ` [PULL 52/92] hw/i386/q35: Remove unreachable Xen code on Q35 machine Paolo Bonzini
2020-09-24  9:22 ` [PULL 53/92] exec: Remove MemoryRegion::global_locking field Paolo Bonzini
2020-09-24  9:22 ` [PULL 54/92] checkpatch: avoid error on cover letter files Paolo Bonzini
2020-09-24  9:22 ` [PULL 55/92] meson: fix installation of keymaps Paolo Bonzini
2020-09-24  9:22 ` [PULL 56/92] configure: fix performance regression due to PIC objects Paolo Bonzini
2020-09-24  9:22 ` [PULL 57/92] oss-fuzz: move linker arg to fix coverage-build Paolo Bonzini
2020-09-24  9:22 ` [PULL 58/92] tests/tcg: reinstate or replace desired parts of rules.mak Paolo Bonzini
2020-09-24  9:22 ` [PULL 59/92] configure: cleanup invocation of submodule Make Paolo Bonzini
2020-09-24  9:22 ` [PULL 60/92] configure: cleanup CFLAGS and LDFLAGS for submodules Paolo Bonzini
2020-09-24  9:22 ` [PULL 61/92] configure: do not clobber environment CFLAGS/CXXFLAGS/LDFLAGS Paolo Bonzini
2020-09-24  9:22 ` [PULL 62/92] configure: consistently pass CFLAGS/CXXFLAGS/LDFLAGS to meson Paolo Bonzini
2020-09-24  9:22 ` [PULL 63/92] smp: drop support for deprecated (invalid topologies) Paolo Bonzini
2020-09-24  9:22 ` [PULL 64/92] cphp: remove deprecated cpu-add command(s) Paolo Bonzini
2020-09-24  9:22 ` [PULL 65/92] char: fix logging when chardev write fails Paolo Bonzini
2020-09-24  9:22 ` [PULL 66/92] qom: Document all function parameters in doc comments Paolo Bonzini
2020-09-24  9:22 ` [PULL 67/92] qom: Use kernel-doc private/public tags in structs Paolo Bonzini
2020-09-24  9:22 ` [PULL 68/92] qom: Use ``code`` Sphinx syntax where appropriate Paolo Bonzini
2020-09-24  9:22 ` [PULL 69/92] qom: Add kernel-doc markup to introduction doc comment Paolo Bonzini
2020-09-24  9:22 ` [PULL 70/92] qom: Reformat section titles using Sphinx syntax Paolo Bonzini
2020-09-24  9:22 ` [PULL 71/92] qom: Indent existing code examples Paolo Bonzini
2020-09-24  9:22 ` [PULL 72/92] qom: Add code block markup to all code blocks Paolo Bonzini
2020-09-24  9:22 ` [PULL 73/92] docs: Create docs/devel/qom.rst Paolo Bonzini
2020-09-24  9:22 ` [PULL 74/92] docs: Move object.h overview doc comment to qom.rst Paolo Bonzini
2020-09-24  9:22 ` [PULL 75/92] hw/i386/xen: Rename X86/PC specific function as xen_hvm_init_pc() Paolo Bonzini
2020-09-24  9:22 ` [PULL 76/92] sysemu/xen: Add missing 'exec/cpu-common.h' header for ram_addr_t type Paolo Bonzini
2020-09-24  9:22 ` [PULL 77/92] stubs: Split accelerator / hardware related stubs Paolo Bonzini
2020-09-24  9:23 ` [PULL 78/92] hw/xen: Split x86-specific declaration from generic hardware ones Paolo Bonzini
2020-09-24  9:23 ` [PULL 79/92] typedefs: Restrict PCMachineState to 'hw/i386/pc.h' Paolo Bonzini
2020-09-24  9:23 ` [PULL 80/92] checkpatch: Detect '%#' or '%0#' in printf-style format strings Paolo Bonzini
2020-09-24  9:23 ` [PULL 81/92] helper_syscall x86_64: clear exception_is_int Paolo Bonzini
2020-09-24  9:23 ` [PULL 82/92] target/i386: Fix VM migration when interrupt based APF is enabled Paolo Bonzini
2020-09-24  9:23 ` [PULL 83/92] target/i386: always create kvmclock device Paolo Bonzini
2020-09-24  9:23 ` [PULL 84/92] bios-tables-test: Remove kernel-irqchip=off option Paolo Bonzini
2020-09-24  9:23 ` [PULL 85/92] target/i386: kvm: do not use kvm_check_extension to find paravirtual capabilities Paolo Bonzini
2020-09-24  9:23 ` [PULL 86/92] net/can: Initial host SocketCan support for CAN FD Paolo Bonzini
2020-09-24  9:23 ` [PULL 87/92] hw/net/can: sja1000 ignore CAN FD frames Paolo Bonzini
2020-09-24  9:23 ` [PULL 88/92] net/can: Add can_dlc2len and can_len2dlc for CAN FD Paolo Bonzini
2020-09-24  9:23 ` [PULL 89/92] hw/net/can/ctucafd: Add CTU CAN FD core register definitions Paolo Bonzini
2020-09-24  9:23 ` [PULL 90/92] hw/net/can: CTU CAN FD IP open hardware core emulation Paolo Bonzini
2020-11-02 16:32   ` Peter Maydell
2020-09-24  9:23 ` [PULL 91/92] hw/net/can: Documentation for " Paolo Bonzini
2020-09-24  9:23 ` [PULL 92/92] hw/net/can: Correct Kconfig dependencies Paolo Bonzini
2020-09-24 11:16 ` [PULL 00/92] Misc patches for 2020-09-24 no-reply
2020-09-25 10:08 ` Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.