qemu.git
9 months agoi386/sev: Fix error message in sev_get_capabilities()
Michal Privoznik [Mon, 24 Jun 2024 08:52:48 +0000 (10:52 +0200)]
i386/sev: Fix error message in sev_get_capabilities()

When a custom path is provided to sev-guest object and opening
the path fails an error message is reported. But the error
message still mentions DEFAULT_SEV_DEVICE ("/dev/sev") instead of
the custom path.

Fixes: 16dcf200dc951c1cde3e5b442457db5f690b8cf0
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Link: https://lore.kernel.org/r/b4648905d399780063dc70851d3d6a3cd28719a5.1719218926.git.mprivozn@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 months agotarget/i386: do not include undefined bits in the AMD topoext leaf
Paolo Bonzini [Wed, 3 Jul 2024 09:29:17 +0000 (11:29 +0200)]
target/i386: do not include undefined bits in the AMD topoext leaf

Commit d7c72735f61 ("target/i386: Add new EPYC CPU versions with updated
cache_info", 2023-05-08) ensured that AMD-defined CPU models did not
have the 'complex_indexing' bit set, but left it set in "-cpu host"
which uses the default ("legacy") cache information.

Reimplement that commit using a CPU feature, so that it can be applied
to all guests using a new machine type, independent of the CPU model.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 months agotarget/i386: SEV: fix formatting of CPUID mismatch message
Paolo Bonzini [Wed, 3 Jul 2024 08:37:23 +0000 (10:37 +0200)]
target/i386: SEV: fix formatting of CPUID mismatch message

Fixes: 70943ad8e4d ("i386/sev: Add support for SNP CPUID validation", 2024-06-05)
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 months agotarget/i386: drop AMD machine check bits from Intel CPUID
Paolo Bonzini [Wed, 26 Jun 2024 23:13:08 +0000 (01:13 +0200)]
target/i386: drop AMD machine check bits from Intel CPUID

The recent addition of the SUCCOR bit to kvm_arch_get_supported_cpuid()
causes the bit to be visible when "-cpu host" VMs are started on Intel
processors.

While this should in principle be harmless, it's not tidy and we don't
even know for sure that it doesn't cause any guest OS to take unexpected
paths.  Since x86_cpu_get_supported_feature_word() can return different
different values depending on the guest, adjust it to hide the SUCCOR
bit if the guest has non-AMD vendor.

Suggested-by: Xiaoyao Li <xiaoyao.li@intel.com>
Cc: John Allen <john.allen@amd.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 months agotarget/i386: pass X86CPU to x86_cpu_get_supported_feature_word
Paolo Bonzini [Wed, 26 Jun 2024 23:12:42 +0000 (01:12 +0200)]
target/i386: pass X86CPU to x86_cpu_get_supported_feature_word

This allows modifying the bits in "-cpu max"/"-cpu host" depending on
the guest CPU vendor (which, at least by default, is the host vendor in
the case of KVM).

For example, machine check architecture differs between Intel and AMD,
and bits from AMD should be dropped when configuring the guest for
an Intel model.

Cc: Xiaoyao Li <xiaoyao.li@intel.com>
Cc: John Allen <john.allen@amd.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 months agomeson: Drop the .fa library suffix
Paolo Bonzini [Fri, 24 May 2024 08:56:55 +0000 (10:56 +0200)]
meson: Drop the .fa library suffix

The non-standard .fa library suffix breaks the link source
de-duplication done by Meson so drop it.

The lack of link source de-duplication causes AddressSanitizer to
complain ODR violations, and makes GNU ld abort when combined with
clang's LTO.

Fortunately, the non-standard suffix is not necessary anymore for
two reasons.

First, the non-standard suffix was necessary for fork-fuzzing.
Meson wraps all standard-suffixed libraries with --start-group and
--end-group. This made a fork-fuzz.ld linker script wrapped as well and
broke builds. Commit d2e6f9272d33 ("fuzz: remove fork-fuzzing
scaffolding") dropped fork-fuzzing so we can now restore the standard
suffix.

Second, the libraries are not even built anymore, because it is
possible to just use the object files directly via extract_all_objects().

The occurences of the suffix were detected and removed by performing
a tree-wide search with 'fa' and .fa (note the quotes and dot).

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Message-ID: <20240524-xkb-v4-4-2de564e5c859@daynix.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 months agoRevert "meson: Propagate gnutls dependency"
Akihiko Odaki [Fri, 24 May 2024 08:00:23 +0000 (17:00 +0900)]
Revert "meson: Propagate gnutls dependency"

This reverts commit 3eacf70bb5a83e4775ad8003cbca63a40f70c8c2.

It was only needed because of duplicate objects caused by
declare_dependency(link_whole: ...), and can be dropped now
that meson.build specifies objects and dependencies separately
for the internal dependencies.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Message-ID: <20240524-objects-v1-2-07cbbe96166b@daynix.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 months agomeson: Pass objects and dependencies to declare_dependency()
Akihiko Odaki [Fri, 24 May 2024 08:00:22 +0000 (17:00 +0900)]
meson: Pass objects and dependencies to declare_dependency()

We used to request declare_dependency() to link_whole static libraries.
If a static library is a thin archive, GNU ld keeps all object files
referenced by the archive open, and sometimes exceeds the open file limit.

Another problem with link_whole is that suboptimal handling of nested
dependencies.

link_whole by itself does not propagate dependencies. In particular,
gnutls, a dependency of crypto, is not propagated to its users, and we
currently workaround the issue by declaring gnutls as a dependency for
each crypto user.  On the other hand, if you write something like

  libfoo = static_library('foo', 'foo.c', dependencies: gnutls)
  foo = declare_dependency(link_whole: libfoo)

  libbar = static_library('bar', 'bar.c', dependencies: foo)
  bar = declare_dependency(link_whole: libbar, dependencies: foo)
  executable('prog', sources: files('prog.c'), dependencies: [foo, bar])

hoping to propagate the gnutls dependency into bar.c, you'll see a
linking failure for "prog", because the foo.c.o object file is included in
libbar.a and therefore it is linked twice into "prog": once from libfoo.a
and once from libbar.a.  Here Meson does not see the duplication, it
just asks the linker to link all of libfoo.a and libbar.a into "prog".

Instead of using link_whole, extract objects included in static libraries
and pass them to declare_dependency(); and then the dependencies can be
added as well so that they are propagated, because object files on the
linker command line are always deduplicated.

This requires Meson 1.1.0 or later.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Message-ID: <20240524-objects-v1-1-07cbbe96166b@daynix.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 months agomeson: merge plugin_ldflags into emulator_link_args
Paolo Bonzini [Thu, 6 Jun 2024 13:07:23 +0000 (15:07 +0200)]
meson: merge plugin_ldflags into emulator_link_args

These serve the same purpose, except plugin_ldflags ends up in the linker
command line in a more roundabout way (through specific_ss).  Simplify.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 months agomeson: move block.syms dependency out of libblock
Paolo Bonzini [Fri, 24 May 2024 11:17:08 +0000 (13:17 +0200)]
meson: move block.syms dependency out of libblock

In order to define libqemuutil symbols that are requested by block modules,
QEMU currently uses a combination of the "link_depends" argument of
libraries (which is propagated into dependencies, but not available in
dependencies) and the "link_args" argument of declare_dependency()
(which _is_ available in static_library, but probably not used for
historical reasons only).

Unfortunately the link_depends will not be propagated into the
"block" dependency if it is defined using
declare_dependency(objects: ...); and it is not possible to
add it directly to the dependency because the keyword argument
simply is not available.

The only solution, in order to switch to defining the dependency
without using "link_whole" (which has problems of its own, see
https://github.com/mesonbuild/meson/pull/8151#issuecomment-754796420),
is unfortunately to add the link_args and link_depends to the
executables directly; fortunately there is just four of them.

It is possible (and I will look into it) to add "link_depends"
to declare_dependency(), but it probably will be a while before
QEMU can use it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 months agomeson: move shared_module() calls where modules are already walked
Paolo Bonzini [Fri, 24 May 2024 08:27:21 +0000 (10:27 +0200)]
meson: move shared_module() calls where modules are already walked

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9 months agoMerge tag 'pull-request-2024-07-02' of https://gitlab.com/thuth/qemu into staging
Richard Henderson [Tue, 2 Jul 2024 22:49:08 +0000 (15:49 -0700)]
Merge tag 'pull-request-2024-07-02' of https://gitlab.com/thuth/qemu into staging

* Fix interrupt controller migration on s390x with TCG and enable qtest
* Fix memory leaks in qtests
* Use a proper qom-tree parent for s390x virtio-net devices
* Add hotplug avocado test for virtio-blk
* Fix Travis jobs (need python3-tomli now)

# -----BEGIN PGP SIGNATURE-----
#
# iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmaD1qsRHHRodXRoQHJl
# ZGhhdC5jb20ACgkQLtnXdP5wLbWOtg//a+6nRcV8crCGzMaxhH32NxcjvV7TPiAI
# FioqOsomKfKKTMIDlbjsgQiQWqGrN/mdnxSzasypxZrC3eoDYJCIUyQfR2iGe4t2
# JJ4gQhQGuXkSstGErj8yw83UnG1drG+XuZ/psSij4/R2ft6Me8miFSh3cCgIm541
# 0DtffV6rAXIEqA+bswKsPq+7bq6ZCxZjaWgKhzfP5RNnpjPvHYMDDPZt9a2Fk9xC
# d3TILh/0djuVr8nZNUkQJBT5EU6dxVDb1JMqn4G6e6kWtiDBh/XwvMtC0KHVCJH1
# tHDz7n+FpwBfpo1cz0Y/Bn9pTW4K9KZ+GVlLOihfbh7Eaix0+RPzLKCigLVg1v8I
# HaNFr70FxF5Xzmvie36arEKf0CwQCinxvfM9USBD0uP3tOzSZwX2XxM0+FBIjUf3
# fYIY8qV1hQZM5tXFxtU5LW4A64pVGwEHlEIcodxo8mY/DnZUdIvB5L5C4rxATnVr
# t2eWc23sGdMZgKxUtlG0PIr80ImkYBWFOLztUmDPOff6igiyw2ZxaLQHyERPEc0O
# 1CL4K4K5FKNtJgjSwJyU1NquGKk85vUSjiUW1JOvInUFjRECIQ7+R41p6FU+eTHO
# l50cKaf2TCWqDOwMOjFYOHj6TWZGXnTmkSN60g0OLioy3UY+Kghd2Zq+aTK5ptyh
# 1BhcvTin9Zg=
# =lLG3
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 02 Jul 2024 03:30:03 AM PDT
# gpg:                using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5
# gpg:                issuer "thuth@redhat.com"
# gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full]
# gpg:                 aka "Thomas Huth <thuth@redhat.com>" [full]
# gpg:                 aka "Thomas Huth <th.huth@posteo.de>" [unknown]
# gpg:                 aka "Thomas Huth <huth@tuxfamily.org>" [full]

* tag 'pull-request-2024-07-02' of https://gitlab.com/thuth/qemu:
  pc-bios/s390-ccw: Remove duplicated LDFLAGS
  .travis.yml: Install python3-tomli in all build jobs
  tests/avocado: add hotplug_blk test
  hw/s390x: Attach default virtio-net devices to the /machine/virtual-css-bridge
  docs: add precision about capstone for execlog plugin
  tests/qtest: Free GThread
  tests/qtest: Free paths
  tests/qtest: Free old machine variable name
  tests/qtest: Free unused QMP response
  tests/qtest: Use qtest_add_data_func_full()
  tests/qtest/migration-test: enable on s390x with TCG
  hw/intc/s390_flic: Fix interrupt controller migration on s390x with TCG

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9 months agoMerge tag 'sdmmc-20240702' of https://github.com/philmd/qemu into staging
Richard Henderson [Tue, 2 Jul 2024 16:52:10 +0000 (09:52 -0700)]
Merge tag 'sdmmc-20240702' of https://github.com/philmd/qemu into staging

SD/MMC patches queue

- Deprecate SD spec v1.10
- Improve tracing
- Fix endianness on DAT lines
- Introduce helpers for commands transmitting data on the DAT lines
- Convert most commands to new helpers
- Register various optional commands
- Add command {name, type, class} fields to SDProto structure

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEE+qvnXhKRciHc/Wuy4+MsLN6twN4FAmaDtrEACgkQ4+MsLN6t
# wN7wABAAjjo+8ZYTxyh+P5oPvv4ec0SLFyTzOyDlzl/8rif9l54UP1kvBGtDYBaF
# hdHM/BguTQVdomObCrjmcXLmb/+ZnQ23x8Bn8rm1mqjXmV8UvuZ9KReAhQeEgBNN
# rtWClQqgtuBAbhh2uh0zNmwPhzCavSostd5nQtJXvUfCZUIyTmUBqUNFCZc+RkGy
# q6kUDzlgrH7uLzVMU5M6QvmOT1LbmWGQAdV+zWXBKXEBgysxzmm6bC7wRCoN+wPQ
# 9OtdHEZsxEDaIJFK7YcDu0lCOsGFzu62d8N7TA/v4nIWaxrppm4FK7kxgmsO15uY
# jEq3p2PbDj6UVYrqGpuw4qMcJ0Cs6dkGEfCw9eqwYyhAPd/Y+s/NBAgc6BieZWj6
# D32goEWykLorxu9sPGgR9qNWo7gbHanMo4ps3v4++D8Qtb3CpANXDIC5H1WR9azH
# tdiepDx0nW9bSo/hE32bL70TA8noqUCsrr1yIN7eydpJ2ZTa2ywMfIifLnowoOD2
# mPQ/QvUsAwJdjGXsz21loQdycOsuBmqZ4bKU45ez3bxKdq1LFC4q6xsVPeS0UVFy
# 6dSj2Bi44Y+Ub/UoNij2/6WzuIfNtSKXrs47et2v2SFjuPJt0g34cv3mLCz6CQQZ
# 2WFk42vyGSZ9gmWmt+G64nksQlifVWnGQP6jub9ThQ5rxqzFTU0=
# =vqY+
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 02 Jul 2024 01:13:37 AM PDT
# gpg:                using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE
# gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org>" [full]

* tag 'sdmmc-20240702' of https://github.com/philmd/qemu: (67 commits)
  hw/sd/sdcard: Add sd_acmd_SEND_SCR handler (ACMD51)
  hw/sd/sdcard: Add sd_acmd_SET_CLR_CARD_DETECT handler (ACMD42)
  hw/sd/sdcard: Add sd_acmd_SD_APP_OP_COND handler (ACMD41)
  hw/sd/sdcard: Add sd_acmd_SET_WR_BLK_ERASE_COUNT handler (ACMD23)
  hw/sd/sdcard: Add sd_acmd_SEND_NUM_WR_BLOCKS handler (ACMD22)
  hw/sd/sdcard: Add sd_acmd_SD_STATUS handler (ACMD13)
  hw/sd/sdcard: Add sd_acmd_SET_BUS_WIDTH handler (ACMD6)
  hw/sd/sdcard: Add spi_cmd_CRC_ON_OFF handler (CMD59)
  hw/sd/sdcard: Add spi_cmd_READ_OCR handler (CMD58)
  hw/sd/sdcard: Add sd_cmd_APP_CMD handler (CMD55)
  hw/sd/sdcard: Add sd_cmd_LOCK_UNLOCK handler (CMD42)
  hw/sd/sdcard: Add sd_cmd_ERASE handler (CMD38)
  hw/sd/sdcard: Add sd_cmd_ERASE_WR_BLK_START/END handlers (CMD32 & CMD33)
  hw/sd/sdcard: Add sd_cmd_SEND_WRITE_PROT handler (CMD30)
  hw/sd/sdcard: Add sd_cmd_SET/CLR_WRITE_PROT handler (CMD28 & CMD29)
  hw/sd/sdcard: Add sd_cmd_PROGRAM_CSD handler (CMD27)
  hw/sd/sdcard: Add sd_cmd_WRITE_SINGLE_BLOCK handler (CMD24)
  hw/sd/sdcard: Add sd_cmd_READ_SINGLE_BLOCK handler (CMD17)
  hw/sd/sdcard: Add sd_cmd_SET_BLOCKLEN handler (CMD16)
  hw/sd/sdcard: Add sd_cmd_GO_INACTIVE_STATE handler (CMD15)
  ...

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9 months agoMerge tag 'pull-aspeed-20240702' of https://github.com/legoater/qemu into staging
Richard Henderson [Tue, 2 Jul 2024 16:51:52 +0000 (09:51 -0700)]
Merge tag 'pull-aspeed-20240702' of https://github.com/legoater/qemu into staging

aspeed queue:

* Coverity fixes
* Deprecation of tacoma-bmc machine
* Buffer overflow fix in GPIO model
* Minor cleanup

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEEoPZlSPBIlev+awtgUaNDx8/77KEFAmaDs3QACgkQUaNDx8/7
# 7KEc/BAAj5AS3rLm3NPpU13y1P1hcjuSm1/PVGTJQH+m4K9UaAkJ8VhRB0Y/rdU6
# ygGhKaCHyk96+I49Csz886YU9Wg9qnxaYJAbornHZJVGNy5tuVpQKM20kfgN3XFN
# ENJR3e+J6Ye7kCtR1ujcf0mydWDaDyq0i82ykURsudcQLMnGq1gBQGadYjt1hJoN
# F9HDPgUJ8/wjQnG8BomsrnuvUSpRTbGNV66FNxXdQ6C6d6OTKQfNnXXqrKO+8QPK
# B5XB9FjTk017DUog1jdE1SaEMowml8CmUhjMwLHOcyWhcZpEk90aMX8cQhefUs9y
# O6kNin2UYEjcTHA/lyfMQJQMNDDZTE32MyP1LwRE/5ZiHqrT7ViqNvZSPBGBueUz
# 9B0xiQTuYqcRqlwgyU73DvnTgrsKFdKQSldj5dXYVnWCKeKY/sCWApHMJxN9xMCA
# Uw1E4QfCLkd+TM6DoJAkBHWFsgi44Aym11VU4VviGNRNTgmTptgQzmHiYGNFiGZG
# OypVPM8Ti6UeVnW65l9J9f7xA0jDB+XQjhCCaoax9GlUMA4C4/Aln5OXXxIWRWFd
# XA3Gn3c/S2j7rMqdfAk68xDHuAJ3wShHlw6HLRd1Xki05WFTeLj1lejLHMdfpNmr
# DkQimzHShBqZzZGxc7FsO0keGY8kyIJkZhbCCbZrFXJXQGRdBao=
# =LxwO
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 02 Jul 2024 12:59:48 AM PDT
# gpg:                using RSA key A0F66548F04895EBFE6B0B6051A343C7CFFBECA1
# gpg: Good signature from "Cédric Le Goater <clg@kaod.org>" [undefined]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: A0F6 6548 F048 95EB FE6B  0B60 51A3 43C7 CFFB ECA1

* tag 'pull-aspeed-20240702' of https://github.com/legoater/qemu:
  hw/net:ftgmac100: fix coding style
  aspeed/sdmc: Remove extra R_MAIN_STATUS case
  aspeed/soc: Fix possible divide by zero
  aspeed/sdmc: Check RAM size value at realize time
  aspeed: Deprecate the tacoma-bmc machine
  hw/gpio/aspeed: Add reg_table_count to AspeedGPIOClass

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9 months agoMerge tag 'hw-misc-20240702' of https://github.com/philmd/qemu into staging
Richard Henderson [Tue, 2 Jul 2024 14:11:47 +0000 (07:11 -0700)]
Merge tag 'hw-misc-20240702' of https://github.com/philmd/qemu into staging

Misc HW patches queue

- Prevent NULL deref in sPAPR network model (Oleg)
- Automatic deprecation of versioned machine types (Daniel)
- Correct 'dump-guest-core' property name in hint (Akihiko)
- Prevent IRQ leak in MacIO IDE model (Mark)
- Remove dead #ifdef'ry related to unsupported macOS 12.0 (Akihiko)
- Remove "hw/hw.h" where unnecessary (Thomas)

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEE+qvnXhKRciHc/Wuy4+MsLN6twN4FAmaDiSQACgkQ4+MsLN6t
# wN4jmBAA2kxwFAGbKvokANDAZBwWmJdnuIPcqS+jdo/wCuQXOo1ROADd3NFlgQWx
# z1xOv/LiAmQiUeeiP+nlA8gWCdW93PErU07og1p1+N2D1sBO6oG5QDlT/tTFuEGd
# IL21jG2xWkEemd3PSN2pHKrytpS0e4S0cNZIKgTUTKdv+Mb2ZEiQi7K4zUTjcmjz
# nlsSjTXdyKBmoiqNGhITWfbR2IUWjtCpzUO44ceqXd5HDpvfGhpKI7Uwun1W2xNU
# yw1XrAFd64Qhd/lvc28G1DLfDdtRIoaRGxgLzQbU6621s0o50Ecs6TNHseuUAKvd
# tQhOtM8IEuZ6jVw8nswCPIcJyjbeY29kjI4WmD2weF1fZbDey6Emlrf+dkJUIuCb
# TximyTXw3rb1nREUVsEQLF69BKjTjE5+ETaplcTWGHCoH2+uA/5MqygalTH1Ub9W
# TwVWSUwpNvIJ3RTsT20YVowkill8piF+ECldTKzJuWjqDviiJDoMm5EFdkkcUB20
# nMyhGoiXtiQ4NYU0/B6HbHOXZkqLbhWcx9G281xJ+RRwjUyVxXD3zHGR9AoOp9ls
# EAo/2URJtGN95LJmzCtaD+oo0wRZ5+7lmnqHPPXkYUdwFm4bhe3dP4NggIrS0cXn
# 19wvBqQuPwywxIbFEu6327YtfPRcImWIlFthWnm9lUyDmbOqDKw=
# =fLCx
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon 01 Jul 2024 09:59:16 PM PDT
# gpg:                using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE
# gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org>" [full]

* tag 'hw-misc-20240702' of https://github.com/philmd/qemu: (22 commits)
  Remove inclusion of hw/hw.h from files that don't need it
  net/vmnet: Drop ifdef for macOS versions older than 12.0
  block/file-posix: Drop ifdef for macOS versions older than 12.0
  audio: Drop ifdef for macOS versions older than 12.0
  hvf: Drop ifdef for macOS versions older than 12.0
  hw/ide/macio: switch from using qemu_allocate_irq() to qdev input GPIOs
  system/physmem: Fix reference to dump-guest-core
  docs: document special exception for machine type deprecation & removal
  hw/i386: remove obsolete manual deprecation reason string of i440fx machines
  hw/ppc: remove obsolete manual deprecation reason string of spapr machines
  hw: skip registration of outdated versioned machine types
  hw: set deprecation info for all versioned machine types
  include/hw: temporarily disable deletion of versioned machine types
  include/hw: add macros for deprecation & removal of versioned machines
  hw/i386: convert 'q35' machine definitions to use new macros
  hw/i386: convert 'i440fx' machine definitions to use new macros
  hw/m68k: convert 'virt' machine definitions to use new macros
  hw/ppc: convert 'spapr' machine definitions to use new macros
  hw/s390x: convert 'ccw' machine definitions to use new macros
  hw/arm: convert 'virt' machine definitions to use new macros
  ...

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9 months agohw/sd/sdcard: Add sd_acmd_SEND_SCR handler (ACMD51)
Philippe Mathieu-Daudé [Wed, 12 Jun 2024 21:48:03 +0000 (23:48 +0200)]
hw/sd/sdcard: Add sd_acmd_SEND_SCR handler (ACMD51)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-75-philmd@linaro.org>

9 months agohw/sd/sdcard: Add sd_acmd_SET_CLR_CARD_DETECT handler (ACMD42)
Philippe Mathieu-Daudé [Wed, 12 Jun 2024 21:47:35 +0000 (23:47 +0200)]
hw/sd/sdcard: Add sd_acmd_SET_CLR_CARD_DETECT handler (ACMD42)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-74-philmd@linaro.org>

9 months agohw/sd/sdcard: Add sd_acmd_SD_APP_OP_COND handler (ACMD41)
Philippe Mathieu-Daudé [Wed, 12 Jun 2024 21:46:39 +0000 (23:46 +0200)]
hw/sd/sdcard: Add sd_acmd_SD_APP_OP_COND handler (ACMD41)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-73-philmd@linaro.org>

9 months agohw/sd/sdcard: Add sd_acmd_SET_WR_BLK_ERASE_COUNT handler (ACMD23)
Philippe Mathieu-Daudé [Wed, 12 Jun 2024 21:45:33 +0000 (23:45 +0200)]
hw/sd/sdcard: Add sd_acmd_SET_WR_BLK_ERASE_COUNT handler (ACMD23)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-72-philmd@linaro.org>

9 months agohw/sd/sdcard: Add sd_acmd_SEND_NUM_WR_BLOCKS handler (ACMD22)
Philippe Mathieu-Daudé [Wed, 12 Jun 2024 21:44:53 +0000 (23:44 +0200)]
hw/sd/sdcard: Add sd_acmd_SEND_NUM_WR_BLOCKS handler (ACMD22)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-71-philmd@linaro.org>

9 months agohw/sd/sdcard: Add sd_acmd_SD_STATUS handler (ACMD13)
Philippe Mathieu-Daudé [Wed, 12 Jun 2024 21:43:53 +0000 (23:43 +0200)]
hw/sd/sdcard: Add sd_acmd_SD_STATUS handler (ACMD13)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-70-philmd@linaro.org>

9 months agohw/sd/sdcard: Add sd_acmd_SET_BUS_WIDTH handler (ACMD6)
Philippe Mathieu-Daudé [Wed, 12 Jun 2024 21:42:52 +0000 (23:42 +0200)]
hw/sd/sdcard: Add sd_acmd_SET_BUS_WIDTH handler (ACMD6)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-69-philmd@linaro.org>

9 months agohw/sd/sdcard: Add spi_cmd_CRC_ON_OFF handler (CMD59)
Philippe Mathieu-Daudé [Wed, 12 Jun 2024 21:39:08 +0000 (23:39 +0200)]
hw/sd/sdcard: Add spi_cmd_CRC_ON_OFF handler (CMD59)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-68-philmd@linaro.org>

9 months agohw/sd/sdcard: Add spi_cmd_READ_OCR handler (CMD58)
Philippe Mathieu-Daudé [Wed, 12 Jun 2024 21:38:31 +0000 (23:38 +0200)]
hw/sd/sdcard: Add spi_cmd_READ_OCR handler (CMD58)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-67-philmd@linaro.org>

9 months agohw/sd/sdcard: Add sd_cmd_APP_CMD handler (CMD55)
Philippe Mathieu-Daudé [Wed, 12 Jun 2024 21:35:19 +0000 (23:35 +0200)]
hw/sd/sdcard: Add sd_cmd_APP_CMD handler (CMD55)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-65-philmd@linaro.org>

9 months agohw/sd/sdcard: Add sd_cmd_LOCK_UNLOCK handler (CMD42)
Philippe Mathieu-Daudé [Wed, 12 Jun 2024 21:32:18 +0000 (23:32 +0200)]
hw/sd/sdcard: Add sd_cmd_LOCK_UNLOCK handler (CMD42)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-64-philmd@linaro.org>

9 months agohw/sd/sdcard: Add sd_cmd_ERASE handler (CMD38)
Philippe Mathieu-Daudé [Wed, 12 Jun 2024 21:30:28 +0000 (23:30 +0200)]
hw/sd/sdcard: Add sd_cmd_ERASE handler (CMD38)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-63-philmd@linaro.org>

9 months agohw/sd/sdcard: Add sd_cmd_ERASE_WR_BLK_START/END handlers (CMD32 & CMD33)
Philippe Mathieu-Daudé [Wed, 12 Jun 2024 21:29:52 +0000 (23:29 +0200)]
hw/sd/sdcard: Add sd_cmd_ERASE_WR_BLK_START/END handlers (CMD32 & CMD33)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-62-philmd@linaro.org>

9 months agohw/sd/sdcard: Add sd_cmd_SEND_WRITE_PROT handler (CMD30)
Philippe Mathieu-Daudé [Wed, 12 Jun 2024 21:28:24 +0000 (23:28 +0200)]
hw/sd/sdcard: Add sd_cmd_SEND_WRITE_PROT handler (CMD30)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-61-philmd@linaro.org>

9 months agohw/sd/sdcard: Add sd_cmd_SET/CLR_WRITE_PROT handler (CMD28 & CMD29)
Philippe Mathieu-Daudé [Wed, 12 Jun 2024 21:27:30 +0000 (23:27 +0200)]
hw/sd/sdcard: Add sd_cmd_SET/CLR_WRITE_PROT handler (CMD28 & CMD29)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-60-philmd@linaro.org>

9 months agohw/sd/sdcard: Add sd_cmd_PROGRAM_CSD handler (CMD27)
Philippe Mathieu-Daudé [Tue, 25 Jun 2024 11:59:28 +0000 (13:59 +0200)]
hw/sd/sdcard: Add sd_cmd_PROGRAM_CSD handler (CMD27)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-59-philmd@linaro.org>

9 months agohw/sd/sdcard: Add sd_cmd_WRITE_SINGLE_BLOCK handler (CMD24)
Philippe Mathieu-Daudé [Wed, 12 Jun 2024 21:22:52 +0000 (23:22 +0200)]
hw/sd/sdcard: Add sd_cmd_WRITE_SINGLE_BLOCK handler (CMD24)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-58-philmd@linaro.org>

9 months agohw/sd/sdcard: Add sd_cmd_READ_SINGLE_BLOCK handler (CMD17)
Philippe Mathieu-Daudé [Thu, 13 Jun 2024 22:09:02 +0000 (00:09 +0200)]
hw/sd/sdcard: Add sd_cmd_READ_SINGLE_BLOCK handler (CMD17)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-57-philmd@linaro.org>

9 months agohw/sd/sdcard: Add sd_cmd_SET_BLOCKLEN handler (CMD16)
Philippe Mathieu-Daudé [Wed, 12 Jun 2024 21:20:36 +0000 (23:20 +0200)]
hw/sd/sdcard: Add sd_cmd_SET_BLOCKLEN handler (CMD16)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-56-philmd@linaro.org>

9 months agohw/sd/sdcard: Add sd_cmd_GO_INACTIVE_STATE handler (CMD15)
Philippe Mathieu-Daudé [Wed, 12 Jun 2024 21:19:33 +0000 (23:19 +0200)]
hw/sd/sdcard: Add sd_cmd_GO_INACTIVE_STATE handler (CMD15)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-55-philmd@linaro.org>

9 months agohw/sd/sdcard: Add sd_cmd_SEND_STATUS handler (CMD13)
Philippe Mathieu-Daudé [Wed, 12 Jun 2024 21:18:39 +0000 (23:18 +0200)]
hw/sd/sdcard: Add sd_cmd_SEND_STATUS handler (CMD13)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-54-philmd@linaro.org>

9 months agohw/sd/sdcard: Add sd_cmd_STOP_TRANSMISSION handler (CMD12)
Philippe Mathieu-Daudé [Wed, 12 Jun 2024 21:17:49 +0000 (23:17 +0200)]
hw/sd/sdcard: Add sd_cmd_STOP_TRANSMISSION handler (CMD12)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-53-philmd@linaro.org>

9 months agohw/sd/sdcard: Add spi_cmd_SEND_CSD/CID handlers (CMD9 & CMD10)
Philippe Mathieu-Daudé [Wed, 12 Jun 2024 21:16:40 +0000 (23:16 +0200)]
hw/sd/sdcard: Add spi_cmd_SEND_CSD/CID handlers (CMD9 & CMD10)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-52-philmd@linaro.org>

9 months agohw/sd/sdcard: Add sd_cmd_SEND_CSD/CID handlers (CMD9 & CMD10)
Philippe Mathieu-Daudé [Wed, 12 Jun 2024 21:16:40 +0000 (23:16 +0200)]
hw/sd/sdcard: Add sd_cmd_SEND_CSD/CID handlers (CMD9 & CMD10)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-51-philmd@linaro.org>

9 months agohw/sd/sdcard: Add sd_cmd_SEND_IF_COND handler (CMD8)
Philippe Mathieu-Daudé [Wed, 12 Jun 2024 21:12:23 +0000 (23:12 +0200)]
hw/sd/sdcard: Add sd_cmd_SEND_IF_COND handler (CMD8)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-50-philmd@linaro.org>

9 months agohw/sd/sdcard: Add sd_cmd_DE/SELECT_CARD handler (CMD7)
Philippe Mathieu-Daudé [Wed, 12 Jun 2024 21:11:20 +0000 (23:11 +0200)]
hw/sd/sdcard: Add sd_cmd_DE/SELECT_CARD handler (CMD7)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-49-philmd@linaro.org>

9 months agohw/sd/sdcard: Add sd_cmd_SWITCH_FUNCTION handler (CMD6)
Philippe Mathieu-Daudé [Wed, 1 Jun 2022 05:10:42 +0000 (07:10 +0200)]
hw/sd/sdcard: Add sd_cmd_SWITCH_FUNCTION handler (CMD6)

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-48-philmd@linaro.org>

9 months agohw/sd/sdcard: Register Security Extension optional handlers
Philippe Mathieu-Daudé [Thu, 27 Jun 2024 09:50:21 +0000 (11:50 +0200)]
hw/sd/sdcard: Register Security Extension optional handlers

See "Advanced Security SD Extension Specification" v2.00.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-47-philmd@linaro.org>

9 months agohw/sd/sdcard: Register SDIO optional handlers
Philippe Mathieu-Daudé [Thu, 27 Jun 2024 09:49:38 +0000 (11:49 +0200)]
hw/sd/sdcard: Register SDIO optional handlers

See "SD Input/Output Card Specification" v1.00.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-46-philmd@linaro.org>

9 months agohw/sd/sdcard: Register optional handlers from spec v6.00
Philippe Mathieu-Daudé [Thu, 27 Jun 2024 09:48:44 +0000 (11:48 +0200)]
hw/sd/sdcard: Register optional handlers from spec v6.00

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-45-philmd@linaro.org>

9 months agohw/sd/sdcard: Register generic optional handlers (CMD11 and CMD20)
Philippe Mathieu-Daudé [Thu, 27 Jun 2024 09:46:45 +0000 (11:46 +0200)]
hw/sd/sdcard: Register generic optional handlers (CMD11 and CMD20)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-44-philmd@linaro.org>

9 months agohw/sd/sdcard: Remove SEND_DSR dead case (CMD4)
Philippe Mathieu-Daudé [Thu, 13 Jun 2024 20:38:17 +0000 (22:38 +0200)]
hw/sd/sdcard: Remove SEND_DSR dead case (CMD4)

The CSD::CSR_IMP bit defines whether the Driver Stage
Register (DSR) is implemented or not. We do not set
this bit in CSD:

    static void sd_set_csd(SDState *sd, uint64_t size)
    {
        ...
        if (size <= SDSC_MAX_CAPACITY) { /* Standard Capacity SD */
            ...
            sd->csd[6] = 0xe0 |     /* Partial block for read allowed */
                ((csize >> 10) & 0x03);
            ...
        } else {                    /* SDHC */
            ...
            sd->csd[6] = 0x00;
            ...
        }
        ...
    }

The sd_normal_command() switch case for the SEND_DSR
command do nothing and fallback to "illegal command".
Since the command is mandatory (although the register
isn't...) call the sd_cmd_unimplemented() handler.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-43-philmd@linaro.org>

9 months agohw/sd/sdcard: Store command class in SDProto
Philippe Mathieu-Daudé [Mon, 17 Jun 2024 03:28:09 +0000 (05:28 +0200)]
hw/sd/sdcard: Store command class in SDProto

Store the command class altogether with the other command
fields (handler, name and type).

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-42-philmd@linaro.org>

9 months agohw/sd/sdcard: Store command type in SDProto
Philippe Mathieu-Daudé [Mon, 17 Jun 2024 03:20:57 +0000 (05:20 +0200)]
hw/sd/sdcard: Store command type in SDProto

Store the command type altogether with the command handler and name.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-41-philmd@linaro.org>

9 months agohw/sd/sdcard: Store command name in SDProto
Philippe Mathieu-Daudé [Thu, 20 Jun 2024 12:43:28 +0000 (14:43 +0200)]
hw/sd/sdcard: Store command name in SDProto

We already have a const array where command handlers
are listed. Store the command name there too.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-40-philmd@linaro.org>

9 months agohw/sd/sdcard: Prepare SDProto to contain more fields
Philippe Mathieu-Daudé [Mon, 17 Jun 2024 03:15:46 +0000 (05:15 +0200)]
hw/sd/sdcard: Prepare SDProto to contain more fields

Convert array of command handlers to array of structures.
The structure contains the command handler. No logical
change intended.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-39-philmd@linaro.org>

9 months agohw/sd/sdcard: Pass SDState as argument to sd_[a]cmd_name()
Philippe Mathieu-Daudé [Thu, 20 Jun 2024 12:56:03 +0000 (14:56 +0200)]
hw/sd/sdcard: Pass SDState as argument to sd_[a]cmd_name()

In order to access SDState::SDProto from sd_[a]cmd_name(),
pass SDState as argument.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-38-philmd@linaro.org>

9 months agohw/sd/sdcard: Move sd_[a]cmd_name() methods to sd.c
Philippe Mathieu-Daudé [Thu, 20 Jun 2024 12:51:03 +0000 (14:51 +0200)]
hw/sd/sdcard: Move sd_[a]cmd_name() methods to sd.c

Merge sdmmc-internal.c into sd.c by moving
sd_cmd_name() and sd_acmd_name() and updating
meson.build.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-37-philmd@linaro.org>

9 months agohw/sd/sdcard: Convert LOCK_UNLOCK to generic_write_byte (CMD42)
Philippe Mathieu-Daudé [Wed, 12 Jun 2024 21:32:18 +0000 (23:32 +0200)]
hw/sd/sdcard: Convert LOCK_UNLOCK to generic_write_byte (CMD42)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-35-philmd@linaro.org>

9 months agohw/sd/sdcard: Convert PROGRAM_CSD to generic_write_byte (CMD27)
Philippe Mathieu-Daudé [Wed, 12 Jun 2024 21:23:54 +0000 (23:23 +0200)]
hw/sd/sdcard: Convert PROGRAM_CSD to generic_write_byte (CMD27)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-34-philmd@linaro.org>

9 months agohw/sd/sdcard: Convert PROGRAM_CID to generic_write_byte (CMD26)
Philippe Mathieu-Daudé [Wed, 1 Jun 2022 05:55:03 +0000 (07:55 +0200)]
hw/sd/sdcard: Convert PROGRAM_CID to generic_write_byte (CMD26)

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-33-philmd@linaro.org>

9 months agohw/sd/sdcard: Convert WRITE_SINGLE_BLOCK to generic_write_byte (CMD24)
Philippe Mathieu-Daudé [Wed, 1 Jun 2022 05:51:01 +0000 (07:51 +0200)]
hw/sd/sdcard: Convert WRITE_SINGLE_BLOCK to generic_write_byte (CMD24)

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-32-philmd@linaro.org>

9 months agohw/sd/sdcard: Duplicate WRITE_SINGLE_BLOCK / WRITE_MULTIPLE_BLOCK cases
Philippe Mathieu-Daudé [Tue, 25 Jun 2024 07:14:09 +0000 (09:14 +0200)]
hw/sd/sdcard: Duplicate WRITE_SINGLE_BLOCK / WRITE_MULTIPLE_BLOCK cases

In order to modify the WRITE_SINGLE_BLOCK case in the
next commit, duplicate it first.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-31-philmd@linaro.org>

9 months agohw/sd/sdcard: Introduce sd_cmd_to_receivingdata / sd_generic_write_byte
Philippe Mathieu-Daudé [Thu, 13 Jun 2024 14:21:50 +0000 (16:21 +0200)]
hw/sd/sdcard: Introduce sd_cmd_to_receivingdata / sd_generic_write_byte

All commands switching from TRANSFER state to (receiving)DATA
do the same: receive stream of data from the DAT lines. Instead
of duplicating the same code many times, introduce 2 helpers:
- sd_cmd_to_receivingdata() on the I/O line setup the data to
  be received on the data[] buffer,
- sd_generic_write_byte() on the DAT lines to push the data.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-30-philmd@linaro.org>

9 months agohw/sd/sdcard: Convert SEND_SCR to generic_read_byte (ACMD51)
Philippe Mathieu-Daudé [Wed, 1 Jun 2022 05:24:07 +0000 (07:24 +0200)]
hw/sd/sdcard: Convert SEND_SCR to generic_read_byte (ACMD51)

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-29-philmd@linaro.org>

9 months agohw/sd/sdcard: Convert SEND_NUM_WR_BLOCKS to generic_read_byte (ACMD22)
Philippe Mathieu-Daudé [Wed, 12 Jun 2024 21:44:53 +0000 (23:44 +0200)]
hw/sd/sdcard: Convert SEND_NUM_WR_BLOCKS to generic_read_byte (ACMD22)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-28-philmd@linaro.org>

9 months agohw/sd/sdcard: Convert SD_STATUS to generic_read_byte (ACMD13)
Philippe Mathieu-Daudé [Wed, 1 Jun 2022 05:25:08 +0000 (07:25 +0200)]
hw/sd/sdcard: Convert SD_STATUS to generic_read_byte (ACMD13)

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-27-philmd@linaro.org>

9 months agohw/sd/sdcard: Convert SEND_WRITE_PROT to generic_read_byte (CMD30)
Philippe Mathieu-Daudé [Wed, 12 Jun 2024 21:28:24 +0000 (23:28 +0200)]
hw/sd/sdcard: Convert SEND_WRITE_PROT to generic_read_byte (CMD30)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-25-philmd@linaro.org>

9 months agohw/sd/sdcard: Convert SEND_TUNING_BLOCK to generic_read_byte (CMD19)
Philippe Mathieu-Daudé [Wed, 1 Jun 2022 05:15:10 +0000 (07:15 +0200)]
hw/sd/sdcard: Convert SEND_TUNING_BLOCK to generic_read_byte (CMD19)

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-24-philmd@linaro.org>

9 months agohw/sd/sdcard: Convert READ_SINGLE_BLOCK to generic_read_byte (CMD17)
Philippe Mathieu-Daudé [Wed, 1 Jun 2022 05:27:51 +0000 (07:27 +0200)]
hw/sd/sdcard: Convert READ_SINGLE_BLOCK to generic_read_byte (CMD17)

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-23-philmd@linaro.org>

9 months agohw/sd/sdcard: Duplicate READ_SINGLE_BLOCK / READ_MULTIPLE_BLOCK cases
Philippe Mathieu-Daudé [Tue, 25 Jun 2024 03:36:27 +0000 (05:36 +0200)]
hw/sd/sdcard: Duplicate READ_SINGLE_BLOCK / READ_MULTIPLE_BLOCK cases

In order to modify the READ_SINGLE_BLOCK case in the
next commit, duplicate it first.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-22-philmd@linaro.org>

9 months agohw/sd/sdcard: Convert SEND_CSD/SEND_CID to generic_read_byte (CMD9 & 10)
Philippe Mathieu-Daudé [Wed, 1 Jun 2022 05:13:05 +0000 (07:13 +0200)]
hw/sd/sdcard: Convert SEND_CSD/SEND_CID to generic_read_byte (CMD9 & 10)

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-21-philmd@linaro.org>

9 months agohw/sd/sdcard: Convert SWITCH_FUNCTION to generic_read_byte (CMD6)
Philippe Mathieu-Daudé [Wed, 12 Jun 2024 21:09:08 +0000 (23:09 +0200)]
hw/sd/sdcard: Convert SWITCH_FUNCTION to generic_read_byte (CMD6)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-20-philmd@linaro.org>

9 months agohw/sd/sdcard: Introduce sd_cmd_to_sendingdata and sd_generic_read_byte
Philippe Mathieu-Daudé [Thu, 13 Jun 2024 14:21:12 +0000 (16:21 +0200)]
hw/sd/sdcard: Introduce sd_cmd_to_sendingdata and sd_generic_read_byte

All commands switching from TRANSFER state to (sending)DATA
do the same: send stream of data on the DAT lines. Instead
of duplicating the same code many times, introduce 2 helpers:
- sd_cmd_to_sendingdata() on the I/O line setup the data to
  be transferred,
- sd_generic_read_byte() on the DAT lines to fetch the data.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <4c9f7f51-83ee-421a-8690-9af2e80b134b@linaro.org>

9 months agohw/sd/sdcard: Introduce definitions for EXT_CSD register
Cédric Le Goater [Wed, 25 May 2022 07:21:22 +0000 (09:21 +0200)]
hw/sd/sdcard: Introduce definitions for EXT_CSD register

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
Co-Developed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20240628070216.92609-18-philmd@linaro.org>

9 months agohw/sd/sdcard: Extract sd_blk_len() helper
Philippe Mathieu-Daudé [Mon, 26 Oct 2020 00:32:52 +0000 (01:32 +0100)]
hw/sd/sdcard: Extract sd_blk_len() helper

Extract sd_blk_len() helper, use definitions instead
of magic values.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-15-philmd@linaro.org>

9 months agohw/sd/sdcard: Add direct reference to SDProto in SDState
Philippe Mathieu-Daudé [Mon, 24 Jun 2024 18:19:10 +0000 (20:19 +0200)]
hw/sd/sdcard: Add direct reference to SDProto in SDState

Keep direct reference to SDProto in SDState,
remove then unnecessary sd_proto().

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-14-philmd@linaro.org>

9 months agohw/sd/sdcard: Simplify sd_inactive_state handling
Philippe Mathieu-Daudé [Tue, 25 Jun 2024 03:50:16 +0000 (05:50 +0200)]
hw/sd/sdcard: Simplify sd_inactive_state handling

Card entering sd_inactive_state powers off, and won't respond
anymore. Handle that once when entering sd_do_command().

Remove condition always true in sd_cmd_GO_IDLE_STATE().

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-12-philmd@linaro.org>

9 months agohw/sd/sdcard: Assign SDCardStates enum values
Philippe Mathieu-Daudé [Mon, 24 Jun 2024 18:18:46 +0000 (20:18 +0200)]
hw/sd/sdcard: Assign SDCardStates enum values

SDCardStates enum values are specified, so assign them
correspondingly. It will be useful later when we add
states from later specs, which might not be continuous.

See CURRENT_STATE bits in section 4.10.1 "Card Status".

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-11-philmd@linaro.org>

9 months agohw/sd/sdcard: Use READY_FOR_DATA definition instead of magic value
Philippe Mathieu-Daudé [Mon, 24 Jun 2024 14:41:10 +0000 (16:41 +0200)]
hw/sd/sdcard: Use READY_FOR_DATA definition instead of magic value

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-10-philmd@linaro.org>

9 months agohw/sd/sdcard: Send NUM_WR_BLOCKS bits MSB first (ACMD22)
Philippe Mathieu-Daudé [Fri, 14 Jun 2024 13:28:10 +0000 (15:28 +0200)]
hw/sd/sdcard: Send NUM_WR_BLOCKS bits MSB first (ACMD22)

Per sections 3.6.1 (SD Bus Protocol), 4.3.4 "Data Write"
and 7.3.2 (Responses):

  In the CMD line the Most Significant Bit is transmitted first.

Use the stl_be_p() helper to store the value in big-endian.

Fixes: a1bb27b1e9 ("Initial SD card emulation")
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20240628070216.92609-9-philmd@linaro.org>

9 months agohw/sd/sdcard: Send WRITE_PROT bits MSB first (CMD30)
Philippe Mathieu-Daudé [Fri, 14 Jun 2024 13:17:55 +0000 (15:17 +0200)]
hw/sd/sdcard: Send WRITE_PROT bits MSB first (CMD30)

Per sections 3.6.1 (SD Bus Protocol) and 7.3.2 (Responses):

  In the CMD line the Most Significant Bit is transmitted first.

Use the stl_be_p() helper to store the value in big-endian.

Fixes: a1bb27b1e9 ("Initial SD card emulation")
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20240628070216.92609-8-philmd@linaro.org>

9 months agohw/sd/sdcard: Restrict SWITCH_FUNCTION to sd_transfer_state (CMD6)
Philippe Mathieu-Daudé [Tue, 25 Jun 2024 02:48:12 +0000 (04:48 +0200)]
hw/sd/sdcard: Restrict SWITCH_FUNCTION to sd_transfer_state (CMD6)

SWITCH_FUNCTION is only allowed in TRANSFER state
(See 4.8 "Card State Transition Table).

Fixes: a1bb27b1e9 ("Initial SD card emulation")
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-13-philmd@linaro.org>

9 months agopc-bios/s390-ccw: Remove duplicated LDFLAGS
Thomas Huth [Fri, 21 Jun 2024 08:24:16 +0000 (10:24 +0200)]
pc-bios/s390-ccw: Remove duplicated LDFLAGS

The -Wl,-pie and -nostdlib flags are added to LDFLAGS twice. Merge
the two lines to get rid of the duplicates.

Message-ID: <20240621082422.136217-2-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
9 months ago.travis.yml: Install python3-tomli in all build jobs
Thomas Huth [Mon, 24 Jun 2024 09:48:07 +0000 (11:48 +0200)]
.travis.yml: Install python3-tomli in all build jobs

Since commit 1f97715c83 ('Revert "python: use vendored tomli"')
this package is a hard requirement for compiling QEMU, so install
it now in all Travis jobs, too.

Message-ID: <20240624094807.182313-1-thuth@redhat.com>
Acked-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
9 months agotests/avocado: add hotplug_blk test
Vladimir Sementsov-Ogievskiy [Tue, 9 Apr 2024 06:58:54 +0000 (09:58 +0300)]
tests/avocado: add hotplug_blk test

Introduce a test, that checks that plug/unplug of virtio-blk device
works.

(the test is developed by copying hotplug_cpu.py, so keep original
copyright)

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20240409065854.366856-1-vsementsov@yandex-team.ru>
Signed-off-by: Thomas Huth <thuth@redhat.com>
9 months agohw/s390x: Attach default virtio-net devices to the /machine/virtual-css-bridge
Thomas Huth [Mon, 1 Jul 2024 20:01:08 +0000 (22:01 +0200)]
hw/s390x: Attach default virtio-net devices to the /machine/virtual-css-bridge

The initial virtio-net-ccw devices currently do not have a proper parent
in the QOM tree, so they show up under /machine/unattached - which is
somewhat ugly. Let's attach them to /machine/virtual-css-bridge/virtual-css
instead.

Message-ID: <20240701200108.154271-1-thuth@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
9 months agodocs: add precision about capstone for execlog plugin
Alexandre Iooss [Thu, 20 Jun 2024 13:57:32 +0000 (15:57 +0200)]
docs: add precision about capstone for execlog plugin

Some people are wondering why they get an empty string as disassembly.
Most of the time, they configured QEMU without Capstone support.
Let's document this behaviour to help users.

Signed-off-by: Alexandre Iooss <erdnaxe@crans.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-ID: <20240620135731.977377-1-erdnaxe@crans.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
9 months agotests/qtest: Free GThread
Akihiko Odaki [Thu, 27 Jun 2024 13:37:58 +0000 (22:37 +0900)]
tests/qtest: Free GThread

These GThreads are never referenced.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20240627-san-v2-15-750bb0946dbd@daynix.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
9 months agotests/qtest: Free paths
Akihiko Odaki [Thu, 27 Jun 2024 13:37:57 +0000 (22:37 +0900)]
tests/qtest: Free paths

This fixes LeakSanitizer warnings.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20240627-san-v2-14-750bb0946dbd@daynix.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
9 months agotests/qtest: Free old machine variable name
Akihiko Odaki [Thu, 27 Jun 2024 13:37:55 +0000 (22:37 +0900)]
tests/qtest: Free old machine variable name

This fixes LeakSanitizer warnings.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20240627-san-v2-12-750bb0946dbd@daynix.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
9 months agotests/qtest: Free unused QMP response
Akihiko Odaki [Thu, 27 Jun 2024 13:37:54 +0000 (22:37 +0900)]
tests/qtest: Free unused QMP response

This fixes LeakSanitizer warnings.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20240627-san-v2-11-750bb0946dbd@daynix.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
9 months agotests/qtest: Use qtest_add_data_func_full()
Akihiko Odaki [Thu, 27 Jun 2024 13:37:53 +0000 (22:37 +0900)]
tests/qtest: Use qtest_add_data_func_full()

A test function may not be executed depending on the test command line
so it is wrong to free data with a test function. Use
qtest_add_data_func_full() to register a function to free data.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20240627-san-v2-10-750bb0946dbd@daynix.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
9 months agohw/sd/sdcard: Trace requested address computed by sd_req_get_address()
Philippe Mathieu-Daudé [Thu, 20 Jun 2024 07:43:26 +0000 (09:43 +0200)]
hw/sd/sdcard: Trace requested address computed by sd_req_get_address()

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Luc Michel <luc.michel@amd.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-6-philmd@linaro.org>

9 months agohw/sd/sdcard: Trace block offset in READ/WRITE data accesses
Philippe Mathieu-Daudé [Wed, 19 Jun 2024 18:26:47 +0000 (20:26 +0200)]
hw/sd/sdcard: Trace block offset in READ/WRITE data accesses

Useful to detect out of bound accesses.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Tested-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-5-philmd@linaro.org>

9 months agohw/sd/sdcard: Track last command used to help logging
Philippe Mathieu-Daudé [Thu, 13 Jun 2024 23:44:28 +0000 (01:44 +0200)]
hw/sd/sdcard: Track last command used to help logging

The command is selected on the I/O lines, and further
processing might be done on the DAT lines via the
sd_read_byte() and sd_write_byte() handlers. Since
these methods can't distinct between normal and APP
commands, keep the name of the current command in
the SDState and use it in the DAT handlers. This
fixes a bug that all normal commands were displayed
as APP commands.

Fixes: 2ed61fb57b ("sdcard: Display command name when tracing CMD/ACMD")
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-4-philmd@linaro.org>

9 months agohw/sd/sdcard: Deprecate support for spec v1.10
Philippe Mathieu-Daudé [Thu, 27 Jun 2024 06:57:38 +0000 (08:57 +0200)]
hw/sd/sdcard: Deprecate support for spec v1.10

We use the v2.00 spec by default since commit 2f0939c234
("sdcard: Add a 'spec_version' property, default to Spec v2.00").
Time to deprecate the v1.10 which doesn't bring much, and
is not tested.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Tested-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240627071040.36190-2-philmd@linaro.org>

9 months agotests/qtest/migration-test: enable on s390x with TCG
Nicholas Piggin [Sat, 25 May 2024 13:12:39 +0000 (23:12 +1000)]
tests/qtest/migration-test: enable on s390x with TCG

s390x with TCG is more stable now. Enable it.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Message-Id: <20240525131241.378473-3-npiggin@gmail.com>
Reviewed-by: Prasad Pandit <pjp@fedoraproject.org>
[thuth: Added "with TCG" to the commit message]
Signed-off-by: Thomas Huth <thuth@redhat.com>
9 months agohw/intc/s390_flic: Fix interrupt controller migration on s390x with TCG
Thomas Huth [Wed, 19 Jun 2024 14:44:21 +0000 (16:44 +0200)]
hw/intc/s390_flic: Fix interrupt controller migration on s390x with TCG

Migration of a s390x guest with TCG was long known to be very unstable,
so the tests in tests/qtest/migration-test.c are disabled if running
with TCG instead of KVM.

Nicholas Piggin did a great analysis of the problem:

"The flic pending state is not migrated, so if the machine is migrated
 while an interrupt is pending, it can be lost. This shows up in
 qtest migration test, an extint is pending (due to console writes?)
 and the CPU waits via s390_cpu_set_psw and expects the interrupt to
 wake it. However when the flic pending state is lost, s390_cpu_has_int
 returns false, so s390_cpu_exec_interrupt falls through to halting
 again."

Thus let's finally migrate the pending state, and to be on the safe
side, also the other state variables of the QEMUS390FLICState structure.

Message-ID: <20240619144421.261342-1-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
9 months agohw/net:ftgmac100: fix coding style
Jamin Lin [Wed, 19 Jun 2024 10:01:01 +0000 (18:01 +0800)]
hw/net:ftgmac100: fix coding style

Fix coding style issues from checkpatch.pl

Test command:
./scripts/checkpatch.pl --no-tree -f hw/net/ftgmac100.c

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
9 months agoaspeed/sdmc: Remove extra R_MAIN_STATUS case
Jamin Lin [Tue, 25 Jun 2024 07:07:40 +0000 (15:07 +0800)]
aspeed/sdmc: Remove extra R_MAIN_STATUS case

Coverity reports that the newly added 'case R_MAIN_STATUS' is DEADCODE
because it can not be reached. This is because R_MAIN_STATUS is handled
before in the "Unprotected registers" switch statement. Remove it.

Fixes: Coverity CID 1547112
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
[ clg: Rewrote commit log ]
Signed-off-by: Cédric Le Goater <clg@redhat.com>
9 months agoaspeed/soc: Fix possible divide by zero
Jamin Lin [Tue, 25 Jun 2024 07:07:39 +0000 (15:07 +0800)]
aspeed/soc: Fix possible divide by zero

Coverity reports a possible DIVIDE_BY_ZERO issue regarding the
"ram_size" object property. This can not happen because RAM has
predefined valid sizes per SoC. Nevertheless, add a test to
close the issue.

Fixes: Coverity CID 1547113
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
[ clg: Rewrote commit log ]
Signed-off-by: Cédric Le Goater <clg@redhat.com>
9 months agoaspeed/sdmc: Check RAM size value at realize time
Cédric Le Goater [Tue, 25 Jun 2024 06:37:43 +0000 (08:37 +0200)]
aspeed/sdmc: Check RAM size value at realize time

The RAM size of the SDMC device is validated for the SoC and set when
the Aspeed machines are initialized and then later used by several
SoC implementations. However, the SDMC model never checks that the RAM
size has been actually set before being used. Do that at realize.

Signed-off-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Jamin_lin < jamin_lin@aspeedtech.com>
9 months agoaspeed: Deprecate the tacoma-bmc machine
Cédric Le Goater [Mon, 24 Jun 2024 17:29:18 +0000 (19:29 +0200)]
aspeed: Deprecate the tacoma-bmc machine

The tacoma-bmc machine was a board including an AST2600 SoC based BMC
and a witherspoon like OpenPOWER system. It was used for bring up of
the AST2600 SoC in labs. It can be easily replaced by the rainier-bmc
machine which is part of a real product offering.

Signed-off-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
9 months agohw/gpio/aspeed: Add reg_table_count to AspeedGPIOClass
Zheyu Ma [Thu, 20 Jun 2024 14:02:39 +0000 (16:02 +0200)]
hw/gpio/aspeed: Add reg_table_count to AspeedGPIOClass

ASan detected a global-buffer-overflow error in the aspeed_gpio_read()
function. This issue occurred when reading beyond the bounds of the
reg_table.

To enhance the safety and maintainability of the Aspeed GPIO code, this commit
introduces a reg_table_count member to the AspeedGPIOClass structure. This
change ensures that the size of the GPIO register table is explicitly tracked
and initialized, reducing the risk of errors if new register tables are
introduced in the future.

Reproducer:
cat << EOF | qemu-system-aarch64 -display none \
-machine accel=qtest, -m 512M -machine ast1030-evb -qtest stdio
readq 0x7e780272
EOF

ASAN log indicating the issue:
==2602930==ERROR: AddressSanitizer: global-buffer-overflow on address 0x55a5da29e128 at pc 0x55a5d700dc62 bp 0x7fff096c4e90 sp 0x7fff096c4e88
READ of size 2 at 0x55a5da29e128 thread T0
    #0 0x55a5d700dc61 in aspeed_gpio_read hw/gpio/aspeed_gpio.c:564:14
    #1 0x55a5d933f3ab in memory_region_read_accessor system/memory.c:445:11
    #2 0x55a5d92fba40 in access_with_adjusted_size system/memory.c:573:18
    #3 0x55a5d92f842c in memory_region_dispatch_read1 system/memory.c:1426:16
    #4 0x55a5d92f7b68 in memory_region_dispatch_read system/memory.c:1459:9
    #5 0x55a5d9376ad1 in flatview_read_continue_step system/physmem.c:2836:18
    #6 0x55a5d9376399 in flatview_read_continue system/physmem.c:2877:19
    #7 0x55a5d93775b8 in flatview_read system/physmem.c:2907:12

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2355
Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Andrew Jeffery <andrew@codeconstruct.com.au>