target-arm queue
Subsystems (5)
Hi; here's an arm pullreq. The big bits here are Fabiano's CONFIG_TCG=n patches and my set that deprecate -singlestep; other than that there's a collection of smaller bugfixes.
thanks
-- PMM
The following changes since commit 7c18f2d663521f1b31b821a13358ce38075eaf7d:
Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging (2023-04-29 23:07:17 +0100)
are available in the Git repository at:
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20230502-1
for you to fetch changes up to 0ab99e4252f21550f2c16f859cbcdd3cced9f8bf:
hw/net/allwinner-sun8i-emac: Correctly byteswap descriptor fields (2023-05-02 13:10:42 +0100)
----------------------------------------------------------------
* Support building Arm targets with CONFIG_TCG=no (ie KVM only)
* hw/net: npcm7xx_emc: set MAC in register space
* hw/arm/bcm2835_property: Implement "get command line" message
* Deprecate the '-singlestep' command line option in favour of '-one-insn-per-tb' and '-accel one-insn-per-tb=on'
* Deprecate 'singlestep' member of QMP StatusInfo struct
* docs/about/deprecated.rst: Add "since 7.1" tag to dtb-kaslr-seed deprecation
* hw/net/msf2-emac: Don't modify descriptor in-place in emac_store_desc()
* raspi, aspeed: Write bootloader code correctly on big-endian hosts
* hw/intc/allwinner-a10-pic: Fix bug on big-endian hosts
* Fix bug in A32 ERET on big-endian hosts that caused guest crash
* hw/sd/allwinner-sdhost: Correctly byteswap descriptor fields
* hw/net/allwinner-sun8i-emac: Correctly byteswap descriptor fields
----------------------------------------------------------------
Claudio Fontana (1):
target/arm: move cpu_tcg to tcg/cpu32.c
Cédric Le Goater (2):
hw/arm/boot: Make write_bootloader() public as arm_write_bootloader() hw/arm/aspeed: Use arm_write_bootloader() to write the bootloader
Daniel Bertalan (1):
hw/arm/bcm2835_property: Implement "get command line" message
Fabiano Rosas (11):
target/arm: Move cortex sysregs into a separate file target/arm: Remove dead code from cpu_max_set_sve_max_vq target/arm: Extract TCG -cpu max code into a function target/arm: Do not expose all -cpu max features to qtests target/arm: Move 64-bit TCG CPUs into tcg/
tests/qtest: Adjust and document query-cpu-model-expansion test for arm tests/qtest: Fix tests when no KVM or TCG are present tests/avocado: Pass parameters to migration test arm/Kconfig: Always select SEMIHOSTING when TCG is present arm/Kconfig: Do not build TCG-only boards on a KVM-only build tests/qtest: Restrict tpm-tis-i2c-test to CONFIG_TCG
Patrick Venture (1):
hw/net: npcm7xx_emc: set MAC in register space
Peter Maydell (18):
make one-insn-per-tb an accel option
softmmu: Don't use 'singlestep' global in QMP and HMP commands accel/tcg: Use one_insn_per_tb global instead of old singlestep global
linux-user: Add '-one-insn-per-tb' option equivalent to '-singlestep'
bsd-user: Add '-one-insn-per-tb' option equivalent to '-singlestep' Document that -singlestep command line option is deprecated accel/tcg: Report one-insn-per-tb in 'info jit', not 'info status'
hmp: Add 'one-insn-per-tb' command equivalent to 'singlestep' qapi/run-state.json: Fix missing newline at end of file
qmp: Deprecate 'singlestep' member of StatusInfo docs/about/deprecated.rst: Add "since 7.1" tag to dtb-kaslr-seed deprecation hw/net/msf2-emac: Don't modify descriptor in-place in emac_store_desc() hw/arm/raspi: Use arm_write_bootloader() to write boot code hw/intc/allwinner-a10-pic: Don't use set_bit()/clear_bit() target/arm: Define and use new load_cpu_field_low32() target/arm: Add compile time asserts to load/store_cpu_field macros hw/sd/allwinner-sdhost: Correctly byteswap descriptor fields hw/net/allwinner-sun8i-emac: Correctly byteswap descriptor fields
Philippe Mathieu-Daudé (1):
gitlab-ci: Check building KVM-only aarch64 target
docs/about/deprecated.rst | 43 +-
docs/user/main.rst | 14 +-
configs/devices/aarch64-softmmu/default.mak | 4 -
configs/devices/arm-softmmu/default.mak | 39 --
qapi/run-state.json | 16 +-
accel/tcg/internal.h | 2 +
include/exec/cpu-common.h | 2 -
include/hw/arm/boot.h | 49 ++
include/hw/misc/bcm2835_property.h | 1 +
include/monitor/hmp.h | 2 +-
target/arm/cpregs.h | 6 +
target/arm/internals.h | 10 +-
target/arm/translate-a32.h | 24 +-
accel/tcg/cpu-exec.c | 2 +-
accel/tcg/monitor.c | 14 +
accel/tcg/tcg-all.c | 23 +
bsd-user/main.c | 14 +-
hw/arm/aspeed.c | 38 +-
hw/arm/bcm2835_peripherals.c | 2 +
hw/arm/bcm2836.c | 2 +
hw/arm/boot.c | 35 +-
hw/arm/raspi.c | 66 +-
hw/arm/virt.c | 6 +-
hw/intc/allwinner-a10-pic.c | 7 +-
hw/misc/bcm2835_property.c | 13 +-
hw/net/allwinner-sun8i-emac.c | 22 +-
hw/net/msf2-emac.c | 16 +-
hw/net/npcm7xx_emc.c | 32 +-
hw/sd/allwinner-sdhost.c | 31 +-
linux-user/main.c | 18 +-
softmmu/globals.c | 1 -
softmmu/runstate-hmp-cmds.c | 25 +-
softmmu/runstate.c | 10 +-
softmmu/vl.c | 17 +-
target/arm/cortex-regs.c | 69 ++
target/arm/cpu64.c | 702 +-------------------
target/arm/{cpu_tcg.c => tcg/cpu32.c} | 72 +-
target/arm/tcg/cpu64.c | 723 +++++++++++++++++++++
target/arm/tcg/translate.c | 4 +-
tests/qtest/arm-cpu-features.c | 20 +-
tests/qtest/bios-tables-test.c | 11 +-
tests/qtest/boot-serial-test.c | 5 +
tests/qtest/migration-test.c | 9 +-
tests/qtest/pxe-test.c | 8 +-
tests/qtest/test-hmp.c | 1 +
tests/qtest/vmgenid-test.c | 9 +-
.gitlab-ci.d/crossbuilds.yml | 11 +
.../custom-runners/ubuntu-22.04-aarch64.yml | 4 -
hmp-commands.hx | 25 +-
hw/arm/Kconfig | 43 +-
qemu-options.hx | 12 +-
target/arm/Kconfig | 7 +
target/arm/meson.build | 2 +-
target/arm/tcg/meson.build | 2 +
tcg/tci/README | 2 +-
tests/avocado/migration.py | 83 ++-
tests/qtest/meson.build | 3 +-
57 files changed, 1449 insertions(+), 984 deletions(-)
create mode 100644 target/arm/cortex-regs.c
rename target/arm/{cpu_tcg.c => tcg/cpu32.c} (93%)
create mode 100644 target/arm/tcg/cpu64.c[PULL 09/35] tests/avocado: Pass parameters to migration test
From: Fabiano Rosas <[email protected]>
The migration tests are currently broken for an aarch64 host because the tests pass no 'machine' and 'cpu' options on the QEMU command line.
Add a separate class to each architecture so that we can specify 'machine' and 'cpu' options instead of relying on defaults.
Add a skip decorator to keep the current behavior of only running migration tests when the qemu target matches the host architecture.
Message-id: [email protected]
--- tests/avocado/migration.py | 83 +++++++++++++++++++++++++++++++++++--- 1 file changed, 78 insertions(+), 5 deletions(-)
tests/avocado/migration.py +78 -5
@@ -11,6 +11,8 @@ import tempfile +import os + from avocado_qemu import QemuSystemTest from avocado import skipUnless
@@ -19,7 +21,7 @@ from avocado.utils.path import find_command -class Migration(QemuSystemTest): +class MigrationTest(QemuSystemTest): """ :avocado: tags=migration """
@@ -62,20 +64,91 @@ def _get_free_port(self): self.cancel('Failed to find a free port') return port - - def test_migration_with_tcp_localhost(self): + def migration_with_tcp_localhost(self): dest_uri = 'tcp:localhost:%u' % self._get_free_port() self.do_migrate(dest_uri) - def test_migration_with_unix(self): + def migration_with_unix(self): with tempfile.TemporaryDirectory(prefix='socket_') as socket_path: dest_uri = 'unix:%s/qemu-test.sock' % socket_path self.do_migrate(dest_uri) @skipUnless(find_command('nc', default=False), "'nc' command not found") - def test_migration_with_exec(self): + def migration_with_exec(self): """The test works for both netcat-traditional and netcat-openbsd packages.""" free_port = self._get_free_port() dest_uri = 'exec:nc -l localhost %u' % free_port src_uri = 'exec:nc localhost %u' % free_port self.do_migrate(dest_uri, src_uri) + + +@skipUnless('aarch64' in os.uname()[4], "host != target") +class Aarch64(MigrationTest): + """ + :avocado: tags=arch:aarch64 + :avocado: tags=machine:virt + :avocado: tags=cpu:max + """ + + def test_migration_with_tcp_localhost(self): + self.migration_with_tcp_localhost() + + def test_migration_with_unix(self): + self.migration_with_unix() + + def test_migration_with_exec(self): + self.migration_with_exec() + + +@skipUnless('x86_64' in os.uname()[4], "host != target") +class X86_64(MigrationTest): + """ + :avocado: tags=arch:x86_64 + :avocado: tags=machine:pc + :avocado: tags=cpu:qemu64 + """ + + def test_migration_with_tcp_localhost(self): + self.migration_with_tcp_localhost() + + def test_migration_with_unix(self): + self.migration_with_unix() + + def test_migration_with_exec(self): + self.migration_with_exec() + + +@skipUnless('ppc64le' in os.uname()[4], "host != target") +class PPC64(MigrationTest): + """ + :avocado: tags=arch:ppc64 + :avocado: tags=machine:pseries + :avocado: tags=cpu:power9_v2.0 + """ + + def test_migration_with_tcp_localhost(self): + self.migration_with_tcp_localhost() + + def test_migration_with_unix(self): + self.migration_with_unix() + + def test_migration_with_exec(self): + self.migration_with_exec() + + +@skipUnless('s390x' in os.uname()[4], "host != target") +class S390X(MigrationTest): + """ + :avocado: tags=arch:s390x + :avocado: tags=machine:s390-ccw-virtio + :avocado: tags=cpu:qemu + """ + + def test_migration_with_tcp_localhost(self): + self.migration_with_tcp_localhost() + + def test_migration_with_unix(self): + self.migration_with_unix() + + def test_migration_with_exec(self): + self.migration_with_exec()
Signature · 1 line
2.34.1
[PULL 01/35] target/arm: Move cortex sysregs into a separate file
In reply to Peter MaydellFrom: Fabiano Rosas <[email protected]>
The file cpu_tcg.c is about to be moved into the tcg/ directory, so move the register definitions into a new file.
Also move the function declaration to the more appropriate cpregs.h.
Message-id: [email protected]
--- target/arm/cpregs.h | 6 ++++ target/arm/internals.h | 6 ---- target/arm/cortex-regs.c | 69 ++++++++++++++++++++++++++++++++++++++++ target/arm/cpu64.c | 1 + target/arm/cpu_tcg.c | 59 ---------------------------------- target/arm/meson.build | 1 + 6 files changed, 77 insertions(+), 65 deletions(-) create mode 100644 target/arm/cortex-regs.c
target/arm/cpregs.h +6 -0
@@ -1071,4 +1071,10 @@ static inline bool arm_cpreg_in_idspace(const ARMCPRegInfo *ri) ri->crn, ri->crm); } +#ifdef CONFIG_USER_ONLY +static inline void define_cortex_a72_a57_a53_cp_reginfo (ARMCPU *cpu) { } +#else +void define_cortex_a72_a57_a53_cp_reginfo (ARMCPU *cpu); +#endif +#endif /* TARGET_ARM_CPREGS_H */
target/arm/internals.h +0 -6
@@ -1376,12 +1376,6 @@ uint32_t arm_v7m_mrs_control(CPUARMState *env, uint32_t secure);uint32_t *arm_v7m_get_sp_ptr (CPUARMState *env,bool secure,bool threadmode,bool spsel); -#ifdef CONFIG_USER_ONLY -static inline void define_cortex_a72_a57_a53_cp_reginfo (ARMCPU *cpu) { } -#else -void define_cortex_a72_a57_a53_cp_reginfo (ARMCPU *cpu); -#endif -bool el_is_in_host (CPUARMState *env,int el);void aa32_max_features (ARMCPU *cpu);
target/arm/cortex-regs.c new file +69 -0
69 lines not on this page · raw message
target/arm/cpu64.c +1 -0
@@ -30,6 +30,7 @@#include "qapi/visitor.h" #include "hw/qdev-properties.h" #include "internals.h" +#include "cpregs.h" static void aarch64_a35_initfn (Object *obj) {
target/arm/cpu_tcg.c +0 -59
65 lines not on this page · raw message
target/arm/meson.build +1 -0
@@ -21,6 +21,7 @@ arm_softmmu_ss.add(files( 'arch_dump.c', 'arm-powerctl.c', 'arm-qmp-cmds.c', + 'cortex-regs.c', 'machine.c', 'ptw.c', ))
Signature · 1 line
2.34.1
[PULL 08/35] tests/qtest: Fix tests when no KVM or TCG are present
In reply to Peter MaydellFrom: Fabiano Rosas <[email protected]>
It is possible to have a build with both TCG and KVM disabled due to Xen requiring the i386 and x86_64 binaries to be present in an aarch64 host.
If we build with --disable-tcg on the aarch64 host, we will end-up with a QEMU binary (x86) that does not support TCG nor KVM.
Skip tests that crash or hang in the above scenario. Do not include any test cases if TCG and KVM are missing.
Make sure that calls to qtest_has_accel are placed after g_test_init in similar fashion to commit ae4b01b349 ("tests: Ensure TAP version is printed before other messages") to avoid TAP parsing errors.
Message-id: [email protected]
--- tests/qtest/bios-tables-test.c | 11 +++++++++-- tests/qtest/boot-serial-test.c | 5 +++++ tests/qtest/migration-test.c | 9 ++++++++- tests/qtest/pxe-test.c | 8 +++++++- tests/qtest/vmgenid-test.c | 9 +++++++-- 5 files changed, 36 insertions(+), 6 deletions(-)
tests/qtest/bios-tables-test.c +9 -2
@@ -2045,8 +2045,7 @@ static void test_acpi_virt_oem_fields(void)int main (int argc,char *argv[]) {const char *arch =qtest_get_arch (); -const bool has_kvm =qtest_has_accel ("kvm" ); -const bool has_tcg =qtest_has_accel ("tcg" ); +bool has_kvm, has_tcg;char *v_env =getenv ("V" );int ret;
@@ -2056,6 +2055,14 @@ int main(int argc, char *argv[])g_test_init (&argc, &argv,NULL ); + has_kvm =qtest_has_accel ("kvm" ); + has_tcg =qtest_has_accel ("tcg" ); + +if (!has_tcg && !has_kvm) { +g_test_skip ("No KVM or TCG accelerator available" ); +return 0 ; + } +if (strcmp (arch,"i386" ) ==0 ||strcmp (arch,"x86_64" ) ==0 ) { ret =boot_sector_init (disk);if (ret) {
tests/qtest/boot-serial-test.c +5 -0
@@ -287,6 +287,11 @@ int main(int argc, char *argv[])g_test_init (&argc, &argv,NULL ); +if (!qtest_has_accel ("tcg" ) && !qtest_has_accel ("kvm" )) { +g_test_skip ("No KVM or TCG accelerator available" ); +return 0 ; + } +for (i =0 ; tests[i].arch !=NULL ; i++) {if (g_str_equal (arch, tests[i].arch) &&qtest_has_machine (tests[i].machine)) {
tests/qtest/migration-test.c +8 -1
@@ -2477,7 +2477,7 @@ static bool kvm_dirty_ring_supported(void)int main (int argc,char **argv) { -bool has_kvm; +bool has_kvm, has_tcg;bool has_uffd;const char *arch;g_autoptr (GError) err =NULL ;
@@ -2486,6 +2486,13 @@ int main(int argc, char **argv)g_test_init (&argc, &argv,NULL ); has_kvm =qtest_has_accel ("kvm" ); + has_tcg =qtest_has_accel ("tcg" ); + +if (!has_tcg && !has_kvm) { +g_test_skip ("No KVM or TCG accelerator available" ); +return 0 ; + } + has_uffd =ufd_version_check (); arch =qtest_get_arch ();
tests/qtest/pxe-test.c +7 -1
@@ -131,11 +131,17 @@ int main(int argc, char *argv[])int ret;const char *arch =qtest_get_arch (); +g_test_init (&argc, &argv,NULL ); + +if (!qtest_has_accel ("tcg" ) && !qtest_has_accel ("kvm" )) { +g_test_skip ("No KVM or TCG accelerator available" ); +return 0 ; + } + ret =boot_sector_init (disk);if (ret)return ret; -g_test_init (&argc, &argv,NULL );if (strcmp (arch,"i386" ) ==0 ||strcmp (arch,"x86_64" ) ==0 ) {test_batch (x86_tests, false);
tests/qtest/vmgenid-test.c +7 -2
@@ -165,13 +165,18 @@ int main(int argc, char **argv) {int ret; +g_test_init (&argc, &argv,NULL ); + +if (!qtest_has_accel ("tcg" ) && !qtest_has_accel ("kvm" )) { +g_test_skip ("No KVM or TCG accelerator available" ); +return 0 ; + } + ret =boot_sector_init (disk);if (ret) {return ret; } -g_test_init (&argc, &argv,NULL ); -qtest_add_func ("/vmgenid/vmgenid/set-guid" , vmgenid_set_guid_test); qtest_add_func("/vmgenid/vmgenid/set-guid-auto",
Signature · 1 line
2.34.1
[PULL 12/35] tests/qtest: Restrict tpm-tis-i2c-test to CONFIG_TCG
In reply to Peter MaydellFrom: Fabiano Rosas <[email protected]>
The test set -accel tcg, so restrict it to when TCG is present.
Message-id: [email protected]
--- tests/qtest/meson.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tests/qtest/meson.build +2 -1
@@ -213,7 +213,8 @@ qtests_aarch64 = \ ['tpm-tis-device-test', 'tpm-tis-device-swtpm-test'] : []) + \ (config_all_devices.has_key('CONFIG_XLNX_ZYNQMP_ARM') ? ['xlnx-can-test', 'fuzz-xlnx-dp-test'] : []) + \ (config_all_devices.has_key('CONFIG_RASPI') ? ['bcm2835-dma-test'] : []) + \ - (config_all_devices.has_key('CONFIG_TPM_TIS_I2C') ? ['tpm-tis-i2c-test'] : []) + \ + (config_all.has_key('CONFIG_TCG') and \ + config_all_devices.has_key('CONFIG_TPM_TIS_I2C') ? ['tpm-tis-i2c-test'] : []) + \ ['arm-cpu-features', 'numa-test', 'boot-serial-test',
Signature · 1 line
2.34.1
[PULL 34/35] hw/sd/allwinner-sdhost: Correctly byteswap descriptor fields
In reply to Peter MaydellIn allwinner_sdhost_process_desc() we just read directly from guest memory into a host TransferDescriptor struct and back. This only works on little-endian hosts. Abstract the reading and writing of descriptors into functions that handle the byte-swapping so that TransferDescriptor structs as seen by the rest of the code are always in host-order.
This fixes a failure of one of the avocado tests on s390.
Message-id: [email protected]
--- hw/sd/allwinner-sdhost.c | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-)
hw/sd/allwinner-sdhost.c +26 -5
@@ -302,6 +302,30 @@ static void allwinner_sdhost_auto_stop(AwSdHostState *s) } } +static void read_descriptor (AwSdHostState *s,hwaddr desc_addr, +TransferDescriptor *desc) +{ +uint32_t desc_words[4 ]; +dma_memory_read (&s->dma_as, desc_addr, &desc_words,sizeof (desc_words), +MEMTXATTRS_UNSPECIFIED ); + desc->status =le32_to_cpu (desc_words[0 ]); + desc->size =le32_to_cpu (desc_words[1 ]); + desc->addr =le32_to_cpu (desc_words[2 ]); + desc->next =le32_to_cpu (desc_words[3 ]); +} + +static void write_descriptor (AwSdHostState *s,hwaddr desc_addr, +const TransferDescriptor *desc) +{ +uint32_t desc_words[4 ]; + desc_words[0 ] =cpu_to_le32 (desc->status); + desc_words[1 ] =cpu_to_le32 (desc->size); + desc_words[2 ] =cpu_to_le32 (desc->addr); + desc_words[3 ] =cpu_to_le32 (desc->next); +dma_memory_write (&s->dma_as, desc_addr, &desc_words,sizeof (desc_words), +MEMTXATTRS_UNSPECIFIED ); +} + static uint32_t allwinner_sdhost_process_desc(AwSdHostState *s, hwaddr desc_addr, TransferDescriptor *desc,
@@ -312,9 +336,7 @@ static uint32_t allwinner_sdhost_process_desc(AwSdHostState *s,uint32_t num_bytes = max_bytes;uint8_t buf[1024 ]; -/* Read descriptor */ -dma_memory_read (&s->dma_as, desc_addr, desc,sizeof (*desc), -MEMTXATTRS_UNSPECIFIED ); +read_descriptor (s, desc_addr, desc);if (desc->size ==0 ) { desc->size = klass->max_desc_size; }else if (desc->size > klass->max_desc_size) {
@@ -356,8 +378,7 @@ static uint32_t allwinner_sdhost_process_desc(AwSdHostState *s,/* Clear hold flag and flush descriptor */ desc->status &= ~DESC_STATUS_HOLD ; -dma_memory_write (&s->dma_as, desc_addr, desc,sizeof (*desc), -MEMTXATTRS_UNSPECIFIED ); +write_descriptor (s, desc_addr, desc);return num_done; }
Signature · 1 line
2.34.1
[PULL 10/35] arm/Kconfig: Always select SEMIHOSTING when TCG is present
In reply to Peter MaydellFrom: Fabiano Rosas <[email protected]>
We are about to enable the build without TCG, so CONFIG_SEMIHOSTING and CONFIG_ARM_COMPATIBLE_SEMIHOSTING cannot be unconditionally set in default.mak anymore. So reflect the change in a Kconfig.
Instead of using semihosting/Kconfig, use a target-specific file, so that the change doesn't affect other architectures which might implement semihosting in a way compatible with KVM.
The selection from ARM_v7M needs to be removed to avoid a cycle during parsing.
Message-id: [email protected]
--- configs/devices/arm-softmmu/default.mak | 2 -- hw/arm/Kconfig | 1 - target/arm/Kconfig | 7 +++++++ 3 files changed, 7 insertions(+), 3 deletions(-)
configs/devices/arm-softmmu/default.mak +0 -2
@@ -40,6 +40,4 @@ CONFIG_MICROBIT=y CONFIG_FSL_IMX25=y CONFIG_FSL_IMX7=y CONFIG_FSL_IMX6UL=y -CONFIG_SEMIHOSTING=y -CONFIG_ARM_COMPATIBLE_SEMIHOSTING=y CONFIG_ALLWINNER_H3=y
hw/arm/Kconfig +0 -1
@@ -317,7 +317,6 @@ config ARM_V7M # currently v7M must be included in a TCG build due to translate.c default y if TCG && (ARM || AARCH64) select PTIMER - select ARM_COMPATIBLE_SEMIHOSTING config ALLWINNER_A10 bool
target/arm/Kconfig +7 -0
@@ -4,3 +4,10 @@ config ARM config AARCH64 bool select ARM + +# This config exists just so we can make SEMIHOSTING default when TCG +# is selected without also changing it for other architectures. +config ARM_SEMIHOSTING + bool + default y if TCG && ARM + select ARM_COMPATIBLE_SEMIHOSTING
Signature · 1 line
2.34.1
[PULL 13/35] gitlab-ci: Check building KVM-only aarch64 target
In reply to Peter MaydellFrom: Philippe Mathieu-Daudé <[email protected]>
Add a manual new job to cross-build the aarch64 target with only the KVM accelerator enabled (in particular, no TCG).
Re-enable running the similar job on the project Aarch64 custom runner.
Message-id: [email protected]
--- .gitlab-ci.d/crossbuilds.yml | 11 +++++++++++ .gitlab-ci.d/custom-runners/ubuntu-22.04-aarch64.yml | 4 ---- 2 files changed, 11 insertions(+), 4 deletions(-)
.gitlab-ci.d/crossbuilds.yml +11 -0
@@ -196,3 +196,14 @@ cross-arm64-xen-only: IMAGE: debian-arm64-cross ACCEL: xen EXTRA_CONFIGURE_OPTS: --disable-tcg --disable-kvm + +# Similar job is run by qemu-project's custom runner by default +cross-arm64-kvm-only: + extends: .cross_accel_build_job + needs: + job: arm64-debian-cross-container + variables: + QEMU_JOB_OPTIONAL: 1 + IMAGE: debian-arm64-cross + ACCEL: kvm + EXTRA_CONFIGURE_OPTS: --disable-tcg --disable-xen --without-default-devices
.gitlab-ci.d/custom-runners/ubuntu-22.04-aarch64.yml +0 -4
@@ -115,11 +115,7 @@ ubuntu-22.04-aarch64-notcg: - aarch64 rules: - if: '$CI_PROJECT_NAMESPACE == "qemu-project" && $CI_COMMIT_BRANCH =~ /^staging/' - when: manual - allow_failure: true - if: "$AARCH64_RUNNER_AVAILABLE" - when: manual - allow_failure: true script: - mkdir build - cd build
Signature · 1 line
2.34.1
[PULL 35/35] hw/net/allwinner-sun8i-emac: Correctly byteswap descriptor fields
In reply to Peter MaydellIn allwinner-sun8i-emac we just read directly from guest memory into a host FrameDescriptor struct and back. This only works on little-endian hosts. Reading and writing of descriptors is already abstracted into functions; make those functions also handle the byte-swapping so that TransferDescriptor structs as seen by the rest of the code are always in host-order, and fix two places that were doing ad-hoc descriptor reading without using the functions.
Message-id: [email protected]
--- hw/net/allwinner-sun8i-emac.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)
hw/net/allwinner-sun8i-emac.c +15 -7
@@ -350,8 +350,13 @@ static void allwinner_sun8i_emac_get_desc(AwSun8iEmacState *s,FrameDescriptor *desc, uint32_t phys_addr) { - dma_memory_read(&s->dma_as, phys_addr, desc, sizeof(*desc), + uint32_t desc_words[4]; +dma_memory_read (&s->dma_as, phys_addr, &desc_words,sizeof (desc_words),MEMTXATTRS_UNSPECIFIED ); + desc->status =le32_to_cpu (desc_words[0 ]); + desc->status2 =le32_to_cpu (desc_words[1 ]); + desc->addr =le32_to_cpu (desc_words[2 ]); + desc->next =le32_to_cpu (desc_words[3 ]); } static uint32_t allwinner_sun8i_emac_next_desc(AwSun8iEmacState *s,
@@ -400,10 +405,15 @@ static uint32_t allwinner_sun8i_emac_tx_desc(AwSun8iEmacState *s, }static void allwinner_sun8i_emac_flush_desc (AwSun8iEmacState *s, -FrameDescriptor *desc, +const FrameDescriptor *desc,uint32_t phys_addr) { -dma_memory_write (&s->dma_as, phys_addr, desc,sizeof (*desc), +uint32_t desc_words[4 ]; + desc_words[0 ] =cpu_to_le32 (desc->status); + desc_words[1 ] =cpu_to_le32 (desc->status2); + desc_words[2 ] =cpu_to_le32 (desc->addr); + desc_words[3 ] =cpu_to_le32 (desc->next); +dma_memory_write (&s->dma_as, phys_addr, &desc_words,sizeof (desc_words),MEMTXATTRS_UNSPECIFIED ); }
@@ -638,8 +648,7 @@ static uint64_t allwinner_sun8i_emac_read(void *opaque, hwaddr offset,break ;case REG_TX_CUR_BUF :/* Transmit Current Buffer */ if (s->tx_desc_curr !=0 ) { -dma_memory_read (&s->dma_as, s->tx_desc_curr, &desc,sizeof (desc), -MEMTXATTRS_UNSPECIFIED ); +allwinner_sun8i_emac_get_desc (s, &desc, s->tx_desc_curr); value = desc.addr; }else { value =0 ;
@@ -652,8 +661,7 @@ static uint64_t allwinner_sun8i_emac_read(void *opaque, hwaddr offset,break ;case REG_RX_CUR_BUF :/* Receive Current Buffer */ if (s->rx_desc_curr !=0 ) { -dma_memory_read (&s->dma_as, s->rx_desc_curr, &desc,sizeof (desc), -MEMTXATTRS_UNSPECIFIED ); +allwinner_sun8i_emac_get_desc (s, &desc, s->rx_desc_curr); value = desc.addr; }else { value =0 ;
Signature · 1 line
2.34.1
[PULL 24/35] qapi/run-state.json: Fix missing newline at end of file
In reply to Peter MaydellThe run-state.json file is missing a trailing newline; add it.
Message-id: [email protected]
--- qapi/run-state.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
qapi/run-state.json +1 -1
@@ -666,4 +666,4 @@ # Since: 7.2 ## { 'enum': 'NotifyVmexitOption', - 'data': [ 'run', 'internal-error', 'disable' ] } + 'data': [ 'run', 'internal-error', 'disable' ] }
Signature · 1 line
2.34.1
[PULL 04/35] target/arm: Do not expose all -cpu max features to qtests
In reply to Peter MaydellFrom: Fabiano Rosas <[email protected]>
We're about to move the TCG-only -cpu max configuration code under CONFIG_TCG. To be able to do that we need to make sure the qtests still have some cpu configured even when no other accelerator is available.
Delineate now what is used with TCG-only and what is also used with qtests to make the subsequent patches cleaner.
Message-id: [email protected]
--- target/arm/cpu64.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
target/arm/cpu64.c +9 -3
@@ -25,6 +25,8 @@#include "qemu/module.h" #include "sysemu/kvm.h" #include "sysemu/hvf.h" +#include "sysemu/qtest.h" +#include "sysemu/tcg.h" #include "kvm_arm.h" #include "hvf_arm.h" #include "qapi/visitor.h"
@@ -1365,10 +1367,14 @@ static void aarch64_max_initfn(Object *obj)return ; } -/* '-cpu max' for TCG: we currently do this as "A57 with extra things" */ +if (tcg_enabled () ||qtest_enabled ()) { +aarch64_a57_initfn (obj); + } -aarch64_a57_initfn (obj); -aarch64_max_tcg_initfn (obj); +/* '-cpu max' for TCG: we currently do this as "A57 with extra things" */ +if (tcg_enabled ()) { +aarch64_max_tcg_initfn (obj); + } }static const ARMCPUInfo aarch64_cpus[] = {
Signature · 1 line
2.34.1
[PULL 14/35] hw/net: npcm7xx_emc: set MAC in register space
In reply to Peter MaydellFrom: Patrick Venture <[email protected]>
The MAC address set from Qemu wasn't being saved into the register space.
--- hw/net/npcm7xx_emc.c | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-)
hw/net/npcm7xx_emc.c +25 -7
@@ -98,6 +98,8 @@ static const char *emc_reg_name(int regno)static void emc_reset (NPCM7xxEMCState *emc) { +uint32_t value; +trace_npcm7xx_emc_reset (emc->emc_num);memset (&emc->regs[0 ],0 ,sizeof (emc->regs));
@@ -112,6 +114,16 @@ static void emc_reset(NPCM7xxEMCState *emc) emc->tx_active = false; emc->rx_active = false; + +/* Set the MAC address in the register space. */ + value = (emc->conf.macaddr.a[0 ] <<24 ) | + (emc->conf.macaddr.a[1 ] <<16 ) | + (emc->conf.macaddr.a[2 ] <<8 ) | + emc->conf.macaddr.a[3 ]; + emc->regs[REG_CAMM_BASE ] = value; + + value = (emc->conf.macaddr.a[4 ] <<24 ) | (emc->conf.macaddr.a[5 ] <<16 ); + emc->regs[REG_CAML_BASE ] = value; }static void npcm7xx_emc_reset (DeviceState *dev)
@@ -432,13 +444,25 @@ static bool emc_receive_filter1(NPCM7xxEMCState *emc, const uint8_t *buf, }case ETH_PKT_UCAST : {bool matches; +uint32_t value; +struct MACAddr mac;if (emc->regs[REG_CAMCMR ] ®_CAMCMR_AUP ) {return true; } + + value = emc->regs[REG_CAMM_BASE ]; + mac.a[0 ] = value >>24 ; + mac.a[1 ] = value >>16 ; + mac.a[2 ] = value >>8 ; + mac.a[3 ] = value >>0 ; + value = emc->regs[REG_CAML_BASE ]; + mac.a[4 ] = value >>24 ; + mac.a[5 ] = value >>16 ; + matches = ((emc->regs[REG_CAMCMR ] ®_CAMCMR_ECMP ) &&/* We only support one CAM register, CAM0. */ (emc->regs[REG_CAMEN ] & (1 <<0 )) && -memcmp (buf, emc->conf.macaddr.a,ETH_ALEN ) ==0 ); +memcmp (buf, mac.a,ETH_ALEN ) ==0 );if (emc->regs[REG_CAMCMR ] ®_CAMCMR_CCAM ) { *fail_reason ="MACADDR matched, comparison complemented" ;return !matches;
@@ -661,15 +685,9 @@ static void npcm7xx_emc_write(void *opaque, hwaddr offset,break ;case REG_CAMM_BASE +0 : emc->regs[reg] = value; - emc->conf.macaddr.a[0 ] = value >>24 ; - emc->conf.macaddr.a[1 ] = value >>16 ; - emc->conf.macaddr.a[2 ] = value >>8 ; - emc->conf.macaddr.a[3 ] = value >>0 ;break ;case REG_CAML_BASE +0 : emc->regs[reg] = value; - emc->conf.macaddr.a[4 ] = value >>24 ; - emc->conf.macaddr.a[5 ] = value >>16 ;break ;case REG_MCMDR : {uint32_t prev;
Signature · 1 line
2.34.1
[PULL 19/35] linux-user: Add '-one-insn-per-tb' option equivalent to '-singlestep'
In reply to Peter MaydellThe '-singlestep' option is confusing, because it doesn't actually have anything to do with single-stepping the CPU. What it does do is force TCG emulation to put one guest instruction in each TB, which can be useful in some situations.
Create a new command line argument -one-insn-per-tb, so we can document that -singlestep is just a deprecated synonym for it, and eventually perhaps drop it.
Message-id: [email protected]
--- docs/user/main.rst | 7 ++++++- linux-user/main.c | 9 ++++++--- 2 files changed, 12 insertions(+), 4 deletions(-)
docs/user/main.rst +6 -1
@@ -93,8 +93,13 @@ Debug options: ``-g port`` Wait gdb connection to port +``-one-insn-per-tb`` + Run the emulation with one guest instruction per translation block. + This slows down emulation a lot, but can be useful in some situations, + such as when trying to analyse the logs produced by the ``-d`` option. + ``-singlestep`` - Run the emulation in single step mode. + This is a deprecated synonym for the ``-one-insn-per-tb`` option. Environment variables:
linux-user/main.c +6 -3
@@ -409,7 +409,7 @@ static void handle_arg_reserved_va(const char *arg) reserved_va = val ? val -1 :0 ; } -static void handle_arg_singlestep (const char *arg) +static void handle_arg_one_insn_per_tb (const char *arg) { opt_one_insn_per_tb = true; }
@@ -500,8 +500,11 @@ static const struct qemu_argument arg_table[] = { "logfile", "write logs to 'logfile' (default stderr)"}, {"p" ,"QEMU_PAGESIZE" , true, handle_arg_pagesize, "pagesize", "set the host page size to 'pagesize'"}, - {"singlestep", "QEMU_SINGLESTEP", false, handle_arg_singlestep, - "", "run in singlestep mode"}, + {"one-insn-per-tb", +"QEMU_ONE_INSN_PER_TB" , false, handle_arg_one_insn_per_tb, + "", "run with one guest instruction per emulated TB"}, + {"singlestep", "QEMU_SINGLESTEP", false, handle_arg_one_insn_per_tb, + "", "deprecated synonym for -one-insn-per-tb"}, {"strace", "QEMU_STRACE", false, handle_arg_strace, "", "log system calls"}, {"seed", "QEMU_RAND_SEED", true, handle_arg_seed,
Signature · 1 line
2.34.1
[PULL 02/35] target/arm: Remove dead code from cpu_max_set_sve_max_vq
In reply to Peter MaydellFrom: Fabiano Rosas <[email protected]>
The sve-max-vq property has been removed from the -cpu max used with KVM, so code under kvm_enabled in cpu_max_set_sve_max_vq is not reachable.
Message-id: [email protected]
--- target/arm/cpu64.c | 6 ------ 1 file changed, 6 deletions(-)
target/arm/cpu64.c +0 -6
@@ -336,12 +336,6 @@ static void cpu_max_set_sve_max_vq(Object *obj, Visitor *v, const char *name,return ; } -if (kvm_enabled () && !kvm_arm_sve_supported ()) { -error_setg (errp,"cannot set sve-max-vq" ); -error_append_hint (errp,"SVE not supported by KVM on this host\n" ); -return ; - } -if (max_vq ==0 || max_vq >ARM_MAX_VQ ) {error_setg (errp,"unsupported SVE vector length" ); error_append_hint(errp, "Valid sve-max-vq in range [1-%d]\n",
Signature · 1 line
2.34.1
[PULL 26/35] docs/about/deprecated.rst: Add "since 7.1" tag to dtb-kaslr-seed deprecation
In reply to Peter MaydellIn commit 5242876f37ca we deprecated the dtb-kaslr-seed property of the virt board, but forgot the "since n.n" tag in the documentation of this in deprecated.rst.
This deprecation note first appeared in the 7.1 release, so retrospectively add the correct "since 7.1" annotation to it.
Message-id: [email protected]
--- docs/about/deprecated.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
docs/about/deprecated.rst +2 -2
@@ -258,8 +258,8 @@ Use the more generic event ``DEVICE_UNPLUG_GUEST_ERROR`` instead. System emulator machines ------------------------ -Arm ``virt`` machine ``dtb-kaslr-seed`` property -'''''''''''''''''''''''''''''''''''''''''''''''' +Arm ``virt`` machine ``dtb-kaslr-seed`` property (since 7.1) +'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' The ``dtb-kaslr-seed`` property on the ``virt`` board has been deprecated; use the new name ``dtb-randomness`` instead. The new name
Signature · 1 line
2.34.1
[PULL 11/35] arm/Kconfig: Do not build TCG-only boards on a KVM-only build
In reply to Peter MaydellFrom: Fabiano Rosas <[email protected]>
Move all the CONFIG_FOO=y from default.mak into "default y if TCG" statements in Kconfig. That way they won't be selected when CONFIG_TCG=n.
I'm leaving CONFIG_ARM_VIRT in default.mak because it allows us to keep the two default.mak files not empty and keep aarch64-default.mak including arm-default.mak. That way we don't surprise anyone that's used to altering these files.
With this change we can start building with --disable-tcg.
Message-id: [email protected]
--- configs/devices/aarch64-softmmu/default.mak | 4 -- configs/devices/arm-softmmu/default.mak | 37 ------------------ hw/arm/Kconfig | 42 ++++++++++++++++++++- 3 files changed, 41 insertions(+), 42 deletions(-)
configs/devices/aarch64-softmmu/default.mak +0 -4
@@ -2,7 +2,3 @@ # We support all the 32 bit boards so need all their config include ../arm-softmmu/default.mak - -CONFIG_XLNX_ZYNQMP_ARM=y -CONFIG_XLNX_VERSAL=y -CONFIG_SBSA_REF=y
configs/devices/arm-softmmu/default.mak +0 -37
@@ -4,40 +4,3 @@ # CONFIG_TEST_DEVICES=n CONFIG_ARM_VIRT=y -CONFIG_CUBIEBOARD=y -CONFIG_EXYNOS4=y -CONFIG_HIGHBANK=y -CONFIG_INTEGRATOR=y -CONFIG_FSL_IMX31=y -CONFIG_MUSICPAL=y -CONFIG_MUSCA=y -CONFIG_CHEETAH=y -CONFIG_SX1=y -CONFIG_NSERIES=y -CONFIG_STELLARIS=y -CONFIG_STM32VLDISCOVERY=y -CONFIG_REALVIEW=y -CONFIG_VERSATILE=y -CONFIG_VEXPRESS=y -CONFIG_ZYNQ=y -CONFIG_MAINSTONE=y -CONFIG_GUMSTIX=y -CONFIG_SPITZ=y -CONFIG_TOSA=y -CONFIG_Z2=y -CONFIG_NPCM7XX=y -CONFIG_COLLIE=y -CONFIG_ASPEED_SOC=y -CONFIG_NETDUINO2=y -CONFIG_NETDUINOPLUS2=y -CONFIG_OLIMEX_STM32_H405=y -CONFIG_MPS2=y -CONFIG_RASPI=y -CONFIG_DIGIC=y -CONFIG_SABRELITE=y -CONFIG_EMCRAFT_SF2=y -CONFIG_MICROBIT=y -CONFIG_FSL_IMX25=y -CONFIG_FSL_IMX7=y -CONFIG_FSL_IMX6UL=y -CONFIG_ALLWINNER_H3=y
hw/arm/Kconfig +41 -1
275 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PULL 11/35] arm/Kconfig: Do not build TCG-only boards on a KVM-only build
Quoted 86 lines · Peter Maydell
From: Fabiano Rosas <[email protected]>
Move all the
CONFIG_FOO=yfrom default.mak into "default y if TCG" statements inKconfig. That way they won't be selected whenCONFIG_TCG=n.I'm leaving
CONFIG_ARM_VIRTin default.mak because it allows us to keep the two default.mak files not empty and keep aarch64-default.mak including arm-default.mak. That way we don't surprise anyone that's used to altering these files.With this change we can start building with --disable-tcg.
Signed-off-by Fabiano Rosas <[email protected]>Reviewed-by Richard Henderson <[email protected]>Message-id: [email protected]
Signed-off-by Peter Maydell <[email protected]>--- configs/devices/aarch64-softmmu/default.mak | 4 -- configs/devices/arm-softmmu/default.mak | 37 ------------------ hw/arm/Kconfig | 42 ++++++++++++++++++++- 3 files changed, 41 insertions(+), 42 deletions(-)configs/devices/aarch64-softmmu/default.mak +0
-4@@ -2,7 +2,3 @@ # We support all the 32 bit boards so need all their config include ../arm-softmmu/default.mak - -CONFIG_XLNX_ZYNQMP_ARM=y -CONFIG_XLNX_VERSAL=y -CONFIG_SBSA_REF=yconfigs/devices/arm-softmmu/default.mak +0
-37@@ -4,40 +4,3 @@ # CONFIG_TEST_DEVICES=n CONFIG_ARM_VIRT=y -CONFIG_CUBIEBOARD=y -CONFIG_EXYNOS4=y -CONFIG_HIGHBANK=y -CONFIG_INTEGRATOR=y -CONFIG_FSL_IMX31=y -CONFIG_MUSICPAL=y -CONFIG_MUSCA=y -CONFIG_CHEETAH=y -CONFIG_SX1=y -CONFIG_NSERIES=y -CONFIG_STELLARIS=y -CONFIG_STM32VLDISCOVERY=y -CONFIG_REALVIEW=y -CONFIG_VERSATILE=y -CONFIG_VEXPRESS=y -CONFIG_ZYNQ=y -CONFIG_MAINSTONE=y -CONFIG_GUMSTIX=y -CONFIG_SPITZ=y -CONFIG_TOSA=y -CONFIG_Z2=y -CONFIG_NPCM7XX=y -CONFIG_COLLIE=y -CONFIG_ASPEED_SOC=y -CONFIG_NETDUINO2=y -CONFIG_NETDUINOPLUS2=y -CONFIG_OLIMEX_STM32_H405=y -CONFIG_MPS2=y -CONFIG_RASPI=y -CONFIG_DIGIC=y -CONFIG_SABRELITE=y -CONFIG_EMCRAFT_SF2=y -CONFIG_MICROBIT=y -CONFIG_FSL_IMX25=y -CONFIG_FSL_IMX7=y -CONFIG_FSL_IMX6UL=y -CONFIG_ALLWINNER_H3=yhw/arm/Kconfig +0
-0@@ -35,20 +35,24 @@ config ARM_VIRT
hw/arm/Kconfig config ARM_VIRT · line 45
Quoted 10 lines
hw/arm/Kconfig +2
-0config CHEETAH bool + default y if TCG && ARM select OMAP select TSC210X config CUBIEBOARD bool + default y if TCG && ARM select ALLWINNER_A10
...
Hi!
Sorry for not noticing this earlier, but I have to say that I really dislike this change, since it very much changes the way we did our machine configuration so far.
Until now, you could simply go to configs/devices/*-softmmu/*.mak and only select the machines you wanted to have with "...=y" and delete everything else. Now you have to know *all* the machines that you do *not* want to have in your build and disable them with "...=n" in that file. That's quite ugly, especially for the arm target that has so many machines. (ok, you could also do a "--without-default-devices" configuration to get rid of the machines, but that also disables all other kind of devices that you then have to specify manually).
Isn't there a better way to solve this TCG dependency problem? Paolo, do you maybe have any ideas?
Thomas
Re: [PULL 11/35] arm/Kconfig: Do not build TCG-only boards on a KVM-only build
Quoted 101 lines · Thomas Huth
Quoted 86 lines · Peter Maydell
From: Fabiano Rosas <[email protected]>
Move all the
CONFIG_FOO=yfrom default.mak into "default y if TCG" statements inKconfig. That way they won't be selected whenCONFIG_TCG=n.I'm leaving
CONFIG_ARM_VIRTin default.mak because it allows us to keep the two default.mak files not empty and keep aarch64-default.mak including arm-default.mak. That way we don't surprise anyone that's used to altering these files.With this change we can start building with --disable-tcg.
Signed-off-by Fabiano Rosas <[email protected]>Reviewed-by Richard Henderson <[email protected]>Message-id: [email protected]
Signed-off-by Peter Maydell <[email protected]>--- configs/devices/aarch64-softmmu/default.mak | 4 -- configs/devices/arm-softmmu/default.mak | 37 ------------------ hw/arm/Kconfig | 42 ++++++++++++++++++++- 3 files changed, 41 insertions(+), 42 deletions(-)configs/devices/aarch64-softmmu/default.mak +0
-4@@ -2,7 +2,3 @@ # We support all the 32 bit boards so need all their config include ../arm-softmmu/default.mak - -CONFIG_XLNX_ZYNQMP_ARM=y -CONFIG_XLNX_VERSAL=y -CONFIG_SBSA_REF=yconfigs/devices/arm-softmmu/default.mak +0
-37@@ -4,40 +4,3 @@ # CONFIG_TEST_DEVICES=n CONFIG_ARM_VIRT=y -CONFIG_CUBIEBOARD=y -CONFIG_EXYNOS4=y -CONFIG_HIGHBANK=y -CONFIG_INTEGRATOR=y -CONFIG_FSL_IMX31=y -CONFIG_MUSICPAL=y -CONFIG_MUSCA=y -CONFIG_CHEETAH=y -CONFIG_SX1=y -CONFIG_NSERIES=y -CONFIG_STELLARIS=y -CONFIG_STM32VLDISCOVERY=y -CONFIG_REALVIEW=y -CONFIG_VERSATILE=y -CONFIG_VEXPRESS=y -CONFIG_ZYNQ=y -CONFIG_MAINSTONE=y -CONFIG_GUMSTIX=y -CONFIG_SPITZ=y -CONFIG_TOSA=y -CONFIG_Z2=y -CONFIG_NPCM7XX=y -CONFIG_COLLIE=y -CONFIG_ASPEED_SOC=y -CONFIG_NETDUINO2=y -CONFIG_NETDUINOPLUS2=y -CONFIG_OLIMEX_STM32_H405=y -CONFIG_MPS2=y -CONFIG_RASPI=y -CONFIG_DIGIC=y -CONFIG_SABRELITE=y -CONFIG_EMCRAFT_SF2=y -CONFIG_MICROBIT=y -CONFIG_FSL_IMX25=y -CONFIG_FSL_IMX7=y -CONFIG_FSL_IMX6UL=y -CONFIG_ALLWINNER_H3=yhw/arm/Kconfig +0
-0@@ -35,20 +35,24 @@ config ARM_VIRThw/arm/Kconfig config ARM_VIRT · line 45
Quoted 10 lines
hw/arm/Kconfig +2
-0config CHEETAH bool + default y if TCG && ARM select OMAP select TSC210X config CUBIEBOARD bool + default y if TCG && ARM select ALLWINNER_A10...
Hi!
Quoted 12 lines
Sorry for not noticing this earlier, but I have to say that I really dislike this change, since it very much changes the way we did our machine configuration so far.
Until now, you could simply go to configs/devices/*-softmmu/*.mak and only select the machines you wanted to have with "...=y" and delete everything else. Now you have to know *all* the machines that you do *not* want to have in your build and disable them with "...=n" in that file. That's quite ugly, especially for the arm target that has so many machines. (ok, you could also do a "--without-default-devices" configuration to get rid of the machines, but that also disables all other kind of devices that you then have to specify manually).
Would leaving the CONFIGs as 'n', but commented out in the .mak files be of any help? If I understand your use case, you were probably just deleting the CONFIG=y for the boards you don't want. So now you'd be uncommenting the CONFIG=n instead.
Alternatively, we could revert the .mak part of this change, convert default.mak into tcg.mak and kvm.mak, and use those transparently depending on whether --disable-tcg is present in the configure line.
But there's probably a better way still that I'm not seeing here, let's see what others think.
Re: [PULL 11/35] arm/Kconfig: Do not build TCG-only boards on a KVM-only build
Il gio 4 mag 2023, 14:27 Fabiano Rosas <[email protected]> ha scritto:
Quoted 121 lines
Quoted 24 lines · Thomas Huth
Quoted 23 lines · Peter Maydell
From: Fabiano Rosas <[email protected]>
Move all the
CONFIG_FOO=yfrom default.mak into "default y if TCG" statements inKconfig. That way they won't be selected whenCONFIG_TCG=n.I'm leaving
CONFIG_ARM_VIRTin default.mak because it allows us to keep the two default.mak files not empty and keep aarch64-default.mak including arm-default.mak. That way we don't surprise anyone that's used to altering these files.With this change we can start building with --disable-tcg.
Signed-off-by Fabiano Rosas <[email protected]>Reviewed-by Richard Henderson <[email protected]>Message-id: [email protected]
Signed-off-by Peter Maydell <[email protected]>--- configs/devices/aarch64-softmmu/default.mak | 4 -- configs/devices/arm-softmmu/default.mak | 37 ------------------ hw/arm/Kconfig | 42 ++++++++++++++++++++- 3 files changed, 41 insertions(+), 42 deletions(-)Quoted 1 line
Review
Quoted 1 line
(quoted diff) +0
-0b/configs/devices/aarch64-softmmu/default.mak
Quoted 5 lines
Quoted 5 lines
index
cf43ac8da11..70e05a197dc100644configs/devices/aarch64-softmmu/default.mak +0
-0@@ -2,7 +2,3 @@Quoted 7 lines
Review
Quoted 7 lines
configs/devices/aarch64-softmmu/default.mak +0
-4# We support all the 32 bit boards so need all their config include ../arm-softmmu/default.mak - -CONFIG_XLNX_ZYNQMP_ARM=y -CONFIG_XLNX_VERSAL=y -CONFIG_SBSA_REF=y(quoted diff) +0
-0b/configs/devices/arm-softmmu/default.mak
Quoted 62 lines
Quoted 60 lines
index
cb3e5aea657..647fbce88d3100644configs/devices/arm-softmmu/default.mak +0
-37@@ -4,40 +4,3 @@ # CONFIG_TEST_DEVICES=n CONFIG_ARM_VIRT=y -CONFIG_CUBIEBOARD=y -CONFIG_EXYNOS4=y -CONFIG_HIGHBANK=y -CONFIG_INTEGRATOR=y -CONFIG_FSL_IMX31=y -CONFIG_MUSICPAL=y -CONFIG_MUSCA=y -CONFIG_CHEETAH=y -CONFIG_SX1=y -CONFIG_NSERIES=y -CONFIG_STELLARIS=y -CONFIG_STM32VLDISCOVERY=y -CONFIG_REALVIEW=y -CONFIG_VERSATILE=y -CONFIG_VEXPRESS=y -CONFIG_ZYNQ=y -CONFIG_MAINSTONE=y -CONFIG_GUMSTIX=y -CONFIG_SPITZ=y -CONFIG_TOSA=y -CONFIG_Z2=y -CONFIG_NPCM7XX=y -CONFIG_COLLIE=y -CONFIG_ASPEED_SOC=y -CONFIG_NETDUINO2=y -CONFIG_NETDUINOPLUS2=y -CONFIG_OLIMEX_STM32_H405=y -CONFIG_MPS2=y -CONFIG_RASPI=y -CONFIG_DIGIC=y -CONFIG_SABRELITE=y -CONFIG_EMCRAFT_SF2=y -CONFIG_MICROBIT=y -CONFIG_FSL_IMX25=y -CONFIG_FSL_IMX7=y -CONFIG_FSL_IMX6UL=y -CONFIG_ALLWINNER_H3=yhw/arm/Kconfig +2
-0@@ -35,20 +35,24 @@ config ARM_VIRT config CHEETAH bool + default y if TCG && ARM select OMAP select TSC210X config CUBIEBOARD bool + default y if TCG && ARM select ALLWINNER_A10...
Quoted 3 lines
Hi!
Sorry for not noticing this earlier, but I have to say that I really
dislike
Quoted 3 lines
this change, since it very much changes the way we did our machine configuration so far.
Until now, you could simply go to configs/devices/*-softmmu/*.mak andonly
Quoted 1 line
select the machines you wanted to have with "...=y" and delete
everything
Quoted 1 line
else. Now you have to know *all* the machines that you do *not* want to
have
Quoted 1 line
in your build and disable them with "...=n" in that file. That's quite
ugly,
Quoted 1 line
especially for the arm target that has so many machines. (ok, you could
also
Quoted 1 line
do a "--without-default-devices" configuration to get rid of the
machines,
Quoted 8 lines
Quoted 3 lines
but that also disables all other kind of devices that you then have to specify manually).
Would leaving the CONFIGs as 'n', but commented out in the .mak files be of any help? If I understand your use case, you were probably just deleting the CONFIG=y for the boards you don't want. So now you'd be uncommenting the CONFIG=n instead.
Yes, that would help—though it is likely to bitrot. I would also change the "if TCG" part to "depends on TCG && ARM", which will break loudly if someone sets the config to y with the wrong accelerator or in the wrong file.
Once this is done for ARM we can extend it to other .mak files for consistency.
Paolo
Quoted 8 lines
Alternatively, we could revert the .mak part of this change, convert default.mak into tcg.mak and kvm.mak, and use those transparently depending on whether --disable-tcg is present in the configure line.
But there's probably a better way still that I'm not seeing here, let's see what others think.
Re: [PULL 11/35] arm/Kconfig: Do not build TCG-only boards on a KVM-only build
In reply to Fabiano RosasQuoted 121 lines · Fabiano Rosas
Quoted 101 lines · Thomas Huth
Quoted 96 lines · Peter Maydell
From: Fabiano Rosas <[email protected]>
Move all the
CONFIG_FOO=yfrom default.mak into "default y if TCG" statements inKconfig. That way they won't be selected whenCONFIG_TCG=n.I'm leaving
CONFIG_ARM_VIRTin default.mak because it allows us to keep the two default.mak files not empty and keep aarch64-default.mak including arm-default.mak. That way we don't surprise anyone that's used to altering these files.With this change we can start building with --disable-tcg.
Signed-off-by Fabiano Rosas <[email protected]>Reviewed-by Richard Henderson <[email protected]>Message-id: [email protected]
Signed-off-by Peter Maydell <[email protected]>--- configs/devices/aarch64-softmmu/default.mak | 4 -- configs/devices/arm-softmmu/default.mak | 37 ------------------ hw/arm/Kconfig | 42 ++++++++++++++++++++- 3 files changed, 41 insertions(+), 42 deletions(-)configs/devices/aarch64-softmmu/default.mak +0
-4@@ -2,7 +2,3 @@ # We support all the 32 bit boards so need all their config include ../arm-softmmu/default.mak - -CONFIG_XLNX_ZYNQMP_ARM=y -CONFIG_XLNX_VERSAL=y -CONFIG_SBSA_REF=yconfigs/devices/arm-softmmu/default.mak +0
-37@@ -4,40 +4,3 @@ # CONFIG_TEST_DEVICES=n CONFIG_ARM_VIRT=y -CONFIG_CUBIEBOARD=y -CONFIG_EXYNOS4=y -CONFIG_HIGHBANK=y -CONFIG_INTEGRATOR=y -CONFIG_FSL_IMX31=y -CONFIG_MUSICPAL=y -CONFIG_MUSCA=y -CONFIG_CHEETAH=y -CONFIG_SX1=y -CONFIG_NSERIES=y -CONFIG_STELLARIS=y -CONFIG_STM32VLDISCOVERY=y -CONFIG_REALVIEW=y -CONFIG_VERSATILE=y -CONFIG_VEXPRESS=y -CONFIG_ZYNQ=y -CONFIG_MAINSTONE=y -CONFIG_GUMSTIX=y -CONFIG_SPITZ=y -CONFIG_TOSA=y -CONFIG_Z2=y -CONFIG_NPCM7XX=y -CONFIG_COLLIE=y -CONFIG_ASPEED_SOC=y -CONFIG_NETDUINO2=y -CONFIG_NETDUINOPLUS2=y -CONFIG_OLIMEX_STM32_H405=y -CONFIG_MPS2=y -CONFIG_RASPI=y -CONFIG_DIGIC=y -CONFIG_SABRELITE=y -CONFIG_EMCRAFT_SF2=y -CONFIG_MICROBIT=y -CONFIG_FSL_IMX25=y -CONFIG_FSL_IMX7=y -CONFIG_FSL_IMX6UL=y -CONFIG_ALLWINNER_H3=yhw/arm/Kconfig +2
-0@@ -35,20 +35,24 @@ config ARM_VIRT config CHEETAH bool + default y if TCG && ARM select OMAP select TSC210X config CUBIEBOARD bool + default y if TCG && ARM select ALLWINNER_A10...
Hi!Quoted 12 lines
Sorry for not noticing this earlier, but I have to say that I really dislike this change, since it very much changes the way we did our machine configuration so far.
Until now, you could simply go to configs/devices/*-softmmu/*.mak and only select the machines you wanted to have with "...=y" and delete everything else. Now you have to know *all* the machines that you do *not* want to have in your build and disable them with "...=n" in that file. That's quite ugly, especially for the arm target that has so many machines. (ok, you could also do a "--without-default-devices" configuration to get rid of the machines, but that also disables all other kind of devices that you then have to specify manually).Would leaving the CONFIGs as 'n', but commented out in the .mak files be of any help? If I understand your use case, you were probably just deleting the CONFIG=y for the boards you don't want. So now you'd be uncommenting the CONFIG=n instead.
Quoted 6 lines
Alternatively, we could revert the .mak part of this change, convert default.mak into tcg.mak and kvm.mak, and use those transparently depending on whether --disable-tcg is present in the configure line.
But there's probably a better way still that I'm not seeing here, let's see what others think.
I pondered about it for a while, but I also don't have a better solution, so yes, I guess that "# CONFIG_xxx=n" idea is likely still the best solution right now.
Thomas
[PULL 15/35] hw/arm/bcm2835_property: Implement "get command line" message
In reply to Peter MaydellFrom: Daniel Bertalan <[email protected]>
This query copies the kernel command line into the message buffer. It was previously stubbed out to return empty, this commit makes it reflect the arguments specified with -append.
I observed the following peculiarities on my Pi 3B+:
- If the buffer is shorter than the string, the response header gives the full length, but no data is actually copied.
- No NUL terminator is added: even if the buffer is long enough to fit one, the buffer's original contents are preserved past the string's end.
- The VC firmware adds the following extra parameters beside the user-supplied ones (via /boot/cmdline.txt): video, vc_mem.mem_base and vc_mem.mem_size. This is currently not implemented in qemu.
Message-id: [email protected]
--- include/hw/misc/bcm2835_property.h | 1 + hw/arm/bcm2835_peripherals.c | 2 ++ hw/arm/bcm2836.c | 2 ++ hw/arm/raspi.c | 2 ++ hw/misc/bcm2835_property.c | 13 ++++++++++++- 5 files changed, 19 insertions(+), 1 deletion(-)
include/hw/misc/bcm2835_property.h +1 -0
@@ -30,6 +30,7 @@ struct BCM2835PropertyState {MACAddr macaddr;uint32_t board_rev;uint32_t addr; +char *command_line;bool pending; };
hw/arm/bcm2835_peripherals.c +2 -0
@@ -90,6 +90,8 @@ static void bcm2835_peripherals_init(Object *obj) TYPE_BCM2835_PROPERTY);object_property_add_alias (obj,"board-rev" ,OBJECT (&s->property),"board-rev" ); +object_property_add_alias (obj,"command-line" ,OBJECT (&s->property), +"command-line" );object_property_add_const_link (OBJECT (&s->property),"fb" ,OBJECT (&s->fb));
hw/arm/bcm2836.c +2 -0
@@ -55,6 +55,8 @@ static void bcm2836_init(Object *obj) TYPE_BCM2835_PERIPHERALS);object_property_add_alias (obj,"board-rev" ,OBJECT (&s->peripherals),"board-rev" ); +object_property_add_alias (obj,"command-line" ,OBJECT (&s->peripherals), +"command-line" );object_property_add_alias (obj,"vcram-size" ,OBJECT (&s->peripherals),"vcram-size" ); }
hw/arm/raspi.c +2 -0
@@ -280,6 +280,8 @@ static void raspi_machine_init(MachineState *machine)object_property_add_const_link (OBJECT (&s->soc),"ram" ,OBJECT (machine->ram));object_property_set_int (OBJECT (&s->soc),"board-rev" , board_rev, &error_abort); +object_property_set_str (OBJECT (&s->soc),"command-line" , + machine->kernel_cmdline, &error_abort);qdev_realize (DEVICE (&s->soc),NULL , &error_fatal);/* Create and plug in the SD cards */
hw/misc/bcm2835_property.c +12 -1
@@ -282,7 +282,17 @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value)break ;case 0x00050001 :/* Get command line */ - resplen =0 ; +/* +* We follow the firmware behaviour: no NUL terminator is +* written to the buffer, and if the buffer is too short +* we report the required length in the response header +* and copy nothing to the buffer. +*/ + resplen =strlen (s->command_line); +if (bufsize >= resplen) +address_space_write (&s->dma_as, value +12 , +MEMTXATTRS_UNSPECIFIED , s->command_line, + resplen);break ;default :
@@ -420,6 +430,7 @@ static void bcm2835_property_realize(DeviceState *dev, Error **errp)static Property bcm2835_property_props[] = {DEFINE_PROP_UINT32 ("board-rev" , BCM2835PropertyState, board_rev,0 ), +DEFINE_PROP_STRING ("command-line" , BCM2835PropertyState, command_line),DEFINE_PROP_END_OF_LIST () };
Signature · 1 line
2.34.1
[PULL 20/35] bsd-user: Add '-one-insn-per-tb' option equivalent to '-singlestep'
In reply to Peter MaydellThe '-singlestep' option is confusing, because it doesn't actually have anything to do with single-stepping the CPU. What it does do is force TCG emulation to put one guest instruction in each TB, which can be useful in some situations.
Create a new command line argument -one-insn-per-tb, so we can document that -singlestep is just a deprecated synonym for it, and eventually perhaps drop it.
Message-id: [email protected]
--- docs/user/main.rst | 7 ++++++- bsd-user/main.c | 5 +++-- 2 files changed, 9 insertions(+), 3 deletions(-)
docs/user/main.rst +6 -1
@@ -247,5 +247,10 @@ Debug options: ``-p pagesize`` Act as if the host page size was 'pagesize' bytes +``-one-insn-per-tb`` + Run the emulation with one guest instruction per translation block. + This slows down emulation a lot, but can be useful in some situations, + such as when trying to analyse the logs produced by the ``-d`` option. + ``-singlestep`` - Run the emulation in single step mode. + This is a deprecated synonym for the ``-one-insn-per-tb`` option.
bsd-user/main.c +3 -2
@@ -162,7 +162,8 @@ static void usage(void)"-d item1[,...] enable logging of specified items\n" " (use '-d help' for a list of log items)\n" "-D logfile write logs to 'logfile' (default stderr)\n" -"-singlestep always run in singlestep mode\n" +"-one-insn-per-tb run with one guest instruction per emulated TB\n" +"-singlestep deprecated synonym for -one-insn-per-tb\n" "-strace log system calls\n" "-trace [[enable=]<pattern>][,events=<file>][,file=<file>]\n" " specify tracing options\n"
@@ -385,7 +386,7 @@ int main(int argc, char **argv) (void )envlist_unsetenv (envlist,"LD_PRELOAD" ); }else if (!strcmp (r,"seed" )) { seed_optarg = optarg; - }else if (!strcmp (r,"singlestep" )) { + }else if (!strcmp (r,"singlestep" ) || !strcmp (r,"one-insn-per-tb" )) { opt_one_insn_per_tb = true; }else if (!strcmp (r,"strace" )) { do_strace =1 ;
Signature · 1 line
2.34.1
[PULL 30/35] hw/arm/raspi: Use arm_write_bootloader() to write boot code
In reply to Peter MaydellWhen writing the secondary-CPU stub boot loader code to the guest, use arm_write_bootloader() instead of directly calling rom_add_blob_fixed(). This fixes a bug on big-endian hosts, because arm_write_bootloader() will correctly byte-swap the host-byte-order array values into the guest-byte-order to write into the guest memory.
Message-id: [email protected]
--- hw/arm/raspi.c | 64 +++++++++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 30 deletions(-)
hw/arm/raspi.c +34 -30
@@ -16,6 +16,7 @@#include "qemu/units.h" #include "qemu/cutils.h" #include "qapi/error.h" +#include "hw/arm/boot.h" #include "hw/arm/bcm2836.h" #include "hw/registerfields.h" #include "qemu/error-report.h"
@@ -124,20 +125,22 @@ static const char *board_type(uint32_t board_rev)static void write_smpboot (ARMCPU *cpu,const struct arm_boot_info *info) { -static const uint32_t smpboot[] = { -0xe1a0e00f ,/* mov lr, pc */ -0xe3a0fe00 + (BOARDSETUP_ADDR >>4 ),/* mov pc, BOARDSETUP_ADDR */ -0xee100fb0 ,/* mrc p15, 0, r0, c0, c0, 5;get core ID */ -0xe7e10050 ,/* ubfx r0, r0, #0, #2 ;extract LSB */ -0xe59f5014 ,/* ldr r5, =0x400000CC ;load mbox base */ -0xe320f001 ,/* 1: yield */ -0xe7953200 ,/* ldr r3, [r5, r0, lsl #4] ;read mbox for our core*/ -0xe3530000 ,/* cmp r3, #0 ;spin while zero */ -0x0afffffb ,/* beq 1b */ -0xe7853200 ,/* str r3, [r5, r0, lsl #4] ;clear mbox */ -0xe12fff13 ,/* bx r3 ;jump to target */ -0x400000cc ,/* (constant: mailbox 3 read/clear base) */ +static const ARMInsnFixup smpboot[] = { + {0xe1a0e00f },/* mov lr, pc */ + {0xe3a0fe00 + (BOARDSETUP_ADDR >>4 ) },/* mov pc, BOARDSETUP_ADDR */ + {0xee100fb0 },/* mrc p15, 0, r0, c0, c0, 5;get core ID */ + {0xe7e10050 },/* ubfx r0, r0, #0, #2 ;extract LSB */ + {0xe59f5014 },/* ldr r5, =0x400000CC ;load mbox base */ + {0xe320f001 },/* 1: yield */ + {0xe7953200 },/* ldr r3, [r5, r0, lsl #4] ;read mbox for our core */ + {0xe3530000 },/* cmp r3, #0 ;spin while zero */ + {0x0afffffb },/* beq 1b */ + {0xe7853200 },/* str r3, [r5, r0, lsl #4] ;clear mbox */ + {0xe12fff13 },/* bx r3 ;jump to target */ + {0x400000cc },/* (constant: mailbox 3 read/clear base) */ + {0 ,FIXUP_TERMINATOR } }; +static const uint32_t fixupcontext[FIXUP_MAX ] = {0 };/* check that we don't overrun board setup vectors */ QEMU_BUILD_BUG_ON (SMPBOOT_ADDR +sizeof (smpboot) >MVBAR_ADDR );
@@ -145,9 +148,8 @@ static void write_smpboot(ARMCPU *cpu, const struct arm_boot_info *info)QEMU_BUILD_BUG_ON ((BOARDSETUP_ADDR &0xf ) !=0 || (BOARDSETUP_ADDR >>4 ) >=0x100 ); -rom_add_blob_fixed_as ("raspi_smpboot" , smpboot,sizeof (smpboot), - info->smp_loader_start, -arm_boot_address_space (cpu, info)); +arm_write_bootloader ("raspi_smpboot" ,arm_boot_address_space (cpu, info), + info->smp_loader_start, smpboot, fixupcontext); }static void write_smpboot64 (ARMCPU *cpu,const struct arm_boot_info *info)
@@ -161,26 +163,28 @@ static void write_smpboot64(ARMCPU *cpu, const struct arm_boot_info *info)* the primary CPU goes into the kernel. We put these variables inside * a rom blob, so that the reset for ROM contents zeroes them for us. */ -static const uint32_t smpboot[] = { -0xd2801b05 ,/* mov x5, 0xd8 */ -0xd53800a6 ,/* mrs x6, mpidr_el1 */ -0x924004c6 ,/* and x6, x6, #0x3 */ -0xd503205f ,/* spin: wfe */ -0xf86678a4 ,/* ldr x4, [x5,x6,lsl #3] */ -0xb4ffffc4 ,/* cbz x4, spin */ -0xd2800000 ,/* mov x0, #0x0 */ -0xd2800001 ,/* mov x1, #0x0 */ -0xd2800002 ,/* mov x2, #0x0 */ -0xd2800003 ,/* mov x3, #0x0 */ -0xd61f0080 ,/* br x4 */ +static const ARMInsnFixup smpboot[] = { + {0xd2801b05 },/* mov x5, 0xd8 */ + {0xd53800a6 },/* mrs x6, mpidr_el1 */ + {0x924004c6 },/* and x6, x6, #0x3 */ + {0xd503205f },/* spin: wfe */ + {0xf86678a4 },/* ldr x4, [x5,x6,lsl #3] */ + {0xb4ffffc4 },/* cbz x4, spin */ + {0xd2800000 },/* mov x0, #0x0 */ + {0xd2800001 },/* mov x1, #0x0 */ + {0xd2800002 },/* mov x2, #0x0 */ + {0xd2800003 },/* mov x3, #0x0 */ + {0xd61f0080 },/* br x4 */ + {0 ,FIXUP_TERMINATOR } }; +static const uint32_t fixupcontext[FIXUP_MAX ] = {0 };static const uint64_t spintables[] = {0 ,0 ,0 ,0 }; -rom_add_blob_fixed_as ("raspi_smpboot" , smpboot,sizeof (smpboot), - info->smp_loader_start, as); +arm_write_bootloader ("raspi_smpboot" , as, info->smp_loader_start, + smpboot, fixupcontext);rom_add_blob_fixed_as ("raspi_spintables" , spintables,sizeof (spintables),SPINTABLE_ADDR , as); }
Signature · 1 line
2.34.1
[PULL 17/35] softmmu: Don't use 'singlestep' global in QMP and HMP commands
In reply to Peter MaydellThe HMP 'singlestep' command, the QMP 'query-status' command and the HMP 'info status' command (which is just wrapping the QMP command implementation) look at the 'singlestep' global variable. Make them access the new TCG accelerator 'one-insn-per-tb' property instead.
This leaves the HMP and QMP command/field names and output strings unchanged; we will clean that up later.
Message-id: [email protected]
--- softmmu/runstate-hmp-cmds.c | 18 ++++++++++++++++-- softmmu/runstate.c | 10 +++++++++- 2 files changed, 25 insertions(+), 3 deletions(-)
softmmu/runstate-hmp-cmds.c +16 -2
@@ -20,6 +20,7 @@#include "qapi/error.h" #include "qapi/qapi-commands-run-state.h" #include "qapi/qmp/qdict.h" +#include "qemu/accel.h" void hmp_info_status (Monitor *mon,const QDict *qdict) {
@@ -43,13 +44,26 @@ void hmp_info_status(Monitor *mon, const QDict *qdict)void hmp_singlestep (Monitor *mon,const QDict *qdict) {const char *option =qdict_get_try_str (qdict,"option" ); +AccelState *accel =current_accel (); +bool newval; + +if (!object_property_find (OBJECT (accel),"one-insn-per-tb" )) { +monitor_printf (mon, +"This accelerator does not support setting one-insn-per-tb\n" ); +return ; + } +if (!option || !strcmp (option,"on" )) { - singlestep =1 ; + newval = true; }else if (!strcmp (option,"off" )) { - singlestep =0 ; + newval = false; }else {monitor_printf (mon,"unexpected option %s\n" , option); +return ; } +/* If the property exists then setting it can never fail */ +object_property_set_bool (OBJECT (accel),"one-insn-per-tb" , + newval, &error_abort); }void hmp_watchdog_action (Monitor *mon,const QDict *qdict)
softmmu/runstate.c +9 -1
@@ -40,6 +40,7 @@#include "qapi/error.h" #include "qapi/qapi-commands-run-state.h" #include "qapi/qapi-events-run-state.h" +#include "qemu/accel.h" #include "qemu/error-report.h" #include "qemu/job.h" #include "qemu/log.h"
@@ -234,9 +235,16 @@ bool runstate_needs_reset(void)StatusInfo *qmp_query_status (Error **errp) {StatusInfo *info =g_malloc0 (sizeof (*info)); +AccelState *accel =current_accel (); +/* +* We ignore errors, which will happen if the accelerator +* is not TCG. "singlestep" is meaningless for other accelerators, +* so we will set the StatusInfo field to false for those. +*/ + info->singlestep =object_property_get_bool (OBJECT (accel), +"one-insn-per-tb" ,NULL ); info->running =runstate_is_running (); - info->singlestep = singlestep; info->status = current_run_state;return info;
Signature · 1 line
2.34.1
[PULL 23/35] hmp: Add 'one-insn-per-tb' command equivalent to 'singlestep'
In reply to Peter MaydellThe 'singlestep' HMP command is confusing, because it doesn't actually have anything to do with single-stepping the CPU. What it does do is force TCG emulation to put one guest instruction in each TB, which can be useful in some situations.
Create a new HMP command 'one-insn-per-tb', so we can document that 'singlestep' is just a deprecated synonym for it, and eventually perhaps drop it.
We aren't obliged to do deprecate-and-drop for HMP commands, but it's easy enough to do so, so we do.
Message-id: [email protected]
--- docs/about/deprecated.rst | 9 +++++++++ include/monitor/hmp.h | 2 +- softmmu/runstate-hmp-cmds.c | 2 +- tests/qtest/test-hmp.c | 1 + hmp-commands.hx | 25 +++++++++++++++++++++---- 5 files changed, 33 insertions(+), 6 deletions(-)
docs/about/deprecated.rst +9 -0
@@ -199,6 +199,15 @@ accepted incorrect commands will return an error. Users should make sure that all arguments passed to ``device_add`` are consistent with the documented property types. +Human Monitor Protocol (HMP) commands +------------------------------------- + +``singlestep`` (since 8.1) +'''''''''''''''''''''''''' + +The ``singlestep`` command has been replaced by the ``one-insn-per-tb`` +command, which has the same behaviour but a less misleading name. + Host Architectures ------------------
include/monitor/hmp.h +1 -1
@@ -158,7 +158,7 @@ void hmp_info_vcpu_dirty_limit(Monitor *mon, const QDict *qdict);void hmp_human_readable_text_helper (Monitor *mon,HumanReadableText *(*qmp_handler)(Error **));void hmp_info_stats (Monitor *mon,const QDict *qdict); -void hmp_singlestep (Monitor *mon,const QDict *qdict); +void hmp_one_insn_per_tb (Monitor *mon,const QDict *qdict);void hmp_watchdog_action (Monitor *mon,const QDict *qdict);void hmp_pcie_aer_inject_error (Monitor *mon,const QDict *qdict);void hmp_info_capture (Monitor *mon,const QDict *qdict);
softmmu/runstate-hmp-cmds.c +1 -1
@@ -40,7 +40,7 @@ void hmp_info_status(Monitor *mon, const QDict *qdict)qapi_free_StatusInfo (info); } -void hmp_singlestep (Monitor *mon,const QDict *qdict) +void hmp_one_insn_per_tb (Monitor *mon,const QDict *qdict) {const char *option =qdict_get_try_str (qdict,"option" );AccelState *accel =current_accel ();
tests/qtest/test-hmp.c +1 -0
@@ -56,6 +56,7 @@ static const char *hmp_cmds[] = {"o /w 0 0x1234" ,"object_add memory-backend-ram,id=mem1,size=256M" ,"object_del mem1" , +"one-insn-per-tb on" ,"pmemsave 0 4096 \"/dev/null\"" ,"p $pc + 8" , "qom-list /",
hmp-commands.hx +21 -4
@@ -378,18 +378,35 @@ SRST only *tag* as parameter. ERST + { + .name = "one-insn-per-tb", + .args_type = "option:s?", + .params = "[on|off]", + .help = "run emulation with one guest instruction per translation block", + .cmd = hmp_one_insn_per_tb, + }, + +SRST +``one-insn-per-tb [off]`` + Run the emulation with one guest instruction per translation block. + This slows down emulation a lot, but can be useful in some situations, + such as when trying to analyse the logs produced by the ``-d`` option. + This only has an effect when using TCG, not with KVM or other accelerators. + + If called with option off, the emulation returns to normal mode. +ERST + { .name = "singlestep", .args_type = "option:s?", .params = "[on|off]", - .help = "run emulation in singlestep mode or switch to normal mode", - .cmd = hmp_singlestep, + .help = "deprecated synonym for one-insn-per-tb", + .cmd = hmp_one_insn_per_tb, }, SRST ``singlestep [off]`` - Run the emulation in single step mode. - If called with option off, the emulation returns to normal mode. + This is a deprecated synonym for the one-insn-per-tb command. ERST {
Signature · 1 line
2.34.1
[PULL 25/35] qmp: Deprecate 'singlestep' member of StatusInfo
In reply to Peter MaydellThe 'singlestep' member of StatusInfo has never done what the QMP documentation claims it does. What it actually reports is whether TCG is working in "one guest instruction per translation block" mode.
We no longer need this field for the HMP 'info status' command, as we've moved that information to 'info jit'. It seems unlikely that anybody is monitoring the state of this obscure TCG setting via QMP, especially since QMP provides no means for changing the setting. So simply deprecate the field, without providing any replacement.
Until we do eventually delete the member, correct the misstatements in the QAPI documentation about it.
If we do find that there are users for this, then the most likely way we would provide replacement access to the information would be to put the accelerator QOM object at a well-known path such as /machine/accel, which could then be used with the existing qom-set and qom-get commands.
Message-id: [email protected]
--- docs/about/deprecated.rst | 14 ++++++++++++++ qapi/run-state.json | 14 +++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-)
docs/about/deprecated.rst +14 -0
@@ -199,6 +199,20 @@ accepted incorrect commands will return an error. Users should make sure that all arguments passed to ``device_add`` are consistent with the documented property types. +``StatusInfo`` member ``singlestep`` (since 8.1) +'''''''''''''''''''''''''''''''''''''''''''''''' + +The ``singlestep`` member of the ``StatusInfo`` returned from the +``query-status`` command is deprecated. This member has a confusing +name and it never did what the documentation claimed or what its name +suggests. We do not believe that anybody is actually using the +information provided in this member. + +The information it reports is whether the TCG JIT is in "one +instruction per translated block" mode (which can be set on the +command line or via the HMP, but not via QMP). The information remains +available via the HMP 'info jit' command. + Human Monitor Protocol (HMP) commands -------------------------------------
qapi/run-state.json +11 -3
@@ -104,16 +104,24 @@ # # @running: true if all VCPUs are runnable, false if not runnable # -# @singlestep: true if VCPUs are in single-step mode +# @singlestep: true if using TCG with one guest instruction +# per translation block # # @status: the virtual machine @RunState # +# Features: +# @deprecated: Member 'singlestep' is deprecated (with no replacement). +# # Since: 0.14 # -# Notes: @singlestep is enabled through the GDB stub +# Notes: @singlestep is enabled on the command line with +# '-accel tcg,one-insn-per-tb=on', or with the HMP +# 'one-insn-per-tb' command. ## { 'struct': 'StatusInfo', - 'data': {'running': 'bool', 'singlestep': 'bool', 'status': 'RunState'} } + 'data': {'running': 'bool', + 'singlestep': { 'type': 'bool', 'features': [ 'deprecated' ]}, + 'status': 'RunState'} } ## # @query-status:
Signature · 1 line
2.34.1
[PULL 06/35] tests/qtest: Adjust and document query-cpu-model-expansion test for arm
In reply to Peter MaydellFrom: Fabiano Rosas <[email protected]>
We're about to move the 32-bit CPUs under CONFIG_TCG, so adjust the query-cpu-model-expansion test to check against the cortex-a7, which is already under CONFIG_TCG. That allows the next patch to contain only code movement. (All the test cares about is that the CPU type it's checking is one which definitely doesn't work under KVM.)
While here add comments clarifying what we're testing.
Message-id: [email protected]
--- tests/qtest/arm-cpu-features.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
tests/qtest/arm-cpu-features.c +17 -3
@@ -506,9 +506,23 @@ static void test_query_cpu_model_expansion_kvm(const void *data)QDict *resp;char *error; -assert_error (qts,"cortex-a15" , -"We cannot guarantee the CPU type 'cortex-a15' works " -"with KVM on this host" ,NULL ); +/* +* When using KVM, only the 'host' and 'max' CPU models are +* supported. Test that we're emitting a suitable error for +* unsupported CPU models. +*/ +if (qtest_has_accel ("tcg" )) { +assert_error (qts,"cortex-a7" , +"We cannot guarantee the CPU type 'cortex-a7' works " +"with KVM on this host" ,NULL ); + }else { +/* +* With a KVM-only build the 32-bit CPUs are not present. +*/ +assert_error (qts,"cortex-a7" , +"The CPU type 'cortex-a7' is not a " +"recognized ARM CPU type" ,NULL ); + }assert_has_feature_enabled (qts,"host" ,"aarch64" );
Signature · 1 line
2.34.1
[PULL 07/35] target/arm: move cpu_tcg to tcg/cpu32.c
In reply to Peter MaydellFrom: Claudio Fontana <[email protected]>
move the module containing cpu models definitions for 32bit TCG-only CPUs to tcg/ and rename it for clarity.
Message-id: [email protected]
---
hw/arm/virt.c | 2 --
target/arm/{cpu_tcg.c => tcg/cpu32.c} | 13 +++----------
target/arm/tcg/cpu64.c | 2 +-
target/arm/meson.build | 1 -
target/arm/tcg/meson.build | 1 +
5 files changed, 5 insertions(+), 14 deletions(-)
rename target/arm/{cpu_tcg.c => tcg/cpu32.c} (99%)hw/arm/virt.c +0 -2
@@ -206,9 +206,7 @@ static const int a15irqmap[] = {static const char *valid_cpus[] = { #ifdef CONFIG_TCGARM_CPU_TYPE_NAME ("cortex-a7" ), -#endifARM_CPU_TYPE_NAME ("cortex-a15" ), -#ifdef CONFIG_TCGARM_CPU_TYPE_NAME ("cortex-a35" ),ARM_CPU_TYPE_NAME ("cortex-a55" ), ARM_CPU_TYPE_NAME("cortex-a72"),
target/arm/tcg/cpu32.c renamed from target/arm/cpu_tcg.c +3 -10
@@ -1,5 +1,5 @@/* -* QEMU ARM TCG CPUs. +* QEMU ARM TCG-only CPUs. * * Copyright (c) 2012 SUSE LINUX Products GmbH *
@@ -10,9 +10,7 @@#include "qemu/osdep.h" #include "cpu.h" -#ifdef CONFIG_TCG #include "hw/core/tcg-cpu-ops.h" -#endif /* CONFIG_TCG */ #include "internals.h" #include "target/arm/idau.h" #if !defined(CONFIG_USER_ONLY )
@@ -96,7 +94,7 @@ void aa32_max_features(ARMCPU *cpu)/* CPU models. These are not needed for the AArch64 linux-user build. */ #if !defined(CONFIG_USER_ONLY) || !defined(TARGET_AARCH64) -#if !defined(CONFIG_USER_ONLY) && defined(CONFIG_TCG) +#if !defined(CONFIG_USER_ONLY) static bool arm_v7m_cpu_exec_interrupt(CPUState *cs, int interrupt_request) { CPUClass *cc = CPU_GET_CLASS(cs);
@@ -120,7 +118,7 @@ static bool arm_v7m_cpu_exec_interrupt(CPUState *cs, int interrupt_request) }return ret; } -#endif /* !CONFIG_USER_ONLY && CONFIG_TCG */ +#endif /* !CONFIG_USER_ONLY */ static void arm926_initfn (Object *obj) {
@@ -1014,7 +1012,6 @@ static void pxa270c5_initfn(Object *obj) cpu->reset_sctlr =0x00000078 ; } -#ifdef CONFIG_TCG static const struct TCGCPUOps arm_v7m_tcg_ops = { .initialize = arm_translate_init, .synchronize_from_tb = arm_cpu_synchronize_from_tb,
@@ -1035,7 +1032,6 @@ static const struct TCGCPUOps arm_v7m_tcg_ops = { .debug_check_breakpoint = arm_debug_check_breakpoint,#endif /* !CONFIG_USER_ONLY */ }; -#endif /* CONFIG_TCG */ static void arm_v7m_class_init (ObjectClass *oc,void *data) {
@@ -1043,10 +1039,7 @@ static void arm_v7m_class_init(ObjectClass *oc, void *data)CPUClass *cc =CPU_CLASS (oc); acc->info = data; -#ifdef CONFIG_TCG cc->tcg_ops = &arm_v7m_tcg_ops; -#endif /* CONFIG_TCG */ - cc->gdb_core_xml_file ="arm-m-profile.xml" ; }
target/arm/tcg/cpu64.c +1 -1
@@ -525,7 +525,7 @@ static void aarch64_neoverse_n1_initfn(Object *obj)/* * -cpu max: a CPU with as many features enabled as our emulation supports. -* The version of '-cpu max' for qemu-system-arm is defined in cpu_tcg.c; +* The version of '-cpu max' for qemu-system-arm is defined in cpu32.c; * this only needs to handle 64 bits. */ void aarch64_max_tcg_initfn (Object *obj)
target/arm/meson.build +0 -1
@@ -5,7 +5,6 @@ arm_ss.add(files( 'gdbstub.c', 'helper.c', 'vfp_helper.c', - 'cpu_tcg.c', )) arm_ss.add(zlib)
target/arm/tcg/meson.build +1 -0
@@ -18,6 +18,7 @@ gen = [ arm_ss.add(gen) arm_ss.add(files( + 'cpu32.c', 'translate.c', 'translate-m-nocp.c', 'translate-mve.c',
Signature · 1 line
2.34.1
[PULL 27/35] hw/net/msf2-emac: Don't modify descriptor in-place in emac_store_desc()
In reply to Peter MaydellThe msf2-emac ethernet controller has functions emac_load_desc() and emac_store_desc() which read and write the in-memory descriptor blocks and handle conversion between guest and host endianness.
As currently written, emac_store_desc() does the endianness conversion in-place; this means that it effectively consumes the input EmacDesc struct, because on a big-endian host the fields will be overwritten with the little-endian versions of their values. Unfortunately, in all the callsites the code continues to access fields in the EmacDesc struct after it has called emac_store_desc() -- specifically, it looks at the d.next field.
The effect of this is that on a big-endian host networking doesn't work because the address of the next descriptor is corrupted.
We could fix this by making the callsite avoid using the struct; but it's more robust to have emac_store_desc() leave its input alone.
(emac_load_desc() also does an in-place conversion, but here this is fine, because the function is supposed to be initializing the struct.)
Message-id: [email protected]
--- hw/net/msf2-emac.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
hw/net/msf2-emac.c +10 -6
@@ -118,14 +118,18 @@ static void emac_load_desc(MSF2EmacState *s, EmacDesc *d, hwaddr desc) d->next =le32_to_cpu (d->next); } -static void emac_store_desc (MSF2EmacState *s,EmacDesc *d,hwaddr desc) +static void emac_store_desc (MSF2EmacState *s,const EmacDesc *d,hwaddr desc) { -/* Convert from host endianness into LE. */ - d->pktaddr =cpu_to_le32 (d->pktaddr); - d->pktsize =cpu_to_le32 (d->pktsize); - d->next =cpu_to_le32 (d->next); +EmacDesc outd; +/* +* Convert from host endianness into LE. We use a local struct because +* calling code may still want to look at the fields afterwards. +*/ + outd.pktaddr =cpu_to_le32 (d->pktaddr); + outd.pktsize =cpu_to_le32 (d->pktsize); + outd.next =cpu_to_le32 (d->next); -address_space_write (&s->dma_as, desc,MEMTXATTRS_UNSPECIFIED , d,sizeof *d); +address_space_write (&s->dma_as, desc,MEMTXATTRS_UNSPECIFIED , &outd,sizeof outd); }static void msf2_dma_tx (MSF2EmacState *s)
Signature · 1 line
2.34.1
[PULL 31/35] hw/intc/allwinner-a10-pic: Don't use set_bit()/clear_bit()
In reply to Peter MaydellThe Allwinner PIC model uses set_bit() and clear_bit() to update the values in its irq_pending[] array when an interrupt arrives. However it is using these functions wrongly: they work on an array of type 'long', and it is passing an array of type 'uint32_t'. Because the code manually figures out the right array element, this works on little-endian hosts and on 32-bit big-endian hosts, where bits 0..31 in a 'long' are in the same place as they are in a 'uint32_t'. However it breaks on 64-bit big-endian hosts.
Remove the use of set_bit() and clear_bit() in favour of using deposit32() on the array element. This fixes a bug where on big-endian 64-bit hosts the guest kernel would hang early on in bootup.
Message-id: [email protected]
--- hw/intc/allwinner-a10-pic.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
hw/intc/allwinner-a10-pic.c +2 -5
@@ -49,12 +49,9 @@ static void aw_a10_pic_update(AwA10PICState *s)static void aw_a10_pic_set_irq (void *opaque,int irq,int level) {AwA10PICState *s = opaque; +uint32_t *pending_reg = &s->irq_pending[irq /32 ]; -if (level) { -set_bit (irq %32 , (void *)&s->irq_pending[irq /32 ]); - }else { -clear_bit (irq %32 , (void *)&s->irq_pending[irq /32 ]); - } + *pending_reg =deposit32 (*pending_reg, irq %32 ,1 , level);aw_a10_pic_update (s); }
Signature · 1 line
2.34.1
Re: [PULL 31/35] hw/intc/allwinner-a10-pic: Don't use set_bit()/clear_bit()
Hi,
Quoted 14 lines · Peter Maydell
The Allwinner PIC model uses
set_bit()andclear_bit()to update the values in its irq_pending[] array when an interrupt arrives. However it is using these functions wrongly: they work on an array of type 'long', and it is passing an array of type 'uint32_t'. Because the code manually figures out the right array element, this works on little-endian hosts and on 32-bit big-endian hosts, where bits 0..31 in a 'long' are in the same place as they are in a 'uint32_t'. However it breaks on 64-bit big-endian hosts.Remove the use of
set_bit()andclear_bit()in favour of usingdeposit32()on the array element. This fixes a bug where on big-endian 64-bit hosts the guest kernel would hang early on in bootup.
Quoted 5 lines
Signed-off-by Peter Maydell <[email protected]>Reviewed-by Thomas Huth <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>Message-id: [email protected]
In v8.0.2, the cubieboard emulation running Linux crashes during reboot with a hung task error. Tested with mainline Linux (v6.4-rc4-78-g929ed21dfdb6) and with v5.15.114. Host is AMD Ryzen 5900X.
Requesting system reboot
[ 61.927460] INFO: task kworker/0:1:13 blocked for more than 30 seconds. [ 61.927896] Not tainted 5.15.115-rc2-00038-g31e35d9f1b8d #1 [ 61.928144] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [ 61.928419] task:kworker/0:1 state:D stack: 0 pid: 13 ppid: 2 flags:0x00000000 [ 61.928972] Workqueue: events_freezable mmc_rescan [ 61.929739] [<c13734f0>] (__schedule) from [<c1373c98>] (schedule+0x80/0x15c) [ 61.930041] [<c1373c98>] (schedule) from [<c137ad64>] (schedule_timeout+0xd4/0x12c) [ 61.930270] [<c137ad64>] (schedule_timeout) from [<c137477c>] (do_wait_for_common+0xa0/0x154) [ 61.930523] [<c137477c>] (do_wait_for_common) from [<c1374870>] (wait_for_completion+0x40/0x4c) [ 61.930764] [<c1374870>] (wait_for_completion) from [<c1044cd0>] (mmc_wait_for_req_done+0x6c/0x90) [ 61.931012] [<c1044cd0>] (mmc_wait_for_req_done) from [<c1044e34>] (mmc_wait_for_cmd+0x70/0xa8) [ 61.931252] [<c1044e34>] (mmc_wait_for_cmd) from [<c10512a0>] (sdio_reset+0x58/0x124) [ 61.931478] [<c10512a0>] (sdio_reset) from [<c1046328>] (mmc_rescan+0x294/0x30c) [ 61.931692] [<c1046328>] (mmc_rescan) from [<c036be10>] (process_one_work+0x28c/0x720) [ 61.931924] [<c036be10>] (process_one_work) from [<c036c308>] (worker_thread+0x64/0x53c) [ 61.932153] [<c036c308>] (worker_thread) from [<c03753e0>] (kthread+0x15c/0x180) [ 61.932365] [<c03753e0>] (kthread) from [<c030015c>] (ret_from_fork+0x14/0x38) [ 61.932628] Exception stack(0xc31ddfb0 to 0xc31ddff8)
This was not seen with v8.0.0. Bisect points to this patch. Reverting it fixes the problem.
Bisect log is attached.
Guenter
---
# bad: [f7f686b61cf7ee142c9264d2e04ac2c6a96d37f8] Update version for 8.0.2 release
# good: [c1eb2ddf0f8075faddc5f7c3d39feae3e8e9d6b4] Update version for v8.0.0 release
git bisect start 'v8.0.2' 'v8.0.0'
# bad: [21b54a683d14c0c6f9af35536d9059c60b7449ca] s390x/pv: Fix spurious warning with asynchronous teardown git bisect bad 21b54a683d14c0c6f9af35536d9059c60b7449ca
# bad: [4dc5df865c482c6e8894964c7f300fa556c3b78e] softfloat: Fix the incorrect computation in float32_exp2 git bisect bad 4dc5df865c482c6e8894964c7f300fa556c3b78e
# good: [f0c5a780292bd405bbce818b63757313cafcf262] target/arm: Initialize debug capabilities only once git bisect good f0c5a780292bd405bbce818b63757313cafcf262
# bad: [af08c70ef5204fedb2b974fbecaf65e1b6cc0a2f] hw/intc/allwinner-a10-pic: Don't use set_bit()/clear_bit() git bisect bad af08c70ef5204fedb2b974fbecaf65e1b6cc0a2f
# good: [168f193c5be54fc9a6d725dbb9974c0d2815792a] hw/arm/boot: Make write_bootloader() public as arm_write_bootloader() git bisect good 168f193c5be54fc9a6d725dbb9974c0d2815792a
# good: [975f12aa528d6cab5cc41efebaf05d7eb7296d94] hw/arm/raspi: Use arm_write_bootloader() to write boot code git bisect good 975f12aa528d6cab5cc41efebaf05d7eb7296d94
# first bad commit: [af08c70ef5204fedb2b974fbecaf65e1b6cc0a2f] hw/intc/allwinner-a10-pic: Don't use set_bit()/clear_bit()
Re: [PULL 31/35] hw/intc/allwinner-a10-pic: Don't use set_bit()/clear_bit()
Quoted 47 lines · Guenter Roeck
Hi,
Quoted 14 lines · Peter Maydell
The Allwinner PIC model uses
set_bit()andclear_bit()to update the values in its irq_pending[] array when an interrupt arrives. However it is using these functions wrongly: they work on an array of type 'long', and it is passing an array of type 'uint32_t'. Because the code manually figures out the right array element, this works on little-endian hosts and on 32-bit big-endian hosts, where bits 0..31 in a 'long' are in the same place as they are in a 'uint32_t'. However it breaks on 64-bit big-endian hosts.Remove the use of
set_bit()andclear_bit()in favour of usingdeposit32()on the array element. This fixes a bug where on big-endian 64-bit hosts the guest kernel would hang early on in bootup.Quoted 5 lines
Signed-off-by Peter Maydell <[email protected]>Reviewed-by Thomas Huth <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>Message-id: [email protected]
In v8.0.2, the cubieboard emulation running Linux crashes during reboot with a hung task error. Tested with mainline Linux (v6.4-rc4-78-g929ed21dfdb6) and with v5.15.114. Host is AMD Ryzen 5900X.
Requesting system reboot
[ 61.927460] INFO: task kworker/0:1:13 blocked for more than 30 seconds. [ 61.927896] Not tainted 5.15.115-rc2-00038-g31e35d9f1b8d #1 [ 61.928144] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [ 61.928419] task:kworker/0:1 state:D stack: 0 pid: 13 ppid: 2 flags:0x00000000 [ 61.928972] Workqueue: events_freezable mmc_rescan [ 61.929739] [<c13734f0>] (__schedule) from [<c1373c98>] (schedule+0x80/0x15c) [ 61.930041] [<c1373c98>] (schedule) from [<c137ad64>] (schedule_timeout+0xd4/0x12c) [ 61.930270] [<c137ad64>] (schedule_timeout) from [<c137477c>] (do_wait_for_common+0xa0/0x154) [ 61.930523] [<c137477c>] (do_wait_for_common) from [<c1374870>] (wait_for_completion+0x40/0x4c) [ 61.930764] [<c1374870>] (wait_for_completion) from [<c1044cd0>] (mmc_wait_for_req_done+0x6c/0x90) [ 61.931012] [<c1044cd0>] (mmc_wait_for_req_done) from [<c1044e34>] (mmc_wait_for_cmd+0x70/0xa8) [ 61.931252] [<c1044e34>] (mmc_wait_for_cmd) from [<c10512a0>] (sdio_reset+0x58/0x124) [ 61.931478] [<c10512a0>] (sdio_reset) from [<c1046328>] (mmc_rescan+0x294/0x30c) [ 61.931692] [<c1046328>] (mmc_rescan) from [<c036be10>] (process_one_work+0x28c/0x720) [ 61.931924] [<c036be10>] (process_one_work) from [<c036c308>] (worker_thread+0x64/0x53c) [ 61.932153] [<c036c308>] (worker_thread) from [<c03753e0>] (kthread+0x15c/0x180) [ 61.932365] [<c03753e0>] (kthread) from [<c030015c>] (ret_from_fork+0x14/0x38) [ 61.932628] Exception stack(0xc31ddfb0 to 0xc31ddff8)
Quoted 2 lines
This was not seen with v8.0.0. Bisect points to this patch. Reverting it fixes the problem.
Does this happen on master too, or just on stable-8.0 ?
Thanks,
/mjt
Re: [PULL 31/35] hw/intc/allwinner-a10-pic: Don't use set_bit()/clear_bit()
Quoted 48 lines · Michael Tokarev
Quoted 47 lines · Guenter Roeck
Hi,
Quoted 14 lines · Peter Maydell
The Allwinner PIC model uses
set_bit()andclear_bit()to update the values in its irq_pending[] array when an interrupt arrives. However it is using these functions wrongly: they work on an array of type 'long', and it is passing an array of type 'uint32_t'. Because the code manually figures out the right array element, this works on little-endian hosts and on 32-bit big-endian hosts, where bits 0..31 in a 'long' are in the same place as they are in a 'uint32_t'. However it breaks on 64-bit big-endian hosts.Remove the use of
set_bit()andclear_bit()in favour of usingdeposit32()on the array element. This fixes a bug where on big-endian 64-bit hosts the guest kernel would hang early on in bootup.Quoted 5 lines
Signed-off-by Peter Maydell <[email protected]>Reviewed-by Thomas Huth <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>Message-id: [email protected]
In v8.0.2, the cubieboard emulation running Linux crashes during reboot with a hung task error. Tested with mainline Linux (v6.4-rc4-78-g929ed21dfdb6) and with v5.15.114. Host is AMD Ryzen 5900X.
Requesting system reboot
[ 61.927460] INFO: task kworker/0:1:13 blocked for more than 30 seconds.
[ 61.927896] Not tainted 5.15.115-rc2-00038-g31e35d9f1b8d #1
[ 61.928144] "echo 0 >/proc/sys/kernel/hung_task_timeout_secs" disables this message. [ 61.928419] task:kworker/0:1 state:D stack: 0 pid: 13 ppid: 2 flags:0x00000000 [ 61.928972] Workqueue:events_freezablemmc_rescan
[ 61.929739] [<c13734f0>] (__schedule) from [<c1373c98>] (schedule+0x80/0x15c)
[ 61.930041] [<c1373c98>] (schedule) from [<c137ad64>] (schedule_timeout+0xd4/0x12c) [ 61.930270] [<c137ad64>] (schedule_timeout) from [<c137477c>] (do_wait_for_common+0xa0/0x154) [ 61.930523] [<c137477c>] (do_wait_for_common) from [<c1374870>] (wait_for_completion+0x40/0x4c) [ 61.930764] [<c1374870>] (wait_for_completion) from [<c1044cd0>] (mmc_wait_for_req_done+0x6c/0x90) [ 61.931012] [<c1044cd0>] (mmc_wait_for_req_done) from [<c1044e34>] (mmc_wait_for_cmd+0x70/0xa8) [ 61.931252] [<c1044e34>] (mmc_wait_for_cmd) from [<c10512a0>] (sdio_reset+0x58/0x124) [ 61.931478] [<c10512a0>] (sdio_reset) from [<c1046328>] (mmc_rescan+0x294/0x30c)
[ 61.931692] [<c1046328>] (mmc_rescan) from [<c036be10>] (process_one_work+0x28c/0x720) [ 61.931924] [<c036be10>] (process_one_work) from [<c036c308>] (worker_thread+0x64/0x53c) [ 61.932153] [<c036c308>] (worker_thread) from [<c03753e0>] (kthread+0x15c/0x180)
[ 61.932365] [<c03753e0>] (kthread) from [<c030015c>] (ret_from_fork+0x14/0x38)
[ 61.932628] Exception stack(0xc31ddfb0 to0xc31ddff8)
Quoted 5 lines
Quoted 2 lines
This was not seen with v8.0.0. Bisect points to this patch. Reverting it fixes the problem.
Does this happen on master too, or just on stable-8.0 ?
It does. Tested with v8.0.0-1542-g848a6caa88.
Here is my command line in case you want to give it a try:
qemu-system-arm -M cubieboard -kernel arch/arm/boot/zImage -no-reboot \
-initrd rootfs-armv5.cpio -m 512 \
--append "panic=-1 rdinit=/sbin/init earlycon=uart8250,mmio32,0x1c28000,115200n8 console=ttyS0" \
-dtb arch/arm/boot/dts/sun4i-a10-cubieboard.dtb -nographic \
-monitor null -serial stdioinitrd is https://github.com/groeck/linux-build-test/blob/master/rootfs/arm-v7/rootfs-armv5.cpio.gz
This is with multi_v7_defconfig with some debug options added. If necessary I'll be happy to provide the exact configuration.
Guenter
Re: [PULL 31/35] hw/intc/allwinner-a10-pic: Don't use set_bit()/clear_bit()
Quoted 66 lines · Guenter Roeck
Quoted 48 lines · Michael Tokarev
Quoted 47 lines · Guenter Roeck
Hi,
Quoted 14 lines · Peter Maydell
The Allwinner PIC model uses
set_bit()andclear_bit()to update the values in its irq_pending[] array when an interrupt arrives. However it is using these functions wrongly: they work on an array of type 'long', and it is passing an array of type 'uint32_t'. Because the code manually figures out the right array element, this works on little-endian hosts and on 32-bit big-endian hosts, where bits 0..31 in a 'long' are in the same place as they are in a 'uint32_t'. However it breaks on 64-bit big-endian hosts.Remove the use of
set_bit()andclear_bit()in favour of usingdeposit32()on the array element. This fixes a bug where on big-endian 64-bit hosts the guest kernel would hang early on in bootup.Quoted 5 lines
Signed-off-by Peter Maydell <[email protected]>Reviewed-by Thomas Huth <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>Message-id: [email protected]
In v8.0.2, the cubieboard emulation running Linux crashes during reboot with a hung task error. Tested with mainline Linux (v6.4-rc4-78-g929ed21dfdb6) and with v5.15.114. Host is AMD Ryzen 5900X.
Requesting system reboot
[ 61.927460] INFO: task kworker/0:1:13 blocked for more than 30 seconds. [ 61.927896] Not tainted 5.15.115-rc2-00038-g31e35d9f1b8d #1 [ 61.928144] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [ 61.928419] task:kworker/0:1 state:D stack: 0 pid: 13 ppid: 2 flags:0x00000000 [ 61.928972] Workqueue: events_freezable mmc_rescan [ 61.929739] [<c13734f0>] (__schedule) from [<c1373c98>] (schedule+0x80/0x15c) [ 61.930041] [<c1373c98>] (schedule) from [<c137ad64>] (schedule_timeout+0xd4/0x12c) [ 61.930270] [<c137ad64>] (schedule_timeout) from [<c137477c>] (do_wait_for_common+0xa0/0x154) [ 61.930523] [<c137477c>] (do_wait_for_common) from [<c1374870>] (wait_for_completion+0x40/0x4c) [ 61.930764] [<c1374870>] (wait_for_completion) from [<c1044cd0>] (mmc_wait_for_req_done+0x6c/0x90) [ 61.931012] [<c1044cd0>] (mmc_wait_for_req_done) from [<c1044e34>] (mmc_wait_for_cmd+0x70/0xa8) [ 61.931252] [<c1044e34>] (mmc_wait_for_cmd) from [<c10512a0>] (sdio_reset+0x58/0x124) [ 61.931478] [<c10512a0>] (sdio_reset) from [<c1046328>] (mmc_rescan+0x294/0x30c) [ 61.931692] [<c1046328>] (mmc_rescan) from [<c036be10>] (process_one_work+0x28c/0x720) [ 61.931924] [<c036be10>] (process_one_work) from [<c036c308>] (worker_thread+0x64/0x53c) [ 61.932153] [<c036c308>] (worker_thread) from [<c03753e0>] (kthread+0x15c/0x180) [ 61.932365] [<c03753e0>] (kthread) from [<c030015c>] (ret_from_fork+0x14/0x38) [ 61.932628] Exception stack(0xc31ddfb0 to 0xc31ddff8)Quoted 5 lines
Quoted 2 lines
This was not seen with v8.0.0. Bisect points to this patch. Reverting it fixes the problem.
Does this happen on master too, or just on stable-8.0 ?
It does. Tested with v8.0.0-1542-g848a6caa88.
Here is my command line in case you want to give it a try:
qemu-system-arm -M cubieboard -kernel arch/arm/boot/zImage -no-reboot \ -initrd rootfs-armv5.cpio -m 512 \ --append "panic=-1 rdinit=/sbin/init earlycon=uart8250,mmio32,0x1c28000,115200n8 console=ttyS0" \ -dtb arch/arm/boot/dts/sun4i-a10-cubieboard.dtb -nographic \ -monitor null -serial stdio
Quoted 4 lines
initrd is https://github.com/groeck/linux-build-test/blob/master/rootfs/arm-v7/rootfs-armv5.cpio.gz
This is with
multi_v7_defconfigwith some debug options added. If necessary I'll be happy to provide the exact configuration.
If you can provide a link to the zImage and the dtb to reproduce as well, that would be helpful.
thanks
-- PMM
Re: [PULL 31/35] hw/intc/allwinner-a10-pic: Don't use set_bit()/clear_bit()
Quoted 67 lines · Peter Maydell
Quoted 66 lines · Guenter Roeck
Quoted 48 lines · Michael Tokarev
Quoted 47 lines · Guenter Roeck
Hi,
Quoted 14 lines · Peter Maydell
The Allwinner PIC model uses
set_bit()andclear_bit()to update the values in its irq_pending[] array when an interrupt arrives. However it is using these functions wrongly: they work on an array of type 'long', and it is passing an array of type 'uint32_t'. Because the code manually figures out the right array element, this works on little-endian hosts and on 32-bit big-endian hosts, where bits 0..31 in a 'long' are in the same place as they are in a 'uint32_t'. However it breaks on 64-bit big-endian hosts.Remove the use of
set_bit()andclear_bit()in favour of usingdeposit32()on the array element. This fixes a bug where on big-endian 64-bit hosts the guest kernel would hang early on in bootup.Quoted 5 lines
Signed-off-by Peter Maydell <[email protected]>Reviewed-by Thomas Huth <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>Message-id: [email protected]
In v8.0.2, the cubieboard emulation running Linux crashes during reboot with a hung task error. Tested with mainline Linux (v6.4-rc4-78-g929ed21dfdb6) and with v5.15.114. Host is AMD Ryzen 5900X.
Requesting system reboot
[ 61.927460] INFO: task kworker/0:1:13 blocked for more than 30 seconds. [ 61.927896] Not tainted 5.15.115-rc2-00038-g31e35d9f1b8d #1 [ 61.928144] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [ 61.928419] task:kworker/0:1 state:D stack: 0 pid: 13 ppid: 2 flags:0x00000000 [ 61.928972] Workqueue: events_freezable mmc_rescan [ 61.929739] [<c13734f0>] (__schedule) from [<c1373c98>] (schedule+0x80/0x15c) [ 61.930041] [<c1373c98>] (schedule) from [<c137ad64>] (schedule_timeout+0xd4/0x12c) [ 61.930270] [<c137ad64>] (schedule_timeout) from [<c137477c>] (do_wait_for_common+0xa0/0x154) [ 61.930523] [<c137477c>] (do_wait_for_common) from [<c1374870>] (wait_for_completion+0x40/0x4c) [ 61.930764] [<c1374870>] (wait_for_completion) from [<c1044cd0>] (mmc_wait_for_req_done+0x6c/0x90) [ 61.931012] [<c1044cd0>] (mmc_wait_for_req_done) from [<c1044e34>] (mmc_wait_for_cmd+0x70/0xa8) [ 61.931252] [<c1044e34>] (mmc_wait_for_cmd) from [<c10512a0>] (sdio_reset+0x58/0x124) [ 61.931478] [<c10512a0>] (sdio_reset) from [<c1046328>] (mmc_rescan+0x294/0x30c) [ 61.931692] [<c1046328>] (mmc_rescan) from [<c036be10>] (process_one_work+0x28c/0x720) [ 61.931924] [<c036be10>] (process_one_work) from [<c036c308>] (worker_thread+0x64/0x53c) [ 61.932153] [<c036c308>] (worker_thread) from [<c03753e0>] (kthread+0x15c/0x180) [ 61.932365] [<c03753e0>] (kthread) from [<c030015c>] (ret_from_fork+0x14/0x38) [ 61.932628] Exception stack(0xc31ddfb0 to 0xc31ddff8)Quoted 5 lines
Quoted 2 lines
This was not seen with v8.0.0. Bisect points to this patch. Reverting it fixes the problem.
Does this happen on master too, or just on stable-8.0 ?
It does. Tested with v8.0.0-1542-g848a6caa88.
Here is my command line in case you want to give it a try:
qemu-system-arm -M cubieboard -kernel arch/arm/boot/zImage -no-reboot \ -initrd rootfs-armv5.cpio -m 512 \ --append "panic=-1 rdinit=/sbin/init earlycon=uart8250,mmio32,0x1c28000,115200n8 console=ttyS0" \ -dtb arch/arm/boot/dts/sun4i-a10-cubieboard.dtb -nographic \ -monitor null -serial stdio
Quoted 8 lines
Quoted 4 lines
initrd is https://github.com/groeck/linux-build-test/blob/master/rootfs/arm-v7/rootfs-armv5.cpio.gz
This is with
multi_v7_defconfigwith some debug options added. If necessary I'll be happy to provide the exact configuration.If you can provide a link to the zImage and the dtb to reproduce as well, that would be helpful.
Please see http://server.roeck-us.net/qemu/arm-v7/.
There are also compiled versions of qemu v8.0.0 and v8.0.2 as well as scripts to run the test. Note that the initrd will auto-reboot. The cubieboard emulation does not support board reset, so the test will normally end with
Requesting system reboot
[ 22.020700] reboot: Restarting system
In the failure case, the second line is not seen, and there will be a hung task crash about 30 seconds after the reboot request.
Requesting system reboot
[ 61.960821] INFO: task kworker/0:2:67 blocked for more than 30 seconds. [ 61.961406] Tainted: G N 6.4.0-rc5 #1
Hope this helps,
Guenter
Re: [PULL 31/35] hw/intc/allwinner-a10-pic: Don't use set_bit()/clear_bit()
Quoted 7 lines · Guenter Roeck
Quoted 2 lines · Peter Maydell
If you can provide a link to the zImage and the dtb to reproduce as well, that would be helpful.
Please see http://server.roeck-us.net/qemu/arm-v7/.
Thanks. I've identified the cause of the regression; will send a patch shortly.
-- PMM
[PULL 18/35] accel/tcg: Use one_insn_per_tb global instead of old singlestep global
In reply to Peter MaydellThe only place left that looks at the old 'singlestep' global variable is the TCG curr_cflags() function. Replace the old global with a new 'one_insn_per_tb' which is defined in tcg-all.c and declared in accel/tcg/internal.h. This keeps it restricted to the TCG code, unlike 'singlestep' which was available to every file in the system and defined in multiple different places for softmmu vs linux-user vs bsd-user.
While we're making this change, use qatomic_read() and qatomic_set() on the accesses to the new global, because TCG will read it without holding a lock.
Message-id: [email protected]
--- accel/tcg/internal.h | 2 ++ include/exec/cpu-common.h | 2 -- accel/tcg/cpu-exec.c | 2 +- accel/tcg/tcg-all.c | 6 ++++-- bsd-user/main.c | 1 - linux-user/main.c | 1 - softmmu/globals.c | 1 - 7 files changed, 7 insertions(+), 8 deletions(-)
accel/tcg/internal.h +2 -0
@@ -67,4 +67,6 @@ static inline target_ulong log_pc(CPUState *cpu, const TranslationBlock *tb)extern int64_t max_delay;extern int64_t max_advance; +extern bool one_insn_per_tb; +#endif /* ACCEL_TCG_INTERNAL_H */
include/exec/cpu-common.h +0 -2
@@ -163,8 +163,6 @@ int cpu_memory_rw_debug(CPUState *cpu, vaddr addr, void *ptr, size_t len, bool is_write);/* vl.c */ -extern int singlestep; -void list_cpus (void );#endif /* CPU_COMMON_H */
accel/tcg/cpu-exec.c +1 -1
@@ -159,7 +159,7 @@ uint32_t curr_cflags(CPUState *cpu)*/ if (unlikely (cpu->singlestep_enabled)) { cflags |=CF_NO_GOTO_TB |CF_NO_GOTO_PTR |CF_SINGLE_STEP |1 ; - }else if (singlestep) { + }else if (qatomic_read (&one_insn_per_tb)) { cflags |=CF_NO_GOTO_TB |1 ; }else if (qemu_loglevel_mask (CPU_LOG_TB_NOCHAIN )) { cflags |=CF_NO_GOTO_TB ;
accel/tcg/tcg-all.c +4 -2
@@ -31,6 +31,7 @@#include "qapi/error.h" #include "qemu/error-report.h" #include "qemu/accel.h" +#include "qemu/atomic.h" #include "qapi/qapi-builtin-visit.h" #include "qemu/units.h" #if !defined(CONFIG_USER_ONLY )
@@ -110,6 +111,7 @@ static void tcg_accel_instance_init(Object *obj) }bool mttcg_enabled; +bool one_insn_per_tb;static int tcg_init_machine (MachineState *ms) {
@@ -219,8 +221,8 @@ static void tcg_set_one_insn_per_tb(Object *obj, bool value, Error **errp) {TCGState *s =TCG_STATE (obj); s->one_insn_per_tb = value; -/* For the moment, set the global also: this changes the behaviour */ - singlestep = value; +/* Set the global also: this changes the behaviour */ +qatomic_set (&one_insn_per_tb, value); }static int tcg_gdbstub_supported_sstep_flags (void )
bsd-user/main.c +0 -1
@@ -49,7 +49,6 @@#include "host-os.h" #include "target_arch_cpu.h" -int singlestep;static bool opt_one_insn_per_tb;uintptr_t guest_base;bool have_guest_base;
linux-user/main.c +0 -1
@@ -68,7 +68,6 @@char *exec_path;char real_exec_path[PATH_MAX ]; -int singlestep;static bool opt_one_insn_per_tb;static const char *argv0;static const char *gdbstub;
softmmu/globals.c +0 -1
@@ -43,7 +43,6 @@ int vga_interface_type = VGA_NONE;bool vga_interface_created;Chardev *parallel_hds[MAX_PARALLEL_PORTS ];int win2k_install_hack; -int singlestep;int fd_bootchk =1 ;int graphic_rotate;QEMUOptionRom option_rom[MAX_OPTION_ROMS ];
Signature · 1 line
2.34.1
[PULL 32/35] target/arm: Define and use new load_cpu_field_low32()
In reply to Peter MaydellIn several places in the 32-bit Arm translate.c, we try to use load_cpu_field() to load from a CPUARMState field into a TCGv_i32 where the field is actually 64-bit. This works on little-endian hosts, but gives the wrong half of the register on big-endian.
Add a new load_cpu_field_low32() which loads the low 32 bits of a 64-bit field into a TCGv_i32. The new macro includes a compile-time check against accidentally using it on a field of the wrong size. Use it to fix the two places in the code where we were using load_cpu_field() on a 64-bit field.
This fixes a bug where on big-endian hosts the guest would crash after executing an ERET instruction, and a more corner case one where some UNDEFs for attempted accesses to MSR banked registers from Secure EL1 might go to the wrong EL.
Message-id: [email protected]
--- target/arm/translate-a32.h | 7 +++++++ target/arm/tcg/translate.c | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-)
target/arm/translate-a32.h +7 -0
@@ -61,6 +61,13 @@ static inline TCGv_i32 load_cpu_offset(int offset)#define load_cpu_field (name) load_cpu_offset(offsetof(CPUARMState, name)) +/* Load from the low half of a 64-bit field to a TCGv_i32 */ +#define load_cpu_field_low32 (name) \ + ({ \ + QEMU_BUILD_BUG_ON(sizeof_field(CPUARMState, name) != 8); \ + load_cpu_offset(offsetoflow32(CPUARMState, name)); \ + }) +void store_cpu_offset (TCGv_i32 var,int offset,int size);#define store_cpu_field (var, name) \
target/arm/tcg/translate.c +2 -2
@@ -2816,7 +2816,7 @@ static bool msr_banked_access_decode(DisasContext *s, int r, int sysm, int rn,if (arm_dc_feature (s,ARM_FEATURE_AARCH64 ) &&dc_isar_feature (aa64_sel2, s)) {/* Target EL is EL<3 minus SCR_EL3.EEL2> */ - tcg_el =load_cpu_field (cp15.scr_el3); + tcg_el =load_cpu_field_low32 (cp15.scr_el3);tcg_gen_sextract_i32 (tcg_el, tcg_el,ctz32 (SCR_EEL2 ),1 );tcg_gen_addi_i32 (tcg_el, tcg_el,3 ); }else {
@@ -6396,7 +6396,7 @@ static bool trans_ERET(DisasContext *s, arg_ERET *a) }if (s->current_el ==2 ) {/* ERET from Hyp uses ELR_Hyp, not LR */ - tmp =load_cpu_field (elr_el[2 ]); + tmp =load_cpu_field_low32 (elr_el[2 ]); }else { tmp =load_reg (s,14 ); }
Signature · 1 line
2.34.1
[PULL 16/35] make one-insn-per-tb an accel option
In reply to Peter MaydellThis commit adds 'one-insn-per-tb' as a property on the TCG accelerator object, so you can enable it with
-accel tcg,one-insn-per-tb=on
It has the same behaviour as the existing '-singlestep' command line option. We use a different name because 'singlestep' has always been a confusing choice, because it doesn't have anything to do with single-stepping the CPU. What it does do is force TCG emulation to put one guest instruction in each TB, which can be useful in some situations (such as analysing debug logs).
The existing '-singlestep' commandline options are decoupled from the global 'singlestep' variable and instead now are syntactic sugar for setting the accel property. (These can then go away after a deprecation period.)
The global variable remains for the moment as:
* what the TCG code looks at to change its behaviour
* what HMP and QMP use to query and set the behaviour
In the following commits we'll clean those up to not directly look at the global variable.
Message-id: [email protected]
--- accel/tcg/tcg-all.c | 21 +++++++++++++++++++++ bsd-user/main.c | 8 ++++++-- linux-user/main.c | 8 ++++++-- softmmu/vl.c | 17 +++++++++++++++-- qemu-options.hx | 7 +++++++ 5 files changed, 55 insertions(+), 6 deletions(-)
accel/tcg/tcg-all.c +21 -0
@@ -42,6 +42,7 @@ struct TCGState {AccelState parent_obj;bool mttcg_enabled; +bool one_insn_per_tb;int splitwx_enabled;unsigned long tb_size; };
@@ -208,6 +209,20 @@ static void tcg_set_splitwx(Object *obj, bool value, Error **errp) s->splitwx_enabled = value; } +static bool tcg_get_one_insn_per_tb (Object *obj,Error **errp) +{ +TCGState *s =TCG_STATE (obj); +return s->one_insn_per_tb; +} + +static void tcg_set_one_insn_per_tb (Object *obj,bool value,Error **errp) +{ +TCGState *s =TCG_STATE (obj); + s->one_insn_per_tb = value; +/* For the moment, set the global also: this changes the behaviour */ + singlestep = value; +} +static int tcg_gdbstub_supported_sstep_flags (void ) {/*
@@ -245,6 +260,12 @@ static void tcg_accel_class_init(ObjectClass *oc, void *data) tcg_get_splitwx, tcg_set_splitwx);object_class_property_set_description (oc,"split-wx" ,"Map jit pages into separate RW and RX regions" ); + +object_class_property_add_bool (oc,"one-insn-per-tb" , + tcg_get_one_insn_per_tb, + tcg_set_one_insn_per_tb); +object_class_property_set_description (oc,"one-insn-per-tb" , +"Only put one guest insn in each translation block" ); }static const TypeInfo tcg_accel_type = {
bsd-user/main.c +6 -2
@@ -50,6 +50,7 @@#include "target_arch_cpu.h" int singlestep; +static bool opt_one_insn_per_tb;uintptr_t guest_base;bool have_guest_base;/*
@@ -386,7 +387,7 @@ int main(int argc, char **argv) }else if (!strcmp (r,"seed" )) { seed_optarg = optarg; }else if (!strcmp (r,"singlestep" )) { - singlestep =1 ; + opt_one_insn_per_tb = true; }else if (!strcmp (r,"strace" )) { do_strace =1 ; }else if (!strcmp (r,"trace" )) {
@@ -444,9 +445,12 @@ int main(int argc, char **argv)/* init tcg before creating CPUs and to get qemu_host_page_size */ { -AccelClass *ac =ACCEL_GET_CLASS (current_accel ()); +AccelState *accel =current_accel (); +AccelClass *ac =ACCEL_GET_CLASS (accel);accel_init_interfaces (ac); +object_property_set_bool (OBJECT (accel),"one-insn-per-tb" , + opt_one_insn_per_tb, &error_abort); ac->init_machine (NULL ); } cpu =cpu_create (cpu_type);
linux-user/main.c +6 -2
@@ -69,6 +69,7 @@ char *exec_path;char real_exec_path[PATH_MAX ];int singlestep; +static bool opt_one_insn_per_tb;static const char *argv0;static const char *gdbstub;static envlist_t *envlist;
@@ -411,7 +412,7 @@ static void handle_arg_reserved_va(const char *arg)static void handle_arg_singlestep (const char *arg) { - singlestep =1 ; + opt_one_insn_per_tb = true; }static void handle_arg_strace (const char *arg)
@@ -777,9 +778,12 @@ int main(int argc, char **argv, char **envp)/* init tcg before creating CPUs and to get qemu_host_page_size */ { -AccelClass *ac =ACCEL_GET_CLASS (current_accel ()); +AccelState *accel =current_accel (); +AccelClass *ac =ACCEL_GET_CLASS (accel);accel_init_interfaces (ac); +object_property_set_bool (OBJECT (accel),"one-insn-per-tb" , + opt_one_insn_per_tb, &error_abort); ac->init_machine (NULL ); } cpu =cpu_create (cpu_type);
softmmu/vl.c +15 -2
@@ -182,6 +182,7 @@ static const char *log_file;static bool list_data_dirs;static const char *qtest_chrdev;static const char *qtest_log; +static bool opt_one_insn_per_tb;static int has_defaults =1 ;static int default_serial =1 ;
@@ -2220,7 +2221,19 @@ static int do_configure_accelerator(void *opaque, QemuOpts *opts, Error **errp)qemu_opt_foreach (opts, accelerator_set_property, accel, &error_fatal); - +/* +* If legacy -singlestep option is set, honour it for TCG and +* silently ignore for any other accelerator (which is how this +* option has always behaved). +*/ +if (opt_one_insn_per_tb) { +/* +* This will always succeed for TCG, and we want to ignore +* the error from trying to set a nonexistent property +* on any other accelerator. +*/ +object_property_set_bool (OBJECT (accel),"one-insn-per-tb" , true,NULL ); + } ret =accel_init_machine (accel, current_machine);if (ret <0 ) {if (!qtest_with_kvm || ret != -ENOENT ) {
@@ -2955,7 +2968,7 @@ void qemu_init(int argc, char **argv)qdict_put_str (machine_opts_dict,"firmware" , optarg);break ;case QEMU_OPTION_singlestep: - singlestep =1 ; + opt_one_insn_per_tb = true;break ;case QEMU_OPTION_S : autostart =0 ;
qemu-options.hx +7 -0
@@ -182,6 +182,7 @@ DEF("accel", HAS_ARG, QEMU_OPTION_accel, " igd-passthru=on|off (enable Xen integrated Intel graphics passthrough, default=off)\n" " kernel-irqchip=on|off|split controls accelerated irqchip support (default=on)\n" " kvm-shadow-mem=size of KVM shadow MMU in bytes\n" + " one-insn-per-tb=on|off (one guest instruction per TCG translation block)\n" " split-wx=on|off (enable TCG split w^x mapping)\n" " tb-size=n (TCG translation block cache size)\n" " dirty-ring-size=n (KVM dirty ring GFN count, default 0)\n"
@@ -210,6 +211,12 @@ SRST ``kvm-shadow-mem=size`` Defines the size of the KVM shadow MMU. + ``one-insn-per-tb=on|off`` + Makes the TCG accelerator put only one guest instruction into + each translation block. This slows down emulation a lot, but + can be useful in some situations, such as when trying to analyse + the logs produced by the ``-d`` option. + ``split-wx=on|off`` Controls the use of split w^x mapping for the TCG code generation buffer. Some operating systems require this to be enabled, and in
Signature · 1 line
2.34.1
[PULL 28/35] hw/arm/boot: Make write_bootloader() public as arm_write_bootloader()
In reply to Peter MaydellFrom: Cédric Le Goater <[email protected]>
The arm boot.c code includes a utility function write_bootloader() which assists in writing a boot-code fragment into guest memory, including handling endianness and fixing it up with entry point addresses and similar things. This is useful not just for the boot.c code but also in board model code, so rename it to arm_write_bootloader() and make it globally visible.
Since we are making it public, make its API a little neater: move the AddressSpace* argument to be next to the hwaddr argument, and allow the fixupcontext array to be const, since we never modify it in this function.
Message-id: [email protected]
--- include/hw/arm/boot.h | 49 +++++++++++++++++++++++++++++++++++++++++++ hw/arm/boot.c | 35 +++++++------------------------ 2 files changed, 57 insertions(+), 27 deletions(-)
include/hw/arm/boot.h +49 -0
@@ -183,4 +183,53 @@ void arm_write_secure_board_setup_dummy_smc(ARMCPU *cpu,const struct arm_boot_info *info, hwaddr mvbar_addr); +typedef enum { +FIXUP_NONE =0 ,/* do nothing */ +FIXUP_TERMINATOR ,/* end of insns */ +FIXUP_BOARDID ,/* overwrite with board ID number */ +FIXUP_BOARD_SETUP ,/* overwrite with board specific setup code address */ +FIXUP_ARGPTR_LO ,/* overwrite with pointer to kernel args */ +FIXUP_ARGPTR_HI ,/* overwrite with pointer to kernel args (high half) */ +FIXUP_ENTRYPOINT_LO ,/* overwrite with kernel entry point */ +FIXUP_ENTRYPOINT_HI ,/* overwrite with kernel entry point (high half) */ +FIXUP_GIC_CPU_IF ,/* overwrite with GIC CPU interface address */ +FIXUP_BOOTREG ,/* overwrite with boot register address */ +FIXUP_DSB ,/* overwrite with correct DSB insn for cpu */ +FIXUP_MAX , +}FixupType ; + +typedef struct ARMInsnFixup { +uint32_t insn; +FixupType fixup; +}ARMInsnFixup ; + +/** +* arm_write_bootloader - write a bootloader to guest memory +* @name: name of the bootloader blob +* @as: AddressSpace to write the bootloader +* @addr: guest address to write it +* @insns: the blob to be loaded +* @fixupcontext: context to be used for any fixups in @insns +* +* Write a bootloader to guest memory at address @addr in the address +* space @as. @name is the name to use for the resulting ROM blob, so +* it should be unique in the system and reasonably identifiable for debugging. +* +* @insns must be an array of ARMInsnFixup structs, each of which has +* one 32-bit value to be written to the guest memory, and a fixup to be +* applied to the value. FIXUP_NONE (do nothing) is value 0, so effectively +* the fixup is optional when writing a struct initializer. +* The final entry in the array must be { 0, FIXUP_TERMINATOR }. +* +* All other supported fixup types have the semantics "ignore insn +* and instead use the value from the array element @fixupcontext[fixup]". +* The caller should therefore provide @fixupcontext as an array of +* size FIXUP_MAX whose elements have been initialized for at least +* the entries that @insns refers to. +*/ +void arm_write_bootloader (const char *name, +AddressSpace *as,hwaddr addr, +const ARMInsnFixup *insns, +const uint32_t *fixupcontext); +#endif /* HW_ARM_BOOT_H */
hw/arm/boot.c +8 -27
@@ -60,26 +60,6 @@ AddressSpace *arm_boot_address_space(ARMCPU *cpu,return cpu_get_address_space (cs, asidx); } -typedef enum { -FIXUP_NONE =0 ,/* do nothing */ -FIXUP_TERMINATOR ,/* end of insns */ -FIXUP_BOARDID ,/* overwrite with board ID number */ -FIXUP_BOARD_SETUP ,/* overwrite with board specific setup code address */ -FIXUP_ARGPTR_LO ,/* overwrite with pointer to kernel args */ -FIXUP_ARGPTR_HI ,/* overwrite with pointer to kernel args (high half) */ -FIXUP_ENTRYPOINT_LO ,/* overwrite with kernel entry point */ -FIXUP_ENTRYPOINT_HI ,/* overwrite with kernel entry point (high half) */ -FIXUP_GIC_CPU_IF ,/* overwrite with GIC CPU interface address */ -FIXUP_BOOTREG ,/* overwrite with boot register address */ -FIXUP_DSB ,/* overwrite with correct DSB insn for cpu */ -FIXUP_MAX , -}FixupType ; - -typedef struct ARMInsnFixup { -uint32_t insn; -FixupType fixup; -}ARMInsnFixup ; -static const ARMInsnFixup bootloader_aarch64[] = { {0x580000c0 },/* ldr x0, arg ; Load the lower 32-bits of DTB */ {0xaa1f03e1 },/* mov x1, xzr */
@@ -150,9 +130,10 @@ static const ARMInsnFixup smpboot[] = { { 0, FIXUP_TERMINATOR } }; -static void write_bootloader (const char *name,hwaddr addr, -const ARMInsnFixup *insns,uint32_t *fixupcontext, -AddressSpace *as) +void arm_write_bootloader (const char *name, +AddressSpace *as,hwaddr addr, +const ARMInsnFixup *insns, +const uint32_t *fixupcontext) {/* Fix up the specified bootloader fragment and write it into * guest memory using rom_add_blob_fixed(). fixupcontext is
@@ -214,8 +195,8 @@ static void default_write_secondary(ARMCPU *cpu, fixupcontext[FIXUP_DSB ] =CP15_DSB_INSN ; } -write_bootloader ("smpboot" , info->smp_loader_start, - smpboot, fixupcontext, as); +arm_write_bootloader ("smpboot" , as, info->smp_loader_start, + smpboot, fixupcontext); } void arm_write_secure_board_setup_dummy_smc(ARMCPU *cpu,
@@ -1186,8 +1167,8 @@ static void arm_setup_direct_kernel_boot(ARMCPU *cpu, fixupcontext[FIXUP_ENTRYPOINT_LO ] = entry; fixupcontext[FIXUP_ENTRYPOINT_HI ] = entry >>32 ; -write_bootloader ("bootloader" , info->loader_start, - primary_loader, fixupcontext, as); +arm_write_bootloader ("bootloader" , as, info->loader_start, + primary_loader, fixupcontext);if (info->write_board_setup) { info->write_board_setup (cpu, info);
Signature · 1 line
2.34.1
[PULL 29/35] hw/arm/aspeed: Use arm_write_bootloader() to write the bootloader
In reply to Peter MaydellFrom: Cédric Le Goater <[email protected]>
When writing the secondary-CPU stub boot loader code to the guest, use arm_write_bootloader() instead of directly calling rom_add_blob_fixed(). This fixes a bug on big-endian hosts, because arm_write_bootloader() will correctly byte-swap the host-byte-order array values into the guest-byte-order to write into the guest memory.
Message-id: [email protected] [PMM: Moved the "make arm_write_bootloader() function public" part
to its own patch; updated commit message to note that this fixes an actual bug; adjust to the API changes noted in previous commit]
--- hw/arm/aspeed.c | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-)
hw/arm/aspeed.c +20 -18
@@ -200,33 +200,35 @@ struct AspeedMachineState {static void aspeed_write_smpboot (ARMCPU *cpu,const struct arm_boot_info *info) { -static const uint32_t poll_mailbox_ready[] = { +AddressSpace *as =arm_boot_address_space (cpu, info); +static const ARMInsnFixup poll_mailbox_ready[] = {/* * r2 = per-cpu go sign value * r1 = AST_SMP_MBOX_FIELD_ENTRY * r0 = AST_SMP_MBOX_FIELD_GOSIGN */ -0xee100fb0 ,/* mrc p15, 0, r0, c0, c0, 5 */ -0xe21000ff ,/* ands r0, r0, #255 */ -0xe59f201c ,/* ldr r2, [pc, #28] */ -0xe1822000 ,/* orr r2, r2, r0 */ + {0xee100fb0 },/* mrc p15, 0, r0, c0, c0, 5 */ + {0xe21000ff },/* ands r0, r0, #255 */ + {0xe59f201c },/* ldr r2, [pc, #28] */ + {0xe1822000 },/* orr r2, r2, r0 */ -0xe59f1018 ,/* ldr r1, [pc, #24] */ -0xe59f0018 ,/* ldr r0, [pc, #24] */ + {0xe59f1018 },/* ldr r1, [pc, #24] */ + {0xe59f0018 },/* ldr r0, [pc, #24] */ -0xe320f002 ,/* wfe */ -0xe5904000 ,/* ldr r4, [r0] */ -0xe1520004 ,/* cmp r2, r4 */ -0x1afffffb ,/* bne <wfe> */ -0xe591f000 ,/* ldr pc, [r1] */ -AST_SMP_MBOX_GOSIGN , -AST_SMP_MBOX_FIELD_ENTRY , -AST_SMP_MBOX_FIELD_GOSIGN , + {0xe320f002 },/* wfe */ + {0xe5904000 },/* ldr r4, [r0] */ + {0xe1520004 },/* cmp r2, r4 */ + {0x1afffffb },/* bne <wfe> */ + {0xe591f000 },/* ldr pc, [r1] */ + {AST_SMP_MBOX_GOSIGN }, + {AST_SMP_MBOX_FIELD_ENTRY }, + {AST_SMP_MBOX_FIELD_GOSIGN }, + {0 ,FIXUP_TERMINATOR } }; +static const uint32_t fixupcontext[FIXUP_MAX ] = {0 }; -rom_add_blob_fixed ("aspeed.smpboot" , poll_mailbox_ready, -sizeof (poll_mailbox_ready), - info->smp_loader_start); +arm_write_bootloader ("aspeed.smpboot" , as, info->smp_loader_start, + poll_mailbox_ready, fixupcontext); } static void aspeed_reset_secondary(ARMCPU *cpu,
Signature · 1 line
2.34.1
[PULL 05/35] target/arm: Move 64-bit TCG CPUs into tcg/
In reply to Peter MaydellFrom: Fabiano Rosas <[email protected]>
Move the 64-bit CPUs that are TCG-only:
- cortex-a35
- cortex-a55
- cortex-a72
- cortex-a76
- a64fx
- neoverse-n1
Keep the CPUs that can be used with KVM:
- cortex-a57
- cortex-a53
- max
- host
Message-id: [email protected]
---
target/arm/internals.h | 4 +
hw/arm/virt.c | 6 +-
target/arm/cpu64.c | 687 +-----------------------------
target/arm/{ => tcg}/cpu64.c | 782 +----------------------------------
target/arm/tcg/meson.build | 1 +
5 files changed, 14 insertions(+), 1466 deletions(-)
copy target/arm/{ => tcg}/cpu64.c (51%)target/arm/internals.h +4 -0
@@ -1361,6 +1361,10 @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp);void arm_cpu_sme_finalize (ARMCPU *cpu,Error **errp);void arm_cpu_pauth_finalize (ARMCPU *cpu,Error **errp);void arm_cpu_lpa2_finalize (ARMCPU *cpu,Error **errp); +void aarch64_max_tcg_initfn (Object *obj); +void aarch64_add_pauth_properties (Object *obj); +void aarch64_add_sve_properties (Object *obj); +void aarch64_add_sme_properties (Object *obj);#endif /* Read the CONTROL register as the MRS instruction would. */
hw/arm/virt.c +4 -2
@@ -208,14 +208,16 @@ static const char *valid_cpus[] = { ARM_CPU_TYPE_NAME("cortex-a7"), #endif ARM_CPU_TYPE_NAME("cortex-a15"), +#ifdef CONFIG_TCG ARM_CPU_TYPE_NAME("cortex-a35"), -ARM_CPU_TYPE_NAME ("cortex-a53" ), ARM_CPU_TYPE_NAME("cortex-a55"), -ARM_CPU_TYPE_NAME ("cortex-a57" ), ARM_CPU_TYPE_NAME("cortex-a72"), ARM_CPU_TYPE_NAME("cortex-a76"), ARM_CPU_TYPE_NAME("a64fx"), ARM_CPU_TYPE_NAME("neoverse-n1"), +#endif + ARM_CPU_TYPE_NAME("cortex-a53"), + ARM_CPU_TYPE_NAME("cortex-a57"), ARM_CPU_TYPE_NAME("host"), ARM_CPU_TYPE_NAME("max"), };
target/arm/cpu64.c +3 -684
743 lines not on this page · raw message
target/arm/tcg/cpu64.c renamed from target/arm/cpu64.c +2 -780
838 lines not on this page · raw message
target/arm/tcg/meson.build +1 -0
@@ -35,6 +35,7 @@ arm_ss.add(files( )) arm_ss.add(when: 'TARGET_AARCH64', if_true: files( + 'cpu64.c', 'translate-a64.c', 'translate-sve.c', 'translate-sme.c',
Signature · 1 line
2.34.1
[PULL 21/35] Document that -singlestep command line option is deprecated
In reply to Peter MaydellDocument that the -singlestep command line option is now deprecated, as it is replaced by either the TCG accelerator property 'one-insn-per-tb' for system emulation or the new '-one-insn-per-tb' option for usermode emulation, and remove the only use of the deprecated syntax from a README.
Message-id: [email protected]
--- docs/about/deprecated.rst | 16 ++++++++++++++++ qemu-options.hx | 5 +++-- tcg/tci/README | 2 +- 3 files changed, 20 insertions(+), 3 deletions(-)
docs/about/deprecated.rst +16 -0
@@ -111,6 +111,22 @@ Use ``-machine acpi=off`` instead. The HAXM project has been retired (see https://github.com/intel/haxm#status). Use "whpx" (on Windows) or "hvf" (on macOS) instead. +``-singlestep`` (since 8.1) +''''''''''''''''''''''''''' + +The ``-singlestep`` option has been turned into an accelerator property, +and given a name that better reflects what it actually does. +Use ``-accel tcg,one-insn-per-tb=on`` instead. + +User-mode emulator command line arguments +----------------------------------------- + +``-singlestep`` (since 8.1) +''''''''''''''''''''''''''' + +The ``-singlestep`` option has been given a name that better reflects +what it actually does. For both linux-user and bsd-user, use the +new ``-one-insn-per-tb`` option instead. QEMU Machine Protocol (QMP) commands ------------------------------------
qemu-options.hx +3 -2
@@ -4192,10 +4192,11 @@ SRST ERST DEF("singlestep", 0, QEMU_OPTION_singlestep, \ - "-singlestep always run in singlestep mode\n", QEMU_ARCH_ALL) + "-singlestep deprecated synonym for -accel tcg,one-insn-per-tb=on\n", QEMU_ARCH_ALL) SRST ``-singlestep`` - Run the emulation in single step mode. + This is a deprecated synonym for the TCG accelerator property + ``one-insn-per-tb``. ERST DEF("preconfig", 0, QEMU_OPTION_preconfig, \
tcg/tci/README +1 -1
@@ -49,7 +49,7 @@ The only difference from running QEMU with TCI to running without TCI should be speed. Especially during development of TCI, it was very useful to compare runs with and without TCI. Create /tmp/qemu.log by - qemu-system-i386 -d in_asm,op_opt,cpu -D /tmp/qemu.log -singlestep + qemu-system-i386 -d in_asm,op_opt,cpu -D /tmp/qemu.log -accel tcg,one-insn-per-tb=on once with interpreter and once without interpreter and compare the resulting qemu.log files. This is also useful to see the effects of additional
Signature · 1 line
2.34.1
[PULL 22/35] accel/tcg: Report one-insn-per-tb in 'info jit', not 'info status'
In reply to Peter MaydellCurrently we report whether the TCG accelerator is in 'one-insn-per-tb' mode in the 'info status' output. This is a pretty minor piece of TCG specific information, and we want to deprecate the 'singlestep' field of the associated QMP command. Move the 'one-insn-per-tb' reporting to 'info jit'.
We don't need a deprecate-and-drop period for this because the HMP interface has no stability guarantees.
Message-id: [email protected]
--- accel/tcg/monitor.c | 14 ++++++++++++++ softmmu/runstate-hmp-cmds.c | 5 ++--- 2 files changed, 16 insertions(+), 3 deletions(-)
accel/tcg/monitor.c +14 -0
@@ -7,6 +7,7 @@*/ #include "qemu/osdep.h" +#include "qemu/accel.h" #include "qapi/error.h" #include "qapi/type-helpers.h" #include "qapi/qapi-commands-machine.h"
@@ -36,6 +37,18 @@ static void dump_drift_info(GString *buf) } } +static void dump_accel_info (GString *buf) +{ +AccelState *accel =current_accel (); +bool one_insn_per_tb =object_property_get_bool (OBJECT (accel), +"one-insn-per-tb" , + &error_fatal); + +g_string_append_printf (buf,"Accelerator settings:\n" ); +g_string_append_printf (buf,"one-insn-per-tb: %s\n\n" , + one_insn_per_tb ?"on" :"off" ); +} +HumanReadableText *qmp_x_query_jit (Error **errp) {g_autoptr (GString) buf =g_string_new ("" );
@@ -45,6 +58,7 @@ HumanReadableText *qmp_x_query_jit(Error **errp)return NULL ; } +dump_accel_info (buf);dump_exec_info (buf);dump_drift_info (buf);
softmmu/runstate-hmp-cmds.c +2 -3
@@ -28,9 +28,8 @@ void hmp_info_status(Monitor *mon, const QDict *qdict) info =qmp_query_status (NULL ); -monitor_printf (mon,"VM status: %s%s" , - info->running ?"running" :"paused" , - info->singlestep ?" (single step mode)" :"" ); +monitor_printf (mon,"VM status: %s" , + info->running ?"running" :"paused" );if (!info->running && info->status !=RUN_STATE_PAUSED ) {monitor_printf (mon," (%s)" ,RunState_str (info->status));
Signature · 1 line
2.34.1
[PULL 03/35] target/arm: Extract TCG -cpu max code into a function
In reply to Peter MaydellFrom: Fabiano Rosas <[email protected]>
Introduce aarch64_max_tcg_initfn that contains the TCG-only part of -cpu max configuration. We'll need that to be able to restrict this code to a TCG-only config in the next patches.
Message-id: [email protected]
--- target/arm/cpu64.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-)
target/arm/cpu64.c +18 -14
@@ -1178,27 +1178,17 @@ static void aarch64_host_initfn(Object *obj)#endif } -/* -cpu max: if KVM is enabled, like -cpu host (best possible with this host); -* otherwise, a CPU with as many features enabled as our emulation supports. -* The version of '-cpu max' for qemu-system-arm is defined in cpu.c; +/* +* -cpu max: a CPU with as many features enabled as our emulation supports. +* The version of '-cpu max' for qemu-system-arm is defined in cpu_tcg.c; * this only needs to handle 64 bits. */ -static void aarch64_max_initfn (Object *obj) +static void aarch64_max_tcg_initfn (Object *obj) {ARMCPU *cpu =ARM_CPU (obj);uint64_t t;uint32_t u; -if (kvm_enabled () ||hvf_enabled ()) { -/* With KVM or HVF, '-cpu max' is identical to '-cpu host' */ -aarch64_host_initfn (obj); -return ; - } - -/* '-cpu max' for TCG: we currently do this as "A57 with extra things" */ - -aarch64_a57_initfn (obj); -/* * Reset MIDR so the guest doesn't mistake our 'max' CPU type for a real * one and try to apply errata workarounds or use impdef features we
@@ -1367,6 +1357,20 @@ static void aarch64_max_initfn(Object *obj)qdev_property_add_static (DEVICE (obj), &arm_cpu_lpa2_property); } +static void aarch64_max_initfn (Object *obj) +{ +if (kvm_enabled () ||hvf_enabled ()) { +/* With KVM or HVF, '-cpu max' is identical to '-cpu host' */ +aarch64_host_initfn (obj); +return ; + } + +/* '-cpu max' for TCG: we currently do this as "A57 with extra things" */ + +aarch64_a57_initfn (obj); +aarch64_max_tcg_initfn (obj); +} +static const ARMCPUInfo aarch64_cpus[] = { { .name ="cortex-a35" , .initfn = aarch64_a35_initfn }, { .name ="cortex-a57" , .initfn = aarch64_a57_initfn },
Signature · 1 line
2.34.1
[PULL 33/35] target/arm: Add compile time asserts to load/store_cpu_field macros
In reply to Peter MaydellAdd some compile-time asserts to the load_cpu_field() and store_cpu_field() macros that the struct field being accessed is the expected size. This lets us catch cases where we incorrectly tried to do a 32-bit load from a 64-bit struct field.
Message-id: [email protected]
--- target/arm/translate-a32.h | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
target/arm/translate-a32.h +13 -4
@@ -59,7 +59,12 @@ static inline TCGv_i32 load_cpu_offset(int offset)return tmp; } -#define load_cpu_field (name) load_cpu_offset(offsetof(CPUARMState, name)) +/* Load from a 32-bit field to a TCGv_i32 */ +#define load_cpu_field (name) \ + ({ \ + QEMU_BUILD_BUG_ON(sizeof_field(CPUARMState, name) != 4); \ + load_cpu_offset(offsetof(CPUARMState, name)); \ + })/* Load from the low half of a 64-bit field to a TCGv_i32 */ #define load_cpu_field_low32 (name) \
@@ -70,9 +75,13 @@ static inline TCGv_i32 load_cpu_offset(int offset)void store_cpu_offset (TCGv_i32 var,int offset,int size); -#define store_cpu_field (var, name) \ - store_cpu_offset(var, offsetof(CPUARMState, name), \ - sizeof_field(CPUARMState, name)) +#define store_cpu_field (val, name) \ + ({ \ + QEMU_BUILD_BUG_ON(sizeof_field(CPUARMState, name) != 4 \ + && sizeof_field(CPUARMState, name) != 1); \ + store_cpu_offset(val, offsetof(CPUARMState, name), \ + sizeof_field(CPUARMState, name)); \ + })#define store_cpu_field_constant (val, name) \ store_cpu_field(tcg_constant_i32(val), name)
Signature · 1 line
2.34.1
Quoted 25 lines · Peter Maydell
Hi; here's an arm pullreq. The big bits here are Fabiano's
CONFIG_TCG=npatches and my set that deprecate -singlestep; other than that there's a collection of smaller bugfixes.thanks
-- PMMThe following changes since commit
7c18f2d663521f1b31b821a13358ce38075eaf7d:Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging (2023-04-29 23:07:17 +0100)are available in the Git repository at:
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20230502-1for you to fetch changes up to
0ab99e4252f21550f2c16f859cbcdd3cced9f8bf:hw/net/allwinner-sun8i-emac: Correctly byteswap descriptor fields (2023-05-02 13:10:42 +0100)----------------------------------------------------------------
* Support building Arm targets withCONFIG_TCG=no(ie KVM only)
* hw/net:npcm7xx_emc: set MAC in register space
* hw/arm/bcm2835_property: Implement "get command line" message
* Deprecate the '-singlestep' command line option in favour of'-one-insn-per-tb' and '-accel one-insn-per-tb=on'
Quoted 8 lines
* Deprecate 'singlestep' member of QMP StatusInfo struct
*docs/about/deprecated.rst: Add "since 7.1" tag to dtb-kaslr-seed deprecation
* hw/net/msf2-emac: Don't modify descriptor in-place inemac_store_desc()
* raspi, aspeed: Write bootloader code correctly on big-endian hosts
* hw/intc/allwinner-a10-pic: Fix bug on big-endian hosts
* Fix bug in A32 ERET on big-endian hosts that caused guest crash
* hw/sd/allwinner-sdhost: Correctly byteswap descriptor fields
* hw/net/allwinner-sun8i-emac: Correctly byteswap descriptor fields
The new notcg test is failing:
https://gitlab.com/qemu-project/qemu/-/jobs/4212154869#L3556
r~
Quoted 36 lines · Richard Henderson
Quoted 25 lines · Peter Maydell
Hi; here's an arm pullreq. The big bits here are Fabiano's
CONFIG_TCG=npatches and my set that deprecate -singlestep; other than that there's a collection of smaller bugfixes.thanks
-- PMMThe following changes since commit
7c18f2d663521f1b31b821a13358ce38075eaf7d:Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging (2023-04-29 23:07:17 +0100)are available in the Git repository at:
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20230502-1for you to fetch changes up to
0ab99e4252f21550f2c16f859cbcdd3cced9f8bf:hw/net/allwinner-sun8i-emac: Correctly byteswap descriptor fields (2023-05-02 13:10:42 +0100)----------------------------------------------------------------
* Support building Arm targets withCONFIG_TCG=no(ie KVM only)
* hw/net:npcm7xx_emc: set MAC in register space
* hw/arm/bcm2835_property: Implement "get command line" message
* Deprecate the '-singlestep' command line option in favour of'-one-insn-per-tb' and '-accel one-insn-per-tb=on'Quoted 8 lines
* Deprecate 'singlestep' member of QMP StatusInfo struct
*docs/about/deprecated.rst: Add "since 7.1" tag to dtb-kaslr-seed deprecation
* hw/net/msf2-emac: Don't modify descriptor in-place inemac_store_desc()
* raspi, aspeed: Write bootloader code correctly on big-endian hosts
* hw/intc/allwinner-a10-pic: Fix bug on big-endian hosts
* Fix bug in A32 ERET on big-endian hosts that caused guest crash
* hw/sd/allwinner-sdhost: Correctly byteswap descriptor fields
* hw/net/allwinner-sun8i-emac: Correctly byteswap descriptor fields
Quoted 3 lines
The new notcg test is failing:
https://gitlab.com/qemu-project/qemu/-/jobs/4212154869#L3556
Output: Could not access KVM kernel module: Permission denied
qemu-system-aarch64: failed to initialize kvm: Permission denied
Looks like the aarch64 runner doesn't have access to /dev/kvm. Philippe, that patch was one of yours -- do you want to have a look at it?
("gitlab-ci: Check building KVM-only aarch64 target")
In the meantime I'll respin the pullreq and drop that patch.
thanks
-- PMM