Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751098AbeAPOK2 (ORCPT + 1 other); Tue, 16 Jan 2018 09:10:28 -0500 Received: from outils.crapouillou.net ([89.234.176.41]:39794 "EHLO crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750752AbeAPOK0 (ORCPT ); Tue, 16 Jan 2018 09:10:26 -0500 Date: Tue, 16 Jan 2018 15:10:20 +0100 From: Paul Cercueil Subject: Re: [PATCH v6 13/15] MIPS: JZ4770: Workaround for corrupted DMA transfers To: James Hogan Cc: Ralf Baechle , Maarten ter Huurne , Paul Burton , linux-kernel@vger.kernel.org, linux-mips@linux-mips.org Message-Id: <1516111821.1648.1@smtp.crapouillou.net> In-Reply-To: <20180110232045.GX27409@jhogan-linux.mipstec.com> References: <20180102150848.11314-1-paul@crapouillou.net> <20180105182513.16248-1-paul@crapouillou.net> <20180105182513.16248-14-paul@crapouillou.net> <20180110232045.GX27409@jhogan-linux.mipstec.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: Hi James, Le jeu. 11 janv. 2018 ? 0:20, James Hogan a ?crit : > On Fri, Jan 05, 2018 at 07:25:11PM +0100, Paul Cercueil wrote: >> [...] >> + >> +/* >> + * 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; >> + } >> +} >> diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c >> index 85bc601e9a0d..5a2c20145aee 100644 >> --- a/arch/mips/kernel/setup.c >> +++ b/arch/mips/kernel/setup.c >> @@ -879,6 +879,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 > > Hmm, a little bit ugly. I'm guessing the plat_mem_setup() callback is > too early since mem= parameters won't have been taken into account yet > from parse_early_param(). > > Is /memreserve/ in FDT of any value here or is it all too late due to > old DTs? > > Cheers > James When trying to test whether or not /memreserve/ fixes the corruption bug we were having, we ran into the problem that we can't reproduce it anymore. Sigh. So I'll skip this patch in the next patchset version, and handle this later if it reappears. -Paul