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

Re: [PATCH v3 11/11] xen/arm: Translate virtual PCI bus topology for guests


  • To: Oleksandr Andrushchenko <andr2000@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 30 Sep 2021 10:53:35 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=gyNj+9vlrP3omPgt6HOQRriQEpOzh8GdSwwftm6nJhU=; b=RESUDXTrN/m068UYN7iVuDwSDQYfG62O1iCeU5PwDhH8YbdkBZRDP5rRwE4kmC98EPqCSX8EbgOopCFxk8AyMeQM7L28kI0wJPvq0IpAljPeBsfbExIi+Le2rw+U03YtblqsUeGvVYHa3Ys8YOA5OPzVsbJygW1GjtzQ3G4StlctB+XZ5rUnnaZjTS7/Zyww1EdD1ltOOWz0W1PRkfeh9a1dWjWMK5RFbVQKXelQdZO5GNtt8lhawoHbyQ3u7YuUZcoUBolurwjyYdSOQ/d9rVnriovM/QfSeLw9NPv3rkdBlAivQsMG62yMldVHSHb1AQgv58VkZhmAL22ZUwsGjg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fNlT0UQvroZjdVOpoJt19sNdL00DA+np9Xq3EKTa3wF4YoJWNZOSFQ+1wtNSfJyau/ncpHwfazJUhaU/GvhklxmzQwoIhxZQFmToGTQvJtPIIGKekFqT1zWKLDDfXO75zSfX0eNZlOQMbT2Zzj7CtrYH3KUVnktNOG9CGPmYAEKeTvDsuORFf/TYBgQn83o5pSoXwksCRqnkTb5GhEuEi/6yrqEACIUWZ127l/ZuRdA6Ft2LQ9g872p8xpnBonoXlnItDyq4mzv+xCz7S7m63BIV0+sxRdW31qP4RhSL4dELKrdo5Ph8tNDkYWF1xa75l/4SfvhipNxwYU6eO+ff1A==
  • Authentication-results: lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=none action=none header.from=suse.com;
  • Cc: julien@xxxxxxx, sstabellini@xxxxxxxxxx, oleksandr_tyshchenko@xxxxxxxx, volodymyr_babchuk@xxxxxxxx, Artem_Mygaiev@xxxxxxxx, roger.pau@xxxxxxxxxx, bertrand.marquis@xxxxxxx, rahul.singh@xxxxxxx, Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 30 Sep 2021 08:53:46 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 30.09.2021 09:52, Oleksandr Andrushchenko wrote:
> --- a/xen/drivers/passthrough/pci.c
> +++ b/xen/drivers/passthrough/pci.c
> @@ -889,6 +889,31 @@ int pci_remove_virtual_device(struct domain *d, const 
> struct pci_dev *pdev)
>      xfree(vdev);
>      return 0;
>  }
> +
> +/*
> + * Find the physical device which is mapped to the virtual device
> + * and translate virtual SBDF to the physical one.
> + */
> +bool pci_translate_virtual_device(const struct domain *d, pci_sbdf_t *sbdf)
> +{
> +    struct vpci_dev *vdev;

const (afaict)

> +    bool found = false;
> +
> +    pcidevs_lock();
> +    list_for_each_entry ( vdev, &d->vdev_list, list )
> +    {
> +        if ( vdev->sbdf.sbdf == sbdf->sbdf )
> +        {
> +            /* Replace virtual SBDF with the physical one. */
> +            *sbdf = vdev->pdev->sbdf;
> +            found = true;
> +            break;
> +        }
> +    }
> +    pcidevs_unlock();

As per the comments on the earlier patch, locking as well as placement
may need reconsidering.

Jan




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.