{"id":2231451,"url":"http://patchwork.ozlabs.org/api/patches/2231451/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260430172204.1006673-36-pbonzini@redhat.com/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260430172204.1006673-36-pbonzini@redhat.com>","list_archive_url":null,"date":"2026-04-30T17:21:41","name":"[PULL,35/58] whpx: i386: interrupt priority support","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"a8928d6db7320caa8f26526718c6a0a6a64b31e1","submitter":{"id":2701,"url":"http://patchwork.ozlabs.org/api/people/2701/?format=json","name":"Paolo Bonzini","email":"pbonzini@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20260430172204.1006673-36-pbonzini@redhat.com/mbox/","series":[{"id":502347,"url":"http://patchwork.ozlabs.org/api/series/502347/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=502347","date":"2026-04-30T17:21:16","name":"[PULL,01/58] pythondeps: bump to meson 1.11.1","version":1,"mbox":"http://patchwork.ozlabs.org/series/502347/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2231451/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2231451/checks/","tags":{},"related":[],"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=euMzv7dY;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=google header.b=VmwSLV68;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g61Pv2XNCz1yHZ\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 01 May 2026 03:29:39 +1000 (AEST)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wIV7l-0007cr-Bt; Thu, 30 Apr 2026 13:24:29 -0400","from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <pbonzini@redhat.com>)\n id 1wIV7K-0005nJ-CH\n for qemu-devel@nongnu.org; Thu, 30 Apr 2026 13:24:08 -0400","from us-smtp-delivery-124.mimecast.com ([170.10.129.124])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <pbonzini@redhat.com>)\n id 1wIV7I-0004m1-MR\n for qemu-devel@nongnu.org; Thu, 30 Apr 2026 13:24:02 -0400","from mail-qk1-f200.google.com (mail-qk1-f200.google.com\n [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-35-_L6FT3GpORu67p3GxH1xPQ-1; Thu, 30 Apr 2026 13:23:58 -0400","by mail-qk1-f200.google.com with SMTP id\n af79cd13be357-8d60fca52b9so206909185a.0\n for <qemu-devel@nongnu.org>; Thu, 30 Apr 2026 10:23:58 -0700 (PDT)","from [192.168.10.48] ([151.49.85.67])\n by smtp.gmail.com with ESMTPSA id\n af79cd13be357-8fbb15ca74bsm24236585a.20.2026.04.30.10.23.54\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 30 Apr 2026 10:23:55 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1777569840;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=zn8RRQ341S74sORTOTdO4e8NZ5+pj0NRoVRqFUU0850=;\n b=euMzv7dYjbyORWbrTrMNJZ8ywYw53NmoiL+hp7jR+fGVTJ8shQtP+/DKMKezJcy5oAKnAE\n NE2btNZYYT7vKu/8n6z2z0ZXTUTHAoogPDfQxKnJdzUuHowd48QH52byby/jv1OAt+i31r\n U2nXLeneid0P3cI2S6LZkQEgUFYnoK0=","v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=redhat.com; s=google; t=1777569837; x=1778174637; darn=nongnu.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=zn8RRQ341S74sORTOTdO4e8NZ5+pj0NRoVRqFUU0850=;\n b=VmwSLV68jTV2GWoaZef2AqGZ1T1Cp5TiyxySnrcf6N3R+P87mM2i5eSis0aLs6D9VL\n ujNJAQqN3MYNyuk988ZAMss6KbebI8O8LZg7ANaV2gj4nU1/FA+dv4/hQBCkls5Pp+kW\n ouQxptsbOx7V8HzmaaOmOhJYkdmiXf1TdO78EqFPPuACz0+o8Ykb+sfmZRDKV5x+0Gx3\n T8RfEc8/O0/65vC8wS/FBEl4PcNsNnmax8P1EKKuDaNZ8txT2rV0QrAbu8PuJzjX7Rum\n mEfl7xaRtbKXaurkLglGIWyj8THZvzaFRWTR/3Gsu9Ngng/uy9RHOrQU2DmfojKtrgae\n HKEw=="],"X-MC-Unique":"_L6FT3GpORu67p3GxH1xPQ-1","X-Mimecast-MFC-AGG-ID":"_L6FT3GpORu67p3GxH1xPQ_1777569838","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777569837; x=1778174637;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=zn8RRQ341S74sORTOTdO4e8NZ5+pj0NRoVRqFUU0850=;\n b=gH6rI/kEokaIv6IuJ5/YLWP+zn50n0mzUJGH8e591TRbz4qTxL7Z7e5QSZ1wRsPWH7\n RaKNaIVfNXKGVCbzA0hnALJacCKIwr4bQnvAMbF0I61sxmXvqNKy/jbChf35qvBo4Fkh\n qgojSaWwvT/lgaH78VY8f0eW45xjSKlQ2qyM7jfjVbLLskqCCWqdNbFdjVlDRaPcnuK4\n McDVH96rdjlMBxuwxVe4lrQY1HMvw2EeTZ24j2CZ3pbavIZUY48rn/0qqwWiNJjz8Rrw\n jD+AalLiTK+ZsW1DpqYAPPfHzXga4rZABi8lg6w28dXx1Bj2h5b4KAowTsFBNF81/DIy\n bjGw==","X-Gm-Message-State":"AOJu0Yw74hE0kEwKeJA9Gi7XdoRWBu3WcQ7fJeOsKoHQCSlUSNQs138a\n 8Uaf1RyXqQNX53DgoOG5mFnqq7F2byR0268mDwI2MV4NoPwmymZfws0VX1fpwu+ezCHnMys9meI\n uvB1yCyE5GRw5YEQ+7uHr54yUV0ZIOws44QrZDn4fXsYFp+sPV48IYouk1NNyoCjloY8Yt4vVGI\n GSGiKb9lbS0nUSB2CnpmqFCnjlhHM2QoNjlDM2CPtr","X-Gm-Gg":"AeBDietv5WbCgpHoI3iWNmj2ZA40VNXkIRxA2lvU0fCb1heeyXncKV3FxLKEKn0Yh7Y\n ZyRSAA7gt3lgj5QQMqMPWiHi87JcX67JdS/LzJxLLl+Tb6YOcfodBfroq/jFFkOUy6i9xMGYTi9\n JGJvUyZ2dpLLZwmn5k1kRNdL/FG1s0Un6Oxw7jWhu+3r7Ec0WiWIRiro2OZs0Tucx1i4LNVWkON\n EiEnPztkLrXM3scOhhcW5gMY8n2hQ5Aryuv+2c0pLGST5xpTqA1coXTKyG12gJPZIBN9wUXEnpW\n XrBeoIUConWSBcC+Ekuy4a/KkkFT2pc9nFAO2BtKhGH9mcjVg/BFgXljq9LYrSshJnvxr0BI4mJ\n FR0PPT9EaQ5zWj50D8cMlgMxSmdiqiLYwFda1bPcDg69rUQY2X62Q/mfgWoXgANY9TvHpKDZhZF\n EMe3szA/zt681CiBCQMNjAl4E6jBv0Bxnq+VA=","X-Received":["by 2002:a05:620a:4627:b0:8d0:191:69b5 with SMTP id\n af79cd13be357-8fab2140c16mr480772585a.54.1777569837500;\n Thu, 30 Apr 2026 10:23:57 -0700 (PDT)","by 2002:a05:620a:4627:b0:8d0:191:69b5 with SMTP id\n af79cd13be357-8fab2140c16mr480763285a.54.1777569836657;\n Thu, 30 Apr 2026 10:23:56 -0700 (PDT)"],"From":"Paolo Bonzini <pbonzini@redhat.com>","To":"qemu-devel@nongnu.org","Cc":"Mohamed Mediouni <mohamed@unpredictable.fr>","Subject":"[PULL 35/58] whpx: i386: interrupt priority support","Date":"Thu, 30 Apr 2026 19:21:41 +0200","Message-ID":"<20260430172204.1006673-36-pbonzini@redhat.com>","X-Mailer":"git-send-email 2.54.0","In-Reply-To":"<20260430172204.1006673-1-pbonzini@redhat.com>","References":"<20260430172204.1006673-1-pbonzini@redhat.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Received-SPF":"pass client-ip=170.10.129.124;\n envelope-from=pbonzini@redhat.com;\n helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001,\n DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001,\n 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 <qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-devel>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"},"content":"From: Mohamed Mediouni <mohamed@unpredictable.fr>\n\nImplement APIC IRR interrupt priorities.\n\nEven with kernel-irqchip=off, Hyper-V is aware of interrupt priorities\nand implements CR8/TPR, with the InterruptPriority field being followed.\n\nSigned-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>\nLink: https://lore.kernel.org/r/20260422214225.2242-14-mohamed@unpredictable.fr\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>\n---\n target/i386/whpx/whpx-all.c | 24 ++++++++++++++++++++----\n 1 file changed, 20 insertions(+), 4 deletions(-)","diff":"diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c\nindex cbcf1de7ae4..012fa6d0216 100644\n--- a/target/i386/whpx/whpx-all.c\n+++ b/target/i386/whpx/whpx-all.c\n@@ -1673,6 +1673,7 @@ static void whpx_vcpu_pre_run(CPUState *cpu)\n     UINT32 reg_count = 0;\n     WHV_REGISTER_VALUE reg_values[3];\n     WHV_REGISTER_NAME reg_names[3];\n+    int irr = apic_get_highest_priority_irr(x86_cpu->apic_state);\n \n     memset(&new_int, 0, sizeof(new_int));\n     memset(reg_values, 0, sizeof(reg_values));\n@@ -1708,10 +1709,20 @@ static void whpx_vcpu_pre_run(CPUState *cpu)\n         }\n     }\n \n+    if (irr == -1) {\n+        if (isa_pic != NULL && pic_get_output(isa_pic)) {\n+            /* In case it's a PIC interrupt */\n+            irr = 0;\n+        } else if (cpu_test_interrupt(cpu, CPU_INTERRUPT_HARD)) {\n+            abort();\n+        }\n+    }\n+\n     /* Get pending hard interruption or replay one that was overwritten */\n     if (!whpx_irqchip_in_kernel()) {\n         if (!vcpu->interruption_pending &&\n-            vcpu->interruptable && (env->eflags & IF_MASK)) {\n+            vcpu->interruptable && (env->eflags & IF_MASK)\n+            && (vcpu->tpr < irr || irr == 0)) {\n             assert(!new_int.InterruptionPending);\n             if (cpu_test_interrupt(cpu, CPU_INTERRUPT_HARD)) {\n                 cpu_reset_interrupt(cpu, CPU_INTERRUPT_HARD);\n@@ -1768,13 +1779,17 @@ static void whpx_vcpu_pre_run(CPUState *cpu)\n     }\n \n     /* Update the state of the interrupt delivery notification */\n-    if (!vcpu->window_registered &&\n+    if ((!vcpu->window_registered ||\n+        (vcpu->window_priority < irr && vcpu->window_priority != 0) ||\n+        (irr == 0 && vcpu->window_priority != 0)) &&\n         cpu_test_interrupt(cpu, CPU_INTERRUPT_HARD)) {\n         reg_values[reg_count].DeliverabilityNotifications =\n             (WHV_X64_DELIVERABILITY_NOTIFICATIONS_REGISTER) {\n-                .InterruptNotification = 1\n+                .InterruptNotification = 1,\n+                .InterruptPriority = irr >> 4\n             };\n         vcpu->window_registered = 1;\n+        vcpu->window_priority = irr;\n         reg_names[reg_count] = WHvX64RegisterDeliverabilityNotifications;\n         reg_count += 1;\n     }\n@@ -1788,7 +1803,7 @@ static void whpx_vcpu_pre_run(CPUState *cpu)\n             reg_names, reg_count, reg_values);\n         if (FAILED(hr)) {\n             error_report(\"WHPX: Failed to set interrupt state registers,\"\n-                         \" hr=%08lx\", hr);\n+                         \" hr=%08lx, InterruptPriority=%i\", hr, irr >> 4);\n         }\n     }\n }\n@@ -2004,6 +2019,7 @@ int whpx_vcpu_run(CPUState *cpu)\n         case WHvRunVpExitReasonX64InterruptWindow:\n             vcpu->ready_for_pic_interrupt = 1;\n             vcpu->window_registered = 0;\n+            vcpu->window_priority = 0;\n             ret = 0;\n             break;\n \n","prefixes":["PULL","35/58"]}