Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp238902rdb; Thu, 18 Jan 2024 01:58:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IFeUNqusZuTlqV+KIXSyEQ2Nd9fkfzSAd+0uMYHFuw+q1+Bd6G5NEkbLaQIq1/cqnSPixdJ X-Received: by 2002:a05:6a00:428d:b0:6d9:b320:94c9 with SMTP id bx13-20020a056a00428d00b006d9b32094c9mr622466pfb.33.1705571928118; Thu, 18 Jan 2024 01:58:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705571928; cv=pass; d=google.com; s=arc-20160816; b=cVt6aoGfxxXCqzp8D/cvRJEwxPjJ+QHZcvGss7wDDiyCJzvToAeGXR8XTsR9dmhVFB IQp0s3MTO6h36s8ht+ElIzsHA4CbQuZ9DZDPvuB22vFS6UZak1/fbdQeXkTK/OYoJLFw pRhfyqpJJCIQaRh4/3fdSFrjElmlEwCQPFauV0KFlFp8s4asS4SSUepJytqs0jYQPUh8 wc54B6UTgu1eHOTwkDWDJAwrppPLLMX2d2oOSC0Suq2KRGk2WG98xGDieDzGYprIjSgI MXq30+kKtZmHre+NUpVogmU+UY+/g88v+k+dJLK895Qfi5qAYvr3JHbjL79mLbrm9BZR CUjA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=tDsa17QGnZJdJ7xoNKAU1deQRzOdcbYO8QmA7kYtEIc=; fh=sDkaTom/Ll/ftvYU3leOOynxpMdqlaux7os0gQIqzHI=; b=EfKrBfAznhy+JfwlL/XvljafbZhLJBNygj7Hb3y/s3kYaOqE6wrhKFWAJqvRG5HkAU 9Nx5luRhMNCjv7G3VU7+VHPATSqgA4p0/aGLDxaJuVIKZVIGKT//VHw9PJbOXNxn3gZZ VeWxvSsy2roVRIrlqd+MnTXc7K1NjxH7iogjo/UP3DUeoWrjDi19Nr8f36CRW2+sJbEe nynPBjnCO4Hxms5Zbp16mjAgAioycAphV85o1SERT02azw44UWkZ3UOdGB/3pdwgHEUf rB/jiva2ldP51wfmDUOF6JQy6u64UcbjsHQbAHuSo01IxbIFVExyfVX0WmcWX4yFY2H2 gl+A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=LNluS1n3; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-29988-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29988-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id i70-20020a638749000000b005893a7c438esi1192862pge.689.2024.01.18.01.58.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 01:58:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-29988-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=LNluS1n3; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-29988-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29988-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id D910EB21545 for ; Thu, 18 Jan 2024 09:58:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BC33920339; Thu, 18 Jan 2024 09:58:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="LNluS1n3" Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7B358125D1; Thu, 18 Jan 2024 09:58:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705571914; cv=none; b=m9OcnPFPxsZBOQMcJ5H+C7RITjHLQV+2O9vM15/BIs96hT94hO1L22JuAEDDG35fXNplBi0DfCdbWwW+sTPpI5bwLkIo63SbVN4BWiC0EGQLyUk1gcY00BH6TCTr77Ud1XxFxUbrzroAz2PI9x+KHJQsXIl1xLxZuamODfHfQSQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705571914; c=relaxed/simple; bh=us7rkNzH3kgjjBtdp/OFNF7E2uhJBQ6GmJ8gywPwYDY=; h=Received:DKIM-Signature:Received:Received:Received:Received: Received:Received:Received:Received:Received:From:To:Cc:Subject: Date:Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding: X-TM-AS-GCONF:X-Proofpoint-GUID:X-Proofpoint-ORIG-GUID: X-Proofpoint-Virus-Version:X-Proofpoint-Spam-Details; b=oX1EGv4HuT5hEroEKfndJmCsL602ESP3Rf8t6S7DlC4kiPHiPT5Y+j4H9NFOSzXnhmJlOhoppCU0Hln3TvlORSGopQcix2IgJKlQHnBKsG/sxvkyRnUc4mW0yZmvzrHlyJHct7qFV455xHiVSw6rl1Q3K+vaFpZwdJs3zah4NOg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=LNluS1n3; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 40I9Keqp003504; Thu, 18 Jan 2024 09:58:11 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=tDsa17QGnZJdJ7xoNKAU1deQRzOdcbYO8QmA7kYtEIc=; b=LNluS1n3x8Hb6WLcT5dJt2X7g3hPRIi6MuAhjB9rfPCT8GmIIxFO9R+omJfNCfgLYPqM 7fTSFJmlD8Y0kEuQlFn00dWGe5lROXQ1RNikZdy8vxOIsc4TDVFh9PSYY8pm47jucc1H r2fnEFBnhYjd/fddA9t1zSUNGO60dVDax9XS2gqxeGgNaqta8NoiL3dRt+5HVCGlIQcp Ic5agQL8bDmErzQGYsYS1ir0O2xi9gHgmxUkDPdzOyAQ1Hgx07gpSQ559oqo5DE+iDJq zLiSDjhTEYUAXqSdRMxwMuN6x4YsmP4t+MtG16pIVhP1Zl17ur2wAv7VCAQ3BQif+M6+ hQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3vq12x97ks-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 18 Jan 2024 09:58:10 +0000 Received: from m0360083.ppops.net (m0360083.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 40I9NZEe016473; Thu, 18 Jan 2024 09:58:10 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3vq12x97jp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 18 Jan 2024 09:58:10 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 40I6t3l8005788; Thu, 18 Jan 2024 09:58:08 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3vm6bkth3a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 18 Jan 2024 09:58:08 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 40I9w51k41222586 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 18 Jan 2024 09:58:05 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4DD7A2004E; Thu, 18 Jan 2024 09:58:05 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AD7E420040; Thu, 18 Jan 2024 09:58:02 +0000 (GMT) Received: from li-a83676cc-350e-11b2-a85c-e11f86bb8d73.in.ibm.com (unknown [9.204.204.156]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 18 Jan 2024 09:58:02 +0000 (GMT) From: Amit Machhiwal To: linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org, kvm-ppc@vger.kernel.org Cc: Vaibhav Jain , Nicholas Piggin , Michael Ellerman , Jordan Niethe , Vaidyanathan Srinivasan , "Aneesh Kumar K . V" , "Naveen N . Rao" , Christophe Leroy , Amit Machhiwal , Amit Machhiwal , linux-kernel@vger.kernel.org Subject: [PATCH] KVM: PPC: Book3S HV: Fix L2 guest reboot failure due to empty 'arch_compat' Date: Thu, 18 Jan 2024 15:26:53 +0530 Message-ID: <20240118095653.2588129-1-amachhiw@linux.ibm.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: -Ffy459YXDPle-vIK3r04gKDoVnHSbTb X-Proofpoint-ORIG-GUID: Rl1pfpqO9J81VDdV_1Gvp8ltEJWiRkzB X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-18_05,2024-01-17_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 spamscore=0 phishscore=0 malwarescore=0 bulkscore=0 mlxlogscore=700 adultscore=0 clxscore=1011 priorityscore=1501 mlxscore=0 impostorscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2401180071 Currently, rebooting a pseries nested qemu-kvm guest (L2) results in below error as L1 qemu sends PVR value 'arch_compat' == 0 via ppc_set_compat ioctl. This triggers a condition failure in kvmppc_set_arch_compat() resulting in an EINVAL. qemu-system-ppc64: Unable to set CPU compatibility mode in KVM: Invalid This patch updates kvmppc_set_arch_compat() to use the host PVR value if 'compat_pvr' == 0 indicating that qemu doesn't want to enforce any specific PVR compat mode. Signed-off-by: Amit Machhiwal --- arch/powerpc/kvm/book3s_hv.c | 2 +- arch/powerpc/kvm/book3s_hv_nestedv2.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index 1ed6ec140701..9573d7f4764a 100644 --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c @@ -439,7 +439,7 @@ static int kvmppc_set_arch_compat(struct kvm_vcpu *vcpu, u32 arch_compat) if (guest_pcr_bit > host_pcr_bit) return -EINVAL; - if (kvmhv_on_pseries() && kvmhv_is_nestedv2()) { + if (kvmhv_on_pseries() && kvmhv_is_nestedv2() && arch_compat) { if (!(cap & nested_capabilities)) return -EINVAL; } diff --git a/arch/powerpc/kvm/book3s_hv_nestedv2.c b/arch/powerpc/kvm/book3s_hv_nestedv2.c index fd3c4f2d9480..069a1fcfd782 100644 --- a/arch/powerpc/kvm/book3s_hv_nestedv2.c +++ b/arch/powerpc/kvm/book3s_hv_nestedv2.c @@ -138,6 +138,7 @@ static int gs_msg_ops_vcpu_fill_info(struct kvmppc_gs_buff *gsb, vector128 v; int rc, i; u16 iden; + u32 arch_compat = 0; vcpu = gsm->data; @@ -347,8 +348,15 @@ static int gs_msg_ops_vcpu_fill_info(struct kvmppc_gs_buff *gsb, break; } case KVMPPC_GSID_LOGICAL_PVR: - rc = kvmppc_gse_put_u32(gsb, iden, - vcpu->arch.vcore->arch_compat); + if (!vcpu->arch.vcore->arch_compat) { + if (cpu_has_feature(CPU_FTR_ARCH_31)) + arch_compat = PVR_ARCH_31; + else if (cpu_has_feature(CPU_FTR_ARCH_300)) + arch_compat = PVR_ARCH_300; + } else { + arch_compat = vcpu->arch.vcore->arch_compat; + } + rc = kvmppc_gse_put_u32(gsb, iden, arch_compat); break; } -- 2.43.0