Skip to contentSkip to conversation

s390x cleanup

RFC In review Claudio Fontana 3 participants 24 messages Apr 22, 2021 – Apr 28, 2021 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

v3 cover s390x cleanup

Hi,

this is the next version of a cleanup series for s390x.

v2 -> v3: minor changes

* "hw/s390x: rename tod-qemu.c to tod-tcg.c": move to the front (David)

* "hw/s390x: only build tod-qemu from the CONFIG_TCG build"
- move just after, use "tod-tcg" instead

* "hw/s390x: tod: make explicit checks for accelerators when initializing"
- removed a line break in commit message

* "target/s390x: start moving TCG-only code to tcg/"
- split the rename s390x-internal.h rename part, do it before the move

* "target/s390x: move kvm files into kvm/"
- fix broken/missing move of trace events

---

v1 -> v2: split more, stubs removal for KVM, kvm/ move, sysemu cpu models

* "hw/s390x: rename tod-qemu.c to tod-tcg.c"
- new patch (Cornelia)

* "hw/s390x: tod: make explicit checks for accelerators when initializing"
- now error out and abort() for an unknown accelerator. (Cornelia)

* "target/s390x: remove tcg-stub.c" : new patch split from "target/s390x: start moving TCG-only code to tcg/" (Cornelia)

* "target/s390x: use kvm_enabled() to wrap call to kvm_s390_get_hpage_1m"
- new patch, allows the removal of kvm stubs

* "target/s390x: remove kvm-stub.c"
- new patch, we do not need stubs, as all calls are wrapped by kvm_enabled(), and all prototypes are visible.

* "target/s390x: move kvm files into kvm/"
- new patch

* "target/s390x: split sysemu part of cpu models"
- new patch

* "MAINTAINERS: update s390x directories"
- new patch

Pre-requisite series (not really needed for now, only in further work down the line):

https://lists.gnu.org/archive/html/qemu-devel/2021-03/msg07461.html

Motivation and higher level steps:

https://lists.gnu.org/archive/html/qemu-devel/2020-05/msg04628.html

Comments welcome, thanks,

Claudio

Claudio Fontana (13):
hw/s390x: rename tod-qemu.c to tod-tcg.c
hw/s390x: only build tod-tcg from the CONFIG_TCG build hw/s390x: tod: make explicit checks for accelerators when initializing target/s390x: remove tcg-stub.c
target/s390x: start moving TCG-only code to tcg/ target/s390x: move sysemu-only code out to cpu-sysemu.c target/s390x: split cpu-dump from helper.c
target/s390x: make helper.c sysemu-only
target/s390x: use kvm_enabled() to wrap call to kvm_s390_get_hpage_1m target/s390x: remove kvm-stub.c
target/s390x: move kvm files into kvm/
target/s390x: split sysemu part of cpu models
MAINTAINERS: update s390x directories

 meson.build                                   |   1 +
 include/hw/s390x/tod.h                        |   2 +-
 target/s390x/{ => kvm}/kvm_s390x.h            |   0
 target/s390x/kvm/trace.h                      |   1 +
 target/s390x/{internal.h => s390x-internal.h} |   8 +
 target/s390x/{ => tcg}/s390-tod.h             |   0
 target/s390x/{ => tcg}/tcg_s390x.h            |   0
 target/s390x/{ => tcg}/vec.h                  |   0
 hw/intc/s390_flic_kvm.c                       |   2 +-
 hw/s390x/s390-stattrib-kvm.c                  |   2 +-
 hw/s390x/tod-kvm.c                            |   2 +-
 hw/s390x/{tod-qemu.c => tod-tcg.c}            |   2 +-
 hw/s390x/tod.c                                |   9 +-
 hw/vfio/ap.c                                  |   2 +-
 target/s390x/arch_dump.c                      |   2 +-
 target/s390x/cpu-dump.c                       | 131 ++++++
 target/s390x/cpu-sysemu.c                     | 304 +++++++++++++
 target/s390x/cpu.c                            | 287 +-----------
 target/s390x/cpu_models.c                     | 421 +----------------
 target/s390x/cpu_models_sysemu.c              | 426 ++++++++++++++++++
 target/s390x/cpu_models_user.c                |  20 +
 target/s390x/diag.c                           |   7 +-
 target/s390x/gdbstub.c                        |   2 +-
 target/s390x/helper.c                         | 113 +----
 target/s390x/interrupt.c                      |   6 +-
 target/s390x/ioinst.c                         |   2 +-
 target/s390x/kvm-stub.c                       | 126 ------
 target/s390x/{ => kvm}/kvm.c                  |   4 +-
 target/s390x/machine.c                        |   6 +-
 target/s390x/mmu_helper.c                     |   4 +-
 target/s390x/sigp.c                           |   2 +-
 target/s390x/tcg-stub.c                       |  30 --
 target/s390x/{ => tcg}/cc_helper.c            |   2 +-
 target/s390x/{ => tcg}/crypto_helper.c        |   2 +-
 target/s390x/{ => tcg}/excp_helper.c          |   2 +-
 target/s390x/{ => tcg}/fpu_helper.c           |   2 +-
 target/s390x/{ => tcg}/int_helper.c           |   2 +-
 target/s390x/{ => tcg}/mem_helper.c           |   2 +-
 target/s390x/{ => tcg}/misc_helper.c          |   2 +-
 target/s390x/{ => tcg}/translate.c            |   2 +-
 target/s390x/{ => tcg}/vec_fpu_helper.c       |   2 +-
 target/s390x/{ => tcg}/vec_helper.c           |   2 +-
 target/s390x/{ => tcg}/vec_int_helper.c       |   0
 target/s390x/{ => tcg}/vec_string_helper.c    |   2 +-
 target/s390x/{ => tcg}/translate_vx.c.inc     |   0
 MAINTAINERS                                   |   8 +-
 hw/s390x/meson.build                          |   4 +-
 target/s390x/kvm/meson.build                  |  17 +
 target/s390x/kvm/trace-events                 |   7 +
 target/s390x/meson.build                      |  41 +-
 target/s390x/{ => tcg}/insn-data.def          |   0
 target/s390x/{ => tcg}/insn-format.def        |   0
 target/s390x/tcg/meson.build                  |  14 +
 target/s390x/trace-events                     |   8 +-
 54 files changed, 1007 insertions(+), 1038 deletions(-)
 rename target/s390x/{ => kvm}/kvm_s390x.h (100%)
 create mode 100644 target/s390x/kvm/trace.h
 rename target/s390x/{internal.h => s390x-internal.h} (97%)
 rename target/s390x/{ => tcg}/s390-tod.h (100%)
 rename target/s390x/{ => tcg}/tcg_s390x.h (100%)
 rename target/s390x/{ => tcg}/vec.h (100%)
 rename hw/s390x/{tod-qemu.c => tod-tcg.c} (98%)
 create mode 100644 target/s390x/cpu-dump.c
 create mode 100644 target/s390x/cpu-sysemu.c
 create mode 100644 target/s390x/cpu_models_sysemu.c
 create mode 100644 target/s390x/cpu_models_user.c
 delete mode 100644 target/s390x/kvm-stub.c
 rename target/s390x/{ => kvm}/kvm.c (99%)
 delete mode 100644 target/s390x/tcg-stub.c
 rename target/s390x/{ => tcg}/cc_helper.c (99%)
 rename target/s390x/{ => tcg}/crypto_helper.c (98%)
 rename target/s390x/{ => tcg}/excp_helper.c (99%)
 rename target/s390x/{ => tcg}/fpu_helper.c (99%)
 rename target/s390x/{ => tcg}/int_helper.c (99%)
 rename target/s390x/{ => tcg}/mem_helper.c (99%)
 rename target/s390x/{ => tcg}/misc_helper.c (99%)
 rename target/s390x/{ => tcg}/translate.c (99%)
 rename target/s390x/{ => tcg}/vec_fpu_helper.c (99%)
 rename target/s390x/{ => tcg}/vec_helper.c (99%)
 rename target/s390x/{ => tcg}/vec_int_helper.c (100%)
 rename target/s390x/{ => tcg}/vec_string_helper.c (99%)
 rename target/s390x/{ => tcg}/translate_vx.c.inc (100%)
 create mode 100644 target/s390x/kvm/meson.build
 create mode 100644 target/s390x/kvm/trace-events
 rename target/s390x/{ => tcg}/insn-data.def (100%)
 rename target/s390x/{ => tcg}/insn-format.def (100%)
 create mode 100644 target/s390x/tcg/meson.build
Signature · 1 line
2.26.2
#1 lore raw

RFC v3 1/13 hw/s390x: rename tod-qemu.c to tod-tcg.c

we stop short of renaming the actual qom object though, so type remains TYPE_QEMU_S390_TOD, ie "s390-tod-qemu".

---
 hw/s390x/{tod-qemu.c => tod-tcg.c} | 0
 hw/s390x/meson.build               | 2 +-
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename hw/s390x/{tod-qemu.c => tod-tcg.c} (100%)
hw/s390x/tod-tcg.c renamed from hw/s390x/tod-qemu.c +0 -0
similarity index 100%
rename from hw/s390x/tod-qemu.c
rename to hw/s390x/tod-tcg.c
hw/s390x/meson.build +1 -1
index 327e9c93af..02e81a9467 100644
@@ -16,7 +16,7 @@ s390x_ss.add(files(
   'sclp.c',
   'sclpcpu.c',
   'sclpquiesce.c',
-  'tod-qemu.c',
+  'tod-tcg.c',
   'tod.c',
 ))
 s390x_ss.add(when: 'CONFIG_KVM', if_true: files(
Signature · 1 line
2.26.2
Reviewed-by on v3 1/13
#2 lore raw

Re: [RFC v3 01/13] hw/s390x: rename tod-qemu.c to tod-tcg.c

Quoted 9 lines · On Thu, 22 Apr 2021 13:54:18 +0200 Claudio Fontana <[email protected]> wrote:

we stop short of renaming the actual qom object though, so type remains TYPE_QEMU_S390_TOD, ie "s390-tod-qemu".

---
 hw/s390x/{tod-qemu.c => tod-tcg.c} | 0
 hw/s390x/meson.build               | 2 +-
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename hw/s390x/{tod-qemu.c => tod-tcg.c} (100%)
Reviewed-by on v3 1/13
#3 lore raw

Re: [RFC v3 01/13] hw/s390x: rename tod-qemu.c to tod-tcg.c

In reply to Claudio Fontana
Quoted 20 lines · Claudio Fontana

we stop short of renaming the actual qom object though, so type remains TYPE_QEMU_S390_TOD, ie "s390-tod-qemu".

---
  hw/s390x/{tod-qemu.c => tod-tcg.c} | 0
  hw/s390x/meson.build               | 2 +-
  2 files changed, 1 insertion(+), 1 deletion(-)

rename hw/s390x/{tod-qemu.c => tod-tcg.c} (100%)

hw/s390x/tod-tcg.c renamed from hw/s390x/tod-qemu.c +0 -0
similarity index 100%
rename from hw/s390x/tod-qemu.c
rename to hw/s390x/tod-tcg.c
hw/s390x/meson.build +0 -0
index 327e9c93af..02e81a9467 100644

hw/s390x/meson.build s390x_ss.add(files( · line 22

Quoted 8 lines
hw/s390x/meson.build +1 -1
@@ -16,7 +16,7 @@ s390x_ss.add(files(
    'sclp.c',
    'sclpcpu.c',
    'sclpquiesce.c',
-  'tod-qemu.c',
+  'tod-tcg.c',
    'tod.c',
  ))
  s390x_ss.add(when: 'CONFIG_KVM', if_true: files(
Signature · 3 lines
Thanks,

David / dhildenb
#4 lore raw

RFC v3 2/13 hw/s390x: only build tod-tcg from the CONFIG_TCG build

In reply to Claudio Fontana

this will allow in later patches to remove unneeded stubs in target/s390x.

---
 hw/s390x/meson.build | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/s390x/meson.build +3 -1
index 02e81a9467..28484256ec 100644
@@ -16,7 +16,6 @@ s390x_ss.add(files(
   'sclp.c',
   'sclpcpu.c',
   'sclpquiesce.c',
-  'tod-tcg.c',
   'tod.c',
 ))
 s390x_ss.add(when: 'CONFIG_KVM', if_true: files(
@@ -25,6 +24,9 @@ s390x_ss.add(when: 'CONFIG_KVM', if_true: files(
   's390-stattrib-kvm.c',
   'pv.c',
 ))
+s390x_ss.add(when: 'CONFIG_TCG', if_true: files(
+  'tod-tcg.c',
+))
 s390x_ss.add(when: 'CONFIG_S390_CCW_VIRTIO', if_true: files('s390-virtio-ccw.c'))
 s390x_ss.add(when: 'CONFIG_TERMINAL3270', if_true: files('3270-ccw.c'))
 s390x_ss.add(when: 'CONFIG_VFIO', if_true: files('s390-pci-vfio.c'))
Signature · 1 line
2.26.2
Reviewed-by on v3 2/13
#5 lore raw

Re: [RFC v3 02/13] hw/s390x: only build tod-tcg from the CONFIG_TCG build

Quoted 8 lines · On Thu, 22 Apr 2021 13:54:19 +0200 Claudio Fontana <[email protected]> wrote:

this will allow in later patches to remove unneeded stubs in target/s390x.

---
 hw/s390x/meson.build | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Reviewed-by on v3 2/13
#6 lore raw

Re: [RFC v3 02/13] hw/s390x: only build tod-tcg from the CONFIG_TCG build

In reply to Claudio Fontana
Quoted 23 lines · Claudio Fontana

this will allow in later patches to remove unneeded stubs in target/s390x.

---
  hw/s390x/meson.build | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
hw/s390x/meson.build +0 -1
index 02e81a9467..28484256ec 100644
@@ -16,7 +16,6 @@ s390x_ss.add(files(
    'sclp.c',
    'sclpcpu.c',
    'sclpquiesce.c',
-  'tod-tcg.c',
    'tod.c',
  ))
  s390x_ss.add(when: 'CONFIG_KVM', if_true: files(

hw/s390x/meson.build s390x_ss.add(when: 'CONFIG_KVM', if_true: files( · line 32

Quoted 9 lines
hw/s390x/meson.build +3 -0
@@ -25,6 +24,9 @@ s390x_ss.add(when: 'CONFIG_KVM', if_true: files(
    's390-stattrib-kvm.c',
    'pv.c',
  ))
+s390x_ss.add(when: 'CONFIG_TCG', if_true: files(
+  'tod-tcg.c',
+))
  s390x_ss.add(when: 'CONFIG_S390_CCW_VIRTIO', if_true: files('s390-virtio-ccw.c'))
  s390x_ss.add(when: 'CONFIG_TERMINAL3270', if_true: files('3270-ccw.c'))
  s390x_ss.add(when: 'CONFIG_VFIO', if_true: files('s390-pci-vfio.c'))
Signature · 3 lines
Thanks,

David / dhildenb
#7 lore raw

RFC v3 3/13 hw/s390x: tod: make explicit checks for accelerators when initializing

In reply to Claudio Fontana

replace general "else" with specific checks for each possible accelerator.

Handle qtest as a NOP, and error out for an unknown accelerator used in combination with tod.

---
 hw/s390x/tod.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
hw/s390x/tod.c +8 -1
index 3c2979175e..fd5a36bf24 100644
@@ -14,6 +14,8 @@
 #include "qemu/error-report.h"
 #include "qemu/module.h"
 #include "sysemu/kvm.h"
+#include "sysemu/tcg.h"
+#include "sysemu/qtest.h"
 #include "migration/qemu-file-types.h"
 #include "migration/register.h"
 
@@ -23,8 +25,13 @@ void s390_init_tod(void)
 
     if (kvm_enabled()) {
         obj = object_new(TYPE_KVM_S390_TOD);
-    } else {
+    } else if (tcg_enabled()) {
         obj = object_new(TYPE_QEMU_S390_TOD);
+    } else if (qtest_enabled()) {
+        return;
+    } else {
+        error_report("current accelerator not handled in s390_init_tod!");
+        abort();
     }
     object_property_add_child(qdev_get_machine(), TYPE_S390_TOD, obj);
     object_unref(obj);
Signature · 1 line
2.26.2
Reviewed-by on v3 3/13
#8 lore raw

Re: [RFC v3 03/13] hw/s390x: tod: make explicit checks for accelerators when initializing

Quoted 10 lines · On Thu, 22 Apr 2021 13:54:20 +0200 Claudio Fontana <[email protected]> wrote:

replace general "else" with specific checks for each possible accelerator.

Handle qtest as a NOP, and error out for an unknown accelerator used in combination with tod.

---
 hw/s390x/tod.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
Reviewed-by on v3 3/13
#9 lore raw

Re: [RFC v3 03/13] hw/s390x: tod: make explicit checks for accelerators when initializing

In reply to Claudio Fontana
Quoted 30 lines · Claudio Fontana

replace general "else" with specific checks for each possible accelerator.

Handle qtest as a NOP, and error out for an unknown accelerator used in combination with tod.

---
  hw/s390x/tod.c | 9 ++++++++-
  1 file changed, 8 insertions(+), 1 deletion(-)
hw/s390x/tod.c +2 -1
index 3c2979175e..fd5a36bf24 100644
@@ -14,6 +14,8 @@
  #include "qemu/error-report.h"
  #include "qemu/module.h"
  #include "sysemu/kvm.h"
+#include "sysemu/tcg.h"
+#include "sysemu/qtest.h"
  #include "migration/qemu-file-types.h"
  #include "migration/register.h"
 
@@ -23,8 +25,13 @@ void s390_init_tod(void)
 
      if (kvm_enabled()) {
          obj = object_new(TYPE_KVM_S390_TOD);
-    } else {

hw/s390x/tod.c void s390_init_tod(void) · line 37

Quoted 10 lines
hw/s390x/tod.c +6 -0
+    } else if (tcg_enabled()) {
          obj = object_new(TYPE_QEMU_S390_TOD);
+    } else if (qtest_enabled()) {
+        return;
+    } else {
+        error_report("current accelerator not handled in s390_init_tod!");
+        abort();
      }
      object_property_add_child(qdev_get_machine(), TYPE_S390_TOD, obj);
      object_unref(obj);

As long as qtest keeps working, fine with me

Signature · 3 lines
Thanks,

David / dhildenb
#10 lore raw

RFC v3 4/13 target/s390x: remove tcg-stub.c

In reply to Claudio Fontana

now that we protect all calls to the tcg-specific functions with if (tcg_enabled()), we do not need the TCG stub anymore.

---
 target/s390x/tcg-stub.c  | 30 ------------------------------
 target/s390x/meson.build |  2 +-
 2 files changed, 1 insertion(+), 31 deletions(-)
 delete mode 100644 target/s390x/tcg-stub.c
target/s390x/tcg-stub.c deleted +0 -30
deleted file mode 100644
index d22c898802..0000000000
@@ -1,30 +0,0 @@
-/*
- * QEMU TCG support -- s390x specific function stubs.
- *
- * Copyright (C) 2018 Red Hat Inc
- *
- * Authors:
- *   David Hildenbrand <[email protected]>
- *
- * This work is licensed under the terms of the GNU GPL, version 2 or later.
- * See the COPYING file in the top-level directory.
- */
-
-#include "qemu/osdep.h"
-#include "qemu-common.h"
-#include "cpu.h"
-#include "tcg_s390x.h"
-
-void tcg_s390_tod_updated(CPUState *cs, run_on_cpu_data opaque)
-{
-}
-void QEMU_NORETURN tcg_s390_program_interrupt(CPUS390XState *env,
-                                              uint32_t code, uintptr_t ra)
-{
-    g_assert_not_reached();
-}
-void QEMU_NORETURN tcg_s390_data_exception(CPUS390XState *env, uint32_t dxc,
-                                           uintptr_t ra)
-{
-    g_assert_not_reached();
-}
target/s390x/meson.build +1 -1
index 1219f64112..a5e1ded93f 100644
@@ -21,7 +21,7 @@ s390x_ss.add(when: 'CONFIG_TCG', if_true: files(
   'vec_helper.c',
   'vec_int_helper.c',
   'vec_string_helper.c',
-), if_false: files('tcg-stub.c'))
+))
 
 s390x_ss.add(when: 'CONFIG_KVM', if_true: files('kvm.c'), if_false: files('kvm-stub.c'))
 
Signature · 1 line
2.26.2
Reviewed-by on v3 4/13
#11 lore raw

Re: [RFC v3 04/13] target/s390x: remove tcg-stub.c

Quoted 10 lines · On Thu, 22 Apr 2021 13:54:21 +0200 Claudio Fontana <[email protected]> wrote:

now that we protect all calls to the tcg-specific functions with if (tcg_enabled()), we do not need the TCG stub anymore.

---
 target/s390x/tcg-stub.c  | 30 ------------------------------
 target/s390x/meson.build |  2 +-
 2 files changed, 1 insertion(+), 31 deletions(-)
 delete mode 100644 target/s390x/tcg-stub.c
#12 lore raw

RFC v3 5/13 target/s390x: start moving TCG-only code to tcg/

In reply to Claudio Fontana

move everything related to translate, as well as HELPER code in tcg/

mmu_helper.c stays put for now, as it contains both TCG and KVM code.

The internal.h file is renamed to s390x-internal.h, because of the risk of collision with other files with the same name.

---
 include/hw/s390x/tod.h                        |  2 +-
 target/s390x/{internal.h => s390x-internal.h} |  0
 target/s390x/{ => tcg}/s390-tod.h             |  0
 target/s390x/{ => tcg}/tcg_s390x.h            |  0
 target/s390x/{ => tcg}/vec.h                  |  0
 hw/s390x/tod-tcg.c                            |  2 +-
 target/s390x/arch_dump.c                      |  2 +-
 target/s390x/cpu.c                            |  2 +-
 target/s390x/cpu_models.c                     |  2 +-
 target/s390x/diag.c                           |  2 +-
 target/s390x/gdbstub.c                        |  2 +-
 target/s390x/helper.c                         |  2 +-
 target/s390x/interrupt.c                      |  4 ++--
 target/s390x/ioinst.c                         |  2 +-
 target/s390x/kvm.c                            |  2 +-
 target/s390x/machine.c                        |  4 ++--
 target/s390x/mmu_helper.c                     |  2 +-
 target/s390x/sigp.c                           |  2 +-
 target/s390x/{ => tcg}/cc_helper.c            |  2 +-
 target/s390x/{ => tcg}/crypto_helper.c        |  2 +-
 target/s390x/{ => tcg}/excp_helper.c          |  2 +-
 target/s390x/{ => tcg}/fpu_helper.c           |  2 +-
 target/s390x/{ => tcg}/int_helper.c           |  2 +-
 target/s390x/{ => tcg}/mem_helper.c           |  2 +-
 target/s390x/{ => tcg}/misc_helper.c          |  2 +-
 target/s390x/{ => tcg}/translate.c            |  2 +-
 target/s390x/{ => tcg}/vec_fpu_helper.c       |  2 +-
 target/s390x/{ => tcg}/vec_helper.c           |  2 +-
 target/s390x/{ => tcg}/vec_int_helper.c       |  0
 target/s390x/{ => tcg}/vec_string_helper.c    |  2 +-
 target/s390x/{ => tcg}/translate_vx.c.inc     |  0
 target/s390x/meson.build                      | 17 ++---------------
 target/s390x/{ => tcg}/insn-data.def          |  0
 target/s390x/{ => tcg}/insn-format.def        |  0
 target/s390x/tcg/meson.build                  | 14 ++++++++++++++
 35 files changed, 43 insertions(+), 42 deletions(-)
 rename target/s390x/{internal.h => s390x-internal.h} (100%)
 rename target/s390x/{ => tcg}/s390-tod.h (100%)
 rename target/s390x/{ => tcg}/tcg_s390x.h (100%)
 rename target/s390x/{ => tcg}/vec.h (100%)
 rename target/s390x/{ => tcg}/cc_helper.c (99%)
 rename target/s390x/{ => tcg}/crypto_helper.c (98%)
 rename target/s390x/{ => tcg}/excp_helper.c (99%)
 rename target/s390x/{ => tcg}/fpu_helper.c (99%)
 rename target/s390x/{ => tcg}/int_helper.c (99%)
 rename target/s390x/{ => tcg}/mem_helper.c (99%)
 rename target/s390x/{ => tcg}/misc_helper.c (99%)
 rename target/s390x/{ => tcg}/translate.c (99%)
 rename target/s390x/{ => tcg}/vec_fpu_helper.c (99%)
 rename target/s390x/{ => tcg}/vec_helper.c (99%)
 rename target/s390x/{ => tcg}/vec_int_helper.c (100%)
 rename target/s390x/{ => tcg}/vec_string_helper.c (99%)
 rename target/s390x/{ => tcg}/translate_vx.c.inc (100%)
 rename target/s390x/{ => tcg}/insn-data.def (100%)
 rename target/s390x/{ => tcg}/insn-format.def (100%)
 create mode 100644 target/s390x/tcg/meson.build
include/hw/s390x/tod.h +1 -1
index ff3195a4bf..0935e85089 100644
@@ -12,7 +12,7 @@
 #define HW_S390_TOD_H
 
 #include "hw/qdev-core.h"
-#include "target/s390x/s390-tod.h"
+#include "tcg/s390-tod.h"
 #include "qom/object.h"
 
 typedef struct S390TOD {
target/s390x/s390x-internal.h renamed from target/s390x/internal.h +0 -0
similarity index 100%
rename from target/s390x/internal.h
rename to target/s390x/s390x-internal.h
target/s390x/tcg/s390-tod.h renamed from target/s390x/s390-tod.h +0 -0
similarity index 100%
rename from target/s390x/s390-tod.h
rename to target/s390x/tcg/s390-tod.h
target/s390x/tcg/tcg_s390x.h renamed from target/s390x/tcg_s390x.h +0 -0
similarity index 100%
rename from target/s390x/tcg_s390x.h
rename to target/s390x/tcg/tcg_s390x.h
target/s390x/tcg/vec.h renamed from target/s390x/vec.h +0 -0
similarity index 100%
rename from target/s390x/vec.h
rename to target/s390x/tcg/vec.h
hw/s390x/tod-tcg.c +1 -1
index e91b9590f5..4b3e65050a 100644
@@ -16,7 +16,7 @@
 #include "qemu/cutils.h"
 #include "qemu/module.h"
 #include "cpu.h"
-#include "tcg_s390x.h"
+#include "tcg/tcg_s390x.h"
 
 static void qemu_s390_tod_get(const S390TODState *td, S390TOD *tod,
                               Error **errp)
target/s390x/arch_dump.c +1 -1
index cc1330876b..08daf93ae1 100644
@@ -13,7 +13,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
 #include "elf.h"
 #include "sysemu/dump.h"
 
target/s390x/cpu.c +1 -1
index d35eb39a1b..ae054d264b 100644
@@ -23,7 +23,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
 #include "kvm_s390x.h"
 #include "sysemu/kvm.h"
 #include "sysemu/reset.h"
target/s390x/cpu_models.c +1 -1
index 050dcf2d42..4ff8cba7e5 100644
@@ -12,7 +12,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
 #include "kvm_s390x.h"
 #include "sysemu/kvm.h"
 #include "sysemu/tcg.h"
target/s390x/diag.c +1 -1
index 1a48429564..86b7032b5b 100644
@@ -14,7 +14,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
 #include "exec/address-spaces.h"
 #include "hw/watchdog/wdt_diag288.h"
 #include "sysemu/cpus.h"
target/s390x/gdbstub.c +1 -1
index d6fce5ff1e..1dbe2973f4 100644
@@ -20,7 +20,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
 #include "exec/exec-all.h"
 #include "exec/gdbstub.h"
 #include "qemu/bitops.h"
target/s390x/helper.c +1 -1
index 7678994feb..2254873cef 100644
@@ -20,7 +20,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
 #include "exec/gdbstub.h"
 #include "qemu/timer.h"
 #include "qemu/qemu-print.h"
target/s390x/interrupt.c +2 -2
index 4cdbbc8849..d0e58d6e8d 100644
@@ -11,12 +11,12 @@
 #include "qemu/log.h"
 #include "cpu.h"
 #include "kvm_s390x.h"
-#include "internal.h"
+#include "s390x-internal.h"
 #include "exec/exec-all.h"
 #include "sysemu/kvm.h"
 #include "sysemu/tcg.h"
 #include "hw/s390x/ioinst.h"
-#include "tcg_s390x.h"
+#include "tcg/tcg_s390x.h"
 #if !defined(CONFIG_USER_ONLY)
 #include "hw/s390x/s390_flic.h"
 #endif
target/s390x/ioinst.c +1 -1
index 1ee11522e1..4eb0a7a9f8 100644
@@ -12,7 +12,7 @@
 #include "qemu/osdep.h"
 
 #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
 #include "hw/s390x/ioinst.h"
 #include "trace.h"
 #include "hw/s390x/s390-pci-bus.h"
target/s390x/kvm.c +1 -1
index 4fb3bbfef5..2a22cc69f6 100644
@@ -26,7 +26,7 @@
 
 #include "qemu-common.h"
 #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
 #include "kvm_s390x.h"
 #include "sysemu/kvm_int.h"
 #include "qemu/cutils.h"
target/s390x/machine.c +2 -2
index 5b4e82f1ab..81a8a7ff99 100644
@@ -16,10 +16,10 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
 #include "kvm_s390x.h"
 #include "migration/vmstate.h"
-#include "tcg_s390x.h"
+#include "tcg/tcg_s390x.h"
 #include "sysemu/kvm.h"
 #include "sysemu/tcg.h"
 
target/s390x/mmu_helper.c +1 -1
index d492b23a17..52fdd86c63 100644
@@ -19,7 +19,7 @@
 #include "qemu/error-report.h"
 #include "exec/address-spaces.h"
 #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
 #include "kvm_s390x.h"
 #include "sysemu/kvm.h"
 #include "sysemu/tcg.h"
target/s390x/sigp.c +1 -1
index c604f17710..320dddbae2 100644
@@ -10,7 +10,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
 #include "sysemu/hw_accel.h"
 #include "sysemu/runstate.h"
 #include "exec/address-spaces.h"
target/s390x/tcg/cc_helper.c renamed from target/s390x/cc_helper.c +1 -1
similarity index 99%
rename from target/s390x/cc_helper.c
rename to target/s390x/tcg/cc_helper.c
index e7039d0d18..f0663f7a3e 100644
@@ -20,7 +20,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
 #include "tcg_s390x.h"
 #include "exec/exec-all.h"
 #include "exec/helper-proto.h"
target/s390x/tcg/crypto_helper.c renamed from target/s390x/crypto_helper.c +1 -1
similarity index 98%
rename from target/s390x/crypto_helper.c
rename to target/s390x/tcg/crypto_helper.c
index ff3fbc3950..138d9e7ad9 100644
@@ -12,7 +12,7 @@
 
 #include "qemu/osdep.h"
 #include "qemu/main-loop.h"
-#include "internal.h"
+#include "s390x-internal.h"
 #include "tcg_s390x.h"
 #include "exec/helper-proto.h"
 #include "exec/exec-all.h"
target/s390x/tcg/excp_helper.c renamed from target/s390x/excp_helper.c +1 -1
similarity index 99%
rename from target/s390x/excp_helper.c
rename to target/s390x/tcg/excp_helper.c
index c48cd6b46f..ecc830cea0 100644
@@ -20,7 +20,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
 #include "exec/helper-proto.h"
 #include "qemu/timer.h"
 #include "exec/exec-all.h"
target/s390x/tcg/fpu_helper.c renamed from target/s390x/fpu_helper.c +1 -1
similarity index 99%
rename from target/s390x/fpu_helper.c
rename to target/s390x/tcg/fpu_helper.c
index f155bc048c..bc89ef7cc8 100644
@@ -20,7 +20,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
 #include "tcg_s390x.h"
 #include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
target/s390x/tcg/int_helper.c renamed from target/s390x/int_helper.c +1 -1
similarity index 99%
rename from target/s390x/int_helper.c
rename to target/s390x/tcg/int_helper.c
index 658507dd6d..954542388a 100644
@@ -20,7 +20,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
 #include "tcg_s390x.h"
 #include "exec/exec-all.h"
 #include "qemu/host-utils.h"
target/s390x/tcg/mem_helper.c renamed from target/s390x/mem_helper.c +1 -1
similarity index 99%
rename from target/s390x/mem_helper.c
rename to target/s390x/tcg/mem_helper.c
index 12e84a4285..a91791a1b7 100644
@@ -20,7 +20,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
 #include "tcg_s390x.h"
 #include "exec/helper-proto.h"
 #include "exec/exec-all.h"
target/s390x/tcg/misc_helper.c renamed from target/s390x/misc_helper.c +1 -1
similarity index 99%
rename from target/s390x/misc_helper.c
rename to target/s390x/tcg/misc_helper.c
index 7ea90d414a..33e6999e15 100644
@@ -22,7 +22,7 @@
 #include "qemu/cutils.h"
 #include "qemu/main-loop.h"
 #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
 #include "exec/memory.h"
 #include "qemu/host-utils.h"
 #include "exec/helper-proto.h"
target/s390x/tcg/translate.c renamed from target/s390x/translate.c +1 -1
similarity index 99%
rename from target/s390x/translate.c
rename to target/s390x/tcg/translate.c
index 4f953ddfba..ac236888a0 100644
@@ -30,7 +30,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
 #include "disas/disas.h"
 #include "exec/exec-all.h"
 #include "tcg/tcg-op.h"
target/s390x/tcg/vec_fpu_helper.c renamed from target/s390x/vec_fpu_helper.c +1 -1
similarity index 99%
rename from target/s390x/vec_fpu_helper.c
rename to target/s390x/tcg/vec_fpu_helper.c
index c1564e819b..850fac721e 100644
@@ -12,7 +12,7 @@
 #include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
 #include "vec.h"
 #include "tcg_s390x.h"
 #include "tcg/tcg-gvec-desc.h"
target/s390x/tcg/vec_helper.c renamed from target/s390x/vec_helper.c +1 -1
similarity index 99%
rename from target/s390x/vec_helper.c
rename to target/s390x/tcg/vec_helper.c
index 986e7cc825..ddd0a8be5b 100644
@@ -11,7 +11,7 @@
  */
 #include "qemu/osdep.h"
 #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
 #include "vec.h"
 #include "tcg/tcg.h"
 #include "tcg/tcg-gvec-desc.h"
target/s390x/tcg/vec_int_helper.c renamed from target/s390x/vec_int_helper.c +0 -0
similarity index 100%
rename from target/s390x/vec_int_helper.c
rename to target/s390x/tcg/vec_int_helper.c
target/s390x/tcg/vec_string_helper.c renamed from target/s390x/vec_string_helper.c +1 -1
similarity index 99%
rename from target/s390x/vec_string_helper.c
rename to target/s390x/tcg/vec_string_helper.c
index c516c0ceeb..ac315eb095 100644
@@ -12,7 +12,7 @@
 #include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
 #include "vec.h"
 #include "tcg/tcg.h"
 #include "tcg/tcg-gvec-desc.h"
target/s390x/tcg/translate_vx.c.inc renamed from target/s390x/translate_vx.c.inc +0 -0
similarity index 100%
rename from target/s390x/translate_vx.c.inc
rename to target/s390x/tcg/translate_vx.c.inc
target/s390x/meson.build +2 -15
index a5e1ded93f..60d7f1b908 100644
@@ -8,21 +8,6 @@ s390x_ss.add(files(
   'interrupt.c',
 ))
 
-s390x_ss.add(when: 'CONFIG_TCG', if_true: files(
-  'cc_helper.c',
-  'crypto_helper.c',
-  'excp_helper.c',
-  'fpu_helper.c',
-  'int_helper.c',
-  'mem_helper.c',
-  'misc_helper.c',
-  'translate.c',
-  'vec_fpu_helper.c',
-  'vec_helper.c',
-  'vec_int_helper.c',
-  'vec_string_helper.c',
-))
-
 s390x_ss.add(when: 'CONFIG_KVM', if_true: files('kvm.c'), if_false: files('kvm-stub.c'))
 
 gen_features = executable('gen-features', 'gen-features.c', native: true,
@@ -60,6 +45,8 @@ endif
 
 s390x_user_ss = ss.source_set()
 
+subdir('tcg')
+
 target_arch += {'s390x': s390x_ss}
 target_softmmu_arch += {'s390x': s390x_softmmu_ss}
 target_user_arch += {'s390x': s390x_user_ss}
target/s390x/tcg/insn-data.def renamed from target/s390x/insn-data.def +0 -0
similarity index 100%
rename from target/s390x/insn-data.def
rename to target/s390x/tcg/insn-data.def
target/s390x/tcg/insn-format.def renamed from target/s390x/insn-format.def +0 -0
similarity index 100%
rename from target/s390x/insn-format.def
rename to target/s390x/tcg/insn-format.def
target/s390x/tcg/meson.build new file +14 -0
new file mode 100644
index 0000000000..ee4e8fec77
@@ -0,0 +1,14 @@
+s390x_ss.add(when: 'CONFIG_TCG', if_true: files(
+  'cc_helper.c',
+  'crypto_helper.c',
+  'excp_helper.c',
+  'fpu_helper.c',
+  'int_helper.c',
+  'mem_helper.c',
+  'misc_helper.c',
+  'translate.c',
+  'vec_fpu_helper.c',
+  'vec_helper.c',
+  'vec_int_helper.c',
+  'vec_string_helper.c',
+))
Signature · 1 line
2.26.2
Acked-by on v3 5/13
#13 lore raw

Re: [RFC v3 05/13] target/s390x: start moving TCG-only code to tcg/

Quoted 512 lines · Claudio Fontana

move everything related to translate, as well as HELPER code in tcg/

mmu_helper.c stays put for now, as it contains both TCG and KVM code.

The internal.h file is renamed to s390x-internal.h, because of the risk of collision with other files with the same name.

---
  include/hw/s390x/tod.h                        |  2 +-
  target/s390x/{internal.h => s390x-internal.h} |  0
  target/s390x/{ => tcg}/s390-tod.h             |  0
  target/s390x/{ => tcg}/tcg_s390x.h            |  0
  target/s390x/{ => tcg}/vec.h                  |  0
  hw/s390x/tod-tcg.c                            |  2 +-
  target/s390x/arch_dump.c                      |  2 +-
  target/s390x/cpu.c                            |  2 +-
  target/s390x/cpu_models.c                     |  2 +-
  target/s390x/diag.c                           |  2 +-
  target/s390x/gdbstub.c                        |  2 +-
  target/s390x/helper.c                         |  2 +-
  target/s390x/interrupt.c                      |  4 ++--
  target/s390x/ioinst.c                         |  2 +-
  target/s390x/kvm.c                            |  2 +-
  target/s390x/machine.c                        |  4 ++--
  target/s390x/mmu_helper.c                     |  2 +-
  target/s390x/sigp.c                           |  2 +-
  target/s390x/{ => tcg}/cc_helper.c            |  2 +-
  target/s390x/{ => tcg}/crypto_helper.c        |  2 +-
  target/s390x/{ => tcg}/excp_helper.c          |  2 +-
  target/s390x/{ => tcg}/fpu_helper.c           |  2 +-
  target/s390x/{ => tcg}/int_helper.c           |  2 +-
  target/s390x/{ => tcg}/mem_helper.c           |  2 +-
  target/s390x/{ => tcg}/misc_helper.c          |  2 +-
  target/s390x/{ => tcg}/translate.c            |  2 +-
  target/s390x/{ => tcg}/vec_fpu_helper.c       |  2 +-
  target/s390x/{ => tcg}/vec_helper.c           |  2 +-
  target/s390x/{ => tcg}/vec_int_helper.c       |  0
  target/s390x/{ => tcg}/vec_string_helper.c    |  2 +-
  target/s390x/{ => tcg}/translate_vx.c.inc     |  0
  target/s390x/meson.build                      | 17 ++---------------
  target/s390x/{ => tcg}/insn-data.def          |  0
  target/s390x/{ => tcg}/insn-format.def        |  0
  target/s390x/tcg/meson.build                  | 14 ++++++++++++++
  35 files changed, 43 insertions(+), 42 deletions(-)

rename target/s390x/{internal.h => s390x-internal.h} (100%) rename target/s390x/{ => tcg}/s390-tod.h (100%) rename target/s390x/{ => tcg}/tcg_s390x.h (100%) rename target/s390x/{ => tcg}/vec.h (100%)
rename target/s390x/{ => tcg}/cc_helper.c (99%) rename target/s390x/{ => tcg}/crypto_helper.c (98%) rename target/s390x/{ => tcg}/excp_helper.c (99%) rename target/s390x/{ => tcg}/fpu_helper.c (99%) rename target/s390x/{ => tcg}/int_helper.c (99%) rename target/s390x/{ => tcg}/mem_helper.c (99%) rename target/s390x/{ => tcg}/misc_helper.c (99%) rename target/s390x/{ => tcg}/translate.c (99%) rename target/s390x/{ => tcg}/vec_fpu_helper.c (99%) rename target/s390x/{ => tcg}/vec_helper.c (99%) rename target/s390x/{ => tcg}/vec_int_helper.c (100%) rename target/s390x/{ => tcg}/vec_string_helper.c (99%) rename target/s390x/{ => tcg}/translate_vx.c.inc (100%) rename target/s390x/{ => tcg}/insn-data.def (100%) rename target/s390x/{ => tcg}/insn-format.def (100%) create mode 100644 target/s390x/tcg/meson.build

include/hw/s390x/tod.h +1 -1
index ff3195a4bf..0935e85089 100644
@@ -12,7 +12,7 @@
  #define HW_S390_TOD_H
 
  #include "hw/qdev-core.h"
-#include "target/s390x/s390-tod.h"
+#include "tcg/s390-tod.h"
  #include "qom/object.h"
 
  typedef struct S390TOD {
target/s390x/s390x-internal.h renamed from target/s390x/internal.h +0 -0
similarity index 100%
rename from target/s390x/internal.h
rename to target/s390x/s390x-internal.h
target/s390x/tcg/s390-tod.h renamed from target/s390x/s390-tod.h +0 -0
similarity index 100%
rename from target/s390x/s390-tod.h
rename to target/s390x/tcg/s390-tod.h
target/s390x/tcg/tcg_s390x.h renamed from target/s390x/tcg_s390x.h +0 -0
similarity index 100%
rename from target/s390x/tcg_s390x.h
rename to target/s390x/tcg/tcg_s390x.h
target/s390x/tcg/vec.h renamed from target/s390x/vec.h +0 -0
similarity index 100%
rename from target/s390x/vec.h
rename to target/s390x/tcg/vec.h
hw/s390x/tod-tcg.c +1 -1
index e91b9590f5..4b3e65050a 100644
@@ -16,7 +16,7 @@
  #include "qemu/cutils.h"
  #include "qemu/module.h"
  #include "cpu.h"
-#include "tcg_s390x.h"
+#include "tcg/tcg_s390x.h"
 
  static void qemu_s390_tod_get(const S390TODState *td, S390TOD *tod,
                                Error **errp)
target/s390x/arch_dump.c +1 -1
index cc1330876b..08daf93ae1 100644
@@ -13,7 +13,7 @@
 
  #include "qemu/osdep.h"
  #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
  #include "elf.h"
  #include "sysemu/dump.h"
 
target/s390x/cpu.c +1 -1
index d35eb39a1b..ae054d264b 100644
@@ -23,7 +23,7 @@
  #include "qemu/osdep.h"
  #include "qapi/error.h"
  #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
  #include "kvm_s390x.h"
  #include "sysemu/kvm.h"
  #include "sysemu/reset.h"
target/s390x/cpu_models.c +1 -1
index 050dcf2d42..4ff8cba7e5 100644
@@ -12,7 +12,7 @@
 
  #include "qemu/osdep.h"
  #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
  #include "kvm_s390x.h"
  #include "sysemu/kvm.h"
  #include "sysemu/tcg.h"
target/s390x/diag.c +1 -1
index 1a48429564..86b7032b5b 100644
@@ -14,7 +14,7 @@
 
  #include "qemu/osdep.h"
  #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
  #include "exec/address-spaces.h"
  #include "hw/watchdog/wdt_diag288.h"
  #include "sysemu/cpus.h"
target/s390x/gdbstub.c +1 -1
index d6fce5ff1e..1dbe2973f4 100644
@@ -20,7 +20,7 @@
 
  #include "qemu/osdep.h"
  #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
  #include "exec/exec-all.h"
  #include "exec/gdbstub.h"
  #include "qemu/bitops.h"
target/s390x/helper.c +1 -1
index 7678994feb..2254873cef 100644
@@ -20,7 +20,7 @@
 
  #include "qemu/osdep.h"
  #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
  #include "exec/gdbstub.h"
  #include "qemu/timer.h"
  #include "qemu/qemu-print.h"
target/s390x/interrupt.c +2 -2
index 4cdbbc8849..d0e58d6e8d 100644
@@ -11,12 +11,12 @@
  #include "qemu/log.h"
  #include "cpu.h"
  #include "kvm_s390x.h"
-#include "internal.h"
+#include "s390x-internal.h"
  #include "exec/exec-all.h"
  #include "sysemu/kvm.h"
  #include "sysemu/tcg.h"
  #include "hw/s390x/ioinst.h"
-#include "tcg_s390x.h"
+#include "tcg/tcg_s390x.h"
  #if !defined(CONFIG_USER_ONLY)
  #include "hw/s390x/s390_flic.h"
  #endif
target/s390x/ioinst.c +1 -1
index 1ee11522e1..4eb0a7a9f8 100644
@@ -12,7 +12,7 @@
  #include "qemu/osdep.h"
 
  #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
  #include "hw/s390x/ioinst.h"
  #include "trace.h"
  #include "hw/s390x/s390-pci-bus.h"
target/s390x/kvm.c +1 -1
index 4fb3bbfef5..2a22cc69f6 100644
@@ -26,7 +26,7 @@
 
  #include "qemu-common.h"
  #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
  #include "kvm_s390x.h"
  #include "sysemu/kvm_int.h"
  #include "qemu/cutils.h"
target/s390x/machine.c +2 -2
index 5b4e82f1ab..81a8a7ff99 100644
@@ -16,10 +16,10 @@
 
  #include "qemu/osdep.h"
  #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
  #include "kvm_s390x.h"
  #include "migration/vmstate.h"
-#include "tcg_s390x.h"
+#include "tcg/tcg_s390x.h"
  #include "sysemu/kvm.h"
  #include "sysemu/tcg.h"
 
target/s390x/mmu_helper.c +1 -1
index d492b23a17..52fdd86c63 100644
@@ -19,7 +19,7 @@
  #include "qemu/error-report.h"
  #include "exec/address-spaces.h"
  #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
  #include "kvm_s390x.h"
  #include "sysemu/kvm.h"
  #include "sysemu/tcg.h"
target/s390x/sigp.c +1 -1
index c604f17710..320dddbae2 100644
@@ -10,7 +10,7 @@
 
  #include "qemu/osdep.h"
  #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
  #include "sysemu/hw_accel.h"
  #include "sysemu/runstate.h"
  #include "exec/address-spaces.h"
target/s390x/tcg/cc_helper.c renamed from target/s390x/cc_helper.c +1 -1
similarity index 99%
rename from target/s390x/cc_helper.c
rename to target/s390x/tcg/cc_helper.c
index e7039d0d18..f0663f7a3e 100644
@@ -20,7 +20,7 @@
 
  #include "qemu/osdep.h"
  #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
  #include "tcg_s390x.h"
  #include "exec/exec-all.h"
  #include "exec/helper-proto.h"
target/s390x/tcg/crypto_helper.c renamed from target/s390x/crypto_helper.c +1 -1
similarity index 98%
rename from target/s390x/crypto_helper.c
rename to target/s390x/tcg/crypto_helper.c
index ff3fbc3950..138d9e7ad9 100644
@@ -12,7 +12,7 @@
 
  #include "qemu/osdep.h"
  #include "qemu/main-loop.h"
-#include "internal.h"
+#include "s390x-internal.h"
  #include "tcg_s390x.h"
  #include "exec/helper-proto.h"
  #include "exec/exec-all.h"
target/s390x/tcg/excp_helper.c renamed from target/s390x/excp_helper.c +1 -1
similarity index 99%
rename from target/s390x/excp_helper.c
rename to target/s390x/tcg/excp_helper.c
index c48cd6b46f..ecc830cea0 100644
@@ -20,7 +20,7 @@
 
  #include "qemu/osdep.h"
  #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
  #include "exec/helper-proto.h"
  #include "qemu/timer.h"
  #include "exec/exec-all.h"
target/s390x/tcg/fpu_helper.c renamed from target/s390x/fpu_helper.c +1 -1
similarity index 99%
rename from target/s390x/fpu_helper.c
rename to target/s390x/tcg/fpu_helper.c
index f155bc048c..bc89ef7cc8 100644
@@ -20,7 +20,7 @@
 
  #include "qemu/osdep.h"
  #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
  #include "tcg_s390x.h"
  #include "exec/exec-all.h"
  #include "exec/cpu_ldst.h"
target/s390x/tcg/int_helper.c renamed from target/s390x/int_helper.c +1 -1
similarity index 99%
rename from target/s390x/int_helper.c
rename to target/s390x/tcg/int_helper.c
index 658507dd6d..954542388a 100644
@@ -20,7 +20,7 @@
 
  #include "qemu/osdep.h"
  #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
  #include "tcg_s390x.h"
  #include "exec/exec-all.h"
  #include "qemu/host-utils.h"
target/s390x/tcg/mem_helper.c renamed from target/s390x/mem_helper.c +1 -1
similarity index 99%
rename from target/s390x/mem_helper.c
rename to target/s390x/tcg/mem_helper.c
index 12e84a4285..a91791a1b7 100644
@@ -20,7 +20,7 @@
 
  #include "qemu/osdep.h"
  #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
  #include "tcg_s390x.h"
  #include "exec/helper-proto.h"
  #include "exec/exec-all.h"
target/s390x/tcg/misc_helper.c renamed from target/s390x/misc_helper.c +1 -1
similarity index 99%
rename from target/s390x/misc_helper.c
rename to target/s390x/tcg/misc_helper.c
index 7ea90d414a..33e6999e15 100644
@@ -22,7 +22,7 @@
  #include "qemu/cutils.h"
  #include "qemu/main-loop.h"
  #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
  #include "exec/memory.h"
  #include "qemu/host-utils.h"
  #include "exec/helper-proto.h"
target/s390x/tcg/translate.c renamed from target/s390x/translate.c +1 -1
similarity index 99%
rename from target/s390x/translate.c
rename to target/s390x/tcg/translate.c
index 4f953ddfba..ac236888a0 100644
@@ -30,7 +30,7 @@
 
  #include "qemu/osdep.h"
  #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
  #include "disas/disas.h"
  #include "exec/exec-all.h"
  #include "tcg/tcg-op.h"
target/s390x/tcg/vec_fpu_helper.c renamed from target/s390x/vec_fpu_helper.c +1 -1
similarity index 99%
rename from target/s390x/vec_fpu_helper.c
rename to target/s390x/tcg/vec_fpu_helper.c
index c1564e819b..850fac721e 100644
@@ -12,7 +12,7 @@
  #include "qemu/osdep.h"
  #include "qemu-common.h"
  #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
  #include "vec.h"
  #include "tcg_s390x.h"
  #include "tcg/tcg-gvec-desc.h"
target/s390x/tcg/vec_helper.c renamed from target/s390x/vec_helper.c +1 -1
similarity index 99%
rename from target/s390x/vec_helper.c
rename to target/s390x/tcg/vec_helper.c
index 986e7cc825..ddd0a8be5b 100644
@@ -11,7 +11,7 @@
   */
  #include "qemu/osdep.h"
  #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
  #include "vec.h"
  #include "tcg/tcg.h"
  #include "tcg/tcg-gvec-desc.h"
target/s390x/tcg/vec_int_helper.c renamed from target/s390x/vec_int_helper.c +0 -0
similarity index 100%
rename from target/s390x/vec_int_helper.c
rename to target/s390x/tcg/vec_int_helper.c
target/s390x/tcg/vec_string_helper.c renamed from target/s390x/vec_string_helper.c +1 -1
similarity index 99%
rename from target/s390x/vec_string_helper.c
rename to target/s390x/tcg/vec_string_helper.c
index c516c0ceeb..ac315eb095 100644
@@ -12,7 +12,7 @@
  #include "qemu/osdep.h"
  #include "qemu-common.h"
  #include "cpu.h"
-#include "internal.h"
+#include "s390x-internal.h"
  #include "vec.h"
  #include "tcg/tcg.h"
  #include "tcg/tcg-gvec-desc.h"
target/s390x/tcg/translate_vx.c.inc renamed from target/s390x/translate_vx.c.inc +0 -0
similarity index 100%
rename from target/s390x/translate_vx.c.inc
rename to target/s390x/tcg/translate_vx.c.inc
target/s390x/meson.build +2 -15
index a5e1ded93f..60d7f1b908 100644
@@ -8,21 +8,6 @@ s390x_ss.add(files(
    'interrupt.c',
  ))
 
-s390x_ss.add(when: 'CONFIG_TCG', if_true: files(
-  'cc_helper.c',
-  'crypto_helper.c',
-  'excp_helper.c',
-  'fpu_helper.c',
-  'int_helper.c',
-  'mem_helper.c',
-  'misc_helper.c',
-  'translate.c',
-  'vec_fpu_helper.c',
-  'vec_helper.c',
-  'vec_int_helper.c',
-  'vec_string_helper.c',
-))
-
  s390x_ss.add(when: 'CONFIG_KVM', if_true: files('kvm.c'), if_false: files('kvm-stub.c'))
 
  gen_features = executable('gen-features', 'gen-features.c', native: true,
@@ -60,6 +45,8 @@ endif
 
  s390x_user_ss = ss.source_set()
 
+subdir('tcg')
+
  target_arch += {'s390x': s390x_ss}
  target_softmmu_arch += {'s390x': s390x_softmmu_ss}
  target_user_arch += {'s390x': s390x_user_ss}
target/s390x/tcg/insn-data.def renamed from target/s390x/insn-data.def +0 -0
similarity index 100%
rename from target/s390x/insn-data.def
rename to target/s390x/tcg/insn-data.def
target/s390x/tcg/insn-format.def renamed from target/s390x/insn-format.def +0 -0
similarity index 100%
rename from target/s390x/insn-format.def
rename to target/s390x/tcg/insn-format.def
target/s390x/tcg/meson.build new file +4 -0
new file mode 100644
index 0000000000..ee4e8fec77
@@ -0,0 +1,14 @@
+s390x_ss.add(when: 'CONFIG_TCG', if_true: files(
+  'cc_helper.c',
+  'crypto_helper.c',
+  'excp_helper.c',

target/s390x/tcg/meson.build line 14

Quoted 10 lines
target/s390x/tcg/meson.build new file +10 -0
+  'fpu_helper.c',
+  'int_helper.c',
+  'mem_helper.c',
+  'misc_helper.c',
+  'translate.c',
+  'vec_fpu_helper.c',
+  'vec_helper.c',
+  'vec_int_helper.c',
+  'vec_string_helper.c',
+))
Signature · 3 lines
Thanks,

David / dhildenb
#14 lore raw

RFC v3 6/13 target/s390x: move sysemu-only code out to cpu-sysemu.c

In reply to Claudio Fontana
---
 target/s390x/s390x-internal.h |   6 +
 target/s390x/cpu-sysemu.c     | 304 ++++++++++++++++++++++++++++++++++
 target/s390x/cpu.c            | 283 ++-----------------------------
 target/s390x/meson.build      |   1 +
 target/s390x/trace-events     |   2 +-
 5 files changed, 324 insertions(+), 272 deletions(-)
 create mode 100644 target/s390x/cpu-sysemu.c
target/s390x/s390x-internal.h +6 -0
index 11515bb617..171ecd59fb 100644
@@ -244,6 +244,12 @@ void load_psw(CPUS390XState *env, uint64_t mask, uint64_t addr);
 #ifndef CONFIG_USER_ONLY
 unsigned int s390_cpu_halt(S390CPU *cpu);
 void s390_cpu_unhalt(S390CPU *cpu);
+void s390_cpu_init_sysemu(Object *obj);
+bool s390_cpu_realize_sysemu(DeviceState *dev, Error **errp);
+void s390_cpu_finalize(Object *obj);
+void s390_cpu_class_init_sysemu(CPUClass *cc);
+void s390_cpu_machine_reset_cb(void *opaque);
+
 #else
 static inline unsigned int s390_cpu_halt(S390CPU *cpu)
 {
target/s390x/cpu-sysemu.c new file +304 -0

304 lines not on this page · raw message

target/s390x/cpu.c +12 -271

367 lines not on this page · raw message

target/s390x/meson.build +1 -0
index 60d7f1b908..a73bae3dc5 100644
@@ -28,6 +28,7 @@ s390x_softmmu_ss.add(files(
   'machine.c',
   'mmu_helper.c',
   'sigp.c',
+  'cpu-sysemu.c',
 ))
 
 # Newer kernels on s390 check for an S390_PGSTE program header and
target/s390x/trace-events +1 -1
index fda1ee8220..e6c5fc1d03 100644
@@ -16,7 +16,7 @@ kvm_clear_cmma(int rc) "CMMA: clearing with result code %d"
 kvm_failed_cpu_state_set(int cpu_index, uint8_t state, const char *msg) "Warning: Unable to set cpu %d state %" PRIu8 " to KVM: %s"
 kvm_assign_subch_ioeventfd(int fd, uint32_t addr, bool assign, int datamatch) "fd: %d sch: @0x%x assign: %d vq: %d"
 
-# cpu.c
+# cpu-sysemu.c
 cpu_set_state(int cpu_index, uint8_t state) "setting cpu %d state to %" PRIu8
 cpu_halt(int cpu_index) "halting cpu %d"
 cpu_unhalt(int cpu_index) "unhalting cpu %d"
Signature · 1 line
2.26.2
#15 lore raw

RFC v3 7/13 target/s390x: split cpu-dump from helper.c

In reply to Claudio Fontana
---
 target/s390x/cpu-dump.c  | 131 +++++++++++++++++++++++++++++++++++++++
 target/s390x/helper.c    | 107 --------------------------------
 target/s390x/meson.build |   1 +
 3 files changed, 132 insertions(+), 107 deletions(-)
 create mode 100644 target/s390x/cpu-dump.c
target/s390x/cpu-dump.c new file +131 -0
new file mode 100644
index 0000000000..4170dec01a
@@ -0,0 +1,131 @@
+/*
+ * S/390 CPU dump to FILE
+ *
+ *  Copyright (c) 2009 Ulrich Hecht
+ *  Copyright (c) 2011 Alexander Graf
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "qemu/osdep.h"
+#include "cpu.h"
+#include "s390x-internal.h"
+#include "qemu/qemu-print.h"
+
+void s390_cpu_dump_state(CPUState *cs, FILE *f, int flags)
+{
+    S390CPU *cpu = S390_CPU(cs);
+    CPUS390XState *env = &cpu->env;
+    int i;
+
+    if (env->cc_op > 3) {
+        qemu_fprintf(f, "PSW=mask %016" PRIx64 " addr %016" PRIx64 " cc %15s\n",
+                     env->psw.mask, env->psw.addr, cc_name(env->cc_op));
+    } else {
+        qemu_fprintf(f, "PSW=mask %016" PRIx64 " addr %016" PRIx64 " cc %02x\n",
+                     env->psw.mask, env->psw.addr, env->cc_op);
+    }
+
+    for (i = 0; i < 16; i++) {
+        qemu_fprintf(f, "R%02d=%016" PRIx64, i, env->regs[i]);
+        if ((i % 4) == 3) {
+            qemu_fprintf(f, "\n");
+        } else {
+            qemu_fprintf(f, " ");
+        }
+    }
+
+    if (flags & CPU_DUMP_FPU) {
+        if (s390_has_feat(S390_FEAT_VECTOR)) {
+            for (i = 0; i < 32; i++) {
+                qemu_fprintf(f, "V%02d=%016" PRIx64 "%016" PRIx64 "%c",
+                             i, env->vregs[i][0], env->vregs[i][1],
+                             i % 2 ? '\n' : ' ');
+            }
+        } else {
+            for (i = 0; i < 16; i++) {
+                qemu_fprintf(f, "F%02d=%016" PRIx64 "%c",
+                             i, *get_freg(env, i),
+                             (i % 4) == 3 ? '\n' : ' ');
+            }
+        }
+    }
+
+#ifndef CONFIG_USER_ONLY
+    for (i = 0; i < 16; i++) {
+        qemu_fprintf(f, "C%02d=%016" PRIx64, i, env->cregs[i]);
+        if ((i % 4) == 3) {
+            qemu_fprintf(f, "\n");
+        } else {
+            qemu_fprintf(f, " ");
+        }
+    }
+#endif
+
+#ifdef DEBUG_INLINE_BRANCHES
+    for (i = 0; i < CC_OP_MAX; i++) {
+        qemu_fprintf(f, "  %15s = %10ld\t%10ld\n", cc_name(i),
+                     inline_branch_miss[i], inline_branch_hit[i]);
+    }
+#endif
+
+    qemu_fprintf(f, "\n");
+}
+
+const char *cc_name(enum cc_op cc_op)
+{
+    static const char * const cc_names[] = {
+        [CC_OP_CONST0]    = "CC_OP_CONST0",
+        [CC_OP_CONST1]    = "CC_OP_CONST1",
+        [CC_OP_CONST2]    = "CC_OP_CONST2",
+        [CC_OP_CONST3]    = "CC_OP_CONST3",
+        [CC_OP_DYNAMIC]   = "CC_OP_DYNAMIC",
+        [CC_OP_STATIC]    = "CC_OP_STATIC",
+        [CC_OP_NZ]        = "CC_OP_NZ",
+        [CC_OP_ADDU]      = "CC_OP_ADDU",
+        [CC_OP_SUBU]      = "CC_OP_SUBU",
+        [CC_OP_LTGT_32]   = "CC_OP_LTGT_32",
+        [CC_OP_LTGT_64]   = "CC_OP_LTGT_64",
+        [CC_OP_LTUGTU_32] = "CC_OP_LTUGTU_32",
+        [CC_OP_LTUGTU_64] = "CC_OP_LTUGTU_64",
+        [CC_OP_LTGT0_32]  = "CC_OP_LTGT0_32",
+        [CC_OP_LTGT0_64]  = "CC_OP_LTGT0_64",
+        [CC_OP_ADD_64]    = "CC_OP_ADD_64",
+        [CC_OP_SUB_64]    = "CC_OP_SUB_64",
+        [CC_OP_ABS_64]    = "CC_OP_ABS_64",
+        [CC_OP_NABS_64]   = "CC_OP_NABS_64",
+        [CC_OP_ADD_32]    = "CC_OP_ADD_32",
+        [CC_OP_SUB_32]    = "CC_OP_SUB_32",
+        [CC_OP_ABS_32]    = "CC_OP_ABS_32",
+        [CC_OP_NABS_32]   = "CC_OP_NABS_32",
+        [CC_OP_COMP_32]   = "CC_OP_COMP_32",
+        [CC_OP_COMP_64]   = "CC_OP_COMP_64",
+        [CC_OP_TM_32]     = "CC_OP_TM_32",
+        [CC_OP_TM_64]     = "CC_OP_TM_64",
+        [CC_OP_NZ_F32]    = "CC_OP_NZ_F32",
+        [CC_OP_NZ_F64]    = "CC_OP_NZ_F64",
+        [CC_OP_NZ_F128]   = "CC_OP_NZ_F128",
+        [CC_OP_ICM]       = "CC_OP_ICM",
+        [CC_OP_SLA_32]    = "CC_OP_SLA_32",
+        [CC_OP_SLA_64]    = "CC_OP_SLA_64",
+        [CC_OP_FLOGR]     = "CC_OP_FLOGR",
+        [CC_OP_LCBB]      = "CC_OP_LCBB",
+        [CC_OP_VC]        = "CC_OP_VC",
+        [CC_OP_MULS_32]   = "CC_OP_MULS_32",
+        [CC_OP_MULS_64]   = "CC_OP_MULS_64",
+    };
+
+    return cc_names[cc_op];
+}
target/s390x/helper.c +0 -107

116 lines not on this page · raw message

target/s390x/meson.build +1 -0
index a73bae3dc5..6e1aa3b0cd 100644
@@ -6,6 +6,7 @@ s390x_ss.add(files(
   'gdbstub.c',
   'helper.c',
   'interrupt.c',
+  'cpu-dump.c',
 ))
 
 s390x_ss.add(when: 'CONFIG_KVM', if_true: files('kvm.c'), if_false: files('kvm-stub.c'))
Signature · 1 line
2.26.2
#16 lore raw

RFC v3 8/13 target/s390x: make helper.c sysemu-only

In reply to Claudio Fontana

Now that we have moved cpu-dump functionality out of helper.c, we can make the module sysemu-only.

---
 target/s390x/helper.c    | 4 ----
 target/s390x/meson.build | 2 +-
 2 files changed, 1 insertion(+), 5 deletions(-)
target/s390x/helper.c +0 -4
index 41ccc83d11..f246bec353 100644
@@ -27,11 +27,8 @@
 #include "hw/s390x/pv.h"
 #include "sysemu/hw_accel.h"
 #include "sysemu/runstate.h"
-#ifndef CONFIG_USER_ONLY
 #include "sysemu/tcg.h"
-#endif
 
-#ifndef CONFIG_USER_ONLY
 void s390x_tod_timer(void *opaque)
 {
     cpu_inject_clock_comparator((S390CPU *) opaque);
@@ -322,4 +319,3 @@ int s390_store_adtl_status(S390CPU *cpu, hwaddr addr, hwaddr len)
     cpu_physical_memory_unmap(sa, len, 1, len);
     return 0;
 }
-#endif /* CONFIG_USER_ONLY */
target/s390x/meson.build +1 -1
index 6e1aa3b0cd..bbcaede384 100644
@@ -4,7 +4,6 @@ s390x_ss.add(files(
   'cpu_features.c',
   'cpu_models.c',
   'gdbstub.c',
-  'helper.c',
   'interrupt.c',
   'cpu-dump.c',
 ))
@@ -23,6 +22,7 @@ s390x_ss.add(gen_features_h)
 
 s390x_softmmu_ss = ss.source_set()
 s390x_softmmu_ss.add(files(
+  'helper.c',
   'arch_dump.c',
   'diag.c',
   'ioinst.c',
Signature · 1 line
2.26.2
#17 lore raw

RFC v3 9/13 target/s390x: use kvm_enabled() to wrap call to kvm_s390_get_hpage_1m

In reply to Claudio Fontana

this will allow to remove the kvm stubs.

---
 target/s390x/diag.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
target/s390x/diag.c +2 -1
index 86b7032b5b..311e22b4ea 100644
@@ -21,6 +21,7 @@
 #include "hw/s390x/ipl.h"
 #include "hw/s390x/s390-virtio-ccw.h"
 #include "hw/s390x/pv.h"
+#include "sysemu/kvm.h"
 #include "kvm_s390x.h"
 
 int handle_diag_288(CPUS390XState *env, uint64_t r1, uint64_t r3)
@@ -169,7 +170,7 @@ out:
             return;
         }
 
-        if (kvm_s390_get_hpage_1m()) {
+        if (kvm_enabled() && kvm_s390_get_hpage_1m()) {
             error_report("Protected VMs can currently not be backed with "
                          "huge pages");
             env->regs[r1 + 1] = DIAG_308_RC_INVAL_FOR_PV;
Signature · 1 line
2.26.2
#18 lore raw

RFC v3 10/13 target/s390x: remove kvm-stub.c

In reply to Claudio Fontana

all function calls are protected by kvm_enabled(), so we should not need the stubs.

---
 target/s390x/kvm-stub.c  | 126 ---------------------------------------
 target/s390x/meson.build |   2 +-
 2 files changed, 1 insertion(+), 127 deletions(-)
 delete mode 100644 target/s390x/kvm-stub.c
target/s390x/kvm-stub.c deleted +0 -126
deleted file mode 100644
index 9970b5a8c7..0000000000
@@ -1,126 +0,0 @@
-/*
- * QEMU KVM support -- s390x specific function stubs.
- *
- * Copyright (c) 2009 Ulrich Hecht
- *
- * This work is licensed under the terms of the GNU GPL, version 2 or later.
- * See the COPYING file in the top-level directory.
- */
-
-#include "qemu/osdep.h"
-#include "cpu.h"
-#include "kvm_s390x.h"
-
-void kvm_s390_access_exception(S390CPU *cpu, uint16_t code, uint64_t te_code)
-{
-}
-
-int kvm_s390_mem_op(S390CPU *cpu, vaddr addr, uint8_t ar, void *hostbuf,
-                    int len, bool is_write)
-{
-    return -ENOSYS;
-}
-
-void kvm_s390_program_interrupt(S390CPU *cpu, uint16_t code)
-{
-}
-
-int kvm_s390_set_cpu_state(S390CPU *cpu, uint8_t cpu_state)
-{
-    return -ENOSYS;
-}
-
-void kvm_s390_vcpu_interrupt_pre_save(S390CPU *cpu)
-{
-}
-
-int kvm_s390_vcpu_interrupt_post_load(S390CPU *cpu)
-{
-    return 0;
-}
-
-int kvm_s390_get_hpage_1m(void)
-{
-    return 0;
-}
-
-int kvm_s390_get_ri(void)
-{
-    return 0;
-}
-
-int kvm_s390_get_gs(void)
-{
-    return 0;
-}
-
-int kvm_s390_get_clock(uint8_t *tod_high, uint64_t *tod_low)
-{
-    return -ENOSYS;
-}
-
-int kvm_s390_get_clock_ext(uint8_t *tod_high, uint64_t *tod_low)
-{
-    return -ENOSYS;
-}
-
-int kvm_s390_set_clock(uint8_t tod_high, uint64_t tod_low)
-{
-    return -ENOSYS;
-}
-
-int kvm_s390_set_clock_ext(uint8_t tod_high, uint64_t tod_low)
-{
-    return -ENOSYS;
-}
-
-void kvm_s390_enable_css_support(S390CPU *cpu)
-{
-}
-
-int kvm_s390_assign_subch_ioeventfd(EventNotifier *notifier, uint32_t sch,
-                                    int vq, bool assign)
-{
-    return -ENOSYS;
-}
-
-void kvm_s390_cmma_reset(void)
-{
-}
-
-void kvm_s390_reset_vcpu_initial(S390CPU *cpu)
-{
-}
-
-void kvm_s390_reset_vcpu_clear(S390CPU *cpu)
-{
-}
-
-void kvm_s390_reset_vcpu_normal(S390CPU *cpu)
-{
-}
-
-int kvm_s390_set_mem_limit(uint64_t new_limit, uint64_t *hw_limit)
-{
-    return 0;
-}
-
-void kvm_s390_set_max_pagesize(uint64_t pagesize, Error **errp)
-{
-}
-
-void kvm_s390_crypto_reset(void)
-{
-}
-
-void kvm_s390_stop_interrupt(S390CPU *cpu)
-{
-}
-
-void kvm_s390_restart_interrupt(S390CPU *cpu)
-{
-}
-
-void kvm_s390_set_diag318(CPUState *cs, uint64_t diag318_info)
-{
-}
target/s390x/meson.build +1 -1
index bbcaede384..6c8e03b8fb 100644
@@ -8,7 +8,7 @@ s390x_ss.add(files(
   'cpu-dump.c',
 ))
 
-s390x_ss.add(when: 'CONFIG_KVM', if_true: files('kvm.c'), if_false: files('kvm-stub.c'))
+s390x_ss.add(when: 'CONFIG_KVM', if_true: files('kvm.c'))
 
 gen_features = executable('gen-features', 'gen-features.c', native: true,
                           build_by_default: false)
Signature · 1 line
2.26.2
#19 lore raw

RFC v3 11/13 target/s390x: move kvm files into kvm/

In reply to Claudio Fontana
---
 meson.build                        |  1 +
 target/s390x/{ => kvm}/kvm_s390x.h |  0
 target/s390x/kvm/trace.h           |  1 +
 hw/intc/s390_flic_kvm.c            |  2 +-
 hw/s390x/s390-stattrib-kvm.c       |  2 +-
 hw/s390x/tod-kvm.c                 |  2 +-
 hw/vfio/ap.c                       |  2 +-
 target/s390x/cpu-sysemu.c          |  2 +-
 target/s390x/cpu.c                 |  2 +-
 target/s390x/cpu_models.c          |  2 +-
 target/s390x/diag.c                |  2 +-
 target/s390x/interrupt.c           |  2 +-
 target/s390x/{ => kvm}/kvm.c       |  2 +-
 target/s390x/machine.c             |  2 +-
 target/s390x/mmu_helper.c          |  2 +-
 target/s390x/kvm/meson.build       | 17 +++++++++++++++++
 target/s390x/kvm/trace-events      |  7 +++++++
 target/s390x/meson.build           | 16 +---------------
 target/s390x/trace-events          |  6 ------
 19 files changed, 39 insertions(+), 33 deletions(-)
 rename target/s390x/{ => kvm}/kvm_s390x.h (100%)
 create mode 100644 target/s390x/kvm/trace.h
 rename target/s390x/{ => kvm}/kvm.c (99%)
 create mode 100644 target/s390x/kvm/meson.build
 create mode 100644 target/s390x/kvm/trace-events
meson.build +1 -0
index 25363b492d..2a4c1964bf 100644
@@ -1852,6 +1852,7 @@ if have_system or have_user
     'target/ppc',
     'target/riscv',
     'target/s390x',
+    'target/s390x/kvm',
     'target/sparc',
   ]
 endif
target/s390x/kvm/kvm_s390x.h renamed from target/s390x/kvm_s390x.h +0 -0
similarity index 100%
rename from target/s390x/kvm_s390x.h
rename to target/s390x/kvm/kvm_s390x.h
target/s390x/kvm/trace.h new file +1 -0
new file mode 100644
index 0000000000..ae195b1306
@@ -0,0 +1 @@
+#include "trace/trace-target_s390x_kvm.h"
hw/intc/s390_flic_kvm.c +1 -1
index b3fb9f8395..91987b0951 100644
@@ -12,7 +12,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
-#include "kvm_s390x.h"
+#include "kvm/kvm_s390x.h"
 #include <sys/ioctl.h>
 #include "qemu/error-report.h"
 #include "qemu/module.h"
hw/s390x/s390-stattrib-kvm.c +1 -1
index f89d8d9d16..6664345fb1 100644
@@ -17,7 +17,7 @@
 #include "sysemu/kvm.h"
 #include "exec/ram_addr.h"
 #include "cpu.h"
-#include "kvm_s390x.h"
+#include "kvm/kvm_s390x.h"
 
 Object *kvm_s390_stattrib_create(void)
 {
hw/s390x/tod-kvm.c +1 -1
index 0b94477486..ec855811ae 100644
@@ -13,7 +13,7 @@
 #include "qemu/module.h"
 #include "sysemu/runstate.h"
 #include "hw/s390x/tod.h"
-#include "kvm_s390x.h"
+#include "kvm/kvm_s390x.h"
 
 static void kvm_s390_get_tod_raw(S390TOD *tod, Error **errp)
 {
hw/vfio/ap.c +1 -1
index 9571c2f91f..56a33b1277 100644
@@ -23,7 +23,7 @@
 #include "qemu/option.h"
 #include "qemu/config-file.h"
 #include "cpu.h"
-#include "kvm_s390x.h"
+#include "kvm/kvm_s390x.h"
 #include "migration/vmstate.h"
 #include "hw/qdev-properties.h"
 #include "hw/s390x/ap-bridge.h"
target/s390x/cpu-sysemu.c +1 -1
index 6081b7ef32..f3c1b4845a 100644
@@ -24,7 +24,7 @@
 #include "qapi/error.h"
 #include "cpu.h"
 #include "s390x-internal.h"
-#include "kvm_s390x.h"
+#include "kvm/kvm_s390x.h"
 #include "sysemu/kvm.h"
 #include "sysemu/reset.h"
 #include "qemu/timer.h"
target/s390x/cpu.c +1 -1
index 59efe48bcd..6e82ba73cc 100644
@@ -24,7 +24,7 @@
 #include "qapi/error.h"
 #include "cpu.h"
 #include "s390x-internal.h"
-#include "kvm_s390x.h"
+#include "kvm/kvm_s390x.h"
 #include "sysemu/kvm.h"
 #include "sysemu/reset.h"
 #include "qemu/module.h"
target/s390x/cpu_models.c +1 -1
index 4ff8cba7e5..0ed1c23774 100644
@@ -13,7 +13,7 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "s390x-internal.h"
-#include "kvm_s390x.h"
+#include "kvm/kvm_s390x.h"
 #include "sysemu/kvm.h"
 #include "sysemu/tcg.h"
 #include "qapi/error.h"
target/s390x/diag.c +1 -1
index 311e22b4ea..5b75853a7e 100644
@@ -22,7 +22,7 @@
 #include "hw/s390x/s390-virtio-ccw.h"
 #include "hw/s390x/pv.h"
 #include "sysemu/kvm.h"
-#include "kvm_s390x.h"
+#include "kvm/kvm_s390x.h"
 
 int handle_diag_288(CPUS390XState *env, uint64_t r1, uint64_t r3)
 {
target/s390x/interrupt.c +1 -1
index d0e58d6e8d..4e64ee705f 100644
@@ -10,7 +10,7 @@
 #include "qemu/osdep.h"
 #include "qemu/log.h"
 #include "cpu.h"
-#include "kvm_s390x.h"
+#include "kvm/kvm_s390x.h"
 #include "s390x-internal.h"
 #include "exec/exec-all.h"
 #include "sysemu/kvm.h"
target/s390x/kvm/kvm.c renamed from target/s390x/kvm.c +1 -1
similarity index 99%
rename from target/s390x/kvm.c
rename to target/s390x/kvm/kvm.c
index 2a22cc69f6..4e47563faf 100644
@@ -27,7 +27,7 @@
 #include "qemu-common.h"
 #include "cpu.h"
 #include "s390x-internal.h"
-#include "kvm_s390x.h"
+#include "kvm/kvm_s390x.h"
 #include "sysemu/kvm_int.h"
 #include "qemu/cutils.h"
 #include "qapi/error.h"
target/s390x/machine.c +1 -1
index 81a8a7ff99..37a076858c 100644
@@ -17,7 +17,7 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "s390x-internal.h"
-#include "kvm_s390x.h"
+#include "kvm/kvm_s390x.h"
 #include "migration/vmstate.h"
 #include "tcg/tcg_s390x.h"
 #include "sysemu/kvm.h"
target/s390x/mmu_helper.c +1 -1
index 52fdd86c63..d779a9fc51 100644
@@ -20,7 +20,7 @@
 #include "exec/address-spaces.h"
 #include "cpu.h"
 #include "s390x-internal.h"
-#include "kvm_s390x.h"
+#include "kvm/kvm_s390x.h"
 #include "sysemu/kvm.h"
 #include "sysemu/tcg.h"
 #include "exec/exec-all.h"
target/s390x/kvm/meson.build new file +17 -0
new file mode 100644
index 0000000000..d1356356b1
@@ -0,0 +1,17 @@
+
+s390x_ss.add(when: 'CONFIG_KVM', if_true: files(
+  'kvm.c'
+))
+
+# Newer kernels on s390 check for an S390_PGSTE program header and
+# enable the pgste page table extensions in that case. This makes
+# the vm.allocate_pgste sysctl unnecessary. We enable this program
+# header if
+#  - we build on s390x
+#  - we build the system emulation for s390x (qemu-system-s390x)
+#  - KVM is enabled
+#  - the linker supports --s390-pgste
+if host_machine.cpu_family() == 's390x' and cc.has_link_argument('-Wl,--s390-pgste')
+  s390x_softmmu_ss.add(when: 'CONFIG_KVM',
+                       if_true: declare_dependency(link_args: ['-Wl,--s390-pgste']))
+endif
target/s390x/kvm/trace-events new file +7 -0
new file mode 100644
index 0000000000..5289f5f675
@@ -0,0 +1,7 @@
+# See docs/devel/tracing.txt for syntax documentation.
+
+# kvm.c
+kvm_enable_cmma(int rc) "CMMA: enabling with result code %d"
+kvm_clear_cmma(int rc) "CMMA: clearing with result code %d"
+kvm_failed_cpu_state_set(int cpu_index, uint8_t state, const char *msg) "Warning: Unable to set cpu %d state %" PRIu8 " to KVM: %s"
+kvm_assign_subch_ioeventfd(int fd, uint32_t addr, bool assign, int datamatch) "fd: %d sch: @0x%x assign: %d vq: %d"
target/s390x/meson.build +1 -15
index 6c8e03b8fb..ec73bed524 100644
@@ -8,8 +8,6 @@ s390x_ss.add(files(
   'cpu-dump.c',
 ))
 
-s390x_ss.add(when: 'CONFIG_KVM', if_true: files('kvm.c'))
-
 gen_features = executable('gen-features', 'gen-features.c', native: true,
                           build_by_default: false)
 
@@ -32,22 +30,10 @@ s390x_softmmu_ss.add(files(
   'cpu-sysemu.c',
 ))
 
-# Newer kernels on s390 check for an S390_PGSTE program header and
-# enable the pgste page table extensions in that case. This makes
-# the vm.allocate_pgste sysctl unnecessary. We enable this program
-# header if
-#  - we build on s390x
-#  - we build the system emulation for s390x (qemu-system-s390x)
-#  - KVM is enabled
-#  - the linker supports --s390-pgste
-if host_machine.cpu_family() == 's390x' and cc.has_link_argument('-Wl,--s390-pgste')
-  s390x_softmmu_ss.add(when: 'CONFIG_KVM',
-                       if_true: declare_dependency(link_args: ['-Wl,--s390-pgste']))
-endif
-
 s390x_user_ss = ss.source_set()
 
 subdir('tcg')
+subdir('kvm')
 
 target_arch += {'s390x': s390x_ss}
 target_softmmu_arch += {'s390x': s390x_softmmu_ss}
target/s390x/trace-events +0 -6
index e6c5fc1d03..c3414f58af 100644
@@ -10,12 +10,6 @@ ioinst_sch_id(const char *insn, int cssid, int ssid, int schid) "IOINST: %s (%x.
 ioinst_chp_id(const char *insn, int cssid, int chpid) "IOINST: %s (%x.%02x)"
 ioinst_chsc_cmd(uint16_t cmd, uint16_t len) "IOINST: chsc command 0x%04x, len 0x%04x"
 
-# kvm.c
-kvm_enable_cmma(int rc) "CMMA: enabling with result code %d"
-kvm_clear_cmma(int rc) "CMMA: clearing with result code %d"
-kvm_failed_cpu_state_set(int cpu_index, uint8_t state, const char *msg) "Warning: Unable to set cpu %d state %" PRIu8 " to KVM: %s"
-kvm_assign_subch_ioeventfd(int fd, uint32_t addr, bool assign, int datamatch) "fd: %d sch: @0x%x assign: %d vq: %d"
-
 # cpu-sysemu.c
 cpu_set_state(int cpu_index, uint8_t state) "setting cpu %d state to %" PRIu8
 cpu_halt(int cpu_index) "halting cpu %d"
Signature · 1 line
2.26.2
#20 lore raw

RFC v3 12/13 target/s390x: split sysemu part of cpu models

In reply to Claudio Fontana

also create a tiny _user.c with just the (at least for now), empty implementation of apply_cpu_model.

---
 target/s390x/s390x-internal.h    |   2 +
 target/s390x/cpu_models.c        | 417 +-----------------------------
 target/s390x/cpu_models_sysemu.c | 426 +++++++++++++++++++++++++++++++
 target/s390x/cpu_models_user.c   |  20 ++
 target/s390x/meson.build         |   4 +
 5 files changed, 453 insertions(+), 416 deletions(-)
 create mode 100644 target/s390x/cpu_models_sysemu.c
 create mode 100644 target/s390x/cpu_models_user.c
target/s390x/s390x-internal.h +2 -0
index 171ecd59fb..e4ec5e55bb 100644
@@ -265,6 +265,8 @@ static inline void s390_cpu_unhalt(S390CPU *cpu)
 /* cpu_models.c */
 void s390_cpu_model_class_register_props(ObjectClass *oc);
 void s390_realize_cpu_model(CPUState *cs, Error **errp);
+S390CPUModel *get_max_cpu_model(Error **errp);
+void apply_cpu_model(const S390CPUModel *model, Error **errp);
 ObjectClass *s390_cpu_class_by_name(const char *name);
 
 
target/s390x/cpu_models.c +1 -416

446 lines not on this page · raw message

target/s390x/cpu_models_sysemu.c new file +426 -0

426 lines not on this page · raw message

target/s390x/cpu_models_user.c new file +20 -0
new file mode 100644
index 0000000000..df24d12d9e
@@ -0,0 +1,20 @@
+/*
+ * CPU models for s390x - User-mode
+ *
+ * Copyright 2016 IBM Corp.
+ *
+ * Author(s): David Hildenbrand <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or (at
+ * your option) any later version. See the COPYING file in the top-level
+ * directory.
+ */
+
+#include "qemu/osdep.h"
+#include "cpu.h"
+#include "s390x-internal.h"
+#include "qapi/error.h"
+
+void apply_cpu_model(const S390CPUModel *model, Error **errp)
+{
+}
target/s390x/meson.build +4 -0
index ec73bed524..84c1402a6a 100644
@@ -28,9 +28,13 @@ s390x_softmmu_ss.add(files(
   'mmu_helper.c',
   'sigp.c',
   'cpu-sysemu.c',
+  'cpu_models_sysemu.c',
 ))
 
 s390x_user_ss = ss.source_set()
+s390x_user_ss.add(files(
+  'cpu_models_user.c',
+))
 
 subdir('tcg')
 subdir('kvm')
Signature · 1 line
2.26.2
#21 lore raw

RFC v3 13/13 MAINTAINERS: update s390x directories

In reply to Claudio Fontana

After the reshuffling, update MAINTAINERS accordingly. Make use of the new directories:

target/s390x/kvm/
target/s390x/tcg/

---
 MAINTAINERS | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
MAINTAINERS +3 -5
index 7de873c9f5..3d738bd4fc 100644
@@ -315,7 +315,7 @@ S390 TCG CPUs
 M: Richard Henderson <[email protected]>
 M: David Hildenbrand <[email protected]>
 S: Maintained
-F: target/s390x/
+F: target/s390x/tcg
 F: hw/s390x/
 F: disas/s390.c
 F: tests/tcg/s390x/
@@ -417,14 +417,12 @@ M: Halil Pasic <[email protected]>
 M: Cornelia Huck <[email protected]>
 M: Christian Borntraeger <[email protected]>
 S: Supported
-F: target/s390x/kvm.c
-F: target/s390x/kvm_s390x.h
-F: target/s390x/kvm-stub.c
+F: target/s390x/kvm/
 F: target/s390x/ioinst.[ch]
 F: target/s390x/machine.c
 F: target/s390x/sigp.c
 F: target/s390x/cpu_features*.[ch]
-F: target/s390x/cpu_models.[ch]
+F: target/s390x/cpu_models*.[ch]
 F: hw/s390x/pv.c
 F: include/hw/s390x/pv.h
 F: hw/intc/s390_flic.c
Signature · 1 line
2.26.2
#22 lore raw

Re: [RFC v3 13/13] MAINTAINERS: update s390x directories

Quoted 5 lines · On Thu, 22 Apr 2021 13:54:30 +0200 Claudio Fontana <[email protected]> wrote:

After the reshuffling, update MAINTAINERS accordingly. Make use of the new directories:

target/s390x/kvm/
target/s390x/tcg/

Is there anything left in target/s390x/ that is neither in kvm/ nor in tcg/? It seems that will only be covered by the general s390 maintainers entry.

Quoted 11 lines
---
 MAINTAINERS | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
MAINTAINERS +0 -0
index 7de873c9f5..3d738bd4fc 100644

MAINTAINERS S390 TCG CPUs · line 319

Quoted 6 lines
MAINTAINERS +1 -1
@@ -315,7 +315,7 @@ S390 TCG CPUs
 M: Richard Henderson <[email protected]>
 M: David Hildenbrand <[email protected]>
 S: Maintained
-F: target/s390x/
+F: target/s390x/tcg
 F: hw/s390x/

Unrelated: I'm wondering how much sense it makes to have the whole of hw/s390x/ under the tcg section... but if the maintainers are not complaining, I'm happy to leave it there :)

Quoted 19 lines
MAINTAINERS +2 -4
 F: disas/s390.c
 F: tests/tcg/s390x/
@@ -417,14 +417,12 @@ M: Halil Pasic <[email protected]>
 M: Cornelia Huck <[email protected]>
 M: Christian Borntraeger <[email protected]>
 S: Supported
-F: target/s390x/kvm.c
-F: target/s390x/kvm_s390x.h
-F: target/s390x/kvm-stub.c
+F: target/s390x/kvm/
 F: target/s390x/ioinst.[ch]
 F: target/s390x/machine.c
 F: target/s390x/sigp.c
 F: target/s390x/cpu_features*.[ch]
-F: target/s390x/cpu_models.[ch]
+F: target/s390x/cpu_models*.[ch]
 F: hw/s390x/pv.c
 F: include/hw/s390x/pv.h
 F: hw/intc/s390_flic.c
#23 lore raw

Re: [RFC v3 13/13] MAINTAINERS: update s390x directories

Hello Cornelia,

Quoted 10 lines · Cornelia Huck
Quoted 5 lines · On Thu, 22 Apr 2021 13:54:30 +0200 Claudio Fontana <[email protected]> wrote:

After the reshuffling, update MAINTAINERS accordingly. Make use of the new directories:

target/s390x/kvm/
target/s390x/tcg/

Is there anything left in target/s390x/ that is neither in kvm/ nor in

Btw the series still does not include the move of TCGCPUOps to a tcg CPU class accel in tcg/, if ok with you all I would do it in a later series, but let me know if you'd like it here instead.

After this series, there is still:

cpu class code, cpu-*
machine.c
arch_dump.c
cpu_models*
cpu_features*
helper.c
diag.c
interrupt.c
ioinst.c

mmu_helper.c [ part of this could be still split between tcg/ and kvm/ but it is not a clear call]
sigp.c [ same here, could be investigated for further split, but likely common parts would remain here]

Many of these items match the S390 KVM CPUs section, which in some cases should probably instead be more in the general section:

S390 KVM CPUs
M: Halil Pasic <[email protected]>
M: Cornelia Huck <[email protected]>
M: Christian Borntraeger <[email protected]>
S: Supported
F: target/s390x/kvm/
F: target/s390x/ioinst.[ch]
F: target/s390x/machine.c
F: target/s390x/sigp.c
F: target/s390x/cpu_features*.[ch]
F: target/s390x/cpu_models*.[ch]
F: hw/s390x/pv.c
F: include/hw/s390x/pv.h
F: hw/intc/s390_flic.c
F: hw/intc/s390_flic_kvm.c
F: include/hw/s390x/s390_flic.h
F: gdb-xml/s390*.xml
T: git https://gitlab.com/cohuck/qemu.git s390-next
T: git https://github.com/borntraeger/qemu.git s390-next
L: [email protected]

Quoted 36 lines

tcg/? It seems that will only be covered by the general s390 maintainers entry.

Quoted 11 lines
---
 MAINTAINERS | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
MAINTAINERS +0 -0
index 7de873c9f5..3d738bd4fc 100644

MAINTAINERS S390 TCG CPUs · line 319

Quoted 6 lines
MAINTAINERS +1 -1
@@ -315,7 +315,7 @@ S390 TCG CPUs
 M: Richard Henderson <[email protected]>
 M: David Hildenbrand <[email protected]>
 S: Maintained
-F: target/s390x/
+F: target/s390x/tcg
 F: hw/s390x/

Unrelated: I'm wondering how much sense it makes to have the whole of hw/s390x/ under the tcg section... but if the maintainers are not complaining, I'm happy to leave it there :)

Quoted 11 lines
MAINTAINERS +1 -3
 F: disas/s390.c
 F: tests/tcg/s390x/
@@ -417,14 +417,12 @@ M: Halil Pasic <[email protected]>
 M: Cornelia Huck <[email protected]>
 M: Christian Borntraeger <[email protected]>
 S: Supported
-F: target/s390x/kvm.c
-F: target/s390x/kvm_s390x.h
-F: target/s390x/kvm-stub.c
+F: target/s390x/kvm/
 F: target/s390x/ioinst.[ch]
Quoted 10 lines

MAINTAINERS M: Halil Pasic <[email protected]> · line 428

Quoted 8 lines
MAINTAINERS +1 -1
 F: target/s390x/machine.c
 F: target/s390x/sigp.c
 F: target/s390x/cpu_features*.[ch]
-F: target/s390x/cpu_models.[ch]
+F: target/s390x/cpu_models*.[ch]
 F: hw/s390x/pv.c
 F: include/hw/s390x/pv.h
 F: hw/intc/s390_flic.c

Let me know if you need further changes here,
or if they should be in a separate context.

Thanks!

Claudio