qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Re: [PATCH] pci/pcie: make pci_find_device() ARI aware.


From: Michael S. Tsirkin
Subject: [Qemu-devel] Re: [PATCH] pci/pcie: make pci_find_device() ARI aware.
Date: Thu, 20 Jan 2011 16:15:48 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, Jan 20, 2011 at 03:57:39PM +0900, Isaku Yamahata wrote:
> make pci_find_device() ARI aware.
> 
> Signed-off-by: Isaku Yamahata <address@hidden>
> ---
>  hw/pci.c |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/hw/pci.c b/hw/pci.c
> index 8d0e3df..851f350 100644
> --- a/hw/pci.c
> +++ b/hw/pci.c
> @@ -1596,11 +1596,18 @@ PCIBus *pci_find_bus(PCIBus *bus, int bus_num)
>  
>  PCIDevice *pci_find_device(PCIBus *bus, int bus_num, int slot, int function)
>  {
> +    PCIDevice *d;
>      bus = pci_find_bus(bus, bus_num);
>  
>      if (!bus)
>          return NULL;
>  
> +    d = bus->parent_dev;
> +    if (d && pci_is_express(d) &&
> +        pcie_cap_get_type(d) == PCI_EXP_TYPE_DOWNSTREAM &&
> +        !pcie_cap_is_ari_enabled(d) && slot > 0) {
> +        return NULL;
> +    }
>      return bus->devices[PCI_DEVFN(slot, function)];
>  }

I'd like to split this express-specific code out in some way.
Further, the downstream port always has a single slot.
Maybe it shouldn't be a bus at all, but this needs some thought.
How about we put flag in PCIBus that says that a single
slot is supported? Downstream ports would just set it.

> -- 
> 1.7.1.1



reply via email to

[Prev in Thread] Current Thread [Next in Thread]