All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Handle init_iova_flush_queue failure in dma-iommu path
@ 2020-09-10 12:25 ` Tom Murphy
  0 siblings, 0 replies; 8+ messages in thread
From: Tom Murphy @ 2020-09-10 12:25 UTC (permalink / raw)
  To: iommu; +Cc: Tom Murphy, Joerg Roedel, linux-kernel

init_iova_flush_queue can fail if we run out of memory. Fall back to noflush
 queue if it fails.

Signed-off-by: Tom Murphy <murphyt7@tcd.ie>
---
 drivers/iommu/dma-iommu.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
index 4959f5df21bd..5f69126f3e91 100644
--- a/drivers/iommu/dma-iommu.c
+++ b/drivers/iommu/dma-iommu.c
@@ -343,8 +343,11 @@ static int iommu_dma_init_domain(struct iommu_domain *domain, dma_addr_t base,
 
 	if (!cookie->fq_domain && !iommu_domain_get_attr(domain,
 			DOMAIN_ATTR_DMA_USE_FLUSH_QUEUE, &attr) && attr) {
-		cookie->fq_domain = domain;
-		init_iova_flush_queue(iovad, iommu_dma_flush_iotlb_all, NULL);
+		if (init_iova_flush_queue(iovad, iommu_dma_flush_iotlb_all,
+					NULL))
+			pr_warn("iova flush queue initialization failed\n");
+		else
+			cookie->fq_domain = domain;
 	}
 
 	if (!dev)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] Handle init_iova_flush_queue failure in dma-iommu path
@ 2020-09-10 12:25 ` Tom Murphy
  0 siblings, 0 replies; 8+ messages in thread
From: Tom Murphy @ 2020-09-10 12:25 UTC (permalink / raw)
  To: iommu; +Cc: linux-kernel, Tom Murphy

init_iova_flush_queue can fail if we run out of memory. Fall back to noflush
 queue if it fails.

Signed-off-by: Tom Murphy <murphyt7@tcd.ie>
---
 drivers/iommu/dma-iommu.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
index 4959f5df21bd..5f69126f3e91 100644
--- a/drivers/iommu/dma-iommu.c
+++ b/drivers/iommu/dma-iommu.c
@@ -343,8 +343,11 @@ static int iommu_dma_init_domain(struct iommu_domain *domain, dma_addr_t base,
 
 	if (!cookie->fq_domain && !iommu_domain_get_attr(domain,
 			DOMAIN_ATTR_DMA_USE_FLUSH_QUEUE, &attr) && attr) {
-		cookie->fq_domain = domain;
-		init_iova_flush_queue(iovad, iommu_dma_flush_iotlb_all, NULL);
+		if (init_iova_flush_queue(iovad, iommu_dma_flush_iotlb_all,
+					NULL))
+			pr_warn("iova flush queue initialization failed\n");
+		else
+			cookie->fq_domain = domain;
 	}
 
 	if (!dev)
-- 
2.20.1

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] Handle init_iova_flush_queue failure in dma-iommu path
  2020-09-10 12:25 ` Tom Murphy
@ 2020-09-18  8:55   ` Joerg Roedel
  -1 siblings, 0 replies; 8+ messages in thread
From: Joerg Roedel @ 2020-09-18  8:55 UTC (permalink / raw)
  To: Tom Murphy, Robin Murphy; +Cc: iommu, linux-kernel

On Thu, Sep 10, 2020 at 01:25:38PM +0100, Tom Murphy wrote:
> init_iova_flush_queue can fail if we run out of memory. Fall back to noflush
>  queue if it fails.
> 
> Signed-off-by: Tom Murphy <murphyt7@tcd.ie>
> ---
>  drivers/iommu/dma-iommu.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
> index 4959f5df21bd..5f69126f3e91 100644
> --- a/drivers/iommu/dma-iommu.c
> +++ b/drivers/iommu/dma-iommu.c
> @@ -343,8 +343,11 @@ static int iommu_dma_init_domain(struct iommu_domain *domain, dma_addr_t base,
>  
>  	if (!cookie->fq_domain && !iommu_domain_get_attr(domain,
>  			DOMAIN_ATTR_DMA_USE_FLUSH_QUEUE, &attr) && attr) {
> -		cookie->fq_domain = domain;
> -		init_iova_flush_queue(iovad, iommu_dma_flush_iotlb_all, NULL);
> +		if (init_iova_flush_queue(iovad, iommu_dma_flush_iotlb_all,
> +					NULL))
> +			pr_warn("iova flush queue initialization failed\n");
> +		else
> +			cookie->fq_domain = domain;
>  	}
>  
>  	if (!dev)

Looks good to me, but Robin should also have a look.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Handle init_iova_flush_queue failure in dma-iommu path
@ 2020-09-18  8:55   ` Joerg Roedel
  0 siblings, 0 replies; 8+ messages in thread
From: Joerg Roedel @ 2020-09-18  8:55 UTC (permalink / raw)
  To: Tom Murphy, Robin Murphy; +Cc: iommu, linux-kernel

On Thu, Sep 10, 2020 at 01:25:38PM +0100, Tom Murphy wrote:
> init_iova_flush_queue can fail if we run out of memory. Fall back to noflush
>  queue if it fails.
> 
> Signed-off-by: Tom Murphy <murphyt7@tcd.ie>
> ---
>  drivers/iommu/dma-iommu.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
> index 4959f5df21bd..5f69126f3e91 100644
> --- a/drivers/iommu/dma-iommu.c
> +++ b/drivers/iommu/dma-iommu.c
> @@ -343,8 +343,11 @@ static int iommu_dma_init_domain(struct iommu_domain *domain, dma_addr_t base,
>  
>  	if (!cookie->fq_domain && !iommu_domain_get_attr(domain,
>  			DOMAIN_ATTR_DMA_USE_FLUSH_QUEUE, &attr) && attr) {
> -		cookie->fq_domain = domain;
> -		init_iova_flush_queue(iovad, iommu_dma_flush_iotlb_all, NULL);
> +		if (init_iova_flush_queue(iovad, iommu_dma_flush_iotlb_all,
> +					NULL))
> +			pr_warn("iova flush queue initialization failed\n");
> +		else
> +			cookie->fq_domain = domain;
>  	}
>  
>  	if (!dev)

Looks good to me, but Robin should also have a look.
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Handle init_iova_flush_queue failure in dma-iommu path
  2020-09-18  8:55   ` Joerg Roedel
@ 2020-09-18 13:51     ` Robin Murphy
  -1 siblings, 0 replies; 8+ messages in thread
From: Robin Murphy @ 2020-09-18 13:51 UTC (permalink / raw)
  To: Joerg Roedel, Tom Murphy; +Cc: iommu, linux-kernel

On 2020-09-18 09:55, Joerg Roedel wrote:
> On Thu, Sep 10, 2020 at 01:25:38PM +0100, Tom Murphy wrote:
>> init_iova_flush_queue can fail if we run out of memory. Fall back to noflush
>>   queue if it fails.
>>
>> Signed-off-by: Tom Murphy <murphyt7@tcd.ie>
>> ---
>>   drivers/iommu/dma-iommu.c | 7 +++++--
>>   1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
>> index 4959f5df21bd..5f69126f3e91 100644
>> --- a/drivers/iommu/dma-iommu.c
>> +++ b/drivers/iommu/dma-iommu.c
>> @@ -343,8 +343,11 @@ static int iommu_dma_init_domain(struct iommu_domain *domain, dma_addr_t base,
>>   
>>   	if (!cookie->fq_domain && !iommu_domain_get_attr(domain,
>>   			DOMAIN_ATTR_DMA_USE_FLUSH_QUEUE, &attr) && attr) {
>> -		cookie->fq_domain = domain;
>> -		init_iova_flush_queue(iovad, iommu_dma_flush_iotlb_all, NULL);
>> +		if (init_iova_flush_queue(iovad, iommu_dma_flush_iotlb_all,
>> +					NULL))
>> +			pr_warn("iova flush queue initialization failed\n");
>> +		else
>> +			cookie->fq_domain = domain;
>>   	}
>>   
>>   	if (!dev)
> 
> Looks good to me, but Robin should also have a look.

Yup, seems reasonable, thanks Tom!

Reviewed-by: Robin Murphy <robin.murphy@arm.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Handle init_iova_flush_queue failure in dma-iommu path
@ 2020-09-18 13:51     ` Robin Murphy
  0 siblings, 0 replies; 8+ messages in thread
From: Robin Murphy @ 2020-09-18 13:51 UTC (permalink / raw)
  To: Joerg Roedel, Tom Murphy; +Cc: iommu, linux-kernel

On 2020-09-18 09:55, Joerg Roedel wrote:
> On Thu, Sep 10, 2020 at 01:25:38PM +0100, Tom Murphy wrote:
>> init_iova_flush_queue can fail if we run out of memory. Fall back to noflush
>>   queue if it fails.
>>
>> Signed-off-by: Tom Murphy <murphyt7@tcd.ie>
>> ---
>>   drivers/iommu/dma-iommu.c | 7 +++++--
>>   1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
>> index 4959f5df21bd..5f69126f3e91 100644
>> --- a/drivers/iommu/dma-iommu.c
>> +++ b/drivers/iommu/dma-iommu.c
>> @@ -343,8 +343,11 @@ static int iommu_dma_init_domain(struct iommu_domain *domain, dma_addr_t base,
>>   
>>   	if (!cookie->fq_domain && !iommu_domain_get_attr(domain,
>>   			DOMAIN_ATTR_DMA_USE_FLUSH_QUEUE, &attr) && attr) {
>> -		cookie->fq_domain = domain;
>> -		init_iova_flush_queue(iovad, iommu_dma_flush_iotlb_all, NULL);
>> +		if (init_iova_flush_queue(iovad, iommu_dma_flush_iotlb_all,
>> +					NULL))
>> +			pr_warn("iova flush queue initialization failed\n");
>> +		else
>> +			cookie->fq_domain = domain;
>>   	}
>>   
>>   	if (!dev)
> 
> Looks good to me, but Robin should also have a look.

Yup, seems reasonable, thanks Tom!

Reviewed-by: Robin Murphy <robin.murphy@arm.com>
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Handle init_iova_flush_queue failure in dma-iommu path
  2020-09-10 12:25 ` Tom Murphy
@ 2020-09-18 15:14   ` Joerg Roedel
  -1 siblings, 0 replies; 8+ messages in thread
From: Joerg Roedel @ 2020-09-18 15:14 UTC (permalink / raw)
  To: Tom Murphy; +Cc: iommu, linux-kernel

On Thu, Sep 10, 2020 at 01:25:38PM +0100, Tom Murphy wrote:
> init_iova_flush_queue can fail if we run out of memory. Fall back to noflush
>  queue if it fails.
> 
> Signed-off-by: Tom Murphy <murphyt7@tcd.ie>
> ---
>  drivers/iommu/dma-iommu.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)

Applied, thanks Tom.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Handle init_iova_flush_queue failure in dma-iommu path
@ 2020-09-18 15:14   ` Joerg Roedel
  0 siblings, 0 replies; 8+ messages in thread
From: Joerg Roedel @ 2020-09-18 15:14 UTC (permalink / raw)
  To: Tom Murphy; +Cc: iommu, linux-kernel

On Thu, Sep 10, 2020 at 01:25:38PM +0100, Tom Murphy wrote:
> init_iova_flush_queue can fail if we run out of memory. Fall back to noflush
>  queue if it fails.
> 
> Signed-off-by: Tom Murphy <murphyt7@tcd.ie>
> ---
>  drivers/iommu/dma-iommu.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)

Applied, thanks Tom.

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-09-18 15:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-10 12:25 [PATCH] Handle init_iova_flush_queue failure in dma-iommu path Tom Murphy
2020-09-10 12:25 ` Tom Murphy
2020-09-18  8:55 ` Joerg Roedel
2020-09-18  8:55   ` Joerg Roedel
2020-09-18 13:51   ` Robin Murphy
2020-09-18 13:51     ` Robin Murphy
2020-09-18 15:14 ` Joerg Roedel
2020-09-18 15:14   ` Joerg Roedel

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.