linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH]: x86_64, audio: Fix system panic when DMA > 40 bits
@ 2013-05-01 19:04 Mike Travis
  2013-05-02  6:20 ` David Henningsson
  0 siblings, 1 reply; 8+ messages in thread
From: Mike Travis @ 2013-05-01 19:04 UTC (permalink / raw)
  To: Jaroslav Kysela, Takashi Iwai
  Cc: Pierre-Louis Bossart, David Henningsson, alsa-devel,
	linux-kernel, Russ Anderson, Mike Travis

The audio driver mistakenly allows 64 bit addresses to be created for
the audio driver on Nvidia GPUs.  Unfortunately, the hardware normally
only supports up to 40 bits of DMA.  This can cause system panics as
well as misdirected data when the address is > 40 bits as the upper
part the address is truncated.

Signed-off-by: Mike Travis <travis@sgi.com>
Reviewed-by: Mike Habeck <habeck@sgi.com>
---
 sound/pci/hda/hda_intel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index bcd40ee..45eb165 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -615,7 +615,7 @@ enum {
 /* quirks for Nvidia */
 #define AZX_DCAPS_PRESET_NVIDIA \
 	(AZX_DCAPS_NVIDIA_SNOOP | AZX_DCAPS_RIRB_DELAY | AZX_DCAPS_NO_MSI |\
-	 AZX_DCAPS_ALIGN_BUFSIZE)
+	 AZX_DCAPS_ALIGN_BUFSIZE | AZX_DCAPS_NO_64BIT)
 
 #define AZX_DCAPS_PRESET_CTHDA \
 	(AZX_DCAPS_NO_MSI | AZX_DCAPS_POSFIX_LPIB | AZX_DCAPS_4K_BDLE_BOUNDARY)
-- 
1.8.2.1


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

* Re: [PATCH]: x86_64, audio: Fix system panic when DMA > 40 bits
  2013-05-01 19:04 [PATCH]: x86_64, audio: Fix system panic when DMA > 40 bits Mike Travis
@ 2013-05-02  6:20 ` David Henningsson
  2013-05-02  6:36   ` Mike Travis
  2013-05-02 18:20   ` Stephen Warren
  0 siblings, 2 replies; 8+ messages in thread
From: David Henningsson @ 2013-05-02  6:20 UTC (permalink / raw)
  To: Mike Travis, Stephen Warren
  Cc: Jaroslav Kysela, Takashi Iwai, Pierre-Louis Bossart, alsa-devel,
	linux-kernel, Russ Anderson

On 05/01/2013 09:04 PM, Mike Travis wrote:
> The audio driver mistakenly allows 64 bit addresses to be created for
> the audio driver on Nvidia GPUs.  Unfortunately, the hardware normally
> only supports up to 40 bits of DMA.  This can cause system panics as
> well as misdirected data when the address is > 40 bits as the upper
> part the address is truncated.

Thanks for this patch. Stephen Warren, is this something you can 
confirm/deny, and do you know what range of hardware this actually 
applies to?

>
> Signed-off-by: Mike Travis <travis@sgi.com>
> Reviewed-by: Mike Habeck <habeck@sgi.com>
> ---
>   sound/pci/hda/hda_intel.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
> index bcd40ee..45eb165 100644
> --- a/sound/pci/hda/hda_intel.c
> +++ b/sound/pci/hda/hda_intel.c
> @@ -615,7 +615,7 @@ enum {
>   /* quirks for Nvidia */
>   #define AZX_DCAPS_PRESET_NVIDIA \
>   	(AZX_DCAPS_NVIDIA_SNOOP | AZX_DCAPS_RIRB_DELAY | AZX_DCAPS_NO_MSI |\
> -	 AZX_DCAPS_ALIGN_BUFSIZE)
> +	 AZX_DCAPS_ALIGN_BUFSIZE | AZX_DCAPS_NO_64BIT)
>
>   #define AZX_DCAPS_PRESET_CTHDA \
>   	(AZX_DCAPS_NO_MSI | AZX_DCAPS_POSFIX_LPIB | AZX_DCAPS_4K_BDLE_BOUNDARY)
>



-- 
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic

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

* Re: [PATCH]: x86_64, audio: Fix system panic when DMA > 40 bits
  2013-05-02  6:20 ` David Henningsson
@ 2013-05-02  6:36   ` Mike Travis
  2013-05-02  8:29     ` David Henningsson
  2013-05-03  9:55     ` Takashi Iwai
  2013-05-02 18:20   ` Stephen Warren
  1 sibling, 2 replies; 8+ messages in thread
From: Mike Travis @ 2013-05-02  6:36 UTC (permalink / raw)
  To: David Henningsson
  Cc: Stephen Warren, Jaroslav Kysela, Takashi Iwai,
	Pierre-Louis Bossart, alsa-devel, linux-kernel, Russ Anderson



On 5/1/2013 11:20 PM, David Henningsson wrote:
> On 05/01/2013 09:04 PM, Mike Travis wrote:
>> The audio driver mistakenly allows 64 bit addresses to be created for
>> the audio driver on Nvidia GPUs.  Unfortunately, the hardware normally
>> only supports up to 40 bits of DMA.  This can cause system panics as
>> well as misdirected data when the address is > 40 bits as the upper
>> part the address is truncated.
> 
> Thanks for this patch. Stephen Warren, is this something you can
> confirm/deny, and do you know what range of hardware this actually
> applies to?

The dma_mask can be read from the gpu device's pci entry.  I know it's
a stretch to try to link to that but past history has shown that it
ranges from 36 to 40 bits.

> 
>>
>> Signed-off-by: Mike Travis <travis@sgi.com>
>> Reviewed-by: Mike Habeck <habeck@sgi.com>
>> ---
>>   sound/pci/hda/hda_intel.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
>> index bcd40ee..45eb165 100644
>> --- a/sound/pci/hda/hda_intel.c
>> +++ b/sound/pci/hda/hda_intel.c
>> @@ -615,7 +615,7 @@ enum {
>>   /* quirks for Nvidia */
>>   #define AZX_DCAPS_PRESET_NVIDIA \
>>       (AZX_DCAPS_NVIDIA_SNOOP | AZX_DCAPS_RIRB_DELAY |
>> AZX_DCAPS_NO_MSI |\
>> -     AZX_DCAPS_ALIGN_BUFSIZE)
>> +     AZX_DCAPS_ALIGN_BUFSIZE | AZX_DCAPS_NO_64BIT)
>>
>>   #define AZX_DCAPS_PRESET_CTHDA \
>>       (AZX_DCAPS_NO_MSI | AZX_DCAPS_POSFIX_LPIB |
>> AZX_DCAPS_4K_BDLE_BOUNDARY)
>>
> 
> 
> 

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

* Re: [PATCH]: x86_64, audio: Fix system panic when DMA > 40 bits
  2013-05-02  6:36   ` Mike Travis
@ 2013-05-02  8:29     ` David Henningsson
  2013-05-02 16:19       ` Mike Travis
  2013-05-03  9:55     ` Takashi Iwai
  1 sibling, 1 reply; 8+ messages in thread
From: David Henningsson @ 2013-05-02  8:29 UTC (permalink / raw)
  To: Mike Travis
  Cc: Stephen Warren, Jaroslav Kysela, Takashi Iwai,
	Pierre-Louis Bossart, alsa-devel, linux-kernel, Russ Anderson

On 05/02/2013 08:36 AM, Mike Travis wrote:
>
>
> On 5/1/2013 11:20 PM, David Henningsson wrote:
>> On 05/01/2013 09:04 PM, Mike Travis wrote:
>>> The audio driver mistakenly allows 64 bit addresses to be created for
>>> the audio driver on Nvidia GPUs.  Unfortunately, the hardware normally
>>> only supports up to 40 bits of DMA.  This can cause system panics as
>>> well as misdirected data when the address is > 40 bits as the upper
>>> part the address is truncated.
>>
>> Thanks for this patch. Stephen Warren, is this something you can
>> confirm/deny, and do you know what range of hardware this actually
>> applies to?
>
> The dma_mask can be read from the gpu device's pci entry.  I know it's
> a stretch to try to link to that but past history has shown that it
> ranges from 36 to 40 bits.

Ok, so the below patch is some kind of workaround, as we don't currently 
take the dma_mask into account correctly? Or put in another way, would 
it be possible/better to actually read the dma_mask and use that instead 
of just clamping at 32 bit?

>
>>
>>>
>>> Signed-off-by: Mike Travis <travis@sgi.com>
>>> Reviewed-by: Mike Habeck <habeck@sgi.com>
>>> ---
>>>    sound/pci/hda/hda_intel.c | 2 +-
>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
>>> index bcd40ee..45eb165 100644
>>> --- a/sound/pci/hda/hda_intel.c
>>> +++ b/sound/pci/hda/hda_intel.c
>>> @@ -615,7 +615,7 @@ enum {
>>>    /* quirks for Nvidia */
>>>    #define AZX_DCAPS_PRESET_NVIDIA \
>>>        (AZX_DCAPS_NVIDIA_SNOOP | AZX_DCAPS_RIRB_DELAY |
>>> AZX_DCAPS_NO_MSI |\
>>> -     AZX_DCAPS_ALIGN_BUFSIZE)
>>> +     AZX_DCAPS_ALIGN_BUFSIZE | AZX_DCAPS_NO_64BIT)
>>>
>>>    #define AZX_DCAPS_PRESET_CTHDA \
>>>        (AZX_DCAPS_NO_MSI | AZX_DCAPS_POSFIX_LPIB |
>>> AZX_DCAPS_4K_BDLE_BOUNDARY)
>>>
>>
>>
>>
>



-- 
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic

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

* Re: [PATCH]: x86_64, audio: Fix system panic when DMA > 40 bits
  2013-05-02  8:29     ` David Henningsson
@ 2013-05-02 16:19       ` Mike Travis
  0 siblings, 0 replies; 8+ messages in thread
From: Mike Travis @ 2013-05-02 16:19 UTC (permalink / raw)
  To: David Henningsson
  Cc: Stephen Warren, Jaroslav Kysela, Takashi Iwai,
	Pierre-Louis Bossart, alsa-devel, linux-kernel, Russ Anderson



On 5/2/2013 1:29 AM, David Henningsson wrote:
> On 05/02/2013 08:36 AM, Mike Travis wrote:
>>
>>
>> On 5/1/2013 11:20 PM, David Henningsson wrote:
>>> On 05/01/2013 09:04 PM, Mike Travis wrote:
>>>> The audio driver mistakenly allows 64 bit addresses to be created for
>>>> the audio driver on Nvidia GPUs.  Unfortunately, the hardware normally
>>>> only supports up to 40 bits of DMA.  This can cause system panics as
>>>> well as misdirected data when the address is > 40 bits as the upper
>>>> part the address is truncated.
>>>
>>> Thanks for this patch. Stephen Warren, is this something you can
>>> confirm/deny, and do you know what range of hardware this actually
>>> applies to?
>>
>> The dma_mask can be read from the gpu device's pci entry.  I know it's
>> a stretch to try to link to that but past history has shown that it
>> ranges from 36 to 40 bits.
> 
> Ok, so the below patch is some kind of workaround, as we don't currently
> take the dma_mask into account correctly? Or put in another way, would
> it be possible/better to actually read the dma_mask and use that instead
> of just clamping at 32 bit?\

Yes, it would.  There is a strange scenario where if you request
a DMA32 address it must be on the lowest node (where the DMA32 area
is).  But if you are running on a cpuset that excludes Node 0's
memory, you'll get an error.  But I couldn't think of a workable
way to link the two (except that the PCI id is the same except
for the function #.)
>>>
>>>>
>>>> Signed-off-by: Mike Travis <travis@sgi.com>
>>>> Reviewed-by: Mike Habeck <habeck@sgi.com>
>>>> ---
>>>>    sound/pci/hda/hda_intel.c | 2 +-
>>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
>>>> index bcd40ee..45eb165 100644
>>>> --- a/sound/pci/hda/hda_intel.c
>>>> +++ b/sound/pci/hda/hda_intel.c
>>>> @@ -615,7 +615,7 @@ enum {
>>>>    /* quirks for Nvidia */
>>>>    #define AZX_DCAPS_PRESET_NVIDIA \
>>>>        (AZX_DCAPS_NVIDIA_SNOOP | AZX_DCAPS_RIRB_DELAY |
>>>> AZX_DCAPS_NO_MSI |\
>>>> -     AZX_DCAPS_ALIGN_BUFSIZE)
>>>> +     AZX_DCAPS_ALIGN_BUFSIZE | AZX_DCAPS_NO_64BIT)
>>>>
>>>>    #define AZX_DCAPS_PRESET_CTHDA \
>>>>        (AZX_DCAPS_NO_MSI | AZX_DCAPS_POSFIX_LPIB |
>>>> AZX_DCAPS_4K_BDLE_BOUNDARY)
>>>>
>>>
>>>
>>>
>>
> 
> 
> 

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

* Re: [PATCH]: x86_64, audio: Fix system panic when DMA > 40 bits
  2013-05-02  6:20 ` David Henningsson
  2013-05-02  6:36   ` Mike Travis
@ 2013-05-02 18:20   ` Stephen Warren
  2013-05-02 18:59     ` Mike Travis
  1 sibling, 1 reply; 8+ messages in thread
From: Stephen Warren @ 2013-05-02 18:20 UTC (permalink / raw)
  To: David Henningsson
  Cc: Mike Travis, Stephen Warren, Jaroslav Kysela, Takashi Iwai,
	Pierre-Louis Bossart, alsa-devel, linux-kernel, Russ Anderson

On 05/02/2013 12:20 AM, David Henningsson wrote:
> On 05/01/2013 09:04 PM, Mike Travis wrote:
>> The audio driver mistakenly allows 64 bit addresses to be created for
>> the audio driver on Nvidia GPUs.  Unfortunately, the hardware normally
>> only supports up to 40 bits of DMA.  This can cause system panics as
>> well as misdirected data when the address is > 40 bits as the upper
>> part the address is truncated.
> 
> Thanks for this patch. Stephen Warren, is this something you can
> confirm/deny, and do you know what range of hardware this actually
> applies to?

It's certainly plausible that the GPU's internal physical addresses are
less than a full 64-bits, and this probably affects PCI accesses too.

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

* Re: [PATCH]: x86_64, audio: Fix system panic when DMA > 40 bits
  2013-05-02 18:20   ` Stephen Warren
@ 2013-05-02 18:59     ` Mike Travis
  0 siblings, 0 replies; 8+ messages in thread
From: Mike Travis @ 2013-05-02 18:59 UTC (permalink / raw)
  To: Stephen Warren
  Cc: David Henningsson, Stephen Warren, Jaroslav Kysela, Takashi Iwai,
	Pierre-Louis Bossart, alsa-devel, linux-kernel, Russ Anderson



On 5/2/2013 11:20 AM, Stephen Warren wrote:
> On 05/02/2013 12:20 AM, David Henningsson wrote:
>> On 05/01/2013 09:04 PM, Mike Travis wrote:
>>> The audio driver mistakenly allows 64 bit addresses to be created for
>>> the audio driver on Nvidia GPUs.  Unfortunately, the hardware normally
>>> only supports up to 40 bits of DMA.  This can cause system panics as
>>> well as misdirected data when the address is > 40 bits as the upper
>>> part the address is truncated.
>>
>> Thanks for this patch. Stephen Warren, is this something you can
>> confirm/deny, and do you know what range of hardware this actually
>> applies to?
> 
> It's certainly plausible that the GPU's internal physical addresses are
> less than a full 64-bits, and this probably affects PCI accesses too.
> 

I haven't noticed any other problems with MMIOH accesses.  The
problem of DMA32 addresses certainly affects us though audio is
not a high priority on UV(*) except in specific applications (like
Media Servers, etc.]  Accesses to the GPU and GPGPU are much more
common.

(* http://www.sgi.com/products/servers/uv/)

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

* Re: [PATCH]: x86_64, audio: Fix system panic when DMA > 40 bits
  2013-05-02  6:36   ` Mike Travis
  2013-05-02  8:29     ` David Henningsson
@ 2013-05-03  9:55     ` Takashi Iwai
  1 sibling, 0 replies; 8+ messages in thread
From: Takashi Iwai @ 2013-05-03  9:55 UTC (permalink / raw)
  To: Mike Travis
  Cc: David Henningsson, Stephen Warren, Jaroslav Kysela,
	Pierre-Louis Bossart, alsa-devel, linux-kernel, Russ Anderson

At Wed, 01 May 2013 23:36:24 -0700,
Mike Travis wrote:
> 
> 
> 
> On 5/1/2013 11:20 PM, David Henningsson wrote:
> > On 05/01/2013 09:04 PM, Mike Travis wrote:
> >> The audio driver mistakenly allows 64 bit addresses to be created for
> >> the audio driver on Nvidia GPUs.  Unfortunately, the hardware normally
> >> only supports up to 40 bits of DMA.  This can cause system panics as
> >> well as misdirected data when the address is > 40 bits as the upper
> >> part the address is truncated.
> > 
> > Thanks for this patch. Stephen Warren, is this something you can
> > confirm/deny, and do you know what range of hardware this actually
> > applies to?
> 
> The dma_mask can be read from the gpu device's pci entry.

Well, this assumes that the graphics driver is initialized before the
audio driver, right?

>  I know it's
> a stretch to try to link to that but past history has shown that it
> ranges from 36 to 40 bits.

Looking through nouveau drivers, even 32bit dma_bits is used for some
devices, too, so a safe bid would be simply 32bit.  Of course, if we
have a table of DMA bits, we can use the more exact values.

I'll apply your original patch as a quick fix for now.


thanks,

Takashi

> > 
> >>
> >> Signed-off-by: Mike Travis <travis@sgi.com>
> >> Reviewed-by: Mike Habeck <habeck@sgi.com>
> >> ---
> >>   sound/pci/hda/hda_intel.c | 2 +-
> >>   1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
> >> index bcd40ee..45eb165 100644
> >> --- a/sound/pci/hda/hda_intel.c
> >> +++ b/sound/pci/hda/hda_intel.c
> >> @@ -615,7 +615,7 @@ enum {
> >>   /* quirks for Nvidia */
> >>   #define AZX_DCAPS_PRESET_NVIDIA \
> >>       (AZX_DCAPS_NVIDIA_SNOOP | AZX_DCAPS_RIRB_DELAY |
> >> AZX_DCAPS_NO_MSI |\
> >> -     AZX_DCAPS_ALIGN_BUFSIZE)
> >> +     AZX_DCAPS_ALIGN_BUFSIZE | AZX_DCAPS_NO_64BIT)
> >>
> >>   #define AZX_DCAPS_PRESET_CTHDA \
> >>       (AZX_DCAPS_NO_MSI | AZX_DCAPS_POSFIX_LPIB |
> >> AZX_DCAPS_4K_BDLE_BOUNDARY)
> >>
> > 
> > 
> > 
> 

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

end of thread, other threads:[~2013-05-03  9:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-01 19:04 [PATCH]: x86_64, audio: Fix system panic when DMA > 40 bits Mike Travis
2013-05-02  6:20 ` David Henningsson
2013-05-02  6:36   ` Mike Travis
2013-05-02  8:29     ` David Henningsson
2013-05-02 16:19       ` Mike Travis
2013-05-03  9:55     ` Takashi Iwai
2013-05-02 18:20   ` Stephen Warren
2013-05-02 18:59     ` Mike Travis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).