{"id":2230833,"url":"http://patchwork.ozlabs.org/api/1.1/covers/2230833/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/cover/20260430054906.94431-1-amachhiw@linux.ibm.com/","project":{"id":2,"url":"http://patchwork.ozlabs.org/api/1.1/projects/2/?format=json","name":"Linux PPC development","link_name":"linuxppc-dev","list_id":"linuxppc-dev.lists.ozlabs.org","list_email":"linuxppc-dev@lists.ozlabs.org","web_url":"https://github.com/linuxppc/wiki/wiki","scm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git","webscm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/"},"msgid":"<20260430054906.94431-1-amachhiw@linux.ibm.com>","date":"2026-04-30T05:48:59","name":"[0/6] KVM: PPC: Handle CPU compatibility mode for nested guests","submitter":{"id":87864,"url":"http://patchwork.ozlabs.org/api/1.1/people/87864/?format=json","name":"Amit Machhiwal","email":"amachhiw@linux.ibm.com"},"mbox":"http://patchwork.ozlabs.org/project/linuxppc-dev/cover/20260430054906.94431-1-amachhiw@linux.ibm.com/mbox/","series":[{"id":502205,"url":"http://patchwork.ozlabs.org/api/1.1/series/502205/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=502205","date":"2026-04-30T05:48:59","name":"KVM: PPC: Handle CPU compatibility mode for nested guests","version":1,"mbox":"http://patchwork.ozlabs.org/series/502205/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/covers/2230833/comments/","headers":{"Return-Path":"\n <linuxppc-dev+bounces-20332-incoming=patchwork.ozlabs.org@lists.ozlabs.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linuxppc-dev@lists.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=tKmJiRIA;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org\n (client-ip=112.213.38.117; helo=lists.ozlabs.org;\n envelope-from=linuxppc-dev+bounces-20332-incoming=patchwork.ozlabs.org@lists.ozlabs.org;\n receiver=patchwork.ozlabs.org)","lists.ozlabs.org;\n arc=none smtp.remote-ip=148.163.156.1","lists.ozlabs.org;\n dmarc=pass (p=none dis=none) header.from=linux.ibm.com","lists.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=tKmJiRIA;\n\tdkim-atps=neutral","lists.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=linux.ibm.com\n (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com;\n envelope-from=amachhiw@linux.ibm.com; receiver=lists.ozlabs.org)"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1 raw public key)\n server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g5jtw4hQhz1yHZ\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 30 Apr 2026 15:50:16 +1000 (AEST)","from boromir.ozlabs.org (localhost [127.0.0.1])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 4g5jtv4qY8z2xl5;\n\tThu, 30 Apr 2026 15:50:15 +1000 (AEST)","from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com\n [148.163.156.1])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 4g5jtt5ldRz2xMY\n\tfor <linuxppc-dev@lists.ozlabs.org>; Thu, 30 Apr 2026 15:50:13 +1000 (AEST)","from pps.filterd (m0353729.ppops.net [127.0.0.1])\n\tby mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id\n 63U2GAIM523254;\n\tThu, 30 Apr 2026 05:50:01 GMT","from ppma22.wdc07v.mail.ibm.com\n (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92])\n\tby mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4drn9re2k3-1\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n\tThu, 30 Apr 2026 05:50:00 +0000 (GMT)","from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1])\n\tby ppma22.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id\n 63U5cqj1025955;\n\tThu, 30 Apr 2026 05:49:59 GMT","from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227])\n\tby ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4ds8aw1nkd-1\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n\tThu, 30 Apr 2026 05:49:59 +0000 (GMT)","from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com\n [10.20.54.102])\n\tby smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id\n 63U5ntwo60162342\n\t(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);\n\tThu, 30 Apr 2026 05:49:55 GMT","from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id B82A220043;\n\tThu, 30 Apr 2026 05:49:55 +0000 (GMT)","from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1])\n\tby IMSVA (Postfix) with ESMTP id 997BB20040;\n\tThu, 30 Apr 2026 05:49:51 +0000 (GMT)","from localhost.localdomain (unknown [9.39.18.70])\n\tby smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP;\n\tThu, 30 Apr 2026 05:49:51 +0000 (GMT)"],"ARC-Seal":"i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1777528215;\n\tcv=none;\n b=n7wf5Q26qlRPLuXOW3KmX/kxASI8ol2Ev69YlDoXPK3VqRgj8bV5yAJwCP65ePDzoJpOTeV973K6Y9zDUobVDGwU46Inok1BN0cJIIUwO3JcWZGFenoXmB/3ObPMuoa2UUx96bD5Q8STrl885G9UJSHlBcBFUThePRPRyWON6UCfuloiFGMbVO6t7SV3rG3NKN2YQomIS5rVc8t18MzBAVo5mpD7dZ+UA2/9xXNvTk4tK3vYw2kL+k7MrF8tQ98Ye/IFRKnk7ggOcQXGJXB8/3iwXPnY/L62KCZd7AfEIUf2I2EEGBky3yt37dap+SXqHQAmUddk/dQoUpVQbPAgmg==","ARC-Message-Signature":"i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707;\n\tt=1777528215; c=relaxed/relaxed;\n\tbh=owmjtlgxhZ3jXS8yeS0VEKzCSvww3herCYfHShTAwek=;\n\th=From:To:Cc:Subject:Date:Message-ID:MIME-Version;\n b=IKkPgP1HyuPARnZHfpmnajCRCjguWctKM52VYGacRNpz6qltHeQ8BU7ErYv/Fg09paIW+o92mK2sHSGd1CCE7/JZ0kkngHkSbdICSs/nqqLSbg4MzVlZiraHpc9+J8b3/yYkN+oEj+ogd30CyqCGtn88+lMe+mizwq5PqY9DAdtyVjHx+6ibtPc60m/zSqLJClYBWEPhs54J05cr6EXSXZq9gRshQ2DwL/wFtpdnAgsA6Wc1G7M1dvp7s/5YnIcpK1GRQhSD/Isxjnnzm4D1LkJt+ar+t85DieMBltoZ2Xnl/DPSqPRf+FGaX4jpr+VuaNex2sM/pTI4Kir/koIi6Q==","ARC-Authentication-Results":"i=1; lists.ozlabs.org;\n dmarc=pass (p=none dis=none) header.from=linux.ibm.com;\n dkim=pass (2048-bit key;\n unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256\n header.s=pp1 header.b=tKmJiRIA; dkim-atps=neutral;\n spf=pass (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com;\n envelope-from=amachhiw@linux.ibm.com;\n receiver=lists.ozlabs.org) smtp.mailfrom=linux.ibm.com","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc\n\t:content-transfer-encoding:date:from:message-id:mime-version\n\t:subject:to; s=pp1; bh=owmjtlgxhZ3jXS8yeS0VEKzCSvww3herCYfHShTAw\n\tek=; b=tKmJiRIAG++6kfz+3rWOH4zvoOpcoa+62w5t+NkKf/1RkRTDQIYVgCnio\n\t6SdPHueyJ6WIifbvuwCN6zKJ29GMX9u2duUO1/rnhTY/SSVUK8Qmt4zSwaIzAV+U\n\twVUBCKfCzzqyfSBg9/RrNLjhj+/QjpjlIMEIUEL44vp0MhstR5P/Xx4/kRIp8HUm\n\teawQmgJNBpDrvfWEQSWxlILWjTC9OF0GkKpe6yykWNhYFDClUM/mP5l1eSZlZkEL\n\tzOZ7OZ1FfiN1EGBCpXjqcw2Szrz2cuJcqqaXIiR+8wAnLsGFOTHyxFil+9zSePYz\n\tdLZCtJ5pGUI0aofzi6II0Oohq9A+A==","From":"Amit Machhiwal <amachhiw@linux.ibm.com>","To":"linuxppc-dev@lists.ozlabs.org, Madhavan Srinivasan <maddy@linux.ibm.com>","Cc":"Amit Machhiwal <amachhiw@linux.ibm.com>,\n        Vaibhav Jain <vaibhav@linux.ibm.com>,\n        Paolo Bonzini <pbonzini@redhat.com>,\n        Nicholas Piggin <npiggin@gmail.com>,\n        Michael Ellerman <mpe@ellerman.id.au>,\n        \"Christophe Leroy (CS GROUP)\" <chleroy@kernel.org>,\n        Jonathan Corbet <corbet@lwn.net>,\n        Shuah Khan <skhan@linuxfoundation.org>, kvm@vger.kernel.org,\n        linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org","Subject":"[PATCH 0/6] KVM: PPC: Handle CPU compatibility mode for nested guests","Date":"Thu, 30 Apr 2026 11:18:59 +0530","Message-ID":"<20260430054906.94431-1-amachhiw@linux.ibm.com>","X-Mailer":"git-send-email 2.50.1","X-Mailing-List":"linuxppc-dev@lists.ozlabs.org","List-Id":"<linuxppc-dev.lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev+help@lists.ozlabs.org>","List-Owner":"<mailto:linuxppc-dev+owner@lists.ozlabs.org>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Archive":"<https://lore.kernel.org/linuxppc-dev/>,\n  <https://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Subscribe":"<mailto:linuxppc-dev+subscribe@lists.ozlabs.org>,\n  <mailto:linuxppc-dev+subscribe-digest@lists.ozlabs.org>,\n  <mailto:linuxppc-dev+subscribe-nomail@lists.ozlabs.org>","List-Unsubscribe":"<mailto:linuxppc-dev+unsubscribe@lists.ozlabs.org>","Precedence":"list","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-TM-AS-GCONF":"00","X-Proofpoint-Reinject":"loops=2 maxloops=12","X-Proofpoint-GUID":"d8zTUNCndk9tKeMj84mKiUdjekEBvPX-","X-Proofpoint-Spam-Details-Enc":"AW1haW4tMjYwNDMwMDA1NSBTYWx0ZWRfX/WAG8EUC84l0\n A9VTSw5dIXDmEZ4CLB++1VwdIxbLl+GTiUI4Lp2g8eh+oeYI7GJRoTkaZvtyOZZ3VAMRUpDhXNt\n 2cBQNgPca0eB/5H/hTx31ZiInFZisSXO+4/XOs4ptXEmPIdbmO6UbN8vXsEMb6XaeYM49sfNMmo\n 9iuHUDx1meJNnX1uOLGOs8Fc/llEN7/6qSmv6bqzgjlEX541r134jIRwX3MJ/e9TQXS9H+eigQu\n 6oxU56qeH7ZGsEQmW7eKHxWTloVk/+vSPOAIXOy/VWUEZiuCneiSDCcMaHbzNQk2Pfq+brAicJY\n pYzrzRdMyri1pp+7sMrY+hy5gpTzlJzqVo/XiLuThModhY2kX4w2fiYk5kkecCKktogH2W5vRFi\n 5tJ49WsGkckfiWxT13at1Wm5sIz5WGrLLXKjagxeWwKlgiAkQIA5n82lrHYKbvuOiOc0KElJD7C\n NZsFF8HE070haL0Y1sQ==","X-Authority-Analysis":"v=2.4 cv=Kc7idwYD c=1 sm=1 tr=0 ts=69f2ed89 cx=c_pps\n a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17\n a=A5OVakUREuEA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22\n a=uAbxVGIbfxUO_5tXvNgY:22 a=3pgwaEq9XIEntMmap7EA:9","X-Proofpoint-ORIG-GUID":"pQubjeeb4m7Z2BXmodPYaTsTe5eVKfs2","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 clxscore=1011 phishscore=0 bulkscore=0 adultscore=0 spamscore=0\n malwarescore=0 impostorscore=0 priorityscore=1501 lowpriorityscore=0\n suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc=\n route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604200000\n definitions=main-2604300055","X-Spam-Status":"No, score=-0.7 required=3.0 tests=DKIM_SIGNED,DKIM_VALID,\n\tRCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,\n\tSPF_PASS autolearn=disabled version=4.0.1 OzLabs 8","X-Spam-Checker-Version":"SpamAssassin 4.0.1 (2024-03-25) on lists.ozlabs.org"},"content":"On POWER systems, newer processor generations can operate in compatibility\nmodes corresponding to earlier generations (e.g., a Power11 system running\nin Power10 compatibility mode). In such cases, the effective CPU level\nexposed to guests differs from the physical processor generation.\n\nThis creates a problem for nested virtualization. When booting a nested KVM\nguest (L2) inside a host KVM guest (L1) running in a compatibility mode,\nuserspace (e.g., QEMU) may derive the CPU model from the raw hardware PVR\nand attempt to configure the nested guest accordingly. However, the L1\npartition is constrained by the compatibility level negotiated with the\nhypervisor (L0), and requests exceeding that level are rejected, leading to\nguest boot failures such as:\n\n  KVM-NESTEDv2: couldn't set guest wide elements\n\nThis series addresses the issue in two steps:\n\n1. Detect and reject invalid compatibility requests early in KVM to avoid\n   late failures.\n\n2. Provide a mechanism for userspace to query the effective CPU\n   compatibility modes supported by the host, so it can select an\n   appropriate CPU model for nested guests.\n\nTo achieve this, the series introduces a new KVM capability and ioctl\n(KVM_CAP_PPC_COMPAT_CAPS / KVM_PPC_GET_COMPAT_CAPS) that expose the\ncompatibility modes supported by the host.\n\nThe implementation supports both:\n\n  - PowerVM (nested API v2), where compatibility information is obtained\n    via the H_GUEST_GET_CAPABILITIES hypercall.\n  - PowerNV (nested API v1), where compatibility is derived from the device\n    tree (\"cpu-version\") representing the effective processor compatibility\n    level.\n\nThis allows userspace (e.g., QEMU) to select a CPU model consistent with\nthe host compatibility mode, avoiding mismatches and enabling successful\nnested guest boot.\n\nPatch summary:\n  [1/6] Validate arch_compat against host compatibility mode\n  [2/6] Introduce KVM_CAP_PPC_COMPAT_CAPS and ioctl\n  [3/6] Wire up ioctl handling\n  [4/6] Implement capability retrieval for PowerVM (API v2)\n  [5/6] Add PowerNV support (API v1)\n  [6/6] Document the new ioctl\n\nTested on:\n  - Power11 pSeries LPAR in Power10 compatibility mode (nested API v2)\n  - Power10 PowerNV system (and QEMU TCG PowerNV 11) with nested\n    virtualization (API v1) with various combinations of KVM L1/L2 guests\n    in various supported compatibility modes.\n\nWith this series, nested guests boot successfully in configurations where\nthey previously failed due to compatibility mismatches.\n\nAmit Machhiwal (6):\n  KVM: PPC: Book3S HV: Validate arch_compat against host compatibility\n    mode\n  KVM: PPC: Introduce KVM_CAP_PPC_COMPAT_CAPS and\n    KVM_PPC_GET_COMPAT_CAPS\n  KVM: PPC: Wire up KVM_PPC_GET_COMPAT_CAPS ioctl\n  KVM: PPC: Book3S HV: Implement compat CPU capability retrieval for KVM\n    on PowerVM\n  KVM: PPC: Book3S HV: Add support for compat CPU capabilities for KVM\n    on PowerNV\n  KVM: PPC: Document KVM_PPC_GET_COMPAT_CAPS ioctl\n\n Documentation/virt/kvm/api.rst      | 35 +++++++++++++++++\n arch/powerpc/include/asm/kvm_ppc.h  |  1 +\n arch/powerpc/include/uapi/asm/kvm.h |  6 +++\n arch/powerpc/kvm/book3s_hv.c        | 58 +++++++++++++++++++++++++++++\n arch/powerpc/kvm/powerpc.c          | 19 ++++++++++\n include/uapi/linux/kvm.h            |  4 ++\n 6 files changed, 123 insertions(+)\n\n\nbase-commit: dca922e019dd758b4c1b4bec8f1d509efddeaab4\n--\n2.50.1"}