[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: Oleksandr Andrushchenko <andr2000@xxxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Mon, 7 Feb 2022 18:06:10 +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=Eak0n+eKgYksPTt8z/Zey1HNNYwAIEU4CabgD8aYCic=; b=HFgJo4iQCebTrZAUBdLcVHNBnjMbbLI5DgPr3feH7cYbdkfLD80VlJ7i4E0PCVdCXog3ZW8ycz3llchDMroo6tZIKMpEMjBqDbA+B92JkEyvNk65k90H24YKoPZKuxB1M775Tn+fHGUS1W3d71QNwm/B9XdHyHgf1a/1qDMapO2Kzq6aBVL2gZxlR1x79EqnzUS2z9u9VYgbBce/3NK+M8ZRvh8ZEQXzfSBbatLtV6+91SDH0IgaaFEJcqtxoLgDgDKkdhj+16FptHx4RUxbkpvqww0g5L1/vcG1EWGhbVJIdJGB4Bv1zhXVewAoInmvavoO54bBwi+h0VG87VB3RQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZHH2YIysjoC9lYoti0unk3dYLgIp670699Xm+aFdSvhlg420GV9T5kv3O+E5RYbyYv86Nt2lJT97Ri0UKcJGA8pUM3nawiYLx8pZtZqTjkSPkivbMHjY/CAyDzXPd7hr6nrUg5UQu08OXsBKrcqeu9BtqtWoB5bt5vkUAJEzooaOyDoLbwNgKSzvyKDpmPZfaX6GtxrTC+71VZWVFUayRTNZ8hEnnGh4v2lDx95N1aadaKSLBTt0YAqiKEUxVrJMJvcJCPgAv8M3oMO3gzZahF38FropV/Lf1uqHxTDSDAksYzMgyfogpy/PD7V+mVtOrKZyRrfM23HMGpxP4DLQLg==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
- Cc: julien@xxxxxxx, sstabellini@xxxxxxxxxx, oleksandr_tyshchenko@xxxxxxxx, volodymyr_babchuk@xxxxxxxx, artem_mygaiev@xxxxxxxx, roger.pau@xxxxxxxxxx, andrew.cooper3@xxxxxxxxxx, george.dunlap@xxxxxxxxxx, paul@xxxxxxx, bertrand.marquis@xxxxxxx, rahul.singh@xxxxxxx, Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- Delivery-date: Mon, 07 Feb 2022 17:06:28 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
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 ...
> @@ -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.
Jan
|