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

Re: [PATCH v5 09/14] vpci/header: emulate PCI_COMMAND register for guests


  • To: Oleksandr Andrushchenko <andr2000@xxxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Thu, 13 Jan 2022 11:50:28 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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=jDdjx7/nl34sXRhRakvicR80sWlVZN+Lx89AJZViGcw=; b=fZZB/OI+qO1n/kuzDzH60OxZQVxJD4yq8rURnSrm2clLm0XuA7OXAi4WE5HlpqyIIzm0qyiwdNuv2+k88ayZmYCEGtYL4VS60fi9TLt1tQkr6yDn6/4U2YQAGFDA8ltkmrj3EKbXqwJWcMN7ChPAQBWDQZOnwweIOijpHVrXkBLPNxi8y7ktMcGOSsJvtMtzWLk2Kz1FMKS3cRvHwYpW8EoUtLmE++oKWkYwPGATQPuik+Xq0CY7Yn9j9jPAnSESj6jaZpSljP9NgItz6fsNpY2YHRvjL4bKMZigYDyFsZwi43GX6smuA8bcwuhOkzH96OoIm54MDWQLcoysNI1SrA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ae3ZSTcy7z4XbeAwhjBxAvn/62ohf5idZMyFq2ULnj5TOZRgLo53o1dgOsasQ+94OAuvPLV5wJSvjrRAa2Ms03JKVl242nKzphYjB52Nh4W3IB/PHO4+C7w2Be7BYUPjBQd6NYWiwdcUIHjYIOSs7LoSI7peAOpK2OX8J332PL9HsJ9dGPMMTHyxTBzmrdfQW/ntBCBpQ+wTkp0nkgrsgfN3A3LPKsQaRzvfOH2zsMWpg2DzuqqpEMOCMd4UjmvoAka0meTLoLYmmupUfjp2HwUKGhAJtv8dTptC8OY8LZZ204RmZYFDgUs1SLJfveIjXibD1EjjqrmImC5ahrOCdA==
  • Authentication-results: esa2.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: <xen-devel@xxxxxxxxxxxxxxxxxxxx>, <julien@xxxxxxx>, <sstabellini@xxxxxxxxxx>, <oleksandr_tyshchenko@xxxxxxxx>, <volodymyr_babchuk@xxxxxxxx>, <Artem_Mygaiev@xxxxxxxx>, <jbeulich@xxxxxxxx>, <andrew.cooper3@xxxxxxxxxx>, <george.dunlap@xxxxxxxxxx>, <paul@xxxxxxx>, <bertrand.marquis@xxxxxxx>, <rahul.singh@xxxxxxx>, Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
  • Delivery-date: Thu, 13 Jan 2022 10:50:47 +0000
  • Ironport-data: A9a23:9/fEjqNk80XNv4DvrR1lkcFynXyQoLVcMsEvi/4bfWQNrUon0DFUy GcZXj/SPvuJNGTxf9x/aNjk9khQucXVzoNiTwto+SlhQUwRpJueD7x1DKtR0wB+jCHnZBg6h ynLQoCYdKjYdpJYz/uUGuCJQUNUjMlkfZKhTr6UUsxNbVU8En150Es4w7dRbrNA2rBVPSvc4 bsenOWHULOV82Yc3rU8sv/rRLtH5ZweiRtA1rAMTakjUGz2zhH5OKk3N6CpR0YUd6EPdgKMq 0Qv+5nilo/R109F5tpICd8XeGVSKlLZFVDmZna7x8FOK/WNz8A/+v9TCRYSVatYoymrnoBo9 thRj6SbWER0Ee7ym/QiFCANRkmSPYUekFPGCX22sMjVxEzaaXr8hf5pCSnaP6VBpLwxWzsXs 6VFdnZdNXhvhMrvqF6/YvNrick5atHiIasUu216zCGfBvEjKXzGa/uTtIYAhW1q7ixINfH5P cU/eCMyVzXJWkJTGU0LIZcBus790xETdBUH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vgt8iiiy8yZwBZ35k+0UZsWEbEODM4UilBtk1TqOvw/lKR2UODt7nV4WznbFXD2F b/nSqmGbG2OF8btXUn0qOWbWqbJ7quQPXkCQAjKl+NcZGXbr/5rt6GQph2OAzSAKXD2RGBObQQ LfMRW/4nnkWoDCidHrnHCumoRPhIDHNCDEywjPPoUY4dw1R6tlbN1EJKMeIsfm1zFKu0Us6/Dq biIEee08ZXeYBq/Dr2nfUBJk
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Thu, Nov 25, 2021 at 01:02:46PM +0200, Oleksandr Andrushchenko wrote:
> From: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
> 
> Add basic emulation support for guests. At the moment only emulate
> PCI_COMMAND_INTX_DISABLE bit, the rest is not emulated yet and left
> as TODO.
> 
> Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
> ---
> Since v3:
> - gate more code on CONFIG_HAS_MSI
> - removed logic for the case when MSI/MSI-X not enabled
> ---
>  xen/drivers/vpci/header.c | 21 +++++++++++++++++++--
>  1 file changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c
> index b0499d32c5d8..2e44055946b0 100644
> --- a/xen/drivers/vpci/header.c
> +++ b/xen/drivers/vpci/header.c
> @@ -491,6 +491,22 @@ static void cmd_write(const struct pci_dev *pdev, 
> unsigned int reg,
>          pci_conf_write16(pdev->sbdf, reg, cmd);
>  }
>  
> +static void guest_cmd_write(const struct pci_dev *pdev, unsigned int reg,
> +                            uint32_t cmd, void *data)
> +{
> +    /* TODO: Add proper emulation for all bits of the command register. */
> +
> +#ifdef CONFIG_HAS_PCI_MSI
> +    if ( pdev->vpci->msi->enabled )

You need to check for MSI-X also, pdev->vpci->msix->enabled.

> +    {
> +        /* Guest wants to enable INTx. It can't be enabled if MSI/MSI-X 
> enabled. */
> +        cmd |= PCI_COMMAND_INTX_DISABLE;

You will also need to make sure PCI_COMMAND_INTX_DISABLE is set in the
command register when attempting to enable MSI or MSIX capabilities.

Thanks, Roger.



 


Rackspace

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