[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [PATCH 1/6] VT-d: properly reserve DID 0 for caching mode IOMMUs


  • To: Jan Beulich <jbeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: "Tian, Kevin" <kevin.tian@xxxxxxxxx>
  • Date: Mon, 15 Nov 2021 05:13:54 +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=7OvxWANLY4ZhdFsKuZCudz0CT8lIX9H8Zg1dwgSlKdQ=; b=gpc6yi2y8rFodNqDLGoHq292sU2D+cQLCng3MMo9NbKbFk05b43KO9OUv3J9aRriQtwwdvMS+vPIUuKVN0w18Lbgbg+6F5sVdqwjj1gHZvM1FlilHDapdJSxl7JFq0I/KFlqB3mV2A5/AdsbD8Zeiz47+B7nooHOSKB72p7A6GvXALDZM0od6Yhe5axubC3rH/SI1Ri545H22iPD7issW+g5U9zfn0EZe6UH2bkw3E5Nz7mXnTWpAl4taeB2a0p1iDLdG31BpUBIyV1jXAJCATP2X/m9dFZJn0NwXgEAXhFYr/GnlF0djt4D3FEXGYqz0ntU9DTc0yCYRx1l05iYVQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O36v7nDqOIFVgztKjZYKRMIvr2cW20kh4X1V9XexGFVz539C+i7lf7lOR55h2lkwzp+vip2209E7EV6lrOVFZ4qGE/UIeZFziXi7mwo6z5+mCvsgM3NRzyy0g43enwQ/wz9gMLHGQrl7cmAiAGBvgUEXXQxt9o/hevpMvvx4/AXtfQOEYSlaoU4L0IXfvVVWiwKcQVdrUcfddQvxRVPd1x5mv1GMAUgqmHngDl9HB4qi8xgpdKRrCCVBW5mcd6w04Pgry027P/4PQf+oa6CcLuBp6DJS0PZWF/J4RksAKIKOhiulsa7HVCTygzMUsoeowGyH6plChY55THsvTlT2jg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com;
  • Delivery-date: Mon, 15 Nov 2021 05:14:04 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHX16ptxP2kemn3HkOptj6NHfmn+qwED8FA
  • Thread-topic: [PATCH 1/6] VT-d: properly reserve DID 0 for caching mode IOMMUs

> From: Jan Beulich <jbeulich@xxxxxxxx>
> Sent: Friday, November 12, 2021 5:48 PM
> 
> Merely setting bit 0 in the bitmap is insufficient, as then Dom0 will
> still have DID 0 allocated to it, because of the zero-filling of
> domid_map[]. Set slot 0 to DOMID_INVALID to keep DID 0 from getting
> used.
> 
> Fixes: b9c20c78789f ("VT-d: per-iommu domain-id")
> 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
> @@ -1257,16 +1257,19 @@ int __init iommu_alloc(struct acpi_drhd_
>      if ( !iommu->domid_bitmap )
>          return -ENOMEM;
> 
> +    iommu->domid_map = xzalloc_array(u16, nr_dom);
> +    if ( !iommu->domid_map )
> +        return -ENOMEM;
> +
>      /*
> -     * if Caching mode is set, then invalid translations are tagged with
> -     * domain id 0, Hence reserve bit 0 for it
> +     * If Caching mode is set, then invalid translations are tagged with
> +     * domain id 0. Hence reserve bit/slot 0.
>       */
>      if ( cap_caching_mode(iommu->cap) )
> +    {
> +        iommu->domid_map[0] = DOMID_INVALID;
>          __set_bit(0, iommu->domid_bitmap);
> -
> -    iommu->domid_map = xzalloc_array(u16, nr_dom);
> -    if ( !iommu->domid_map )
> -        return -ENOMEM;
> +    }
> 
>      return 0;
>  }


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.