From nobody Sat May 11 07:09:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1601640836; cv=none; d=zohomail.com; s=zohoarc; b=LYE41GCjeJEgNY11YK1kClXaA2LtQZ4eZo4lnD9+SL1JWtKajiqyoT4w0jlSc2YOYNfQ8tFwK82seulwHK66hmOTaB3o9J0++0kk4y5xNjFNiRXY3ztJUwqWRQSvTtPlU2azm533BjsYEFEQhJ7nqBBMNNOcdQFmEp/qqUL8Nzs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601640836; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=HHii4DQCSQq9+/hRg+o4bp6H4E8SHekM9A1ehq6aXaE=; b=aw2IB82tGoa+Y7DZyEO18W8Nq5pDv0RL4CbTWFTeAhzlKLyrDYvz6CcqKJ3GjJthYsPeXOVL9T+PMhzpKMtbFjleYhZUHPCn90XkwVjxqvye6HZf1TXJzRH0dLiBRpTfdvZZAER65GbavzSvwYvH7G4RjnirlnKvZvm2jX6ovsI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1601640836266330.42525172374906; Fri, 2 Oct 2020 05:13:56 -0700 (PDT) Received: from localhost ([::1]:51788 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kOJwg-0005c5-Lx for importer@patchew.org; Fri, 02 Oct 2020 08:13:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56602) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kOJug-0003rL-Bl for qemu-devel@nongnu.org; Fri, 02 Oct 2020 08:11:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:57218) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kOJud-0003Np-8g for qemu-devel@nongnu.org; Fri, 02 Oct 2020 08:11:50 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-37-jVOh71j4M1K8pThhrEjW_A-1; Fri, 02 Oct 2020 08:11:25 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 970A81005530; Fri, 2 Oct 2020 12:11:24 +0000 (UTC) Received: from localhost (ovpn-112-216.ams2.redhat.com [10.36.112.216]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3D6B160C05; Fri, 2 Oct 2020 12:11:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601640690; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HHii4DQCSQq9+/hRg+o4bp6H4E8SHekM9A1ehq6aXaE=; b=Nhw72aIPy4bg2SSbLiZhOQ8imYX6Jqt+NhUdMoFOwyP68AGObZuNqRnLEMLouammvQofjZ chZlROKXsBwOlFxSTRiccJP3uuB3ZAAoGLsGx1Cnv6d+M23xgYJPDLeTuybkGOEs6SxNOj pPIT70a+Nmih8i2nu8SFxMyxJ8hJReY= X-MC-Unique: jVOh71j4M1K8pThhrEjW_A-1 From: Cornelia Huck To: Peter Maydell Subject: [PULL 01/19] hw/s390x/css: Remove double initialization Date: Fri, 2 Oct 2020 14:11:00 +0200 Message-Id: <20201002121118.180315-2-cohuck@redhat.com> In-Reply-To: <20201002121118.180315-1-cohuck@redhat.com> References: <20201002121118.180315-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=cohuck@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=cohuck@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/02 01:13:31 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , qemu-s390x@nongnu.org, Cornelia Huck , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Philippe Mathieu-Daud=C3=A9 Fix eventual copy/paste mistake introduced in commit bc994b74ea ("s390x/css: Use static initialization for channel_subsys fields"). Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Thomas Huth Message-Id: <20200907024020.854465-1-philmd@redhat.com> Signed-off-by: Cornelia Huck --- hw/s390x/css.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/s390x/css.c b/hw/s390x/css.c index 519dc91316d7..9961cfe7bf67 100644 --- a/hw/s390x/css.c +++ b/hw/s390x/css.c @@ -353,7 +353,6 @@ static ChannelSubSys channel_subsys =3D { .pending_crws =3D QTAILQ_HEAD_INITIALIZER(channel_subsys.pending_crws), .do_crw_mchk =3D true, .sei_pending =3D false, - .do_crw_mchk =3D true, .crws_lost =3D false, .chnmon_active =3D false, .indicator_addresses =3D --=20 2.25.4 From nobody Sat May 11 07:09:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1601641088; cv=none; d=zohomail.com; s=zohoarc; b=MPiUlSZN/ShrNhORYvEk8+ErCcAmFEZX4hVfH2XuE57+Fg9EtDMF/L4si6rIGEtw59vXMrpPoQaBhZCNFi/cTGIwCYXivtwLlo2NBelARh5yUidWLf4uPVVK0o5ztupvSad4cO1XXdWpS8XhUAGIMm5WSpgFgh2ow+NP0AttD9k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601641088; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=kv32205fTbXd7bSoM1c0KKvgWJtfChslxWXaK/dr3/U=; b=dt70d8NXE+lnLq01cQi0pPxn8DcMZaY6qd5LxtikneDZp8fHZ3wIg0su400+Ml2omUqM/cdxUMz3bWPPRqoygFtAe1DnefvZwJ6dI6JQtQwuzDEGUp6+PCVr/zjBK0XIXIWe/5HSrRu6ySeVijlYI+cpeZI+WeAwLLpNYLH9izw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1601641088211963.1747697438078; Fri, 2 Oct 2020 05:18:08 -0700 (PDT) Received: from localhost ([::1]:59452 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kOK0l-0000Ym-0V for importer@patchew.org; Fri, 02 Oct 2020 08:18:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56688) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kOJuw-0003wU-CV for qemu-devel@nongnu.org; Fri, 02 Oct 2020 08:12:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:55431) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kOJud-0003PG-8i for qemu-devel@nongnu.org; Fri, 02 Oct 2020 08:11:59 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-23-2AL4nSUIM_aw4mHtAPiHNQ-1; Fri, 02 Oct 2020 08:11:30 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 762A61DDFB; Fri, 2 Oct 2020 12:11:29 +0000 (UTC) Received: from localhost (ovpn-112-216.ams2.redhat.com [10.36.112.216]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 538D110023A5; Fri, 2 Oct 2020 12:11:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601640693; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kv32205fTbXd7bSoM1c0KKvgWJtfChslxWXaK/dr3/U=; b=bgyQ5h+DH8UcO1vuI7Aba5h7piL7KeLtOUoj4frAskIH0f+k2mw9WC5mK3DDjean2xEtAn 07vgkAdznYqLp3ikaavawcMxCSio4PZ78LDgCspWUrwMVKqX4aV71vIj1W2XTHOqmIw07x rkmwoYM7Z7OXNTCQztn6q6r2n3PmYLM= X-MC-Unique: 2AL4nSUIM_aw4mHtAPiHNQ-1 From: Cornelia Huck To: Peter Maydell Subject: [PULL 02/19] s390/sclp: get machine once during read scp/cpu info Date: Fri, 2 Oct 2020 14:11:01 +0200 Message-Id: <20201002121118.180315-3-cohuck@redhat.com> In-Reply-To: <20201002121118.180315-1-cohuck@redhat.com> References: <20201002121118.180315-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=cohuck@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=cohuck@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/02 01:13:31 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , Janosch Frank , David Hildenbrand , Cornelia Huck , qemu-devel@nongnu.org, qemu-s390x@nongnu.org, Claudio Imbrenda , Collin Walling Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Collin Walling Functions within read scp/cpu info will need access to the machine state. Let's make a call to retrieve the machine state once and pass the appropriate data to the respective functions. Signed-off-by: Collin Walling Reviewed-by: David Hildenbrand Reviewed-by: Thomas Huth Reviewed-by: Janosch Frank Reviewed-by: Cornelia Huck Reviewed-by: Claudio Imbrenda Message-Id: <20200915194416.107460-2-walling@linux.ibm.com> Signed-off-by: Cornelia Huck --- hw/s390x/sclp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c index a0ce444b4bf2..28b973de8fd2 100644 --- a/hw/s390x/sclp.c +++ b/hw/s390x/sclp.c @@ -49,9 +49,8 @@ static inline bool sclp_command_code_valid(uint32_t code) return false; } =20 -static void prepare_cpu_entries(SCLPDevice *sclp, CPUEntry *entry, int *co= unt) +static void prepare_cpu_entries(MachineState *ms, CPUEntry *entry, int *co= unt) { - MachineState *ms =3D MACHINE(qdev_get_machine()); uint8_t features[SCCB_CPU_FEATURE_LEN] =3D { 0 }; int i; =20 @@ -77,7 +76,7 @@ static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb) IplParameterBlock *ipib =3D s390_ipl_get_iplb(); =20 /* CPU information */ - prepare_cpu_entries(sclp, read_info->entries, &cpu_count); + prepare_cpu_entries(machine, read_info->entries, &cpu_count); read_info->entries_cpu =3D cpu_to_be16(cpu_count); read_info->offset_cpu =3D cpu_to_be16(offsetof(ReadInfo, entries)); read_info->highest_cpu =3D cpu_to_be16(machine->smp.max_cpus - 1); @@ -132,10 +131,11 @@ static void read_SCP_info(SCLPDevice *sclp, SCCB *scc= b) /* Provide information about the CPU */ static void sclp_read_cpu_info(SCLPDevice *sclp, SCCB *sccb) { + MachineState *machine =3D MACHINE(qdev_get_machine()); ReadCpuInfo *cpu_info =3D (ReadCpuInfo *) sccb; int cpu_count; =20 - prepare_cpu_entries(sclp, cpu_info->entries, &cpu_count); + prepare_cpu_entries(machine, cpu_info->entries, &cpu_count); cpu_info->nr_configured =3D cpu_to_be16(cpu_count); cpu_info->offset_configured =3D cpu_to_be16(offsetof(ReadCpuInfo, entr= ies)); cpu_info->nr_standby =3D cpu_to_be16(0); --=20 2.25.4 From nobody Sat May 11 07:09:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1601640928; cv=none; d=zohomail.com; s=zohoarc; b=OEpyDE7fFAPXqaE389wJgao/OsHYgWDrwMVGm9sbUO9e4afajpTNYG6MZvs1EtcabF55G7Q9Ze2IOUVBSlvQIwbEpLdurCaZLwrnolPt7u6Hk3TxvFTBEVPXmbVm6NftLl56+7qncJ5iv9zzmT9YHdMKlxLQ44CmstjLBR9SVFo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601640928; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=DcBc14UyWCXi47xxebHw1vNpkt7VDIrA7FjAieHhV/o=; b=foOv7PhNKyJnbSzf6WJZf7WsTuxpRO0Hiwc+p89a4scsOkVbx8C7YhLIJJB17gggAWdhQ+6gGkhplLZIXs6avXC1xewTIJ6PpznBAhsLTUIHZo5YHrtgJb6o/qAAFEycGadJe4r6MMP+FmPSlc43f0phvaexWCVrApeYZdFlo14= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1601640928218236.52986338770665; Fri, 2 Oct 2020 05:15:28 -0700 (PDT) Received: from localhost ([::1]:55576 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kOJy9-0007Cw-VU for importer@patchew.org; Fri, 02 Oct 2020 08:15:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56766) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kOJv5-00040Y-6w for qemu-devel@nongnu.org; Fri, 02 Oct 2020 08:12:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:46973) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kOJue-0003PV-Lz for qemu-devel@nongnu.org; Fri, 02 Oct 2020 08:12:11 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-524-mHrx6VcGNIm2MaKJTQ_Ntw-1; Fri, 02 Oct 2020 08:11:32 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 819E01DE08; Fri, 2 Oct 2020 12:11:31 +0000 (UTC) Received: from localhost (ovpn-112-216.ams2.redhat.com [10.36.112.216]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 26EAA5C1D0; Fri, 2 Oct 2020 12:11:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601640696; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DcBc14UyWCXi47xxebHw1vNpkt7VDIrA7FjAieHhV/o=; b=bIsKVUiTVjOLsPAv3q5OXyq5NRw5NbO2G2B9Pi9HvdQ8et5zLOBX24UZujjCIrFqvV9tNd EfEeXyfppxMGpLfIFjk3Rh1RqHdgfvReAbWiS7F3SVj2rwapVx/Q8idJGYPbGhsUpsG5XA iJZa7SVALlbIxs5cNHHgixX7B35HsOs= X-MC-Unique: mHrx6VcGNIm2MaKJTQ_Ntw-1 From: Cornelia Huck To: Peter Maydell Subject: [PULL 03/19] s390/sclp: rework sclp boundary checks Date: Fri, 2 Oct 2020 14:11:02 +0200 Message-Id: <20201002121118.180315-4-cohuck@redhat.com> In-Reply-To: <20201002121118.180315-1-cohuck@redhat.com> References: <20201002121118.180315-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=cohuck@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=cohuck@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/01 23:37:29 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , Janosch Frank , Cornelia Huck , qemu-devel@nongnu.org, qemu-s390x@nongnu.org, Claudio Imbrenda , Collin Walling Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Collin Walling Rework the SCLP boundary check to account for different SCLP commands (eventually) allowing different boundary sizes. Signed-off-by: Collin Walling Reviewed-by: Cornelia Huck Reviewed-by: Thomas Huth Acked-by: Janosch Frank Reviewed-by: Claudio Imbrenda Message-Id: <20200915194416.107460-3-walling@linux.ibm.com> Signed-off-by: Cornelia Huck --- hw/s390x/sclp.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c index 28b973de8fd2..a37cfbf534cd 100644 --- a/hw/s390x/sclp.c +++ b/hw/s390x/sclp.c @@ -49,6 +49,18 @@ static inline bool sclp_command_code_valid(uint32_t code) return false; } =20 +static bool sccb_verify_boundary(uint64_t sccb_addr, uint16_t sccb_len) +{ + uint64_t sccb_max_addr =3D sccb_addr + sccb_len - 1; + uint64_t sccb_boundary =3D (sccb_addr & PAGE_MASK) + PAGE_SIZE; + + if (sccb_max_addr < sccb_boundary) { + return true; + } + + return false; +} + static void prepare_cpu_entries(MachineState *ms, CPUEntry *entry, int *co= unt) { uint8_t features[SCCB_CPU_FEATURE_LEN] =3D { 0 }; @@ -229,6 +241,11 @@ int sclp_service_call_protected(CPUS390XState *env, ui= nt64_t sccb, goto out_write; } =20 + if (!sccb_verify_boundary(sccb, be16_to_cpu(work_sccb.h.length))) { + work_sccb.h.response_code =3D cpu_to_be16(SCLP_RC_SCCB_BOUNDARY_VI= OLATION); + goto out_write; + } + sclp_c->execute(sclp, &work_sccb, code); out_write: s390_cpu_pv_mem_write(env_archcpu(env), 0, &work_sccb, @@ -274,7 +291,7 @@ int sclp_service_call(CPUS390XState *env, uint64_t sccb= , uint32_t code) goto out_write; } =20 - if ((sccb + be16_to_cpu(work_sccb.h.length)) > ((sccb & PAGE_MASK) + P= AGE_SIZE)) { + if (!sccb_verify_boundary(sccb, be16_to_cpu(work_sccb.h.length))) { work_sccb.h.response_code =3D cpu_to_be16(SCLP_RC_SCCB_BOUNDARY_VI= OLATION); goto out_write; } --=20 2.25.4 From nobody Sat May 11 07:09:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1601641248; cv=none; d=zohomail.com; s=zohoarc; b=Ka5a092WBFmJYLZgIsB/d9PRNyqIP339ZApAQ2lhsUgS04Pm4O/98OD0TRw7TcwhlHpKKkDS7D57QI5PXhVlFc0G0zdD5VBZYg8B+BB2NOrGdMCDjgQ8jiVga0CvUecIzibbdmDbvuPkGmxn2RiOuKSNPqev010/i25qNPgfZKM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601641248; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Tbj1u8uW6H73Lq4XOm8md4dGxbv6a164Fz6/bA8zMrY=; b=C9GuzR2jHuqTHmi1kKtYXWMctr0yY302OLnIIH4RLHQdOoZTh4IQixxOH9hW0jHMRdgW4M3lUsAryJP0D3KLhDkl6DtlqV9DjD8oIym8MrTAoNaxo7oRCERlbUjvtjSpmKtcBEFhH0yjw6V62DIOmVCd+0EkgRoP6ZCWfzsCvNg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1601641248496181.30567622398394; Fri, 2 Oct 2020 05:20:48 -0700 (PDT) Received: from localhost ([::1]:37384 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kOK3L-0003Ew-7z for importer@patchew.org; Fri, 02 Oct 2020 08:20:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56722) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kOJuz-0003zI-OI for qemu-devel@nongnu.org; Fri, 02 Oct 2020 08:12:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:51176) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kOJud-0003Pk-8g for qemu-devel@nongnu.org; Fri, 02 Oct 2020 08:12:04 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-57-c80II4jGNkG7cZPo_SUH-w-1; Fri, 02 Oct 2020 08:11:34 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9DCE5802B75; Fri, 2 Oct 2020 12:11:33 +0000 (UTC) Received: from localhost (ovpn-112-216.ams2.redhat.com [10.36.112.216]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3EB3219C66; Fri, 2 Oct 2020 12:11:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601640698; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Tbj1u8uW6H73Lq4XOm8md4dGxbv6a164Fz6/bA8zMrY=; b=artp2n9zmLd5xl6xLO65d3Z8BR43dJ1w1veIIFABdcWTm7dFJAXVeHoak1/zDfplFoDLBP ibld06vhIc60u1ke+dtwr/jz5StmetGV/5b/DaU6RuIWqbsiKcuJfg2SOHwCHMTDunEf2c QSWIeokhEAr3WYNDXfOAREPOy7xPkH8= X-MC-Unique: c80II4jGNkG7cZPo_SUH-w-1 From: Cornelia Huck To: Peter Maydell Subject: [PULL 04/19] s390/sclp: read sccb from mem based on provided length Date: Fri, 2 Oct 2020 14:11:03 +0200 Message-Id: <20201002121118.180315-5-cohuck@redhat.com> In-Reply-To: <20201002121118.180315-1-cohuck@redhat.com> References: <20201002121118.180315-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=cohuck@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=cohuck@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/02 01:13:31 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , Cornelia Huck , qemu-devel@nongnu.org, qemu-s390x@nongnu.org, Claudio Imbrenda , Collin Walling Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Collin Walling The header contained within the SCCB passed to the SCLP service call contains the actual length of the SCCB. Instead of allocating a static 4K size for the work sccb, let's allow for a variable size determined by the value in the header. The proper checks are already in place to ensure the SCCB length is sufficent to store a full response and that the length does not cross any explicitly-set boundaries. Signed-off-by: Collin Walling Reviewed-by: Thomas Huth Reviewed-by: Claudio Imbrenda Message-Id: <20200915194416.107460-4-walling@linux.ibm.com> Signed-off-by: Cornelia Huck --- hw/s390x/event-facility.c | 2 +- hw/s390x/sclp.c | 55 ++++++++++++++++++++++----------------- include/hw/s390x/sclp.h | 2 +- 3 files changed, 33 insertions(+), 26 deletions(-) diff --git a/hw/s390x/event-facility.c b/hw/s390x/event-facility.c index 645b4080c5b9..ed92ce510d9e 100644 --- a/hw/s390x/event-facility.c +++ b/hw/s390x/event-facility.c @@ -213,7 +213,7 @@ static uint16_t handle_sccb_read_events(SCLPEventFacili= ty *ef, SCCB *sccb, =20 event_buf =3D &red->ebh; event_buf->length =3D 0; - slen =3D sizeof(sccb->data); + slen =3D sccb_data_len(sccb); =20 rc =3D SCLP_RC_NO_EVENT_BUFFERS_STORED; =20 diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c index a37cfbf534cd..4ae6fb400b40 100644 --- a/hw/s390x/sclp.c +++ b/hw/s390x/sclp.c @@ -231,25 +231,29 @@ int sclp_service_call_protected(CPUS390XState *env, u= int64_t sccb, { SCLPDevice *sclp =3D get_sclp_device(); SCLPDeviceClass *sclp_c =3D SCLP_GET_CLASS(sclp); - SCCB work_sccb; - hwaddr sccb_len =3D sizeof(SCCB); + SCCBHeader header; + g_autofree SCCB *work_sccb =3D NULL; =20 - s390_cpu_pv_mem_read(env_archcpu(env), 0, &work_sccb, sccb_len); + s390_cpu_pv_mem_read(env_archcpu(env), 0, &header, sizeof(SCCBHeader)); + + work_sccb =3D g_malloc0(be16_to_cpu(header.length)); + s390_cpu_pv_mem_read(env_archcpu(env), 0, work_sccb, + be16_to_cpu(header.length)); =20 if (!sclp_command_code_valid(code)) { - work_sccb.h.response_code =3D cpu_to_be16(SCLP_RC_INVALID_SCLP_COM= MAND); + work_sccb->h.response_code =3D cpu_to_be16(SCLP_RC_INVALID_SCLP_CO= MMAND); goto out_write; } =20 - if (!sccb_verify_boundary(sccb, be16_to_cpu(work_sccb.h.length))) { - work_sccb.h.response_code =3D cpu_to_be16(SCLP_RC_SCCB_BOUNDARY_VI= OLATION); + if (!sccb_verify_boundary(sccb, be16_to_cpu(work_sccb->h.length))) { + work_sccb->h.response_code =3D cpu_to_be16(SCLP_RC_SCCB_BOUNDARY_V= IOLATION); goto out_write; } =20 - sclp_c->execute(sclp, &work_sccb, code); + sclp_c->execute(sclp, work_sccb, code); out_write: - s390_cpu_pv_mem_write(env_archcpu(env), 0, &work_sccb, - be16_to_cpu(work_sccb.h.length)); + s390_cpu_pv_mem_write(env_archcpu(env), 0, work_sccb, + be16_to_cpu(work_sccb->h.length)); sclp_c->service_interrupt(sclp, SCLP_PV_DUMMY_ADDR); return 0; } @@ -258,9 +262,8 @@ int sclp_service_call(CPUS390XState *env, uint64_t sccb= , uint32_t code) { SCLPDevice *sclp =3D get_sclp_device(); SCLPDeviceClass *sclp_c =3D SCLP_GET_CLASS(sclp); - SCCB work_sccb; - - hwaddr sccb_len =3D sizeof(SCCB); + SCCBHeader header; + g_autofree SCCB *work_sccb =3D NULL; =20 /* first some basic checks on program checks */ if (env->psw.mask & PSW_MASK_PSTATE) { @@ -274,32 +277,36 @@ int sclp_service_call(CPUS390XState *env, uint64_t sc= cb, uint32_t code) return -PGM_SPECIFICATION; } =20 + /* the header contains the actual length of the sccb */ + cpu_physical_memory_read(sccb, &header, sizeof(SCCBHeader)); + + /* Valid sccb sizes */ + if (be16_to_cpu(header.length) < sizeof(SCCBHeader)) { + return -PGM_SPECIFICATION; + } + /* * we want to work on a private copy of the sccb, to prevent guests * from playing dirty tricks by modifying the memory content after * the host has checked the values */ - cpu_physical_memory_read(sccb, &work_sccb, sccb_len); - - /* Valid sccb sizes */ - if (be16_to_cpu(work_sccb.h.length) < sizeof(SCCBHeader)) { - return -PGM_SPECIFICATION; - } + work_sccb =3D g_malloc0(be16_to_cpu(header.length)); + cpu_physical_memory_read(sccb, work_sccb, be16_to_cpu(header.length)); =20 if (!sclp_command_code_valid(code)) { - work_sccb.h.response_code =3D cpu_to_be16(SCLP_RC_INVALID_SCLP_COM= MAND); + work_sccb->h.response_code =3D cpu_to_be16(SCLP_RC_INVALID_SCLP_CO= MMAND); goto out_write; } =20 - if (!sccb_verify_boundary(sccb, be16_to_cpu(work_sccb.h.length))) { - work_sccb.h.response_code =3D cpu_to_be16(SCLP_RC_SCCB_BOUNDARY_VI= OLATION); + if (!sccb_verify_boundary(sccb, be16_to_cpu(work_sccb->h.length))) { + work_sccb->h.response_code =3D cpu_to_be16(SCLP_RC_SCCB_BOUNDARY_V= IOLATION); goto out_write; } =20 - sclp_c->execute(sclp, &work_sccb, code); + sclp_c->execute(sclp, work_sccb, code); out_write: - cpu_physical_memory_write(sccb, &work_sccb, - be16_to_cpu(work_sccb.h.length)); + cpu_physical_memory_write(sccb, work_sccb, + be16_to_cpu(work_sccb->h.length)); =20 sclp_c->service_interrupt(sclp, sccb); =20 diff --git a/include/hw/s390x/sclp.h b/include/hw/s390x/sclp.h index cd730772f94b..374ea83e7811 100644 --- a/include/hw/s390x/sclp.h +++ b/include/hw/s390x/sclp.h @@ -178,7 +178,7 @@ typedef struct IoaCfgSccb { =20 typedef struct SCCB { SCCBHeader h; - char data[SCCB_DATA_LEN]; + char data[]; } QEMU_PACKED SCCB; =20 #define TYPE_SCLP "sclp" --=20 2.25.4 From nobody Sat May 11 07:09:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1601641097; cv=none; d=zohomail.com; s=zohoarc; b=Fnf3M1eb7PHW3XMG/Jkz1hHWs3sa3R7NigHV8GhtY2qPm17RiYxoijYsGLRUtqgdaBV8S86f6dvqInw7DZYSz0iqpQeNDcXHb3E6ofA3JWKNC4jmeTELnVt4TjXUEdno8JwQIXAkU+oNtT0ROEDSwKNm7ONnXSyOeyHU4J/uJEA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601641097; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=G2xhT7syXzz3rk5fFDEFlekGdnSQCQMc7jIOHykHsno=; b=CZuwQDPmE2EZNxlkLsgB8VQnh7ChDyYuo9G7xl98NxkNarKRTVH/hsMHHDjPgdEAS+vsh4yba35XOG+YIY9x6OygIlBz3IJzQuQxhZcjd7SsPqw/ZTzDwdAFMIzx4gdgfKdoe37pk2uAQZ2QjzVwEaer6ln0FKUAGEWsk5mxnjs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1601641097706786.1184747929278; Fri, 2 Oct 2020 05:18:17 -0700 (PDT) Received: from localhost ([::1]:59890 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kOK0u-0000kf-EH for importer@patchew.org; Fri, 02 Oct 2020 08:18:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56768) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kOJv5-00040e-8R for qemu-devel@nongnu.org; Fri, 02 Oct 2020 08:12:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:57963) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kOJue-0003Q8-Na for qemu-devel@nongnu.org; Fri, 02 Oct 2020 08:12:14 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-551-wAqQJA_1OHKDoZBAqg946g-1; Fri, 02 Oct 2020 08:11:40 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CA71F1074644; Fri, 2 Oct 2020 12:11:38 +0000 (UTC) Received: from localhost (ovpn-112-216.ams2.redhat.com [10.36.112.216]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5FD8573693; Fri, 2 Oct 2020 12:11:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601640702; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=G2xhT7syXzz3rk5fFDEFlekGdnSQCQMc7jIOHykHsno=; b=bTHoTE/JLBrMXiMUuoKwdG5PB31oKjan0iAZU+6c1kJLctifVNDOQLRDCh6d7fdym1uAPG IAfWyUDp5+EW5+OftkoLJ5s47RjUqkdyXWZieDgaxtLk5Rco7c7ELfEQ7q2gBrSeJAGjGw 0EoJqdKqEI1Cm60w+L1T+sGvwWxiDRs= X-MC-Unique: wAqQJA_1OHKDoZBAqg946g-1 From: Cornelia Huck To: Peter Maydell Subject: [PULL 05/19] s390/sclp: check sccb len before filling in data Date: Fri, 2 Oct 2020 14:11:04 +0200 Message-Id: <20201002121118.180315-6-cohuck@redhat.com> In-Reply-To: <20201002121118.180315-1-cohuck@redhat.com> References: <20201002121118.180315-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=cohuck@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=cohuck@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/02 01:13:31 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Collin Walling , Janosch Frank , David Hildenbrand , Cornelia Huck , qemu-devel@nongnu.org, qemu-s390x@nongnu.org, Thomas Huth , Claudio Imbrenda Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Collin Walling The SCCB must be checked for a sufficient length before it is filled with any data. If the length is insufficient, then the SCLP command is suppressed and the proper response code is set in the SCCB header. While we're at it, let's cleanup the length check by placing the calculation inside a macro. Fixes: 832be0d8a3bb ("s390x: sclp: Report insufficient SCCB length") Signed-off-by: Collin Walling Reviewed-by: Janosch Frank Reviewed-by: David Hildenbrand Reviewed-by: Cornelia Huck Reviewed-by: Thomas Huth Reviewed-by: Claudio Imbrenda Message-Id: <20200915194416.107460-5-walling@linux.ibm.com> Signed-off-by: Cornelia Huck --- hw/s390x/sclp.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c index 4ae6fb400b40..0d54075309d5 100644 --- a/hw/s390x/sclp.c +++ b/hw/s390x/sclp.c @@ -78,6 +78,8 @@ static void prepare_cpu_entries(MachineState *ms, CPUEntr= y *entry, int *count) } } =20 +#define SCCB_REQ_LEN(s, max_cpus) (sizeof(s) + max_cpus * sizeof(CPUEntry)) + /* Provide information about the configuration, CPUs and storage */ static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb) { @@ -86,6 +88,12 @@ static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb) int cpu_count; int rnsize, rnmax; IplParameterBlock *ipib =3D s390_ipl_get_iplb(); + int required_len =3D SCCB_REQ_LEN(ReadInfo, machine->possible_cpus->le= n); + + if (be16_to_cpu(sccb->h.length) < required_len) { + sccb->h.response_code =3D cpu_to_be16(SCLP_RC_INSUFFICIENT_SCCB_LE= NGTH); + return; + } =20 /* CPU information */ prepare_cpu_entries(machine, read_info->entries, &cpu_count); @@ -95,12 +103,6 @@ static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb) =20 read_info->ibc_val =3D cpu_to_be32(s390_get_ibc_val()); =20 - if (be16_to_cpu(sccb->h.length) < - (sizeof(ReadInfo) + cpu_count * sizeof(CPUEntry))) { - sccb->h.response_code =3D cpu_to_be16(SCLP_RC_INSUFFICIENT_SCCB_LE= NGTH); - return; - } - /* Configuration Characteristic (Extension) */ s390_get_feat_block(S390_FEAT_TYPE_SCLP_CONF_CHAR, read_info->conf_char); @@ -146,18 +148,18 @@ static void sclp_read_cpu_info(SCLPDevice *sclp, SCCB= *sccb) MachineState *machine =3D MACHINE(qdev_get_machine()); ReadCpuInfo *cpu_info =3D (ReadCpuInfo *) sccb; int cpu_count; + int required_len =3D SCCB_REQ_LEN(ReadCpuInfo, machine->possible_cpus-= >len); + + if (be16_to_cpu(sccb->h.length) < required_len) { + sccb->h.response_code =3D cpu_to_be16(SCLP_RC_INSUFFICIENT_SCCB_LE= NGTH); + return; + } =20 prepare_cpu_entries(machine, cpu_info->entries, &cpu_count); cpu_info->nr_configured =3D cpu_to_be16(cpu_count); cpu_info->offset_configured =3D cpu_to_be16(offsetof(ReadCpuInfo, entr= ies)); cpu_info->nr_standby =3D cpu_to_be16(0); =20 - if (be16_to_cpu(sccb->h.length) < - (sizeof(ReadCpuInfo) + cpu_count * sizeof(CPUEntry))) { - sccb->h.response_code =3D cpu_to_be16(SCLP_RC_INSUFFICIENT_SCCB_LE= NGTH); - return; - } - /* The standby offset is 16-byte for each CPU */ cpu_info->offset_standby =3D cpu_to_be16(cpu_info->offset_configured + cpu_info->nr_configured*sizeof(CPUEntry)); --=20 2.25.4 From nobody Sat May 11 07:09:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1601641418; cv=none; d=zohomail.com; s=zohoarc; b=MT8gXkNZKerYowYaEsUZPX6Ab3R0U2r6areFobVJRiKDCoqF5HkA+2y2TJrOqff3UWyBmppNHJHWIM0HYO8Y1rvwiiq0zuro69E9Z6VhnxIZ5nVs3D219HODc34dGijphQcqMve0WxZpYcD+CxvUSMDP4bHR/ino6TveJqhh5Ds= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601641418; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=zYdTw6wiSsSksPC2d/EHbxhpKPPuEoKsh3T6SHWkH9Y=; b=akutU6ye+5vAZeXvUXmAFXRWGj4R8WPLCsGJktgv8+K+1IpjWnKt28Dri/cWTLQY4Deu3x3yYsS9TCDBP+jaVeK4EUDzU6u47f5o0g7LRx1B1iJKbrXct2tqnmUQI7Y6VCea+iU22uDo7Df5NuIhnbX07KjSv/s/ycRJrt+fE1E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 160164141828948.056921982150584; Fri, 2 Oct 2020 05:23:38 -0700 (PDT) Received: from localhost ([::1]:43466 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kOK65-0005xS-1D for importer@patchew.org; Fri, 02 Oct 2020 08:23:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56812) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kOJv6-00044j-VR for qemu-devel@nongnu.org; Fri, 02 Oct 2020 08:12:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:34059) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kOJue-0003QQ-Om for qemu-devel@nongnu.org; Fri, 02 Oct 2020 08:12:16 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-406-85Li0ZK6NZe6-sOYk-xTIQ-1; Fri, 02 Oct 2020 08:11:42 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 085311074647; Fri, 2 Oct 2020 12:11:41 +0000 (UTC) Received: from localhost (ovpn-112-216.ams2.redhat.com [10.36.112.216]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9FAF460C05; Fri, 2 Oct 2020 12:11:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601640704; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zYdTw6wiSsSksPC2d/EHbxhpKPPuEoKsh3T6SHWkH9Y=; b=T6Wx03ResrvY1wxOOZXOVY/lTUAAfvvta/w/7ZpgLGMJewQT2Ua9tT5Iz5A38qEx9HfuHD JxXiWXgHB4AAII5ERQvqxBcPiXvd//MKqGevrugmVSKJala7a1GpfsYO1w2ir1jdhOYTij Jtpf4JX/8UDzocFcTkzyXKFVp6J6RF0= X-MC-Unique: 85Li0ZK6NZe6-sOYk-xTIQ-1 From: Cornelia Huck To: Peter Maydell Subject: [PULL 06/19] s390/sclp: use cpu offset to locate cpu entries Date: Fri, 2 Oct 2020 14:11:05 +0200 Message-Id: <20201002121118.180315-7-cohuck@redhat.com> In-Reply-To: <20201002121118.180315-1-cohuck@redhat.com> References: <20201002121118.180315-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=cohuck@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=cohuck@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/01 23:37:29 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , Cornelia Huck , qemu-devel@nongnu.org, qemu-s390x@nongnu.org, Claudio Imbrenda , Collin Walling Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Collin Walling The start of the CPU entry region in the Read SCP Info response data is denoted by the offset_cpu field. As such, QEMU needs to begin creating entries at this address. This is in preparation for when Read SCP Info inevitably introduces new bytes that push the start of the CPUEntry field further away. Read CPU Info is unlikely to ever change, so let's not bother accounting for the offset there. Signed-off-by: Collin Walling Reviewed-by: Thomas Huth Reviewed-by: Cornelia Huck Reviewed-by: Claudio Imbrenda Message-Id: <20200915194416.107460-6-walling@linux.ibm.com> Signed-off-by: Cornelia Huck --- hw/s390x/sclp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c index 0d54075309d5..1df67c99bfb9 100644 --- a/hw/s390x/sclp.c +++ b/hw/s390x/sclp.c @@ -89,6 +89,8 @@ static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb) int rnsize, rnmax; IplParameterBlock *ipib =3D s390_ipl_get_iplb(); int required_len =3D SCCB_REQ_LEN(ReadInfo, machine->possible_cpus->le= n); + int offset_cpu =3D offsetof(ReadInfo, entries); + CPUEntry *entries_start =3D (void *)sccb + offset_cpu; =20 if (be16_to_cpu(sccb->h.length) < required_len) { sccb->h.response_code =3D cpu_to_be16(SCLP_RC_INSUFFICIENT_SCCB_LE= NGTH); @@ -96,9 +98,9 @@ static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb) } =20 /* CPU information */ - prepare_cpu_entries(machine, read_info->entries, &cpu_count); + prepare_cpu_entries(machine, entries_start, &cpu_count); read_info->entries_cpu =3D cpu_to_be16(cpu_count); - read_info->offset_cpu =3D cpu_to_be16(offsetof(ReadInfo, entries)); + read_info->offset_cpu =3D cpu_to_be16(offset_cpu); read_info->highest_cpu =3D cpu_to_be16(machine->smp.max_cpus - 1); =20 read_info->ibc_val =3D cpu_to_be32(s390_get_ibc_val()); --=20 2.25.4 From nobody Sat May 11 07:09:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1601641257; cv=none; d=zohomail.com; s=zohoarc; b=hu3J2IvH8bdgym2OMFJLCJMzlZHoRayZ61TDBvaQwycqPwozSpDeLv7PErzF+tS5kjrc7pAXXydpxK1f4UdzA9AVtzeKN2gbrpLAbtT8+4Mb2YjFVdW+poX+jVsWbyeVfmTlG5Nha4/HitAlQ0BQ8xNc1Vu7VQzIFmkPLkw35LM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601641257; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=LXl8SdrC6gJcuUf4RdSR9CPL8V4r7Zumagbz+u+q9UQ=; b=HIWF8bZ25oex2QzeSdpdIFbVMKCZzflXgqGEYS0JeoCKGgFJAf/kQ/HTXtuvzaYtKwnq2bIykOxcF5BfqHRXE1JCE0QT/eO8BZRmbMMEcLUo2ArpS7fpPxZgQ8xovqcArPkVIYdIcWgLiXQ+rHFU3ih//IgaFCqzdrfX0PZXMQ8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1601641256933848.6131492377632; Fri, 2 Oct 2020 05:20:56 -0700 (PDT) Received: from localhost ([::1]:37824 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kOK3S-0003Sg-K8 for importer@patchew.org; Fri, 02 Oct 2020 08:20:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56774) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kOJv5-00041L-JR for qemu-devel@nongnu.org; Fri, 02 Oct 2020 08:12:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:37422) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kOJuh-0003Qw-US for qemu-devel@nongnu.org; Fri, 02 Oct 2020 08:12:15 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-372-B_3ZmyXiPeir9eZqT0Wi3g-1; Fri, 02 Oct 2020 08:11:45 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7F44D1074644; Fri, 2 Oct 2020 12:11:44 +0000 (UTC) Received: from localhost (ovpn-112-216.ams2.redhat.com [10.36.112.216]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C539810013BD; Fri, 2 Oct 2020 12:11:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601640710; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LXl8SdrC6gJcuUf4RdSR9CPL8V4r7Zumagbz+u+q9UQ=; b=jM0JbT2r3ICeKcVOeinHfFENhpcIeDdjLdg5jOXJqhHvT3zKZF4593k8suNAmaHRRgYoJy 118qpHhN2nLbCvHTvw3CHT4Wg86hK8whWDoBXF8UTBiW9PuHnB6p6DTsBffeXzdEqq+9Bh wllE4Xqx3GAyEzy60wsQOIcjf4rBEzc= X-MC-Unique: B_3ZmyXiPeir9eZqT0Wi3g-1 From: Cornelia Huck To: Peter Maydell Subject: [PULL 07/19] s390/sclp: add extended-length sccb support for kvm guest Date: Fri, 2 Oct 2020 14:11:06 +0200 Message-Id: <20201002121118.180315-8-cohuck@redhat.com> In-Reply-To: <20201002121118.180315-1-cohuck@redhat.com> References: <20201002121118.180315-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=cohuck@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=cohuck@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/01 23:37:29 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , Cornelia Huck , qemu-devel@nongnu.org, qemu-s390x@nongnu.org, Claudio Imbrenda , Collin Walling Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Collin Walling As more features and facilities are added to the Read SCP Info (RSCPI) response, more space is required to store them. The space used to store these new features intrudes on the space originally used to store CPU entries. This means as more features and facilities are added to the RSCPI response, less space can be used to store CPU entries. With the Extended-Length SCCB (ELS) facility, a KVM guest can execute the RSCPI command and determine if the SCCB is large enough to store a complete reponse. If it is not large enough, then the required length will be set in the SCCB header. The caller of the SCLP command is responsible for creating a large-enough SCCB to store a complete response. Proper checking should be in place, and the caller should execute the command once-more with the large-enough SCCB. This facility also enables an extended SCCB for the Read CPU Info (RCPUI) command. When this facility is enabled, the boundary violation response cannot be a result from the RSCPI, RSCPI Forced, or RCPUI commands. In order to tolerate kernels that do not yet have full support for this feature, a "fixed" offset to the start of the CPU Entries within the Read SCP Info struct is set to allow for the original 248 max entries when this feature is disabled. Additionally, this is introduced as a CPU feature to protect the guest from migrating to a machine that does not support storing an extended SCCB. This could otherwise hinder the VM from being able to read all available CPU entries after migration (such as during re-ipl). Signed-off-by: Collin Walling Reviewed-by: Thomas Huth Acked-by: Cornelia Huck Reviewed-by: Claudio Imbrenda Message-Id: <20200915194416.107460-7-walling@linux.ibm.com> Signed-off-by: Cornelia Huck --- hw/s390x/sclp.c | 43 +++++++++++++++++++++++++---- include/hw/s390x/sclp.h | 1 + target/s390x/cpu_features_def.h.inc | 1 + target/s390x/gen-features.c | 1 + target/s390x/kvm.c | 8 ++++++ 5 files changed, 48 insertions(+), 6 deletions(-) diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c index 1df67c99bfb9..caf40f41b69e 100644 --- a/hw/s390x/sclp.c +++ b/hw/s390x/sclp.c @@ -49,13 +49,30 @@ static inline bool sclp_command_code_valid(uint32_t cod= e) return false; } =20 -static bool sccb_verify_boundary(uint64_t sccb_addr, uint16_t sccb_len) +static bool sccb_verify_boundary(uint64_t sccb_addr, uint16_t sccb_len, + uint32_t code) { uint64_t sccb_max_addr =3D sccb_addr + sccb_len - 1; uint64_t sccb_boundary =3D (sccb_addr & PAGE_MASK) + PAGE_SIZE; =20 - if (sccb_max_addr < sccb_boundary) { - return true; + switch (code & SCLP_CMD_CODE_MASK) { + case SCLP_CMDW_READ_SCP_INFO: + case SCLP_CMDW_READ_SCP_INFO_FORCED: + case SCLP_CMDW_READ_CPU_INFO: + /* + * An extended-length SCCB is only allowed for Read SCP/CPU Info a= nd + * is allowed to exceed the 4k boundary. The respective commands w= ill + * set the length field to the required length if an insufficient + * SCCB length is provided. + */ + if (s390_has_feat(S390_FEAT_EXTENDED_LENGTH_SCCB)) { + return true; + } + /* fallthrough */ + default: + if (sccb_max_addr < sccb_boundary) { + return true; + } } =20 return false; @@ -80,6 +97,12 @@ static void prepare_cpu_entries(MachineState *ms, CPUEnt= ry *entry, int *count) =20 #define SCCB_REQ_LEN(s, max_cpus) (sizeof(s) + max_cpus * sizeof(CPUEntry)) =20 +static inline bool ext_len_sccb_supported(SCCBHeader header) +{ + return s390_has_feat(S390_FEAT_EXTENDED_LENGTH_SCCB) && + header.control_mask[2] & SCLP_VARIABLE_LENGTH_RESPONSE; +} + /* Provide information about the configuration, CPUs and storage */ static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb) { @@ -89,10 +112,15 @@ static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb) int rnsize, rnmax; IplParameterBlock *ipib =3D s390_ipl_get_iplb(); int required_len =3D SCCB_REQ_LEN(ReadInfo, machine->possible_cpus->le= n); - int offset_cpu =3D offsetof(ReadInfo, entries); + int offset_cpu =3D s390_has_feat(S390_FEAT_EXTENDED_LENGTH_SCCB) ? + offsetof(ReadInfo, entries) : + SCLP_READ_SCP_INFO_FIXED_CPU_OFFSET; CPUEntry *entries_start =3D (void *)sccb + offset_cpu; =20 if (be16_to_cpu(sccb->h.length) < required_len) { + if (ext_len_sccb_supported(sccb->h)) { + sccb->h.length =3D cpu_to_be16(required_len); + } sccb->h.response_code =3D cpu_to_be16(SCLP_RC_INSUFFICIENT_SCCB_LE= NGTH); return; } @@ -153,6 +181,9 @@ static void sclp_read_cpu_info(SCLPDevice *sclp, SCCB *= sccb) int required_len =3D SCCB_REQ_LEN(ReadCpuInfo, machine->possible_cpus-= >len); =20 if (be16_to_cpu(sccb->h.length) < required_len) { + if (ext_len_sccb_supported(sccb->h)) { + sccb->h.length =3D cpu_to_be16(required_len); + } sccb->h.response_code =3D cpu_to_be16(SCLP_RC_INSUFFICIENT_SCCB_LE= NGTH); return; } @@ -249,7 +280,7 @@ int sclp_service_call_protected(CPUS390XState *env, uin= t64_t sccb, goto out_write; } =20 - if (!sccb_verify_boundary(sccb, be16_to_cpu(work_sccb->h.length))) { + if (!sccb_verify_boundary(sccb, be16_to_cpu(work_sccb->h.length), code= )) { work_sccb->h.response_code =3D cpu_to_be16(SCLP_RC_SCCB_BOUNDARY_V= IOLATION); goto out_write; } @@ -302,7 +333,7 @@ int sclp_service_call(CPUS390XState *env, uint64_t sccb= , uint32_t code) goto out_write; } =20 - if (!sccb_verify_boundary(sccb, be16_to_cpu(work_sccb->h.length))) { + if (!sccb_verify_boundary(sccb, be16_to_cpu(work_sccb->h.length), code= )) { work_sccb->h.response_code =3D cpu_to_be16(SCLP_RC_SCCB_BOUNDARY_V= IOLATION); goto out_write; } diff --git a/include/hw/s390x/sclp.h b/include/hw/s390x/sclp.h index 374ea83e7811..88fb65aef44b 100644 --- a/include/hw/s390x/sclp.h +++ b/include/hw/s390x/sclp.h @@ -111,6 +111,7 @@ typedef struct CPUEntry { uint8_t reserved1; } QEMU_PACKED CPUEntry; =20 +#define SCLP_READ_SCP_INFO_FIXED_CPU_OFFSET 128 typedef struct ReadInfo { SCCBHeader h; uint16_t rnmax; diff --git a/target/s390x/cpu_features_def.h.inc b/target/s390x/cpu_feature= s_def.h.inc index 5942f81f1659..1c04cc18f40f 100644 --- a/target/s390x/cpu_features_def.h.inc +++ b/target/s390x/cpu_features_def.h.inc @@ -97,6 +97,7 @@ DEF_FEAT(GUARDED_STORAGE, "gs", STFL, 133, "Guarded-stora= ge facility") DEF_FEAT(VECTOR_PACKED_DECIMAL, "vxpd", STFL, 134, "Vector packed decimal = facility") DEF_FEAT(VECTOR_ENH, "vxeh", STFL, 135, "Vector enhancements facility") DEF_FEAT(MULTIPLE_EPOCH, "mepoch", STFL, 139, "Multiple-epoch facility") +DEF_FEAT(EXTENDED_LENGTH_SCCB, "els", STFL, 140, "Extended-length SCCB fac= ility") DEF_FEAT(TEST_PENDING_EXT_INTERRUPTION, "tpei", STFL, 144, "Test-pending-e= xternal-interruption facility") DEF_FEAT(INSERT_REFERENCE_BITS_MULT, "irbm", STFL, 145, "Insert-reference-= bits-multiple facility") DEF_FEAT(MSA_EXT_8, "msa8-base", STFL, 146, "Message-security-assist-exten= sion-8 facility (excluding subfunctions)") diff --git a/target/s390x/gen-features.c b/target/s390x/gen-features.c index 8ddeebc54419..6857f657fbad 100644 --- a/target/s390x/gen-features.c +++ b/target/s390x/gen-features.c @@ -522,6 +522,7 @@ static uint16_t full_GEN12_GA1[] =3D { S390_FEAT_AP_QUEUE_INTERRUPT_CONTROL, S390_FEAT_AP_FACILITIES_TEST, S390_FEAT_AP, + S390_FEAT_EXTENDED_LENGTH_SCCB, }; =20 static uint16_t full_GEN12_GA2[] =3D { diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index f2f75d2a57e8..a2d5ad78f652 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -2456,6 +2456,14 @@ void kvm_s390_get_host_cpu_model(S390CPUModel *model= , Error **errp) KVM_S390_VM_CRYPTO_ENABLE_APIE)) { set_bit(S390_FEAT_AP, model->features); } + + /* + * Extended-Length SCCB is handled entirely within QEMU. + * For PV guests this is completely fenced by the Ultravisor, as Servi= ce + * Call error checking and STFLE interpretation are handled via SIE. + */ + set_bit(S390_FEAT_EXTENDED_LENGTH_SCCB, model->features); + /* strip of features that are not part of the maximum model */ bitmap_and(model->features, model->features, model->def->full_feat, S390_FEAT_MAX); --=20 2.25.4 From nobody Sat May 11 07:09:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1601640870; cv=none; d=zohomail.com; s=zohoarc; b=mfJpZVjO4InlfSm+VY45FSQJ7Oz7ExDoHtRL2P5nlz4004EbtP/9qTLAMjZmfewlD/c9ufscY7QVXdswSm6ghWy0eF9SC3OqLNtQTs/bnog6r8BRT1OxFTVNbqDjaUj0HTt4X8JqBARqu/SdNJmLMxeXNdka3L4e6D7v3BEPHFc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601640870; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=abVZ3FcABTc+KqwUm7gI/8jwP4oT5KYGo4dBwqfo9uI=; b=AFaBa3dqxj4dpWpZ7/h0PALyufLLk1cCLUu5XuREDnx7WAxwy/8LyD5AjxA9MSM6q5P/4Ps3fKuir7Gy8vMZjYHA801BC7t8QmYOIGGXcPIDq3BNVbXaguTBTkoSeQIS2tZvk7qNJuH0J3BJeThe2npUs25F/63Fwa6ftDCM+bw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1601640870466684.1669820013603; Fri, 2 Oct 2020 05:14:30 -0700 (PDT) Received: from localhost ([::1]:52666 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kOJxE-0005yP-SB for importer@patchew.org; Fri, 02 Oct 2020 08:14:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56838) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kOJv7-000473-NX for qemu-devel@nongnu.org; Fri, 02 Oct 2020 08:12:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:42641) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kOJuo-0003RU-Bd for qemu-devel@nongnu.org; Fri, 02 Oct 2020 08:12:17 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-216-cWeeJJP2PRe4kYGohsK2pA-1; Fri, 02 Oct 2020 08:11:50 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 773681DDFB; Fri, 2 Oct 2020 12:11:49 +0000 (UTC) Received: from localhost (ovpn-112-216.ams2.redhat.com [10.36.112.216]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3DCC978806; Fri, 2 Oct 2020 12:11:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601640714; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=abVZ3FcABTc+KqwUm7gI/8jwP4oT5KYGo4dBwqfo9uI=; b=CEvoE5vRC/gZozFqA4Bi8uPZjBJQnvsO+WYHmhcFE8lwRhEOkxAT+dO8E4HpDVIPT+fdEu trcWhbyHyhC40xYYJtxTgAri/lttPiWwA2SzIGvJs4s2Hm/4ZCOgYeFZpy6En2gdZNjsIh lkAvAS+74robtXBve/qG71P98Jo5wxk= X-MC-Unique: cWeeJJP2PRe4kYGohsK2pA-1 From: Cornelia Huck To: Peter Maydell Subject: [PULL 08/19] s390: guest support for diagnose 0x318 Date: Fri, 2 Oct 2020 14:11:07 +0200 Message-Id: <20201002121118.180315-9-cohuck@redhat.com> In-Reply-To: <20201002121118.180315-1-cohuck@redhat.com> References: <20201002121118.180315-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=cohuck@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=cohuck@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/01 23:37:29 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , Janosch Frank , David Hildenbrand , Cornelia Huck , qemu-devel@nongnu.org, qemu-s390x@nongnu.org, Claudio Imbrenda , Collin Walling Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Collin Walling DIAGNOSE 0x318 (diag318) is an s390 instruction that allows the storage of diagnostic information that is collected by the firmware in the case of hardware/firmware service events. QEMU handles the instruction by storing the info in the CPU state. A subsequent register sync will communicate the data to the hypervisor. QEMU handles the migration via a VM State Description. This feature depends on the Extended-Length SCCB (els) feature. If els is not present, then a warning will be printed and the SCLP bit that allows the Linux kernel to execute the instruction will not be set. Availability of this instruction is determined by byte 134 (aka fac134) bit 0 of the SCLP Read Info block. This coincidentally expands into the space used for CPU entries, which means VMs running with the diag318 capability may not be able to read information regarding all CPUs unless the guest kernel supports an extended-length SCCB. This feature is not supported in protected virtualization mode. Signed-off-by: Collin Walling Acked-by: Janosch Frank Acked-by: Thomas Huth Acked-by: David Hildenbrand Acked-by: Claudio Imbrenda Message-Id: <20200915194416.107460-9-walling@linux.ibm.com> Signed-off-by: Cornelia Huck --- hw/s390x/sclp.c | 5 ++++ include/hw/s390x/sclp.h | 8 ++++++ target/s390x/cpu.h | 2 ++ target/s390x/cpu_features.h | 1 + target/s390x/cpu_features_def.h.inc | 3 +++ target/s390x/cpu_models.c | 1 + target/s390x/gen-features.c | 1 + target/s390x/kvm.c | 39 +++++++++++++++++++++++++++++ target/s390x/machine.c | 17 +++++++++++++ 9 files changed, 77 insertions(+) diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c index caf40f41b69e..00f1e4648db2 100644 --- a/hw/s390x/sclp.c +++ b/hw/s390x/sclp.c @@ -139,6 +139,11 @@ static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb) s390_get_feat_block(S390_FEAT_TYPE_SCLP_CONF_CHAR_EXT, read_info->conf_char_ext); =20 + if (s390_has_feat(S390_FEAT_EXTENDED_LENGTH_SCCB)) { + s390_get_feat_block(S390_FEAT_TYPE_SCLP_FAC134, + &read_info->fac134); + } + read_info->facilities =3D cpu_to_be64(SCLP_HAS_CPU_INFO | SCLP_HAS_IOA_RECONFIG); =20 diff --git a/include/hw/s390x/sclp.h b/include/hw/s390x/sclp.h index 88fb65aef44b..d3ade40a5a8d 100644 --- a/include/hw/s390x/sclp.h +++ b/include/hw/s390x/sclp.h @@ -134,7 +134,15 @@ typedef struct ReadInfo { uint16_t highest_cpu; uint8_t _reserved5[124 - 122]; /* 122-123 */ uint32_t hmfai; + uint8_t _reserved7[134 - 128]; /* 128-133 */ + uint8_t fac134; + uint8_t _reserved8[144 - 135]; /* 135-143 */ struct CPUEntry entries[]; + /* + * When the Extended-Length SCCB (ELS) feature is enabled the + * start of the entries field begins at an offset denoted by the + * offset_cpu field, otherwise it's at an offset of 128. + */ } QEMU_PACKED ReadInfo; =20 typedef struct ReadCpuInfo { diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index 035427521cec..f875ebf0f491 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -112,6 +112,8 @@ struct CPUS390XState { uint16_t external_call_addr; DECLARE_BITMAP(emergency_signals, S390_MAX_CPUS); =20 + uint64_t diag318_info; + /* Fields up to this point are cleared by a CPU reset */ struct {} end_reset_fields; =20 diff --git a/target/s390x/cpu_features.h b/target/s390x/cpu_features.h index 2a2947549387..ef52ffce83ec 100644 --- a/target/s390x/cpu_features.h +++ b/target/s390x/cpu_features.h @@ -23,6 +23,7 @@ typedef enum { S390_FEAT_TYPE_STFL, S390_FEAT_TYPE_SCLP_CONF_CHAR, S390_FEAT_TYPE_SCLP_CONF_CHAR_EXT, + S390_FEAT_TYPE_SCLP_FAC134, S390_FEAT_TYPE_SCLP_CPU, S390_FEAT_TYPE_MISC, S390_FEAT_TYPE_PLO, diff --git a/target/s390x/cpu_features_def.h.inc b/target/s390x/cpu_feature= s_def.h.inc index 1c04cc18f40f..f82b4b5ec16a 100644 --- a/target/s390x/cpu_features_def.h.inc +++ b/target/s390x/cpu_features_def.h.inc @@ -122,6 +122,9 @@ DEF_FEAT(SIE_CMMA, "cmma", SCLP_CONF_CHAR_EXT, 1, "SIE:= Collaborative-memory-man DEF_FEAT(SIE_PFMFI, "pfmfi", SCLP_CONF_CHAR_EXT, 9, "SIE: PFMF interpretat= ion facility") DEF_FEAT(SIE_IBS, "ibs", SCLP_CONF_CHAR_EXT, 10, "SIE: Interlock-and-broad= cast-suppression facility") =20 +/* Features exposed via SCLP SCCB Facilities byte 134 (bit numbers relativ= e to byte-134) */ +DEF_FEAT(DIAG_318, "diag318", SCLP_FAC134, 0, "Control program name and ve= rsion codes") + /* Features exposed via SCLP CPU info. */ DEF_FEAT(SIE_F2, "sief2", SCLP_CPU, 4, "SIE: interception format 2 (Virtua= l SIE)") DEF_FEAT(SIE_SKEY, "skey", SCLP_CPU, 5, "SIE: Storage-key facility") diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index b97e9596ab03..ca484bfda7be 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -824,6 +824,7 @@ static void check_consistency(const S390CPUModel *model) { S390_FEAT_PTFF_STOE, S390_FEAT_MULTIPLE_EPOCH }, { S390_FEAT_PTFF_STOUE, S390_FEAT_MULTIPLE_EPOCH }, { S390_FEAT_AP_QUEUE_INTERRUPT_CONTROL, S390_FEAT_AP }, + { S390_FEAT_DIAG_318, S390_FEAT_EXTENDED_LENGTH_SCCB }, }; int i; =20 diff --git a/target/s390x/gen-features.c b/target/s390x/gen-features.c index 6857f657fbad..a1f0a6f3c6fc 100644 --- a/target/s390x/gen-features.c +++ b/target/s390x/gen-features.c @@ -523,6 +523,7 @@ static uint16_t full_GEN12_GA1[] =3D { S390_FEAT_AP_FACILITIES_TEST, S390_FEAT_AP, S390_FEAT_EXTENDED_LENGTH_SCCB, + S390_FEAT_DIAG_318, }; =20 static uint16_t full_GEN12_GA2[] =3D { diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index a2d5ad78f652..f13eff688caf 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -105,6 +105,7 @@ =20 #define DIAG_TIMEREVENT 0x288 #define DIAG_IPL 0x308 +#define DIAG_SET_CONTROL_PROGRAM_CODES 0x318 #define DIAG_KVM_HYPERCALL 0x500 #define DIAG_KVM_BREAKPOINT 0x501 =20 @@ -602,6 +603,11 @@ int kvm_arch_put_registers(CPUState *cs, int level) cs->kvm_run->kvm_dirty_regs |=3D KVM_SYNC_ETOKEN; } =20 + if (can_sync_regs(cs, KVM_SYNC_DIAG318)) { + cs->kvm_run->s.regs.diag318 =3D env->diag318_info; + cs->kvm_run->kvm_dirty_regs |=3D KVM_SYNC_DIAG318; + } + /* Finally the prefix */ if (can_sync_regs(cs, KVM_SYNC_PREFIX)) { cs->kvm_run->s.regs.prefix =3D env->psa; @@ -741,6 +747,10 @@ int kvm_arch_get_registers(CPUState *cs) } } =20 + if (can_sync_regs(cs, KVM_SYNC_DIAG318)) { + env->diag318_info =3D cs->kvm_run->s.regs.diag318; + } + return 0; } =20 @@ -1601,6 +1611,27 @@ static int handle_sw_breakpoint(S390CPU *cpu, struct= kvm_run *run) return -ENOENT; } =20 +static void handle_diag_318(S390CPU *cpu, struct kvm_run *run) +{ + uint64_t reg =3D (run->s390_sieic.ipa & 0x00f0) >> 4; + uint64_t diag318_info =3D run->s.regs.gprs[reg]; + + /* + * DIAG 318 can only be enabled with KVM support. As such, let's + * ensure a guest cannot execute this instruction erroneously. + */ + if (!s390_has_feat(S390_FEAT_DIAG_318)) { + kvm_s390_program_interrupt(cpu, PGM_SPECIFICATION); + } + + cpu->env.diag318_info =3D diag318_info; + + if (can_sync_regs(CPU(cpu), KVM_SYNC_DIAG318)) { + run->s.regs.diag318 =3D diag318_info; + run->kvm_dirty_regs |=3D KVM_SYNC_DIAG318; + } +} + #define DIAG_KVM_CODE_MASK 0x000000000000ffff =20 static int handle_diag(S390CPU *cpu, struct kvm_run *run, uint32_t ipb) @@ -1620,6 +1651,9 @@ static int handle_diag(S390CPU *cpu, struct kvm_run *= run, uint32_t ipb) case DIAG_IPL: kvm_handle_diag_308(cpu, run); break; + case DIAG_SET_CONTROL_PROGRAM_CODES: + handle_diag_318(cpu, run); + break; case DIAG_KVM_HYPERCALL: r =3D handle_hypercall(cpu, run); break; @@ -2464,6 +2498,11 @@ void kvm_s390_get_host_cpu_model(S390CPUModel *model= , Error **errp) */ set_bit(S390_FEAT_EXTENDED_LENGTH_SCCB, model->features); =20 + /* DIAGNOSE 0x318 is not supported under protected virtualization */ + if (!s390_is_pv() && kvm_check_extension(kvm_state, KVM_CAP_S390_DIAG3= 18)) { + set_bit(S390_FEAT_DIAG_318, model->features); + } + /* strip of features that are not part of the maximum model */ bitmap_and(model->features, model->features, model->def->full_feat, S390_FEAT_MAX); diff --git a/target/s390x/machine.c b/target/s390x/machine.c index 549bb6c2808f..5b4e82f1ab99 100644 --- a/target/s390x/machine.c +++ b/target/s390x/machine.c @@ -234,6 +234,22 @@ const VMStateDescription vmstate_etoken =3D { } }; =20 +static bool diag318_needed(void *opaque) +{ + return s390_has_feat(S390_FEAT_DIAG_318); +} + +const VMStateDescription vmstate_diag318 =3D { + .name =3D "cpu/diag318", + .version_id =3D 1, + .minimum_version_id =3D 1, + .needed =3D diag318_needed, + .fields =3D (VMStateField[]) { + VMSTATE_UINT64(env.diag318_info, S390CPU), + VMSTATE_END_OF_LIST() + } +}; + const VMStateDescription vmstate_s390_cpu =3D { .name =3D "cpu", .post_load =3D cpu_post_load, @@ -270,6 +286,7 @@ const VMStateDescription vmstate_s390_cpu =3D { &vmstate_gscb, &vmstate_bpbc, &vmstate_etoken, + &vmstate_diag318, NULL }, }; --=20 2.25.4 From nobody Sat May 11 07:09:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1601641612; cv=none; d=zohomail.com; s=zohoarc; b=X5snrDiZ8DoQ00UIEe9GZxDnfpdC//UBBVJIEIiBOtoVw3t9GYcaPv1gTPQR7J9OmCsu0AZeRlnnrYvU//UriQWXOZrI8osjs1fXzWOzlt7+V2GBfyIuegxOKZqP88ioyeoR2MY7q5tEXJl4SXJcv67+gZJWBv169u68Ajl7OD4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601641612; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ubNgyxnI1ncFy+ev6LEYB8xPbgVFuajTGk/5+8i4/+Y=; b=mzXmOwA4oPq2G8Z2LeiYBcZlBz/2v3sji3uva/kOLKV2zQjtu2NKMbN6v0x/olBCYWLpinFFUVthYIz068HbHebXrhkLP1CWxL9BTPgEqNbN9vKuy1WZ0Z/S9hwnD6LL8yD8/re7Civ11NeyHgzvJ0TwxYQFxnh7DUqQN5XxNro= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1601641612748790.4968817997387; Fri, 2 Oct 2020 05:26:52 -0700 (PDT) Received: from localhost ([::1]:50306 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kOK9D-0000TG-Fd for importer@patchew.org; Fri, 02 Oct 2020 08:26:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56908) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kOJvA-0004Cr-5E for qemu-devel@nongnu.org; Fri, 02 Oct 2020 08:12:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:28181) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kOJuz-0003Ra-Fa for qemu-devel@nongnu.org; Fri, 02 Oct 2020 08:12:19 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-213-Qi2kKg3TMcejw6meB3WlEQ-1; Fri, 02 Oct 2020 08:11:55 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 693001074644; Fri, 2 Oct 2020 12:11:54 +0000 (UTC) Received: from localhost (ovpn-112-216.ams2.redhat.com [10.36.112.216]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2E56860C05; Fri, 2 Oct 2020 12:11:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601640718; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ubNgyxnI1ncFy+ev6LEYB8xPbgVFuajTGk/5+8i4/+Y=; b=EyaAYzylhvFVxfjhl1FA9ELCouztpQjtjIDlRZNj1TxEZaVLX0Ke1UwiviriGvtuuDGd/Z cSMOMujd2n9OZBg+ZqtxY986HCoEtdfUeeRLFSVEJ1t5Vg+2AA4wRtZkrCu/EG5r77lttp 75E6b9/cjLN+cALN/1XbpoOXjWZPKV4= X-MC-Unique: Qi2kKg3TMcejw6meB3WlEQ-1 From: Cornelia Huck To: Peter Maydell Subject: [PULL 09/19] s390x/tcg: Implement MONITOR CALL Date: Fri, 2 Oct 2020 14:11:08 +0200 Message-Id: <20201002121118.180315-10-cohuck@redhat.com> In-Reply-To: <20201002121118.180315-1-cohuck@redhat.com> References: <20201002121118.180315-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=cohuck@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=cohuck@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/02 01:13:31 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Hildenbrand , Cornelia Huck , Richard Henderson , qemu-devel@nongnu.org, Christian Borntraeger , qemu-s390x@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: David Hildenbrand Recent upstream Linux uses the MONITOR CALL instruction for things like BUG_ON() and WARN_ON(). We currently inject an operation exception when we hit a MONITOR CALL instruction - which is wrong, as the instruction is not glued to specific CPU features. Doing a simple WARN_ON_ONCE() currently results in a panic: [ 18.162801] illegal operation: 0001 ilc:2 [#1] SMP [ 18.162889] Modules linked in: [...] [ 18.165476] Kernel panic - not syncing: Fatal exception: panic_on_oops With a proper implementation, we now get: [ 18.242754] ------------[ cut here ]------------ [ 18.242855] WARNING: CPU: 7 PID: 1 at init/main.c:1534 [...] [ 18.242919] Modules linked in: [...] [ 18.246262] ---[ end trace a420477d71dc97b4 ]--- [ 18.259014] Freeing unused kernel memory: 4220K Reported-by: Christian Borntraeger Signed-off-by: David Hildenbrand Reviewed-by: Richard Henderson Message-Id: <20200918085122.26132-1-david@redhat.com> Signed-off-by: Cornelia Huck --- target/s390x/excp_helper.c | 23 +++++++++++++++++++++++ target/s390x/helper.h | 1 + target/s390x/insn-data.def | 3 +++ target/s390x/translate.c | 21 +++++++++++++++++++++ 4 files changed, 48 insertions(+) diff --git a/target/s390x/excp_helper.c b/target/s390x/excp_helper.c index 3b58d10df3ca..0adfbbda2708 100644 --- a/target/s390x/excp_helper.c +++ b/target/s390x/excp_helper.c @@ -610,4 +610,27 @@ void s390x_cpu_do_unaligned_access(CPUState *cs, vaddr= addr, tcg_s390_program_interrupt(env, PGM_SPECIFICATION, retaddr); } =20 +static void QEMU_NORETURN monitor_event(CPUS390XState *env, + uint64_t monitor_code, + uint8_t monitor_class, uintptr_t r= a) +{ + /* Store the Monitor Code and the Monitor Class Number into the lowcor= e */ + stq_phys(env_cpu(env)->as, + env->psa + offsetof(LowCore, monitor_code), monitor_code); + stw_phys(env_cpu(env)->as, + env->psa + offsetof(LowCore, mon_class_num), monitor_class); + + tcg_s390_program_interrupt(env, PGM_MONITOR, ra); +} + +void HELPER(monitor_call)(CPUS390XState *env, uint64_t monitor_code, + uint32_t monitor_class) +{ + g_assert(monitor_class <=3D 0xff); + + if (env->cregs[8] & (0x8000 >> monitor_class)) { + monitor_event(env, monitor_code, monitor_class, GETPC()); + } +} + #endif /* CONFIG_USER_ONLY */ diff --git a/target/s390x/helper.h b/target/s390x/helper.h index b7887b552bbb..55bd1551e604 100644 --- a/target/s390x/helper.h +++ b/target/s390x/helper.h @@ -349,4 +349,5 @@ DEF_HELPER_3(sic, void, env, i64, i64) DEF_HELPER_3(rpcit, void, env, i32, i32) DEF_HELPER_5(pcistb, void, env, i32, i32, i64, i32) DEF_HELPER_4(mpcifc, void, env, i32, i64, i32) +DEF_HELPER_3(monitor_call, void, env, i64, i32) #endif diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index d79ae9e3f114..e14cbd63fa0a 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -617,6 +617,9 @@ C(0x9a00, LAM, RS_a, Z, 0, a2, 0, 0, lam, 0) C(0xeb9a, LAMY, RSY_a, LD, 0, a2, 0, 0, lam, 0) =20 +/* MONITOR CALL */ + C(0xaf00, MC, SI, Z, la1, 0, 0, 0, mc, 0) + /* MOVE */ C(0xd200, MVC, SS_a, Z, la1, a2, 0, 0, mvc, 0) C(0xe544, MVHHI, SIL, GIE, la1, i2, 0, m1_16, mov2, 0) diff --git a/target/s390x/translate.c b/target/s390x/translate.c index a777343821bb..90dc1740e7ab 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -3302,6 +3302,27 @@ static DisasJumpType op_lcbb(DisasContext *s, DisasO= ps *o) return DISAS_NEXT; } =20 +static DisasJumpType op_mc(DisasContext *s, DisasOps *o) +{ +#if !defined(CONFIG_USER_ONLY) + TCGv_i32 i2; +#endif + const uint16_t monitor_class =3D get_field(s, i2); + + if (monitor_class & 0xff00) { + gen_program_exception(s, PGM_SPECIFICATION); + return DISAS_NORETURN; + } + +#if !defined(CONFIG_USER_ONLY) + i2 =3D tcg_const_i32(monitor_class); + gen_helper_monitor_call(cpu_env, o->addr1, i2); + tcg_temp_free_i32(i2); +#endif + /* Defaults to a NOP. */ + return DISAS_NEXT; +} + static DisasJumpType op_mov2(DisasContext *s, DisasOps *o) { o->out =3D o->in2; --=20 2.25.4 From nobody Sat May 11 07:09:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1601641738; cv=none; d=zohomail.com; s=zohoarc; b=lIkhtW38a4KyASAY1HKl/m4w2q7teT2f86wKwuqej0cbjlCZnEihgfhaZy74WZNFFGXEtlOHY+37cUIgFKdXxnM/qYFc3/nlY8t6kp1ueBoEkCKgsC6Ccoyl9cZ5HZgqpr0ZJdtdjFHzwpR9jIgpXJdLcCp17eN2+wTwSWA8W5M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601641738; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=EIBGYoiGqV9u2JbSxHXBCyqZdISVN7OjqQg6e5/mb/E=; b=QEqUMEgFiyilRjyAGhQHg/jsb6wXFJspTPSFTQAV0R0DydqvVy+8wCwePJrcI50yMnJjTL/TZ53k9omeFH+BgiJ3PM4M2qNabUtYifIRtO0iRKBgdZrJLi//1f4UvTmfiMz3fTSltV+jcWML4oYcQJPO1Nny7OBHxCEYVsib00g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1601641738610757.0453005125473; Fri, 2 Oct 2020 05:28:58 -0700 (PDT) Received: from localhost ([::1]:55430 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kOKBF-0002dX-69 for importer@patchew.org; Fri, 02 Oct 2020 08:28:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56916) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kOJvA-0004ED-KD for qemu-devel@nongnu.org; Fri, 02 Oct 2020 08:12:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:25635) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kOJuz-0003Rr-HG for qemu-devel@nongnu.org; Fri, 02 Oct 2020 08:12:20 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-485-DDTXcJbWN8en3tdvbsfVNQ-1; Fri, 02 Oct 2020 08:12:01 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C8A941DDFB; Fri, 2 Oct 2020 12:11:59 +0000 (UTC) Received: from localhost (ovpn-112-216.ams2.redhat.com [10.36.112.216]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5619D55770; Fri, 2 Oct 2020 12:11:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601640725; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EIBGYoiGqV9u2JbSxHXBCyqZdISVN7OjqQg6e5/mb/E=; b=JK2xnstdLzc1CNpl7OLCOTXhnTWeWe3lMy8upkscU9umB/XvrPy+1we+vzQcvtym67BN9d 7lJqsmNcEknMEEBK3Hr8U+H9hTPniwjKS8eNmoxRDGVLoPknmtiN1xCAIiJTuL0o5NlAXC +TV1M1FHgYizRbDz+i1RIowdK4BSFsE= X-MC-Unique: DDTXcJbWN8en3tdvbsfVNQ-1 From: Cornelia Huck To: Peter Maydell Subject: [PULL 10/19] vfio-ccw: plug memory leak while getting region info Date: Fri, 2 Oct 2020 14:11:09 +0200 Message-Id: <20201002121118.180315-11-cohuck@redhat.com> In-Reply-To: <20201002121118.180315-1-cohuck@redhat.com> References: <20201002121118.180315-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=cohuck@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=cohuck@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/02 01:13:31 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eric Farman , Cornelia Huck , Alex Williamson , qemu-devel@nongnu.org, qemu-s390x@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) vfio_get_dev_region_info() unconditionally allocates memory for a passed-in vfio_region_info structure (and does not re-use an already allocated structure). Therefore, we have to free the structure we pass to that function in vfio_ccw_get_region() for every region we successfully obtained information for. Fixes: 8fadea24de4e ("vfio-ccw: support async command subregion") Fixes: 46ea3841edaf ("vfio-ccw: Add support for the schib region") Fixes: f030532f2ad6 ("vfio-ccw: Add support for the CRW region and IRQ") Reported-by: Alex Williamson Signed-off-by: Cornelia Huck Reviewed-by: Eric Farman Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20200928101701.13540-1-cohuck@redhat.com> --- hw/vfio/ccw.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c index ff7f36977994..d2755d7fc5ca 100644 --- a/hw/vfio/ccw.c +++ b/hw/vfio/ccw.c @@ -491,6 +491,7 @@ static void vfio_ccw_get_region(VFIOCCWDevice *vcdev, E= rror **errp) =20 vcdev->io_region_offset =3D info->offset; vcdev->io_region =3D g_malloc0(info->size); + g_free(info); =20 /* check for the optional async command region */ ret =3D vfio_get_dev_region_info(vdev, VFIO_REGION_TYPE_CCW, @@ -503,6 +504,7 @@ static void vfio_ccw_get_region(VFIOCCWDevice *vcdev, E= rror **errp) } vcdev->async_cmd_region_offset =3D info->offset; vcdev->async_cmd_region =3D g_malloc0(info->size); + g_free(info); } =20 ret =3D vfio_get_dev_region_info(vdev, VFIO_REGION_TYPE_CCW, @@ -515,6 +517,7 @@ static void vfio_ccw_get_region(VFIOCCWDevice *vcdev, E= rror **errp) } vcdev->schib_region_offset =3D info->offset; vcdev->schib_region =3D g_malloc(info->size); + g_free(info); } =20 ret =3D vfio_get_dev_region_info(vdev, VFIO_REGION_TYPE_CCW, @@ -528,9 +531,9 @@ static void vfio_ccw_get_region(VFIOCCWDevice *vcdev, E= rror **errp) } vcdev->crw_region_offset =3D info->offset; vcdev->crw_region =3D g_malloc(info->size); + g_free(info); } =20 - g_free(info); return; =20 out_err: --=20 2.25.4 From nobody Sat May 11 07:09:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1601641342; cv=none; d=zohomail.com; s=zohoarc; b=K2VbM4Vp2Ft26XbVJA8n5MgVxVmDSEtrxIefVfptBX2lV91o8NLQ46mxQgS/4cbyHKBrA8Ec1IYc5Qq4/Wx0MlSpCtGzhYvg8rIWLrpweYRcu0BmJg7Nqkuq8/z4tf4lAj9oDDVPfuvyv8as7/bQXP23FvW95wmHYgH/pOrtPLI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601641342; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=OU6Y6Jz7cq8uW3N9sI3TJVwBty4jN6+TFXKrR3iHLoY=; b=V+ZD0kV2lKdpShxB8DV0OdalWDW2/cnhb/+AqAr0oPa+8ILoZv7xRhWj9Xh/KRP6POu3hmLzdGQKGP5cTGVVZVpgjGihmmdNCzGpRwIga+Bot+fSCkotHaexkww32AD9UpjC9W5fN1Nsaboi6eFKoogyVXTiAjzdxJHS6iFfIN8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1601641342078847.8197975462773; Fri, 2 Oct 2020 05:22:22 -0700 (PDT) Received: from localhost ([::1]:40070 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kOK4q-0004Tp-QG for importer@patchew.org; Fri, 02 Oct 2020 08:22:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56954) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kOJvC-0004Ih-Cu for qemu-devel@nongnu.org; Fri, 02 Oct 2020 08:12:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:33779) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kOJv4-0003Sm-T3 for qemu-devel@nongnu.org; Fri, 02 Oct 2020 08:12:22 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-261-x_tgy0B1NAODP_RYx9HX7g-1; Fri, 02 Oct 2020 08:12:09 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A2471185FD8B; Fri, 2 Oct 2020 12:12:07 +0000 (UTC) Received: from localhost (ovpn-112-216.ams2.redhat.com [10.36.112.216]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A93C95D9D3; Fri, 2 Oct 2020 12:12:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601640733; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OU6Y6Jz7cq8uW3N9sI3TJVwBty4jN6+TFXKrR3iHLoY=; b=azD8WIR9d8m7o5GHJHeRVdayIERR7pTnCQEnFc9OvQwRwYuqahktULYhJHcM8X+ofuIRDh FaXy73SV+0DhQXXKLfRSTV4TRObVLV/V0dHLI+NoZzxTBj8x7BJz7lFNkUNpAJG6KoGGds eF8R07EWvnXKyE58WnMkNMEAWtOlOE0= X-MC-Unique: x_tgy0B1NAODP_RYx9HX7g-1 From: Cornelia Huck To: Peter Maydell Subject: [PULL 11/19] s390x/cpumodel: S390_FEAT_MISC_INSTRUCTION_EXT -> S390_FEAT_MISC_INSTRUCTION_EXT2 Date: Fri, 2 Oct 2020 14:11:10 +0200 Message-Id: <20201002121118.180315-12-cohuck@redhat.com> In-Reply-To: <20201002121118.180315-1-cohuck@redhat.com> References: <20201002121118.180315-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=cohuck@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=cohuck@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/02 01:13:31 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, TVD_SPACE_RATIO=0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , David Hildenbrand , Cornelia Huck , qemu-devel@nongnu.org, Christian Borntraeger , qemu-s390x@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: David Hildenbrand Let's avoid confusion with the "Miscellaneous-Instruction-Extensions Facility 1" Suggested-by: Thomas Huth Signed-off-by: David Hildenbrand Cc: Christian Borntraeger Message-Id: <20200928122717.30586-2-david@redhat.com> Signed-off-by: Cornelia Huck --- target/s390x/cpu_features_def.h.inc | 2 +- target/s390x/gen-features.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/target/s390x/cpu_features_def.h.inc b/target/s390x/cpu_feature= s_def.h.inc index f82b4b5ec16a..7db3449e0434 100644 --- a/target/s390x/cpu_features_def.h.inc +++ b/target/s390x/cpu_features_def.h.inc @@ -72,7 +72,7 @@ DEF_FEAT(INTERLOCKED_ACCESS_2, "iacc2", STFL, 52, "Interl= ocked-access facility 2 DEF_FEAT(STFLE_53, "stfle53", STFL, 53, "Various facilities introduced wit= h z13") DEF_FEAT(ENTROPY_ENC_COMP, "eec", STFL, 54, "Entropy encoding compression = facility") DEF_FEAT(MSA_EXT_5, "msa5-base", STFL, 57, "Message-security-assist-extens= ion-5 facility (excluding subfunctions)") -DEF_FEAT(MISC_INSTRUCTION_EXT, "minste2", STFL, 58, "Miscellaneous-instruc= tion-extensions facility 2") +DEF_FEAT(MISC_INSTRUCTION_EXT2, "minste2", STFL, 58, "Miscellaneous-instru= ction-extensions facility 2") DEF_FEAT(SEMAPHORE_ASSIST, "sema", STFL, 59, "Semaphore-assist facility") DEF_FEAT(TIME_SLICE_INSTRUMENTATION, "tsi", STFL, 60, "Time-slice Instrume= ntation facility") DEF_FEAT(MISC_INSTRUCTION_EXT3, "minste3", STFL, 61, "Miscellaneous-Instru= ction-Extensions Facility 3") diff --git a/target/s390x/gen-features.c b/target/s390x/gen-features.c index a1f0a6f3c6fc..e3fd0c0a2ef3 100644 --- a/target/s390x/gen-features.c +++ b/target/s390x/gen-features.c @@ -412,7 +412,7 @@ static uint16_t base_GEN13_GA1[] =3D { =20 static uint16_t base_GEN14_GA1[] =3D { S390_FEAT_ENTROPY_ENC_COMP, - S390_FEAT_MISC_INSTRUCTION_EXT, + S390_FEAT_MISC_INSTRUCTION_EXT2, S390_FEAT_SEMAPHORE_ASSIST, S390_FEAT_TIME_SLICE_INSTRUMENTATION, S390_FEAT_ORDER_PRESERVING_COMPRESSION, --=20 2.25.4 From nobody Sat May 11 07:09:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1601641158; cv=none; d=zohomail.com; s=zohoarc; b=UzH0eVP9Ivpf6xj4XJO9x1TsdMUf+5sYy5xR/mJDRwKQhAtdJ+Qk4jm8upUbLFjj+ky/lCJXTrOTTY6p/GQ6Xu+QxfueAVeFSv/XtdE+2Ual74oy2+ZuLLopMd+HUab1itwWPkBuX4YiPI8WpFyNKgm+RFEwlSQ0es2ZXL3PnGY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601641158; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=hPTjbg3bmFDvw2kmM1Ei6ooKLVnZmRUMPNWDvSe394k=; b=ky5unWg1gJUWwyXGpXSROtphj8U9PhcaNtFGUSK49Ho/arV68ZiumxU1WaFGDPYZ5nAI76/0TRzyAOm3C2g0QHLPOddNTZ8+mHcfHIodft/YjnkMbqFruEtfVCZEPciTVeEkPYgyCICXkv50sEdUTrmM2tJ5+6avdsdRRGsuiRY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1601641158314908.6341615101123; Fri, 2 Oct 2020 05:19:18 -0700 (PDT) Received: from localhost ([::1]:33994 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kOK1s-0001lF-V2 for importer@patchew.org; Fri, 02 Oct 2020 08:19:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56946) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kOJvC-0004Hs-8f for qemu-devel@nongnu.org; Fri, 02 Oct 2020 08:12:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:52957) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kOJv7-0003TI-5x for qemu-devel@nongnu.org; Fri, 02 Oct 2020 08:12:21 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-180-umG1TdCsPFSDfKsNmSPt2Q-1; Fri, 02 Oct 2020 08:12:13 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BBD50803F7B; Fri, 2 Oct 2020 12:12:12 +0000 (UTC) Received: from localhost (ovpn-112-216.ams2.redhat.com [10.36.112.216]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7D29119C66; Fri, 2 Oct 2020 12:12:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601640736; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hPTjbg3bmFDvw2kmM1Ei6ooKLVnZmRUMPNWDvSe394k=; b=VNutemcDHN1dtczQu54qKQLlyexHByM6Sa7q14CtVJz6WO0Qb/2OmtLkarZisgv7ZFipr9 72/+dY2aa5LhF8wvpy2Oumr5iwhIPFh8oA2HYb01k3bv9z1Y2X+2FywsVXwz/mxuCgdjgM 6bK3DxbLuc0KxiBl4LGRIazi4WfUeG8= X-MC-Unique: umG1TdCsPFSDfKsNmSPt2Q-1 From: Cornelia Huck To: Peter Maydell Subject: [PULL 12/19] s390x/tcg: Implement ADD HALFWORD (AGH) Date: Fri, 2 Oct 2020 14:11:11 +0200 Message-Id: <20201002121118.180315-13-cohuck@redhat.com> In-Reply-To: <20201002121118.180315-1-cohuck@redhat.com> References: <20201002121118.180315-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=cohuck@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=cohuck@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/01 23:37:29 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , David Hildenbrand , Cornelia Huck , Richard Henderson , qemu-devel@nongnu.org, qemu-s390x@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: David Hildenbrand Easy, just like ADD HALFWORD IMMEDIATE (AGHI). Signed-off-by: David Hildenbrand Reviewed-by: Thomas Huth Reviewed-by: Richard Henderson Message-Id: <20200928122717.30586-3-david@redhat.com> Signed-off-by: Cornelia Huck --- target/s390x/insn-data.def | 1 + target/s390x/translate.c | 1 + 2 files changed, 2 insertions(+) diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index e14cbd63fa0a..dbcdb4c387fa 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -52,6 +52,7 @@ /* ADD HALFWORD */ C(0x4a00, AH, RX_a, Z, r1, m2_16s, new, r1_32, add, adds32) C(0xe37a, AHY, RXY_a, LD, r1, m2_16s, new, r1_32, add, adds32) + C(0xe338, AGH, RXY_a, MIE2,r1, m2_16s, r1, 0, add, adds64) /* ADD HALFWORD IMMEDIATE */ C(0xa70a, AHI, RI_a, Z, r1, i2, new, r1_32, add, adds32) C(0xa70b, AGHI, RI_a, Z, r1, i2, r1, 0, add, adds64) diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 90dc1740e7ab..7ea666b9a7fb 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -6119,6 +6119,7 @@ enum DisasInsnEnum { #define FAC_AIS S390_FEAT_ADAPTER_INT_SUPPRESSION #define FAC_V S390_FEAT_VECTOR /* vector facility */ #define FAC_VE S390_FEAT_VECTOR_ENH /* vector enhancements facili= ty 1 */ +#define FAC_MIE2 S390_FEAT_MISC_INSTRUCTION_EXT2 /* miscellaneous-i= nstruction-extensions facility 2 */ =20 static const DisasInsn insn_info[] =3D { #include "insn-data.def" --=20 2.25.4 From nobody Sat May 11 07:09:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1601641437; cv=none; d=zohomail.com; s=zohoarc; b=AJ3QlMmMmzoxtu9Md0Rm5ZffzIYnoHMCegDkb+Fq3MFdnwmS42QeLR7c7vDkERZh+zlRE0xWFhcDqFzAamKsXlJKZQxQBHVD0070p+/Od7QoQlyt7SToPWRaSKev8yYkj7hpb3H6MYvCaXfbCi6JS+uL/cdgYH15QPuxzNGQ6Pk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601641437; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FHBD8OAxwN2Hc4y4W0/2DnSeC8GEqaSX4FvJUa6OKqg=; b=kMxaNO/0utfp3OCbbGXgrFaBJRt96qwpqkyUjK9BAUY6V6vmLK42x2ZBNsDeyMEQFXfGxcE8BZ1ddVHP95g5eAzTz8PwjM+1kZ32G9TPpwjKi51Gr6DU3KenU8sSRETDysx9FzZdlM8uIKBg4YPG4HVveRMdroumGsyjZyMi56A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1601641437457721.57052713258; Fri, 2 Oct 2020 05:23:57 -0700 (PDT) Received: from localhost ([::1]:44502 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kOK6O-0006Mp-1n for importer@patchew.org; Fri, 02 Oct 2020 08:23:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56972) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kOJvD-0004LL-Dv for qemu-devel@nongnu.org; Fri, 02 Oct 2020 08:12:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:20815) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kOJv9-0003U6-T3 for qemu-devel@nongnu.org; Fri, 02 Oct 2020 08:12:23 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-384-py4E2dTyOFKei0MD3kD-Yw-1; Fri, 02 Oct 2020 08:12:17 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DF6D480EDAE; Fri, 2 Oct 2020 12:12:14 +0000 (UTC) Received: from localhost (ovpn-112-216.ams2.redhat.com [10.36.112.216]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7609019C66; Fri, 2 Oct 2020 12:12:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601640739; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FHBD8OAxwN2Hc4y4W0/2DnSeC8GEqaSX4FvJUa6OKqg=; b=GWwYlHh9M8yVq1dmTKSiSzcwCvBCOxLdkUX09Fjk75IuR+4I80WExPSS5+IVChsslzwcEA dv7+WkjdxJQFJUvgcLERMwrOekaSXBtts6jGcXzuZe1z+mbkQ2mVYa4ozHkkRC0m60g5dE 6K1P5+aQ047hcUercLAaaO4+Zwwnp2w= X-MC-Unique: py4E2dTyOFKei0MD3kD-Yw-1 From: Cornelia Huck To: Peter Maydell Subject: [PULL 13/19] s390x/tcg: Implement SUBTRACT HALFWORD (SGH) Date: Fri, 2 Oct 2020 14:11:12 +0200 Message-Id: <20201002121118.180315-14-cohuck@redhat.com> In-Reply-To: <20201002121118.180315-1-cohuck@redhat.com> References: <20201002121118.180315-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=cohuck@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=cohuck@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/01 23:37:29 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , David Hildenbrand , Cornelia Huck , Richard Henderson , qemu-devel@nongnu.org, qemu-s390x@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: David Hildenbrand Easy to wire up. Signed-off-by: David Hildenbrand Reviewed-by: Thomas Huth Reviewed-by: Richard Henderson Message-Id: <20200928122717.30586-4-david@redhat.com> Signed-off-by: Cornelia Huck --- target/s390x/insn-data.def | 1 + 1 file changed, 1 insertion(+) diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index dbcdb4c387fa..e994d32d96bd 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -886,6 +886,7 @@ /* SUBTRACT HALFWORD */ C(0x4b00, SH, RX_a, Z, r1, m2_16s, new, r1_32, sub, subs32) C(0xe37b, SHY, RXY_a, LD, r1, m2_16s, new, r1_32, sub, subs32) + C(0xe339, SGH, RXY_a, MIE2,r1, m2_16s, r1, 0, sub, subs64) /* SUBTRACT HIGH */ C(0xb9c9, SHHHR, RRF_a, HW, r2_sr32, r3_sr32, new, r1_32h, sub, sub= s32) C(0xb9d9, SHHLR, RRF_a, HW, r2_sr32, r3, new, r1_32h, sub, subs32) --=20 2.25.4 From nobody Sat May 11 07:09:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1601641491; cv=none; d=zohomail.com; s=zohoarc; b=OPSPjftKa04A629KVGbjCetcdHg6X4kBUulspsepDlh6WFlx6p6hAntxU6uI/fZkyt94juGYziTCKY2AT7Cm4mgBFMQ0ixlQraA+lBKPBhm7uKsjV4XWHzrUyjLfBCStswfb2aleOt/+e8pEl/1LMBTIg4gkP9KZVjhsToF7Ul0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601641491; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6EnuCjQbCLv9CGuzTKtouRRl6nvSX6AetpA8WsY25AI=; b=maCpcBCfv3MzoM4EcEFEP41klZj6tiAC15BcF5JSZbpJra+yBKne/CyvoMJaJdZtUYjFogFkgAvkMiynNtdrae7MPxgIhl0SWKgtv64SebegkK65WzfZ1KYenOxf5Ar9wAMrS5W6ngvGyhuTffV/8tOyaOatB73GRLXDHDmpm/I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1601641491271383.20459652556167; Fri, 2 Oct 2020 05:24:51 -0700 (PDT) Received: from localhost ([::1]:46774 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kOK7G-0007Io-2C for importer@patchew.org; Fri, 02 Oct 2020 08:24:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56996) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kOJvI-0004Xg-Bl for qemu-devel@nongnu.org; Fri, 02 Oct 2020 08:12:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:58947) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kOJvG-0003VG-QG for qemu-devel@nongnu.org; Fri, 02 Oct 2020 08:12:28 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-409-wAi_pKl2OKeclVl_r-7amQ-1; Fri, 02 Oct 2020 08:12:22 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C81E61084C93; Fri, 2 Oct 2020 12:12:19 +0000 (UTC) Received: from localhost (ovpn-112-216.ams2.redhat.com [10.36.112.216]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 90A1979981; Fri, 2 Oct 2020 12:12:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601640746; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6EnuCjQbCLv9CGuzTKtouRRl6nvSX6AetpA8WsY25AI=; b=idzGolBPCPZQIzfMjSxYBB8+ap8XI/V+6sT6Tui8Nuk4iHHsCCdhRPX/vTOPhuIqD/srM3 rl9V53et8ImRYF/6reH8REaItjDRByZuQYeUMyZ40lHviIas/FvtzpzGMlS7zRkhLjh9N7 m1cwGJptYzseA1Q32BAJMkpGNc6BeHI= X-MC-Unique: wAi_pKl2OKeclVl_r-7amQ-1 From: Cornelia Huck To: Peter Maydell Subject: [PULL 14/19] s390x/tcg: Implement MULTIPLY (MG, MGRK) Date: Fri, 2 Oct 2020 14:11:13 +0200 Message-Id: <20201002121118.180315-15-cohuck@redhat.com> In-Reply-To: <20201002121118.180315-1-cohuck@redhat.com> References: <20201002121118.180315-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=cohuck@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=cohuck@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/02 01:13:31 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-s390x@nongnu.org, Cornelia Huck , Richard Henderson , qemu-devel@nongnu.org, David Hildenbrand Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: David Hildenbrand Multiply two signed 64bit values and store the 128bit result in r1 (0-63) and r1 + 1 (64-127). Signed-off-by: David Hildenbrand Reviewed-by: Richard Henderson Message-Id: <20200928122717.30586-5-david@redhat.com> Signed-off-by: Cornelia Huck --- target/s390x/insn-data.def | 2 ++ target/s390x/translate.c | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index e994d32d96bd..13c4ffdaf5b3 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -653,8 +653,10 @@ =20 /* MULTIPLY */ C(0x1c00, MR, RR_a, Z, r1p1_32s, r2_32s, new, r1_D32, mul, 0) + C(0xb9ec, MGRK, RRF_a, MIE2,r3_o, r2_o, r1_P, 0, muls128, 0) C(0x5c00, M, RX_a, Z, r1p1_32s, m2_32s, new, r1_D32, mul, 0) C(0xe35c, MFY, RXY_a, GIE, r1p1_32s, m2_32s, new, r1_D32, mul, 0) + C(0xe384, MG, RXY_a, MIE2,r1p1_o, m2_64, r1_P, 0, muls128, 0) F(0xb317, MEEBR, RRE, Z, e1, e2, new, e1, meeb, 0, IF_BFP) F(0xb31c, MDBR, RRE, Z, f1, f2, new, f1, mdb, 0, IF_BFP) F(0xb34c, MXBR, RRE, Z, x2h, x2l, x1, x1, mxb, 0, IF_BFP) diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 7ea666b9a7fb..66a3693d128c 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -3539,6 +3539,12 @@ static DisasJumpType op_mul128(DisasContext *s, Disa= sOps *o) return DISAS_NEXT; } =20 +static DisasJumpType op_muls128(DisasContext *s, DisasOps *o) +{ + tcg_gen_muls2_i64(o->out2, o->out, o->in1, o->in2); + return DISAS_NEXT; +} + static DisasJumpType op_meeb(DisasContext *s, DisasOps *o) { gen_helper_meeb(o->out, cpu_env, o->in1, o->in2); @@ -5563,6 +5569,13 @@ static void in1_r1p1(DisasContext *s, DisasOps *o) } #define SPEC_in1_r1p1 SPEC_r1_even =20 +static void in1_r1p1_o(DisasContext *s, DisasOps *o) +{ + o->in1 =3D regs[get_field(s, r1) + 1]; + o->g_in1 =3D true; +} +#define SPEC_in1_r1p1_o SPEC_r1_even + static void in1_r1p1_32s(DisasContext *s, DisasOps *o) { o->in1 =3D tcg_temp_new_i64(); --=20 2.25.4 From nobody Sat May 11 07:09:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1601641651; cv=none; d=zohomail.com; s=zohoarc; b=AErSmcK6Ix9fVzfNyKWyw+OOFLNolZnZoKRtli/LEOSIxb3K29jz0/c7OicmBoI1jsDQ39ofKzVnZHcucCcYHqSf9nnsID2KpTcoWX0OaUersRsSOJjbw64OYkkoyGy9H0gQmT2swrwGMutwU6CremrLukKbJmxiDFFCQes3K4o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601641651; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/TdNG7A5nFaZM4Yjh3LLAFIvp8cCGg+8daj3bPu5Tx4=; b=PCI4b701wtFmDCWqzyib+ExcpZNBEps8yQvugHYJqUn+6ZasvLk3zmLNosIGmErwnuo87HQWHpBQ15Fi4Rr4m1w2/ea8mAlWsQcESNjQhuRn12Gfy10+8BoBHM6JoYBNb57CIM0ais5htOOvKC6x2jQmG8kzppIPP26o2IfO2CI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 160164165170436.18680968018532; Fri, 2 Oct 2020 05:27:31 -0700 (PDT) Received: from localhost ([::1]:52674 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kOK9q-0001TP-Gl for importer@patchew.org; Fri, 02 Oct 2020 08:27:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57008) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kOJvK-0004dc-L9 for qemu-devel@nongnu.org; Fri, 02 Oct 2020 08:12:30 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:56178) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kOJvI-0003VQ-OU for qemu-devel@nongnu.org; Fri, 02 Oct 2020 08:12:30 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-116-kuxcrFecMuOTmla6Yg-04g-1; Fri, 02 Oct 2020 08:12:25 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A682285C736; Fri, 2 Oct 2020 12:12:24 +0000 (UTC) Received: from localhost (ovpn-112-216.ams2.redhat.com [10.36.112.216]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 82E9710013BD; Fri, 2 Oct 2020 12:12:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601640748; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/TdNG7A5nFaZM4Yjh3LLAFIvp8cCGg+8daj3bPu5Tx4=; b=XPZgBjxGlX7Aude4I9xqWo5eBgZGXxITcu/vd5fI/NRuhOFC3edhGo/MBjLitGN3Nc+gvh IdX2ZO3O5SKR0PNDzJaggrxkOov9ImJzTCRMwhNLsJvoX1lNmHGq2S12MTlfkYPoxt3/G1 oCw/pdgEER5TffxKIJtJT46QrBjMbWg= X-MC-Unique: kuxcrFecMuOTmla6Yg-04g-1 From: Cornelia Huck To: Peter Maydell Subject: [PULL 15/19] s390x/tcg: Implement MULTIPLY HALFWORD (MGH) Date: Fri, 2 Oct 2020 14:11:14 +0200 Message-Id: <20201002121118.180315-16-cohuck@redhat.com> In-Reply-To: <20201002121118.180315-1-cohuck@redhat.com> References: <20201002121118.180315-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=cohuck@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=63.128.21.124; envelope-from=cohuck@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/01 23:37:29 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-s390x@nongnu.org, Cornelia Huck , Richard Henderson , qemu-devel@nongnu.org, David Hildenbrand Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: David Hildenbrand Just like MULTIPLY HALFWORD IMMEDIATE (MGHI), only the second operand (signed 16 bit) comes from memory. Signed-off-by: David Hildenbrand Reviewed-by: Richard Henderson Message-Id: <20200928122717.30586-6-david@redhat.com> Signed-off-by: Cornelia Huck --- target/s390x/insn-data.def | 1 + 1 file changed, 1 insertion(+) diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index 13c4ffdaf5b3..bf18d8aaf43e 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -669,6 +669,7 @@ /* MULTIPLY HALFWORD */ C(0x4c00, MH, RX_a, Z, r1_o, m2_16s, new, r1_32, mul, 0) C(0xe37c, MHY, RXY_a, GIE, r1_o, m2_16s, new, r1_32, mul, 0) + C(0xe33c, MGH, RXY_a, MIE2,r1_o, m2_16s, r1, 0, mul, 0) /* MULTIPLY HALFWORD IMMEDIATE */ C(0xa70c, MHI, RI_a, Z, r1_o, i2, new, r1_32, mul, 0) C(0xa70d, MGHI, RI_a, Z, r1_o, i2, r1, 0, mul, 0) --=20 2.25.4 From nobody Sat May 11 07:09:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1601641787; cv=none; d=zohomail.com; s=zohoarc; b=L8moJG2bFMiqv/rSf2EdJdL4VnHrPa3FT6/ApwtN+8h3MA45UptQSYxCgCnsc0RBrzTjmz6LK2c5/S+VoKEIC/PopZojS4PgticczGHzY4rcoJZru62KSCIvs5zFLDsJhUasFX5bozpyVFQR7cp0paPdpg/lrrweDxEwfKhhS2Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601641787; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=W5jeL73icdSoEitdtgj4079z9kZgec574FtVJbMWvcM=; b=mXzeGCuQqjQopy3xk2gOykfGFmpV8idKqCvfhTe6cKRHMfkuhCBmkTCCxZ3qrcwo/xUAynaGtgQcrazKXRmJHfwA8KJ9UrRU4FRH6JPzi8xZA1F+mKT0IdJSMryZbepNp+NcRYGty3LnKq/rIsVKtBVY/FUcQ4+uwMnZhFU3nTw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1601641787119876.0549847148556; Fri, 2 Oct 2020 05:29:47 -0700 (PDT) Received: from localhost ([::1]:58604 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kOKC1-0003wa-S3 for importer@patchew.org; Fri, 02 Oct 2020 08:29:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57044) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kOJvP-0004pN-BJ for qemu-devel@nongnu.org; Fri, 02 Oct 2020 08:12:39 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:31993) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kOJvN-0003Wz-Gx for qemu-devel@nongnu.org; Fri, 02 Oct 2020 08:12:35 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-473-GjkcAVbvM_-cMIYqXhhyhg-1; Fri, 02 Oct 2020 08:12:30 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8390A873119; Fri, 2 Oct 2020 12:12:29 +0000 (UTC) Received: from localhost (ovpn-112-216.ams2.redhat.com [10.36.112.216]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 57C865D9D5; Fri, 2 Oct 2020 12:12:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601640752; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=W5jeL73icdSoEitdtgj4079z9kZgec574FtVJbMWvcM=; b=CaflgcL0mx5Hj9WF11wdXHVkFmdu7OIxP9tOmqX0j5a+9j+omsmyld/+iBgxABQ0B0PzE9 FyNpI8E8qz/dJYwduydaLj+dJrGCzNND7W81miX3RBiVtIFn2nuVZeW6ylXYlXyQ+WvCVW IlX1eec4D3+v8K0sXwvQLF8ONmIpEmc= X-MC-Unique: GjkcAVbvM_-cMIYqXhhyhg-1 From: Cornelia Huck To: Peter Maydell Subject: [PULL 16/19] s390x/tcg: Implement BRANCH INDIRECT ON CONDITION (BIC) Date: Fri, 2 Oct 2020 14:11:15 +0200 Message-Id: <20201002121118.180315-17-cohuck@redhat.com> In-Reply-To: <20201002121118.180315-1-cohuck@redhat.com> References: <20201002121118.180315-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=cohuck@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=cohuck@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/02 01:13:31 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-s390x@nongnu.org, Cornelia Huck , Richard Henderson , qemu-devel@nongnu.org, David Hildenbrand Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: David Hildenbrand Just like BRANCH ON CONDITION - however the address is read from memory (always 8 bytes are read), we have to wrap the address manually. The address is read using current CPU DAT/address-space controls, just like ordinary data. Signed-off-by: David Hildenbrand Reviewed-by: Richard Henderson Message-Id: <20200928122717.30586-7-david@redhat.com> Signed-off-by: Cornelia Huck --- target/s390x/insn-data.def | 2 ++ target/s390x/translate.c | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index bf18d8aaf43e..3322e5f2a504 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -115,6 +115,8 @@ /* BRANCH RELATIVE AND SAVE */ C(0xa705, BRAS, RI_b, Z, 0, 0, r1, 0, basi, 0) C(0xc005, BRASL, RIL_b, Z, 0, 0, r1, 0, basi, 0) +/* BRANCH INDIRECT ON CONDITION */ + C(0xe347, BIC, RXY_b, MIE2,0, m2_64w, 0, 0, bc, 0) /* BRANCH ON CONDITION */ C(0x0700, BCR, RR_b, Z, 0, r2_nz, 0, 0, bc, 0) C(0x4700, BC, RX_b, Z, 0, a2, 0, 0, bc, 0) diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 66a3693d128c..27fb7af8fb1c 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -5956,6 +5956,14 @@ static void in2_m2_64(DisasContext *s, DisasOps *o) } #define SPEC_in2_m2_64 0 =20 +static void in2_m2_64w(DisasContext *s, DisasOps *o) +{ + in2_a2(s, o); + tcg_gen_qemu_ld64(o->in2, o->in2, get_mem_index(s)); + gen_addi_and_wrap_i64(s, o->in2, o->in2, 0); +} +#define SPEC_in2_m2_64w 0 + #ifndef CONFIG_USER_ONLY static void in2_m2_64a(DisasContext *s, DisasOps *o) { --=20 2.25.4 From nobody Sat May 11 07:09:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1601641971; cv=none; d=zohomail.com; s=zohoarc; b=CnLOqPGHTVUlR4LY5cUJ3Tt5H+BiZ9hY8i0rZMjeqtv98NloMU+0CVAa00Yn6TZJN/jRRW3LwFWJG5JE5tDSCGPnivXCDwyD+wBwRZobE/+Kv+eQBDxaNyzq+EQm+bBl1AoRFDwja4XMci+wh8QWPhV2ROu7rrk91WHTrGjGZ1g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601641971; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=j166oUDIA/92ZrLVTvgDodul59v5VMg4hO/cAQ3wRx4=; b=S81PTecqv26JZymAXTEN3CxeuNchLhNnfXHdCbdA+odDVjvcnCjKLU5mUJJWOEolr46UOu7E6EHvw3ikRGebmvV4/TrbVE3THyMhtMQQdyr5Ku50WAVECjPpMGntXVOWrwLQg4mcSqNeUHLItzIL5NM1uWR3bgbR+ignlRQXg+E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1601641971285884.1899168108986; Fri, 2 Oct 2020 05:32:51 -0700 (PDT) Received: from localhost ([::1]:35600 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kOKF0-0006BF-2e for importer@patchew.org; Fri, 02 Oct 2020 08:32:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57082) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kOJvX-0004rw-VU for qemu-devel@nongnu.org; Fri, 02 Oct 2020 08:12:44 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:38195) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kOJvV-0003XT-Kc for qemu-devel@nongnu.org; Fri, 02 Oct 2020 08:12:43 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-529-eYmtQdgUNlidRhfnfJ2dew-1; Fri, 02 Oct 2020 08:12:35 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AF647802B75; Fri, 2 Oct 2020 12:12:34 +0000 (UTC) Received: from localhost (ovpn-112-216.ams2.redhat.com [10.36.112.216]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3D8EF19C66; Fri, 2 Oct 2020 12:12:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601640759; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=j166oUDIA/92ZrLVTvgDodul59v5VMg4hO/cAQ3wRx4=; b=WF3hcawp6s3nup7BfkoZ4cizo3BuI1paVoCuECTLkQ23Na4UjZbR8Ulhk+mVZGJAJIJZoW VGEWMvt/7X8z1zsmyB+Auv3XxZPRO/H1TR+6mAjHOypmM49lRcfdlS/6AXgh1ejeXZK2dM MVcxMghdpqNqLiLdxOMwNufVAkwEj0Y= X-MC-Unique: eYmtQdgUNlidRhfnfJ2dew-1 From: Cornelia Huck To: Peter Maydell Subject: [PULL 17/19] s390x/tcg: Implement MULTIPLY SINGLE (MSC, MSGC, MSGRKC, MSRKC) Date: Fri, 2 Oct 2020 14:11:16 +0200 Message-Id: <20201002121118.180315-18-cohuck@redhat.com> In-Reply-To: <20201002121118.180315-1-cohuck@redhat.com> References: <20201002121118.180315-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=cohuck@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=cohuck@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/02 01:13:31 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-s390x@nongnu.org, Cornelia Huck , Richard Henderson , qemu-devel@nongnu.org, David Hildenbrand Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: David Hildenbrand We need new CC handling, determining the CC based on the intermediate result (64bit for MSC and MSRKC, 128bit for MSGC and MSGRKC). We want to store out2 ("low") after muls128 to r1, so add "wout_out2_r1". Signed-off-by: David Hildenbrand Reviewed-by: Richard Henderson Message-Id: <20200928122717.30586-8-david@redhat.com> Signed-off-by: Cornelia Huck --- target/s390x/cc_helper.c | 32 ++++++++++++++++++++++++++++++++ target/s390x/helper.c | 2 ++ target/s390x/insn-data.def | 4 ++++ target/s390x/internal.h | 2 ++ target/s390x/translate.c | 19 +++++++++++++++++++ 5 files changed, 59 insertions(+) diff --git a/target/s390x/cc_helper.c b/target/s390x/cc_helper.c index 44731e4a85c3..5432aeeed46c 100644 --- a/target/s390x/cc_helper.c +++ b/target/s390x/cc_helper.c @@ -417,6 +417,32 @@ static uint32_t cc_calc_vc(uint64_t low, uint64_t high) } } =20 +static uint32_t cc_calc_muls_32(int64_t res) +{ + const int64_t tmp =3D res >> 31; + + if (!res) { + return 0; + } else if (tmp && tmp !=3D -1) { + return 3; + } else if (res < 0) { + return 1; + } + return 2; +} + +static uint64_t cc_calc_muls_64(int64_t res_high, uint64_t res_low) +{ + if (!res_high && !res_low) { + return 0; + } else if (res_high + (res_low >> 63) !=3D 0) { + return 3; + } else if (res_high < 0) { + return 1; + } + return 2; +} + static uint32_t do_calc_cc(CPUS390XState *env, uint32_t cc_op, uint64_t src, uint64_t dst, uint64_t vr) { @@ -484,6 +510,9 @@ static uint32_t do_calc_cc(CPUS390XState *env, uint32_t= cc_op, case CC_OP_COMP_64: r =3D cc_calc_comp_64(dst); break; + case CC_OP_MULS_64: + r =3D cc_calc_muls_64(src, dst); + break; =20 case CC_OP_ADD_32: r =3D cc_calc_add_32(src, dst, vr); @@ -512,6 +541,9 @@ static uint32_t do_calc_cc(CPUS390XState *env, uint32_t= cc_op, case CC_OP_COMP_32: r =3D cc_calc_comp_32(dst); break; + case CC_OP_MULS_32: + r =3D cc_calc_muls_32(dst); + break; =20 case CC_OP_ICM: r =3D cc_calc_icm(src, dst); diff --git a/target/s390x/helper.c b/target/s390x/helper.c index 9257d388baed..b877690845aa 100644 --- a/target/s390x/helper.c +++ b/target/s390x/helper.c @@ -430,6 +430,8 @@ const char *cc_name(enum cc_op cc_op) [CC_OP_FLOGR] =3D "CC_OP_FLOGR", [CC_OP_LCBB] =3D "CC_OP_LCBB", [CC_OP_VC] =3D "CC_OP_VC", + [CC_OP_MULS_32] =3D "CC_OP_MULS_32", + [CC_OP_MULS_64] =3D "CC_OP_MULS_64", }; =20 return cc_names[cc_op]; diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index 3322e5f2a504..fc83a6ec32a4 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -682,11 +682,15 @@ C(0xe386, MLG, RXY_a, Z, r1p1, m2_64, r1_P, 0, mul128, 0) /* MULTIPLY SINGLE */ C(0xb252, MSR, RRE, Z, r1_o, r2_o, new, r1_32, mul, 0) + C(0xb9fd, MSRKC, RRF_a, MIE2,r3_32s, r2_32s, new, r1_32, mul, muls32) C(0x7100, MS, RX_a, Z, r1_o, m2_32s, new, r1_32, mul, 0) C(0xe351, MSY, RXY_a, LD, r1_o, m2_32s, new, r1_32, mul, 0) + C(0xe353, MSC, RXY_a, MIE2,r1_32s, m2_32s, new, r1_32, mul, muls32) C(0xb90c, MSGR, RRE, Z, r1_o, r2_o, r1, 0, mul, 0) + C(0xb9ed, MSGRKC, RRF_a, MIE2,r3_o, r2_o, new_P, out2_r1, muls128, mu= ls64) C(0xb91c, MSGFR, RRE, Z, r1_o, r2_32s, r1, 0, mul, 0) C(0xe30c, MSG, RXY_a, Z, r1_o, m2_64, r1, 0, mul, 0) + C(0xe383, MSGC, RXY_a, MIE2,r1_o, m2_64, new_P, out2_r1, muls128, m= uls64) C(0xe31c, MSGF, RXY_a, Z, r1_o, m2_32s, r1, 0, mul, 0) /* MULTIPLY SINGLE IMMEDIATE */ C(0xc201, MSFI, RIL_a, GIE, r1_o, i2, new, r1_32, mul, 0) diff --git a/target/s390x/internal.h b/target/s390x/internal.h index bac0d3c67b21..64602660ae17 100644 --- a/target/s390x/internal.h +++ b/target/s390x/internal.h @@ -175,6 +175,7 @@ enum cc_op { CC_OP_SUBB_64, /* overflow on unsigned sub-borrow (64bit)= */ CC_OP_ABS_64, /* sign eval on abs (64bit) */ CC_OP_NABS_64, /* sign eval on nabs (64bit) */ + CC_OP_MULS_64, /* overflow on signed multiply (64bit) */ =20 CC_OP_ADD_32, /* overflow on add (32bit) */ CC_OP_ADDU_32, /* overflow on unsigned add (32bit) */ @@ -184,6 +185,7 @@ enum cc_op { CC_OP_SUBB_32, /* overflow on unsigned sub-borrow (32bit)= */ CC_OP_ABS_32, /* sign eval on abs (64bit) */ CC_OP_NABS_32, /* sign eval on nabs (64bit) */ + CC_OP_MULS_32, /* overflow on signed multiply (32bit) */ =20 CC_OP_COMP_32, /* complement */ CC_OP_COMP_64, /* complement */ diff --git a/target/s390x/translate.c b/target/s390x/translate.c index 27fb7af8fb1c..bcc65893e4ff 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -646,6 +646,7 @@ static void gen_op_calc_cc(DisasContext *s) case CC_OP_NZ_F64: case CC_OP_FLOGR: case CC_OP_LCBB: + case CC_OP_MULS_32: /* 1 argument */ gen_helper_calc_cc(cc_op, cpu_env, local_cc_op, dummy, cc_dst, dum= my); break; @@ -660,6 +661,7 @@ static void gen_op_calc_cc(DisasContext *s) case CC_OP_SLA_64: case CC_OP_NZ_F128: case CC_OP_VC: + case CC_OP_MULS_64: /* 2 arguments */ gen_helper_calc_cc(cc_op, cpu_env, local_cc_op, cc_src, cc_dst, du= mmy); break; @@ -5310,6 +5312,17 @@ static void cout_tm64(DisasContext *s, DisasOps *o) gen_op_update2_cc_i64(s, CC_OP_TM_64, o->in1, o->in2); } =20 +static void cout_muls32(DisasContext *s, DisasOps *o) +{ + gen_op_update1_cc_i64(s, CC_OP_MULS_32, o->out); +} + +static void cout_muls64(DisasContext *s, DisasOps *o) +{ + /* out contains "high" part, out2 contains "low" part of 128 bit resul= t */ + gen_op_update2_cc_i64(s, CC_OP_MULS_64, o->out, o->out2); +} + /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */ /* The "PREParation" generators. These initialize the DisasOps.OUT fields with the TCG register to which we will write. Used in combination with @@ -5365,6 +5378,12 @@ static void wout_r1(DisasContext *s, DisasOps *o) } #define SPEC_wout_r1 0 =20 +static void wout_out2_r1(DisasContext *s, DisasOps *o) +{ + store_reg(get_field(s, r1), o->out2); +} +#define SPEC_wout_out2_r1 0 + static void wout_r1_8(DisasContext *s, DisasOps *o) { int r1 =3D get_field(s, r1); --=20 2.25.4 From nobody Sat May 11 07:09:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1601641916; cv=none; d=zohomail.com; s=zohoarc; b=RjPNIBle6szxpttucJYD187uG+LFv7W19rGD8SjvuNXA1OVEhCF88ucDwPvpysNW7bfwdkMjHFObB820BfwlusoyrUaeC6tCbe5SODjNN6UyvcrXx2ZOgqVn0X14JnCXz94dnpUwVoyvQ9/oFQeqYHyLb2w3czrkKuIQY37FH88= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601641916; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=XowRrk/lXOLUH3goliD+mz4/xyaIoBaMmRz83JRYToU=; b=M3pleYI6cRIRyxdbr0HK1FNUKgFVim9nfC764YmqoK99l7RBFt8fGa5YdgTlkpy/26hT1KpF9k4ezHk370bD/AS7bzoabEe5nid4HkF+snJs8GL83i8/z0sm7yqDKt8M6ylYcis5ywAM7y19UrgganuW+ZYcqgrmvOIkng8ExuU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1601641916640422.6745442923461; Fri, 2 Oct 2020 05:31:56 -0700 (PDT) Received: from localhost ([::1]:33680 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kOKE7-0005P8-1a for importer@patchew.org; Fri, 02 Oct 2020 08:31:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57134) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kOJvk-0004xx-Ho for qemu-devel@nongnu.org; Fri, 02 Oct 2020 08:12:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:59527) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kOJvj-0003Y4-0i for qemu-devel@nongnu.org; Fri, 02 Oct 2020 08:12:56 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-567-GDYwNfo7NyamNzhEsTchKw-1; Fri, 02 Oct 2020 08:12:41 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 373501882FA0; Fri, 2 Oct 2020 12:12:40 +0000 (UTC) Received: from localhost (ovpn-112-216.ams2.redhat.com [10.36.112.216]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C0CB560C05; Fri, 2 Oct 2020 12:12:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601640766; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XowRrk/lXOLUH3goliD+mz4/xyaIoBaMmRz83JRYToU=; b=g1pzzaVYxee9iUvj8HlA2Y03jdfJZXq5kPWPkJLyjeA5VCGPMkgak4mu+uNjtFHx1TzzjW Igm2O+Z/g9CWdgvwwW4upau9MepsZZW6hX5nzfwtey13Mg7GwFjKsoSoNS7aWJhNU1abzY 39f0o/b4uLbDKI2wbiuiWcqZn4meBHU= X-MC-Unique: GDYwNfo7NyamNzhEsTchKw-1 From: Cornelia Huck To: Peter Maydell Subject: [PULL 18/19] s390x/tcg: We support Miscellaneous-Instruction-Extensions Facility 2 Date: Fri, 2 Oct 2020 14:11:17 +0200 Message-Id: <20201002121118.180315-19-cohuck@redhat.com> In-Reply-To: <20201002121118.180315-1-cohuck@redhat.com> References: <20201002121118.180315-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=cohuck@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=cohuck@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/02 01:13:31 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-s390x@nongnu.org, Cornelia Huck , Richard Henderson , qemu-devel@nongnu.org, David Hildenbrand Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: David Hildenbrand We implement all relevant instructions. Signed-off-by: David Hildenbrand Reviewed-by: Richard Henderson Message-Id: <20200928122717.30586-9-david@redhat.com> Signed-off-by: Cornelia Huck --- target/s390x/gen-features.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/s390x/gen-features.c b/target/s390x/gen-features.c index e3fd0c0a2ef3..02ec0a673517 100644 --- a/target/s390x/gen-features.c +++ b/target/s390x/gen-features.c @@ -718,6 +718,7 @@ static uint16_t qemu_MAX[] =3D { S390_FEAT_MSA_EXT_5, /* features introduced after the z13 */ S390_FEAT_INSTRUCTION_EXEC_PROT, + S390_FEAT_MISC_INSTRUCTION_EXT2, }; =20 /****** END FEATURE DEFS ******/ --=20 2.25.4 From nobody Sat May 11 07:09:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1601642031; cv=none; d=zohomail.com; s=zohoarc; b=R8arKVDPpfMNRJtWb3DOL5l+ztT7xN64Y3gej3kI7LV98xpQHovxsNN2nwd/1Qvra7u6d8E/fzZiSqQMhB/w6IzPn5JbeBq4UvllGCxNIonwuTSQTsohMfk19uiL5DDPDdUOYar+PZQTeLmZvJizH+ICW8f8SEx7BqAikdseZpQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601642031; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=p15fEnU2x5Cdrh43KCW+kcJvwkIB+VO7T2snwCcFnoo=; b=HQoJeO0iEZ6Pvdo7ciPPRh2Gk/xe+AEkIh35U8ZyGi0o8mRkcJBS4rphG2IBBOuojnO/byhubbX2TUFxrKII5ZlqhEKRlW6BqKZHSJtOAjJdENZd3XWmYNw/RhpyR/dk/XalzX6GnJj979YTUqiEOIGaVcLBWARcNJIzw1sRiPo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1601642031195174.64152469348562; Fri, 2 Oct 2020 05:33:51 -0700 (PDT) Received: from localhost ([::1]:39148 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kOKFy-0007cs-0l for importer@patchew.org; Fri, 02 Oct 2020 08:33:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57168) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kOJvl-00050Z-Tj for qemu-devel@nongnu.org; Fri, 02 Oct 2020 08:12:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:41957) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kOJvj-0003YH-0v for qemu-devel@nongnu.org; Fri, 02 Oct 2020 08:12:57 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-493-ok6c72I1P2aNL-eOavot9g-1; Fri, 02 Oct 2020 08:12:46 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4A7151084C8F; Fri, 2 Oct 2020 12:12:45 +0000 (UTC) Received: from localhost (ovpn-112-216.ams2.redhat.com [10.36.112.216]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E9FE15C1D7; Fri, 2 Oct 2020 12:12:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601640768; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=p15fEnU2x5Cdrh43KCW+kcJvwkIB+VO7T2snwCcFnoo=; b=Ka1yE2kUrIgZX0xpMZRpBu2S5twJvr3uHD/gOCekIw4CNq7ZIdbK2LD9e88RXnJxqIdzir p4+DigxInMDrIvA2EBC5JznM0QgLWnLKgiU5M5xpGNzQCkYF575FGiWSzif6JN49wGzzFU d+Nh1ZJlLooJ72pqPe0k21efhep1vQE= X-MC-Unique: ok6c72I1P2aNL-eOavot9g-1 From: Cornelia Huck To: Peter Maydell Subject: [PULL 19/19] s390x/tcg: Implement CIPHER MESSAGE WITH AUTHENTICATION (KMA) Date: Fri, 2 Oct 2020 14:11:18 +0200 Message-Id: <20201002121118.180315-20-cohuck@redhat.com> In-Reply-To: <20201002121118.180315-1-cohuck@redhat.com> References: <20201002121118.180315-1-cohuck@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=cohuck@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=cohuck@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/02 01:13:31 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-s390x@nongnu.org, Cornelia Huck , Richard Henderson , qemu-devel@nongnu.org, David Hildenbrand Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: David Hildenbrand As with the other crypto functions, we only implement subcode 0 (query) and no actual encryption/decryption. We now implement S390_FEAT_MSA_EXT_8. Signed-off-by: David Hildenbrand Reviewed-by: Richard Henderson Message-Id: <20200928122717.30586-10-david@redhat.com> Signed-off-by: Cornelia Huck --- target/s390x/gen-features.c | 1 + target/s390x/insn-data.def | 1 + target/s390x/translate.c | 7 +++++++ 3 files changed, 9 insertions(+) diff --git a/target/s390x/gen-features.c b/target/s390x/gen-features.c index 02ec0a673517..a6ec918e901e 100644 --- a/target/s390x/gen-features.c +++ b/target/s390x/gen-features.c @@ -719,6 +719,7 @@ static uint16_t qemu_MAX[] =3D { /* features introduced after the z13 */ S390_FEAT_INSTRUCTION_EXEC_PROT, S390_FEAT_MISC_INSTRUCTION_EXT2, + S390_FEAT_MSA_EXT_8, }; =20 /****** END FEATURE DEFS ******/ diff --git a/target/s390x/insn-data.def b/target/s390x/insn-data.def index fc83a6ec32a4..d3bcdfd67b3c 100644 --- a/target/s390x/insn-data.def +++ b/target/s390x/insn-data.def @@ -982,6 +982,7 @@ D(0xb92d, KMCTR, RRF_b, MSA4, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KMC= TR) D(0xb92e, KM, RRE, MSA, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KM) D(0xb92f, KMC, RRE, MSA, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KMC) + D(0xb929, KMA, RRF_b, MSA8, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KMA) D(0xb93c, PPNO, RRE, MSA5, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_PPN= O) D(0xb93e, KIMD, RRE, MSA, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KIM= D) D(0xb93f, KLMD, RRE, MSA, 0, 0, 0, 0, msa, 0, S390_FEAT_TYPE_KLM= D) diff --git a/target/s390x/translate.c b/target/s390x/translate.c index bcc65893e4ff..ac10f42f1045 100644 --- a/target/s390x/translate.c +++ b/target/s390x/translate.c @@ -2710,6 +2710,12 @@ static DisasJumpType op_msa(DisasContext *s, DisasOp= s *o) TCGv_i32 t_r1, t_r2, t_r3, type; =20 switch (s->insn->data) { + case S390_FEAT_TYPE_KMA: + if (r3 =3D=3D r1 || r3 =3D=3D r2) { + gen_program_exception(s, PGM_SPECIFICATION); + return DISAS_NORETURN; + } + /* FALL THROUGH */ case S390_FEAT_TYPE_KMCTR: if (r3 & 1 || !r3) { gen_program_exception(s, PGM_SPECIFICATION); @@ -6154,6 +6160,7 @@ enum DisasInsnEnum { #define FAC_MSA3 S390_FEAT_MSA_EXT_3 /* msa-extension-3 facility */ #define FAC_MSA4 S390_FEAT_MSA_EXT_4 /* msa-extension-4 facility */ #define FAC_MSA5 S390_FEAT_MSA_EXT_5 /* msa-extension-5 facility */ +#define FAC_MSA8 S390_FEAT_MSA_EXT_8 /* msa-extension-8 facility */ #define FAC_ECT S390_FEAT_EXTRACT_CPU_TIME #define FAC_PCI S390_FEAT_ZPCI /* z/PCI facility */ #define FAC_AIS S390_FEAT_ADAPTER_INT_SUPPRESSION --=20 2.25.4