From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: [PATCH 3/9] msix: move kvm specific msix notify into a function Date: Mon, 20 Sep 2010 17:06:44 +0200 Message-ID: <1284995210-32432-4-git-send-email-avi@redhat.com> References: <1284995210-32432-1-git-send-email-avi@redhat.com> To: Marcelo Tosatti , kvm@vger.kernel.org, "Michael S. Tsirkin" Return-path: Received: from mx1.redhat.com ([209.132.183.28]:65232 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752891Ab0ITPGw (ORCPT ); Mon, 20 Sep 2010 11:06:52 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o8KF6qnn028760 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 20 Sep 2010 11:06:52 -0400 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o8KF6p6I025678 for ; Mon, 20 Sep 2010 11:06:51 -0400 In-Reply-To: <1284995210-32432-1-git-send-email-avi@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Signed-off-by: Avi Kivity --- hw/msix.c | 19 +++++++++++++++---- 1 files changed, 15 insertions(+), 4 deletions(-) diff --git a/hw/msix.c b/hw/msix.c index 2e2ce5a..d762870 100644 --- a/hw/msix.c +++ b/hw/msix.c @@ -159,6 +159,18 @@ static void kvm_msix_del(PCIDevice *dev, unsigned vector) kvm_del_routing_entry(kvm_context, &dev->msix_irq_entries[vector]); kvm_commit_irq_routes(kvm_context); } + +static bool kvm_msix_notify(PCIDevice *dev, unsigned vector) +{ +#ifdef KVM_CAP_IRQCHIP + if (kvm_enabled() && kvm_irqchip_in_kernel()) { + kvm_set_irq(dev->msix_irq_entries[vector].gsi, 1, NULL); + return true; + } +#endif + return false; +} + #else static void kvm_msix_init(PCIDevice *dev) {} @@ -167,6 +179,8 @@ static void kvm_msix_update(PCIDevice *dev, int vector, int was_masked, int is_masked) {} static int kvm_msix_add(PCIDevice *dev, unsigned vector) { return -1; } static void kvm_msix_del(PCIDevice *dev, unsigned vector) {} +static bool kvm_msix_notify(PCIDevice *dev, unsigned vector) { return false; } + #endif /* Add MSI-X capability to the config space for the device. */ @@ -525,12 +539,9 @@ void msix_notify(PCIDevice *dev, unsigned vector) return; } -#ifdef KVM_CAP_IRQCHIP - if (kvm_enabled() && kvm_irqchip_in_kernel()) { - kvm_set_irq(dev->msix_irq_entries[vector].gsi, 1, NULL); + if (kvm_msix_notify(dev, vector)) { return; } -#endif address = pci_get_long(table_entry + MSIX_MSG_UPPER_ADDR); address = (address << 32) | pci_get_long(table_entry + MSIX_MSG_ADDR); -- 1.7.2.3