diff options
author | Heinz Graalfs <graalfs@linux.vnet.ibm.com> | 2012-10-29 02:13:23 +0000 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2012-10-29 19:41:56 +0100 |
commit | 559a17a1439e34a95dcab47ef99022bcd0e8f8e7 (patch) | |
tree | da054d678b36baa48a6c55c156a83bac5aad97d4 /hw/s390x/sclp.c | |
parent | f6c98f9286c69cafe108b7e9fb22c2ff5da7d6a9 (diff) | |
download | qemu-559a17a1439e34a95dcab47ef99022bcd0e8f8e7.zip qemu-559a17a1439e34a95dcab47ef99022bcd0e8f8e7.tar.gz qemu-559a17a1439e34a95dcab47ef99022bcd0e8f8e7.tar.bz2 |
s390: sclp event support
Several SCLP features are considered to be events. Those events don't
provide SCLP commands on their own, instead they are all based on
Read Event Data, Write Event Data, Write Event Mask and the service
interrupt. Follow-on patches will provide SCLP's Signal Quiesce (via
system_powerdown) and the ASCII console.
Further down the road the sclp line mode console and configuration
change events (e.g. cpu hotplug) can be implemented.
Signed-off-by: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'hw/s390x/sclp.c')
-rw-r--r-- | hw/s390x/sclp.c | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c index d902a66..5c274fa 100644 --- a/hw/s390x/sclp.c +++ b/hw/s390x/sclp.c @@ -18,6 +18,15 @@ #include "sclp.h" +static inline S390SCLPDevice *get_event_facility(void) +{ + ObjectProperty *op = object_property_find(qdev_get_machine(), + "s390-sclp-event-facility", + NULL); + assert(op); + return op->opaque; +} + /* Provide information about the configuration, CPUs and storage */ static void read_SCP_info(SCCB *sccb) { @@ -34,13 +43,15 @@ static void read_SCP_info(SCCB *sccb) static void sclp_execute(SCCB *sccb, uint64_t code) { + S390SCLPDevice *sdev = get_event_facility(); + switch (code) { case SCLP_CMDW_READ_SCP_INFO: case SCLP_CMDW_READ_SCP_INFO_FORCED: read_SCP_info(sccb); break; default: - sccb->h.response_code = cpu_to_be16(SCLP_RC_INVALID_SCLP_COMMAND); + sdev->sclp_command_handler(sdev->ef, sccb, code); break; } } @@ -89,11 +100,45 @@ out: void sclp_service_interrupt(uint32_t sccb) { - s390_sclp_extint(sccb & ~3); + S390SCLPDevice *sdev = get_event_facility(); + uint32_t param = sccb & ~3; + + /* Indicate whether an event is still pending */ + param |= sdev->event_pending(sdev->ef) ? 1 : 0; + + if (!param) { + /* No need to send an interrupt, there's nothing to be notified about */ + return; + } + s390_sclp_extint(param); } /* qemu object creation and initialization functions */ +void s390_sclp_init(void) +{ + DeviceState *dev = qdev_create(NULL, "s390-sclp-event-facility"); + + object_property_add_child(qdev_get_machine(), "s390-sclp-event-facility", + OBJECT(dev), NULL); + qdev_init_nofail(dev); +} + +static int s390_sclp_dev_init(SysBusDevice *dev) +{ + int r; + S390SCLPDevice *sdev = (S390SCLPDevice *)dev; + S390SCLPDeviceClass *sclp = SCLP_S390_DEVICE_GET_CLASS(dev); + + r = sclp->init(sdev); + if (!r) { + assert(sdev->event_pending); + assert(sdev->sclp_command_handler); + } + + return r; +} + static void s390_sclp_device_class_init(ObjectClass *klass, void *data) { SysBusDeviceClass *dc = SYS_BUS_DEVICE_CLASS(klass); |