Received: from [140.186.70.92] (port=44431 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q1eBe-00078h-D0 for qemu-devel@nongnu.org; Mon, 21 Mar 2011 08:26:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q1eBb-0007bZ-U8 for qemu-devel@nongnu.org; Mon, 21 Mar 2011 08:26:17 -0400 Received: from mail.valinux.co.jp ([210.128.90.3]:36604) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q1eBb-0007b7-Fk for qemu-devel@nongnu.org; Mon, 21 Mar 2011 08:26:15 -0400 Date: Mon, 21 Mar 2011 21:26:12 +0900 From: Isaku Yamahata Message-ID: <20110321122612.GB9998@valinux.co.jp> References: <533593a679f7c243ddce87c9c3a7c31c6f67acd7.1300540833.git.yamahata@valinux.co.jp> <20110321113707.GC27445@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110321113707.GC27445@redhat.com> Subject: [Qemu-devel] Re: [PATCH v3 3/3] piix_pci: optimize set irq path List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: qemu-devel@nongnu.org On Mon, Mar 21, 2011 at 01:37:07PM +0200, Michael S. Tsirkin wrote: > > +/* irq routing is changed. so rebuild bitmap */ > > +static void piix3_update_irq_levels(PIIX3State *piix3) > > +{ > > + int pirq; > > + > > + piix3->pic_levels = 0; > > + for (pirq = 0; pirq < PIIX_NUM_PIRQS; pirq++) { > > + piix3_set_irq_level(piix3, pirq, > > + pci_bus_get_irq_level(piix3->dev.bus, pirq), > > + false); > > + } > > +} > > + > > +static void piix3_write_config(PCIDevice *dev, > > + uint32_t address, uint32_t val, int len) > > +{ > > + pci_default_write_config(dev, address, val, len); > > + if (ranges_overlap(address, len, PIIX_PIRQC, 4)) { > > + PIIX3State *piix3 = DO_UPCAST(PIIX3State, dev, dev); > > + int pic_irq; > > + piix3_update_irq_levels(piix3); > > + for (pic_irq = 0; pic_irq < PIIX_NUM_PIC_IRQS; pic_irq++) { > > + piix3_set_irq_pic(piix3, pic_irq); > > } > > We wouldn't need this loop if piix3_update_irq_levels > called piix3_set_irq_level with propagate enabled. No. piix3_update_irq_levels loops over PIRQs(= 4). But we need to loop over all pic PINs(= 16) to raise/lower irqs. -- yamahata