[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 6/6] xen/vpci: header: filter PCI capabilities
- To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
- Date: Mon, 28 Aug 2023 22:07:36 -0400
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org 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
- 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=y5tywCrlNdNA4Sw8X0tODm8GPgaTAvMQP4Zqy/xqcEo=; b=UDYiFIKml+NvFPgU+Fg52OIvwSZr0G96xQcCx9woY3WFLjh+UIfloNWTAfDD7CVxfcYMJdQnlNYFuPAGPR/l45ceKj2mTgx7segyUxk+doHSuKqXKwKXTAfpFhAP9kd8woP2dmNKryRrun+5IKZnRAog/cksHNOwNKsqD8iPzZEfa8jnKomq83Luy0ZQggs5BO1fFTfxplJuFqCqIgs2JJQfCslIzKjxhHq4TJClU1kDdaR6tNBRn3PZjz2UmUfzZKDGcEpPi9m0gI7SoLuQGfTc0TQdKVEkvKd4HrLbqcT3faMHUhZdR2Esy4On2xvk4Yu8kUl5rx9H7Jebq409QQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IlKouVS0sXD0AmHFz27fSPe9UkrYP8hSUUwFj117DIGmELmJcwGcg4Aoa7te0sjgG/TrJXdyw3sJ2RSFiu+dARft/muYc3CBx5d99bMpG8g2e6/RdvC1Wx3olGh73fVgejB/EciixE8ncfYvGD/K10/NmqnIjIW9UoQWia4c2I6cQgYqTIxpYOl3iQrW69mNDWDKciNOXW7WXXykyEZRtSCotyQs7XpRtYMqZSWQ/WJdC9KtAtQgYzocCBZ6wuGhCz/1RHrBnYnGEEVxfR29q7cQnRSD6cOmQaC2c/bdINyPjxyhrzCe5556Wgi/TpkC4muzLMFp+7m93B9NXlVTHQ==
- Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Delivery-date: Tue, 29 Aug 2023 02:08:09 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 8/28/23 13:56, Stewart Hildebrand wrote:
> diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c
> index 4a4dbb69ab1c..919addbfa630 100644
> --- a/xen/drivers/vpci/header.c
> +++ b/xen/drivers/vpci/header.c
> @@ -561,6 +573,71 @@ static int cf_check init_bars(struct pci_dev *pdev)
> if ( rc )
> return rc;
>
> + if ( !is_hardware_domain(pdev->domain) )
> + {
> + if ( !(pci_conf_read16(pdev->sbdf, PCI_STATUS) &
> PCI_STATUS_CAP_LIST) )
> + {
> + /* RAZ/WI */
> + rc = vpci_add_register(pdev->vpci, vpci_read_val, NULL,
> + PCI_CAPABILITY_LIST, 1, (void *)0);
> + if ( rc )
> + return rc;
> + }
> + else
> + {
> + /* Only expose capabilities to the guest that vPCI can handle. */
> + uint8_t next;
s/uint8_t/unsigned int/
> + unsigned int ttl = 48;
> +
> + next = pci_find_next_cap_ttl(pdev->sbdf, PCI_CAPABILITY_LIST,
> + vpci_cap_supported, 0, &ttl);
> +
> + rc = vpci_add_register(pdev->vpci, vpci_read_val, NULL,
> + PCI_CAPABILITY_LIST, 1,
> + (void *)(uintptr_t)next);
> + if ( rc )
> + return rc;
> +
> + next &= ~3;
> +
> + if ( !next )
> + /*
> + * If we don't have any supported capabilities to expose to
> the
> + * guest, mask the PCI_STATUS_CAP_LIST bit in the status
> + * register.
> + */
> + header->mask_cap_list = true;
> +
> + while ( next && ttl )
> + {
> + uint8_t pos = next;
s/uint8_t/unsigned int/
|