[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 <Oleksandr_Andrushchenko@xxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Wed, 2 Feb 2022 14:32:18 +0100
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; 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=TZVvidwyhH4G2wqsKLBS1yy9f/2iV7LGiUjXMLEWH/4=; b=Klg8xVpJSEAZsN85JEK+oIkEqmpKgbnqiw6c5obiVakOnuLNEmm/q6XMLiuXpBxOcEe5vdTSQ/uQ/S6udCtiQf1tu0c9KwS3j6I3IGPXodM79Is33KWkm8Q7eDJ5H+fELkbtewsC6OZaJ7dP8hjxHtjaVUZ6aMxTDJswtTnFsML7cg+5CBh2j6rjRGp+neTi9f52nG29utJ01qk9+hOLom+MqivGsyy+nz/rJQQsLRzGG708aEufWAjrj7c5AY2iBf0IH4ZeEAKjV53lxw3XsSxOy5ripKoMBnyL1CSMNWuS/wb7X2kJ5NHYh4CAKVBYlw4Oz4efJT3saAz3rV4yqg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CYpXwL4i077OTTN48dOEvD65TjE3mmgJQXdC+ioniYAAJJTJ72zi8M92qhp/YPawFTgUJCCMP9vfNN4N3rZQrvzUHRAcokdhdwsR+BFjhSwM+N2ndnj/YbQklpLF/65vRSXi+HK2eSWRe2ExIkbPL87wMKvYbsVl14SF81xhqCL/SnvQCIL/jBnwirnMPgw2IuVKdW1l8mFLLhNr7+2qgATaU72b99DHrIfgvGoUeFCfmkF9lS/nBE5h1QTSJWBWjpCaXSpQ+w8+pOPP7Qm49v60KrU/IRsZKTucxV12IU4N8i+d6/VqZd+AiPuJyCtTCo2u4JBZnTwg1AHS0/Rgug==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
- Cc: "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>, "andrew.cooper3@xxxxxxxxxx" <andrew.cooper3@xxxxxxxxxx>, "george.dunlap@xxxxxxxxxx" <george.dunlap@xxxxxxxxxx>, "paul@xxxxxxx" <paul@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Rahul Singh <rahul.singh@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Delivery-date: Wed, 02 Feb 2022 13:32:33 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 02.02.2022 13:49, Oleksandr Andrushchenko wrote:
> On 13.01.22 12:50, Roger Pau Monné wrote:
>> On Thu, Nov 25, 2021 at 01:02:46PM +0200, Oleksandr Andrushchenko wrote:
>>> --- 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.
> Indeed, thank you
>>
>>> + {
>>> + /* 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.
> Isn't it enough that we just check above if MSI/MSI-X enabled then make
> sure INTX disabled? I am not following you here on what else needs to
> be done.
No, you need to deal with the potentially bad combination on both
paths - command register writes (here) and MSI/MSI-X control register
writes (which is what Roger points you at). I would like to suggest
to consider simply forcing INTX_DISABLE on behind the guest's back
for those other two paths.
Jan
|