From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:60548) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SaRLo-00040y-JX for qemu-devel@nongnu.org; Fri, 01 Jun 2012 08:53:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SaRLi-0000xo-8s for qemu-devel@nongnu.org; Fri, 01 Jun 2012 08:53:08 -0400 Received: from thoth.sbs.de ([192.35.17.2]:17155) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SaRLh-0000xG-VD for qemu-devel@nongnu.org; Fri, 01 Jun 2012 08:53:02 -0400 Message-ID: <4FC8BB28.8000004@siemens.com> Date: Fri, 01 Jun 2012 14:52:56 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <4FC65910.4030908@siemens.com> <20120530174125.GC32721@redhat.com> <4FC65E19.6090203@siemens.com> <4FC65F70.4040501@siemens.com> <20120530182356.GD32721@redhat.com> <20120530182913.GE32721@redhat.com> <20120530185150.GA1546@redhat.com> <4FC66FB1.9050306@siemens.com> <20120530193034.GE1551@redhat.com> <4FC681B4.3030807@web.de> <20120530203119.GH1551@redhat.com> In-Reply-To: <20120530203119.GH1551@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/2] pci: Add pci_device_get_host_irq List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: Alex Williamson , Marcelo Tosatti , qemu-devel , Avi Kivity On 2012-05-30 22:31, Michael S. Tsirkin wrote: >>> So we'll just have PIIX_NUM_PIC_IRQS entries there and use >>> irq_count instead of the pic_levels bitmap. >> >> Just that this affects generic PCI code, not only PIIX-specific things. > > Yes but it's not a problem - pci_bus_irqs sets the map function and nirqs. > >> And that we need to save/restore some irq_count field according to the >> old semantics. > > Well, it's a bug: this is redundant info we should not have exposed it. > > Anyway, let's make the rest work properly and cleanly first, add a FIXME > for now, then we'll find a hack making it work for migration. It remains non-trivial: I got your patch working (a minor init issue), but yet without changing the number of IRQs for PIIX3, so keeping the irq_count semantics for this host bridge. Now I'm facing three possibilities of how to proceed: 1. Give up on the (currently broken) feature to write a vmstate for older QEMU versions. This will allow to declare the irq_count field in vmstate_pcibus unused, and we would have to restore it on vmload step-wise via the PCI devices. It would also allow to change its semantics for PIIX3, mapping directly to PIC IRQs. 2. Keep writing a legacy irq_count field. This will require quite a few new APIs so that host bridges that want to change their nirq can still generate a compatible irq_count vmstate field. Namely: - A function to set up vmstate_irq_count and define a callback that the core will invoke to prepare the vmstate_irq_count before vmsave. - A function to obtain the IRQ mapping /without/ the final host bridge step. This is required so that the callback above can calculate the old state like in the PIIX3 case. 3. Keep irq_count and nirq as is, introduce additional map_host_irq. This is simpler than 2 and more compatible than 1. It would also allow to introduce the polarity and masking information more smoothly as we won't have to add it to existing map_irq callbacks then. Any other suggestions? Jan -- Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux