[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC PATCH v2 1/4] pci: refactor pci_find_capapibilty t
From: |
Kevin O'Connor |
Subject: |
Re: [Qemu-devel] [RFC PATCH v2 1/4] pci: refactor pci_find_capapibilty to get bdf as the first argument instead of the whole pci_device |
Date: |
Sun, 23 Jul 2017 12:24:47 -0400 |
User-agent: |
Mutt/1.8.3 (2017-05-23) |
On Sun, Jul 23, 2017 at 01:11:47AM +0300, Aleksandr Bezzubikov wrote:
> Refactor pci_find_capability function to get bdf instead of
> a whole pci_device* as the only necessary field for this function
> is still bdf.
> It greatly helps when we have bdf but not pci_device.
>
> Signed-off-by: Aleksandr Bezzubikov <address@hidden>
> ---
> src/fw/pciinit.c | 4 ++--
> src/hw/pcidevice.c | 12 ++++++------
> src/hw/pcidevice.h | 2 +-
> src/hw/virtio-pci.c | 4 ++--
> 4 files changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/src/fw/pciinit.c b/src/fw/pciinit.c
> index 08221e6..864954f 100644
> --- a/src/fw/pciinit.c
> +++ b/src/fw/pciinit.c
> @@ -762,7 +762,7 @@ static int pci_bus_hotplug_support(struct pci_bus *bus,
> u8 pcie_cap)
> return downstream_port && slot_implemented;
> }
>
> - shpc_cap = pci_find_capability(bus->bus_dev, PCI_CAP_ID_SHPC, 0);
> + shpc_cap = pci_find_capability(bus->bus_dev->bdf, PCI_CAP_ID_SHPC, 0);
> return !!shpc_cap;
> }
>
> @@ -844,7 +844,7 @@ static int pci_bios_check_devices(struct pci_bus *busses)
> */
> parent = &busses[0];
> int type;
> - u8 pcie_cap = pci_find_capability(s->bus_dev, PCI_CAP_ID_EXP, 0);
> + u8 pcie_cap = pci_find_capability(s->bus_dev->bdf, PCI_CAP_ID_EXP,
> 0);
> int hotplug_support = pci_bus_hotplug_support(s, pcie_cap);
> for (type = 0; type < PCI_REGION_TYPE_COUNT; type++) {
> u64 align = (type == PCI_REGION_TYPE_IO) ?
> diff --git a/src/hw/pcidevice.c b/src/hw/pcidevice.c
> index cfebf66..d01e27b 100644
> --- a/src/hw/pcidevice.c
> +++ b/src/hw/pcidevice.c
> @@ -134,25 +134,25 @@ pci_find_init_device(const struct pci_device_id *ids,
> void *arg)
> return NULL;
> }
>
> -u8 pci_find_capability(struct pci_device *pci, u8 cap_id, u8 cap)
> +u8 pci_find_capability(u16 bdf, u8 cap_id, u8 cap)
Thanks. If you respin this series, please also move
pci_find_capability() function from pcidevice.c to pci.c. (If the
function no longer takes a pci_device, it should be moved out of
pcidevice.c.)
-Kevin