From nobody Sat Feb 7 01:38:13 2026 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576673051; cv=none; d=zohomail.com; s=zohoarc; b=Rw6pf/dKoqyknNgeU2Xo6MPyUgNY7niK5uqgUmBYEtQA1vXApIsMnb+qyPQ6meknAApYZilPjQHV0Oklmup388oPq48WNjoH4miuZKs8Wn5bj0ugzMbKO5IXTjGKfvFdmlWtuvVyKsLwP80AGeIuhenxtK8VKnmYcpLnnHRkEtU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576673051; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=WOlXgr5dZa9g4c2a4JN2toyyzN/vi7Wxgjlick+Xxu0=; b=Rce8aJtBhKhrBYptPbKYFXczMkoQTuRBLcam8ly8QxZuR9uO0p6evdplZuG62Xrov1xUjWSWU1xcS4BTW1uy9jenQqwTJbLO44YnrmE6r7ss14Or/XW/l8OF9ErrxxZSM7uAx5kUreUVxdZ1s8yApUC0Fk/Zgg/kvnd0G6DWKvc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576673051379599.9127011130794; Wed, 18 Dec 2019 04:44:11 -0800 (PST) Received: from localhost ([::1]:53656 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYgT-0004wk-OO for importer@patchew.org; Wed, 18 Dec 2019 07:44:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53345) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3c-0006y8-9v for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3a-0002Lc-VJ for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:00 -0500 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:43642) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3a-0002HG-JR for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:58 -0500 Received: by mail-wr1-x42e.google.com with SMTP id d16so1985298wre.10 for ; Wed, 18 Dec 2019 04:03:58 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WOlXgr5dZa9g4c2a4JN2toyyzN/vi7Wxgjlick+Xxu0=; b=DXgcoH4l/3iV6ULg2ZN9xXRCxKgJI5KNZKomQXqwcZ5abiD9twAZm8gQtET2AioCg6 e72bXRE9yUvoQpPZ90McmauI7bMiZiKtHtVoZiB6WPRQfOcPJ5fDC/yllzE/scPUwoQk 4IKKE58NAM1PKHH9Ah+j6ARdPy8tEm8VLQQm87ePMkqpw9CKQgKdZ1V6655L4vsO90A9 qNjNV166ZE1AbuXS+i2azlJe7Yx+olB8PsO0hSb5EF8L1mX9GVl0LfML9ZgEpjpzYSHd DzjXB/88nQoouM/5G6PgHvzsykfPp0zGIIYxceAfT8zE+Re7wu8ieaoN/5YUwslBKmLB pxlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=WOlXgr5dZa9g4c2a4JN2toyyzN/vi7Wxgjlick+Xxu0=; b=P2GBCDEc2RrKEX+b46l0L0CGkuV4vHc/z2Z7IxVIyzifH44jVC+fgYSZcplGyS18xg IV6CiUi0fC5LKnOXOK2N6DDywsLq59vxnRmLntwhmgcflXVh6bhSbC2/QnAv5Be8rplt PgbEUHJo1Ix9u4PQ85o+tihHLsqZiDsSAAuHqI8rgIKCwif9L2JDaUAUgnwazyt53Jxz wzIF7G9AYZ65TYxAE/83PFpafOAfFQ4/fJw6Wd2vVVDk4ojukkdebVfaivHIsRfJkyc+ hI+Z4b2SPN2lpjCbVchFBtiJjVPaNu/z/2GKXsrglSoqKmdBwHI7XTkYyyaEWlTauTyZ BdPA== X-Gm-Message-State: APjAAAVUhB6k3bkQQ07ZzNcdhqx+Q+W2OEeiUPil0EJRUDMVoAS1QD1Z Eogwh18VW9Dzk2kkX8gpEWmqo63O X-Google-Smtp-Source: APXvYqzUknMQshY2w4SQ6DOB8HB53WnZnAnVge94gTia/SrQJhy7k9U1hwonEKAftJDTZzt0ITE2zQ== X-Received: by 2002:a5d:5403:: with SMTP id g3mr2492287wrv.302.1576670637404; Wed, 18 Dec 2019 04:03:57 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 53/87] hw/i386: De-duplicate gsi_handler() to remove kvm_pc_gsi_handler() Date: Wed, 18 Dec 2019 13:02:19 +0100 Message-Id: <1576670573-48048-54-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42e X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Philippe Mathieu-Daud=C3=A9 Both gsi_handler() and kvm_pc_gsi_handler() have the same content, except one comment. Move the comment, and de-duplicate the code. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Paolo Bonzini --- hw/i386/kvm/ioapic.c | 12 ------------ hw/i386/pc.c | 4 +--- hw/i386/x86.c | 1 + include/sysemu/kvm.h | 1 - 4 files changed, 2 insertions(+), 16 deletions(-) diff --git a/hw/i386/kvm/ioapic.c b/hw/i386/kvm/ioapic.c index 8703f19..973e2b2 100644 --- a/hw/i386/kvm/ioapic.c +++ b/hw/i386/kvm/ioapic.c @@ -48,18 +48,6 @@ void kvm_pc_setup_irq_routing(bool pci_enabled) } } =20 -void kvm_pc_gsi_handler(void *opaque, int n, int level) -{ - GSIState *s =3D opaque; - - if (n < ISA_NUM_IRQS) { - /* Kernel will forward to both PIC and IOAPIC */ - qemu_set_irq(s->i8259_irq[n], level); - } else { - qemu_set_irq(s->ioapic_irq[n], level); - } -} - typedef struct KVMIOAPICState KVMIOAPICState; =20 struct KVMIOAPICState { diff --git a/hw/i386/pc.c b/hw/i386/pc.c index dff09e4..ea7320b 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -344,10 +344,8 @@ GSIState *pc_gsi_create(qemu_irq **irqs, bool pci_enab= led) s =3D g_new0(GSIState, 1); if (kvm_ioapic_in_kernel()) { kvm_pc_setup_irq_routing(pci_enabled); - *irqs =3D qemu_allocate_irqs(kvm_pc_gsi_handler, s, GSI_NUM_PINS); - } else { - *irqs =3D qemu_allocate_irqs(gsi_handler, s, GSI_NUM_PINS); } + *irqs =3D qemu_allocate_irqs(gsi_handler, s, GSI_NUM_PINS); =20 return s; } diff --git a/hw/i386/x86.c b/hw/i386/x86.c index 80e33be..d18a3ef 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -295,6 +295,7 @@ void gsi_handler(void *opaque, int n, int level) =20 trace_x86_gsi_interrupt(n, level); if (n < ISA_NUM_IRQS) { + /* Under KVM, Kernel will forward to both PIC and IOAPIC */ qemu_set_irq(s->i8259_irq[n], level); } qemu_set_irq(s->ioapic_irq[n], level); diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index aaf2a50..141342d 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -515,7 +515,6 @@ int kvm_irqchip_add_irqfd_notifier(KVMState *s, EventNo= tifier *n, int kvm_irqchip_remove_irqfd_notifier(KVMState *s, EventNotifier *n, qemu_irq irq); void kvm_irqchip_set_qemuirq_gsi(KVMState *s, qemu_irq irq, int gsi); -void kvm_pc_gsi_handler(void *opaque, int n, int level); void kvm_pc_setup_irq_routing(bool pci_enabled); void kvm_init_irq_routing(KVMState *s); =20 --=20 1.8.3.1