From patchwork Fri Nov 17 11:56:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 119148 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp421897qgn; Fri, 17 Nov 2017 03:57:01 -0800 (PST) X-Google-Smtp-Source: AGs4zMZUrq2b77TP4w7NSOb9ot49Snkxj9KtdyJqanKRalkhkFrUYtG9FnBxDf41nci+6L4HJXqz X-Received: by 10.99.109.193 with SMTP id i184mr4857389pgc.187.1510919820930; Fri, 17 Nov 2017 03:57:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510919820; cv=none; d=google.com; s=arc-20160816; b=rYiXdNxBl4rRD4/OEfhaJc4uP+AC1pJLrmax1mp6RTgDjYk5fFVqfOWAf/pNaPe7QQ r4Zib4qfZSvJ9JB46e6osyjw59CZtj/IwfC7ZYz/i50JOiOTFJHj7aFZTaUckjY/GTZr AlD9pRVZDQSvfPS7tuuyOLp6iQqqKz1hZxupELU/qFCWA3oUK77lryRQZY3HgyIWlP7J LGJIXFBX79jbrmQl+8Xv17h32tgnO075+M3+km4l+xiBoe8JOXp19if5rd5LU7tSglRo jwzDq9ggUoaHFWu1Kc54/i1yu2qPCVHav6F5MImmBc1MWIPaVwqtZIbu517jqhAMdB// rg0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=aN85nE7oAscS1E7Pif2/2M4OgZPKG19edmA9qFuuAOs=; b=oTSe5A+pAUWU+RwtG1XpPqsI3+jQtOPcYpXHHPzn7J9lPQ5urt7d/fWDH1XLNdEnUR AWJEwimU+GileZ0vqkuD47sGP9QSDHYy4ehyBH+ERtkF3AEUDUCpQmvGB6WkXaqNsV6b ZOHb2cp/BQ7F2NJQ/htUXkiswDvhO/pO59dYOi3pje6nNvBYMWJmRHTwb9qHv2xZmrVo 7VbYHbvB+xoYrWMZ3nHzXLRoHQh7krlzhU8l/BcqqG1EmYc+yHOExdxWa04jVPl+Upiv Bcl7G8gsg497Uipdd/8UR69j+ru52FljG37EzSXFnfGIjaSNNpEKhBJkiQ6Gl9qdPaRU 8cGQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o12si2585634pgv.237.2017.11.17.03.57.00; Fri, 17 Nov 2017 03:57:00 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754941AbdKQL47 (ORCPT + 28 others); Fri, 17 Nov 2017 06:56:59 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:33740 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751060AbdKQL4w (ORCPT ); Fri, 17 Nov 2017 06:56:52 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F04A080D; Fri, 17 Nov 2017 03:56:51 -0800 (PST) Received: from e107155-lin.cambridge.arm.com (unknown [10.1.210.28]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 0FD763F318; Fri, 17 Nov 2017 03:56:50 -0800 (PST) From: Sudeep Holla To: linux-kernel@vger.kernel.org Cc: Sudeep Holla , Tan Xiaojun , Greg Kroah-Hartman Subject: [PATCH] drivers: base: cacheinfo: fix cache type for non-architected system cache Date: Fri, 17 Nov 2017 11:56:41 +0000 Message-Id: <1510919801-6738-1-git-send-email-sudeep.holla@arm.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit dfea747d2aba ("drivers: base: cacheinfo: support DT overrides for cache properties") doesn't initialise the cache type if it's present only in DT and the architecture is not aware of it. They are unified system level cache which are generally transparent. This patch check if the cache type is set to NOCACHE but the DT node indicates that it's unified cache and sets the cache type accordingly. Fixes: dfea747d2aba ("drivers: base: cacheinfo: support DT overrides for cache properties") Reported-and-tested-by: Tan Xiaojun Cc: Greg Kroah-Hartman Signed-off-by: Sudeep Holla --- drivers/base/cacheinfo.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) -- 2.7.4 diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c index eb3af2739537..07532d83be0b 100644 --- a/drivers/base/cacheinfo.c +++ b/drivers/base/cacheinfo.c @@ -186,6 +186,11 @@ static void cache_associativity(struct cacheinfo *this_leaf) this_leaf->ways_of_associativity = (size / nr_sets) / line_size; } +static bool cache_node_is_unified(struct cacheinfo *this_leaf) +{ + return of_property_read_bool(this_leaf->of_node, "cache-unified"); +} + static void cache_of_override_properties(unsigned int cpu) { int index; @@ -194,6 +199,14 @@ static void cache_of_override_properties(unsigned int cpu) for (index = 0; index < cache_leaves(cpu); index++) { this_leaf = this_cpu_ci->info_list + index; + /* + * init_cache_level must setup the cache level correctly + * overriding the architecturally specified levels, so + * if type is NONE at this stage, it should be unified + */ + if (this_leaf->type == CACHE_TYPE_NOCACHE && + cache_node_is_unified(this_leaf)) + this_leaf->type = CACHE_TYPE_UNIFIED; cache_size(this_leaf); cache_get_line_size(this_leaf); cache_nr_sets(this_leaf);