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


Groups > linux.kernel > #1674789

Re: [PATCH v2 15/17] MIPS: JZ4770: Workaround for corrupted DMA transfers

From Paul Cercueil <paul@crapouillou.net>
Newsgroups linux.kernel
Subject Re: [PATCH v2 15/17] MIPS: JZ4770: Workaround for corrupted DMA transfers
Date 2017-06-26 15:40 +0200
Message-ID <tWCpc-2Xw-33@gated-at.bofh.it> (permalink)
References <tPPrd-2PB-43@gated-at.bofh.it> <tUt6F-1QX-3@gated-at.bofh.it> <tUtgm-1UJ-29@gated-at.bofh.it> <tV4IW-1sJ-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi,

Le 2017-06-22 09:21, Marcin Nowakowski a écrit :
> Hi Paul, Maarten,
> 
> On 20.06.2017 17:18, Paul Cercueil wrote:
>> From: Maarten ter Huurne <maarten@treewalker.org>
>> 
>> We have seen MMC DMA transfers read corrupted data from SDRAM when
>> a burst interval ends at physical address 0x10000000. To avoid this
>> problem, we remove the final page of low memory from the memory map.
>> 
>> Signed-off-by: Maarten ter Huurne <maarten@treewalker.org>
>> ---
>>   arch/mips/jz4740/setup.c | 24 ++++++++++++++++++++++++
>>   arch/mips/kernel/setup.c |  8 ++++++++
>>   2 files changed, 32 insertions(+)
>> 
>>   v2: No change
>> 
>> diff --git a/arch/mips/jz4740/setup.c b/arch/mips/jz4740/setup.c
>> index afd84ee966e8..6948b133a15d 100644
>> --- a/arch/mips/jz4740/setup.c
>> +++ b/arch/mips/jz4740/setup.c
>> @@ -23,6 +23,7 @@
>>     #include <asm/bootinfo.h>
>>   #include <asm/mips_machine.h>
>> +#include <asm/page.h>
>>   #include <asm/prom.h>
>>     #include <asm/mach-jz4740/base.h>
>> @@ -102,6 +103,29 @@ void __init arch_init_irq(void)
>>   	irqchip_init();
>>   }
>>   +/*
>> + * We have seen MMC DMA transfers read corrupted data from SDRAM when 
>> a burst
>> + * interval ends at physical address 0x10000000. To avoid this 
>> problem, we
>> + * remove the final page of low memory from the memory map.
>> + */
>> +void __init jz4770_reserve_unsafe_for_dma(void)
>> +{
>> +	int i;
>> +
>> +	for (i = 0; i < boot_mem_map.nr_map; i++) {
>> +		struct boot_mem_map_entry *entry = boot_mem_map.map + i;
>> +
>> +		if (entry->type != BOOT_MEM_RAM)
>> +			continue;
>> +
>> +		if (entry->addr + entry->size != 0x10000000)
>> +			continue;
>> +
>> +		entry->size -= PAGE_SIZE;
>> +		break;
>> +	}
>> +}
>> +
>>   static int __init jz4740_machine_setup(void)
>>   {
>>   	mips_machine_setup();
>> diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
>> index 89785600fde4..cccfd7ba89fe 100644
>> --- a/arch/mips/kernel/setup.c
>> +++ b/arch/mips/kernel/setup.c
>> @@ -838,6 +838,14 @@ static void __init arch_mem_init(char 
>> **cmdline_p)
>>     	parse_early_param();
>>   +#ifdef CONFIG_MACH_JZ4770
>> +	if (current_cpu_type() == CPU_JZRISC &&
>> +				mips_machtype == MACH_INGENIC_JZ4770) {
>> +		extern void __init jz4770_reserve_unsafe_for_dma(void);
>> +		jz4770_reserve_unsafe_for_dma();
>> +	}
>> +#endif
>> +
> 
> This part doesn't look good in the platform-agnostic code ... is there
> a reason why you wouldn't do that from within plat_mem_setup()?
> 

I agree, but, doing it in plat_mem_setup() is too early, as the 'boot 
mem map' hasn't been initialized yet then...

>>   	if (usermem) {
>>   		pr_info("User-defined physical RAM map:\n");
>>   		print_memory_map();
>> 
> 
> 
> Marcin

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 01/17] clk: ingenic: Use const pointer to clk_ops in struct Paul Cercueil <paul@crapouillou.net> - 2017-06-20 17:30 +0200
  [PATCH v2 08/17] serial: 8250_ingenic: Parse earlycon options Paul Cercueil <paul@crapouillou.net> - 2017-06-20 17:30 +0200
  [PATCH v2 15/17] MIPS: JZ4770: Workaround for corrupted DMA transfers Paul Cercueil <paul@crapouillou.net> - 2017-06-20 17:30 +0200
    Re: [PATCH v2 15/17] MIPS: JZ4770: Workaround for corrupted DMA  transfers Marcin Nowakowski <marcin.nowakowski@imgtec.com> - 2017-06-22 09:30 +0200
      Re: [PATCH v2 15/17] MIPS: JZ4770: Workaround for corrupted DMA  transfers Paul Cercueil <paul@crapouillou.net> - 2017-06-26 15:40 +0200
  [PATCH v2 03/17] clk: ingenic: support PLLs with no bypass bit Paul Cercueil <paul@crapouillou.net> - 2017-06-20 17:30 +0200
  [PATCH v2 07/17] serial: 8250_ingenic: Add support for the JZ4770 SoC Paul Cercueil <paul@crapouillou.net> - 2017-06-20 17:30 +0200
  [PATCH v2 06/17] serial: core: Make uart_parse_options take const char* argument Paul Cercueil <paul@crapouillou.net> - 2017-06-20 17:30 +0200
  [PATCH v2 05/17] clk: Add Ingenic jz4770 CGU driver Paul Cercueil <paul@crapouillou.net> - 2017-06-20 17:30 +0200
  [PATCH v2 16/17] devicetree/bindings: Add GCW vendor prefix Paul Cercueil <paul@crapouillou.net> - 2017-06-20 17:30 +0200
  Re: [PATCH v2 01/17] clk: ingenic: Use const pointer to clk_ops in  struct Stephen Boyd <sboyd@codeaurora.org> - 2017-06-22 00:00 +0200
    Re: [PATCH v2 01/17] clk: ingenic: Use const pointer to clk_ops in  struct Paul Cercueil <paul@crapouillou.net> - 2017-06-26 15:50 +0200

csiph-web