qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [RFC v5 00/36] arm cleanup experiment for kvm-only build
@ 2021-03-09 14:25 Claudio Fontana
  2021-03-09 14:25 ` [RFC v5 01/36] target/arm: move translate modules to tcg/ Claudio Fontana
                   ` (35 more replies)
  0 siblings, 36 replies; 39+ messages in thread
From: Claudio Fontana @ 2021-03-09 14:25 UTC (permalink / raw)
  To: Peter Maydell, Philippe Mathieu-Daudé,
	Richard Henderson, Alex Bennée
  Cc: Paolo Bonzini, Roman Bolshakov, Claudio Fontana, Eduardo Habkost,
	qemu-devel

Here a new version of the series that enables kvm-only builds.
The goal here is to enable the KVM-only build.

The split of additional kvm code to kvm/ is planned for the next series,
along with the splitting of the accelerator-specific extensions to the
cpu class, once all tests are ok.

The rebase on latest master has not been painless, so a double check
is probably good.

TEST FAILURES:

all tests are fixed. However, the change in
commit 6e937ba7f8fb90d66cb3781f7fed32fb4239556a
    
had to be reverted for now, to avoid breakage in kvm-only build tests.

    Author: Philippe Mathieu-Daudé <f4bug@amsat.org>
    Date:   Sun Feb 21 23:26:15 2021 +0100
    
    target/arm: Restrict v8M IDAU to TCG
    
    Signed-off-by: Claudio Fontana <cfontana@suse.de>

v4 -> v5:
* fixed other remaining tests for kvm-only build
* rebased on latest target/arm changes (painful)
* reverted Philippe's IDAU v8m change

v3 -> v4:

* added style cleanup patches

* added header cleanup

* added basic move of simple KVM-only code to kvm/

* fixed some qtest failures due to existing:

  if (kvm_enabled) {
  
  } else {

  }

  which needed explicit if qtest_enabled() in addition to tcg_enabled() check

* include 32bit cpus for AArch64 too.

v2 -> v3:

* "target/arm: tcg: add sysemu and user subsirs"
  - new standalone patch to create the empty tcg/sysemu and tcg/user subdirs.

* "target/arm: only build psci for TCG"
  - do not move psci inside tcg/ directory, because HVF might use it soon.
    (Peter)

* "target/arm: move physical address translation"
  - change the module name from "get-phys-addr" to "cpu-mmu",
    which includes aa64_va_parameter in this patch, and that
    will also contain the get_mmu_idx* functions later in the series.
    (Richard)

* "target/arm: split cpregs from tcg/helper.c"
  - moved raw_read and raw_write to cpregs.h (Richard)

* "target/arm: only perform TCG cpu and machine inits if TCG enabled"
  - add an explanatory comment before the kvm function for cpreg list init
  - change the use of g_renew to g_new, since we do not do the double
    initialization of cpreg list anymore.

* "target/arm: add temporary stub for arm_rebuild_hflags"
  - use a if (tcg_enabled()) instead of #ifdef (Richard)

* "target/arm: split vfp state setting from tcg helpers"
  - explain better what goes where in the commit (Richard)

* "target/arm: move arm_mmu_idx*"
  - move the functions to cpu-mmu instead of get-phys-addr (Richard)

* "target/arm: move sve_zcr_len_for_el to common_cpu"

 - add a comment about those functions being in theory
   TARGET_AARCH64 specific, but making the change would spawn
   a large number of additional #ifdefs. This state predates this
   change (Richard).

* "target/arm: move aarch64_sync_32_to_64 (and vv) to cpu code"

 - explain better why these functions are needed for KVM too (Richard)

* "target/arm: move sve_exception_el out of TCG helpers"

 - bring over the sve_exception_el code, making it available for KVM too.
   (Richard)

* "target/arm: wrap call to aarch64_sve_change_el in tcg_enabled()"

 - mention in the commit that this enables finally a build with
   configure --enable-kvm --disable-tcg


v1 -> v2: reworked of the whole series

In this v2, only the first two patches remain, the rest is
reworked.

Main reasons for the rework were:

1) moving out cpregs to its own module, leave the tcg-only part in tcg/

2) split of arm cpu32, cpu64 and cpu models. This is still not perfect,
   but I think it's an improvement.

3) import less stuff, that is actually unused or can be stubbed on KVM
   (thanks to the precious feedback on the previous RFCv1).

...

Main issues:

1) basically needs the "configure only machines compatible with KVM" from Philippe,
   so we can avoid some of the stubs.

2) tests/ work fine building with tcg or with tcg + kvm,
   but for making a kvm-only build pass the tests, more work is needed in tests/
   figuring out which tests are TCG-only and which need to be tweaked.

Thanks a lot for your comments!


. / . / . / . / . / . /


Hi all,

this is an experiment, a cleanup based on and requiring the series
"i386 cleanup PART 2":

https://lists.gnu.org/archive/html/qemu-devel/2021-02/msg05935.html

The goal is to split the code between TCG-only and non-TCG code,
fixing the KVM-only build (configure --disable-tcg),

and laying the ground for further cleanups and the use of the
new accel objects in the hierarchy to specialize the cpu
according to the accelerator.

This is known to be an early state, with probably a lot of work
still needed.

I thought it could be useful to share early, especially in light
of the combination of this with Philippe's work on building
only the machines and devices compatible with KVM for arm.

Comments welcome, thanks,

Claudio


Claudio Fontana (36):
  target/arm: move translate modules to tcg/
  target/arm: move helpers to tcg/
  arm: tcg: only build under CONFIG_TCG
  target/arm: tcg: add sysemu and user subsirs
  target/arm: only build psci for TCG
  target/arm: split off cpu-sysemu.c
  target/arm: move physical address translation to cpu-mmu
  target/arm: cpu-mmu: fix comment style
  target/arm: split cpregs from tcg/helper.c
  target/arm: cpregs: fix style (mostly just comments)
  target/arm: move cpu definitions to common cpu module
  target/arm: only perform TCG cpu and machine inits if TCG enabled
  target/arm: kvm: add stubs for some helpers
  target/arm: move cpsr_read, cpsr_write to cpu_common
  target/arm: add temporary stub for arm_rebuild_hflags
  target/arm: split vfp state setting from tcg helpers
  target/arm: move arm_mmu_idx* to cpu-mmu
  target/arm: move sve_zcr_len_for_el to common_cpu
  target/arm: move arm_sctlr away from tcg helpers
  target/arm: move arm_cpu_list to common_cpu
  target/arm: move aarch64_sync_32_to_64 (and vv) to cpu code
  target/arm: split 32bit cpu models from cpu.c to cpu32.c
  target/arm: move sve_exception_el out of TCG helpers
  target/arm: move TCG cpu and models inside tcg/
  target/arm: cpu: fix style
  target/arm: wrap call to aarch64_sve_change_el in tcg_enabled()
  target/arm: remove kvm include file for PSCI and arm-powerctl
  target/arm: move kvm-const.h, kvm.c, kvm64.c, kvm_arm.h to kvm/
  target/arm: cleanup cpu includes
  target/arm: remove broad "else" statements when checking accels
  tests/qtest: skip bios-tables-test test_acpi_oem_fields_virt for KVM
  tests: restrict TCG-only arm-cpu-features tests to TCG builds
  tests: do not run test-hmp on all machines for ARM KVM-only
  tests: device-introspect-test: cope with ARM TCG-only devices
  tests: do not run qom-test on all machines for ARM KVM-only
  revert commit 6e937ba7f8fb90d66cb3781f7fed32fb4239556a

 meson.build                                   |    3 +-
 target/arm/arm-powerctl.h                     |    2 -
 target/arm/cpregs.h                           |  274 +
 target/arm/cpu-mmu.h                          |  119 +
 target/arm/cpu-qom.h                          |    3 -
 target/arm/cpu-vfp.h                          |   29 +
 target/arm/cpu.h                              |  246 +-
 target/arm/cpu32.h                            |   27 +
 target/arm/internals.h                        |   47 +-
 target/arm/{ => kvm}/kvm-consts.h             |    0
 target/arm/{ => kvm}/kvm_arm.h                |    0
 target/arm/kvm/trace.h                        |    1 +
 target/arm/{ => tcg}/op_addsub.h              |    0
 target/arm/tcg/tcg-cpu.h                      |   37 +
 target/arm/tcg/trace.h                        |    1 +
 target/arm/{ => tcg}/translate-a64.h          |    0
 target/arm/{ => tcg}/translate.h              |    0
 target/arm/{ => tcg}/vec_internal.h           |    0
 target/arm/trace.h                            |    1 -
 target/arm/{ => tcg}/a32-uncond.decode        |    0
 target/arm/{ => tcg}/a32.decode               |    0
 target/arm/{ => tcg}/m-nocp.decode            |    0
 target/arm/{ => tcg}/neon-dp.decode           |    0
 target/arm/{ => tcg}/neon-ls.decode           |    0
 target/arm/{ => tcg}/neon-shared.decode       |    0
 target/arm/{ => tcg}/sve.decode               |    0
 target/arm/{ => tcg}/t16.decode               |    0
 target/arm/{ => tcg}/t32.decode               |    0
 target/arm/{ => tcg}/vfp-uncond.decode        |    0
 target/arm/{ => tcg}/vfp.decode               |    0
 hw/arm/boot.c                                 |    5 +-
 hw/arm/pxa2xx.c                               |    1 +
 hw/arm/pxa2xx_pic.c                           |    1 +
 hw/arm/sbsa-ref.c                             |    2 +-
 hw/arm/virt-acpi-build.c                      |    2 +-
 hw/arm/virt.c                                 |    2 +-
 hw/arm/xlnx-versal.c                          |    2 +-
 hw/arm/xlnx-zynqmp.c                          |    2 +-
 hw/cpu/a15mpcore.c                            |    2 +-
 hw/intc/arm_gic_kvm.c                         |    2 +-
 hw/intc/arm_gicv3_cpuif.c                     |    1 +
 hw/intc/arm_gicv3_its_kvm.c                   |    2 +-
 hw/intc/arm_gicv3_kvm.c                       |    3 +-
 target/arm/arm-powerctl.c                     |    8 +-
 target/arm/cpregs.c                           |  377 +
 target/arm/cpu-common.c                       |  329 +
 target/arm/cpu-mmu-sysemu.c                   | 2307 +++++++
 target/arm/cpu-mmu.c                          |  219 +
 target/arm/cpu-sysemu.c                       | 1088 +++
 target/arm/cpu-user.c                         |   40 +
 target/arm/cpu-vfp.c                          |   92 +
 target/arm/cpu.c                              |  963 +--
 target/arm/cpu32.c                            |  502 ++
 target/arm/cpu64.c                            |  154 +-
 target/arm/cpustate-list.c                    |  146 +
 target/arm/gdbstub.c                          |    5 +-
 target/arm/kvm-stub.c                         |   24 -
 target/arm/kvm/helper-stubs.c                 |   43 +
 target/arm/{ => kvm}/kvm.c                    |   18 +-
 target/arm/{ => kvm}/kvm64.c                  |    0
 target/arm/machine.c                          |   40 +-
 target/arm/monitor.c                          |    2 +-
 target/arm/psci.c                             |    1 -
 target/arm/{helper.c => tcg/cpregs.c}         | 6098 +----------------
 target/arm/tcg/cpu-vfp.c                      |  146 +
 target/arm/{ => tcg}/crypto_helper.c          |    0
 target/arm/{ => tcg}/debug_helper.c           |    0
 target/arm/{ => tcg}/helper-a64.c             |    0
 target/arm/tcg/helper.c                       | 1521 ++++
 target/arm/{ => tcg}/iwmmxt_helper.c          |    0
 target/arm/{ => tcg}/m_helper.c               |    1 +
 target/arm/{ => tcg}/mte_helper.c             |    0
 target/arm/{ => tcg}/neon_helper.c            |    0
 target/arm/{ => tcg}/op_helper.c              |    1 +
 target/arm/{ => tcg}/pauth_helper.c           |    2 +-
 target/arm/{ => tcg}/sve_helper.c             |    0
 target/arm/tcg/sysemu/tcg-cpu.c               |   52 +
 .../arm/{cpu_tcg.c => tcg/tcg-cpu-models.c}   |   24 +-
 target/arm/tcg/tcg-cpu.c                      |  229 +
 target/arm/{ => tcg}/tlb_helper.c             |    1 +
 target/arm/{ => tcg}/translate-a64.c          |    1 +
 target/arm/{ => tcg}/translate-sve.c          |    0
 target/arm/{ => tcg}/translate.c              |    1 +
 target/arm/{ => tcg}/vec_helper.c             |    0
 target/arm/{ => tcg}/vfp_helper.c             |  210 +-
 tests/qtest/arm-cpu-features.c                |   16 +-
 tests/qtest/bios-tables-test.c                |    7 +
 tests/qtest/device-introspect-test.c          |   18 +
 tests/qtest/qom-test.c                        |   20 +
 tests/qtest/test-hmp.c                        |   20 +
 target/arm/{ => tcg}/translate-neon.c.inc     |    0
 target/arm/{ => tcg}/translate-vfp.c.inc      |    0
 MAINTAINERS                                   |    2 +-
 target/arm/kvm/meson.build                    |    8 +
 target/arm/kvm/trace-events                   |    4 +
 target/arm/meson.build                        |   53 +-
 target/arm/tcg/meson.build                    |   45 +
 target/arm/tcg/sysemu/meson.build             |    4 +
 target/arm/{ => tcg}/trace-events             |    3 -
 target/arm/tcg/user/meson.build               |    3 +
 100 files changed, 8178 insertions(+), 7487 deletions(-)
 create mode 100644 target/arm/cpregs.h
 create mode 100644 target/arm/cpu-mmu.h
 create mode 100644 target/arm/cpu-vfp.h
 create mode 100644 target/arm/cpu32.h
 rename target/arm/{ => kvm}/kvm-consts.h (100%)
 rename target/arm/{ => kvm}/kvm_arm.h (100%)
 create mode 100644 target/arm/kvm/trace.h
 rename target/arm/{ => tcg}/op_addsub.h (100%)
 create mode 100644 target/arm/tcg/tcg-cpu.h
 create mode 100644 target/arm/tcg/trace.h
 rename target/arm/{ => tcg}/translate-a64.h (100%)
 rename target/arm/{ => tcg}/translate.h (100%)
 rename target/arm/{ => tcg}/vec_internal.h (100%)
 delete mode 100644 target/arm/trace.h
 rename target/arm/{ => tcg}/a32-uncond.decode (100%)
 rename target/arm/{ => tcg}/a32.decode (100%)
 rename target/arm/{ => tcg}/m-nocp.decode (100%)
 rename target/arm/{ => tcg}/neon-dp.decode (100%)
 rename target/arm/{ => tcg}/neon-ls.decode (100%)
 rename target/arm/{ => tcg}/neon-shared.decode (100%)
 rename target/arm/{ => tcg}/sve.decode (100%)
 rename target/arm/{ => tcg}/t16.decode (100%)
 rename target/arm/{ => tcg}/t32.decode (100%)
 rename target/arm/{ => tcg}/vfp-uncond.decode (100%)
 rename target/arm/{ => tcg}/vfp.decode (100%)
 create mode 100644 target/arm/cpregs.c
 create mode 100644 target/arm/cpu-common.c
 create mode 100644 target/arm/cpu-mmu-sysemu.c
 create mode 100644 target/arm/cpu-mmu.c
 create mode 100644 target/arm/cpu-sysemu.c
 create mode 100644 target/arm/cpu-user.c
 create mode 100644 target/arm/cpu-vfp.c
 create mode 100644 target/arm/cpu32.c
 create mode 100644 target/arm/cpustate-list.c
 delete mode 100644 target/arm/kvm-stub.c
 create mode 100644 target/arm/kvm/helper-stubs.c
 rename target/arm/{ => kvm}/kvm.c (98%)
 rename target/arm/{ => kvm}/kvm64.c (100%)
 rename target/arm/{helper.c => tcg/cpregs.c} (59%)
 create mode 100644 target/arm/tcg/cpu-vfp.c
 rename target/arm/{ => tcg}/crypto_helper.c (100%)
 rename target/arm/{ => tcg}/debug_helper.c (100%)
 rename target/arm/{ => tcg}/helper-a64.c (100%)
 create mode 100644 target/arm/tcg/helper.c
 rename target/arm/{ => tcg}/iwmmxt_helper.c (100%)
 rename target/arm/{ => tcg}/m_helper.c (99%)
 rename target/arm/{ => tcg}/mte_helper.c (100%)
 rename target/arm/{ => tcg}/neon_helper.c (100%)
 rename target/arm/{ => tcg}/op_helper.c (99%)
 rename target/arm/{ => tcg}/pauth_helper.c (99%)
 rename target/arm/{ => tcg}/sve_helper.c (100%)
 create mode 100644 target/arm/tcg/sysemu/tcg-cpu.c
 rename target/arm/{cpu_tcg.c => tcg/tcg-cpu-models.c} (98%)
 create mode 100644 target/arm/tcg/tcg-cpu.c
 rename target/arm/{ => tcg}/tlb_helper.c (99%)
 rename target/arm/{ => tcg}/translate-a64.c (99%)
 rename target/arm/{ => tcg}/translate-sve.c (100%)
 rename target/arm/{ => tcg}/translate.c (99%)
 rename target/arm/{ => tcg}/vec_helper.c (100%)
 rename target/arm/{ => tcg}/vfp_helper.c (84%)
 rename target/arm/{ => tcg}/translate-neon.c.inc (100%)
 rename target/arm/{ => tcg}/translate-vfp.c.inc (100%)
 create mode 100644 target/arm/kvm/meson.build
 create mode 100644 target/arm/kvm/trace-events
 create mode 100644 target/arm/tcg/meson.build
 create mode 100644 target/arm/tcg/sysemu/meson.build
 rename target/arm/{ => tcg}/trace-events (85%)
 create mode 100644 target/arm/tcg/user/meson.build

-- 
2.26.2



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

end of thread, other threads:[~2021-03-09 20:29 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-09 14:25 [RFC v5 00/36] arm cleanup experiment for kvm-only build Claudio Fontana
2021-03-09 14:25 ` [RFC v5 01/36] target/arm: move translate modules to tcg/ Claudio Fontana
2021-03-09 14:25 ` [RFC v5 02/36] target/arm: move helpers " Claudio Fontana
2021-03-09 14:25 ` [RFC v5 03/36] arm: tcg: only build under CONFIG_TCG Claudio Fontana
2021-03-09 14:25 ` [RFC v5 04/36] target/arm: tcg: add sysemu and user subsirs Claudio Fontana
2021-03-09 14:25 ` [RFC v5 05/36] target/arm: only build psci for TCG Claudio Fontana
2021-03-09 14:25 ` [RFC v5 06/36] target/arm: split off cpu-sysemu.c Claudio Fontana
2021-03-09 14:25 ` [RFC v5 07/36] target/arm: move physical address translation to cpu-mmu Claudio Fontana
2021-03-09 14:25 ` [RFC v5 08/36] target/arm: cpu-mmu: fix comment style Claudio Fontana
2021-03-09 14:25 ` [RFC v5 09/36] target/arm: split cpregs from tcg/helper.c Claudio Fontana
2021-03-09 14:25 ` [RFC v5 10/36] target/arm: cpregs: fix style (mostly just comments) Claudio Fontana
2021-03-09 14:25 ` [RFC v5 11/36] target/arm: move cpu definitions to common cpu module Claudio Fontana
2021-03-09 14:25 ` [RFC v5 12/36] target/arm: only perform TCG cpu and machine inits if TCG enabled Claudio Fontana
2021-03-09 14:25 ` [RFC v5 13/36] target/arm: kvm: add stubs for some helpers Claudio Fontana
2021-03-09 14:25 ` [RFC v5 14/36] target/arm: move cpsr_read, cpsr_write to cpu_common Claudio Fontana
2021-03-09 14:25 ` [RFC v5 15/36] target/arm: add temporary stub for arm_rebuild_hflags Claudio Fontana
2021-03-09 14:25 ` [RFC v5 16/36] target/arm: split vfp state setting from tcg helpers Claudio Fontana
2021-03-09 14:25 ` [RFC v5 17/36] target/arm: move arm_mmu_idx* to cpu-mmu Claudio Fontana
2021-03-09 14:25 ` [RFC v5 18/36] target/arm: move sve_zcr_len_for_el to common_cpu Claudio Fontana
2021-03-09 14:25 ` [RFC v5 19/36] target/arm: move arm_sctlr away from tcg helpers Claudio Fontana
2021-03-09 14:25 ` [RFC v5 20/36] target/arm: move arm_cpu_list to common_cpu Claudio Fontana
2021-03-09 14:25 ` [RFC v5 21/36] target/arm: move aarch64_sync_32_to_64 (and vv) to cpu code Claudio Fontana
2021-03-09 14:25 ` [RFC v5 22/36] target/arm: split 32bit cpu models from cpu.c to cpu32.c Claudio Fontana
2021-03-09 19:18   ` Claudio Fontana
2021-03-09 14:25 ` [RFC v5 23/36] target/arm: move sve_exception_el out of TCG helpers Claudio Fontana
2021-03-09 14:25 ` [RFC v5 24/36] target/arm: move TCG cpu and models inside tcg/ Claudio Fontana
2021-03-09 19:17   ` Claudio Fontana
2021-03-09 14:25 ` [RFC v5 25/36] target/arm: cpu: fix style Claudio Fontana
2021-03-09 14:25 ` [RFC v5 26/36] target/arm: wrap call to aarch64_sve_change_el in tcg_enabled() Claudio Fontana
2021-03-09 14:25 ` [RFC v5 27/36] target/arm: remove kvm include file for PSCI and arm-powerctl Claudio Fontana
2021-03-09 14:25 ` [RFC v5 28/36] target/arm: move kvm-const.h, kvm.c, kvm64.c, kvm_arm.h to kvm/ Claudio Fontana
2021-03-09 14:25 ` [RFC v5 29/36] target/arm: cleanup cpu includes Claudio Fontana
2021-03-09 14:25 ` [RFC v5 30/36] target/arm: remove broad "else" statements when checking accels Claudio Fontana
2021-03-09 14:25 ` [RFC v5 31/36] tests/qtest: skip bios-tables-test test_acpi_oem_fields_virt for KVM Claudio Fontana
2021-03-09 14:25 ` [RFC v5 32/36] tests: restrict TCG-only arm-cpu-features tests to TCG builds Claudio Fontana
2021-03-09 14:25 ` [RFC v5 33/36] tests: do not run test-hmp on all machines for ARM KVM-only Claudio Fontana
2021-03-09 14:25 ` [RFC v5 34/36] tests: device-introspect-test: cope with ARM TCG-only devices Claudio Fontana
2021-03-09 14:25 ` [RFC v5 35/36] tests: do not run qom-test on all machines for ARM KVM-only Claudio Fontana
2021-03-09 14:25 ` [RFC v5 36/36] revert commit 6e937ba7f8fb90d66cb3781f7fed32fb4239556a Claudio Fontana

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).