From nobody Tue Jun 16 18:01:11 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 3FE522E401; Thu, 30 Apr 2026 05:50:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777528231; cv=none; b=kfVh64GmCiauywoyULKufcRpEfYkZogFQkrgkZTFdhBJYAoMqmPsSIutvAMRJwmMIznVc/8vJ7oFKhxQ38HgludwhQKRaYiobHghLhf+axeBgUAwpD0mUGXEOrfOtmPY+GnGa3fYHwBsnrgvlKJgQhViXsSXsFKpZTMznc1eiE8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777528231; c=relaxed/simple; bh=M0SjA1f10uVxQ2w9Ge9hE+2+S3awl2IFtkUjUTWswbs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bUTkTfemoGPSBtbKhVL+HcPcHVXi+Jbxzv6dFQf2Z239LtBmEa05AbAdx9UCZsB3moyDeOg+1DV8BpIiFHhm5VNiVJaf5iepouYu96T7xmJQ7bzUxdpQpaEetGzjd80Aq9qt2UtPIZFi5iX4p6xumHr6TxjO4nP7gx8vWJuJ2eY= 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=svjj4TBr; arc=none smtp.client-ip=148.163.158.5 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="svjj4TBr" Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63TGvvQD1895497; Thu, 30 Apr 2026 05:50:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=Ubv6yMYn9d//u05u3 4jzNdKgQTaW5W4pj0AddL7IWss=; b=svjj4TBrn4aZkvDbzolMj8YF6qj+ob52Q rsn8OX1ObecoIX8ZIuRbgDBR8X9HZFcU2uYs10qthTT6TqHV5aZwLIISlqIf95QF l4/LfKU4WArc4cYBOK5GeH8KreujIBBWDbf6qQziafCRsuj2l+fQEDN6fv4vc83V pMRT7oqT9GoAV/MZHDGo+kKJnBE5O1k8hMfAhfg/lkhVTffEJhnaztl4eKofKuwA 8PyR07wbY2KGy4UGUG+nN9gZLIj9UsWwvMKm9yf7r5BXEq/Fu1K/t/X63QN3fRTZ us5Yj3qHfe/zq2wt8gRf/E3UfSuzCCVrU17MTiSRl39ihKIGVX6gQ== Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4drm1e4f9h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 30 Apr 2026 05:50:16 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 63U5cnE8018013; Thu, 30 Apr 2026 05:50:16 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4ds8xk9k32-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 30 Apr 2026 05:50:16 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 63U5oCU040829312 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 Apr 2026 05:50:12 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E93B320043; Thu, 30 Apr 2026 05:50:11 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A6EF220040; Thu, 30 Apr 2026 05:50:08 +0000 (GMT) Received: from localhost.localdomain (unknown [9.39.18.70]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 30 Apr 2026 05:50:08 +0000 (GMT) From: Amit Machhiwal To: linuxppc-dev@lists.ozlabs.org, Madhavan Srinivasan Cc: Amit Machhiwal , Vaibhav Jain , Nicholas Piggin , Michael Ellerman , "Christophe Leroy (CS GROUP)" , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/6] KVM: PPC: Book3S HV: Validate arch_compat against host compatibility mode Date: Thu, 30 Apr 2026 11:19:00 +0530 Message-ID: <20260430054906.94431-2-amachhiw@linux.ibm.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260430054906.94431-1-amachhiw@linux.ibm.com> References: <20260430054906.94431-1-amachhiw@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-ORIG-GUID: zt7r0mqoNlX3WLlD1khd0zPKSRuFFnQa X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDMwMDA1NSBTYWx0ZWRfX6OVWkafEfjB8 mGOxl+gtNffqwNC0wEugg5aIzIDy5P9Eo/9wtpRfGvyESiLF2M5y3Axw/+ZW7aScOwaXXoxAX0C 67UhbAH/fqnIStVlf04g4Et9Cr2090B+++Q9UvCU1ErcWuU6SfUhaKk/X91DBO3P+XNyfkYt3ZS L0b+ovgMHuZrp5mndhha+k38YvNUds1s4yhs1mPBQVGLiFf3GwdSsHQn57Uf24FGYbeg4yfEn/F kq3nRTEV4MNX3LtwXSaZI74+ZPJ+RA4jNhU1vr5xsdbEselicHS0LUwbuyQGzsWmWeJxyLMct8u Czx8wB6UGGPGJKPhEBVlAGFTKw80SXvceCALTM79Yc/TqTGHscAaQs8UhiDewJ0fCklHv3mROV7 vu6ApxZdtiQzoeYFRQ4Mf7djOO38oEdTq8Mbtj71M0tF/sEuCe6N1NLZX4aDxQocQP8xirnGtq7 WtOyJeHgbivWYO6N1YQ== X-Authority-Analysis: v=2.4 cv=VZLH+lp9 c=1 sm=1 tr=0 ts=69f2ed99 cx=c_pps a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17 a=A5OVakUREuEA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=V8glGbnc2Ofi9Qvn3v5h:22 a=VnNF1IyMAAAA:8 a=9nGdcix9NZkGgJ1vRr8A:9 X-Proofpoint-GUID: CQNBagWsl1eIXAex8tZNSm3NPZAAFrRF X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-30_01,2026-04-28_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 suspectscore=0 adultscore=0 lowpriorityscore=0 phishscore=0 spamscore=0 malwarescore=0 bulkscore=0 priorityscore=1501 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604200000 definitions=main-2604300055 Content-Type: text/plain; charset="utf-8" On IBM POWER systems, newer processor generations can operate in compatibility modes corresponding to earlier generations. This becomes relevant for nested virtualization, where nested KVM guests may need to run with a specific processor compatibility level. Currently, when running a nested KVM guest (L2) inside a Power11 pSeries logical partition (L1) booted in Power10 compatibility mode, the guest fails to boot while setting 'arch_compat'. This happens because the CPU class is derived from the hardware PVR (via mfspr()), which reflects the physical processor generation (Power11), rather than the effective compatibility mode (Power10). As a result, userspace may request a Power11 arch_compat for the L2 guest. However, the L1 partition, running in Power10 compatibility, has only negotiated support up to Power10 with the Power Hypervisor (L0). When H_SET_STATE is invoked with a Power11 Logical PVR, the hypervisor rejects the request, leading to a late guest boot failure: KVM-NESTEDv2: couldn't set guest wide elements [..KVM reg dump..] This situation should be detected earlier. Rejecting unsupported 'arch_compat' values in 'kvmppc_set_arch_compat()' avoids issuing an invalid H_SET_STATE hcall and provides a clearer failure mode. Add a check to reject Power11 'arch_compat' requests when the host is running in Power10 compatibility mode, returning -EINVAL early instead of deferring the failure to the hypervisor. Signed-off-by: Amit Machhiwal --- arch/powerpc/kvm/book3s_hv.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index 61dbeea317f3..948c6b099a29 100644 --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c @@ -446,7 +446,13 @@ static int kvmppc_set_arch_compat(struct kvm_vcpu *vcp= u, u32 arch_compat) guest_pcr_bit =3D PCR_ARCH_300; break; case PVR_ARCH_31: + guest_pcr_bit =3D PCR_ARCH_31; + break; case PVR_ARCH_31_P11: + if ((PVR_ARCH_31 & cur_cpu_spec->pvr_mask) =3D=3D + cur_cpu_spec->pvr_value) { + return -EINVAL; + } guest_pcr_bit =3D PCR_ARCH_31; break; default: --=20 2.50.1 From nobody Tue Jun 16 18:01:11 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 F00A82E401; Thu, 30 Apr 2026 05:50:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777528244; cv=none; b=b019MnmQQuYzpYGCRo4Txe6LLd05WwDhg+M9orjRgMiJGU36f35HcQ2hncDy1bODJuFbY36/nO4LUAZchNlgS823MW7B9Yt9zE1hqiV1U4QJvCDnkX3a/lW1V3TgcIEKaGyPzgfyXmOVCSbV+F6fjfTuzPEWR9TARmGxX85mkE4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777528244; c=relaxed/simple; bh=Vhht9794HXQ938YCN4lGHDlmIYPgUsKnlKPWob5NhMQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Obs4q9nyQNRx7S4CpygjMCakEwD7ERdPTRERtOmx26eK8Jt6zofvJ25GLUryzWy+6BYgexysV7h774pmKqCR4O3fhXZb7eJJd38NQ6VOhZVV6Rul7tPfOc1AbtmXzPXkYcn1W/7hIXknThWesBOqIKaCkc9ZU3jjzJzDaukyNOM= 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=UkvMBih0; arc=none smtp.client-ip=148.163.158.5 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="UkvMBih0" Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63TGQKwW1381532; Thu, 30 Apr 2026 05:50:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=kRHLaJYJOvSkXJuRt Sw56wFj4c4/U5VwrUJ/mjyaPbw=; b=UkvMBih0JfGBr7FeRqVutWPTEYvjpu0uN 0VKc1UILaJxW5xeuLWPaQI7UZffT8dVwS86WzTSUagE9xYJzOVkBFdZFcsOr9jhU /ltWDL3PwUjRIIOuwi4xYaxZuRP76o4WaNpvBBjFjJzDiyIKOpHfvIvguFV4FP7A a+eoJYb4myO2Rm/b7pf4EZs+Jr+89RvI9VYe2//59wHT8m4scXnF0TX5iPGdK8Is 51pDBUItTEk/zGiHn9zYIe1EOaID/AXfc/jo4OabTIgWhf9IoR90LbACtyK2zZHu 9rXmDqu7mECgYsWDbCYgBAN3Kxz7dU0k1vGfu4Px+YPRCzxmoupqA== Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4drk1jvm6a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 30 Apr 2026 05:50:26 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 63U5crun010301; Thu, 30 Apr 2026 05:50:25 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 4dsamyhbfy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 30 Apr 2026 05:50:25 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 63U5oMdX30016064 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 Apr 2026 05:50:22 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F37AB20043; Thu, 30 Apr 2026 05:50:21 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 866F420040; Thu, 30 Apr 2026 05:50:18 +0000 (GMT) Received: from localhost.localdomain (unknown [9.39.18.70]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 30 Apr 2026 05:50:18 +0000 (GMT) From: Amit Machhiwal To: linuxppc-dev@lists.ozlabs.org, Madhavan Srinivasan Cc: Amit Machhiwal , Vaibhav Jain , Paolo Bonzini , Nicholas Piggin , Michael Ellerman , "Christophe Leroy (CS GROUP)" , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/6] KVM: PPC: Introduce KVM_CAP_PPC_COMPAT_CAPS and KVM_PPC_GET_COMPAT_CAPS Date: Thu, 30 Apr 2026 11:19:01 +0530 Message-ID: <20260430054906.94431-3-amachhiw@linux.ibm.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260430054906.94431-1-amachhiw@linux.ibm.com> References: <20260430054906.94431-1-amachhiw@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDMwMDA1NSBTYWx0ZWRfX7ApGCVSfmgVV VGoO1X7c7/KM7S+/jEddz8GLi8ozSmSRlZ101rbtGkkkOjGP6e4TZ9C+TKXTasN4F51XmFPEZzG Fi53qAp9m557zalkUoBWuITS7h1cUcoXI7AKbJlEtJGixO9vtGUoxt9bZPdxHPUyL0Oy8oiAjG/ iUfDEXTcuH+g5SfOP6LEslivVjdRebfWJoP42gKu9asF3cZC63Wh879yzC/tyIHdaljDYyUAIfv 7w1p8WZArKoD3IWZneo4cB3h9NXZvWM5cPf4R6bXtbUghxPsCAeglQLR24twAkTXC0Eo/tMGUTf 5AULVNbp5ZIza584rKOaieFaGZae5t4eBT45b2wXggTCJssOlxEnASArI6lK14uMCJbsQg/X7HW aBL2d6UdP5MBYXmU1rRc+18I6kvYyIUti+yVlkf3iZNE5+ov2kWfP6EJNlCNwKPvedZan1j7bKj PnjbgBnmJWINs/TK+eQ== X-Proofpoint-GUID: 96lL4LaNIR1eM_sSVTGwF4xQporZ2bRu X-Proofpoint-ORIG-GUID: Tp3jD4YFcuJfBz4z8oYH2TTtSLLlwBfk X-Authority-Analysis: v=2.4 cv=MohiLWae c=1 sm=1 tr=0 ts=69f2eda2 cx=c_pps a=aDMHemPKRhS1OARIsFnwRA==:117 a=aDMHemPKRhS1OARIsFnwRA==:17 a=A5OVakUREuEA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=Y2IxJ9c9Rs8Kov3niI8_:22 a=VnNF1IyMAAAA:8 a=lArzyTj6eNMAAlWrubwA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-30_01,2026-04-28_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 adultscore=0 suspectscore=0 bulkscore=0 spamscore=0 priorityscore=1501 malwarescore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604200000 definitions=main-2604300055 Content-Type: text/plain; charset="utf-8" Introduce a new capability and ioctl to expose CPU compatibility modes supported by the host processor for nested guests. Introduce a new KVM capability, KVM_CAP_PPC_COMPAT_CAPS, and a corresponding vm ioctl, KVM_PPC_GET_COMPAT_CAPS, to expose processor compatibility modes supported by the host. On IBM POWER systems, newer processor generations (N) can operate in compatibility modes corresponding to earlier generations, like (N-1) and (N-2). This is particularly relevant for nested virtualization, where nested KVM guests may need to run with a specific processor compatibility level. The new ioctl returns a bitmap describing the compatibility modes supported by the host in respective bit numbers. This allows userspace to select an appropriate compatibility level when configuring nested KVM guests. Signed-off-by: Amit Machhiwal --- arch/powerpc/include/uapi/asm/kvm.h | 6 ++++++ include/uapi/linux/kvm.h | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/arch/powerpc/include/uapi/asm/kvm.h b/arch/powerpc/include/uap= i/asm/kvm.h index 077c5437f521..a38dff7a8aea 100644 --- a/arch/powerpc/include/uapi/asm/kvm.h +++ b/arch/powerpc/include/uapi/asm/kvm.h @@ -437,6 +437,12 @@ struct kvm_ppc_cpu_char { __u64 behaviour_mask; /* valid bits in behaviour */ }; =20 +/* For KVM_PPC_GET_COMPAT_CAPS */ +struct kvm_ppc_compat_caps { + __u32 flags; + __u64 compat_capabilities; /* Capabilities supported by the host */ +}; + /* * Values for character and character_mask. * These are identical to the values used by H_GET_CPU_CHARACTERISTICS. diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h index 6c8afa2047bf..1788a0068662 100644 --- a/include/uapi/linux/kvm.h +++ b/include/uapi/linux/kvm.h @@ -996,6 +996,7 @@ struct kvm_enable_cap { #define KVM_CAP_S390_USER_OPEREXEC 246 #define KVM_CAP_S390_KEYOP 247 #define KVM_CAP_S390_VSIE_ESAMODE 248 +#define KVM_CAP_PPC_COMPAT_CAPS 249 =20 struct kvm_irq_routing_irqchip { __u32 irqchip; @@ -1349,6 +1350,9 @@ struct kvm_s390_keyop { #define KVM_GET_DEVICE_ATTR _IOW(KVMIO, 0xe2, struct kvm_device_attr) #define KVM_HAS_DEVICE_ATTR _IOW(KVMIO, 0xe3, struct kvm_device_attr) =20 +/* Available with KVM_CAP_PPC_COMPAT_CAPS */ +#define KVM_PPC_GET_COMPAT_CAPS _IOR(KVMIO, 0xe4, struct kvm_ppc_compat_c= aps) + /* * ioctls for vcpu fds */ --=20 2.50.1 From nobody Tue Jun 16 18:01:11 2026 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 DB295370D71; Thu, 30 Apr 2026 05:50:44 +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=1777528246; cv=none; b=nh5w9tmgcUNJQg0YiK0TZuFkWxfKMAe9vvsWxgl7PB1xfcVQWnPK00ziRRZOD0Xit3lz73JnlUSCOym19dZOM7Sjd5SUyXk3UGMr44RtFAuwNKbS4IBzKBO7bWTZam+E/QrNuC5xDKC/VT03x/Rtupqy5sJna3o5I5rqgyiq6Xw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777528246; c=relaxed/simple; bh=J+5LNB2VNY73hYQDaK4DNgHv1tsHZKUBzanjAr72QxA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fUZ22YF/0LuoxKfDhpvODS+biEVo7ILHs1mfXPjeKAjl8tTsqydqIJ0T4yy+xIu3Yo3+YQmzXha5o/9dyCTSlLzFrSWj0GwJbmHy4bldPFgJWW++fzRaocuf58YKDs1uU3TyLC/DEKZ9c1gCLxLh2vRRpdSa4WKh1RNNedRpAsA= 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=EUvm/qjg; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="EUvm/qjg" Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63TLdf7X3991826; Thu, 30 Apr 2026 05:50:35 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=zux2iqmTVMoxCwd+G glwc5wsABaBBuAJANF/lFJMKzo=; b=EUvm/qjgmAo0X+WglVWZuPQxUssZB4o9J Zq2BC4XmjtJaaXqBKy3cCntJecGEaCAC3M0xCZMHmrem7xBZQWT3fIAzqtnyJSuK ky0WI5r4ghEjjmfx04C3/hw97Ps7TZBH3+jyqphgltsNFSlitxjjmbaSGPuZlWwl h9uEdAatEAZvwcnCgiQMZIdejQSTH4pKRhDg0JgyCOpePIXffzntmcJqrYHVo84B Yp0lrxI+2C8+Fu64hBI7YzuYuA85Ur1qz7RWQj9Tf3AUZ2WaQ4y3RQt+cv2GeOi7 Z/RtyS//aL/4EVHBgYrZ4XKGXMKPkkY09H7qziKmVjhlXNiDRU5Gg== Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4drn44x6yh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 30 Apr 2026 05:50:35 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 63U5cuB9010311; Thu, 30 Apr 2026 05:50:34 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 4dsamyhbgq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 30 Apr 2026 05:50:34 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 63U5oUP159375972 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 Apr 2026 05:50:31 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D6AA720040; Thu, 30 Apr 2026 05:50:30 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 838AD20043; Thu, 30 Apr 2026 05:50:27 +0000 (GMT) Received: from localhost.localdomain (unknown [9.39.18.70]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 30 Apr 2026 05:50:27 +0000 (GMT) From: Amit Machhiwal To: linuxppc-dev@lists.ozlabs.org, Madhavan Srinivasan Cc: Amit Machhiwal , Vaibhav Jain , Nicholas Piggin , Michael Ellerman , "Christophe Leroy (CS GROUP)" , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/6] KVM: PPC: Wire up KVM_PPC_GET_COMPAT_CAPS ioctl Date: Thu, 30 Apr 2026 11:19:02 +0530 Message-ID: <20260430054906.94431-4-amachhiw@linux.ibm.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260430054906.94431-1-amachhiw@linux.ibm.com> References: <20260430054906.94431-1-amachhiw@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-ORIG-GUID: N0YytoSHj77IpD60dC_KIuO930sp6Edt X-Authority-Analysis: v=2.4 cv=Ft81OWrq c=1 sm=1 tr=0 ts=69f2edab cx=c_pps a=aDMHemPKRhS1OARIsFnwRA==:117 a=aDMHemPKRhS1OARIsFnwRA==:17 a=A5OVakUREuEA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=iQ6ETzBq9ecOQQE5vZCe:22 a=VnNF1IyMAAAA:8 a=MxX2ZhQXYH6PMiHjArUA:9 X-Proofpoint-GUID: sw-Vb_Bk0h4TjseRr9opP-Lf-6-iNc9W X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDMwMDA1NSBTYWx0ZWRfX3gmRQYD5fkIn vNhXoFnroncb91SiAm+7A94HI6TYd0LYMaN+0mAutviOSDPcqnYi7Lvvi4cD7CDKx/zT5bpvdd4 Qg+J+onkN3h1rrC37IuUxjxIIe2o0fb8l3pObujOR77Tmcy+55PNZ+QM5PlVGHvyH66bmHO+4Jr cOG8npEIqUFBR5w228nYrby0eA1Uo/0ncLdYLDgub92PFbaenb/SkkgoeaXXJVWrkpxlgJ9vlre JAOz/G8ljjj+ENBFJcN9CUnKBdfyfItfSrutBp1+cpHDMeExuJqdSA7VusNcluwS8rLIRgKE/cq Ug0WZcOawHkYKG4YxEfMuPMDmtJnJJWz9UjzgU7QVdkC17Y3is+PUVR8l6AnVhy6T2nqIvB9547 BVeTaADZrR4hosWPH/gExMHYh/mUiEmtjywSouz8c1Bch+uhap9kwUiOpxwTsPLJ16n8b3h5ghu 9EMJ2Lw0yGAMJPwZ6fQ== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-30_01,2026-04-28_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 lowpriorityscore=0 bulkscore=0 spamscore=0 impostorscore=0 clxscore=1015 malwarescore=0 phishscore=0 suspectscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604200000 definitions=main-2604300055 Content-Type: text/plain; charset="utf-8" Add handling for KVM_PPC_GET_COMPAT_CAPS in kvm_arch_vm_ioctl() and advertise support via KVM_CAP_PPC_COMPAT_CAPS. The ioctl retrieves host CPU compatibility capabilities via a PowerPC-specific backend implementation when available. If the capability is not supported, the ioctl returns success with no capabilities set, allowing userspace to fall back gracefully. Signed-off-by: Amit Machhiwal --- arch/powerpc/include/asm/kvm_ppc.h | 1 + arch/powerpc/kvm/powerpc.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/= kvm_ppc.h index 0953f2daa466..cadfb839e836 100644 --- a/arch/powerpc/include/asm/kvm_ppc.h +++ b/arch/powerpc/include/asm/kvm_ppc.h @@ -319,6 +319,7 @@ struct kvmppc_ops { bool (*hash_v3_possible)(void); int (*create_vm_debugfs)(struct kvm *kvm); int (*create_vcpu_debugfs)(struct kvm_vcpu *vcpu, struct dentry *debugfs_= dentry); + int (*get_compat_cpu_ver)(struct kvm_ppc_compat_caps *host_caps); }; =20 extern struct kvmppc_ops *kvmppc_hv_ops; diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index 00302399fc37..f35017d83d77 100644 --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c @@ -697,6 +697,12 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long= ext) } } break; +#if defined(CONFIG_KVM_BOOK3S_HV_POSSIBLE) + case KVM_CAP_PPC_COMPAT_CAPS: + if (kvmhv_on_pseries()) + r =3D 1; + break; +#endif /* CONFIG_KVM_BOOK3S_HV_POSSIBLE */ default: r =3D 0; break; @@ -2463,6 +2469,19 @@ int kvm_arch_vm_ioctl(struct file *filp, unsigned in= t ioctl, unsigned long arg) r =3D kvm->arch.kvm_ops->svm_off(kvm); break; } + case KVM_PPC_GET_COMPAT_CAPS: { + struct kvm_ppc_compat_caps host_caps; + + memset(&host_caps, 0, sizeof(host_caps)); + if (!kvm->arch.kvm_ops->get_compat_cpu_ver) + goto out; + + r =3D kvm->arch.kvm_ops->get_compat_cpu_ver(&host_caps); + if (!r && copy_to_user(argp, &host_caps, + sizeof(host_caps))) + r =3D -EFAULT; + break; + } default: { struct kvm *kvm =3D filp->private_data; r =3D kvm->arch.kvm_ops->arch_vm_ioctl(filp, ioctl, arg); --=20 2.50.1 From nobody Tue Jun 16 18:01:11 2026 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 C76BC184; Thu, 30 Apr 2026 05:50:54 +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=1777528256; cv=none; b=eW3sda7wNkZ45mkqpNyyfDotkW3xLCtZUxDS27FTFsNnSbvoXK7AaKRlTX2JI4PoBxjLD6RNKNNmLNY5YVXW8geYUz86rZ+oR6iZ+fFlsPoEIqmBT8C8oNYp4YCqEdR8vqjEk4MJBApM+p8twb7ziBXdQyDsID+2i6md2Oy2o+o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777528256; c=relaxed/simple; bh=aujlOtU2N/6iCPPHtsTBon27sXSbLXCHgZkMMbIcPlY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=isJcnVKCNBMvzvjHfHGzTMl1uF0ZQ93oJbni6dj3W1JcmRiVAzvlmuXfylMPPhAYoyU4XyV5aBG2S76X3gFyYJPgNKc+DN0g924OdoZMGviDSODGJTM1e95hEP6++gGegQd83IcSEZ+OKPit0uj1vUC7XHu8hAVumTaenveivgw= 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=Cx5io097; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="Cx5io097" Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63TNPjfX3102032; Thu, 30 Apr 2026 05:50:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=BhEenOdIb0zci+cfo D2CfrCg7b4bPrp2JC0oafympkM=; b=Cx5io0976BUxCqiqvdVFimnjVYME7bxy1 EzM35Che9djq69jvITsug3m2/dNosTl3VIK78WMj5ptPPvDRZUKS8WHPxJH23WpL 7qyvtmQva52tJ0WIIQS9RN/SCMe8tNqNEcVddzXQ6S75ZaJEUApZSALZHcZcKW7a SXhISXzP4vfBtLdB95xsqjqXnRbOsubCbnt2cBbRXDijK906/PztBL1ZbXaP/nyO 4fwi7QSewl4DGsXNyFlOYzwOTbiC6z5DbVsFgb9wHRDDZKMNpmuKQWf/YxCeV2H0 RsOc+2Nobjek28qSMkeiCyIEBGXDS1sAy9t/S0rmxjQiDgP4pBy1Q== Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4drn44x703-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 30 Apr 2026 05:50:44 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 63U5cq0A010295; Thu, 30 Apr 2026 05:50:43 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 4dsamyhbhb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 30 Apr 2026 05:50:43 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 63U5oeps52035998 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 Apr 2026 05:50:40 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6340B20040; Thu, 30 Apr 2026 05:50:40 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 267F720043; Thu, 30 Apr 2026 05:50:37 +0000 (GMT) Received: from localhost.localdomain (unknown [9.39.18.70]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 30 Apr 2026 05:50:36 +0000 (GMT) From: Amit Machhiwal To: linuxppc-dev@lists.ozlabs.org, Madhavan Srinivasan Cc: Amit Machhiwal , Vaibhav Jain , Nicholas Piggin , Michael Ellerman , "Christophe Leroy (CS GROUP)" , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/6] KVM: PPC: Book3S HV: Implement compat CPU capability retrieval for KVM on PowerVM Date: Thu, 30 Apr 2026 11:19:03 +0530 Message-ID: <20260430054906.94431-5-amachhiw@linux.ibm.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260430054906.94431-1-amachhiw@linux.ibm.com> References: <20260430054906.94431-1-amachhiw@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-ORIG-GUID: fNuj-0nRG1olPKrXOSyc2CDSXB1z5DsD X-Authority-Analysis: v=2.4 cv=Ft81OWrq c=1 sm=1 tr=0 ts=69f2edb5 cx=c_pps a=aDMHemPKRhS1OARIsFnwRA==:117 a=aDMHemPKRhS1OARIsFnwRA==:17 a=A5OVakUREuEA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=iQ6ETzBq9ecOQQE5vZCe:22 a=VnNF1IyMAAAA:8 a=lI54la875Hh5wgzWY30A:9 X-Proofpoint-GUID: Bf398W9isCBf2MLnAisWhCddQxZ6KQc7 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDMwMDA1NSBTYWx0ZWRfXwgPs3Mzn4hHv 4Qban/7Ju94/giip/gc7xpq1kvGk1I3cilRfUUeLIr8pvZRUhms5E5XdvNDdkxPkrk+zu3mgC4z /0jp/7XXQ8cXGvwMoDU1nUZxgXBKDsAzJwbKH0Wx6cb47tM7unZvOJFPIxn7VnHrh2lhmzuWxys GpQCIH/k1R85ufNU66y3FfCsRpkEKNgylZgq+oWDVExmi8vRTmZ9PjZl8jnDzuwco6VYV4TCx+2 Njw4sZ2kBAn74yOZEOTCiXTKJymCeMmGObrFe1aU4ia6R5jawHlYDSuJFYhJIYQrJ3rNPnmVbrE hCophTfjQB720rVmNnmsl3doPzKXi2M+owKDVBJNFshE1FG9AgaCOIOUAsVNZp2wTCO4tWvRtte ZkFqd47njVQxTqKPbXztXbAREL0fVYA5R+5EsR9kP/90gV+JdYUG1TuLdOwnUWVazh71jj1nQlx s3GwQ4iKKPhFXsGmCsw== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-30_01,2026-04-28_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 lowpriorityscore=0 bulkscore=0 spamscore=0 impostorscore=0 clxscore=1015 malwarescore=0 phishscore=0 suspectscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604200000 definitions=main-2604300055 Content-Type: text/plain; charset="utf-8" On POWER systems, the host CPU may run in a compatibility mode (e.g., a Power11 processor operating in Power10 compatibility mode). In such cases, the effective CPU level exposed to guests differs from the physical processor generation. When running nested KVM guests, QEMU derives the host CPU type using mfpvr(), which reflects the physical processor version. This can result in a mismatch between the CPU model selected by QEMU and the compatibility mode enforced by the host, leading to guest boot failures. For example, booting a nested guest on a Power11 LPAR configured in Power10 compatibility mode fails with: KVM-NESTEDv2: couldn't set guest wide elements [..KVM reg dump..] This occurs because QEMU selects a CPU model corresponding to the physical processor (via mfpvr()), while the host operates in a lower compatibility mode. As a result, KVM rejects the requested compatibility level during guest initialization. Add support for retrieving host CPU compatibility capabilities for nested guests on PowerVM (PAPR nested API v2). The hypervisor provides the effective compatibility levels via the H_GUEST_GET_CAPABILITIES hcall, which reflects the processor modes negotiated between the Power hypervisor (L0) and the host partition (L1). On pseries systems, obtain the capability bitmap using plpar_guest_get_capabilities() and return it via struct kvm_ppc_compat_caps. This information is then exposed to userspace through the KVM_PPC_GET_COMPAT_CAPS ioctl. Hook the implementation into the Book3S HV kvmppc_ops so that it can be invoked by the generic KVM ioctl handling code. Signed-off-by: Amit Machhiwal --- arch/powerpc/kvm/book3s_hv.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index 948c6b099a29..d602d90111d1 100644 --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c @@ -6516,6 +6516,22 @@ static bool kvmppc_hash_v3_possible(void) return true; } =20 + +static int kvmppc_get_compat_cpu_caps(struct kvm_ppc_compat_caps *host_cap= s) +{ + + unsigned long capabilities =3D 0; + long rc =3D -EINVAL; + + if (kvmhv_on_pseries()) { + if (kvmhv_is_nestedv2()) + rc =3D plpar_guest_get_capabilities(0, &capabilities); + host_caps->compat_capabilities =3D capabilities; + } + + return rc; +} + static struct kvmppc_ops kvm_ops_hv =3D { .get_sregs =3D kvm_arch_vcpu_ioctl_get_sregs_hv, .set_sregs =3D kvm_arch_vcpu_ioctl_set_sregs_hv, @@ -6558,6 +6574,7 @@ static struct kvmppc_ops kvm_ops_hv =3D { .hash_v3_possible =3D kvmppc_hash_v3_possible, .create_vcpu_debugfs =3D kvmppc_arch_create_vcpu_debugfs_hv, .create_vm_debugfs =3D kvmppc_arch_create_vm_debugfs_hv, + .get_compat_cpu_ver =3D kvmppc_get_compat_cpu_caps, }; =20 static int kvm_init_subcore_bitmap(void) --=20 2.50.1 From nobody Tue Jun 16 18:01:11 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 5125634750A; Thu, 30 Apr 2026 05:51:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777528262; cv=none; b=uYa45PTpGrQUuLu+idbghTSvOYz6ws8eMazSV6MtQH0u4vi9cZC8yAiMYyrieddD641LHSoiecM6VhwKq/wXUvmCvTuemOFzw7zsxSfW4QPaNA0Yf4m/HptRy9U/puJC7YJEImbjyNNftx2URrU3eX4+wV3/90PmbDW6bbJ16Mc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777528262; c=relaxed/simple; bh=sspOeu1mcLYb6FLxYRgorDB3bHqOpq5HnJhItrLaqNE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZeW2V9C9TWuy2bGWBCN3AvZkiss6IA5r09LjnNmkIRGirxbw55ccscqpiR4Ozpczeq0Wp4ib0cv7RfjC8BWFHfFvJJOkpNSnUnmgicPre4lJrKoI8L/n9Z9Qj5WlWhqpGO2YjQaB4z49/hDZibU0k0gegcSeQPEWK2lbgSQvExw= 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=Xx6zKEGf; arc=none smtp.client-ip=148.163.158.5 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="Xx6zKEGf" Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63TGV5kW2037068; Thu, 30 Apr 2026 05:50:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=Cy6bOdGwcpAN6PjTw 79AQNezQbvoMdFpgvQLRpDMT4o=; b=Xx6zKEGfL7r8a/2aJpcd+XBzp8SJckW2Z N/BTFMBuDZ+WkAvGPbQCWQkNSaFtSRzcGubBS8vCIIdfchvyjn+ZGFkbiETATQyZ acb1mVOKzGYpbHyQRmeiROMEvFFfKWLmOeHdnbRqGnTPOxe15Hxw3n+Bg3JzSQy+ mn/tV92igrKC3WOn/5PCQc4ZrEp8heq4SVa8zEm3hOLZEpSClLEUTVkwXcIRgBeH HHsK+26Z5U3mWgBp60T7JDHycQkBDsoYhAR70WTlD4RIChq6VYDyPokj5S8q5LoC 6pzKbo0ye6GvUN4cbFqVFcBZVRq0SXDvPf9rXoRsEkL+QIa38p4QQ== Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4drk1jvm7s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 30 Apr 2026 05:50:49 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 63U5colb013174; Thu, 30 Apr 2026 05:50:48 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 4dsa5ghems-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 30 Apr 2026 05:50:48 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 63U5ojMI43516166 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 Apr 2026 05:50:45 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4B0C920043; Thu, 30 Apr 2026 05:50:45 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1FABA20040; Thu, 30 Apr 2026 05:50:42 +0000 (GMT) Received: from localhost.localdomain (unknown [9.39.18.70]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 30 Apr 2026 05:50:41 +0000 (GMT) From: Amit Machhiwal To: linuxppc-dev@lists.ozlabs.org, Madhavan Srinivasan Cc: Amit Machhiwal , Vaibhav Jain , Nicholas Piggin , Michael Ellerman , "Christophe Leroy (CS GROUP)" , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/6] KVM: PPC: Book3S HV: Add support for compat CPU capabilities for KVM on PowerNV Date: Thu, 30 Apr 2026 11:19:04 +0530 Message-ID: <20260430054906.94431-6-amachhiw@linux.ibm.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260430054906.94431-1-amachhiw@linux.ibm.com> References: <20260430054906.94431-1-amachhiw@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDMwMDA1NSBTYWx0ZWRfX8jDAyDYbPtOE Eg8rmNMFA6EGZhA7uZg0FYtC9vDsNcUzUjLGExNIk3+kwyY+t8qXirKd9C1fVicTKqbsF0lz6xv JhPRPoqW2DUNEzFAK5fWm75SK9Gy6cu6nI2ySzSxiatxEx4tiwQAbGG8hgq5YZ3TKpBZ4ALUWTU x6dqeZzEl/XfKF3b0dm8JLOSjRXSqGHK3m4NORwa2eWHz38eHO0AJ009+JoR9tq1bkZN16dF9rn S9ho+lIanXoi19X4FAEmkT3iMPT9Vrhvzy4pNqLY/kRbyjuwOC1jh2Zl9/nNXfi8C59wjqc4Z50 1jnb48V85Sim/CxmKC7BIlXy0NhdCDGO32aCZXyWFP8XSC9Jt0LVhSCJ7GijVvjXWURDEp+DxqH ioeJL0EsSvuTM0R0rzdFgKYJlTi49/15MScXq/M183CSHa0c2MChBkN9NNK2GYlJjJT26esuTEw dwOMZCN0UdUF7Tf4+kA== X-Proofpoint-GUID: iUj-YKxo3sPB2St381_RksO7wj_EEXK9 X-Proofpoint-ORIG-GUID: xI8XyEiWmMkw5kpVVqnlBb77BpNUczlI X-Authority-Analysis: v=2.4 cv=MohiLWae c=1 sm=1 tr=0 ts=69f2edba cx=c_pps a=AfN7/Ok6k8XGzOShvHwTGQ==:117 a=AfN7/Ok6k8XGzOShvHwTGQ==:17 a=A5OVakUREuEA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=Y2IxJ9c9Rs8Kov3niI8_:22 a=VnNF1IyMAAAA:8 a=LbGGMz8L2r-vpTRwWUsA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-30_01,2026-04-28_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 adultscore=0 suspectscore=0 bulkscore=0 spamscore=0 priorityscore=1501 malwarescore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604200000 definitions=main-2604300055 Content-Type: text/plain; charset="utf-8" Currently, when booting a compatibility-mode KVM guest (L1) on a PowerNV hypervisor (L0), the guest runs with the expected processor compatibility level. However, when booting a nested KVM guest (L2) inside the L1, QEMU derives the CPU model from the raw host PVR and attempts to run the nested guest at that level, instead of honoring the compatibility mode of the L1. Extend host CPU compatibility capability reporting to support nested virtualization on PowerNV systems (PAPR nested API v1). For nested API v2 (PowerVM), compatibility capabilities are obtained from the hypervisor via the H_GUEST_GET_CAPABILITIES hcall. This information is not available on PowerNV systems. For nested API v1, derive the compatibility capabilities from the L1 guest by reading the "cpu-version" property from the device tree, which reflects the effective (logical) processor compatibility level. Map this value to the corresponding compatibility capability bitmap. Introduce a helper to translate CPU version values into compatibility capability bits and integrate it into kvmppc_get_compat_cpu_caps(). This allows userspace to query host CPU compatibility modes on both PowerVM and PowerNV platforms via the KVM_PPC_GET_COMPAT_CAPS ioctl. Signed-off-by: Amit Machhiwal --- arch/powerpc/kvm/book3s_hv.c | 37 +++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index d602d90111d1..25d05f1ccb72 100644 --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c @@ -6516,16 +6516,51 @@ static bool kvmppc_hash_v3_possible(void) return true; } =20 +static int kvmppc_map_compat_capabilities(const __be32 cpu_version, + unsigned long *capabilities) +{ + switch (cpu_version) { + case PVR_ARCH_31_P11: + *capabilities |=3D H_GUEST_CAP_POWER11; + break; + case PVR_ARCH_31: + *capabilities |=3D H_GUEST_CAP_POWER10; + break; + case PVR_ARCH_300: + *capabilities |=3D H_GUEST_CAP_POWER9; + break; + default: + return -EINVAL; + } + + return 0; +} =20 static int kvmppc_get_compat_cpu_caps(struct kvm_ppc_compat_caps *host_cap= s) { =20 + struct device_node *np; unsigned long capabilities =3D 0; + const __be32 *prop =3D NULL; long rc =3D -EINVAL; + u32 cpu_version; =20 if (kvmhv_on_pseries()) { - if (kvmhv_is_nestedv2()) + if (kvmhv_is_nestedv2()) { rc =3D plpar_guest_get_capabilities(0, &capabilities); + } else { + for_each_node_by_type(np, "cpu") { + prop =3D of_get_property(np, "cpu-version", NULL); + if (prop) { + cpu_version =3D be32_to_cpup(prop); + break; + } + } + if (!prop) + return -EINVAL; + rc =3D kvmppc_map_compat_capabilities(cpu_version, + &capabilities); + } host_caps->compat_capabilities =3D capabilities; } =20 --=20 2.50.1 From nobody Tue Jun 16 18:01:11 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 14774372B4F; Thu, 30 Apr 2026 05:51:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777528266; cv=none; b=oDP2q8j29v2tuF8H2EyLJoTAaAeo3Gf94B5cnwfw6MPmSeVd2K0rnkvtA5yK0kzySk/658Fv+Xiw29OZ2U7p9jiyGdeoiRpwhCavOoyLLgEixmtLejcWO2Jq/oxuvgfgZs44Zl5C2f0OOxPrbLx6q6mW2AcPmFQUqg8GfQDWPPE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777528266; c=relaxed/simple; bh=p4nEDrWIGS+qGXKeYk/iD+rTPCQaDzWwOPIhNDYyz68=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ccZ43oTb9I+WbtqH3JS+X3Z0e42J+Z+qgo/37E6cYV1BZBYJYMIFNCaXGPfWqeveeWGX2igxyuoV4Egr5zV6SPyogE+/8iR9JBlS5q/y1saN3duZZJjIgVBm4NYjgCfJgsIwvV0HON25aD2IFw5arJNPD9To6JgdmFdgZ7UJhMc= 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=mkvZF/tZ; arc=none smtp.client-ip=148.163.158.5 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="mkvZF/tZ" Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63U3nlGN4169201; Thu, 30 Apr 2026 05:50:59 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=A+TFab3TxBuckPuod X7Yxrhrp4K3N57dRmZphKt1Eog=; b=mkvZF/tZ9H1ZcDPBQw8C1FYMVoFP9PfLZ Gm9aAcX2/YFNgJ+kijTkDJIimLxaico8pF+wtq+PZa2pl18cH3O2QJK+uBjxsRht vFNqse3ClGn/u3ZcMSPZgpJxqural0/MbITnOTjVbt+0tbmbGby2hhngUL+eWCcs iduXJ7JbsoKb+1Q9BXB7rS2LA4mMpBXY/56IzMZLIhohGeTB8/PntmcX4nnH7j1c 8Ev3EiDZBQJBG7CwszxKV+wp3i5MqqQKKWaWYX6MyxM3XmH5ADO8BiRyEie551En 2Zq4Z9sVQ0GtnNjB2eJNzzYjojeISrEL/zOmKJ6x/ZCjAZITYXQwQ== Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4drm1e4fej-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 30 Apr 2026 05:50:59 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 63U5dF2N026090; Thu, 30 Apr 2026 05:50:58 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4ds8aw1nse-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 30 Apr 2026 05:50:58 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 63U5osal51511636 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 Apr 2026 05:50:54 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B41D82004B; Thu, 30 Apr 2026 05:50:54 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 44F4920043; Thu, 30 Apr 2026 05:50:51 +0000 (GMT) Received: from localhost.localdomain (unknown [9.39.18.70]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 30 Apr 2026 05:50:50 +0000 (GMT) From: Amit Machhiwal To: linuxppc-dev@lists.ozlabs.org, Madhavan Srinivasan Cc: Amit Machhiwal , Vaibhav Jain , Paolo Bonzini , Jonathan Corbet , Shuah Khan , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH 6/6] KVM: PPC: Document KVM_PPC_GET_COMPAT_CAPS ioctl Date: Thu, 30 Apr 2026 11:19:05 +0530 Message-ID: <20260430054906.94431-7-amachhiw@linux.ibm.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260430054906.94431-1-amachhiw@linux.ibm.com> References: <20260430054906.94431-1-amachhiw@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: PY1Pk5C2qoENucOkMV8Y5LISX-Mrjos1 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDMwMDA1NSBTYWx0ZWRfXxz0Q8GlnGWtM EACpotdoO0dzuIwZvB9q10VwKgpegGJshExny1JYwCH1ruDGf/ku8UOJR+tl0C+xRVNWanTlsXY fXUihCv6bXer8gOgw0UcxNbbmZjIFgAxVPRAXJwd0igKe1K6BclAwXj0AXFJ8wf7JSAPXeUCbvQ 1zl2CBCsk8xGI+5WF9uFhNbyuPlbdFWv7QGhoR1mm203pd/1R6qyoA6YNTjsjSwwtVfxBMtT0pd s2wt73DrID/95Z456Xc4BsxdAqnEHSJ7U9zZuG/kpZROIHFFDvETBcU9xYDP2abrUEYzYy1P63p kkjWF/5Shwi9Q3hqySQ12oh6BHNqfoYSCFC3pQsyD6TfqmDj1NbvuNEBJWVUYstsCDlSB4nx+zw g7MAWXZKl0nbR9kFJv5sd/CBlSZmuWMm+hzgSgZJ/bEOnE0CB/TsDcTkcjrwQjfOs+AcTi5cFEI ZI9N0NdjjPfRymOZu8w== X-Authority-Analysis: v=2.4 cv=VZLH+lp9 c=1 sm=1 tr=0 ts=69f2edc3 cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=A5OVakUREuEA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=V8glGbnc2Ofi9Qvn3v5h:22 a=VnNF1IyMAAAA:8 a=fHGwRvExhQHp1Ic8jzwA:9 X-Proofpoint-GUID: PY1Pk5C2qoENucOkMV8Y5LISX-Mrjos1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-30_01,2026-04-28_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 suspectscore=0 adultscore=0 lowpriorityscore=0 phishscore=0 spamscore=0 malwarescore=0 bulkscore=0 priorityscore=1501 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604200000 definitions=main-2604300055 Content-Type: text/plain; charset="utf-8" Add documentation for the KVM_PPC_GET_COMPAT_CAPS ioctl to the KVM API documentation. The ioctl exposes host processor compatibility modes supported for nested KVM guests on PowerPC systems. Signed-off-by: Amit Machhiwal --- Documentation/virt/kvm/api.rst | 35 ++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst index 52bbbb553ce1..7a10c3c6cbf1 100644 --- a/Documentation/virt/kvm/api.rst +++ b/Documentation/virt/kvm/api.rst @@ -6555,6 +6555,41 @@ KVM_S390_KEYOP_SSKE =20 .. _kvm_run: =20 +4.145 KVM_PPC_GET_COMPAT_CAPS +----------------------------- +:Capability: KVM_CAP_PPC_COMPAT_CAPS +:Architectures: powerpc +:Type: vm ioctl +:Parameters: struct kvm_ppc_compat_caps (out) +:Returns: + 0 on successful completion, + -EFAULT if ``struct kvm_ppc_compat_caps`` cannot be written + +IBM POWER system server-based processors provide a compatibility mode feat= ure +where an Nth generation processor can operate in modes consistent with ear= lier +generations such as (N-1) and (N-2). + +This ioctl provides userspace with information about the CPU compatibility= modes +supported by the current host processor for booting the nested KVM guests = on +PowerNV (KVM nested APIv1) and PowerVM (KVM nested APIv2) platforms. + +:: + + struct kvm_ppc_compat_caps { + __u32 flags; + __u64 compat_capabilities; /* Capabilities supported by the = host */ + }; + +The ``compat_capabilities`` bit field describes the processor compatibility +modes supported by the host. For example, the following bits indicate supp= ort +for specific processor modes. + +:: + + bit 1: KVM guests can run in Power9 processor mode + bit 2: KVM guests can run in Power10 processor mode + bit 3: KVM guests can run in Power11 processor mode + 5. The kvm_run structure =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 --=20 2.50.1