Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp904730ybi; Fri, 2 Aug 2019 06:15:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqzgDFxaQJ8Q9h/Y2x78f0Y8InuujliLesYqA3G3oSSZ5ZUUtSKgUz+PPJPrV0JJJqPkxvaY X-Received: by 2002:a17:90a:2ec1:: with SMTP id h1mr4297805pjs.119.1564751747274; Fri, 02 Aug 2019 06:15:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1564751747; cv=pass; d=google.com; s=arc-20160816; b=mxZbFGhSzUR2L7jVmn2w3P/qWLCaRaqNkPNJW0YiGJa/RPPDjtycol4JA5HaZfsxLj ykH0csXHDJl4+uOhnQZafUYWD5FA+9pU9psyeuS6tgf5eqIh8y+Oojoe6JEwL0WbIo1i WJ+ONYlG+loW212S/NF3jmEw56n/RouUWqDy60kY3++2xC+APLF8CytA2H7cyToYPC6Y I5aV0N/whg6PGYOtIZJVOVFrDXZAjqxWP/SHnK0ZZwRvmrlb0l2H96YVJzSl43Cq0yBr pcQZFVXcg3Pv/vE+R61oTVR8G2hQsZSjIQmOVR0rLVnd88dl0OWqp6hmirgbv9T0cath LdNA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:domainkey-signature; bh=XInzzMgiWJcFkaRBKjAqwD6Ji5EqOMk9SfoHZu+8Meo=; b=cL09vdQMgmw+5MIC4VCUxL1b/Sn7dk8azlrT3qUe7QklGwZZEbBxIvbP0LBRDjhdLE 2Fl8rOu7zRlHEkLSzNSgzixAR3AoWFvmk50KSKYnDy1EtH3U8gKeowm3imerSk5HkixJ WiEW27yTL686sLa0AvhNtVddOHz/18UEF1Rnna00rW2itZ+ahwQP3Xt0u3gCKeekw895 u/SmdMynCrNLENRABDShYBzTviW37taFaWAGJC4KJHVyrSLelLVClFE2pUzVd6QQIU/z SWX1IefDhpoW2Hh5OZc8ZDofaBMWYw5QOwY8lX3hZe47Jb5W/pIuChc/Z7OG7Xof7sHD 9YoA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@zoho.com header.s=zm2019 header.b=Ot84g6lq; arc=pass (i=1 spf=pass spfdomain=zoho.com dkim=pass dkdomain=zoho.com dmarc=pass fromdomain=zoho.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=pass (p=REJECT sp=REJECT dis=NONE) header.from=zoho.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n6si41262351pgl.419.2019.08.02.06.15.32; Fri, 02 Aug 2019 06:15:47 -0700 (PDT) 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; dkim=pass header.i=@zoho.com header.s=zm2019 header.b=Ot84g6lq; arc=pass (i=1 spf=pass spfdomain=zoho.com dkim=pass dkdomain=zoho.com dmarc=pass fromdomain=zoho.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=pass (p=REJECT sp=REJECT dis=NONE) header.from=zoho.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390858AbfHBI3I (ORCPT + 99 others); Fri, 2 Aug 2019 04:29:08 -0400 Received: from sender-pp-o92.zoho.com ([135.84.80.237]:25402 "EHLO sender-pp-o92.zoho.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731576AbfHBI3H (ORCPT ); Fri, 2 Aug 2019 04:29:07 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1564734486; cv=none; d=zoho.com; s=zohoarc; b=Rko2+rMWSy68EF5M0q1Ehmsk7cY9OZoEtn7ImthRZJbcl+kwKAkb1Oo7lfPfgNl9ny5E/UOuBHksuHxmXyjfIej0HvN4Gp5IKcJbGRT/AFPZLuv2p3PENxkOcEvW/ob7t0u/qOo3kT8MfOY86Aq5IRyfaic3+yCg5deMqlQNMZE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564734486; h=Cc:Date:From:In-Reply-To:Message-ID:References:Subject:To:ARC-Authentication-Results; bh=XInzzMgiWJcFkaRBKjAqwD6Ji5EqOMk9SfoHZu+8Meo=; b=mryTHn8MZ46YJqr3jnaF7YcuUMWZBR2xuYirGcXxTrF43oTtrOg2zhvsr3iSsnZT/UIDtimhOWt0u5BxgJGdbwulNGZ98ooDlhY87WsQMQrkV8kWncRgfKXGx0TnpfUC+iPFmK6boR9m9VfFxjpF9rQmp4E7ieJFfoqz2fP3+BU= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass header.i=zoho.com; spf=pass smtp.mailfrom=zhouyanjie@zoho.com; dmarc=pass header.from= header.from= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=zapps768; d=zoho.com; h=from:to:cc:subject:date:message-id:in-reply-to:references; b=ZjBpQvo/tw8NGuUcwJgoAXY0goXCCYRVtPUnr9Q5yMfCj1zWbJC+kAK+tybO7qvql2ZPEFB5CIal m+q+c9ehlricXdCEPvxzirH3+6O8JwA3P2Rm+wIFo2qxJE694QhP DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1564734486; s=zm2019; d=zoho.com; i=zhouyanjie@zoho.com; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; l=1930; bh=XInzzMgiWJcFkaRBKjAqwD6Ji5EqOMk9SfoHZu+8Meo=; b=Ot84g6lqLoc1OjB+B0Bud8/mCMBuhjWliMItYKSR3TixWIs6pcbxnFAnOrI20gPD 1cTh56Y8sXOXqG5pMJtcm8P/1PDRc06+xlmOVPutADpwOGVeC/Nr4Jce+09ifNJh38x 2qmpR9bhnZBZoF1Pz6fXJrp9bySJ02tb8cx258OE= Received: from localhost.localdomain (125.71.5.36 [125.71.5.36]) by mx.zohomail.com with SMTPS id 1564734483932104.33420675435002; Fri, 2 Aug 2019 01:28:03 -0700 (PDT) From: Zhou Yanjie To: linux-mips@vger.kernel.org Cc: linux-kernel@vger.kernel.org, ralf@linux-mips.org, paul@crapouillou.net, paul.burton@mips.com, jhogan@kernel.org, malat@debian.org, gregkh@linuxfoundation.org, tglx@linutronix.de, allison@lohutok.net, syq@debian.org, chenhc@lemote.com, jiaxun.yang@flygoat.com Subject: [PATCH 2/2 v4] MIPS: Ingenic: Disable broken BTB lookup optimization. Date: Fri, 2 Aug 2019 16:27:37 +0800 Message-Id: <1564734457-48801-3-git-send-email-zhouyanjie@zoho.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1564734457-48801-1-git-send-email-zhouyanjie@zoho.com> References: <1564498510-3751-1-git-send-email-zhouyanjie@zoho.com> <1564734457-48801-1-git-send-email-zhouyanjie@zoho.com> X-ZohoMailClient: External Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In order to further reduce power consumption, the XBurst core by default attempts to avoid branch target buffer lookups by detecting & special casing loops. This feature will cause BogoMIPS and lpj calculate in error. Set cp0 config7 bit 4 to disable this feature. Signed-off-by: Zhou Yanjie --- arch/mips/include/asm/mipsregs.h | 4 ++++ arch/mips/kernel/cpu-probe.c | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h index 1e6966e..bdbdc19 100644 --- a/arch/mips/include/asm/mipsregs.h +++ b/arch/mips/include/asm/mipsregs.h @@ -689,6 +689,9 @@ #define MIPS_CONF7_IAR (_ULCAST_(1) << 10) #define MIPS_CONF7_AR (_ULCAST_(1) << 16) +/* Ingenic Config7 bits */ +#define MIPS_CONF7_BTB_LOOP_EN (_ULCAST_(1) << 4) + /* Config7 Bits specific to MIPS Technologies. */ /* Performance counters implemented Per TC */ @@ -2813,6 +2816,7 @@ __BUILD_SET_C0(status) __BUILD_SET_C0(cause) __BUILD_SET_C0(config) __BUILD_SET_C0(config5) +__BUILD_SET_C0(config7) __BUILD_SET_C0(intcontrol) __BUILD_SET_C0(intctl) __BUILD_SET_C0(srsmap) diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c index eb527a1..2bdd3e1 100644 --- a/arch/mips/kernel/cpu-probe.c +++ b/arch/mips/kernel/cpu-probe.c @@ -1964,6 +1964,13 @@ static inline void cpu_probe_ingenic(struct cpuinfo_mips *c, unsigned int cpu) c->cputype = CPU_XBURST; c->writecombine = _CACHE_UNCACHED_ACCELERATED; __cpu_name[cpu] = "Ingenic XBurst"; + /* + * The XBurst core by default attempts to avoid branch target + * buffer lookups by detecting & special casing loops. This + * feature will cause BogoMIPS and lpj calculate in error. + * Set cp0 config7 bit 4 to disable this feature. + */ + set_c0_config7(MIPS_CONF7_BTB_LOOP_EN); break; default: panic("Unknown Ingenic Processor ID!"); -- 2.7.4