linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH 5.10 81/97] MIPS: Loongson64: Enable DMA noncoherent support
       [not found] ` <20231211182023.277870337@linuxfoundation.org>
@ 2023-12-30 19:38   ` Salvatore Bonaccorso
  2023-12-30 23:16     ` Jiaxun Yang
  0 siblings, 1 reply; 4+ messages in thread
From: Salvatore Bonaccorso @ 2023-12-30 19:38 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: stable, patches, Jiaxun Yang, Thomas Bogendoerfer,
	Christoph Hellwig, Huacai Chen, linux-mips

Hi,

On Mon, Dec 11, 2023 at 07:22:24PM +0100, Greg Kroah-Hartman wrote:
> 5.10-stable review patch.  If anyone has any objections, please let me know.
> 
> ------------------
> 
> From: Jiaxun Yang <jiaxun.yang@flygoat.com>
> 
> commit edc0378eee00200a5bedf1bb9f00ad390e0d1bd4 upstream.
> 
> There are some Loongson64 systems come with broken coherent DMA
> support, firmware will set a bit in boot_param and pass nocoherentio
> in cmdline.
> 
> However nonconherent support was missed out when spin off Loongson-2EF
> form Loongson64, and that boot_param change never made itself into
> upstream.
> 
> Support DMA noncoherent properly to get those systems working.
> 
> Cc: stable@vger.kernel.org
> Fixes: 71e2f4dd5a65 ("MIPS: Fork loongson2ef from loongson64")
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  arch/mips/Kconfig                                  |    2 ++
>  arch/mips/include/asm/mach-loongson64/boot_param.h |    3 ++-
>  arch/mips/loongson64/env.c                         |   10 +++++++++-
>  3 files changed, 13 insertions(+), 2 deletions(-)
> 
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -468,6 +468,7 @@ config MACH_LOONGSON2EF
>  
>  config MACH_LOONGSON64
>  	bool "Loongson 64-bit family of machines"
> +	select ARCH_DMA_DEFAULT_COHERENT
>  	select ARCH_SPARSEMEM_ENABLE
>  	select ARCH_MIGHT_HAVE_PC_PARPORT
>  	select ARCH_MIGHT_HAVE_PC_SERIO
> @@ -1379,6 +1380,7 @@ config CPU_LOONGSON64
>  	select CPU_SUPPORTS_MSA
>  	select CPU_DIEI_BROKEN if !LOONGSON3_ENHANCEMENT
>  	select CPU_MIPSR2_IRQ_VI
> +	select DMA_NONCOHERENT
>  	select WEAK_ORDERING
>  	select WEAK_REORDERING_BEYOND_LLSC
>  	select MIPS_ASID_BITS_VARIABLE
> --- a/arch/mips/include/asm/mach-loongson64/boot_param.h
> +++ b/arch/mips/include/asm/mach-loongson64/boot_param.h
> @@ -117,7 +117,8 @@ struct irq_source_routing_table {
>  	u64 pci_io_start_addr;
>  	u64 pci_io_end_addr;
>  	u64 pci_config_addr;
> -	u32 dma_mask_bits;
> +	u16 dma_mask_bits;
> +	u16 dma_noncoherent;
>  } __packed;
>  
>  struct interface_info {
> --- a/arch/mips/loongson64/env.c
> +++ b/arch/mips/loongson64/env.c
> @@ -13,6 +13,8 @@
>   * Copyright (C) 2009 Lemote Inc.
>   * Author: Wu Zhangjin, wuzhangjin@gmail.com
>   */
> +
> +#include <linux/dma-map-ops.h>
>  #include <linux/export.h>
>  #include <linux/pci_ids.h>
>  #include <asm/bootinfo.h>
> @@ -131,8 +133,14 @@ void __init prom_init_env(void)
>  	loongson_sysconf.pci_io_base = eirq_source->pci_io_start_addr;
>  	loongson_sysconf.dma_mask_bits = eirq_source->dma_mask_bits;
>  	if (loongson_sysconf.dma_mask_bits < 32 ||
> -		loongson_sysconf.dma_mask_bits > 64)
> +			loongson_sysconf.dma_mask_bits > 64) {
>  		loongson_sysconf.dma_mask_bits = 32;
> +		dma_default_coherent = true;
> +	} else {
> +		dma_default_coherent = !eirq_source->dma_noncoherent;
> +	}
> +
> +	pr_info("Firmware: Coherent DMA: %s\n", dma_default_coherent ? "on" : "off");
>  
>  	loongson_sysconf.restart_addr = boot_p->reset_system.ResetWarm;
>  	loongson_sysconf.poweroff_addr = boot_p->reset_system.Shutdown;

While preparing an update for Debian and finally building for all
supported architecture, the builds for mipsel and mips64el were
failing with:

/<<PKGBUILDDIR>>/arch/mips/loongson64/env.c: In function 'prom_init_env':
/<<PKGBUILDDIR>>/arch/mips/loongson64/env.c:138:3: error: 'dma_default_coherent' undeclared (first use in this function); did you mean 'dma_free_coherent'?
  138 |   dma_default_coherent = true;
      |   ^~~~~~~~~~~~~~~~~~~~
      |   dma_free_coherent
/<<PKGBUILDDIR>>/arch/mips/loongson64/env.c:138:3: note: each undeclared identifier is reported only once for each function it appears in
make[6]: *** [/<<PKGBUILDDIR>>/scripts/Makefile.build:291: arch/mips/loongson64/env.o] Error 1
make[6]: *** Waiting for unfinished jobs....

Is here a prerequisite missing for the commit?

Backporting though 6d4e9a8efe3d ("driver core: lift dma_default_coherent into
common code") which is from 5.12-rc1 though seems too intrusive, correct? Would
the alternative be to just revert the 3ee7e2faef87 ("MIPS: Loongson64: Enable
DMA noncoherent support") commit which landed in 5.10.204?

Regards,
Salvatore

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

* Re: [PATCH 5.10 81/97] MIPS: Loongson64: Enable DMA noncoherent support
  2023-12-30 19:38   ` [PATCH 5.10 81/97] MIPS: Loongson64: Enable DMA noncoherent support Salvatore Bonaccorso
@ 2023-12-30 23:16     ` Jiaxun Yang
  2023-12-31  9:33       ` Salvatore Bonaccorso
  0 siblings, 1 reply; 4+ messages in thread
From: Jiaxun Yang @ 2023-12-30 23:16 UTC (permalink / raw)
  To: Salvatore Bonaccorso, Greg Kroah-Hartman
  Cc: stable@vger.kernel.org, patches, Thomas Bogendoerfer,
	Christoph Hellwig, Huacai Chen, linux-mips@vger.kernel.org



在2023年12月30日十二月 下午7:38,Salvatore Bonaccorso写道:
> Hi,
>
> On Mon, Dec 11, 2023 at 07:22:24PM +0100, Greg Kroah-Hartman wrote:
>> 5.10-stable review patch.  If anyone has any objections, please let me know.
>> 
>> ------------------
>> 
>> From: Jiaxun Yang <jiaxun.yang@flygoat.com>
>> 
>> commit edc0378eee00200a5bedf1bb9f00ad390e0d1bd4 upstream.
>> 
>> There are some Loongson64 systems come with broken coherent DMA
>> support, firmware will set a bit in boot_param and pass nocoherentio
>> in cmdline.
>> 
>> However nonconherent support was missed out when spin off Loongson-2EF
>> form Loongson64, and that boot_param change never made itself into
>> upstream.
>> 
>> Support DMA noncoherent properly to get those systems working.
>> 
>> Cc: stable@vger.kernel.org
>> Fixes: 71e2f4dd5a65 ("MIPS: Fork loongson2ef from loongson64")
>> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
>> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
>> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>> ---
>>  arch/mips/Kconfig                                  |    2 ++
>>  arch/mips/include/asm/mach-loongson64/boot_param.h |    3 ++-
>>  arch/mips/loongson64/env.c                         |   10 +++++++++-
>>  3 files changed, 13 insertions(+), 2 deletions(-)
>> 
>> --- a/arch/mips/Kconfig
>> +++ b/arch/mips/Kconfig
>> @@ -468,6 +468,7 @@ config MACH_LOONGSON2EF
>>  
>>  config MACH_LOONGSON64
>>  	bool "Loongson 64-bit family of machines"
>> +	select ARCH_DMA_DEFAULT_COHERENT
>>  	select ARCH_SPARSEMEM_ENABLE
>>  	select ARCH_MIGHT_HAVE_PC_PARPORT
>>  	select ARCH_MIGHT_HAVE_PC_SERIO
>> @@ -1379,6 +1380,7 @@ config CPU_LOONGSON64
>>  	select CPU_SUPPORTS_MSA
>>  	select CPU_DIEI_BROKEN if !LOONGSON3_ENHANCEMENT
>>  	select CPU_MIPSR2_IRQ_VI
>> +	select DMA_NONCOHERENT
>>  	select WEAK_ORDERING
>>  	select WEAK_REORDERING_BEYOND_LLSC
>>  	select MIPS_ASID_BITS_VARIABLE
>> --- a/arch/mips/include/asm/mach-loongson64/boot_param.h
>> +++ b/arch/mips/include/asm/mach-loongson64/boot_param.h
>> @@ -117,7 +117,8 @@ struct irq_source_routing_table {
>>  	u64 pci_io_start_addr;
>>  	u64 pci_io_end_addr;
>>  	u64 pci_config_addr;
>> -	u32 dma_mask_bits;
>> +	u16 dma_mask_bits;
>> +	u16 dma_noncoherent;
>>  } __packed;
>>  
>>  struct interface_info {
>> --- a/arch/mips/loongson64/env.c
>> +++ b/arch/mips/loongson64/env.c
>> @@ -13,6 +13,8 @@
>>   * Copyright (C) 2009 Lemote Inc.
>>   * Author: Wu Zhangjin, wuzhangjin@gmail.com
>>   */
>> +
>> +#include <linux/dma-map-ops.h>
>>  #include <linux/export.h>
>>  #include <linux/pci_ids.h>
>>  #include <asm/bootinfo.h>
>> @@ -131,8 +133,14 @@ void __init prom_init_env(void)
>>  	loongson_sysconf.pci_io_base = eirq_source->pci_io_start_addr;
>>  	loongson_sysconf.dma_mask_bits = eirq_source->dma_mask_bits;
>>  	if (loongson_sysconf.dma_mask_bits < 32 ||
>> -		loongson_sysconf.dma_mask_bits > 64)
>> +			loongson_sysconf.dma_mask_bits > 64) {
>>  		loongson_sysconf.dma_mask_bits = 32;
>> +		dma_default_coherent = true;
>> +	} else {
>> +		dma_default_coherent = !eirq_source->dma_noncoherent;
>> +	}
>> +
>> +	pr_info("Firmware: Coherent DMA: %s\n", dma_default_coherent ? "on" : "off");
>>  
>>  	loongson_sysconf.restart_addr = boot_p->reset_system.ResetWarm;
>>  	loongson_sysconf.poweroff_addr = boot_p->reset_system.Shutdown;
>
> While preparing an update for Debian and finally building for all
> supported architecture, the builds for mipsel and mips64el were
> failing with:
>
> /<<PKGBUILDDIR>>/arch/mips/loongson64/env.c: In function 
> 'prom_init_env':
> /<<PKGBUILDDIR>>/arch/mips/loongson64/env.c:138:3: error: 
> 'dma_default_coherent' undeclared (first use in this function); did you 
> mean 'dma_free_coherent'?
>   138 |   dma_default_coherent = true;
>       |   ^~~~~~~~~~~~~~~~~~~~
>       |   dma_free_coherent
> /<<PKGBUILDDIR>>/arch/mips/loongson64/env.c:138:3: note: each 
> undeclared identifier is reported only once for each function it 
> appears in
> make[6]: *** [/<<PKGBUILDDIR>>/scripts/Makefile.build:291: 
> arch/mips/loongson64/env.o] Error 1
> make[6]: *** Waiting for unfinished jobs....
>
> Is here a prerequisite missing for the commit?
>
> Backporting though 6d4e9a8efe3d ("driver core: lift dma_default_coherent into
> common code") which is from 5.12-rc1 though seems too intrusive, correct? Would
> the alternative be to just revert the 3ee7e2faef87 ("MIPS: Loongson64: Enable
> DMA noncoherent support") commit which landed in 5.10.204?

Hi,

Sorry for not spotting the issue in the first place.

It actually requires more dependencies such as c00a60d6f4a1 ("of: address: always
use dma_default_coherent for default coherency").

I'll try to produce a backport series but better to drop this patch from stable
for now.

Thanks
>
> Regards,
> Salvatore

-- 
- Jiaxun

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

* Re: [PATCH 5.10 81/97] MIPS: Loongson64: Enable DMA noncoherent support
  2023-12-30 23:16     ` Jiaxun Yang
@ 2023-12-31  9:33       ` Salvatore Bonaccorso
  2024-01-03 10:40         ` Greg Kroah-Hartman
  0 siblings, 1 reply; 4+ messages in thread
From: Salvatore Bonaccorso @ 2023-12-31  9:33 UTC (permalink / raw)
  To: Jiaxun Yang
  Cc: Greg Kroah-Hartman, stable@vger.kernel.org, patches,
	Thomas Bogendoerfer, Christoph Hellwig, Huacai Chen,
	linux-mips@vger.kernel.org

Hi,

On Sat, Dec 30, 2023 at 11:16:41PM +0000, Jiaxun Yang wrote:
> 
> 
> 在2023年12月30日十二月 下午7:38,Salvatore Bonaccorso写道:
> > Hi,
> >
> > On Mon, Dec 11, 2023 at 07:22:24PM +0100, Greg Kroah-Hartman wrote:
> >> 5.10-stable review patch.  If anyone has any objections, please let me know.
> >> 
> >> ------------------
> >> 
> >> From: Jiaxun Yang <jiaxun.yang@flygoat.com>
> >> 
> >> commit edc0378eee00200a5bedf1bb9f00ad390e0d1bd4 upstream.
> >> 
> >> There are some Loongson64 systems come with broken coherent DMA
> >> support, firmware will set a bit in boot_param and pass nocoherentio
> >> in cmdline.
> >> 
> >> However nonconherent support was missed out when spin off Loongson-2EF
> >> form Loongson64, and that boot_param change never made itself into
> >> upstream.
> >> 
> >> Support DMA noncoherent properly to get those systems working.
> >> 
> >> Cc: stable@vger.kernel.org
> >> Fixes: 71e2f4dd5a65 ("MIPS: Fork loongson2ef from loongson64")
> >> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> >> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> >> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> >> ---
> >>  arch/mips/Kconfig                                  |    2 ++
> >>  arch/mips/include/asm/mach-loongson64/boot_param.h |    3 ++-
> >>  arch/mips/loongson64/env.c                         |   10 +++++++++-
> >>  3 files changed, 13 insertions(+), 2 deletions(-)
> >> 
> >> --- a/arch/mips/Kconfig
> >> +++ b/arch/mips/Kconfig
> >> @@ -468,6 +468,7 @@ config MACH_LOONGSON2EF
> >>  
> >>  config MACH_LOONGSON64
> >>  	bool "Loongson 64-bit family of machines"
> >> +	select ARCH_DMA_DEFAULT_COHERENT
> >>  	select ARCH_SPARSEMEM_ENABLE
> >>  	select ARCH_MIGHT_HAVE_PC_PARPORT
> >>  	select ARCH_MIGHT_HAVE_PC_SERIO
> >> @@ -1379,6 +1380,7 @@ config CPU_LOONGSON64
> >>  	select CPU_SUPPORTS_MSA
> >>  	select CPU_DIEI_BROKEN if !LOONGSON3_ENHANCEMENT
> >>  	select CPU_MIPSR2_IRQ_VI
> >> +	select DMA_NONCOHERENT
> >>  	select WEAK_ORDERING
> >>  	select WEAK_REORDERING_BEYOND_LLSC
> >>  	select MIPS_ASID_BITS_VARIABLE
> >> --- a/arch/mips/include/asm/mach-loongson64/boot_param.h
> >> +++ b/arch/mips/include/asm/mach-loongson64/boot_param.h
> >> @@ -117,7 +117,8 @@ struct irq_source_routing_table {
> >>  	u64 pci_io_start_addr;
> >>  	u64 pci_io_end_addr;
> >>  	u64 pci_config_addr;
> >> -	u32 dma_mask_bits;
> >> +	u16 dma_mask_bits;
> >> +	u16 dma_noncoherent;
> >>  } __packed;
> >>  
> >>  struct interface_info {
> >> --- a/arch/mips/loongson64/env.c
> >> +++ b/arch/mips/loongson64/env.c
> >> @@ -13,6 +13,8 @@
> >>   * Copyright (C) 2009 Lemote Inc.
> >>   * Author: Wu Zhangjin, wuzhangjin@gmail.com
> >>   */
> >> +
> >> +#include <linux/dma-map-ops.h>
> >>  #include <linux/export.h>
> >>  #include <linux/pci_ids.h>
> >>  #include <asm/bootinfo.h>
> >> @@ -131,8 +133,14 @@ void __init prom_init_env(void)
> >>  	loongson_sysconf.pci_io_base = eirq_source->pci_io_start_addr;
> >>  	loongson_sysconf.dma_mask_bits = eirq_source->dma_mask_bits;
> >>  	if (loongson_sysconf.dma_mask_bits < 32 ||
> >> -		loongson_sysconf.dma_mask_bits > 64)
> >> +			loongson_sysconf.dma_mask_bits > 64) {
> >>  		loongson_sysconf.dma_mask_bits = 32;
> >> +		dma_default_coherent = true;
> >> +	} else {
> >> +		dma_default_coherent = !eirq_source->dma_noncoherent;
> >> +	}
> >> +
> >> +	pr_info("Firmware: Coherent DMA: %s\n", dma_default_coherent ? "on" : "off");
> >>  
> >>  	loongson_sysconf.restart_addr = boot_p->reset_system.ResetWarm;
> >>  	loongson_sysconf.poweroff_addr = boot_p->reset_system.Shutdown;
> >
> > While preparing an update for Debian and finally building for all
> > supported architecture, the builds for mipsel and mips64el were
> > failing with:
> >
> > /<<PKGBUILDDIR>>/arch/mips/loongson64/env.c: In function 
> > 'prom_init_env':
> > /<<PKGBUILDDIR>>/arch/mips/loongson64/env.c:138:3: error: 
> > 'dma_default_coherent' undeclared (first use in this function); did you 
> > mean 'dma_free_coherent'?
> >   138 |   dma_default_coherent = true;
> >       |   ^~~~~~~~~~~~~~~~~~~~
> >       |   dma_free_coherent
> > /<<PKGBUILDDIR>>/arch/mips/loongson64/env.c:138:3: note: each 
> > undeclared identifier is reported only once for each function it 
> > appears in
> > make[6]: *** [/<<PKGBUILDDIR>>/scripts/Makefile.build:291: 
> > arch/mips/loongson64/env.o] Error 1
> > make[6]: *** Waiting for unfinished jobs....
> >
> > Is here a prerequisite missing for the commit?
> >
> > Backporting though 6d4e9a8efe3d ("driver core: lift dma_default_coherent into
> > common code") which is from 5.12-rc1 though seems too intrusive, correct? Would
> > the alternative be to just revert the 3ee7e2faef87 ("MIPS: Loongson64: Enable
> > DMA noncoherent support") commit which landed in 5.10.204?
> 
> Hi,
> 
> Sorry for not spotting the issue in the first place.
> 
> It actually requires more dependencies such as c00a60d6f4a1 ("of: address: always
> use dma_default_coherent for default coherency").
> 
> I'll try to produce a backport series but better to drop this patch from stable
> for now.

Thanks a lot for your quick reply! 

So I guess it only needs a revert for now from 5.10.y correct?

Greg, possible to already queue up the revert for 5.10.y for the next
upload?

Regards,
Salvatore

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

* Re: [PATCH 5.10 81/97] MIPS: Loongson64: Enable DMA noncoherent support
  2023-12-31  9:33       ` Salvatore Bonaccorso
@ 2024-01-03 10:40         ` Greg Kroah-Hartman
  0 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2024-01-03 10:40 UTC (permalink / raw)
  To: Salvatore Bonaccorso
  Cc: Jiaxun Yang, stable@vger.kernel.org, patches, Thomas Bogendoerfer,
	Christoph Hellwig, Huacai Chen, linux-mips@vger.kernel.org

On Sun, Dec 31, 2023 at 10:33:19AM +0100, Salvatore Bonaccorso wrote:
> Hi,
> 
> On Sat, Dec 30, 2023 at 11:16:41PM +0000, Jiaxun Yang wrote:
> > 
> > 
> > 在2023年12月30日十二月 下午7:38,Salvatore Bonaccorso写道:
> > > Hi,
> > >
> > > On Mon, Dec 11, 2023 at 07:22:24PM +0100, Greg Kroah-Hartman wrote:
> > >> 5.10-stable review patch.  If anyone has any objections, please let me know.
> > >> 
> > >> ------------------
> > >> 
> > >> From: Jiaxun Yang <jiaxun.yang@flygoat.com>
> > >> 
> > >> commit edc0378eee00200a5bedf1bb9f00ad390e0d1bd4 upstream.
> > >> 
> > >> There are some Loongson64 systems come with broken coherent DMA
> > >> support, firmware will set a bit in boot_param and pass nocoherentio
> > >> in cmdline.
> > >> 
> > >> However nonconherent support was missed out when spin off Loongson-2EF
> > >> form Loongson64, and that boot_param change never made itself into
> > >> upstream.
> > >> 
> > >> Support DMA noncoherent properly to get those systems working.
> > >> 
> > >> Cc: stable@vger.kernel.org
> > >> Fixes: 71e2f4dd5a65 ("MIPS: Fork loongson2ef from loongson64")
> > >> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> > >> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> > >> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > >> ---
> > >>  arch/mips/Kconfig                                  |    2 ++
> > >>  arch/mips/include/asm/mach-loongson64/boot_param.h |    3 ++-
> > >>  arch/mips/loongson64/env.c                         |   10 +++++++++-
> > >>  3 files changed, 13 insertions(+), 2 deletions(-)
> > >> 
> > >> --- a/arch/mips/Kconfig
> > >> +++ b/arch/mips/Kconfig
> > >> @@ -468,6 +468,7 @@ config MACH_LOONGSON2EF
> > >>  
> > >>  config MACH_LOONGSON64
> > >>  	bool "Loongson 64-bit family of machines"
> > >> +	select ARCH_DMA_DEFAULT_COHERENT
> > >>  	select ARCH_SPARSEMEM_ENABLE
> > >>  	select ARCH_MIGHT_HAVE_PC_PARPORT
> > >>  	select ARCH_MIGHT_HAVE_PC_SERIO
> > >> @@ -1379,6 +1380,7 @@ config CPU_LOONGSON64
> > >>  	select CPU_SUPPORTS_MSA
> > >>  	select CPU_DIEI_BROKEN if !LOONGSON3_ENHANCEMENT
> > >>  	select CPU_MIPSR2_IRQ_VI
> > >> +	select DMA_NONCOHERENT
> > >>  	select WEAK_ORDERING
> > >>  	select WEAK_REORDERING_BEYOND_LLSC
> > >>  	select MIPS_ASID_BITS_VARIABLE
> > >> --- a/arch/mips/include/asm/mach-loongson64/boot_param.h
> > >> +++ b/arch/mips/include/asm/mach-loongson64/boot_param.h
> > >> @@ -117,7 +117,8 @@ struct irq_source_routing_table {
> > >>  	u64 pci_io_start_addr;
> > >>  	u64 pci_io_end_addr;
> > >>  	u64 pci_config_addr;
> > >> -	u32 dma_mask_bits;
> > >> +	u16 dma_mask_bits;
> > >> +	u16 dma_noncoherent;
> > >>  } __packed;
> > >>  
> > >>  struct interface_info {
> > >> --- a/arch/mips/loongson64/env.c
> > >> +++ b/arch/mips/loongson64/env.c
> > >> @@ -13,6 +13,8 @@
> > >>   * Copyright (C) 2009 Lemote Inc.
> > >>   * Author: Wu Zhangjin, wuzhangjin@gmail.com
> > >>   */
> > >> +
> > >> +#include <linux/dma-map-ops.h>
> > >>  #include <linux/export.h>
> > >>  #include <linux/pci_ids.h>
> > >>  #include <asm/bootinfo.h>
> > >> @@ -131,8 +133,14 @@ void __init prom_init_env(void)
> > >>  	loongson_sysconf.pci_io_base = eirq_source->pci_io_start_addr;
> > >>  	loongson_sysconf.dma_mask_bits = eirq_source->dma_mask_bits;
> > >>  	if (loongson_sysconf.dma_mask_bits < 32 ||
> > >> -		loongson_sysconf.dma_mask_bits > 64)
> > >> +			loongson_sysconf.dma_mask_bits > 64) {
> > >>  		loongson_sysconf.dma_mask_bits = 32;
> > >> +		dma_default_coherent = true;
> > >> +	} else {
> > >> +		dma_default_coherent = !eirq_source->dma_noncoherent;
> > >> +	}
> > >> +
> > >> +	pr_info("Firmware: Coherent DMA: %s\n", dma_default_coherent ? "on" : "off");
> > >>  
> > >>  	loongson_sysconf.restart_addr = boot_p->reset_system.ResetWarm;
> > >>  	loongson_sysconf.poweroff_addr = boot_p->reset_system.Shutdown;
> > >
> > > While preparing an update for Debian and finally building for all
> > > supported architecture, the builds for mipsel and mips64el were
> > > failing with:
> > >
> > > /<<PKGBUILDDIR>>/arch/mips/loongson64/env.c: In function 
> > > 'prom_init_env':
> > > /<<PKGBUILDDIR>>/arch/mips/loongson64/env.c:138:3: error: 
> > > 'dma_default_coherent' undeclared (first use in this function); did you 
> > > mean 'dma_free_coherent'?
> > >   138 |   dma_default_coherent = true;
> > >       |   ^~~~~~~~~~~~~~~~~~~~
> > >       |   dma_free_coherent
> > > /<<PKGBUILDDIR>>/arch/mips/loongson64/env.c:138:3: note: each 
> > > undeclared identifier is reported only once for each function it 
> > > appears in
> > > make[6]: *** [/<<PKGBUILDDIR>>/scripts/Makefile.build:291: 
> > > arch/mips/loongson64/env.o] Error 1
> > > make[6]: *** Waiting for unfinished jobs....
> > >
> > > Is here a prerequisite missing for the commit?
> > >
> > > Backporting though 6d4e9a8efe3d ("driver core: lift dma_default_coherent into
> > > common code") which is from 5.12-rc1 though seems too intrusive, correct? Would
> > > the alternative be to just revert the 3ee7e2faef87 ("MIPS: Loongson64: Enable
> > > DMA noncoherent support") commit which landed in 5.10.204?
> > 
> > Hi,
> > 
> > Sorry for not spotting the issue in the first place.
> > 
> > It actually requires more dependencies such as c00a60d6f4a1 ("of: address: always
> > use dma_default_coherent for default coherency").
> > 
> > I'll try to produce a backport series but better to drop this patch from stable
> > for now.
> 
> Thanks a lot for your quick reply! 
> 
> So I guess it only needs a revert for now from 5.10.y correct?
> 
> Greg, possible to already queue up the revert for 5.10.y for the next
> upload?

Now reverted, thanks.

greg k-h

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

end of thread, other threads:[~2024-01-03 10:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20231211182019.802717483@linuxfoundation.org>
     [not found] ` <20231211182023.277870337@linuxfoundation.org>
2023-12-30 19:38   ` [PATCH 5.10 81/97] MIPS: Loongson64: Enable DMA noncoherent support Salvatore Bonaccorso
2023-12-30 23:16     ` Jiaxun Yang
2023-12-31  9:33       ` Salvatore Bonaccorso
2024-01-03 10:40         ` Greg Kroah-Hartman

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).