[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v11 10/17] vpci/header: handle p2m range sets per BAR
- To: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
- Date: Tue, 2 Jan 2024 16:31:52 -0500
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=epam.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
- 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=XG6vUQ6DENq+W56RI8NWXjugR1dCYi6z16wlbBg63yk=; b=YLr4maTLU6Qs0m92uYxz4GJaSgvV3utuMFqDJN5Dv0+PJ8Fbu/FQnRhm5HmdlRYnjnXYPYJyQNpvca6EK5Lcy5nNTBZuaWY+K6kqZIGg3O8Wlj2gd2S1p+XgdLElIAk1i4XSh/dOdIyNxLa3aBlOI3l5S3eaoZhLQZ9dzNCxFIytkEaSUu7YZfv0txexjCFxLK75mxg3aoYmHmo/B11i8yD0l2JqYBYYUGI17FVRjoCO3gx3tfoMYPeUMhPSUkkZnFUz87q0f6DOGqyGNQXZ/JOr6MXiywsEdK2HNSYZKZZNAgLbrx2XD8veiA318CKQQnH9UnosmWUhKnPZcf4GgA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ylb/4QdCh2smlKSVcrNYh43YusqbLvF2R6YMWAhH1R1U5QgIH0HJI7p7As1CioIzJq2meBgy+x0L5tkGWeD6A3kv38nBf9jHnjKvbLieFp54Xm2lxrds1u+uhc9Am9/W5yckQyTDh1RRMbnevoSpggxNaiXDKqpKevSOCIHkvcGfdSY6/meoP+h3xWwkCQ51frHhFAxDwp/NVqNVFPfIPONeciSR4ORBdXLvHWLAVNKt/kIS+v6bMZWRWBk0xWrK0nKH8ZP7SydVzHFsyVGWyTVG/AhlfouFW9MiXo3N0BW2Tj7hckhQqw8W8pgQYfzMzDGqKc0QhlkDHK52z1DzlA==
- Cc: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Delivery-date: Tue, 02 Jan 2024 21:32:17 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 12/1/23 20:27, Volodymyr Babchuk wrote:
> diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c
> index 43216429d9..7c84cee5d1 100644
> --- a/xen/drivers/vpci/header.c
> +++ b/xen/drivers/vpci/header.c
> @@ -598,6 +675,18 @@ static void cf_check rom_write(
> rom->addr = val & PCI_ROM_ADDRESS_MASK;
> }
>
> +static int bar_add_rangeset(const struct pci_dev *pdev, struct vpci_bar *bar,
> + unsigned int i)
> +{
> + char str[32];
> +
> + snprintf(str, sizeof(str), "%pp:BAR%u", &pdev->sbdf, i);
> +
> + bar->mem = rangeset_new(pdev->domain, str, RANGESETF_no_print);
> +
> + return !bar->mem ? -ENOMEM : 0;
> +}
> +
> static int cf_check init_bars(struct pci_dev *pdev)
> {
> uint16_t cmd;
> @@ -679,6 +768,10 @@ static int cf_check init_bars(struct pci_dev *pdev)
> else
> bars[i].type = VPCI_BAR_MEM32;
>
> + rc = bar_add_rangeset(pdev, &bars[i], i);
> + if ( rc )
> + goto fail;
> +
> rc = pci_size_mem_bar(pdev->sbdf, reg, &addr, &size,
> (i == num_bars - 1) ? PCI_BAR_LAST : 0);
> if ( rc < 0 )
> @@ -728,6 +821,12 @@ static int cf_check init_bars(struct pci_dev *pdev)
> rom_reg, 4, rom);
> if ( rc )
> rom->type = VPCI_BAR_EMPTY;
> + else
> + {
> + rc = bar_add_rangeset(pdev, rom, i);
Although purely cosmetic, it looks like this should use num_bars, not i.
> + if ( rc )
> + goto fail;
> + }
> }
> }
> else
|