diff mbox series

[RFC,v6,12/13] target/s390x: move kvm files into kvm/

Message ID 20210629141931.4489-13-acho@suse.com (mailing list archive)
State New, archived
Headers show
Series s390x cleanup | expand

Commit Message

Al Cho June 29, 2021, 2:19 p.m. UTC
move kvm files into kvm/
After the reshuffling, update MAINTAINERS accordingly.
Make use of the new directory:

target/s390x/kvm/

Signed-off-by: Claudio Fontana <cfontana@suse.de>
Signed-off-by: Cho, Yu-Chen <acho@suse.com>
---
 MAINTAINERS                        |  3 +--
 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 +-
 meson.build                        |  1 +
 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/{ => kvm}/kvm_s390x.h |  0
 target/s390x/kvm/meson.build       | 17 +++++++++++++++++
 target/s390x/kvm/trace-events      |  7 +++++++
 target/s390x/kvm/trace.h           |  1 +
 target/s390x/machine.c             |  2 +-
 target/s390x/meson.build           | 16 +---------------
 target/s390x/mmu_helper.c          |  2 +-
 target/s390x/trace-events          |  6 ------
 20 files changed, 40 insertions(+), 35 deletions(-)
 rename target/s390x/{ => kvm}/kvm.c (99%)
 rename target/s390x/{ => kvm}/kvm_s390x.h (100%)
 create mode 100644 target/s390x/kvm/meson.build
 create mode 100644 target/s390x/kvm/trace-events
 create mode 100644 target/s390x/kvm/trace.h

Comments

Cornelia Huck June 30, 2021, 3:24 p.m. UTC | #1
On Tue, Jun 29 2021, "Cho, Yu-Chen" <acho@suse.com> wrote:

> move kvm files into kvm/
> After the reshuffling, update MAINTAINERS accordingly.
> Make use of the new directory:
>
> target/s390x/kvm/
>
> Signed-off-by: Claudio Fontana <cfontana@suse.de>
> Signed-off-by: Cho, Yu-Chen <acho@suse.com>
> ---
>  MAINTAINERS                        |  3 +--
>  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 +-
>  meson.build                        |  1 +
>  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/{ => kvm}/kvm_s390x.h |  0
>  target/s390x/kvm/meson.build       | 17 +++++++++++++++++
>  target/s390x/kvm/trace-events      |  7 +++++++
>  target/s390x/kvm/trace.h           |  1 +
>  target/s390x/machine.c             |  2 +-
>  target/s390x/meson.build           | 16 +---------------
>  target/s390x/mmu_helper.c          |  2 +-
>  target/s390x/trace-events          |  6 ------
>  20 files changed, 40 insertions(+), 35 deletions(-)
>  rename target/s390x/{ => kvm}/kvm.c (99%)
>  rename target/s390x/{ => kvm}/kvm_s390x.h (100%)
>  create mode 100644 target/s390x/kvm/meson.build
>  create mode 100644 target/s390x/kvm/trace-events
>  create mode 100644 target/s390x/kvm/trace.h

Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Thomas Huth July 1, 2021, 7:30 p.m. UTC | #2
On 29/06/2021 16.19, Cho, Yu-Chen wrote:
> move kvm files into kvm/
> After the reshuffling, update MAINTAINERS accordingly.
> Make use of the new directory:
> 
> target/s390x/kvm/
> 
> Signed-off-by: Claudio Fontana <cfontana@suse.de>
> Signed-off-by: Cho, Yu-Chen <acho@suse.com>
> ---
[...]
> diff --git a/meson.build b/meson.build
> index a91b39465c..293d509c7e 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1886,6 +1886,7 @@ if have_system or have_user
>       'target/ppc',
>       'target/riscv',
>       'target/s390x',
> +    'target/s390x/kvm',

You've added this to the "have_system or have_user" section ... however, I 
think the KVM code should not be required at all if compiling with 
--disable-system, since the linux-user builds require TCG only.

So it might be cleaner to add this in the "if have_system" section instead?

>       'target/sparc',
>     ]
>   endif
[...]
> diff --git a/target/s390x/kvm.c b/target/s390x/kvm/kvm.c
> similarity index 99%
> rename from target/s390x/kvm.c
> rename to target/s390x/kvm/kvm.c
> index 5b1fdb55c4..07dae06de8 100644
> --- a/target/s390x/kvm.c
> +++ b/target/s390x/kvm/kvm.c
> @@ -27,7 +27,7 @@
>   #include "qemu-common.h"
>   #include "cpu.h"
>   #include "s390x-internal.h"
> -#include "kvm_s390x.h"
> +#include "kvm/kvm_s390x.h"

No need to add the kvm/ prefix here since the file is in the same folder.

  Thomas
Al Cho July 6, 2021, 6:32 p.m. UTC | #3
On Thu, 2021-07-01 at 21:30 +0200, Thomas Huth wrote:
> On 29/06/2021 16.19, Cho, Yu-Chen wrote:
> > move kvm files into kvm/
> > After the reshuffling, update MAINTAINERS accordingly.
> > Make use of the new directory:
> > 
> > target/s390x/kvm/
> > 
> > Signed-off-by: Claudio Fontana <cfontana@suse.de>
> > Signed-off-by: Cho, Yu-Chen <acho@suse.com>
> > ---
> [...]
> > diff --git a/meson.build b/meson.build
> > index a91b39465c..293d509c7e 100644
> > --- a/meson.build
> > +++ b/meson.build
> > @@ -1886,6 +1886,7 @@ if have_system or have_user
> >       'target/ppc',
> >       'target/riscv',
> >       'target/s390x',
> > +    'target/s390x/kvm',
> 
> You've added this to the "have_system or have_user" section ...
> however, I 
> think the KVM code should not be required at all if compiling with 
> --disable-system, since the linux-user builds require TCG only.
> 
> So it might be cleaner to add this in the "if have_system" section
> instead?
> 

Yes, I agree with you the KVM code does not be required at all if
compiling with --disable-system.
But I think it's fine to add this here, if we want to change to the "if
have_system" section, it might be better in another patch and include
target/i386/kvm.


> >       'target/sparc',
> >     ]
> >   endif
> [...]
> > diff --git a/target/s390x/kvm.c b/target/s390x/kvm/kvm.c
> > similarity index 99%
> > rename from target/s390x/kvm.c
> > rename to target/s390x/kvm/kvm.c
> > index 5b1fdb55c4..07dae06de8 100644
> > --- a/target/s390x/kvm.c
> > +++ b/target/s390x/kvm/kvm.c
> > @@ -27,7 +27,7 @@
> >   #include "qemu-common.h"
> >   #include "cpu.h"
> >   #include "s390x-internal.h"
> > -#include "kvm_s390x.h"
> > +#include "kvm/kvm_s390x.h"
> 
> No need to add the kvm/ prefix here since the file is in the same
> folder.
> 

indeed, will remove this.

Thanks,
      AL
diff mbox series

Patch

diff --git a/MAINTAINERS b/MAINTAINERS
index 4e172540c0..5a482d65da 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -393,8 +393,7 @@  M: Halil Pasic <pasic@linux.ibm.com>
 M: Cornelia Huck <cohuck@redhat.com>
 M: Christian Borntraeger <borntraeger@de.ibm.com>
 S: Supported
-F: target/s390x/kvm.c
-F: target/s390x/kvm_s390x.h
+F: target/s390x/kvm/
 F: target/s390x/ioinst.[ch]
 F: target/s390x/machine.c
 F: target/s390x/sigp.c
diff --git a/hw/intc/s390_flic_kvm.c b/hw/intc/s390_flic_kvm.c
index 929cfa3a68..efe5054182 100644
--- a/hw/intc/s390_flic_kvm.c
+++ b/hw/intc/s390_flic_kvm.c
@@ -11,7 +11,7 @@ 
  */
 
 #include "qemu/osdep.h"
-#include "kvm_s390x.h"
+#include "kvm/kvm_s390x.h"
 #include <sys/ioctl.h>
 #include "qemu/error-report.h"
 #include "qemu/module.h"
diff --git a/hw/s390x/s390-stattrib-kvm.c b/hw/s390x/s390-stattrib-kvm.c
index f0b11a74e4..24cd01382e 100644
--- a/hw/s390x/s390-stattrib-kvm.c
+++ b/hw/s390x/s390-stattrib-kvm.c
@@ -16,7 +16,7 @@ 
 #include "qemu/error-report.h"
 #include "sysemu/kvm.h"
 #include "exec/ram_addr.h"
-#include "kvm_s390x.h"
+#include "kvm/kvm_s390x.h"
 
 Object *kvm_s390_stattrib_create(void)
 {
diff --git a/hw/s390x/tod-kvm.c b/hw/s390x/tod-kvm.c
index 0b94477486..ec855811ae 100644
--- a/hw/s390x/tod-kvm.c
+++ b/hw/s390x/tod-kvm.c
@@ -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)
 {
diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c
index 4b32aca1a0..e0dd561e85 100644
--- a/hw/vfio/ap.c
+++ b/hw/vfio/ap.c
@@ -21,7 +21,7 @@ 
 #include "qemu/module.h"
 #include "qemu/option.h"
 #include "qemu/config-file.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"
diff --git a/meson.build b/meson.build
index a91b39465c..293d509c7e 100644
--- a/meson.build
+++ b/meson.build
@@ -1886,6 +1886,7 @@  if have_system or have_user
     'target/ppc',
     'target/riscv',
     'target/s390x',
+    'target/s390x/kvm',
     'target/sparc',
   ]
 endif
diff --git a/target/s390x/cpu-sysemu.c b/target/s390x/cpu-sysemu.c
index 16e5301084..df2c6bf694 100644
--- a/target/s390x/cpu-sysemu.c
+++ b/target/s390x/cpu-sysemu.c
@@ -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"
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
index 2b2b70e1c6..9574bc9305 100644
--- a/target/s390x/cpu.c
+++ b/target/s390x/cpu.c
@@ -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"
diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
index 94789c7280..ba8f6a55ac 100644
--- a/target/s390x/cpu_models.c
+++ b/target/s390x/cpu_models.c
@@ -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"
diff --git a/target/s390x/diag.c b/target/s390x/diag.c
index 8405f69df0..76b01dcd68 100644
--- a/target/s390x/diag.c
+++ b/target/s390x/diag.c
@@ -21,7 +21,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)
 {
diff --git a/target/s390x/interrupt.c b/target/s390x/interrupt.c
index 734f0c62de..5195f060ec 100644
--- a/target/s390x/interrupt.c
+++ b/target/s390x/interrupt.c
@@ -9,7 +9,7 @@ 
 
 #include "qemu/osdep.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"
diff --git a/target/s390x/kvm.c b/target/s390x/kvm/kvm.c
similarity index 99%
rename from target/s390x/kvm.c
rename to target/s390x/kvm/kvm.c
index 5b1fdb55c4..07dae06de8 100644
--- a/target/s390x/kvm.c
+++ b/target/s390x/kvm/kvm.c
@@ -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"
diff --git a/target/s390x/kvm_s390x.h b/target/s390x/kvm/kvm_s390x.h
similarity index 100%
rename from target/s390x/kvm_s390x.h
rename to target/s390x/kvm/kvm_s390x.h
diff --git a/target/s390x/kvm/meson.build b/target/s390x/kvm/meson.build
new file mode 100644
index 0000000000..d1356356b1
--- /dev/null
+++ b/target/s390x/kvm/meson.build
@@ -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
diff --git a/target/s390x/kvm/trace-events b/target/s390x/kvm/trace-events
new file mode 100644
index 0000000000..5289f5f675
--- /dev/null
+++ b/target/s390x/kvm/trace-events
@@ -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"
diff --git a/target/s390x/kvm/trace.h b/target/s390x/kvm/trace.h
new file mode 100644
index 0000000000..ae195b1306
--- /dev/null
+++ b/target/s390x/kvm/trace.h
@@ -0,0 +1 @@ 
+#include "trace/trace-target_s390x_kvm.h"
diff --git a/target/s390x/machine.c b/target/s390x/machine.c
index 81a8a7ff99..37a076858c 100644
--- a/target/s390x/machine.c
+++ b/target/s390x/machine.c
@@ -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"
diff --git a/target/s390x/meson.build b/target/s390x/meson.build
index 6c8e03b8fb..ec73bed524 100644
--- a/target/s390x/meson.build
+++ b/target/s390x/meson.build
@@ -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}
diff --git a/target/s390x/mmu_helper.c b/target/s390x/mmu_helper.c
index 52fdd86c63..d779a9fc51 100644
--- a/target/s390x/mmu_helper.c
+++ b/target/s390x/mmu_helper.c
@@ -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"
diff --git a/target/s390x/trace-events b/target/s390x/trace-events
index e83a8cf85e..729cb012b4 100644
--- a/target/s390x/trace-events
+++ b/target/s390x/trace-events
@@ -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"