From nobody Sun Apr 12 06:08:38 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=1770954437; cv=none; d=zohomail.com; s=zohoarc; b=nKdWNRkbMPZh4SlcdfIClkU7eP+Tj/aENsXsCXLOLCZ9XhdnFTq73jemFCkcp6Xvq5eu5jg6qc6EHmSTLM6yZTgLLX6tGp/fl+GOYSNcOuPC5SaS8v2K4iPqLjvvERL/MgCDD9+IqGzRfNeaJ63mRiRcINaZBbo2wzCF5M7Ru0A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770954437; 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=O7pcpgfwM6ECBoMunj3RQ37ql2fZKOaaMfhrgMDZZG8=; b=iKJShl7Cg0Al4OJ/+68N5uLhn112KYy4673mQ8vFgcKoZC4O13ySVYCX3VIBjBhUfsur1IvXRRwfWEiBfbfI00bDLCqxep1fdPWfqRWnjqfYVgc5FQ7KnyGmWTAgLnUo10N94NrSjCn9lsbgKiF/+HIRWIDgYHtsG20DfR4zBNc= 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 1770954437337445.9017699446588; Thu, 12 Feb 2026 19:47:17 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vqk8g-0008NU-53; Thu, 12 Feb 2026 22:46:42 -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 1vqk8e-0008NH-K6 for qemu-devel@nongnu.org; Thu, 12 Feb 2026 22:46:40 -0500 Received: from p-west1-cluster4-host7-snip4-10.eps.apple.com ([57.103.65.181] helo=outbound.pv.icloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vqk8c-0005tR-Ux for qemu-devel@nongnu.org; Thu, 12 Feb 2026 22:46:40 -0500 Received: from outbound.pv.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-west-1a-60-percent-11 (Postfix) with ESMTPS id 32F3918002E6; Fri, 13 Feb 2026 03:46:36 +0000 (UTC) Received: from localhost.localdomain (unknown [17.56.9.36]) by p00-icloudmta-asmtp-us-west-1a-60-percent-11 (Postfix) with ESMTPSA id AFA3418002E3; Fri, 13 Feb 2026 03:46:32 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1770954397; x=1773546397; bh=O7pcpgfwM6ECBoMunj3RQ37ql2fZKOaaMfhrgMDZZG8=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=HKX1N/ctpSFpQm5Pv8ph8yltbWwOmZxD/0KcLWvBjp05vbfeTPgZ8aFmNMn/sPBSs+AzO7OjVIyEEunXDzdASXp7IzVfRYVMjRwhqpWyCvqJuHXtNbUrsRGxHEqO4qEO8DiRoxtmqs0BhgiHVkNPSuXkApV4OHte3JCXb8q72tny3Hd4C/HTrKyl1AcE3iN21IghVZ8qbm4iQWt5RzTA6uio3TwkieR3k2kMvZK6Kyk1IfqI3l7KkGIPzoj5MrBd6wtAWZ6AxutLsXE+bqwwV15/Jz0GRA6a0/bphD6qzXruf/5DFX/MF5a1V8JRqyEmhi4bBptcUMMxnDdE6/1oHA== mail-alias-created-date: 1752046281608 From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Magnus Kulke , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Bernhard Beschow , Paolo Bonzini , Mohamed Mediouni , Wei Liu , Pedro Barbuda , Cameron Esfahani , Peter Maydell , Phil Dennis-Jordan , Zhao Liu , Roman Bolshakov , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH v2 09/10] whpx: i386: remove CPUID trapping Date: Fri, 13 Feb 2026 04:45:52 +0100 Message-ID: <20260213034556.13471-10-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260213034556.13471-1-mohamed@unpredictable.fr> References: <20260213034556.13471-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: YhtuqlvwhCZrchmbnsjTBi2fEHN3TaqI X-Authority-Info-Out: v=2.4 cv=Qahrf8bv c=1 sm=1 tr=0 ts=698e9e9c cx=c_apl:c_apl_out:c_pps a=azHRBMxVc17uSn+fyuI/eg==:117 a=azHRBMxVc17uSn+fyuI/eg==:17 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=Mpw57Om8IfrbqaoTuvik:22 a=GgsMoib0sEa3-_RKJdDe:22 a=Gk9p9Fe9aJpBGj35TJ8A:9 X-Proofpoint-GUID: YhtuqlvwhCZrchmbnsjTBi2fEHN3TaqI X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjEzMDAyNSBTYWx0ZWRfXyXRz2XQCHypN 5o1helNaDarDwUDSsStMza1MgB5yIx37HZIp89WVTIrCQa8Rm0Apk5gl4E7kuDo9/JFh6pl/BPK iv0A4EpcKsD3eZZ6gYPdN1CWolLPVaj18H4GmvXmR4n47l/8qyvCS2TfHtnlGMsOiewp9MJj9Pi Iki0KopXI1PXGVUARR5h4/uPbkO/gOSr+NEaxQmLdR2Pl2fym8x/utBBKyVBwhhnK8MngPTocuC qZ4MlkFMeY2AqKIdmhFziryYYPKO/6RlDxDkfzwOuWLNj7Xut3oUopKo8kXK2mJhmFg9i1o6bNO j2zU82+eGtN7Nd1/Wmy0RWYST3CtDWMk/DqRHFgGVho3QB5PAaXEnUh20YVz3k= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-12_05,2026-02-12_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 clxscore=1030 bulkscore=0 mlxscore=0 spamscore=0 phishscore=0 mlxlogscore=999 adultscore=0 lowpriorityscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602130025 X-JNJ: AAAAAAABMOmPJv531qsBnQPS1XKoTMDWy5WUdK4LqlpiU/FfBuTamSBc2VIrQ5cIFert3jyErTYlitBOoi/Fc8tTUaaZ5SM5uFI9urPxZNXq5OqEpaiEPVc3zR/abwS8Hz0DyihG5WRgDnDyPIJUO0iCTxGy9XzzQLJ9HAklRoZnRunnq5Ua8ba+tF42BmPSp0s+tIypo6q9CUjMIlIGQQyR217LXLtadmNUctqvhgNia6+cMTw74n64yV1U+n85XysCE1xFCyC3uYU/CxojGB1ouJ0PysqCU8R4AYwSEYGcQfuldWT9bF3FrIK/Sh7yURDgzWWeZDaZOdVM0U9jfXgCw+C1P9zzlD4mZhHiGk7aq5pQJH4q0xY9qGcLHgt9uK/mFqI1DqsDIZrKacbK7pVrKMZ+FqTJZK8Qt7GSZBGfzEcx8OEKaHSgBqCTeOKYaq/dWbVyoMur+eWAiAz8xwhao4Jp1wuSNpKlT/pOiT4tUd2tGTYD8rQvDJIWm5a4z60unXsQ1YN8TpfaY1cfVEL1R0cH4IbNriyqty3dENUAfeCb+nIp8Nj8DkRibCy0jCb/Ey/PIVI4PzdWPly5En/eJKVpTT7U+m4FkPAj84kXneeDDy6hrJRgDAySErhvG9CllPOHX+/+GJJGlL0OoV86z/ceB82FThzGxqBz8io4u17EI7YEDJvWox2KFLxAlEBTPvuXWgMpZnATZp0njX/hxAsp+/bpYsl07MApzvIRkUUvh3J1N4UzRB/NjQ4rIavdiJRTnWLiQNaxfUjpulq4DshXlbzA4UxxdX3HTuX12xKzfCdq 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.65.181; envelope-from=mohamed@unpredictable.fr; helo=outbound.pv.icloud.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H2=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @unpredictable.fr) X-ZM-MESSAGEID: 1770954438796154100 Content-Type: text/plain; charset="utf-8" Very partial in its current state and results in significantly inconsistent CPUID data. Remove it until it's reimplemented later. Signed-off-by: Mohamed Mediouni --- target/i386/whpx/whpx-all.c | 104 ------------------------------------ 1 file changed, 104 deletions(-) diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index e815ca9bfa..0e8fb0e72e 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -1793,75 +1793,6 @@ int whpx_vcpu_run(CPUState *cpu) ret =3D 0; break; } - case WHvRunVpExitReasonX64Cpuid: { - WHV_REGISTER_VALUE reg_values[5]; - WHV_REGISTER_NAME reg_names[5]; - UINT32 reg_count =3D 5; - UINT64 cpuid_fn, rip =3D 0, rax =3D 0, rcx =3D 0, rdx =3D 0, r= bx =3D 0; - X86CPU *x86_cpu =3D X86_CPU(cpu); - CPUX86State *env =3D &x86_cpu->env; - - memset(reg_values, 0, sizeof(reg_values)); - - rip =3D vcpu->exit_ctx.VpContext.Rip + - vcpu->exit_ctx.VpContext.InstructionLength; - cpuid_fn =3D vcpu->exit_ctx.CpuidAccess.Rax; - - /* - * Ideally, these should be supplied to the hypervisor during = VCPU - * initialization and it should be able to satisfy this reques= t. - * But, currently, WHPX doesn't support setting CPUID values i= n the - * hypervisor once the partition has been setup, which is too = late - * since VCPUs are realized later. For now, use the values from - * QEMU to satisfy these requests, until WHPX adds support for - * being able to set these values in the hypervisor at runtime. - */ - cpu_x86_cpuid(env, cpuid_fn, 0, (UINT32 *)&rax, (UINT32 *)&rbx, - (UINT32 *)&rcx, (UINT32 *)&rdx); - switch (cpuid_fn) { - case 0x40000000: - /* Expose the vmware cpu frequency cpuid leaf */ - rax =3D 0x40000010; - rbx =3D rcx =3D rdx =3D 0; - break; - - case 0x40000010: - rax =3D env->tsc_khz; - rbx =3D env->apic_bus_freq / 1000; /* Hz to KHz */ - rcx =3D rdx =3D 0; - break; - - case 0x80000001: - /* Remove any support of OSVW */ - rcx &=3D ~CPUID_EXT3_OSVW; - break; - } - - reg_names[0] =3D WHvX64RegisterRip; - reg_names[1] =3D WHvX64RegisterRax; - reg_names[2] =3D WHvX64RegisterRcx; - reg_names[3] =3D WHvX64RegisterRdx; - reg_names[4] =3D WHvX64RegisterRbx; - - reg_values[0].Reg64 =3D rip; - reg_values[1].Reg64 =3D rax; - reg_values[2].Reg64 =3D rcx; - reg_values[3].Reg64 =3D rdx; - reg_values[4].Reg64 =3D rbx; - - hr =3D whp_dispatch.WHvSetVirtualProcessorRegisters( - whpx->partition, cpu->cpu_index, - reg_names, - reg_count, - reg_values); - - if (FAILED(hr)) { - error_report("WHPX: Failed to set CpuidAccess state regist= ers," - " hr=3D%08lx", hr); - } - ret =3D 0; - break; - } case WHvRunVpExitReasonException: whpx_get_registers(cpu); =20 @@ -2015,26 +1946,6 @@ int whpx_init_vcpu(CPUState *cpu) } } =20 - /* - * If the vmware cpuid frequency leaf option is set, and we have a val= id - * tsc value, trap the corresponding cpuid's. - */ - if (x86_cpu->vmware_cpuid_freq && env->tsc_khz) { - UINT32 cpuidExitList[] =3D {1, 0x80000001, 0x40000000, 0x40000010}; - - hr =3D whp_dispatch.WHvSetPartitionProperty( - whpx->partition, - WHvPartitionPropertyCodeCpuidExitList, - cpuidExitList, - RTL_NUMBER_OF(cpuidExitList) * sizeof(UINT32)); - - if (FAILED(hr)) { - error_report("WHPX: Failed to set partition CpuidExitList hr= =3D%08lx", - hr); - ret =3D -EINVAL; - goto error; - } - } =20 vcpu->interruptable =3D true; cpu->vcpu_dirty =3D true; @@ -2071,7 +1982,6 @@ int whpx_accel_init(AccelState *as, MachineState *ms) WHV_CAPABILITY whpx_cap; UINT32 whpx_cap_size; WHV_PARTITION_PROPERTY prop; - UINT32 cpuidExitList[] =3D {1, 0x80000001}; WHV_CAPABILITY_FEATURES features =3D {0}; =20 whpx =3D &whpx_global; @@ -2181,7 +2091,6 @@ int whpx_accel_init(AccelState *as, MachineState *ms) /* Register for MSR and CPUID exits */ memset(&prop, 0, sizeof(WHV_PARTITION_PROPERTY)); prop.ExtendedVmExits.X64MsrExit =3D 1; - prop.ExtendedVmExits.X64CpuidExit =3D 1; prop.ExtendedVmExits.ExceptionExit =3D 1; if (whpx_irqchip_in_kernel()) { prop.ExtendedVmExits.X64ApicInitSipiExitTrap =3D 1; @@ -2198,19 +2107,6 @@ int whpx_accel_init(AccelState *as, MachineState *ms) goto error; } =20 - hr =3D whp_dispatch.WHvSetPartitionProperty( - whpx->partition, - WHvPartitionPropertyCodeCpuidExitList, - cpuidExitList, - RTL_NUMBER_OF(cpuidExitList) * sizeof(UINT32)); - - if (FAILED(hr)) { - error_report("WHPX: Failed to set partition CpuidExitList hr=3D%08= lx", - hr); - ret =3D -EINVAL; - goto error; - } - /* * We do not want to intercept any exceptions from the guest, * until we actually start debugging with gdb. --=20 2.50.1 (Apple Git-155)