From nobody Mon Feb 9 17:24:14 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1500030920481254.3632335486809; Fri, 14 Jul 2017 04:15:20 -0700 (PDT) Received: from localhost ([::1]:37046 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVyZ3-000162-38 for importer@patchew.org; Fri, 14 Jul 2017 07:15:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56855) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVyPG-000054-4m for qemu-devel@nongnu.org; Fri, 14 Jul 2017 07:05:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVyPC-00044C-1D for qemu-devel@nongnu.org; Fri, 14 Jul 2017 07:05:10 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:49908) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dVyPB-00043N-N7 for qemu-devel@nongnu.org; Fri, 14 Jul 2017 07:05:05 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v6EB4snT110253 for ; Fri, 14 Jul 2017 07:05:04 -0400 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 2bpmjb1f5u-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 14 Jul 2017 07:05:04 -0400 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 14 Jul 2017 12:04:54 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 14 Jul 2017 12:04:51 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v6EB4osQ33358008; Fri, 14 Jul 2017 11:04:51 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 693DC52A78; Fri, 14 Jul 2017 10:37:28 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTPS id 48ADA52A75; Fri, 14 Jul 2017 10:37:28 +0100 (BST) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 25651) id 7BAC520F69D; Fri, 14 Jul 2017 12:41:10 +0200 (CEST) From: Christian Borntraeger To: Peter Maydell Date: Fri, 14 Jul 2017 12:40:37 +0200 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1500028867-134709-1-git-send-email-borntraeger@de.ibm.com> References: <1500028867-134709-1-git-send-email-borntraeger@de.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17071411-0040-0000-0000-000003C42207 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17071411-0041-0000-0000-000025BF8054 Message-Id: <1500028867-134709-11-git-send-email-borntraeger@de.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-07-13_13:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1706020000 definitions=main-1707140183 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PULL 10/40] s390x/sic: realize SIC handling X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , Yi Min Zhao , Cornelia Huck , qemu-devel , Alexander Graf , Christian Borntraeger , Fei Li , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Fei Li Currently, we do nothing for the SIC instruction, but we need to implement it properly. Let's add proper handling in the backend code. Co-authored-by: Yi Min Zhao Signed-off-by: Yi Min Zhao Signed-off-by: Fei Li Signed-off-by: Christian Borntraeger --- hw/s390x/css.c | 26 ++++++++++++++++++++++++++ hw/s390x/trace-events | 1 + include/hw/s390x/css.h | 2 ++ target/s390x/kvm.c | 16 +++++++++++++++- 4 files changed, 44 insertions(+), 1 deletion(-) diff --git a/hw/s390x/css.c b/hw/s390x/css.c index 1fcbc84..7b82176 100644 --- a/hw/s390x/css.c +++ b/hw/s390x/css.c @@ -521,6 +521,32 @@ void css_conditional_io_interrupt(SubchDev *sch) } } =20 +int css_do_sic(CPUS390XState *env, uint8_t isc, uint16_t mode) +{ + S390FLICState *fs =3D s390_get_flic(); + S390FLICStateClass *fsc =3D S390_FLIC_COMMON_GET_CLASS(fs); + int r; + + if (env->psw.mask & PSW_MASK_PSTATE) { + r =3D -PGM_PRIVILEGED; + goto out; + } + + trace_css_do_sic(mode, isc); + switch (mode) { + case SIC_IRQ_MODE_ALL: + case SIC_IRQ_MODE_SINGLE: + break; + default: + r =3D -PGM_OPERAND; + goto out; + } + + r =3D fsc->modify_ais_mode(fs, isc, mode) ? -PGM_OPERATION : 0; +out: + return r; +} + void css_adapter_interrupt(uint8_t isc) { uint32_t io_int_word =3D (isc << 27) | IO_INT_WORD_AI; diff --git a/hw/s390x/trace-events b/hw/s390x/trace-events index 84ea964..f07e974 100644 --- a/hw/s390x/trace-events +++ b/hw/s390x/trace-events @@ -8,6 +8,7 @@ css_new_image(uint8_t cssid, const char *default_cssid) "CS= S: add css image %02x css_assign_subch(const char *do_assign, uint8_t cssid, uint8_t ssid, uint1= 6_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 (intpa= rm %08x, isc %x) %s" css_adapter_interrupt(uint8_t isc) "CSS: adapter I/O interrupt (isc %x)" +css_do_sic(uint16_t mode, uint8_t isc) "CSS: set interruption mode %x on i= sc %x" =20 # hw/s390x/virtio-ccw.c virtio_ccw_interpret_ccw(int cssid, int ssid, int schid, int cmd_code) "VI= RTIO-CCW: %x.%x.%04x: interpret command %x" diff --git a/include/hw/s390x/css.h b/include/hw/s390x/css.h index e028960..5ee6d52 100644 --- a/include/hw/s390x/css.h +++ b/include/hw/s390x/css.h @@ -12,6 +12,7 @@ #ifndef CSS_H #define CSS_H =20 +#include "cpu.h" #include "hw/s390x/adapter.h" #include "hw/s390x/s390_flic.h" #include "hw/s390x/ioinst.h" @@ -165,6 +166,7 @@ typedef enum { CSS_IO_ADAPTER_TYPE_NUMS, } CssIoAdapterType; =20 +int css_do_sic(CPUS390XState *env, uint8_t isc, uint16_t mode); uint32_t css_get_adapter_id(CssIoAdapterType type, uint8_t isc); void css_register_io_adapters(CssIoAdapterType type, bool swap, bool maska= ble, uint8_t flags, Error **errp); diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index 7a2a7c0..78ebe83 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -1206,7 +1206,21 @@ static int kvm_stpcifc_service_call(S390CPU *cpu, st= ruct kvm_run *run) =20 static int kvm_sic_service_call(S390CPU *cpu, struct kvm_run *run) { - /* NOOP */ + CPUS390XState *env =3D &cpu->env; + uint8_t r1 =3D (run->s390_sieic.ipa & 0x00f0) >> 4; + uint8_t r3 =3D run->s390_sieic.ipa & 0x000f; + uint8_t isc; + uint16_t mode; + int r; + + cpu_synchronize_state(CPU(cpu)); + mode =3D env->regs[r1] & 0xffff; + isc =3D (env->regs[r3] >> 27) & 0x7; + r =3D css_do_sic(env, isc, mode); + if (r) { + enter_pgmcheck(cpu, -r); + } + return 0; } =20 --=20 2.7.4