From nobody Sat Feb 7 07:31:33 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=unpredictable.fr ARC-Seal: i=1; a=rsa-sha256; t=1770301712; cv=none; d=zohomail.com; s=zohoarc; b=bGaYTj+SV20WQc/6ayaylZgIZI9V+Jz2bSLLTNZ19nMIM9KxlD5PBQV74eJv4h01yd5Xj/AMyH/Etkmm71hTqBhwvdNFmfL7qrquUd6KVTXVpR/tLOqeG2NTr2V7BXPG9bRzkF9htZKXsBIrUnOqBMxB6dm8P7ns/9YiIzaFriY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770301712; h=Content-Type: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=JM+IS+u2FhSUs+ag940jtQKtrbvFK486Oy66aTDOb2E=; b=J9R5FJyG6ymwOHgW2O4PiMWqN7d9UANB9zrwyP0RVSLu0za3rEjlXG5ibwvg/MK6ZFVdiyTXB1EAYk+h9c37k8WGUJg3SiHhEpncwnptCwM/MoAsyKCxZeg7l7RQEN1BGB4UwlSiuKl+5V5TZ4rmJzCloBdxRzkCMiLbjUWpO/s= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770301712792459.41454733076523; Thu, 5 Feb 2026 06:28:32 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vo0J3-0000mK-Al; Thu, 05 Feb 2026 09:26:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0Ix-0000lb-72 for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:25:59 -0500 Received: from qs-2002b-snip4-11.eps.apple.com ([57.103.87.151] helo=outbound.qs.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0Iv-0007oP-Tq for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:25:58 -0500 Received: from outbound.qs.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPS id 31FFA180011A; Thu, 5 Feb 2026 14:25:51 +0000 (UTC) Received: from localhost.localdomain (unknown [17.57.155.37]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPSA id 451111800267; Thu, 5 Feb 2026 14:25:48 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1770301557; x=1772893557; bh=JM+IS+u2FhSUs+ag940jtQKtrbvFK486Oy66aTDOb2E=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:x-icloud-hme; b=ELkxtTfQ4ryDg7Yi2NfrHIMiJyoO9EykMSovqfvG/O6VzopXlZvpin+DTqbRmugjv2E1w6IBDPcSQBg9OkWMXMciztmAGTd8u5aBdGwst1iu8cBxZJs9pWW5vk1//Tqan2HAE3WRye95R9HI59RMn1dwM2jJjk68KA+pOHILrpLIkzB1GfJwE9T0MYQ8ngvl/L36TJUfinXX0Aq1WH+zqfE16Gn6OWXcSF9T0LLb135VR4pVrvC5bzI2WHp/bYpvAL0TzM8+qVroaO0XFAGLfUk0ia+jKXeRxygaZZ7F7kd/CKUaSyqVN8mvAidBwTzCBpFCxZlBnzdmh1wyOzD0uA== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org, mohamed@unpredictable.fr Cc: Zhao Liu , Paolo Bonzini , Akihiko Odaki , Cameron Esfahani , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Shannon Zhao , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Phil Dennis-Jordan , "Michael S. Tsirkin" , Richard Henderson , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Alexander Graf , Pedro Barbuda , Yanan Wang , Ani Sinha , Igor Mammedov , Marcel Apfelbaum , Peter Maydell , Eduardo Habkost , Roman Bolshakov , Pierrick Bouvier , Sebastian Ott Subject: [PATCH v21 01/22] target/arm/kvm: add constants for new PSCI versions Date: Thu, 5 Feb 2026 15:25:19 +0100 Message-ID: <20260205142543.64818-2-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260205142543.64818-1-mohamed@unpredictable.fr> References: <20260205142543.64818-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Authority-Info-Out: v=2.4 cv=QLNlhwLL c=1 sm=1 tr=0 ts=6984a873 cx=c_apl:c_apl_out:c_pps a=bsP7O+dXZ5uKcj+dsLqiMw==:117 a=bsP7O+dXZ5uKcj+dsLqiMw==:17 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=20KFwNOVAAAA:8 a=KKAkSRfTAAAA:8 a=JzSzn-WSbtI0XTK35wMA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjA1MDEwOCBTYWx0ZWRfX7zl9qQDQ4CMd LNl9Vt4w5LN3xKDL7XZMTiCdJY2MrGrVsTpeWzRdmPaRYrSvZg9I3frrk7EBKMbhUofTNLIWvtI 51m4ObsVYRdKJroF6X421mfaHvtEAFIJOheG11OAaexeBNRAC2ECZDXCEdpKuo3RaP0/3G/tgXg GnNdjGqxFZZUv2W7cwZg0rtVLzX05DVOAXIBFRaC4MdrkSdAiUEoWM3o2D0PTAWzuTEfsId2W+s inP5uSgCOqKQqXrKCoEBnsO7izltDgnwHaluLT4bvVtOjVSOQDJTYx3c5tht0AtPq+AwTmY6fsF vCF2Qs7sqoffmI9KiIBNfwtCdIiI97xkKg+GScPans3SLFv6k0rKEWL6WjoQwU= X-Proofpoint-GUID: HPAg23eP3_mg6IVN9xyeFY3cgn8bcSX4 X-Proofpoint-ORIG-GUID: HPAg23eP3_mg6IVN9xyeFY3cgn8bcSX4 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-05_03,2026-02-05_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 phishscore=0 adultscore=0 mlxscore=0 spamscore=0 bulkscore=0 clxscore=1030 malwarescore=0 lowpriorityscore=0 suspectscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602050108 X-JNJ: AAAAAAABQofOqeULv+IHxZErJD88H0KIE8ihkrEnpuNATfVWcJ+ERV6LSq74zLFWSI6wxB4IdV6OAtcuYTt229oj88nZZFmtRP3e/wIZksAFVNxU0cxhbzJ+yjzpXsc7h0hKNQUdHEOO0AgTpjzuwz1UDaYlFDd5s7xXWeaV4NcL231WhlAPjgvu4u0ertfNQS4CdK5L127zqivY+/RAh7o0MoIUhX5DGVQq0vVh32OPWHUjfwN571sEEqTBJxE6GCSkxmLl4zbk30RQRohgL/6+J6W0EeZiV4JxQIei4hO37WzH/MydcTYwuHLJpP8VnMmO3968+L3NuEj9jvwRC5Sny6Xs6AVSI8Uwdo9LXzM0YQHsBwRMMpy9TkFx7a/LKcPAJd08v3IYbBEu9eWsj5JA2UnHdpUU6w6okGhbXR3+T37keQCxh4aBSkPJbKDqk1gkDbuWOHzyP1LGYTdXn7cON+IolWb0A2MdTHH1/McOhkKONM2g1+/Qlqs/udrgN31xTwKNxmgBM1E9vKG13GqaQNzMlXZOl5jcWIb+0cLcW6sXHJ51KYbzh+2+RNInAonBXutvDtPTLLWeFqcK3TSZzPVZd2IHRLaqLCf8Z5iXIfwtXAivg4D7sxrR7XMGrr+GmKAO6mGtWLuzT1tEMqRZJ08PbFJBdPPlPrv4n20EnYn+IMPZaWcR+7PuzaghiekMtRiXlkGNxInLNUHQFVfkNfojBdf20jv3OxMFoksEBZdMJO3DjlnC7ouRwo6k7eBgGDgSQdpVKBVBxRU4pDk68K/EgJt6JZ8De2evJhjbyU3BcN6SF+9XctZ7lOfs4cB32qRjKUExjRdYXBSEwyMx8EPyscUHAlIm5KAidavmy6Y57HTI/MJXrZKCvW0ihvsM/jtIy/tpIukg55E1rYIBK6BU/pCGryUfNipE2kJovonpEsF5RSKg87Yb7KinKkFlKqlSkmxGwiEReUc= 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=lists.gnu.org; Received-SPF: pass client-ip=57.103.87.151; envelope-from=mohamed@unpredictable.fr; helo=outbound.qs.icloud.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @unpredictable.fr) X-ZM-MESSAGEID: 1770301715017158500 From: Sebastian Ott Add constants for PSCI version 1_2 and 1_3. Signed-off-by: Sebastian Ott Reviewed-by: Pierrick Bouvier Reviewed-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- target/arm/kvm-consts.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/arm/kvm-consts.h b/target/arm/kvm-consts.h index 54ae5da7ce..9fba3e886d 100644 --- a/target/arm/kvm-consts.h +++ b/target/arm/kvm-consts.h @@ -97,6 +97,8 @@ MISMATCH_CHECK(QEMU_PSCI_1_0_FN_PSCI_FEATURES, PSCI_1_0_F= N_PSCI_FEATURES); #define QEMU_PSCI_VERSION_0_2 0x00002 #define QEMU_PSCI_VERSION_1_0 0x10000 #define QEMU_PSCI_VERSION_1_1 0x10001 +#define QEMU_PSCI_VERSION_1_2 0x10002 +#define QEMU_PSCI_VERSION_1_3 0x10003 =20 MISMATCH_CHECK(QEMU_PSCI_0_2_RET_TOS_MIGRATION_NOT_REQUIRED, PSCI_0_2_TOS_= MP); /* We don't bother to check every possible version value */ --=20 2.50.1 (Apple Git-155) From nobody Sat Feb 7 07:31:33 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=unpredictable.fr ARC-Seal: i=1; a=rsa-sha256; t=1770301923; cv=none; d=zohomail.com; s=zohoarc; b=j24Vg7IJO8cK8XzzQXed+xItWcOa/PJq2y2dxZn95JpgeGwzjO1kbBkCuKQfJIzAAaHql+VLbG8XeVPUnXDW/Vhy7dTbaf863ON1jueR/8XpBkTrXlZ1j5Ogvd3MxpdyI37P/HpZ0GMnXDxpsgtqoX+0hZQqni6vkgtaRLeeVKo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770301923; h=Content-Type: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=rqevPYI5PNmYfO37aWp6zQDTk/Z3PG7nW7DuJwvRyUM=; b=kIBSns+DDuvks6uSjK7ub5xVTcAH6Xmam7Il4oUOa8Qa3lRpgL2bfgyYcFzVyW8v5aa1Nxq2wyTOleMlcvK5pnMJE1qF6PxxToanqjUYp7msSHjq1LJBCiOf7tHg9TsFVlprA44mNUx4vpCkLIb/NGeoUwREBtFYFP8BD6i8g2k= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770301923350337.46739245945105; Thu, 5 Feb 2026 06:32:03 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vo0J6-0000o5-5H; Thu, 05 Feb 2026 09:26:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0J0-0000lu-4y for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:03 -0500 Received: from qs-2002j-snip4-11.eps.apple.com ([57.103.87.231] helo=outbound.qs.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0Ix-0007ow-Q7 for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:01 -0500 Received: from outbound.qs.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPS id 92BE91800D8E; Thu, 5 Feb 2026 14:25:55 +0000 (UTC) Received: from localhost.localdomain (unknown [17.57.155.37]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPSA id 5AEC2180027B; Thu, 5 Feb 2026 14:25:51 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1770301559; x=1772893559; bh=rqevPYI5PNmYfO37aWp6zQDTk/Z3PG7nW7DuJwvRyUM=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:x-icloud-hme; b=eWpboVVlzJFCqBmLgbwNlHMcFB0hEODWNHcWscT81dby4jxVLH0zwSy9jfFuiNbDklppWjwzu75UFEjK8FMBk4vvRE6HM/NfyoDdY1Nd1fv9P6GS0Su8H0uq7Lzg6G0Pq9pjnaqq3ybus31JAOnSsZVBe7z9T3aJgbNL1mGNmvAVeOFKHXy5kh233ufzxsijHARBu4Fs4TmEJI5tb2ADenCqQxDZHB/TWC5+xFCDBCM9cmEGDaYHCAKo9NspSlTcA0ZABO5Q6AudOigyse37FeyY1dOVh7cbl8liABuWg/PzVsMcbapcu3e88SqoYkfD43cSQVeQ0q6SKu63xjYeRg== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org, mohamed@unpredictable.fr Cc: Zhao Liu , Paolo Bonzini , Akihiko Odaki , Cameron Esfahani , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Shannon Zhao , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Phil Dennis-Jordan , "Michael S. Tsirkin" , Richard Henderson , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Alexander Graf , Pedro Barbuda , Yanan Wang , Ani Sinha , Igor Mammedov , Marcel Apfelbaum , Peter Maydell , Eduardo Habkost , Roman Bolshakov , Pierrick Bouvier Subject: [PATCH v21 02/22] accel/system: Introduce hwaccel_enabled() helper Date: Thu, 5 Feb 2026 15:25:20 +0100 Message-ID: <20260205142543.64818-3-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260205142543.64818-1-mohamed@unpredictable.fr> References: <20260205142543.64818-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: 8tD6QiDTpZMLH8UuSsLGQXC5ZJqFhADU X-Proofpoint-GUID: 8tD6QiDTpZMLH8UuSsLGQXC5ZJqFhADU X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjA1MDEwOCBTYWx0ZWRfX4so4QKJgC6sB KtsmE2iL4wPZEoLhkKPuCdPQ6U0oncf6Sjm8Emmn9u4bHhzULudRd0W2bxzPQBD3e5bV8twwOah tTfNBZfuH1TIkoNQkRjB2d7bu+JMAI9sGTvBpohOy6gxmlcwIsa5jLvjJy7XVZw0zQghPC3alGv stNf9mxpXshCij/TbxbTRJmrt5I8BFEJVIq0N2WWVExLCAgHl2stz8S/LW3yAnVVRiMCI9Gs0tL lX4iOeGBTJsToXd1+0sxWXUY92mQaVijA7bIF2OxYTQ0o6uWpnOrwL12UKJBT+OcklrS4wAm4h7 Faka4ZFwQKMeywYL8frZY+zOiiEJMdIfxO5zmy37soi1xYyI1z73WRz2Rg9EBI= X-Authority-Info-Out: v=2.4 cv=dLerWeZb c=1 sm=1 tr=0 ts=6984a875 cx=c_apl:c_apl_out:c_pps a=bsP7O+dXZ5uKcj+dsLqiMw==:117 a=bsP7O+dXZ5uKcj+dsLqiMw==:17 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=zYwLhoXY7WJC0OmO1EgA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-05_03,2026-02-05_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 clxscore=1030 spamscore=0 mlxlogscore=999 bulkscore=0 lowpriorityscore=0 malwarescore=0 adultscore=0 suspectscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602050108 X-JNJ: AAAAAAABkaiDMd8DfTFQWRhWeYZsJrTMio/BJX+Nt4Q5U62TIGe4shOWXMnpUTACuz7Y9+5dslg5Ao22+qO0sCgfwNpG/A+AhaJF0l0NHI/JkRGk5oa/kDR8uRrqcJ9HM2h5rYoj+SM06fuVFVfb2ZH2iuWqFBYhehMUg+M30kiMHuuf/W6CJJHDdA12uk/GJaQ7bxAegHiDXZrcmgGYK9/CLs0Z3bcotT1PoybWYuPzCh2C2gHSyZiUQl+PnbRC602ZwJ7imNsazMlVTMfsozr2fjHtfKXazesT/ABzyTOVeUuPHhcv6199BNNeRxCbfj4omLq7qwl/VbJ5NskPmLeV6+nniRWqcyzgnFO1KvL59qYeCboS5yP7dzx56tdQJ/58PxcVUBqr6fcPHyBUsCC3RkyrTAod0L/yKhckL97T8APSge1c5J0rNP20EURvjDF0hFXOoIcE0l8Qs5D1XcZZyOobFeDCswvFZmeXiQISQD9SWr++7WgF+QTkVydmX28Qmp4/R6THsdCr64/xMU3klp7UpaOYKOViOPp977SCWeXNsPbjjyN9QyxJ3nasybxbtB2PiFMgBgHOq937ZT5x81UOil4aHPeWRpcj/3I82/7rJ2JTL0I4Kxr6hZZCOzpYSz49F2aR2Isi0YIo7/PnnuB1/MoKMUDVnxax/41IH/08MQJEYKAWf+ijMk+fuoQZaDaK5t3Ha7zhnIbb1lmm+UEPzgoQfygS1/q4JjCkUep6aqsik9kf1XTjLtq2c47KYzhWi2tDguNjTAbuCESntGXRTsDMOEJegpPZvX18GC1Zc+GcRNIpVNddfEWBRVrg63rC+rQWQhh90F9LiFRlc5ioETTrJbHtLINm5uYWk5TjVNaATxCT+9qJ82BHKcw7dTP+TMRxov+clVkeYkQrKzBRJah5NCXBlWtRxL+mWzHPXklqMmlsyIK2JQnIHVgHz0PKH+sKqWP5VLM= 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=lists.gnu.org; Received-SPF: pass client-ip=57.103.87.231; envelope-from=mohamed@unpredictable.fr; helo=outbound.qs.icloud.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @unpredictable.fr) X-ZM-MESSAGEID: 1770301925495154100 From: Philippe Mathieu-Daud=C3=A9 hwaccel_enabled() return whether any hardware accelerator is enabled. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Reviewed-by: Pierrick Bouvier Reviewed-by: Akihiko Odaki --- include/system/hw_accel.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/system/hw_accel.h b/include/system/hw_accel.h index 55497edc29..628a50e066 100644 --- a/include/system/hw_accel.h +++ b/include/system/hw_accel.h @@ -40,4 +40,17 @@ void cpu_synchronize_pre_loadvm(CPUState *cpu); void cpu_synchronize_post_reset(CPUState *cpu); void cpu_synchronize_post_init(CPUState *cpu); =20 +/** + * hwaccel_enabled: + * + * Returns: %true if a hardware accelerator is enabled, %false otherwise. + */ +static inline bool hwaccel_enabled(void) +{ + return hvf_enabled() + || kvm_enabled() + || nvmm_enabled() + || whpx_enabled(); +} + #endif /* QEMU_HW_ACCEL_H */ --=20 2.50.1 (Apple Git-155) From nobody Sat Feb 7 07:31:33 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=unpredictable.fr ARC-Seal: i=1; a=rsa-sha256; t=1770301909; cv=none; d=zohomail.com; s=zohoarc; b=eONuQgbIFaQm5nLHiUrPO4UndS2CXD04LoP6MGRxh/05zqtz8B2D5SK+hUfJECXnOUseFqJILKcYHAIFpr6+3Trxvsjnmu8Cu3Vfal2c5hQ27I7PTaaSZsvevs2bVjA5TLS3IGZxYTBvX4ocWxCqrxmofOIlpVvKsHlZxzwr6s4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770301909; 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=ChIhwcPMGVA7/ZQSbYVEEiNk2wqKK9/9DHnWEjCY41s=; b=DnBCy0BbQOh0HFULsI6aIQGAO9Qap2px38smk/GiAjv7XLvtRw8DD9MgF4sYEslPrrtsjROI6GoVgrRSns7Y93BilHnaFlFN8lMQX2Jgsneq5ZDT4WcL0EUqjffESihUjk1Y//ti3hpW5wwKe5WW6E521VMVSoXw8CG6QjogAXg= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 177030190937451.86189715166768; Thu, 5 Feb 2026 06:31:49 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vo0J6-0000oE-L3; Thu, 05 Feb 2026 09:26:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0J4-0000n2-Fx for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:06 -0500 Received: from qs-2002g-snip4-6.eps.apple.com ([57.103.87.197] helo=outbound.qs.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0J3-0007qo-3B for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:06 -0500 Received: from outbound.qs.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPS id E494A1800DA1; Thu, 5 Feb 2026 14:25:58 +0000 (UTC) Received: from localhost.localdomain (unknown [17.57.155.37]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPSA id 3B1E71800128; Thu, 5 Feb 2026 14:25:54 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1770301564; x=1772893564; bh=ChIhwcPMGVA7/ZQSbYVEEiNk2wqKK9/9DHnWEjCY41s=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=JzTs0q1U2kud0n3gI1QAFerUJhrv7pbgsNPVUnGqUNvgP6FwWy+N6KEbCEp3jrrBnqkaczgrVijLSdJjVmMwf6sr9m1fXKkLytYObp8Spo2i8WXn7ZgyG3FqW8MRmiM83Mh1r7ZEy35+bs9lI2a6O1euiNKOYnpkPtKueQjk8T29HN10uJgd4jNvPRxnlhqTKpcvvURBW0lp9Z1GdS5LxebTB9OYVpXUMSHUQ7F4GE+lrm5C42ggxcRnpQHX6Pz9ccZFjv20UAPu9nnkaCsR/K8b4OwJyKBdm4Uyd+JfZBD2nRn3XFvC5+jAxwDPH8gJGYxAxhW6dH3hpP8BecshOQ== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org, mohamed@unpredictable.fr Cc: Zhao Liu , Paolo Bonzini , Akihiko Odaki , Cameron Esfahani , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Shannon Zhao , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Phil Dennis-Jordan , "Michael S. Tsirkin" , Richard Henderson , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Alexander Graf , Pedro Barbuda , Yanan Wang , Ani Sinha , Igor Mammedov , Marcel Apfelbaum , Peter Maydell , Eduardo Habkost , Roman Bolshakov , Pierrick Bouvier Subject: [PATCH v21 03/22] qtest: hw/arm: virt: skip ACPI test for IORT with GICv2 Date: Thu, 5 Feb 2026 15:25:21 +0100 Message-ID: <20260205142543.64818-4-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260205142543.64818-1-mohamed@unpredictable.fr> References: <20260205142543.64818-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjA1MDEwOCBTYWx0ZWRfXxHPp7X0I8oTP +xbwXNRm2jmFPemcUn3Hubj/AI6jGGxJDoMOfLjia3hiUTDtdZ5dpvXQfa3e199M0puLes8Rzms BxCGOSIuQeks18Vw6CSD8RcZVei113Y+y9EDcOsCJMjljuoiuyODXg2EhM0nyGDJpEikAygKMS9 +j/VTJbfj3E9x8lGUwb4Ete4IrcZBOl0Wrg7QEhQZlE2y54CW/2oCKNrg26ymyB/tNeK/mqr3I9 ka+SBXMHX+GbGlLVkZRsplKQDr+4Q5M0umH9gNnWgJdlYNl2A3kgeT9Mx0IU+b8a+ain9UzSxzj Qtn47hE1L/7EtnmyRr1y+9KC9FUtmphw23tAoy+sBv8ULnddYNByjCDVhDyFd4= X-Authority-Info-Out: v=2.4 cv=V/1wEOni c=1 sm=1 tr=0 ts=6984a87a cx=c_apl:c_apl_out:c_pps a=bsP7O+dXZ5uKcj+dsLqiMw==:117 a=bsP7O+dXZ5uKcj+dsLqiMw==:17 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=3bhNkNL8zgIfWImNCT0A:9 X-Proofpoint-ORIG-GUID: bb1rVl0rrycccUCMz4oFVg0LfBdGDMzT X-Proofpoint-GUID: bb1rVl0rrycccUCMz4oFVg0LfBdGDMzT X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-05_03,2026-02-05_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxlogscore=999 suspectscore=0 malwarescore=0 mlxscore=0 phishscore=0 lowpriorityscore=0 spamscore=0 bulkscore=0 clxscore=1030 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602050108 X-JNJ: AAAAAAABcQbziiXBNRenHHc53stuyxZFv1onlJRYZB53NDIrDlJsyWQQ3Xkw+RnYSMMAPNYWwoqpKszkI7Q4Gk7Nvjb9s+Qnk98kM7L8n4hMMDJFN3No9Wsa6K6UNuPxiGVG7W9Cf9APctRqV2FrkLmGD6r5bFBe6QaRMoGRbK+nxaBX8iCIQBtTF6JvpJxHJUSgpeJpf3Dk++1EEOAe5Xi5gRREQlJeqX4NWWsewP7rahwWnFEnY09zt/iMBlTguLXgosZYaYNatgh7V1K6Dieah1Z9dPpTpVHjjlhiWexdHz/J09ON1icdbGILwX3Ucs6KyEJ+Dv79TVBE3XFlP/ZMxwljFjA4aR1Z9szv4/WtQu+Okr3uCC/bTnAlOQJkp+mdgclQfh4AzaVQ8UkzNO0G7FhlMOZA7u+33vwyXWi3+9lwS1yx0LWtf0PAAPWbG4FMqN+LslqBf+P0PbOMF9dbPpw/aWNuesCPerL2bBcyS2HVO6JfL19log5zIQH20KemdVYWDoPdw+cfsix9Ue3jb4sxGbWxI3noN97qFhaoM/jBICGWDGYtD5UHz45ai3JP3VEp6nOIS29YHBn/NuBeujrqG3kCFvOsMZ7xskkTIP36PYD3rcE6guvCqHeToS7O3g4eJl69b6ocaM7CAGlvyEIe/W1oarhluC2Md07oU69WfUN7lolfg9V5OAUKdNwh231KZmw9nGgSmWQ01VrlZbkFCbve4Qz3EMKG9JoyMeFbLSVirLx6XO2LAU0dlWW67r4b9+IzYAFYBmS6ytml5yfwZOCDtZwLsLSZjyERtb7f3n+xhr3SbDar2MZHArFJF0cNNbtUUImXwdXTCRVUtpIGpuIiXMh/8OxvwPo+v9wc/ZxwYYyETS5eT1hBGhU3R3E7GcYLFJyeuVwr3tjxZYXnnxu7lWbYuRinTDvtKrRWS4yU4D1pJqjnE6Uv2oDXt42G3WqFNu4GLdRh0ENgR5adCFz g4A== 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=lists.gnu.org; Received-SPF: pass client-ip=57.103.87.197; envelope-from=mohamed@unpredictable.fr; helo=outbound.qs.icloud.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @unpredictable.fr) X-ZM-MESSAGEID: 1770301910166158500 Content-Type: text/plain; charset="utf-8" Signed-off-by: Mohamed Mediouni --- tests/qtest/bios-tables-test-allowed-diff.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios= -tables-test-allowed-diff.h index dfb8523c8b..7acaf464dd 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1 +1,4 @@ /* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/aarch64/virt/IORT", +"tests/data/acpi/aarch64/virt/IORT.smmuv3-dev", +"tests/data/acpi/aarch64/virt/IORT.smmuv3-legacy", --=20 2.50.1 (Apple Git-155) From nobody Sat Feb 7 07:31:33 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=unpredictable.fr ARC-Seal: i=1; a=rsa-sha256; t=1770301889; cv=none; d=zohomail.com; s=zohoarc; b=CfGFNfj3VVPhotFt5Lc54yP5YynQ14DeFua+a8zLUQir6pul4RlE7Zl+oZqZueNC+rbSfh92zibB2rX1hcJ7qWNHW17ji4rVy722+xhFuV4ySUUkJDEvBwjuhoBhVOFSzs5t1bktzMcnhbjlCctNQLm4W98uBXoe0k5d6DJVNmQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770301889; 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=XyBHHRZUjZrB24DOEIVWdZ5GavQ/FkCfYqY7wYjlLmk=; b=dHk4bnGLR0xOw3U7ngS+X4kW+aeL8ZtvdiRiq0GK+rb+1h67vQurP0q1LWCBUiVQnNB7mavW6+dxNfx6mfqsKEDfZk4iKQgZ0vQLx+IZK4FKM12sHAAA34crOGqIeLMOekHpPzatsU6rh0w6UE2vB+aB4rML4URZ33oTl2TFLL0= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770301889792584.6081229240938; Thu, 5 Feb 2026 06:31:29 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vo0J8-0000ot-2G; Thu, 05 Feb 2026 09:26:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0J6-0000oC-IX for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:08 -0500 Received: from qs-2002g-snip4-1.eps.apple.com ([57.103.87.192] helo=outbound.qs.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0J4-0007r8-GK for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:08 -0500 Received: from outbound.qs.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPS id E514A1800276; Thu, 5 Feb 2026 14:26:01 +0000 (UTC) Received: from localhost.localdomain (unknown [17.57.155.37]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPSA id 1A4AB1800D9C; Thu, 5 Feb 2026 14:25:57 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1770301565; x=1772893565; bh=XyBHHRZUjZrB24DOEIVWdZ5GavQ/FkCfYqY7wYjlLmk=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=bTapqeXfuNAh+kjBH0z6uUznvZv5gm+tInA76AgsKJiMKXG1QFMRNb6D/LK7Sp2hU3veW6S/CuAAsY2djx3qipM94e1Nr+YyLyrk57HFElpUzaVua+ppKdKGFJCKTXV1ZwLBp1+Xq6YE7tIGjaPvftVT6ZeWwySzfOLZAgJRrdXrbpYP9F7RRakwfYaAxkOEMA2tXfbJTMxmYRkdeezfPvWCt6HOM3Xj/2e0ErNpVd2944Jm2va85t9O/Knx+0pPEtXQpNo4eOayz4tnAyDFBeZqDmqY+2exvnXzx/48Alf9VRdxA8dYHd5iy4wzryUUy+oZLIxZ4jHVdYGRqaU6tw== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org, mohamed@unpredictable.fr Cc: Zhao Liu , Paolo Bonzini , Akihiko Odaki , Cameron Esfahani , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Shannon Zhao , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Phil Dennis-Jordan , "Michael S. Tsirkin" , Richard Henderson , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Alexander Graf , Pedro Barbuda , Yanan Wang , Ani Sinha , Igor Mammedov , Marcel Apfelbaum , Peter Maydell , Eduardo Habkost , Roman Bolshakov , Pierrick Bouvier Subject: [PATCH v21 04/22] hw: arm: virt: rework MSI-X configuration Date: Thu, 5 Feb 2026 15:25:22 +0100 Message-ID: <20260205142543.64818-5-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260205142543.64818-1-mohamed@unpredictable.fr> References: <20260205142543.64818-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: BjXVaoaUtxxZKSOSrqns56H76W7idzpq X-Authority-Info-Out: v=2.4 cv=MZthep/f c=1 sm=1 tr=0 ts=6984a87c cx=c_apl:c_apl_out:c_pps a=bsP7O+dXZ5uKcj+dsLqiMw==:117 a=bsP7O+dXZ5uKcj+dsLqiMw==:17 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=XHbtxiRcFRs46boockMA:9 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjA1MDEwOCBTYWx0ZWRfX6iZqVaRZmVW5 4PTLGm+NEOWpp+g8mEW5Qo+DlH7dkMKmWg5lYzs0kSQptts6uqkp4vWYYRs+nLghHcaNaG8/aAZ pyQTRiOkeFSXK2OuUvRn2fmuEEGo1fDszeNIPerKJml2o+r0hRFdVv4vrdNJicBoyBs7EAByZRF ILYeiN7VrrZUi9fpgE+MzKwlttHCQcOT/yZQBGzcnnQhPYEWoBIRQvDcG505yxOuYCOsl/PkHQq 82EIAa4lj47ub1LQN55NYoAmFLZBLtjRq8uwRmociP+YG/u4unvaFHtHsg9wwp9CzFtpZCm0gCN CHDDm5x4Jw2c9drDtRmW0WdQfOBY+xG+6pejmKuBBBxpVoyI6fO9f9x/ddY7NM= X-Proofpoint-GUID: BjXVaoaUtxxZKSOSrqns56H76W7idzpq X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-05_03,2026-02-05_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxscore=0 suspectscore=0 mlxlogscore=999 clxscore=1030 bulkscore=0 lowpriorityscore=0 spamscore=0 malwarescore=0 phishscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602050108 X-JNJ: AAAAAAABS9ZhbR8uFuYsWCb634Foi+dQz6LkCrqz9kuiGm3agl9hvqgXe9aNYyHIJoqPtdBZwWvtSNSiHWlQGZUQJAsyTTV9ZjCClkZ6wWQjR9nugpHPOcrQUYsf9NsPP8SJ+U5Z6+rnWvrxHy63MCGk6YFUf72Q13sYB3QFtoK5Mwmpm9gP9cm4m+SbNlajTmcc+lzv62U0ZOOK4f8Orhp/vNleJPJP/AVMmvfVteV6hsuLxaxlOeAzRMrPl49DuLEuj1GHRTPWS+QNOTDOQP6MYu3D5vVM0w1FHnA3cTiPEEyrJbwmnxGJOIIiQZJiZnaT1Vi5hvp2W72UuekRtxlFbPAMxIBfjkdLvCmdVtt0NkgBLGGrKQRBH65jTMd2P/dtOKuCzE8NAhTWeVyboJa35m/B5FafL59ioIxTLbX+5JM3d3OI6WStoRxqChaLsOiOU9rkwKXAM2wQ8EfRRb0d+EDAKC9av1j8VJgOX8FHE5dRvfGI4d6qWw4aZcYAbVFDqKB9VWUpt9QRhPloSMfAxwauw27rUgbZ0+Yz+wiyYl4yygrgJEJ1bIESczcR2YRUEimNhJdTKxBxrZl1EkiEK4cpGEYZRLRRAQkNfmQf7aCi+CgZ7nU+XHOGfmCpRAEMOOYCRwfuZ6NANdfbs9bUqmJQ+7iAuFdqC1cm40zNjNObNqUgpqgLRB3AOBAscQOUmriyIbLfURCOY08HRExpIXJqi1hSu+EgibbPVBExLUIU69o8tz5Ea7p7raqAURFmWMSrWdDGe6n6dn++Be+77rTS4mONPToGht0gXODqubShqrsedBZGqjeHtZTZCp/AOl0v8XvdDES6cxYDGcWM/WEf426lp1RrCzRs5FNlHz0O52LGsF0OJ8QCnK7d+8QbQELVazxTYWx51AIOv2eV4Vd0VfRdPzghJEWPMjCJ5ZVS3kEeKBFad+i7 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=lists.gnu.org; Received-SPF: pass client-ip=57.103.87.192; envelope-from=mohamed@unpredictable.fr; helo=outbound.qs.icloud.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @unpredictable.fr) X-ZM-MESSAGEID: 1770301891997158500 Content-Type: text/plain; charset="utf-8" Introduce a -M msi=3D argument to be able to control MSI-X support independ= ently from ITS, as part of supporting GICv3 + GICv2m platforms. Remove vms->its as it's no longer needed after that change. Signed-off-by: Mohamed Mediouni Reviewed-by: Peter Maydell --- hw/arm/virt-acpi-build.c | 20 ++++--- hw/arm/virt.c | 119 ++++++++++++++++++++++++++++++++++++--- include/hw/arm/virt.h | 5 +- 3 files changed, 128 insertions(+), 16 deletions(-) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index c145678185..544004615d 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -569,7 +569,7 @@ build_iort(GArray *table_data, BIOSLinker *linker, Virt= MachineState *vms) nb_nodes =3D num_smmus + 1; /* RC and SMMUv3 */ rc_mapping_count =3D rc_smmu_idmaps_len; =20 - if (vms->its) { + if (vms->msi_controller =3D=3D VIRT_MSI_CTRL_ITS) { /* * Knowing the ID ranges from the RC to the SMMU, it's possibl= e to * determine the ID ranges from RC that go directly to ITS. @@ -590,7 +590,7 @@ build_iort(GArray *table_data, BIOSLinker *linker, Virt= MachineState *vms) } } } else { - if (vms->its) { + if (vms->msi_controller =3D=3D VIRT_MSI_CTRL_ITS) { nb_nodes =3D 2; /* RC and ITS */ rc_mapping_count =3D 1; /* Direct map to ITS */ } else { @@ -605,7 +605,7 @@ build_iort(GArray *table_data, BIOSLinker *linker, Virt= MachineState *vms) build_append_int_noprefix(table_data, IORT_NODE_OFFSET, 4); build_append_int_noprefix(table_data, 0, 4); /* Reserved */ =20 - if (vms->its) { + if (vms->msi_controller =3D=3D VIRT_MSI_CTRL_ITS) { /* Table 12 ITS Group Format */ build_append_int_noprefix(table_data, 0 /* ITS Group */, 1); /* Ty= pe */ node_size =3D 20 /* fixed header size */ + 4 /* 1 GIC ITS Identif= ier */; @@ -624,7 +624,7 @@ build_iort(GArray *table_data, BIOSLinker *linker, Virt= MachineState *vms) int smmu_mapping_count, offset_to_id_array; int irq =3D sdev->irq; =20 - if (vms->its) { + if (vms->msi_controller =3D=3D VIRT_MSI_CTRL_ITS) { smmu_mapping_count =3D 1; /* ITS Group node */ offset_to_id_array =3D SMMU_V3_ENTRY_SIZE; /* Just after the h= eader */ } else { @@ -717,7 +717,7 @@ build_iort(GArray *table_data, BIOSLinker *linker, Virt= MachineState *vms) } } =20 - if (vms->its) { + if (vms->msi_controller =3D=3D VIRT_MSI_CTRL_ITS) { /* * Map bypassed (don't go through the SMMU) RIDs (input) to * ITS Group node directly: RC -> ITS. @@ -735,7 +735,9 @@ build_iort(GArray *table_data, BIOSLinker *linker, Virt= MachineState *vms) * SMMU: RC -> ITS. * Output IORT node is the ITS Group node (the first node). */ - build_iort_id_mapping(table_data, 0, 0x10000, IORT_NODE_OFFSET, 0); + if (vms->msi_controller =3D=3D VIRT_MSI_CTRL_ITS) { + build_iort_id_mapping(table_data, 0, 0x10000, IORT_NODE_OFFSET= , 0); + } } =20 build_iort_rmr_nodes(table_data, smmuv3_devs, &id); @@ -1053,7 +1055,7 @@ build_madt(GArray *table_data, BIOSLinker *linker, Vi= rtMachineState *vms) memmap[VIRT_HIGH_GIC_REDIST2].si= ze); } =20 - if (vms->its) { + if (vms->msi_controller =3D=3D VIRT_MSI_CTRL_ITS) { /* * ACPI spec, Revision 6.0 Errata A * (original 6.0 definition has invalid Length) @@ -1067,7 +1069,9 @@ build_madt(GArray *table_data, BIOSLinker *linker, Vi= rtMachineState *vms) build_append_int_noprefix(table_data, memmap[VIRT_GIC_ITS].bas= e, 8); build_append_int_noprefix(table_data, 0, 4); /* Reserved */ } - } else { + } + + if (vms->msi_controller =3D=3D VIRT_MSI_CTRL_GICV2M) { const uint16_t spi_base =3D vms->irqmap[VIRT_GIC_V2M] + ARM_SPI_BA= SE; =20 /* 5.2.12.16 GIC MSI Frame Structure */ diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 390845c503..aa5e992712 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -737,7 +737,6 @@ static void create_its(VirtMachineState *vms) { DeviceState *dev; =20 - assert(vms->its); if (!kvm_irqchip_in_kernel() && !vms->tcg_its) { /* * Do nothing if ITS is neither supported by the host nor emulated= by @@ -957,9 +956,9 @@ static void create_gic(VirtMachineState *vms, MemoryReg= ion *mem) =20 fdt_add_gic_node(vms); =20 - if (vms->gic_version !=3D VIRT_GIC_VERSION_2 && vms->its) { + if (vms->msi_controller =3D=3D VIRT_MSI_CTRL_ITS) { create_its(vms); - } else if (vms->gic_version =3D=3D VIRT_GIC_VERSION_2) { + } else if (vms->msi_controller =3D=3D VIRT_MSI_CTRL_GICV2M) { create_v2m(vms); } } @@ -2137,6 +2136,44 @@ static void finalize_gic_version(VirtMachineState *v= ms) gics_supported, max_cpus); } =20 +static void finalize_msi_controller(VirtMachineState *vms) +{ + /* + * VIRT_MSI_LEGACY_OPT_ITS_OFF is an option to replicate + * behavior of its=3Doff when running with a GICv2, where a + * GICv2m is still present. Otherwise, it behaves the same + * as msi=3Doff. + */ + if (vms->msi_controller =3D=3D VIRT_MSI_LEGACY_OPT_ITS_OFF) { + if (vms->gic_version =3D=3D 2) { + vms->msi_controller =3D VIRT_MSI_CTRL_GICV2M; + } else { + vms->msi_controller =3D VIRT_MSI_CTRL_NONE; + } + } + if (vms->msi_controller =3D=3D VIRT_MSI_CTRL_AUTO) { + if (vms->gic_version =3D=3D VIRT_GIC_VERSION_2) { + vms->msi_controller =3D VIRT_MSI_CTRL_GICV2M; + } else { + vms->msi_controller =3D VIRT_MSI_CTRL_ITS; + } + } + + if (vms->msi_controller =3D=3D VIRT_MSI_CTRL_ITS) { + if (vms->gic_version =3D=3D VIRT_GIC_VERSION_2) { + /* + * The legacy its=3D option in earlier releases allowed specif= ying + * this configuration and treated it as GICv3 + GICv2m. + * Diagnose it as an error even for that case. + */ + error_report("GICv2 + ITS is an invalid configuration."); + exit(1); + } + } + + assert(vms->msi_controller !=3D VIRT_MSI_CTRL_AUTO); +} + /* * virt_post_cpus_gic_realized() must be called after the CPUs and * the GIC have both been realized. @@ -2256,6 +2293,7 @@ static void machvirt_init(MachineState *machine) * KVM is not available yet */ finalize_gic_version(vms); + finalize_msi_controller(vms); =20 if (vms->secure) { /* @@ -2705,18 +2743,76 @@ static void virt_set_highmem_mmio_size(Object *obj,= Visitor *v, extended_memmap[VIRT_HIGH_PCIE_MMIO].size =3D size; } =20 +static char *virt_get_msi(Object *obj, Error **errp) +{ + VirtMachineState *vms =3D VIRT_MACHINE(obj); + const char *val; + + switch (vms->msi_controller) { + case VIRT_MSI_CTRL_NONE: + case VIRT_MSI_LEGACY_OPT_ITS_OFF: + val =3D "off"; + break; + case VIRT_MSI_CTRL_ITS: + val =3D "its"; + break; + case VIRT_MSI_CTRL_GICV2M: + val =3D "gicv2m"; + break; + case VIRT_MSI_CTRL_AUTO: + val =3D "auto"; + break; + default: + g_assert_not_reached(); + } + return g_strdup(val); +} + +static void virt_set_msi(Object *obj, const char *value, Error **errp) +{ + ERRP_GUARD(); + VirtMachineState *vms =3D VIRT_MACHINE(obj); + + if (!strcmp(value, "auto")) { + vms->msi_controller =3D VIRT_MSI_CTRL_AUTO; /* Will be overriden l= ater */ + } else if (!strcmp(value, "its")) { + vms->msi_controller =3D VIRT_MSI_CTRL_ITS; + } else if (!strcmp(value, "gicv2m")) { + vms->msi_controller =3D VIRT_MSI_CTRL_GICV2M; + } else if (!strcmp(value, "off")) { + vms->msi_controller =3D VIRT_MSI_CTRL_NONE; + } else { + error_setg(errp, "Invalid msi value"); + error_append_hint(errp, "Valid values are auto, gicv2m, its, off\n= "); + } +} + static bool virt_get_its(Object *obj, Error **errp) { VirtMachineState *vms =3D VIRT_MACHINE(obj); =20 - return vms->its; + switch (vms->msi_controller) { + case VIRT_MSI_CTRL_AUTO: + case VIRT_MSI_CTRL_ITS: + return true; + case VIRT_MSI_CTRL_NONE: + case VIRT_MSI_CTRL_GICV2M: + case VIRT_MSI_LEGACY_OPT_ITS_OFF: + return false; + default: + g_assert_not_reached(); + } } =20 static void virt_set_its(Object *obj, bool value, Error **errp) { VirtMachineState *vms =3D VIRT_MACHINE(obj); =20 - vms->its =3D value; + if (value) { + vms->msi_controller =3D VIRT_MSI_CTRL_ITS; + } else { + vms->msi_controller =3D VIRT_MSI_LEGACY_OPT_ITS_OFF; + } } =20 static bool virt_get_dtb_randomness(Object *obj, Error **errp) @@ -3043,6 +3139,9 @@ static void virt_machine_device_pre_plug_cb(HotplugHa= ndler *hotplug_dev, db_start =3D base_memmap[VIRT_GIC_V2M].base; db_end =3D db_start + base_memmap[VIRT_GIC_V2M].size - 1; break; + case VIRT_MSI_CTRL_AUTO: + case VIRT_MSI_LEGACY_OPT_ITS_OFF: + g_assert_not_reached(); } resv_prop_str =3D g_strdup_printf("0x%"PRIx64":0x%"PRIx64":%u", db_start, db_end, @@ -3463,6 +3562,12 @@ static void virt_machine_class_init(ObjectClass *oc,= const void *data) "Set on/off to enable/disable " "ITS instantiation"); =20 + object_class_property_add_str(oc, "msi", virt_get_msi, + virt_set_msi); + object_class_property_set_description(oc, "msi", + "Set MSI settings. " + "Valid values are auto, gicv2m, = its and off"); + object_class_property_add_bool(oc, "dtb-randomness", virt_get_dtb_randomness, virt_set_dtb_randomness); @@ -3518,8 +3623,8 @@ static void virt_instance_init(Object *obj) vms->highmem_mmio =3D true; vms->highmem_redists =3D true; =20 - /* Default allows ITS instantiation */ - vms->its =3D true; + /* Default allows ITS instantiation if available */ + vms->msi_controller =3D VIRT_MSI_CTRL_AUTO; /* Allow ITS emulation if the machine version supports it */ vms->tcg_its =3D !vmc->no_tcg_its; =20 diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h index 3b382bdf49..8069422769 100644 --- a/include/hw/arm/virt.h +++ b/include/hw/arm/virt.h @@ -101,6 +101,10 @@ typedef enum VirtIOMMUType { =20 typedef enum VirtMSIControllerType { VIRT_MSI_CTRL_NONE, + /* This value is overriden at runtime.*/ + VIRT_MSI_CTRL_AUTO, + /* Legacy option: its=3Doff provides a GICv2m when using GICv2 */ + VIRT_MSI_LEGACY_OPT_ITS_OFF, VIRT_MSI_CTRL_GICV2M, VIRT_MSI_CTRL_ITS, } VirtMSIControllerType; @@ -146,7 +150,6 @@ struct VirtMachineState { bool highmem_ecam; bool highmem_mmio; bool highmem_redists; - bool its; bool tcg_its; bool virt; bool ras; --=20 2.50.1 (Apple Git-155) From nobody Sat Feb 7 07:31:33 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=unpredictable.fr ARC-Seal: i=1; a=rsa-sha256; t=1770301614; cv=none; d=zohomail.com; s=zohoarc; b=AFnl+Da+UXnCZmRuuzGi6upiZ3Zc8JjNrMp5NNrbQ29RMm72nGDbCxtftre/o5xzi1PWYkBhbkp/81IDTjh3PzUlnh22N2KOK8EZ+YWg5mnZmpdv5pmTxsDKuTMam1iajBYO56LmaZ3QVXQmeWHKl/3PXBzYX9bCrKS9AcWOMho= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770301614; 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=FjtQ8XSoceu/POn4mLePgEXcXNSnO3IPji7VW8Vfg1M=; b=Edr73dZcd3N0+cnhid+uAr1TrS0NKsCnAtvmphLwr75hgka3k+XLaPOzD1+ev1gIb3MoQuPFcwRVw1RziheXgiNYcn+JHXY0oB84Ai0AO5+HaykjQBgLij6kA1a7hRJUsqr3cqItdM3cA4gS3DjYgJaePkFZ4TZJh5GDPBHzGCg= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770301614052154.2831524278722; Thu, 5 Feb 2026 06:26:54 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vo0JF-0000wJ-Vq; Thu, 05 Feb 2026 09:26:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0JC-0000vC-Ci for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:14 -0500 Received: from qs-2003c-snip4-4.eps.apple.com ([57.103.86.27] helo=outbound.qs.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0J8-0007uL-W9 for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:13 -0500 Received: from outbound.qs.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPS id 45674180010A; Thu, 5 Feb 2026 14:26:05 +0000 (UTC) Received: from localhost.localdomain (unknown [17.57.155.37]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPSA id F0DA4180027C; Thu, 5 Feb 2026 14:25:59 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1770301570; x=1772893570; bh=FjtQ8XSoceu/POn4mLePgEXcXNSnO3IPji7VW8Vfg1M=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=SdqB3FjG5b40BlQQFyl5YYy0TCbpWm9iu1b55GMC1eSroeEMJcuRDQnfvN0Bgz9UuSWbxYv5aSOYl88cQWl/5Huw5K59+mK+uWQRY1D3Lf0BdlyrVzm1VfdR5mJL6Vhceo7wy3ZGQH3MFoaKY9O48K8KthHVrCCsXIsdED7Be8QutNh8TrwofDFqq7kBX+d8mMI18K1YTKCw968ph3W1PQIhYAkRTScla1ljv5S0csrwti0O8wTApPKpwEB+tAdXuFVJVsFqFPkvFE31PjAVGABWSn/plj9cWHFZfLGvl2a+IUkPiA/iq3up9JIu6gcSF6euEsn1Dq+q+v0uNXR7Tw== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org, mohamed@unpredictable.fr Cc: Zhao Liu , Paolo Bonzini , Akihiko Odaki , Cameron Esfahani , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Shannon Zhao , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Phil Dennis-Jordan , "Michael S. Tsirkin" , Richard Henderson , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Alexander Graf , Pedro Barbuda , Yanan Wang , Ani Sinha , Igor Mammedov , Marcel Apfelbaum , Peter Maydell , Eduardo Habkost , Roman Bolshakov , Pierrick Bouvier Subject: [PATCH v21 05/22] tests: data: update AArch64 ACPI tables Date: Thu, 5 Feb 2026 15:25:23 +0100 Message-ID: <20260205142543.64818-6-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260205142543.64818-1-mohamed@unpredictable.fr> References: <20260205142543.64818-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Authority-Info-Out: v=2.4 cv=QLNlhwLL c=1 sm=1 tr=0 ts=6984a880 cx=c_apl:c_apl_out:c_pps a=bsP7O+dXZ5uKcj+dsLqiMw==:117 a=bsP7O+dXZ5uKcj+dsLqiMw==:17 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=kIK1FOY676eA-lZfg3QA:9 a=cvk_HSt5zwsbDY-e:21 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjA1MDEwOCBTYWx0ZWRfX/M9+l1tbfS5W G/Fh7Mf8sgjYCz2uayhf4lbjJWFs0bApy7ouE5QYaUnNp3Wl9Dyrz+4PgD5BTrjo4WLRwwVZgpH yUzhHHVpRkTUMcmqgSK0cBkFMcZKtViP0rbTI+w3rcwM3qLwFh5maUgy7Ywufpk7623aLn/XoGo r5Bi71I9Frj21Jne+twcRdpGiY+HX+eDYGt3XrIASCCbKOfi7TjRwgCv6+TFXY70YRHM6o3iQp8 b8a3rYMWcUDAFFk/zDjr7weqLuRJsJFJ72XVtkHHsmwSl1yFvV5cfL351s/zHSq/bXhOPz54Cbu yTeqVwhDbX6oVl2E9mvgtgEAZbkmR8sQTEbVOcp12c9V4AXiscGQBzlADgObXI= X-Proofpoint-GUID: f0TROGaGKPOlfYtPr3GHgLL2Pw7TC3Ne X-Proofpoint-ORIG-GUID: f0TROGaGKPOlfYtPr3GHgLL2Pw7TC3Ne X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-05_03,2026-02-05_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 phishscore=0 adultscore=0 mlxscore=0 spamscore=0 bulkscore=0 clxscore=1030 malwarescore=0 lowpriorityscore=0 suspectscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602050108 X-JNJ: AAAAAAABppGMm0s31tsO9pxvKH28YHSru4yu3DiYsjZxRgEufYfkUsqbwEgXTC0Gw5YWsNuwGlcVnVgFMFBDD4RZwWKLfw4RIxpHqZWzO8z9bYuz12taGqJb+hPxA1SDTlac0q5O8zxVZFNeXtz6/xNCDfOpYcjb+V9ZStwJUmIx0jr1FkU4umLzEhZJWnppsXZq/Vn2eKZWYyPOlgEER1//yT/0q80SMCr9oRimXkaZvOfEmlpKfB5jZPjkKOEY18uNZi8Xeam6xVUjJRlJzDAzrE3e+hL6UQckizW0r6TKa0DSCBYXGVX17tUyhtudb7nPSVkXEE2RhbScHaHWKKDfshd/RKfhLsGHafHpmmmi7EB/2L6RA9iZHwiljKAk6MFFjpo/eSFLS7XheN45bD9KDH86bIEvNBA1HQ1Wu86WtyIYf5fSaqgjEbqxii1NAR8jEhHy3RLlFMT3m8wZTf9jCOxiOTMqv0Ne92ni2tCW8rYsd1a+m5NN9omrQb3a8Qtl30bG0jVByW7Xn78zpYbIETarnDZLQ82pxbDNhY+vKjeuTy6+TjbIYWeTsvqls9/73+UlcVtN8arLrPra14vGrFxkfx5o7oJnxrco3a6oovZK5XmIhfCz+VsLPphQEZLl07YOaKZuaw5HMZQbfNrWznq6H4JMySOJTyHHZMZvXwJVdduH0N1iCy7eCOhQNu1uhn4Q/qwPb5j7ziaAvJJgFpE24uIR/e6aVoW58a+pzwKgNMDVMU6gZ8oe5lbNy5kDxU4U2SuIO5nJkGmPKV34/L50VhzfdgtAClpdgfcp2xCQe1/jBWyH4b7ivmQqN+MfmHILRauRe30VAAb1lodKDGQgzIQwEfp2JpNN6W8+p/K+qyD50MkRv5lS5WwJLNPZw9EBSXd9fPJ9BVYSo4yltdQGjLlmwYfNLu4uolg6ZfAj4UZXpMzRF8q2BdTKn3n6aa3IgLUe4A== 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=lists.gnu.org; Received-SPF: pass client-ip=57.103.86.27; envelope-from=mohamed@unpredictable.fr; helo=outbound.qs.icloud.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @unpredictable.fr) X-ZM-MESSAGEID: 1770301620767158500 Content-Type: text/plain; charset="utf-8" After the previous commit introducing GICv3 + GICv2m configurations, update the AArch64 ACPI tables for the GICv2 case. Changes to the ACPI tables: tests/data/acpi/aarch64/virt/IORT.dsl: @@ -11,68 +11,49 @@ */ [000h 0000 004h] Signature : "IORT" [IO Remapping Tab= le] -[004h 0004 004h] Table Length : 00000080 +[004h 0004 004h] Table Length : 00000054 [008h 0008 001h] Revision : 05 -[009h 0009 001h] Checksum : B1 +[009h 0009 001h] Checksum : 3C [00Ah 0010 006h] Oem ID : "BOCHS " [010h 0016 008h] Oem Table ID : "BXPC " [018h 0024 004h] Oem Revision : 00000001 [01Ch 0028 004h] Asl Compiler ID : "BXPC" [020h 0032 004h] Asl Compiler Revision : 00000001 -[024h 0036 004h] Node Count : 00000002 +[024h 0036 004h] Node Count : 00000001 [028h 0040 004h] Node Offset : 00000030 [02Ch 0044 004h] Reserved : 00000000 -[030h 0048 001h] Type : 00 -[031h 0049 002h] Length : 0018 -[033h 0051 001h] Revision : 01 +[030h 0048 001h] Type : 02 +[031h 0049 002h] Length : 0024 +[033h 0051 001h] Revision : 03 [034h 0052 004h] Identifier : 00000000 [038h 0056 004h] Mapping Count : 00000000 -[03Ch 0060 004h] Mapping Offset : 00000000 +[03Ch 0060 004h] Mapping Offset : 00000024 -[040h 0064 004h] ItsCount : 00000001 -[044h 0068 004h] Identifiers : 00000000 - -[048h 0072 001h] Type : 02 -[049h 0073 002h] Length : 0038 -[04Bh 0075 001h] Revision : 03 -[04Ch 0076 004h] Identifier : 00000001 -[050h 0080 004h] Mapping Count : 00000001 -[054h 0084 004h] Mapping Offset : 00000024 - -[058h 0088 008h] Memory Properties : [IORT Memory Access Propert= ies] -[058h 0088 004h] Cache Coherency : 00000001 -[05Ch 0092 001h] Hints (decoded below) : 00 +[040h 0064 008h] Memory Properties : [IORT Memory Access Propert= ies] +[040h 0064 004h] Cache Coherency : 00000001 +[044h 0068 001h] Hints (decoded below) : 00 Transient : 0 Write Allocate : 0 Read Allocate : 0 Override : 0 -[05Dh 0093 002h] Reserved : 0000 -[05Fh 0095 001h] Memory Flags (decoded below) : 03 +[045h 0069 002h] Reserved : 0000 +[047h 0071 001h] Memory Flags (decoded below) : 03 Coherency : 1 Device Attribute : 1 Ensured Coherency of Accesses : 0 -[060h 0096 004h] ATS Attribute : 00000000 -[064h 0100 004h] PCI Segment Number : 00000000 -[068h 0104 001h] Memory Size Limit : 40 -[069h 0105 002h] PASID Capabilities : 0000 -[06Bh 0107 001h] Reserved : 00 +[048h 0072 004h] ATS Attribute : 00000000 +[04Ch 0076 004h] PCI Segment Number : 00000000 +[050h 0080 001h] Memory Size Limit : 40 +[051h 0081 002h] PASID Capabilities : 0000 +[053h 0083 001h] Reserved : 00 -[06Ch 0108 004h] Input base : 00000000 -[070h 0112 004h] ID Count : 0000FFFF -[074h 0116 004h] Output Base : 00000000 -[078h 0120 004h] Output Reference : 00000030 -[07Ch 0124 004h] Flags (decoded below) : 00000000 - Single Mapping : 0 +Raw Table Data: Length 84 (0x54) -Raw Table Data: Length 128 (0x80) - - 0000: 49 4F 52 54 80 00 00 00 05 B1 42 4F 43 48 53 20 // IORT......BO= CHS + 0000: 49 4F 52 54 54 00 00 00 05 3C 42 4F 43 48 53 20 // IORTT.... --- tests/data/acpi/aarch64/virt/IORT | Bin 128 -> 84 bytes tests/data/acpi/aarch64/virt/IORT.smmuv3-dev | Bin 364 -> 260 bytes tests/data/acpi/aarch64/virt/IORT.smmuv3-legacy | Bin 276 -> 192 bytes tests/qtest/bios-tables-test-allowed-diff.h | 3 --- 4 files changed, 3 deletions(-) diff --git a/tests/data/acpi/aarch64/virt/IORT b/tests/data/acpi/aarch64/vi= rt/IORT index a234aae4c2d04668d34313836d32ca20e19c0880..389f7a8d7d6fa47a3e2b6116960= 4e580afe0e07b 100644 GIT binary patch delta 42 ocmZo*4B_(h4+;rkU|?XinaCw2$_Qi`05J$KsW32u850Ag0fA}+)Bpeg literal 128 zcmebD4+?2uU|?X~=3D;ZJ05v<@85#X!<1dKp25F11@0kHuPgMkDCNC*yK93~3}W)K^M VRiHGGVg_O`aDdYP|3ers^8jQ#3IPBB diff --git a/tests/data/acpi/aarch64/virt/IORT.smmuv3-dev b/tests/data/acpi= /aarch64/virt/IORT.smmuv3-dev index 43a15fe2bf6cc650ffcbceff86919ea892928c0e..60cfed1361976ef26b280c11ba2= e233f1cfd9383 100644 GIT binary patch delta 107 zcmaFE)WXE&=3D^qrr!pOkD>N$~1N|Kp@fx!TXL4d`Dfd#?>k`qJCc|ig|l@Ks-tvM%? f4+Aq3kjpfgkx^X+rjJ2@f#E+$5s)r{C}scviuDRY literal 364 zcmZ{fJr2S!3`R{GHjrRr?7#sy0%{q`R0Iq?1S1FGpOxcq8mQ3)t zYVYaX4D^|s{hfQ^-WA=3D^4SmP&+-xs-&ISG36s0{Cg_tMzsZpm|Mj~NF{9%j*{g48; Ly=3D4r0!Ej@55yu$; diff --git a/tests/data/acpi/aarch64/virt/IORT.smmuv3-legacy b/tests/data/a= cpi/aarch64/virt/IORT.smmuv3-legacy index 5779d0e225a62b9cd70bebbacb7fd1e519c9e3c4..e2de4049f044bdfe5b3e656b942= 82ddf17832d9f 100644 GIT binary patch delta 74 zcmbQjbbyh|(?2NW00RR9tIR|$DM=3D$0E=3D4*h5!Hn literal 276 zcmX|*F%E-33 (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770301624480402.5233852397281; Thu, 5 Feb 2026 06:27:04 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vo0JI-0000yT-2u; Thu, 05 Feb 2026 09:26:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0JE-0000w0-8k for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:16 -0500 Received: from qs-2003h-snip4-11.eps.apple.com ([57.103.86.83] helo=outbound.qs.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0JA-0007uw-Jt for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:15 -0500 Received: from outbound.qs.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPS id 499DE180014C; Thu, 5 Feb 2026 14:26:08 +0000 (UTC) Received: from localhost.localdomain (unknown [17.57.155.37]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPSA id D2E661800264; Thu, 5 Feb 2026 14:26:02 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1770301571; x=1772893571; bh=9QIxEvbHNo+rywotPm4qpOSZ6bu6/BOqqYkQWv1CMRs=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=TH1mDw8pJekDZPIWOYguMVlXKTDAFHvFCZ8z/lo+ofXLTXkwWKhytj8Z4Jl+6SYBHFblMcxSlgvlGPAKd+0SxTzNkMa7U1qrLMr30yw3Ka6sY+Y+46zAyUL9we11mIVBnsTYz9pV6Dpv9HP4otzZsByNJq190X99fOfq2zqOvwssoWaABoTYPjswdC3OeVPkxjSQ8dlUksaM8b6zGMDXqcMT26vePPJTwx8bQ5wrX0DNnq/cbftO+hmP2spNOCy+8UdqDx3BdjLRWRcP/3+UshrP1rvt/O7ydGNV0YQvH1CdfrnLIWKbXy4FYPK0FsmGrdtbs7JaMY7xa98da/p1RQ== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org, mohamed@unpredictable.fr Cc: Zhao Liu , Paolo Bonzini , Akihiko Odaki , Cameron Esfahani , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Shannon Zhao , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Phil Dennis-Jordan , "Michael S. Tsirkin" , Richard Henderson , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Alexander Graf , Pedro Barbuda , Yanan Wang , Ani Sinha , Igor Mammedov , Marcel Apfelbaum , Peter Maydell , Eduardo Habkost , Roman Bolshakov , Pierrick Bouvier Subject: [PATCH v21 06/22] qtest: hw/arm: virt: add ACPI tables for new GICv3 + GICv2m test case Date: Thu, 5 Feb 2026 15:25:24 +0100 Message-ID: <20260205142543.64818-7-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260205142543.64818-1-mohamed@unpredictable.fr> References: <20260205142543.64818-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: iTCjNI2NvEX200EsIIPuUBxbPiVo2loo X-Authority-Info-Out: v=2.4 cv=dozWylg4 c=1 sm=1 tr=0 ts=6984a882 cx=c_apl:c_apl_out:c_pps a=bsP7O+dXZ5uKcj+dsLqiMw==:117 a=bsP7O+dXZ5uKcj+dsLqiMw==:17 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=t89SEOTD3Leb8Qfr0uYA:9 X-Proofpoint-ORIG-GUID: iTCjNI2NvEX200EsIIPuUBxbPiVo2loo X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjA1MDEwOCBTYWx0ZWRfX6zBWgNbdneAO JCwZ97PiI5yHmvRtdff7WM9tmQ9gEs9cA5hWhBL3mP3FD4pVJbng219KMDN2wTM8TVaYkzMuS9z x4EbH2mHKb8OEhmYa3WCwryfUhRYTZO42ehlbaT789yefKyebCPoaoaPrBKjVzZ0IDX6IPkib79 xobgpoc/KA64qPPMlewPgEB9AZw22o4EGzvhoK6w6vBhO15hroHJUFweaiPawOe6Rah0W7qKehX SCia9h2jJw7KrBYCvvMxcjfhjRsV5FgaOQNYv6hxt35A1FLLPWFRfkbMSm48HkXD2WAd5XtQBw2 kk2+qUImURswObLp/OHruG1muK3IWVSLMSLRhWS/QWlY1B/VUipf0+2CynyWGQ= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-05_03,2026-02-05_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1030 suspectscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 lowpriorityscore=0 adultscore=0 bulkscore=0 mlxscore=0 phishscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602050108 X-JNJ: AAAAAAABoUvExQbMdMgOAkCtqLl7bNLuoL//8qCJhDycHhogOMCEG4d9MIdBkb5zOm5tQ3dATVJX5/zeCzcm1K37M+T7BYJ9Mp2/1CywjbKsQoecOnyICmkWOEMtMpll1rhD+nFOEz1QJhFdJuKmKvTLha21se7d8QjFydt3rjDR2D70ICs/0UEuZ+6UCuPgGIN4hr5nV6sjYS5KZSlbkKz6Ri+4e3qIvMBRdr1J49+r1BiBJw6yscUiNpmI/nDbAA/LUge6AMXCfrvawNQCzl0Rxn7rey2FI4Te2gmY6BXqCUIk3DMs99t9UoXzetsbJKQkRfUQbZVrZCkJIkoofxKPUcob9NNeMVJZYrMSdbRitD9nsVsDy8BE5XQCuBV4PYPeb+I702IGL2AN7OiRpFBT/5xjReFW3RC+aLFukcK2hXJFzC7tFL95K+c31DsfK1vUaSQB9DWddL94+wLpcOA+r1syFO4180mjYVk5wZWuaghkbyp/qeyD2eGZJ+sW1R6Ujm3OAIVKgN/q/FJPok9YVs0gYMC62i2kaqWyFZumcoSTqYL4/bQCVC3wQdxR+GAvQwtOiT8X6/wF4lxLhj59nniHSONOvdEWW1gqg/m+m+0wd3IZ77WBXyXz2XZA56+WUI/E8zGZLcthsjZW2Wqsj4Ct779F/wUD8xtJFgdR56ru17bqgVOnrcEeMRfyUxVCiXnA1re5IYLvpb7M95vF2PPyawCLtGdO7pzSeIM9PrlOn1HREXP4vpm9JiiOFspCHtKKx8LiKlywsqaPJazWMBN1L+Q4uiUqouLJ/ZOlUFwun/1K6e/ZC3f4PRJCPKQ+Y1GPBAXCzn1qCIZCv2ea51ArhcxyZVUrIPoUHYM78XJZctxW/ab+1n5+IWVew1G8hD5fgJ4XdwWwoKNzlCJ0bT6ILAlkTEQTiCmpjlLK3FyWe+BQAYoTuWCyItsK3ruK0QwrZYh1Kn6l4p0cRJ57wPkO 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=lists.gnu.org; Received-SPF: pass client-ip=57.103.86.83; envelope-from=mohamed@unpredictable.fr; helo=outbound.qs.icloud.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @unpredictable.fr) X-ZM-MESSAGEID: 1770301630067154100 Content-Type: text/plain; charset="utf-8" Signed-off-by: Mohamed Mediouni --- tests/data/acpi/aarch64/virt/APIC.msi_gicv2m | Bin 0 -> 188 bytes tests/data/acpi/aarch64/virt/IORT.msi_gicv2m | Bin 0 -> 172 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 tests/data/acpi/aarch64/virt/APIC.msi_gicv2m create mode 100644 tests/data/acpi/aarch64/virt/IORT.msi_gicv2m diff --git a/tests/data/acpi/aarch64/virt/APIC.msi_gicv2m b/tests/data/acpi= /aarch64/virt/APIC.msi_gicv2m new file mode 100644 index 0000000000000000000000000000000000000000..16a01a17c0af605daf64f3cd2de= 3572be9e60cab GIT binary patch literal 188 zcmZ<^@O0k8z`(#_;N}2A literal 0 HcmV?d00001 diff --git a/tests/data/acpi/aarch64/virt/IORT.msi_gicv2m b/tests/data/acpi= /aarch64/virt/IORT.msi_gicv2m new file mode 100644 index 0000000000000000000000000000000000000000..c10da4e61dd00e7eb062558a273= 5d49ca0b20620 GIT binary patch literal 172 zcmebD4+>esz`(#f-O1nCBUr&HBEVSz2pEB4AU23*0%8Lo1_2fq1{MelMzV5(SRi%i nAPXpv4aB)XoP#9EWWm4;QV+r^P#Q=3Dv12GslK (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770301645163113.46907333670015; Thu, 5 Feb 2026 06:27:25 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vo0JL-0000zX-OZ; Thu, 05 Feb 2026 09:26:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0JH-0000xJ-6I for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:19 -0500 Received: from qs-2003c-snip4-3.eps.apple.com ([57.103.86.26] helo=outbound.qs.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0JF-0007wB-Of for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:18 -0500 Received: from outbound.qs.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPS id E56C61800D89; Thu, 5 Feb 2026 14:26:11 +0000 (UTC) Received: from localhost.localdomain (unknown [17.57.155.37]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPSA id B878F1800D93; Thu, 5 Feb 2026 14:26:05 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1770301577; x=1772893577; bh=tbfFbAve7fkxKDMXq+Hqdeacl/+zBPkkhOdplq2Wm74=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=edqphzl3PuooG6CodeDU2uosQie6UZnWj7+3eYnBzPkMtNnBP5Dngq7F7MFp7aG5RpVK0mUQVVW4OiX9ta0giKVdbAh3DqYa1Nweh+HV8hpLMvXpxuaoKDR+4Y6joN6nsWZ8nvy8tQnL8MFj7CzFD3LlhO/OW8yLo37sEV2UTUkk9tyRnVzb0WZ99Cz24NDN1bLVm0FoFbNWw3xdH6mVOWKc/USQDusfZBBHzdwb4ERBwjbxndRRy2sFlRPFcHe5XrCEi64iZt7K/WhdDMkQhkFJ2oPLm3huU5W8nxy1D4BHGvxJXfak+2nCm2sVPHiGj8AkKrUg890qlj4W7UDN5w== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org, mohamed@unpredictable.fr Cc: Zhao Liu , Paolo Bonzini , Akihiko Odaki , Cameron Esfahani , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Shannon Zhao , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Phil Dennis-Jordan , "Michael S. Tsirkin" , Richard Henderson , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Alexander Graf , Pedro Barbuda , Yanan Wang , Ani Sinha , Igor Mammedov , Marcel Apfelbaum , Peter Maydell , Eduardo Habkost , Roman Bolshakov , Pierrick Bouvier Subject: [PATCH v21 07/22] qtest: hw/arm: virt: add new test case for GICv3 + GICv2m Date: Thu, 5 Feb 2026 15:25:25 +0100 Message-ID: <20260205142543.64818-8-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260205142543.64818-1-mohamed@unpredictable.fr> References: <20260205142543.64818-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: F6Je4a14iunhNQ1-T1ccg_Skg5teeUTV X-Proofpoint-ORIG-GUID: F6Je4a14iunhNQ1-T1ccg_Skg5teeUTV X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjA1MDEwOCBTYWx0ZWRfX74FmD+o6D1BS dg/9U+RdIadDUTLfe/4vt8ohPLaymA9FxcrhORsIXzdkYHbVnpWx5Lk4xUMkmsCvyCbJl4vUqfg gOi2c0tGBPR4LsUN5NXCI9zMzbiruFPc9xGRWak1N/ikvJu5CcmcXP6IiqRD+jtRIDSlKJrkLJQ mxUbSUDyNLsTkVVhrdRfkL2ab4xJon3wRGWXi0zbn/E0GtDK1YFxYII3uLKXEZ/UGRvEIEdWELA 5ApgFrBLb8vR3tKJQRqGCBLC4xNJrUv4wgKct9SwyLwGEV0FpLja5PYlmoSIIt7u7evRQbECI8E a/PEhnHW7rxMXmFFkcV76ceua09WvD+cufGnzrVp/Dcntu10N+rSZn95LrDTYI= X-Authority-Info-Out: v=2.4 cv=S8nUAYsP c=1 sm=1 tr=0 ts=6984a887 cx=c_apl:c_apl_out:c_pps a=bsP7O+dXZ5uKcj+dsLqiMw==:117 a=bsP7O+dXZ5uKcj+dsLqiMw==:17 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=WSkgWlIY1_Pf25iQiQAA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-05_03,2026-02-05_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxlogscore=999 lowpriorityscore=0 mlxscore=0 phishscore=0 spamscore=0 suspectscore=0 bulkscore=0 clxscore=1030 malwarescore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602050108 X-JNJ: AAAAAAABNjTNxx4CiGUYYBiC+IlJF5Sil5YV91s3HcPNBz0vUzdSVyYVjYt2KND0fjhk1WANdBQxpgdqTJkr3F6VfPTXZx6GuePP20TCfgiS3srO4XQOhYIJLFkBITaoxMKdPlZtPFkzkh4ezZXLZPjU20YBrIwpsHU1mDw72GpUPerujCNRnwH+TOeX1En/DSdTDgPHlQqydGG9abvPR3QVvd1e+0AX5MOwtHcRxtFNv0oVQ8rh/1oT7p3qDH+Z3rzvdxl0TlNjKGZ1xaeVnkUm+DXSkH3JyDakSkscF7Xc+zqY4vMwDXXo2nWLPWR+b/RwIsrdZK37pl1/vOl75RPKFape0wxIXrxyFFTsRvnHzFssfwiJSWtWUwwqmZxl1uqMkEhixIvZke3+0B9c+Dm7PE100lEKbovtYF+3j0MrAnMirmp44nDDHhbOYpOAvZ7JwPz2BNcWqacDScQfXe1hR0dcFzBZubSa3GDbVeumQB2fxEgmy67SDhggVEoHoGLRQS28YxBmhh+QUCBmNOiNriMxbN/uIjpXq3hVqVsGKBuhjnsBNaMAwxjorQwimrHhLAJrRXTh8vGGZ0vj2W+Cu7dtveey6YwsVtUfiVSaMzRCERz8+CXGIJJsvSC3EjhJ5HT2tsBFCGUWjhBC+nmZIOz2L6nACo5iYEdc07/2+SQgwD4hw1d6R/UsToDMb5+cNf/cKbiMEj9PxEMOKiG1bDezgIEkPdcB6+r8OD15vvKPDMugel2cSWieEtEFW/Rq33mLOu22/J2h8r5RVvxlm4ZWgL+ta/eZ8Muov3cj4koKxJb6W7O7xJ/QVBFCFw38w9a5fUjqCWaIht2csU0DmIJVd1pn64fdYdZEWiqZdJUkTh0bS+NrePlRXpa5DFIf9ZS/DtvV7LTEcHn0y6cdFf5pB1AltI3O8y1Kwj1EJzn6exxIORLzZfZds+VmNJhr+c80r4xy 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=lists.gnu.org; Received-SPF: pass client-ip=57.103.86.26; envelope-from=mohamed@unpredictable.fr; helo=outbound.qs.icloud.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @unpredictable.fr) X-ZM-MESSAGEID: 1770301647388154100 Content-Type: text/plain; charset="utf-8" Signed-off-by: Mohamed Mediouni --- tests/qtest/bios-tables-test.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index e489d94331..a5a5b8807b 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -2252,6 +2252,25 @@ static void test_acpi_aarch64_virt_tcg_its_off(void) free_test_data(&data); } =20 +static void test_acpi_aarch64_virt_tcg_msi_gicv2m(void) +{ + test_data data =3D { + .machine =3D "virt", + .arch =3D "aarch64", + .variant =3D ".msi_gicv2m", + .tcg_only =3D true, + .uefi_fl1 =3D "pc-bios/edk2-aarch64-code.fd", + .uefi_fl2 =3D "pc-bios/edk2-arm-vars.fd", + .cd =3D "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.= qcow2", + .ram_start =3D 0x40000000ULL, + .scan_len =3D 128ULL * 1024 * 1024, + }; + + test_acpi_one("-cpu cortex-a57 " + "-M gic-version=3D3,iommu=3Dsmmuv3,msi=3Dgicv2m", &data); + free_test_data(&data); +} + static void test_acpi_q35_viot(void) { test_data data =3D { @@ -2834,6 +2853,8 @@ int main(int argc, char *argv[]) test_acpi_aarch64_virt_tcg_topology); qtest_add_func("acpi/virt/its_off", test_acpi_aarch64_virt_tcg_its_off); + qtest_add_func("acpi/virt/msi_gicv2m", + test_acpi_aarch64_virt_tcg_msi_gicv2m); qtest_add_func("acpi/virt/numamem", test_acpi_aarch64_virt_tcg_numamem); qtest_add_func("acpi/virt/memhp", test_acpi_aarch64_virt_tcg_m= emhp); --=20 2.50.1 (Apple Git-155) From nobody Sat Feb 7 07:31:33 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=unpredictable.fr ARC-Seal: i=1; a=rsa-sha256; t=1770301614; cv=none; d=zohomail.com; s=zohoarc; b=N6EEll8ax0QUTL1Rwp5nTzbQkG0AzAHCQmdAFz06KLCQiU0X9yik/7m0F5ysorfKI8iF25y+hHxilq/kMONp+7TQpreEu27hbb/co6MpQqk6iDujYXPpPwtCd2s+DjdLUuEdxwfySnmTcUpR8ZXU2DBAyxIu6LIqOl5vdn7kklE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770301614; 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=uYfGepuvX25YdvzNM/DFH7a6wkIX8tO0xW4cMIOnmXY=; b=e4i2CmPVfTtx8zgsZ3hBR2ixFKcMZMhT5yn99mVFmiRkQNpGy6osRvIyiWzUapU759uj5/gyTFbriRpkLdsUw+BIFxFCKPzXNyZwCfk/iQt/PmavZ6Xx77Vs7sRcD4KQLHjGSdfUGGjGMJgshHLnwTNreGNIVkZh+Vkq4lDzmi8= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770301614078871.4945427516492; Thu, 5 Feb 2026 06:26:54 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vo0JO-00010R-Tc; Thu, 05 Feb 2026 09:26:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0JL-0000zF-6u for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:23 -0500 Received: from qs-2003a-snip4-5.eps.apple.com ([57.103.86.8] helo=outbound.qs.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0JJ-0007x0-N9 for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:22 -0500 Received: from outbound.qs.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPS id 016981800DAB; Thu, 5 Feb 2026 14:26:15 +0000 (UTC) Received: from localhost.localdomain (unknown [17.57.155.37]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPSA id 974B61800DA8; Thu, 5 Feb 2026 14:26:08 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1770301581; x=1772893581; bh=uYfGepuvX25YdvzNM/DFH7a6wkIX8tO0xW4cMIOnmXY=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=Rn2xkguwXxGqPLq+ysV9G8KPyg24mPo6SKWlnxxGf5f9VFygOeNZUA76/WVBjV9gQrIT82g4nQiXvBJBceS4SnVCmuSKh6sk4fohtfPkCoQDLbzTeYMifp3Te4dV1HgIIYv3DQ/Gk8wwcg6JYJJtyf7OniSGKmTY0qhn+ExfDhYl6J3HRifAs8TZRtqGCRAWs90nH4tjHF4b9rY+AnrnqMEIaS2SjwGpcgBsr0YTCXi600AkVYuRQplGICbFAO+lQpDndkfNo7E1J1sj+dgNyf4/0eIlWGQvnZfRNULowZqkiiMNd08eyrQ8ws1lUJvSw1xzjFuG6TFizK0AHxL3lg== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org, mohamed@unpredictable.fr Cc: Zhao Liu , Paolo Bonzini , Akihiko Odaki , Cameron Esfahani , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Shannon Zhao , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Phil Dennis-Jordan , "Michael S. Tsirkin" , Richard Henderson , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Alexander Graf , Pedro Barbuda , Yanan Wang , Ani Sinha , Igor Mammedov , Marcel Apfelbaum , Peter Maydell , Eduardo Habkost , Roman Bolshakov , Pierrick Bouvier Subject: [PATCH v21 08/22] docs: arm: update virt machine model description Date: Thu, 5 Feb 2026 15:25:26 +0100 Message-ID: <20260205142543.64818-9-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260205142543.64818-1-mohamed@unpredictable.fr> References: <20260205142543.64818-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: 9K5bBl9T5O6QfMFsqJEZLrDfWX-hFr-G X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjA1MDEwOCBTYWx0ZWRfX48C/rVM8Wbng 3nmOvALitNsdIQNaPYwZwNmSzuPjqfwOG4yqDaAIbxllsLvWHRO0+orocXepX6TwEGxYAuxV+J4 8ihurj3jWzFYw8DKzKoK+/alk+hNdZ5HkYWUK/B0eNyKq0b5985D9bX0jVVL8ChSIa7nAhfbGaW 4L8t7vlwqsKDtOlgPl6PVjE2f2lpa4uLo+K2Y5nAzfpebT0udt+Pzvj3tPDrYhpythvd+a/pn02 xFcBBLnwlrwxelnDR8LyzisA+R/SRsmg4wXWBiJlEv/Kb9+XnbBriukIH1h7XIGhTmcB0+uO3jy CCAhmhWzNHjI68s72crrXZsJd8HR3BQ66LUWSuC9Qf8TkITHu2BFEDfoROKRj0= X-Proofpoint-ORIG-GUID: 9K5bBl9T5O6QfMFsqJEZLrDfWX-hFr-G X-Authority-Info-Out: v=2.4 cv=bv5BxUai c=1 sm=1 tr=0 ts=6984a88b cx=c_apl:c_apl_out:c_pps a=bsP7O+dXZ5uKcj+dsLqiMw==:117 a=bsP7O+dXZ5uKcj+dsLqiMw==:17 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=yTMYbjrfWCcMMitk-bsA:9 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-05_03,2026-02-05_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1030 spamscore=0 adultscore=0 malwarescore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 phishscore=0 bulkscore=0 lowpriorityscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602050108 X-JNJ: AAAAAAABifD3pZpvTdrjU/esJfBzYy2k/jpR97YjJtoMR05TxIo5KFLlpPlb11hWBIwlBLCmXok1hKYAQ4GEcOq/6SddT4RgaHBrTinNftw3ZAPHpqPwat+qJq8ug1Snpr7ZaMEBy/Z74Nmhil/Jy3KDTtsXGZtgTUgCXryZhYT9uaAOYu21W0zcUbtWavAm/Iyl6QJ7M3JZmWxjllAmZ9/zf304SkYu9GranwSlpvT1KfygKOD9uCCLkhidlaqAtnBGSD5BXbFaOLPoQCBoII5DWsZ+Knqh4y0RJM6QoUz1e0C6r0408G0+tsJn4dZ7p4GKOxfa60cBOZ71qiebq6bdb8wJ6PQU6UwFcKKgnpfKpSHTOu96+gQULeUB+V4VWaPyb5NT0NJIuqzYrFsuicrEkz73ZF6B5xSW6tN4+I7sa9S2gxYJF9/4lW5tWZeomnah5I9dynw8n+G81w/LEENhy9KHH9hltFig9D37beP9kVKfMd7glu5DbXJBmmzA/eNtyCVzvozt28uTmtpDpI+kMGZTwsLNMLDQzX1slVoZnjMUqb6lJB+2nlHALOf5Yfam0BLIt/mnAdBqjk/Xyw6B8ovS7cHsHJ0MtBWpvhv0FYyxPysWkApGb2vz4pGJYj+slN6RDM12nHuby4M2PrJfBXWD1YdFKO/YU5hdSzc9AvFpGUPMMBVJyBY1zNU9jHl3bjxScu9pAHbePKLDyY8VFGpF868qYPtJQYTlkGdR6zoqnoa9Su8A38/cu4LWwViJFtRRgpxqwxWUm0pw9Xe+7m/HhRHjPFUOwwQRzDuRI/AbHVZ+UrbAZomS6jWjj1I77UunQh+B4FhRtMQq2rs5rq7XQ91gqPsmlV/nssUBiiSmsjFSAX0IIdqw4nxa7nIe0Qmq4ykdKwbSa3QeH4CskRNx3UrpWwKGJtp1ungx2YeboREWAJbmMf3i2AdXBty8LpTgN6Y= 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=lists.gnu.org; Received-SPF: pass client-ip=57.103.86.8; envelope-from=mohamed@unpredictable.fr; helo=outbound.qs.icloud.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @unpredictable.fr) X-ZM-MESSAGEID: 1770301620700158500 Content-Type: text/plain; charset="utf-8" Update the documentation to match current QEMU. Remove the mention of pre-2.7 machine models as those aren't provided anymore. Signed-off-by: Mohamed Mediouni Reviewed-by: Peter Maydell --- docs/system/arm/virt.rst | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/docs/system/arm/virt.rst b/docs/system/arm/virt.rst index e5570773ba..f8148b5dcf 100644 --- a/docs/system/arm/virt.rst +++ b/docs/system/arm/virt.rst @@ -41,9 +41,10 @@ The virt board supports: - User-creatable SMMUv3 devices (see below for example) - hotpluggable DIMMs - hotpluggable NVDIMMs -- An MSI controller (GICv2M or ITS). GICv2M is selected by default along - with GICv2. ITS is selected by default with GICv3 (>=3D virt-2.7). Note - that ITS is not modeled in TCG mode. +- An MSI controller (GICv2m or ITS). + - When using GICv3, ITS is selected by default when available on the pla= tform. + - If using GICv2, a GICv2m is provided by default instead. + - When ITS is not available on a GICv3 platform, a GICv2m is provided by= default. - 32 virtio-mmio transport devices - running guests using the KVM accelerator on aarch64 hardware - large amounts of RAM (at least 255GB, and more if using highmem) @@ -167,9 +168,22 @@ gic-version with TCG this is currently ``3`` if ``virtualization`` is ``off`` and ``4`` if ``virtualization`` is ``on``, but this may change in future) =20 +msi + Specify the MSI and MSI-X controller (GIC) to provide. + Valid values are: + + ``auto`` + Use the best available MSI-X controller option. ITS when supported, GI= Cv2m otherwise. + ``gicv2m`` + GICv2m. Typically used with a GICv2. Also available with a newer GIC. + ``its`` + GICv3 ITS. This is the default option when using a GICv3 or GICv4 with= a supported + accelerator. + ``off`` + Disable support for MSI/MSI-X interrupts. + its - Set ``on``/``off`` to enable/disable ITS instantiation. The default is `= `on`` - for machine types later than ``virt-2.7``. + Set ``on``/``off`` to control ITS instantiation. This is a deprecated op= tion, use ``msi`` instead. =20 iommu Set the IOMMU type to create for the guest. Valid values are: --=20 2.50.1 (Apple Git-155) From nobody Sat Feb 7 07:31:33 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=unpredictable.fr ARC-Seal: i=1; a=rsa-sha256; t=1770301864; cv=none; d=zohomail.com; s=zohoarc; b=Y5Ht1UiuZ4kJ2AlXUkwbiljqvvBRMEeJgrqYzYuZB0JbxMuR4Bf/3nGLNDocZGBuRICRzxtp9Q14nA8O2hKqR5llXdLI8+3FM0UL9XW2ppyq1H/KxxjxVPb4/tXwvRGO8bm6yg8DlucJ5TruGDiYHUtNDlNbuQW4PoI5GomsXk4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770301864; h=Content-Type: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=C1DYbSEFYo2ZgjBenQ83qKhjOaZ2uyIVgfAe3esAA4k=; b=cZ9BI/hrhOWMwA/XfJieQRqEQ0F6IN8QHvdlU4iYkST6oFAVg6zNd3D/pfVLppul2NiH8gaEP4ScQDnHM+FErLFVywAJWjOXcIIPyRdqn1rRdp6BeTiKoNLv5xR5IEBifVgxGNqxAW/wVau1MMvCGSNuZi19DnOLeS/ms2tBxGQ= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770301863565637.4751425930046; Thu, 5 Feb 2026 06:31:03 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vo0JR-00011N-9H; Thu, 05 Feb 2026 09:26:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0JO-00010N-Rx for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:26 -0500 Received: from qs-2003e-snip4-11.eps.apple.com ([57.103.86.53] helo=outbound.qs.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0JM-0007xX-Uh for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:26 -0500 Received: from outbound.qs.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPS id 37A9D1800D99; Thu, 5 Feb 2026 14:26:17 +0000 (UTC) Received: from localhost.localdomain (unknown [17.57.155.37]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPSA id 775F2180027A; Thu, 5 Feb 2026 14:26:11 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1770301583; x=1772893583; bh=C1DYbSEFYo2ZgjBenQ83qKhjOaZ2uyIVgfAe3esAA4k=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:x-icloud-hme; b=CLx3BuuSLQDUoNn5rdemxYO1XzMGT/HIpfEnNnjkSUQiKOvnGP67SuvlmHZN2cRG++ZuTv/Yn0hYYCxu7bWGDf+TJVeKAM/xNfmuzGKQP7C+dr04i6XmxoLFvCAbYbLHWoIZK7cv/YY2BCkVmVB6qMcTsnIRggy9MDVN3Ht8yRJQvFUMNDnn3CJ3MhJlMMhUxYAfp0dG2/jgn1KxaKUDlIY665MnnB2Fl5T0Z2KrKfvNVoopxoB6wvArzH/SnYWw1CDcFYJxU9XKwu0aH8b2RwmKhNXRn+8yXemm9tm+YQA70rK50El1PwzjU53YlJfCk9nQw+2Z6fUgTuRDNF8S5A== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org, mohamed@unpredictable.fr Cc: Zhao Liu , Paolo Bonzini , Akihiko Odaki , Cameron Esfahani , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Shannon Zhao , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Phil Dennis-Jordan , "Michael S. Tsirkin" , Richard Henderson , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Alexander Graf , Pedro Barbuda , Yanan Wang , Ani Sinha , Igor Mammedov , Marcel Apfelbaum , Peter Maydell , Eduardo Habkost , Roman Bolshakov , Pierrick Bouvier Subject: [PATCH v21 09/22] whpx: Move around files before introducing AArch64 support Date: Thu, 5 Feb 2026 15:25:27 +0100 Message-ID: <20260205142543.64818-10-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260205142543.64818-1-mohamed@unpredictable.fr> References: <20260205142543.64818-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjA1MDEwOCBTYWx0ZWRfX+2pFtDEqcdsq /ajutdF+KodxDb01/yRK9X1UOjlkEgGq042Vrba/4+o0Ka0z5dVnwE0CvPtm8r3Dzn8tbtWW61L cqbWxiR5QLC+H3mxdbtCrwVDFjr0LOfKyCOaPKmUCVGACKjqZfR11rgbfPJ9u6lHuT3w6OM0g9l 5iPGWYY12RIPSceBjv6mKmnUSG1vu/wvZAjwF/RmE2nyXAWQjE1IkNVY02w5v/V81v72SstmzqC LwBzfqeYvPzGhCXXnMBK0LhnKIP7aOszFYxe7rKwU1uXHqJV85VRSLCzqNazMhWobW3tfo6XXQY lXEaV/OuDdvoBKibE7T6Od3y8ZjvmPU5wKrPGavZ8PfPtLd638T/JC9ox89kIQ= X-Authority-Info-Out: v=2.4 cv=G7MR0tk5 c=1 sm=1 tr=0 ts=6984a88e cx=c_apl:c_apl_out:c_pps a=bsP7O+dXZ5uKcj+dsLqiMw==:117 a=bsP7O+dXZ5uKcj+dsLqiMw==:17 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=yMhMjlubAAAA:8 a=5-iGLm-LtT_B5TT3xKgA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-GUID: w_qlr_yM9IWLv9Nyrj7TZTiw__qhomQ1 X-Proofpoint-ORIG-GUID: w_qlr_yM9IWLv9Nyrj7TZTiw__qhomQ1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-05_03,2026-02-05_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 suspectscore=0 lowpriorityscore=0 mlxlogscore=999 mlxscore=0 spamscore=0 clxscore=1030 bulkscore=0 phishscore=0 adultscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602050108 X-JNJ: AAAAAAABlSPzBGmD01DJa+s1gvjZLIvDP7x+wTkKQq3RJRZJ5PR1ZS7leDTS9Wlgj5m6ujlimZpWL6SIK0Tj/wNylv6hwqo3njcjCZlsNTXUygxBRWWcYsxZuZHrMmeP9bqQcUpw1wIXlFdujEf98xp32zICNEv4B5JY5AEF+9/wA70+vqWQJLUZJx8o4EWXplydCJTv6CosX9W/mC47vhaF+5pR+mHfPXxpwm17e9RM/YIZO6ZI7Oy8XPN/5wXgLE5AjNi8uZL9uPQYExUfKwHlULUX8g2fvmEjqONlSLD14379aqQX6/ra5+5YfMo8WOMLOV952yKRjWtzDJykWSC0RTrqbqXbMDz2ESpd5QhDJaigpgim642rIdOYmd/qiMZEs38WOgnbjR3+ixRwAupqB4rXNwKclyGSq/03iQLE6t0LT9j8iEk7dWQMNLwWxyEsUG9YboLSJbsdgmED2cDEJ6V140IzPcwevqHSJQ9y5HoxpGRhdlp9PvRpUswnPUMLDEW5PQSot2ecWpjdOEihWAiE6/FqeZLoBpmbDrUlOvDznjX27r6DLryefRzraz/JznvuMAM0Bitq9vDXIStYiuQ9CpuhLs8A4sQKRN75jHYqxlMnaBxTS0YwqysRz0/n7mn9gq7v04/SbDKSIBEFv/8MDdiyr+sxESJ58apKnkwfD0dUgRIjPnFn0D5vkqGBZwyM+EjsWgVEH57zXTnNqp8OiaDfnaOWXQYKeWc75930jn0iE7Y6tI23gXa9me9Y3UlJKxrpvYIy6ukq5T+CcZNiT2Rfd/eUaCrO4Z5r8lWn+m13zR7Y/Wp2NxloJwXk/UhsNWqwbCQV0DF5u75W8KiFEZMbarq4CdYHWRsSDbu/colbYFh6cvHy0VwjQK2swDkygPok+NXNJe8H7hEpcKWL8lUqhnTO5jQ0loCe/BD4Jj2OcyrSNuN6P0heUEK0fcpo2BjjwSAvqtA= 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=lists.gnu.org; Received-SPF: pass client-ip=57.103.86.53; envelope-from=mohamed@unpredictable.fr; helo=outbound.qs.icloud.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @unpredictable.fr) X-ZM-MESSAGEID: 1770301865756158500 Switch to a design where we can share whpx code between x86 and AArch64 whe= n it makes sense to do so. Signed-off-by: Mohamed Mediouni Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Reviewed-by: Pierrick Bouvier Reviewed-by: Akihiko Odaki --- MAINTAINERS | 2 ++ accel/meson.build | 1 + accel/whpx/meson.build | 6 ++++++ {target/i386 =3D> accel}/whpx/whpx-accel-ops.c | 4 ++-- {target/i386/whpx =3D> include/system}/whpx-accel-ops.h | 4 ++-- {target/i386/whpx =3D> include/system}/whpx-internal.h | 6 ++++-- target/i386/whpx/meson.build | 1 - target/i386/whpx/whpx-all.c | 4 ++-- target/i386/whpx/whpx-apic.c | 2 +- 9 files changed, 20 insertions(+), 10 deletions(-) create mode 100644 accel/whpx/meson.build rename {target/i386 =3D> accel}/whpx/whpx-accel-ops.c (97%) rename {target/i386/whpx =3D> include/system}/whpx-accel-ops.h (92%) rename {target/i386/whpx =3D> include/system}/whpx-internal.h (97%) diff --git a/MAINTAINERS b/MAINTAINERS index 4c35249a18..69a7a3567d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -564,9 +564,11 @@ WHPX CPUs M: Pedro Barbuda M: Mohamed Mediouni S: Supported +F: accel/whpx/ F: target/i386/whpx/ F: accel/stubs/whpx-stub.c F: include/system/whpx.h +F: include/system/whpx-accel-ops.h =20 MSHV M: Magnus Kulke diff --git a/accel/meson.build b/accel/meson.build index 983dfd0bd5..289b7420ff 100644 --- a/accel/meson.build +++ b/accel/meson.build @@ -6,6 +6,7 @@ user_ss.add(files('accel-user.c')) subdir('tcg') if have_system subdir('hvf') + subdir('whpx') subdir('qtest') subdir('kvm') subdir('xen') diff --git a/accel/whpx/meson.build b/accel/whpx/meson.build new file mode 100644 index 0000000000..7b3d6f1c1c --- /dev/null +++ b/accel/whpx/meson.build @@ -0,0 +1,6 @@ +whpx_ss =3D ss.source_set() +whpx_ss.add(files( + 'whpx-accel-ops.c', +)) + +specific_ss.add_all(when: 'CONFIG_WHPX', if_true: whpx_ss) diff --git a/target/i386/whpx/whpx-accel-ops.c b/accel/whpx/whpx-accel-ops.c similarity index 97% rename from target/i386/whpx/whpx-accel-ops.c rename to accel/whpx/whpx-accel-ops.c index f75886128d..c84a25c273 100644 --- a/target/i386/whpx/whpx-accel-ops.c +++ b/accel/whpx/whpx-accel-ops.c @@ -16,8 +16,8 @@ #include "qemu/guest-random.h" =20 #include "system/whpx.h" -#include "whpx-internal.h" -#include "whpx-accel-ops.h" +#include "system/whpx-internal.h" +#include "system/whpx-accel-ops.h" =20 static void *whpx_cpu_thread_fn(void *arg) { diff --git a/target/i386/whpx/whpx-accel-ops.h b/include/system/whpx-accel-= ops.h similarity index 92% rename from target/i386/whpx/whpx-accel-ops.h rename to include/system/whpx-accel-ops.h index 54cfc25a14..ed9d4c49f4 100644 --- a/target/i386/whpx/whpx-accel-ops.h +++ b/include/system/whpx-accel-ops.h @@ -7,8 +7,8 @@ * See the COPYING file in the top-level directory. */ =20 -#ifndef TARGET_I386_WHPX_ACCEL_OPS_H -#define TARGET_I386_WHPX_ACCEL_OPS_H +#ifndef SYSTEM_WHPX_ACCEL_OPS_H +#define SYSTEM_WHPX_ACCEL_OPS_H =20 #include "system/cpus.h" =20 diff --git a/target/i386/whpx/whpx-internal.h b/include/system/whpx-interna= l.h similarity index 97% rename from target/i386/whpx/whpx-internal.h rename to include/system/whpx-internal.h index 2dcad1f565..041fa958b4 100644 --- a/target/i386/whpx/whpx-internal.h +++ b/include/system/whpx-internal.h @@ -1,11 +1,13 @@ -#ifndef TARGET_I386_WHPX_INTERNAL_H -#define TARGET_I386_WHPX_INTERNAL_H +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#ifndef SYSTEM_WHPX_INTERNAL_H +#define SYSTEM_WHPX_INTERNAL_H =20 #include #include #include =20 #include "hw/i386/apic.h" +#include "exec/vaddr.h" =20 typedef enum WhpxBreakpointState { WHPX_BP_CLEARED =3D 0, diff --git a/target/i386/whpx/meson.build b/target/i386/whpx/meson.build index 9c54aaad39..c3aaaff9fd 100644 --- a/target/i386/whpx/meson.build +++ b/target/i386/whpx/meson.build @@ -1,5 +1,4 @@ i386_system_ss.add(when: 'CONFIG_WHPX', if_true: files( 'whpx-all.c', 'whpx-apic.c', - 'whpx-accel-ops.c', )) diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index db184e1b0d..cef31fc1a8 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -31,8 +31,8 @@ #include "accel/accel-cpu-target.h" #include =20 -#include "whpx-internal.h" -#include "whpx-accel-ops.h" +#include "system/whpx-internal.h" +#include "system/whpx-accel-ops.h" =20 #include #include diff --git a/target/i386/whpx/whpx-apic.c b/target/i386/whpx/whpx-apic.c index afcb25843b..b934fdcbe1 100644 --- a/target/i386/whpx/whpx-apic.c +++ b/target/i386/whpx/whpx-apic.c @@ -18,7 +18,7 @@ #include "hw/pci/msi.h" #include "system/hw_accel.h" #include "system/whpx.h" -#include "whpx-internal.h" +#include "system/whpx-internal.h" =20 struct whpx_lapic_state { struct { --=20 2.50.1 (Apple Git-155) From nobody Sat Feb 7 07:31:33 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=unpredictable.fr ARC-Seal: i=1; a=rsa-sha256; t=1770301744; cv=none; d=zohomail.com; s=zohoarc; b=lF52p5ncpiaRBiCMpMKO0VAvUrGyi4gCn2wh+KGBchwEql0EQxzOneGkT4j3xprewFGZS18RuvQxVI25gKMnclC491brk68RfVtou3ruj34LNRH9zKIIhOVHkAK2T3NFpIxjKdSYEdAFLA8YJQLw1Cfw5sh7wacWtVN/znBXcEo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770301744; 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=EU+Dz0UAClN7y9rnUxP3bZhO204vTYPR69Tq0F8zkvQ=; b=AIaJxcwd5oxPVlgoL3uEZoiUSC3u8O+LsiOX9/dZ78acLuI4A/MjXVPsVtF0JQ5fqp0lwCFCohhaSXuucffX+us2rWiI8LAgiM0gnQ9/7U4AxjQqIr6Fx+TR0bUbcpTh2faDH5f2LvZJgc5Ra4fmU179POdCSGNHC772Y59/qSg= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770301744239250.1350016628437; Thu, 5 Feb 2026 06:29:04 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vo0Jd-000142-1u; Thu, 05 Feb 2026 09:26:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0Ja-000132-9g for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:38 -0500 Received: from qs-2003c-snip4-2.eps.apple.com ([57.103.86.25] helo=outbound.qs.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0JQ-0007yG-PB for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:32 -0500 Received: from outbound.qs.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPS id 6363F1800128; Thu, 5 Feb 2026 14:26:22 +0000 (UTC) Received: from localhost.localdomain (unknown [17.57.155.37]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPSA id 5A486180014F; Thu, 5 Feb 2026 14:26:14 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1770301588; x=1772893588; bh=EU+Dz0UAClN7y9rnUxP3bZhO204vTYPR69Tq0F8zkvQ=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=abQbaaFPDEhMIq94BMneopx0UFgDBzo42O+dKAIpVsjl7lE4+mdK9Ilb4ERy9bcDDXymaHxoHQGbShfLv+MjlCudUdLLHFbjGUawzromcE+3US9CCZ60+7UhXSQlGRf1nqkUoBCq+bucD+aV7zCNhqKNjx4cISG9KNNmYgoFJMoeT8tR2aN9poNTKlp17bfw6QcFMsmPDi5daSUX76cN9OGD4mGx1yqVJgCqyIMb5zNIAem1NJq7fr0OznJk8ArM14E6QrlyPye4usSzB4rrFiRIj4spNC70fmHYysXqx6Wh/KFNfiqH2R1q3MZdMVAkHoFNXnXw5vZ1QGLUtVlpEw== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org, mohamed@unpredictable.fr Cc: Zhao Liu , Paolo Bonzini , Akihiko Odaki , Cameron Esfahani , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Shannon Zhao , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Phil Dennis-Jordan , "Michael S. Tsirkin" , Richard Henderson , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Alexander Graf , Pedro Barbuda , Yanan Wang , Ani Sinha , Igor Mammedov , Marcel Apfelbaum , Peter Maydell , Eduardo Habkost , Roman Bolshakov , Pierrick Bouvier Subject: [PATCH v21 10/22] whpx: reshuffle common code Date: Thu, 5 Feb 2026 15:25:28 +0100 Message-ID: <20260205142543.64818-11-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260205142543.64818-1-mohamed@unpredictable.fr> References: <20260205142543.64818-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjA1MDEwOCBTYWx0ZWRfX4Onatd1bFjuq yBZoCgm+uaBlCPNaFU+pGbBDv5hCuzvCPkZAT31bp5igYQBeBnWUuN93YMAtjuJ7wYJzOQEQIwe JMDXT+F96yNdkN3Kl/Jr8/Y94Jvth145+k61jYWAee6h4hTYot+gezRrbLMvYnCXWVIml3FciiX Mi7x456MbMmjCrBXim1gaSXFU3Ap9O452ZfFtknsIKQ3+ERMuixp2sPi1PEmD9eioWxCZEw1rVB Lr85f6qHQcX4/XLiH8LMJOB79FXbRonQENXDzNq12T7c2CnupKFZt5c4AuA+FdWHYM4/E7ZqTZj fY6m0sAvdss+F25JvPIqCEp7EKCR/jEABon4cLLUaZGIsBoGHyys+I4NPrQzaA= X-Authority-Info-Out: v=2.4 cv=G7MR0tk5 c=1 sm=1 tr=0 ts=6984a892 cx=c_apl:c_apl_out:c_pps a=bsP7O+dXZ5uKcj+dsLqiMw==:117 a=bsP7O+dXZ5uKcj+dsLqiMw==:17 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=yMhMjlubAAAA:8 a=XtnWhMvHLvoGx0dyWtYA:9 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-GUID: OHgkFSEsSiIxe8e1qwW_tiMbhRcsVH8e X-Proofpoint-ORIG-GUID: OHgkFSEsSiIxe8e1qwW_tiMbhRcsVH8e X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-05_03,2026-02-05_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 suspectscore=0 lowpriorityscore=0 mlxlogscore=999 mlxscore=0 spamscore=0 clxscore=1030 bulkscore=0 phishscore=0 adultscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602050108 X-JNJ: AAAAAAAB+UdD0q20jJEbQhHigoNnoJQwWlQer4GjYAPA1OdyTtFtGTDgzsyxNqYenEi3gO2sp5bzvk9Bh4G2NcdyM0GFVE0qiDReSs8O8OrPuEuTjESVNJBtQDLFygHUhYs1NdzWzP7NbgWERdMfPXKuiEE/j564+ud2dRH9L/WXDmMW0ur7PFoDfxYHj2KIXFkSnE8xm97smCBqy2RtRauOSu9C1gKmI66+dRS53TkrsITPC2TyEqGc0NZc2KM8MCAdjHk3h6C855NebevXmgsMSx2TDbLDyiwz/s/bLtC6v5c1QTPXjd+Mu4OjT4rRb4PlTKGH+Rl9RYPorckfmFWVfIPRqyD4gEhjt+RaSdyahg5CJd3xjdNljBTcjKTeKXptkqWUWueeJZwfqvTRhS+IsVY9jzhHU+eHIG9qiAM4kERFC1+V+i/UnsWy+VtRwmZosgsRcHVJhM8Su4xLQQGcpUWFFdugbBvsovVx3BPM5gvHtveplWxpJrnCCQo1Pyxq4u8P3r4/k8cNa/7INfxUhXir2mRXD5J9VAJ1zIv1xDVIEkn21LlSGA44YTDzWwf+Ho71gVgyN79BL7AbH2+1ZBPY8oiz4h5bNLEodrx8r1f6gYN0NczM31IdCEMATd+eLQEphifxjw9IeyXYMj99YUudzOH7s3lrc6+rU/05pqfdtoCZeNXSMmchDRpBwmJBaPQZFyDTJkHS7VsrWJcWzbqzvz2ULL2l1JOJYNlYFif1O2GChkMIa2vuSQ5niNKTgsI1mUd4DoVRw7sfkIBJs6RspQJTHmcEKZWNQrrKosdynhLFURnowS5AWug57z08/wwOlQmbOCTfASt9mIMmkmnoJNJKUWxFpm0d/VyC/E3okuFb1HMADFN+4oifKQbVe55/blg6Au7QdFfJ6fS/159dSO8R 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=lists.gnu.org; Received-SPF: pass client-ip=57.103.86.25; envelope-from=mohamed@unpredictable.fr; helo=outbound.qs.icloud.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @unpredictable.fr) X-ZM-MESSAGEID: 1770301746811154100 Content-Type: text/plain; charset="utf-8" Some code can be shared between x86_64 and arm64 WHPX. Do so as much as rea= sonable. Signed-off-by: Mohamed Mediouni Reviewed-by: Pierrick Bouvier Reviewed-by: Akihiko Odaki --- MAINTAINERS | 2 + accel/whpx/meson.build | 1 + accel/whpx/whpx-common.c | 558 +++++++++++++++++++++++++++++++++++ include/system/whpx-all.h | 20 ++ include/system/whpx-common.h | 21 ++ target/i386/whpx/whpx-all.c | 551 +--------------------------------- 6 files changed, 612 insertions(+), 541 deletions(-) create mode 100644 accel/whpx/whpx-common.c create mode 100644 include/system/whpx-all.h create mode 100644 include/system/whpx-common.h diff --git a/MAINTAINERS b/MAINTAINERS index 69a7a3567d..873d6628cd 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -569,6 +569,8 @@ F: target/i386/whpx/ F: accel/stubs/whpx-stub.c F: include/system/whpx.h F: include/system/whpx-accel-ops.h +F: include/system/whpx-common.h +F: include/system/whpx-internal.h =20 MSHV M: Magnus Kulke diff --git a/accel/whpx/meson.build b/accel/whpx/meson.build index 7b3d6f1c1c..fad28dddcb 100644 --- a/accel/whpx/meson.build +++ b/accel/whpx/meson.build @@ -1,6 +1,7 @@ whpx_ss =3D ss.source_set() whpx_ss.add(files( 'whpx-accel-ops.c', + 'whpx-common.c' )) =20 specific_ss.add_all(when: 'CONFIG_WHPX', if_true: whpx_ss) diff --git a/accel/whpx/whpx-common.c b/accel/whpx/whpx-common.c new file mode 100644 index 0000000000..0a6068fdde --- /dev/null +++ b/accel/whpx/whpx-common.c @@ -0,0 +1,558 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * QEMU Windows Hypervisor Platform accelerator (WHPX) + * + * Copyright Microsoft Corp. 2017 + */ + +#include "qemu/osdep.h" +#include "cpu.h" +#include "system/address-spaces.h" +#include "system/ioport.h" +#include "gdbstub/helpers.h" +#include "qemu/accel.h" +#include "accel/accel-ops.h" +#include "system/whpx.h" +#include "system/cpus.h" +#include "system/runstate.h" +#include "qemu/main-loop.h" +#include "hw/core/boards.h" +#include "hw/intc/ioapic.h" +#include "qemu/error-report.h" +#include "qapi/error.h" +#include "qapi/qapi-types-common.h" +#include "qapi/qapi-visit-common.h" +#include "migration/blocker.h" +#include "accel/accel-cpu-target.h" +#include + +#include "system/whpx-internal.h" +#include "system/whpx-accel-ops.h" +#include "system/whpx-common.h" +#include "system/whpx-all.h" + +#include +#include + +bool whpx_allowed; +static bool whp_dispatch_initialized; +static HMODULE hWinHvPlatform; +static HMODULE hWinHvEmulation; + +struct whpx_state whpx_global; +struct WHPDispatch whp_dispatch; + +/* Tries to find a breakpoint at the specified address. */ +struct whpx_breakpoint *whpx_lookup_breakpoint_by_addr(uint64_t address) +{ + struct whpx_state *whpx =3D &whpx_global; + int i; + + if (whpx->breakpoints.breakpoints) { + for (i =3D 0; i < whpx->breakpoints.breakpoints->used; i++) { + if (address =3D=3D whpx->breakpoints.breakpoints->data[i].addr= ess) { + return &whpx->breakpoints.breakpoints->data[i]; + } + } + } + + return NULL; +} + +/* + * This function is called when the a VCPU is about to start and no other + * VCPUs have been started so far. Since the VCPU start order could be + * arbitrary, it doesn't have to be VCPU#0. + * + * It is used to commit the breakpoints into memory, and configure WHPX + * to intercept debug exceptions. + * + * Note that whpx_set_exception_exit_bitmap() cannot be called if one or + * more VCPUs are already running, so this is the best place to do it. + */ +int whpx_first_vcpu_starting(CPUState *cpu) +{ + struct whpx_state *whpx =3D &whpx_global; + + g_assert(bql_locked()); + + if (!QTAILQ_EMPTY(&cpu->breakpoints) || + (whpx->breakpoints.breakpoints && + whpx->breakpoints.breakpoints->used)) { + CPUBreakpoint *bp; + int i =3D 0; + bool update_pending =3D false; + + QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) { + if (i >=3D whpx->breakpoints.original_address_count || + bp->pc !=3D whpx->breakpoints.original_addresses[i]) { + update_pending =3D true; + } + + i++; + } + + if (i !=3D whpx->breakpoints.original_address_count) { + update_pending =3D true; + } + + if (update_pending) { + /* + * The CPU breakpoints have changed since the last call to + * whpx_translate_cpu_breakpoints(). WHPX breakpoints must + * now be recomputed. + */ + whpx_translate_cpu_breakpoints(&whpx->breakpoints, cpu, i); + } + /* Actually insert the breakpoints into the memory. */ + whpx_apply_breakpoints(whpx->breakpoints.breakpoints, cpu, true); + } + HRESULT hr; + uint64_t exception_mask; + if (whpx->step_pending || + (whpx->breakpoints.breakpoints && + whpx->breakpoints.breakpoints->used)) { + /* + * We are either attempting to single-step one or more CPUs, or + * have one or more breakpoints enabled. Both require intercepting + * the WHvX64ExceptionTypeBreakpointTrap exception. + */ + exception_mask =3D 1UL << WHvX64ExceptionTypeDebugTrapOrFault; + } else { + /* Let the guest handle all exceptions. */ + exception_mask =3D 0; + } + hr =3D whpx_set_exception_exit_bitmap(exception_mask); + if (!SUCCEEDED(hr)) { + error_report("WHPX: Failed to update exception exit mask," + "hr=3D%08lx.", hr); + return 1; + } + return 0; +} + +/* + * This function is called when the last VCPU has finished running. + * It is used to remove any previously set breakpoints from memory. + */ +int whpx_last_vcpu_stopping(CPUState *cpu) +{ + whpx_apply_breakpoints(whpx_global.breakpoints.breakpoints, cpu, false= ); + return 0; +} + +static void do_whpx_cpu_synchronize_state(CPUState *cpu, run_on_cpu_data a= rg) +{ + if (!cpu->vcpu_dirty) { + whpx_get_registers(cpu); + cpu->vcpu_dirty =3D true; + } +} + +static void do_whpx_cpu_synchronize_post_reset(CPUState *cpu, + run_on_cpu_data arg) +{ + whpx_set_registers(cpu, WHPX_SET_RESET_STATE); + cpu->vcpu_dirty =3D false; +} + +static void do_whpx_cpu_synchronize_post_init(CPUState *cpu, + run_on_cpu_data arg) +{ + whpx_set_registers(cpu, WHPX_SET_FULL_STATE); + cpu->vcpu_dirty =3D false; +} + +static void do_whpx_cpu_synchronize_pre_loadvm(CPUState *cpu, + run_on_cpu_data arg) +{ + cpu->vcpu_dirty =3D true; +} + +/* + * CPU support. + */ + +void whpx_cpu_synchronize_state(CPUState *cpu) +{ + if (!cpu->vcpu_dirty) { + run_on_cpu(cpu, do_whpx_cpu_synchronize_state, RUN_ON_CPU_NULL); + } +} + +void whpx_cpu_synchronize_post_reset(CPUState *cpu) +{ + run_on_cpu(cpu, do_whpx_cpu_synchronize_post_reset, RUN_ON_CPU_NULL); +} + +void whpx_cpu_synchronize_post_init(CPUState *cpu) +{ + run_on_cpu(cpu, do_whpx_cpu_synchronize_post_init, RUN_ON_CPU_NULL); +} + +void whpx_cpu_synchronize_pre_loadvm(CPUState *cpu) +{ + run_on_cpu(cpu, do_whpx_cpu_synchronize_pre_loadvm, RUN_ON_CPU_NULL); +} + +static void whpx_pre_resume_vm(AccelState *as, bool step_pending) +{ + whpx_global.step_pending =3D step_pending; +} + +/* + * Vcpu support. + */ + +int whpx_vcpu_exec(CPUState *cpu) +{ + int ret; + int fatal; + + for (;;) { + if (cpu->exception_index >=3D EXCP_INTERRUPT) { + ret =3D cpu->exception_index; + cpu->exception_index =3D -1; + break; + } + + fatal =3D whpx_vcpu_run(cpu); + + if (fatal) { + error_report("WHPX: Failed to exec a virtual processor"); + abort(); + } + } + + return ret; +} + +void whpx_destroy_vcpu(CPUState *cpu) +{ + struct whpx_state *whpx =3D &whpx_global; + + whp_dispatch.WHvDeleteVirtualProcessor(whpx->partition, cpu->cpu_index= ); + AccelCPUState *vcpu =3D cpu->accel; + whp_dispatch.WHvEmulatorDestroyEmulator(vcpu->emulator); + g_free(cpu->accel); +} + + +void whpx_vcpu_kick(CPUState *cpu) +{ + struct whpx_state *whpx =3D &whpx_global; + whp_dispatch.WHvCancelRunVirtualProcessor( + whpx->partition, cpu->cpu_index, 0); +} + +/* + * Memory support. + */ + +static void whpx_update_mapping(hwaddr start_pa, ram_addr_t size, + void *host_va, int add, int rom, + const char *name) +{ + struct whpx_state *whpx =3D &whpx_global; + HRESULT hr; + + /* + if (add) { + printf("WHPX: ADD PA:%p Size:%p, Host:%p, %s, '%s'\n", + (void*)start_pa, (void*)size, host_va, + (rom ? "ROM" : "RAM"), name); + } else { + printf("WHPX: DEL PA:%p Size:%p, Host:%p, '%s'\n", + (void*)start_pa, (void*)size, host_va, name); + } + */ + + if (add) { + hr =3D whp_dispatch.WHvMapGpaRange(whpx->partition, + host_va, + start_pa, + size, + (WHvMapGpaRangeFlagRead | + WHvMapGpaRangeFlagExecute | + (rom ? 0 : WHvMapGpaRangeFlagWri= te))); + } else { + hr =3D whp_dispatch.WHvUnmapGpaRange(whpx->partition, + start_pa, + size); + } + + if (FAILED(hr)) { + error_report("WHPX: Failed to %s GPA range '%s' PA:%p, Size:%p byt= es," + " Host:%p, hr=3D%08lx", + (add ? "MAP" : "UNMAP"), name, + (void *)(uintptr_t)start_pa, (void *)size, host_va, h= r); + } +} + +static void whpx_process_section(MemoryRegionSection *section, int add) +{ + MemoryRegion *mr =3D section->mr; + hwaddr start_pa =3D section->offset_within_address_space; + ram_addr_t size =3D int128_get64(section->size); + unsigned int delta; + uint64_t host_va; + + if (!memory_region_is_ram(mr)) { + return; + } + + delta =3D qemu_real_host_page_size() - (start_pa & ~qemu_real_host_pag= e_mask()); + delta &=3D ~qemu_real_host_page_mask(); + if (delta > size) { + return; + } + start_pa +=3D delta; + size -=3D delta; + size &=3D qemu_real_host_page_mask(); + if (!size || (start_pa & ~qemu_real_host_page_mask())) { + return; + } + + host_va =3D (uintptr_t)memory_region_get_ram_ptr(mr) + + section->offset_within_region + delta; + + whpx_update_mapping(start_pa, size, (void *)(uintptr_t)host_va, add, + memory_region_is_rom(mr), mr->name); +} + +static void whpx_region_add(MemoryListener *listener, + MemoryRegionSection *section) +{ + memory_region_ref(section->mr); + whpx_process_section(section, 1); +} + +static void whpx_region_del(MemoryListener *listener, + MemoryRegionSection *section) +{ + whpx_process_section(section, 0); + memory_region_unref(section->mr); +} + +static void whpx_transaction_begin(MemoryListener *listener) +{ +} + +static void whpx_transaction_commit(MemoryListener *listener) +{ +} + +static void whpx_log_sync(MemoryListener *listener, + MemoryRegionSection *section) +{ + MemoryRegion *mr =3D section->mr; + + if (!memory_region_is_ram(mr)) { + return; + } + + memory_region_set_dirty(mr, 0, int128_get64(section->size)); +} + +static MemoryListener whpx_memory_listener =3D { + .name =3D "whpx", + .begin =3D whpx_transaction_begin, + .commit =3D whpx_transaction_commit, + .region_add =3D whpx_region_add, + .region_del =3D whpx_region_del, + .log_sync =3D whpx_log_sync, + .priority =3D MEMORY_LISTENER_PRIORITY_ACCEL, +}; + +void whpx_memory_init(void) +{ + memory_listener_register(&whpx_memory_listener, &address_space_memory); +} + +/* + * Load the functions from the given library, using the given handle. If a + * handle is provided, it is used, otherwise the library is opened. The + * handle will be updated on return with the opened one. + */ +static bool load_whp_dispatch_fns(HMODULE *handle, + WHPFunctionList function_list) +{ + HMODULE hLib =3D *handle; + + #define WINHV_PLATFORM_DLL "WinHvPlatform.dll" + #define WINHV_EMULATION_DLL "WinHvEmulation.dll" + #define WHP_LOAD_FIELD_OPTIONAL(return_type, function_name, signature)= \ + whp_dispatch.function_name =3D \ + (function_name ## _t)GetProcAddress(hLib, #function_name); \ + + #define WHP_LOAD_FIELD(return_type, function_name, signature) \ + whp_dispatch.function_name =3D \ + (function_name ## _t)GetProcAddress(hLib, #function_name); \ + if (!whp_dispatch.function_name) { \ + error_report("Could not load function %s", #function_name); \ + goto error; \ + } \ + + #define WHP_LOAD_LIB(lib_name, handle_lib) \ + if (!handle_lib) { \ + handle_lib =3D LoadLibrary(lib_name); \ + if (!handle_lib) { \ + error_report("Could not load library %s.", lib_name); \ + goto error; \ + } \ + } \ + + switch (function_list) { + case WINHV_PLATFORM_FNS_DEFAULT: + WHP_LOAD_LIB(WINHV_PLATFORM_DLL, hLib) + LIST_WINHVPLATFORM_FUNCTIONS(WHP_LOAD_FIELD) + break; + case WINHV_EMULATION_FNS_DEFAULT: + WHP_LOAD_LIB(WINHV_EMULATION_DLL, hLib) + LIST_WINHVEMULATION_FUNCTIONS(WHP_LOAD_FIELD) + break; + case WINHV_PLATFORM_FNS_SUPPLEMENTAL: + WHP_LOAD_LIB(WINHV_PLATFORM_DLL, hLib) + LIST_WINHVPLATFORM_FUNCTIONS_SUPPLEMENTAL(WHP_LOAD_FIELD_OPTIONAL) + break; + } + + *handle =3D hLib; + return true; + +error: + if (hLib) { + FreeLibrary(hLib); + } + + return false; +} + +static void whpx_set_kernel_irqchip(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) +{ + struct whpx_state *whpx =3D &whpx_global; + OnOffSplit mode; + + if (!visit_type_OnOffSplit(v, name, &mode, errp)) { + return; + } + + switch (mode) { + case ON_OFF_SPLIT_ON: + whpx->kernel_irqchip_allowed =3D true; + whpx->kernel_irqchip_required =3D true; + break; + + case ON_OFF_SPLIT_OFF: + whpx->kernel_irqchip_allowed =3D false; + whpx->kernel_irqchip_required =3D false; + break; + + case ON_OFF_SPLIT_SPLIT: + error_setg(errp, "WHPX: split irqchip currently not supported"); + error_append_hint(errp, + "Try without kernel-irqchip or with kernel-irqchip=3Don|off"); + break; + + default: + /* + * The value was checked in visit_type_OnOffSplit() above. If + * we get here, then something is wrong in QEMU. + */ + abort(); + } +} + +static void whpx_cpu_accel_class_init(ObjectClass *oc, const void *data) +{ + AccelCPUClass *acc =3D ACCEL_CPU_CLASS(oc); + + acc->cpu_instance_init =3D whpx_cpu_instance_init; +} + +static const TypeInfo whpx_cpu_accel_type =3D { + .name =3D ACCEL_CPU_NAME("whpx"), + + .parent =3D TYPE_ACCEL_CPU, + .class_init =3D whpx_cpu_accel_class_init, + .abstract =3D true, +}; + +/* + * Partition support + */ + +bool whpx_apic_in_platform(void) +{ + return whpx_global.apic_in_platform; +} + +static void whpx_accel_class_init(ObjectClass *oc, const void *data) +{ + AccelClass *ac =3D ACCEL_CLASS(oc); + ac->name =3D "WHPX"; + ac->init_machine =3D whpx_accel_init; + ac->pre_resume_vm =3D whpx_pre_resume_vm; + ac->allowed =3D &whpx_allowed; + + object_class_property_add(oc, "kernel-irqchip", "on|off|split", + NULL, whpx_set_kernel_irqchip, + NULL, NULL); + object_class_property_set_description(oc, "kernel-irqchip", + "Configure WHPX in-kernel irqchip"); +} + +static void whpx_accel_instance_init(Object *obj) +{ + struct whpx_state *whpx =3D &whpx_global; + + memset(whpx, 0, sizeof(struct whpx_state)); + /* Turn on kernel-irqchip, by default */ + whpx->kernel_irqchip_allowed =3D true; +} + +static const TypeInfo whpx_accel_type =3D { + .name =3D ACCEL_CLASS_NAME("whpx"), + .parent =3D TYPE_ACCEL, + .instance_init =3D whpx_accel_instance_init, + .class_init =3D whpx_accel_class_init, +}; + +static void whpx_type_init(void) +{ + type_register_static(&whpx_accel_type); + type_register_static(&whpx_cpu_accel_type); +} + +bool init_whp_dispatch(void) +{ + if (whp_dispatch_initialized) { + return true; + } + + if (!load_whp_dispatch_fns(&hWinHvPlatform, WINHV_PLATFORM_FNS_DEFAULT= )) { + goto error; + } + + if (!load_whp_dispatch_fns(&hWinHvEmulation, WINHV_EMULATION_FNS_DEFAU= LT)) { + goto error; + } + + assert(load_whp_dispatch_fns(&hWinHvPlatform, + WINHV_PLATFORM_FNS_SUPPLEMENTAL)); + whp_dispatch_initialized =3D true; + + return true; +error: + if (hWinHvPlatform) { + FreeLibrary(hWinHvPlatform); + } + if (hWinHvEmulation) { + FreeLibrary(hWinHvEmulation); + } + return false; +} + +type_init(whpx_type_init); diff --git a/include/system/whpx-all.h b/include/system/whpx-all.h new file mode 100644 index 0000000000..f13cdf7f66 --- /dev/null +++ b/include/system/whpx-all.h @@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#ifndef SYSTEM_WHPX_ALL_H +#define SYSTEM_WHPX_ALL_H + +/* Called by whpx-common */ +int whpx_vcpu_run(CPUState *cpu); +void whpx_get_registers(CPUState *cpu); +void whpx_set_registers(CPUState *cpu, int level); +int whpx_accel_init(AccelState *as, MachineState *ms); +void whpx_cpu_instance_init(CPUState *cs); +HRESULT whpx_set_exception_exit_bitmap(UINT64 exceptions); +void whpx_apply_breakpoints( +struct whpx_breakpoint_collection *breakpoints, + CPUState *cpu, + bool resuming); +void whpx_translate_cpu_breakpoints( + struct whpx_breakpoints *breakpoints, + CPUState *cpu, + int cpu_breakpoint_count); +#endif diff --git a/include/system/whpx-common.h b/include/system/whpx-common.h new file mode 100644 index 0000000000..e549c7539c --- /dev/null +++ b/include/system/whpx-common.h @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#ifndef SYSTEM_WHPX_COMMON_H +#define SYSTEM_WHPX_COMMON_H + +struct AccelCPUState { + WHV_EMULATOR_HANDLE emulator; + bool window_registered; + bool interruptable; + bool ready_for_pic_interrupt; + uint64_t tpr; + uint64_t apic_base; + bool interruption_pending; + /* Must be the last field as it may have a tail */ + WHV_RUN_VP_EXIT_CONTEXT exit_ctx; +}; + +int whpx_first_vcpu_starting(CPUState *cpu); +int whpx_last_vcpu_stopping(CPUState *cpu); +void whpx_memory_init(void); +struct whpx_breakpoint *whpx_lookup_breakpoint_by_addr(uint64_t address); +#endif diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index cef31fc1a8..052cda42bf 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -33,6 +33,8 @@ =20 #include "system/whpx-internal.h" #include "system/whpx-accel-ops.h" +#include "system/whpx-all.h" +#include "system/whpx-common.h" =20 #include #include @@ -232,28 +234,9 @@ typedef enum WhpxStepMode { WHPX_STEP_EXCLUSIVE, } WhpxStepMode; =20 -struct AccelCPUState { - WHV_EMULATOR_HANDLE emulator; - bool window_registered; - bool interruptable; - bool ready_for_pic_interrupt; - uint64_t tpr; - uint64_t apic_base; - bool interruption_pending; - - /* Must be the last field as it may have a tail */ - WHV_RUN_VP_EXIT_CONTEXT exit_ctx; -}; - -bool whpx_allowed; -static bool whp_dispatch_initialized; -static HMODULE hWinHvPlatform, hWinHvEmulation; static uint32_t max_vcpu_index; static WHV_PROCESSOR_XSAVE_FEATURES whpx_xsave_cap; =20 -struct whpx_state whpx_global; -struct WHPDispatch whp_dispatch; - static bool whpx_has_xsave(void) { return whpx_xsave_cap.XsaveSupport; @@ -379,7 +362,7 @@ static uint64_t whpx_cr8_to_apic_tpr(uint64_t cr8) return cr8 << 4; } =20 -static void whpx_set_registers(CPUState *cpu, int level) +void whpx_set_registers(CPUState *cpu, int level) { struct whpx_state *whpx =3D &whpx_global; AccelCPUState *vcpu =3D cpu->accel; @@ -594,7 +577,7 @@ static void whpx_get_xcrs(CPUState *cpu) cpu_env(cpu)->xcr0 =3D xcr0.Reg64; } =20 -static void whpx_get_registers(CPUState *cpu) +void whpx_get_registers(CPUState *cpu) { struct whpx_state *whpx =3D &whpx_global; AccelCPUState *vcpu =3D cpu->accel; @@ -934,7 +917,7 @@ static int whpx_handle_portio(CPUState *cpu, * The 'exceptions' argument accepts a bitmask, e.g: * (1 << WHvX64ExceptionTypeDebugTrapOrFault) | (...) */ -static HRESULT whpx_set_exception_exit_bitmap(UINT64 exceptions) +HRESULT whpx_set_exception_exit_bitmap(UINT64 exceptions) { struct whpx_state *whpx =3D &whpx_global; WHV_PARTITION_PROPERTY prop =3D { 0, }; @@ -1084,23 +1067,6 @@ static HRESULT whpx_vcpu_configure_single_stepping(C= PUState *cpu, return S_OK; } =20 -/* Tries to find a breakpoint at the specified address. */ -static struct whpx_breakpoint *whpx_lookup_breakpoint_by_addr(uint64_t add= ress) -{ - struct whpx_state *whpx =3D &whpx_global; - int i; - - if (whpx->breakpoints.breakpoints) { - for (i =3D 0; i < whpx->breakpoints.breakpoints->used; i++) { - if (address =3D=3D whpx->breakpoints.breakpoints->data[i].addr= ess) { - return &whpx->breakpoints.breakpoints->data[i]; - } - } - } - - return NULL; -} - /* * Linux uses int3 (0xCC) during startup (see int3_selftest()) and for * debugging user-mode applications. Since the WHPX API does not offer @@ -1136,7 +1102,7 @@ static const uint8_t whpx_breakpoint_instruction =3D = 0xF1; * memory, but doesn't actually do it. The memory accessing is done in * whpx_apply_breakpoints(). */ -static void whpx_translate_cpu_breakpoints( +void whpx_translate_cpu_breakpoints( struct whpx_breakpoints *breakpoints, CPUState *cpu, int cpu_breakpoint_count) @@ -1230,7 +1196,7 @@ static void whpx_translate_cpu_breakpoints( * Passing resuming=3Dtrue will try to set all previously unset breakpoin= ts. * Passing resuming=3Dfalse will remove all inserted ones. */ -static void whpx_apply_breakpoints( +void whpx_apply_breakpoints( struct whpx_breakpoint_collection *breakpoints, CPUState *cpu, bool resuming) @@ -1306,93 +1272,6 @@ static void whpx_apply_breakpoints( } } =20 -/* - * This function is called when the a VCPU is about to start and no other - * VCPUs have been started so far. Since the VCPU start order could be - * arbitrary, it doesn't have to be VCPU#0. - * - * It is used to commit the breakpoints into memory, and configure WHPX - * to intercept debug exceptions. - * - * Note that whpx_set_exception_exit_bitmap() cannot be called if one or - * more VCPUs are already running, so this is the best place to do it. - */ -static int whpx_first_vcpu_starting(CPUState *cpu) -{ - struct whpx_state *whpx =3D &whpx_global; - HRESULT hr; - - g_assert(bql_locked()); - - if (!QTAILQ_EMPTY(&cpu->breakpoints) || - (whpx->breakpoints.breakpoints && - whpx->breakpoints.breakpoints->used)) { - CPUBreakpoint *bp; - int i =3D 0; - bool update_pending =3D false; - - QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) { - if (i >=3D whpx->breakpoints.original_address_count || - bp->pc !=3D whpx->breakpoints.original_addresses[i]) { - update_pending =3D true; - } - - i++; - } - - if (i !=3D whpx->breakpoints.original_address_count) { - update_pending =3D true; - } - - if (update_pending) { - /* - * The CPU breakpoints have changed since the last call to - * whpx_translate_cpu_breakpoints(). WHPX breakpoints must - * now be recomputed. - */ - whpx_translate_cpu_breakpoints(&whpx->breakpoints, cpu, i); - } - - /* Actually insert the breakpoints into the memory. */ - whpx_apply_breakpoints(whpx->breakpoints.breakpoints, cpu, true); - } - - uint64_t exception_mask; - if (whpx->step_pending || - (whpx->breakpoints.breakpoints && - whpx->breakpoints.breakpoints->used)) { - /* - * We are either attempting to single-step one or more CPUs, or - * have one or more breakpoints enabled. Both require intercepting - * the WHvX64ExceptionTypeBreakpointTrap exception. - */ - - exception_mask =3D 1UL << WHvX64ExceptionTypeDebugTrapOrFault; - } else { - /* Let the guest handle all exceptions. */ - exception_mask =3D 0; - } - - hr =3D whpx_set_exception_exit_bitmap(exception_mask); - if (!SUCCEEDED(hr)) { - error_report("WHPX: Failed to update exception exit mask," - "hr=3D%08lx.", hr); - return 1; - } - - return 0; -} - -/* - * This function is called when the last VCPU has finished running. - * It is used to remove any previously set breakpoints from memory. - */ -static int whpx_last_vcpu_stopping(CPUState *cpu) -{ - whpx_apply_breakpoints(whpx_global.breakpoints.breakpoints, cpu, false= ); - return 0; -} - /* Returns the address of the next instruction that is about to be execute= d. */ static vaddr whpx_vcpu_get_pc(CPUState *cpu, bool exit_context_valid) { @@ -1634,7 +1513,7 @@ static void whpx_vcpu_process_async_events(CPUState *= cpu) } } =20 -static int whpx_vcpu_run(CPUState *cpu) +int whpx_vcpu_run(CPUState *cpu) { HRESULT hr; struct whpx_state *whpx =3D &whpx_global; @@ -2057,65 +1936,6 @@ static int whpx_vcpu_run(CPUState *cpu) return ret < 0; } =20 -static void do_whpx_cpu_synchronize_state(CPUState *cpu, run_on_cpu_data a= rg) -{ - if (!cpu->vcpu_dirty) { - whpx_get_registers(cpu); - cpu->vcpu_dirty =3D true; - } -} - -static void do_whpx_cpu_synchronize_post_reset(CPUState *cpu, - run_on_cpu_data arg) -{ - whpx_set_registers(cpu, WHPX_SET_RESET_STATE); - cpu->vcpu_dirty =3D false; -} - -static void do_whpx_cpu_synchronize_post_init(CPUState *cpu, - run_on_cpu_data arg) -{ - whpx_set_registers(cpu, WHPX_SET_FULL_STATE); - cpu->vcpu_dirty =3D false; -} - -static void do_whpx_cpu_synchronize_pre_loadvm(CPUState *cpu, - run_on_cpu_data arg) -{ - cpu->vcpu_dirty =3D true; -} - -/* - * CPU support. - */ - -void whpx_cpu_synchronize_state(CPUState *cpu) -{ - if (!cpu->vcpu_dirty) { - run_on_cpu(cpu, do_whpx_cpu_synchronize_state, RUN_ON_CPU_NULL); - } -} - -void whpx_cpu_synchronize_post_reset(CPUState *cpu) -{ - run_on_cpu(cpu, do_whpx_cpu_synchronize_post_reset, RUN_ON_CPU_NULL); -} - -void whpx_cpu_synchronize_post_init(CPUState *cpu) -{ - run_on_cpu(cpu, do_whpx_cpu_synchronize_post_init, RUN_ON_CPU_NULL); -} - -void whpx_cpu_synchronize_pre_loadvm(CPUState *cpu) -{ - run_on_cpu(cpu, do_whpx_cpu_synchronize_pre_loadvm, RUN_ON_CPU_NULL); -} - -static void whpx_pre_resume_vm(AccelState *as, bool step_pending) -{ - whpx_global.step_pending =3D step_pending; -} - /* * Vcpu support. */ @@ -2244,295 +2064,18 @@ error: return ret; } =20 -int whpx_vcpu_exec(CPUState *cpu) -{ - int ret; - int fatal; - - for (;;) { - if (cpu->exception_index >=3D EXCP_INTERRUPT) { - ret =3D cpu->exception_index; - cpu->exception_index =3D -1; - break; - } - - fatal =3D whpx_vcpu_run(cpu); - - if (fatal) { - error_report("WHPX: Failed to exec a virtual processor"); - abort(); - } - } - - return ret; -} - -void whpx_destroy_vcpu(CPUState *cpu) -{ - struct whpx_state *whpx =3D &whpx_global; - AccelCPUState *vcpu =3D cpu->accel; - - whp_dispatch.WHvDeleteVirtualProcessor(whpx->partition, cpu->cpu_index= ); - whp_dispatch.WHvEmulatorDestroyEmulator(vcpu->emulator); - g_free(cpu->accel); -} - -void whpx_vcpu_kick(CPUState *cpu) -{ - struct whpx_state *whpx =3D &whpx_global; - whp_dispatch.WHvCancelRunVirtualProcessor( - whpx->partition, cpu->cpu_index, 0); -} - -/* - * Memory support. - */ - -static void whpx_update_mapping(hwaddr start_pa, ram_addr_t size, - void *host_va, int add, int rom, - const char *name) -{ - struct whpx_state *whpx =3D &whpx_global; - HRESULT hr; - - /* - if (add) { - printf("WHPX: ADD PA:%p Size:%p, Host:%p, %s, '%s'\n", - (void*)start_pa, (void*)size, host_va, - (rom ? "ROM" : "RAM"), name); - } else { - printf("WHPX: DEL PA:%p Size:%p, Host:%p, '%s'\n", - (void*)start_pa, (void*)size, host_va, name); - } - */ - - if (add) { - hr =3D whp_dispatch.WHvMapGpaRange(whpx->partition, - host_va, - start_pa, - size, - (WHvMapGpaRangeFlagRead | - WHvMapGpaRangeFlagExecute | - (rom ? 0 : WHvMapGpaRangeFlagWri= te))); - } else { - hr =3D whp_dispatch.WHvUnmapGpaRange(whpx->partition, - start_pa, - size); - } - - if (FAILED(hr)) { - error_report("WHPX: Failed to %s GPA range '%s' PA:%p, Size:%p byt= es," - " Host:%p, hr=3D%08lx", - (add ? "MAP" : "UNMAP"), name, - (void *)(uintptr_t)start_pa, (void *)size, host_va, h= r); - } -} - -static void whpx_process_section(MemoryRegionSection *section, int add) -{ - MemoryRegion *mr =3D section->mr; - hwaddr start_pa =3D section->offset_within_address_space; - ram_addr_t size =3D int128_get64(section->size); - unsigned int delta; - uint64_t host_va; - - if (!memory_region_is_ram(mr)) { - return; - } - - delta =3D qemu_real_host_page_size() - (start_pa & ~qemu_real_host_pag= e_mask()); - delta &=3D ~qemu_real_host_page_mask(); - if (delta > size) { - return; - } - start_pa +=3D delta; - size -=3D delta; - size &=3D qemu_real_host_page_mask(); - if (!size || (start_pa & ~qemu_real_host_page_mask())) { - return; - } - - host_va =3D (uintptr_t)memory_region_get_ram_ptr(mr) - + section->offset_within_region + delta; - - whpx_update_mapping(start_pa, size, (void *)(uintptr_t)host_va, add, - memory_region_is_rom(mr), mr->name); -} - -static void whpx_region_add(MemoryListener *listener, - MemoryRegionSection *section) -{ - memory_region_ref(section->mr); - whpx_process_section(section, 1); -} - -static void whpx_region_del(MemoryListener *listener, - MemoryRegionSection *section) -{ - whpx_process_section(section, 0); - memory_region_unref(section->mr); -} - -static void whpx_transaction_begin(MemoryListener *listener) -{ -} - -static void whpx_transaction_commit(MemoryListener *listener) -{ -} - -static void whpx_log_sync(MemoryListener *listener, - MemoryRegionSection *section) -{ - MemoryRegion *mr =3D section->mr; - - if (!memory_region_is_ram(mr)) { - return; - } - - memory_region_set_dirty(mr, 0, int128_get64(section->size)); -} - -static MemoryListener whpx_memory_listener =3D { - .name =3D "whpx", - .begin =3D whpx_transaction_begin, - .commit =3D whpx_transaction_commit, - .region_add =3D whpx_region_add, - .region_del =3D whpx_region_del, - .log_sync =3D whpx_log_sync, - .priority =3D MEMORY_LISTENER_PRIORITY_ACCEL, -}; - -static void whpx_memory_init(void) -{ - memory_listener_register(&whpx_memory_listener, &address_space_memory); -} - -/* - * Load the functions from the given library, using the given handle. If a - * handle is provided, it is used, otherwise the library is opened. The - * handle will be updated on return with the opened one. - */ -static bool load_whp_dispatch_fns(HMODULE *handle, - WHPFunctionList function_list) -{ - HMODULE hLib =3D *handle; - - #define WINHV_PLATFORM_DLL "WinHvPlatform.dll" - #define WINHV_EMULATION_DLL "WinHvEmulation.dll" - #define WHP_LOAD_FIELD_OPTIONAL(return_type, function_name, signature)= \ - whp_dispatch.function_name =3D \ - (function_name ## _t)GetProcAddress(hLib, #function_name); \ - - #define WHP_LOAD_FIELD(return_type, function_name, signature) \ - whp_dispatch.function_name =3D \ - (function_name ## _t)GetProcAddress(hLib, #function_name); \ - if (!whp_dispatch.function_name) { \ - error_report("Could not load function %s", #function_name); \ - goto error; \ - } \ - - #define WHP_LOAD_LIB(lib_name, handle_lib) \ - if (!handle_lib) { \ - handle_lib =3D LoadLibrary(lib_name); \ - if (!handle_lib) { \ - error_report("Could not load library %s.", lib_name); \ - goto error; \ - } \ - } \ - - switch (function_list) { - case WINHV_PLATFORM_FNS_DEFAULT: - WHP_LOAD_LIB(WINHV_PLATFORM_DLL, hLib) - LIST_WINHVPLATFORM_FUNCTIONS(WHP_LOAD_FIELD) - break; - - case WINHV_EMULATION_FNS_DEFAULT: - WHP_LOAD_LIB(WINHV_EMULATION_DLL, hLib) - LIST_WINHVEMULATION_FUNCTIONS(WHP_LOAD_FIELD) - break; - - case WINHV_PLATFORM_FNS_SUPPLEMENTAL: - WHP_LOAD_LIB(WINHV_PLATFORM_DLL, hLib) - LIST_WINHVPLATFORM_FUNCTIONS_SUPPLEMENTAL(WHP_LOAD_FIELD_OPTIONAL) - break; - } - - *handle =3D hLib; - return true; - -error: - if (hLib) { - FreeLibrary(hLib); - } - - return false; -} - -static void whpx_set_kernel_irqchip(Object *obj, Visitor *v, - const char *name, void *opaque, - Error **errp) -{ - struct whpx_state *whpx =3D &whpx_global; - OnOffSplit mode; - - if (!visit_type_OnOffSplit(v, name, &mode, errp)) { - return; - } - - switch (mode) { - case ON_OFF_SPLIT_ON: - whpx->kernel_irqchip_allowed =3D true; - whpx->kernel_irqchip_required =3D true; - break; - - case ON_OFF_SPLIT_OFF: - whpx->kernel_irqchip_allowed =3D false; - whpx->kernel_irqchip_required =3D false; - break; - - case ON_OFF_SPLIT_SPLIT: - error_setg(errp, "WHPX: split irqchip currently not supported"); - error_append_hint(errp, - "Try without kernel-irqchip or with kernel-irqchip=3Don|off"); - break; - - default: - /* - * The value was checked in visit_type_OnOffSplit() above. If - * we get here, then something is wrong in QEMU. - */ - abort(); - } -} - -static void whpx_cpu_instance_init(CPUState *cs) +void whpx_cpu_instance_init(CPUState *cs) { X86CPU *cpu =3D X86_CPU(cs); =20 host_cpu_instance_init(cpu); } =20 -static void whpx_cpu_accel_class_init(ObjectClass *oc, const void *data) -{ - AccelCPUClass *acc =3D ACCEL_CPU_CLASS(oc); - - acc->cpu_instance_init =3D whpx_cpu_instance_init; -} - -static const TypeInfo whpx_cpu_accel_type =3D { - .name =3D ACCEL_CPU_NAME("whpx"), - - .parent =3D TYPE_ACCEL_CPU, - .class_init =3D whpx_cpu_accel_class_init, - .abstract =3D true, -}; - /* * Partition support */ =20 -static int whpx_accel_init(AccelState *as, MachineState *ms) +int whpx_accel_init(AccelState *as, MachineState *ms) { struct whpx_state *whpx; int ret; @@ -2715,77 +2258,3 @@ error: =20 return ret; } - -bool whpx_apic_in_platform(void) { - return whpx_global.apic_in_platform; -} - -static void whpx_accel_class_init(ObjectClass *oc, const void *data) -{ - AccelClass *ac =3D ACCEL_CLASS(oc); - ac->name =3D "WHPX"; - ac->init_machine =3D whpx_accel_init; - ac->pre_resume_vm =3D whpx_pre_resume_vm; - ac->allowed =3D &whpx_allowed; - - object_class_property_add(oc, "kernel-irqchip", "on|off|split", - NULL, whpx_set_kernel_irqchip, - NULL, NULL); - object_class_property_set_description(oc, "kernel-irqchip", - "Configure WHPX in-kernel irqchip"); -} - -static void whpx_accel_instance_init(Object *obj) -{ - struct whpx_state *whpx =3D &whpx_global; - - memset(whpx, 0, sizeof(struct whpx_state)); - /* Turn on kernel-irqchip, by default */ - whpx->kernel_irqchip_allowed =3D true; -} - -static const TypeInfo whpx_accel_type =3D { - .name =3D ACCEL_CLASS_NAME("whpx"), - .parent =3D TYPE_ACCEL, - .instance_init =3D whpx_accel_instance_init, - .class_init =3D whpx_accel_class_init, -}; - -static void whpx_type_init(void) -{ - type_register_static(&whpx_accel_type); - type_register_static(&whpx_cpu_accel_type); -} - -bool init_whp_dispatch(void) -{ - if (whp_dispatch_initialized) { - return true; - } - - if (!load_whp_dispatch_fns(&hWinHvPlatform, WINHV_PLATFORM_FNS_DEFAULT= )) { - goto error; - } - - if (!load_whp_dispatch_fns(&hWinHvEmulation, WINHV_EMULATION_FNS_DEFAU= LT)) { - goto error; - } - - assert(load_whp_dispatch_fns(&hWinHvPlatform, - WINHV_PLATFORM_FNS_SUPPLEMENTAL)); - whp_dispatch_initialized =3D true; - - return true; -error: - if (hWinHvPlatform) { - FreeLibrary(hWinHvPlatform); - } - - if (hWinHvEmulation) { - FreeLibrary(hWinHvEmulation); - } - - return false; -} - -type_init(whpx_type_init); --=20 2.50.1 (Apple Git-155) From nobody Sat Feb 7 07:31:33 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=unpredictable.fr ARC-Seal: i=1; a=rsa-sha256; t=1770301674; cv=none; d=zohomail.com; s=zohoarc; b=NUNgrGfIUWGSFeQjuSU9BD/8T3WfS4TKWH/Ai0st4D15997vVlwatKL4Vkd1cQTzURTQwtKej+QGwNjKOIQ/K3eZBQHf6QTDpoLSdGHFow0mlATBhcI4s1rS0psX9aquqAzoU6IjW9qJurGHnh7320wfYo+W2aeTFw+IMcxt5kY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770301674; h=Content-Type: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=mBFnX+1GWKubPDZlgEM1plJqBHQoJzuLiKUgkg0UYPU=; b=ZvZEBRWIfqPfokNBWnckTPOYOqoKvsZWxVMOPc2OBOagWV5e/fWt4/OPMBVdSdES4rllULASLK6krGbfft4oY5pKpb9YrOvrZ+fcHqYglnbHk9AWjhHU7RXsJQInhIqrLSaAR3oBR51ghqN/LCTj2QGdvJAhoCRx02i8PTueNTY= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770301674508674.824823768806; Thu, 5 Feb 2026 06:27:54 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vo0Jk-000199-Et; Thu, 05 Feb 2026 09:26:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0Ja-000133-A1 for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:38 -0500 Received: from qs-2003d-snip4-11.eps.apple.com ([57.103.86.43] helo=outbound.qs.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0JQ-0007yL-T8 for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:33 -0500 Received: from outbound.qs.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPS id BDF801800264; Thu, 5 Feb 2026 14:26:24 +0000 (UTC) Received: from localhost.localdomain (unknown [17.57.155.37]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPSA id 440A81800D93; Thu, 5 Feb 2026 14:26:17 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1770301588; x=1772893588; bh=mBFnX+1GWKubPDZlgEM1plJqBHQoJzuLiKUgkg0UYPU=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:x-icloud-hme; b=TcYkg/A1pZzQlH/acD2YvIUr5Ey+vvL6yYd+EkMUAk2X6nI1cTQpbwDaz8iSPP5ZDd+rF4d5V14oiJKWZEJYuN30CoMmfC+PnjSIFmzAuf0DsbjAq2TBXqX6xQTAjq59jdER30EOTosZ2hn+/b7+E8evDfApAnmqJEAsM+Krlji1JUj/5SlgnwGCCe/CL75Q6kI1X9gukmst7Q9JFKAi1feAf3X/mgKlncIgdCuRsgRTOhLBAOsFlr775pLu4Zk8TfEeatWK2XNfnzUR2vdSVecoTUgP7oRgEak3X7LJj2t9nXzj0oqfJ8H4CE/vx9y1XmArJuGrmmdE6WDm5koHRA== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org, mohamed@unpredictable.fr Cc: Zhao Liu , Paolo Bonzini , Akihiko Odaki , Cameron Esfahani , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Shannon Zhao , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Phil Dennis-Jordan , "Michael S. Tsirkin" , Richard Henderson , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Alexander Graf , Pedro Barbuda , Yanan Wang , Ani Sinha , Igor Mammedov , Marcel Apfelbaum , Peter Maydell , Eduardo Habkost , Roman Bolshakov , Pierrick Bouvier Subject: [PATCH v21 11/22] whpx: ifdef out winhvemulation on non-x86_64 Date: Thu, 5 Feb 2026 15:25:29 +0100 Message-ID: <20260205142543.64818-12-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260205142543.64818-1-mohamed@unpredictable.fr> References: <20260205142543.64818-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: 6bgapYDGBxF079P4pJiTVaQidK3iumHo X-Proofpoint-ORIG-GUID: 6bgapYDGBxF079P4pJiTVaQidK3iumHo X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjA1MDEwOCBTYWx0ZWRfX9p9GOqi7ceJH hy28DvGBfZCxlCIzaX4VSdlD7DvU0fGbWPCRhr38aI9pzu0n88K971gIc1s0ektLE7gOPq4L2t2 u/GSh3W6ZcjHmoKWYyJz9I7Ri0U1zCOpwdzM6n1f6NDm3C6E2HvvrL9vbEKb3kOYtO0sceLVgZH bPB5Hox4egs/6zWM8fzxFsWwBfVAAYkrSkwaUYcTH8Wm2k8shtUhuda5g0gXNcqdQOyzJohIZMb Kj/MNFNb5MFAnqss7mN/lqIaHucGpxAEZFNjL3OK3fAGE3e0afHx0f5d6DVeMIkHvpLuUtdVm4R 6Ur43RxsOy4j+Bnq2hvRcIM6jvK4Eb8LHv2ttEa1w0AIPtzP+LpoT0Dip8bHOA= X-Authority-Info-Out: v=2.4 cv=aN39aL9m c=1 sm=1 tr=0 ts=6984a892 cx=c_apl:c_apl_out:c_pps a=bsP7O+dXZ5uKcj+dsLqiMw==:117 a=bsP7O+dXZ5uKcj+dsLqiMw==:17 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=VExx-Oqz_yhFp4n2Ql0A:9 a=0bXxn9q0MV6snEgNplNhOjQmxlI=:19 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-05_03,2026-02-05_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxlogscore=982 phishscore=0 spamscore=0 clxscore=1030 adultscore=0 lowpriorityscore=0 bulkscore=0 malwarescore=0 mlxscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602050108 X-JNJ: AAAAAAAB4zlniXRxQ/QXnvMCnhvi+RvQxQtIHkcA67CFAvF+jZi3hTWdob41GxeKfoU+gOHHz90oez5tf4D3GfMxgiMcJyfXx0ICKU5u4unRkKlKWc89JlVbu7F205M9bhYKdlPqksfgVqY9ERRq+biu8dIVjGsrZ4pK4zdmO8zKKki7zcW7ScOp8SX/HHTPExdugsZavvLynckgStO/aP0pD5tuQt9tv8sfqSluLEbMUzy77+8mEiyZzgHlBHunH+fKkQKLdnajRyIqiSzPmOO3p0R9ynoPFNwJy7SWrpDSJYXWCFbkklfs82ipimW3GEK+wWrkAjL4M/t7GCT3lTphwlUmLQ1uC/L0DTwZqBI4RceJ/t5NG96WS6K4GZ+QfrNOYoi37zeNAzoruMQBu8EPtUzBOJ5iTTqPrhWsHxoPrLZgbFskeSLlb+pkcHeslfNg5mxmjOSMQ72KmHNTDX6M/pyhh11/1KofaPVSFY5xcHi6X/D5N8bTq5unhbifSKKwEdmFsmUSUDxbxp7Wk6gK7En1UQTZfpm84Ul0Fooq8GdQjPOBn7xo8fRssSutVdNWCemKQpGA/haPYT0Yux+ydk52NkGmk7HrODWpLD4bvzBUHo1F+UELZlB4VWqh6F/J9gbrRWbnJpX+b8GEW6zdJJsOGx0p8rXkmZdCOao3iwo2rbuGjwfmaN82ypHhyhcJq99ygzbCHx+iqTm94iqjOMC7Bs6TYl4T0nJPuhFDZuN6fOvUZtiQXhcnnm4N2ukMal/PUYU36H57iR1Ma8Cfh/Up11iO7NOkxdTm5KlPnaXU5K70fUEDgFZBnfZjKxv65JH37Fv4EPaSToEQOoTw7v5F3urhkwuYlZ+r/FfrL6SciqAyoCJR31SEHe6gEbODLvtIfsC99w67mMT8ohVQeDGbpGDuszX0+UR2ZvxHgeHt7Xxcqv8bOQaRLBeG+g== 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=lists.gnu.org; Received-SPF: pass client-ip=57.103.86.43; envelope-from=mohamed@unpredictable.fr; helo=outbound.qs.icloud.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @unpredictable.fr) X-ZM-MESSAGEID: 1770301677012158500 winhvemulation is x86_64 only. In the future, we might want to get rid of winhvemulation usage entirely. Signed-off-by: Mohamed Mediouni Reviewed-by: Pierrick Bouvier Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- accel/whpx/whpx-common.c | 14 ++++++++++++-- include/system/whpx-common.h | 2 ++ include/system/whpx-internal.h | 7 ++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/accel/whpx/whpx-common.c b/accel/whpx/whpx-common.c index 0a6068fdde..c58344cb61 100644 --- a/accel/whpx/whpx-common.c +++ b/accel/whpx/whpx-common.c @@ -37,7 +37,9 @@ bool whpx_allowed; static bool whp_dispatch_initialized; static HMODULE hWinHvPlatform; +#ifdef HOST_X86_64 static HMODULE hWinHvEmulation; +#endif =20 struct whpx_state whpx_global; struct WHPDispatch whp_dispatch; @@ -232,8 +234,10 @@ void whpx_destroy_vcpu(CPUState *cpu) struct whpx_state *whpx =3D &whpx_global; =20 whp_dispatch.WHvDeleteVirtualProcessor(whpx->partition, cpu->cpu_index= ); +#ifdef HOST_X86_64 AccelCPUState *vcpu =3D cpu->accel; whp_dispatch.WHvEmulatorDestroyEmulator(vcpu->emulator); +#endif g_free(cpu->accel); } =20 @@ -408,8 +412,12 @@ static bool load_whp_dispatch_fns(HMODULE *handle, LIST_WINHVPLATFORM_FUNCTIONS(WHP_LOAD_FIELD) break; case WINHV_EMULATION_FNS_DEFAULT: +#ifdef HOST_X86_64 WHP_LOAD_LIB(WINHV_EMULATION_DLL, hLib) LIST_WINHVEMULATION_FUNCTIONS(WHP_LOAD_FIELD) +#else + g_assert_not_reached(); +#endif break; case WINHV_PLATFORM_FNS_SUPPLEMENTAL: WHP_LOAD_LIB(WINHV_PLATFORM_DLL, hLib) @@ -535,11 +543,11 @@ bool init_whp_dispatch(void) if (!load_whp_dispatch_fns(&hWinHvPlatform, WINHV_PLATFORM_FNS_DEFAULT= )) { goto error; } - +#ifdef HOST_X86_64 if (!load_whp_dispatch_fns(&hWinHvEmulation, WINHV_EMULATION_FNS_DEFAU= LT)) { goto error; } - +#endif assert(load_whp_dispatch_fns(&hWinHvPlatform, WINHV_PLATFORM_FNS_SUPPLEMENTAL)); whp_dispatch_initialized =3D true; @@ -549,9 +557,11 @@ error: if (hWinHvPlatform) { FreeLibrary(hWinHvPlatform); } +#ifdef HOST_X86_64 if (hWinHvEmulation) { FreeLibrary(hWinHvEmulation); } +#endif return false; } =20 diff --git a/include/system/whpx-common.h b/include/system/whpx-common.h index e549c7539c..8f171d1397 100644 --- a/include/system/whpx-common.h +++ b/include/system/whpx-common.h @@ -3,7 +3,9 @@ #define SYSTEM_WHPX_COMMON_H =20 struct AccelCPUState { +#ifdef HOST_X86_64 WHV_EMULATOR_HANDLE emulator; +#endif bool window_registered; bool interruptable; bool ready_for_pic_interrupt; diff --git a/include/system/whpx-internal.h b/include/system/whpx-internal.h index 041fa958b4..609d0e1c08 100644 --- a/include/system/whpx-internal.h +++ b/include/system/whpx-internal.h @@ -4,8 +4,9 @@ =20 #include #include +#ifdef HOST_X86_64 #include - +#endif #include "hw/i386/apic.h" #include "exec/vaddr.h" =20 @@ -101,12 +102,16 @@ void whpx_apic_get(APICCommonState *s); =20 /* Define function typedef */ LIST_WINHVPLATFORM_FUNCTIONS(WHP_DEFINE_TYPE) +#ifdef HOST_X86_64 LIST_WINHVEMULATION_FUNCTIONS(WHP_DEFINE_TYPE) +#endif LIST_WINHVPLATFORM_FUNCTIONS_SUPPLEMENTAL(WHP_DEFINE_TYPE) =20 struct WHPDispatch { LIST_WINHVPLATFORM_FUNCTIONS(WHP_DECLARE_MEMBER) +#ifdef HOST_X86_64 LIST_WINHVEMULATION_FUNCTIONS(WHP_DECLARE_MEMBER) +#endif LIST_WINHVPLATFORM_FUNCTIONS_SUPPLEMENTAL(WHP_DECLARE_MEMBER) }; =20 --=20 2.50.1 (Apple Git-155) From nobody Sat Feb 7 07:31:33 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=unpredictable.fr ARC-Seal: i=1; a=rsa-sha256; t=1770301915; cv=none; d=zohomail.com; s=zohoarc; b=iDu1gsxCHihMjhGgN0l71q7PrKiAvSHmT5gzd4zkkbyrWy+NV80KJJGEvlfQRXwgxUaI01n6zK/rpCa+5AJxDMNOiaa+AwaZ3+78kgnyIB5g6kx2uK605NL/PF8sU0ZyGxawGrwmu41EyrRL1x218jyyBUhHowe9/Lb0LtY6K7U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770301915; 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=c9xkU5JKUppgK3M6NvIGvHRbHv9MZvro5B1lYG+DJ2Y=; b=gwZaSxs4rKi/DdNWae6EobeluzfOmq5G52nV251WHWwuchCNhQrZemQ4TDalCajDzqq8bYTiI66PxOQsfvYHJr6g43ctnzmJBdnnsU/PwwvPO9LlADXNnfoJbjWTM4G1vVbPFeV5jQCLVFFf9gQr/inGv8Uuy4mpBRxtgy0bw8Y= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770301915698559.9532595351434; Thu, 5 Feb 2026 06:31:55 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vo0Jq-0001CY-E7; Thu, 05 Feb 2026 09:26:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0Jb-000143-I3 for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:40 -0500 Received: from qs-2003d-snip4-2.eps.apple.com ([57.103.86.35] helo=outbound.qs.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0JX-0007yY-Jg for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:39 -0500 Received: from outbound.qs.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPS id 5ECF41800DA3; Thu, 5 Feb 2026 14:26:27 +0000 (UTC) Received: from localhost.localdomain (unknown [17.57.155.37]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPSA id 42CBE1800178; Thu, 5 Feb 2026 14:26:20 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1770301590; x=1772893590; bh=c9xkU5JKUppgK3M6NvIGvHRbHv9MZvro5B1lYG+DJ2Y=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=R5GKQ65RIYVVoB1ad1pWdp+GuDCN0u2/0hymMkX7AoEILpxEwJIKDdsGIXK4s8QnmcjYvieH+iosLqB9tnOooNScf4GHuV2g5EJjvyJgb7ef24Tot90mk+h1lzswMWJoUeyNEVwVCnCSXdQZiy0Xl1wiJ8PqZ6yXxnxDGkLlbIozQvos2X9wuvyMAGl3a2bwLNu2ZCYgFRMSGOKZYLZygWt/eMHDTQnHeoJp83ERzhl/SnmYvcPONFJScGGIgkgwfCFN02K6TSj47Nsg+T12Zehx1ToqfPKefkiK4f7QZUsgN0WCsfZs1zbdLB4jbeJcrykc1cy5Sy6mzqP4C6FqkA== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org, mohamed@unpredictable.fr Cc: Zhao Liu , Paolo Bonzini , Akihiko Odaki , Cameron Esfahani , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Shannon Zhao , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Phil Dennis-Jordan , "Michael S. Tsirkin" , Richard Henderson , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Alexander Graf , Pedro Barbuda , Yanan Wang , Ani Sinha , Igor Mammedov , Marcel Apfelbaum , Peter Maydell , Eduardo Habkost , Roman Bolshakov , Pierrick Bouvier Subject: [PATCH v21 12/22] whpx: common: add WHPX_INTERCEPT_DEBUG_TRAPS define Date: Thu, 5 Feb 2026 15:25:30 +0100 Message-ID: <20260205142543.64818-13-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260205142543.64818-1-mohamed@unpredictable.fr> References: <20260205142543.64818-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: QvVhRmNCY-ySj9T9MqBAglko89EdGRDp X-Authority-Info-Out: v=2.4 cv=NKbYOk6g c=1 sm=1 tr=0 ts=6984a895 cx=c_apl:c_apl_out:c_pps a=bsP7O+dXZ5uKcj+dsLqiMw==:117 a=bsP7O+dXZ5uKcj+dsLqiMw==:17 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=2psWIPzlEfUqwKpUe20A:9 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-GUID: QvVhRmNCY-ySj9T9MqBAglko89EdGRDp X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjA1MDEwOCBTYWx0ZWRfX1bngqPSu37r5 3gAHZWoFHNyaQehfCDy2O/tnBHUASTOe9oScICrZP7uiRXuWeZC6zZSdEtbbCFelWvDxN8/UJ84 UjzUjK5djRAkvfz5G7v6Bo9nYwmCXJI+Vk9UMal5qpDFOpEcsBlXP5gir7rsU4N/ZULq85r9ict EtgOLzBuLuM7mWunrZJPE7IVeMIOlCsfbPsgKNf20G2BLc9TtoJ1Bu0DfTCIAzrss7LF8SoO7bp EEfg2GsynfuB5VdJZvBaA5TaQCG/ol+c3EqfYezqnEO7o2w9JqoLoYl7wu1OyVnG6KijY9rL5Xm PA7nZ+VN7k9DmQxki5B8RUx+eT1oe+1Q9hAfq6DZ7Eq4oJwn/o3TRRnXjathdQ= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-05_03,2026-02-05_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 clxscore=1030 suspectscore=0 mlxlogscore=999 lowpriorityscore=0 phishscore=0 adultscore=0 mlxscore=0 spamscore=0 bulkscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602050108 X-JNJ: AAAAAAABnmSDw9LYq4v5N+VCx0aeqTwhfyNUQyyTwinPTsmYJ087u4IErS+1/cM4EpKe/q7qVZpeZgJeupC7oM54qHrhO3/Q0nkyXw5o5uhcHyfR8IzfI4MS96dXbB66YkgIRReL2lc1q1gL1tkaITfEw5cyqlI+EJ+0aAnryUxCZ/Bfi3wbOiJNHXDHkjo4zdYb2ZhB3cgqa8EuMX9sfIJe1UiIDoRPG/sE5UXUwI9KacSBDBQEH2RXggS27RMfgS/FeFdwF+smAh7QAbN3yFEK8c9DlqgozapJgHtYeQcDH4PfPLKnC8NrCwfPAX1Rk96ckGDOzHPhqpEVjAOa+OGMXhEHZuMMisR2Yy/FAnYbXRdJqMsv3vd9ZalZPphv/X2NSFIb8tSjj55obO6N36eUbz7I6MbC3FRNoHrrAy0sq6ICXw8nJd9LP9SlB3NQEBes7ywJKHLZSiiSQyH+P3B9O6FxclpQkpEixB8BhFiWQQ9xzO3On8P08zN/8avvhNuXtY5QBBmMnDmsvn2+syAfuDx3VtyprmUq2jchfUKL8BnI2bKnhzWyD1+VnxI63qV8gUAJZLELLuttMo2wglXjRoM41LReduDei6XVghGuKZqc/ZU18t5LHv3IKXnej6KB4fok6JUkZC8fcYyzwx4/4TJPt2GN8bxZsZ2Ilox+ZAgcMD128sJNAG58xPlHoJ/WzimzTPX9yFBGFHxpnXawR60qSXOXMs76KrZsnQ4+utHw7/eNwHrVbEnIizxceRNikeOhm19T5ALle1H1RtHVmLXZLV3Qccu7U+AhBXFjyNfCf098di6pMfmcZ8iXXigAUp0KJlgaag0cPwS6g0MX/pigf9DxsNajsMOaaxPrn2i7phQEN13ynzozzMn16w49mQcaVB2f8eY6HmH7luL7GUfa1Sb20iMQqig2b7q4L5QpZhlSsk8kcPXut/4X3L7IuWrnQiot4cVSPDKilYaO9Zg= 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=lists.gnu.org; Received-SPF: pass client-ip=57.103.86.35; envelope-from=mohamed@unpredictable.fr; helo=outbound.qs.icloud.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @unpredictable.fr) X-ZM-MESSAGEID: 1770301917561154100 Content-Type: text/plain; charset="utf-8" As of why: WHPX on arm64 doesn't have debug trap support as of today. Keep the exception bitmap interface for now - despite that being entirely u= navailable on arm64 too. Signed-off-by: Mohamed Mediouni Reviewed-by: Pierrick Bouvier Reviewed-by: Akihiko Odaki --- accel/whpx/whpx-common.c | 2 +- include/system/whpx-common.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/accel/whpx/whpx-common.c b/accel/whpx/whpx-common.c index c58344cb61..c0610815d9 100644 --- a/accel/whpx/whpx-common.c +++ b/accel/whpx/whpx-common.c @@ -119,7 +119,7 @@ int whpx_first_vcpu_starting(CPUState *cpu) * have one or more breakpoints enabled. Both require intercepting * the WHvX64ExceptionTypeBreakpointTrap exception. */ - exception_mask =3D 1UL << WHvX64ExceptionTypeDebugTrapOrFault; + exception_mask =3D 1UL << WHPX_INTERCEPT_DEBUG_TRAPS; } else { /* Let the guest handle all exceptions. */ exception_mask =3D 0; diff --git a/include/system/whpx-common.h b/include/system/whpx-common.h index 8f171d1397..b86fe9db6e 100644 --- a/include/system/whpx-common.h +++ b/include/system/whpx-common.h @@ -20,4 +20,7 @@ int whpx_first_vcpu_starting(CPUState *cpu); int whpx_last_vcpu_stopping(CPUState *cpu); void whpx_memory_init(void); struct whpx_breakpoint *whpx_lookup_breakpoint_by_addr(uint64_t address); + +/* On x64: same as WHvX64ExceptionTypeDebugTrapOrFault */ +#define WHPX_INTERCEPT_DEBUG_TRAPS 1 #endif --=20 2.50.1 (Apple Git-155) From nobody Sat Feb 7 07:31:33 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=unpredictable.fr ARC-Seal: i=1; a=rsa-sha256; t=1770301698; cv=none; d=zohomail.com; s=zohoarc; b=aN28rnR9ROj36X3yL2Pa7d7+Fwsbk3aUl3vmmMZZcGrDEQqEbNSLH81SKVJLHhqayo2VWrn7aEZJI3Gtp7EBTLLIByIKYxHeQJVH9A7tcSFPmNV+RUQzf+pIvyaAnkZ98p+ahgewIeGSjJoNGodphrAaemyZaiqqs530OYkxtC8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770301698; 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=jbpBkBFfXNX3BzKF2Q07er+vdtP2HICkvEt9c9jj/7w=; b=GiRc/+kUBuuUIg663JOU6ZiJvEaD2DDzBteyRNZyCSbFOw3SB68OEhaN9u0f8kCSKpfMaR+ATXwTPYTdtK/6N0lbZWgGlQ6NqQhcQEinHwII+DkxxMR0J1V89G30v6cVEzQm3k8oKtp3zs40zpqJYmGrnEdE3R9ic07cj/kAErE= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770301698651521.3401299085598; Thu, 5 Feb 2026 06:28:18 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vo0K2-0001bG-0f; Thu, 05 Feb 2026 09:27:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0Je-00014d-0n for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:42 -0500 Received: from qs-2003e-snip4-2.eps.apple.com ([57.103.86.45] helo=outbound.qs.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0Ja-0007yw-3b for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:41 -0500 Received: from outbound.qs.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPS id F111D1800117; Thu, 5 Feb 2026 14:26:29 +0000 (UTC) Received: from localhost.localdomain (unknown [17.57.155.37]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPSA id 20D671800D83; Thu, 5 Feb 2026 14:26:23 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1770301593; x=1772893593; bh=jbpBkBFfXNX3BzKF2Q07er+vdtP2HICkvEt9c9jj/7w=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=UQOX0mrcRNUXYSYf0l85K4RGx82WmwjCu4NA6Ty9VHmY6tMb5zLjebB0UnL8IGVHFu3q8u/PsW0tZAdhhfWn57lWhEJVPA6vkLZdKklzUQ/Bm1T3xHeU3XsfPttT80wLG+ZvI8PrJ3eeD2e5Twr/fEeheI9aSXWHI/ZK1XdVqFgZXBayyS88ATZapIepjJFsb64ZQl0dO6X2fCAT+Oreo8FsbbzvGhkVAgUYzpz39XFiSJd3BMGkkAdsDdLh/lQp0cvrLhMC+OxP7pweZm37Dlz++AjE+WAcd581PJdXeAetthmHMxNvzmcFGq3G//XZgYueNQtRrFmoKwUYdxmzYQ== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org, mohamed@unpredictable.fr Cc: Zhao Liu , Paolo Bonzini , Akihiko Odaki , Cameron Esfahani , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Shannon Zhao , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Phil Dennis-Jordan , "Michael S. Tsirkin" , Richard Henderson , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Alexander Graf , Pedro Barbuda , Yanan Wang , Ani Sinha , Igor Mammedov , Marcel Apfelbaum , Peter Maydell , Eduardo Habkost , Roman Bolshakov , Pierrick Bouvier Subject: [PATCH v21 13/22] hw, target, accel: whpx: change apic_in_platform to kernel_irqchip Date: Thu, 5 Feb 2026 15:25:31 +0100 Message-ID: <20260205142543.64818-14-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260205142543.64818-1-mohamed@unpredictable.fr> References: <20260205142543.64818-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Authority-Info-Out: v=2.4 cv=AIp8DMUn c=1 sm=1 tr=0 ts=6984a897 cx=c_apl:c_apl_out:c_pps a=bsP7O+dXZ5uKcj+dsLqiMw==:117 a=bsP7O+dXZ5uKcj+dsLqiMw==:17 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=kiID8kuSrMNj-W4hClMA:9 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-GUID: AmQKvvPGCtXJ-9ANSBWFJ_9Ic6OO0_YL X-Proofpoint-ORIG-GUID: AmQKvvPGCtXJ-9ANSBWFJ_9Ic6OO0_YL X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjA1MDEwOCBTYWx0ZWRfX9mZ8LembAjFb gbc5ckWZ+sdRkBVCkERbLQHho3hVtv851PW7ejpjbxL7pea6rFWd7/bYjX7uTMgvhXcKsiONImc 5RTHMaqbFCC8x5KJ2RxLCKqZm0lpCTHF+FDxndLIFZl9mt2pGZy5LQ/liMNjqut98UTPVS8n2X3 aRUjHlg9+GAaodQwKzrTjsYzQO00SLMxNKA9uzcxGue65zyjjQujFFzwfRRotojM7fVIdto/zoH MH2u0laR2kKC6WBLJpT7Q01gHEhiDF+eclN1sQb4su2CE9DB0silBDI5b/l7V1wJdnTN+MTdAKZ SXNvnHOZGOlpOD4rjJUvmlQMhBGAPpCTu9rcOTOSh3f9FZCGVvrBYqefKMlWF0= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-05_03,2026-02-05_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 malwarescore=0 phishscore=0 lowpriorityscore=0 adultscore=0 mlxlogscore=999 spamscore=0 suspectscore=0 mlxscore=0 clxscore=1030 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602050108 X-JNJ: AAAAAAABUZzinEyxASTS//50Upcousa0QjE/A/1+zF8h7Ue0gcDuuLSCfL7BNBj8Jgm5aVkxbwpeks0hcI9a3okJJD5tvxUp7qBQYfxfsZn/6IGhcvMeh5ni9DVRAs0Q7TuBfo0O+psQ8Fi5713BJ+xzOMh8Ks8UbDqoYuS4aUX0eDldchwZR1OHARxtVXA77hMJ4/KxXssNdKp7oZSUyfywZBihPh6Zr9pUj+UhTcOfqM1G0DeDyAuyUMkN8+xxnWKv7OPe5EyfWX+XobQre+Z1+k2cXNGNyurh55BkboRPoaCnCR3JLm89zz8FJyj3EeMSunfJXCliirDPJ9imVv6bcF2DGt8XdE9AXn2G2W59mkrqM4F58xh7cLLN/9h5iWLrqDA4wCCRbBkSpYvfr6+a0gtX8jVYXIx8/ReNpU579ZhQWmVPYzfXVTA6L7cCqoAYb8c0pSgaz0i89uEklQ+RTmyDZCm4TUPPeIeW5HmhCIncee1wKRcKk/bqIadbfOqu6Y6nCw0PhCV5rY9+Xz6QWaTXW2knOW8QXeBfvQG89JwTKDxiQmUKP9qK+ZSKTMxi74dmNL3uzL96ATuaotvbJIbeJc1eO+33kFA9jyozNqFKg/GMYBv5JlL7iDt9wFhinmcMFHvKxzQC55gK6uwnKxiMTCRmjLm+T/LPABrX8wV43N1JQqejWr3iHq4AMlRvIOB6HuzfiGyDWkGdB2mnZmHvMLJwrKfSd3hk1e3cDRvIlWA/muf/t0ZqwKdP3cf1maoECBkDiiIcC+I7U5wvIQNcIyaaQemPXPzZoLCufoZCcTpAFE2SEz5mYYEO2sbeIqBbzFhKYHKeXHHSSK40oBM05gap8bJ5fCf7G2Pi7aZswWq8Z43HjsmtmRvds9xeovglIQdpV6z3ltKcOcn5YwrgebL1o0rCOxs5l+emx21c4cTa+rAWro/abSe+3N3XLVenTog/PD6MGwTkcA== 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=lists.gnu.org; Received-SPF: pass client-ip=57.103.86.45; envelope-from=mohamed@unpredictable.fr; helo=outbound.qs.icloud.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @unpredictable.fr) X-ZM-MESSAGEID: 1770301705130158500 Content-Type: text/plain; charset="utf-8" Change terminology to match the KVM one, as APIC is x86-specific. And move out whpx_irqchip_in_kernel() to make it usable from common code even when not compiling with WHPX support. Signed-off-by: Mohamed Mediouni Reviewed-by: Pierrick Bouvier Reviewed-by: Akihiko Odaki --- MAINTAINERS | 1 + accel/stubs/whpx-stub.c | 1 + accel/whpx/whpx-accel-ops.c | 2 +- accel/whpx/whpx-common.c | 10 +- hw/arm/virt.c | 9 ++ hw/i386/x86-cpu.c | 4 +- hw/intc/arm_gicv3_common.c | 3 + hw/intc/arm_gicv3_whpx.c | 237 +++++++++++++++++++++++++++++ hw/intc/meson.build | 1 + include/hw/intc/arm_gicv3_common.h | 3 + include/system/whpx-internal.h | 1 - include/system/whpx.h | 5 +- target/i386/cpu-apic.c | 2 +- target/i386/whpx/whpx-all.c | 14 +- 14 files changed, 270 insertions(+), 23 deletions(-) create mode 100644 hw/intc/arm_gicv3_whpx.c diff --git a/MAINTAINERS b/MAINTAINERS index 873d6628cd..126f72e587 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -566,6 +566,7 @@ M: Mohamed Mediouni S: Supported F: accel/whpx/ F: target/i386/whpx/ +F: hw/intc/arm_gicv3_whpx.c F: accel/stubs/whpx-stub.c F: include/system/whpx.h F: include/system/whpx-accel-ops.h diff --git a/accel/stubs/whpx-stub.c b/accel/stubs/whpx-stub.c index c564c89fd0..4529dc4f78 100644 --- a/accel/stubs/whpx-stub.c +++ b/accel/stubs/whpx-stub.c @@ -10,3 +10,4 @@ #include "system/whpx.h" =20 bool whpx_allowed; +bool whpx_irqchip_in_kernel; diff --git a/accel/whpx/whpx-accel-ops.c b/accel/whpx/whpx-accel-ops.c index c84a25c273..50fadea0fd 100644 --- a/accel/whpx/whpx-accel-ops.c +++ b/accel/whpx/whpx-accel-ops.c @@ -78,7 +78,7 @@ static void whpx_kick_vcpu_thread(CPUState *cpu) =20 static bool whpx_vcpu_thread_is_idle(CPUState *cpu) { - return !whpx_apic_in_platform(); + return !whpx_irqchip_in_kernel(); } =20 static void whpx_accel_ops_class_init(ObjectClass *oc, const void *data) diff --git a/accel/whpx/whpx-common.c b/accel/whpx/whpx-common.c index c0610815d9..05f9e520b7 100644 --- a/accel/whpx/whpx-common.c +++ b/accel/whpx/whpx-common.c @@ -35,6 +35,7 @@ #include =20 bool whpx_allowed; +bool whpx_irqchip_in_kernel; static bool whp_dispatch_initialized; static HMODULE hWinHvPlatform; #ifdef HOST_X86_64 @@ -488,15 +489,6 @@ static const TypeInfo whpx_cpu_accel_type =3D { .abstract =3D true, }; =20 -/* - * Partition support - */ - -bool whpx_apic_in_platform(void) -{ - return whpx_global.apic_in_platform; -} - static void whpx_accel_class_init(ObjectClass *oc, const void *data) { AccelClass *ac =3D ACCEL_CLASS(oc); diff --git a/hw/arm/virt.c b/hw/arm/virt.c index aa5e992712..b7eb0cec5e 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -49,6 +49,7 @@ #include "system/tcg.h" #include "system/kvm.h" #include "system/hvf.h" +#include "system/whpx.h" #include "system/qtest.h" #include "system/system.h" #include "hw/core/loader.h" @@ -2114,6 +2115,8 @@ static void finalize_gic_version(VirtMachineState *vm= s) /* KVM w/o kernel irqchip can only deal with GICv2 */ gics_supported |=3D VIRT_GIC_VERSION_2_MASK; accel_name =3D "KVM with kernel-irqchip=3Doff"; + } else if (whpx_enabled()) { + gics_supported |=3D VIRT_GIC_VERSION_3_MASK; } else if (tcg_enabled() || hvf_enabled() || qtest_enabled()) { gics_supported |=3D VIRT_GIC_VERSION_2_MASK; if (module_object_class_by_name("arm-gicv3")) { @@ -2154,6 +2157,8 @@ static void finalize_msi_controller(VirtMachineState = *vms) if (vms->msi_controller =3D=3D VIRT_MSI_CTRL_AUTO) { if (vms->gic_version =3D=3D VIRT_GIC_VERSION_2) { vms->msi_controller =3D VIRT_MSI_CTRL_GICV2M; + } else if (whpx_enabled()) { + vms->msi_controller =3D VIRT_MSI_CTRL_GICV2M; } else { vms->msi_controller =3D VIRT_MSI_CTRL_ITS; } @@ -2169,6 +2174,10 @@ static void finalize_msi_controller(VirtMachineState= *vms) error_report("GICv2 + ITS is an invalid configuration."); exit(1); } + if (whpx_enabled()) { + error_report("ITS not supported on WHPX."); + exit(1); + } } =20 assert(vms->msi_controller !=3D VIRT_MSI_CTRL_AUTO); diff --git a/hw/i386/x86-cpu.c b/hw/i386/x86-cpu.c index 276f2b0cdf..95e08e3c2a 100644 --- a/hw/i386/x86-cpu.c +++ b/hw/i386/x86-cpu.c @@ -45,7 +45,7 @@ static void pic_irq_request(void *opaque, int irq, int le= vel) =20 trace_x86_pic_interrupt(irq, level); if (cpu_is_apic_enabled(cpu->apic_state) && !kvm_irqchip_in_kernel() && - !whpx_apic_in_platform()) { + !whpx_irqchip_in_kernel()) { CPU_FOREACH(cs) { cpu =3D X86_CPU(cs); if (apic_accept_pic_intr(cpu->apic_state)) { @@ -71,7 +71,7 @@ int cpu_get_pic_interrupt(CPUX86State *env) X86CPU *cpu =3D env_archcpu(env); int intno; =20 - if (!kvm_irqchip_in_kernel() && !whpx_apic_in_platform()) { + if (!kvm_irqchip_in_kernel() && !whpx_irqchip_in_kernel()) { intno =3D apic_get_interrupt(cpu->apic_state); if (intno >=3D 0) { return intno; diff --git a/hw/intc/arm_gicv3_common.c b/hw/intc/arm_gicv3_common.c index 0a2e5a3e2f..9054143ea7 100644 --- a/hw/intc/arm_gicv3_common.c +++ b/hw/intc/arm_gicv3_common.c @@ -32,6 +32,7 @@ #include "gicv3_internal.h" #include "hw/arm/linux-boot-if.h" #include "system/kvm.h" +#include "system/whpx.h" =20 =20 static void gicv3_gicd_no_migration_shift_bug_post_load(GICv3State *cs) @@ -663,6 +664,8 @@ const char *gicv3_class_name(void) { if (kvm_irqchip_in_kernel()) { return "kvm-arm-gicv3"; + } else if (whpx_enabled()) { + return TYPE_WHPX_GICV3; } else { if (kvm_enabled()) { error_report("Userspace GICv3 is not supported with KVM"); diff --git a/hw/intc/arm_gicv3_whpx.c b/hw/intc/arm_gicv3_whpx.c new file mode 100644 index 0000000000..849a005242 --- /dev/null +++ b/hw/intc/arm_gicv3_whpx.c @@ -0,0 +1,237 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * ARM Generic Interrupt Controller using HVF platform support + * + * Copyright (c) 2025 Mohamed Mediouni + * Based on vGICv3 KVM code by Pavel Fedin + * + */ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "hw/intc/arm_gicv3_common.h" +#include "qemu/error-report.h" +#include "qemu/module.h" +#include "system/runstate.h" +#include "system/whpx.h" +#include "system/whpx-internal.h" +#include "gicv3_internal.h" +#include "vgic_common.h" +#include "migration/blocker.h" +#include "qom/object.h" +#include "target/arm/cpregs.h" + +#include "hw/arm/bsa.h" +#include +#include +#include + +struct WHPXARMGICv3Class { + ARMGICv3CommonClass parent_class; + DeviceRealize parent_realize; + ResettablePhases parent_phases; +}; + +OBJECT_DECLARE_TYPE(GICv3State, WHPXARMGICv3Class, WHPX_GICV3) + +/* TODO: Implement GIC state save-restore */ +static void whpx_gicv3_check(GICv3State *s) +{ +} + +static void whpx_gicv3_put(GICv3State *s) +{ + whpx_gicv3_check(s); +} + +static void whpx_gicv3_get(GICv3State *s) +{ +} + +static void whpx_gicv3_set_irq(void *opaque, int irq, int level) +{ + struct whpx_state *whpx =3D &whpx_global; + GICv3State *s =3D opaque; + WHV_INTERRUPT_CONTROL interrupt_control =3D { + .InterruptControl.InterruptType =3D WHvArm64InterruptTypeFixed, + .RequestedVector =3D GIC_INTERNAL + irq, + .InterruptControl.Asserted =3D level + }; + + if (irq > s->num_irq) { + return; + } + + + whp_dispatch.WHvRequestInterrupt(whpx->partition, &interrupt_control, + sizeof(interrupt_control)); +} + +static void whpx_gicv3_icc_reset(CPUARMState *env, const ARMCPRegInfo *ri) +{ + GICv3CPUState *c; + + c =3D env->gicv3state; + + c->icc_pmr_el1 =3D 0; + /* + * Architecturally the reset value of the ICC_BPR registers + * is UNKNOWN. We set them all to 0 here; when the kernel + * uses these values to program the ICH_VMCR_EL2 fields that + * determine the guest-visible ICC_BPR register values, the + * hardware's "writing a value less than the minimum sets + * the field to the minimum value" behaviour will result in + * them effectively resetting to the correct minimum value + * for the host GIC. + */ + c->icc_bpr[GICV3_G0] =3D 0; + c->icc_bpr[GICV3_G1] =3D 0; + c->icc_bpr[GICV3_G1NS] =3D 0; + + c->icc_sre_el1 =3D 0x7; + memset(c->icc_apr, 0, sizeof(c->icc_apr)); + memset(c->icc_igrpen, 0, sizeof(c->icc_igrpen)); +} + +static void whpx_gicv3_reset_hold(Object *obj, ResetType type) +{ + GICv3State *s =3D ARM_GICV3_COMMON(obj); + WHPXARMGICv3Class *kgc =3D WHPX_GICV3_GET_CLASS(s); + + if (kgc->parent_phases.hold) { + kgc->parent_phases.hold(obj, type); + } + + whpx_gicv3_put(s); +} + + +/* + * CPU interface registers of GIC needs to be reset on CPU reset. + * For the calling arm_gicv3_icc_reset() on CPU reset, we register + * below ARMCPRegInfo. As we reset the whole cpu interface under single + * register reset, we define only one register of CPU interface instead + * of defining all the registers. + */ +static const ARMCPRegInfo gicv3_cpuif_reginfo[] =3D { + { .name =3D "ICC_CTLR_EL1", .state =3D ARM_CP_STATE_BOTH, + .opc0 =3D 3, .opc1 =3D 0, .crn =3D 12, .crm =3D 12, .opc2 =3D 4, + /* + * If ARM_CP_NOP is used, resetfn is not called, + * So ARM_CP_NO_RAW is appropriate type. + */ + .type =3D ARM_CP_NO_RAW, + .access =3D PL1_RW, + .readfn =3D arm_cp_read_zero, + .writefn =3D arm_cp_write_ignore, + /* + * We hang the whole cpu interface reset routine off here + * rather than parcelling it out into one little function + * per register + */ + .resetfn =3D whpx_gicv3_icc_reset, + }, +}; + +static void whpx_set_reg(CPUState *cpu, WHV_REGISTER_NAME reg, WHV_REGISTE= R_VALUE val) +{ + struct whpx_state *whpx =3D &whpx_global; + HRESULT hr; + + hr =3D whp_dispatch.WHvSetVirtualProcessorRegisters(whpx->partition, c= pu->cpu_index, + ®, 1, &val); + + if (FAILED(hr)) { + error_report("WHPX: Failed to set register %08x, hr=3D%08lx", reg,= hr); + } +} + +static void whpx_gicv3_realize(DeviceState *dev, Error **errp) +{ + ERRP_GUARD(); + GICv3State *s =3D WHPX_GICV3(dev); + WHPXARMGICv3Class *kgc =3D WHPX_GICV3_GET_CLASS(s); + int i; + + kgc->parent_realize(dev, errp); + if (*errp) { + return; + } + + if (s->revision !=3D 3) { + error_setg(errp, "unsupported GIC revision %d for platform GIC", + s->revision); + return; + } + + if (s->security_extn) { + error_setg(errp, "the platform vGICv3 does not implement the " + "security extensions"); + return; + } + + if (s->nmi_support) { + error_setg(errp, "NMI is not supported with the platform GIC"); + return; + } + + if (s->nb_redist_regions > 1) { + error_setg(errp, "Multiple VGICv3 redistributor regions are not " + "supported by WHPX"); + error_append_hint(errp, "A maximum of %d VCPUs can be used", + s->redist_region_count[0]); + return; + } + + gicv3_init_irqs_and_mmio(s, whpx_gicv3_set_irq, NULL); + + for (i =3D 0; i < s->num_cpu; i++) { + CPUState *cpu_state =3D qemu_get_cpu(i); + ARMCPU *cpu =3D ARM_CPU(cpu_state); + WHV_REGISTER_VALUE val =3D {.Reg64 =3D 0x080A0000 + (GICV3_REDIST_= SIZE * i)}; + whpx_set_reg(cpu_state, WHvArm64RegisterGicrBaseGpa, val); + define_arm_cp_regs(cpu, gicv3_cpuif_reginfo); + } + + if (s->maint_irq) { + error_setg(errp, "Nested virtualisation not currently supported by= WHPX."); + return; + } + + error_setg(&s->migration_blocker, + "Live migration disabled because GIC state save/restore not suppor= ted on WHPX"); + if (migrate_add_blocker(&s->migration_blocker, errp) < 0) { + error_report_err(*errp); + } +} + +static void whpx_gicv3_class_init(ObjectClass *klass, const void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + ResettableClass *rc =3D RESETTABLE_CLASS(klass); + ARMGICv3CommonClass *agcc =3D ARM_GICV3_COMMON_CLASS(klass); + WHPXARMGICv3Class *kgc =3D WHPX_GICV3_CLASS(klass); + + agcc->pre_save =3D whpx_gicv3_get; + agcc->post_load =3D whpx_gicv3_put; + + device_class_set_parent_realize(dc, whpx_gicv3_realize, + &kgc->parent_realize); + resettable_class_set_parent_phases(rc, NULL, whpx_gicv3_reset_hold, NU= LL, + &kgc->parent_phases); +} + +static const TypeInfo whpx_arm_gicv3_info =3D { + .name =3D TYPE_WHPX_GICV3, + .parent =3D TYPE_ARM_GICV3_COMMON, + .instance_size =3D sizeof(GICv3State), + .class_init =3D whpx_gicv3_class_init, + .class_size =3D sizeof(WHPXARMGICv3Class), +}; + +static void whpx_gicv3_register_types(void) +{ + type_register_static(&whpx_arm_gicv3_info); +} + +type_init(whpx_gicv3_register_types) diff --git a/hw/intc/meson.build b/hw/intc/meson.build index faae20b93d..96742df090 100644 --- a/hw/intc/meson.build +++ b/hw/intc/meson.build @@ -41,6 +41,7 @@ specific_ss.add(when: 'CONFIG_APIC', if_true: files('apic= .c', 'apic_common.c')) arm_common_ss.add(when: 'CONFIG_ARM_GIC', if_true: files('arm_gicv3_cpuif_= common.c')) arm_common_ss.add(when: 'CONFIG_ARM_GICV3', if_true: files('arm_gicv3_cpui= f.c')) specific_ss.add(when: 'CONFIG_ARM_GIC_KVM', if_true: files('arm_gic_kvm.c'= )) +specific_ss.add(when: ['CONFIG_WHPX', 'TARGET_AARCH64'], if_true: files('a= rm_gicv3_whpx.c')) specific_ss.add(when: ['CONFIG_ARM_GIC_KVM', 'TARGET_AARCH64'], if_true: f= iles('arm_gicv3_kvm.c', 'arm_gicv3_its_kvm.c')) arm_common_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('armv7m_nvic.c')) specific_ss.add(when: 'CONFIG_GRLIB', if_true: files('grlib_irqmp.c')) diff --git a/include/hw/intc/arm_gicv3_common.h b/include/hw/intc/arm_gicv3= _common.h index 3d24ad22d2..c55cf18120 100644 --- a/include/hw/intc/arm_gicv3_common.h +++ b/include/hw/intc/arm_gicv3_common.h @@ -313,6 +313,9 @@ typedef struct ARMGICv3CommonClass ARMGICv3CommonClass; DECLARE_OBJ_CHECKERS(GICv3State, ARMGICv3CommonClass, ARM_GICV3_COMMON, TYPE_ARM_GICV3_COMMON) =20 +/* Types for GICv3 kernel-irqchip */ +#define TYPE_WHPX_GICV3 "whpx-arm-gicv3" + struct ARMGICv3CommonClass { /*< private >*/ SysBusDeviceClass parent_class; diff --git a/include/system/whpx-internal.h b/include/system/whpx-internal.h index 609d0e1c08..8ded54a39b 100644 --- a/include/system/whpx-internal.h +++ b/include/system/whpx-internal.h @@ -45,7 +45,6 @@ struct whpx_state { =20 bool kernel_irqchip_allowed; bool kernel_irqchip_required; - bool apic_in_platform; }; =20 extern struct whpx_state whpx_global; diff --git a/include/system/whpx.h b/include/system/whpx.h index 00f6a3e523..4217a27e91 100644 --- a/include/system/whpx.h +++ b/include/system/whpx.h @@ -25,11 +25,12 @@ =20 #ifdef CONFIG_WHPX_IS_POSSIBLE extern bool whpx_allowed; +extern bool whpx_irqchip_in_kernel; #define whpx_enabled() (whpx_allowed) -bool whpx_apic_in_platform(void); +#define whpx_irqchip_in_kernel() (whpx_irqchip_in_kernel) #else /* !CONFIG_WHPX_IS_POSSIBLE */ #define whpx_enabled() 0 -#define whpx_apic_in_platform() (0) +#define whpx_irqchip_in_kernel() (0) #endif /* !CONFIG_WHPX_IS_POSSIBLE */ =20 #endif /* QEMU_WHPX_H */ diff --git a/target/i386/cpu-apic.c b/target/i386/cpu-apic.c index f7ad7b5139..eaa10ad2a3 100644 --- a/target/i386/cpu-apic.c +++ b/target/i386/cpu-apic.c @@ -33,7 +33,7 @@ APICCommonClass *apic_get_class(Error **errp) apic_type =3D "kvm-apic"; } else if (xen_enabled()) { apic_type =3D "xen-apic"; - } else if (whpx_apic_in_platform()) { + } else if (whpx_irqchip_in_kernel()) { apic_type =3D "whpx-apic"; } =20 diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index 052cda42bf..8210250dc3 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -607,7 +607,7 @@ void whpx_get_registers(CPUState *cpu) hr); } =20 - if (whpx_apic_in_platform()) { + if (whpx_irqchip_in_kernel()) { /* * Fetch the TPR value from the emulated APIC. It may get overwrit= ten * below with the value from CR8 returned by @@ -749,7 +749,7 @@ void whpx_get_registers(CPUState *cpu) =20 assert(idx =3D=3D RTL_NUMBER_OF(whpx_register_names)); =20 - if (whpx_apic_in_platform()) { + if (whpx_irqchip_in_kernel()) { whpx_apic_get(x86_cpu->apic_state); } =20 @@ -1379,7 +1379,7 @@ static void whpx_vcpu_pre_run(CPUState *cpu) } =20 /* Get pending hard interruption or replay one that was overwritten */ - if (!whpx_apic_in_platform()) { + if (!whpx_irqchip_in_kernel()) { if (!vcpu->interruption_pending && vcpu->interruptable && (env->eflags & IF_MASK)) { assert(!new_int.InterruptionPending); @@ -1553,7 +1553,7 @@ int whpx_vcpu_run(CPUState *cpu) =20 if (exclusive_step_mode =3D=3D WHPX_STEP_NONE) { whpx_vcpu_process_async_events(cpu); - if (cpu->halted && !whpx_apic_in_platform()) { + if (cpu->halted && !whpx_irqchip_in_kernel()) { cpu->exception_index =3D EXCP_HLT; qatomic_set(&cpu->exit_request, false); return 0; @@ -1642,7 +1642,7 @@ int whpx_vcpu_run(CPUState *cpu) break; =20 case WHvRunVpExitReasonX64ApicEoi: - assert(whpx_apic_in_platform()); + assert(whpx_irqchip_in_kernel()); ioapic_eoi_broadcast(vcpu->exit_ctx.ApicEoi.InterruptVector); break; =20 @@ -2187,7 +2187,7 @@ int whpx_accel_init(AccelState *as, MachineState *ms) goto error; } } else { - whpx->apic_in_platform =3D true; + whpx_irqchip_in_kernel =3D true; } } =20 @@ -2196,7 +2196,7 @@ int whpx_accel_init(AccelState *as, MachineState *ms) prop.ExtendedVmExits.X64MsrExit =3D 1; prop.ExtendedVmExits.X64CpuidExit =3D 1; prop.ExtendedVmExits.ExceptionExit =3D 1; - if (whpx_apic_in_platform()) { + if (whpx_irqchip_in_kernel()) { prop.ExtendedVmExits.X64ApicInitSipiExitTrap =3D 1; } =20 --=20 2.50.1 (Apple Git-155) From nobody Sat Feb 7 07:31:33 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=unpredictable.fr ARC-Seal: i=1; a=rsa-sha256; t=1770301928; cv=none; d=zohomail.com; s=zohoarc; b=nzxsWY45/wV7pl2ljTQvW20e4XMafhHU+bGomtQdBDd0xlfo+EmVihaKopXf2YVaOVg88wOBsdKkjog0f19wWQpN9cIUWCP3v2+ZmcA9QTZZtiQ066iIrljT6wFJlFW+r51G7CbjkVt+ms/fKVuNwrTiemX5UN+ozd55XZIUepk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770301928; h=Content-Type: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=HkRHMpTl2uKI4wNS8ZKWqrFWgjwWuAAq5M2BiLLuN7c=; b=fubFMf8DdsPq0/mDzmGRGiXVkCLKKBIR5DZ/SFmL3p7wUmn37PMLIc9Or6EBAXMIlDaE20UmcDZnmwyrnN0SUT/504eLNMyyzFClRCyS+kN2OB4HBdTJLiYx8NB/GTQyLcKVBgJ9ve9OGE/gBcjTmqVAOHbHK19gwOB0OaMvllY= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770301927587891.1252952026123; Thu, 5 Feb 2026 06:32:07 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vo0Jq-0001Cd-GV; Thu, 05 Feb 2026 09:26:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0Je-00014f-Pk for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:43 -0500 Received: from qs-2003g-snip4-3.eps.apple.com ([57.103.86.66] helo=outbound.qs.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0Ja-0007z9-36 for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:42 -0500 Received: from outbound.qs.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPS id 411921800D94; Thu, 5 Feb 2026 14:26:32 +0000 (UTC) Received: from localhost.localdomain (unknown [17.57.155.37]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPSA id 079B91800DAA; Thu, 5 Feb 2026 14:26:25 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1770301595; x=1772893595; bh=HkRHMpTl2uKI4wNS8ZKWqrFWgjwWuAAq5M2BiLLuN7c=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:x-icloud-hme; b=ALRQgfKz/zyayEJBdnoMACE7HQaJE5oG64doclQ25QV1igMOF3Gxyxe+EG849ilqw6HzhYTYqp69m5NLIBhG3OR6lVvTVYobpV5hAszTD7ghPD0FNC5ojMzx4bGUwoFRt/Q9q0P3uV2KooliMxL/MvDJGDit3vBuE0RVr6w3gedHAefF5VpC2VwHeBpodcYRJoaa/ztynzpDBqcPmO+qoOnyMJ8EZYc0C5r9Hvecl4QDbD0iDv9CnqRE+HFAcgalqsKiCmiXO4UbrkEnrUIa5KpoI9tRmc05mDXcfZDgSIJE9PhLMk2/HyTv6lK8MpaPBuxrC2UKuEjGvW6CjoWuiQ== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org, mohamed@unpredictable.fr Cc: Zhao Liu , Paolo Bonzini , Akihiko Odaki , Cameron Esfahani , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Shannon Zhao , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Phil Dennis-Jordan , "Michael S. Tsirkin" , Richard Henderson , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Alexander Graf , Pedro Barbuda , Yanan Wang , Ani Sinha , Igor Mammedov , Marcel Apfelbaum , Peter Maydell , Eduardo Habkost , Roman Bolshakov , Pierrick Bouvier Subject: [PATCH v21 14/22] whpx: add arm64 support Date: Thu, 5 Feb 2026 15:25:32 +0100 Message-ID: <20260205142543.64818-15-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260205142543.64818-1-mohamed@unpredictable.fr> References: <20260205142543.64818-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Authority-Info-Out: v=2.4 cv=AIp8DMUn c=1 sm=1 tr=0 ts=6984a89a cx=c_apl:c_apl_out:c_pps a=bsP7O+dXZ5uKcj+dsLqiMw==:117 a=bsP7O+dXZ5uKcj+dsLqiMw==:17 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=coTCL0kfoV_fbKzCm0sA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-GUID: bv3gTa5u23C5GWh3fyGFpP8t921CH0eN X-Proofpoint-ORIG-GUID: bv3gTa5u23C5GWh3fyGFpP8t921CH0eN X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjA1MDEwOCBTYWx0ZWRfXzHpIfEc2EyhA cf56cjLEx5p2cEniTMCGRrDLgTK+wZQNfBNVFH6OeFBNfZDBigfcJLlH3Ew/EdMZp6e5AR6mW9Q uNo1vKzWl0Fnlpe2amAQZKdv1aBOfW7ZnZL016yuIaFPrKP2KVss3CM3thFnsnLZq9xAhookE0k K/n1R83Sy3619MZeiTX5Ie8SednPt1h7vWOBnoym8wm3fLmR/N7VNsMGp5i1RE1/r+Vw2b225Lq 5IqVBMQ4IXtwDT5LnHIVGLL3BJ7PxcCvUTuOiop0I4iSA5WrllQvKgbhcofOu5z3WFYqDiJ+GO7 ADdBiozlA2CR8WAeUkOJi4jnmxskzKtrh0gMuHyNJor4ObwbdUOP5yDsTXmyQ4= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-05_03,2026-02-05_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 malwarescore=0 phishscore=0 lowpriorityscore=0 adultscore=0 mlxlogscore=999 spamscore=0 suspectscore=0 mlxscore=0 clxscore=1030 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602050108 X-JNJ: AAAAAAAB51jWS8+Sil+dHWyX5FBnUG9OBl9al6nLWtpmJc/thkQ9zi8Y7bt3eDI2plvRDtwAwxZxX5yMVPUXAvRGAi6YGpNSfcjirX8ygyrPzoP58I+nXMFN+gniM4dzLVANEgPb7FP/ttE1l2CPCunue24ZnWcjszEdDANGEkNku6CjQfufljJJG55RjO6wu+RoE/M6tdfCwSHzc23v0N4dv0QeWsReQAzeoSYWFy4mFNBJctGNC1biVY0A00Luc6R710nNi4r1DoTYQ3w4GjO5aQlhFKADeSz5niLzjzAgeGfsX+jnASaLGi4KjPonLdHPQFiHKcPwMXW2PfF6PXTg0ZNP3z9hDOjJTOsGNJlCyFtxwR+IeNxV5EJSTlykG11tEkLDoBaI5Zxzn6bWayQW7fnLHAkhxtt1WVKxdcOKdZdUI6MgLS90WJ1E8IZJuiaHbXo+SrQM+TbLkuOjvGiC7JaLgxFQjbsems8zi+5Ja0oXgNPuku6TdhodpqyPkF6oF/zCHWDYzLdlqSEjPxlqxmlZE+USQvqZaHbRZm7lFLBRn65e4JbInkqv0xJgdrVvqUxEYT35m0mVgd6tivMKVNIVV03PasozhtWgjyorC1a2M3s2GfST91GGr+kog3TfQBSThQFPNDR8f+/K5ytCR8LWiNdcg6ldVNTirWEKu9ncs/tJhMd5lSocJ91QTvJV6Mif5Uz+KgKCtRWjEGi2kbmNsV3/VeYdUte9kFaeKI6iJucmRLWJivSkCvQ/svyu4KP0JR6FZ3BN22MWPeMmBwb/8oyfCZZGWMNhNIOhS2oALLVVuMa1U19Gd9wDEuFw6G8N60Omlj9PBo2NYKxMq5cylAGLbmif/XXP4hRD5W5qdMC94W3HkcdC67VHh2omDho6ykWT1xRRo66+rl0ESuZ/FdJ4S934wfc5eV1WL5Pank3rCErNyZAJpr9UgQ== 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=lists.gnu.org; Received-SPF: pass client-ip=57.103.86.66; envelope-from=mohamed@unpredictable.fr; helo=outbound.qs.icloud.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @unpredictable.fr) X-ZM-MESSAGEID: 1770301930241158500 Signed-off-by: Mohamed Mediouni Reviewed-by: Pierrick Bouvier --- MAINTAINERS | 1 + accel/whpx/whpx-common.c | 1 + target/arm/meson.build | 1 + target/arm/whpx/meson.build | 3 + target/arm/whpx/whpx-all.c | 810 ++++++++++++++++++++++++++++++++++++ 5 files changed, 816 insertions(+) create mode 100644 target/arm/whpx/meson.build create mode 100644 target/arm/whpx/whpx-all.c diff --git a/MAINTAINERS b/MAINTAINERS index 126f72e587..a92cd7050f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -566,6 +566,7 @@ M: Mohamed Mediouni S: Supported F: accel/whpx/ F: target/i386/whpx/ +F: target/arm/whpx/ F: hw/intc/arm_gicv3_whpx.c F: accel/stubs/whpx-stub.c F: include/system/whpx.h diff --git a/accel/whpx/whpx-common.c b/accel/whpx/whpx-common.c index 05f9e520b7..827f50f3e0 100644 --- a/accel/whpx/whpx-common.c +++ b/accel/whpx/whpx-common.c @@ -12,6 +12,7 @@ #include "gdbstub/helpers.h" #include "qemu/accel.h" #include "accel/accel-ops.h" +#include "system/memory.h" #include "system/whpx.h" #include "system/cpus.h" #include "system/runstate.h" diff --git a/target/arm/meson.build b/target/arm/meson.build index 462c71148d..ce155ba9b4 100644 --- a/target/arm/meson.build +++ b/target/arm/meson.build @@ -59,6 +59,7 @@ arm_common_system_ss.add(files( )) =20 subdir('hvf') +subdir('whpx') =20 if 'CONFIG_TCG' in config_all_accel subdir('tcg') diff --git a/target/arm/whpx/meson.build b/target/arm/whpx/meson.build new file mode 100644 index 0000000000..1de2ef0283 --- /dev/null +++ b/target/arm/whpx/meson.build @@ -0,0 +1,3 @@ +arm_system_ss.add(when: 'CONFIG_WHPX', if_true: files( + 'whpx-all.c', +)) diff --git a/target/arm/whpx/whpx-all.c b/target/arm/whpx/whpx-all.c new file mode 100644 index 0000000000..192d7ec7a8 --- /dev/null +++ b/target/arm/whpx/whpx-all.c @@ -0,0 +1,810 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * QEMU Windows Hypervisor Platform accelerator (WHPX) + * + * Copyright (c) 2025 Mohamed Mediouni + * + */ + +#include "qemu/osdep.h" +#include "cpu.h" +#include "system/address-spaces.h" +#include "system/ioport.h" +#include "gdbstub/helpers.h" +#include "qemu/accel.h" +#include "accel/accel-ops.h" +#include "system/whpx.h" +#include "system/cpus.h" +#include "system/runstate.h" +#include "qemu/main-loop.h" +#include "hw/core/boards.h" +#include "qemu/error-report.h" +#include "qapi/error.h" +#include "qapi/qapi-types-common.h" +#include "qapi/qapi-visit-common.h" +#include "migration/blocker.h" +#include "accel/accel-cpu-target.h" +#include + +#include "syndrome.h" +#include "cpu.h" +#include "target/arm/cpregs.h" +#include "internals.h" + +#include "system/whpx-internal.h" +#include "system/whpx-accel-ops.h" +#include "system/whpx-all.h" +#include "system/whpx-common.h" +#include "hw/arm/bsa.h" +#include "arm-powerctl.h" + +#include +#include + +typedef struct WHPXRegMatch { + WHV_REGISTER_NAME reg; + uint64_t offset; +} WHPXRegMatch; + +static const WHPXRegMatch whpx_reg_match[] =3D { + { WHvArm64RegisterX0, offsetof(CPUARMState, xregs[0]) }, + { WHvArm64RegisterX1, offsetof(CPUARMState, xregs[1]) }, + { WHvArm64RegisterX2, offsetof(CPUARMState, xregs[2]) }, + { WHvArm64RegisterX3, offsetof(CPUARMState, xregs[3]) }, + { WHvArm64RegisterX4, offsetof(CPUARMState, xregs[4]) }, + { WHvArm64RegisterX5, offsetof(CPUARMState, xregs[5]) }, + { WHvArm64RegisterX6, offsetof(CPUARMState, xregs[6]) }, + { WHvArm64RegisterX7, offsetof(CPUARMState, xregs[7]) }, + { WHvArm64RegisterX8, offsetof(CPUARMState, xregs[8]) }, + { WHvArm64RegisterX9, offsetof(CPUARMState, xregs[9]) }, + { WHvArm64RegisterX10, offsetof(CPUARMState, xregs[10]) }, + { WHvArm64RegisterX11, offsetof(CPUARMState, xregs[11]) }, + { WHvArm64RegisterX12, offsetof(CPUARMState, xregs[12]) }, + { WHvArm64RegisterX13, offsetof(CPUARMState, xregs[13]) }, + { WHvArm64RegisterX14, offsetof(CPUARMState, xregs[14]) }, + { WHvArm64RegisterX15, offsetof(CPUARMState, xregs[15]) }, + { WHvArm64RegisterX16, offsetof(CPUARMState, xregs[16]) }, + { WHvArm64RegisterX17, offsetof(CPUARMState, xregs[17]) }, + { WHvArm64RegisterX18, offsetof(CPUARMState, xregs[18]) }, + { WHvArm64RegisterX19, offsetof(CPUARMState, xregs[19]) }, + { WHvArm64RegisterX20, offsetof(CPUARMState, xregs[20]) }, + { WHvArm64RegisterX21, offsetof(CPUARMState, xregs[21]) }, + { WHvArm64RegisterX22, offsetof(CPUARMState, xregs[22]) }, + { WHvArm64RegisterX23, offsetof(CPUARMState, xregs[23]) }, + { WHvArm64RegisterX24, offsetof(CPUARMState, xregs[24]) }, + { WHvArm64RegisterX25, offsetof(CPUARMState, xregs[25]) }, + { WHvArm64RegisterX26, offsetof(CPUARMState, xregs[26]) }, + { WHvArm64RegisterX27, offsetof(CPUARMState, xregs[27]) }, + { WHvArm64RegisterX28, offsetof(CPUARMState, xregs[28]) }, + { WHvArm64RegisterFp, offsetof(CPUARMState, xregs[29]) }, + { WHvArm64RegisterLr, offsetof(CPUARMState, xregs[30]) }, + { WHvArm64RegisterPc, offsetof(CPUARMState, pc) }, +}; + +static const WHPXRegMatch whpx_fpreg_match[] =3D { + { WHvArm64RegisterQ0, offsetof(CPUARMState, vfp.zregs[0]) }, + { WHvArm64RegisterQ1, offsetof(CPUARMState, vfp.zregs[1]) }, + { WHvArm64RegisterQ2, offsetof(CPUARMState, vfp.zregs[2]) }, + { WHvArm64RegisterQ3, offsetof(CPUARMState, vfp.zregs[3]) }, + { WHvArm64RegisterQ4, offsetof(CPUARMState, vfp.zregs[4]) }, + { WHvArm64RegisterQ5, offsetof(CPUARMState, vfp.zregs[5]) }, + { WHvArm64RegisterQ6, offsetof(CPUARMState, vfp.zregs[6]) }, + { WHvArm64RegisterQ7, offsetof(CPUARMState, vfp.zregs[7]) }, + { WHvArm64RegisterQ8, offsetof(CPUARMState, vfp.zregs[8]) }, + { WHvArm64RegisterQ9, offsetof(CPUARMState, vfp.zregs[9]) }, + { WHvArm64RegisterQ10, offsetof(CPUARMState, vfp.zregs[10]) }, + { WHvArm64RegisterQ11, offsetof(CPUARMState, vfp.zregs[11]) }, + { WHvArm64RegisterQ12, offsetof(CPUARMState, vfp.zregs[12]) }, + { WHvArm64RegisterQ13, offsetof(CPUARMState, vfp.zregs[13]) }, + { WHvArm64RegisterQ14, offsetof(CPUARMState, vfp.zregs[14]) }, + { WHvArm64RegisterQ15, offsetof(CPUARMState, vfp.zregs[15]) }, + { WHvArm64RegisterQ16, offsetof(CPUARMState, vfp.zregs[16]) }, + { WHvArm64RegisterQ17, offsetof(CPUARMState, vfp.zregs[17]) }, + { WHvArm64RegisterQ18, offsetof(CPUARMState, vfp.zregs[18]) }, + { WHvArm64RegisterQ19, offsetof(CPUARMState, vfp.zregs[19]) }, + { WHvArm64RegisterQ20, offsetof(CPUARMState, vfp.zregs[20]) }, + { WHvArm64RegisterQ21, offsetof(CPUARMState, vfp.zregs[21]) }, + { WHvArm64RegisterQ22, offsetof(CPUARMState, vfp.zregs[22]) }, + { WHvArm64RegisterQ23, offsetof(CPUARMState, vfp.zregs[23]) }, + { WHvArm64RegisterQ24, offsetof(CPUARMState, vfp.zregs[24]) }, + { WHvArm64RegisterQ25, offsetof(CPUARMState, vfp.zregs[25]) }, + { WHvArm64RegisterQ26, offsetof(CPUARMState, vfp.zregs[26]) }, + { WHvArm64RegisterQ27, offsetof(CPUARMState, vfp.zregs[27]) }, + { WHvArm64RegisterQ28, offsetof(CPUARMState, vfp.zregs[28]) }, + { WHvArm64RegisterQ29, offsetof(CPUARMState, vfp.zregs[29]) }, + { WHvArm64RegisterQ30, offsetof(CPUARMState, vfp.zregs[30]) }, + { WHvArm64RegisterQ31, offsetof(CPUARMState, vfp.zregs[31]) }, +}; + +struct whpx_sreg_match { + WHV_REGISTER_NAME reg; + uint32_t key; + bool global; + uint32_t cp_idx; +}; + +static struct whpx_sreg_match whpx_sreg_match[] =3D { + { WHvArm64RegisterDbgbvr0El1, ENCODE_AA64_CP_REG(0, 0, 2, 0, 4) }, + { WHvArm64RegisterDbgbcr0El1, ENCODE_AA64_CP_REG(0, 0, 2, 0, 5) }, + { WHvArm64RegisterDbgwvr0El1, ENCODE_AA64_CP_REG(0, 0, 2, 0, 6) }, + { WHvArm64RegisterDbgwcr0El1, ENCODE_AA64_CP_REG(0, 0, 2, 0, 7) }, + + { WHvArm64RegisterDbgbvr0El1, ENCODE_AA64_CP_REG(0, 1, 2, 0, 4) }, + { WHvArm64RegisterDbgbcr0El1, ENCODE_AA64_CP_REG(0, 1, 2, 0, 5) }, + { WHvArm64RegisterDbgwvr0El1, ENCODE_AA64_CP_REG(0, 1, 2, 0, 6) }, + { WHvArm64RegisterDbgwcr0El1, ENCODE_AA64_CP_REG(0, 1, 2, 0, 7) }, + + { WHvArm64RegisterDbgbvr2El1, ENCODE_AA64_CP_REG(0, 2, 2, 0, 4) }, + { WHvArm64RegisterDbgbcr2El1, ENCODE_AA64_CP_REG(0, 2, 2, 0, 5) }, + { WHvArm64RegisterDbgwvr2El1, ENCODE_AA64_CP_REG(0, 2, 2, 0, 6) }, + { WHvArm64RegisterDbgwcr2El1, ENCODE_AA64_CP_REG(0, 2, 2, 0, 7) }, + + { WHvArm64RegisterDbgbvr3El1, ENCODE_AA64_CP_REG(0, 3, 2, 0, 4) }, + { WHvArm64RegisterDbgbcr3El1, ENCODE_AA64_CP_REG(0, 3, 2, 0, 5) }, + { WHvArm64RegisterDbgwvr3El1, ENCODE_AA64_CP_REG(0, 3, 2, 0, 6) }, + { WHvArm64RegisterDbgwcr3El1, ENCODE_AA64_CP_REG(0, 3, 2, 0, 7) }, + + { WHvArm64RegisterDbgbvr4El1, ENCODE_AA64_CP_REG(0, 4, 2, 0, 4) }, + { WHvArm64RegisterDbgbcr4El1, ENCODE_AA64_CP_REG(0, 4, 2, 0, 5) }, + { WHvArm64RegisterDbgwvr4El1, ENCODE_AA64_CP_REG(0, 4, 2, 0, 6) }, + { WHvArm64RegisterDbgwcr4El1, ENCODE_AA64_CP_REG(0, 4, 2, 0, 7) }, + + { WHvArm64RegisterDbgbvr5El1, ENCODE_AA64_CP_REG(0, 5, 2, 0, 4) }, + { WHvArm64RegisterDbgbcr5El1, ENCODE_AA64_CP_REG(0, 5, 2, 0, 5) }, + { WHvArm64RegisterDbgwvr5El1, ENCODE_AA64_CP_REG(0, 5, 2, 0, 6) }, + { WHvArm64RegisterDbgwcr5El1, ENCODE_AA64_CP_REG(0, 5, 2, 0, 7) }, + + { WHvArm64RegisterDbgbvr6El1, ENCODE_AA64_CP_REG(0, 6, 2, 0, 4) }, + { WHvArm64RegisterDbgbcr6El1, ENCODE_AA64_CP_REG(0, 6, 2, 0, 5) }, + { WHvArm64RegisterDbgwvr6El1, ENCODE_AA64_CP_REG(0, 6, 2, 0, 6) }, + { WHvArm64RegisterDbgwcr6El1, ENCODE_AA64_CP_REG(0, 6, 2, 0, 7) }, + + { WHvArm64RegisterDbgbvr7El1, ENCODE_AA64_CP_REG(0, 7, 2, 0, 4) }, + { WHvArm64RegisterDbgbcr7El1, ENCODE_AA64_CP_REG(0, 7, 2, 0, 5) }, + { WHvArm64RegisterDbgwvr7El1, ENCODE_AA64_CP_REG(0, 7, 2, 0, 6) }, + { WHvArm64RegisterDbgwcr7El1, ENCODE_AA64_CP_REG(0, 7, 2, 0, 7) }, + + { WHvArm64RegisterDbgbvr8El1, ENCODE_AA64_CP_REG(0, 8, 2, 0, 4) }, + { WHvArm64RegisterDbgbcr8El1, ENCODE_AA64_CP_REG(0, 8, 2, 0, 5) }, + { WHvArm64RegisterDbgwvr8El1, ENCODE_AA64_CP_REG(0, 8, 2, 0, 6) }, + { WHvArm64RegisterDbgwcr8El1, ENCODE_AA64_CP_REG(0, 8, 2, 0, 7) }, + + { WHvArm64RegisterDbgbvr9El1, ENCODE_AA64_CP_REG(0, 9, 2, 0, 4) }, + { WHvArm64RegisterDbgbcr9El1, ENCODE_AA64_CP_REG(0, 9, 2, 0, 5) }, + { WHvArm64RegisterDbgwvr9El1, ENCODE_AA64_CP_REG(0, 9, 2, 0, 6) }, + { WHvArm64RegisterDbgwcr9El1, ENCODE_AA64_CP_REG(0, 9, 2, 0, 7) }, + + { WHvArm64RegisterDbgbvr10El1, ENCODE_AA64_CP_REG(0, 10, 2, 0, 4) }, + { WHvArm64RegisterDbgbcr10El1, ENCODE_AA64_CP_REG(0, 10, 2, 0, 5) }, + { WHvArm64RegisterDbgwvr10El1, ENCODE_AA64_CP_REG(0, 10, 2, 0, 6) }, + { WHvArm64RegisterDbgwcr10El1, ENCODE_AA64_CP_REG(0, 10, 2, 0, 7) }, + + { WHvArm64RegisterDbgbvr11El1, ENCODE_AA64_CP_REG(0, 11, 2, 0, 4) }, + { WHvArm64RegisterDbgbcr11El1, ENCODE_AA64_CP_REG(0, 11, 2, 0, 5) }, + { WHvArm64RegisterDbgwvr11El1, ENCODE_AA64_CP_REG(0, 11, 2, 0, 6) }, + { WHvArm64RegisterDbgwcr11El1, ENCODE_AA64_CP_REG(0, 11, 2, 0, 7) }, + + { WHvArm64RegisterDbgbvr12El1, ENCODE_AA64_CP_REG(0, 12, 2, 0, 4) }, + { WHvArm64RegisterDbgbcr12El1, ENCODE_AA64_CP_REG(0, 12, 2, 0, 5) }, + { WHvArm64RegisterDbgwvr12El1, ENCODE_AA64_CP_REG(0, 12, 2, 0, 6) }, + { WHvArm64RegisterDbgwcr12El1, ENCODE_AA64_CP_REG(0, 12, 2, 0, 7) }, + + { WHvArm64RegisterDbgbvr13El1, ENCODE_AA64_CP_REG(0, 13, 2, 0, 4) }, + { WHvArm64RegisterDbgbcr13El1, ENCODE_AA64_CP_REG(0, 13, 2, 0, 5) }, + { WHvArm64RegisterDbgwvr13El1, ENCODE_AA64_CP_REG(0, 13, 2, 0, 6) }, + { WHvArm64RegisterDbgwcr13El1, ENCODE_AA64_CP_REG(0, 13, 2, 0, 7) }, + + { WHvArm64RegisterDbgbvr14El1, ENCODE_AA64_CP_REG(0, 14, 2, 0, 4) }, + { WHvArm64RegisterDbgbcr14El1, ENCODE_AA64_CP_REG(0, 14, 2, 0, 5) }, + { WHvArm64RegisterDbgwvr14El1, ENCODE_AA64_CP_REG(0, 14, 2, 0, 6) }, + { WHvArm64RegisterDbgwcr14El1, ENCODE_AA64_CP_REG(0, 14, 2, 0, 7) }, + + { WHvArm64RegisterDbgbvr15El1, ENCODE_AA64_CP_REG(0, 15, 2, 0, 4) }, + { WHvArm64RegisterDbgbcr15El1, ENCODE_AA64_CP_REG(0, 15, 2, 0, 5) }, + { WHvArm64RegisterDbgwvr15El1, ENCODE_AA64_CP_REG(0, 15, 2, 0, 6) }, + { WHvArm64RegisterDbgwcr15El1, ENCODE_AA64_CP_REG(0, 15, 2, 0, 7) }, +#ifdef SYNC_NO_RAW_REGS + /* + * The registers below are manually synced on init because they are + * marked as NO_RAW. We still list them to make number space sync easi= er. + */ + { WHvArm64RegisterMidrEl1, ENCODE_AA64_CP_REG(0, 0, 3, 0, 0) }, + { WHvArm64RegisterMpidrEl1, ENCODE_AA64_CP_REG(0, 0, 3, 0, 5) }, + { WHvArm64RegisterIdPfr0El1, ENCODE_AA64_CP_REG(0, 4, 3, 0, 0) }, +#endif + { WHvArm64RegisterIdAa64Pfr1El1, ENCODE_AA64_CP_REG(0, 4, 3, 0, 1), tr= ue }, + { WHvArm64RegisterIdAa64Dfr0El1, ENCODE_AA64_CP_REG(0, 5, 3, 0, 0), tr= ue }, + { WHvArm64RegisterIdAa64Dfr1El1, ENCODE_AA64_CP_REG(0, 5, 3, 0, 1), tr= ue }, + { WHvArm64RegisterIdAa64Isar0El1, ENCODE_AA64_CP_REG(0, 6, 3, 0, 0), t= rue }, + { WHvArm64RegisterIdAa64Isar1El1, ENCODE_AA64_CP_REG(0, 6, 3, 0, 1), t= rue }, +#ifdef SYNC_NO_MMFR0 + /* We keep the hardware MMFR0 around. HW limits are there anyway */ + { WHvArm64RegisterIdAa64Mmfr0El1, ENCODE_AA64_CP_REG(0, 7, 3, 0, 0) }, +#endif + { WHvArm64RegisterIdAa64Mmfr1El1, ENCODE_AA64_CP_REG(0, 7, 3, 0, 1), t= rue }, + { WHvArm64RegisterIdAa64Mmfr2El1, ENCODE_AA64_CP_REG(0, 7, 3, 0, 2), t= rue }, + { WHvArm64RegisterIdAa64Mmfr3El1, ENCODE_AA64_CP_REG(0, 7, 3, 0, 3), t= rue }, + + { WHvArm64RegisterMdscrEl1, ENCODE_AA64_CP_REG(0, 2, 2, 0, 2) }, + { WHvArm64RegisterSctlrEl1, ENCODE_AA64_CP_REG(1, 0, 3, 0, 0) }, + { WHvArm64RegisterCpacrEl1, ENCODE_AA64_CP_REG(1, 0, 3, 0, 2) }, + { WHvArm64RegisterTtbr0El1, ENCODE_AA64_CP_REG(2, 0, 3, 0, 0) }, + { WHvArm64RegisterTtbr1El1, ENCODE_AA64_CP_REG(2, 0, 3, 0, 1) }, + { WHvArm64RegisterTcrEl1, ENCODE_AA64_CP_REG(2, 0, 3, 0, 2) }, + + { WHvArm64RegisterApiAKeyLoEl1, ENCODE_AA64_CP_REG(2, 1, 3, 0, 0) }, + { WHvArm64RegisterApiAKeyHiEl1, ENCODE_AA64_CP_REG(2, 1, 3, 0, 1) }, + { WHvArm64RegisterApiBKeyLoEl1, ENCODE_AA64_CP_REG(2, 1, 3, 0, 2) }, + { WHvArm64RegisterApiBKeyHiEl1, ENCODE_AA64_CP_REG(2, 1, 3, 0, 3) }, + { WHvArm64RegisterApdAKeyLoEl1, ENCODE_AA64_CP_REG(2, 2, 3, 0, 0) }, + { WHvArm64RegisterApdAKeyHiEl1, ENCODE_AA64_CP_REG(2, 2, 3, 0, 1) }, + { WHvArm64RegisterApdBKeyLoEl1, ENCODE_AA64_CP_REG(2, 2, 3, 0, 2) }, + { WHvArm64RegisterApdBKeyHiEl1, ENCODE_AA64_CP_REG(2, 2, 3, 0, 3) }, + { WHvArm64RegisterApgAKeyLoEl1, ENCODE_AA64_CP_REG(2, 3, 3, 0, 0) }, + { WHvArm64RegisterApgAKeyHiEl1, ENCODE_AA64_CP_REG(2, 3, 3, 0, 1) }, + + { WHvArm64RegisterSpsrEl1, ENCODE_AA64_CP_REG(4, 0, 3, 0, 0) }, + { WHvArm64RegisterElrEl1, ENCODE_AA64_CP_REG(4, 0, 3, 0, 1) }, + { WHvArm64RegisterSpEl1, ENCODE_AA64_CP_REG(4, 1, 3, 0, 0) }, + { WHvArm64RegisterEsrEl1, ENCODE_AA64_CP_REG(5, 2, 3, 0, 0) }, + { WHvArm64RegisterFarEl1, ENCODE_AA64_CP_REG(6, 0, 3, 0, 0) }, + { WHvArm64RegisterParEl1, ENCODE_AA64_CP_REG(7, 4, 3, 0, 0) }, + { WHvArm64RegisterMairEl1, ENCODE_AA64_CP_REG(10, 2, 3, 0, 0) }, + { WHvArm64RegisterVbarEl1, ENCODE_AA64_CP_REG(12, 0, 3, 0, 0) }, + { WHvArm64RegisterContextidrEl1, ENCODE_AA64_CP_REG(13, 0, 3, 0, 1) }, + { WHvArm64RegisterTpidrEl1, ENCODE_AA64_CP_REG(13, 0, 3, 0, 4) }, + { WHvArm64RegisterCntkctlEl1, ENCODE_AA64_CP_REG(14, 1, 3, 0, 0) }, + { WHvArm64RegisterCsselrEl1, ENCODE_AA64_CP_REG(0, 0, 3, 2, 0) }, + { WHvArm64RegisterTpidrEl0, ENCODE_AA64_CP_REG(13, 0, 3, 3, 2) }, + { WHvArm64RegisterTpidrroEl0, ENCODE_AA64_CP_REG(13, 0, 3, 3, 3) }, + { WHvArm64RegisterCntvCtlEl0, ENCODE_AA64_CP_REG(14, 3, 3, 3, 1) }, + { WHvArm64RegisterCntvCvalEl0, ENCODE_AA64_CP_REG(14, 3, 3, 3, 2) }, + { WHvArm64RegisterSpEl1, ENCODE_AA64_CP_REG(4, 1, 3, 4, 0) }, +}; + +static void flush_cpu_state(CPUState *cpu) +{ + if (cpu->vcpu_dirty) { + whpx_set_registers(cpu, WHPX_SET_RUNTIME_STATE); + cpu->vcpu_dirty =3D false; + } +} + +HRESULT whpx_set_exception_exit_bitmap(UINT64 exceptions) +{ + if (exceptions !=3D 0) { + return E_NOTIMPL; + } + return ERROR_SUCCESS; +} +void whpx_apply_breakpoints( + struct whpx_breakpoint_collection *breakpoints, + CPUState *cpu, + bool resuming) +{ + /* Breakpoints aren=E2=80=99t supported on this platform */ +} +void whpx_translate_cpu_breakpoints( + struct whpx_breakpoints *breakpoints, + CPUState *cpu, + int cpu_breakpoint_count) +{ + /* Breakpoints aren=E2=80=99t supported on this platform */ +} + +static void whpx_get_reg(CPUState *cpu, WHV_REGISTER_NAME reg, WHV_REGISTE= R_VALUE* val) +{ + struct whpx_state *whpx =3D &whpx_global; + HRESULT hr; + + flush_cpu_state(cpu); + + hr =3D whp_dispatch.WHvGetVirtualProcessorRegisters(whpx->partition, c= pu->cpu_index, + ®, 1, val); + + if (FAILED(hr)) { + error_report("WHPX: Failed to get register %08x, hr=3D%08lx", reg,= hr); + } +} + +static void whpx_set_reg(CPUState *cpu, WHV_REGISTER_NAME reg, WHV_REGISTE= R_VALUE val) +{ + struct whpx_state *whpx =3D &whpx_global; + HRESULT hr; + hr =3D whp_dispatch.WHvSetVirtualProcessorRegisters(whpx->partition, c= pu->cpu_index, + ®, 1, &val); + + if (FAILED(hr)) { + error_report("WHPX: Failed to set register %08x, hr=3D%08lx", reg,= hr); + } +} + +static void whpx_get_global_reg(WHV_REGISTER_NAME reg, WHV_REGISTER_VALUE = *val) +{ + struct whpx_state *whpx =3D &whpx_global; + HRESULT hr; + + hr =3D whp_dispatch.WHvGetVirtualProcessorRegisters(whpx->partition, W= HV_ANY_VP, + ®, 1, val); + + if (FAILED(hr)) { + error_report("WHPX: Failed to get register %08x, hr=3D%08lx", reg,= hr); + } +} + +static void whpx_set_global_reg(WHV_REGISTER_NAME reg, WHV_REGISTER_VALUE = val) +{ + struct whpx_state *whpx =3D &whpx_global; + HRESULT hr; + hr =3D whp_dispatch.WHvSetVirtualProcessorRegisters(whpx->partition, W= HV_ANY_VP, + ®, 1, &val); + + if (FAILED(hr)) { + error_report("WHPX: Failed to set register %08x, hr=3D%08lx", reg,= hr); + } +} + +static uint64_t whpx_get_gp_reg(CPUState *cpu, int rt) +{ + assert(rt <=3D 31); + if (rt =3D=3D 31) { + return 0; + } + WHV_REGISTER_NAME reg =3D WHvArm64RegisterX0 + rt; + WHV_REGISTER_VALUE val; + whpx_get_reg(cpu, reg, &val); + + return val.Reg64; +} + +static void whpx_set_gp_reg(CPUState *cpu, int rt, uint64_t val) +{ + assert(rt < 31); + WHV_REGISTER_NAME reg =3D WHvArm64RegisterX0 + rt; + WHV_REGISTER_VALUE reg_val =3D {.Reg64 =3D val}; + + whpx_set_reg(cpu, reg, reg_val); +} + +static int whpx_handle_mmio(CPUState *cpu, WHV_MEMORY_ACCESS_CONTEXT *ctx) +{ + uint64_t syndrome =3D ctx->Syndrome; + + bool isv =3D syndrome & ARM_EL_ISV; + bool iswrite =3D (syndrome >> 6) & 1; + bool sse =3D (syndrome >> 21) & 1; + uint32_t sas =3D (syndrome >> 22) & 3; + uint32_t len =3D 1 << sas; + uint32_t srt =3D (syndrome >> 16) & 0x1f; + uint32_t cm =3D (syndrome >> 8) & 0x1; + uint64_t val =3D 0; + + assert(!cm); + assert(isv); + + if (iswrite) { + val =3D whpx_get_gp_reg(cpu, srt); + address_space_write(&address_space_memory, + ctx->Gpa, + MEMTXATTRS_UNSPECIFIED, &val, len); + } else { + address_space_read(&address_space_memory, + ctx->Gpa, + MEMTXATTRS_UNSPECIFIED, &val, len); + if (sse) { + val =3D sextract64(val, 0, len * 8); + } + whpx_set_gp_reg(cpu, srt, val); + } + + return 0; +} + +static void whpx_psci_cpu_off(ARMCPU *arm_cpu) +{ + int32_t ret =3D arm_set_cpu_off(arm_cpu_mp_affinity(arm_cpu)); + assert(ret =3D=3D QEMU_ARM_POWERCTL_RET_SUCCESS); +} + +int whpx_vcpu_run(CPUState *cpu) +{ + HRESULT hr; + struct whpx_state *whpx =3D &whpx_global; + ARMCPU *arm_cpu =3D ARM_CPU(cpu); + AccelCPUState *vcpu =3D cpu->accel; + int ret; + + + g_assert(bql_locked()); + + if (whpx->running_cpus++ =3D=3D 0) { + ret =3D whpx_first_vcpu_starting(cpu); + if (ret !=3D 0) { + return ret; + } + } + + bql_unlock(); + + + cpu_exec_start(cpu); + do { + bool advance_pc =3D false; + if (cpu->vcpu_dirty) { + whpx_set_registers(cpu, WHPX_SET_RUNTIME_STATE); + cpu->vcpu_dirty =3D false; + } + + if (qatomic_read(&cpu->exit_request)) { + whpx_vcpu_kick(cpu); + } + + hr =3D whp_dispatch.WHvRunVirtualProcessor( + whpx->partition, cpu->cpu_index, + &vcpu->exit_ctx, sizeof(vcpu->exit_ctx)); + + if (FAILED(hr)) { + error_report("WHPX: Failed to exec a virtual processor," + " hr=3D%08lx", hr); + ret =3D -1; + break; + } + + switch (vcpu->exit_ctx.ExitReason) { + case WHvRunVpExitReasonGpaIntercept: + case WHvRunVpExitReasonUnmappedGpa: + advance_pc =3D true; + + if (vcpu->exit_ctx.MemoryAccess.Syndrome & BIT(8)) { + error_report("WHPX: cached access to unmapped memory" + "Pc =3D 0x%llx Gva =3D 0x%llx Gpa =3D 0x%llx", + vcpu->exit_ctx.MemoryAccess.Header.Pc, + vcpu->exit_ctx.MemoryAccess.Gpa, + vcpu->exit_ctx.MemoryAccess.Gva); + break; + } + + ret =3D whpx_handle_mmio(cpu, &vcpu->exit_ctx.MemoryAccess); + break; + case WHvRunVpExitReasonCanceled: + cpu->exception_index =3D EXCP_INTERRUPT; + ret =3D 1; + break; + case WHvRunVpExitReasonArm64Reset: + switch (vcpu->exit_ctx.Arm64Reset.ResetType) { + case WHvArm64ResetTypePowerOff: + qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN= ); + break; + case WHvArm64ResetTypeReboot: + qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); + break; + default: + g_assert_not_reached(); + } + bql_lock(); + if (arm_cpu->power_state !=3D PSCI_OFF) { + whpx_psci_cpu_off(arm_cpu); + } + bql_unlock(); + break; + case WHvRunVpExitReasonNone: + case WHvRunVpExitReasonUnrecoverableException: + case WHvRunVpExitReasonInvalidVpRegisterValue: + case WHvRunVpExitReasonUnsupportedFeature: + default: + error_report("WHPX: Unexpected VP exit code 0x%08x", + vcpu->exit_ctx.ExitReason); + whpx_get_registers(cpu); + bql_lock(); + qemu_system_guest_panicked(cpu_get_crash_info(cpu)); + bql_unlock(); + break; + } + if (advance_pc) { + WHV_REGISTER_VALUE pc; + + flush_cpu_state(cpu); + pc.Reg64 =3D vcpu->exit_ctx.MemoryAccess.Header.Pc + 4; + whpx_set_reg(cpu, WHvArm64RegisterPc, pc); + } + } while (!ret); + + cpu_exec_end(cpu); + + bql_lock(); + current_cpu =3D cpu; + + if (--whpx->running_cpus =3D=3D 0) { + whpx_last_vcpu_stopping(cpu); + } + + qatomic_set(&cpu->exit_request, false); + + return ret < 0; +} + +static void clean_whv_register_value(WHV_REGISTER_VALUE *val) +{ + memset(val, 0, sizeof(WHV_REGISTER_VALUE)); +} + +void whpx_get_registers(CPUState *cpu) +{ + ARMCPU *arm_cpu =3D ARM_CPU(cpu); + CPUARMState *env =3D &arm_cpu->env; + WHV_REGISTER_VALUE val; + int i; + + for (i =3D 0; i < ARRAY_SIZE(whpx_reg_match); i++) { + whpx_get_reg(cpu, whpx_reg_match[i].reg, &val); + *(uint64_t *)((char *)env + whpx_reg_match[i].offset) =3D val.Reg6= 4; + } + + for (i =3D 0; i < ARRAY_SIZE(whpx_fpreg_match); i++) { + whpx_get_reg(cpu, whpx_reg_match[i].reg, &val); + memcpy((char *)env + whpx_fpreg_match[i].offset, &val, sizeof(val.= Reg128)); + } + + whpx_get_reg(cpu, WHvArm64RegisterPc, &val); + env->pc =3D val.Reg64; + + whpx_get_reg(cpu, WHvArm64RegisterFpcr, &val); + vfp_set_fpcr(env, val.Reg32); + + whpx_get_reg(cpu, WHvArm64RegisterFpsr, &val); + vfp_set_fpsr(env, val.Reg32); + + whpx_get_reg(cpu, WHvArm64RegisterPstate, &val); + pstate_write(env, val.Reg32); + + for (i =3D 0; i < ARRAY_SIZE(whpx_sreg_match); i++) { + if (whpx_sreg_match[i].cp_idx =3D=3D -1) { + continue; + } + + if (whpx_sreg_match[i].global) { + /* WHP disallows us from accessing global regs as a vCPU */ + whpx_get_global_reg(whpx_sreg_match[i].reg, &val); + } else { + whpx_get_reg(cpu, whpx_sreg_match[i].reg, &val); + } + arm_cpu->cpreg_values[whpx_sreg_match[i].cp_idx] =3D val.Reg64; + } + + assert(write_list_to_cpustate(arm_cpu)); + aarch64_restore_sp(env, arm_current_el(env)); +} + +void whpx_set_registers(CPUState *cpu, int level) +{ + ARMCPU *arm_cpu =3D ARM_CPU(cpu); + CPUARMState *env =3D &arm_cpu->env; + WHV_REGISTER_VALUE val; + clean_whv_register_value(&val); + int i; + + assert(cpu_is_stopped(cpu) || qemu_cpu_is_self(cpu)); + + for (i =3D 0; i < ARRAY_SIZE(whpx_reg_match); i++) { + val.Reg64 =3D *(uint64_t *)((char *)env + whpx_reg_match[i].offset= ); + whpx_set_reg(cpu, whpx_reg_match[i].reg, val); + } + + for (i =3D 0; i < ARRAY_SIZE(whpx_fpreg_match); i++) { + memcpy(&val.Reg128, (char *)env + whpx_fpreg_match[i].offset, size= of(val.Reg128)); + whpx_set_reg(cpu, whpx_reg_match[i].reg, val); + } + + clean_whv_register_value(&val); + val.Reg64 =3D env->pc; + whpx_set_reg(cpu, WHvArm64RegisterPc, val); + + clean_whv_register_value(&val); + val.Reg32 =3D vfp_get_fpcr(env); + whpx_set_reg(cpu, WHvArm64RegisterFpcr, val); + val.Reg32 =3D vfp_get_fpsr(env); + whpx_set_reg(cpu, WHvArm64RegisterFpsr, val); + val.Reg32 =3D pstate_read(env); + whpx_set_reg(cpu, WHvArm64RegisterPstate, val); + + aarch64_save_sp(env, arm_current_el(env)); + + assert(write_cpustate_to_list(arm_cpu, false)); + + /* Currently set global regs every time. */ + for (i =3D 0; i < ARRAY_SIZE(whpx_sreg_match); i++) { + if (whpx_sreg_match[i].cp_idx =3D=3D -1) { + continue; + } + + val.Reg64 =3D arm_cpu->cpreg_values[whpx_sreg_match[i].cp_idx]; + if (whpx_sreg_match[i].global) { + /* WHP disallows us from accessing global regs as a vCPU */ + whpx_set_global_reg(whpx_sreg_match[i].reg, val); + } else { + whpx_set_reg(cpu, whpx_sreg_match[i].reg, val); + } + } +} + +static uint32_t max_vcpu_index; + +static void whpx_cpu_update_state(void *opaque, bool running, RunState sta= te) +{ +} + +int whpx_init_vcpu(CPUState *cpu) +{ + HRESULT hr; + struct whpx_state *whpx =3D &whpx_global; + ARMCPU *arm_cpu =3D ARM_CPU(cpu); + CPUARMState *env =3D &arm_cpu->env; + + uint32_t sregs_match_len =3D ARRAY_SIZE(whpx_sreg_match); + uint32_t sregs_cnt =3D 0; + WHV_REGISTER_VALUE val; + int i; + + hr =3D whp_dispatch.WHvCreateVirtualProcessor( + whpx->partition, cpu->cpu_index, 0); + if (FAILED(hr)) { + error_report("WHPX: Failed to create a virtual processor," + " hr=3D%08lx", hr); + return -EINVAL; + } + + /* Assumption that CNTFRQ_EL0 is the same between the VMM and the part= ition. */ + asm volatile("mrs %0, cntfrq_el0" : "=3Dr"(arm_cpu->gt_cntfrq_hz)); + + cpu->vcpu_dirty =3D true; + cpu->accel =3D g_new0(AccelCPUState, 1); + max_vcpu_index =3D MAX(max_vcpu_index, cpu->cpu_index); + qemu_add_vm_change_state_handler(whpx_cpu_update_state, env); + + env->aarch64 =3D true; + + /* Allocate enough space for our sysreg sync */ + arm_cpu->cpreg_indexes =3D g_renew(uint64_t, arm_cpu->cpreg_indexes, + sregs_match_len); + arm_cpu->cpreg_values =3D g_renew(uint64_t, arm_cpu->cpreg_values, + sregs_match_len); + arm_cpu->cpreg_vmstate_indexes =3D g_renew(uint64_t, + arm_cpu->cpreg_vmstate_indexe= s, + sregs_match_len); + arm_cpu->cpreg_vmstate_values =3D g_renew(uint64_t, + arm_cpu->cpreg_vmstate_values, + sregs_match_len); + + memset(arm_cpu->cpreg_values, 0, sregs_match_len * sizeof(uint64_t)); + + /* Populate cp list for all known sysregs */ + for (i =3D 0; i < sregs_match_len; i++) { + const ARMCPRegInfo *ri; + uint32_t key =3D whpx_sreg_match[i].key; + + ri =3D get_arm_cp_reginfo(arm_cpu->cp_regs, key); + if (ri) { + assert(!(ri->type & ARM_CP_NO_RAW)); + whpx_sreg_match[i].cp_idx =3D sregs_cnt; + arm_cpu->cpreg_indexes[sregs_cnt++] =3D cpreg_to_kvm_id(key); + } else { + whpx_sreg_match[i].cp_idx =3D -1; + } + } + arm_cpu->cpreg_array_len =3D sregs_cnt; + arm_cpu->cpreg_vmstate_array_len =3D sregs_cnt; + + assert(write_cpustate_to_list(arm_cpu, false)); + + /* Set CP_NO_RAW system registers on init */ + val.Reg64 =3D arm_cpu->midr; + whpx_set_reg(cpu, WHvArm64RegisterMidrEl1, + val); + + clean_whv_register_value(&val); + + val.Reg64 =3D deposit64(arm_cpu->mp_affinity, 31, 1, 1 /* RES1 */); + whpx_set_reg(cpu, WHvArm64RegisterMpidrEl1, val); + + return 0; +} + +void whpx_cpu_instance_init(CPUState *cs) +{ +} + +int whpx_accel_init(AccelState *as, MachineState *ms) +{ + struct whpx_state *whpx; + int ret; + HRESULT hr; + WHV_CAPABILITY whpx_cap; + UINT32 whpx_cap_size; + WHV_PARTITION_PROPERTY prop; + WHV_CAPABILITY_FEATURES features; + + whpx =3D &whpx_global; + /* on arm64 Windows Hypervisor Platform, vGICv3 always used */ + whpx_irqchip_in_kernel =3D true; + + if (!init_whp_dispatch()) { + ret =3D -ENOSYS; + goto error; + } + + whpx->mem_quota =3D ms->ram_size; + + hr =3D whp_dispatch.WHvGetCapability( + WHvCapabilityCodeHypervisorPresent, &whpx_cap, + sizeof(whpx_cap), &whpx_cap_size); + if (FAILED(hr) || !whpx_cap.HypervisorPresent) { + error_report("WHPX: No accelerator found, hr=3D%08lx", hr); + ret =3D -ENOSPC; + goto error; + } + + memset(&features, 0, sizeof(features)); + hr =3D whp_dispatch.WHvGetCapability( + WHvCapabilityCodeFeatures, &features, sizeof(features), NULL); + if (FAILED(hr)) { + error_report("WHPX: Failed to query capabilities, hr=3D%08lx", hr); + ret =3D -EINVAL; + goto error; + } + + if (!features.Arm64Support) { + error_report("WHPX: host OS exposing pre-release WHPX implementati= on. " + "Please update your operating system to at least build 26100.3= 915"); + ret =3D -EINVAL; + goto error; + } + + hr =3D whp_dispatch.WHvCreatePartition(&whpx->partition); + if (FAILED(hr)) { + error_report("WHPX: Failed to create partition, hr=3D%08lx", hr); + ret =3D -EINVAL; + goto error; + } + + memset(&prop, 0, sizeof(prop)); + prop.ProcessorCount =3D ms->smp.cpus; + hr =3D whp_dispatch.WHvSetPartitionProperty( + whpx->partition, + WHvPartitionPropertyCodeProcessorCount, + &prop, + sizeof(prop)); + + if (FAILED(hr)) { + error_report("WHPX: Failed to set partition processor count to %u," + " hr=3D%08lx", prop.ProcessorCount, hr); + ret =3D -EINVAL; + goto error; + } + + if (!whpx->kernel_irqchip_allowed) { + error_report("WHPX: on Arm, only kernel-irqchip=3Don is currently = supported"); + ret =3D -EINVAL; + goto error; + } + + memset(&prop, 0, sizeof(prop)); + + hr =3D whp_dispatch.WHvSetupPartition(whpx->partition); + if (FAILED(hr)) { + error_report("WHPX: Failed to setup partition, hr=3D%08lx", hr); + ret =3D -EINVAL; + goto error; + } + + whpx_memory_init(); + + return 0; + +error: + if (whpx->partition !=3D NULL) { + whp_dispatch.WHvDeletePartition(whpx->partition); + whpx->partition =3D NULL; + } + + return ret; +} --=20 2.50.1 (Apple Git-155) From nobody Sat Feb 7 07:31:33 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=unpredictable.fr ARC-Seal: i=1; a=rsa-sha256; t=1770301737; cv=none; d=zohomail.com; s=zohoarc; b=h8kR/rL/6BhNTMuDpohsuswvueyN0XsJMAHbXA+4aw4gpMudXLycIAVzdeHhSQVIfsXfYZ3O6AvFVixHJIiH8ExIAC/FEsURPUy7PT8wQ7Ja4SEwgcjsgwwsQvGLkEvrb0QzhuPU8+MiHNGyd65nJ7BoLamEmN8UD266XBnwfWo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770301737; h=Content-Type: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=KaQ368BT2+kXLDF2JjCqdQWANc+K5Nc/lcLx70881Os=; b=SdqAJaNNSTWdNcrD3Ty/roMlP0ibXcj0lsH64oAYGU1nCUQIF+TWd599s8K7usx3Ty/Tl23t54CLCOzAC2xuNrkv3Qo5P5DdKWSvcNuMiFQp5aMSRUrb3W2CHxAbTBKbdBwTHkidGiE3FAf0eDaXWS4Yf7qUOBdBZUMIKZyMCUM= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770301737605112.91813333546895; Thu, 5 Feb 2026 06:28:57 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vo0Jw-0001Ma-M2; Thu, 05 Feb 2026 09:27:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0Jf-00014l-8J for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:46 -0500 Received: from qs-2004f-snip4-8.eps.apple.com ([57.103.84.61] helo=outbound.qs.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0Ja-0007zL-KR for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:42 -0500 Received: from outbound.qs.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPS id 0652F1800D8E; Thu, 5 Feb 2026 14:26:33 +0000 (UTC) Received: from localhost.localdomain (unknown [17.57.155.37]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPSA id DBAB41800DA2; Thu, 5 Feb 2026 14:26:28 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1770301597; x=1772893597; bh=KaQ368BT2+kXLDF2JjCqdQWANc+K5Nc/lcLx70881Os=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:x-icloud-hme; b=gmVlFxitjHrTilbXu0Xa5lfMySbLn9QZ3BXjJLfnlWdJKGIxQvbnq/1jX/HpYHgzHXevZ5kVnRcVOPdyJFQvNzaWshuer/s/Ds9O/Z/ckrvDNUZGE7pfysvFXrR3UvwqjalCIsuocBGexTB+WMucJnBRpMRAeV8NKzODNK+5Ziv+9eKfie1zqlnnrss6sFeaQc9rR6/ILEqL8br2IZfGbpnRwjKLy774yVDw0clEtnXSrMe7hirb8pHkTovwJhJFRHlwGySxyAZz5yVEPkveSFIyyE1Y21O+L2mArzCYUnFikGu72bFBGxizPCzlrHzZYq3RsfvZDVCg3p32ci8X3g== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org, mohamed@unpredictable.fr Cc: Zhao Liu , Paolo Bonzini , Akihiko Odaki , Cameron Esfahani , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Shannon Zhao , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Phil Dennis-Jordan , "Michael S. Tsirkin" , Richard Henderson , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Alexander Graf , Pedro Barbuda , Yanan Wang , Ani Sinha , Igor Mammedov , Marcel Apfelbaum , Peter Maydell , Eduardo Habkost , Roman Bolshakov , Pierrick Bouvier Subject: [PATCH v21 15/22] whpx: change memory management logic Date: Thu, 5 Feb 2026 15:25:33 +0100 Message-ID: <20260205142543.64818-16-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260205142543.64818-1-mohamed@unpredictable.fr> References: <20260205142543.64818-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Authority-Info-Out: v=2.4 cv=AIp8DMUn c=1 sm=1 tr=0 ts=6984a89b cx=c_apl:c_apl_out:c_pps a=bsP7O+dXZ5uKcj+dsLqiMw==:117 a=bsP7O+dXZ5uKcj+dsLqiMw==:17 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=Wq2Hhhcarr-WV7vA_m4A:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-GUID: duxkBm81gjyqKdzzGuYZcVSKbtQIstD4 X-Proofpoint-ORIG-GUID: duxkBm81gjyqKdzzGuYZcVSKbtQIstD4 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjA1MDEwOCBTYWx0ZWRfXwEpOio8aTGkE xjGy8rHviKhs3+2kAgRjZRh60w/RqOCH0pxK8/yyTGUeRBBp4uAEFO2Gmn1twoDgXLXOCsx9bpG Oy2+cRt1Bk4ShroKJhZb4PRJtzHrJqTC+rDPP4SdQEGnf0TonUIfehFOM4B1svtZgSFYGZeDdeQ S4mQM/tR5++TYRWV2uhfFJwSpJLLifBYroui6bY6hna0dZCb56gweTFwbUWu/Avf22mANCamHNy Ngg66q1+WNSwihZ+4itGILj4ljtRV93Qrd+Lr/jnSA95qhyAmF9UquvRfv0r7x3QCITRw7gdYYF qlB3N0MzqIx4O62mbeyShL50caYzNwvAhmvaGPsav5dLMPPM9bNS4SM0mcZFPM= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-05_03,2026-02-05_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 malwarescore=0 phishscore=0 lowpriorityscore=0 adultscore=0 mlxlogscore=999 spamscore=0 suspectscore=0 mlxscore=0 clxscore=1030 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602050108 X-JNJ: AAAAAAAB/YwutOvLtp7QHTBD1G+S62YGDRyppb6eRAx7wMXSuScaYhbfcrkzrmtbUuZcqzUOeIGFFSFW1a4b6I7lmk8sN57ZWwPf+hG98IffvoNQ8gJJxn5x9DYD8o9fv5cyLsN2yWw/+knrh/6LTYelg8YpJbnq9CJbXrpDJLy3fI6MCngp4im1EGcrB6athYXaENnEJP7BnFOYbqaaNhhIg4GiZEzLDSrga/RP6ZICYs3NvV+O519d89MaOP0XygYq/rv+U4wP+ekHc+Jg0pHT/D3R59RXn8uZOWgr3fP1+gB5grZqCLy5gbZ7NyGVA64fmtM/S3LUCcGD6aSrZ5DSHFgcRfkEm44PSNAtxAXjhTGmC9FmjknmlEAUIqk9BzhKYMNDVQ1X7Cy9ADrlzoXq0f3zBhgieMUa/RtnHB+ffWeyaRBS5V25f9XA40f1bQgZvp1fKm/FBxpqnnty7FSUK2DvDpOZDIEk7hhduak5bGu1hNmGkbK7qec+dw7tSo7dz7GZDeGOisduMnZtoXtCgxydeiiTWRqWjkwrLvSGXCIbxo3EtiKv6gKXWYhWWe4VpD65tv0ahO/cifJIesXSgCQqY/+VZf1w8Vcku4I4F+1iNAnychQ+iGl5TK+REaYcyQh2u4mPfMUVtKyhKvNobuijX3RnxOtYDaep53Pc4aSuos7o1wAvyl5DeLDEfuDpZrVtAhFu+nAzGkQa+l6+92e+lW0OBp9NK8MbeSo9ZYE9EP6uxov+SyA0nFjkTgDwLwQ0yeFERRvOYGz+uvqfPyV2t+LhNzTsGVrDJGXeGflQVTjJCsJ7eVCJmPxcyg0PwReEuylPmusJi7iA+jYLCZG5mra9+12mel1lXrQiVTMbQxsKZJ6+2U8PRtFwPIj+1LbrMoAZ21OFCvUtI9FCxhP8mOWY+inrCSbXxXS2bR8WBJZ5kv38cslvUTIKCWwsdxcOPLo= 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=lists.gnu.org; Received-SPF: pass client-ip=57.103.84.61; envelope-from=mohamed@unpredictable.fr; helo=outbound.qs.icloud.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @unpredictable.fr) X-ZM-MESSAGEID: 1770301740878154100 This allows edk2 to work on Arm, although u-boot is still not functional. Signed-off-by: Mohamed Mediouni Reviewed-by: Pierrick Bouvier Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Akihiko Odaki --- accel/whpx/whpx-common.c | 97 +++++++++++++++------------------------- 1 file changed, 36 insertions(+), 61 deletions(-) diff --git a/accel/whpx/whpx-common.c b/accel/whpx/whpx-common.c index 827f50f3e0..f018a8f5c7 100644 --- a/accel/whpx/whpx-common.c +++ b/accel/whpx/whpx-common.c @@ -255,89 +255,64 @@ void whpx_vcpu_kick(CPUState *cpu) * Memory support. */ =20 -static void whpx_update_mapping(hwaddr start_pa, ram_addr_t size, - void *host_va, int add, int rom, - const char *name) +static void whpx_set_phys_mem(MemoryRegionSection *section, bool add) { struct whpx_state *whpx =3D &whpx_global; + MemoryRegion *area =3D section->mr; + bool writable =3D !area->readonly && !area->rom_device; + WHV_MAP_GPA_RANGE_FLAGS flags; + uint64_t page_size =3D qemu_real_host_page_size(); + uint64_t gva =3D section->offset_within_address_space; + uint64_t size =3D int128_get64(section->size); HRESULT hr; + void *mem; =20 - /* - if (add) { - printf("WHPX: ADD PA:%p Size:%p, Host:%p, %s, '%s'\n", - (void*)start_pa, (void*)size, host_va, - (rom ? "ROM" : "RAM"), name); - } else { - printf("WHPX: DEL PA:%p Size:%p, Host:%p, '%s'\n", - (void*)start_pa, (void*)size, host_va, name); - } - */ - - if (add) { - hr =3D whp_dispatch.WHvMapGpaRange(whpx->partition, - host_va, - start_pa, - size, - (WHvMapGpaRangeFlagRead | - WHvMapGpaRangeFlagExecute | - (rom ? 0 : WHvMapGpaRangeFlagWri= te))); - } else { - hr =3D whp_dispatch.WHvUnmapGpaRange(whpx->partition, - start_pa, - size); - } - - if (FAILED(hr)) { - error_report("WHPX: Failed to %s GPA range '%s' PA:%p, Size:%p byt= es," - " Host:%p, hr=3D%08lx", - (add ? "MAP" : "UNMAP"), name, - (void *)(uintptr_t)start_pa, (void *)size, host_va, h= r); + if (!memory_region_is_ram(area)) { + if (writable) { + return; + } else if (!memory_region_is_romd(area)) { + add =3D false; + } } -} - -static void whpx_process_section(MemoryRegionSection *section, int add) -{ - MemoryRegion *mr =3D section->mr; - hwaddr start_pa =3D section->offset_within_address_space; - ram_addr_t size =3D int128_get64(section->size); - unsigned int delta; - uint64_t host_va; =20 - if (!memory_region_is_ram(mr)) { - return; + if (!QEMU_IS_ALIGNED(size, page_size) || + !QEMU_IS_ALIGNED(gva, page_size)) { + /* Not page aligned, so we can not map as RAM */ + add =3D false; } =20 - delta =3D qemu_real_host_page_size() - (start_pa & ~qemu_real_host_pag= e_mask()); - delta &=3D ~qemu_real_host_page_mask(); - if (delta > size) { - return; - } - start_pa +=3D delta; - size -=3D delta; - size &=3D qemu_real_host_page_mask(); - if (!size || (start_pa & ~qemu_real_host_page_mask())) { + if (!add) { + hr =3D whp_dispatch.WHvUnmapGpaRange(whpx->partition, + gva, size); + if (FAILED(hr)) { + error_report("WHPX: failed to unmap GPA range"); + abort(); + } return; } =20 - host_va =3D (uintptr_t)memory_region_get_ram_ptr(mr) - + section->offset_within_region + delta; + flags =3D WHvMapGpaRangeFlagRead | WHvMapGpaRangeFlagExecute + | (writable ? WHvMapGpaRangeFlagWrite : 0); + mem =3D memory_region_get_ram_ptr(area) + section->offset_within_regio= n; =20 - whpx_update_mapping(start_pa, size, (void *)(uintptr_t)host_va, add, - memory_region_is_rom(mr), mr->name); + hr =3D whp_dispatch.WHvMapGpaRange(whpx->partition, + mem, gva, size, flags); + if (FAILED(hr)) { + error_report("WHPX: failed to map GPA range"); + abort(); + } } =20 static void whpx_region_add(MemoryListener *listener, MemoryRegionSection *section) { - memory_region_ref(section->mr); - whpx_process_section(section, 1); + whpx_set_phys_mem(section, true); } =20 static void whpx_region_del(MemoryListener *listener, MemoryRegionSection *section) { - whpx_process_section(section, 0); - memory_region_unref(section->mr); + whpx_set_phys_mem(section, false); } =20 static void whpx_transaction_begin(MemoryListener *listener) --=20 2.50.1 (Apple Git-155) From nobody Sat Feb 7 07:31:33 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=unpredictable.fr ARC-Seal: i=1; a=rsa-sha256; t=1770301742; cv=none; d=zohomail.com; s=zohoarc; b=TJl6bIyYyYkR/ZG97wxPEWi0ANdmVu3GUULCVLQourVb0im5P3mit1XRMBkoGwuQfR9wiBmiLY+v/iJB1WOo5yHoBSaF8Rl+fTesZ+2ji2QtCz+GRf+iBia51yrZTOZ8oQAJwrJetaSDTrEM7n26tWniLhLOgs/PTIykGTyoHzw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770301742; 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=s1GW0hnfqvPJUBalVotB8aEtoQcY7bM3WJxM9j7OEF4=; b=Q+E96laKMvge4AXVCvoDkuc54p94d8Djksel+S6nBY3m85nrektcY3KzVDsHn9/kLwjkOnR73Lnlls6FrJ3tlaT2LQvwrlZaDSk00IlBR4YSNoIVy1RIomWf//J0ESzNR+Bv1Ett74iN5EowzI+jiIqZkoD09Fbj/CcRyXvuTY4= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770301742675786.4351517433432; Thu, 5 Feb 2026 06:29:02 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vo0Jv-0001MC-Ft; Thu, 05 Feb 2026 09:27:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0Jh-00016R-5m for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:46 -0500 Received: from qs-2004l-snip4-2.eps.apple.com ([57.103.84.115] helo=outbound.qs.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0Jc-00080G-RP for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:44 -0500 Received: from outbound.qs.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPS id 104A11800D86; Thu, 5 Feb 2026 14:26:35 +0000 (UTC) Received: from localhost.localdomain (unknown [17.57.155.37]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPSA id BB1A61800273; Thu, 5 Feb 2026 14:26:31 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1770301599; x=1772893599; bh=s1GW0hnfqvPJUBalVotB8aEtoQcY7bM3WJxM9j7OEF4=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=M4pioZbtOteknIQ/ipr21hR31wS527RvrGxa5SR1mM6ueUnueiTA9hkC2oF4y5bkbOutE9yKr2va202KOvLoMRuVUn++cju8v6IrVRR6PrA6Z0taNcem3VUIlF511kEshldZwpRpeMSiJXDa2168xcbwI3Xg2Yotvq9exNfQBbPtSJU9WhKVWsfnCHQ6g9UtVr2Vv9e7+Y6Mka1altQQZEVCHNHkp4BDtgBoQJwJ99ifG/6K9aaMjyCVvJDjPWXv2vlMbKVe8OBm34oO/9fPkrDct9NvUDH5hjOva728X5RPSSbW9iW6MV2rKXOlwPvZvJl7ejU0aNWxFUWaT2hhqQ== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org, mohamed@unpredictable.fr Cc: Zhao Liu , Paolo Bonzini , Akihiko Odaki , Cameron Esfahani , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Shannon Zhao , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Phil Dennis-Jordan , "Michael S. Tsirkin" , Richard Henderson , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Alexander Graf , Pedro Barbuda , Yanan Wang , Ani Sinha , Igor Mammedov , Marcel Apfelbaum , Peter Maydell , Eduardo Habkost , Roman Bolshakov , Pierrick Bouvier Subject: [PATCH v21 16/22] target/arm: cpu: mark WHPX as supporting PSCI 1.3 Date: Thu, 5 Feb 2026 15:25:34 +0100 Message-ID: <20260205142543.64818-17-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260205142543.64818-1-mohamed@unpredictable.fr> References: <20260205142543.64818-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: gMSDW8VMIkxx857R75ox0zylBBW_3CuD X-Proofpoint-ORIG-GUID: gMSDW8VMIkxx857R75ox0zylBBW_3CuD X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjA1MDEwOCBTYWx0ZWRfX+pxxjlbkcLtE SdG9F31AhrISiRqmReof2o8U+f8A8jZf4/IPbABklN+ISSgde8KMR9tDVg8fgMBi0wu8ids/gk/ PauNpxON+rGl05sZC8b5KCxBwffYk7H78JTEedzlsXXfk09exOinZqfigODUNO/x2s0D2nz7213 av+m5usoFMKEV6pPrGRZ/E8KRAoNV12YceF4z0N1DWdY5G8Uo0HuHhHBDFOvqjmnLfd+sPzSvZh vZlC//XXxeLWFqHfPvqbpx9d0fOC/HPPPnddPdoiIalsA4fxi6eVi6idFOSwwxnaujSnhlZrhWV eW0ZnsklKKbKAZE/YqVNPRbyKviErttEi6m2YoV4df8CtUrYt5mstMLRhC/kG4= X-Authority-Info-Out: v=2.4 cv=DtBbOW/+ c=1 sm=1 tr=0 ts=6984a89d cx=c_apl:c_apl_out:c_pps a=bsP7O+dXZ5uKcj+dsLqiMw==:117 a=bsP7O+dXZ5uKcj+dsLqiMw==:17 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=emIkxkYSJqCgyAM8kcYA:9 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-05_03,2026-02-05_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 phishscore=0 bulkscore=0 spamscore=0 adultscore=0 clxscore=1030 suspectscore=0 malwarescore=0 mlxscore=0 mlxlogscore=999 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602050108 X-JNJ: AAAAAAABnZ2nwFev4tJ/LDKeVTzmnyrpuzGo6Ma+v6Bpxof6641Un+mPJ0iluF/ODpy42dDfpuN+6Kz/qnWokQv0BGrbIT38b4gOpx4QcG4U2gbf8AO4bNUdGhUU/QqVM2c35CPGBKgqZOHV2MMxY8qpX642G5xLdzzNveWiokUerervliAU3xplOwCh7dW/riZS9rDmdVrwzlZtaMmwnaHGtA1HpS+AwvqCFC8nGIefsGt/d0a/0FzpNJkreMU2iJl/DLUp8XAqZtOlmMO5Q26sQW0PKOcme3b5xswe0Gc//4ZwJ4/DNTD8/GBInYfegRCW+jrAzoM2iek4Y7n3AhbX981i8Mi6g3qsC+AMFl2rj6MK/iImxUnj2/RjC7Ge1ZJlR0uaBIRMp1ZYwySqsYubnvtMYPsrWWNkExmrUtaJVzt7UXMoRP8fgqp96Rbf4uePIfrWf6gmd+zXnntJVJONIoo7p4v7h6fZiVKSzEI3yZ9IW9eFFUucgPgjbiocEtO5DT4PohuAuqCNK528NwNC3uPA9d170eDsSAhXjv+kMUhGsvt++CEpFnZNEzbgUsg+vk4vjUQ2A9QvRRGbOl8eiCb4f2LzDn4qxoujzoEjoY0RX2luwXkToVflsgoe5lg5YVNaeCCCqEMQ0PJz9hbI2t2F3IXoDPSHaukCIZKHdYlpFiWHEBxdgsXdlIh0y8I8ClrG+5ljV8Ar0xh5GXMq0A54Nc5p+iiMcDbOSazOn13ytTm/ZWhAxnWJo0OkLQ//oU6LJqIXVKvEZiw6zUiFpHJ+363wrE43BUjk8JwjeT3jiA8UgmiunvlUtS9SY0MAtWM7+uA4FBPCGoJExhc2nwf3CxZ2WmzC/UWTLlvlfpPGaehRIOabpsDvSW43FGUPZy+iYygRunK9t1bMTUV1nC48qOarukIYRRT/Zs8kTYr9yO/fKFMFZBMG/HrVVRX1X1UU3FYfo0u2uridn6czvdUqYaV A 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=lists.gnu.org; Received-SPF: pass client-ip=57.103.84.115; envelope-from=mohamed@unpredictable.fr; helo=outbound.qs.icloud.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @unpredictable.fr) X-ZM-MESSAGEID: 1770301746658154100 Content-Type: text/plain; charset="utf-8" Hyper-V supports PSCI 1.3, and that implementation is exposed through WHPX. Signed-off-by: Mohamed Mediouni Reviewed-by: Richard Henderson Reviewed-by: Pierrick Bouvier Reviewed-by: Akihiko Odaki --- target/arm/cpu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index c535b292d9..077f1f9a74 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -23,6 +23,7 @@ #include "qemu/timer.h" #include "qemu/log.h" #include "exec/page-vary.h" +#include "system/whpx.h" #include "target/arm/idau.h" #include "qemu/module.h" #include "qapi/error.h" @@ -1143,6 +1144,8 @@ static void arm_cpu_initfn(Object *obj) if (tcg_enabled() || hvf_enabled()) { /* TCG and HVF implement PSCI 1.1 */ cpu->psci_version =3D QEMU_PSCI_VERSION_1_1; + } else if (whpx_enabled()) { + cpu->psci_version =3D QEMU_PSCI_VERSION_1_3; } } =20 --=20 2.50.1 (Apple Git-155) From nobody Sat Feb 7 07:31:33 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=unpredictable.fr ARC-Seal: i=1; a=rsa-sha256; t=1770301924; cv=none; d=zohomail.com; s=zohoarc; b=cF7y9zeHABhkRnbsSaYls3JELT3suxzGJ3MtaslO/CXDeyrlZrvs7AhULVsIMk1gXbYljlN9rhTpWh/X3JDWiU2Bn6AQmbiUfN4bZu3xnei3HsHrhilwuFFL4sR7IgHpuYW9oS52sfBJjWa5475EMdXtU2IzVx6UBvgh7cEfeSM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770301924; 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=E+EVlaYd4DFvMgTTrp6ruOR6cr2IXuAiLwM1qxEWucg=; b=BjJe1SrxanLZL3hnXTZZ5sDF7r41guTZy2/Wjk3+vniGnN5fryfR+maJMV1feYp6D2kuyU2s5jbPZ+6JzQXADTrLhue+BeU4AOeBTDbtyqPWyqSRRR5ibMKwo7zb0Ha+8NpAYPVisuIvR88yJCemuRg7D8LlPqQpQoYiPB6GkYY= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770301924738589.7430484130607; Thu, 5 Feb 2026 06:32:04 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vo0K0-0001Wk-5f; Thu, 05 Feb 2026 09:27:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0Jn-0001BB-3v for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:52 -0500 Received: from qs-2004c-snip4-10.eps.apple.com ([57.103.84.32] helo=outbound.qs.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0Jj-00083o-M3 for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:50 -0500 Received: from outbound.qs.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPS id 23FE81800DA6; Thu, 5 Feb 2026 14:26:38 +0000 (UTC) Received: from localhost.localdomain (unknown [17.57.155.37]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPSA id 9A3D61800D90; Thu, 5 Feb 2026 14:26:34 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1770301607; x=1772893607; bh=E+EVlaYd4DFvMgTTrp6ruOR6cr2IXuAiLwM1qxEWucg=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=gONRJ88pU+XI3nNh66sUojpMrLw3D0r7A5AzXffohjrrM7Qb8K2vM6ua0AcEjKLVn1ZMMgWult6LgdqLe+OZ71CfIbsCOet6ZRNr4YAXKDFDe89DFXlS6oQgECDvjWmCr5+TWnl8HSmVY5z/N7bdzJDRMTsD8crrjfhMudk9Mbiaw7bc5ncNFtNCtb0ubZ34ytQsU56qT4tgKcZnOOJCyJmQ/a3XlOSrTYa2dT/VpfnQOx3hzi82RJWSojIqTqWD1BSy/vKvbISv0JFhO+yekKndaMbSjLCj8Ra4PCYwM0zKjaehcXnWrlG2LSfw5DOdlngglTim2cDclJUQao6MiQ== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org, mohamed@unpredictable.fr Cc: Zhao Liu , Paolo Bonzini , Akihiko Odaki , Cameron Esfahani , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Shannon Zhao , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Phil Dennis-Jordan , "Michael S. Tsirkin" , Richard Henderson , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Alexander Graf , Pedro Barbuda , Yanan Wang , Ani Sinha , Igor Mammedov , Marcel Apfelbaum , Peter Maydell , Eduardo Habkost , Roman Bolshakov , Pierrick Bouvier Subject: [PATCH v21 17/22] whpx: arm64: clamp down IPA size Date: Thu, 5 Feb 2026 15:25:35 +0100 Message-ID: <20260205142543.64818-18-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260205142543.64818-1-mohamed@unpredictable.fr> References: <20260205142543.64818-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: Y7m9015v_PRXQ696QRxWtj2ItiixJZGi X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjA1MDEwOSBTYWx0ZWRfX4T3VwFN+vH98 dzNchIvPmGKFqMkfSzzJVy6jz3E1EQlmpWP5y2jEfB9EcuD4DqOcTlr/hFbV3M+TyJjeJ/2ehva /Mtl6xr33xTY+iF2N47Tslv8KJ1Wt235fAYFCuhdB9B2ZMI1CSg58UkyL9qHe5l2BVu6VmMznC9 pWF6QMUgdVL2gJKOi8C6x/kYZ6wjiG72WVi78gd2TPJVS3NA3FiEas4mMQvjAgyopMTtROc13+r 1jPvOB6OZe8XT+Ndqdp34lp++V2Ajvmzi2c6hoD+FJ92Ih0/PMpZtXSYBMgIYrLmgf6lJbwdsCp Ub+5imlwzWQ2bdfoTjg9+uG8WMWfGTOCMUOVOsG2/dA45B/TyxItu0kokuU17M= X-Authority-Info-Out: v=2.4 cv=WtAm8Nfv c=1 sm=1 tr=0 ts=6984a8a5 cx=c_apl:c_apl_out:c_pps a=bsP7O+dXZ5uKcj+dsLqiMw==:117 a=bsP7O+dXZ5uKcj+dsLqiMw==:17 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=wAo57kR77d7e8uaIccUA:9 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-ORIG-GUID: Y7m9015v_PRXQ696QRxWtj2ItiixJZGi X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-05_03,2026-02-05_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 bulkscore=0 phishscore=0 mlxscore=0 adultscore=0 lowpriorityscore=0 malwarescore=0 mlxlogscore=999 clxscore=1030 spamscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602050109 X-JNJ: AAAAAAABswFJnqw50OcW0OmVT9ZmbIEgEkoypN9ilmzgr2bdlZEdDRGzeEusemfbEEF3VmCeqYh7HmW3Q5AJpIJcPkIlEEX0ugK2y1P7O7MPc13/tSDWCfxmEbYyapUaho0vt3bYLyKemA1Ghu1Ps7ee6MfcMkIdMuqI2JqSObiJiUXAgBukJbsRiMic7ZlYV72YRZJSFw7gxI2mNGK/oxMbIhFJm7j6JmNCicUdK6ShxP/nNr2bcBOZulFEIJB7SqJEjIscnkhaOb//+hip24xYaAL1UIxenZu76NWedf6SABGllt2HxgiiYSF5JXoJXI607K54Y1KX/69YRBbGUUoN9/mr2ZRfkNAiHHSfLUWnLxNgvT9HxZe3fgJSjhYmaN9bmOE41FRFmQ/k78IM7B9Sex2UVXv0BQACV4A2RpMhJ2DpveMlJJeYeLLPYNaUto6zc+eQMqeNlySeUyFz/DV8FADrQTRs/4RmwQOTDpIe6PtlnLIjBe3EToOV0PWeFfJNP5iZKkeBxmglPHJnEz+Nuj6cfYGNgleExTvdd2+q15Ung+XKAMn1r6+CHuLPRJUjhaseaJjolB05YCsdx2vESw6VWzYUwPOZbYTgXBcDfBJe71NFaGFm1DSJY7DLeRDmm93Zg9XyOs2nu8whpB2tjDWMJo0nK1Al6T8botki2JqmJThcuTbx1c4gGCGiiEMEPDC0iHy+AduWyojpzoQqMlNUtx9Szp7OxGcGJ0cp1um3tZGiusTLr5GA5hcHUOv84D5rngXvPkrij0JP+UQg2P0leKZldOp3AHgSm+qrTnU6sd0mWFJcYvDoPX6lL9I50c3E/C32B5HZwZZasnTeL2zCAZ9zIuyzXYioHNQca+6QmLZ3+CjAtzPLBQwBcAu5T1c6UmIx6JPiUfkUPGEKVIru4nW6Vmzbdo1wXEV2L9QNR7Qj8P94zQvfPg== 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=lists.gnu.org; Received-SPF: pass client-ip=57.103.84.32; envelope-from=mohamed@unpredictable.fr; helo=outbound.qs.icloud.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @unpredictable.fr) X-ZM-MESSAGEID: 1770301927606154100 Content-Type: text/plain; charset="utf-8" Code taken from HVF and adapted for WHPX use. Note that WHPX doesn't have a default vs maximum IPA distinction. Signed-off-by: Mohamed Mediouni Reviewed-by: Pierrick Bouvier --- hw/arm/virt.c | 32 ++++++++++++++++++++++++++ include/hw/core/boards.h | 1 + target/arm/whpx/meson.build | 2 ++ target/arm/whpx/whpx-all.c | 45 +++++++++++++++++++++++++++++++++++++ target/arm/whpx/whpx-stub.c | 15 +++++++++++++ target/arm/whpx_arm.h | 16 +++++++++++++ 6 files changed, 111 insertions(+) create mode 100644 target/arm/whpx/whpx-stub.c create mode 100644 target/arm/whpx_arm.h diff --git a/hw/arm/virt.c b/hw/arm/virt.c index b7eb0cec5e..77832b566e 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -72,6 +72,7 @@ #include "hw/core/irq.h" #include "kvm_arm.h" #include "hvf_arm.h" +#include "whpx_arm.h" #include "hw/firmware/smbios.h" #include "qapi/visitor.h" #include "qapi/qapi-visit-common.h" @@ -3360,6 +3361,36 @@ static int virt_kvm_type(MachineState *ms, const cha= r *type_str) return fixed_ipa ? 0 : requested_pa_size; } =20 +static int virt_whpx_get_physical_address_range(MachineState *ms) +{ + VirtMachineState *vms =3D VIRT_MACHINE(ms); + + int max_ipa_size =3D whpx_arm_get_ipa_bit_size(); + + /* We freeze the memory map to compute the highest gpa */ + virt_set_memmap(vms, max_ipa_size); + + int requested_ipa_size =3D 64 - clz64(vms->highest_gpa); + + /* + * If we're <=3D the default IPA size just use the default. + * If we're above the default but below the maximum, round up to + * the maximum. whpx_arm_get_max_ipa_bit_size() conveniently only + * returns values that are valid ARM PARange values. + */ + if (requested_ipa_size <=3D max_ipa_size) { + requested_ipa_size =3D max_ipa_size; + } else { + error_report("-m and ,maxmem option values " + "require an IPA range (%d bits) larger than " + "the one supported by the host (%d bits)", + requested_ipa_size, max_ipa_size); + return -1; + } + + return requested_ipa_size; +} + static int virt_hvf_get_physical_address_range(MachineState *ms) { VirtMachineState *vms =3D VIRT_MACHINE(ms); @@ -3459,6 +3490,7 @@ static void virt_machine_class_init(ObjectClass *oc, = const void *data) mc->get_default_cpu_node_id =3D virt_get_default_cpu_node_id; mc->kvm_type =3D virt_kvm_type; mc->hvf_get_physical_address_range =3D virt_hvf_get_physical_address_r= ange; + mc->whpx_get_physical_address_range =3D virt_whpx_get_physical_address= _range; assert(!mc->get_hotplug_handler); mc->get_hotplug_handler =3D virt_machine_get_hotplug_handler; hc->pre_plug =3D virt_machine_device_pre_plug_cb; diff --git a/include/hw/core/boards.h b/include/hw/core/boards.h index 07f8938752..0b2aefb126 100644 --- a/include/hw/core/boards.h +++ b/include/hw/core/boards.h @@ -278,6 +278,7 @@ struct MachineClass { void (*wakeup)(MachineState *state); int (*kvm_type)(MachineState *machine, const char *arg); int (*hvf_get_physical_address_range)(MachineState *machine); + int (*whpx_get_physical_address_range)(MachineState *machine); =20 BlockInterfaceType block_default_type; int units_per_default_bus; diff --git a/target/arm/whpx/meson.build b/target/arm/whpx/meson.build index 1de2ef0283..3df632c9d3 100644 --- a/target/arm/whpx/meson.build +++ b/target/arm/whpx/meson.build @@ -1,3 +1,5 @@ arm_system_ss.add(when: 'CONFIG_WHPX', if_true: files( 'whpx-all.c', )) + +arm_common_system_ss.add(when: 'CONFIG_WHPX', if_false: files('whpx-stub.c= ')) diff --git a/target/arm/whpx/whpx-all.c b/target/arm/whpx/whpx-all.c index 192d7ec7a8..850f6ec81f 100644 --- a/target/arm/whpx/whpx-all.c +++ b/target/arm/whpx/whpx-all.c @@ -35,6 +35,7 @@ #include "system/whpx-accel-ops.h" #include "system/whpx-all.h" #include "system/whpx-common.h" +#include "whpx_arm.h" #include "hw/arm/bsa.h" #include "arm-powerctl.h" =20 @@ -633,6 +634,40 @@ static void whpx_cpu_update_state(void *opaque, bool r= unning, RunState state) { } =20 +uint32_t whpx_arm_get_ipa_bit_size(void) +{ + WHV_CAPABILITY whpx_cap; + UINT32 whpx_cap_size; + HRESULT hr; + hr =3D whp_dispatch.WHvGetCapability( + WHvCapabilityCodePhysicalAddressWidth, &whpx_cap, + sizeof(whpx_cap), &whpx_cap_size); + if (FAILED(hr)) { + error_report("WHPX: failed to get supported " + "physical address width, hr=3D%08lx", hr); + } + + /* + * We clamp any IPA size we want to back the VM with to a valid PARange + * value so the guest doesn't try and map memory outside of the valid = range. + * This logic just clamps the passed in IPA bit size to the first valid + * PARange value <=3D to it. + */ + return round_down_to_parange_bit_size(whpx_cap.PhysicalAddressWidth); +} + +static void clamp_id_aa64mmfr0_parange_to_ipa_size(ARMISARegisters *isar) +{ + uint32_t ipa_size =3D whpx_arm_get_ipa_bit_size(); + uint64_t id_aa64mmfr0; + + /* Clamp down the PARange to the IPA size the kernel supports. */ + uint8_t index =3D round_down_to_parange_index(ipa_size); + id_aa64mmfr0 =3D GET_IDREG(isar, ID_AA64MMFR0); + id_aa64mmfr0 =3D (id_aa64mmfr0 & ~R_ID_AA64MMFR0_PARANGE_MASK) | index; + SET_IDREG(isar, ID_AA64MMFR0, id_aa64mmfr0); +} + int whpx_init_vcpu(CPUState *cpu) { HRESULT hr; @@ -706,6 +741,7 @@ int whpx_init_vcpu(CPUState *cpu) val.Reg64 =3D deposit64(arm_cpu->mp_affinity, 31, 1, 1 /* RES1 */); whpx_set_reg(cpu, WHvArm64RegisterMpidrEl1, val); =20 + clamp_id_aa64mmfr0_parange_to_ipa_size(&arm_cpu->isar); return 0; } =20 @@ -722,6 +758,8 @@ int whpx_accel_init(AccelState *as, MachineState *ms) UINT32 whpx_cap_size; WHV_PARTITION_PROPERTY prop; WHV_CAPABILITY_FEATURES features; + MachineClass *mc =3D MACHINE_GET_CLASS(ms); + int pa_range =3D 0; =20 whpx =3D &whpx_global; /* on arm64 Windows Hypervisor Platform, vGICv3 always used */ @@ -732,6 +770,13 @@ int whpx_accel_init(AccelState *as, MachineState *ms) goto error; } =20 + if (mc->whpx_get_physical_address_range) { + pa_range =3D mc->whpx_get_physical_address_range(ms); + if (pa_range < 0) { + return -EINVAL; + } + } + whpx->mem_quota =3D ms->ram_size; =20 hr =3D whp_dispatch.WHvGetCapability( diff --git a/target/arm/whpx/whpx-stub.c b/target/arm/whpx/whpx-stub.c new file mode 100644 index 0000000000..32e434a5f6 --- /dev/null +++ b/target/arm/whpx/whpx-stub.c @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * WHPX stubs for ARM + * + * Copyright (c) 2025 Mohamed Mediouni + * + */ + +#include "qemu/osdep.h" +#include "whpx_arm.h" + +uint32_t whpx_arm_get_ipa_bit_size(void) +{ + g_assert_not_reached(); +} diff --git a/target/arm/whpx_arm.h b/target/arm/whpx_arm.h new file mode 100644 index 0000000000..de7406b66f --- /dev/null +++ b/target/arm/whpx_arm.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * WHPX support -- ARM specifics + * + * Copyright (c) 2025 Mohamed Mediouni + * + */ + +#ifndef QEMU_WHPX_ARM_H +#define QEMU_WHPX_ARM_H + +#include "target/arm/cpu-qom.h" + +uint32_t whpx_arm_get_ipa_bit_size(void); + +#endif --=20 2.50.1 (Apple Git-155) From nobody Sat Feb 7 07:31:33 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=unpredictable.fr ARC-Seal: i=1; a=rsa-sha256; t=1770301691; cv=none; d=zohomail.com; s=zohoarc; b=LWj94d3uYX4MLDEJmOkpSGOXFOjzFDyxguMHAlfilO+kB5bpgX1zKPrLAO/htr0Jso6z/o5vl2+HyEhUnc9J0KP4DkcybohS3OBVbNm77ZegZ7uCHTmLfRwvTyYe7FkGYN3+ZL1BOI8JB352s7/wnLb1TT7O+/9fQjDZyRiayvM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770301691; h=Content-Type: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=ytYj5J6mRWA1MZc5Ke/cgWypdvS6bPw8ua4WvIunSds=; b=CRUqxeHaMupL4oI2RGQrisnqt90ymf8hcLuJkNKGXPRx6HJ+2yvQWeEQpQuVbdV+63gWEEsTv3PldowGpxTqrw4kdzBchP6g8A0k75QN8HRvzLzY4kw47CXbb5SuAuoFENR6JHqgrl45I4+octVQStbfdjxP/6nGub6odd272XE= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 177030169176724.796290645193494; Thu, 5 Feb 2026 06:28:11 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vo0Jz-0001UA-Jm; Thu, 05 Feb 2026 09:27:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0Jj-000195-8J for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:48 -0500 Received: from qs-2004a-snip4-11.eps.apple.com ([57.103.84.13] helo=outbound.qs.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0Jh-00081j-Bo for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:47 -0500 Received: from outbound.qs.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPS id B92E81800178; Thu, 5 Feb 2026 14:26:40 +0000 (UTC) Received: from localhost.localdomain (unknown [17.57.155.37]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPSA id 754811800272; Thu, 5 Feb 2026 14:26:37 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1770301604; x=1772893604; bh=ytYj5J6mRWA1MZc5Ke/cgWypdvS6bPw8ua4WvIunSds=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:x-icloud-hme; b=QAx25kbR5uMJN78HE6BiFEkLbp0x3esIPX6nFTcLXnToG8jpaTJ/KDyV5wRPlLCD3JVXNAmNEu8unaGGyNZwLTqXUviJaxlckSnnm4OZJXs1wwIdb90dxUP8S2DF0Ma5P3zXbBHhOraHmlJi2sNw7SfKGfRooeCGkycsLTdBXwXGRr+7pTiL/SEkTM2D5YEZpGSuRwReksOYr8x4wK2Gt+VoaA0YQvVgJcdF+G5tXvgPdM+bZmyEYzNritKnHdz3cfR6Q5UMb8ePZ51TVgPFWc8OY8wql4pQbdEUabUefqJdZ45npeylKPAtmsogJwKzhFrgaYRG4k6yyu8OayspBA== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org, mohamed@unpredictable.fr Cc: Zhao Liu , Paolo Bonzini , Akihiko Odaki , Cameron Esfahani , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Shannon Zhao , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Phil Dennis-Jordan , "Michael S. Tsirkin" , Richard Henderson , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Alexander Graf , Pedro Barbuda , Yanan Wang , Ani Sinha , Igor Mammedov , Marcel Apfelbaum , Peter Maydell , Eduardo Habkost , Roman Bolshakov , Pierrick Bouvier Subject: [PATCH v21 18/22] hw/arm, accel/hvf, whpx: unify get_physical_address_range between WHPX and HVF Date: Thu, 5 Feb 2026 15:25:36 +0100 Message-ID: <20260205142543.64818-19-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260205142543.64818-1-mohamed@unpredictable.fr> References: <20260205142543.64818-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: hO0vK5KcW1fjryoC-Fg1-8rzwvKnoebX X-Proofpoint-ORIG-GUID: hO0vK5KcW1fjryoC-Fg1-8rzwvKnoebX X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjA1MDEwOCBTYWx0ZWRfX16LKS5HLTtaJ a65lc7Z31iqkB/0CEV9XOJKg0NYfFToaH4z6VJTOM9128ZnrX6Zan3AU7FDNuVSKwwUUAVNOF/z id963w0+RtndGopWovfWoXed2Ld33Q8M+mUPHRdp90idyELS4UZ8KIqi+OIrgvxl7CpiLFCr91v GbvT9cEcgHVcmxQgRRnDmFpXKQJlMXAmIvdvTLdI5YWQFJzDAI7IRM3yup3TsWhydbbCMcWfGzw mrjzPPl2HmE11HsBdfe0PsrCG1FuSSnFhOrLcqz/eXrSXdevMSYTxHwLVYr/mOzBzdgw9pO6Ymn BCYqz64ypzBC7RL/FEmx14AjvkFnQkHu66hMpg+VVGNe442VxZamnp6D9F1gpk= X-Authority-Info-Out: v=2.4 cv=aN39aL9m c=1 sm=1 tr=0 ts=6984a8a2 cx=c_apl:c_apl_out:c_pps a=bsP7O+dXZ5uKcj+dsLqiMw==:117 a=bsP7O+dXZ5uKcj+dsLqiMw==:17 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=2TttH9MEl-kxELt7c1gA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-05_03,2026-02-05_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxlogscore=999 phishscore=0 spamscore=0 clxscore=1030 adultscore=0 lowpriorityscore=0 bulkscore=0 malwarescore=0 mlxscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602050108 X-JNJ: AAAAAAABGUkPl5kxd6Yn5sOBSwGf/8B0atCsxL7pDuZaBGlpO0Hk0whFw9uUbcOhPe1gxztFBMxE7P2vE3QXL9URlwbwW3AA37s2W7LB00vuc3HdvmnciHZppgg5xBViX/DiuZuBmnx7M3+0j1UV7nCswL8lLRmCIac8wOzdkKe4xmgUsgGR0MaE503xT3/sycyWTyonFOmwOJBAdqI3X/fD3q+I4vpPy+EgloU2BncTsaIBRVD3l+ZSVshyEx8u2ByyjCZ7cOkH9EBKDJ0ZIyIlv2scXuKtSydKpiKJyDps4OacAvrxXB9zx3EkeHZ0rMa5s63Gkdy3he+7Q5lPwxMNt/R5uUGaR4P5qBHu8bUGDXHmRZ3boT3ixiB8qwnQ54BoklXzRsHSt9QEGNuX5QCDJvU+E5/vdfqMJfELiyhRWu2KoUSJIBWKynFSyphF4OZFTTxlLD0+hFcUm9csl0uCzr39w7Rn72sh59kTeljJN9TohfgQn/VzvOSQ+Rh3L4uDe0jwvOBHufIHvx5yn5WIPXqPAUGOcv71CABiT0lWEkfqrlm/gYsHZlDltxzUBGQjYQCjI3b/FwbIndtb3XBSOdvL9XiAozgtrjsG5PbPuddR2j/cCncBq3U4hZKxoyLPIOcSRfltVGWRMPED6cW831OG22ReMvypXEOjZ/0MOw+DpKFsHNdOJcY3xrAFTx23jbF39L+PI6SovZl9mIvRjT7Txy0OjNhVNm7YyM/DJCwoT17vtCx14BzIVT6L1Ya3FSEve0i8LR6is17FF6Wxff9Z82iJb0ezh/18xpsRmUM2lhKW6BzYE1i5KY9nx8WQ/fqeFQ+eZzujdpFPB2hM0GcPU79H/kLyN6p0BaYG8Wv9mdSC+jZyNs1UkhcJnS78Prneqw5RbDztAYrlAIvNeaizDv844WhAALjidMXjFnXej5V85pRy/K/EOpRrtH6WEI/n3mxLNbQWm4Xkr7x+zxNwov0 TCsou 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=lists.gnu.org; Received-SPF: pass client-ip=57.103.84.13; envelope-from=mohamed@unpredictable.fr; helo=outbound.qs.icloud.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @unpredictable.fr) X-ZM-MESSAGEID: 1770301694488154100 Signed-off-by: Mohamed Mediouni Reviewed-by: Pierrick Bouvier Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- accel/hvf/hvf-all.c | 7 +++++-- hw/arm/virt.c | 43 +++++--------------------------------- include/hw/core/boards.h | 4 ++-- include/system/hvf_int.h | 4 ++++ target/arm/hvf-stub.c | 20 ------------------ target/arm/hvf/hvf.c | 6 +++--- target/arm/hvf_arm.h | 3 --- target/arm/meson.build | 1 - target/arm/whpx/whpx-all.c | 5 +++-- target/i386/hvf/hvf.c | 11 ++++++++++ 10 files changed, 33 insertions(+), 71 deletions(-) delete mode 100644 target/arm/hvf-stub.c diff --git a/accel/hvf/hvf-all.c b/accel/hvf/hvf-all.c index 0fbe27dfa2..033c677b6f 100644 --- a/accel/hvf/hvf-all.c +++ b/accel/hvf/hvf-all.c @@ -18,6 +18,7 @@ #include "system/hvf_int.h" #include "hw/core/cpu.h" #include "hw/core/boards.h" +#include "target/arm/hvf_arm.h" #include "trace.h" =20 bool hvf_allowed; @@ -186,8 +187,10 @@ static int hvf_accel_init(AccelState *as, MachineState= *ms) int pa_range =3D 36; MachineClass *mc =3D MACHINE_GET_CLASS(ms); =20 - if (mc->hvf_get_physical_address_range) { - pa_range =3D mc->hvf_get_physical_address_range(ms); + + if (mc->get_physical_address_range) { + pa_range =3D mc->get_physical_address_range(ms, + hvf_arch_get_default_ipa_bit_size(), hvf_arch_get_max_ipa_bit_= size()); if (pa_range < 0) { return -EINVAL; } diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 77832b566e..5c31695d37 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -3361,43 +3361,11 @@ static int virt_kvm_type(MachineState *ms, const ch= ar *type_str) return fixed_ipa ? 0 : requested_pa_size; } =20 -static int virt_whpx_get_physical_address_range(MachineState *ms) +static int virt_get_physical_address_range(MachineState *ms, + int default_ipa_size, int max_ipa_size) { VirtMachineState *vms =3D VIRT_MACHINE(ms); =20 - int max_ipa_size =3D whpx_arm_get_ipa_bit_size(); - - /* We freeze the memory map to compute the highest gpa */ - virt_set_memmap(vms, max_ipa_size); - - int requested_ipa_size =3D 64 - clz64(vms->highest_gpa); - - /* - * If we're <=3D the default IPA size just use the default. - * If we're above the default but below the maximum, round up to - * the maximum. whpx_arm_get_max_ipa_bit_size() conveniently only - * returns values that are valid ARM PARange values. - */ - if (requested_ipa_size <=3D max_ipa_size) { - requested_ipa_size =3D max_ipa_size; - } else { - error_report("-m and ,maxmem option values " - "require an IPA range (%d bits) larger than " - "the one supported by the host (%d bits)", - requested_ipa_size, max_ipa_size); - return -1; - } - - return requested_ipa_size; -} - -static int virt_hvf_get_physical_address_range(MachineState *ms) -{ - VirtMachineState *vms =3D VIRT_MACHINE(ms); - - int default_ipa_size =3D hvf_arm_get_default_ipa_bit_size(); - int max_ipa_size =3D hvf_arm_get_max_ipa_bit_size(); - /* We freeze the memory map to compute the highest gpa */ virt_set_memmap(vms, max_ipa_size); =20 @@ -3406,8 +3374,8 @@ static int virt_hvf_get_physical_address_range(Machin= eState *ms) /* * If we're <=3D the default IPA size just use the default. * If we're above the default but below the maximum, round up to - * the maximum. hvf_arm_get_max_ipa_bit_size() conveniently only - * returns values that are valid ARM PARange values. + * the maximum. hvf/whpx_arch_get_max_ipa_bit_size() conveniently only + * return values that are valid ARM PARange values. */ if (requested_ipa_size <=3D default_ipa_size) { requested_ipa_size =3D default_ipa_size; @@ -3489,8 +3457,7 @@ static void virt_machine_class_init(ObjectClass *oc, = const void *data) mc->get_valid_cpu_types =3D virt_get_valid_cpu_types; mc->get_default_cpu_node_id =3D virt_get_default_cpu_node_id; mc->kvm_type =3D virt_kvm_type; - mc->hvf_get_physical_address_range =3D virt_hvf_get_physical_address_r= ange; - mc->whpx_get_physical_address_range =3D virt_whpx_get_physical_address= _range; + mc->get_physical_address_range =3D virt_get_physical_address_range; assert(!mc->get_hotplug_handler); mc->get_hotplug_handler =3D virt_machine_get_hotplug_handler; hc->pre_plug =3D virt_machine_device_pre_plug_cb; diff --git a/include/hw/core/boards.h b/include/hw/core/boards.h index 0b2aefb126..26e0879e1a 100644 --- a/include/hw/core/boards.h +++ b/include/hw/core/boards.h @@ -277,8 +277,8 @@ struct MachineClass { void (*reset)(MachineState *state, ResetType type); void (*wakeup)(MachineState *state); int (*kvm_type)(MachineState *machine, const char *arg); - int (*hvf_get_physical_address_range)(MachineState *machine); - int (*whpx_get_physical_address_range)(MachineState *machine); + int (*get_physical_address_range)(MachineState *machine, + int default_ipa_size, int max_ipa_size); =20 BlockInterfaceType block_default_type; int units_per_default_bus; diff --git a/include/system/hvf_int.h b/include/system/hvf_int.h index 96790b4938..2621164cb2 100644 --- a/include/system/hvf_int.h +++ b/include/system/hvf_int.h @@ -57,6 +57,8 @@ void assert_hvf_ok_impl(hv_return_t ret, const char *file= , unsigned int line, const char *hvf_return_string(hv_return_t ret); int hvf_arch_init(void); hv_return_t hvf_arch_vm_create(MachineState *ms, uint32_t pa_range); +uint32_t hvf_arch_get_default_ipa_bit_size(void); +uint32_t hvf_arch_get_max_ipa_bit_size(void); void hvf_kick_vcpu_thread(CPUState *cpu); =20 /* Must be called by the owning thread */ @@ -107,5 +109,7 @@ int hvf_update_guest_debug(CPUState *cpu); bool hvf_arch_supports_guest_debug(void); =20 bool hvf_arch_cpu_realize(CPUState *cpu, Error **errp); +uint32_t hvf_arch_get_default_ipa_bit_size(void); +uint32_t hvf_arch_get_max_ipa_bit_size(void); =20 #endif diff --git a/target/arm/hvf-stub.c b/target/arm/hvf-stub.c deleted file mode 100644 index ff137267a0..0000000000 --- a/target/arm/hvf-stub.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * QEMU Hypervisor.framework (HVF) stubs for ARM - * - * Copyright (c) Linaro - * - * SPDX-License-Identifier: GPL-2.0-or-later - */ - -#include "qemu/osdep.h" -#include "hvf_arm.h" - -uint32_t hvf_arm_get_default_ipa_bit_size(void) -{ - g_assert_not_reached(); -} - -uint32_t hvf_arm_get_max_ipa_bit_size(void) -{ - g_assert_not_reached(); -} diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index 9ce720793d..1b19d9713e 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -825,7 +825,7 @@ static uint64_t hvf_get_reg(CPUState *cpu, int rt) static void clamp_id_aa64mmfr0_parange_to_ipa_size(ARMISARegisters *isar) { uint32_t ipa_size =3D chosen_ipa_bit_size ? - chosen_ipa_bit_size : hvf_arm_get_max_ipa_bit_size(); + chosen_ipa_bit_size : hvf_arch_get_max_ipa_bit_size(); uint64_t id_aa64mmfr0; =20 /* Clamp down the PARange to the IPA size the kernel supports. */ @@ -921,7 +921,7 @@ static bool hvf_arm_get_host_cpu_features(ARMHostCPUFea= tures *ahcf) return r =3D=3D HV_SUCCESS; } =20 -uint32_t hvf_arm_get_default_ipa_bit_size(void) +uint32_t hvf_arch_get_default_ipa_bit_size(void) { uint32_t default_ipa_size; hv_return_t ret =3D hv_vm_config_get_default_ipa_size(&default_ipa_siz= e); @@ -930,7 +930,7 @@ uint32_t hvf_arm_get_default_ipa_bit_size(void) return default_ipa_size; } =20 -uint32_t hvf_arm_get_max_ipa_bit_size(void) +uint32_t hvf_arch_get_max_ipa_bit_size(void) { uint32_t max_ipa_size; hv_return_t ret =3D hv_vm_config_get_max_ipa_size(&max_ipa_size); diff --git a/target/arm/hvf_arm.h b/target/arm/hvf_arm.h index ea82f2691d..5d19d82e5d 100644 --- a/target/arm/hvf_arm.h +++ b/target/arm/hvf_arm.h @@ -22,7 +22,4 @@ void hvf_arm_init_debug(void); =20 void hvf_arm_set_cpu_features_from_host(ARMCPU *cpu); =20 -uint32_t hvf_arm_get_default_ipa_bit_size(void); -uint32_t hvf_arm_get_max_ipa_bit_size(void); - #endif diff --git a/target/arm/meson.build b/target/arm/meson.build index ce155ba9b4..1ddc4b2a54 100644 --- a/target/arm/meson.build +++ b/target/arm/meson.build @@ -41,7 +41,6 @@ arm_common_system_ss.add(files('cpu.c')) arm_common_system_ss.add(when: 'TARGET_AARCH64', if_false: files( 'cpu32-stubs.c')) arm_common_system_ss.add(when: 'CONFIG_KVM', if_false: files('kvm-stub.c')) -arm_common_system_ss.add(when: 'CONFIG_HVF', if_false: files('hvf-stub.c')) arm_common_system_ss.add(when: 'CONFIG_ARM_COMPATIBLE_SEMIHOSTING', if_true: files('common-semi-target.c')) arm_common_system_ss.add(files( diff --git a/target/arm/whpx/whpx-all.c b/target/arm/whpx/whpx-all.c index 850f6ec81f..6067918b27 100644 --- a/target/arm/whpx/whpx-all.c +++ b/target/arm/whpx/whpx-all.c @@ -770,8 +770,9 @@ int whpx_accel_init(AccelState *as, MachineState *ms) goto error; } =20 - if (mc->whpx_get_physical_address_range) { - pa_range =3D mc->whpx_get_physical_address_range(ms); + if (mc->get_physical_address_range) { + pa_range =3D mc->get_physical_address_range(ms, + whpx_arm_get_ipa_bit_size(), whpx_arm_get_ipa_bit_size()); if (pa_range < 0) { return -EINVAL; } diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c index 7cfaee389e..ce54020f00 100644 --- a/target/i386/hvf/hvf.c +++ b/target/i386/hvf/hvf.c @@ -228,6 +228,17 @@ int hvf_arch_init(void) return 0; } =20 +/* 48-bit on all Intel Macs. Function currently unused. */ +uint32_t hvf_arch_get_default_ipa_bit_size(void) +{ + g_assert_not_reached(); +} + +uint32_t hvf_arch_get_max_ipa_bit_size(void) +{ + g_assert_not_reached(); +} + hv_return_t hvf_arch_vm_create(MachineState *ms, uint32_t pa_range) { return hv_vm_create(HV_VM_DEFAULT); --=20 2.50.1 (Apple Git-155) From nobody Sat Feb 7 07:31:33 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=unpredictable.fr ARC-Seal: i=1; a=rsa-sha256; t=1770301844; cv=none; d=zohomail.com; s=zohoarc; b=nv6XiZsYzgLJK+ACX/FAGrr743HzkA0AMnPQNR+rut3m70qTZ/387VRCdbSEyZqTaBRDKygE3C1fMNLmDZ84rjFgYmssQfsFtKr4fwSzZekwucjv45Ko0r60HtlUXbFw+/uBU9K6+cw7INegezGQ25Y+/YgA/uNEOt95VZyzWSw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770301844; 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=CD7WXAJUs520lYihpYaluR3foYw2WDZXLPihgzEb9wc=; b=bWLNd+bKhvkk+WPhwV9M+ab8/ljVXqd3uu6feSdwCpi84kAYVkmLGn2pdPNJzBQM4YvkhnGCFvKHikMTy1/Qb7PMUM0fASXMd+kmQYRteQ+uqfLqwqtA4bhVcFpQoojowk+ONdQfsQSDu1Pksu21a03LsW4CNYuKU94KPjmpgxs= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770301844180573.2373649053515; Thu, 5 Feb 2026 06:30:44 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vo0Jz-0001Sg-8R; Thu, 05 Feb 2026 09:27:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0Jl-0001AP-GF for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:50 -0500 Received: from qs-2004g-snip4-11.eps.apple.com ([57.103.84.73] helo=outbound.qs.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0Jj-00083W-J3 for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:49 -0500 Received: from outbound.qs.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPS id 983FD180027B; Thu, 5 Feb 2026 14:26:43 +0000 (UTC) Received: from localhost.localdomain (unknown [17.57.155.37]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPSA id 5FDC11800D80; Thu, 5 Feb 2026 14:26:40 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1770301606; x=1772893606; bh=CD7WXAJUs520lYihpYaluR3foYw2WDZXLPihgzEb9wc=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=CHdmJ0lZMdnN9Oc7mBYggp9ZFUodjKcDagevcLd0d67wGJcW8K82+SwnzIWTqI8lh78EmfH/FyOVGKMW7X+Gobl0g/0ObQZ82TGQgn/9C+UJRigGaNWyOUzBdPWsfYZ33lEhMmvR3F4SbObnD4rXtLDhBl2xceljVF3GggjzrHyKPHPveZ1rkIGLObKDICdhEatIlh10qP0huBS3auc4e5NZvypDkKNm11WBgU+32T7zGJv1U+m8TirmeCPay/YAfXCSXm/N8Jwj0PsHUjEzNBLiOUcy2yYMEuoQs8ZVNq3sCiBnjaVbcuc4AFmK5o/neQpRrj5SB/M82mGpgchSSw== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org, mohamed@unpredictable.fr Cc: Zhao Liu , Paolo Bonzini , Akihiko Odaki , Cameron Esfahani , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Shannon Zhao , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Phil Dennis-Jordan , "Michael S. Tsirkin" , Richard Henderson , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Alexander Graf , Pedro Barbuda , Yanan Wang , Ani Sinha , Igor Mammedov , Marcel Apfelbaum , Peter Maydell , Eduardo Habkost , Roman Bolshakov , Pierrick Bouvier Subject: [PATCH v21 19/22] whpx: arm64: implement -cpu host Date: Thu, 5 Feb 2026 15:25:37 +0100 Message-ID: <20260205142543.64818-20-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260205142543.64818-1-mohamed@unpredictable.fr> References: <20260205142543.64818-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Authority-Info-Out: v=2.4 cv=WZMBqkhX c=1 sm=1 tr=0 ts=6984a8a5 cx=c_apl:c_apl_out:c_pps a=bsP7O+dXZ5uKcj+dsLqiMw==:117 a=bsP7O+dXZ5uKcj+dsLqiMw==:17 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=L6Cw-x9jAAAA:20 a=KKAkSRfTAAAA:8 a=hGuVB2XOhXFvD5HHq_UA:9 a=cvBusfyB2V15izCimMoJ:22 a=bA3UWDv6hWIuX7UZL3qL:22 X-Proofpoint-ORIG-GUID: KavsYq3HQTQ7uxsPy37QHvw6vfekIXQy X-Proofpoint-GUID: KavsYq3HQTQ7uxsPy37QHvw6vfekIXQy X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjA1MDEwOCBTYWx0ZWRfX92lobvA2u2tj pGHIdD2e8pbWLMkU06MBN5gSYW+sPvTtteld+iCesmbJC95zWNFg3xpw8YhXdFdtnnmA7p59v1T Cd4knHXzWrxIgJZq71g2hCFq8uIGJeWiXwG2TfegpMatHPdrnaTUjaRgt0S5BTgG4HzwbP08ph6 Zr+suswopBCwTVG4lGUkMwK9Psw4zXzQZDKXoqvrpWoTLAGZE7FTct/PcTCb1mzWy8xteKX0PbN n7OKBDwczrvsSPoN6+GYv/nBkU1GOzvSf7yGo5ERzBp/Cg0yPG1FvVC24I0tiIibzWyXQbgAULd MXcj1ruskOqFRwV4KGvT/iSGNdrcRUqbrQQIYYElqPWtrUAthsJPgFL+ALp6f8= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-05_03,2026-02-05_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 malwarescore=0 clxscore=1030 phishscore=0 mlxscore=0 bulkscore=0 spamscore=0 lowpriorityscore=0 mlxlogscore=999 suspectscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602050108 X-JNJ: AAAAAAABnMm6CgCZsKvwk732CQANZjwnT6KVXPCBeFV2jco9ptCwJ5hteyfGSN47eElOoqC/o2FvqBb+MzL98M7G0K5TzAl2Rymij78trhDshlSiD8yUOGD6vipq796cpt2zqlpzYu3nS23W0roNX5TqRmzKsiG7X6eJFW8TV2nGNYygcFkwly77hy/gGWLiVc4/ERkHH8qnOU/u56MzuRupV/Jxsgipur8F/Ja8TWXI8qv/7h3aLNjJGZCG8if5NvhBL4pWN7W5oqaSbwkS6GDlxr8Ga411p0P4SqSEp9WhNUMWHk2bvACd/7I4ngP6xmL9YzlH+gmwdi/WgsUvGfQZC1CxVeBW+SxoATgSy3a/tC/Ke5wcjOHr5DvY/Dgw8LnbpgcKwXqzDuCG7lNxo6owh8M+SjVei+nN2DLesV9ZnL8m3ifIjw9iAYlKlgJmuy9GOuWxm05xxBbLJ7OKvYHnkV5aRRg1CBbizpCEi8qnBRdvDD3tgh3Nx7/wsKdw7cylxcRIH6DAr81YaVwn+hm2t4xh+Hh2/lU9NHraEPzjJ76CC9PrBUGPwEz89UdS2pix283Ic5SD3w9MHiIlHEJrhqzUrB3lfGSHcZuLDR+1by34KNOUv6UD/c8Hrb0ack1KiAZlftys0mx6KyV869+VGFccdNiJ6LfpALPNrvmRejY+4xk2aLKRF2aiGAcdh0ZLYfhuuEk2/V1jqPoGRBLAzbPANYspkYO9jj9ozLEVO1mliHKvbmc4okRUuJgMpwfvxAWFbbKwgoUAke2Rs2HsSlRQJh5iQE8LZPgXXhV+FdvEazydTMxFAZoZ1/EZOCLffSOeJHF0/VNctdv08wlpJVf/uzHgeAgbczKjiLu8O6MAo/LU5xle8gU+6XLh9BaYxxZsXrUaQJ0URS6VSvHwLZ9PKtqarh7TOx9ycS6krzyP2+0226l29qkA8N5Uawhc 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=lists.gnu.org; Received-SPF: pass client-ip=57.103.84.73; envelope-from=mohamed@unpredictable.fr; helo=outbound.qs.icloud.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @unpredictable.fr) X-ZM-MESSAGEID: 1770301846143158500 Content-Type: text/plain; charset="utf-8" Logic to fetch MIDR_EL1 for cpu 0 adapted from: https://github.com/FEX-Emu/FEX/blob/e6de17e72ef03aa88ba14fa0ec13163061608c7= 4/Source/Windows/Common/CPUFeatures.cpp#L62 Signed-off-by: Mohamed Mediouni Reviewed-by: Pierrick Bouvier Reviewed-by: Akihiko Odaki --- target/arm/cpu64.c | 17 +++--- target/arm/whpx/whpx-all.c | 104 +++++++++++++++++++++++++++++++++++++ target/arm/whpx_arm.h | 1 + 3 files changed, 116 insertions(+), 6 deletions(-) diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 4dfc03973e..5d7c6b7fbb 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -26,10 +26,13 @@ #include "qemu/units.h" #include "system/kvm.h" #include "system/hvf.h" +#include "system/whpx.h" +#include "system/hw_accel.h" #include "system/qtest.h" #include "system/tcg.h" #include "kvm_arm.h" #include "hvf_arm.h" +#include "whpx_arm.h" #include "qapi/visitor.h" #include "hw/core/qdev-properties.h" #include "internals.h" @@ -521,7 +524,7 @@ void arm_cpu_pauth_finalize(ARMCPU *cpu, Error **errp) isar2 =3D FIELD_DP64(isar2, ID_AA64ISAR2, APA3, 0); isar2 =3D FIELD_DP64(isar2, ID_AA64ISAR2, GPA3, 0); =20 - if (kvm_enabled() || hvf_enabled()) { + if (hwaccel_enabled()) { /* * Exit early if PAuth is enabled and fall through to disable it. * The algorithm selection properties are not present. @@ -598,10 +601,10 @@ void aarch64_add_pauth_properties(Object *obj) =20 /* Default to PAUTH on, with the architected algorithm on TCG. */ qdev_property_add_static(DEVICE(obj), &arm_cpu_pauth_property); - if (kvm_enabled() || hvf_enabled()) { + if (hwaccel_enabled()) { /* * Mirror PAuth support from the probed sysregs back into the - * property for KVM or hvf. Is it just a bit backward? Yes it is! + * property for HW accel. Is it just a bit backward? Yes it is! * Note that prop_pauth is true whether the host CPU supports the * architected QARMA5 algorithm or the IMPDEF one. We don't * provide the separate pauth-impdef property for KVM or hvf, @@ -769,6 +772,8 @@ static void aarch64_host_initfn(Object *obj) } #elif defined(CONFIG_HVF) hvf_arm_set_cpu_features_from_host(cpu); +#elif defined(CONFIG_WHPX) + whpx_arm_set_cpu_features_from_host(cpu); #else g_assert_not_reached(); #endif @@ -779,8 +784,8 @@ static void aarch64_host_initfn(Object *obj) =20 static void aarch64_max_initfn(Object *obj) { - if (kvm_enabled() || hvf_enabled()) { - /* With KVM or HVF, '-cpu max' is identical to '-cpu host' */ + if (hwaccel_enabled()) { + /* When hardware acceleration enabled, '-cpu max' is identical to = '-cpu host' */ aarch64_host_initfn(obj); return; } @@ -799,7 +804,7 @@ static const ARMCPUInfo aarch64_cpus[] =3D { { .name =3D "cortex-a57", .initfn =3D aarch64_a57_initfn }, { .name =3D "cortex-a53", .initfn =3D aarch64_a53_initfn }, { .name =3D "max", .initfn =3D aarch64_max_initfn }, -#if defined(CONFIG_KVM) || defined(CONFIG_HVF) +#if defined(CONFIG_KVM) || defined(CONFIG_HVF) || defined(CONFIG_WHPX) { .name =3D "host", .initfn =3D aarch64_host_initfn }, #endif }; diff --git a/target/arm/whpx/whpx-all.c b/target/arm/whpx/whpx-all.c index 6067918b27..c88c67a9e2 100644 --- a/target/arm/whpx/whpx-all.c +++ b/target/arm/whpx/whpx-all.c @@ -41,6 +41,17 @@ =20 #include #include +#include + +typedef struct ARMHostCPUFeatures { + ARMISARegisters isar; + uint64_t features; + uint64_t midr; + uint32_t reset_sctlr; + const char *dtb_compatible; +} ARMHostCPUFeatures; + +static ARMHostCPUFeatures arm_host_cpu_features; =20 typedef struct WHPXRegMatch { WHV_REGISTER_NAME reg; @@ -668,6 +679,99 @@ static void clamp_id_aa64mmfr0_parange_to_ipa_size(ARM= ISARegisters *isar) SET_IDREG(isar, ID_AA64MMFR0, id_aa64mmfr0); } =20 +static uint64_t whpx_read_midr(void) +{ + HKEY key; + uint64_t midr_el1; + DWORD size =3D sizeof(midr_el1); + const char *path =3D "Hardware\\Description\\System\\CentralProcessor\= \0\\"; + assert(!RegOpenKeyExA(HKEY_LOCAL_MACHINE, path, 0, KEY_READ, &key)); + assert(!RegGetValueA(key, NULL, "CP 4000", RRF_RT_REG_QWORD, NULL, &mi= dr_el1, &size)); + RegCloseKey(key); + return midr_el1; +} + +static bool whpx_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) +{ + const struct isar_regs { + WHV_REGISTER_NAME reg; + uint64_t *val; + } regs[] =3D { + { WHvArm64RegisterIdAa64Pfr0El1, &ahcf->isar.idregs[ID_AA64PFR0_EL= 1_IDX] }, + { WHvArm64RegisterIdAa64Pfr1El1, &ahcf->isar.idregs[ID_AA64PFR1_EL= 1_IDX] }, + { WHvArm64RegisterIdAa64Dfr0El1, &ahcf->isar.idregs[ID_AA64DFR0_EL= 1_IDX] }, + { WHvArm64RegisterIdAa64Dfr1El1 , &ahcf->isar.idregs[ID_AA64DFR1_E= L1_IDX] }, + { WHvArm64RegisterIdAa64Isar0El1, &ahcf->isar.idregs[ID_AA64ISAR0_= EL1_IDX] }, + { WHvArm64RegisterIdAa64Isar1El1, &ahcf->isar.idregs[ID_AA64ISAR1_= EL1_IDX] }, + { WHvArm64RegisterIdAa64Isar2El1, &ahcf->isar.idregs[ID_AA64ISAR2_= EL1_IDX] }, + { WHvArm64RegisterIdAa64Mmfr0El1, &ahcf->isar.idregs[ID_AA64MMFR0_= EL1_IDX] }, + { WHvArm64RegisterIdAa64Mmfr1El1, &ahcf->isar.idregs[ID_AA64MMFR1_= EL1_IDX] }, + { WHvArm64RegisterIdAa64Mmfr2El1, &ahcf->isar.idregs[ID_AA64MMFR2_= EL1_IDX] }, + { WHvArm64RegisterIdAa64Mmfr3El1, &ahcf->isar.idregs[ID_AA64MMFR2_= EL1_IDX] } + }; + + int i; + WHV_REGISTER_VALUE val; + + ahcf->dtb_compatible =3D "arm,armv8"; + ahcf->features =3D (1ULL << ARM_FEATURE_V8) | + (1ULL << ARM_FEATURE_NEON) | + (1ULL << ARM_FEATURE_AARCH64) | + (1ULL << ARM_FEATURE_PMU) | + (1ULL << ARM_FEATURE_GENERIC_TIMER); + + for (i =3D 0; i < ARRAY_SIZE(regs); i++) { + clean_whv_register_value(&val); + whpx_get_global_reg(regs[i].reg, &val); + *regs[i].val =3D val.Reg64; + } + + /* + * MIDR_EL1 is not a global register on WHPX + * As such, read the CPU0 from the registry to get a consistent value. + * Otherwise, on heterogenous systems, you'll get variance between CPU= s. + */ + ahcf->midr =3D whpx_read_midr(); + + clamp_id_aa64mmfr0_parange_to_ipa_size(&ahcf->isar); + + /* + * Disable SVE, which is not supported by QEMU whpx yet. + * Work needed for SVE support: + * - SVE state save/restore + * - any potentially needed VL management + * Also disable SME at the same time. (not currently supported by Hype= r-V) + */ + SET_IDREG(&ahcf->isar, ID_AA64PFR0, + GET_IDREG(&ahcf->isar, ID_AA64PFR0) & ~R_ID_AA64PFR0_SVE_MAS= K); + + SET_IDREG(&ahcf->isar, ID_AA64PFR1, + GET_IDREG(&ahcf->isar, ID_AA64PFR1) & ~R_ID_AA64PFR1_SME_MAS= K); + + return true; +} + +void whpx_arm_set_cpu_features_from_host(ARMCPU *cpu) +{ + if (!arm_host_cpu_features.dtb_compatible) { + if (!whpx_enabled() || + !whpx_arm_get_host_cpu_features(&arm_host_cpu_features)) { + /* + * We can't report this error yet, so flag that we need to + * in arm_cpu_realizefn(). + */ + cpu->host_cpu_probe_failed =3D true; + return; + } + } + + cpu->dtb_compatible =3D arm_host_cpu_features.dtb_compatible; + cpu->isar =3D arm_host_cpu_features.isar; + cpu->env.features =3D arm_host_cpu_features.features; + cpu->midr =3D arm_host_cpu_features.midr; + cpu->reset_sctlr =3D arm_host_cpu_features.reset_sctlr; +} + int whpx_init_vcpu(CPUState *cpu) { HRESULT hr; diff --git a/target/arm/whpx_arm.h b/target/arm/whpx_arm.h index de7406b66f..df65fd753c 100644 --- a/target/arm/whpx_arm.h +++ b/target/arm/whpx_arm.h @@ -12,5 +12,6 @@ #include "target/arm/cpu-qom.h" =20 uint32_t whpx_arm_get_ipa_bit_size(void); +void whpx_arm_set_cpu_features_from_host(ARMCPU *cpu); =20 #endif --=20 2.50.1 (Apple Git-155) From nobody Sat Feb 7 07:31:33 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=unpredictable.fr ARC-Seal: i=1; a=rsa-sha256; t=1770301824; cv=none; d=zohomail.com; s=zohoarc; b=L5UXxr9DWuCtum9oaFPXtFAvIzJziNO3tNJQT/DsULPf0PoJQpXkNbWOiwFoCE0zaorrHsQUfJN8YUmGbq3dZdou9SAVDDNRFRAwLr7Y59mDzS+2gh7oJfj52iPApgYKgghGkXQgi0bToyyzQ0+TiIRWE21SeiamCLTgFAHuD4c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770301824; 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=dXlBjrYQLV1qCj1RHDhCy7H3jFtP7Evi4SFhHqHKNZU=; b=V2TNx0AAb9TKA0by2nm6AoxvE0ThJEwkWEBjejRUKOmQmz5gaRla/6PpZbjVhpH97lygnlWPUZll/ubODqDT2I9NnoNPTFvSpavvVdSQXWtv11oW52AKRp5kghh7955+pSIPUI9i5pcaHDIbd5UyHbVVaapI9RDtuGlUg0vRd5M= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770301824725865.2691840696588; Thu, 5 Feb 2026 06:30:24 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vo0Jz-0001Tv-Fp; Thu, 05 Feb 2026 09:27:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0Jn-0001BD-Nx for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:52 -0500 Received: from qs-2004c-snip4-11.eps.apple.com ([57.103.84.33] helo=outbound.qs.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0Jm-00084P-6s for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:51 -0500 Received: from outbound.qs.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPS id 881BA1800D95; Thu, 5 Feb 2026 14:26:46 +0000 (UTC) Received: from localhost.localdomain (unknown [17.57.155.37]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPSA id 45FE5180014F; Thu, 5 Feb 2026 14:26:43 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1770301609; x=1772893609; bh=dXlBjrYQLV1qCj1RHDhCy7H3jFtP7Evi4SFhHqHKNZU=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=XkIVNnNz82CWM+qYWwiz3YEsCx/4rOy2n1VHBJQXZgdoDroDh8V3LY4vCG5uDrFeXemRvfmCOb6A43GSpc7dUsoV0OBk90r4YOIHzTrwMgHV2eUfhT6RX+fwNMLaZqoODnZg9ps5A8CHuhyDgytT5R3TKw+Va5NZgPZb9gp3JFtYzyAdDJfK+LOCnXjZNQIgY82s1RcDwQulm6eDycDR00A9y1FYSBUGZSfwQYM5ewk9yDRH2AIZByxc2IKSVvAkQteY80l2p2ip7CRQkqgnN6PPTMOEuUV2deYBdjQWlP4h3VrPVjof76SIVoSdvwk98yrOni3xaiIj0uEDlEMHMA== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org, mohamed@unpredictable.fr Cc: Zhao Liu , Paolo Bonzini , Akihiko Odaki , Cameron Esfahani , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Shannon Zhao , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Phil Dennis-Jordan , "Michael S. Tsirkin" , Richard Henderson , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Alexander Graf , Pedro Barbuda , Yanan Wang , Ani Sinha , Igor Mammedov , Marcel Apfelbaum , Peter Maydell , Eduardo Habkost , Roman Bolshakov , Pierrick Bouvier Subject: [PATCH v21 20/22] target/arm: whpx: instantiate GIC early Date: Thu, 5 Feb 2026 15:25:38 +0100 Message-ID: <20260205142543.64818-21-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260205142543.64818-1-mohamed@unpredictable.fr> References: <20260205142543.64818-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: 1KP28ueGUCRvnZaT4BNeKohuSDxEUWHQ X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjA1MDEwOSBTYWx0ZWRfX2+Bp5Jmem0Uk Y+1Zr4XaD9gJwe9a3ipdHPGPi5oKWctV7Pim0PZ243QgvExdnq4B0sbWckiEsvNY1BXvw4XqU/A lNWxLWAaMex9SUWh5I/7letT6OQ11KpXAx0lwCOmMidynd+cIKTWpG/2BNLzNcxLr1Nu6NEHqN5 nqJogb2X3KZd+fVMfL9r+K0XXapNoze5+EM5w4OtfMun+OViP1p/BluvOPHZ5wZsMmMoZB2BVNc Au9CDO8deSpbJVUsRW/kKIq9O/TmsDpBS1jkLC/pWj1T29j4Lkljhd4ws9G7a/bjLR906rRObhP QYjdDl1ROVJXvlnthYjn+OJC3FXwgF9M9WWaPqWm/vFcug9HFU9ttHwgeT6wG0= X-Authority-Info-Out: v=2.4 cv=WtAm8Nfv c=1 sm=1 tr=0 ts=6984a8a8 cx=c_apl:c_apl_out:c_pps a=bsP7O+dXZ5uKcj+dsLqiMw==:117 a=bsP7O+dXZ5uKcj+dsLqiMw==:17 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=EYz79TNVRTG0waESW9UA:9 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-ORIG-GUID: 1KP28ueGUCRvnZaT4BNeKohuSDxEUWHQ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-05_03,2026-02-05_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 bulkscore=0 phishscore=0 mlxscore=0 adultscore=0 lowpriorityscore=0 malwarescore=0 mlxlogscore=994 clxscore=1030 spamscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602050109 X-JNJ: AAAAAAABn2pqz4ROYjwf2N6P3LvJPTSYadLkCDM4Hbdw7hcK4dQB0hdFANDM8MVAc8Nt0GaVLEBrDpuZYP4DplIUGiEmB89rOE3pIYNv36gauICHvVm/fflxYR6R4UI66RcnWroqWY/gToCgkoJBZKscwg5gE5U5cCxfzNopdMO8OV2GvtJI2prtFDgZyBcxwFZfRQYUGZtFsP0EifmRCgtRWsbhBax3Lh5B3NBrE1DGpUr+kNDAw2hSSwPUuqOmPCzbMwxW4N+Uq1Od9CO5n6ERkAjbJVgddzVcgv79B0bFq8Y79Ts18gLV5okfVWBdgs5L2p62+Aoqg5Amf3vEZLVgHDcod8gTBdqTUgd2/8OFnnIP44CCL8999eikdrCLMh3LH+HBvd5CRhumHu2Tp6YH/R24hftErs3x+NTSQshAvx94rjRB+kzkF8Bp5Y3EpX6v8Z1HdDtkmJ885d3qL6tq/yYiPuRvaLQcg3gF+7/J6wx7bEOpGGgvWEcmBxoYdU2qQV6fQ5TLpco9ME9rH3QG9hSYbW4xWstmmG2JHmAuwSnkl0tOY6AahjqGmQYwfYJHzrRHnoDoMalPTT2OgM8aGhJvdcXuoWs1koZEe3IG5/pJbmXkWXwWuLLRyNNc5RheK1WdsaVlCtNy8r/piG9lh6FKKPXq3Qi4HyKzML59yGCJePXhkqPSnv5wJuI4U0oKXvHKiNYA3gWB6PyCBF69/4gqoY0Gy0RLngz5B+iYya754OgbgggUKDRuGBLoANf7Xc5jUVMMTm1FToGacavPXu6IBOwvyBZu7H2PqJcD2VTZ4lO6S2kDrPNrgyQT3gxpJYBnpJYj7jgc3ezxzEgclEfMirKNz55nWsC4ycddxVy3+Tu7SU2I8gxqpAamGAit1ekwm4sqJTuQx6OeOaOURES7/3SLbI29fwZd9xOp2NiakJiA81y6B6Hplw== 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=lists.gnu.org; Received-SPF: pass client-ip=57.103.84.33; envelope-from=mohamed@unpredictable.fr; helo=outbound.qs.icloud.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @unpredictable.fr) X-ZM-MESSAGEID: 1770301826394154100 Content-Type: text/plain; charset="utf-8" While figuring out a better spot for it, put it in whpx_accel_init. Needs to be done before WHvSetupPartition. Signed-off-by: Mohamed Mediouni Reviewed-by: Pierrick Bouvier Reviewed-by: Akihiko Odaki --- target/arm/whpx/whpx-all.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/target/arm/whpx/whpx-all.c b/target/arm/whpx/whpx-all.c index c88c67a9e2..44ef42307b 100644 --- a/target/arm/whpx/whpx-all.c +++ b/target/arm/whpx/whpx-all.c @@ -939,6 +939,38 @@ int whpx_accel_init(AccelState *as, MachineState *ms) =20 memset(&prop, 0, sizeof(prop)); =20 + /* + * The only currently supported configuration for the interrupt + * controller is kernel-irqchip=3Don,gic-version=3D3, with the `virt` + * machine. + * + * Initialising the vGIC here because it needs to be done prior to + * WHvSetupPartition. + */ + + WHV_ARM64_IC_PARAMETERS ic_params =3D { + .EmulationMode =3D WHvArm64IcEmulationModeGicV3, + .GicV3Parameters =3D { + .GicdBaseAddress =3D 0x08000000, + .GitsTranslaterBaseAddress =3D 0x08080000, + .GicLpiIntIdBits =3D 0, + .GicPpiPerformanceMonitorsInterrupt =3D VIRTUAL_PMU_IRQ, + .GicPpiOverflowInterruptFromCntv =3D ARCH_TIMER_VIRT_IRQ + } + }; + prop.Arm64IcParameters =3D ic_params; + + hr =3D whp_dispatch.WHvSetPartitionProperty( + whpx->partition, + WHvPartitionPropertyCodeArm64IcParameters, + &prop, + sizeof(prop)); + if (FAILED(hr)) { + error_report("WHPX: Failed to enable GICv3 interrupt controller, h= r=3D%08lx", hr); + ret =3D -EINVAL; + goto error; + } + hr =3D whp_dispatch.WHvSetupPartition(whpx->partition); if (FAILED(hr)) { error_report("WHPX: Failed to setup partition, hr=3D%08lx", hr); --=20 2.50.1 (Apple Git-155) From nobody Sat Feb 7 07:31:33 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=unpredictable.fr ARC-Seal: i=1; a=rsa-sha256; t=1770301908; cv=none; d=zohomail.com; s=zohoarc; b=WBqF0iqriK3o9tG+YpVaWbKDz1BpAXF4flM/ntIbzGFLDxq4jeUr7NiCXs0HbNKaOvO+8OLWlbrlhgHoIzjnmL6AxDF2EbBCuudOGg+fo9bhVXLpkjir7HnagmVNPxh3o2UYo7AORPlfdn0o8joWGCdRbXAhTQiF9gVS7CxNtro= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770301908; 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=yJUrkA3wK08ViV31cAOA/Pb+MGLmCaTb/RGoYUR01yw=; b=Czn1/C2z3nrMSW3QDUqKp50icnFyvf2Gy1Oseq5C2WKPHu+Srgj1evn+zuwVl1SwHQKCOn4WSs4EhmQXEWzhmIs9VqFG3vZReuxd7LixiiTrizAnSeTnhxlaTAHr64yU15ahNFmf2LnBOHV19T8nwjnvt5ph1cGmjotBCJMDlM0= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17703019088404.4774052115735685; Thu, 5 Feb 2026 06:31:48 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vo0K0-0001XM-Dt; Thu, 05 Feb 2026 09:27:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0Js-0001Kh-OH for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:58 -0500 Received: from qs-2004a-snip4-4.eps.apple.com ([57.103.84.7] helo=outbound.qs.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0Jr-00087D-9j for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:56 -0500 Received: from outbound.qs.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPS id 8DBD31800D98; Thu, 5 Feb 2026 14:26:49 +0000 (UTC) Received: from localhost.localdomain (unknown [17.57.155.37]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPSA id 3CF041800D91; Thu, 5 Feb 2026 14:26:46 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1770301614; x=1772893614; bh=yJUrkA3wK08ViV31cAOA/Pb+MGLmCaTb/RGoYUR01yw=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=XqlPdLrZj3WgGpG/VHhGiZdNHtroRQlF7B1h/K09sh/dai4rKtLwEU87WcNO0YiAU86NlmrO6KNvTsmB8rAuRuXmLG0MdWF5zyVwoV96DLY/ZaCvP59iA6iu/X8xd1bwr18x27RVNV+bvaDDYLDzbzvwhNUHpPZ4VBpCuO5GKqMa3U05pSTsprsasm/QHBcQybKDP9WZSzCsW/lEYkqG4GmbLEBH8ifOp6dMFX3Uw51Cfno7jNJE2E+v7EqZusKH+ZOM3GSkzgjUXVysaB3Mg2+5swFjQsk8RirSduIyOR2uEGpkpSDLdp0MEuZoyySOXX+bjTQWOeCx/Co6W6AKaw== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org, mohamed@unpredictable.fr Cc: Zhao Liu , Paolo Bonzini , Akihiko Odaki , Cameron Esfahani , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Shannon Zhao , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Phil Dennis-Jordan , "Michael S. Tsirkin" , Richard Henderson , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Alexander Graf , Pedro Barbuda , Yanan Wang , Ani Sinha , Igor Mammedov , Marcel Apfelbaum , Peter Maydell , Eduardo Habkost , Roman Bolshakov , Pierrick Bouvier Subject: [PATCH v21 21/22] whpx: enable arm64 builds Date: Thu, 5 Feb 2026 15:25:39 +0100 Message-ID: <20260205142543.64818-22-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260205142543.64818-1-mohamed@unpredictable.fr> References: <20260205142543.64818-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjA1MDEwOSBTYWx0ZWRfX/zgSXs2RRl/c IgH/b9Whq/jH7FkJmgS9jKoXPH4ASC6S9FbnNRjUQ2gelcGslTG2qb85MzlsH0/9Rkscn6oSz/3 A0fGUzlgwIv2Z33ejCDNw3ZTYzuWzhjmBHvVx/pDwHqiLIS5xZ4dgMVV3I99Z+tG83kLLS9z4TS 1GhVqi6KPyNjXsRdrPaf0ZxSjDjWuoMD9bMfIHY+9tDoaifbhiTCvEi4bHN/eqSy8K8V7anNDXR jJoOns9oy1PyyugEEWHU+gCp2e5lZ2lrv2e3LyTdlt2Bghu5ygc8djZMTJxyCe9FtaxWoueTn8f DJ+x84GwXUXpHGKi+2IvXQYp/yMfkMebGFmFJz9//3HRbRZvn5QT8Fx6D7ZDM0= X-Proofpoint-GUID: bNuXwyx1dcIRbJXmzFKl-2XtJk5gCoLG X-Proofpoint-ORIG-GUID: bNuXwyx1dcIRbJXmzFKl-2XtJk5gCoLG X-Authority-Info-Out: v=2.4 cv=Zvzg6t7G c=1 sm=1 tr=0 ts=6984a8ae cx=c_apl:c_apl_out:c_pps a=bsP7O+dXZ5uKcj+dsLqiMw==:117 a=bsP7O+dXZ5uKcj+dsLqiMw==:17 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=Ck9h3XeVBPDugYI9Na4A:9 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-05_03,2026-02-05_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 adultscore=0 mlxscore=0 bulkscore=0 suspectscore=0 clxscore=1030 spamscore=0 lowpriorityscore=0 phishscore=0 mlxlogscore=955 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602050109 X-JNJ: AAAAAAABZ4Nn6hWQH2tTfoYE8KbpprcjDXWXtPzhKiiWxbUDmDSPiPg47kLih3OCUJ1MVvhwVzurwNi2H/zhqkrJsuDLmNMHEsEdR/veuy9gJndYz+1O3atrKiQklDEmqm2uOE145cadZbfpgjk64GYSXJJTmzIRG1yodOSiCwYcJTHQTFt7/Pgs+E8oipeQK+OxdctO/UAqQWepY0DQM5tYu9Uk/q7BAZ7D6HJafDaW4lOKn5kkxAK4/suthEFt52FMBhti5ER1SxVM4y/2V/XKBFYiq5ZSUzXBOZPJFvTsJlTjeZk+HKfQsT51qEKUC//w99t8/vlLKs2L3oqMmJdGFUd5fUajIACxx0UHRaez+jbiU21tMYg0ye7gx6kH75fZF0Ds5xvcGKWpGiGVPMuD3JYI2/jUVaNz2Qr3jTk+7ooYCT0LldsGJKbMHQBhch96GfyI7Z+9qdisWcpy5ygYAywMWjLZM2fjMOHXxiWUjvga43AlScoqcQpb5FE9TAbqd0H22F+iB7TgdxA2cQQ4n7skr9421bHAnqVy5YBGp7xW03sfkskMR1f294QXXVbXwJTFkvTMTX03OHSWs4V7oBbVDdx3bSLsgvXPNK11ZGAbNE54GXw1c1zUF/aCzWp6FWqe2vhyiPwUZFaXdyLknun6BNjq8IAaNnoUa88Aoy/uUQC778lt9KUji1JWtpt7YsZa/7j5uS9fhApnJIZi/p9o8YM0zUL0CoYeMgEGvfTHiZh1HeFkL5eo+lb8Y0FCTcFw6eabeRS4gAiNi41l/DONDClbco4ddjXffMeLLOuxeN61Qo/GqiKHJqm5e1AEI4XXwG62HYuIAeSnfijE8ztwij7GLrCCN7+GvpuMo/dkBmGg27LG41ZU/MI4YDgo+H15UKveTM6HVrv8XFQZyrLmFsPGMRwL1zga148iyA== 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=lists.gnu.org; Received-SPF: pass client-ip=57.103.84.7; envelope-from=mohamed@unpredictable.fr; helo=outbound.qs.icloud.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @unpredictable.fr) X-ZM-MESSAGEID: 1770301911553154100 Content-Type: text/plain; charset="utf-8" Signed-off-by: Mohamed Mediouni Reviewed-by: Pierrick Bouvier Reviewed-by: Akihiko Odaki --- meson.build | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/meson.build b/meson.build index 8c6c0a9a32..eeafd1d42b 100644 --- a/meson.build +++ b/meson.build @@ -301,7 +301,8 @@ accelerator_targets +=3D { 'CONFIG_XEN': xen_targets } =20 if cpu =3D=3D 'aarch64' accelerator_targets +=3D { - 'CONFIG_HVF': ['aarch64-softmmu'] + 'CONFIG_HVF': ['aarch64-softmmu'], + 'CONFIG_WHPX': ['aarch64-softmmu'] } elif cpu =3D=3D 'x86_64' accelerator_targets +=3D { @@ -858,13 +859,18 @@ if get_option('mshv').allowed() and host_os =3D=3D 'l= inux' endif =20 if get_option('whpx').allowed() and host_os =3D=3D 'windows' - if get_option('whpx').enabled() and host_machine.cpu() !=3D 'x86_64' - error('WHPX requires 64-bit host') - elif cc.has_header('winhvplatform.h', required: get_option('whpx')) and \ - cc.has_header('winhvemulation.h', required: get_option('whpx')) - accelerators +=3D 'CONFIG_WHPX' + if cpu =3D=3D 'i386' + if get_option('whpx').enabled() + error('WHPX requires 64-bit host') + endif + # Leave CONFIG_WHPX disabled + else + if cc.has_header('winhvplatform.h', required: get_option('whpx')) and \ + cc.has_header('winhvemulation.h', required: get_option('whpx')) + accelerators +=3D 'CONFIG_WHPX' + endif endif -endif + endif =20 hvf =3D not_found if get_option('hvf').allowed() --=20 2.50.1 (Apple Git-155) From nobody Sat Feb 7 07:31:33 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=unpredictable.fr ARC-Seal: i=1; a=rsa-sha256; t=1770301922; cv=none; d=zohomail.com; s=zohoarc; b=gFwdiZCMoTRtG8OeF/mJ8MumYBDby0fSD+VWSJakf0yrmj7k0kne1eDEfno3nkRN3FTEEl7Hx4rc9IEVuwXwEwkQtXMyEpNYSQWJO0gHlaA/hOdQsZ9V2txCcIQO+jYi7yz/0tZ4UkBt0MRxUxFU1+NFppft+/1K9J0WorAcBMQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770301922; 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=+zW8Xnd3fSoP8tYABJv1S0adhsQ8kwT3yFXLBoRfW4c=; b=D6vW5bNj7lYspDBWHojDwUD0vsAu+b4ku0yZ54y0p/6SVml4bTNusM9OEVvM6pEjUXtZFLvqZHD/nq+WWS7Iuv85Rii6Nqhk73j3FtbPIgw/rXEix0uNZHESm8cfzODFSCTEzQnpTo2i6kvxzmf0I7xwf7BayTO2c7AtEaC76wQ= 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 lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17703019224971016.2673376545247; Thu, 5 Feb 2026 06:32:02 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vo0K2-0001bH-1i; Thu, 05 Feb 2026 09:27:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0Jv-0001Mb-Ut for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:27:00 -0500 Received: from qs-2004e-snip4-4.eps.apple.com ([57.103.84.47] helo=outbound.qs.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vo0Ju-00087Z-IZ for qemu-devel@nongnu.org; Thu, 05 Feb 2026 09:26:59 -0500 Received: from outbound.qs.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPS id CC22718000AD; Thu, 5 Feb 2026 14:26:52 +0000 (UTC) Received: from localhost.localdomain (unknown [17.57.155.37]) by p00-icloudmta-asmtp-us-east-2d-100-percent-2 (Postfix) with ESMTPSA id 1B79F1800D8F; Thu, 5 Feb 2026 14:26:49 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1770301618; x=1772893618; bh=+zW8Xnd3fSoP8tYABJv1S0adhsQ8kwT3yFXLBoRfW4c=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=VL4cS22G2plkqaJGUq+n7Nxuizfz0OPOne8BoUrNgGf/+wjXlOS0CLxTsAhpdE+a1FGipaGIwCaBD1DqANh05AyCfPp7pACr5Wm7/SVpByji11LzS/4EoSO76Ea94HMxaJ5cwza8u0fmaO+kpG0ruRmHqFx8kTIWXM2BqvgCMy+MHOe5wX+VTJgQkIdWouQhIOOsGTYa+amBkmc5IADSSYHxMKAAeaFAp+0UfTftS8Dmsk4yMZkGDFA7++JxPT7NjjLsy6dQSNNeAEKnAqntCj1m8Hh2en/idJttKQRrIlcNToXL7YMI8SxOdQyxMSy0VvOjsFoppxDZYQu3ycCZXg== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org, mohamed@unpredictable.fr Cc: Zhao Liu , Paolo Bonzini , Akihiko Odaki , Cameron Esfahani , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Shannon Zhao , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Phil Dennis-Jordan , "Michael S. Tsirkin" , Richard Henderson , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Alexander Graf , Pedro Barbuda , Yanan Wang , Ani Sinha , Igor Mammedov , Marcel Apfelbaum , Peter Maydell , Eduardo Habkost , Roman Bolshakov , Pierrick Bouvier Subject: [PATCH v21 22/22] whpx: arm64: add partition-wide reset on the reboot path Date: Thu, 5 Feb 2026 15:25:40 +0100 Message-ID: <20260205142543.64818-23-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260205142543.64818-1-mohamed@unpredictable.fr> References: <20260205142543.64818-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: dg_AeEbeDrNi7jZZwMWPhvl8yA95iDH- X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjA1MDEwOSBTYWx0ZWRfX20SXi9yodk6K DMZRDeshrU0wh3jEcF+JimXeGEv2smOBo3hpHyeEHkrwtChPCV7C0MhmmqO2/TcW5B0jrXXZpo4 4bjUsQyjhd74M95pn2jGxW8y9Woa1uFvjXtCPgEuG6GhWVXuVnAQXElUJ/AAHXd3zyoXF3hNuFy h4dgl4C1TCyadO99wdFIc8/pTGZoMNniPkgt3v9pi+2+DyPfzTOAsIkOy7sfeII8MzW+2PPdWu1 cXBzurEQpdJDjgVOM1jGv2Fqi7HGccT2PvobG7nGeagOQZVPR2kBZwEAMXb/4cyLdCkX8FViOfv 3TE5m9DcvLCJHn3L8w+9INUx5MscKFUk1qdjz9IneJxcbavykTr3BdR/MQ3tIU= X-Authority-Info-Out: v=2.4 cv=ApjjHe9P c=1 sm=1 tr=0 ts=6984a8b0 cx=c_apl:c_apl_out:c_pps a=bsP7O+dXZ5uKcj+dsLqiMw==:117 a=bsP7O+dXZ5uKcj+dsLqiMw==:17 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=h5GvOLqLgfJ3vAEETv4A:9 a=NqO74GWdXPXpGKcKHaDJD/ajO6k=:19 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-GUID: dg_AeEbeDrNi7jZZwMWPhvl8yA95iDH- X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-05_03,2026-02-05_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 clxscore=1030 bulkscore=0 adultscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 mlxscore=0 suspectscore=0 spamscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602050109 X-JNJ: AAAAAAABFhYUAz/ZfjASw/R18HeMpWGv/jShe+rYlItH+RY7KovTl8sZqe106btsWA28XcuCIsRd7/E6N/+s7ux3ZpLNKHPA5Mvmoyq4JOcN8ApAXCuU4m5r73kXlmZY2oIA5C20w/etVIoTdy47HfV0ht35f7PJ8UsIjgNQL0yVVK4r5IjS1Y6I+jTyKCn4UxkbbKG3gzVtdQnaF1meYkciCvv9Z8fMHCSE6AZ5zE6Rjl8tVv4OZ9pQQiSNGyGqU99ylnWYA5fitkR9SbutrQYXbOpLVVTM809tu6F5PftXo4TeEnPh3TNSSCDJPYS8H8KX6iJ3HdxvYOsowEu0MVNPQ7qIax6l+v/2B4NylJKV3fjEzLwCjUBE407sWXfpAEn6/H7ric4JbwQRuZGXQ9Y0LknGaung0LLKfFH1F5VGGZh1gapDUTKcX+kIyzlndfeLadAWtj6hhlBUJNrFZJcyWrifX2V+3ObkWb5JreKv3VFzzDm8Sm5ba38K/4vY8nSDf2XO6R9f2dTTxHIURZoXogZlxrAkAJlMlyyK97spthOB8GZoO9IZV9NYyF8vyXHeerzHKTba1IJqSJO7Ggejo1fgnFuLd2X93K6IU8F/mLSqosr/z/JKpEpvEUzTaMn9NWOKQPhopfPfKVz41ZXdn4X+Uz5pb1sQUTtQKJECVqY8SmiI4PnG2AHoSychqaw+wbkbXdZwxi1hhquSU+Sf6VRcTI/eNkdQDrUKnqsLfRqz+tiHYFTXSJZNRoknk7D1Ou1biU2A9CMbZRb6eC3qrDjIFOl6+FmWfc6IbCshbRq03gk3Hb8GyM+wQoxVGRJGdeSwHFRtiMibKtNXy8Ekfa9rqbHRzgpMvdyXzCMfeMErW3KJsK6VRvsmhtZTCDbRcHY0yyYWCRADS9YgabR8nm+a/KXAR6UreUNNlPz5vGKSGU4V3NdAGnDLUZaYDZ8gdXR/ 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=lists.gnu.org; Received-SPF: pass client-ip=57.103.84.47; envelope-from=mohamed@unpredictable.fr; helo=outbound.qs.icloud.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-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 @unpredictable.fr) X-ZM-MESSAGEID: 1770301924039158500 Content-Type: text/plain; charset="utf-8" This resets non-architectural state to allow for reboots to succeed. Signed-off-by: Mohamed Mediouni Reviewed-by: Pierrick Bouvier Reviewed-by: Akihiko Odaki --- include/system/whpx-internal.h | 2 ++ target/arm/whpx/whpx-all.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/include/system/whpx-internal.h b/include/system/whpx-internal.h index 8ded54a39b..ad6ade223e 100644 --- a/include/system/whpx-internal.h +++ b/include/system/whpx-internal.h @@ -86,6 +86,8 @@ void whpx_apic_get(APICCommonState *s); X(HRESULT, WHvSetVirtualProcessorInterruptControllerState2, \ (WHV_PARTITION_HANDLE Partition, UINT32 VpIndex, PVOID State, \ UINT32 StateSize)) \ + X(HRESULT, WHvResetPartition, \ + (WHV_PARTITION_HANDLE Partition)) \ =20 #define LIST_WINHVEMULATION_FUNCTIONS(X) \ X(HRESULT, WHvEmulatorCreateEmulator, (const WHV_EMULATOR_CALLBACKS* Cal= lbacks, WHV_EMULATOR_HANDLE* Emulator)) \ diff --git a/target/arm/whpx/whpx-all.c b/target/arm/whpx/whpx-all.c index 44ef42307b..36c5e30a03 100644 --- a/target/arm/whpx/whpx-all.c +++ b/target/arm/whpx/whpx-all.c @@ -497,6 +497,8 @@ int whpx_vcpu_run(CPUState *cpu) if (arm_cpu->power_state !=3D PSCI_OFF) { whpx_psci_cpu_off(arm_cpu); } + /* Partition-wide reset, to reset state for reboots to succeed= . */ + whp_dispatch.WHvResetPartition(whpx->partition); bql_unlock(); break; case WHvRunVpExitReasonNone: --=20 2.50.1 (Apple Git-155)