[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v6 10/13] vpci/header: reset the command register when adding devices
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>
- Date: Fri, 4 Feb 2022 14:37:15 +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=GnR7WvusOa8NAdWCqsvd5ZNFf15QvGL54Y7S0D9pVe8=; b=C8xKvJQ/MrDBD67bptoxSGPgH1bGN8LWtciX4Ojhax3oFHcb2kp22003nhRe//GdpkGZdtt3Bp6ubo3R8OJUnPU+/rA8SZ+DBUR/tM4QId4RvKrpETnut3R6INswRH/oUAzbA8ImrB7eimW3IoM/CSq2+iRbboZRpaJ088Dwa8PIEIArUdxklc+ZIcRyAPTuZdcL5phfLx7S8K/QogxF0tvva0xZVXTMxYm3pMj6x04N6bQDRGuTLqvAyWF8DDWv36CNMZIp7dHZxSp5Ue9gKeOX/aZOhf7jUKEr/+15wBAHs6eAjMJtoLzAjoXaVzoBDpUy3xB/WPQ71lGfqF2WwQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bn0sB43IEpZzbkGpRf4lRal/TYMRrUUUkwQiyfKAF4530hi3B6iNXbts5xZa5bT89NoSqMUkPB1rGIkuU9R3HeHPuPPN+t57BLe8aEa6iaAKubYleGYQxx++lDjs5W+J6RKzoNo9NBN6gdYFpf77Ivi4yg6Z3JW7idNGGUarDnf4NdN5vfRIoUCFsfrN6+kXBxHRvxdgLhPkchvAh9HR9z1V05IULapHfUmZJHYh4qPWGsWYCAHLqj1gvL6qr+USkH67gXHYUqysWd8awXTq9Yo7GTkR7P/c88Pf47ygblyyAZe/y6CnYFfcUVV+ABi8Ou6EaeDJP9ZBJybADDiC+w==
- Cc: "julien@xxxxxxx" <julien@xxxxxxx>, "sstabellini@xxxxxxxxxx" <sstabellini@xxxxxxxxxx>, Oleksandr Tyshchenko <Oleksandr_Tyshchenko@xxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Artem Mygaiev <Artem_Mygaiev@xxxxxxxx>, "roger.pau@xxxxxxxxxx" <roger.pau@xxxxxxxxxx>, "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>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>
- Delivery-date: Fri, 04 Feb 2022 14:37:42 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHYGZFg3nazYSvfA0G+yHTbxcxX2ayDdFgAgAAB6wA=
- Thread-topic: [PATCH v6 10/13] vpci/header: reset the command register when adding devices
On 04.02.22 16:30, Jan Beulich wrote:
> On 04.02.2022 07:34, Oleksandr Andrushchenko wrote:
>> Reset the command register when assigning a PCI device to a guest:
>> according to the PCI spec the PCI_COMMAND register is typically all 0's
>> after reset.
> It's not entirely clear to me whether setting the hardware register to
> zero is okay. What wants to be zero is the value the guest observes
> initially.
"the PCI spec says the PCI_COMMAND register is typically all 0's after reset."
Why wouldn't it be ok? What is the exact concern here?
>> --- a/xen/drivers/vpci/header.c
>> +++ b/xen/drivers/vpci/header.c
>> @@ -454,8 +454,7 @@ 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)
>> +static uint32_t emulate_cmd_reg(const struct pci_dev *pdev, uint32_t cmd)
> The command register is a 16-bit one, so parameter and return type should
> either be plain unsigned int (preferred, see ./CODING_STYLE) or uint16_t
> imo.
God catch, thank you
> Jan
>
Thank you,
Oleksandr
|