Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp1186862pxb; Wed, 16 Feb 2022 13:03:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJwNqpri7BYUxJJjbg+BABp1J8HyRxRJGJunXbd9yWFzza4xqlVFRls/ObY65k17xCTRsJfb X-Received: by 2002:a05:6a00:1a09:b0:4e1:67a7:2c87 with SMTP id g9-20020a056a001a0900b004e167a72c87mr782008pfv.37.1645045425801; Wed, 16 Feb 2022 13:03:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645045425; cv=none; d=google.com; s=arc-20160816; b=qWgkowsnKfvuAv2Zzg0Z9EcqRZbX39Wl9NfOkc03jseJ269o2848M+E7gqv7sTfxZl odyDxGaV6R2z9NRhUx19UHrt4FuHMQQOsiqaPIaJjT0AR6GP+WFaydiYBjG5K78Q3ush sjLTMaYMrCfTFwxN6joHtdS93hQOoFP2uep5zHD8lFSQN+yPF8K/psbJ18YmmU8KJ3OJ 0/Oq9lvVa1jUUtv7Q9qD7YMZHNe0aftSHc91MZx3BeIAw9TuwmDiozGlsJnOb9C86Re+ OGyU0C24U55Shg4TMOH5gkdvB4rF4xqreGBmt2Jsh2FcuVlna3YDrPvU0LG1IsxB/LiF wJ+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=Fib7msiQeZ+PmMmyivx8nkMiSre2hmlJ1TCOKtLeIKY=; b=tiU33yD527n03QTjJ5IGEBnuqVJzGZYdTyNXDNvinUI7f8hlQZLchBCaOREi2ki1tM icnEQOzNR1sAzR8xBSnYTzOXpmI6qwWIeZW9etrFn2kTliL1TcNmEtNXaa+XbU+0bIkl MnF2s9AdvF1BBA38pFsEKZcx5LDd1VOssaFNo6u+MEhia6/iOkCcJwi1xQ7+hxn8ZBtV MY99Ux2IDjq1SkpBoMEZAN7eMtBjaHbuccbPT6rPw3kM7MpzK9yF5BB20hjQQ0667P+A nNNdwIbGda5XUsWn+0wdmAg2tKri2K7J2DE7IluwfvmnfEPnUzpsTLckKH5AjwuA/MAG Cpuw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j17si21626564plx.316.2022.02.16.13.03.30; Wed, 16 Feb 2022 13:03:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236536AbiBPT50 (ORCPT + 99 others); Wed, 16 Feb 2022 14:57:26 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233169AbiBPT5Z (ORCPT ); Wed, 16 Feb 2022 14:57:25 -0500 Received: from elvis.franken.de (elvis.franken.de [193.175.24.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B7335222DE6; Wed, 16 Feb 2022 11:57:12 -0800 (PST) Received: from uucp (helo=alpha) by elvis.franken.de with local-bsmtp (Exim 3.36 #1) id 1nKQQI-00055x-01; Wed, 16 Feb 2022 20:57:10 +0100 Received: by alpha.franken.de (Postfix, from userid 1000) id 84055C250A; Wed, 16 Feb 2022 20:54:23 +0100 (CET) Date: Wed, 16 Feb 2022 20:54:23 +0100 From: Thomas Bogendoerfer To: Chuanhong Guo Cc: linux-mips@vger.kernel.org, Rui Salvaterra , Ilya Lipnitskiy , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] MIPS: ralink: mt7621: do memory detection on KSEG1 Message-ID: <20220216195423.GA17551@alpha.franken.de> References: <20220211001345.3429572-1-gch981213@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220211001345.3429572-1-gch981213@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_NONE,T_SCC_BODY_TEXT_LINE,T_SPF_HELO_PERMERROR autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 11, 2022 at 08:13:44AM +0800, Chuanhong Guo wrote: > It's reported that current memory detection code occasionally detects > larger memory under some bootloaders. > Current memory detection code tests whether address space wraps around > on KSEG0, which is unreliable because it's cached. > > Rewrite memory size detection to perform the same test on KSEG1 instead. > While at it, this patch also does the following two things: > 1. use a fixed pattern instead of a random function pointer as the magic > value. > 2. add an additional memory write and a second comparison as part of the > test to prevent possible smaller memory detection result due to > leftover values in memory. > > Fixes: 139c949f7f0a MIPS: ("ralink: mt7621: add memory detection support") > Reported-by: Rui Salvaterra > Signed-off-by: Chuanhong Guo > --- > arch/mips/ralink/mt7621.c | 36 +++++++++++++++++++++++------------- > 1 file changed, 23 insertions(+), 13 deletions(-) applied to mips-fixes. Thomas. -- Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]