mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20171020' into staging
The last big chunk of s390x changes: - (experimental) smp support under tcg - provide the virtio-input devices for virtio-ccw - improve error handling in the css code - enable some simple virtio tests for s390x - low-address protection in tcg - some more cleanups and fixes # gpg: Signature made Fri 20 Oct 2017 12:49:22 BST # gpg: using RSA key 0xDECF6B93C6F02FAF # gpg: Good signature from "Cornelia Huck <conny@cornelia-huck.de>" # gpg: aka "Cornelia Huck <huckc@linux.vnet.ibm.com>" # gpg: aka "Cornelia Huck <cornelia.huck@de.ibm.com>" # gpg: aka "Cornelia Huck <cohuck@kernel.org>" # gpg: aka "Cornelia Huck <cohuck@redhat.com>" # Primary key fingerprint: C3D0 D66D C362 4FF6 A8C0 18CE DECF 6B93 C6F0 2FAF * remotes/cohuck/tags/s390x-20171020: (46 commits) s390x/tcg: low-address protection support accel/tcg: allow to invalidate a write TLB entry immediately tests: Enable the very simple virtio tests on s390x, too libqtest: Add qtest_[v]startf() s390x: refactor error handling for MSCH handler s390x: refactor error handling for HSCH handler s390x: refactor error handling for CSCH handler s390x: refactor error handling for XSCH handler s390x: improve error handling for SSCH and RSCH s390x/css: IO instr handler ending control s390x: move s390x_new_cpu() into board code s390x: fix cpu object referrence leak in s390x_new_cpu() s390x/event-facility: variable-length event masks s390x/MAINTAINERS: add mailing list virtio-ccw: Add the virtio-input devices for CCW bus target/s390x: special handling when starting a CPU with WAIT PSW s390x/tcg: refactor stfl(e) to use s390_get_feat_block() s390x/tcg: unlock NMI s390x/cpumodel: allow to enable SENSE RUNNING STATUS for qemu s390x/tcg: switch to new SIGP handling code ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
@@ -216,6 +216,7 @@ S: Maintained
|
||||
F: target/s390x/
|
||||
F: hw/s390x/
|
||||
F: disas/s390.c
|
||||
L: qemu-s390x@nongnu.org
|
||||
|
||||
SH4
|
||||
M: Aurelien Jarno <aurelien@aurel32.net>
|
||||
@@ -303,12 +304,14 @@ F: target/s390x/kvm_s390x.h
|
||||
F: target/s390x/kvm-stub.c
|
||||
F: target/s390x/ioinst.[ch]
|
||||
F: target/s390x/machine.c
|
||||
F: target/s390x/sigp.c
|
||||
F: hw/intc/s390_flic.c
|
||||
F: hw/intc/s390_flic_kvm.c
|
||||
F: include/hw/s390x/s390_flic.h
|
||||
F: gdb-xml/s390*.xml
|
||||
T: git git://github.com/cohuck/qemu.git s390-next
|
||||
T: git git://github.com/borntraeger/qemu.git s390-next
|
||||
L: qemu-s390x@nongnu.org
|
||||
|
||||
X86
|
||||
M: Paolo Bonzini <pbonzini@redhat.com>
|
||||
@@ -807,6 +810,7 @@ F: pc-bios/s390-ccw.img
|
||||
F: default-configs/s390x-softmmu.mak
|
||||
T: git git://github.com/cohuck/qemu.git s390-next
|
||||
T: git git://github.com/borntraeger/qemu.git s390-next
|
||||
L: qemu-s390x@nongnu.org
|
||||
|
||||
UniCore32 Machines
|
||||
-------------
|
||||
@@ -1031,6 +1035,7 @@ F: hw/vfio/ccw.c
|
||||
F: hw/s390x/s390-ccw.c
|
||||
F: include/hw/s390x/s390-ccw.h
|
||||
T: git git://github.com/cohuck/qemu.git s390-next
|
||||
L: qemu-s390x@nongnu.org
|
||||
|
||||
vhost
|
||||
M: Michael S. Tsirkin <mst@redhat.com>
|
||||
@@ -1074,6 +1079,7 @@ S: Supported
|
||||
F: hw/s390x/virtio-ccw.[hc]
|
||||
T: git git://github.com/cohuck/qemu.git s390-next
|
||||
T: git git://github.com/borntraeger/qemu.git s390-next
|
||||
L: qemu-s390x@nongnu.org
|
||||
|
||||
virtio-input
|
||||
M: Gerd Hoffmann <kraxel@redhat.com>
|
||||
@@ -1717,6 +1723,7 @@ M: Richard Henderson <rth@twiddle.net>
|
||||
S: Maintained
|
||||
F: tcg/s390/
|
||||
F: disas/s390.c
|
||||
L: qemu-s390x@nongnu.org
|
||||
|
||||
SPARC target
|
||||
S: Odd Fixes
|
||||
|
||||
+4
-1
@@ -694,6 +694,9 @@ void tlb_set_page_with_attrs(CPUState *cpu, target_ulong vaddr,
|
||||
} else {
|
||||
tn.addr_write = address;
|
||||
}
|
||||
if (prot & PAGE_WRITE_INV) {
|
||||
tn.addr_write |= TLB_INVALID_MASK;
|
||||
}
|
||||
}
|
||||
|
||||
/* Pairs with flag setting in tlb_reset_dirty_range */
|
||||
@@ -978,7 +981,7 @@ static void *atomic_mmu_lookup(CPUArchState *env, target_ulong addr,
|
||||
if (!VICTIM_TLB_HIT(addr_write, addr)) {
|
||||
tlb_fill(ENV_GET_CPU(env), addr, MMU_DATA_STORE, mmu_idx, retaddr);
|
||||
}
|
||||
tlb_addr = tlbe->addr_write;
|
||||
tlb_addr = tlbe->addr_write & ~TLB_INVALID_MASK;
|
||||
}
|
||||
|
||||
/* Check notdirty */
|
||||
|
||||
@@ -285,7 +285,7 @@ void helper_le_st_name(CPUArchState *env, target_ulong addr, DATA_TYPE val,
|
||||
if (!VICTIM_TLB_HIT(addr_write, addr)) {
|
||||
tlb_fill(ENV_GET_CPU(env), addr, MMU_DATA_STORE, mmu_idx, retaddr);
|
||||
}
|
||||
tlb_addr = env->tlb_table[mmu_idx][index].addr_write;
|
||||
tlb_addr = env->tlb_table[mmu_idx][index].addr_write & ~TLB_INVALID_MASK;
|
||||
}
|
||||
|
||||
/* Handle an IO access. */
|
||||
@@ -361,7 +361,7 @@ void helper_be_st_name(CPUArchState *env, target_ulong addr, DATA_TYPE val,
|
||||
if (!VICTIM_TLB_HIT(addr_write, addr)) {
|
||||
tlb_fill(ENV_GET_CPU(env), addr, MMU_DATA_STORE, mmu_idx, retaddr);
|
||||
}
|
||||
tlb_addr = env->tlb_table[mmu_idx][index].addr_write;
|
||||
tlb_addr = env->tlb_table[mmu_idx][index].addr_write & ~TLB_INVALID_MASK;
|
||||
}
|
||||
|
||||
/* Handle an IO access. */
|
||||
|
||||
+50
-123
@@ -488,7 +488,7 @@ int css_create_css_image(uint8_t cssid, bool default_image)
|
||||
if (channel_subsys.css[cssid]) {
|
||||
return -EBUSY;
|
||||
}
|
||||
channel_subsys.css[cssid] = g_malloc0(sizeof(CssImage));
|
||||
channel_subsys.css[cssid] = g_new0(CssImage, 1);
|
||||
if (default_image) {
|
||||
channel_subsys.default_cssid = cssid;
|
||||
}
|
||||
@@ -1181,12 +1181,11 @@ static void sch_handle_start_func_virtual(SubchDev *sch)
|
||||
|
||||
}
|
||||
|
||||
static int sch_handle_start_func_passthrough(SubchDev *sch)
|
||||
static IOInstEnding sch_handle_start_func_passthrough(SubchDev *sch)
|
||||
{
|
||||
|
||||
PMCW *p = &sch->curr_status.pmcw;
|
||||
SCSW *s = &sch->curr_status.scsw;
|
||||
int ret;
|
||||
|
||||
ORB *orb = &sch->orb;
|
||||
if (!(s->ctrl & SCSW_ACTL_SUSP)) {
|
||||
@@ -1200,31 +1199,12 @@ static int sch_handle_start_func_passthrough(SubchDev *sch)
|
||||
*/
|
||||
if (!(orb->ctrl0 & ORB_CTRL0_MASK_PFCH) ||
|
||||
!(orb->ctrl0 & ORB_CTRL0_MASK_C64)) {
|
||||
return -EINVAL;
|
||||
warn_report("vfio-ccw requires PFCH and C64 flags set");
|
||||
sch_gen_unit_exception(sch);
|
||||
css_inject_io_interrupt(sch);
|
||||
return IOINST_CC_EXPECTED;
|
||||
}
|
||||
|
||||
ret = s390_ccw_cmd_request(orb, s, sch->driver_data);
|
||||
switch (ret) {
|
||||
/* Currently we don't update control block and just return the cc code. */
|
||||
case 0:
|
||||
break;
|
||||
case -EBUSY:
|
||||
break;
|
||||
case -ENODEV:
|
||||
break;
|
||||
case -EACCES:
|
||||
/* Let's reflect an inaccessible host device by cc 3. */
|
||||
ret = -ENODEV;
|
||||
break;
|
||||
default:
|
||||
/*
|
||||
* All other return codes will trigger a program check,
|
||||
* or set cc to 1.
|
||||
*/
|
||||
break;
|
||||
};
|
||||
|
||||
return ret;
|
||||
return s390_ccw_cmd_request(sch);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1233,7 +1213,7 @@ static int sch_handle_start_func_passthrough(SubchDev *sch)
|
||||
* read/writes) asynchronous later on if we start supporting more than
|
||||
* our current very simple devices.
|
||||
*/
|
||||
int do_subchannel_work_virtual(SubchDev *sch)
|
||||
IOInstEnding do_subchannel_work_virtual(SubchDev *sch)
|
||||
{
|
||||
|
||||
SCSW *s = &sch->curr_status.scsw;
|
||||
@@ -1245,44 +1225,35 @@ int do_subchannel_work_virtual(SubchDev *sch)
|
||||
} else if (s->ctrl & SCSW_FCTL_START_FUNC) {
|
||||
/* Triggered by both ssch and rsch. */
|
||||
sch_handle_start_func_virtual(sch);
|
||||
} else {
|
||||
/* Cannot happen. */
|
||||
return 0;
|
||||
}
|
||||
css_inject_io_interrupt(sch);
|
||||
return 0;
|
||||
/* inst must succeed if this func is called */
|
||||
return IOINST_CC_EXPECTED;
|
||||
}
|
||||
|
||||
int do_subchannel_work_passthrough(SubchDev *sch)
|
||||
IOInstEnding do_subchannel_work_passthrough(SubchDev *sch)
|
||||
{
|
||||
int ret;
|
||||
SCSW *s = &sch->curr_status.scsw;
|
||||
|
||||
if (s->ctrl & SCSW_FCTL_CLEAR_FUNC) {
|
||||
/* TODO: Clear handling */
|
||||
sch_handle_clear_func(sch);
|
||||
ret = 0;
|
||||
} else if (s->ctrl & SCSW_FCTL_HALT_FUNC) {
|
||||
/* TODO: Halt handling */
|
||||
sch_handle_halt_func(sch);
|
||||
ret = 0;
|
||||
} else if (s->ctrl & SCSW_FCTL_START_FUNC) {
|
||||
ret = sch_handle_start_func_passthrough(sch);
|
||||
} else {
|
||||
/* Cannot happen. */
|
||||
return -ENODEV;
|
||||
return sch_handle_start_func_passthrough(sch);
|
||||
}
|
||||
|
||||
return ret;
|
||||
return IOINST_CC_EXPECTED;
|
||||
}
|
||||
|
||||
static int do_subchannel_work(SubchDev *sch)
|
||||
static IOInstEnding do_subchannel_work(SubchDev *sch)
|
||||
{
|
||||
if (sch->do_subchannel_work) {
|
||||
return sch->do_subchannel_work(sch);
|
||||
} else {
|
||||
return -EINVAL;
|
||||
if (!sch->do_subchannel_work) {
|
||||
return IOINST_CC_STATUS_PRESENT;
|
||||
}
|
||||
g_assert(sch->curr_status.scsw.ctrl & SCSW_CTRL_MASK_FCTL);
|
||||
return sch->do_subchannel_work(sch);
|
||||
}
|
||||
|
||||
static void copy_pmcw_to_guest(PMCW *dest, const PMCW *src)
|
||||
@@ -1376,28 +1347,24 @@ static void copy_schib_from_guest(SCHIB *dest, const SCHIB *src)
|
||||
}
|
||||
}
|
||||
|
||||
int css_do_msch(SubchDev *sch, const SCHIB *orig_schib)
|
||||
IOInstEnding css_do_msch(SubchDev *sch, const SCHIB *orig_schib)
|
||||
{
|
||||
SCSW *s = &sch->curr_status.scsw;
|
||||
PMCW *p = &sch->curr_status.pmcw;
|
||||
uint16_t oldflags;
|
||||
int ret;
|
||||
SCHIB schib;
|
||||
|
||||
if (!(sch->curr_status.pmcw.flags & PMCW_FLAGS_MASK_DNV)) {
|
||||
ret = 0;
|
||||
goto out;
|
||||
return IOINST_CC_EXPECTED;
|
||||
}
|
||||
|
||||
if (s->ctrl & SCSW_STCTL_STATUS_PEND) {
|
||||
ret = -EINPROGRESS;
|
||||
goto out;
|
||||
return IOINST_CC_STATUS_PRESENT;
|
||||
}
|
||||
|
||||
if (s->ctrl &
|
||||
(SCSW_FCTL_START_FUNC|SCSW_FCTL_HALT_FUNC|SCSW_FCTL_CLEAR_FUNC)) {
|
||||
ret = -EBUSY;
|
||||
goto out;
|
||||
return IOINST_CC_BUSY;
|
||||
}
|
||||
|
||||
copy_schib_from_guest(&schib, orig_schib);
|
||||
@@ -1424,27 +1391,20 @@ int css_do_msch(SubchDev *sch, const SCHIB *orig_schib)
|
||||
&& (p->flags & PMCW_FLAGS_MASK_ENA) == 0) {
|
||||
sch->disable_cb(sch);
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
||||
out:
|
||||
return ret;
|
||||
return IOINST_CC_EXPECTED;
|
||||
}
|
||||
|
||||
int css_do_xsch(SubchDev *sch)
|
||||
IOInstEnding css_do_xsch(SubchDev *sch)
|
||||
{
|
||||
SCSW *s = &sch->curr_status.scsw;
|
||||
PMCW *p = &sch->curr_status.pmcw;
|
||||
int ret;
|
||||
|
||||
if (~(p->flags) & (PMCW_FLAGS_MASK_DNV | PMCW_FLAGS_MASK_ENA)) {
|
||||
ret = -ENODEV;
|
||||
goto out;
|
||||
return IOINST_CC_NOT_OPERATIONAL;
|
||||
}
|
||||
|
||||
if (s->ctrl & SCSW_CTRL_MASK_STCTL) {
|
||||
ret = -EINPROGRESS;
|
||||
goto out;
|
||||
return IOINST_CC_STATUS_PRESENT;
|
||||
}
|
||||
|
||||
if (!(s->ctrl & SCSW_CTRL_MASK_FCTL) ||
|
||||
@@ -1452,8 +1412,7 @@ int css_do_xsch(SubchDev *sch)
|
||||
(!(s->ctrl &
|
||||
(SCSW_ACTL_RESUME_PEND | SCSW_ACTL_START_PEND | SCSW_ACTL_SUSP))) ||
|
||||
(s->ctrl & SCSW_ACTL_SUBCH_ACTIVE)) {
|
||||
ret = -EBUSY;
|
||||
goto out;
|
||||
return IOINST_CC_BUSY;
|
||||
}
|
||||
|
||||
/* Cancel the current operation. */
|
||||
@@ -1465,56 +1424,43 @@ int css_do_xsch(SubchDev *sch)
|
||||
sch->last_cmd_valid = false;
|
||||
s->dstat = 0;
|
||||
s->cstat = 0;
|
||||
ret = 0;
|
||||
|
||||
out:
|
||||
return ret;
|
||||
return IOINST_CC_EXPECTED;
|
||||
}
|
||||
|
||||
int css_do_csch(SubchDev *sch)
|
||||
IOInstEnding css_do_csch(SubchDev *sch)
|
||||
{
|
||||
SCSW *s = &sch->curr_status.scsw;
|
||||
PMCW *p = &sch->curr_status.pmcw;
|
||||
int ret;
|
||||
|
||||
if (~(p->flags) & (PMCW_FLAGS_MASK_DNV | PMCW_FLAGS_MASK_ENA)) {
|
||||
ret = -ENODEV;
|
||||
goto out;
|
||||
return IOINST_CC_NOT_OPERATIONAL;
|
||||
}
|
||||
|
||||
/* Trigger the clear function. */
|
||||
s->ctrl &= ~(SCSW_CTRL_MASK_FCTL | SCSW_CTRL_MASK_ACTL);
|
||||
s->ctrl |= SCSW_FCTL_CLEAR_FUNC | SCSW_ACTL_CLEAR_PEND;
|
||||
|
||||
do_subchannel_work(sch);
|
||||
ret = 0;
|
||||
|
||||
out:
|
||||
return ret;
|
||||
return do_subchannel_work(sch);
|
||||
}
|
||||
|
||||
int css_do_hsch(SubchDev *sch)
|
||||
IOInstEnding css_do_hsch(SubchDev *sch)
|
||||
{
|
||||
SCSW *s = &sch->curr_status.scsw;
|
||||
PMCW *p = &sch->curr_status.pmcw;
|
||||
int ret;
|
||||
|
||||
if (~(p->flags) & (PMCW_FLAGS_MASK_DNV | PMCW_FLAGS_MASK_ENA)) {
|
||||
ret = -ENODEV;
|
||||
goto out;
|
||||
return IOINST_CC_NOT_OPERATIONAL;
|
||||
}
|
||||
|
||||
if (((s->ctrl & SCSW_CTRL_MASK_STCTL) == SCSW_STCTL_STATUS_PEND) ||
|
||||
(s->ctrl & (SCSW_STCTL_PRIMARY |
|
||||
SCSW_STCTL_SECONDARY |
|
||||
SCSW_STCTL_ALERT))) {
|
||||
ret = -EINPROGRESS;
|
||||
goto out;
|
||||
return IOINST_CC_STATUS_PRESENT;
|
||||
}
|
||||
|
||||
if (s->ctrl & (SCSW_FCTL_HALT_FUNC | SCSW_FCTL_CLEAR_FUNC)) {
|
||||
ret = -EBUSY;
|
||||
goto out;
|
||||
return IOINST_CC_BUSY;
|
||||
}
|
||||
|
||||
/* Trigger the halt function. */
|
||||
@@ -1527,11 +1473,7 @@ int css_do_hsch(SubchDev *sch)
|
||||
}
|
||||
s->ctrl |= SCSW_ACTL_HALT_PEND;
|
||||
|
||||
do_subchannel_work(sch);
|
||||
ret = 0;
|
||||
|
||||
out:
|
||||
return ret;
|
||||
return do_subchannel_work(sch);
|
||||
}
|
||||
|
||||
static void css_update_chnmon(SubchDev *sch)
|
||||
@@ -1569,27 +1511,23 @@ static void css_update_chnmon(SubchDev *sch)
|
||||
}
|
||||
}
|
||||
|
||||
int css_do_ssch(SubchDev *sch, ORB *orb)
|
||||
IOInstEnding css_do_ssch(SubchDev *sch, ORB *orb)
|
||||
{
|
||||
SCSW *s = &sch->curr_status.scsw;
|
||||
PMCW *p = &sch->curr_status.pmcw;
|
||||
int ret;
|
||||
|
||||
if (~(p->flags) & (PMCW_FLAGS_MASK_DNV | PMCW_FLAGS_MASK_ENA)) {
|
||||
ret = -ENODEV;
|
||||
goto out;
|
||||
return IOINST_CC_NOT_OPERATIONAL;
|
||||
}
|
||||
|
||||
if (s->ctrl & SCSW_STCTL_STATUS_PEND) {
|
||||
ret = -EINPROGRESS;
|
||||
goto out;
|
||||
return IOINST_CC_STATUS_PRESENT;
|
||||
}
|
||||
|
||||
if (s->ctrl & (SCSW_FCTL_START_FUNC |
|
||||
SCSW_FCTL_HALT_FUNC |
|
||||
SCSW_FCTL_CLEAR_FUNC)) {
|
||||
ret = -EBUSY;
|
||||
goto out;
|
||||
return IOINST_CC_BUSY;
|
||||
}
|
||||
|
||||
/* If monitoring is active, update counter. */
|
||||
@@ -1602,10 +1540,7 @@ int css_do_ssch(SubchDev *sch, ORB *orb)
|
||||
s->ctrl |= (SCSW_FCTL_START_FUNC | SCSW_ACTL_START_PEND);
|
||||
s->flags &= ~SCSW_FLAGS_MASK_PNO;
|
||||
|
||||
ret = do_subchannel_work(sch);
|
||||
|
||||
out:
|
||||
return ret;
|
||||
return do_subchannel_work(sch);
|
||||
}
|
||||
|
||||
static void copy_irb_to_guest(IRB *dest, const IRB *src, PMCW *pmcw,
|
||||
@@ -1778,7 +1713,7 @@ void css_undo_stcrw(CRW *crw)
|
||||
{
|
||||
CrwContainer *crw_cont;
|
||||
|
||||
crw_cont = g_try_malloc0(sizeof(CrwContainer));
|
||||
crw_cont = g_try_new0(CrwContainer, 1);
|
||||
if (!crw_cont) {
|
||||
channel_subsys.crws_lost = true;
|
||||
return;
|
||||
@@ -1852,27 +1787,23 @@ void css_do_schm(uint8_t mbk, int update, int dct, uint64_t mbo)
|
||||
}
|
||||
}
|
||||
|
||||
int css_do_rsch(SubchDev *sch)
|
||||
IOInstEnding css_do_rsch(SubchDev *sch)
|
||||
{
|
||||
SCSW *s = &sch->curr_status.scsw;
|
||||
PMCW *p = &sch->curr_status.pmcw;
|
||||
int ret;
|
||||
|
||||
if (~(p->flags) & (PMCW_FLAGS_MASK_DNV | PMCW_FLAGS_MASK_ENA)) {
|
||||
ret = -ENODEV;
|
||||
goto out;
|
||||
return IOINST_CC_NOT_OPERATIONAL;
|
||||
}
|
||||
|
||||
if (s->ctrl & SCSW_STCTL_STATUS_PEND) {
|
||||
ret = -EINPROGRESS;
|
||||
goto out;
|
||||
return IOINST_CC_STATUS_PRESENT;
|
||||
}
|
||||
|
||||
if (((s->ctrl & SCSW_CTRL_MASK_FCTL) != SCSW_FCTL_START_FUNC) ||
|
||||
(s->ctrl & SCSW_ACTL_RESUME_PEND) ||
|
||||
(!(s->ctrl & SCSW_ACTL_SUSP))) {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
return IOINST_CC_BUSY;
|
||||
}
|
||||
|
||||
/* If monitoring is active, update counter. */
|
||||
@@ -1881,11 +1812,7 @@ int css_do_rsch(SubchDev *sch)
|
||||
}
|
||||
|
||||
s->ctrl |= SCSW_ACTL_RESUME_PEND;
|
||||
do_subchannel_work(sch);
|
||||
ret = 0;
|
||||
|
||||
out:
|
||||
return ret;
|
||||
return do_subchannel_work(sch);
|
||||
}
|
||||
|
||||
int css_do_rchp(uint8_t cssid, uint8_t chpid)
|
||||
@@ -2185,7 +2112,7 @@ void css_subch_assign(uint8_t cssid, uint8_t ssid, uint16_t schid,
|
||||
css = channel_subsys.css[cssid];
|
||||
|
||||
if (!css->sch_set[ssid]) {
|
||||
css->sch_set[ssid] = g_malloc0(sizeof(SubchSet));
|
||||
css->sch_set[ssid] = g_new0(SubchSet, 1);
|
||||
}
|
||||
s_set = css->sch_set[ssid];
|
||||
|
||||
@@ -2206,7 +2133,7 @@ void css_queue_crw(uint8_t rsc, uint8_t erc, int solicited,
|
||||
|
||||
trace_css_crw(rsc, erc, rsid, chain ? "(chained)" : "");
|
||||
/* TODO: Maybe use a static crw pool? */
|
||||
crw_cont = g_try_malloc0(sizeof(CrwContainer));
|
||||
crw_cont = g_try_new0(CrwContainer, 1);
|
||||
if (!crw_cont) {
|
||||
channel_subsys.crws_lost = true;
|
||||
return;
|
||||
@@ -2498,7 +2425,7 @@ SubchDev *css_create_sch(CssDevId bus_id, bool is_virtual, bool squash_mcss,
|
||||
}
|
||||
}
|
||||
|
||||
sch = g_malloc0(sizeof(*sch));
|
||||
sch = g_new0(SubchDev, 1);
|
||||
sch->cssid = bus_id.cssid;
|
||||
sch->ssid = bus_id.ssid;
|
||||
sch->devno = bus_id.devid;
|
||||
|
||||
@@ -259,23 +259,46 @@ out:
|
||||
return;
|
||||
}
|
||||
|
||||
/* copy up to dst_len bytes and fill the rest of dst with zeroes */
|
||||
static void copy_mask(uint8_t *dst, uint8_t *src, uint16_t dst_len,
|
||||
uint16_t src_len)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < dst_len; i++) {
|
||||
dst[i] = i < src_len ? src[i] : 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void write_event_mask(SCLPEventFacility *ef, SCCB *sccb)
|
||||
{
|
||||
WriteEventMask *we_mask = (WriteEventMask *) sccb;
|
||||
uint16_t mask_length = be16_to_cpu(we_mask->mask_length);
|
||||
uint32_t tmp_mask;
|
||||
|
||||
/* Attention: We assume that Linux uses 4-byte masks, what it actually
|
||||
does. Architecture allows for masks of variable size, though */
|
||||
if (be16_to_cpu(we_mask->mask_length) != 4) {
|
||||
if (!mask_length || (mask_length > SCLP_EVENT_MASK_LEN_MAX)) {
|
||||
sccb->h.response_code = cpu_to_be16(SCLP_RC_INVALID_MASK_LENGTH);
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
* Note: We currently only support masks up to 4 byte length;
|
||||
* the remainder is filled up with zeroes. Linux uses
|
||||
* a 4 byte mask length.
|
||||
*/
|
||||
|
||||
/* keep track of the guest's capability masks */
|
||||
ef->receive_mask = be32_to_cpu(we_mask->cp_receive_mask);
|
||||
copy_mask((uint8_t *)&tmp_mask, WEM_CP_RECEIVE_MASK(we_mask, mask_length),
|
||||
sizeof(tmp_mask), mask_length);
|
||||
ef->receive_mask = be32_to_cpu(tmp_mask);
|
||||
|
||||
/* return the SCLP's capability masks to the guest */
|
||||
we_mask->send_mask = cpu_to_be32(get_host_send_mask(ef));
|
||||
we_mask->receive_mask = cpu_to_be32(get_host_receive_mask(ef));
|
||||
tmp_mask = cpu_to_be32(get_host_send_mask(ef));
|
||||
copy_mask(WEM_RECEIVE_MASK(we_mask, mask_length), (uint8_t *)&tmp_mask,
|
||||
mask_length, sizeof(tmp_mask));
|
||||
tmp_mask = cpu_to_be32(get_host_receive_mask(ef));
|
||||
copy_mask(WEM_SEND_MASK(we_mask, mask_length), (uint8_t *)&tmp_mask,
|
||||
mask_length, sizeof(tmp_mask));
|
||||
|
||||
sccb->h.response_code = cpu_to_be16(SCLP_RC_NORMAL_COMPLETION);
|
||||
|
||||
|
||||
+5
-6
@@ -18,15 +18,14 @@
|
||||
#include "hw/s390x/css-bridge.h"
|
||||
#include "hw/s390x/s390-ccw.h"
|
||||
|
||||
int s390_ccw_cmd_request(ORB *orb, SCSW *scsw, void *data)
|
||||
IOInstEnding s390_ccw_cmd_request(SubchDev *sch)
|
||||
{
|
||||
S390CCWDeviceClass *cdc = S390_CCW_DEVICE_GET_CLASS(data);
|
||||
S390CCWDeviceClass *cdc = S390_CCW_DEVICE_GET_CLASS(sch->driver_data);
|
||||
|
||||
if (cdc->handle_request) {
|
||||
return cdc->handle_request(orb, scsw, data);
|
||||
} else {
|
||||
return -ENOSYS;
|
||||
if (!cdc->handle_request) {
|
||||
return IOINST_CC_STATUS_PRESENT;
|
||||
}
|
||||
return cdc->handle_request(sch);
|
||||
}
|
||||
|
||||
static void s390_ccw_get_dev_info(S390CCWDevice *cdev,
|
||||
|
||||
@@ -240,7 +240,7 @@ static void s390_pci_generate_event(uint8_t cc, uint16_t pec, uint32_t fh,
|
||||
SeiContainer *sei_cont;
|
||||
S390pciState *s = s390_get_phb();
|
||||
|
||||
sei_cont = g_malloc0(sizeof(SeiContainer));
|
||||
sei_cont = g_new0(SeiContainer, 1);
|
||||
sei_cont->fh = fh;
|
||||
sei_cont->fid = fid;
|
||||
sei_cont->cc = cc;
|
||||
@@ -416,7 +416,7 @@ static S390PCIIOMMU *s390_pci_get_iommu(S390pciState *s, PCIBus *bus,
|
||||
S390PCIIOMMU *iommu;
|
||||
|
||||
if (!table) {
|
||||
table = g_malloc0(sizeof(S390PCIIOMMUTable));
|
||||
table = g_new0(S390PCIIOMMUTable, 1);
|
||||
table->key = key;
|
||||
g_hash_table_insert(s->iommu_table, &table->key, table);
|
||||
}
|
||||
|
||||
@@ -52,15 +52,34 @@ S390CPU *s390_cpu_addr2state(uint16_t cpu_addr)
|
||||
return S390_CPU(ms->possible_cpus->cpus[cpu_addr].cpu);
|
||||
}
|
||||
|
||||
static S390CPU *s390x_new_cpu(const char *typename, uint32_t core_id,
|
||||
Error **errp)
|
||||
{
|
||||
S390CPU *cpu = S390_CPU(object_new(typename));
|
||||
Error *err = NULL;
|
||||
|
||||
object_property_set_int(OBJECT(cpu), core_id, "core-id", &err);
|
||||
if (err != NULL) {
|
||||
goto out;
|
||||
}
|
||||
object_property_set_bool(OBJECT(cpu), true, "realized", &err);
|
||||
|
||||
out:
|
||||
object_unref(OBJECT(cpu));
|
||||
if (err) {
|
||||
error_propagate(errp, err);
|
||||
cpu = NULL;
|
||||
}
|
||||
return cpu;
|
||||
}
|
||||
|
||||
static void s390_init_cpus(MachineState *machine)
|
||||
{
|
||||
MachineClass *mc = MACHINE_GET_CLASS(machine);
|
||||
int i;
|
||||
|
||||
if (tcg_enabled() && max_cpus > 1) {
|
||||
error_report("Number of SMP CPUs requested (%d) exceeds max CPUs "
|
||||
"supported by TCG (1) on s390x", max_cpus);
|
||||
exit(1);
|
||||
error_report("WARNING: SMP support on s390x is experimental!");
|
||||
}
|
||||
|
||||
/* initialize possible_cpus */
|
||||
@@ -258,6 +277,9 @@ static void ccw_init(MachineState *machine)
|
||||
|
||||
s390_flic_init();
|
||||
|
||||
/* init the SIGP facility */
|
||||
s390_init_sigp();
|
||||
|
||||
/* get a BUS */
|
||||
css_bus = virtual_css_bus_init();
|
||||
s390_init_ipl_dev(machine->kernel_filename, machine->kernel_cmdline,
|
||||
@@ -397,9 +419,7 @@ static void s390_nmi(NMIState *n, int cpu_index, Error **errp)
|
||||
{
|
||||
CPUState *cs = qemu_get_cpu(cpu_index);
|
||||
|
||||
if (s390_cpu_restart(S390_CPU(cs))) {
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
}
|
||||
s390_cpu_restart(S390_CPU(cs));
|
||||
}
|
||||
|
||||
static void ccw_machine_class_init(ObjectClass *oc, void *data)
|
||||
|
||||
@@ -953,6 +953,15 @@ static void virtio_ccw_gpu_realize(VirtioCcwDevice *ccw_dev, Error **errp)
|
||||
object_property_set_bool(OBJECT(vdev), true, "realized", errp);
|
||||
}
|
||||
|
||||
static void virtio_ccw_input_realize(VirtioCcwDevice *ccw_dev, Error **errp)
|
||||
{
|
||||
VirtIOInputCcw *dev = VIRTIO_INPUT_CCW(ccw_dev);
|
||||
DeviceState *vdev = DEVICE(&dev->vdev);
|
||||
|
||||
qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus));
|
||||
object_property_set_bool(OBJECT(vdev), true, "realized", errp);
|
||||
}
|
||||
|
||||
/* DeviceState to VirtioCcwDevice. Note: used on datapath,
|
||||
* be careful and test performance if you change this.
|
||||
*/
|
||||
@@ -1601,6 +1610,92 @@ static const TypeInfo virtio_ccw_gpu = {
|
||||
.class_init = virtio_ccw_gpu_class_init,
|
||||
};
|
||||
|
||||
static Property virtio_ccw_input_properties[] = {
|
||||
DEFINE_PROP_BIT("ioeventfd", VirtioCcwDevice, flags,
|
||||
VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT, true),
|
||||
DEFINE_PROP_UINT32("max_revision", VirtioCcwDevice, max_rev,
|
||||
VIRTIO_CCW_MAX_REV),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
};
|
||||
|
||||
static void virtio_ccw_input_class_init(ObjectClass *klass, void *data)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_CLASS(klass);
|
||||
|
||||
k->realize = virtio_ccw_input_realize;
|
||||
k->exit = virtio_ccw_exit;
|
||||
dc->reset = virtio_ccw_reset;
|
||||
dc->props = virtio_ccw_input_properties;
|
||||
set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
|
||||
}
|
||||
|
||||
static void virtio_ccw_keyboard_instance_init(Object *obj)
|
||||
{
|
||||
VirtIOInputHIDCcw *dev = VIRTIO_INPUT_HID_CCW(obj);
|
||||
VirtioCcwDevice *ccw_dev = VIRTIO_CCW_DEVICE(obj);
|
||||
|
||||
ccw_dev->force_revision_1 = true;
|
||||
virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
|
||||
TYPE_VIRTIO_KEYBOARD);
|
||||
}
|
||||
|
||||
static void virtio_ccw_mouse_instance_init(Object *obj)
|
||||
{
|
||||
VirtIOInputHIDCcw *dev = VIRTIO_INPUT_HID_CCW(obj);
|
||||
VirtioCcwDevice *ccw_dev = VIRTIO_CCW_DEVICE(obj);
|
||||
|
||||
ccw_dev->force_revision_1 = true;
|
||||
virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
|
||||
TYPE_VIRTIO_MOUSE);
|
||||
}
|
||||
|
||||
static void virtio_ccw_tablet_instance_init(Object *obj)
|
||||
{
|
||||
VirtIOInputHIDCcw *dev = VIRTIO_INPUT_HID_CCW(obj);
|
||||
VirtioCcwDevice *ccw_dev = VIRTIO_CCW_DEVICE(obj);
|
||||
|
||||
ccw_dev->force_revision_1 = true;
|
||||
virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
|
||||
TYPE_VIRTIO_TABLET);
|
||||
}
|
||||
|
||||
static const TypeInfo virtio_ccw_input = {
|
||||
.name = TYPE_VIRTIO_INPUT_CCW,
|
||||
.parent = TYPE_VIRTIO_CCW_DEVICE,
|
||||
.instance_size = sizeof(VirtIOInputCcw),
|
||||
.class_init = virtio_ccw_input_class_init,
|
||||
.abstract = true,
|
||||
};
|
||||
|
||||
static const TypeInfo virtio_ccw_input_hid = {
|
||||
.name = TYPE_VIRTIO_INPUT_HID_CCW,
|
||||
.parent = TYPE_VIRTIO_INPUT_CCW,
|
||||
.instance_size = sizeof(VirtIOInputHIDCcw),
|
||||
.abstract = true,
|
||||
};
|
||||
|
||||
static const TypeInfo virtio_ccw_keyboard = {
|
||||
.name = TYPE_VIRTIO_KEYBOARD_CCW,
|
||||
.parent = TYPE_VIRTIO_INPUT_HID_CCW,
|
||||
.instance_size = sizeof(VirtIOInputHIDCcw),
|
||||
.instance_init = virtio_ccw_keyboard_instance_init,
|
||||
};
|
||||
|
||||
static const TypeInfo virtio_ccw_mouse = {
|
||||
.name = TYPE_VIRTIO_MOUSE_CCW,
|
||||
.parent = TYPE_VIRTIO_INPUT_HID_CCW,
|
||||
.instance_size = sizeof(VirtIOInputHIDCcw),
|
||||
.instance_init = virtio_ccw_mouse_instance_init,
|
||||
};
|
||||
|
||||
static const TypeInfo virtio_ccw_tablet = {
|
||||
.name = TYPE_VIRTIO_TABLET_CCW,
|
||||
.parent = TYPE_VIRTIO_INPUT_HID_CCW,
|
||||
.instance_size = sizeof(VirtIOInputHIDCcw),
|
||||
.instance_init = virtio_ccw_tablet_instance_init,
|
||||
};
|
||||
|
||||
static void virtio_ccw_busdev_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
VirtioCcwDevice *_dev = (VirtioCcwDevice *)dev;
|
||||
@@ -1801,6 +1896,11 @@ static void virtio_ccw_register(void)
|
||||
#endif
|
||||
type_register_static(&virtio_ccw_crypto);
|
||||
type_register_static(&virtio_ccw_gpu);
|
||||
type_register_static(&virtio_ccw_input);
|
||||
type_register_static(&virtio_ccw_input_hid);
|
||||
type_register_static(&virtio_ccw_keyboard);
|
||||
type_register_static(&virtio_ccw_mouse);
|
||||
type_register_static(&virtio_ccw_tablet);
|
||||
}
|
||||
|
||||
type_init(virtio_ccw_register)
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "hw/virtio/vhost-vsock.h"
|
||||
#endif /* CONFIG_VHOST_VSOCK */
|
||||
#include "hw/virtio/virtio-gpu.h"
|
||||
#include "hw/virtio/virtio-input.h"
|
||||
|
||||
#include "hw/s390x/s390_flic.h"
|
||||
#include "hw/s390x/css.h"
|
||||
@@ -233,4 +234,25 @@ typedef struct VirtIOGPUCcw {
|
||||
VirtIOGPU vdev;
|
||||
} VirtIOGPUCcw;
|
||||
|
||||
#define TYPE_VIRTIO_INPUT_CCW "virtio-input-ccw"
|
||||
#define VIRTIO_INPUT_CCW(obj) \
|
||||
OBJECT_CHECK(VirtIOInputCcw, (obj), TYPE_VIRTIO_INPUT_CCW)
|
||||
|
||||
typedef struct VirtIOInputCcw {
|
||||
VirtioCcwDevice parent_obj;
|
||||
VirtIOInput vdev;
|
||||
} VirtIOInputCcw;
|
||||
|
||||
#define TYPE_VIRTIO_INPUT_HID_CCW "virtio-input-hid-ccw"
|
||||
#define TYPE_VIRTIO_KEYBOARD_CCW "virtio-keyboard-ccw"
|
||||
#define TYPE_VIRTIO_MOUSE_CCW "virtio-mouse-ccw"
|
||||
#define TYPE_VIRTIO_TABLET_CCW "virtio-tablet-ccw"
|
||||
#define VIRTIO_INPUT_HID_CCW(obj) \
|
||||
OBJECT_CHECK(VirtIOInputHIDCcw, (obj), TYPE_VIRTIO_INPUT_HID_CCW)
|
||||
|
||||
typedef struct VirtIOInputHIDCcw {
|
||||
VirtioCcwDevice parent_obj;
|
||||
VirtIOInputHID vdev;
|
||||
} VirtIOInputHIDCcw;
|
||||
|
||||
#endif
|
||||
|
||||
+21
-7
@@ -47,9 +47,9 @@ struct VFIODeviceOps vfio_ccw_ops = {
|
||||
.vfio_compute_needs_reset = vfio_ccw_compute_needs_reset,
|
||||
};
|
||||
|
||||
static int vfio_ccw_handle_request(ORB *orb, SCSW *scsw, void *data)
|
||||
static IOInstEnding vfio_ccw_handle_request(SubchDev *sch)
|
||||
{
|
||||
S390CCWDevice *cdev = data;
|
||||
S390CCWDevice *cdev = sch->driver_data;
|
||||
VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev);
|
||||
struct ccw_io_region *region = vcdev->io_region;
|
||||
int ret;
|
||||
@@ -60,8 +60,8 @@ static int vfio_ccw_handle_request(ORB *orb, SCSW *scsw, void *data)
|
||||
|
||||
memset(region, 0, sizeof(*region));
|
||||
|
||||
memcpy(region->orb_area, orb, sizeof(ORB));
|
||||
memcpy(region->scsw_area, scsw, sizeof(SCSW));
|
||||
memcpy(region->orb_area, &sch->orb, sizeof(ORB));
|
||||
memcpy(region->scsw_area, &sch->curr_status.scsw, sizeof(SCSW));
|
||||
|
||||
again:
|
||||
ret = pwrite(vcdev->vdev.fd, region,
|
||||
@@ -71,10 +71,24 @@ again:
|
||||
goto again;
|
||||
}
|
||||
error_report("vfio-ccw: wirte I/O region failed with errno=%d", errno);
|
||||
return -errno;
|
||||
ret = -errno;
|
||||
} else {
|
||||
ret = region->ret_code;
|
||||
}
|
||||
switch (ret) {
|
||||
case 0:
|
||||
return IOINST_CC_EXPECTED;
|
||||
case -EBUSY:
|
||||
return IOINST_CC_BUSY;
|
||||
case -ENODEV:
|
||||
case -EACCES:
|
||||
return IOINST_CC_NOT_OPERATIONAL;
|
||||
case -EFAULT:
|
||||
default:
|
||||
sch_gen_unit_exception(sch);
|
||||
css_inject_io_interrupt(sch);
|
||||
return IOINST_CC_EXPECTED;
|
||||
}
|
||||
|
||||
return region->ret_code;
|
||||
}
|
||||
|
||||
static void vfio_ccw_reset(DeviceState *dev)
|
||||
|
||||
@@ -245,6 +245,9 @@ extern intptr_t qemu_host_page_mask;
|
||||
/* original state of the write flag (used when tracking self-modifying
|
||||
code */
|
||||
#define PAGE_WRITE_ORG 0x0010
|
||||
/* Invalidate the TLB entry immediately, helpful for s390x
|
||||
* Low-Address-Protection. Used with PAGE_WRITE in tlb_set_page_with_attrs() */
|
||||
#define PAGE_WRITE_INV 0x0040
|
||||
#if defined(CONFIG_BSD) && defined(CONFIG_USER_ONLY)
|
||||
/* FIXME: Code that sets/uses this is broken and needs to go away. */
|
||||
#define PAGE_RESERVED 0x0020
|
||||
|
||||
+37
-10
@@ -99,6 +99,22 @@ typedef struct CcwDataStream {
|
||||
hwaddr cda;
|
||||
} CcwDataStream;
|
||||
|
||||
/*
|
||||
* IO instructions conclude according to this. Currently we have only
|
||||
* cc codes. Valid values are 0, 1, 2, 3 and the generic semantic for
|
||||
* IO instructions is described briefly. For more details consult the PoP.
|
||||
*/
|
||||
typedef enum IOInstEnding {
|
||||
/* produced expected result */
|
||||
IOINST_CC_EXPECTED = 0,
|
||||
/* status conditions were present or produced alternate result */
|
||||
IOINST_CC_STATUS_PRESENT = 1,
|
||||
/* inst. ineffective because busy with previously initiated function */
|
||||
IOINST_CC_BUSY = 2,
|
||||
/* inst. ineffective because not operational */
|
||||
IOINST_CC_NOT_OPERATIONAL = 3
|
||||
} IOInstEnding;
|
||||
|
||||
typedef struct SubchDev SubchDev;
|
||||
struct SubchDev {
|
||||
/* channel-subsystem related things: */
|
||||
@@ -120,11 +136,22 @@ struct SubchDev {
|
||||
/* transport-provided data: */
|
||||
int (*ccw_cb) (SubchDev *, CCW1);
|
||||
void (*disable_cb)(SubchDev *);
|
||||
int (*do_subchannel_work) (SubchDev *);
|
||||
IOInstEnding (*do_subchannel_work) (SubchDev *);
|
||||
SenseId id;
|
||||
void *driver_data;
|
||||
};
|
||||
|
||||
static inline void sch_gen_unit_exception(SubchDev *sch)
|
||||
{
|
||||
sch->curr_status.scsw.ctrl &= ~SCSW_ACTL_START_PEND;
|
||||
sch->curr_status.scsw.ctrl |= SCSW_STCTL_PRIMARY |
|
||||
SCSW_STCTL_SECONDARY |
|
||||
SCSW_STCTL_ALERT |
|
||||
SCSW_STCTL_STATUS_PEND;
|
||||
sch->curr_status.scsw.cpa = sch->channel_prog + 8;
|
||||
sch->curr_status.scsw.dstat = SCSW_DSTAT_UNIT_EXCEP;
|
||||
}
|
||||
|
||||
extern const VMStateDescription vmstate_subch_dev;
|
||||
|
||||
/*
|
||||
@@ -183,9 +210,9 @@ void css_generate_sch_crws(uint8_t cssid, uint8_t ssid, uint16_t schid,
|
||||
void css_generate_chp_crws(uint8_t cssid, uint8_t chpid);
|
||||
void css_generate_css_crws(uint8_t cssid);
|
||||
void css_clear_sei_pending(void);
|
||||
int s390_ccw_cmd_request(ORB *orb, SCSW *scsw, void *data);
|
||||
int do_subchannel_work_virtual(SubchDev *sub);
|
||||
int do_subchannel_work_passthrough(SubchDev *sub);
|
||||
IOInstEnding s390_ccw_cmd_request(SubchDev *sch);
|
||||
IOInstEnding do_subchannel_work_virtual(SubchDev *sub);
|
||||
IOInstEnding do_subchannel_work_passthrough(SubchDev *sub);
|
||||
|
||||
typedef enum {
|
||||
CSS_IO_ADAPTER_VIRTIO = 0,
|
||||
@@ -212,11 +239,11 @@ 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(int m, uint8_t cssid, uint8_t ssid, uint16_t schid);
|
||||
int css_do_msch(SubchDev *sch, const 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);
|
||||
IOInstEnding css_do_msch(SubchDev *sch, const SCHIB *schib);
|
||||
IOInstEnding css_do_xsch(SubchDev *sch);
|
||||
IOInstEnding css_do_csch(SubchDev *sch);
|
||||
IOInstEnding css_do_hsch(SubchDev *sch);
|
||||
IOInstEnding css_do_ssch(SubchDev *sch, ORB *orb);
|
||||
int css_do_tsch_get_irb(SubchDev *sch, IRB *irb, int *irb_len);
|
||||
void css_do_tsch_update_subch(SubchDev *sch);
|
||||
int css_do_stcrw(CRW *crw);
|
||||
@@ -227,7 +254,7 @@ int css_collect_chp_desc(int m, uint8_t cssid, uint8_t f_chpid, uint8_t l_chpid,
|
||||
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);
|
||||
IOInstEnding css_do_rsch(SubchDev *sch);
|
||||
int css_do_rchp(uint8_t cssid, uint8_t chpid);
|
||||
bool css_present(uint8_t cssid);
|
||||
#endif
|
||||
|
||||
@@ -49,16 +49,28 @@
|
||||
#define TYPE_SCLP_CPU_HOTPLUG "sclp-cpu-hotplug"
|
||||
#define TYPE_SCLP_QUIESCE "sclpquiesce"
|
||||
|
||||
#define SCLP_EVENT_MASK_LEN_MAX 1021
|
||||
|
||||
typedef struct WriteEventMask {
|
||||
SCCBHeader h;
|
||||
uint16_t _reserved;
|
||||
uint16_t mask_length;
|
||||
uint32_t cp_receive_mask;
|
||||
uint32_t cp_send_mask;
|
||||
uint32_t receive_mask;
|
||||
uint32_t send_mask;
|
||||
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
|
||||
*/
|
||||
} QEMU_PACKED WriteEventMask;
|
||||
|
||||
#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))
|
||||
|
||||
typedef struct EventBufferHeader {
|
||||
uint16_t length;
|
||||
uint8_t type;
|
||||
|
||||
@@ -33,7 +33,7 @@ typedef struct S390CCWDeviceClass {
|
||||
CCWDeviceClass parent_class;
|
||||
void (*realize)(S390CCWDevice *dev, char *sysfsdev, Error **errp);
|
||||
void (*unrealize)(S390CCWDevice *dev, Error **errp);
|
||||
int (*handle_request) (ORB *, SCSW *, void *);
|
||||
IOInstEnding (*handle_request) (SubchDev *sch);
|
||||
} S390CCWDeviceClass;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,6 +2,7 @@ obj-y += cpu.o cpu_models.o cpu_features.o gdbstub.o interrupt.o helper.o
|
||||
obj-$(CONFIG_TCG) += translate.o cc_helper.o excp_helper.o fpu_helper.o
|
||||
obj-$(CONFIG_TCG) += int_helper.o mem_helper.o misc_helper.o crypto_helper.o
|
||||
obj-$(CONFIG_SOFTMMU) += machine.o ioinst.o arch_dump.o mmu_helper.o diag.o
|
||||
obj-$(CONFIG_SOFTMMU) += sigp.o
|
||||
obj-$(CONFIG_KVM) += kvm.o
|
||||
obj-$(call lnot,$(CONFIG_KVM)) += kvm-stub.o
|
||||
|
||||
|
||||
+20
-15
@@ -56,10 +56,18 @@ static void s390_cpu_set_pc(CPUState *cs, vaddr value)
|
||||
static bool s390_cpu_has_work(CPUState *cs)
|
||||
{
|
||||
S390CPU *cpu = S390_CPU(cs);
|
||||
CPUS390XState *env = &cpu->env;
|
||||
|
||||
return (cs->interrupt_request & CPU_INTERRUPT_HARD) &&
|
||||
(env->psw.mask & PSW_MASK_EXT);
|
||||
/* STOPPED cpus can never wake up */
|
||||
if (s390_cpu_get_state(cpu) != CPU_STATE_LOAD &&
|
||||
s390_cpu_get_state(cpu) != CPU_STATE_OPERATING) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(cs->interrupt_request & CPU_INTERRUPT_HARD)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return s390_cpu_has_int(cpu);
|
||||
}
|
||||
|
||||
#if !defined(CONFIG_USER_ONLY)
|
||||
@@ -107,7 +115,6 @@ static void s390_cpu_initial_reset(CPUState *s)
|
||||
env->gbea = 1;
|
||||
|
||||
env->pfault_token = -1UL;
|
||||
env->ext_index = -1;
|
||||
for (i = 0; i < ARRAY_SIZE(env->io_index); i++) {
|
||||
env->io_index[i] = -1;
|
||||
}
|
||||
@@ -145,7 +152,6 @@ static void s390_cpu_full_reset(CPUState *s)
|
||||
env->gbea = 1;
|
||||
|
||||
env->pfault_token = -1UL;
|
||||
env->ext_index = -1;
|
||||
for (i = 0; i < ARRAY_SIZE(env->io_index); i++) {
|
||||
env->io_index[i] = -1;
|
||||
}
|
||||
@@ -331,8 +337,15 @@ unsigned int s390_cpu_set_state(uint8_t cpu_state, S390CPU *cpu)
|
||||
break;
|
||||
case CPU_STATE_OPERATING:
|
||||
case CPU_STATE_LOAD:
|
||||
/* unhalt the cpu for common infrastructure */
|
||||
s390_cpu_unhalt(cpu);
|
||||
/*
|
||||
* Starting a CPU with a PSW WAIT bit set:
|
||||
* KVM: handles this internally and triggers another WAIT exit.
|
||||
* TCG: will actually try to continue to run. Don't unhalt, will
|
||||
* be done when the CPU actually has work (an interrupt).
|
||||
*/
|
||||
if (!tcg_enabled() || !(cpu->env.psw.mask & PSW_MASK_WAIT)) {
|
||||
s390_cpu_unhalt(cpu);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
error_report("Requested CPU state is not a valid S390 CPU state: %u",
|
||||
@@ -394,14 +407,6 @@ void s390_cmma_reset(void)
|
||||
}
|
||||
}
|
||||
|
||||
int s390_cpu_restart(S390CPU *cpu)
|
||||
{
|
||||
if (kvm_enabled()) {
|
||||
return kvm_s390_cpu_restart(cpu);
|
||||
}
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
int s390_get_memslot_count(void)
|
||||
{
|
||||
if (kvm_enabled()) {
|
||||
|
||||
+27
-16
@@ -53,7 +53,6 @@
|
||||
|
||||
#define MMU_USER_IDX 0
|
||||
|
||||
#define MAX_EXT_QUEUE 16
|
||||
#define MAX_IO_QUEUE 16
|
||||
#define MAX_MCHK_QUEUE 16
|
||||
|
||||
@@ -67,12 +66,6 @@ typedef struct PSW {
|
||||
uint64_t addr;
|
||||
} PSW;
|
||||
|
||||
typedef struct ExtQueue {
|
||||
uint32_t code;
|
||||
uint32_t param;
|
||||
uint32_t param64;
|
||||
} ExtQueue;
|
||||
|
||||
typedef struct IOIntQueue {
|
||||
uint16_t id;
|
||||
uint16_t nr;
|
||||
@@ -128,12 +121,13 @@ struct CPUS390XState {
|
||||
|
||||
uint64_t cregs[16]; /* control registers */
|
||||
|
||||
ExtQueue ext_queue[MAX_EXT_QUEUE];
|
||||
IOIntQueue io_queue[MAX_IO_QUEUE][8];
|
||||
MchkQueue mchk_queue[MAX_MCHK_QUEUE];
|
||||
|
||||
int pending_int;
|
||||
int ext_index;
|
||||
uint32_t service_param;
|
||||
uint16_t external_call_addr;
|
||||
DECLARE_BITMAP(emergency_signals, S390_MAX_CPUS);
|
||||
int io_index[8];
|
||||
int mchk_index;
|
||||
|
||||
@@ -351,6 +345,11 @@ extern const struct VMStateDescription vmstate_s390_cpu;
|
||||
#define CR0_LOWPROT 0x0000000010000000ULL
|
||||
#define CR0_SECONDARY 0x0000000004000000ULL
|
||||
#define CR0_EDAT 0x0000000000800000ULL
|
||||
#define CR0_EMERGENCY_SIGNAL_SC 0x0000000000004000ULL
|
||||
#define CR0_EXTERNAL_CALL_SC 0x0000000000002000ULL
|
||||
#define CR0_CKC_SC 0x0000000000000800ULL
|
||||
#define CR0_CPU_TIMER_SC 0x0000000000000400ULL
|
||||
#define CR0_SERVICE_SC 0x0000000000000200ULL
|
||||
|
||||
/* MMU */
|
||||
#define MMU_PRIMARY_IDX 0
|
||||
@@ -401,14 +400,20 @@ static inline void cpu_get_tb_cpu_state(CPUS390XState* env, target_ulong *pc,
|
||||
#define EXCP_EXT 1 /* external interrupt */
|
||||
#define EXCP_SVC 2 /* supervisor call (syscall) */
|
||||
#define EXCP_PGM 3 /* program interruption */
|
||||
#define EXCP_RESTART 4 /* restart interrupt */
|
||||
#define EXCP_STOP 5 /* stop interrupt */
|
||||
#define EXCP_IO 7 /* I/O interrupt */
|
||||
#define EXCP_MCHK 8 /* machine check */
|
||||
|
||||
#define INTERRUPT_EXT (1 << 0)
|
||||
#define INTERRUPT_TOD (1 << 1)
|
||||
#define INTERRUPT_CPUTIMER (1 << 2)
|
||||
#define INTERRUPT_IO (1 << 3)
|
||||
#define INTERRUPT_MCHK (1 << 4)
|
||||
#define INTERRUPT_IO (1 << 0)
|
||||
#define INTERRUPT_MCHK (1 << 1)
|
||||
#define INTERRUPT_EXT_SERVICE (1 << 2)
|
||||
#define INTERRUPT_EXT_CPU_TIMER (1 << 3)
|
||||
#define INTERRUPT_EXT_CLOCK_COMPARATOR (1 << 4)
|
||||
#define INTERRUPT_EXTERNAL_CALL (1 << 5)
|
||||
#define INTERRUPT_EMERGENCY_SIGNAL (1 << 6)
|
||||
#define INTERRUPT_RESTART (1 << 7)
|
||||
#define INTERRUPT_STOP (1 << 8)
|
||||
|
||||
/* Program Status Word. */
|
||||
#define S390_PSWM_REGNUM 0
|
||||
@@ -589,6 +594,8 @@ struct sysib_322 {
|
||||
#define SIGP_SET_PREFIX 0x0d
|
||||
#define SIGP_STORE_STATUS_ADDR 0x0e
|
||||
#define SIGP_SET_ARCH 0x12
|
||||
#define SIGP_COND_EMERGENCY 0x13
|
||||
#define SIGP_SENSE_RUNNING 0x15
|
||||
#define SIGP_STORE_ADTL_STATUS 0x17
|
||||
|
||||
/* SIGP condition codes */
|
||||
@@ -599,6 +606,7 @@ struct sysib_322 {
|
||||
|
||||
/* SIGP status bits */
|
||||
#define SIGP_STAT_EQUIPMENT_CHECK 0x80000000UL
|
||||
#define SIGP_STAT_NOT_RUNNING 0x00000400UL
|
||||
#define SIGP_STAT_INCORRECT_STATE 0x00000200UL
|
||||
#define SIGP_STAT_INVALID_PARAMETER 0x00000100UL
|
||||
#define SIGP_STAT_EXT_CALL_PENDING 0x00000080UL
|
||||
@@ -675,7 +683,6 @@ bool s390_get_squash_mcss(void);
|
||||
int s390_get_memslot_count(void);
|
||||
int s390_set_memory_limit(uint64_t new_limit, uint64_t *hw_limit);
|
||||
void s390_cmma_reset(void);
|
||||
int s390_cpu_restart(S390CPU *cpu);
|
||||
void s390_enable_css_support(S390CPU *cpu);
|
||||
int s390_assign_subch_ioeventfd(EventNotifier *notifier, uint32_t sch_id,
|
||||
int vq, bool assign);
|
||||
@@ -695,7 +702,6 @@ void s390_cpu_list(FILE *f, fprintf_function cpu_fprintf);
|
||||
|
||||
/* helper.c */
|
||||
#define cpu_init(cpu_model) cpu_generic_init(TYPE_S390_CPU, cpu_model)
|
||||
S390CPU *s390x_new_cpu(const char *typename, uint32_t core_id, Error **errp);
|
||||
|
||||
#define S390_CPU_TYPE_SUFFIX "-" TYPE_S390_CPU
|
||||
#define S390_CPU_TYPE_NAME(name) (name S390_CPU_TYPE_SUFFIX)
|
||||
@@ -729,6 +735,11 @@ int s390_cpu_virt_mem_rw(S390CPU *cpu, vaddr laddr, uint8_t ar, void *hostbuf,
|
||||
s390_cpu_virt_mem_rw(cpu, laddr, ar, NULL, len, true)
|
||||
|
||||
|
||||
/* sigp.c */
|
||||
int s390_cpu_restart(S390CPU *cpu);
|
||||
void s390_init_sigp(void);
|
||||
|
||||
|
||||
/* outside of target/s390x/ */
|
||||
S390CPU *s390_cpu_addr2state(uint16_t cpu_addr);
|
||||
|
||||
|
||||
@@ -392,7 +392,7 @@ static void create_cpu_model_list(ObjectClass *klass, void *opaque)
|
||||
|
||||
/* strip off the -s390-cpu */
|
||||
g_strrstr(name, "-" TYPE_S390_CPU)[0] = 0;
|
||||
info = g_malloc0(sizeof(*info));
|
||||
info = g_new0(CpuDefinitionInfo, 1);
|
||||
info->name = name;
|
||||
info->has_migration_safe = true;
|
||||
info->migration_safe = scc->is_migration_safe;
|
||||
@@ -412,7 +412,7 @@ static void create_cpu_model_list(ObjectClass *klass, void *opaque)
|
||||
object_unref(obj);
|
||||
}
|
||||
|
||||
entry = g_malloc0(sizeof(*entry));
|
||||
entry = g_new0(CpuDefinitionInfoList, 1);
|
||||
entry->value = info;
|
||||
entry->next = *cpu_list;
|
||||
*cpu_list = entry;
|
||||
@@ -574,7 +574,7 @@ CpuModelExpansionInfo *arch_query_cpu_model_expansion(CpuModelExpansionType type
|
||||
}
|
||||
|
||||
/* convert it back to a static representation */
|
||||
expansion_info = g_malloc0(sizeof(*expansion_info));
|
||||
expansion_info = g_new0(CpuModelExpansionInfo, 1);
|
||||
expansion_info->model = g_malloc0(sizeof(*expansion_info->model));
|
||||
cpu_info_from_model(expansion_info->model, &s390_model, delta_changes);
|
||||
return expansion_info;
|
||||
@@ -585,7 +585,7 @@ static void list_add_feat(const char *name, void *opaque)
|
||||
strList **last = (strList **) opaque;
|
||||
strList *entry;
|
||||
|
||||
entry = g_malloc0(sizeof(*entry));
|
||||
entry = g_new0(strList, 1);
|
||||
entry->value = g_strdup(name);
|
||||
entry->next = *last;
|
||||
*last = entry;
|
||||
@@ -609,7 +609,7 @@ CpuModelCompareInfo *arch_query_cpu_model_comparison(CpuModelInfo *infoa,
|
||||
if (*errp) {
|
||||
return NULL;
|
||||
}
|
||||
compare_info = g_malloc0(sizeof(*compare_info));
|
||||
compare_info = g_new0(CpuModelCompareInfo, 1);
|
||||
|
||||
/* check the cpu generation and ga level */
|
||||
if (modela.def->gen == modelb.def->gen) {
|
||||
@@ -713,7 +713,7 @@ CpuModelBaselineInfo *arch_query_cpu_model_baseline(CpuModelInfo *infoa,
|
||||
bitmap_and(model.features, model.features, model.def->full_feat,
|
||||
S390_FEAT_MAX);
|
||||
|
||||
baseline_info = g_malloc0(sizeof(*baseline_info));
|
||||
baseline_info = g_new0(CpuModelBaselineInfo, 1);
|
||||
baseline_info->model = g_malloc0(sizeof(*baseline_info->model));
|
||||
cpu_info_from_model(baseline_info->model, &model, true);
|
||||
return baseline_info;
|
||||
@@ -823,6 +823,7 @@ static void add_qemu_cpu_model_features(S390FeatBitmap fbm)
|
||||
S390_FEAT_DAT_ENH,
|
||||
S390_FEAT_IDTE_SEGMENT,
|
||||
S390_FEAT_STFLE,
|
||||
S390_FEAT_SENSE_RUNNING_STATUS,
|
||||
S390_FEAT_EXTENDED_IMMEDIATE,
|
||||
S390_FEAT_EXTENDED_TRANSLATION_2,
|
||||
S390_FEAT_MSA,
|
||||
|
||||
+1
-1
@@ -144,7 +144,7 @@ void handle_diag_308(CPUS390XState *env, uint64_t r1, uint64_t r3)
|
||||
program_interrupt(env, PGM_ADDRESSING, ILEN_AUTO);
|
||||
return;
|
||||
}
|
||||
iplb = g_malloc0(sizeof(IplParameterBlock));
|
||||
iplb = g_new0(IplParameterBlock, 1);
|
||||
cpu_physical_memory_read(addr, iplb, sizeof(iplb->len));
|
||||
if (!iplb_valid_len(iplb)) {
|
||||
env->regs[r1 + 1] = DIAG_308_RC_INVALID;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user