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

RE: [PATCH v4 20/21] VT-d: fold iommu_flush_iotlb{,_pages}()


  • To: "Beulich, Jan" <JBeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: "Tian, Kevin" <kevin.tian@xxxxxxxxx>
  • Date: Wed, 27 Apr 2022 04:12:15 +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=V2idaFxucHiJGDXQSdaMMES8a8n6WWlBDcoqFbA5KEU=; b=KkKrSY/JDVLSieQrCzmbdqUqExX4FxznUZJu8kRc36za2bny655Qwpq+BdUp/Bm84uEnBMhqJbvQoQpGDQQYlDMJptImhn8e0NYkQwGJVaoO9V2af/ycW7AzgFjsKmyBZw9Vioxx9dnJqnersrzYVP/Ub10u7G/FDtjghO3oTCczwsj/33Kl+zDEQ2mpFmIao7niGRpze23NHeqJg901OsXpHMp8t3sJeZqgrww5F7SxLeWYw2yNDhfB4HgUsHs9P3S0HsVIpAEFMe/fW5rvbj2nK3XJuirvFVi8iEz0c2XrCSr7Z38k7ECZnZe1mpqL3x6ygE1DgFrSJ02jRHbCAQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LBMIMU9MKCWTx12g9jQmq+rxMmBH5uCWl0n4L1GfqvCYBtuhDDZgTS5VBcyEKjtWZJY1V7LM1vsgAIY8o5vSX3dc9PgLJzO+sTXFaiN8yFTN4qzdDArUMGVM2YM9qkxfbkUxfbwtI5K4UQdsO7L4B8AjDskIm/WHZ29iECKrubdhCHJSd4Cfd8hTzhNqDj2nwu98baG2X7C76KeCjTjn4A0E5icnO7AYd+KOLpMULSo8VPXCqfbtK3vzw3y6xFjG1wKJL7SYsZ6qys6b8dfohEvvgkT3PRfJcHlhRbug0+fdUvd/ayHWgP/PNkoRoL+wr7EqQGyNy0TcBFICX0wbTw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com;
  • Cc: "Cooper, Andrew" <andrew.cooper3@xxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Pau Monné, Roger <roger.pau@xxxxxxxxxx>
  • Delivery-date: Wed, 27 Apr 2022 04:12:32 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHYWIC6Eez4ojrFhkKf16nX7g3O4a0DKNrw
  • Thread-topic: [PATCH v4 20/21] VT-d: fold iommu_flush_iotlb{,_pages}()

> From: Jan Beulich <jbeulich@xxxxxxxx>
> Sent: Monday, April 25, 2022 4:45 PM
> 
> With iommu_flush_iotlb_all() gone, iommu_flush_iotlb_pages() is merely a
> wrapper around the not otherwise called iommu_flush_iotlb(). Fold both
> functions.
> 
> No functional change intended.
> 
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>

> ---
> v4: New.
> 
> --- a/xen/drivers/passthrough/vtd/iommu.c
> +++ b/xen/drivers/passthrough/vtd/iommu.c
> @@ -728,9 +728,9 @@ static int __must_check iommu_flush_all(
>      return rc;
>  }
> 
> -static int __must_check iommu_flush_iotlb(struct domain *d, dfn_t dfn,
> -                                          bool_t dma_old_pte_present,
> -                                          unsigned long page_count)
> +static int __must_check cf_check iommu_flush_iotlb(struct domain *d,
> dfn_t dfn,
> +                                                   unsigned long page_count,
> +                                                   unsigned int flush_flags)
>  {
>      struct domain_iommu *hd = dom_iommu(d);
>      struct acpi_drhd_unit *drhd;
> @@ -739,6 +739,17 @@ static int __must_check iommu_flush_iotl
>      int iommu_domid;
>      int ret = 0;
> 
> +    if ( flush_flags & IOMMU_FLUSHF_all )
> +    {
> +        dfn = INVALID_DFN;
> +        page_count = 0;
> +    }
> +    else
> +    {
> +        ASSERT(page_count && !dfn_eq(dfn, INVALID_DFN));
> +        ASSERT(flush_flags);
> +    }
> +
>      /*
>       * No need pcideves_lock here because we have flush
>       * when assign/deassign device
> @@ -765,7 +776,7 @@ static int __must_check iommu_flush_iotl
>              rc = iommu_flush_iotlb_psi(iommu, iommu_domid,
>                                         dfn_to_daddr(dfn),
>                                         get_order_from_pages(page_count),
> -                                       !dma_old_pte_present,
> +                                       !(flush_flags & 
> IOMMU_FLUSHF_modified),
>                                         flush_dev_iotlb);
> 
>          if ( rc > 0 )
> @@ -777,25 +788,6 @@ static int __must_check iommu_flush_iotl
>      return ret;
>  }
> 
> -static int __must_check cf_check iommu_flush_iotlb_pages(
> -    struct domain *d, dfn_t dfn, unsigned long page_count,
> -    unsigned int flush_flags)
> -{
> -    if ( flush_flags & IOMMU_FLUSHF_all )
> -    {
> -        dfn = INVALID_DFN;
> -        page_count = 0;
> -    }
> -    else
> -    {
> -        ASSERT(page_count && !dfn_eq(dfn, INVALID_DFN));
> -        ASSERT(flush_flags);
> -    }
> -
> -    return iommu_flush_iotlb(d, dfn, flush_flags & IOMMU_FLUSHF_modified,
> -                             page_count);
> -}
> -
>  static void queue_free_pt(struct domain_iommu *hd, mfn_t mfn, unsigned
> int level)
>  {
>      if ( level > 1 )
> @@ -3254,7 +3246,7 @@ static const struct iommu_ops __initcons
>      .suspend = vtd_suspend,
>      .resume = vtd_resume,
>      .crash_shutdown = vtd_crash_shutdown,
> -    .iotlb_flush = iommu_flush_iotlb_pages,
> +    .iotlb_flush = iommu_flush_iotlb,
>      .get_reserved_device_memory =
> intel_iommu_get_reserved_device_memory,
>      .dump_page_tables = vtd_dump_page_tables,
>  };


 


Rackspace

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