Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4962709ybi; Tue, 30 Jul 2019 11:13:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqzHihISYacBRig3RSKahEGnPiiUEYPYYLUX4n4WQ8JyKZI65lXGohtOyYlw7LjyOLnP6hyH X-Received: by 2002:a17:902:76c6:: with SMTP id j6mr116113216plt.102.1564510404254; Tue, 30 Jul 2019 11:13:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1564510404; cv=pass; d=google.com; s=arc-20160816; b=oRUUkvXsS4kq1QDe6tbB2KKNSvayhV9qAjGp0kKn+IC1DUuouwhUjgNNeifQtCpiZj GrK0KNobaZ/nkbh9pwixM7y4MznMzzfC+TUZZDdJGKzPFB3q2zNEDnUS1Iuu12BCWSv4 2j27Mt0nA9Gvp6Oy3MdyoI/J/k1SCYnEDGszG1HRdLqr/cmt/GUOGr4qUt4lmUXiYjSq 1Kj2IlpXdowQwfZytPOZSBm5S/JR0i63+WaSI82p7FsHmsdFFJTo3RsTjTTr36PfJkMW 9riyeHvjF6r8U0/mk59IqA/IxJHWOx9mMmQ6cLXoYiGS4cduQ9UANcNg3kEUDJG5392d bjyA== 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=728HodtxlQspuSWgc0WI2C4ZB/XnFKgXz7EKp0oAYhw=; b=UGV1YU0UqkHRRTtYtPZO3b9HX3c21+qqVR/xkYG/uWamG0DBQVbPZfCQU6aGobocDU oTwoiBEKDbF326ZfQElW7OwwctbA2WSwtB/uK7nU2UsSMcavIVnRVhXKB3rYC9CIvVvG XGKWFc5QTvPZlK00w291zB8RpPpw3GDf3uxNnlDzsv91J27qH1jUQKjRxdpvSfKExfNZ 3tHuDUmt36I5c0PGAWoqr69+BslawpzofJ1SACuD+wQ4yhCHKsiWl/xj+fAbOLYC6kJ+ uZKz60zyxXCGsU0V9h9yGdjhPfuB6ZCxuM9vDX73hPkigrUvffXgE9GvCPrYP1VQ69+K A8+A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@zoho.com header.s=zm2019 header.b="PDCa/6/+"; 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 70si27731462plc.253.2019.07.30.11.13.09; Tue, 30 Jul 2019 11:13:24 -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="PDCa/6/+"; 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 S1731432AbfG3RlV (ORCPT + 99 others); Tue, 30 Jul 2019 13:41:21 -0400 Received: from sender-pp-o92.zoho.com ([135.84.80.237]:25401 "EHLO sender-pp-o92.zoho.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726432AbfG3RlQ (ORCPT ); Tue, 30 Jul 2019 13:41:16 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1564508422; cv=none; d=zoho.com; s=zohoarc; b=du1Elyexm7ALYNjVm2ylWhySii8zUx7LoPwc2ifiFchS7A9hsjpQRY5aLGvh62Rk3631ueJ0SvFhJVFBf6f8L5zbev+04v8W/QcSDi4bPHZh+zpL9fjZFDEfdI/Ng9L7w34BGfv1peLKKNWXzK07rPIghSp9/Eewj07WHUP2U/A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564508422; h=Cc:Date:From:In-Reply-To:Message-ID:References:Subject:To:ARC-Authentication-Results; bh=728HodtxlQspuSWgc0WI2C4ZB/XnFKgXz7EKp0oAYhw=; b=noUnok43K/jGVu//UsP1+FRgFXEnB3PrwyMwBP173Gc/rOKxUcyGb7Zcstqk6vsdjCUDzuoUDGbnZnfSh33OxlXncQGKIYBAew2qYGdLv4MV73vIegYi9USmxUEQXS7SuAarA7Q/NP7LXK2lAizKvcYnmIoJ9ji8mnoscrTxJSw= 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=k9Mkye7d4RBrUeacHCGizzV6cKDVvaXSAs8ErlpQz/n2THTM3gwDa04+Wpzw9rs6OJhhBZKFBrCv jK9lNC8xiEGg/8iTAJtCLeYhpBdCh9GX5piwRt2sXnMJzucPgLKO DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1564508422; s=zm2019; d=zoho.com; i=zhouyanjie@zoho.com; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; l=2231; bh=728HodtxlQspuSWgc0WI2C4ZB/XnFKgXz7EKp0oAYhw=; b=PDCa/6/+P25Vb2iXqAfxpxF+ISNuxUF4Da8ly34ghulpmXWh1k8YfpN5OA5tEIKP hmFqEOQEvNfG+k4KG8xo/coR26+VJKteF7w+abMPSmQS6tk+az8KeSUMY7A0+cVN/4D DorXm91bZgtfFr/XqoF9UAYDPhYJTWk6mqMIRkB8= Received: from localhost.localdomain (171.221.113.137 [171.221.113.137]) by mx.zohomail.com with SMTPS id 156450842112058.53911824379736; Tue, 30 Jul 2019 10:40:21 -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, chenhc@lemote.com, tglx@linutronix.de, allison@lohutok.net, syq@debian.org, jiaxun.yang@flygoat.com Subject: [PATCH] MIPS: Ingenic: Fix bugs when detecting X1000's parameters. Date: Tue, 30 Jul 2019 22:55:10 +0800 Message-Id: <1564498510-3751-2-git-send-email-zhouyanjie@zoho.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1564498510-3751-1-git-send-email-zhouyanjie@zoho.com> References: <1564498510-3751-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 1.fix bugs when detecting L2 cache sets value. 2.fix bugs when detecting L2 cache ways value. 3.fix bugs when calculate bogoMips and loops_per_jiffy. Signed-off-by: Zhou Yanjie --- arch/mips/kernel/cpu-probe.c | 7 ++++++- arch/mips/mm/sc-mips.c | 18 +++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c index eb527a1..a914435 100644 --- a/arch/mips/kernel/cpu-probe.c +++ b/arch/mips/kernel/cpu-probe.c @@ -1960,11 +1960,16 @@ static inline void cpu_probe_ingenic(struct cpuinfo_mips *c, unsigned int cpu) c->options &= ~MIPS_CPU_COUNTER; BUG_ON(!__builtin_constant_p(cpu_has_counter) || cpu_has_counter); switch (c->processor_id & PRID_IMP_MASK) { - case PRID_IMP_XBURST: + case PRID_IMP_XBURST: { + unsigned int config7; c->cputype = CPU_XBURST; c->writecombine = _CACHE_UNCACHED_ACCELERATED; __cpu_name[cpu] = "Ingenic XBurst"; + config7 = read_c0_config7(); + config7 |= (1 << 4); + write_c0_config7(config7); break; + } default: panic("Unknown Ingenic Processor ID!"); break; diff --git a/arch/mips/mm/sc-mips.c b/arch/mips/mm/sc-mips.c index 9385ddb..ed953d4 100644 --- a/arch/mips/mm/sc-mips.c +++ b/arch/mips/mm/sc-mips.c @@ -215,6 +215,14 @@ static inline int __init mips_sc_probe(void) else return 0; + /* + * According to config2 it would be 512-sets, but that is contradicted + * by all documentation. + */ + if (current_cpu_type() == CPU_XBURST && + mips_machtype == MACH_INGENIC_X1000) + c->scache.sets = 256; + tmp = (config2 >> 0) & 0x0f; if (tmp <= 7) c->scache.ways = tmp + 1; @@ -225,9 +233,13 @@ static inline int __init mips_sc_probe(void) * According to config2 it would be 5-ways, but that is contradicted * by all documentation. */ - if (current_cpu_type() == CPU_XBURST && - mips_machtype == MACH_INGENIC_JZ4770) - c->scache.ways = 4; + if (current_cpu_type() == CPU_XBURST) { + switch (mips_machtype) { + case MACH_INGENIC_JZ4770: + case MACH_INGENIC_X1000: + c->scache.ways = 4; + } + } c->scache.waysize = c->scache.sets * c->scache.linesz; c->scache.waybit = __ffs(c->scache.waysize); -- 2.7.4