2012-10-29 06:13:23 +04:00
|
|
|
/*
|
|
|
|
* SCLP
|
|
|
|
* Event Facility definitions
|
|
|
|
*
|
|
|
|
* Copyright IBM, Corp. 2012
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Heinz Graalfs <graalfs@de.ibm.com>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef HW_S390_SCLP_EVENT_FACILITY_H
|
|
|
|
#define HW_S390_SCLP_EVENT_FACILITY_H
|
|
|
|
|
2012-12-17 21:20:00 +04:00
|
|
|
#include "qemu/thread.h"
|
2019-08-12 08:23:51 +03:00
|
|
|
#include "hw/qdev-core.h"
|
2014-01-20 23:51:50 +04:00
|
|
|
#include "hw/s390x/sclp.h"
|
2020-09-03 23:43:22 +03:00
|
|
|
#include "qom/object.h"
|
2012-10-29 06:13:23 +04:00
|
|
|
|
|
|
|
/* SCLP event types */
|
2013-05-22 16:11:36 +04:00
|
|
|
#define SCLP_EVENT_OPRTNS_COMMAND 0x01
|
|
|
|
#define SCLP_EVENT_MESSAGE 0x02
|
2014-01-20 23:51:50 +04:00
|
|
|
#define SCLP_EVENT_CONFIG_MGT_DATA 0x04
|
2013-05-22 16:11:36 +04:00
|
|
|
#define SCLP_EVENT_PMSGCMD 0x09
|
2012-10-29 06:13:23 +04:00
|
|
|
#define SCLP_EVENT_ASCII_CONSOLE_DATA 0x1a
|
|
|
|
#define SCLP_EVENT_SIGNAL_QUIESCE 0x1d
|
|
|
|
|
|
|
|
/* SCLP event masks */
|
2018-02-23 20:42:57 +03:00
|
|
|
#define SCLP_EVMASK(T) (1ULL << (sizeof(sccb_mask_t) * 8 - (T)))
|
|
|
|
|
|
|
|
#define SCLP_EVENT_MASK_OP_CMD SCLP_EVMASK(SCLP_EVENT_OPRTNS_COMMAND)
|
|
|
|
#define SCLP_EVENT_MASK_MSG SCLP_EVMASK(SCLP_EVENT_MESSAGE)
|
|
|
|
#define SCLP_EVENT_MASK_CONFIG_MGT_DATA SCLP_EVMASK(SCLP_EVENT_CONFIG_MGT_DATA)
|
|
|
|
#define SCLP_EVENT_MASK_PMSGCMD SCLP_EVMASK(SCLP_EVENT_PMSGCMD)
|
|
|
|
#define SCLP_EVENT_MASK_MSG_ASCII SCLP_EVMASK(SCLP_EVENT_ASCII_CONSOLE_DATA)
|
|
|
|
#define SCLP_EVENT_MASK_SIGNAL_QUIESCE SCLP_EVMASK(SCLP_EVENT_SIGNAL_QUIESCE)
|
2012-10-29 06:13:23 +04:00
|
|
|
|
|
|
|
#define SCLP_UNCONDITIONAL_READ 0x00
|
|
|
|
#define SCLP_SELECTIVE_READ 0x01
|
|
|
|
|
|
|
|
#define TYPE_SCLP_EVENT "s390-sclp-event-type"
|
2020-09-01 00:07:37 +03:00
|
|
|
OBJECT_DECLARE_TYPE(SCLPEvent, SCLPEventClass,
|
qom: Remove module_obj_name parameter from OBJECT_DECLARE* macros
One of the goals of having less boilerplate on QOM declarations
is to avoid human error. Requiring an extra argument that is
never used is an opportunity for mistakes.
Remove the unused argument from OBJECT_DECLARE_TYPE and
OBJECT_DECLARE_SIMPLE_TYPE.
Coccinelle patch used to convert all users of the macros:
@@
declarer name OBJECT_DECLARE_TYPE;
identifier InstanceType, ClassType, lowercase, UPPERCASE;
@@
OBJECT_DECLARE_TYPE(InstanceType, ClassType,
- lowercase,
UPPERCASE);
@@
declarer name OBJECT_DECLARE_SIMPLE_TYPE;
identifier InstanceType, lowercase, UPPERCASE;
@@
OBJECT_DECLARE_SIMPLE_TYPE(InstanceType,
- lowercase,
UPPERCASE);
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Acked-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Igor Mammedov <imammedo@redhat.com>
Acked-by: Paul Durrant <paul@xen.org>
Acked-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20200916182519.415636-4-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2020-09-16 21:25:17 +03:00
|
|
|
SCLP_EVENT)
|
2012-10-29 06:13:23 +04:00
|
|
|
|
2014-01-20 23:51:50 +04:00
|
|
|
#define TYPE_SCLP_CPU_HOTPLUG "sclp-cpu-hotplug"
|
2015-05-11 16:31:47 +03:00
|
|
|
#define TYPE_SCLP_QUIESCE "sclpquiesce"
|
2014-01-20 23:51:50 +04:00
|
|
|
|
2017-10-11 16:39:53 +03:00
|
|
|
#define SCLP_EVENT_MASK_LEN_MAX 1021
|
|
|
|
|
2012-10-29 06:13:23 +04:00
|
|
|
typedef struct WriteEventMask {
|
|
|
|
SCCBHeader h;
|
|
|
|
uint16_t _reserved;
|
|
|
|
uint16_t mask_length;
|
2017-10-11 16:39:53 +03:00
|
|
|
uint8_t masks[];
|
|
|
|
/*
|
|
|
|
* Layout of the masks is
|
|
|
|
* uint8_t cp_receive_mask[mask_length];
|
|
|
|
* uint8_t cp_send_mask[mask_length];
|
|
|
|
* uint8_t receive_mask[mask_length];
|
|
|
|
* uint8_t send_mask[mask_length];
|
|
|
|
* where 1 <= mask_length <= SCLP_EVENT_MASK_LEN_MAX
|
|
|
|
*/
|
2012-10-29 06:13:23 +04:00
|
|
|
} QEMU_PACKED WriteEventMask;
|
|
|
|
|
2017-10-11 16:39:53 +03:00
|
|
|
#define WEM_CP_RECEIVE_MASK(wem, mask_len) ((wem)->masks)
|
|
|
|
#define WEM_CP_SEND_MASK(wem, mask_len) ((wem)->masks + (mask_len))
|
|
|
|
#define WEM_RECEIVE_MASK(wem, mask_len) ((wem)->masks + 2 * (mask_len))
|
|
|
|
#define WEM_SEND_MASK(wem, mask_len) ((wem)->masks + 3 * (mask_len))
|
|
|
|
|
2018-03-08 14:04:29 +03:00
|
|
|
typedef uint64_t sccb_mask_t;
|
2018-02-23 20:42:57 +03:00
|
|
|
|
2012-10-29 06:13:23 +04:00
|
|
|
typedef struct EventBufferHeader {
|
|
|
|
uint16_t length;
|
|
|
|
uint8_t type;
|
|
|
|
uint8_t flags;
|
|
|
|
uint16_t _reserved;
|
|
|
|
} QEMU_PACKED EventBufferHeader;
|
|
|
|
|
2013-05-22 16:11:36 +04:00
|
|
|
typedef struct MdbHeader {
|
|
|
|
uint16_t length;
|
|
|
|
uint16_t type;
|
|
|
|
uint32_t tag;
|
|
|
|
uint32_t revision_code;
|
|
|
|
} QEMU_PACKED MdbHeader;
|
|
|
|
|
|
|
|
typedef struct MTO {
|
|
|
|
uint16_t line_type_flags;
|
|
|
|
uint8_t alarm_control;
|
|
|
|
uint8_t _reserved[3];
|
|
|
|
char message[];
|
|
|
|
} QEMU_PACKED MTO;
|
|
|
|
|
|
|
|
typedef struct GO {
|
|
|
|
uint32_t domid;
|
|
|
|
uint8_t hhmmss_time[8];
|
|
|
|
uint8_t th_time[3];
|
|
|
|
uint8_t _reserved_0;
|
|
|
|
uint8_t dddyyyy_date[7];
|
|
|
|
uint8_t _reserved_1;
|
|
|
|
uint16_t general_msg_flags;
|
|
|
|
uint8_t _reserved_2[10];
|
|
|
|
uint8_t originating_system_name[8];
|
|
|
|
uint8_t job_guest_name[8];
|
|
|
|
} QEMU_PACKED GO;
|
|
|
|
|
|
|
|
#define MESSAGE_TEXT 0x0004
|
|
|
|
|
|
|
|
typedef struct MDBO {
|
|
|
|
uint16_t length;
|
|
|
|
uint16_t type;
|
|
|
|
union {
|
|
|
|
GO go;
|
|
|
|
MTO mto;
|
|
|
|
};
|
|
|
|
} QEMU_PACKED MDBO;
|
|
|
|
|
|
|
|
typedef struct MDB {
|
|
|
|
MdbHeader header;
|
2020-03-04 18:38:16 +03:00
|
|
|
MDBO mdbo[];
|
2013-05-22 16:11:36 +04:00
|
|
|
} QEMU_PACKED MDB;
|
|
|
|
|
|
|
|
typedef struct SclpMsg {
|
|
|
|
EventBufferHeader header;
|
|
|
|
MDB mdb;
|
|
|
|
} QEMU_PACKED SclpMsg;
|
|
|
|
|
|
|
|
#define GDS_ID_MDSMU 0x1310
|
|
|
|
#define GDS_ID_CPMSU 0x1212
|
|
|
|
#define GDS_ID_TEXTCMD 0x1320
|
|
|
|
|
|
|
|
typedef struct GdsVector {
|
|
|
|
uint16_t length;
|
|
|
|
uint16_t gds_id;
|
|
|
|
} QEMU_PACKED GdsVector;
|
|
|
|
|
|
|
|
#define GDS_KEY_SELFDEFTEXTMSG 0x31
|
|
|
|
#define GDS_KEY_TEXTMSG 0x30
|
|
|
|
|
|
|
|
typedef struct GdsSubvector {
|
|
|
|
uint8_t length;
|
|
|
|
uint8_t key;
|
|
|
|
} QEMU_PACKED GdsSubvector;
|
|
|
|
|
|
|
|
/* MDS Message Unit */
|
|
|
|
typedef struct MDMSU {
|
|
|
|
GdsVector mdmsu;
|
|
|
|
GdsVector cpmsu;
|
|
|
|
GdsVector text_command;
|
|
|
|
GdsSubvector self_def_text_message;
|
|
|
|
GdsSubvector text_message;
|
|
|
|
} QEMU_PACKED MDMSU;
|
|
|
|
|
2012-10-29 06:13:23 +04:00
|
|
|
typedef struct WriteEventData {
|
|
|
|
SCCBHeader h;
|
|
|
|
EventBufferHeader ebh;
|
|
|
|
} QEMU_PACKED WriteEventData;
|
|
|
|
|
|
|
|
typedef struct ReadEventData {
|
|
|
|
SCCBHeader h;
|
2015-07-27 17:55:23 +03:00
|
|
|
union {
|
2018-02-23 20:42:57 +03:00
|
|
|
sccb_mask_t mask;
|
2015-07-27 17:55:23 +03:00
|
|
|
EventBufferHeader ebh;
|
|
|
|
};
|
2012-10-29 06:13:23 +04:00
|
|
|
} QEMU_PACKED ReadEventData;
|
|
|
|
|
2020-09-03 23:43:22 +03:00
|
|
|
struct SCLPEvent {
|
2012-10-29 06:13:23 +04:00
|
|
|
DeviceState qdev;
|
|
|
|
bool event_pending;
|
|
|
|
char *name;
|
2020-09-03 23:43:22 +03:00
|
|
|
};
|
2012-10-29 06:13:23 +04:00
|
|
|
|
2020-09-03 23:43:22 +03:00
|
|
|
struct SCLPEventClass {
|
2012-10-29 06:13:23 +04:00
|
|
|
DeviceClass parent_class;
|
|
|
|
int (*init)(SCLPEvent *event);
|
|
|
|
|
|
|
|
/* get SCLP's send mask */
|
2018-02-23 20:42:57 +03:00
|
|
|
sccb_mask_t (*get_send_mask)(void);
|
2012-10-29 06:13:23 +04:00
|
|
|
|
|
|
|
/* get SCLP's receive mask */
|
2018-02-23 20:42:57 +03:00
|
|
|
sccb_mask_t (*get_receive_mask)(void);
|
2012-10-29 06:13:23 +04:00
|
|
|
|
|
|
|
int (*read_event_data)(SCLPEvent *event, EventBufferHeader *evt_buf_hdr,
|
|
|
|
int *slen);
|
|
|
|
|
|
|
|
int (*write_event_data)(SCLPEvent *event, EventBufferHeader *evt_buf_hdr);
|
|
|
|
|
2013-09-17 15:07:30 +04:00
|
|
|
/* can we handle this event type? */
|
|
|
|
bool (*can_handle_event)(uint8_t type);
|
2020-09-03 23:43:22 +03:00
|
|
|
};
|
2012-10-29 06:13:23 +04:00
|
|
|
|
2013-12-18 13:10:49 +04:00
|
|
|
#define TYPE_SCLP_EVENT_FACILITY "s390-sclp-event-facility"
|
2020-08-25 22:20:24 +03:00
|
|
|
typedef struct SCLPEventFacility SCLPEventFacility;
|
2020-09-03 23:43:22 +03:00
|
|
|
typedef struct SCLPEventFacilityClass SCLPEventFacilityClass;
|
2020-09-01 00:07:33 +03:00
|
|
|
DECLARE_OBJ_CHECKERS(SCLPEventFacility, SCLPEventFacilityClass,
|
|
|
|
EVENT_FACILITY, TYPE_SCLP_EVENT_FACILITY)
|
2013-12-18 13:10:49 +04:00
|
|
|
|
2020-09-03 23:43:22 +03:00
|
|
|
struct SCLPEventFacilityClass {
|
2015-05-21 13:43:31 +03:00
|
|
|
SysBusDeviceClass parent_class;
|
2013-12-18 13:10:49 +04:00
|
|
|
void (*command_handler)(SCLPEventFacility *ef, SCCB *sccb, uint64_t code);
|
|
|
|
bool (*event_pending)(SCLPEventFacility *ef);
|
2020-09-03 23:43:22 +03:00
|
|
|
};
|
2013-12-18 13:10:49 +04:00
|
|
|
|
hw/s390x: Allow to configure the consoles with the "-serial" parameter
The consoles ("sclpconsole" and "sclplmconsole") can only be configured
with "-device" and "-chardev" so far. Other machines use the convenience
option "-serial" to configure the default consoles, even for virtual
consoles like spapr-vty on the pseries machine. So let's support this
option on s390x, too. This way we can easily enable the serial console
here again with "-nodefaults", for example:
qemu-system-s390x -no-shutdown -nographic -nodefaults -serial mon:stdio
... which is way shorter than typing:
qemu-system-s390x -no-shutdown -nographic -nodefaults \
-chardev stdio,id=c1,mux=on -device sclpconsole,chardev=c1 \
-mon chardev=c1
The -serial parameter can also be used if you only want to see the QEMU
monitor on stdio without using -nodefaults, but not the console output.
That's something that is pretty impossible with the current code today:
qemu-system-s390x -no-shutdown -nographic -serial none
While we're at it, this patch also maps the second -serial option to the
"sclplmconsole", so that there is now an easy way to configure this second
console on s390x, too, for example:
qemu-system-s390x -no-shutdown -nographic -serial null -serial mon:stdio
Additionally, the new code is also smaller than the old one and we have
less s390x-specific code in vl.c :-)
I've also checked that migration still works as expected by migrating
a guest with console output back and forth between a qemu-system-s390x
that has this patch and an instance without this patch.
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1524754794-28005-1-git-send-email-thuth@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2018-04-26 17:59:54 +03:00
|
|
|
BusState *sclp_get_event_facility_bus(void);
|
|
|
|
|
2012-10-29 06:13:23 +04:00
|
|
|
#endif
|