Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1500998 > unrolled thread

RE: [PATCH v2] r8169: set coherent DMA mask as well as streaming DMA mask

Started byDavid Laight <David.Laight@ACULAB.COM>
First post2016-10-14 15:50 +0200
Last post2016-10-14 15:50 +0200
Articles 4 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  RE: [PATCH v2] r8169: set coherent DMA mask as well as streaming  DMA mask David Laight <David.Laight@ACULAB.COM> - 2016-10-14 15:50 +0200
    Re: [PATCH v2] r8169: set coherent DMA mask as well as streaming DMA mask Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-10-14 15:50 +0200
      Re: [PATCH v2] r8169: set coherent DMA mask as well as streaming  DMA mask David Miller <davem@davemloft.net> - 2016-10-15 23:40 +0200
    Re: [PATCH v2] r8169: set coherent DMA mask as well as streaming DMA mask Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-10-14 15:50 +0200

#1500998 — RE: [PATCH v2] r8169: set coherent DMA mask as well as streaming DMA mask

FromDavid Laight <David.Laight@ACULAB.COM>
Date2016-10-14 15:50 +0200
SubjectRE: [PATCH v2] r8169: set coherent DMA mask as well as streaming DMA mask
Message-ID<ssb21-1TI-7@gated-at.bofh.it>
From: Of Ard Biesheuvel
> Sent: 14 October 2016 14:41
> PCI devices that are 64-bit DMA capable should set the coherent
> DMA mask as well as the streaming DMA mask. On some architectures,
> these are managed separately, and so the coherent DMA mask will be
> left at its default value of 32 if it is not set explicitly. This
> results in errors such as
> 
>      r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded
>      hwdev DMA mask = 0x00000000ffffffff, dev_addr = 0x00000080fbfff000
>      swiotlb: coherent allocation failed for device 0000:02:00.0 size=4096
>      CPU: 0 PID: 1062 Comm: systemd-udevd Not tainted 4.8.0+ #35
>      Hardware name: AMD Seattle/Seattle, BIOS 10:53:24 Oct 13 2016
> 
> on systems without memory that is 32-bit addressable by PCI devices.
> 
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
> v2: dropped the hunk that sets the coherent DMA mask to DMA_BIT_MASK(32),
>     which is unnecessary given that it is the default
> 
>  drivers/net/ethernet/realtek/r8169.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
> index e55638c7505a..bf000d819a21 100644
> --- a/drivers/net/ethernet/realtek/r8169.c
> +++ b/drivers/net/ethernet/realtek/r8169.c
> @@ -8273,7 +8273,8 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
>  	if ((sizeof(dma_addr_t) > 4) &&
>  	    (use_dac == 1 || (use_dac == -1 && pci_is_pcie(pdev) &&
>  			      tp->mac_version >= RTL_GIGA_MAC_VER_18)) &&
> -	    !pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) {
> +	    !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) &&
> +	    !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) {

Isn't there a dma_set_mask_and_coherent() function ?

	David

[toc] | [next] | [standalone]


#1501007 — Re: [PATCH v2] r8169: set coherent DMA mask as well as streaming DMA mask

FromArd Biesheuvel <ard.biesheuvel@linaro.org>
Date2016-10-14 15:50 +0200
SubjectRe: [PATCH v2] r8169: set coherent DMA mask as well as streaming DMA mask
Message-ID<ssb22-1TI-29@gated-at.bofh.it>
In reply to#1500998
> On 14 Oct 2016, at 14:42, David Laight <David.Laight@ACULAB.COM> wrote:
> 
> From: Of Ard Biesheuvel
>> Sent: 14 October 2016 14:41
>> PCI devices that are 64-bit DMA capable should set the coherent
>> DMA mask as well as the streaming DMA mask. On some architectures,
>> these are managed separately, and so the coherent DMA mask will be
>> left at its default value of 32 if it is not set explicitly. This
>> results in errors such as
>> 
>>     r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded
>>     hwdev DMA mask = 0x00000000ffffffff, dev_addr = 0x00000080fbfff00
0
>>     swiotlb: coherent allocation failed for device 0000:02:00.0 size=4096
>>     CPU: 0 PID: 1062 Comm: systemd-udevd Not tainted 4.8.0+ #35
>>     Hardware name: AMD Seattle/Seattle, BIOS 10:53:24 Oct 13 2016
>> 
>> on systems without memory that is 32-bit addressable by PCI devices.
>> 
>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>> ---
>> v2: dropped the hunk that sets the coherent DMA mask to DMA_BIT_MASK(32),
>>    which is unnecessary given that it is the default
>> 
>> drivers/net/ethernet/realtek/r8169.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>> 
>> diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
>> index e55638c7505a..bf000d819a21 100644
>> --- a/drivers/net/ethernet/realtek/r8169.c
>> +++ b/drivers/net/ethernet/realtek/r8169.c
>> @@ -8273,7 +8273,8 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
>>    if ((sizeof(dma_addr_t) > 4) &&
>>        (use_dac == 1 || (use_dac == -1 && pci_is_pcie(pdev) &&
>>                  tp->mac_version >= RTL_GIGA_MAC_VER_18)) &&
>> -        !pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) {
>> +        !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) &&
>> +        !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) {
> 
> Isn't there a dma_set_mask_and_coherent() function ?
> 

Not of the pci_xxx variety afaik

[toc] | [prev] | [next] | [standalone]


#1501372

FromDavid Miller <davem@davemloft.net>
Date2016-10-15 23:40 +0200
Message-ID<ssEQq-4Ss-9@gated-at.bofh.it>
In reply to#1501007
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Date: Fri, 14 Oct 2016 14:48:51 +0100

> 
>> On 14 Oct 2016, at 14:42, David Laight <David.Laight@ACULAB.COM> wrote:
>> 
>> From: Of Ard Biesheuvel
>>> Sent: 14 October 2016 14:41
>>> PCI devices that are 64-bit DMA capable should set the coherent
>>> DMA mask as well as the streaming DMA mask. On some architectures,
>>> these are managed separately, and so the coherent DMA mask will be
>>> left at its default value of 32 if it is not set explicitly. This
>>> results in errors such as
>>> 
>>>     r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded
>>>     hwdev DMA mask = 0x00000000ffffffff, dev_addr = 0x00000080fbfff000
>>>     swiotlb: coherent allocation failed for device 0000:02:00.0 size=4096
>>>     CPU: 0 PID: 1062 Comm: systemd-udevd Not tainted 4.8.0+ #35
>>>     Hardware name: AMD Seattle/Seattle, BIOS 10:53:24 Oct 13 2016
>>> 
>>> on systems without memory that is 32-bit addressable by PCI devices.
>>> 
>>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>>> ---
>>> v2: dropped the hunk that sets the coherent DMA mask to DMA_BIT_MASK(32),
>>>    which is unnecessary given that it is the default
>>> 
>>> drivers/net/ethernet/realtek/r8169.c | 3 ++-
>>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>> 
>>> diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
>>> index e55638c7505a..bf000d819a21 100644
>>> --- a/drivers/net/ethernet/realtek/r8169.c
>>> +++ b/drivers/net/ethernet/realtek/r8169.c
>>> @@ -8273,7 +8273,8 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
>>>    if ((sizeof(dma_addr_t) > 4) &&
>>>        (use_dac == 1 || (use_dac == -1 && pci_is_pcie(pdev) &&
>>>                  tp->mac_version >= RTL_GIGA_MAC_VER_18)) &&
>>> -        !pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) {
>>> +        !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) &&
>>> +        !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) {
>> 
>> Isn't there a dma_set_mask_and_coherent() function ?
>> 
> 
> Not of the pci_xxx variety afaik

You can often use the "dev_*" variants intechangably with the pci_*()
ones.

In fact you'll find that for several architectures pci_*() is
implemented via calls to dev_*().

[toc] | [prev] | [next] | [standalone]


#1501011 — Re: [PATCH v2] r8169: set coherent DMA mask as well as streaming DMA mask

FromArd Biesheuvel <ard.biesheuvel@linaro.org>
Date2016-10-14 15:50 +0200
SubjectRe: [PATCH v2] r8169: set coherent DMA mask as well as streaming DMA mask
Message-ID<ssb22-1TI-37@gated-at.bofh.it>
In reply to#1500998

> On 14 Oct 2016, at 14:42, David Laight<David.Laight@ACULAB.COM> wrote:
> 
> From: Of Ard Biesheuvel
>> Sent: 14 October 2016 14:41
>> PCI devices that are 64-bit DMA capable should set the coherent
>> DMA mask as well as the streaming DMA mask. On some architectures,
>> these are managed separately, and so the coherent DMA mask will be
>> left at its default value of 32 if it is not set explicitly. This
>> results in errors such as
>> 
>>     r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded
>>     hwdev DMA mask = 0x00000000ffffffff, dev_addr = 0x00000080fbfff00
0
>>     swiotlb: coherent allocation failed for device 0000:02:00.0 size=4096
>>     CPU: 0 PID: 1062 Comm: systemd-udevd Not tainted 4.8.0+ #35
>>     Hardware name: AMD Seattle/Seattle, BIOS 10:53:24 Oct 13 2016
>> 
>> on systems without memory that is 32-bit addressable by PCI devices.
>> 
>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>> ---
>> v2: dropped the hunk that sets the coherent DMA mask to DMA_BIT_MASK(32),
>>    which is unnecessary given that it is the default
>> 
>> drivers/net/ethernet/realtek/r8169.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>> 
>> diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
>> index e55638c7505a..bf000d819a21 100644
>> --- a/drivers/net/ethernet/realtek/r8169.c
>> +++ b/drivers/net/ethernet/realtek/r8169.c
>> @@ -8273,7 +8273,8 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
>>    if ((sizeof(dma_addr_t) > 4) &&
>>        (use_dac == 1 || (use_dac == -1 && pci_is_pcie(pdev) &&
>>                  tp->mac_version >= RTL_GIGA_MAC_VER_18)) &&
>> -        !pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) {
>> +        !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) &&
>> +        !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) {
> 
> Isn't there a dma_set_mask_and_coherent() function ?
> 
>    David
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web