lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f1d9a544-bb08-f78a-2a27-437cb9261a16@omp.ru>
Date:   Wed, 1 Nov 2023 19:27:11 +0300
From:   Sergey Shtylyov <s.shtylyov@....ru>
To:     Jiaxun Yang <jiaxun.yang@...goat.com>,
        Thomas Bogendoerfer <tsbogend@...ha.franken.de>
CC:     Huacai Chen <chenhuacai@...nel.org>, <linux-mips@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>, <stable@...r.kernel.org>
Subject: Re: [PATCH fixes 2/3] MIPS: Loongson64: Enable DMA noncoherent
 support

On 11/1/23 2:39 PM, Jiaxun Yang wrote:

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

   Working.

> 
> Cc: stable@...r.kernel.org
> Fixes: 71e2f4dd5a65 ("MIPS: Fork loongson2ef from loongson64")
> Signed-off-by: Jiaxun Yang <jiaxun.yang@...goat.com>
[...]

> diff --git a/arch/mips/include/asm/mach-loongson64/boot_param.h b/arch/mips/include/asm/mach-loongson64/boot_param.h
> index 035b1a69e2d0..c454ef734c45 100644
> --- 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 {
> diff --git a/arch/mips/loongson64/env.c b/arch/mips/loongson64/env.c
> index c961e2999f15..df0e92cd3920 100644
> --- 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@...il.com
>   */
> +
> +#include <linux/dma-map-ops.h>
>  #include <linux/export.h>
>  #include <linux/pci_ids.h>
>  #include <asm/bootinfo.h>
> @@ -147,8 +149,13 @@ void __init prom_lefi_init_env(void)
>  
>  	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) {

   Please indent this line differently, so it doesn't blend
with the following line (either start it in the same column
as the *if* expression above, or add 1 more tab).

>  		loongson_sysconf.dma_mask_bits = 32;
> +		dma_default_coherent = true;
> +	} else

   The kernel style dictates that you need to add {} on the *else*
branchh too.

> +		dma_default_coherent = !eirq_source->dma_noncoherent;
> +
> +	pr_info("DMA coherent: %s\n", dma_default_coherent ? "on" : "off");

   Maybe "Coherent DMA: %s\n"?

[...]

MBR, Sergey

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ