qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Ken CC <ken.ccao@gmail.com>
Cc: yamahata@valinux.co.jp, avi@redhat.com, kvm@vger.kernel.org,
	qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH 1/4] PCI: define PCIBUS_MAX_DEVICES and PCI_FUNCTIONS_PER_DEVICE in pci.h
Date: Tue, 7 Sep 2010 20:16:33 +0300	[thread overview]
Message-ID: <20100907171632.GB18374@redhat.com> (raw)
In-Reply-To: <20100824132525.GA19469@kt>

On Tue, Aug 24, 2010 at 09:25:26PM +0800, Ken CC wrote:
> And update the max function number used in struct PCIBus{} to
> PCIBUS_MAX_FUNCTIONS = PCI_FUNCTIONS_PER_DEVICE * PCIBUS_MAX_DEVICES
> 
> TODO:
>     according to Avi Kivity, PCIBus.devices[] should be renamed to functions[]
> 
> Signed-off-by: Ken CC <ken.ccao@gmail.com>
> ---
>  hw/pci.c |    2 +-
>  hw/pci.h |    2 ++
>  2 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/hw/pci.c b/hw/pci.c
> index 70dbace..9234fe3 100644
> --- a/hw/pci.c
> +++ b/hw/pci.c
> @@ -47,7 +47,7 @@ struct PCIBus {
>      pci_hotplug_fn hotplug;
>      DeviceState *hotplug_qdev;
>      void *irq_opaque;
> -    PCIDevice *devices[256];
> +    PCIDevice *devices[PCIBUS_MAX_DEVICES * PCI_FUNCTIONS_PER_DEVICE];
>      PCIDevice *parent_dev;
>      target_phys_addr_t mem_base;
>  
> diff --git a/hw/pci.h b/hw/pci.h
> index ccb99d0..eb97b76 100644
> --- a/hw/pci.h
> +++ b/hw/pci.h
> @@ -17,6 +17,8 @@ struct kvm_irq_routing_entry;
>  #define PCI_SLOT(devfn)         (((devfn) >> 3) & 0x1f)
>  #define PCI_FUNC(devfn)         ((devfn) & 0x07)
>  #define PCI_FUNC_MAX            8
> +#define PCI_FUNCTIONS_PER_DEVICE 8
> +#define PCIBUS_MAX_DEVICES 32

PCI_FUNCTIONS_PER_DEVICE is same as PCI_FUNC_MAX. Why do we need another
macro?

>  /* Class, Vendor and Device IDs from Linux's pci_ids.h */
>  #include "pci_ids.h"

      parent reply	other threads:[~2010-09-07 17:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-24 13:25 [Qemu-devel] [PATCH 1/4] PCI: define PCIBUS_MAX_DEVICES and PCI_FUNCTIONS_PER_DEVICE in pci.h Ken CC
2010-08-24 13:27 ` [Qemu-devel] [PATCH 2/4] pci init: fail qemu if devfn exceeding the max function number supported on bus Ken CC
2010-09-07 17:19   ` [Qemu-devel] " Michael S. Tsirkin
2010-08-24 13:27 ` [Qemu-devel] [PATCH 3/4] Check pci slot number against PCIBUS_MAX_DEVICES in parse_pci_devfn Ken CC
2010-09-07 17:20   ` [Qemu-devel] " Michael S. Tsirkin
2010-08-24 13:28 ` [Qemu-devel] [PATCH 4/4] Rename PCI_FUNC_MAX to PCI_FUNCTIONS_PER_DEVICES in pci.[ch] Ken CC
2010-09-07 17:22   ` [Qemu-devel] " Michael S. Tsirkin
2010-09-07 17:16 ` Michael S. Tsirkin [this message]

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=20100907171632.GB18374@redhat.com \
    --to=mst@redhat.com \
    --cc=avi@redhat.com \
    --cc=ken.ccao@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=qemu-devel@nongnu.org \
    --cc=yamahata@valinux.co.jp \
    /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).