Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2230844/?format=api
{ "id": 2230844, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2230844/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260430061333.37905-3-amachhiw@linux.ibm.com/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/1.1/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20260430061333.37905-3-amachhiw@linux.ibm.com>", "date": "2026-04-30T06:13:33", "name": "[2/2] target/ppc/kvm: Use host compatibility mode for nested guests", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "266a6015966d9e2d508dad4a0cad2bb44ec6d8d8", "submitter": { "id": 87864, "url": "http://patchwork.ozlabs.org/api/1.1/people/87864/?format=api", "name": "Amit Machhiwal", "email": "amachhiw@linux.ibm.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260430061333.37905-3-amachhiw@linux.ibm.com/mbox/", "series": [ { "id": 502209, "url": "http://patchwork.ozlabs.org/api/1.1/series/502209/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=502209", "date": "2026-04-30T06:13:33", "name": "ppc/kvm: Handle CPU compatibility mode correctly for nested guests", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/502209/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2230844/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2230844/checks/", "tags": {}, "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256\n header.s=pp1 header.b=K6MGg4aU;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)" ], "Received": [ "from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g5kRR1dFfz1yGq\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 30 Apr 2026 16:14:59 +1000 (AEST)", "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wIKfb-00038b-0x; Thu, 30 Apr 2026 02:14:43 -0400", "from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <amachhiw@linux.ibm.com>)\n id 1wIKf6-0002yq-Ub; Thu, 30 Apr 2026 02:14:14 -0400", "from mx0a-001b2d01.pphosted.com ([148.163.156.1])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <amachhiw@linux.ibm.com>)\n id 1wIKf3-0006It-SF; Thu, 30 Apr 2026 02:14:12 -0400", "from pps.filterd (m0360083.ppops.net [127.0.0.1])\n by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id\n 63TLdf9P3991826; Thu, 30 Apr 2026 06:14:07 GMT", "from ppma11.dal12v.mail.ibm.com\n (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219])\n by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4drn44xa4a-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n Thu, 30 Apr 2026 06:14:07 +0000 (GMT)", "from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1])\n by ppma11.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id\n 63U6CXZ4012526;\n Thu, 30 Apr 2026 06:14:06 GMT", "from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224])\n by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 4dsamyhegr-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n Thu, 30 Apr 2026 06:14:06 +0000 (GMT)", "from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com\n [10.20.54.102])\n by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id\n 63U6E2ru38076916\n (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);\n Thu, 30 Apr 2026 06:14:02 GMT", "from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1])\n by IMSVA (Postfix) with ESMTP id 9DCB220040;\n Thu, 30 Apr 2026 06:14:02 +0000 (GMT)", "from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1])\n by IMSVA (Postfix) with ESMTP id 1B0092004B;\n Thu, 30 Apr 2026 06:13:59 +0000 (GMT)", "from localhost.localdomain (unknown [9.39.18.70])\n by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP;\n Thu, 30 Apr 2026 06:13:58 +0000 (GMT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc\n :content-transfer-encoding:date:from:in-reply-to:message-id\n :mime-version:references:subject:to; s=pp1; bh=pwvZmbPinPYK/5tr/\n 2XxXcOE/ztPQAaOmkWyg9wPbVs=; b=K6MGg4aUQLqHZcocgX5eeIgL8e1UJnAmP\n VhLlOJdbTbHGAEAyVp0P0brjwROZw4+Giz8Zjveu4msnySf7/LnK/5bpOch3fNzT\n Xo5/1V6WirKem/alabR+Ez6RoiHOy9YHXuT5Tk4X3MH+azpc7MwIExyJVhfKQmvX\n Ik4XNpAOC+wMm7cq2N+y/w8BdYkwODCLVdFyvzLXiQm5lKFSdBDvxreeoiwrLaAu\n oJjQ9z1rpQuj239FZ8OjPA5b2E7lMeXqZ51T0BZ6+0V0SLVP3rCOVD/meJSeq5Fz\n 500LADSdJxvM1sEErpHazb+UVuEUjmZQwsdauWTE/l6rbMgapbo+g==", "From": "Amit Machhiwal <amachhiw@linux.ibm.com>", "To": "qemu-ppc@nongnu.org, Harsh Prateek Bora <harshpb@linux.ibm.com>", "Cc": "Amit Machhiwal <amachhiw@linux.ibm.com>,\n Vaibhav Jain <vaibhav@linux.ibm.com>, Nicholas Piggin <npiggin@gmail.com>,\n Chinmay Rath <rathc@linux.ibm.com>, Glenn Miles <milesg@linux.ibm.com>,\n Paolo Bonzini <pbonzini@redhat.com>, kvm@vger.kernel.org,\n qemu-devel@nongnu.org", "Subject": "[PATCH 2/2] target/ppc/kvm: Use host compatibility mode for nested\n guests", "Date": "Thu, 30 Apr 2026 11:43:33 +0530", "Message-ID": "<20260430061333.37905-3-amachhiw@linux.ibm.com>", "X-Mailer": "git-send-email 2.50.1", "In-Reply-To": "<20260430061333.37905-1-amachhiw@linux.ibm.com>", "References": "<20260430061333.37905-1-amachhiw@linux.ibm.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-TM-AS-GCONF": "00", "X-Proofpoint-Reinject": "loops=2 maxloops=12", "X-Proofpoint-ORIG-GUID": "37BV_D4pjXUlBrr9ACtUqSoOhBmvl7xK", "X-Authority-Analysis": "v=2.4 cv=Ft81OWrq c=1 sm=1 tr=0 ts=69f2f32f cx=c_pps\n a=aDMHemPKRhS1OARIsFnwRA==:117 a=aDMHemPKRhS1OARIsFnwRA==:17\n a=A5OVakUREuEA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22\n a=iQ6ETzBq9ecOQQE5vZCe:22 a=VnNF1IyMAAAA:8 a=n0kojfgqO0W5ScNLDTQA:9", "X-Proofpoint-GUID": "KD8zVK0cpXIPWATTqo3jZEvkAG5AhY6F", "X-Proofpoint-Spam-Details-Enc": "AW1haW4tMjYwNDMwMDA1NSBTYWx0ZWRfX3+IK9R9bvGx5\n uj2BbKjZaE5F+yB3rBVD1fAWgJx8gwNbvYEJia02F1/utDin8YkizWL2p1MhaCVy9udvRWukhz0\n r9lSQlsuV4UsXSakK0zLErSDCn58n5CgReVvgaRFi7UqUVyDcwZ0MN5INLHBFrdjawKJ19T8R1P\n HdPeqcJKfj0bmFvJOjcUoZzhiljHlXq65Ohf8MQXCGJ/q3PhxhV13JnBmGyLIWY4xabzzMZ9dBF\n 7yfqZo7K//QlfcukUM1JOoRHexM7a1dozIGvTbBmjJIMgRbEy45EU3bue2PkuXMv3b79ZMp5zt8\n nhlcCMSioe20othfZslK51T8dXJowgXD4Te/KLh8iPe2IeI0wA0tBcIGR13nE6H0RaWzQjPfQWd\n Xzz6VYzzwcS6pe24mF/CpG0XylHWh7T8spgpsfZ3gsgTc5YJKZf0oVEyl2dHCbW0+6L1QhWkl4X\n n9GlxNdZKQnlhaBG8mw==", "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49\n definitions=2026-04-30_01,2026-04-28_01,2025-10-01_01", "X-Proofpoint-Spam-Details": "rule=outbound_notspam policy=outbound score=0\n priorityscore=1501 lowpriorityscore=0 bulkscore=0 spamscore=0 impostorscore=0\n clxscore=1015 malwarescore=0 phishscore=0 suspectscore=0 adultscore=0\n classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0\n reason=mlx scancount=1 engine=8.22.0-2604200000 definitions=main-2604300055", "Received-SPF": "pass client-ip=148.163.156.1;\n envelope-from=amachhiw@linux.ibm.com; helo=mx0a-001b2d01.pphosted.com", "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,\n DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7,\n RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001,\n 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.29", "Precedence": "list", "List-Id": "qemu development <qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<https://lists.nongnu.org/archive/html/qemu-devel>", "List-Post": "<mailto:qemu-devel@nongnu.org>", "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org" }, "content": "On POWER systems, the host CPU may run in a compatibility mode (e.g.,\na Power11 processor operating in Power10 compatibility mode). In such\ncases, the effective CPU level exposed to guests differs from the\nphysical processor generation.\n\nWhen running nested KVM guests, QEMU currently derives the host CPU type\nusing mfpvr(), which reflects the physical processor version. This can\nresult in a mismatch between the CPU model used by QEMU and the\ncompatibility mode enforced by the host, leading to guest boot failures.\n\nIn particular, booting a nested guest on a Power11 LPAR configured in\nPower10 compatibility mode fails with errors such as:\n\n KVM-NESTEDv2: couldn't set guest wide elements\n\nThis occurs because QEMU selects a CPU model based on the physical\nprocessor version, while the host operates in a lower compatibility\nmode. As a result, KVM rejects the requested compatibility level during\nguest initialization.\n\nAdd support for querying host compatibility capabilities via the\nKVM_PPC_GET_COMPAT_CAPS ioctl and derive the effective PVR based on the\ncompatibility mode reported by KVM. When available, use this\ncompatibility PVR instead of the raw hardware PVR when selecting\nthe CPU model.\n\nIf the capability is not supported or the query fails, fall back to the\nexisting behavior.\n\nThis ensures that QEMU selects a CPU model consistent with the host\ncompatibility mode, allowing nested guests to boot correctly.\n\nSigned-off-by: Amit Machhiwal <amachhiw@linux.ibm.com>\n---\n target/ppc/kvm.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 52 insertions(+)", "diff": "diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c\nindex 25c28ad089c6..d384161f780b 100644\n--- a/target/ppc/kvm.c\n+++ b/target/ppc/kvm.c\n@@ -2602,11 +2602,63 @@ bool kvmppc_supports_ail_3(void)\n return cap_ail_mode_3;\n }\n \n+static target_ulong kvmppc_get_compat_caps(void)\n+{\n+ struct kvm_ppc_compat_caps host_compat;\n+ target_ulong host_caps;\n+ int ret;\n+\n+ if (!kvm_check_extension(kvm_state, KVM_CAP_PPC_COMPAT_CAPS)) {\n+ return 0;\n+ }\n+\n+ ret = kvm_vm_ioctl(kvm_state, KVM_PPC_GET_COMPAT_CAPS, &host_compat);\n+ if (ret < 0) {\n+ fprintf(stderr, \"KVM: failed to get host capabilities\\n\");\n+ return 0;\n+ }\n+\n+ host_caps = host_compat.compat_capabilities;\n+ return host_caps;\n+}\n+\n+static uint32_t kvm_ppc_host_compat_pvr(void)\n+{\n+ uint32_t compat_host_pvr = 0;\n+ int cap_idx = 0;\n+ target_ulong host_caps = kvmppc_get_compat_caps();\n+\n+ if (host_caps) {\n+ cap_idx = 63 - __builtin_ctzll(host_caps);\n+ switch (cap_idx) {\n+ case H_GUEST_CAP_P9_MODE_BMAP:\n+ compat_host_pvr = CPU_POWERPC_POWER9_DD22;\n+ break;\n+ case H_GUEST_CAP_P10_MODE_BMAP:\n+ compat_host_pvr = CPU_POWERPC_POWER10_DD20;\n+ break;\n+ case H_GUEST_CAP_P11_MODE_BMAP:\n+ compat_host_pvr = CPU_POWERPC_POWER11_DD20;\n+ break;\n+ default:\n+ break;\n+ }\n+ }\n+\n+ return compat_host_pvr;\n+}\n+\n PowerPCCPUClass *kvm_ppc_get_host_cpu_class(void)\n {\n uint32_t host_pvr = mfpvr();\n+ uint32_t compat_host_pvr;\n PowerPCCPUClass *pvr_pcc;\n \n+ compat_host_pvr = kvm_ppc_host_compat_pvr();\n+ if (compat_host_pvr) {\n+ host_pvr = compat_host_pvr;\n+ }\n+\n pvr_pcc = ppc_cpu_class_by_pvr(host_pvr);\n if (pvr_pcc == NULL) {\n pvr_pcc = ppc_cpu_class_by_pvr_mask(host_pvr);\n", "prefixes": [ "2/2" ] }