All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: emu10k1: Stop using iommu_present()
@ 2022-04-05 12:13 ` Robin Murphy
  0 siblings, 0 replies; 8+ messages in thread
From: Robin Murphy @ 2022-04-05 12:13 UTC (permalink / raw)
  To: perex, tiwai; +Cc: iommu, alsa-devel, linux-kernel

iommu_get_domain_for_dev() is already perfectly happy to return NULL
if the given device has no IOMMU. Drop the unnecessary check.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
---
 sound/pci/emu10k1/emu10k1_main.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
index 86cc1ca025e4..5ffab343b89c 100644
--- a/sound/pci/emu10k1/emu10k1_main.c
+++ b/sound/pci/emu10k1/emu10k1_main.c
@@ -1751,9 +1751,6 @@ static void snd_emu10k1_detect_iommu(struct snd_emu10k1 *emu)
 
 	emu->iommu_workaround = false;
 
-	if (!iommu_present(emu->card->dev->bus))
-		return;
-
 	domain = iommu_get_domain_for_dev(emu->card->dev);
 	if (domain && domain->type == IOMMU_DOMAIN_IDENTITY)
 		return;
-- 
2.28.0.dirty

_______________________________________________
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

* [PATCH] ALSA: emu10k1: Stop using iommu_present()
@ 2022-04-05 12:13 ` Robin Murphy
  0 siblings, 0 replies; 8+ messages in thread
From: Robin Murphy @ 2022-04-05 12:13 UTC (permalink / raw)
  To: perex, tiwai; +Cc: iommu, alsa-devel, linux-kernel

iommu_get_domain_for_dev() is already perfectly happy to return NULL
if the given device has no IOMMU. Drop the unnecessary check.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
---
 sound/pci/emu10k1/emu10k1_main.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
index 86cc1ca025e4..5ffab343b89c 100644
--- a/sound/pci/emu10k1/emu10k1_main.c
+++ b/sound/pci/emu10k1/emu10k1_main.c
@@ -1751,9 +1751,6 @@ static void snd_emu10k1_detect_iommu(struct snd_emu10k1 *emu)
 
 	emu->iommu_workaround = false;
 
-	if (!iommu_present(emu->card->dev->bus))
-		return;
-
 	domain = iommu_get_domain_for_dev(emu->card->dev);
 	if (domain && domain->type == IOMMU_DOMAIN_IDENTITY)
 		return;
-- 
2.28.0.dirty


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

* Re: [PATCH] ALSA: emu10k1: Stop using iommu_present()
  2022-04-05 12:13 ` Robin Murphy
  (?)
@ 2022-04-05 12:29   ` Takashi Iwai
  -1 siblings, 0 replies; 8+ messages in thread
From: Takashi Iwai @ 2022-04-05 12:29 UTC (permalink / raw)
  To: Robin Murphy; +Cc: linux-kernel, iommu, tiwai, alsa-devel, perex

On Tue, 05 Apr 2022 14:13:33 +0200,
Robin Murphy wrote:
> 
> iommu_get_domain_for_dev() is already perfectly happy to return NULL
> if the given device has no IOMMU. Drop the unnecessary check.
> 
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>

This will change the code behavior.  The current code does nothing if
no IOMMU is found, but after your removal of the check, the code
reaches to emu->iommu_workaround = true incorrectly.


thanks,

Takashi

> ---
>  sound/pci/emu10k1/emu10k1_main.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
> index 86cc1ca025e4..5ffab343b89c 100644
> --- a/sound/pci/emu10k1/emu10k1_main.c
> +++ b/sound/pci/emu10k1/emu10k1_main.c
> @@ -1751,9 +1751,6 @@ static void snd_emu10k1_detect_iommu(struct snd_emu10k1 *emu)
>  
>  	emu->iommu_workaround = false;
>  
> -	if (!iommu_present(emu->card->dev->bus))
> -		return;
> -
>  	domain = iommu_get_domain_for_dev(emu->card->dev);
>  	if (domain && domain->type == IOMMU_DOMAIN_IDENTITY)
>  		return;
> -- 
> 2.28.0.dirty
> 
_______________________________________________
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] ALSA: emu10k1: Stop using iommu_present()
@ 2022-04-05 12:29   ` Takashi Iwai
  0 siblings, 0 replies; 8+ messages in thread
From: Takashi Iwai @ 2022-04-05 12:29 UTC (permalink / raw)
  To: Robin Murphy; +Cc: linux-kernel, iommu, tiwai, alsa-devel

On Tue, 05 Apr 2022 14:13:33 +0200,
Robin Murphy wrote:
> 
> iommu_get_domain_for_dev() is already perfectly happy to return NULL
> if the given device has no IOMMU. Drop the unnecessary check.
> 
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>

This will change the code behavior.  The current code does nothing if
no IOMMU is found, but after your removal of the check, the code
reaches to emu->iommu_workaround = true incorrectly.


thanks,

Takashi

> ---
>  sound/pci/emu10k1/emu10k1_main.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
> index 86cc1ca025e4..5ffab343b89c 100644
> --- a/sound/pci/emu10k1/emu10k1_main.c
> +++ b/sound/pci/emu10k1/emu10k1_main.c
> @@ -1751,9 +1751,6 @@ static void snd_emu10k1_detect_iommu(struct snd_emu10k1 *emu)
>  
>  	emu->iommu_workaround = false;
>  
> -	if (!iommu_present(emu->card->dev->bus))
> -		return;
> -
>  	domain = iommu_get_domain_for_dev(emu->card->dev);
>  	if (domain && domain->type == IOMMU_DOMAIN_IDENTITY)
>  		return;
> -- 
> 2.28.0.dirty
> 

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

* Re: [PATCH] ALSA: emu10k1: Stop using iommu_present()
@ 2022-04-05 12:29   ` Takashi Iwai
  0 siblings, 0 replies; 8+ messages in thread
From: Takashi Iwai @ 2022-04-05 12:29 UTC (permalink / raw)
  To: Robin Murphy; +Cc: perex, tiwai, iommu, alsa-devel, linux-kernel

On Tue, 05 Apr 2022 14:13:33 +0200,
Robin Murphy wrote:
> 
> iommu_get_domain_for_dev() is already perfectly happy to return NULL
> if the given device has no IOMMU. Drop the unnecessary check.
> 
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>

This will change the code behavior.  The current code does nothing if
no IOMMU is found, but after your removal of the check, the code
reaches to emu->iommu_workaround = true incorrectly.


thanks,

Takashi

> ---
>  sound/pci/emu10k1/emu10k1_main.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
> index 86cc1ca025e4..5ffab343b89c 100644
> --- a/sound/pci/emu10k1/emu10k1_main.c
> +++ b/sound/pci/emu10k1/emu10k1_main.c
> @@ -1751,9 +1751,6 @@ static void snd_emu10k1_detect_iommu(struct snd_emu10k1 *emu)
>  
>  	emu->iommu_workaround = false;
>  
> -	if (!iommu_present(emu->card->dev->bus))
> -		return;
> -
>  	domain = iommu_get_domain_for_dev(emu->card->dev);
>  	if (domain && domain->type == IOMMU_DOMAIN_IDENTITY)
>  		return;
> -- 
> 2.28.0.dirty
> 

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

* Re: [PATCH] ALSA: emu10k1: Stop using iommu_present()
  2022-04-05 12:29   ` Takashi Iwai
  (?)
@ 2022-04-05 12:37     ` Robin Murphy
  -1 siblings, 0 replies; 8+ messages in thread
From: Robin Murphy @ 2022-04-05 12:37 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: linux-kernel, iommu, tiwai, alsa-devel, perex

On 2022-04-05 13:29, Takashi Iwai wrote:
> On Tue, 05 Apr 2022 14:13:33 +0200,
> Robin Murphy wrote:
>>
>> iommu_get_domain_for_dev() is already perfectly happy to return NULL
>> if the given device has no IOMMU. Drop the unnecessary check.
>>
>> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> 
> This will change the code behavior.  The current code does nothing if
> no IOMMU is found, but after your removal of the check, the code
> reaches to emu->iommu_workaround = true incorrectly.

Ah, right you are - I should have looked more closely at the second 
check, where of course "domain &&" wants tweaking to "!domain ||" as 
well. I'll send a v2 in a bit...

Thanks,
Robin.

> 
> 
> thanks,
> 
> Takashi
> 
>> ---
>>   sound/pci/emu10k1/emu10k1_main.c | 3 ---
>>   1 file changed, 3 deletions(-)
>>
>> diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
>> index 86cc1ca025e4..5ffab343b89c 100644
>> --- a/sound/pci/emu10k1/emu10k1_main.c
>> +++ b/sound/pci/emu10k1/emu10k1_main.c
>> @@ -1751,9 +1751,6 @@ static void snd_emu10k1_detect_iommu(struct snd_emu10k1 *emu)
>>   
>>   	emu->iommu_workaround = false;
>>   
>> -	if (!iommu_present(emu->card->dev->bus))
>> -		return;
>> -
>>   	domain = iommu_get_domain_for_dev(emu->card->dev);
>>   	if (domain && domain->type == IOMMU_DOMAIN_IDENTITY)
>>   		return;
>> -- 
>> 2.28.0.dirty
>>
_______________________________________________
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] ALSA: emu10k1: Stop using iommu_present()
@ 2022-04-05 12:37     ` Robin Murphy
  0 siblings, 0 replies; 8+ messages in thread
From: Robin Murphy @ 2022-04-05 12:37 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: linux-kernel, iommu, tiwai, alsa-devel

On 2022-04-05 13:29, Takashi Iwai wrote:
> On Tue, 05 Apr 2022 14:13:33 +0200,
> Robin Murphy wrote:
>>
>> iommu_get_domain_for_dev() is already perfectly happy to return NULL
>> if the given device has no IOMMU. Drop the unnecessary check.
>>
>> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> 
> This will change the code behavior.  The current code does nothing if
> no IOMMU is found, but after your removal of the check, the code
> reaches to emu->iommu_workaround = true incorrectly.

Ah, right you are - I should have looked more closely at the second 
check, where of course "domain &&" wants tweaking to "!domain ||" as 
well. I'll send a v2 in a bit...

Thanks,
Robin.

> 
> 
> thanks,
> 
> Takashi
> 
>> ---
>>   sound/pci/emu10k1/emu10k1_main.c | 3 ---
>>   1 file changed, 3 deletions(-)
>>
>> diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
>> index 86cc1ca025e4..5ffab343b89c 100644
>> --- a/sound/pci/emu10k1/emu10k1_main.c
>> +++ b/sound/pci/emu10k1/emu10k1_main.c
>> @@ -1751,9 +1751,6 @@ static void snd_emu10k1_detect_iommu(struct snd_emu10k1 *emu)
>>   
>>   	emu->iommu_workaround = false;
>>   
>> -	if (!iommu_present(emu->card->dev->bus))
>> -		return;
>> -
>>   	domain = iommu_get_domain_for_dev(emu->card->dev);
>>   	if (domain && domain->type == IOMMU_DOMAIN_IDENTITY)
>>   		return;
>> -- 
>> 2.28.0.dirty
>>

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

* Re: [PATCH] ALSA: emu10k1: Stop using iommu_present()
@ 2022-04-05 12:37     ` Robin Murphy
  0 siblings, 0 replies; 8+ messages in thread
From: Robin Murphy @ 2022-04-05 12:37 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: perex, tiwai, iommu, alsa-devel, linux-kernel

On 2022-04-05 13:29, Takashi Iwai wrote:
> On Tue, 05 Apr 2022 14:13:33 +0200,
> Robin Murphy wrote:
>>
>> iommu_get_domain_for_dev() is already perfectly happy to return NULL
>> if the given device has no IOMMU. Drop the unnecessary check.
>>
>> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> 
> This will change the code behavior.  The current code does nothing if
> no IOMMU is found, but after your removal of the check, the code
> reaches to emu->iommu_workaround = true incorrectly.

Ah, right you are - I should have looked more closely at the second 
check, where of course "domain &&" wants tweaking to "!domain ||" as 
well. I'll send a v2 in a bit...

Thanks,
Robin.

> 
> 
> thanks,
> 
> Takashi
> 
>> ---
>>   sound/pci/emu10k1/emu10k1_main.c | 3 ---
>>   1 file changed, 3 deletions(-)
>>
>> diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
>> index 86cc1ca025e4..5ffab343b89c 100644
>> --- a/sound/pci/emu10k1/emu10k1_main.c
>> +++ b/sound/pci/emu10k1/emu10k1_main.c
>> @@ -1751,9 +1751,6 @@ static void snd_emu10k1_detect_iommu(struct snd_emu10k1 *emu)
>>   
>>   	emu->iommu_workaround = false;
>>   
>> -	if (!iommu_present(emu->card->dev->bus))
>> -		return;
>> -
>>   	domain = iommu_get_domain_for_dev(emu->card->dev);
>>   	if (domain && domain->type == IOMMU_DOMAIN_IDENTITY)
>>   		return;
>> -- 
>> 2.28.0.dirty
>>

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

end of thread, other threads:[~2022-04-06  2:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-05 12:13 [PATCH] ALSA: emu10k1: Stop using iommu_present() Robin Murphy
2022-04-05 12:13 ` Robin Murphy
2022-04-05 12:29 ` Takashi Iwai
2022-04-05 12:29   ` Takashi Iwai
2022-04-05 12:29   ` Takashi Iwai
2022-04-05 12:37   ` Robin Murphy
2022-04-05 12:37     ` Robin Murphy
2022-04-05 12:37     ` Robin Murphy

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.