s390x cleanup
v6 cover s390x cleanup
this is the next version of a cleanup series for s390x.
v5 -> v6:
* target/s390x: start moving TCG-only code to tcg/
- keep the old pattern in MAINTAINERS (Cornelia)
* target/s390x: make helper.c sysemu-only
- fixed typo
v4 -> v5:
* "target/s390x: start moving TCG-only code to tcg/"
- add change to MAINTAINERS file
* "target/s390x: move sysemu-only code out to cpu-sysemu.c"
- make use of SysemuCPUOps s390_sysemu_ops to handle
* "target/s390x: split cpu-dump from helper.c"
- add description to explain why split cpu-dump from helper.c
* "target/s390x: make helper.c sysemu-only"
- mention at the beginning of this file that this is sysemu only (Cornelia)
* "target/s390x: remove kvm-stub.c"
- add additional comment to explain the function can be removed (Thomas)
* "target/s390x: move kvm files into kvm/"
- add change to MAINTAINERS file
* "target/s390x: split sysemu part of cpu models"
- add change to MAINTAINERS file
* "MAINTAINERS: update s390x directories"
- removed, squash this in respectively:
#6 target/s390x: start moving TCG-only code to tcg/
#12 target/s390x: move kvm files into kvm/
#13 target/s390x: split sysemu part of cpu modelsv3 -> v4: take s390x part from Claudio and modify for the current master
* "target/s390x: meson: add target_user_arch"
- new patch, add target_user_arch to avoid the proliferation of #ifdef
in target code.
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
Cho, Yu-Chen (13):
target/s390x: meson: add target_user_arch
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 | 6 +-
hw/intc/s390_flic_kvm.c | 2 +-
hw/s390x/meson.build | 4 +-
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 +-
include/hw/s390x/tod.h | 2 +-
meson.build | 1 +
target/s390x/arch_dump.c | 2 +-
target/s390x/cpu-dump.c | 176 ++++++++
target/s390x/cpu-sysemu.c | 309 +++++++++++++
target/s390x/cpu.c | 289 +-----------
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 | 162 +------
target/s390x/interrupt.c | 6 +-
target/s390x/ioinst.c | 2 +-
target/s390x/kvm-stub.c | 121 -----
target/s390x/{ => kvm}/kvm.c | 4 +-
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 | 6 +-
target/s390x/meson.build | 42 +-
target/s390x/mmu_helper.c | 4 +-
target/s390x/{internal.h => s390x-internal.h} | 8 +
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}/insn-data.def | 0
target/s390x/{ => tcg}/insn-format.def | 0
target/s390x/{ => tcg}/int_helper.c | 2 +-
target/s390x/{ => tcg}/mem_helper.c | 2 +-
target/s390x/tcg/meson.build | 14 +
target/s390x/{ => tcg}/misc_helper.c | 2 +-
target/s390x/{ => tcg}/s390-tod.h | 0
target/s390x/{ => tcg}/tcg_s390x.h | 0
target/s390x/{ => tcg}/translate.c | 2 +-
target/s390x/{ => tcg}/translate_vx.c.inc | 0
target/s390x/{ => tcg}/vec.h | 0
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/trace-events | 8 +-
54 files changed, 1057 insertions(+), 1083 deletions(-)
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%)
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
rename target/s390x/{internal.h => s390x-internal.h} (97%)
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}/insn-data.def (100%)
rename target/s390x/{ => tcg}/insn-format.def (100%)
rename target/s390x/{ => tcg}/int_helper.c (99%)
rename target/s390x/{ => tcg}/mem_helper.c (99%)
create mode 100644 target/s390x/tcg/meson.build
rename target/s390x/{ => tcg}/misc_helper.c (99%)
rename target/s390x/{ => tcg}/s390-tod.h (100%)
rename target/s390x/{ => tcg}/tcg_s390x.h (100%)
rename target/s390x/{ => tcg}/translate.c (99%)
rename target/s390x/{ => tcg}/translate_vx.c.inc (100%)
rename target/s390x/{ => tcg}/vec.h (100%)
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%)Signature · 1 line
2.32.0
RFC v6 1/13 target/s390x: meson: add target_user_arch
the lack of target_user_arch makes it hard to fully leverage the build system in order to separate user code from sysemu code.
Provide it, so that we can avoid the proliferation of #ifdef in target code.
--- target/s390x/meson.build | 3 +++ 1 file changed, 3 insertions(+)
target/s390x/meson.build +3 -0
@@ -58,5 +58,8 @@ if host_machine.cpu_family() == 's390x' and cc.has_link_argument('-Wl,--s390-pgs if_true: declare_dependency(link_args: ['-Wl,--s390-pgste'])) endif +s390x_user_ss = ss.source_set() + target_arch += {'s390x': s390x_ss} target_softmmu_arch += {'s390x': s390x_softmmu_ss} +target_user_arch += {'s390x': s390x_user_ss}
Signature · 1 line
2.32.0
Re: [RFC v6 01/13] target/s390x: meson: add target_user_arch
Quoted 6 lines · Yu-Chen
the lack of
target_user_archmakes it hard to fully leverage the build system in order to separate user code from sysemu code.Provide it, so that we can avoid the proliferation of #ifdef in target code.
Quoted 6 lines
Signed-off-by Claudio Fontana<[email protected]>Signed-off-by Cho, Yu-Chen<[email protected]>Acked-by Cornelia Huck<[email protected]>--- target/s390x/meson.build | 3 +++ 1 file changed, 3 insertions(+)
r~
RFC v6 2/13 hw/s390x: rename tod-qemu.c to tod-tcg.c
In reply to Cho, Yu-Chenwe stop short of renaming the actual qom object though, so type remains TYPE_QEMU_S390_TOD, ie "s390-tod-qemu".
---
hw/s390x/meson.build | 2 +-
hw/s390x/{tod-qemu.c => tod-tcg.c} | 0
2 files changed, 1 insertion(+), 1 deletion(-)
rename hw/s390x/{tod-qemu.c => tod-tcg.c} (100%)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(
hw/s390x/tod-tcg.c renamed from hw/s390x/tod-qemu.c +0 -0
Signature · 1 line
2.32.0
Re: [RFC v6 02/13] hw/s390x: rename tod-qemu.c to tod-tcg.c
hw/s390x/tod-tcg.c
Quoted 30 lines · Yu-Chen
we stop short of renaming the actual qom object though, so type remains
TYPE_QEMU_S390_TOD, ie "s390-tod-qemu".Signed-off-by Claudio Fontana <[email protected]>Reviewed-by David Hildenbrand <[email protected]>Reviewed-by Cornelia Huck <[email protected]>Signed-off-by Cho, Yu-Chen <[email protected]>--- hw/s390x/meson.build | 2 +- hw/s390x/{tod-qemu.c => tod-tcg.c} | 0 2 files changed, 1 insertion(+), 1 deletion(-)rename
hw/s390x/{tod-qemu.c=>tod-tcg.c} (100%)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(hw/s390x/tod-tcg.c renamed from hw/s390x/tod-qemu.c +0
-0
Might be worth the effort to also change the comment at the top of the file ("TCG implementation" instead of "QEMU implementation").
Anyway:
Re: [RFC v6 02/13] hw/s390x: rename tod-qemu.c to tod-tcg.c
Quoted 27 lines · Thomas Huth
Quoted 26 lines · Yu-Chen
we stop short of renaming the actual qom object though, so type remains
TYPE_QEMU_S390_TOD, ie "s390-tod-qemu".Signed-off-by Claudio Fontana <[email protected]>Reviewed-by David Hildenbrand <[email protected]>Reviewed-by Cornelia Huck <[email protected]>Signed-off-by Cho, Yu-Chen <[email protected]>---
hw/s390x/meson.build | 2 +-hw/s390x/{tod-qemu.c=>tod-tcg.c} | 02 files changed, 1 insertion(+), 1 deletion(-)rename
hw/s390x/{tod-qemu.c=>tod-tcg.c} (100%)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(
Quoted 9 lines
hw/s390x/tod-tcg.c
Quoted 4 lines
hw/s390x/tod-tcg.c renamed from hw/s390x/tod-qemu.c +0
-0Might be worth the effort to also change the comment at the top of the file
("TCG implementation" instead of "QEMU implementation").
right, will change it.
Thanks,
AL
Quoted 3 lines
Anyway:
Reviewed-by Thomas Huth <[email protected]>
RFC v6 3/13 hw/s390x: only build tod-tcg from the CONFIG_TCG build
In reply to Cho, Yu-Chenthis 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
@@ -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.32.0
Re: [RFC v6 03/13] hw/s390x: only build tod-tcg from the CONFIG_TCG build
Quoted 25 lines · Yu-Chen
this will allow in later patches to remove unneeded stubs in target/s390x.
Signed-off-by Claudio Fontana <[email protected]>Reviewed-by David Hildenbrand <[email protected]>Reviewed-by Cornelia Huck <[email protected]>Signed-off-by Cho, Yu-Chen <[email protected]>--- hw/s390x/meson.build | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)hw/s390x/meson.build +0
-1@@ -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'))
RFC v6 4/13 hw/s390x: tod: make explicit checks for accelerators when initializing
In reply to Cho, Yu-Chenreplace 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
@@ -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.32.0
Re: [RFC v6 04/13] hw/s390x: tod: make explicit checks for accelerators when initializing
Quoted 32 lines · Yu-Chen
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.
Signed-off-by Claudio Fontana <[email protected]>Reviewed-by David Hildenbrand <[email protected]>Reviewed-by Cornelia Huck <[email protected]>Signed-off-by Cho, Yu-Chen <[email protected]>--- hw/s390x/tod.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)hw/s390x/tod.c +2
-1@@ -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);
I think it might be better to swap the order of patch 03 and 04, to avoid that the qtests might break during bisecting later.
For this patch itself:
Al Cho via
Reviewed-by Thomas HuthRe: [RFC v6 04/13] hw/s390x: tod: make explicit checks for accelerators when initializing
ok, will swap 03 and 04 in next version.
Thanks,
AL
________________________________
From: Thomas Huth <[email protected]>
Sent: Thursday, July 1, 2021 6:32 PM
To: Al Cho <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>
Cc: Claudio Fontana <[email protected]>; José Ricardo Ziviani <[email protected]>; Claudio Fontana <[email protected]>; David Hildenbrand <[email protected]>; Cornelia Huck <[email protected]>
Subject: Re: [RFC v6 04/13] hw/s390x: tod: make explicit checks for accelerators when initializing
Quoted 32 lines · Yu-Chen
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.
Signed-off-by Claudio Fontana <[email protected]>Reviewed-by David Hildenbrand <[email protected]>Reviewed-by Cornelia Huck <[email protected]>Signed-off-by Cho, Yu-Chen <[email protected]>--- hw/s390x/tod.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)hw/s390x/tod.c +2
-1@@ -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);
I think it might be better to swap the order of patch 03 and 04, to avoid that the qtests might break during bisecting later.
For this patch itself:
RFC v6 5/13 target/s390x: remove tcg-stub.c
In reply to Cho, Yu-Chennow that we protect all calls to the tcg-specific functions with if (tcg_enabled()), we do not need the TCG stub anymore.
--- target/s390x/meson.build | 2 +- target/s390x/tcg-stub.c | 30 ------------------------------ 2 files changed, 1 insertion(+), 31 deletions(-) delete mode 100644 target/s390x/tcg-stub.c
target/s390x/meson.build +1 -1
@@ -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'))
target/s390x/tcg-stub.c deleted +0 -30
@@ -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 (); -}
Signature · 1 line
2.32.0
Re: [RFC v6 05/13] target/s390x: remove tcg-stub.c
Quoted 7 lines · Yu-Chen
now that we protect all calls to the tcg-specific functions with if (
tcg_enabled()), we do not need the TCG stub anymore.Signed-off-by Claudio Fontana <[email protected]>Reviewed-by David Hildenbrand <[email protected]>Reviewed-by Cornelia Huck <[email protected]>Signed-off-by Cho, Yu-Chen <[email protected]>
Quoted 5 lines
--- target/s390x/meson.build | 2 +- target/s390x/tcg-stub.c | 30 ------------------------------ 2 files changed, 1 insertion(+), 31 deletions(-)delete mode 100644
target/s390x/tcg-stub.c
RFC v6 6/13 target/s390x: start moving TCG-only code to tcg/
In reply to Cho, Yu-Chenmove 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.
After the reshuffling, update MAINTAINERS accordingly. Make use of the new directory:
target/s390x/tcg/
---
MAINTAINERS | 1 +
hw/s390x/tod-tcg.c | 2 +-
include/hw/s390x/tod.h | 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/meson.build | 17 ++---------------
target/s390x/mmu_helper.c | 2 +-
target/s390x/{internal.h => s390x-internal.h} | 6 ++++++
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}/insn-data.def | 0
target/s390x/{ => tcg}/insn-format.def | 0
target/s390x/{ => tcg}/int_helper.c | 2 +-
target/s390x/{ => tcg}/mem_helper.c | 2 +-
target/s390x/tcg/meson.build | 14 ++++++++++++++
target/s390x/{ => tcg}/misc_helper.c | 2 +-
target/s390x/{ => tcg}/s390-tod.h | 0
target/s390x/{ => tcg}/tcg_s390x.h | 0
target/s390x/{ => tcg}/translate.c | 2 +-
target/s390x/{ => tcg}/translate_vx.c.inc | 0
target/s390x/{ => tcg}/vec.h | 0
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 +-
36 files changed, 50 insertions(+), 42 deletions(-)
rename target/s390x/{internal.h => s390x-internal.h} (98%)
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}/insn-data.def (100%)
rename target/s390x/{ => tcg}/insn-format.def (100%)
rename target/s390x/{ => tcg}/int_helper.c (99%)
rename target/s390x/{ => tcg}/mem_helper.c (99%)
create mode 100644 target/s390x/tcg/meson.build
rename target/s390x/{ => tcg}/misc_helper.c (99%)
rename target/s390x/{ => tcg}/s390-tod.h (100%)
rename target/s390x/{ => tcg}/tcg_s390x.h (100%)
rename target/s390x/{ => tcg}/translate.c (99%)
rename target/s390x/{ => tcg}/translate_vx.c.inc (100%)
rename target/s390x/{ => tcg}/vec.h (100%)
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%)MAINTAINERS +1 -0
@@ -296,6 +296,7 @@ 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/
hw/s390x/tod-tcg.c +1 -1
@@ -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)
include/hw/s390x/tod.h +1 -1
@@ -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/arch_dump.c +1 -1
@@ -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
@@ -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
@@ -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
@@ -14,7 +14,7 @@#include "qemu/osdep.h" #include "cpu.h" -#include "internal.h" +#include "s390x-internal.h" #include "hw/watchdog/wdt_diag288.h" #include "sysemu/cpus.h" #include "hw/s390x/ipl.h"
target/s390x/gdbstub.c +1 -1
@@ -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
@@ -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
@@ -10,12 +10,12 @@#include "qemu/osdep.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
@@ -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
@@ -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
@@ -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/meson.build +2 -15
@@ -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/mmu_helper.c +1 -1
@@ -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/s390x-internal.h renamed from target/s390x/internal.h +6 -0
@@ -240,6 +240,12 @@ uint32_t calc_cc(CPUS390XState *env, uint32_t cc_op, uint64_t src, uint64_t dst,#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/sigp.c +1 -1
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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/insn-data.def renamed from target/s390x/insn-data.def +0 -0
target/s390x/tcg/insn-format.def renamed from target/s390x/insn-format.def +0 -0
target/s390x/tcg/int_helper.c renamed from target/s390x/int_helper.c +1 -1
@@ -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
@@ -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/meson.build new file +14 -0
@@ -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', +))
target/s390x/tcg/misc_helper.c renamed from target/s390x/misc_helper.c +1 -1
@@ -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/s390-tod.h renamed from target/s390x/s390-tod.h +0 -0
target/s390x/tcg/tcg_s390x.h renamed from target/s390x/tcg_s390x.h +0 -0
target/s390x/tcg/translate.c renamed from target/s390x/translate.c +1 -1
@@ -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/translate_vx.c.inc renamed from target/s390x/translate_vx.c.inc +0 -0
target/s390x/tcg/vec.h renamed from target/s390x/vec.h +0 -0
target/s390x/tcg/vec_fpu_helper.c renamed from target/s390x/vec_fpu_helper.c +1 -1
@@ -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
@@ -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
target/s390x/tcg/vec_string_helper.c renamed from target/s390x/vec_string_helper.c +1 -1
@@ -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"
Signature · 1 line
2.32.0
Re: [RFC v6 06/13] target/s390x: start moving TCG-only code to tcg/
Quoted 6 lines · Yu-Chen
move everything related to translate, as well as HELPER code in tcg/
mmu_helper.cstays put for now, as it contains both TCG and KVM code.The
internal.hfile is renamed tos390x-internal.h, because of the risk of collision with other files with the same name.
IMHO the renaming from internal.h to s390x-internal.h should be done in a separate patch, since it's not directly related to the movement of the other files.
[...]
Quoted 8 lines
target/s390x/s390x-internal.h renamed from target/s390x/internal.h +0
-0
target/s390x/s390x-internal.h uint32_t calc_cc(CPUS390XState *env, uint32_t cc_op, uint64_t src, uint64_t dst, · line 247
Quoted 8 lines
target/s390x/s390x-internal.h renamed from target/s390x/internal.h +5
-0@@ -240,6 +240,12 @@ uint32_t calc_cc(CPUS390XState *env, uint32_t cc_op, uint64_t src, uint64_t dst,#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);
This hunk rather belongs into the next patch instead.
Thomas
Re: [RFC v6 06/13] target/s390x: start moving TCG-only code to tcg/
Quoted 5 lines · Thomas Huth
Quoted 4 lines · Yu-Chen
move everything related to translate, as well as HELPER code in tcg/
mmu_helper.cstays put for now, as it contains both TCG and KVM code.
Quoted 9 lines
Quoted 2 lines
The
internal.hfile is renamed tos390x-internal.h, because of the risk of collision with other files with the same name.IMHO the renaming from
internal.htos390x-internal.hshould be done in a
separate patch, since it's not directly related to the movement of the other
files.
Indeed, this patch should not include this. The renaming from internal.h to s390x-internal.h would be done in a separate patch.
Quoted 13 lines
[...]
Quoted 12 lines
target/s390x/s390x- renamed from target/s390x/internal.h +0
-0
internal.h
similarity index 98%
rename fromtarget/s390x/internal.h
rename totarget/s390x/s390x-internal.h
index 9256275376..17edd4d13b 100644target/s390x/s390x-internal.h renamed from target/s390x/internal.h +0
-0@@ -240,6 +240,12 @@ uint32_t calc_cc(CPUS390XState *env, uint32_t cc_op, uint64_t src, uint64_t dst, #ifndef CONFIG_USER_ONLY unsigned int s390_cpu_halt(S390CPU *cpu);
Quoted 9 lines
target/s390x/s390x-internal.h uint32_t calc_cc(CPUS390XState *env, uint32_t cc_op, uint64_t src, uint64_t dst, · line 247
Quoted 6 lines
target/s390x/s390x-internal.h renamed from target/s390x/internal.h +5
-0void 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);This hunk rather belongs into the next patch instead.
True, this part in 07 would be better, I will move this to 07.
Thanks, AL
RFC v6 7/13 target/s390x: move sysemu-only code out to cpu-sysemu.c
In reply to Cho, Yu-Chenmove sysemu-only code out to cpu-sysemu.c
--- target/s390x/cpu-sysemu.c | 309 ++++++++++++++++++++++++++++++++++++++ target/s390x/cpu.c | 285 ++--------------------------------- target/s390x/meson.build | 1 + target/s390x/trace-events | 2 +- 4 files changed, 320 insertions(+), 277 deletions(-) create mode 100644 target/s390x/cpu-sysemu.c
target/s390x/cpu-sysemu.c new file +309 -0
@@ -0,0 +1,309 @@ +/* +* QEMU S/390 CPU - System Emulation-only code +* +* Copyright (c) 2009 Ulrich Hecht +* Copyright (c) 2011 Alexander Graf +* Copyright (c) 2012 SUSE LINUX Products GmbH +* Copyright (c) 2012 IBM Corp. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program 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 +* General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "cpu.h" +#include "s390x-internal.h" +#include "kvm_s390x.h" +#include "sysemu/kvm.h" +#include "sysemu/reset.h" +#include "qemu/timer.h" +#include "trace.h" +#include "qapi/qapi-visit-run-state.h" +#include "sysemu/hw_accel.h" + +#include "hw/s390x/pv.h" +#include "hw/boards.h" +#include "sysemu/arch_init.h" +#include "sysemu/sysemu.h" +#include "sysemu/tcg.h" +#include "hw/core/sysemu-cpu-ops.h" + +/* S390CPUClass::load_normal() */ +static void s390_cpu_load_normal (CPUState *s) +{ +S390CPU *cpu =S390_CPU (s); +uint64_t spsw; + +if (!s390_is_pv ()) { + spsw =ldq_phys (s->as,0 ); + cpu->env.psw.mask = spsw &PSW_MASK_SHORT_CTRL ; +/* +* Invert short psw indication, so SIE will report a specification +* exception if it was not set. +*/ + cpu->env.psw.mask ^=PSW_MASK_SHORTPSW ; + cpu->env.psw.addr = spsw &PSW_MASK_SHORT_ADDR ; + }else { +/* +* Firmware requires us to set the load state before we set +* the cpu to operating on protected guests. +*/ +s390_cpu_set_state (S390_CPU_STATE_LOAD , cpu); + } +s390_cpu_set_state (S390_CPU_STATE_OPERATING , cpu); +} + +void s390_cpu_machine_reset_cb (void *opaque) +{ +S390CPU *cpu = opaque; + +run_on_cpu (CPU (cpu), s390_do_cpu_full_reset,RUN_ON_CPU_NULL ); +} + +static GuestPanicInformation *s390_cpu_get_crash_info (CPUState *cs) +{ +GuestPanicInformation *panic_info; +S390CPU *cpu =S390_CPU (cs); + +cpu_synchronize_state (cs); + panic_info =g_malloc0 (sizeof (GuestPanicInformation)); + + panic_info->type =GUEST_PANIC_INFORMATION_TYPE_S390 ; + panic_info->u.s390.core = cpu->env.core_id; + panic_info->u.s390.psw_mask = cpu->env.psw.mask; + panic_info->u.s390.psw_addr = cpu->env.psw.addr; + panic_info->u.s390.reason = cpu->env.crash_reason; + +return panic_info; +} + +static void s390_cpu_get_crash_info_qom (Object *obj,Visitor *v, +const char *name,void *opaque, +Error **errp) +{ +CPUState *cs =CPU (obj); +GuestPanicInformation *panic_info; + +if (!cs->crash_occurred) { +error_setg (errp,"No crash occurred" ); +return ; + } + + panic_info =s390_cpu_get_crash_info (cs); + +visit_type_GuestPanicInformation (v,"crash-information" , &panic_info, + errp); +qapi_free_GuestPanicInformation (panic_info); +} + +void s390_cpu_init_sysemu (Object *obj) +{ +CPUState *cs =CPU (obj); +S390CPU *cpu =S390_CPU (obj); + + cs->start_powered_off = true; +object_property_add (obj,"crash-information" ,"GuestPanicInformation" , + s390_cpu_get_crash_info_qom,NULL ,NULL ,NULL ); + cpu->env.tod_timer = +timer_new_ns (QEMU_CLOCK_VIRTUAL , s390x_tod_timer, cpu); + cpu->env.cpu_timer = +timer_new_ns (QEMU_CLOCK_VIRTUAL , s390x_cpu_timer, cpu); +s390_cpu_set_state (S390_CPU_STATE_STOPPED , cpu); +} + +bool s390_cpu_realize_sysemu (DeviceState *dev,Error **errp) +{ +S390CPU *cpu =S390_CPU (dev); +MachineState *ms =MACHINE (qdev_get_machine ()); +unsigned int max_cpus = ms->smp.max_cpus; + +if (cpu->env.core_id >= max_cpus) { +error_setg (errp,"Unable to add CPU with core-id: %" PRIu32 +", maximum core-id: %d" , cpu->env.core_id, + max_cpus -1 ); +return false; + } + +if (cpu_exists (cpu->env.core_id)) { +error_setg (errp,"Unable to add CPU with core-id: %" PRIu32 +", it already exists" , cpu->env.core_id); +return false; + } + +/* sync cs->cpu_index and env->core_id. The latter is needed for TCG. */ +CPU (cpu)->cpu_index = cpu->env.core_id; +return true; +} + +void s390_cpu_finalize (Object *obj) +{ +S390CPU *cpu =S390_CPU (obj); + +timer_free (cpu->env.tod_timer); +timer_free (cpu->env.cpu_timer); + +qemu_unregister_reset (s390_cpu_machine_reset_cb, cpu); +g_free (cpu->irqstate); +} + +static const struct SysemuCPUOps s390_sysemu_ops = { + .get_phys_page_debug = s390_cpu_get_phys_page_debug, + .get_crash_info = s390_cpu_get_crash_info, + .write_elf64_note = s390_cpu_write_elf64_note, + .legacy_vmsd = &vmstate_s390_cpu, +}; + +void s390_cpu_class_init_sysemu (CPUClass *cc) +{ +S390CPUClass *scc =S390_CPU_CLASS (cc); + + scc->load_normal = s390_cpu_load_normal; + cc->sysemu_ops = &s390_sysemu_ops; +} + +static bool disabled_wait (CPUState *cpu) +{ +return cpu->halted && !(S390_CPU (cpu)->env.psw.mask & + (PSW_MASK_IO |PSW_MASK_EXT |PSW_MASK_MCHECK )); +} + +static unsigned s390_count_running_cpus (void ) +{ +CPUState *cpu; +int nr_running =0 ; + +CPU_FOREACH (cpu) { +uint8_t state =S390_CPU (cpu)->env.cpu_state; +if (state ==S390_CPU_STATE_OPERATING || + state ==S390_CPU_STATE_LOAD ) { +if (!disabled_wait (cpu)) { + nr_running++; + } + } + } + +return nr_running; +} + +unsigned int s390_cpu_halt (S390CPU *cpu) +{ +CPUState *cs =CPU (cpu); +trace_cpu_halt (cs->cpu_index); + +if (!cs->halted) { + cs->halted =1 ; + cs->exception_index =EXCP_HLT ; + } + +return s390_count_running_cpus (); +} + +void s390_cpu_unhalt (S390CPU *cpu) +{ +CPUState *cs =CPU (cpu); +trace_cpu_unhalt (cs->cpu_index); + +if (cs->halted) { + cs->halted =0 ; + cs->exception_index =-1 ; + } +} + +unsigned int s390_cpu_set_state (uint8_t cpu_state,S390CPU *cpu) + { +trace_cpu_set_state (CPU (cpu)->cpu_index, cpu_state); + +switch (cpu_state) { +case S390_CPU_STATE_STOPPED : +case S390_CPU_STATE_CHECK_STOP : +/* halt the cpu for common infrastructure */ +s390_cpu_halt (cpu); +break ; +case S390_CPU_STATE_OPERATING : +case S390_CPU_STATE_LOAD : +/* +* Starting a CPU with a PSW WAIT bit set: +* KVM: handles this internally and triggers another WAIT exit. +* TCG: will actually try to continue to run. Don't unhalt, will +* be done when the CPU actually has work (an interrupt). +*/ +if (!tcg_enabled () || !(cpu->env.psw.mask &PSW_MASK_WAIT )) { +s390_cpu_unhalt (cpu); + } +break ; +default : +error_report ("Requested CPU state is not a valid S390 CPU state: %u" , + cpu_state); +exit (1 ); + } +if (kvm_enabled () && cpu->env.cpu_state != cpu_state) { +kvm_s390_set_cpu_state (cpu, cpu_state); + } + cpu->env.cpu_state = cpu_state; + +return s390_count_running_cpus (); +} + +int s390_set_memory_limit (uint64_t new_limit,uint64_t *hw_limit) +{ +if (kvm_enabled ()) { +return kvm_s390_set_mem_limit (new_limit, hw_limit); + } +return 0 ; +} + +void s390_set_max_pagesize (uint64_t pagesize,Error **errp) +{ +if (kvm_enabled ()) { +kvm_s390_set_max_pagesize (pagesize, errp); + } +} + +void s390_cmma_reset (void ) +{ +if (kvm_enabled ()) { +kvm_s390_cmma_reset (); + } +} + +int s390_assign_subch_ioeventfd (EventNotifier *notifier,uint32_t sch_id, +int vq,bool assign) +{ +if (kvm_enabled ()) { +return kvm_s390_assign_subch_ioeventfd (notifier, sch_id, vq, assign); + }else { +return 0 ; + } +} + +void s390_crypto_reset (void ) +{ +if (kvm_enabled ()) { +kvm_s390_crypto_reset (); + } +} + +void s390_enable_css_support (S390CPU *cpu) +{ +if (kvm_enabled ()) { +kvm_s390_enable_css_support (cpu); + } +} + +void s390_do_cpu_set_diag318 (CPUState *cs,run_on_cpu_data arg) +{ +if (kvm_enabled ()) { +kvm_s390_set_diag318 (cs, arg.host_ulong); + } +}
target/s390x/cpu.c +9 -276
370 lines not on this page · raw message
target/s390x/meson.build +1 -0
@@ -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
@@ -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.32.0
Re: [RFC v6 07/13] target/s390x: move sysemu-only code out to cpu-sysemu.c
Quoted 11 lines · Yu-Chen
move sysemu-only code out to
cpu-sysemu.cSigned-off-by Claudio Fontana <[email protected]>Signed-off-by Cho, Yu-Chen <[email protected]>--- target/s390x/cpu-sysemu.c | 309 ++++++++++++++++++++++++++++++++++++++ target/s390x/cpu.c | 285 ++--------------------------------- target/s390x/meson.build | 1 + target/s390x/trace-events | 2 +- 4 files changed, 320 insertions(+), 277 deletions(-) create mode 100644 target/s390x/cpu-sysemu.c
Re: [RFC v6 07/13] target/s390x: move sysemu-only code out to cpu-sysemu.c
In reply to Cho, Yu-ChenQuoted 11 lines · Yu-Chen
move sysemu-only code out to
cpu-sysemu.cSigned-off-by Claudio Fontana <[email protected]>Signed-off-by Cho, Yu-Chen <[email protected]>--- target/s390x/cpu-sysemu.c | 309 ++++++++++++++++++++++++++++++++++++++ target/s390x/cpu.c | 285 ++--------------------------------- target/s390x/meson.build | 1 + target/s390x/trace-events | 2 +- 4 files changed, 320 insertions(+), 277 deletions(-)create mode 100644
target/s390x/cpu-sysemu.c
RFC v6 8/13 target/s390x: split cpu-dump from helper.c
In reply to Cho, Yu-ChenSplitting this functionality also allows us to make helper.c sysemu-only.
--- target/s390x/cpu-dump.c | 176 +++++++++++++++++++++++++++++++++++++++ target/s390x/helper.c | 151 --------------------------------- target/s390x/meson.build | 1 + 3 files changed, 177 insertions(+), 151 deletions(-) create mode 100644 target/s390x/cpu-dump.c
target/s390x/cpu-dump.c new file +176 -0
@@ -0,0 +1,176 @@ +/* +* 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" +#include "sysemu/tcg.h" + +void s390_cpu_set_psw (CPUS390XState *env,uint64_t mask,uint64_t addr) +{ +#ifndef CONFIG_USER_ONLY +uint64_t old_mask = env->psw.mask; +#endif + + env->psw.addr = addr; + env->psw.mask = mask; + +/* KVM will handle all WAITs and trigger a WAIT exit on disabled_wait */ +if (!tcg_enabled ()) { +return ; + } + env->cc_op = (mask >>44 ) &3 ; + +#ifndef CONFIG_USER_ONLY +if ((old_mask ^ mask) &PSW_MASK_PER ) { +s390_cpu_recompute_watchpoints (env_cpu (env)); + } + +if (mask &PSW_MASK_WAIT ) { +s390_handle_wait (env_archcpu (env)); + } +#endif +} + +uint64_t s390_cpu_get_psw_mask (CPUS390XState *env) +{ +uint64_t r = env->psw.mask; + +if (tcg_enabled ()) { +uint64_t cc =calc_cc (env, env->cc_op, env->cc_src, + env->cc_dst, env->cc_vr); + +assert (cc <=3 ); + r &= ~PSW_MASK_CC ; + r |= cc <<44 ; + } + +return r; +} + +void s390_cpu_dump_state (CPUState *cs,FILE *f,int flags) +{ +S390CPU *cpu =S390_CPU (cs); +CPUS390XState *env = &cpu->env; +int i; + +qemu_fprintf (f,"PSW=mask %016" PRIx64" addr %016" PRIx64, +s390_cpu_get_psw_mask (env), env->psw.addr); +if (!tcg_enabled ()) { +qemu_fprintf (f,"\n" ); + }else if (env->cc_op >3 ) { +qemu_fprintf (f," cc %15s\n" ,cc_name (env->cc_op)); + }else { +qemu_fprintf (f," cc %02x\n" , 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 -151
160 lines not on this page · raw message
target/s390x/meson.build +1 -0
@@ -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.32.0
Re: [RFC v6 08/13] target/s390x: split cpu-dump from helper.c
Quoted 7 lines · Yu-Chen
Splitting this functionality also allows us to make
helper.csysemu-only.Signed-off-by Claudio Fontana <[email protected]>Signed-off-by Cho, Yu-Chen <[email protected]>Acked-by Cornelia Huck <[email protected]>--- target/s390x/cpu-dump.c | 176 +++++++++++++++++++++++++++++++++++++++
Apart from the dump() function, the other functions here are are used in other contexts, too, so maybe the name is not very appropriate here... What about naming it "cpu-state.c" instead? Or include the functions in cpu.c directly?
Thomas
Re: [RFC v6 08/13] target/s390x: split cpu-dump from helper.c
Quoted 11 lines · Thomas Huth
Quoted 9 lines · Yu-Chen
Splitting this functionality also allows us to make
helper.csysemu- only.Signed-off-by Claudio Fontana <[email protected]>Signed-off-by Cho, Yu-Chen <[email protected]>Acked-by Cornelia Huck <[email protected]>---
target/s390x/cpu-dump.c | 176
+++++++++++++++++++++++++++++++++++++++
Quoted 8 lines
Apart from the
dump()function, the other functions here are are used in
other contexts, too, so maybe the name is not very appropriate here... What
about naming it "cpu-state.c" instead? Or include the functions incpu.c
directly?
ok, I think naming it "cpu-state.c" would make more sense.
Thanks,
AL
Re: [RFC v6 08/13] target/s390x: split cpu-dump from helper.c
Quoted 21 lines · Al Cho
Quoted 11 lines · Thomas Huth
Quoted 9 lines · Yu-Chen
Splitting this functionality also allows us to make
helper.csysemu- only.Signed-off-by Claudio Fontana <[email protected]>Signed-off-by Cho, Yu-Chen <[email protected]>Acked-by Cornelia Huck <[email protected]>---
target/s390x/cpu-dump.c | 176
+++++++++++++++++++++++++++++++++++++++Quoted 8 lines
Apart from the
dump()function, the other functions here are are used in
other contexts, too, so maybe the name is not very appropriate here... What
about naming it "cpu-state.c" instead? Or include the functions incpu.c
directly?
Quoted 5 lines
ok, I think naming it "
cpu-state.c" would make more sense.Thanks,
AL
For context, cpu-dump.c mimics how this is done on x86,
so rather than coming up with creative new names for each architecture,
I'd rather either put the code into cpu.c, or just keep the existing "cpu-dump.c" as in the initially proposed patch, which looks like the best option to me.
Thanks
Claudio
Re: [RFC v6 08/13] target/s390x: split cpu-dump from helper.c
Quoted 28 lines · Claudio Fontana
Quoted 27 lines · Al Cho
Quoted 12 lines · Thomas Huth
Quoted 10 lines · Yu-Chen
Splitting this functionality also allows us to make
helper.csysemu-
only.Signed-off-by Claudio Fontana <[email protected]>Signed-off-by Cho, Yu-Chen <[email protected]>Acked-by Cornelia Huck <[email protected]>---
target/s390x/cpu-dump.c | 176
+++++++++++++++++++++++++++++++++++++++Quoted 11 lines
Apart from the
dump()function, the other functions here are are used
in
other contexts, too, so maybe the name is not very appropriate here...
What
about naming it "cpu-state.c" instead? Or include the functions incpu.c
directly?ok, I think naming it "
cpu-state.c" would make more sense.
Quoted 8 lines
Quoted 3 lines
Thanks,
ALFor context,
cpu-dump.cmimics how this is done on x86,so rather than coming up with creative new names for each architecture,
I think Claudio is right, I didn't recognize it before. sorry.
Quoted 4 lines
I'd rather either put the code into
cpu.c, or just keep the existing "cpu-dump.c" as in the initially proposed patch, which looks like the best option to me.
For me just keep the existing "cpu-dump.c" as in the initially proposed patch would be the better one option.
But it's also good to me if we keep the dump() function in cpu-dump.c and put other functions into cpu.c.
Cheers,
AL
Re: [RFC v6 08/13] target/s390x: split cpu-dump from helper.c
Quoted 45 lines · Al Cho
Quoted 28 lines · Claudio Fontana
Quoted 27 lines · Al Cho
Quoted 12 lines · Thomas Huth
Quoted 10 lines · Yu-Chen
Splitting this functionality also allows us to make
helper.csysemu-
only.Signed-off-by Claudio Fontana <[email protected]>Signed-off-by Cho, Yu-Chen <[email protected]>Acked-by Cornelia Huck <[email protected]>--- target/s390x/cpu-dump.c | 176+++++++++++++++++++++++++++++++++++++++
Quoted 11 lines
Apart from the
dump()function, the other functions here are are used
in
other contexts, too, so maybe the name is not very appropriate here...
What
about naming it "cpu-state.c" instead? Or include the functions incpu.c
directly?ok, I think naming it "
cpu-state.c" would make more sense.Quoted 8 lines
Quoted 3 lines
Thanks,
ALFor context,
cpu-dump.cmimics how this is done on x86,so rather than coming up with creative new names for each architecture,
I think Claudio is right, I didn't recognize it before. sorry.
Quoted 4 lines
I'd rather either put the code into
cpu.c, or just keep the existing "cpu-dump.c" as in the initially proposed patch, which looks like the best option to me.
Quoted 4 lines
For me just keep the existing "
cpu-dump.c" as in the initially proposed patch would be the better one option.
But it's also good to me if we keep thedump()function incpu-dump.cand put other functions intocpu.c.
FWIW, if you don't like cpu-state.c, I'd vote for putting the dump() function into cpu-dump.c and put the other functions into cpu.c instead.
Thomas
Re: [RFC v6 08/13] target/s390x: split cpu-dump from helper.c
Quoted 51 lines · Thomas Huth
Quoted 45 lines · Al Cho
Quoted 28 lines · Claudio Fontana
Quoted 27 lines · Al Cho
Quoted 12 lines · Thomas Huth
Quoted 10 lines · Yu-Chen
Splitting this functionality also allows us to make
helper.csysemu-
only.Signed-off-by Claudio Fontana <[email protected]>Signed-off-by Cho, Yu-Chen <[email protected]>Acked-by Cornelia Huck <[email protected]>--- target/s390x/cpu-dump.c | 176+++++++++++++++++++++++++++++++++++++++
Quoted 11 lines
Apart from the
dump()function, the other functions here are are used
in
other contexts, too, so maybe the name is not very appropriate here...
What
about naming it "cpu-state.c" instead? Or include the functions incpu.c
directly?ok, I think naming it "
cpu-state.c" would make more sense.Quoted 8 lines
Quoted 3 lines
Thanks,
ALFor context,
cpu-dump.cmimics how this is done on x86,so rather than coming up with creative new names for each architecture,
I think Claudio is right, I didn't recognize it before. sorry.
Quoted 4 lines
I'd rather either put the code into
cpu.c, or just keep the existing "cpu-dump.c" as in the initially proposed patch, which looks like the best option to me.Quoted 4 lines
For me just keep the existing "
cpu-dump.c" as in the initially proposed patch would be the better one option.
But it's also good to me if we keep thedump()function incpu-dump.cand put other functions intocpu.c.
Quoted 5 lines
FWIW, if you don't like
cpu-state.c, I'd vote for putting thedump()function intocpu-dump.cand put the other functions intocpu.cinstead.Thomas
Ah I see the issue now, the patch currently includes functions in cpu-dump.c that are not really cpu dump functions, and should go back into cpu.c .
Agreed, this seems to be the next step.
Thanks,
Claudio
RFC v6 9/13 target/s390x: make helper.c sysemu-only
In reply to Cho, Yu-ChenNow that we have moved cpu-dump functionality out of helper.c, we can make the module sysemu-only.
--- target/s390x/helper.c | 9 +-------- target/s390x/meson.build | 2 +- 2 files changed, 2 insertions(+), 9 deletions(-)
target/s390x/helper.c +1 -8
@@ -1,5 +1,5 @@/* -* S/390 helpers +* S/390 helpers - systemu only * * Copyright (c) 2009 Ulrich Hecht * Copyright (c) 2011 Alexander Graf
@@ -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);
@@ -284,7 +281,3 @@ int s390_store_adtl_status(S390CPU *cpu, hwaddr addr, hwaddr len)cpu_physical_memory_unmap (sa, len,1 , len);return 0 ; } -#else -/* For user-only, tcg is always enabled. */ -#define tcg_enabled () true -#endif /* CONFIG_USER_ONLY */
target/s390x/meson.build +1 -1
@@ -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.32.0
Re: [RFC v6 09/13] target/s390x: make helper.c sysemu-only
Quoted 16 lines · Yu-Chen
Now that we have moved cpu-dump functionality out of
helper.c, we can make the module sysemu-only.Signed-off-by Claudio Fontana <[email protected]>Signed-off-by Cho, Yu-Chen <[email protected]>Acked-by Cornelia Huck <[email protected]>--- target/s390x/helper.c | 9 +-------- target/s390x/meson.build | 2 +- 2 files changed, 2 insertions(+), 9 deletions(-)target/s390x/helper.c +0
-0
target/s390x/helper.c line 2
Quoted 3 lines
target/s390x/helper.c +1
-1@@ -1,5 +1,5 @@/* -* S/390 helpers +* S/390 helpers - systemu only
s/systemu/sysemu/
With that typo fixed:
Re: [RFC v6 09/13] target/s390x: make helper.c sysemu-only
Quoted 23 lines · Thomas Huth
Quoted 16 lines · Yu-Chen
Now that we have moved cpu-dump functionality out of
helper.c, we can make the module sysemu-only.Signed-off-by Claudio Fontana <[email protected]>Signed-off-by Cho, Yu-Chen <[email protected]>Acked-by Cornelia Huck <[email protected]>---
target/s390x/helper.c | 9 +--------
target/s390x/meson.build | 2 +-2 files changed, 2 insertions(+), 9 deletions(-)target/s390x/helper.c +0
-0target/s390x/helper.c line 2
Quoted 3 lines
target/s390x/helper.c +1
-1@@ -1,5 +1,5 @@ /* -* S/390 helpers +* S/390 helpers - systemu only s/systemu/sysemu/
Quoted 3 lines
With that typo fixed:
Reviewed-by Thomas Huth <[email protected]>
That's a stupid mistake, it should be fixed this version. Will fix it.
Thanks,
AL
RFC v6 10/13 target/s390x: use kvm_enabled() to wrap call to kvm_s390_get_hpage_1m
In reply to Cho, Yu-Chenthis 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
@@ -20,6 +20,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)
@@ -168,7 +169,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.32.0
Re: [RFC v6 10/13] target/s390x: use kvm_enabled() to wrap call to kvm_s390_get_hpage_1m
Quoted 21 lines · Yu-Chen
this will allow to remove the kvm stubs.
Signed-off-by Claudio Fontana <[email protected]>Signed-off-by Cho, Yu-Chen <[email protected]>--- target/s390x/diag.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)target/s390x/diag.c +1
-0@@ -20,6 +20,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)
target/s390x/diag.c out: · line 172
Quoted 5 lines
target/s390x/diag.c +1
-1@@ -168,7 +169,7 @@ out:return ; } -if (kvm_s390_get_hpage_1m ()) { +if (kvm_enabled () &&kvm_s390_get_hpage_1m ()) {
I think I asked before whether we should introduce a s390_huge_page_backing() wrapper (which might be overkill)... any opinions on that? I'm not really opposed to this patch here, either.
Quoted 3 lines
target/s390x/diag.c +0
-0error_report ("Protected VMs can currently not be backed with " "huge pages" ); env->regs[r1 +1 ] =DIAG_308_RC_INVAL_FOR_PV ;
Re: [RFC v6 10/13] target/s390x: use kvm_enabled() to wrap call to kvm_s390_get_hpage_1m
Hi Cornelia,
Sorry for missing the reply.
I think it may not be worth it, as you said it seem to be the only call site for kvm_s390_get_hpage_1m(). So I think we could keep it.
Thanks,
AL
________________________________
From: Cornelia Huck <[email protected]>
Sent: Wednesday, June 30, 2021 11:21 PM
To: Al Cho <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]>
Cc: Claudio Fontana <[email protected]>; Al Cho <[email protected]>; José Ricardo Ziviani <[email protected]>; Claudio Fontana <[email protected]>
Subject: Re: [RFC v6 10/13] target/s390x: use kvm_enabled() to wrap call to kvm_s390_get_hpage_1m
Quoted 21 lines · Yu-Chen
this will allow to remove the kvm stubs.
Signed-off-by Claudio Fontana <[email protected]>Signed-off-by Cho, Yu-Chen <[email protected]>--- target/s390x/diag.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)target/s390x/diag.c +1
-0@@ -20,6 +20,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)
target/s390x/diag.c out: · line 172
Quoted 5 lines
target/s390x/diag.c +1
-1@@ -168,7 +169,7 @@ out:return ; } -if (kvm_s390_get_hpage_1m ()) { +if (kvm_enabled () &&kvm_s390_get_hpage_1m ()) {
I think I asked before whether we should introduce a s390_huge_page_backing() wrapper (which might be overkill)... any opinions on that? I'm not really opposed to this patch here, either.
Quoted 3 lines
target/s390x/diag.c +0
-0error_report ("Protected VMs can currently not be backed with " "huge pages" ); env->regs[r1 +1 ] =DIAG_308_RC_INVAL_FOR_PV ;
Re: [RFC v6 10/13] target/s390x: use kvm_enabled() to wrap call to kvm_s390_get_hpage_1m
In reply to Cho, Yu-ChenQuoted 21 lines · Yu-Chen
this will allow to remove the kvm stubs.
Signed-off-by Claudio Fontana <[email protected]>Signed-off-by Cho, Yu-Chen <[email protected]>--- target/s390x/diag.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)target/s390x/diag.c +1
-0@@ -20,6 +20,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)
target/s390x/diag.c out: · line 175
Quoted 8 lines
target/s390x/diag.c +1
-1@@ -168,7 +169,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 ;
RFC v6 11/13 target/s390x: remove kvm-stub.c
In reply to Cho, Yu-Chenall function calls are protected by kvm_enabled(), so we do not need the stubs.
--- MAINTAINERS | 1 - target/s390x/kvm-stub.c | 121 --------------------------------------- target/s390x/meson.build | 2 +- 3 files changed, 1 insertion(+), 123 deletions(-) delete mode 100644 target/s390x/kvm-stub.c
MAINTAINERS +0 -1
@@ -395,7 +395,6 @@ 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/ioinst.[ch] F: target/s390x/machine.c F: target/s390x/sigp.c
target/s390x/kvm-stub.c deleted +0 -121
121 lines not on this page · raw message
target/s390x/meson.build +1 -1
@@ -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.32.0
Re: [RFC v6 11/13] target/s390x: remove kvm-stub.c
Quoted 11 lines · Yu-Chen
all function calls are protected by
kvm_enabled(), so we do not need the stubs.Signed-off-by Claudio Fontana <[email protected]>Signed-off-by Cho, Yu-Chen <[email protected]>--- MAINTAINERS | 1 - target/s390x/kvm-stub.c | 121 --------------------------------------- target/s390x/meson.build | 2 +- 3 files changed, 1 insertion(+), 123 deletions(-) delete mode 100644 target/s390x/kvm-stub.c
Re: [RFC v6 11/13] target/s390x: remove kvm-stub.c
In reply to Cho, Yu-ChenQuoted 11 lines · Yu-Chen
all function calls are protected by
kvm_enabled(), so we do not need the stubs.Signed-off-by Claudio Fontana <[email protected]>Signed-off-by Cho, Yu-Chen <[email protected]>--- MAINTAINERS | 1 - target/s390x/kvm-stub.c | 121 --------------------------------------- target/s390x/meson.build | 2 +- 3 files changed, 1 insertion(+), 123 deletions(-)delete mode 100644
target/s390x/kvm-stub.c
RFC v6 12/13 target/s390x: move kvm files into kvm/
In reply to Cho, Yu-Chenmove kvm files into kvm/
After the reshuffling, update MAINTAINERS accordingly. Make use of the new directory:
target/s390x/kvm/
---
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.hMAINTAINERS +1 -2
@@ -393,8 +393,7 @@ 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/ F: target/s390x/ioinst.[ch] F: target/s390x/machine.c F: target/s390x/sigp.c
hw/intc/s390_flic_kvm.c +1 -1
@@ -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"
hw/s390x/s390-stattrib-kvm.c +1 -1
@@ -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 ) {
hw/s390x/tod-kvm.c +1 -1
@@ -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
@@ -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"
meson.build +1 -0
@@ -1886,6 +1886,7 @@ if have_system or have_user 'target/ppc', 'target/riscv', 'target/s390x', + 'target/s390x/kvm', 'target/sparc', ] endif
target/s390x/cpu-sysemu.c +1 -1
@@ -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
@@ -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
@@ -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
@@ -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) {
target/s390x/interrupt.c +1 -1
@@ -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"
target/s390x/kvm/kvm.c renamed from target/s390x/kvm.c +1 -1
@@ -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/kvm/kvm_s390x.h renamed from target/s390x/kvm_s390x.h +0 -0
target/s390x/kvm/meson.build new file +17 -0
@@ -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
@@ -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/kvm/trace.h new file +1 -0
@@ -0,0 +1 @@ +#include "trace/trace-target_s390x_kvm.h"
target/s390x/machine.c +1 -1
@@ -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/meson.build +1 -15
@@ -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/mmu_helper.c +1 -1
@@ -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/trace-events +0 -6
@@ -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.32.0
Re: [RFC v6 12/13] target/s390x: move kvm files into kvm/
Quoted 27 lines · Yu-Chen
move kvm files into kvm/
After the reshuffling, updateMAINTAINERSaccordingly. Make use of the new directory:target/s390x/kvm/
Signed-off-by Claudio Fontana <[email protected]>Signed-off-by Cho, Yu-Chen <[email protected]>--- 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 +---------------
Quoted 8 lines
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.hRe: [RFC v6 12/13] target/s390x: move kvm files into kvm/
In reply to Cho, Yu-ChenQuoted 9 lines · Yu-Chen
move kvm files into kvm/
After the reshuffling, updateMAINTAINERSaccordingly. Make use of the new directory:target/s390x/kvm/
Signed-off-by Claudio Fontana <[email protected]>Signed-off-by Cho, Yu-Chen <[email protected]>---
[...]
meson.build if have_system or have_user · line 1889
Quoted 9 lines
meson.build +1
-0@@ -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?
Quoted 3 lines
meson.build +0
-0'target/sparc', ] endif
[...]
target/s390x/kvm/kvm.c line 30
Quoted 13 lines
target/s390x/kvm/kvm.c renamed from target/s390x/kvm.c +1
-1@@ -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
Re: [RFC v6 12/13] target/s390x: move kvm files into kvm/
Quoted 26 lines · Thomas Huth
Quoted 9 lines · Yu-Chen
move kvm files into kvm/
After the reshuffling, updateMAINTAINERSaccordingly. Make use of the new directory:target/s390x/kvm/
Signed-off-by Claudio Fontana <[email protected]>Signed-off-by Cho, Yu-Chen <[email protected]>---
[...]
meson.build if have_system or have_user · line 1889
Quoted 9 lines
meson.build +1
-0@@ -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_systemorhave_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.
Quoted 3 lines
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.
Quoted 4 lines
Quoted 3 lines
meson.build +0
-0'target/sparc',]
endif[...]
Quoted 17 lines
target/s390x/kvm/kvm.c line 30
Quoted 13 lines
target/s390x/kvm/kvm.c renamed from target/s390x/kvm.c +1
-1@@ -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
RFC v6 13/13 target/s390x: split sysemu part of cpu models
In reply to Cho, Yu-Chensplit sysemu part of cpu models,
also create a tiny _user.c with just the (at least for now), empty implementation of apply_cpu_model.
--- MAINTAINERS | 1 + 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 + target/s390x/s390x-internal.h | 2 + 6 files changed, 454 insertions(+), 416 deletions(-) create mode 100644 target/s390x/cpu_models_sysemu.c create mode 100644 target/s390x/cpu_models_user.c
MAINTAINERS +1 -0
@@ -297,6 +297,7 @@ M: David Hildenbrand <[email protected]> S: Maintained F: target/s390x/ F: target/s390x/tcg +F: target/s390x/cpu_models_*.[ch] F: hw/s390x/ F: disas/s390.c F: tests/tcg/s390x/
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
@@ -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
@@ -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')
target/s390x/s390x-internal.h +2 -0
@@ -261,6 +261,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);
Signature · 1 line
2.32.0
Re: [RFC v6 13/13] target/s390x: split sysemu part of cpu models
Quoted 14 lines · Yu-Chen
split sysemu part of cpu models,
also create a tiny_user.cwith just the (at least for now), empty implementation ofapply_cpu_model.Signed-off-by Claudio Fontana <[email protected]>Signed-off-by Cho, Yu-Chen <[email protected]>--- MAINTAINERS | 1 + 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 + target/s390x/s390x-internal.h | 2 + 6 files changed, 454 insertions(+), 416 deletions(-)
Quoted 2 lines
create mode 100644
target/s390x/cpu_models_sysemu.ccreate mode 100644target/s390x/cpu_models_user.c
Straight forward code movement. Looks fine to me!
Quoted 2 lines · Yu-Chen
this is the next version of a cleanup series for s390x.
(...)
Quoted 6 lines
Cho, Yu-Chen (13):
target/s390x: meson: addtarget_user_arch
hw/s390x: renametod-qemu.ctotod-tcg.c
hw/s390x: only build tod-tcg from theCONFIG_TCGbuild hw/s390x: tod: make explicit checks for accelerators when initializing target/s390x: removetcg-stub.c
Quoted 8 lines
target/s390x: start moving TCG-only code to tcg/ target/s390x: move sysemu-only code out to
cpu-sysemu.ctarget/s390x: split cpu-dump fromhelper.c
target/s390x: makehelper.csysemu-only
target/s390x: usekvm_enabled()to wrap call tokvm_s390_get_hpage_1mtarget/s390x: removekvm-stub.c
target/s390x: move kvm files into kvm/
target/s390x: split sysemu part of cpu models
I think this generally looks fine.
However, I'd like to have a second pair of eyes look at this, especially at the cpu models.
Quoted 22 lines · Cornelia Huck
Quoted 2 lines · Yu-Chen
this is the next version of a cleanup series for s390x.
(...)
Quoted 6 lines
Cho, Yu-Chen (13):
target/s390x: meson: addtarget_user_arch
hw/s390x: renametod-qemu.ctotod-tcg.c
hw/s390x: only build tod-tcg from theCONFIG_TCGbuild hw/s390x: tod: make explicit checks for accelerators when initializing target/s390x: removetcg-stub.cQuoted 8 lines
target/s390x: start moving TCG-only code to tcg/ target/s390x: move sysemu-only code out to
cpu-sysemu.ctarget/s390x: split cpu-dump fromhelper.c
target/s390x: makehelper.csysemu-only
target/s390x: usekvm_enabled()to wrap call tokvm_s390_get_hpage_1mtarget/s390x: removekvm-stub.c
target/s390x: move kvm files into kvm/
target/s390x: split sysemu part of cpu models
Quoted 4 lines
I think this generally looks fine.
However, I'd like to have a second pair of eyes look at this, especially at the cpu models.
Just a short note from my side: I'm planning to send a pull request (late) this week, so having a version that is ready to merge before that would be nice :)