From: Avi Kivity <avi@redhat.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Alex Williamson <alex.williamson@redhat.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
qemu-devel <qemu-devel@nongnu.org>,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 1/2] pci: Add pci_device_get_host_irq
Date: Mon, 21 May 2012 17:36:25 +0300 [thread overview]
Message-ID: <4FBA52E9.3060808@redhat.com> (raw)
In-Reply-To: <4FBA3F8B.9060103@siemens.com>
On 05/21/2012 04:13 PM, Jan Kiszka wrote:
> Add a PCI IRQ path discovery function that walks from a given device to
> the host bridge, returning the IRQ number that is reported to the
> attached interrupt controller. For this purpose, another PCI bridge
> callback function is introduced: map_host_irq. It is so far only
> implemented by the PIIX3, other host bridges can be added later on as
> required.
>
> Will be used for KVM PCI device assignment.
This is similar to the memory API, which converts a memory region
hierarchy to a flat list and fires notifiers whenever it changes.
> +int pci_device_get_host_irq(PCIDevice *pci_dev, int irq_num)
> +{
> + PCIBus *bus;
> +
> + for (;;) {
> + bus = pci_dev->bus;
> + irq_num = bus->map_irq(pci_dev, irq_num);
> + if (bus->map_host_irq) {
> + break;
> + }
> + pci_dev = bus->parent_dev;
> + assert(pci_dev);
> + }
> + return bus->map_host_irq(bus->irq_opaque, irq_num);
> +}
> +
My personal preference is to avoid infinite loops with breaks, I'd write
this as a do/while (without the assert). Or maybe supply all buses with
a default map_host_irq that recurses back into
pci_device_get_host_irq(). But this is not an objection to the patch.
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2012-05-21 14:36 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-21 13:13 [Qemu-devel] [PATCH 1/2] pci: Add pci_device_get_host_irq Jan Kiszka
2012-05-21 13:15 ` [Qemu-devel] [PATCH 2/2] pci: Add INTx routing notifier Jan Kiszka
2012-05-21 14:13 ` Alex Williamson
2012-05-21 14:10 ` [Qemu-devel] [PATCH 1/2] pci: Add pci_device_get_host_irq Alex Williamson
2012-05-21 14:36 ` Avi Kivity [this message]
2012-05-21 14:47 ` Jan Kiszka
2012-05-21 17:34 ` Michael S. Tsirkin
2012-05-21 18:58 ` Jan Kiszka
2012-05-21 21:04 ` Michael S. Tsirkin
2012-05-21 19:05 ` Michael S. Tsirkin
2012-05-21 20:35 ` Jan Kiszka
2012-05-21 21:03 ` Michael S. Tsirkin
[not found] <4FC65910.4030908@siemens.com>
[not found] ` <20120530174125.GC32721@redhat.com>
[not found] ` <4FC65E19.6090203@siemens.com>
[not found] ` <4FC65F70.4040501@siemens.com>
[not found] ` <20120530182356.GD32721@redhat.com>
[not found] ` <20120530182913.GE32721@redhat.com>
[not found] ` <20120530185150.GA1546@redhat.com>
[not found] ` <4FC66FB1.9050306@siemens.com>
[not found] ` <20120530193034.GE1551@redhat.com>
[not found] ` <4FC681B4.3030807@web.de>
[not found] ` <20120530203119.GH1551@redhat.com>
2012-06-01 12:52 ` Jan Kiszka
2012-06-01 13:27 ` Michael S. Tsirkin
2012-06-01 13:57 ` Jan Kiszka
2012-06-01 14:34 ` Michael S. Tsirkin
2012-06-01 15:15 ` Jan Kiszka
2012-06-01 15:28 ` Michael S. Tsirkin
2012-06-01 15:54 ` Jan Kiszka
2012-06-01 16:05 ` Michael S. Tsirkin
2012-06-01 16:17 ` Jan Kiszka
2012-06-01 15:30 ` Michael S. Tsirkin
2012-06-01 15:59 ` Jan Kiszka
2012-06-01 15:26 ` Michael S. Tsirkin
2012-06-01 13:28 ` Michael S. Tsirkin
2012-06-01 13:43 ` Jan Kiszka
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FBA52E9.3060808@redhat.com \
--to=avi@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=jan.kiszka@siemens.com \
--cc=mst@redhat.com \
--cc=mtosatti@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).