mirror of
https://github.com/qemu/qemu.git
synced 2024-11-28 06:13:46 +08:00
s390: Virtual channel subsystem support.
Provide a mechanism for qemu to provide fully virtual subchannels to the guest. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
parent
7b18aad543
commit
df1fe5bb49
@ -6,3 +6,4 @@ obj-y += sclp.o
|
||||
obj-y += event-facility.o
|
||||
obj-y += sclpquiesce.o sclpconsole.o
|
||||
obj-y += ipl.o
|
||||
obj-y += css.o
|
||||
|
1277
hw/s390x/css.c
Normal file
1277
hw/s390x/css.c
Normal file
File diff suppressed because it is too large
Load Diff
99
hw/s390x/css.h
Normal file
99
hw/s390x/css.h
Normal file
@ -0,0 +1,99 @@
|
||||
/*
|
||||
* Channel subsystem structures and definitions.
|
||||
*
|
||||
* Copyright 2012 IBM Corp.
|
||||
* Author(s): Cornelia Huck <cornelia.huck@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 CSS_H
|
||||
#define CSS_H
|
||||
|
||||
#include "ioinst.h"
|
||||
|
||||
/* Channel subsystem constants. */
|
||||
#define MAX_SCHID 65535
|
||||
#define MAX_SSID 3
|
||||
#define MAX_CSSID 254 /* 255 is reserved */
|
||||
#define MAX_CHPID 255
|
||||
|
||||
#define MAX_CIWS 62
|
||||
|
||||
typedef struct CIW {
|
||||
uint8_t type;
|
||||
uint8_t command;
|
||||
uint16_t count;
|
||||
} QEMU_PACKED CIW;
|
||||
|
||||
typedef struct SenseId {
|
||||
/* common part */
|
||||
uint8_t reserved; /* always 0x'FF' */
|
||||
uint16_t cu_type; /* control unit type */
|
||||
uint8_t cu_model; /* control unit model */
|
||||
uint16_t dev_type; /* device type */
|
||||
uint8_t dev_model; /* device model */
|
||||
uint8_t unused; /* padding byte */
|
||||
/* extended part */
|
||||
CIW ciw[MAX_CIWS]; /* variable # of CIWs */
|
||||
} QEMU_PACKED SenseId;
|
||||
|
||||
/* Channel measurements, from linux/drivers/s390/cio/cmf.c. */
|
||||
typedef struct CMB {
|
||||
uint16_t ssch_rsch_count;
|
||||
uint16_t sample_count;
|
||||
uint32_t device_connect_time;
|
||||
uint32_t function_pending_time;
|
||||
uint32_t device_disconnect_time;
|
||||
uint32_t control_unit_queuing_time;
|
||||
uint32_t device_active_only_time;
|
||||
uint32_t reserved[2];
|
||||
} QEMU_PACKED CMB;
|
||||
|
||||
typedef struct CMBE {
|
||||
uint32_t ssch_rsch_count;
|
||||
uint32_t sample_count;
|
||||
uint32_t device_connect_time;
|
||||
uint32_t function_pending_time;
|
||||
uint32_t device_disconnect_time;
|
||||
uint32_t control_unit_queuing_time;
|
||||
uint32_t device_active_only_time;
|
||||
uint32_t device_busy_time;
|
||||
uint32_t initial_command_response_time;
|
||||
uint32_t reserved[7];
|
||||
} QEMU_PACKED CMBE;
|
||||
|
||||
struct SubchDev {
|
||||
/* channel-subsystem related things: */
|
||||
uint8_t cssid;
|
||||
uint8_t ssid;
|
||||
uint16_t schid;
|
||||
uint16_t devno;
|
||||
SCHIB curr_status;
|
||||
uint8_t sense_data[32];
|
||||
hwaddr channel_prog;
|
||||
CCW1 last_cmd;
|
||||
bool last_cmd_valid;
|
||||
ORB *orb;
|
||||
/* transport-provided data: */
|
||||
int (*ccw_cb) (SubchDev *, CCW1);
|
||||
SenseId id;
|
||||
void *driver_data;
|
||||
};
|
||||
|
||||
typedef SubchDev *(*css_subch_cb_func)(uint8_t m, uint8_t cssid, uint8_t ssid,
|
||||
uint16_t schid);
|
||||
int css_create_css_image(uint8_t cssid, bool default_image);
|
||||
bool css_devno_used(uint8_t cssid, uint8_t ssid, uint16_t devno);
|
||||
void css_subch_assign(uint8_t cssid, uint8_t ssid, uint16_t schid,
|
||||
uint16_t devno, SubchDev *sch);
|
||||
void css_sch_build_virtual_schib(SubchDev *sch, uint8_t chpid, uint8_t type);
|
||||
void css_reset(void);
|
||||
void css_reset_sch(SubchDev *sch);
|
||||
void css_queue_crw(uint8_t rsc, uint8_t erc, int chain, uint16_t rsid);
|
||||
void css_generate_sch_crws(uint8_t cssid, uint8_t ssid, uint16_t schid,
|
||||
int hotplugged, int add);
|
||||
void css_generate_chp_crws(uint8_t cssid, uint8_t chpid);
|
||||
#endif
|
@ -399,6 +399,30 @@ void cpu_unlock(void);
|
||||
|
||||
typedef struct SubchDev SubchDev;
|
||||
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
SubchDev *css_find_subch(uint8_t m, uint8_t cssid, uint8_t ssid,
|
||||
uint16_t schid);
|
||||
bool css_subch_visible(SubchDev *sch);
|
||||
void css_conditional_io_interrupt(SubchDev *sch);
|
||||
int css_do_stsch(SubchDev *sch, SCHIB *schib);
|
||||
bool css_schid_final(uint8_t cssid, uint8_t ssid, uint16_t schid);
|
||||
int css_do_msch(SubchDev *sch, SCHIB *schib);
|
||||
int css_do_xsch(SubchDev *sch);
|
||||
int css_do_csch(SubchDev *sch);
|
||||
int css_do_hsch(SubchDev *sch);
|
||||
int css_do_ssch(SubchDev *sch, ORB *orb);
|
||||
int css_do_tsch(SubchDev *sch, IRB *irb);
|
||||
int css_do_stcrw(CRW *crw);
|
||||
int css_do_tpi(uint64_t addr, int lowcore);
|
||||
int css_collect_chp_desc(int m, uint8_t cssid, uint8_t f_chpid, uint8_t l_chpid,
|
||||
int rfmt, void *buf);
|
||||
void css_do_schm(uint8_t mbk, int update, int dct, uint64_t mbo);
|
||||
int css_enable_mcsse(void);
|
||||
int css_enable_mss(void);
|
||||
int css_do_rsch(SubchDev *sch);
|
||||
int css_do_rchp(uint8_t cssid, uint8_t chpid);
|
||||
bool css_present(uint8_t cssid);
|
||||
#else
|
||||
static inline SubchDev *css_find_subch(uint8_t m, uint8_t cssid, uint8_t ssid,
|
||||
uint16_t schid)
|
||||
{
|
||||
@ -479,6 +503,7 @@ static inline bool css_present(uint8_t cssid)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline void cpu_set_tls(CPUS390XState *env, target_ulong newtls)
|
||||
{
|
||||
@ -1031,4 +1056,41 @@ void program_interrupt(CPUS390XState *env, uint32_t code, int ilen);
|
||||
void QEMU_NORETURN runtime_exception(CPUS390XState *env, int excp,
|
||||
uintptr_t retaddr);
|
||||
|
||||
#include <sysemu/kvm.h>
|
||||
|
||||
static inline void kvm_s390_io_interrupt(S390CPU *cpu,
|
||||
uint16_t subchannel_id,
|
||||
uint16_t subchannel_nr,
|
||||
uint32_t io_int_parm,
|
||||
uint32_t io_int_word)
|
||||
{
|
||||
}
|
||||
static inline void kvm_s390_crw_mchk(S390CPU *cpu)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void s390_io_interrupt(S390CPU *cpu,
|
||||
uint16_t subchannel_id,
|
||||
uint16_t subchannel_nr,
|
||||
uint32_t io_int_parm,
|
||||
uint32_t io_int_word)
|
||||
{
|
||||
if (kvm_enabled()) {
|
||||
kvm_s390_io_interrupt(cpu, subchannel_id, subchannel_nr, io_int_parm,
|
||||
io_int_word);
|
||||
} else {
|
||||
cpu_inject_io(&cpu->env, subchannel_id, subchannel_nr, io_int_parm,
|
||||
io_int_word);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void s390_crw_mchk(S390CPU *cpu)
|
||||
{
|
||||
if (kvm_enabled()) {
|
||||
kvm_s390_crw_mchk(cpu);
|
||||
} else {
|
||||
cpu_inject_crw_mchk(&cpu->env);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1078,3 +1078,11 @@ ioinst(const char *insn) "IOINST: %s"
|
||||
ioinst_sch_id(const char *insn, int cssid, int ssid, int schid) "IOINST: %s (%x.%x.%04x)"
|
||||
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 %04x, len %04x"
|
||||
|
||||
# hw/s390x/css.c
|
||||
css_enable_facility(const char *facility) "CSS: enable %s"
|
||||
css_crw(uint8_t rsc, uint8_t erc, uint16_t rsid, const char *chained) "CSS: queueing crw: rsc=%x, erc=%x, rsid=%x %s"
|
||||
css_chpid_add(uint8_t cssid, uint8_t chpid, uint8_t type) "CSS: add chpid %x.%02x (type %02x)"
|
||||
css_new_image(uint8_t cssid, const char *default_cssid) "CSS: add css image %02x %s"
|
||||
css_assign_subch(const char *do_assign, uint8_t cssid, uint8_t ssid, uint16_t schid, uint16_t devno) "CSS: %s %x.%x.%04x (devno %04x)"
|
||||
css_io_interrupt(int cssid, int ssid, int schid, uint32_t intparm, uint8_t isc, const char *conditional) "CSS: I/O interrupt on sch %x.%x.%04x (intparm %08x, isc %x) %s"
|
||||
|
Loading…
Reference in New Issue
Block a user