From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56136) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XfB1P-0004Mm-TA for qemu-devel@nongnu.org; Fri, 17 Oct 2014 13:09:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XfB1H-0003Gw-5G for qemu-devel@nongnu.org; Fri, 17 Oct 2014 13:08:59 -0400 Received: from mail-la0-f53.google.com ([209.85.215.53]:55509) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XfB1G-0003Gj-U5 for qemu-devel@nongnu.org; Fri, 17 Oct 2014 13:08:51 -0400 Received: by mail-la0-f53.google.com with SMTP id gq15so1045724lab.26 for ; Fri, 17 Oct 2014 10:08:49 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1403869944-31927-32-git-send-email-agraf@suse.de> References: <1403869944-31927-1-git-send-email-agraf@suse.de> <1403869944-31927-32-git-send-email-agraf@suse.de> From: Peter Maydell Date: Fri, 17 Oct 2014 19:08:29 +0200 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] [PULL 31/32] spapr_pci: Use XICS interrupt allocator and do not cache interrupts in PHB List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: Alexey Kardashevskiy , "qemu-ppc@nongnu.org" , QEMU Developers On 27 June 2014 13:52, Alexander Graf wrote: > From: Alexey Kardashevskiy > > Currently SPAPR PHB keeps track of all allocated MSI (here and below > MSI stands for both MSI and MSIX) interrupt because > XICS used to be unable to reuse interrupts. This is a problem for > dynamic MSI reconfiguration which happens when guest reloads a driver > or performs PCI hotplug. Another problem is that the existing > implementation can enable MSI on 32 devices maximum > (SPAPR_MSIX_MAX_DEVS=32) and there is no good reason for that. > > This makes use of new XICS ability to reuse interrupts. > > This reorganizes MSI information storage in sPAPRPHBState. Instead of > static array of 32 descriptors (one per a PCI function), this patch adds > a GHashTable when @config_addr is a key and (first_irq, num) pair is > a value. GHashTable can dynamically grow and shrink so the initial limit > of 32 devices is gone. > +static void spapr_pci_pre_save(void *opaque) > +{ > + sPAPRPHBState *sphb = opaque; > + GHashTableIter iter; > + gpointer key, value; > + int i; > + > + if (sphb->msi_devs) { > + g_free(sphb->msi_devs); > + sphb->msi_devs = NULL; > + } > + sphb->msi_devs_num = g_hash_table_size(sphb->msi); > + if (!sphb->msi_devs_num) { > + return; > + } > + sphb->msi_devs = g_malloc(sphb->msi_devs_num * sizeof(spapr_pci_msi_mig)); > + > + g_hash_table_iter_init(&iter, sphb->msi); > + for (i = 0; g_hash_table_iter_next(&iter, &key, &value); ++i) { > + sphb->msi_devs[i].key = *(uint32_t *) key; > + sphb->msi_devs[i].value = *(spapr_pci_msi *) value; > + } > +} Hi. I'm afraid this doesn't build under glib 2.12: /home/petmay01/linaro/qemu-for-merges/hw/ppc/spapr_pci.c: In function 'spapr_pci_pre_save': /home/petmay01/linaro/qemu-for-merges/hw/ppc/spapr_pci.c:710: error: 'GHashTableIter' undeclared (first use in this function) /home/petmay01/linaro/qemu-for-merges/hw/ppc/spapr_pci.c:710: error: (Each undeclared identifier is reported only once /home/petmay01/linaro/qemu-for-merges/hw/ppc/spapr_pci.c:710: error: for each function it appears in.) /home/petmay01/linaro/qemu-for-merges/hw/ppc/spapr_pci.c:710: error: expected ';' before 'iter' /home/petmay01/linaro/qemu-for-merges/hw/ppc/spapr_pci.c:724: warning: implicit declaration of function 'g_hash_table_iter_init' /home/petmay01/linaro/qemu-for-merges/hw/ppc/spapr_pci.c:724: warning: nested extern declaration of 'g_hash_table_iter_init' /home/petmay01/linaro/qemu-for-merges/hw/ppc/spapr_pci.c:724: error: 'iter' undeclared (first use in this function) /home/petmay01/linaro/qemu-for-merges/hw/ppc/spapr_pci.c:725: warning: implicit declaration of function 'g_hash_table_iter_next' /home/petmay01/linaro/qemu-for-merges/hw/ppc/spapr_pci.c:725: warning: nested extern declaration of 'g_hash_table_iter_next' g_hash_table_iter_init was only added in glib 2.16; the old style way to do this is using g_hash_table_foreach() (and a helper function). thanks -- PMM