From patchwork Fri Nov 2 10:30:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Morel X-Patchwork-Id: 10665255 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D648B14BD for ; Fri, 2 Nov 2018 10:35:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B89AF2B619 for ; Fri, 2 Nov 2018 10:35:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ACB032B948; Fri, 2 Nov 2018 10:35:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 477BF2B619 for ; Fri, 2 Nov 2018 10:35:30 +0000 (UTC) Received: from localhost ([::1]:50669 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gIWnZ-0006YI-HG for patchwork-qemu-devel@patchwork.kernel.org; Fri, 02 Nov 2018 06:35:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39684) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gIWj6-0001so-4e for qemu-devel@nongnu.org; Fri, 02 Nov 2018 06:30:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gIWj3-0004I6-3s for qemu-devel@nongnu.org; Fri, 02 Nov 2018 06:30:51 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:60134 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gIWj2-0004BO-Rs for qemu-devel@nongnu.org; Fri, 02 Nov 2018 06:30:49 -0400 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wA2ATg7d031795 for ; Fri, 2 Nov 2018 06:30:36 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0b-001b2d01.pphosted.com with ESMTP id 2nghj988x5-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 02 Nov 2018 06:30:36 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 2 Nov 2018 10:30:33 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 2 Nov 2018 10:30:29 -0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wA2AURuD49873014 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 2 Nov 2018 10:30:27 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A173611C04C; Fri, 2 Nov 2018 10:30:27 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 51C5011C050; Fri, 2 Nov 2018 10:30:27 +0000 (GMT) Received: from morel-ThinkPad-W530.boeblingen.de.ibm.com (unknown [9.152.224.73]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 2 Nov 2018 10:30:27 +0000 (GMT) From: Pierre Morel To: borntraeger@de.ibm.com Date: Fri, 2 Nov 2018 11:30:20 +0100 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1541154621-22423-1-git-send-email-pmorel@linux.ibm.com> References: <1541154621-22423-1-git-send-email-pmorel@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18110210-0020-0000-0000-000002DEA4F5 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18110210-0021-0000-0000-0000212E0743 Message-Id: <1541154621-22423-5-git-send-email-pmorel@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-11-02_06:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1811020099 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH v1 4/5] s390x/vfio: ap: Intercepting AP Queue Interrupt Control 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: akrowiak@linux.ibm.com, peter.maydell@linaro.org, david@redhat.com, cohuck@redhat.com, qemu-devel@nongnu.org, agraf@suse.de, pasic@linux.ibm.com, eric.auger@redhat.com, qemu-s390x@nongnu.org, mst@redhat.com, pbonzini@redhat.com, rth@twiddle.net Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Pierre Morel We intercept the PQAP(AQIC) instruction. Until we implement AQIC we return a PGM_OPERATION. Signed-off-by: Pierre Morel --- hw/vfio/ap.c | 10 ++++++++++ include/hw/s390x/ap-device.h | 9 +++++++++ target/s390x/kvm.c | 20 ++++++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c index 3962bb74e5..d8d9cadc46 100644 --- a/hw/vfio/ap.c +++ b/hw/vfio/ap.c @@ -38,6 +38,16 @@ typedef struct VFIOAPDevice { #define VFIO_AP_DEVICE(obj) \ OBJECT_CHECK(VFIOAPDevice, (obj), VFIO_AP_DEVICE_TYPE) +/* + * ap_pqap + * @env: environment pointing to registers + * return value: Code Condition + */ +int ap_pqap(CPUS390XState *env) +{ + return -PGM_OPERATION; +} + static void vfio_ap_compute_needs_reset(VFIODevice *vdev) { vdev->needs_reset = false; diff --git a/include/hw/s390x/ap-device.h b/include/hw/s390x/ap-device.h index 765e9082a3..a83ea096c7 100644 --- a/include/hw/s390x/ap-device.h +++ b/include/hw/s390x/ap-device.h @@ -19,4 +19,13 @@ typedef struct APDevice { #define AP_DEVICE(obj) \ OBJECT_CHECK(APDevice, (obj), AP_DEVICE_TYPE) +#define AP_DEVICE_GET_CLASS(obj) \ + OBJECT_GET_CLASS(APDeviceClass, (obj), AP_DEVICE_TYPE) + +#define AP_DEVICE_CLASS(klass) \ + OBJECT_CLASS_CHECK(APDeviceClass, (klass), AP_DEVICE_TYPE) + +#include "cpu.h" +int ap_pqap(CPUS390XState *env); + #endif /* HW_S390X_AP_DEVICE_H */ diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index 2ebf26adfe..3eac59549d 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -45,6 +45,7 @@ #include "trace.h" #include "hw/s390x/s390-pci-inst.h" #include "hw/s390x/s390-pci-bus.h" +#include "hw/s390x/ap-device.h" #include "hw/s390x/ipl.h" #include "hw/s390x/ebcdic.h" #include "exec/memattrs.h" @@ -88,6 +89,7 @@ #define PRIV_B2_CHSC 0x5f #define PRIV_B2_SIGA 0x74 #define PRIV_B2_XSCH 0x76 +#define PRIV_B2_PQAP 0xaf #define PRIV_EB_SQBS 0x8a #define PRIV_EB_PCISTB 0xd0 @@ -1154,6 +1156,21 @@ static int kvm_sclp_service_call(S390CPU *cpu, struct kvm_run *run, return 0; } +static int kvm_ap_pqap(S390CPU *cpu, uint16_t ipbh0) +{ + int r; + + r = ap_pqap(&cpu->env); + + if (r < 0) { + kvm_s390_program_interrupt(cpu, -r); + } else { + setcc(cpu, r); + } + + return 0; +} + static int handle_b2(S390CPU *cpu, struct kvm_run *run, uint8_t ipa1) { CPUS390XState *env = &cpu->env; @@ -1216,6 +1233,9 @@ static int handle_b2(S390CPU *cpu, struct kvm_run *run, uint8_t ipa1) case PRIV_B2_SCLP_CALL: rc = kvm_sclp_service_call(cpu, run, ipbh0); break; + case PRIV_B2_PQAP: + rc = kvm_ap_pqap(cpu, ipbh0); + break; default: rc = -1; DPRINTF("KVM: unhandled PRIV: 0xb2%x\n", ipa1);