[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 09/27] s390x: move s390_cpu_addr2state to target/s390x/sigp.c
From: |
Paolo Bonzini |
Subject: |
[PULL 09/27] s390x: move s390_cpu_addr2state to target/s390x/sigp.c |
Date: |
Sun, 12 May 2024 12:49:27 +0200 |
This function has no dependency on the virtio-ccw machine type, though it
assumes that the CPU address corresponds to the core_id and the index.
If there is any need of something different or more fancy (unlikely)
S390 can include a MachineClass subclass and implement it there. For
now, move it to sigp.c for simplicity.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20240509170044.190795-2-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/s390x/s390-virtio-ccw.c | 16 ----------------
target/s390x/sigp.c | 17 +++++++++++++++++
2 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index 2afaf45ce60..42628fc45d2 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -50,22 +50,6 @@
static Error *pv_mig_blocker;
-S390CPU *s390_cpu_addr2state(uint16_t cpu_addr)
-{
- static MachineState *ms;
-
- if (!ms) {
- ms = MACHINE(qdev_get_machine());
- g_assert(ms->possible_cpus);
- }
-
- /* CPU address corresponds to the core_id and the index */
- if (cpu_addr >= ms->possible_cpus->len) {
- return NULL;
- }
- return S390_CPU(ms->possible_cpus->cpus[cpu_addr].cpu);
-}
-
static S390CPU *s390x_new_cpu(const char *typename, uint32_t core_id,
Error **errp)
{
diff --git a/target/s390x/sigp.c b/target/s390x/sigp.c
index 9dd977349ab..ad0ad61177d 100644
--- a/target/s390x/sigp.c
+++ b/target/s390x/sigp.c
@@ -11,6 +11,7 @@
#include "qemu/osdep.h"
#include "cpu.h"
#include "s390x-internal.h"
+#include "hw/boards.h"
#include "sysemu/hw_accel.h"
#include "sysemu/runstate.h"
#include "exec/address-spaces.h"
@@ -435,6 +436,22 @@ static int sigp_set_architecture(S390CPU *cpu, uint32_t
param,
return SIGP_CC_STATUS_STORED;
}
+S390CPU *s390_cpu_addr2state(uint16_t cpu_addr)
+{
+ static MachineState *ms;
+
+ if (!ms) {
+ ms = MACHINE(qdev_get_machine());
+ g_assert(ms->possible_cpus);
+ }
+
+ /* CPU address corresponds to the core_id and the index */
+ if (cpu_addr >= ms->possible_cpus->len) {
+ return NULL;
+ }
+ return S390_CPU(ms->possible_cpus->cpus[cpu_addr].cpu);
+}
+
int handle_sigp(CPUS390XState *env, uint8_t order, uint64_t r1, uint64_t r3)
{
uint64_t *status_reg = &env->regs[r1];
--
2.45.0
- [PULL 00/27] Build/arch cleanups, target/i386 fixes for 2024-05-10, Paolo Bonzini, 2024/05/12
- [PULL 02/27] target/i386: fix operand size for DATA16 REX.W POPCNT, Paolo Bonzini, 2024/05/12
- [PULL 04/27] target/i386: move prefetch and multi-byte UD/NOP to new decoder, Paolo Bonzini, 2024/05/12
- [PULL 05/27] target/i386: fix feature dependency for WAITPKG, Paolo Bonzini, 2024/05/12
- [PULL 06/27] tests/tcg: cover lzcnt/tzcnt/popcnt, Paolo Bonzini, 2024/05/12
- [PULL 03/27] target/i386: rdpkru/wrpkru are no-prefix instructions, Paolo Bonzini, 2024/05/12
- [PULL 09/27] s390x: move s390_cpu_addr2state to target/s390x/sigp.c,
Paolo Bonzini <=
- [PULL 07/27] configure: quote -D options that are passed through to meson, Paolo Bonzini, 2024/05/12
- [PULL 10/27] s390_flic: add migration-enabled property, Paolo Bonzini, 2024/05/12
- [PULL 11/27] s390: move css_migration_enabled from machine to css.c, Paolo Bonzini, 2024/05/12
- [PULL 12/27] s390x: select correct components for no-board build, Paolo Bonzini, 2024/05/12
- [PULL 14/27] xen: initialize legacy backends from xen_bus_init(), Paolo Bonzini, 2024/05/12
- [PULL 15/27] xen: register legacy backends via xen_backend_init, Paolo Bonzini, 2024/05/12
- [PULL 13/27] tests/qtest: s390x: fix operation in a build without any boards or devices, Paolo Bonzini, 2024/05/12
- [PULL 19/27] hw/i386: move rtc-reset-reinjection command out of hw/rtc, Paolo Bonzini, 2024/05/12
- [PULL 17/27] i386: pc: remove unnecessary MachineClass overrides, Paolo Bonzini, 2024/05/12
- [PULL 18/27] hw/i386: split x86.c in multiple parts, Paolo Bonzini, 2024/05/12