Skip to content

QOM CPUState, part 13: Emptying CPU_COMMON

Andreas Färber kvm qemu-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest40 patches 17 repliesIn review
  2. v1 RFC41 patches 26 repliesSuperseded

Changes in v2 from the cover letter

* Dropped cpu_mmu_index() and cpu_get_tb_cpu_state() changes (Paolo)
* Rebased on LM32 cpu_abort() and dc->env cleanups (Michael)
* cpu_copy() was already moved into linux-user and cpu_model_str dropped
* Rebased on CPU address spaces; added cleanups for ENV_GET_CPU() misuses
* Rebased on LM32 watchpoints and breakpoints
* Rebased on AArch64
* Fixed s/tlb_update_dirty/tlb_unprotect_code_phys/ in commit message
* Leave tlb_flush_{addr,mask} fields in CPU_COMMON_TLB for now
* Dropped tlb_add_large_page() argument change for now

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/40target-alpha: Clean up ENV_GET_CPU() usagetarget-alpha/helper.c target-alpha/mem_helper.c+9 -90 replies
2/40target-arm: Clean up ENV_GET_CPU() usagetarget-arm/helper.c+7 -50 replies
3/40target-i386: Clean up ENV_GET_CPU() usagetarget-i386/helper.c target-i386/seg_helper.c target-i386/smm_helper.c +1 more+12 -100 replies
4/40target-ppc: Clean up ENV_GET_CPU() usagehw/ppc/ppc405_uc.c hw/ppc/spapr_hcall.c target-ppc/mmu-hash32.h +2 more+17 -112 replies
5/40target-s390x: Clean up ENV_GET_CPU() usagetarget-s390x/helper.c target-s390x/mem_helper.c+7 -60 replies
6/40target-sparc: Clean up ENV_GET_CPU() usagetarget-sparc/ldst_helper.c target-sparc/mmu_helper.c+9 -120 replies
7/40target-unicore32: Clean up ENV_GET_CPU() usagetarget-unicore32/softmmu.c+1 -10 replies
8/40target-xtensa: Clean up ENV_GET_CPU() usagetarget-xtensa/cpu.h target-xtensa/helper.c+4 -20 replies
9/40cpu: Turn cpu_handle_mmu_fault() into a CPUClass hookinclude/qom/cpu.h target-alpha/cpu.c target-alpha/cpu.h +58 more+238 -1513 replies
10/40cpu: Move mem_io_{pc, vaddr} fields from CPU_COMMON to CPUStateexec.c hw/i386/kvmvapic.c include/exec/cpu-defs.h +5 more+31 -250 replies
11/40cpu: Move can_do_io field from CPU_COMMON to CPUStatecpus.c include/exec/cpu-defs.h include/exec/exec-all.h +5 more+24 -160 replies
12/40cpu: Move icount_extra field from CPU_COMMON to CPUStatecpu-exec.c cpus.c include/exec/cpu-defs.h +2 more+15 -130 replies
13/40cpu: Move icount_decr field from CPU_COMMON to CPUStatecpu-exec.c cpus.c include/exec/cpu-defs.h +4 more+40 -380 replies
14/40cpu: Move tb_jmp_cache field from CPU_COMMON to CPUStatecpu-exec.c cputlb.c include/exec/cpu-defs.h +3 more+16 -160 replies
15/40cpu: Move jmp_env field from CPU_COMMON to CPUStatecpu-exec.c include/exec/cpu-defs.h include/qom/cpu.h +1 more+9 -60 replies
16/40cpu: Move exception_index field from CPU_COMMON to CPUStatecpu-exec.c exec.c hw/ppc/e500.c +56 more+385 -3172 replies
17/40cpu: Move opaque field from CPU_COMMON to CPUStatebsd-user/main.c gdbstub.c include/exec/cpu-defs.h +10 more+72 -480 replies
18/40cpu: Move watchpoint fields from CPU_COMMON to CPUStatecpu-exec.c exec.c gdbstub.c +10 more+60 -470 replies
19/40cpu: Move breakpoints field from CPU_COMMON to CPUStateexec.c include/exec/cpu-defs.h include/qom/cpu.h +40 more+94 -733 replies
20/40exec: Change tlb_fill() argument to CPUStateinclude/exec/exec-all.h include/exec/softmmu_template.h target-alpha/mem_helper.c +15 more+91 -610 replies
21/40cpu-exec: Change cpu_loop_exit() argument to CPUStatecpu-exec.c exec.c include/exec/exec-all.h +25 more+63 -661 reply
22/40translate-all: Change cpu_restore_state() argument to CPUStatehw/i386/kvmvapic.c include/exec/exec-all.h target-alpha/helper.c +21 more+35 -632 replies
23/40translate-all: Change cpu_restore_state_from_tb() argument to CPUStatetranslate-all.c+7 -80 replies
24/40translate-all: Change tb_check_watchpoint() argument to CPUStateexec.c translate-all.c translate-all.h+4 -40 replies
25/40translate-all: Change cpu_io_recompile() argument to CPUStateinclude/exec/exec-all.h include/exec/softmmu_template.h translate-all.c+5 -50 replies
26/40translate-all: Change tb_gen_code() argument to CPUStatecpu-exec.c exec.c hw/i386/kvmvapic.c +2 more+10 -90 replies
27/40translate-all: Change tb_flush_jmp_cache() argument to CPUStatecputlb.c include/exec/cputlb.h translate-all.c+3 -40 replies
28/40target-ppc: Use PowerPCCPU in PowerPCCPUClass::handle_mmu_fault hooktarget-ppc/cpu-qom.h target-ppc/mmu-hash32.c target-ppc/mmu-hash32.h +3 more+14 -100 replies
29/40exec: Change cpu_watchpoint_{insert, remove{, _by_ref, _all}} argumentexec.c gdbstub.c include/exec/cpu-all.h +7 more+58 -430 replies
30/40exec: Change cpu_breakpoint_{insert, remove{, _by_ref, _all}} argumentexec.c gdbstub.c include/exec/cpu-all.h +6 more+43 -460 replies
31/40cpu-exec: Change cpu_resume_from_signal() argument to CPUStatecpu-exec.c exec.c hw/i386/kvmvapic.c +6 more+11 -140 replies
32/40cputlb: Change tlb_unprotect_code_phys() argument to CPUStatecputlb.c include/exec/cputlb.h translate-all.c+5 -50 replies
33/40exec: Change memory_region_section_get_iotlb() argument to CPUStatecputlb.c exec.c include/exec/cputlb.h+3 -40 replies
34/40exec: Change cpu_abort() argument to CPUStatecputlb.c exec.c include/exec/cpu-all.h +36 more+288 -1982 replies
35/40target-cris: Replace DisasContext::env field with CRISCPUtarget-cris/translate.c target-cris/translate_v10.c+16 -160 replies
36/40target-microblaze: Replace DisasContext::env field with MicroBlazeCPUtarget-microblaze/translate.c+43 -440 replies
37/40cputlb: Change tlb_flush_page() argument to CPUStatecputlb.c exec.c include/exec/exec-all.h +15 more+107 -702 replies
38/40cputlb: Change tlb_flush() argument to CPUStatecputlb.c exec.c hw/sh4/sh7750.c +38 more+143 -870 replies
39/40cputlb: Change tlb_set_page() argument to CPUStatecputlb.c include/exec/exec-all.h target-alpha/helper.c +17 more+33 -340 replies
40/40user-exec: Change exception_action() argument to CPUStateuser-exec.c+5 -60 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [Qemu-devel] [PATCH qom-cpu v2 00/40] QOM CPUState, part 13: Emptying CPU_COMMON

Hello,

This series aggressively decimizes CPU_COMMON fields and then begins with some follow-up cleanups in core CPU code.

Paolo has suggested we handle cputlb.c not as "common code" but as code to be inlined into target code. I have therefore dropped some cputlb.c changes that seemed mostly relevant for the file itself only.

Available for testing at:
git://github.com/afaerber/qemu-cpu.git qom-cpu-13.v2
https://github.com/afaerber/qemu-cpu/commits/qom-cpu-13.v2

Regards,
Andreas

v1 -> v2:
* Dropped cpu_mmu_index() and cpu_get_tb_cpu_state() changes (Paolo)
* Rebased on LM32 cpu_abort() and dc->env cleanups (Michael)
* cpu_copy() was already moved into linux-user and cpu_model_str dropped
* Rebased on CPU address spaces; added cleanups for ENV_GET_CPU() misuses
* Rebased on LM32 watchpoints and breakpoints
* Rebased on AArch64
* Fixed s/tlb_update_dirty/tlb_unprotect_code_phys/ in commit message
* Leave tlb_flush_{addr,mask} fields in CPU_COMMON_TLB for now
* Dropped tlb_add_large_page() argument change for now

Quoted 1 line

From qom-cpu-copy preview:

* Instead of moving cpu_copy() to a new linux-user/cpu.c, moved it to main.c, allowing to drop cpu_model_str field completely

Cc Anthony Liguori <[email protected]>
Cc Blue Swirl <[email protected]>
Cc Aurélien Jarno <[email protected]>
Cc Richard Henderson <[email protected]> (TCG)
Cc Xuebing Wang <[email protected]>
Cc Michael Walle <[email protected]> (lm32)
Cc Edgar E. Iglesias <[email protected]> (cris, microblaze)
Cc Peter Crosthwaite <[email protected]> (microblaze)
Cc Eduardo Habkost <[email protected]>
Cc Igor Mammedov <[email protected]>
Cc Riku Voipio <[email protected]> (linux-user)
Cc Peter Maydell <[email protected]> (arm)

Andreas Färber (40):
target-alpha: Clean up ENV_GET_CPU() usage
target-arm: Clean up ENV_GET_CPU() usage
target-i386: Clean up ENV_GET_CPU() usage
target-ppc: Clean up ENV_GET_CPU() usage
target-s390x: Clean up ENV_GET_CPU() usage
target-sparc: Clean up ENV_GET_CPU() usage
target-unicore32: Clean up ENV_GET_CPU() usage
target-xtensa: Clean up ENV_GET_CPU() usage
cpu: Turn cpu_handle_mmu_fault() into a CPUClass hook
cpu: Move mem_io_{pc,vaddr} fields from CPU_COMMON to CPUState
cpu: Move can_do_io field from CPU_COMMON to CPUState
cpu: Move icount_extra field from CPU_COMMON to CPUState
cpu: Move icount_decr field from CPU_COMMON to CPUState
cpu: Move tb_jmp_cache field from CPU_COMMON to CPUState
cpu: Move jmp_env field from CPU_COMMON to CPUState
cpu: Move exception_index field from CPU_COMMON to CPUState
cpu: Move opaque field from CPU_COMMON to CPUState
cpu: Move watchpoint fields from CPU_COMMON to CPUState
cpu: Move breakpoints field from CPU_COMMON to CPUState
exec: Change tlb_fill() argument to CPUState
cpu-exec: Change cpu_loop_exit() argument to CPUState
translate-all: Change cpu_restore_state() argument to CPUState
translate-all: Change cpu_restore_state_from_tb() argument to CPUState
translate-all: Change tb_check_watchpoint() argument to CPUState
translate-all: Change cpu_io_recompile() argument to CPUState
translate-all: Change tb_gen_code() argument to CPUState
translate-all: Change tb_flush_jmp_cache() argument to CPUState
target-ppc: Use PowerPCCPU in PowerPCCPUClass::handle_mmu_fault hook
exec: Change cpu_watchpoint_{insert,remove{,_by_ref,_all}} argument
exec: Change cpu_breakpoint_{insert,remove{,_by_ref,_all}} argument
cpu-exec: Change cpu_resume_from_signal() argument to CPUState
cputlb: Change tlb_unprotect_code_phys() argument to CPUState
exec: Change memory_region_section_get_iotlb() argument to CPUState
exec: Change cpu_abort() argument to CPUState
target-cris: Replace DisasContext::env field with CRISCPU
target-microblaze: Replace DisasContext::env field with MicroBlazeCPU
cputlb: Change tlb_flush_page() argument to CPUState
cputlb: Change tlb_flush() argument to CPUState
cputlb: Change tlb_set_page() argument to CPUState
user-exec: Change exception_action() argument to CPUState

 bsd-user/main.c                    |   2 +-
 cpu-exec.c                         | 101 +++++++++---------
 cpus.c                             |  23 ++--
 cputlb.c                           |  24 ++---
 exec.c                             | 118 ++++++++++-----------
 gdbstub.c                          |  48 ++++-----
 hw/i386/kvmvapic.c                 |   6 +-
 hw/ppc/e500.c                      |   3 +-
 hw/ppc/ppc405_uc.c                 |   2 +-
 hw/ppc/ppce500_spin.c              |   2 +-
 hw/ppc/spapr_hcall.c               |   8 +-
 hw/s390x/s390-virtio.c             |   8 +-
 hw/sh4/sh7750.c                    |   2 +-
 include/exec/cpu-all.h             |  24 -----
 include/exec/cpu-defs.h            |  61 -----------
 include/exec/cputlb.h              |   6 +-
 include/exec/exec-all.h            |  43 ++++----
 include/exec/gen-icount.h          |  10 +-
 include/exec/softmmu_template.h    |  24 ++---
 include/qom/cpu.h                  |  88 ++++++++++++++++
 linux-user/elfload.c               |  10 +-
 linux-user/linuxload.c             |   3 +-
 linux-user/m68k-sim.c              |   3 +-
 linux-user/m68k/target_cpu.h       |   4 +-
 linux-user/main.c                  | 102 +++++++++---------
 linux-user/signal.c                |  24 +++--
 linux-user/syscall.c               |  30 +++---
 linux-user/vm86.c                  |  27 +++--
 qom/cpu.c                          |   6 ++
 target-alpha/cpu.c                 |   6 +-
 target-alpha/cpu.h                 |   5 +-
 target-alpha/helper.c              |  40 ++++---
 target-alpha/mem_helper.c          |  32 +++---
 target-alpha/sys_helper.c          |   4 +-
 target-alpha/translate.c           |   4 +-
 target-arm/arm-semi.c              |   9 +-
 target-arm/cpu.c                   |   8 +-
 target-arm/cpu.h                   |   5 +-
 target-arm/helper.c                | 136 ++++++++++++++++--------
 target-arm/op_helper.c             |  33 +++---
 target-arm/translate-a64.c         |   4 +-
 target-arm/translate.c             |   6 +-
 target-cris/cpu.c                  |   8 +-
 target-cris/cpu.h                  |   7 +-
 target-cris/helper.c               |  48 +++++----
 target-cris/mmu.c                  |   3 +-
 target-cris/op_helper.c            |  28 +++--
 target-cris/translate.c            |  21 ++--
 target-cris/translate_v10.c        |  16 +--
 target-i386/cpu.c                  |  12 ++-
 target-i386/cpu.h                  |   8 +-
 target-i386/excp_helper.c          |   6 +-
 target-i386/helper.c               |  77 ++++++++------
 target-i386/kvm.c                  |   8 +-
 target-i386/machine.c              |   7 +-
 target-i386/mem_helper.c           |  16 +--
 target-i386/misc_helper.c          |  20 ++--
 target-i386/seg_helper.c           |  20 ++--
 target-i386/smm_helper.c           |   2 +-
 target-i386/svm_helper.c           |  41 ++++----
 target-i386/translate.c            |   4 +-
 target-lm32/cpu.c                  |   8 +-
 target-lm32/cpu.h                  |   8 +-
 target-lm32/helper.c               |  51 +++++----
 target-lm32/op_helper.c            |  23 ++--
 target-lm32/translate.c            |   5 +-
 target-m68k/cpu.c                  |   8 +-
 target-m68k/cpu.h                  |   4 +-
 target-m68k/helper.c               |  23 ++--
 target-m68k/m68k-semi.c            |   5 +-
 target-m68k/op_helper.c            |  34 +++---
 target-m68k/qregs.def              |   1 -
 target-m68k/translate.c            |  13 ++-
 target-microblaze/cpu.c            |   8 +-
 target-microblaze/cpu.h            |   3 +-
 target-microblaze/helper.c         |  34 +++---
 target-microblaze/mmu.c            |   6 +-
 target-microblaze/op_helper.c      |  19 ++--
 target-microblaze/translate.c      | 102 +++++++++---------
 target-mips/cpu.c                  |   8 +-
 target-mips/cpu.h                  |   6 +-
 target-mips/helper.c               |  56 ++++++----
 target-mips/machine.c              |   3 +-
 target-mips/op_helper.c            |  34 ++++--
 target-mips/translate.c            |   8 +-
 target-mips/translate_init.c       |   4 +-
 target-moxie/cpu.c                 |   8 +-
 target-moxie/cpu.h                 |   2 +-
 target-moxie/helper.c              |  51 +++++----
 target-moxie/translate.c           |   4 +-
 target-openrisc/cpu.c              |  14 ++-
 target-openrisc/cpu.h              |   5 +-
 target-openrisc/exception.c        |   6 +-
 target-openrisc/interrupt.c        |  14 +--
 target-openrisc/interrupt_helper.c |   2 +-
 target-openrisc/mmu.c              |  17 +--
 target-openrisc/mmu_helper.c       |   8 +-
 target-openrisc/sys_helper.c       |   6 +-
 target-openrisc/translate.c        |   5 +-
 target-ppc/cpu-qom.h               |   8 +-
 target-ppc/cpu.h                   |   6 +-
 target-ppc/excp_helper.c           |  73 ++++++-------
 target-ppc/fpu_helper.c            |  26 +++--
 target-ppc/helper_regs.h           |   2 +-
 target-ppc/misc_helper.c           |   4 +-
 target-ppc/mmu-hash32.c            |  35 ++++---
 target-ppc/mmu-hash32.h            |  14 ++-
 target-ppc/mmu-hash64.c            |  30 +++---
 target-ppc/mmu-hash64.h            |   8 +-
 target-ppc/mmu_helper.c            | 208 +++++++++++++++++++++----------------
 target-ppc/translate.c             |   4 +-
 target-ppc/translate_init.c        |  13 ++-
 target-ppc/user_only_helper.c      |   8 +-
 target-s390x/cc_helper.c           |   5 +-
 target-s390x/cpu.c                 |  12 ++-
 target-s390x/cpu.h                 |   5 +-
 target-s390x/fpu_helper.c          |   4 +-
 target-s390x/helper.c              |  88 +++++++++-------
 target-s390x/mem_helper.c          |  58 ++++++-----
 target-s390x/misc_helper.c         |  33 +++---
 target-s390x/translate.c           |   4 +-
 target-sh4/cpu.c                   |   8 +-
 target-sh4/cpu.h                   |   6 +-
 target-sh4/helper.c                | 108 ++++++++++---------
 target-sh4/op_helper.c             |  20 ++--
 target-sh4/translate.c             |   4 +-
 target-sparc/cpu.c                 |   8 +-
 target-sparc/cpu.h                 |   4 +-
 target-sparc/helper.c              |  28 ++---
 target-sparc/int32_helper.c        |  10 +-
 target-sparc/int64_helper.c        |   8 +-
 target-sparc/ldst_helper.c         |  52 +++++-----
 target-sparc/machine.c             |   3 +-
 target-sparc/mmu_helper.c          |  42 ++++----
 target-sparc/translate.c           |   4 +-
 target-unicore32/cpu.c             |   6 +-
 target-unicore32/cpu.h             |   5 +-
 target-unicore32/helper.c          |  17 +--
 target-unicore32/op_helper.c       |  14 +--
 target-unicore32/softmmu.c         |  29 +++---
 target-unicore32/translate.c       |  32 +++++-
 target-unicore32/ucf64_helper.c    |   3 +-
 target-xtensa/cpu.h                |   6 +-
 target-xtensa/helper.c             |  32 +++---
 target-xtensa/op_helper.c          |  50 +++++----
 target-xtensa/translate.c          |   5 +-
 translate-all.c                    |  98 ++++++++---------
 translate-all.h                    |   2 +-
 user-exec.c                        |  28 +++--
 149 files changed, 1893 insertions(+), 1459 deletions(-)
Signature · 1 line
1.8.4.5