From nobody Sat Apr 11 23:03:23 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=1772571046; cv=none; d=zohomail.com; s=zohoarc; b=UrDCeBpmTMgpr2XToiMTm80hsJTvu9yBabIJ8+DYGPdSPceuk7NZKgPaXRuJbq2/HQKifxuBywXc5A3o9KAqC/57RZHPXvn0zW/l5jc2NJKirbbatF2u7vag4moIFqGVGHYR7la+nbK+us+2Xo0UdD8N3no627V5/e3X7MhPpWw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772571046; 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=+NoH88IZWNOWXHn7XiZHTQBxVxI8RNautRlaqzdVGdA=; b=VVXQexLSD1ROcMYHrQ+KbVHjhyQcTW3IQoPGIQ1cRdweVML07DuRs+ouZOoKA0D0F1XOhAtarBouIJzfjoxJ7rQKE10qayzBILKb0cgI8irBOaaDJz1Ku6+8/k26CsKeqxjFvdgrKR7q422XkZhceLHcXVs7QAyKBptGRYlNYw4= 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 1772571046466461.1510450899134; Tue, 3 Mar 2026 12:50:46 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vxWh2-00060Y-Jv; Tue, 03 Mar 2026 15:50:12 -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 1vxWh0-0005zu-Uf for qemu-devel@nongnu.org; Tue, 03 Mar 2026 15:50:11 -0500 Received: from p-east2-cluster6-host10-snip4-6.eps.apple.com ([57.103.76.207] helo=outbound.st.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vxWgx-0000hu-TQ for qemu-devel@nongnu.org; Tue, 03 Mar 2026 15:50:09 -0500 Received: from outbound.st.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-1a-20-percent-2 (Postfix) with ESMTPS id C0405180041C; Tue, 3 Mar 2026 20:50:05 +0000 (UTC) Received: from localhost.localdomain (unknown [17.42.251.67]) by p00-icloudmta-asmtp-us-east-1a-20-percent-2 (Postfix) with ESMTPSA id AA2DB1800593; Tue, 3 Mar 2026 20:50:03 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1772571006; x=1775163006; bh=+NoH88IZWNOWXHn7XiZHTQBxVxI8RNautRlaqzdVGdA=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=EdtEa42+k/Ny5dTUFvNPUFmj93PQzx8ZfkT1cVibctFntw2NjHx8lxboHAr6hEWLtrBwqXchut0eBvJdZoLIXBW7wfLHwxn2/dRTk946f68K8zMpYwJNyzcKpiBEbE0bnCRj99kQilKeI4qa9uKQyOHyfC5IZ5agef2XU8SPZFnUn6XPGq1RwfIAB8V4WXh4VcCybIu2bl1uDaSein7mlYSeCjSPBIeWeZ4qIIxYOu/dd9gDPh5xYRItbjXxNor36a90dN7yqpzqvYZja1pumd2gDm0KqjuGojWCa6yZZJXR5IQ+DC60xa4Yqxi6Cx3jw9MQDPHLTvSMKGFcFqbKpg== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Zhao Liu , Pedro Barbuda , "Michael S. Tsirkin" , Cameron Esfahani , Mohamed Mediouni , Peter Maydell , Roman Bolshakov , Phil Dennis-Jordan , qemu-arm@nongnu.org, Wei Liu , Pierrick Bouvier Subject: [PATCH v3 1/9] target/i386/hvf/hvf.c: fix compilation Date: Tue, 3 Mar 2026 21:49:51 +0100 Message-ID: <20260303204959.31156-2-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260303204959.31156-1-mohamed@unpredictable.fr> References: <20260303204959.31156-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Authority-Info-Out: v=2.4 cv=DL+CIiNb c=1 sm=1 tr=0 ts=69a7497e cx=c_apl:c_pps:t_out a=YrL12D//S6tul8v/L+6tKg==:117 a=YrL12D//S6tul8v/L+6tKg==:17 a=Yq5XynenixoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=prbQHjbDPxtVlcUdaJMA:9 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-GUID: R-mrFFwMF76EepFwg0o4pI0aP8CGN7Yo X-Proofpoint-ORIG-GUID: R-mrFFwMF76EepFwg0o4pI0aP8CGN7Yo X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzAzMDE3MSBTYWx0ZWRfXySbD2M6uZip4 Du1Ch2CvvtuyFRtump1YF8CfnylqF4oeeR2QWbLMUxpINSsKaBTwEJlBb5rrbus/9/3/JqUhnki 5S0sPY0plfPsS3+LcfokzUJ0KpAYFvaMwKeB09l4V6Kjdo/Q+zShonfCPcmdqjXRQnlYZONNnCo udo4+D1GEivCQFDgLl46E4jaSh0Zq+NnopOK8kVKJS1FV8cpVMrfz+ppPlJMLJiZFgVkGuSgG3O wLhaUUKy3LpvF6MFyS4tFG8VyCg5E6AUGkyGKF7uQ85rEpQP2opz8NXOO/V83HPF29jZj7X5Gg2 nm+gSDAm74qxDws004RqwdG2/3Gq8qPRJ395e22ey7LG8D8FzDlYXsdICFyk8M= 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-03-03_03,2026-03-03_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 clxscore=1030 mlxlogscore=978 malwarescore=0 mlxscore=0 suspectscore=0 lowpriorityscore=0 adultscore=0 spamscore=0 bulkscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2603030171 X-JNJ: AAAAAAABaDCuzOb9wPdeANAxxXt9H0cqILnpkJhcAdN7VWrICaZ+psiuVQJNh3ouxmap7Hr+AFk1WmfiJLmEaqitoo493NBdiRl61rRTXPa4CMQZ9S6unxHC4TnhOAGO869bgkagZZ2h58MCoQVGn8ky/eSRW1f8iTqcrRgIXaew4JGE4KNejXELbqdDQHfNGacDaDMeuwGzVKji/IEynLDqyI79ZoFyZDAIC0W+js3LjRFh2Tl7nhuwwAGsQYU1UQ76II+IZfUEYX06q/BJiJvI+G0+hncVJH7aHA9ynmCwREc1/zhM+4QQ23QB6B7XjbQEf/44ETxdUJyVrhG7MbK8RaPFz6OX6eFOyJPv4x8EA0ms3nDf7VOWncX3oKF9M7VDAtHB6CrT6d+gkS1Sy1BJ0Xmq3OEE7OzyzkojKUsAZKJaFXV/UpD2fJREoJt/4xjHzEr9Rdhbpq3s69QTbmcz0J6u4Hk3LjIyoi9U+Z2WP8sbF2+S1dnl78rhfK9XkjeXNeq9qxrKgrgVp7uDAdbZqrUM2HNCh0ZaQ67V07xRUnasDcaGpYZtdU2tLTiBXGAeBN37Vf959clkz2OTD0ADocMmv0a6DZGLQ+sVp53Xv9CGgnyH1Iz5I8d0L1D921cBv1DeNKDGNSv8pfUY7eHgI3FK4XQxyscT0ZbXyQkvO/9BGvxCEys7tuvxiMf+pn/WFcMnDvOyvJmASF8tcDddJIxldwbGyaNJxBbtX1Dzj9k6/6G576jepghovbPFsf5IXpTDVrWLmOax 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.76.207; envelope-from=mohamed@unpredictable.fr; helo=outbound.st.icloud.com X-Spam_score_int: -5 X-Spam_score: -0.6 X-Spam_bar: / X-Spam_report: (-0.6 / 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.322, RCVD_IN_VALIDITY_SAFE_BLOCKED=1.141, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no 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: 1772571054686158500 Content-Type: text/plain; charset="utf-8" From: Pierrick Bouvier ../target/i386/hvf/hvf.c:476:31: error: use of undeclared identifier 'cpu' 476 | X86CPU *x86_cpu =3D X86_CPU(cpu); | ^ ../target/i386/hvf/hvf.c:479:24: error: use of undeclared identifier 'cpu' 479 | env->cr[0] =3D rvmcs(cpu->accel->fd, VMCS_GUEST_CR0); | ^ ../target/i386/hvf/hvf.c:480:24: error: use of undeclared identifier 'cpu' 480 | env->cr[3] =3D rvmcs(cpu->accel->fd, VMCS_GUEST_CR3); | ^ ../target/i386/hvf/hvf.c:481:23: error: use of undeclared identifier 'cpu' 481 | env->cr[2] =3D rreg(cpu->accel->fd, HV_X86_CR2); | ^ ../target/i386/hvf/hvf.c:486:31: error: use of undeclared identifier 'cpu' 486 | X86CPU *x86_cpu =3D X86_CPU(cpu); | ^ ../target/i386/hvf/hvf.c:489:11: error: use of undeclared identifier 'cpu' 489 | wvmcs(cpu->accel->fd, VMCS_GUEST_CR0, env->cr[0]); | ^ ../target/i386/hvf/hvf.c:490:11: error: use of undeclared identifier 'cpu' 490 | wvmcs(cpu->accel->fd, VMCS_GUEST_CR3, env->cr[3]); | ^ 7 errors generated. Signed-off-by: Pierrick Bouvier Reviewed-by: Mohamed Mediouni --- target/i386/hvf/hvf.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c index a70f8461b0..c0d028b147 100644 --- a/target/i386/hvf/hvf.c +++ b/target/i386/hvf/hvf.c @@ -472,21 +472,21 @@ static void hvf_cpu_x86_cpuid(CPUX86State *env, uint3= 2_t index, uint32_t count, =20 static void hvf_load_crs(CPUState *cs) { - X86CPU *x86_cpu =3D X86_CPU(cpu); + X86CPU *x86_cpu =3D X86_CPU(cs); CPUX86State *env =3D &x86_cpu->env; =20 - env->cr[0] =3D rvmcs(cpu->accel->fd, VMCS_GUEST_CR0); - env->cr[3] =3D rvmcs(cpu->accel->fd, VMCS_GUEST_CR3); - env->cr[2] =3D rreg(cpu->accel->fd, HV_X86_CR2); + env->cr[0] =3D rvmcs(cs->accel->fd, VMCS_GUEST_CR0); + env->cr[3] =3D rvmcs(cs->accel->fd, VMCS_GUEST_CR3); + env->cr[2] =3D rreg(cs->accel->fd, HV_X86_CR2); } =20 static void hvf_save_crs(CPUState *cs) { - X86CPU *x86_cpu =3D X86_CPU(cpu); + X86CPU *x86_cpu =3D X86_CPU(cs); CPUX86State *env =3D &x86_cpu->env; =20 - wvmcs(cpu->accel->fd, VMCS_GUEST_CR0, env->cr[0]); - wvmcs(cpu->accel->fd, VMCS_GUEST_CR3, env->cr[3]); + wvmcs(cs->accel->fd, VMCS_GUEST_CR0, env->cr[0]); + wvmcs(cs->accel->fd, VMCS_GUEST_CR3, env->cr[3]); wreg(cs->accel->fd, HV_X86_CR2, env->cr[2]); } =20 --=20 2.50.1 (Apple Git-155) From nobody Sat Apr 11 23:03:23 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=1772571104; cv=none; d=zohomail.com; s=zohoarc; b=SNsvFeO+HO+iKqNym5gf5ajWqlIEJse+dMSZhLalk1wgEj6Re3zeEoO49RpPi6RlZN1E/cLuRThEUAlU3La3z/8+3WV3t8OSjm1sevrFlskSGil/FNKpkhsqedILv7rxCGb4ZeasEqMNSR/dTnnKEQXy7nXSQzCMzaFSyg93IS4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772571104; 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=0fWErJaX02RIx//K1QKWhyiArR5flxx/eaA9Q5gZ7qk=; b=KSFxOugZy+2VTi9JoOAsDK+yAHOnnpW/9lK6MFB0We2LwzqzSFsQ1nqaN4j/6U/NJai8rqxHr1tv5hGopiaN1l/EEu8PZKUyyS2VlkQnP6RAw7CI1ILXWy674hzxkknxa+jVkvqPTEbJichUauSNClWls4WMUTG9NjDwBZuYHLg= 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 1772571104293590.4119942616796; Tue, 3 Mar 2026 12:51:44 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vxWhF-00066r-Ng; Tue, 03 Mar 2026 15:50:25 -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 1vxWh3-00060b-F5 for qemu-devel@nongnu.org; Tue, 03 Mar 2026 15:50:14 -0500 Received: from p-east2-cluster6-host2-snip4-6.eps.apple.com ([57.103.76.187] helo=outbound.st.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vxWh0-0000ie-Lf for qemu-devel@nongnu.org; Tue, 03 Mar 2026 15:50:13 -0500 Received: from outbound.st.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-1a-20-percent-2 (Postfix) with ESMTPS id 9389C180058D; Tue, 3 Mar 2026 20:50:07 +0000 (UTC) Received: from localhost.localdomain (unknown [17.42.251.67]) by p00-icloudmta-asmtp-us-east-1a-20-percent-2 (Postfix) with ESMTPSA id 991171800133; Tue, 3 Mar 2026 20:50:05 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1772571008; x=1775163008; bh=0fWErJaX02RIx//K1QKWhyiArR5flxx/eaA9Q5gZ7qk=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=M5pmyZWXBskNeP+DvaPx8WFgusXbRRIEXmsD/9E1vhlXxseapSLFwvUNsDqVkFzW5omuzf8tFYCVP2uhjMQII39ZhX5KPg1TqzXgyftE8ZNwUfUchHrWwt4NdFA8ukFe1CBoaYE/zTZLkhXR3RdkPh26T0skJXKP4pmDs3grpdQlF6zrjtnp0hJJdymSBTYFsAGtMFWEdOvZLo//QwsW9z8ByJvCnQ74KEo52ySgFuADr3ILzSfrcfBu5BByStf4Y/rJYiSUAqNlYwYa+7ppfzgXvujLd6acMNhIZV711Pl+i7nFpy0HzLbdU3mt+uZPrj45iqdcnYCaYtj6gJEVAQ== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Zhao Liu , Pedro Barbuda , "Michael S. Tsirkin" , Cameron Esfahani , Mohamed Mediouni , Peter Maydell , Roman Bolshakov , Phil Dennis-Jordan , qemu-arm@nongnu.org, Wei Liu Subject: [PATCH v3 2/9] Revert "elf-ops.h: Map into memory the ELF to load" Date: Tue, 3 Mar 2026 21:49:52 +0100 Message-ID: <20260303204959.31156-3-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260303204959.31156-1-mohamed@unpredictable.fr> References: <20260303204959.31156-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: 5dDjHihJFBf_6EKbP_B3CCetOZkn6m7C X-Proofpoint-ORIG-GUID: 5dDjHihJFBf_6EKbP_B3CCetOZkn6m7C X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzAzMDE3MSBTYWx0ZWRfX850W0F5FLzLS xliXMcF4/Td8BfxI5heIQI6XpYOAQHH9Z1GlEjSYzCwocSuzmq8rWZJmcADRU/064u/7zFh5U6q T1rmhnkT139E0nBD3BdrY43z58MYlvdcy3xELvmjKmyYZvCGq4H8sgYq3K1+KiLsxJMirk+j3Fx 4jW12cf9sOrcWgFc3DRzoOqpk0lg9grMJQiodTzaQqD/PY7ZM1gCM8pMaPnI44kftNn2XZeekKg Kx/N0nUGGo1D/plVRQDBEfw5L4gZinPVtgXtLUmPNZ/K+KJXR7qk/dX2jsekqeK5sobhzWxrfzR iMiyFqdZR/Zj/g71jUM0cpE7svUsGaHDI2gHBYAdPvSpUfFyZBwkXGO+K5GukY= X-Authority-Info-Out: v=2.4 cv=H4jWAuYi c=1 sm=1 tr=0 ts=69a74980 cx=c_apl:c_pps:t_out a=YrL12D//S6tul8v/L+6tKg==:117 a=YrL12D//S6tul8v/L+6tKg==:17 a=Yq5XynenixoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=c_HyBtZksB4fQN2gfusA: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-03-03_03,2026-03-03_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 phishscore=0 lowpriorityscore=0 bulkscore=0 clxscore=1030 suspectscore=0 malwarescore=0 mlxscore=0 adultscore=0 spamscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2603030171 X-JNJ: AAAAAAABvdiNvL0MHYjUrMETfuTipG/uj5sd7ge+oZXp8BIL+f7AdmiP9a+5aXyz6kBYshpK4Ne/WAg+7NoAVilrrs0L8nV+DBEQanQHnvd51B361nZkFmxpiiqXqLGuqBIeT/VrDdG7E7bDlHPSDITFzhik4tTo4E2TyIEaNFbk/folj/a7L/wJ4aBR0R48iSI6PWoz7ZSimjKk85ZXyDZirePNcNq5puP9xraFqc39JttViT+T+q6iFT84SHMR1iEkkOOWBI2r6mBLYhhxZ5MTIBDLCldeuwA6f01avlScuQIyiC2DTroED91SBwi0bVFy/riVkaJdHM7XrWjUEOrBaeKZMawrjEUspwqeyAGdyovTuRBKv0fTnv85l6mUvXPue/2mkRWlvad2Ja+WWN+C7fMUUSyeUgOm4C5B3kNmwYlc7iAXASmAwl/+m3p10kDodWiusctFpvTC5i3MQNx7ZcKcwl7V3iv6XWo5Y7tVo+M5E9Bv5qZKhiIUU8tf710xMymu3zwf1Y8Z2sD1/6OXgK2nIzYnmr8K5fFWX1ZQdBOtKCot1dOV8asXhUqlPKeNPxG1sypilnX/F21+XVXndc8Rrkw1hcEbugGqEyWtu1eol8EPlsiiN5l2+rO/8CXHtWVfz3y9ZadiQWqyV5qq+lZQ79C/fCZGMQ7sTRB7MB2w1HLmlcWQNUnylCpqH2gNAj8YF5ziZTOZSjAN5nKGhvvVhjqwUllnaQtx9R/08g//99NgtimK9Sh5+RUIE5ZvCTM6FLfgnFl9SIC2dQ== 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.76.187; envelope-from=mohamed@unpredictable.fr; helo=outbound.st.icloud.com X-Spam_score_int: -5 X-Spam_score: -0.6 X-Spam_bar: / X-Spam_report: (-0.6 / 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.322, RCVD_IN_VALIDITY_SAFE_BLOCKED=1.141, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no 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: 1772571105803158500 Content-Type: text/plain; charset="utf-8" This reverts commit 816b9fe450220e19acb91a0ce4a8ade7000648d1. --- include/hw/elf_ops.h.inc | 71 +++++++++++++++------------------------- 1 file changed, 26 insertions(+), 45 deletions(-) diff --git a/include/hw/elf_ops.h.inc b/include/hw/elf_ops.h.inc index 9c35d1b9da..bcf484b938 100644 --- a/include/hw/elf_ops.h.inc +++ b/include/hw/elf_ops.h.inc @@ -325,11 +325,9 @@ static ssize_t glue(load_elf, SZ)(const char *name, in= t fd, { struct elfhdr ehdr; struct elf_phdr *phdr =3D NULL, *ph; - int size, i; - ssize_t total_size; - elf_word mem_size, file_size, data_offset; + int size, i, total_size; + elf_word mem_size, file_size; uint64_t addr, low =3D (uint64_t)-1, high =3D 0; - GMappedFile *mapped_file =3D NULL; uint8_t *data =3D NULL; ssize_t ret =3D ELF_LOAD_FAILED; =20 @@ -409,32 +407,20 @@ static ssize_t glue(load_elf, SZ)(const char *name, i= nt fd, } } =20 - /* - * Since we want to be able to modify the mapped buffer, we set the - * 'writable' parameter to 'true'. Modifications to the buffer are not - * written back to the file. - */ - mapped_file =3D g_mapped_file_new_from_fd(fd, true, NULL); - if (!mapped_file) { - goto fail; - } - total_size =3D 0; for(i =3D 0; i < ehdr.e_phnum; i++) { ph =3D &phdr[i]; if (ph->p_type =3D=3D PT_LOAD) { mem_size =3D ph->p_memsz; /* Size of the ROM */ file_size =3D ph->p_filesz; /* Size of the allocated data */ - data_offset =3D ph->p_offset; /* Offset where the data is loca= ted */ - - if (file_size > 0) { - if (g_mapped_file_get_length(mapped_file) < - file_size + data_offset) { + data =3D g_malloc0(file_size); + if (ph->p_filesz > 0) { + if (lseek(fd, ph->p_offset, SEEK_SET) < 0) { + goto fail; + } + if (read(fd, data, file_size) !=3D file_size) { goto fail; } - - data =3D (uint8_t *)g_mapped_file_get_contents(mapped_file= ); - data +=3D data_offset; } =20 /* The ELF spec is somewhat vague about the purpose of the @@ -530,23 +516,22 @@ static ssize_t glue(load_elf, SZ)(const char *name, i= nt fd, *pentry =3D ehdr.e_entry - ph->p_vaddr + ph->p_paddr; } =20 - /* Some ELF files really do have segments of zero size; - * just ignore them rather than trying to create empty - * ROM blobs, because the zero-length blob can falsely - * trigger the overlapping-ROM-blobs check. - */ - if (mem_size !=3D 0) { + if (mem_size =3D=3D 0) { + /* Some ELF files really do have segments of zero size; + * just ignore them rather than trying to create empty + * ROM blobs, because the zero-length blob can falsely + * trigger the overlapping-ROM-blobs check. + */ + g_free(data); + } else { if (load_rom) { g_autofree char *label =3D g_strdup_printf("%s ELF program header segment %d", name, i); =20 - /* - * rom_add_elf_program() takes its own reference to - * 'mapped_file'. - */ - rom_add_elf_program(label, mapped_file, data, file_siz= e, - mem_size, addr, as); + /* rom_add_elf_program() seize the ownership of 'data'= */ + rom_add_elf_program(label, NULL, data, file_size, mem_= size, + addr, as); } else { MemTxResult res; =20 @@ -584,16 +569,14 @@ static ssize_t glue(load_elf, SZ)(const char *name, i= nt fd, struct elf_note *nhdr =3D NULL; =20 file_size =3D ph->p_filesz; /* Size of the range of ELF notes = */ - data_offset =3D ph->p_offset; /* Offset where the notes are lo= cated */ - - if (file_size > 0) { - if (g_mapped_file_get_length(mapped_file) < - file_size + data_offset) { + data =3D g_malloc0(file_size); + if (ph->p_filesz > 0) { + if (lseek(fd, ph->p_offset, SEEK_SET) < 0) { + goto fail; + } + if (read(fd, data, file_size) !=3D file_size) { goto fail; } - - data =3D (uint8_t *)g_mapped_file_get_contents(mapped_file= ); - data +=3D data_offset; } =20 /* @@ -607,6 +590,7 @@ static ssize_t glue(load_elf, SZ)(const char *name, int= fd, if (nhdr !=3D NULL) { elf_note_fn((void *)nhdr, (void *)&ph->p_align, SZ =3D=3D = 64); } + g_free(data); data =3D NULL; } } @@ -619,9 +603,6 @@ static ssize_t glue(load_elf, SZ)(const char *name, int= fd, } ret =3D total_size; fail: - if (mapped_file) { - g_mapped_file_unref(mapped_file); - } g_free(phdr); return ret; } --=20 2.50.1 (Apple Git-155) From nobody Sat Apr 11 23:03:23 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=1772571146; cv=none; d=zohomail.com; s=zohoarc; b=WDzQYgWlIKMZXikW6qsflvJZnChFOzO0CR4BSLy/GdgR6KNkmPFr3FpNJ1zrrD48v/6pWFRuPs3v3TTr6as1OmU0qf29Wov1nkuvo/DqGI7kjBTsCyH51QkDrSvlwLtFdY0lHp2U2WH0z9YV3VZRg5/S8Wg2LBYHtE/4nx0OtXs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772571146; 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=F9BWIbAr980ZBXELLnOIEZWMzo9HppGNpact1WFSAtU=; b=JWE2kRukWLf2ufnBJ2HHVxU6t4mzyep3lbXE3HRGNnUFijMXUD13IMzQKQPMAmY84ifltgtKRtfZH9UqkoXTYuratSA4/CyT1cFLpiuDBAgh7RPL5SydVQH3RhmBP0OBbu7g4QBBPYnCx0oZOik+3cAxDg0jGw0zHvByaOASrf8= 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 1772571146912960.9833531302357; Tue, 3 Mar 2026 12:52:26 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vxWhI-00069O-1F; Tue, 03 Mar 2026 15:50:28 -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 1vxWh6-00060j-GO for qemu-devel@nongnu.org; Tue, 03 Mar 2026 15:50:18 -0500 Received: from p-east2-cluster6-host4-snip4-10.eps.apple.com ([57.103.76.151] helo=outbound.st.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vxWh2-0000jK-SM for qemu-devel@nongnu.org; Tue, 03 Mar 2026 15:50:15 -0500 Received: from outbound.st.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-1a-20-percent-2 (Postfix) with ESMTPS id 7C4671800587; Tue, 3 Mar 2026 20:50:09 +0000 (UTC) Received: from localhost.localdomain (unknown [17.42.251.67]) by p00-icloudmta-asmtp-us-east-1a-20-percent-2 (Postfix) with ESMTPSA id 6C7C31800419; Tue, 3 Mar 2026 20:50:07 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1772571010; x=1775163010; bh=F9BWIbAr980ZBXELLnOIEZWMzo9HppGNpact1WFSAtU=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=d1l2D66pY4vmD4C+ePacNPJgl8oymTcSvqgiM4NCkmSDtAEypkFuiWXAf4Bc9NK+MoEbaB+vrj9+UnAxZo2XriGuqJ6M7QbHytU1StQvrm9MT5zjgcjPlPpqV4CX3fyoWlLPNNTG01PE0Skh2/7KYuwHtAQf+/NHU7Wvhl192H0S1WNAGFMT2AEbJEBHwQmCvJBlEKjH7WPX9jcwppxXdKBtkwjCaKFbAP74ePsUb02QQIRFYnGlOvdqcDxBjFR27qtmw5IeXjbNcWZQJKvUkpl+fbxW/+bneOW1jilm1gOY4jRkWDEMxmDnH8t8ZUGHQtD5fzxKm52osGGmRh9EPQ== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Zhao Liu , Pedro Barbuda , "Michael S. Tsirkin" , Cameron Esfahani , Mohamed Mediouni , Peter Maydell , Roman Bolshakov , Phil Dennis-Jordan , qemu-arm@nongnu.org, Wei Liu Subject: [PATCH v3 3/9] whpx: i386: apic: bring closer to MSHV code path Date: Tue, 3 Mar 2026 21:49:53 +0100 Message-ID: <20260303204959.31156-4-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260303204959.31156-1-mohamed@unpredictable.fr> References: <20260303204959.31156-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Authority-Info-Out: v=2.4 cv=LpyfC3dc c=1 sm=1 tr=0 ts=69a74982 cx=c_apl:c_pps:t_out a=YrL12D//S6tul8v/L+6tKg==:117 a=YrL12D//S6tul8v/L+6tKg==:17 a=Yq5XynenixoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=a_U1oVfrAAAA:8 a=yMhMjlubAAAA:8 a=gZWPb2AKFxxsgVUQgu4A:9 X-Proofpoint-ORIG-GUID: 00pcw4N7N2WE1rkzhYDnracvH8FcImsY X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzAzMDE3MSBTYWx0ZWRfXxMSxjhqOTP6f tiJr2enEKpsBdKE+VR3tBbKArXsdGEkS+QuuaVPZWm64endM95tdu0+xl8g6W1waCnQzqWZ6kVp c41YOUY8jQ4JG8d3nM538BLZ7x3yUVKxUualdGQASxQjDcykcLcTm/4mobc9xWX3Lqjcm1VHQdc CWugN2U8AYxXE7B4NzHhF7olN4uiLYNBZLmHpfuxvN7cpPynuH8mf0LoV7BGx7PsarPLLSTR1Jt b39O/VoWvkngaXHFbqeR7UtscPWpmvp5sL01iKgDEvv5U2L+pU53dzfqvA/OMXCDBC59d7ixf5Z gbG4EISwKrs8BzS9gwpI0FLWmDk0fL0WQHXBDf/qSzPYuqAKTF/bJtreIjwo6I= X-Proofpoint-GUID: 00pcw4N7N2WE1rkzhYDnracvH8FcImsY 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-03-03_03,2026-03-03_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxlogscore=999 adultscore=0 clxscore=1030 phishscore=0 bulkscore=0 mlxscore=0 lowpriorityscore=0 suspectscore=0 spamscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2603030171 X-JNJ: AAAAAAABNi11TVYEBvladhsLcsYD82rlnh5mEzJ+15SJvYO/n2TBb1uH2T2Zx7dWU8yJXOuaepyNwMxsT5AXvVRcuz7nb5fWCdQqZk1bQrJJzsScCK5ESwYvyVMaiMYMNaW1fNfecZNz5v7iUOHHaiRqkez0706EYm+58/OEZpPobIKa70Co+1NXhL38h/PuIM6j8Ly3C0gAdflS2QkK1P5/sGvaX4IF/cdSzCXzwdra4AWi2DyHP5Ud8EcHCKZI5UakArNTNt2ZJJvyNr/5JtRPCkQ+m9mONSkUxjSzKruBZPUxZqNuvanps/xTujnQBB4brfAAAvxrXLzHm79FPb+NWiYyEwGmYV0dFk459UjrzoqjHX2H7hS8wsJbRhZD1JdnBIJSiiZy5y4ag11pItOv+nAMNyAeaHTNnt1bGbWcPAaD5YjZEOuOf4gyBH2ur5xsL8bUtvOrqThGqHQs5gthoqfpKY8u+6q2WZpzFEPV8Leu1YCmQKP2b96dKHvO6w88WYAwWc4wJ+9hvJmcDnKiImJ01YUlYpzbMADNiORrOiu0nW0W4PZXfhv4rfS+ZnjnQWXI3xc4xinlOH8wKN4AxU/6XMsuG/vjh8dJzB64vbyrMVdQz4GLetnOYLaAIYuXuD4bvS10LbF+PM1LFIKJRUnJ6ckTdtV/ENPHNRqsUdd1wSzciQN9ph5TBh+hUFL8YOKiM5CYy3OAKsS7lWY0Wet//75/pcQgQ+Jw26FovJZH4j0hLXAfeJ+1eJaQnvNEuw== 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.76.151; envelope-from=mohamed@unpredictable.fr; helo=outbound.st.icloud.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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_H2=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.322, RCVD_IN_VALIDITY_SAFE_BLOCKED=1.141, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no 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: 1772571148982139100 Content-Type: text/plain; charset="utf-8" MSHV doesn't have a dedicated apic_type and uses the common class. Make WHP= X do the same thing. As VM save/restore isn't currently supported anyway, this doesn't break fun= ctionality. Signed-off-by: Mohamed Mediouni --- hw/intc/apic.c | 9 ++ include/system/whpx-internal.h | 10 +- target/i386/cpu-apic.c | 3 - target/i386/whpx/irq.c | 153 ++++++++++++++++++ target/i386/whpx/irq.h | 10 ++ target/i386/whpx/meson.build | 2 +- target/i386/whpx/whpx-all.c | 17 +- target/i386/whpx/whpx-apic.c | 286 --------------------------------- 8 files changed, 183 insertions(+), 307 deletions(-) create mode 100644 target/i386/whpx/irq.c create mode 100644 target/i386/whpx/irq.h delete mode 100644 target/i386/whpx/whpx-apic.c diff --git a/hw/intc/apic.c b/hw/intc/apic.c index 8766ed00b9..4920043063 100644 --- a/hw/intc/apic.c +++ b/hw/intc/apic.c @@ -28,6 +28,8 @@ #include "qemu/host-utils.h" #include "system/kvm.h" #include "system/mshv.h" +#include "system/whpx.h" +#include "whpx/irq.h" #include "trace.h" #include "hw/i386/apic-msidef.h" #include "exec/cpu-common.h" @@ -915,6 +917,13 @@ static void apic_send_msi(MSIMessage *msi) dest_mode, trigger_mode); return; } +#endif +#ifdef CONFIG_WHPX + if (whpx_enabled() && whpx_irqchip_in_kernel()) { + whpx_request_interrupt(delivery, vector, dest, + dest_mode, trigger_mode); + return; + } #endif apic_deliver_irq(dest, dest_mode, delivery, vector, trigger_mode); } diff --git a/include/system/whpx-internal.h b/include/system/whpx-internal.h index 7a1c9871f1..e7b915ccbf 100644 --- a/include/system/whpx-internal.h +++ b/include/system/whpx-internal.h @@ -4,7 +4,6 @@ =20 #include #include -#include "hw/i386/apic.h" #include "exec/vaddr.h" =20 typedef enum WhpxBreakpointState { @@ -45,7 +44,6 @@ struct whpx_state { }; =20 extern struct whpx_state whpx_global; -void whpx_apic_get(APICCommonState *s); =20 #define WHV_E_UNKNOWN_CAPABILITY 0x80370300L =20 @@ -85,6 +83,14 @@ void whpx_apic_get(APICCommonState *s); UINT32 StateSize)) \ X(HRESULT, WHvResetPartition, \ (WHV_PARTITION_HANDLE Partition)) \ + X(HRESULT, WHvGetVirtualProcessorState, \ + (WHV_PARTITION_HANDLE Partition, UINT32 VpIndex, \ + WHV_VIRTUAL_PROCESSOR_STATE_TYPE StateType, PVOID Buffer, \ + UINT32 BufferSizeInBytes, UINT32 *BytesWritten)) \ + X(HRESULT, WHvSetVirtualProcessorState, \ + (WHV_PARTITION_HANDLE Partition, UINT32 VpIndex, \ + WHV_VIRTUAL_PROCESSOR_STATE_TYPE StateType, PVOID Buffer, \ + UINT32 BufferSizeInBytes)) \ =20 #define WHP_DEFINE_TYPE(return_type, function_name, signature) \ typedef return_type (WINAPI *function_name ## _t) signature; diff --git a/target/i386/cpu-apic.c b/target/i386/cpu-apic.c index eaa10ad2a3..77073ad455 100644 --- a/target/i386/cpu-apic.c +++ b/target/i386/cpu-apic.c @@ -33,10 +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_irqchip_in_kernel()) { - apic_type =3D "whpx-apic"; } - return APIC_COMMON_CLASS(object_class_by_name(apic_type)); } =20 diff --git a/target/i386/whpx/irq.c b/target/i386/whpx/irq.c new file mode 100644 index 0000000000..966916779e --- /dev/null +++ b/target/i386/whpx/irq.c @@ -0,0 +1,153 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#include "qemu/osdep.h" +#include "qemu/error-report.h" +#include "cpu.h" +#include "hw/i386/apic_internal.h" +#include "hw/i386/apic-msidef.h" +#include "hw/pci/msi.h" +#include "system/hw_accel.h" +#include "system/whpx.h" +#include "system/whpx-internal.h" +#include "irq.h" +#include "system/whpx-accel-ops.h" +#include "system/whpx-all.h" +#include "system/whpx-common.h" +#include "qemu/memalign.h" +#include "qemu/main-loop.h" + + +/* Structure definition from Hyper-V, to keep unaltered */ +typedef struct _HV_X64_INTERRUPT_CONTROLLER_STATE +{ + UINT32 ApicId; + UINT32 ApicVersion; + UINT32 ApicLdr; + UINT32 ApicDfr; + UINT32 ApicSpurious; + UINT32 ApicIsr[8]; + UINT32 ApicTmr[8]; + UINT32 ApicIrr[8]; + UINT32 ApicEsr; + UINT32 ApicIcrHigh; + UINT32 ApicIcrLow; + UINT32 ApicLvtTimer; + UINT32 ApicLvtThermal; + UINT32 ApicLvtPerfmon; + UINT32 ApicLvtLint0; + UINT32 ApicLvtLint1; + UINT32 ApicLvtError; + UINT32 ApicLvtCmci; + UINT32 ApicErrorStatus; + UINT32 ApicInitialCount; + UINT32 ApicCounterValue; + UINT32 ApicDivideConfiguration; + UINT32 ApicRemoteRead; + +} HV_X64_INTERRUPT_CONTROLLER_STATE, *PHV_X64_INTERRUPT_CONTROLLER_STATE; + +int whpx_request_interrupt(uint32_t interrupt_type, uint32_t vector, + uint32_t vp_index, bool logical_dest_mode, + bool level_triggered) +{ + HRESULT hr; + + if (vector =3D=3D 0) { + warn_report("Ignoring request for interrupt vector 0"); + return 0; + } + + WHV_INTERRUPT_CONTROL interrupt =3D { + .Type =3D interrupt_type, + .DestinationMode =3D logical_dest_mode ? + WHvX64InterruptDestinationModeLogical : + WHvX64InterruptDestinationModePhysical, + + .TriggerMode =3D level_triggered ? + WHvX64InterruptTriggerModeLevel : WHvX64InterruptTriggerModeEd= ge, + .Reserved =3D 0, + .Vector =3D vector, + .Destination =3D vp_index, + }; + + hr =3D whp_dispatch.WHvRequestInterrupt(whpx_global.partition, + &interrupt, sizeof(interrupt)); + if (FAILED(hr)) { + error_report("Failed to request interrupt"); + return -errno; + } + return 0; +} + +static uint32_t set_apic_delivery_mode(uint32_t reg, uint32_t mode) +{ + return ((reg) & ~0x700) | ((mode) << 8); +} + +static int get_lapic(CPUState* cpu, HV_X64_INTERRUPT_CONTROLLER_STATE* sta= te) +{ + HRESULT hr; + UINT32 BytesWritten; + + size_t size =3D 4096; + /* buffer aligned to 4k, as *state requires that */ + void *buffer =3D qemu_memalign(size, size); + + hr =3D whp_dispatch.WHvGetVirtualProcessorState( + whpx_global.partition, + cpu->cpu_index, + WHvVirtualProcessorStateTypeInterruptControllerState2, + buffer, + size, &BytesWritten); + =20 + if (!FAILED(hr)) { + memcpy(state, buffer, sizeof(*state)); + } else { + error_report("Failed to get LAPIC"); + return -1; + } + return 0; +} + +static int set_lapic(CPUState* cpu, HV_X64_INTERRUPT_CONTROLLER_STATE* sta= te) +{ + HRESULT hr; + + size_t size =3D 4096; + /* buffer aligned to 4k, as *state requires that */ + void *buffer =3D qemu_memalign(size, size); + memcpy(buffer, state, sizeof(*state)); + + hr =3D whp_dispatch.WHvSetVirtualProcessorState( + whpx_global.partition, + cpu->cpu_index, + WHvVirtualProcessorStateTypeInterruptControllerState2, + state, + sizeof(HV_X64_INTERRUPT_CONTROLLER_STATE)); + if (FAILED(hr)) { + error_report("Failed to set LAPIC"); + return -1; + } + return 0; +} + +int whpx_set_lint(CPUState* cpu) +{ + int ret; + uint32_t *lvt_lint0, *lvt_lint1; + + HV_X64_INTERRUPT_CONTROLLER_STATE lapic_state =3D { 0 }; + ret =3D get_lapic(cpu, &lapic_state); + if (ret < 0) { + return ret; + } + + lvt_lint0 =3D &lapic_state.ApicLvtLint0; + *lvt_lint0 =3D set_apic_delivery_mode(*lvt_lint0, APIC_DM_EXTINT); + + lvt_lint1 =3D &lapic_state.ApicLvtLint1; + *lvt_lint1 =3D set_apic_delivery_mode(*lvt_lint1, APIC_DM_NMI); + + /* TODO: should we skip setting lapic if the values are the same? */ + + return set_lapic(cpu, &lapic_state); +} diff --git a/target/i386/whpx/irq.h b/target/i386/whpx/irq.h new file mode 100644 index 0000000000..02debc9e85 --- /dev/null +++ b/target/i386/whpx/irq.h @@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#ifndef QEMU_X86_WHPX_H +#define QEMU_X86_WHPX_H + +int whpx_request_interrupt(uint32_t interrupt_type, uint32_t vector, + uint32_t vp_index, bool logical_dest_mode, + bool level_triggered); + +int whpx_set_lint(CPUState* cpu); +#endif /* QEMU_X86_WHPX_H */ diff --git a/target/i386/whpx/meson.build b/target/i386/whpx/meson.build index c3aaaff9fd..5c13274b77 100644 --- a/target/i386/whpx/meson.build +++ b/target/i386/whpx/meson.build @@ -1,4 +1,4 @@ i386_system_ss.add(when: 'CONFIG_WHPX', if_true: files( 'whpx-all.c', - 'whpx-apic.c', + 'irq.c' )) diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index c172e86886..8dd6f68ff9 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -36,6 +36,7 @@ #include "system/whpx-accel-ops.h" #include "system/whpx-all.h" #include "system/whpx-common.h" +#include "whpx/irq.h" =20 #include "emulate/x86_decode.h" #include "emulate/x86_emu.h" @@ -390,6 +391,7 @@ void whpx_set_registers(CPUState *cpu, WHPXStateLevel l= evel) */ if (level >=3D WHPX_LEVEL_RESET_STATE) { whpx_set_tsc(cpu); + whpx_set_lint(cpu); } =20 memset(&vcxt, 0, sizeof(struct whpx_register_set)); @@ -621,17 +623,6 @@ void whpx_get_registers(CPUState *cpu, WHPXStateLevel = level) hr); } =20 - if (level > WHPX_LEVEL_FAST_RUNTIME_STATE && 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 - * WHvGetVirtualProcessorRegisters(). - */ - whpx_apic_get(x86_cpu->apic_state); - vcpu->tpr =3D whpx_apic_tpr_to_cr8( - cpu_get_apic_tpr(x86_cpu->apic_state)); - } - idx =3D 0; =20 /* Indexes for first 16 registers match between HV and QEMU definition= s */ @@ -764,10 +755,6 @@ void whpx_get_registers(CPUState *cpu, WHPXStateLevel = level) =20 assert(idx =3D=3D RTL_NUMBER_OF(whpx_register_names)); =20 - if (level > WHPX_LEVEL_FAST_RUNTIME_STATE && whpx_irqchip_in_kernel())= { - whpx_apic_get(x86_cpu->apic_state); - } - x86_update_hflags(env); } =20 diff --git a/target/i386/whpx/whpx-apic.c b/target/i386/whpx/whpx-apic.c deleted file mode 100644 index f26ecaf6e8..0000000000 --- a/target/i386/whpx/whpx-apic.c +++ /dev/null @@ -1,286 +0,0 @@ -/* - * WHPX platform APIC support - * - * Copyright (c) 2011 Siemens AG - * - * Authors: - * Jan Kiszka - * John Starks - * - * This work is licensed under the terms of the GNU GPL version 2. - * See the COPYING file in the top-level directory. - */ -#include "qemu/osdep.h" -#include "qemu/error-report.h" -#include "cpu.h" -#include "hw/i386/apic_internal.h" -#include "hw/i386/apic-msidef.h" -#include "hw/pci/msi.h" -#include "system/hw_accel.h" -#include "system/whpx.h" -#include "system/whpx-internal.h" - -struct whpx_lapic_state { - struct { - uint32_t data; - uint32_t padding[3]; - } fields[256]; -}; - -static void whpx_put_apic_state(APICCommonState *s, - struct whpx_lapic_state *kapic) -{ - int i; - - memset(kapic, 0, sizeof(*kapic)); - kapic->fields[0x2].data =3D s->id << 24; - kapic->fields[0x3].data =3D s->version | ((APIC_LVT_NB - 1) << 16); - kapic->fields[0x8].data =3D s->tpr; - kapic->fields[0xd].data =3D s->log_dest << 24; - kapic->fields[0xe].data =3D s->dest_mode << 28 | 0x0fffffff; - kapic->fields[0xf].data =3D s->spurious_vec; - for (i =3D 0; i < 8; i++) { - kapic->fields[0x10 + i].data =3D s->isr[i]; - kapic->fields[0x18 + i].data =3D s->tmr[i]; - kapic->fields[0x20 + i].data =3D s->irr[i]; - } - - kapic->fields[0x28].data =3D s->esr; - kapic->fields[0x30].data =3D s->icr[0]; - kapic->fields[0x31].data =3D s->icr[1]; - for (i =3D 0; i < APIC_LVT_NB; i++) { - kapic->fields[0x32 + i].data =3D s->lvt[i]; - } - - kapic->fields[0x38].data =3D s->initial_count; - kapic->fields[0x3e].data =3D s->divide_conf; -} - -static void whpx_get_apic_state(APICCommonState *s, - struct whpx_lapic_state *kapic) -{ - int i, v; - - s->id =3D kapic->fields[0x2].data >> 24; - s->tpr =3D kapic->fields[0x8].data; - s->arb_id =3D kapic->fields[0x9].data; - s->log_dest =3D kapic->fields[0xd].data >> 24; - s->dest_mode =3D kapic->fields[0xe].data >> 28; - s->spurious_vec =3D kapic->fields[0xf].data; - for (i =3D 0; i < 8; i++) { - s->isr[i] =3D kapic->fields[0x10 + i].data; - s->tmr[i] =3D kapic->fields[0x18 + i].data; - s->irr[i] =3D kapic->fields[0x20 + i].data; - } - - s->esr =3D kapic->fields[0x28].data; - s->icr[0] =3D kapic->fields[0x30].data; - s->icr[1] =3D kapic->fields[0x31].data; - for (i =3D 0; i < APIC_LVT_NB; i++) { - s->lvt[i] =3D kapic->fields[0x32 + i].data; - } - - s->initial_count =3D kapic->fields[0x38].data; - s->divide_conf =3D kapic->fields[0x3e].data; - - v =3D (s->divide_conf & 3) | ((s->divide_conf >> 1) & 4); - s->count_shift =3D (v + 1) & 7; - - s->initial_count_load_time =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); - apic_next_timer(s, s->initial_count_load_time); -} - -static int whpx_apic_set_base(APICCommonState *s, uint64_t val) -{ - s->apicbase =3D val; - return 0; -} - -static void whpx_put_apic_base(CPUState *cpu, uint64_t val) -{ - HRESULT hr; - WHV_REGISTER_VALUE reg_value =3D {.Reg64 =3D val}; - WHV_REGISTER_NAME reg_name =3D WHvX64RegisterApicBase; - - hr =3D whp_dispatch.WHvSetVirtualProcessorRegisters( - whpx_global.partition, - cpu->cpu_index, - ®_name, 1, - ®_value); - - if (FAILED(hr)) { - error_report("WHPX: Failed to set MSR APIC base, hr=3D%08lx", hr); - } -} - -static void whpx_apic_set_tpr(APICCommonState *s, uint8_t val) -{ - s->tpr =3D val; -} - -static uint8_t whpx_apic_get_tpr(APICCommonState *s) -{ - return s->tpr; -} - -static void whpx_apic_vapic_base_update(APICCommonState *s) -{ - /* not implemented yet */ -} - -static void whpx_apic_put(CPUState *cs, run_on_cpu_data data) -{ - APICCommonState *s =3D data.host_ptr; - struct whpx_lapic_state kapic; - HRESULT hr; - - whpx_put_apic_base(CPU(s->cpu), s->apicbase); - whpx_put_apic_state(s, &kapic); - - hr =3D whp_dispatch.WHvSetVirtualProcessorInterruptControllerState2( - whpx_global.partition, - cs->cpu_index, - &kapic, - sizeof(kapic)); - if (FAILED(hr)) { - fprintf(stderr, - "WHvSetVirtualProcessorInterruptControllerState failed: %08lx\= n", - hr); - - abort(); - } -} - -void whpx_apic_get(APICCommonState *s) -{ - CPUState *cpu =3D CPU(s->cpu); - struct whpx_lapic_state kapic; - - HRESULT hr =3D whp_dispatch.WHvGetVirtualProcessorInterruptControllerS= tate2( - whpx_global.partition, - cpu->cpu_index, - &kapic, - sizeof(kapic), - NULL); - if (FAILED(hr)) { - fprintf(stderr, - "WHvSetVirtualProcessorInterruptControllerState failed: %08lx\= n", - hr); - - abort(); - } - - whpx_get_apic_state(s, &kapic); -} - -static void whpx_apic_post_load(APICCommonState *s) -{ - run_on_cpu(CPU(s->cpu), whpx_apic_put, RUN_ON_CPU_HOST_PTR(s)); -} - -static void whpx_apic_external_nmi(APICCommonState *s) -{ -} - -static void whpx_send_msi(MSIMessage *msg) -{ - uint64_t addr =3D msg->address; - uint32_t data =3D msg->data; - uint8_t dest =3D (addr & MSI_ADDR_DEST_ID_MASK) >> MSI_ADDR_DEST_ID_SH= IFT; - uint8_t vector =3D (data & MSI_DATA_VECTOR_MASK) >> MSI_DATA_VECTOR_SH= IFT; - uint8_t dest_mode =3D (addr >> MSI_ADDR_DEST_MODE_SHIFT) & 0x1; - uint8_t trigger_mode =3D (data >> MSI_DATA_TRIGGER_SHIFT) & 0x1; - uint8_t delivery =3D (data >> MSI_DATA_DELIVERY_MODE_SHIFT) & 0x7; - - if (vector =3D=3D 0) { - warn_report("Ignoring request for interrupt vector 0"); - return; - } - - WHV_INTERRUPT_CONTROL interrupt =3D { - /* Values correspond to delivery modes */ - .Type =3D delivery, - .DestinationMode =3D dest_mode ? - WHvX64InterruptDestinationModeLogical : - WHvX64InterruptDestinationModePhysical, - - .TriggerMode =3D trigger_mode ? - WHvX64InterruptTriggerModeLevel : WHvX64InterruptTriggerModeEd= ge, - .Reserved =3D 0, - .Vector =3D vector, - .Destination =3D dest, - }; - HRESULT hr =3D whp_dispatch.WHvRequestInterrupt(whpx_global.partition, - &interrupt, sizeof(interrupt)); - if (FAILED(hr)) { - fprintf(stderr, "whpx: injection failed, MSI (%llx, %x) delivery: = %d, " - "dest_mode: %d, trigger mode: %d, vector: %d, lost (%08lx)= \n", - addr, data, delivery, dest_mode, trigger_mode, vector, hr); - } -} - -static uint64_t whpx_apic_mem_read(void *opaque, hwaddr addr, - unsigned size) -{ - return ~(uint64_t)0; -} - -static void whpx_apic_mem_write(void *opaque, hwaddr addr, - uint64_t data, unsigned size) -{ - MSIMessage msg =3D { .address =3D addr, .data =3D data }; - whpx_send_msi(&msg); -} - -static const MemoryRegionOps whpx_apic_io_ops =3D { - .read =3D whpx_apic_mem_read, - .write =3D whpx_apic_mem_write, - .endianness =3D DEVICE_LITTLE_ENDIAN, -}; - -static void whpx_apic_reset(APICCommonState *s) -{ - /* Not used by WHPX. */ - s->wait_for_sipi =3D 0; - - run_on_cpu(CPU(s->cpu), whpx_apic_put, RUN_ON_CPU_HOST_PTR(s)); -} - -static void whpx_apic_realize(DeviceState *dev, Error **errp) -{ - APICCommonState *s =3D APIC_COMMON(dev); - - memory_region_init_io(&s->io_memory, OBJECT(s), &whpx_apic_io_ops, s, - "whpx-apic-msi", APIC_SPACE_SIZE); - - msi_nonbroken =3D true; -} - -static void whpx_apic_class_init(ObjectClass *klass, const void *data) -{ - APICCommonClass *k =3D APIC_COMMON_CLASS(klass); - - k->realize =3D whpx_apic_realize; - k->reset =3D whpx_apic_reset; - k->set_base =3D whpx_apic_set_base; - k->set_tpr =3D whpx_apic_set_tpr; - k->get_tpr =3D whpx_apic_get_tpr; - k->post_load =3D whpx_apic_post_load; - k->vapic_base_update =3D whpx_apic_vapic_base_update; - k->external_nmi =3D whpx_apic_external_nmi; - k->send_msi =3D whpx_send_msi; -} - -static const TypeInfo whpx_apic_info =3D { - .name =3D "whpx-apic", - .parent =3D TYPE_APIC_COMMON, - .instance_size =3D sizeof(APICCommonState), - .class_init =3D whpx_apic_class_init, -}; - -static void whpx_apic_register_types(void) -{ - type_register_static(&whpx_apic_info); -} - -type_init(whpx_apic_register_types) --=20 2.50.1 (Apple Git-155) From nobody Sat Apr 11 23:03:23 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=1772571103; cv=none; d=zohomail.com; s=zohoarc; b=HmVIw8ITEzvutt5Wl61by4rh6WCPCHa0NTpvxLp2zozFmf+GLANjIS0deSOCts+iTMoBa0Yk4mXDiApkg0RTyP9BJWHM7RDK8cw4UG8lrD4jPnk7l/1F3SMSZlJMsIp0kupsa/j8U0xMgdhV3v6xWtJrG1hkxea+WWjUJuN5Kxk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772571103; 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=mLmxlRPFcwMxrG9myQtY85BdAdnRcI/En8EyLObKCOE=; b=Y8sYi1xlGIcCYtcFx6hfldwVc2XF7AZoEgHlWwjPfA5KjU9vG12JuL7eTzUonJSkilew0FnbCRoqvTLE/F+DeR6md1QT3AcO6VC63WTrRMyNai0aGuKV7h9uVCDX6FMtgxi2WxyZ1c3o4oRU5wHT9DLAyJdYeJ1czA/aBQzm7Rg= 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 17725711035512.3581330047454685; Tue, 3 Mar 2026 12:51:43 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vxWhN-0006Du-L6; Tue, 03 Mar 2026 15:50:33 -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 1vxWh8-00061C-SH for qemu-devel@nongnu.org; Tue, 03 Mar 2026 15:50:22 -0500 Received: from p-east2-cluster6-host4-snip4-2.eps.apple.com ([57.103.76.143] helo=outbound.st.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vxWh6-0000kX-7r for qemu-devel@nongnu.org; Tue, 03 Mar 2026 15:50:17 -0500 Received: from outbound.st.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-1a-20-percent-2 (Postfix) with ESMTPS id CA32318000BA; Tue, 3 Mar 2026 20:50:11 +0000 (UTC) Received: from localhost.localdomain (unknown [17.42.251.67]) by p00-icloudmta-asmtp-us-east-1a-20-percent-2 (Postfix) with ESMTPSA id 42D0F180041F; Tue, 3 Mar 2026 20:50:09 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1772571015; x=1775163015; bh=mLmxlRPFcwMxrG9myQtY85BdAdnRcI/En8EyLObKCOE=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=H/x2Y5w+bVpX+/2kexXHdhGfuMYyW2d+5691OLGODzf8P6nwEHRqNUVevTt1vfw1nMUmTPBhY3dWRZODNFr4n8lfiKiHI624teGiUMzueHwjKQ4VuadFyUbCWKhhQn/Wm+x2eOKQQW9jZeg7PhdLdAm+xOF/dd6Ntzu2IoAnoL6qJkHI1lwjD0QHxYnkjGkLyutC1qMu0POHHWUdz8Rz5SCI/i0DVUBvyI5LD0CCAyqauBYFWe+Gq3aQokEVuLFuvDIE4SK+39ddIy9oOsD7DVzyOvBXZ+zXqU6A2O0JZHWqBRlBAq8w2u1Az6Y4OnihYwDWrL+/xiaoewNGjUjHMQ== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Zhao Liu , Pedro Barbuda , "Michael S. Tsirkin" , Cameron Esfahani , Mohamed Mediouni , Peter Maydell , Roman Bolshakov , Phil Dennis-Jordan , qemu-arm@nongnu.org, Wei Liu Subject: [PATCH v3 4/9] whpx: i386: do not enable nested virt when kernel-irqchip=off Date: Tue, 3 Mar 2026 21:49:54 +0100 Message-ID: <20260303204959.31156-5-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260303204959.31156-1-mohamed@unpredictable.fr> References: <20260303204959.31156-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: XQF0VD8i8cg5ptZQ7nl3TbZmGrjT-d_p X-Proofpoint-ORIG-GUID: XQF0VD8i8cg5ptZQ7nl3TbZmGrjT-d_p X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzAzMDE3MSBTYWx0ZWRfXzUhIdxsdSmxS 0LWceMtpO5ToV5z6ZW94NTN3DiaeTYrGwR9JvXukU23hNcnM3at4RauyYaUkcv4gso8vgDQ3K1z BEK3pHRQgqqflDdCEIbyQbsl2z0/JhWZwHVnF5jayHJEu4SLoj+4UDn+EEWzqTHu8dHyyWw8u0Z sb+u9SYqpYlOAKravLdEnqN/sn9V062LbJIVsDfD8B4sCOlcC+4bMeH+qbgdOtmERShTE6uEB+q OuIe16qicd6cUxagQ0LKr923tkAwAtPTMLlMFdzeOPvoPjuvbhYzvbBOANIpn3xR9d7XwxFbVDj 5BZH5vSQ7kyXcX209We8KhkE7hOc3lo4OtosbU9hfc+03nlq/XmUcdEr+UChck= X-Authority-Info-Out: v=2.4 cv=H4jWAuYi c=1 sm=1 tr=0 ts=69a74985 cx=c_apl:c_pps:t_out a=YrL12D//S6tul8v/L+6tKg==:117 a=YrL12D//S6tul8v/L+6tKg==:17 a=Yq5XynenixoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=eKpLbWQDCUPTAuIwU-0A: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-03-03_03,2026-03-03_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=942 phishscore=0 lowpriorityscore=0 bulkscore=0 clxscore=1030 suspectscore=0 malwarescore=0 mlxscore=0 adultscore=0 spamscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2603030171 X-JNJ: AAAAAAABu+YEBTdDFPdVQRImmPkY1UQKHlpqqj5MzYW9cLCwWVNIt6OjJe3LLDeN/iuY34IDt47+5RJAU4AOtubpqwP7wkaPNM1gq4YFuArb+JdUgoLLOL07E5NOzd1wjIrtCV0EVLFkOV939+jWvBxzvbtygUENGzdfYMubghzpHNVRpvrzwIqHIlQYgpD3eepAm2fozOERkTgNOU6HObf+wVRRszg642TJ0g8tc2zmFpHn1LRg659QPK5vQFE9Oadb6X6RrxKoQ0dEOqkELcUAXv31Aol5zaASUGhzHCJPJZGYCj/F6zWxYbTGksglq/HvlMjhxoXDZUuBWKlE5zsNSLJFYWx8KnsMmO8KTXutmG4bsJG+sz87BH7coR46Dx+yK0J9tdPoJFbdKLpuCOPmtp9Qv8KoAvoom9nLxVJJTQoFmFPTVNSE5WgTBj1x7H8tXyt/OSXTIylEb4Fkbn9YaLxbSGsE9nhWAWXrkdLMXHtQEfQL1CYxNXAa348254wrKl0PaMH1xopFPm6CKoZy55/bYy+81VBs372dr4IbmFhSJ579Uz/TnxuEPzQZ6q/htfdW0XL66rpQeg6PmpjKvtrY80SyGNZqZ7dKOQuvXsFwjelEKFJYdfrWGcSD9h/uCrTxnfMgj4uz+/WqODr85rVCa36Kczoa4I8GMx/jGQBMHcCR3OTOP5io7tVOdiM0jmMn8MMPcLBPQ/9qU14MIq8PMHTkbVt4wBx1YbRD6Lzrt0ocAaVqpv2KtAGyU5C/MLXkD7Cf6u0y4kNr 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.76.143; envelope-from=mohamed@unpredictable.fr; helo=outbound.st.icloud.com X-Spam_score_int: -5 X-Spam_score: -0.6 X-Spam_bar: / X-Spam_report: (-0.6 / 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.322, RCVD_IN_VALIDITY_SAFE_BLOCKED=1.141, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no 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: 1772571106271139100 Content-Type: text/plain; charset="utf-8" This combination is not allowed as of build 26300.7939 and results in: qemu-system-x86_64.exe: WHPX: Failed to setup partition, hr=3Dc0350005 qemu-system-x86_64.exe: failed to initialize whpx: Invalid argument Signed-off-by: Mohamed Mediouni --- target/i386/whpx/whpx-all.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index 8dd6f68ff9..4afcbbae25 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -2147,7 +2147,7 @@ int whpx_accel_init(AccelState *as, MachineState *ms) goto error; } =20 - if (processor_features.Bank1.NestedVirtSupport) { + if (whpx_irqchip_in_kernel() && processor_features.Bank1.NestedVirtSup= port) { memset(&prop, 0, sizeof(WHV_PARTITION_PROPERTY)); prop.NestedVirtualization =3D 1; hr =3D whp_dispatch.WHvSetPartitionProperty( --=20 2.50.1 (Apple Git-155) From nobody Sat Apr 11 23:03:23 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=1772571063; cv=none; d=zohomail.com; s=zohoarc; b=PukHLL/pLMacZzwet6fBDbdxoj58F1Z4BIF6mlF7npq8eQWPX1eO/PO8N3GxX2nGy3B6KMYO263lZnB+xYt7WSxEUvAQbABJZUjwqGqboubKUGYG2w6zOYN90Meudb5ZlGzf0tdUdTRXBjkHwfvW5sIaPRmvSg8s26m20ZNnBjs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772571063; 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=gBxNQ3TjAYTeogiJbh69cd5jTUQ5SWnQGrtlwC8PRBY=; b=CTEufAvy2snV6SVWR9FHQ1CPpmDD+/n2YEvv+MZ7vKM3Zy3/b/zCO/sYd4SfusxOHdaYp1vYAmQzfGG8EXNRQGFlVVxAVczxrg2nanQHIQ5Rm5l7o9o3Q7oHeFekAC9KZfyNFFE60z38+X4cQJKw7CS9NvKt/0KOCZ6H/RtKWko= 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 1772571063345159.46168927650285; Tue, 3 Mar 2026 12:51:03 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vxWhG-00067p-E2; Tue, 03 Mar 2026 15:50: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 1vxWh8-00061B-Hc for qemu-devel@nongnu.org; Tue, 03 Mar 2026 15:50:22 -0500 Received: from p-east2-cluster6-host10-snip4-10.eps.apple.com ([57.103.76.211] helo=outbound.st.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vxWh5-0000kJ-Go for qemu-devel@nongnu.org; Tue, 03 Mar 2026 15:50:16 -0500 Received: from outbound.st.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-1a-20-percent-2 (Postfix) with ESMTPS id 35D5E1800431; Tue, 3 Mar 2026 20:50:13 +0000 (UTC) Received: from localhost.localdomain (unknown [17.42.251.67]) by p00-icloudmta-asmtp-us-east-1a-20-percent-2 (Postfix) with ESMTPSA id 20A271800435; Tue, 3 Mar 2026 20:50:11 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1772571014; x=1775163014; bh=gBxNQ3TjAYTeogiJbh69cd5jTUQ5SWnQGrtlwC8PRBY=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=a9j3ukYRxyq1LoIvQwub/33u8HmZvc/aepAp9FLWtokz2rUgAj0vR1xX+arJTNqVOSbOiDmvWe6C/dlEBuARMhU9FF/W2BV4ub4oLWFmtk2omNarf9pOzyOGf20R+a2H1j7R9Q7oebCvCZEqz/fR+jT3Q0vERd3k1sghlMBfvg4tRwhkZdWdVEziLVYYwHF0Us4Cgc7tJdo01HRpYsvXl+rrm/Pi8kTOZ9+TnC4njqff0/GACK2iHXI8x/CcFskxJwqobBOlMDy9S25sUyIO/hDqC/V/p28by4U7LNxYPoZ0ItnhvwA3VT1mrkGdDd4XjoJ8ybU9GIVXjA33cDqx+g== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Zhao Liu , Pedro Barbuda , "Michael S. Tsirkin" , Cameron Esfahani , Mohamed Mediouni , Peter Maydell , Roman Bolshakov , Phil Dennis-Jordan , qemu-arm@nongnu.org, Wei Liu Subject: [PATCH v3 5/9] target/i386: emulate: LA57 fix Date: Tue, 3 Mar 2026 21:49:55 +0100 Message-ID: <20260303204959.31156-6-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260303204959.31156-1-mohamed@unpredictable.fr> References: <20260303204959.31156-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzAzMDE3MSBTYWx0ZWRfXyfNcCUzIGEUt 5BQ7Yx4FpJfXslj8a0R37C5KLqZpqAxnwSgPcDMrje7Z8SWp6SY/lLrge3rd7q+P07r9JVm2oCR Gn3JCG1RjLf0a03/C7IksqzrJnleiSRwYwhZ5A+CK/TNfvOkdP4ICVGki4sNeB8GovQhFpgR0f4 5TwkzZMyXqc91Sek+KEUHZL/cBrNEPMN0YDvmIlypDZqwGeoq+BHfNz3Ok0Wkt5WZt/fcWzMusl ef+X06/fYztGDpmpyM/JAh8HK5lVdalBEfQjCILHYXBlrVr/RpH5VURc3rYtDl1Sd20139Ropq+ csrIEBSb0zlnPlDUGI78yFq8WWXfx8m4l+t+5uSwl7LaLQtV9LAKXdLc2WDXHA= X-Proofpoint-ORIG-GUID: ugsTfOLkNhtSZKCkWnpqe1Y8Mp_RV6lD X-Proofpoint-GUID: ugsTfOLkNhtSZKCkWnpqe1Y8Mp_RV6lD X-Authority-Info-Out: v=2.4 cv=CL4nnBrD c=1 sm=1 tr=0 ts=69a74986 cx=c_apl:c_pps:t_out a=YrL12D//S6tul8v/L+6tKg==:117 a=YrL12D//S6tul8v/L+6tKg==:17 a=Yq5XynenixoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=AJrqCOfVdMXzVqk_6-kA: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-03-03_03,2026-03-03_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 adultscore=0 suspectscore=0 spamscore=0 lowpriorityscore=0 malwarescore=0 mlxlogscore=896 phishscore=0 bulkscore=0 clxscore=1030 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2603030171 X-JNJ: AAAAAAABxAtLsZy0QjIxCrP/G7BuKm4PPrI94aywiUKp8GuLftNvGsBLj8uz835IC6Stp6sLci84dIe/qCkW+Z5uICvrvB4JC1rS30smCvtVdxF5mEYLz9gv+d3+z9XOOR6ya8zBnMx3nwfGCsTw44d+4EUtxoCT/0+aUPN61whdSjkliwTXLDLe8HAqewtyOYLPR0FAs6RYCS9FdTJwvHwGEsiUFE38IW5fK4yhor7rnUcJ4o1N7erjDjBVkWNfDm/K98be1r4UGx6PKZbTq4ZgUnUYe/YY0JzXD93iC2CoGVu14F7UvqmHIrBxCR6xxGxaS5fsxlKfy6RmaTSYv9O+S6wvRQffuIybSTP4YnyB17lDlYey/BqZ4jvxMg4y9+WND7r6rmXn6v+EKvIwoTGzHwfi+fRXeN910d1HHf3v5AKGnBXGTNIStzR1AGlkPLpR9vmnvh5jNIVo/b7hn+PQtRaC8I87eUbiFkxdZECejZaXi3lrw37nz51I4rlgzKmvYVJ9XBBivAZNsH7cNOWvmm3j/BBUNkEojbg37n0Lloj6oJvz9SGJQn6AWCGcKnc1xTtkFBzVpyvahumcc5CFhWgWmkdehA7lO+hqKtgkeFo4ycWLDDGQIo/CvKbTfFPaA9e10Ol0Qp4m+ZFygZeqqTlgBTlJVr/e+LBWpcvKgpUDMT5yW2IlPvD9ASlUii3FW91ebfp233T5wDTvFFhbKrI3cuORGJIFUBeAn7LO86ELq7vw+1M= 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.76.211; envelope-from=mohamed@unpredictable.fr; helo=outbound.st.icloud.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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_H2=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.322, RCVD_IN_VALIDITY_SAFE_BLOCKED=1.141, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no 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: 1772571066661139100 Content-Type: text/plain; charset="utf-8" Seen on a Sapphire Rapids box with LA57. Signed-off-by: Mohamed Mediouni --- target/i386/emulate/x86_mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/i386/emulate/x86_mmu.c b/target/i386/emulate/x86_mmu.c index 8261ca1635..4e39bae025 100644 --- a/target/i386/emulate/x86_mmu.c +++ b/target/i386/emulate/x86_mmu.c @@ -56,7 +56,7 @@ static bool is_user(CPUState *cpu) struct gpt_translation { target_ulong gva; uint64_t gpa; - uint64_t pte[5]; + uint64_t pte[6]; }; =20 static int gpt_top_level(CPUState *cpu, bool pae) --=20 2.50.1 (Apple Git-155) From nobody Sat Apr 11 23:03:23 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=1772571081; cv=none; d=zohomail.com; s=zohoarc; b=chRW6UsRMGCVh1yWtgWDLS8UBqGQ0hX1zck+NPppk6YUiSTxQeVcKzBHknx9QCRg70SkJoo8oWIQlpU3P72GvMP/kx1rJuSeOBazoI71iwkCXoPh8+8fBrt1GEvsvO6ruLTOzVdmUODC1D45GMYs2MaKxsN34lSZpZu807iL4NQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772571081; 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=3JX8beg0C2Np1egU4bEnkRFyLgIrgwrt1tvpx/K3/Vk=; b=d/Aq4AUij7FN99EjaUIpLPp6igvy4J7aU8//Ojv92BpOLedLINbkB5J454oeq+CO680xIjmnV4MVHpMRSiIJOlwxGNwlfWnc0588v4rN8v3KxuRV8K9/aecZ0l2cYK1dF3/TpqJw1eNSaPyJcX7gb5nQN8pADaey8z7uABo+TzQ= 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 1772571081367624.2151942670773; Tue, 3 Mar 2026 12:51:21 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vxWhM-0006Cp-JA; Tue, 03 Mar 2026 15:50:32 -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 1vxWhA-00061F-Gg for qemu-devel@nongnu.org; Tue, 03 Mar 2026 15:50:22 -0500 Received: from p-east2-cluster6-host6-snip4-1.eps.apple.com ([57.103.76.222] helo=outbound.st.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vxWh8-0000kv-7d for qemu-devel@nongnu.org; Tue, 03 Mar 2026 15:50:19 -0500 Received: from outbound.st.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-1a-20-percent-2 (Postfix) with ESMTPS id ED4D9180041C; Tue, 3 Mar 2026 20:50:14 +0000 (UTC) Received: from localhost.localdomain (unknown [17.42.251.67]) by p00-icloudmta-asmtp-us-east-1a-20-percent-2 (Postfix) with ESMTPSA id F3FF31800580; Tue, 3 Mar 2026 20:50:12 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1772571015; x=1775163015; bh=3JX8beg0C2Np1egU4bEnkRFyLgIrgwrt1tvpx/K3/Vk=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=WYQZ9wgcleZhj8mATsjr1ltdlZpJIOaw+WvAkykMX3VvGyHfQxplW6MJUNuDq/oVAFaB9puWdPRhWhcSo1c82lJK0C+zLzCYvGFN4Eg8q+BmY9bPKqXA6TAzfOrd1ZcvKjrPifU2kw4qGoMLj+rlGRb0e7feZRNCrlRMnAYXzVYfWld0smMJTAcGu3SeSkKAkqQ/LPdhTgDDKWSTIxzkOhIk/JUlQyWc31XhIKzpkxobpE2oB9HMvFCnKhSsgav1V0ugVYGDD/3/pGWypFdaIllAzGUys9SN8/73zZypd6nPcn8RL7jvleOp9jkawLZas0zGCjvVwgLJMGGB/SZyyg== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Zhao Liu , Pedro Barbuda , "Michael S. Tsirkin" , Cameron Esfahani , Mohamed Mediouni , Peter Maydell , Roman Bolshakov , Phil Dennis-Jordan , qemu-arm@nongnu.org, Wei Liu Subject: [PATCH v3 6/9] whpx: i386: enable some more enlightenments Date: Tue, 3 Mar 2026 21:49:56 +0100 Message-ID: <20260303204959.31156-7-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260303204959.31156-1-mohamed@unpredictable.fr> References: <20260303204959.31156-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Authority-Info-Out: v=2.4 cv=LpyfC3dc c=1 sm=1 tr=0 ts=69a74987 cx=c_apl:c_pps:t_out a=YrL12D//S6tul8v/L+6tKg==:117 a=YrL12D//S6tul8v/L+6tKg==:17 a=Yq5XynenixoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=lWQTlSF5RC17BzGQrLAA:9 X-Proofpoint-ORIG-GUID: aqPC19KbimsLHDXoxe04_R1bnaL4qrYX X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzAzMDE3MSBTYWx0ZWRfXzghHMpMtRy0v 83nwvlG0hFFX9M/lN5Kgqv0uM9tcnzsvfHFxkNkyIhTS5e8WbLHEwhLwktW7phxSCssJDmSk6je vePUambrfkbGrw8xiqJCu0PVp4KVh7e/W/rDYI1K3uGXdAI0RdmCYhf0qSQIZfMTFReLC6ABZtr PpXUpyHt0O5b9H9DOEf1tMIP+4EhfTO3cuAPrPkN6V7KwRyqj1AVcBDUPmBiit2AcI50rPEY+wh hn/Cvli821jYBYQ20pVjFLb2GDoWpmGNpVFbzPIAq3GFaYVAd/45ZaouDpDmsEtsnWrRrFyJYxj FDm5mOd6QAgoXjU2+VxmTttmbx4gRFDqGx/t8Zt0s3A/If81Nlp6I+KDUudgCY= X-Proofpoint-GUID: aqPC19KbimsLHDXoxe04_R1bnaL4qrYX 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-03-03_03,2026-03-03_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxlogscore=875 adultscore=0 clxscore=1030 phishscore=0 bulkscore=0 mlxscore=0 lowpriorityscore=0 suspectscore=0 spamscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2603030171 X-JNJ: AAAAAAAB6K6/FQJ9dE+HWiLZXvUBq/zEsO7z06wa+Voi/q+6KW1ufhoUvXlhJovC4TYYHm0WyYIX/c9MqCsp0kH2RpStIgBI6msfzrDvf/d0AbrqFzUVCBZRVl4NeAZeeWZXB1Pg+yYuIifvXcHRhTs+xo+CSVO2YFizTqTFjwnlhc+ybw/Qvum0Yc8+j5gZD++WiB3xacsKVTWxCG35JTlX8FeverHqqs4TdZnXZDfaIAnDcrrAn2DOfC/S4kbNG9uqeDnH4REYW2PZA5obSpflr8cA1ub1CMGEPhPpUq4tkKNMzgzPFu6F5VhtVSKYj99rvHwBEAL0V46/NoA07LKNH86cs7AGMhgHqs/+NOMxjtpGkjLTWcVNGBR7fhEInNMa7w5NuPIO5N9mljGyKdzDgpYTImF2VqFfub/qyppOri71haIeFEOim3+yI603gMY3JdgQgccsArqTzHrCjBxjIW0/qaBx/K/blyAi9zXu6ue+pWuIYH0f3BHsljfaEkTK/qXuziWvzfCdra80wJ8OSoCMNV2E9JDdksYvrg5Ns+cbwHtM2hT9iyOyzSEdHlug6pW1LQ0LwfM/sRjubjv0nkNjOMcWfbKeqicDQEksxQoUlI3qdMpAOZn5gyCTYz40kHouz103ZpCEEj8ZjCTDwYWyPCOso/v5tnLqtVPRQJEQwkVTVZ5BhKUF38h0QkU3sJE/5HpvPwEquYahBU7ejXgak+UjRIlzU0kKR0uCsP0m8y0G1IF73Q7DRw== 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.76.222; envelope-from=mohamed@unpredictable.fr; helo=outbound.st.icloud.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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.322, RCVD_IN_VALIDITY_SAFE_BLOCKED=1.141, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no 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: 1772571084039139100 Content-Type: text/plain; charset="utf-8" Signed-off-by: Mohamed Mediouni --- target/i386/whpx/whpx-all.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index 4afcbbae25..915d79152e 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -2201,9 +2201,12 @@ int whpx_accel_init(AccelState *as, MachineState *ms) =20 synthetic_features.Bank0.HypervisorPresent =3D 1; synthetic_features.Bank0.Hv1 =3D 1; + synthetic_features.Bank0.AccessVpRunTimeReg =3D 1; synthetic_features.Bank0.AccessPartitionReferenceCounter =3D 1; synthetic_features.Bank0.AccessPartitionReferenceTsc =3D 1; + synthetic_features.Bank0.AccessHypercallRegs =3D 1; synthetic_features.Bank0.AccessFrequencyRegs =3D 1; + synthetic_features.Bank0.EnableExtendedGvaRangesForFlushVirtualAddress= List =3D 1; synthetic_features.Bank0.AccessVpIndex =3D 1; synthetic_features.Bank0.AccessHypercallRegs =3D 1; synthetic_features.Bank0.TbFlushHypercalls =3D 1; --=20 2.50.1 (Apple Git-155) From nobody Sat Apr 11 23:03:23 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=1772571104; cv=none; d=zohomail.com; s=zohoarc; b=M68BI4r2PodkZF+QWvegjMqpzwJuvCRSaVvJV3UBwWrWi8xaqzC99Fcmz/KiwxzmHrkhEvGyslEZCatC4M9flG+VpaYKwdvoZFFC/w5LyveXYVAFQMBXOsxsNULMBziiBg1S2yS/xkOZ6dWH74Ha0h3PekGWa9awSwsclbjgbhc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772571104; 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=Y3JlG+z3H9s3sHt/x0Tuo8JzSDhUpyc6A/I7Tj0fIfs=; b=AXav3AvqzN+qGtMvtJZJytgJqvs8FhzBhw4mXQKSusgPbzzl7ET1r/h+8uoAnlZ4XG38w9OnzTGLrwuRHdY8m2/kLEZp7wQhfc+ByR6Wakzwx2eEaFEbpA+aUOsKpdleoFzpu4vibSFX8iMGroTgKWjSaXUb0EYAsODv9hmFaZs= 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 1772571104229959.7171602042374; Tue, 3 Mar 2026 12:51:44 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vxWhJ-0006B7-35; Tue, 03 Mar 2026 15:50: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 1vxWhE-00061u-42 for qemu-devel@nongnu.org; Tue, 03 Mar 2026 15:50:24 -0500 Received: from p-east2-cluster6-host2-snip4-10.eps.apple.com ([57.103.76.191] helo=outbound.st.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vxWhB-0000mT-CM for qemu-devel@nongnu.org; Tue, 03 Mar 2026 15:50:23 -0500 Received: from outbound.st.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-1a-20-percent-2 (Postfix) with ESMTPS id 4057D1800424; Tue, 3 Mar 2026 20:50:17 +0000 (UTC) Received: from localhost.localdomain (unknown [17.42.251.67]) by p00-icloudmta-asmtp-us-east-1a-20-percent-2 (Postfix) with ESMTPSA id CA480180012C; Tue, 3 Mar 2026 20:50:14 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1772571020; x=1775163020; bh=Y3JlG+z3H9s3sHt/x0Tuo8JzSDhUpyc6A/I7Tj0fIfs=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=K2ZEeZFrCO6lAp8Z35uUzwCr9wdNiXLgRDnSPV9+5NhBzxZFrvLU4QRljLMNJYmIcb314o5htSrm+EOCmLtOh7xM5OlcnNJMW1osmRxRkTWQ2e0yRQwvauYUMP7srYou4G8E/xLR1v0pGIFqsoKn3nYw2NAeKdJesffWch2V+xeYbCfDGk9WLdJITLzL8XlkMXzOJ3qc2WuK9qCL8Ru1Askk1ilrM3BlkBjDcZiwLeve3mdlbFj1IQH8WtIkU6c1h1tVCuHtVY5bg3W58gbt4Aa2HZ0Aah/ZnYBTkRUDityTTzw/Z/qzukedVh+4g1KwKfn7S0qU9KDMUJInAtmkfg== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Zhao Liu , Pedro Barbuda , "Michael S. Tsirkin" , Cameron Esfahani , Mohamed Mediouni , Peter Maydell , Roman Bolshakov , Phil Dennis-Jordan , qemu-arm@nongnu.org, Wei Liu Subject: [PATCH v3 7/9] whpx: make Hyper-V enlightenments configurable Date: Tue, 3 Mar 2026 21:49:57 +0100 Message-ID: <20260303204959.31156-8-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260303204959.31156-1-mohamed@unpredictable.fr> References: <20260303204959.31156-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: 5go7WhVrQWT7SmQIItTlHSkSemc4f3rO X-Proofpoint-ORIG-GUID: 5go7WhVrQWT7SmQIItTlHSkSemc4f3rO X-Authority-Info-Out: v=2.4 cv=K/gv3iWI c=1 sm=1 tr=0 ts=69a7498a cx=c_apl:c_pps:t_out a=YrL12D//S6tul8v/L+6tKg==:117 a=YrL12D//S6tul8v/L+6tKg==:17 a=Yq5XynenixoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=BRqF0JgGwH6LvUrOcfoA:9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzAzMDE3MSBTYWx0ZWRfX7AmmhhffwzN1 PndZkDZEJ73/y8B524hufZaFjwPpcfK511eu7rhhsdTQy1pVCVaAve9Oo5q8zL6jDUVHudIdf+5 iUlLV7FjsIP9W649vYqQvIyXL7Y2WKl/eZbU6sstGP7KIGyuknxABTqSnr6/1qYuoaoXl8cXc8o bBbs8AqcvVrE4WBrIb46ki9iYlaJZUZE2UEYxr8bkmIVAtkrNL1i0T7Lmd6j3OdC42XG7Dg18F1 hz6jw4/YS65OMBBUVKPYsgH35tdYYrj2grI/1jDpSTWRdQvhOlARmOQRKSUsPgJ0x+hYlOjKbUR h5oAmpEP67g4mfC8Rxzhwwy/cTiaebPcXRqG6nxJ0Xj09VI+N0dp4ren6b3HnA= 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-03-03_03,2026-03-03_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1030 phishscore=0 spamscore=0 malwarescore=0 adultscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 lowpriorityscore=0 mlxscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2603030171 X-JNJ: AAAAAAABgpjdZUbs+sXZ7QqVpLNGzUeLzt0R7c4kM9ac/vIzkaNfbp+G+BNAZN5WsyO+Wtq924ylfKCEw6mfE2zvLFJzL+y5u0XBc/jU+HDhIKpebdmR43CanOpf5IQtNTbfs68QJKEYA0lXZ+sjPDJaT+yqXpXhQdXoty6SVowzE6gzH+0067SVkPQ3qUk6gMFqXOoGLzgMQKu9tK2rJA608OOvOzgejpzPVVlj5cwJqngoyTLyos8R1XYGAE6AeibKkVTnUePyKh4jfV3RkBhDltRlLpGZmOBgqOQvZROTkTv6h0n0blX/PRas758ejWkqKJQHh8dp4qBV7/mFtsN/p80QRAS1rhyAx0ELg1AsfvNrkDoIpPkfZBW5Tx+8bGmmX7Lk/kGBTJJI7G+BtW6x+yv4o8XmjkricjlEmOWvH28xyng7eYBXuKnXvz4jdtiggb6fQxnqJYOy9fnD3MuNMKe6e+3Mm3HHvkHIP5PZpzErl9Zw4f5+8QTeNeg0Pz6DolEY9L39zliUv+pwIUIVyEAKXFK4RAGtQ7vnGeOs+jDxP593tVeC5gRtClSEdvHbCOuKyyf5vtavqydfRRY8Qaz0ZDfO4HqmAN2T4obOkq0NlPegT8NdYjV9Vgl0FS9umhls1ylkTdZ3YszjXpyQU8k29MNhZxAYl4URP3QlCOa/rVyJHfrw9XIF0c3oULk7IcdD+hyLbgJYdo2mzLsE0yiq8Lrbwy3TAo/agIoRG3mlbTPutyeYVqcuKWGuMjg= 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.76.191; envelope-from=mohamed@unpredictable.fr; helo=outbound.st.icloud.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.322, RCVD_IN_VALIDITY_SAFE_BLOCKED=1.141, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no 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: 1772571105808158500 Content-Type: text/plain; charset="utf-8" Have them be a machine option instead of a CPU one, to have something avail= able, even if not ideal... The existing Hyper-V enlightenments configuration mechanism is part of per-= CPU configuration, which happens too late for this. Signed-off-by: Mohamed Mediouni --- accel/whpx/whpx-common.c | 44 ++++++++++++++++++++++++++++++++++ include/system/whpx-internal.h | 4 ++++ target/i386/whpx/whpx-all.c | 20 +++++++++------- 3 files changed, 59 insertions(+), 9 deletions(-) diff --git a/accel/whpx/whpx-common.c b/accel/whpx/whpx-common.c index 4863fc8663..dae9ff0800 100644 --- a/accel/whpx/whpx-common.c +++ b/accel/whpx/whpx-common.c @@ -25,6 +25,7 @@ #include "qapi/qapi-visit-common.h" #include "migration/blocker.h" #include "accel/accel-cpu-target.h" +#include "qemu/target-info.h" #include =20 #include "system/whpx-internal.h" @@ -470,6 +471,41 @@ static void whpx_set_kernel_irqchip(Object *obj, Visit= or *v, } } =20 +static void whpx_set_hyperv(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) +{ + struct whpx_state *whpx =3D &whpx_global; + OnOffAuto mode; + + if (!visit_type_OnOffAuto(v, name, &mode, errp)) { + return; + } + + switch (mode) { + case ON_OFF_AUTO_ON: + whpx->hyperv_enlightenments_allowed =3D true; + whpx->hyperv_enlightenments_required =3D true; + break; + + case ON_OFF_AUTO_OFF: + whpx->hyperv_enlightenments_allowed =3D false; + whpx->hyperv_enlightenments_required =3D false; + break; + + case ON_OFF_AUTO_AUTO: + whpx->hyperv_enlightenments_allowed =3D true; + whpx->hyperv_enlightenments_required =3D false; + break; + default: + /* + * The value was checked in visit_type_OnOffAuto() 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); @@ -498,6 +534,11 @@ static void whpx_accel_class_init(ObjectClass *oc, con= st void *data) NULL, NULL); object_class_property_set_description(oc, "kernel-irqchip", "Configure WHPX in-kernel irqchip"); + object_class_property_add(oc, "hyperv", "OnOffAuto", + NULL, whpx_set_hyperv, + NULL, NULL); + object_class_property_set_description(oc, "hyperv", + "Configure Hyper-V enlightenments"); } =20 static void whpx_accel_instance_init(Object *obj) @@ -507,6 +548,9 @@ static void whpx_accel_instance_init(Object *obj) memset(whpx, 0, sizeof(struct whpx_state)); /* Turn on kernel-irqchip, by default */ whpx->kernel_irqchip_allowed =3D true; + + whpx->hyperv_enlightenments_allowed =3D true; + whpx->hyperv_enlightenments_required =3D false; } =20 static const TypeInfo whpx_accel_type =3D { diff --git a/include/system/whpx-internal.h b/include/system/whpx-internal.h index e7b915ccbf..abea3ddeee 100644 --- a/include/system/whpx-internal.h +++ b/include/system/whpx-internal.h @@ -41,6 +41,10 @@ struct whpx_state { =20 bool kernel_irqchip_allowed; bool kernel_irqchip_required; + + bool hyperv_enlightenments_allowed; + bool hyperv_enlightenments_required; + }; =20 extern struct whpx_state whpx_global; diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index 915d79152e..4968a5a3e4 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -2219,15 +2219,17 @@ int whpx_accel_init(AccelState *as, MachineState *m= s) synthetic_features.Bank0.DirectSyntheticTimers =3D 1; } =20 - hr =3D whp_dispatch.WHvSetPartitionProperty( - whpx->partition, - WHvPartitionPropertyCodeSyntheticProcessorFeaturesBanks, - &synthetic_features, - sizeof(WHV_SYNTHETIC_PROCESSOR_FEATURES_BANKS)); - if (FAILED(hr)) { - error_report("WHPX: Failed to set synthetic features, hr=3D%08lx",= hr); - ret =3D -EINVAL; - goto error; + if (whpx->hyperv_enlightenments_allowed) { + hr =3D whp_dispatch.WHvSetPartitionProperty( + whpx->partition, + WHvPartitionPropertyCodeSyntheticProcessorFeaturesBanks, + &synthetic_features, + sizeof(WHV_SYNTHETIC_PROCESSOR_FEATURES_BANKS)); + if (FAILED(hr)) { + error_report("WHPX: Failed to set synthetic features, hr=3D%08= lx", hr); + ret =3D -EINVAL; + goto error; + } } =20 /* Register for MSR and CPUID exits */ --=20 2.50.1 (Apple Git-155) From nobody Sat Apr 11 23:03:23 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=1772571070; cv=none; d=zohomail.com; s=zohoarc; b=AvOcozSFYv4aueXU2Qcxh6SKNsUV0WL0GOgyC36plMIQC2j27VrNJ1bDsIDJDMCBCtlPdYLRT0m5iGTQWAu/WRXC1sZbiqV6n+mM27h89Vr7yR6EKlOmxEL2z6ZDKzolLzwsdm7HxDoJs3vj3vxfU7mr6Wb3MLTd/XPvSFKwu9g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772571070; 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=OW8S3KLD8zFsAuvhuwhxPEOWPDp1M7oc2dpZI+SomHI=; b=MvdFnV8HBdw7OjiYNV35XGPVU/YxDlrldE5za4wkjWAJtEev+wy5rUap++R5ZXFxJ687/5btJ8YtWF7jr+ze4pkptkWmGrEjoulMU7vuLjpINf0GxWuhHn8cTkDyMuutzWFakZb0MmICDr86xvVY9q3XtrEwGVkueAGUHiuD36A= 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 1772571070788693.2931278474059; Tue, 3 Mar 2026 12:51:10 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vxWhJ-0006B9-WF; Tue, 03 Mar 2026 15:50:30 -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 1vxWhF-00065O-89 for qemu-devel@nongnu.org; Tue, 03 Mar 2026 15:50:25 -0500 Received: from p-east2-cluster6-host7-snip4-10.eps.apple.com ([57.103.76.161] helo=outbound.st.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vxWhD-0000mW-9m for qemu-devel@nongnu.org; Tue, 03 Mar 2026 15:50:24 -0500 Received: from outbound.st.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-1a-20-percent-2 (Postfix) with ESMTPS id 9B13A1800132; Tue, 3 Mar 2026 20:50:18 +0000 (UTC) Received: from localhost.localdomain (unknown [17.42.251.67]) by p00-icloudmta-asmtp-us-east-1a-20-percent-2 (Postfix) with ESMTPSA id 9EF0C18000A3; Tue, 3 Mar 2026 20:50:16 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1772571020; x=1775163020; bh=OW8S3KLD8zFsAuvhuwhxPEOWPDp1M7oc2dpZI+SomHI=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=UlInqj552cMV9+I1Cntf7FrJje6yMV2I7SXrihwqqG9hYv/q8z61wkgg3wu6QAcexMqAWf/QnG8PEb7FK1BQTGgrmw99V4hgU8HUBrFsAWjq8wLLKRW8MKT/0ry6H5OW1J83EVGDM6jNHQk+OXhGuM3U/FlSQ8D5N5emXYNSPG2fZcrMcKuhKvdKFjYR7krYhmFvue3T/Z7IHMh4reCwfktXyvyVre3IpTlQAo/S0Pt1rNAjY12vWVQK6Qk4spzNcFe+Hs6iEb2N1E2LqZxbbYMW+UbPaVO2++CcntsbFsBcVhWVIrrkZsHn6rHdnCd4qE6HvmKeLblPDGTmjd00ZA== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Zhao Liu , Pedro Barbuda , "Michael S. Tsirkin" , Cameron Esfahani , Mohamed Mediouni , Peter Maydell , Roman Bolshakov , Phil Dennis-Jordan , qemu-arm@nongnu.org, Wei Liu Subject: [PATCH v3 8/9] whpx: arm64: enable enlightenments if asked for Date: Tue, 3 Mar 2026 21:49:58 +0100 Message-ID: <20260303204959.31156-9-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260303204959.31156-1-mohamed@unpredictable.fr> References: <20260303204959.31156-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Authority-Info-Out: v=2.4 cv=LpyfC3dc c=1 sm=1 tr=0 ts=69a7498b cx=c_apl:c_pps:t_out a=YrL12D//S6tul8v/L+6tKg==:117 a=YrL12D//S6tul8v/L+6tKg==:17 a=Yq5XynenixoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=rOdoSoqhRWX9tc6y9DEA:9 X-Proofpoint-ORIG-GUID: cieeCDLk2BXp3JgSVVTO49-3ENaEEv58 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzAzMDE3MSBTYWx0ZWRfX0EZ+z+nFAOvv fgBihLF87vbHlTFKn+dqXbqvn6ZCXnaJztY7VDxPPCnuthTRsQcShMQIKrZW/DsIDueKO31QSC0 XWPa6e2eGNfqHdnfEKRJ6p3SvSYVVEyCD36dT5eAop59/A+rP3Ws1w1HFPhELxkBRbZjPzaMCzd 3F0YtKK4GtFs4Iq+T59pgIlGaf9ZyTUrttZiqzrgY784NrS/9cEjqIdSLXiW/UGCuPn9qEvG1v5 KvaUOlr8/cHfX08nG/SwfZq1lclsy4L6zQ0LLDiyYi1lvYMHL4syVakfTPNiGDAsBgc/1dkT0x+ fCD87uvWOdw5aEz7LT/mw0fuebhDXtIRt8rqp0Sws9yDyXPClZGcQexNi0J65E= X-Proofpoint-GUID: cieeCDLk2BXp3JgSVVTO49-3ENaEEv58 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-03-03_03,2026-03-03_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxlogscore=800 adultscore=0 clxscore=1030 phishscore=0 bulkscore=0 mlxscore=0 lowpriorityscore=0 suspectscore=0 spamscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2603030171 X-JNJ: AAAAAAABhd5Z7vrU0isfwRvm/DEy7uzWOYMo9zGcZiLatNyZZe2JmoJIfXGud0bPAaX3Tfr5goDMcs175r5Zs6o+3rqpsjt+jEXhZI5F9Cj9GZ3zYb5yNPfNfGbQPZ/X8REkvxlg+54pBsTOi3MYDRlptwBYTMpxbRRomqB1/HYCt7shXcHLpOmf0KTudbEeMrbjNvLFYljo2buSvA3LLBL1Hc7laqQ+SVawlOwmycU0lxGplDzekmDA+j/muE6CWumddwCu4bxGhgY5QKY0QTxFuAgdt972bYXcfYx9szeWJXz9KwHfTrqLC1SFDgNa4h+gjClckvN82p0Fk4D1Wubsn1mJHsXlkZROWYGG4WosxayljwWVm49xrRWsvwAjVEg5s0bQRHv3zXpPqhKS+frgps2m6DWDuT4Tvf82zQnh1PVj6AYfK1TpooXKDz+bUDDBL9/VxtyBoGQCHyrxSJ52mwNcqNBnYjbAZ+96QujoHUf/5oxnb963KJSTh3yrNBHa3vywyn8SWyXlBSlM5NumFNGKR0qayf4cFssmG+vPbbGFYleb0uo4C0U9+lzsnSEO6QGqmWeWE0ut4waxPO72q57AmvZiybUbcQfsBIqQ2a9B2VgF6IL+pyraWFBbow11GhEwsCEL3ASQ7H1e0wLWN95HQ16SK9A+qFF8ZbixaBxskRtez1W+IrVD8SQ39uNZHOzhdYyAFDdTwmMVNa1K0WN245ZTHCEenULGxYZPwfJ13+Un0FBPLTPgkZ07 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.76.161; envelope-from=mohamed@unpredictable.fr; helo=outbound.st.icloud.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.322, RCVD_IN_VALIDITY_SAFE_BLOCKED=1.141, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no 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: 1772571073978158500 Content-Type: text/plain; charset="utf-8" Signed-off-by: Mohamed Mediouni --- target/arm/whpx/whpx-all.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/target/arm/whpx/whpx-all.c b/target/arm/whpx/whpx-all.c index bb94eac7bf..9983d59a38 100644 --- a/target/arm/whpx/whpx-all.c +++ b/target/arm/whpx/whpx-all.c @@ -947,6 +947,43 @@ int whpx_accel_init(AccelState *as, MachineState *ms) goto error; } =20 + /* Enable synthetic processor features */ + WHV_SYNTHETIC_PROCESSOR_FEATURES_BANKS synthetic_features; + memset(&synthetic_features, 0, sizeof(WHV_SYNTHETIC_PROCESSOR_FEATURES= _BANKS)); + synthetic_features.BanksCount =3D 1; + + synthetic_features.Bank0.HypervisorPresent =3D 1; + synthetic_features.Bank0.Hv1 =3D 1; + synthetic_features.Bank0.AccessVpRunTimeReg =3D 1; + synthetic_features.Bank0.AccessPartitionReferenceCounter =3D 1; + synthetic_features.Bank0.AccessPartitionReferenceTsc =3D 1; + synthetic_features.Bank0.AccessHypercallRegs =3D 1; + synthetic_features.Bank0.AccessVpIndex =3D 1; + synthetic_features.Bank0.AccessHypercallRegs =3D 1; + synthetic_features.Bank0.TbFlushHypercalls =3D 1; + synthetic_features.Bank0.AccessSynicRegs =3D 1; + synthetic_features.Bank0.AccessSyntheticTimerRegs =3D 1; + synthetic_features.Bank0.AccessIntrCtrlRegs =3D 1; + synthetic_features.Bank0.SyntheticClusterIpi =3D 1; + synthetic_features.Bank0.DirectSyntheticTimers =3D 1; + + /* + * On ARM64, have enlightenments off by default=20 + * as they're not needed for performance. + */ + if (whpx->hyperv_enlightenments_required) { + hr =3D whp_dispatch.WHvSetPartitionProperty( + whpx->partition, + WHvPartitionPropertyCodeSyntheticProcessorFeaturesBanks, + &synthetic_features, + sizeof(WHV_SYNTHETIC_PROCESSOR_FEATURES_BANKS)); + if (FAILED(hr)) { + error_report("WHPX: Failed to set synthetic features, hr=3D%08= lx", 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 Apr 11 23:03:23 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=1772571148; cv=none; d=zohomail.com; s=zohoarc; b=IdiM+UxMN5Wz5pxr8qwA7J1xQayddhFAWX3JHb0XkITkXAXKUpOxQZPZDwc25s0QIOnW5//ONjpHfqt2P2+PoDZ3/Ep5daQ0iQ1CPeCjhgVxm6Ycvm5sNp5hvP7Am7budA6PfFxN6IRldPfFOX73pnMt6I/Cd0iE/Km3KWQSjEY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772571148; 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=xfi6rjeDQo4vpSHmbqs0x+tY5PCeD7vMjLpTj63mmJI=; b=dJ9gfF+52ofedLZdQcCdXXkA30abaY0md0GH93zFGHp3kJrbAcfAxDatVUDcCED35czCs10begKkZfjVbInlUlnl+oAHyN9H5ED2/7bWNdnRZE9wC7pCu9LirQUbYN+lBBk1lK7riWh1sTX/+BbN6bIXDVM15EKmddYcysvuetE= 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 1772571148731674.1371354671102; Tue, 3 Mar 2026 12:52:28 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vxWhK-0006BW-Mf; Tue, 03 Mar 2026 15:50:30 -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 1vxWhH-00068q-6Y for qemu-devel@nongnu.org; Tue, 03 Mar 2026 15:50:27 -0500 Received: from p-east2-cluster6-host10-snip4-4.eps.apple.com ([57.103.76.205] helo=outbound.st.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vxWhF-0000nt-99 for qemu-devel@nongnu.org; Tue, 03 Mar 2026 15:50:26 -0500 Received: from outbound.st.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-east-1a-20-percent-2 (Postfix) with ESMTPS id F1F3F180012C; Tue, 3 Mar 2026 20:50:20 +0000 (UTC) Received: from localhost.localdomain (unknown [17.42.251.67]) by p00-icloudmta-asmtp-us-east-1a-20-percent-2 (Postfix) with ESMTPSA id 734571800580; Tue, 3 Mar 2026 20:50:18 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1772571024; x=1775163024; bh=xfi6rjeDQo4vpSHmbqs0x+tY5PCeD7vMjLpTj63mmJI=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=gylOBL219wo9mpENOvJe3UyCADKcXdPd2ypLZG+fBRLQiMYazjUDX+GuZBGkKHm2rjlcbE4KMkarVXswfQT5cJn2XALB4MAonC4pHzXAuN2SNPQE0z0VZJyxkDcd29hKCjAEROqqKUDMgDSqqn3R0IaWK5IpxWYftvjDmNBaesoJCSD99/r0F8ExbEri1C/CP/BJWMHM81NFoA8DrGm37OG4Dx/EYP+n0pM44nCoz1tzKm4bVdLoxhUiDlY9fNS4Ei0nxFMdvlwy5TeXzhO8Q4vOFKPjQKBeLlvQkbTAB2f59lJdb7HVQefi8LGweONhcfeFREufOgbm55iMeSfQ7Q== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Zhao Liu , Pedro Barbuda , "Michael S. Tsirkin" , Cameron Esfahani , Mohamed Mediouni , Peter Maydell , Roman Bolshakov , Phil Dennis-Jordan , qemu-arm@nongnu.org, Wei Liu Subject: [PATCH v3 9/9] whpx: i386: remove SIPI trapping Date: Tue, 3 Mar 2026 21:49:59 +0100 Message-ID: <20260303204959.31156-10-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260303204959.31156-1-mohamed@unpredictable.fr> References: <20260303204959.31156-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: mzhYWAyi_613Jwd4bpiBuTmORIiMM3rO X-Proofpoint-ORIG-GUID: mzhYWAyi_613Jwd4bpiBuTmORIiMM3rO X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzAzMDE3MSBTYWx0ZWRfX0z/KigJAZAp2 TWtvnB+44FINTwfORfTx1/WXjqqwdcSe8wMiigD5X9M2Ti2z34GxLE8za/pho0+2mUBRMxPSDgp kLEIe4zngVjBjjf3JPxZQdopqaCFWJZETFZu9VPLSSmN5YM2K7PMSbT9bmsg6ZFpBzrFuUEBApe KZ+ZQTzIaB1uiujdbvRr9X7hMgUMLz0zGbyhFWqT9Wd1V6lxxVmNG/XRiMnLsH2nYcvtUHTdLy6 GrS3NUf1AW5chn+YlxUvgYkpXmbhNCdeAhv7LJRMMwBvkm3z409mL1LnOZ//Sd/iQsKFawmH/0h LsxRvK9C8b9tro0Z7Qu6C88g2YuNTJDSVdZl+bpz1Cfc/bNWk3fLLR6uHeXdVU= X-Authority-Info-Out: v=2.4 cv=H4jWAuYi c=1 sm=1 tr=0 ts=69a7498e cx=c_apl:c_pps:t_out a=YrL12D//S6tul8v/L+6tKg==:117 a=YrL12D//S6tul8v/L+6tKg==:17 a=Yq5XynenixoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=Xl7PRCIL3n5FuX7mVuoA: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-03-03_03,2026-03-03_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=997 phishscore=0 lowpriorityscore=0 bulkscore=0 clxscore=1030 suspectscore=0 malwarescore=0 mlxscore=0 adultscore=0 spamscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2603030171 X-JNJ: AAAAAAABCLcq71L/nAeaqvrS3vPU4gHNlLZ9/ZhxGO9u5sTOjbwjlIZDliblJRi1ssLIfnPqDOBEtHMqi0kuth//nX9asOABqFZqwXo6cVH09eOqscDMDHPhc5CuxFZPhJtb18oxrjH0h57TGXbJ09Ow5j94jOipXEQEU7tutCw0Z+i3xqHFaf12RW74Y3FBdArDQRFUDOLYhOwf64sft4JOXfla/zVJtTN81xHdk7jM5Zm51S5XDwXgf+LaVnmi+Ypk6Fs4cNnt6Xf7uzS/PunGT8KKVO/lG/3GCnteJ0ns6Sc5UiOx0uECiCRvIK1nAXnxputr2xxR1wNMTM2K4K13tj5TSTWgXDNDQr1ql53O6oebN03eVtbouhYUlfZTYbM7TkE/crfz8lEKgtt8XRUlCu8Bo0WM+xIzCJwtSgfIuObbEaolmjJufBEr39AjblItCycq2d6vQjo85mEyIma7dmtmBqIkuWjdzKdkXJmYj4J5dNOTs2ChaDodnhcRTd2jYyP9UjJdV/j0ayTALz1/ww5O7jq37SRA555qhGMjDdwh4iSu4qulZdeHx86JfQ0Hzn36tK9NxIjtPHJWvlqyUMKZkzbRbGon9TJZdUrUPyYBFkDplxzPAUi7YY8vX2/oW/6AIHrxSBzU/k1rg5SUIq3i1zMQBTcaYyO5tcfhM0umLOxm/It+n6WB5TM6TuUUvffpnOdwEUIprjzzPvNwM0jWXP0WE08Laibx7KzTM2ypRl53qvJEfz2oDWuDH2rlPmOc 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.76.205; envelope-from=mohamed@unpredictable.fr; helo=outbound.st.icloud.com X-Spam_score_int: -5 X-Spam_score: -0.6 X-Spam_bar: / X-Spam_report: (-0.6 / 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.322, RCVD_IN_VALIDITY_SAFE_BLOCKED=1.141, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no 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: 1772571152141158500 Content-Type: text/plain; charset="utf-8" The implementation in Hyper-V works fine and the code currently present doesn't handle x2APIC correctly anyway, so remove it and use the implementation in Hyper-V. Signed-off-by: Mohamed Mediouni --- target/i386/whpx/whpx-all.c | 97 ------------------------------------- 1 file changed, 97 deletions(-) diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index 4968a5a3e4..fa78218f80 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -1679,100 +1679,6 @@ int whpx_vcpu_run(CPUState *cpu) ret =3D whpx_handle_halt(cpu); break; =20 - case WHvRunVpExitReasonX64ApicInitSipiTrap: { - WHV_INTERRUPT_CONTROL ipi =3D {0}; - uint64_t icr =3D vcpu->exit_ctx.ApicInitSipi.ApicIcr; - uint32_t delivery_mode =3D - (icr & APIC_ICR_DELIV_MOD) >> APIC_ICR_DELIV_MOD_SHIFT; - int dest_shorthand =3D - (icr & APIC_ICR_DEST_SHORT) >> APIC_ICR_DEST_SHORT_SHIFT; - bool broadcast =3D false; - bool include_self =3D false; - uint32_t i; - - /* We only registered for INIT and SIPI exits. */ - if ((delivery_mode !=3D APIC_DM_INIT) && - (delivery_mode !=3D APIC_DM_SIPI)) { - error_report( - "WHPX: Unexpected APIC exit that is not a INIT or SIPI= "); - break; - } - - if (delivery_mode =3D=3D APIC_DM_INIT) { - ipi.Type =3D WHvX64InterruptTypeInit; - } else { - ipi.Type =3D WHvX64InterruptTypeSipi; - } - - ipi.DestinationMode =3D - ((icr & APIC_ICR_DEST_MOD) >> APIC_ICR_DEST_MOD_SHIFT) ? - WHvX64InterruptDestinationModeLogical : - WHvX64InterruptDestinationModePhysical; - - ipi.TriggerMode =3D - ((icr & APIC_ICR_TRIGGER_MOD) >> APIC_ICR_TRIGGER_MOD_SHIF= T) ? - WHvX64InterruptTriggerModeLevel : - WHvX64InterruptTriggerModeEdge; - - ipi.Vector =3D icr & APIC_VECTOR_MASK; - switch (dest_shorthand) { - /* no shorthand. Bits 56-63 contain the destination. */ - case 0: - ipi.Destination =3D (icr >> 56) & APIC_VECTOR_MASK; - hr =3D whp_dispatch.WHvRequestInterrupt(whpx->partition, - &ipi, sizeof(ipi)); - if (FAILED(hr)) { - error_report("WHPX: Failed to request interrupt hr=3D= %08lx", - hr); - } - - break; - - /* self */ - case 1: - include_self =3D true; - break; - - /* broadcast, including self */ - case 2: - broadcast =3D true; - include_self =3D true; - break; - - /* broadcast, excluding self */ - case 3: - broadcast =3D true; - break; - } - - if (!broadcast && !include_self) { - break; - } - - for (i =3D 0; i <=3D max_vcpu_index; i++) { - if (i =3D=3D cpu->cpu_index && !include_self) { - continue; - } - - /* - * Assuming that APIC Ids are identity mapped since - * WHvX64RegisterApicId & WHvX64RegisterInitialApicId regi= sters - * are not handled yet and the hypervisor doesn't allow the - * guest to modify the APIC ID. - */ - ipi.Destination =3D i; - hr =3D whp_dispatch.WHvRequestInterrupt(whpx->partition, - &ipi, sizeof(ipi)); - if (FAILED(hr)) { - error_report( - "WHPX: Failed to request SIPI for %d, hr=3D%08lx", - i, hr); - } - } - - break; - } - case WHvRunVpExitReasonCanceled: if (exclusive_step_mode !=3D WHPX_STEP_NONE) { /* @@ -2236,9 +2142,6 @@ int whpx_accel_init(AccelState *as, MachineState *ms) memset(&prop, 0, sizeof(WHV_PARTITION_PROPERTY)); prop.ExtendedVmExits.X64MsrExit =3D 1; prop.ExtendedVmExits.ExceptionExit =3D 1; - if (whpx_irqchip_in_kernel()) { - prop.ExtendedVmExits.X64ApicInitSipiExitTrap =3D 1; - } =20 hr =3D whp_dispatch.WHvSetPartitionProperty( whpx->partition, --=20 2.50.1 (Apple Git-155)