From nobody Sat May 30 18:34:48 2026 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=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1777730531; cv=none; d=zohomail.com; s=zohoarc; b=n58AbXfIIHMloGpUAQivFwAC7kKtFiBp8jPJFtgtjF+x04wBpg8BskjhWgE/lwx9SvkgdeFJXXs63ARzsXbj4RdojH/vxEv5wVIGuuzEBiAx5wlAqXh5B7gU104O2PGlwSAIUpOkBT94cySSeJQEBDjAa+0UmV9wJG70JAHcWSI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777730531; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=I1hsOJZQR2XGOk7WIH8LLfPojJ5cB30a2SQsOUbn0oU=; b=KxS++ppvdV5S5RDFHv1l8YVql5daKi1hy7MnS3i6vFuZadV1De1s1Ri4xk8CfZ5Yg1z6qRGHlj0hQvpuLHwZgJSvIkb/2LQLYkag11j0kUaawnlTxPQzn4MS4fYzIooWUfP4zY3P1e8vShz2xJmw5GbZKj++T3wf5pRqpm9EOl0= 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=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1777730531137944.0915614439091; Sat, 2 May 2026 07:02:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wJAub-0004jn-Rr; Sat, 02 May 2026 10:01:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wJAu2-0004gu-RE; Sat, 02 May 2026 10:01:12 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wJAty-0007XG-Gn; Sat, 02 May 2026 10:01:03 -0400 Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 642DlT2F3118223; Sat, 2 May 2026 14:01:00 GMT 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 4dw9x494ub-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 02 May 2026 14:00:59 +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 642Dshhx023830; Sat, 2 May 2026 14:00:58 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 4dw9hd1ay0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 02 May 2026 14:00:58 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 642E0tpb15925758 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 2 May 2026 14:00:55 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0707C20043; Sat, 2 May 2026 14:00:55 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6F77220040; Sat, 2 May 2026 14:00:52 +0000 (GMT) Received: from localhost.localdomain (unknown [9.124.223.28]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Sat, 2 May 2026 14:00:52 +0000 (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=I1hsOJZQR2XGOk7WI H8LLfPojJ5cB30a2SQsOUbn0oU=; b=B5/hIXYRIrRTAbaCOBNdaM47VUUXmu6U5 9+driFADe+ZVQUM81Zjb0tAcz8hJLdua8rXjtpslZqKtnQ0oKIu2luFIsSoJuG1e Zw6Zyth0IPVjMvyAhzrz9Adg+/LeutGrLhiplKYxzy2AmpkeH0hPGsRSIbz9zSPY vxJJ1LhfNSa8rmcaKZKaSnHzGgecAkRx6JDGrgGqhr1sUDWR+WcgNHkWt2bC4gX1 V95fEERpBnZCRXQX2iI4B2hN0vynh3BP0QXthnBNrHYfFxvVQeSsLvlXYx1/TlWn CCr2+zyZHF2W8s6aBPSYvoHJmiTkxYX2zTjuXvj4xO2ZnqzZAF4Rw== From: Amit Machhiwal To: qemu-ppc@nongnu.org, Harsh Prateek Bora Cc: Amit Machhiwal , Vaibhav Jain , Nicholas Piggin , qemu-devel@nongnu.org Subject: [PATCH v2 1/3] hw/ppc/spapr: Do not fallback to raw mode when KVM rejects compat Date: Sat, 2 May 2026 19:30:19 +0530 Message-ID: <20260502140021.69712-2-amachhiw@linux.ibm.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260502140021.69712-1-amachhiw@linux.ibm.com> References: <20260502140021.69712-1-amachhiw@linux.ibm.com> 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: AW1haW4tMjYwNTAyMDEzNiBTYWx0ZWRfX3lnf4UuAQzZr 88Zxu1CDrVJJc8rAVJNp5LhD2ddv+cQgbEiJQgCslYzoXSyF5GnSOYQluJiT4LRMkWSTrvMOcOD qWKWtvz5Y+SFbAhBFTSvfuSzmmjINswW5zmh9stcjr62HYqlnsCcOBKfqld9wSatXUst7bZSmUP q+ywFudsudGvxr0GQapkTxiXDldD8wuH6RlCafaCF/islu7NF/pe6aOM/Pu/gFJ4vhxoyCwy9qX LLZ+AsATWwejTiZD3nu3GL+/KGkFco9CtSwcNPj9un2uXqosQYg3KP1O3BmTUwXYwiGqNahqjRm fzt8drG2b9H4omznfz5HRZK8ZJKDRrnIrxbfk4RAKBLOieWK1mVO5oLfYMR5X/kPvfHLMADLPvO CGRysTSMAo9/XWTSYQEpgAQxPEOUAcJYepqC5wWpS43rmDL/N9SGZMd27lvRx45HmeAS0EICEMK 3UxuWVdfvPKx6XfYl7Q== X-Proofpoint-ORIG-GUID: uUi8ylP4Z510A5kW9Q4PHNb7NCl6diaF X-Proofpoint-GUID: 1ml0mEtvr53PGUzCKLaAPe_puiHAYX2B X-Authority-Analysis: v=2.4 cv=W7UIkxWk c=1 sm=1 tr=0 ts=69f6039b cx=c_pps a=AfN7/Ok6k8XGzOShvHwTGQ==:117 a=AfN7/Ok6k8XGzOShvHwTGQ==:17 a=NGcC8JguVDcA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=uAbxVGIbfxUO_5tXvNgY:22 a=VnNF1IyMAAAA:8 a=i5GS84888sUNcPDMq4UA: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-05-02_03,2026-04-30_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 adultscore=0 lowpriorityscore=0 malwarescore=0 suspectscore=0 spamscore=0 clxscore=1015 phishscore=0 bulkscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604200000 definitions=main-2605020136 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=lists1p.gnu.org; Received-SPF: pass client-ip=148.163.156.1; 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, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ibm.com) X-ZM-MESSAGEID: 1777730533187158500 Content-Type: text/plain; charset="utf-8" During H_CLIENT_ARCHITECTURE_SUPPORT, QEMU attempts to set the requested CPU compatibility mode via ppc_set_compat_all(). If this fails, the existing code may fall back to raw mode when supported by the guest. The current logic treats all failures uniformly and tried to fall back to raw mode whenever possible. As a result, errors from KVM (e.g. kvmppc_set_compat() returning -EINVAL) are silently masked, making debugging difficult and allowing the guest to proceed with an unsupported or incompatible configuration. When running with KVM, such failures indicate that the requested compatibility level is not supported by the host. Do not fallback in this case; instead, report the error and fail the CAS negotiation. This makes the failure visible to the user and ensures that invalid compatibility requests are rejected early rather than being hidden by fallback behavior. For example, the following error is now reported: qemu-system-ppc64: Unable to set CPU compatibility mode in KVM: Invalid a= rgument Fixes: cc7b35b169e9 ("spapr: fallback to raw mode if best compat mode canno= t be set during CAS") Signed-off-by: Amit Machhiwal Tested-by: Anushree Mathur --- hw/ppc/spapr_hcall.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c index 032805a8d0db..de2ea6f5e579 100644 --- a/hw/ppc/spapr_hcall.c +++ b/hw/ppc/spapr_hcall.c @@ -1204,6 +1204,15 @@ target_ulong do_client_architecture_support(PowerPCC= PU *cpu, Error *local_err =3D NULL; =20 if (ppc_set_compat_all(cas_pvr, &local_err) < 0) { + /* + * If KVM rejected the compat mode, do not fallback. This indi= cates + * the host cannot support the requested level. + */ + if (kvm_enabled()) { + error_report_err(local_err); + return H_HARDWARE; + } + /* We fail to set compat mode (likely because running with KVM= PR), * but maybe we can fallback to raw mode if the guest supports= it. */ --=20 2.50.1 (Apple Git-155) From nobody Sat May 30 18:34:48 2026 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=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1777730530; cv=none; d=zohomail.com; s=zohoarc; b=fDM14XvT5HoTM6kDBOhrsjDeExune0bzNrppywyOW5P6yRWiVmymO1uJSDfA6U3VoOWuJvVApxx0w2yUHU9Ah4544/PpErrgpi3EsfSyRaM8+H0k11MoMDW5TPDogDDDnJENzZ7Mrx9wI585lAkRPhhq020LJdWgV7JPzJEqxUc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777730530; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=rOIu87FgwaCWUbRmw1EvAvFLxCHYHpiTW7ufaEC6/kw=; b=WriiSMbb3sI+qy6H584SI7ULkYDRxZvEeHADYPXGjmYDk4KWvla+FUQiNVBw8OCBVn732gIaEqynlf04YqsgCdn1bLzBCGGjrKpNvjeXlRufzlnYAVwGmXTMvZVrHNG4MXmNJ1z4Whkdduvnz0KNRTwovDgrb6z5X5+RrJBp3Jw= 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=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1777730530929896.5282416693879; Sat, 2 May 2026 07:02:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wJAuk-0004mw-EX; Sat, 02 May 2026 10:01:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wJAuG-0004iV-Us; Sat, 02 May 2026 10:01:27 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wJAu9-0007Yn-3T; Sat, 02 May 2026 10:01:16 -0400 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 642Di3W63887449; Sat, 2 May 2026 14:01:08 GMT 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 4dw9xx9335-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 02 May 2026 14:01:07 +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 642DsUjm028219; Sat, 2 May 2026 14:01:07 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 4dw9jy9asp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 02 May 2026 14:01:07 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 642E138s50200952 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 2 May 2026 14:01:03 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A82FB20043; Sat, 2 May 2026 14:01:03 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0763F20040; Sat, 2 May 2026 14:01:00 +0000 (GMT) Received: from localhost.localdomain (unknown [9.124.223.28]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Sat, 2 May 2026 14:00:59 +0000 (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=rOIu87FgwaCWUbRmw 1EvAvFLxCHYHpiTW7ufaEC6/kw=; b=ISx8V8jwqtOQS3lG49hlcsf014fxwcM5d 3aCl/4eRengaaqP5Wote9rGExu4gnbt5tihAiSVq02f92H809dvH5GG/uZRWnNB0 +0jo8/JvIDlyYD6iv1zYKUpnXieTAMx0J1mfqRhVnrb2mM83ujfWe12AqHYtNCwN CJuh2v/XBZ5Op1iLYVsDuagjbAMZjRnW5lwpisWuc6xdq/fOcE5Myq+XK5WKl9k7 92ffc5YCBmLeMIPtszXOlcSVliyxCh6IdbaRw7UTnH/gj9l9bX9WFIiuWjhkjdD1 /B9scgN3zPt4jsn3SOySmI4bnCCQP0sCQyrEKmq3YZZYVxn+Tq8vw== From: Amit Machhiwal To: qemu-ppc@nongnu.org, Harsh Prateek Bora Cc: Amit Machhiwal , Vaibhav Jain , Nicholas Piggin , Chinmay Rath , Glenn Miles , Paolo Bonzini , kvm@vger.kernel.org, qemu-devel@nongnu.org Subject: [PATCH v2 2/3] [DO_NOT_MERGE] linux-headers: Add uapi header changes Date: Sat, 2 May 2026 19:30:20 +0530 Message-ID: <20260502140021.69712-3-amachhiw@linux.ibm.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260502140021.69712-1-amachhiw@linux.ibm.com> References: <20260502140021.69712-1-amachhiw@linux.ibm.com> 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: AW1haW4tMjYwNTAyMDEzNiBTYWx0ZWRfX2tt3AADlODFp cfIDmzjpVmQSQPa+D9yS/XZ7wihAmZXlqVPgGK9OqHtucAofNhmjxT876QibzERN0/gIqdKzK3i xjwtajsVkN50bVgmDqXbbgvIkpkp2dLiXcxMBYDRrmn+z4SV9Jae2CG3FdC0XDluGMWaJ7fjdnS HdmEePFzO3E+jt4DX0sj5yRewK4P3ZuKe7obJa9PGYCd4QyeltI7dUh1KDCQTzmPI4cPXl2rMMV u8vAMRiqHz2GPx/YLgkwDZxL+ubDLFnHxKDuhSdDkyMCeT5XAcWRj+u8yacN2pu/o++EDIOmm/4 QCd5vYqq6QsKOY/cmG2HJ1YjKZjhTUyRzJm/UPNdUJcsDHGO6ZNm+N5GSTmpwlOIJFzzJMVU9UZ gQfZj6M3u7gwPwOBHbgtpYTNvCc8xu9aI16T5JpIf31ldCc+u8IlqJ6azkaUU+RwWXcpU9Fxolp DPKl24u4nh+L2S8adHA== X-Proofpoint-ORIG-GUID: gS_rdAeb1ha3SGIxcGd-Aseb8JP3SkPD X-Proofpoint-GUID: 2N91-7y7aD6cbiNXukQXT06igeG6jui1 X-Authority-Analysis: v=2.4 cv=ctWrVV4i c=1 sm=1 tr=0 ts=69f603a4 cx=c_pps a=aDMHemPKRhS1OARIsFnwRA==:117 a=aDMHemPKRhS1OARIsFnwRA==:17 a=NGcC8JguVDcA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=V8glGbnc2Ofi9Qvn3v5h:22 a=VwQbUJbxAAAA:8 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-05-02_03,2026-04-30_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 lowpriorityscore=0 adultscore=0 clxscore=1015 suspectscore=0 impostorscore=0 spamscore=0 malwarescore=0 phishscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604200000 definitions=main-2605020136 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=lists1p.gnu.org; Received-SPF: pass client-ip=148.163.158.5; envelope-from=amachhiw@linux.ibm.com; helo=mx0b-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, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ibm.com) X-ZM-MESSAGEID: 1777730533240154100 Content-Type: text/plain; charset="utf-8" This is a temporary patch intended for review and testing purposes only. It defines the new ioctls introduced for checking the compatibility modes. The actual header changes are to be done once the kernel changes [1] are merged. [1] https://lore.kernel.org/all/20260430054906.94431-1-amachhiw@linux.ibm.c= om/ Signed-off-by: Amit Machhiwal Tested-by: Anushree Mathur --- linux-headers/asm-powerpc/kvm.h | 7 +++++++ linux-headers/linux/kvm.h | 3 +++ 2 files changed, 10 insertions(+) diff --git a/linux-headers/asm-powerpc/kvm.h b/linux-headers/asm-powerpc/kv= m.h index 077c5437f521..df91b1f40c5b 100644 --- a/linux-headers/asm-powerpc/kvm.h +++ b/linux-headers/asm-powerpc/kvm.h @@ -437,6 +437,13 @@ 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 ho= st */ +}; + + /* * Values for character and character_mask. * These are identical to the values used by H_GET_CPU_CHARACTERISTICS. diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h index a4ab42dcba97..b0c0014a0a0a 100644 --- a/linux-headers/linux/kvm.h +++ b/linux-headers/linux/kvm.h @@ -966,6 +966,7 @@ struct kvm_enable_cap { #define KVM_CAP_GUEST_MEMFD_FLAGS 244 #define KVM_CAP_ARM_SEA_TO_USER 245 #define KVM_CAP_S390_USER_OPEREXEC 246 +#define KVM_CAP_PPC_COMPAT_CAPS 249 =20 struct kvm_irq_routing_irqchip { __u32 irqchip; @@ -1295,6 +1296,8 @@ struct kvm_vfio_spapr_tce { /* Available with KVM_CAP_COUNTER_OFFSET */ #define KVM_ARM_SET_COUNTER_OFFSET _IOW(KVMIO, 0xb5, struct kvm_arm_count= er_offset) #define KVM_ARM_GET_REG_WRITABLE_MASKS _IOR(KVMIO, 0xb6, struct reg_mask_= range) +/* Available with KVM_CAP_PPC_COMPAT_CAPS */ +#define KVM_PPC_GET_COMPAT_CAPS _IOR(KVMIO, 0xe4, struct kvm_ppc= _compat_caps) =20 /* ioctl for vm fd */ #define KVM_CREATE_DEVICE _IOWR(KVMIO, 0xe0, struct kvm_create_device) --=20 2.50.1 (Apple Git-155) From nobody Sat May 30 18:34:48 2026 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=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1777730581; cv=none; d=zohomail.com; s=zohoarc; b=istzZI1d5RHGrqr/BTOMKUrGT1vlGouzbh/fT8ZzYS8hcPmW8MH9J5kahgfLReo53Jx3v71d89SYFodWQi1MlK1Jtzo3B4KYEn8pcVr9ucw9Vu/v/3xbWvm1r5Jz5U9xgr/UFwLLUkyED50WRvBoFVXeRCo7tdCImlZutMR3p64= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1777730581; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=gCcboTpeVtTJuxyfS5ABxK8gnTqsgHQ1afQby0lyAJk=; b=HEHbj4aT7yU+BNoc5xZcxVPpeOrTYfWBLVQfbtnwWpTvBg2gvrwj4b6xbxvdSySO70YjAC8KTf7UGkWxMm7QDTfh50Hyotf0M6YJYHz29L43Fn6yPIcLf8FAIvZa+kOFCQ+3yMP/SwCclRdvoxv7mG29FVungVevRjMdVg4nROY= 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=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1777730581352836.9392593765355; Sat, 2 May 2026 07:03:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wJAui-0004ll-D8; Sat, 02 May 2026 10:01:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wJAuL-0004il-1l; Sat, 02 May 2026 10:01:30 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wJAuH-0007Zu-0v; Sat, 02 May 2026 10:01:23 -0400 Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 64244bFj1989518; Sat, 2 May 2026 14:01:18 GMT 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 4dw9x494uy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 02 May 2026 14:01:17 +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 642DsdgK012945; Sat, 2 May 2026 14:01:16 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4dw9fs9bfg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 02 May 2026 14:01:16 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 642E1Cb453412218 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 2 May 2026 14:01:12 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 873A020043; Sat, 2 May 2026 14:01:12 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E9B2220040; Sat, 2 May 2026 14:01:08 +0000 (GMT) Received: from localhost.localdomain (unknown [9.124.223.28]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Sat, 2 May 2026 14:01:08 +0000 (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=gCcboTpeVtTJuxyfS 5ABxK8gnTqsgHQ1afQby0lyAJk=; b=KGYHCjPDaKyLi6G5MeZC0pSDz6d0V2LI4 pGw0khgluk4HM8Ky1/TJ/QDjB7ckAZvSahYC8rhabuHKnupTcaPb0KjzZd3ctpQH mUIRhbN+f64+jOIFdmsKjDWlERN2rq1awy51zLKn/fOtSFKA3cjCCpWH1ljz0M4X fLabJb5qP0RFiOSZCpwPbeROe4uYuOYqH6GqxXSxDCNNlarDH5MjXOcFCug8Df0l V27a39sguyY8dn/TQtveHLl+93luZbsTDKWlWIV6TmHa5p1hPKarNeaqQ2ced/Jw YO99tjEsrnINSwUKOjyirJigWbEmjX5KCWPxYeUtkNwEqAq0dSzNA== From: Amit Machhiwal To: qemu-ppc@nongnu.org, Harsh Prateek Bora Cc: Amit Machhiwal , Vaibhav Jain , Nicholas Piggin , Chinmay Rath , Glenn Miles , Paolo Bonzini , kvm@vger.kernel.org, qemu-devel@nongnu.org Subject: [PATCH v2 3/3] target/ppc/kvm: Use host compatibility mode for nested guests Date: Sat, 2 May 2026 19:30:21 +0530 Message-ID: <20260502140021.69712-4-amachhiw@linux.ibm.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260502140021.69712-1-amachhiw@linux.ibm.com> References: <20260502140021.69712-1-amachhiw@linux.ibm.com> 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: AW1haW4tMjYwNTAyMDEzNiBTYWx0ZWRfX8O0l7cwMaTck QsarJf4BDaI0450pJIvo/LTifCxdkmOzzDaHVb8G1hl22r9IRmAea4DRW4Dzx0/OZ9xUblHLIP8 Yhzqv1W+b5qRKEPWvRVbmB7jyHaYzDkzUPplqGcc8TmVaKqP0wWU4EG2jWM3oi4GrReKQ6oMi6c xrA2eJsh2ZfEP55pnmqezLMTJqKH7oB12Q5e5BOOkXaBZaQolw3S/UIbMdfe1J0VIRxT3inZL5F mr69nWqIOVklR+xi0yEQPhdPLAAJaiw47u9kBxknVI6Bl+JhMq21xa+nMo1O4FB3PhX3OBX8/ak W5rei7mwjdxFe5IHHGPpcyKNpH37yH1Bb+7soet53Q6wiLZrxIXCWDbB6FIVkUs0s8+RvS3LDU3 iK4svRSF0AzZ4b+GSDfm6tkn6YeAZnKF1BDSi5OPkQKIFphUl6lGyPiZk+fMXQkK1dgMRnllwQ3 0UoCpu+otw0qBmX++yA== X-Proofpoint-ORIG-GUID: 1OQ5RcboF0w4nC9TKv9WsVdRDdAq9lJt X-Proofpoint-GUID: TLeF8EwYmnUnkwkRhrIQX90mz4FA1Cd_ X-Authority-Analysis: v=2.4 cv=W7UIkxWk c=1 sm=1 tr=0 ts=69f603ad cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=NGcC8JguVDcA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=uAbxVGIbfxUO_5tXvNgY:22 a=VnNF1IyMAAAA:8 a=n0kojfgqO0W5ScNLDTQA: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-05-02_03,2026-04-30_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 adultscore=0 lowpriorityscore=0 malwarescore=0 suspectscore=0 spamscore=0 clxscore=1015 phishscore=0 bulkscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604200000 definitions=main-2605020136 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=lists1p.gnu.org; Received-SPF: pass client-ip=148.163.156.1; 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, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=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.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ibm.com) X-ZM-MESSAGEID: 1777730583754154100 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 currently derives the host CPU type using mfpvr(), which reflects the physical processor version. This can result in a mismatch between the CPU model used by QEMU and the compatibility mode enforced by the host, leading to guest boot failures. In particular, booting a nested guest on a Power11 LPAR configured in Power10 compatibility mode fails with errors such as: KVM-NESTEDv2: couldn't set guest wide elements This occurs because QEMU selects a CPU model based on the physical processor version, while the host operates in a lower compatibility mode. As a result, KVM rejects the requested compatibility level during guest initialization. Add support for querying host compatibility capabilities via the KVM_PPC_GET_COMPAT_CAPS ioctl and derive the effective PVR based on the compatibility mode reported by KVM. When available, use this compatibility PVR instead of the raw hardware PVR when selecting the CPU model. If the capability is not supported or the query fails, fall back to the existing behavior. This ensures that QEMU selects a CPU model consistent with the host compatibility mode, allowing nested guests to boot correctly. Signed-off-by: Amit Machhiwal Tested-by: Anushree Mathur --- target/ppc/kvm.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 25c28ad089c6..7a00092c4208 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -2602,11 +2602,68 @@ bool kvmppc_supports_ail_3(void) return cap_ail_mode_3; } =20 +#if defined(TARGET_PPC64) +static target_ulong kvmppc_get_compat_caps(void) +{ + struct kvm_ppc_compat_caps host_compat; + target_ulong host_caps; + int ret; + + if (!kvm_check_extension(kvm_state, KVM_CAP_PPC_COMPAT_CAPS)) { + return 0; + } + + ret =3D kvm_vm_ioctl(kvm_state, KVM_PPC_GET_COMPAT_CAPS, &host_compat); + if (ret < 0) { + fprintf(stderr, "KVM: failed to get host capabilities\n"); + return 0; + } + + host_caps =3D host_compat.compat_capabilities; + return host_caps; +} + +static uint32_t kvm_ppc_host_compat_pvr(void) +{ + uint32_t compat_host_pvr =3D 0; + int cap_idx =3D 0; + target_ulong host_caps =3D kvmppc_get_compat_caps(); + + if (host_caps) { + cap_idx =3D 63 - __builtin_ctzll(host_caps); + switch (cap_idx) { + case H_GUEST_CAP_P9_MODE_BMAP: + compat_host_pvr =3D CPU_POWERPC_POWER9_DD22; + break; + case H_GUEST_CAP_P10_MODE_BMAP: + compat_host_pvr =3D CPU_POWERPC_POWER10_DD20; + break; + case H_GUEST_CAP_P11_MODE_BMAP: + compat_host_pvr =3D CPU_POWERPC_POWER11_DD20; + break; + default: + break; + } + } + + return compat_host_pvr; +} +#endif /* TARGET_PPC64 */ + PowerPCCPUClass *kvm_ppc_get_host_cpu_class(void) { uint32_t host_pvr =3D mfpvr(); PowerPCCPUClass *pvr_pcc; =20 +#if defined(TARGET_PPC64) + uint32_t compat_host_pvr; + + compat_host_pvr =3D kvm_ppc_host_compat_pvr(); + if (compat_host_pvr) { + host_pvr =3D compat_host_pvr; + } +#endif /* TARGET_PPC64 */ + pvr_pcc =3D ppc_cpu_class_by_pvr(host_pvr); if (pvr_pcc =3D=3D NULL) { pvr_pcc =3D ppc_cpu_class_by_pvr_mask(host_pvr); --=20 2.50.1 (Apple Git-155)