[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v6 06/13] vpci/header: implement guest BAR register handlers
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>
- Date: Tue, 8 Feb 2022 08:06:54 +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=WOppeeF7lJW9AgRbC1oJFoap/cAQXccHD6FCmvHzk7g=; b=UD++qDNa1+6QxezPjVfGc5I8E6djBpCwchUN4+x/woEabW/6LITQANhShbwul1jqVwlESa1n0Onf9aeI7q3Ab1fsZh+gEGYuSZg3mISd2gSSPSsrOinuFuU5r3dMiyasOQdCQyE8qdfSP4VS7cBrAueuST0P5gAbx/TbDj6niD5EJN2lmFCo+htikjS4deHnuITcXw3kGficjCEyKe9Bx3I7ksc+QXtrBqDzh2PSePCc6ttnVlLpcJoJ2H+wZTINqrgs+fYtJuZ9sF0V9NaVEpWW/S5aZYUs1PvtPT0UR+SWrBf0ISP27eoWUFKO3gaH6skGlXo3G9YZCgF6eRKs7g==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dGhhjEl03bpK8yDFzAnWTrz5mCFThOW7Ey22Boue175fXNsO5yMJxuYAiibwucOrvxsuRVahPbkZ0KkJRW8WLKlUGRoqk8B6rsgwEC333HFlgcgXAoLesWMNxadwPnCJSyF3eMRfqtEzkZ6y/NXdERghacKUEq2y8r8gfsG3J3FZxX12wgGN3sZdJnSQ/RKFd1qpZl3NKZdOPCiWIl95PdOvPpTWhVhYHgcV3zNAKn/Jel56cTM/EG6CNn/XwBQU9+XJP/y3mooJ4NV8iM7+1nZr0jbd8l7FU+n8YQgq6qwm50kawBN9ifH2J7vjxaKjwCw1YJtzZEIj1xdw/xT3gg==
- 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: Tue, 08 Feb 2022 08:07:19 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHYGZFd6D+qnME8W0+wTH+v8YZ8DayIVt4AgAD7qYA=
- Thread-topic: [PATCH v6 06/13] vpci/header: implement guest BAR register handlers
On 07.02.22 19:06, Jan Beulich wrote:
> On 04.02.2022 07:34, Oleksandr Andrushchenko wrote:
>> +static uint32_t guest_bar_ignore_read(const struct pci_dev *pdev,
>> + unsigned int reg, void *data)
>> +{
>> + return 0;
>> +}
>> +
>> +static int bar_ignore_access(const struct pci_dev *pdev, unsigned int reg,
>> + struct vpci_bar *bar)
>> +{
>> + if ( is_hardware_domain(pdev->domain) )
>> + return 0;
>> +
>> + return vpci_add_register(pdev->vpci, guest_bar_ignore_read, NULL,
>> + reg, 4, bar);
>> +}
> For these two functions: I'm not sure "ignore" is an appropriate
> term here. unused_bar_read() and unused_bar() maybe? Or,
> considering we already have VPCI_BAR_EMPTY, s/unused/empty/ ? I'm
> also not sure we really need the is_hardware_domain() check here:
> Returning 0 for Dom0 is going to be fine as well; there's no need
> to fetch the value from actual hardware. The one exception might
> be for devices with buggy BAR behavior ...
Well, I think this should be ok, so then
- s/guest_bar_ignore_read/empty_bar_read
- s/bar_ignore_access/empty_bar
- no is_hardware_domain check
>
>> @@ -516,6 +594,11 @@ static int init_bars(struct pci_dev *pdev)
>> if ( (val & PCI_BASE_ADDRESS_SPACE) == PCI_BASE_ADDRESS_SPACE_IO )
>> {
>> bars[i].type = VPCI_BAR_IO;
>> +
>> + rc = bar_ignore_access(pdev, reg, &bars[i]);
>> + if ( rc )
>> + return rc;
> Elsewhere the command register is restored on error paths.
Ok, I will restore
>
> Jan
>
Thank you,
Oleksandr
|