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

Re: [PATCH V7 10/11] xen/arm: translate virtual PCI bus topology for guests


  • To: Oleksandr Tyshchenko <olekstysh@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 26 Jul 2022 17:16:10 +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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hr6t49yUb79LjGrXkFo3m9F1lS3uPNtudkh55r7pH/o=; b=OxZTUu25Jlu3DfC5WlXF5Demo7y+1EyYfmDCTV8PleCT2cUNYWxvJnOizlgb0NUxP+31voBWJoTo0CkyrO5yNZlas3AZY1Puv0oHYj6GIQ+qlDqSCXwNCCiIL6XSVJds1Rwla1b/Www0pzYa2Hq2lvd8rLb0nftzYzkF8yFwesuR61fQpyTJCZu9u2QyfFG8OYTlQ5ZZM6FZibOFHIjw2oFmE+mw6E3x61hDehLKc4naQGUwzVyBFupaiJoXU6Zmu8p0bR65Z8gGy9p90Hfs2NZIdaw5B7kDw8XnrBFeAhKriG77annZLATIrZfH2pes2wpbamqhN3aIRpZqON5hfA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aLQ4oePvXTcbGQDpJ5FuZMIJPvpNomcgAO6wijIqwmQ07yKconfVHSxdg/X0I6V1Dzj8LUe5kjRjKjKv7XZ/iOOC3Ik9EUk0fgOvfoWplIZJACW7Mplw7fmFStcnKGze/g/AEhPB7/3dbVS165XnPky59XjCaDrSHWWKiVgws2xGXG1dPmk701YjFzlEBGg82kNKyG8k3IxXgTtDlMGWXapYZdmxEuNEiXSdoIMJoRjGWIHeyp90tnbv41xHLs5w5FcQYhTVO0vCFxtNubsmYfQmBcCCHHBWGMYkQW9Z85qM2tKD1UgAxiP43VkK4UcAxlNmj/xpdLnKOFV+F1DBrg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 26 Jul 2022 15:16:22 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 19.07.2022 19:42, Oleksandr Tyshchenko wrote:
> --- a/xen/arch/arm/vpci.c
> +++ b/xen/arch/arm/vpci.c
> @@ -41,6 +41,16 @@ static int vpci_mmio_read(struct vcpu *v, mmio_info_t 
> *info,
>      /* data is needed to prevent a pointer cast on 32bit */
>      unsigned long data;
>  
> +    /*
> +     * For the passed through devices we need to map their virtual SBDF
> +     * to the physical PCI device being passed through.
> +     */
> +    if ( !bridge && !vpci_translate_virtual_device(v->domain, &sbdf) )
> +    {
> +        *r = ~0ul;
> +        return 1;
> +    }

I'm probably simply lacking specific Arm-side knowledge, but it strikes
me as odd that the need for translation would be dependent upon "bridge".

> --- a/xen/drivers/vpci/vpci.c
> +++ b/xen/drivers/vpci/vpci.c
> @@ -158,6 +158,32 @@ static void vpci_remove_virtual_device(const struct 
> pci_dev *pdev)
>      }
>  }
>  
> +/*
> + * Find the physical device which is mapped to the virtual device
> + * and translate virtual SBDF to the physical one.
> + */
> +bool vpci_translate_virtual_device(struct domain *d, pci_sbdf_t *sbdf)
> +{
> +    struct pci_dev *pdev;

const wherever possible please (i.e. likely also for the first function
parameter).

> --- a/xen/include/xen/vpci.h
> +++ b/xen/include/xen/vpci.h
> @@ -276,6 +276,7 @@ static inline bool __must_check 
> vpci_process_pending(struct vcpu *v)
>  /* Notify vPCI that device is assigned/de-assigned to/from guest. */
>  int vpci_assign_device(struct pci_dev *pdev);
>  void vpci_deassign_device(struct pci_dev *pdev);
> +bool vpci_translate_virtual_device(struct domain *d, pci_sbdf_t *sbdf);
>  #else
>  static inline int vpci_assign_device(struct pci_dev *pdev)
>  {
> @@ -285,6 +286,12 @@ static inline int vpci_assign_device(struct pci_dev 
> *pdev)
>  static inline void vpci_deassign_device(struct pci_dev *pdev)
>  {
>  };
> +
> +static inline bool vpci_translate_virtual_device(struct domain *d,
> +                                                 pci_sbdf_t *sbdf)
> +{
> +    return false;
> +}

Please don't add stubs which aren't really needed (which, afaict, is the
case for this one).

Jan



 


Rackspace

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