From nobody Sat Apr 27 22:04:57 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1599798757; cv=none; d=zohomail.com; s=zohoarc; b=EGqML2zjQWpw+6hBMDZJOfB/WCZK/TWrGE2eQnLyr3gWu8bIXb2LAKs+27nm5UW8O04JWdLPIg2dFdrymwaoC+eJN1HQ3fAkNO2ZsxfV4xSJkAu7jmPpmIGZlW1OGOPAo+gqi0USZNy0ZHdkHfEMxNqET31ksh0eNr53XYKOtLE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599798757; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=ObIs7ZUzOhX1e8VGE1/CqWxJuEbn2p2ZqVQ81nH+X/w=; b=f+bur3HD74XLeNAgFXF1DlR5bLjdmv1kj3tV035eOte4LMM+bfSEspSU2EOROCwaIUg3q/U3RaH0g51ZHY1POF5om3UP2SfoDzHXtiQHxJAQrbWB9MCUgUTvqfaPHCoiHRq19ljE2hOagEMsOPIkya3wuZNahaCRFf1Novv3K/0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass 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 1599798757788747.0481555554752; Thu, 10 Sep 2020 21:32:37 -0700 (PDT) Received: from localhost ([::1]:34826 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kGajj-00057A-Lm for importer@patchew.org; Fri, 11 Sep 2020 00:32:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43126) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kGaiw-0004Yf-MM; Fri, 11 Sep 2020 00:31:46 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:29680) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kGaiu-0004Jm-Ka; Fri, 11 Sep 2020 00:31:46 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 08B43icu099068; Fri, 11 Sep 2020 00:31:37 -0400 Received: from ppma04dal.us.ibm.com (7a.29.35a9.ip4.static.sl-reverse.com [169.53.41.122]) by mx0a-001b2d01.pphosted.com with ESMTP id 33g1vqgjte-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 11 Sep 2020 00:31:37 -0400 Received: from pps.filterd (ppma04dal.us.ibm.com [127.0.0.1]) by ppma04dal.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 08B4SFXW008634; Fri, 11 Sep 2020 04:31:36 GMT Received: from b03cxnp07028.gho.boulder.ibm.com (b03cxnp07028.gho.boulder.ibm.com [9.17.130.15]) by ppma04dal.us.ibm.com with ESMTP id 33c2aa0fc4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 11 Sep 2020 04:31:36 +0000 Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp07028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 08B4VZhv44892614 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 11 Sep 2020 04:31:35 GMT Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9DA32C605A; Fri, 11 Sep 2020 04:31:35 +0000 (GMT) Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8C8F3C6057; Fri, 11 Sep 2020 04:31:34 +0000 (GMT) Received: from farosas.linux.ibm.com.com (unknown [9.80.219.36]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTP; Fri, 11 Sep 2020 04:31:34 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=pp1; bh=ObIs7ZUzOhX1e8VGE1/CqWxJuEbn2p2ZqVQ81nH+X/w=; b=kKlBqycmsY7A6pL2TLFcSeFPEBkaKUI9G5AtHgHO/WbMPzIhfXddOO7x6loU4aukVjuH O+pxaADnQ4Cl3G7eeeg/9VdEOc+j/nZm2fXgalf3GhX5IY7ht6MO9svpeSKSQQldKula JJ83Jte2di/QLPRoKp+7LbMxlQU0nb1P78PmXRtGr5I6wT4O5cAq3OunzU7Mprwt2NNI G1qdPIcbgNBtHuyPd/RLR8VuadX6WSma16ylThp/SqTIzg8QIZzDbradSGxFZ5NvQ5+x cX/ft8Iu7U9+E9cPUl6d11P32OHD5DphWVtCJ27w2WezVCjAfYtOWz49oDblv/iH2Lts Zw== From: Fabiano Rosas To: qemu-devel@nongnu.org Subject: [PATCH] spapr: Handle HPT allocation failure in nested guest Date: Fri, 11 Sep 2020 01:31:23 -0300 Message-Id: <20200911043123.204162-1-farosas@linux.ibm.com> X-Mailer: git-send-email 2.25.4 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.687 definitions=2020-09-11_01:2020-09-10, 2020-09-11 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 mlxscore=0 phishscore=0 impostorscore=0 bulkscore=0 clxscore=1011 malwarescore=0 mlxlogscore=999 lowpriorityscore=0 spamscore=0 suspectscore=3 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009110026 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=farosas@linux.ibm.com; helo=mx0b-001b2d01.pphosted.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/11 00:31:42 X-ACL-Warn: Detected OS = Linux 3.x [generic] X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @ibm.com) Content-Type: text/plain; charset="utf-8" The nested KVM code does not yet support HPT guests. Calling the KVM_CAP_PPC_ALLOC_HTAB ioctl currently leads to KVM setting the guest as HPT and erroneously executing code in L1 that should only run in hypervisor mode, leading to an exception in the L1 vcpu thread when it enters the nested guest. This can be reproduced with -machine max-cpu-compat=3Dpower8 in the L2 guest command line. The KVM code has since been modified to fail the ioctl when running in a nested environment so QEMU needs to be able to handle that. This patch provides an error message informing the user about the lack of support for HPT in nested guests. Signed-off-by: Fabiano Rosas Reported-by: Satheesh Rajendran Reviewed-by: Greg Kurz --- hw/ppc/spapr.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 9bce1892b5..ea2c755310 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1483,6 +1483,12 @@ void spapr_reallocate_hpt(SpaprMachineState *spapr, = int shift, spapr_free_hpt(spapr); =20 rc =3D kvmppc_reset_htab(shift); + + if (rc =3D=3D -EOPNOTSUPP) { + error_setg(errp, "HPT not supported in nested guests"); + return; + } + if (rc < 0) { /* kernel-side HPT needed, but couldn't allocate one */ error_setg_errno(errp, errno, --=20 2.25.4