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

Re: [PATCH v8 04/13] vpci: add hooks for PCI device assign/de-assign


  • To: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 24 Jul 2023 11:41: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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=EYrwqGSlqyeMdaVpr7MKG2KaWIkESZGb1YTpr5NSxsA=; b=DFqP2YzJedCgdj+H9gxYp31t9FfavSxFgWTRH93at6n6HHs8Or46A3T7beFWZsXAxR47XS/OdEpp1FNlh0pQgcX1gztJpe5CCCEPHK2Fb3UaaH12XHxQN+P8YW3lgHxJFHG6iVyxacBI08ClclrTFBhHybDV0oi2lkjfwrJ9viap9jYgsGJzSnjIEHje/6tUCzELouA8ZcJb/G+UemVs7TgbPn3lH5e6Jqlls9XUY5bOFlEdgPpljStOmOJ/v3KDvkHTvIPNiakJT2BwTxEh6gEU85v0ubTXehzJcC5OieAxApopeRL21PX3U2Kg3VrQfOGENtYPnOgiIE5oTMUkUA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aLml5g56QAklOGRs7XhhCeQCZArUx3QqjKniqfsCFzp15pfr3p2pMxrhWvWVDHFX7OtHi+DbwBPRmdWUhj1n5D2HuyjWAQONmGHnKRN64oAlrPU0rTS5Ei4qOJHX4Dyz2YNscj0jCvHxySYV1rULACfVjyTefgCQyhdXC8wyv0VNMa1zPVcXWL8u2rD22OftnJUxTmkFMbdDv5s9RJknaT3Z+ygZHV10eAYkumvs9ccIY/EbqrsOMAmtfA77REBd/ofMMlOJ41DYHqaWwUTIL2GC5nM+9ExCzNPxefYP96br2BMnX/b4sE+YbM2o0PZJN677w5u+Cvj1SuhqMYa4QQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 24 Jul 2023 09:41:43 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 20.07.2023 02:32, Volodymyr Babchuk wrote:
> From: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
> 
> When a PCI device gets assigned/de-assigned some work on vPCI side needs
> to be done for that device. Introduce a pair of hooks so vPCI can handle
> that.
> 
> Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>

A couple more mechanical comments in addition to what Roger said:

> --- a/xen/drivers/passthrough/pci.c
> +++ b/xen/drivers/passthrough/pci.c
> @@ -885,6 +885,10 @@ static int deassign_device(struct domain *d, uint16_t 
> seg, uint8_t bus,
>      if ( ret )
>          goto out;
>  
> +    write_lock(&pdev->domain->pci_lock);
> +    vpci_deassign_device(pdev);
> +    write_unlock(&pdev->domain->pci_lock);

Can't it be just d here?

> @@ -1484,6 +1488,10 @@ static int assign_device(struct domain *d, u16 seg, u8 
> bus, u8 devfn, u32 flag)
>      if ( pdev->broken && d != hardware_domain && d != dom_io )
>          goto done;
>  
> +    write_lock(&pdev->domain->pci_lock);
> +    vpci_deassign_device(pdev);
> +    write_unlock(&pdev->domain->pci_lock);

Is this meaningful (and okay to call at all) when pdev->domain == dom_io?

> @@ -1509,6 +1517,19 @@ static int assign_device(struct domain *d, u16 seg, u8 
> bus, u8 devfn, u32 flag)
>          rc = iommu_call(hd->platform_ops, assign_device, d, devfn,
>                          pci_to_dev(pdev), flag);
>      }
> +    if ( rc )
> +        goto done;
> +
> +    devfn = pdev->devfn;
> +    write_lock(&pdev->domain->pci_lock);
> +    rc = vpci_assign_device(pdev);
> +    write_unlock(&pdev->domain->pci_lock);

Just d again here?

Jan



 


Rackspace

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