Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0106AF9D0F0 for ; Tue, 14 Apr 2026 18:24:32 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wCiPh-0006Ax-Kf; Tue, 14 Apr 2026 14:23:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wCiPS-00067S-Tj for qemu-devel@nongnu.org; Tue, 14 Apr 2026 14:22:51 -0400 Received: from pv-2005h-snip4-7.eps.apple.com ([57.103.66.248] 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 1wCiPQ-0006Ua-Dl for qemu-devel@nongnu.org; Tue, 14 Apr 2026 14:22:50 -0400 Received: from outbound.pv.icloud.com (unknown [127.0.0.2]) by p00-icloudmta-asmtp-us-west-1a-60-percent-9 (Postfix) with ESMTPS id A3A2F1800108; Tue, 14 Apr 2026 18:22:45 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unpredictable.fr; s=sig1; t=1776190967; x=1778782967; bh=tT4F++bSuONbY+c7bgtCCb6QKbPZ19v7x1ehrozqyHo=; h=From:To:Subject:Date:Message-ID:MIME-Version:x-icloud-hme; b=fW6u+ORigS+O6Pk7YAhgz6rsavDy7P3hZ+z1TKixvAGV7T1UdxZuKauL1E9a3NfqjAFMgbGZHjHWpSTwr2fMcvRKWcfE8PJIHl8wwl1kHuiL1v2ImET/hXR8A1uABVoOvXZCL68eNvhPjuYq/++ukRyP3G+a16yzmJSEFsR446ajJYuF+/JGX1YffVPoi1S1SyUGMyqH5yIQlp0MGyXKL3c9Rgu9sNMO6Z8WCckbx27nXJMpmvHYhocIh6BEsUGll3lDAsFTRRZXzHuRJISB5DbCZJc1UVGAYqwkWA4XWOd0YOgUWTHU8ZeVzLHFqipeJQhK/h+XO2hhlXCbHWROhw== mail-alias-created-date: 1752046281608 Received: from localhost.localdomain (unknown [17.56.9.36]) by p00-icloudmta-asmtp-us-west-1a-60-percent-9 (Postfix) with ESMTPSA id F261618013AE; Tue, 14 Apr 2026 18:22:43 +0000 (UTC) From: Mohamed Mediouni To: qemu-devel@nongnu.org Cc: Pedro Barbuda , Mohamed Mediouni , Zhao Liu , Paolo Bonzini Subject: [PATCH 6/7] target: i386: HLT type that ignores EFLAGS.IF Date: Tue, 14 Apr 2026 20:22:30 +0200 Message-ID: <20260414182231.18776-7-mohamed@unpredictable.fr> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260414182231.18776-1-mohamed@unpredictable.fr> References: <20260414182231.18776-1-mohamed@unpredictable.fr> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDE0MDE3MSBTYWx0ZWRfX5/ls1LiVJwEh 7F6c4jtssZKWOWA3UnyNXtmwc1ygtBe6nZaBjAOi2JwjYdZnWhVMok4FTUQ2AIRELYnDQDJtZju 3XtcioRKTyRnU2Ku9onGxf9zO5ss5E+YGB62m2W1OXZDAEGcHxN97syCHwnfJyWdyKGBSgARPCx aSOBRT/wtcyhAm2PPfN1m5FoWFBwNRWEIS1/EBCsPIqIC9K3o+IeKd3Xa8m41G1zhv8qeZSQRKd Tnr94MDHtHmog3n/bKp852mghUzmqARkuOBLaWmHKwMqbsthDjXn5RCwTSbIDcndnR//rnL0ig/ P06adoeVJhYi0nOSzFit1xeV6u7AHHq4ixA3LHjKiDC5YAfI2bDeXiwMOMAjsA= X-Authority-Info-Out: v=2.4 cv=KJ1XzVFo c=1 sm=1 tr=0 ts=69de85f6 cx=c_apl:c_pps:t_out a=azHRBMxVc17uSn+fyuI/eg==:117 a=azHRBMxVc17uSn+fyuI/eg==:17 a=A5OVakUREuEA:10 a=VkNPw1HP01LnGYTKEx00:22 a=ZtXhj7NgbhMgH__AbsQA:9 X-Proofpoint-GUID: H12iFphNauZtdUD9oA64BRiLR7IOtK4E X-Proofpoint-ORIG-GUID: H12iFphNauZtdUD9oA64BRiLR7IOtK4E X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-14_03,2026-04-13_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 suspectscore=0 bulkscore=0 lowpriorityscore=0 clxscore=1030 mlxlogscore=937 spamscore=0 phishscore=0 malwarescore=0 mlxscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2604140171 Received-SPF: pass client-ip=57.103.66.248; 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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org The TLFS says: > A partition which possesses the AccessGuestIdleMsr privilege may trigger > entry into the virtual processor idle sleep state through a read to the > hypervisor-defined MSR HV_X64_MSR_GUEST_IDLE. The virtual processor will > be woken when an interrupt arrives, regardless of whether the interrupt > is enabled on the virtual processor or not. Meanwhile, Windows 24H2+ calls this MSR anyway without the privilege being set. Add the infrastructure to support it on the generic QEMU side. Signed-off-by: Mohamed Mediouni --- target/i386/cpu.c | 10 ++++++---- target/i386/cpu.h | 2 ++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 0000093fa3..b18e40666e 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -10482,13 +10482,15 @@ int x86_cpu_pending_interrupt(CPUState *cs, int interrupt_request) (((env->hflags2 & HF2_VINTR_MASK) && (env->hflags2 & HF2_HIF_MASK)) || (!(env->hflags2 & HF2_VINTR_MASK) && - (env->eflags & IF_MASK && - !(env->hflags & HF_INHIBIT_IRQ_MASK))))) { + ((env->eflags & IF_MASK && + !(env->hflags & HF_INHIBIT_IRQ_MASK)) + || env->hflags2 & HF2_HYPERV_HLT_MASK)))) { return CPU_INTERRUPT_HARD; } else if (env->hflags2 & HF2_VGIF_MASK) { if((interrupt_request & CPU_INTERRUPT_VIRQ) && - (env->eflags & IF_MASK) && - !(env->hflags & HF_INHIBIT_IRQ_MASK)) { + ((env->eflags & IF_MASK && + !(env->hflags & HF_INHIBIT_IRQ_MASK)) + || env->hflags2 & HF2_HYPERV_HLT_MASK)) { return CPU_INTERRUPT_VIRQ; } } diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 0b539155c4..67f508dc10 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -225,6 +225,7 @@ typedef enum X86Seg { #define HF2_NPT_SHIFT 6 /* Nested Paging enabled */ #define HF2_IGNNE_SHIFT 7 /* Ignore CR0.NE=0 */ #define HF2_VGIF_SHIFT 8 /* Can take VIRQ*/ +#define HF2_HYPERV_HLT_SHIFT 9 /* Hyper-V HV_X64_MSR_GUEST_IDLE */ #define HF2_GIF_MASK (1 << HF2_GIF_SHIFT) #define HF2_HIF_MASK (1 << HF2_HIF_SHIFT) @@ -235,6 +236,7 @@ typedef enum X86Seg { #define HF2_NPT_MASK (1 << HF2_NPT_SHIFT) #define HF2_IGNNE_MASK (1 << HF2_IGNNE_SHIFT) #define HF2_VGIF_MASK (1 << HF2_VGIF_SHIFT) +#define HF2_HYPERV_HLT_MASK (1 << HF2_HYPERV_HLT_SHIFT) #define CR0_PE_SHIFT 0 #define CR0_MP_SHIFT 1 -- 2.50.1 (Apple Git-155)