[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [PATCH 4/8] VT-d: refuse to use IOMMU with reserved CAP.ND value
- To: "Beulich, Jan" <JBeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: "Tian, Kevin" <kevin.tian@xxxxxxxxx>
- Date: Wed, 20 Apr 2022 06:23:11 +0000
- Accept-language: en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; 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=+oUTanEnh2AObnHMuWR4ZPdXYH+k9bN76JETz2KqUek=; b=AOEkKmLlfBb1I+/LvtIQJodwmGScI8ZgZjoEmUVhTdNb5RuLSWAm82VQWTpseA5Yb5clcFRbwl2f7Jwr2qkeSv2D37ieApGuM/BceCvrThPqmZzT259TEwBw0M14SXpni5lKTREqwCkZemaXEqA2yqQTuUjDdQM4wzS1W5oYZIA1+8hEUIHY+FL5NGmWtrdTKhw/8H26EzUgftz9HoYzNgjvNuD/Q4pSlJTXZKlxFgd6z903fxHoGaurV19TAdc5LfFXuTKRs9ZRrYPx+hLidM9v5ayhgqrx6unieGKgzjHxsG9UOW/6AzfCHoSPs1oWrAIm3OJPpZtBqowfkpGOyw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l2GQ/030/ccWmP2IEf+/KYzyg1U/fjaUlQObA9/uCYV87nZuMX2vif3ZufqWQbJyCiy7I6r9fvmtN86Btz1z4/MWCdVNnIG3nD0P2wgBUjIYLT8kZKlOg3IEZn+Y8ljZDrrRk+JSDtE/rEQrEubGdA6FcKQYG4omiq4PzboR2W9Vv+RiR2975Ik8PtHTOg4MjgEoohjVcLg9olHiJrJpVKuQg6sZFbc3bkXG8Ouh+CIZA1ZQZAS2h+XMgGX0lkD/4Zs3+gCxeH1DuJPNeTch2x8+3iOfa4KmBCOQOkz7yyUWYGZ4Uvlxrv6ehn0blTY9tqwlX0Paw2qx9rJSj5hIJA==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com;
- Cc: Paul Durrant <paul@xxxxxxx>, Pau Monné, Roger <roger.pau@xxxxxxxxxx>
- Delivery-date: Wed, 20 Apr 2022 06:23:19 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHYTYfNLLeYzKkfHkCJpFNUAy97oqz4YdEw
- Thread-topic: [PATCH 4/8] VT-d: refuse to use IOMMU with reserved CAP.ND value
> From: Jan Beulich <jbeulich@xxxxxxxx>
> Sent: Monday, April 11, 2022 5:37 PM
>
> The field taking the value 7 (resulting in 18-bit DIDs when using the
> calculation in cap_ndoms(), when the DID fields are only 16 bits wide)
> is reserved. Instead of misbehaving in case we would encounter such an
> IOMMU, refuse to use it.
>
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>
>
> --- a/xen/drivers/passthrough/vtd/iommu.c
> +++ b/xen/drivers/passthrough/vtd/iommu.c
> @@ -1267,8 +1267,11 @@ int __init iommu_alloc(struct acpi_drhd_
>
> quirk_iommu_caps(iommu);
>
> + nr_dom = cap_ndoms(iommu->cap);
> +
> if ( cap_fault_reg_offset(iommu->cap) +
> cap_num_fault_regs(iommu->cap) * PRIMARY_FAULT_REG_LEN >
> PAGE_SIZE ||
> + ((nr_dom - 1) >> 16) /* I.e. cap.nd > 6 */ ||
> (has_register_based_invalidation(iommu) &&
> ecap_iotlb_offset(iommu->ecap) >= PAGE_SIZE) )
> {
> @@ -1294,8 +1297,6 @@ int __init iommu_alloc(struct acpi_drhd_
> if ( !ecap_coherent(iommu->ecap) )
> iommu_non_coherent = true;
>
> - nr_dom = cap_ndoms(iommu->cap);
> -
> if ( nr_dom <= DOMID_MASK * 2 + cap_caching_mode(iommu->cap) )
> {
> /* Allocate domain id (bit) maps. */
|