[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/3] s390x: Introduce a SCLPDevice pointer under the machine
From: |
Cédric Le Goater |
Subject: |
[PATCH 1/3] s390x: Introduce a SCLPDevice pointer under the machine |
Date: |
Thu, 2 May 2024 15:15:31 +0200 |
Initialize directly SCLPDevice from the machine init handler and
remove s390_sclp_init(). We will use the SCLPDevice pointer later to
create the consoles.
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
include/hw/s390x/s390-virtio-ccw.h | 3 +++
include/hw/s390x/sclp.h | 2 --
hw/s390x/s390-virtio-ccw.c | 6 +++++-
hw/s390x/sclp.c | 10 ----------
4 files changed, 8 insertions(+), 13 deletions(-)
diff --git a/include/hw/s390x/s390-virtio-ccw.h
b/include/hw/s390x/s390-virtio-ccw.h
index
c1d46e78af8524802225fb192ffd9f6a5bc4434e..7605d06bff18a6075728f3bb462284eaf211b3cb
100644
--- a/include/hw/s390x/s390-virtio-ccw.h
+++ b/include/hw/s390x/s390-virtio-ccw.h
@@ -13,6 +13,7 @@
#include "hw/boards.h"
#include "qom/object.h"
+#include "hw/s390x/sclp.h"
#define TYPE_S390_CCW_MACHINE "s390-ccw-machine"
@@ -28,6 +29,8 @@ struct S390CcwMachineState {
bool dea_key_wrap;
bool pv;
uint8_t loadparm[8];
+
+ SCLPDevice *sclp;
};
#define S390_PTF_REASON_NONE (0x00 << 8)
diff --git a/include/hw/s390x/sclp.h b/include/hw/s390x/sclp.h
index
b405a387b6780ea8f11a062fc02296f633171676..d32f6180e0d3e7ecca09e97ce4b9740360a69692
100644
--- a/include/hw/s390x/sclp.h
+++ b/include/hw/s390x/sclp.h
@@ -221,8 +221,6 @@ static inline int sccb_data_len(SCCB *sccb)
return be16_to_cpu(sccb->h.length) - sizeof(sccb->h);
}
-
-void s390_sclp_init(void);
void sclp_service_interrupt(uint32_t sccb);
void raise_irq_cpu_hotplug(void);
int sclp_service_call(S390CPU *cpu, uint64_t sccb, uint32_t code);
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index
726c2ab4363be30fe6b674d1ee697bb7d2e6352d..159f67d05c1e534800427ce46afcdaa526fd5902
100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -251,11 +251,15 @@ static void s390_create_sclpconsole(const char *type,
Chardev *chardev)
static void ccw_init(MachineState *machine)
{
MachineClass *mc = MACHINE_GET_CLASS(machine);
+ S390CcwMachineState *ms = S390_CCW_MACHINE(machine);
int ret;
VirtualCssBus *css_bus;
DeviceState *dev;
- s390_sclp_init();
+ ms->sclp = SCLP(object_new(TYPE_SCLP));
+ object_property_add_child(OBJECT(machine), TYPE_SCLP, OBJECT(ms->sclp));
+ qdev_realize_and_unref(DEVICE(ms->sclp), NULL, &error_fatal);
+
/* init memory + setup max page size. Required for the CPU model */
s390_memory_init(machine->ram);
diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c
index
893e71a41b2ddd88a007bd7d395895fc4d444540..d236dbaf0bdd15c3fc07749a98a5813e05cfb9a1
100644
--- a/hw/s390x/sclp.c
+++ b/hw/s390x/sclp.c
@@ -378,16 +378,6 @@ void sclp_service_interrupt(uint32_t sccb)
}
/* qemu object creation and initialization functions */
-
-void s390_sclp_init(void)
-{
- Object *new = object_new(TYPE_SCLP);
-
- object_property_add_child(qdev_get_machine(), TYPE_SCLP, new);
- object_unref(new);
- qdev_realize(DEVICE(new), NULL, &error_fatal);
-}
-
static void sclp_realize(DeviceState *dev, Error **errp)
{
MachineState *machine = MACHINE(qdev_get_machine());
--
2.44.0