[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: Roger Pau Monné <roger.pau@xxxxxxxxxx>
- From: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>
- Date: Wed, 2 Feb 2022 12:49:36 +0000
- Accept-language: en-US
- 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=JdwM/IjxZ8Zh3OgHK1J9dw1fGKQCbiTgpygXmiWkaCQ=; b=dTehYAOxpOZejyLSzskBjc/tzhbrlpE28Vr22LzRcHiAmhIfv3lONJADe7SN0i2EoE/U+vTDkokUJ3vcp5CCORezAo+E6dn3xWoirG+IpJYaduj2N+4YPeeavyZZG1qd9669aoQrHtLy3ShOV8aMPew7fgdQJ44wkvfsFeEBv9TIZHPBWHVxcM4/wCRGIpbtat7jReEnHpyD/2Z5luGJn9PwxrMzYmi+B04wpIOi9rp7j6a48HDIFyCgQ0mLoDJ1qmFGGWEhjQaHZ+0ZUtIA1AXAyMdz022KqNdxBTPALFXJ7txoI1Ut1rwXN3yJn/2YzAbrushLqfNHjjlm7d88Ug==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YrTy+1XFG129aH20J/oCa99pd6EbH6lNb95YiJNYXw7FCxWUNl0l1sYxSb5ZZlJ3m8Rbiyk8/Ky/lrj4WOE0o4vv4beRb5XjZVm26Y4K/j/aicsXv8BbAIbzgYVmrehMVj6XiKOvbOFL2HCaKe5qV1/pV6BrRER/MRbBv4UZACPYVDRrwAfhfw/wTZT3y1K6c6HimPRXHWoJ9CTAIpUn0tpB1oOsaSPSblRTEo2CNkCjwIH1nKNbH8kFFFyv92TYy8xTPEndNX/KjXJsLjebiDdj9wLE/0A3vMprlphASte5tjzhLJ/0A7W25n8na5LqrmbfeFf2Bue0woLEB5m4Fw==
- 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>, "jbeulich@xxxxxxxx" <jbeulich@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>, Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>
- Delivery-date: Wed, 02 Feb 2022 12:50:29 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHX4ewK3mPSKCsK30iVfRQpWoVIB6xhEugAgB+P6YA=
- Thread-topic: [PATCH v5 09/14] vpci/header: emulate PCI_COMMAND register for guests
Hi, Roger!
On 13.01.22 12:50, Roger Pau Monné wrote:
> 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.
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.
>
> Thanks, Roger.
Thank you,
Oleksandr
|