[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:26:55 +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=e5/rMpp17fCyF7TNdmwANrqFRWQerO9Pqw7bzVFp80E=; b=lsZi40epYwea9ofnbUfS0vfjC1x4wjRYyLVSlR52FnEIJiT3XFE5my9EGRl1xZHc7vlljtr0j2xahQyCk0Alq30bBEJ+TByiSlTv10/Utgo6rhDXjabJef/zLs4aVexIKFbjJEUlO/lVevq3TsCuYf/hfCDSj1SRsl6ZDWRpUM0dxwcdtSJnZfgd4I9qZLw28meEcjrHCxjQNmSTRAXdPheGr6VCHp33+8Epjg8v0WcuXccjRZQzrxlmKvhCwJAU1PNCYuGp/VmdS9LJKeZOsAibKhwKzD2wPSA9H5P1tLZ9C4rt7efzCuy2Ja7V/2huXs2QnGskJIWZrzXCl0KcOw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m3ijAPKa88kd/dws4th91RN/T+Zi1H5LS0KRHpnInmHGmRUvmNRaweiJvEPO8NgLhOEs6jz0/YQakzm/wBWVw9MkeC1L9yHTSYIPdsvjo72IwDgBKnKzyVP8j0qrY8JQjTm2FUmx8K5C6AraFPjjeM0pGzd1jQlw4r7l8pBu4DcyLXToin1lcLldobFQpuU/FgipBopIqhkWO6qA9x1SZIuzYxdxq+XCcXOiGKcE37LFhoPF9b2kn/hlgZCcgEZQcw/VgtbMzm1WyJ6qwMIwH1awuegHdaYGz3tmx19nA1N7m9kMbVw9xS4Oon6SnYW4BLPZp4iPu5iChE4Wz4XfFQ==
  • Authentication-results: esa3.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:27:24 +0000
  • Ironport-data: A9a23:chGVxqh8vctNexGvlXndygCSX161VBYKZh0ujC45NGQN5FlHY01je htvXDiEa/6CYWv3KIokOti38EJUuceAyIRkG1BvpHs0EX4b9cadCdqndUqhZCn6wu8v7a5EA 2fyTvGacajYm1eF/k/F3oAMKRCQ7InQLlbGILes1htZGEk0F0/NtTo5w7Rg29cw2oDja++wk YiaT/P3aQfNNwFcagr424rbwP+4lK2v0N+wlgVWicFj5DcypVFMZH4sDfjZw0/DaptVBoaHq 9Prl9lVyI97EyAFUbtJmp6jGqEDryW70QKm0hK6UID66vROS7BbPg/W+5PwZG8O4whlkeydx /1AhKKZFiwvPJfWo/RGdh4COCVVLPVZreqvzXiX6aR/zmXDenrohf5vEFs3LcsT/eMf7WNmr KJCbmpXN1ba2rzwkOnTpupE36zPKOHxO4wSoDd4xCzxBvc6W5HTBa7N4Le02R9t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vbosOj+51HfrjyhRiVwMFhSNKPDb22idL4qgBxxywlkbshZUvi/FBBlVDx1N2yPSnJ vU2AV5XMK24IwLF+N1vxMKX6s++AsPPTw8WNecQmbeQVvPNqpoohvdXoGYWTqrA6H8/a3+j3IA w2xK8nB8D6MbjPsngR9cKMcZKoqDgTZz+Fa13fX9xRLXCuqYtm3i0su4pt9G/LgHUfACDPhqCy +oRG//PdeV5OeKndlC3gKbXh
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Wed, Nov 03, 2021 at 11:02:37AM +0000, Oleksandr Andrushchenko wrote:
> 
> 
> On 03.11.21 13:01, Roger Pau Monné wrote:
> > 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.
> Ok, sounds good!
> Thank you both!!

In fact you could even remove the check for !(cmd &
PCI_COMMAND_INTX_DISABLE) and always set PCI_COMMAND_INTX_DISABLE if
MSI is enabled, which I think is what Jan was pointing to in his
previous reply.

Regards, Roger.



 


Rackspace

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