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

Re: [PATCH v3 08/11] vpci/header: Emulate PCI_COMMAND register for guests


  • To: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Wed, 3 Nov 2021 12:01:03 +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=nufGc9BLzFfdeaVHW1Je3NvSwxZPZFL7GA/6Q7+cfPo=; b=W5R2djPLP5AiHf3oNt8yu19t3qKoWXVlxF9qHL1pdulEoUsdvQrJUQgj/BAk2my2zeZQ0kA8auDO5iHf4hzHSSSCpQR5lVF7DTnLzrkuxAsl+P6ofAdrpNdh+hRLckm0cOzWnnBxE4UvG80Y3GBz1x1TBjBYOzXdo5BCrZak9FTKBpqJyomZi/zFo5CWtr4AM8HTEZj+dr1M4/r9ZlZI8wNaDjFgq7TQP16Pue7dglLROSypPdWOeOnm9eOcwiUiMC3I5R4zPTDiV+IKM5SwzaXdTiZDxsVU17S7rW1BAP6bYdSKClEXT7G3/OgWEhHEhYLQ9ir31MYCDnGGktv17Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OpcxhSCfHw1mMOGpz1iX/MkAJAt9NPOdlDuGelG0HBbtLl3YlxJkelEMe2UYvSxVfckggSS+19CTX5L+VYQ5ct6GlFokD6bqQdxujx/jXT5VhvTreHcOvU9/JaOna5xKk4RtMV4nEgM0abqvVkP+iPSZwcuecWDMtU4hhV9NA1y0mi8DoojsJ6mmyc9htF0AQxbVrwIbwm/klc+eWq6Y8N3DwPk3cAV18p5VUhoh2OOlnSBLouj9Vm1LdTurbMeSowrO2D0Hc5lj0cPSUW0Ub6u3y2h0YbzSdwZSuKgwZXNhEX+Ps2eWo4SAasGfjuAV1eD2c3SaqDMTytCXDd8tfA==
  • Authentication-results: esa1.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Jan Beulich <jbeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "julien@xxxxxxx" <julien@xxxxxxx>, "sstabellini@xxxxxxxxxx" <sstabellini@xxxxxxxxxx>, Oleksandr Tyshchenko <Oleksandr_Tyshchenko@xxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Artem Mygaiev <Artem_Mygaiev@xxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Rahul Singh <rahul.singh@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>
  • Delivery-date: Wed, 03 Nov 2021 11:01:28 +0000
  • Ironport-data: A9a23:4+rToqlHjSIByVGvZIfeawXo5gy+IERdPkR7XQ2eYbSJt1+Wr1Gzt xIXC2mPM/yMZzOhedpza47l9kJX7cKAnNU3Ggs//i8yQyMWpZLJC+rCIxarNUt+DCFioGGLT Sk6QoOdRCzhZiaE/n9BClVlxJVF/fngqoDUUYYoAQgsA187IMsdoUg7wbdg29Yz2YLR7z6l4 rseneWOYDdJ5BYsWo4kw/rrRMRH5amaVJsw5zTSVNgT1LPsvyB94KE3fMldG0DQUIhMdtNWc s6YpF2PEsE1yD92Yj+tuu6TnkTn2dc+NyDW4pZdc/DKbhSvOkXee0v0XRYRQR4/ttmHozx+4 PZRhZGNcQwUBbHRl/UAYUB/UDs9epQTrdcrIVDn2SCS50jPcn+qyPRyFkAme4Yf/46bA0kXq 6ZecmpUKEne2aTmm9pXScE17ign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b/T/xogJx2jqi2Ou31RGujm2iGbkKpY994IrX5h/rHBTRJkI+TZSMqi0lHo2A8 KDcdMzSJdoAyIDadvaXVZTFVqcEik0nkDv+izDAX35HTJ9u9M4R8AOGPVM9lPfGCVlS1lktzwv kFZQwXS89h2dTfCu1RLfyXJ3vDLQAHE3A53V9gNXnANRaiqC4s/F/HUTTtcWNd1mb47dQ845Y9 p8ma7fHMrGIzHVwzp5GzU2lDo+Lsm4+ZoM4qwyniFIdZg51R+Q17WKBUanS4mWfLzq6L5lhSlp zSp5F6kzsKt3or+VcatDbLQZ
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Wed, Nov 03, 2021 at 10:36:36AM +0000, Oleksandr Andrushchenko wrote:
> 
> 
> On 03.11.21 12:34, Jan Beulich wrote:
> > On 03.11.2021 11:24, Oleksandr Andrushchenko wrote:
> >> On 03.11.21 11:49, Jan Beulich wrote:
> >>> Aiui you want to prevent the guest from clearing the bit if either
> >>> MSI or MSI-X are in use. Symmetrically, when the guest enables MSI
> >>> or MSI-X, you will want to force the bit set (which may well be in
> >>> a separate, future patch).
> >> static uint32_t emulate_cmd_reg(const struct pci_dev *pdev, uint32_t cmd)
> >> {
> >>       /* TODO: Add proper emulation for all bits of the command register. 
> >> */
> >>
> >>       if ( (cmd & PCI_COMMAND_INTX_DISABLE) == 0 )
> >>       {
> >>           /* Guest wants to enable INTx. It can't be enabled if MSI/MSI-X 
> >> enabled. */
> >> #ifdef CONFIG_HAS_PCI_MSI
> >>           if ( pdev->vpci->msi->enabled )
> >>               cmd |= PCI_COMMAND_INTX_DISABLE;
> >> #endif
> >>       }
> >>
> >>       return cmd;
> >> }
> >>
> >> Is this what you mean?
> > Something along these lines, yes. I'd omit the outer if() for clarity /
> > brevity.
> Sure, thank you!
> @Roger are you ok with this approach?

Sure, I would even do:

#ifdef CONFIG_HAS_PCI_MSI
if ( !(cmd & PCI_COMMAND_INTX_DISABLE) && pdev->vpci->msi->enabled )
{
    /* Guest wants to enable INTx. It can't be enabled if MSI/MSI-X enabled. */
    cmd |= PCI_COMMAND_INTX_DISABLE;
}
#endif

There's no need for the outer check if there's no support for MSI.

Thanks, Roger.



 


Rackspace

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