All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lu Baolu <baolu.lu@linux.intel.com>
To: Tom Murphy <murphyt7@tcd.ie>, iommu@lists.linux-foundation.org
Cc: David Woodhouse <dwmw2@infradead.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH V2 2/5] iommu: Add iommu_dma_free_cpu_cached_iovas function
Date: Wed, 9 Sep 2020 08:45:34 +0800	[thread overview]
Message-ID: <b30be538-a4dd-987e-78df-ff23b703bbe3@linux.intel.com> (raw)
In-Reply-To: <20200903201839.7327-3-murphyt7@tcd.ie>

On 9/4/20 4:18 AM, Tom Murphy wrote:
> to dma-iommu ops
> 
> Add a iommu_dma_free_cpu_cached_iovas function to allow drivers which
> use the dma-iommu ops to free cached cpu iovas.
> 
> Signed-off-by: Tom Murphy <murphyt7@tcd.ie>
> ---
>   drivers/iommu/dma-iommu.c | 9 +++++++++
>   include/linux/dma-iommu.h | 3 +++
>   2 files changed, 12 insertions(+)
> 
> diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
> index f69dc9467d71..33f3f4f5edc5 100644
> --- a/drivers/iommu/dma-iommu.c
> +++ b/drivers/iommu/dma-iommu.c
> @@ -50,6 +50,15 @@ struct iommu_dma_cookie {
>   	struct iommu_domain		*fq_domain;
>   };
>   
> +void iommu_dma_free_cpu_cached_iovas(unsigned int cpu,
> +		struct iommu_domain *domain)
> +{
> +	struct iommu_dma_cookie *cookie = domain->iova_cookie;
> +	struct iova_domain *iovad = &cookie->iovad;
> +
> +	free_cpu_cached_iovas(cpu, iovad);
> +}
> +
>   static void iommu_dma_entry_dtor(unsigned long data)
>   {
>   	struct page *freelist = (struct page *)data;
> diff --git a/include/linux/dma-iommu.h b/include/linux/dma-iommu.h
> index 2112f21f73d8..316d22a4a860 100644
> --- a/include/linux/dma-iommu.h
> +++ b/include/linux/dma-iommu.h
> @@ -37,6 +37,9 @@ void iommu_dma_compose_msi_msg(struct msi_desc *desc,
>   
>   void iommu_dma_get_resv_regions(struct device *dev, struct list_head *list);
>   
> +void iommu_dma_free_cpu_cached_iovas(unsigned int cpu,
> +		struct iommu_domain *domain);
> +
>   #else /* CONFIG_IOMMU_DMA */
>   
>   struct iommu_domain;
> 

I will add below in the next version:

diff --git a/include/linux/dma-iommu.h b/include/linux/dma-iommu.h
index 37df037788f0..ab4bffea3aaa 100644
--- a/include/linux/dma-iommu.h
+++ b/include/linux/dma-iommu.h
@@ -81,5 +81,10 @@ static inline void iommu_dma_get_resv_regions(struct 
device *dev, struct list_he
  {
  }

+static inline void iommu_dma_free_cpu_cached_iovas(unsigned int cpu,
+                                                  struct iommu_domain 
*domain)
+{
+}
+
  #endif /* CONFIG_IOMMU_DMA */
  #endif /* __DMA_IOMMU_H */

Others looks good to me.

Best regards,
baolu
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

WARNING: multiple messages have this Message-ID (diff)
From: Lu Baolu <baolu.lu@linux.intel.com>
To: Tom Murphy <murphyt7@tcd.ie>, iommu@lists.linux-foundation.org
Cc: baolu.lu@linux.intel.com, Joerg Roedel <joro@8bytes.org>,
	David Woodhouse <dwmw2@infradead.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH V2 2/5] iommu: Add iommu_dma_free_cpu_cached_iovas function
Date: Wed, 9 Sep 2020 08:45:34 +0800	[thread overview]
Message-ID: <b30be538-a4dd-987e-78df-ff23b703bbe3@linux.intel.com> (raw)
In-Reply-To: <20200903201839.7327-3-murphyt7@tcd.ie>

On 9/4/20 4:18 AM, Tom Murphy wrote:
> to dma-iommu ops
> 
> Add a iommu_dma_free_cpu_cached_iovas function to allow drivers which
> use the dma-iommu ops to free cached cpu iovas.
> 
> Signed-off-by: Tom Murphy <murphyt7@tcd.ie>
> ---
>   drivers/iommu/dma-iommu.c | 9 +++++++++
>   include/linux/dma-iommu.h | 3 +++
>   2 files changed, 12 insertions(+)
> 
> diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
> index f69dc9467d71..33f3f4f5edc5 100644
> --- a/drivers/iommu/dma-iommu.c
> +++ b/drivers/iommu/dma-iommu.c
> @@ -50,6 +50,15 @@ struct iommu_dma_cookie {
>   	struct iommu_domain		*fq_domain;
>   };
>   
> +void iommu_dma_free_cpu_cached_iovas(unsigned int cpu,
> +		struct iommu_domain *domain)
> +{
> +	struct iommu_dma_cookie *cookie = domain->iova_cookie;
> +	struct iova_domain *iovad = &cookie->iovad;
> +
> +	free_cpu_cached_iovas(cpu, iovad);
> +}
> +
>   static void iommu_dma_entry_dtor(unsigned long data)
>   {
>   	struct page *freelist = (struct page *)data;
> diff --git a/include/linux/dma-iommu.h b/include/linux/dma-iommu.h
> index 2112f21f73d8..316d22a4a860 100644
> --- a/include/linux/dma-iommu.h
> +++ b/include/linux/dma-iommu.h
> @@ -37,6 +37,9 @@ void iommu_dma_compose_msi_msg(struct msi_desc *desc,
>   
>   void iommu_dma_get_resv_regions(struct device *dev, struct list_head *list);
>   
> +void iommu_dma_free_cpu_cached_iovas(unsigned int cpu,
> +		struct iommu_domain *domain);
> +
>   #else /* CONFIG_IOMMU_DMA */
>   
>   struct iommu_domain;
> 

I will add below in the next version:

diff --git a/include/linux/dma-iommu.h b/include/linux/dma-iommu.h
index 37df037788f0..ab4bffea3aaa 100644
--- a/include/linux/dma-iommu.h
+++ b/include/linux/dma-iommu.h
@@ -81,5 +81,10 @@ static inline void iommu_dma_get_resv_regions(struct 
device *dev, struct list_he
  {
  }

+static inline void iommu_dma_free_cpu_cached_iovas(unsigned int cpu,
+                                                  struct iommu_domain 
*domain)
+{
+}
+
  #endif /* CONFIG_IOMMU_DMA */
  #endif /* __DMA_IOMMU_H */

Others looks good to me.

Best regards,
baolu

  reply	other threads:[~2020-09-09  0:51 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-03 20:18 [PATCH V2 0/5] Convert the intel iommu driver to the dma-iommu api Tom Murphy
2020-09-03 20:18 ` Tom Murphy
2020-09-03 20:18 ` [PATCH V2 1/5] iommu: Handle freelists when using deferred flushing in iommu drivers Tom Murphy
2020-09-03 20:18   ` Tom Murphy
2020-09-03 20:18 ` [PATCH V2 2/5] iommu: Add iommu_dma_free_cpu_cached_iovas function Tom Murphy
2020-09-03 20:18   ` Tom Murphy
2020-09-09  0:45   ` Lu Baolu [this message]
2020-09-09  0:45     ` Lu Baolu
2020-09-09  7:05     ` Christoph Hellwig
2020-09-09  7:05       ` Christoph Hellwig
2020-09-12  2:55       ` Lu Baolu
2020-09-12  2:55         ` Lu Baolu
2020-09-03 20:18 ` [PATCH V2 3/5] iommu: allow the dma-iommu api to use bounce buffers Tom Murphy
2020-09-03 20:18   ` Tom Murphy
2020-09-09  1:34   ` Lu Baolu
2020-09-03 20:18 ` [PATCH V2 4/5] iommu/vt-d: Convert intel iommu driver to the iommu ops Tom Murphy
2020-09-03 20:18   ` Tom Murphy
2020-09-09  1:59   ` Lu Baolu
2020-09-09  1:59     ` Lu Baolu
2020-09-03 20:18 ` [PATCH V2 5/5] DO NOT MERGE: iommu: disable list appending in dma-iommu Tom Murphy
2020-09-03 20:18   ` Tom Murphy
2020-09-07  7:00   ` [Intel-gfx] " Christoph Hellwig
2020-09-07  7:00     ` Christoph Hellwig
2020-09-07  7:00     ` Christoph Hellwig
2020-09-07 20:18     ` [Intel-gfx] " Tom Murphy
2020-09-07 20:18       ` Tom Murphy
2020-09-07 20:18       ` Tom Murphy
2020-09-08  5:36       ` [Intel-gfx] " Christoph Hellwig
2020-09-08  5:36         ` Christoph Hellwig
2020-09-08  5:36         ` Christoph Hellwig
2020-09-08  5:55         ` [Intel-gfx] " Christoph Hellwig
2020-09-08  5:55           ` Christoph Hellwig
2020-09-08  5:55           ` Christoph Hellwig
2020-09-08  6:04           ` [Intel-gfx] " Lu Baolu
2020-09-08  6:04             ` Lu Baolu
2020-09-08  6:04             ` Lu Baolu
2020-09-08  6:23             ` [Intel-gfx] " Christoph Hellwig
2020-09-08  6:23               ` Christoph Hellwig
2020-09-08  6:23               ` Christoph Hellwig
2020-09-08  9:07               ` [Intel-gfx] " Lu Baolu
2020-09-08  9:07                 ` Lu Baolu
2020-09-08  9:07                 ` Lu Baolu
2020-09-09  1:43               ` [Intel-gfx] " Lu Baolu
2020-09-09  1:43                 ` Lu Baolu
2020-09-09  1:43                 ` Lu Baolu
2020-09-09  7:06                 ` [Intel-gfx] " Christoph Hellwig
2020-09-09  7:06                   ` Christoph Hellwig
2020-09-09  7:06                   ` Christoph Hellwig
2020-09-12  3:13                   ` [Intel-gfx] " Lu Baolu
2020-09-12  3:13                     ` Lu Baolu
2020-09-12  3:13                     ` Lu Baolu
2020-09-04 10:03 ` [PATCH V2 0/5] Convert the intel iommu driver to the dma-iommu api Joerg Roedel
2020-09-04 10:03   ` Joerg Roedel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b30be538-a4dd-987e-78df-ff23b703bbe3@linux.intel.com \
    --to=baolu.lu@linux.intel.com \
    --cc=dwmw2@infradead.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=murphyt7@tcd.ie \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.