qemu-block
[Top][All Lists]
Advanced

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

Re: [PATCH 4/4] pci: Compare function number and ARI next function numbe


From: Ani Sinha
Subject: Re: [PATCH 4/4] pci: Compare function number and ARI next function number
Date: Tue, 11 Jul 2023 12:40:47 +0530


> On 01-Jul-2023, at 12:31 PM, Akihiko Odaki <akihiko.odaki@daynix.com> wrote:
> 
> The function number must be lower than the next function number
> advertised with ARI.
> 
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> ---
> hw/pci/pci.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
> 
> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
> index e2eb4c3b4a..568665ee42 100644
> --- a/hw/pci/pci.c
> +++ b/hw/pci/pci.c
> @@ -2059,6 +2059,8 @@ static void pci_qdev_realize(DeviceState *qdev, Error 
> **errp)
>     Error *local_err = NULL;
>     bool is_default_rom;
>     uint16_t class_id;
> +    uint16_t ari;
> +    uint16_t nextfn;
> 
>     /*
>      * capped by systemd (see: udev-builtin-net_id.c)
> @@ -2121,6 +2123,19 @@ static void pci_qdev_realize(DeviceState *qdev, Error 
> **errp)
>         }
>     }
> 
> +    if (pci_is_express(pci_dev)) {
> +        ari = pcie_find_capability(pci_dev, PCI_EXT_CAP_ID_ARI);
> +        if (ari) {
> +            nextfn = (pci_get_long(pci_dev->config + ari + PCI_ARI_CAP) >> 
> 8) & 0xff;
> +            if (nextfn && (pci_dev->devfn & 0xff) >= nextfn) {
> +                error_setg(errp, "PCI: function number %u is not lower than 
> ARI next function number %u",
> +                           pci_dev->devfn & 0xff, nextfn);
> +                pci_qdev_unrealize(DEVICE(pci_dev));
> +                return;
> +            }
> +        }
> +    }
> +

So I kind of got lost in all the patches. What was the ultimate decision 
regarding checking this?

>     if (pci_dev->failover_pair_id) {
>         if (!pci_bus_is_express(pci_get_bus(pci_dev))) {
>             error_setg(errp, "failover primary device must be on "
> -- 
> 2.41.0
> 




reply via email to

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