[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: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>
- From: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>
- Date: Wed, 3 Nov 2021 11:02:37 +0000
- Accept-language: en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.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=I2hqvwZaJc93k9Zhb5aUKiapbvoDN4shc/xIEg3+Q1M=; b=mlK74QYMuAHpP6OBe49dfNxotx7Imza97ZRqGsOAnTfrKCbbxo6x3WXFK0tfwzjSfczNu9gQrsknnwOOcCmEEAMBE9KDg8I0KPJlClThCHacoKE191SWm0hwIAPr3C6z23oyKLLnfRdM9uwLjUxTtdBFYdOz5w0O/Cen/Z39DmhEemG6jiLFAe6FXwyqb7DjHzOJE2w15/mUZuEIrwdQIrisK5bNoZKX2T6budpedzQdonzD93+mCmqX7uMz/eV+IP6WfrT6jIekmLEwDfZKcLwWlYvVKxg5tNvBzLS7NNxIa+uCL3deUKQGpDXA/5/f/lI/U8LttR8MuuGX2FYeNA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eNI8ywGr82T1ZzZ05+fD/VoK7vUIVTELpSa0dHLTXCTWNGm9FfV5Aod3/+Y+FpX0s/rWcix1SppAUjKMO9wTjhmxgxXQugzcGA7CNo1kBx3g/qIdI+zxcazpNSbK7w5n08gMGz1zB5ZpvxJX5Lb0kJAnXicieRCG2yHi/gWZ9z9aXXvB/3u3bQFQv7ntcCguPzl6rK5tErJv2pzCJHmcY6ciDMhWYVmYbes1aHAD5EHHP0faTaQym8XvIHUG9u9W2W/U8s8IwHy9jkHY+szvbszxh8vrre0cxLYwA3OyhTZ55/aFxKNd0wl4xKGkctgo17l8lU7P2UQuy7yJQnJXzQ==
- 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>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Rahul Singh <rahul.singh@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>
- Delivery-date: Wed, 03 Nov 2021 11:02:56 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHXtdAkq8Qmwxr3HUWTio8KWsEpvKvlQ6KAgAsHq4CAAAimAIAAIt2AgAAEUICAATmxAIAABTcAgAABvgCAAAHkAIAAAZSAgAAFc4CAAAmcgIAAAuiAgAAAg4CAAAbWgIAAAG8A
- Thread-topic: [PATCH v3 08/11] vpci/header: Emulate PCI_COMMAND register for guests
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!!
>
> Thanks, Roger.
|