From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCHv2] qemu-kvm: enable msi with irqchip Date: Sun, 05 Jul 2009 18:13:02 +0300 Message-ID: <4A50C2FE.6060501@redhat.com> References: <20090705130425.GA5451@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: "Michael S. Tsirkin" Return-path: Received: from mx2.redhat.com ([66.187.237.31]:53010 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752574AbZGEPKr (ORCPT ); Sun, 5 Jul 2009 11:10:47 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n65FAp07022037 for ; Sun, 5 Jul 2009 11:10:51 -0400 In-Reply-To: <20090705130425.GA5451@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 07/05/2009 04:04 PM, Michael S. Tsirkin wrote: > Support msi-x with irqchip in kernel: allocate entries > when they are used, and update when they are unmasked. > > > /* Declaration from linux/pci_regs.h */ > #define PCI_CAP_ID_MSIX 0x11 /* MSI-X */ > @@ -109,6 +110,18 @@ static int msix_add_config(struct PCIDevice *pdev, unsigned short nentries, > static void msix_free_irq_entries(PCIDevice *dev) > { > int vector; > + if (kvm_enabled()&& qemu_kvm_irqchip_in_kernel()) { > + int changed = 0; > + for (vector = 0; vector< dev->msix_entries_nr; ++vector) { > + if (dev->msix_entry_used[vector]) { > + kvm_del_routing_entry(kvm_context,&dev->msix_irq_entries[vector]); > + changed = 1; > + } > + } > + if (changed) { > + kvm_commit_irq_routes(kvm_context); > + } > + } > Please move this into a helper. Ditto all the code hunks in msix functions. -- error compiling committee.c: too many arguments to function