From: "Michael S. Tsirkin" <mst@redhat.com>
To: Isaku Yamahata <yamahata@valinux.co.jp>
Cc: blauwirbel@gmail.com, yu.liu@freescale.com,
qemu-devel@nongnu.org, aurelien@aurel32.net,
paul@codesourcery.com
Subject: [Qemu-devel] Re: [PATCH v5 2/9] pci: insert assert that auto-assigned-address function is single function device.
Date: Wed, 23 Jun 2010 13:11:00 +0300 [thread overview]
Message-ID: <20100623101100.GB9835@redhat.com> (raw)
In-Reply-To: <504880ade711145a5094f754994e7d5344f437ad.1277277076.git.yamahata@valinux.co.jp>
On Wed, Jun 23, 2010 at 04:15:26PM +0900, Isaku Yamahata wrote:
> Auto-assigned-address pci function (passing devfn = -1) is always
> single function.
> This patch adds assert() to guarantee that auto-assigned-address function
> is always single function device at function = 0.
>
> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
So this means we must pass PCI_DEVFN(x, 0) to pci_register_bus?
> ---
> changes v2 -> v3
> split out into PCI_DEVFN() patch and assert patch.
> ---
> hw/pci.c | 3 ++-
> hw/pci.h | 1 +
> 2 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/hw/pci.c b/hw/pci.c
> index ef17eb4..1ba209f 100644
> --- a/hw/pci.c
> +++ b/hw/pci.c
> @@ -224,6 +224,7 @@ void pci_bus_new_inplace(PCIBus *bus, DeviceState *parent,
> const char *name, int devfn_min)
> {
> qbus_create_inplace(&bus->qbus, &pci_bus_info, parent, name);
> + assert(PCI_FUNC(devfn_min) == 0);
> bus->devfn_min = devfn_min;
> QLIST_INIT(&bus->child);
> vmstate_register(-1, &vmstate_pcibus, bus);
> @@ -601,7 +602,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
> {
> if (devfn < 0) {
> for(devfn = bus->devfn_min ; devfn < ARRAY_SIZE(bus->devices);
> - devfn += 8) {
> + devfn += PCI_FUNC_MAX) {
> if (!bus->devices[devfn])
> goto found;
> }
> diff --git a/hw/pci.h b/hw/pci.h
> index 6a2bc6a..077387d 100644
> --- a/hw/pci.h
> +++ b/hw/pci.h
> @@ -14,6 +14,7 @@
> #define PCI_DEVFN(slot, func) ((((slot) & 0x1f) << 3) | ((func) & 0x07))
> #define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f)
> #define PCI_FUNC(devfn) ((devfn) & 0x07)
> +#define PCI_FUNC_MAX 8
>
> /* Class, Vendor and Device IDs from Linux's pci_ids.h */
> #include "pci_ids.h"
> --
> 1.6.6.1
next prev parent reply other threads:[~2010-06-23 10:16 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-23 7:15 [Qemu-devel] [PATCH v5 0/9] pci: multi-function bit fixes Isaku Yamahata
2010-06-23 7:15 ` [Qemu-devel] [PATCH v5 1/9] pci: use PCI_DEVFN() where appropriate Isaku Yamahata
2010-06-23 9:59 ` [Qemu-devel] " Michael S. Tsirkin
2010-06-23 7:15 ` [Qemu-devel] [PATCH v5 2/9] pci: insert assert that auto-assigned-address function is single function device Isaku Yamahata
2010-06-23 10:11 ` Michael S. Tsirkin [this message]
2010-06-23 23:42 ` [Qemu-devel] " Isaku Yamahata
2010-06-23 7:15 ` [Qemu-devel] [PATCH v5 3/9] pci: don't overwrite multi functio bit in pci header type Isaku Yamahata
2010-06-23 7:15 ` [Qemu-devel] [PATCH v5 4/9] pci: remove PCIDeviceInfo::header_type Isaku Yamahata
2010-06-23 7:15 ` [Qemu-devel] [PATCH v5 5/9] qdev: implement qdev_prop_set_bit() Isaku Yamahata
2010-06-23 7:15 ` [Qemu-devel] [PATCH v5 6/9] pci: introduce multifunction property Isaku Yamahata
2010-06-23 7:15 ` [Qemu-devel] [PATCH v5 7/9] pci: set multifunction property for normal device Isaku Yamahata
2010-06-23 7:15 ` [Qemu-devel] [PATCH v5 8/9] pci_bridge: make pci bridge aware of pci multi function bit Isaku Yamahata
2010-06-23 7:15 ` [Qemu-devel] [PATCH v5 9/9] pci: set PCI multi-function bit appropriately Isaku Yamahata
2010-07-09 1:44 ` [Qemu-devel] [PATCH v5 0/9] pci: multi-function bit fixes Isaku Yamahata
2010-07-11 19:26 ` Blue Swirl
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=20100623101100.GB9835@redhat.com \
--to=mst@redhat.com \
--cc=aurelien@aurel32.net \
--cc=blauwirbel@gmail.com \
--cc=paul@codesourcery.com \
--cc=qemu-devel@nongnu.org \
--cc=yamahata@valinux.co.jp \
--cc=yu.liu@freescale.com \
/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).