Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp5028653ybc; Fri, 15 Nov 2019 13:38:15 -0800 (PST) X-Google-Smtp-Source: APXvYqx/zlGkoLvzJIXQTbGUsUZEAKq1+7lccTNiUKEzqrQoEX8KjAZgnmQsqqgTZYQ+Xuzmrhgo X-Received: by 2002:a17:906:25cb:: with SMTP id n11mr3839658ejb.239.1573853895846; Fri, 15 Nov 2019 13:38:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573853895; cv=none; d=google.com; s=arc-20160816; b=M0AzJCqYXN3J/GLeASlv8H5TrMAOLeFKOmGqKiIJ1Gv4mCXp9SQ8PmkeD9bbnWezSN q/cMhUmGje1MyS81URK+LBKOZCK82YVgiRgGHWQZSZ6Yhhyi2kVMRy9gNewVVUQUy5rY hoDvnDa0Y/ZDEHhz4tCTk76ySqfESnXTf2u4x7j5cNkYeiP/emFqQJnuK8n2lwlVrmia zBjieMV92gviQtnfDAMDXi0v4yxE3KMc/hepRk55BgwBccMk3FHMvLL1QH0loqA9/+iU EDlxW69RbAMfzNlPf1WLWd5TeLUeTharpd0l8ti3xbJYVv75ZMvzNEn/pYK00Io3wtnd zzFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=HKB+jFOHyqunil9vKc+eJ+fGW7O6CCFe80yOgJOM6R0=; b=fmUJsBZdThv4m6DaxzfcgOotHFbsiA7tgBFVRh1DiybfgAiD00CGPutwpjZyUh+x26 0PIzijG0hLgopRVetK6tlT9MUZq93OLMgADauU1B/eqL35sPNpRRwZiOqnkDyikoKyhp cukLAw4cMpxDckpbrOxyTGg3MYFwN2aP9gdWjOXy5vTxqmji6mPnuCJQDACtEy7BLc6f Z9MKoXhviKRWLy/mCngifgGgtFQE15h2UEHj22UY5hBMjrd7/hPVhrxdpfUBCETDfbv2 FoAz2Zrwj2TJ35V3vTtI9S+aMSaNShsovkAeAov81TuDv6hzMPos1aFsIXbcLiNsTn4L pwTg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l16si6335625ejg.240.2019.11.15.13.37.51; Fri, 15 Nov 2019 13:38:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726910AbfKOVgq (ORCPT + 99 others); Fri, 15 Nov 2019 16:36:46 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:43284 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726640AbfKOVgp (ORCPT ); Fri, 15 Nov 2019 16:36:45 -0500 Received: by mail-pl1-f195.google.com with SMTP id a18so5530106plm.10; Fri, 15 Nov 2019 13:36:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=HKB+jFOHyqunil9vKc+eJ+fGW7O6CCFe80yOgJOM6R0=; b=Yek8216+l3N9sznKB1W6Fco8bhNQfpnYdU5wWE0c/6K702QyuHifQJGCBHF9hFlIE8 Nz3Jc6jk8/6PWLbQDLuivi0hCJKuXCHdLgFA97kmZ3Ed1UiTwhq1sUjxQYmOV09CWn4i 1c3MyyLNJee/yd59hpP2bihkg+rofBGKb6wKGdN3GeFU/nbNK1IzoG9mEl2Mm/QHjKSw /esQnxmkfpJbS5w4bRAhoXNmRJ39atc7AkxBbfwePmNRoZeayrDxaBwxn+ruJma/g10Z Bt/cosLh0MfpxM6Ml/mphMI/xwYPs1EZspiNOxaF/2LHRmTW5ewA1aKvXuJz6ya1Z5xP 7FKg== X-Gm-Message-State: APjAAAWaUnJvs0UfrYQSU6H9FD0FkCMto5wTxYFEBPiWk9KlQZHnGAF1 AxAoW9Nt2/B2aQ5EIuh9ynkenMd8svolHg== X-Received: by 2002:a17:902:5985:: with SMTP id p5mr17934348pli.259.1573853804377; Fri, 15 Nov 2019 13:36:44 -0800 (PST) Received: from localhost ([2601:646:8a00:9810:5af3:56d9:f882:39d4]) by smtp.gmail.com with ESMTPSA id p16sm11701614pfn.171.2019.11.15.13.36.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Nov 2019 13:36:43 -0800 (PST) Date: Fri, 15 Nov 2019 13:37:16 -0800 From: Paul Burton To: Zhou Yanjie Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, ralf@linux-mips.org, jhogan@kernel.org, gregkh@linuxfoundation.org, paul.burton@mips.com, chenhc@lemote.com, paul@crapouillou.net, tglx@linutronix.de, jiaxun.yang@flygoat.com Subject: Re: [PATCH 2/2] MIPS: Ingenic: Disable abandoned HPTLB function. Message-ID: <20191115213716.wt4wn2moj3fup4dc@lantea.localdomain> References: <1571909341-10108-1-git-send-email-zhouyanjie@zoho.com> <1571909341-10108-3-git-send-email-zhouyanjie@zoho.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1571909341-10108-3-git-send-email-zhouyanjie@zoho.com> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Zhou, On Thu, Oct 24, 2019 at 05:29:01PM +0800, Zhou Yanjie wrote: > JZ4760/JZ4770/JZ4775/X1000/X1500 has an abandoned huge page > tlb, write 0xa9000000 to cp0 config5 sel4 to disable this > function to prevent getting stuck. Can you describe how we "get stuck"? What actually goes wrong on the affected CPUs? Do they misinterpret EntryLo values? Which bits do they misinterpret? > Confirmed by Ingenic, > this operation will not adversely affect processors > without HPTLB function. > > Signed-off-by: Zhou Yanjie > --- > arch/mips/kernel/cpu-probe.c | 16 ++++++++++++++-- > 1 file changed, 14 insertions(+), 2 deletions(-) > > diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c > index 16033a4..cfebf8c 100644 > --- a/arch/mips/kernel/cpu-probe.c > +++ b/arch/mips/kernel/cpu-probe.c > @@ -1966,11 +1966,23 @@ static inline void cpu_probe_ingenic(struct cpuinfo_mips *c, unsigned int cpu) > } > > /* > - * The config0 register in the Xburst CPUs with a processor ID of > + * The config0 register in the XBurst CPUs with a processor ID of > + * PRID_COMP_INGENIC_D1 has an abandoned huge page tlb, write > + * 0xa9000000 to cp0 config5 sel4 to disable this function to Saying "config5" suggests $16 sel 5 to me - Config5 is after all an architecturally defined register & it's not this one. It'd be better to say "cop0 register 5 sel 4". > + * prevent getting stuck. > + */ > + if ((c->processor_id & PRID_COMP_MASK) == PRID_COMP_INGENIC_D1) { > + __asm__ ( > + "li $2, 0xa9000000 \n\t" > + "mtc0 $2, $5, 4 \n\t" > + "nop \n\t" > + ::"r"(2)); I'd prefer that you add #defines to asm/mipsregs.h to provide a write_c0_X() function where X is replaced with whatever the name of this register is, and preferably also #define macros describing the fields present in the register. Writing a magic number isn't ideal. > + /* > + * The config0 register in the XBurst CPUs with a processor ID of > * PRID_COMP_INGENIC_D0 report themselves as MIPS32r2 compatible, > * but they don't actually support this ISA. > */ > - if ((c->processor_id & PRID_COMP_MASK) == PRID_COMP_INGENIC_D0) > + } else if ((c->processor_id & PRID_COMP_MASK) == PRID_COMP_INGENIC_D0) It might be cleaner to use a switch statement rather than writing out the & PRID_COMP_MASK condition twice? Thanks, Paul