From nobody Sun May 19 16:31:32 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=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1603287963; cv=none; d=zohomail.com; s=zohoarc; b=n94zH/GKOFJqYcz4fDQHTBzujdfgDDed4tcuJp1E9V7iWjlL8WoKGM1dxArjDsrd0RVh2hGvDe3Y4FaIg+ieVaTKEBkJcm9FuNL1B/ebTbE6yAFEnWMDhIcdXGx5KRGLTu1yRGrILjKCIrlFNYksEYN5/RRlkyxRWitWSjKAGXk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603287963; h=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=dVliiDtCkD8myCUYPi1HxnZYvwqqMcc0mBlZeudvQUM=; b=W8vvMS6bMms38kmMEJ/8r3jXmhsJ6tpff16AKiu10ekfpGIjPJy+acC2X0IHRsE0C2cKD+c+9AogCmOEFE2yVuUhqF0EnAAh1wh81ce3RY90RmwuFBvvuin7WakxZN9C9KvYCMo/PjYM8o0l6JmHA31IY3q4mHbWovSpI/aanQM= 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 1603287962905705.0785701789463; Wed, 21 Oct 2020 06:46:02 -0700 (PDT) Received: from localhost ([::1]:47616 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVERE-00076J-MI for importer@patchew.org; Wed, 21 Oct 2020 09:46:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37512) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVEPL-0005qn-OJ; Wed, 21 Oct 2020 09:44:03 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:17440 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVEPJ-0006UN-2A; Wed, 21 Oct 2020 09:44:03 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 09LDgR0E106775; Wed, 21 Oct 2020 09:43:57 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 34anv288kx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 21 Oct 2020 09:43:57 -0400 Received: from m0098414.ppops.net (m0098414.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 09LDhu7p110352; Wed, 21 Oct 2020 09:43:56 -0400 Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0b-001b2d01.pphosted.com with ESMTP id 34anv288kd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 21 Oct 2020 09:43:56 -0400 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 09LDcVY3007995; Wed, 21 Oct 2020 13:43:55 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma03fra.de.ibm.com with ESMTP id 347r87t95b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 21 Oct 2020 13:43:54 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 09LDhqN525035126 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 21 Oct 2020 13:43:52 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D8DA2A405B; Wed, 21 Oct 2020 13:43:51 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E7EBEA4057; Wed, 21 Oct 2020 13:43:50 +0000 (GMT) Received: from linux01.pok.stglabs.ibm.com (unknown [9.114.17.81]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 21 Oct 2020 13:43:50 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=dVliiDtCkD8myCUYPi1HxnZYvwqqMcc0mBlZeudvQUM=; b=XxxEEg9vWqFkwFva2xGTW93HrvXunPQJvRD35jiiwXZTjMm1C5WMuRxfwqav4HYdhH/F Hs6v7mnIVQ++LxREdE8hw5K2gFs37l022W6CdXdyhsMbjn8tSubrWVULlHxc+7Eh/4Tu 3oRFXb/W6Fb6LihlB0qzDIbW7sfbCLk0niInCFMyiqGZFu3MPH5NI1D1sYQPt0fYl0fm W8fY2GmL7BXEDG1iS/LvFuFfydot0YXlLJql109+83OWlKkwfP8prudJlPFyz6iNLfUg Ic1tVXMOAgsEwtncyHi2yh06afgD/yB1/W36iwH1LXEQFhjN4OprlbcsrmZGl16+drAI pw== From: Janosch Frank To: qemu-devel@nongnu.org Subject: [PATCH 1/2] s390x: pv: Remove sclp boundary checks Date: Wed, 21 Oct 2020 09:43:44 -0400 Message-Id: <20201021134345.110173-2-frankja@linux.ibm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201021134345.110173-1-frankja@linux.ibm.com> References: <20201021134345.110173-1-frankja@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.737 definitions=2020-10-21_06:2020-10-20, 2020-10-21 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=1 clxscore=1015 spamscore=0 priorityscore=1501 adultscore=0 malwarescore=0 lowpriorityscore=0 impostorscore=0 mlxlogscore=999 phishscore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010210103 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=148.163.158.5; envelope-from=frankja@linux.ibm.com; helo=mx0a-001b2d01.pphosted.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/21 09:43:58 X-ACL-Warn: Detected OS = Linux 3.x [generic] X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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: thuth@redhat.com, david@redhat.com, cohuck@redhat.com, walling@linux.ibm.com, pasic@linux.ibm.com, borntraeger@de.ibm.com, qemu-s390x@nongnu.org, mhartmay@linux.ibm.com 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" The SCLP boundary cross check is done by the Ultravisor for a protected guest, hence we don't need to do it. As QEMU doesn't get a valid SCCB address in protected mode this is even problematic and can lead to QEMU reporting a false boundary cross error. Signed-off-by: Janosch Frank Reported-by: Marc Hartmayer Fixes: db13387ca0 ("s390/sclp: rework sclp boundary checks") Reviewed-by: Christian Borntraeger Tested-by: Marc Hartmayer Acked-by: David Hildenbrand Acked-by: Halil Pasic Reviewed-by: Thomas Huth --- hw/s390x/sclp.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c index 00f1e4648d..0cf2290826 100644 --- a/hw/s390x/sclp.c +++ b/hw/s390x/sclp.c @@ -285,11 +285,6 @@ 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), code= )) { - work_sccb->h.response_code =3D cpu_to_be16(SCLP_RC_SCCB_BOUNDARY_V= IOLATION); - goto out_write; - } - sclp_c->execute(sclp, work_sccb, code); out_write: s390_cpu_pv_mem_write(env_archcpu(env), 0, work_sccb, --=20 2.25.1 From nobody Sun May 19 16:31:32 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=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1603288060; cv=none; d=zohomail.com; s=zohoarc; b=nb3Kwx9Afej26vo8bRz4xPS2/H67lTpqWdaJPzaELbm6PC7EcFB12OmOtIE5CRffRjCVW7W+PYgaAUFCmnQJQTXJqVJfPlR59Jexn4A/ftQsh6nmaTApd/ulK3yu6Vn9ret1NOXV04QtI3y3M6u/nomxWaoib2pnnU6riMvYUUU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603288060; h=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=49G3bSDWQYjcldBk0Fo4veCK0xIVuTlGHuQc7ticxBk=; b=LdjFh1oDAI326zFshidcEnRfRRKcuxuhyNFStMJhqqxl85QeLFiinQ6xTM5HKG23UFB8ZQFhNDUr5oeDRgaicVt6jH0p8uZ4YKLUUfEXzaop0d63HKfm2vF7HAhnrQ06uQjlMyC3H9UNvo0HTx0GUire0NUhCkF3dVzbhIdYm6I= 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 1603288060245174.79359331516412; Wed, 21 Oct 2020 06:47:40 -0700 (PDT) Received: from localhost ([::1]:52664 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVESo-0000rS-Mg for importer@patchew.org; Wed, 21 Oct 2020 09:47:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37742) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVEQK-000781-I7; Wed, 21 Oct 2020 09:45:05 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:54914) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVEQH-0006Z2-Vy; Wed, 21 Oct 2020 09:45:04 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 09LDXgDr192887; Wed, 21 Oct 2020 09:44:59 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 34ajunexrn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 21 Oct 2020 09:44:59 -0400 Received: from m0098409.ppops.net (m0098409.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 09LDXpOH193736; Wed, 21 Oct 2020 09:44:58 -0400 Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 34ajunexqp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 21 Oct 2020 09:44:58 -0400 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 09LDb84K009362; Wed, 21 Oct 2020 13:43:56 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma03ams.nl.ibm.com with ESMTP id 348d5quh39-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 21 Oct 2020 13:43:56 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 09LDhrhN32702778 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 21 Oct 2020 13:43:53 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 051C9A4040; Wed, 21 Oct 2020 13:43:53 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 15B3EA404D; Wed, 21 Oct 2020 13:43:52 +0000 (GMT) Received: from linux01.pok.stglabs.ibm.com (unknown [9.114.17.81]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 21 Oct 2020 13:43:51 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=49G3bSDWQYjcldBk0Fo4veCK0xIVuTlGHuQc7ticxBk=; b=hGZWJmb2cvCW5Dt9FksjeOXEcsKlQfJx6qQkbQuub4R5dDhb/8BbJyZic6YOY+6mmmVy QQ1s67amFxLk1barcB2ZRYCgzZbtXfh0PoT3ap+fNpjgQjYm0y2f3Es2Wg+KEN5HShmv TyR+/a75RLQ4H+O04FSpko0c6I+FD5PrMMKO4hWXLFgA0b4QHhuEyd9eKyNJXHWsr2/f dlsSbnUFvhQ9DYnNtBnPDCKnYOHsSO7pTDopV/VuSwlo284qNdmyVapJuKcjRKO+/20H ipZFnbuKf3a6RY6SSONDZprqPpylX+axYBKu6AlsWQPFDNlKgojcJGzbFfL3dV0lh564 kw== From: Janosch Frank To: qemu-devel@nongnu.org Subject: [PATCH 2/2] s390x: pv: Fix diag318 PV fencing Date: Wed, 21 Oct 2020 09:43:45 -0400 Message-Id: <20201021134345.110173-3-frankja@linux.ibm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201021134345.110173-1-frankja@linux.ibm.com> References: <20201021134345.110173-1-frankja@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.737 definitions=2020-10-21_06:2020-10-20, 2020-10-21 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=1 mlxlogscore=999 mlxscore=0 spamscore=0 adultscore=0 impostorscore=0 bulkscore=0 malwarescore=0 phishscore=0 lowpriorityscore=0 clxscore=1015 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010210103 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=148.163.156.1; envelope-from=frankja@linux.ibm.com; helo=mx0a-001b2d01.pphosted.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/21 09:43:57 X-ACL-Warn: Detected OS = Linux 3.x [generic] [fuzzy] X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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: thuth@redhat.com, david@redhat.com, cohuck@redhat.com, walling@linux.ibm.com, pasic@linux.ibm.com, borntraeger@de.ibm.com, qemu-s390x@nongnu.org, mhartmay@linux.ibm.com 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" Diag318 fencing needs to be determined on the current VM PV state and not on the state that the VM has when we create the CPU model. Signed-off-by: Janosch Frank Reported-by: Marc Hartmayer Reviewed-by: Christian Borntraeger Fixes: fabdada935 ("s390: guest support for diagnose 0x318") Tested-by: Marc Hartmayer --- hw/s390x/sclp.c | 10 ++++++++++ target/s390x/kvm.c | 3 +-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c index 0cf2290826..69aba402d3 100644 --- a/hw/s390x/sclp.c +++ b/hw/s390x/sclp.c @@ -22,6 +22,7 @@ #include "hw/s390x/event-facility.h" #include "hw/s390x/s390-pci-bus.h" #include "hw/s390x/ipl.h" +#include "hw/s390x/pv.h" =20 static inline SCLPDevice *get_sclp_device(void) { @@ -142,6 +143,15 @@ static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb) if (s390_has_feat(S390_FEAT_EXTENDED_LENGTH_SCCB)) { s390_get_feat_block(S390_FEAT_TYPE_SCLP_FAC134, &read_info->fac134); + /* + * Diag318 is not available in protected mode and will result + * in an operation exception. As we can dynamically move in + * and out of protected mode, we need to fence the feature + * here rather than when creating the CPU model. + */ + if (s390_is_pv()) { + read_info->fac134 &=3D ~0x80; + } } =20 read_info->facilities =3D cpu_to_be64(SCLP_HAS_CPU_INFO | diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index f13eff688c..baa070fdf7 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -2498,8 +2498,7 @@ 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)) { + if (kvm_check_extension(kvm_state, KVM_CAP_S390_DIAG318)) { set_bit(S390_FEAT_DIAG_318, model->features); } =20 --=20 2.25.1