Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3270354ybi; Sun, 26 May 2019 19:09:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqzcvzgfWRVd/rLL/uKiRcWSVFZ+9rwvnEYxoMzVIDpDfEWkAEPYr6i83YyV6+pD9BmYq73W X-Received: by 2002:a17:902:8ec4:: with SMTP id x4mr24046808plo.249.1558922966772; Sun, 26 May 2019 19:09:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558922966; cv=none; d=google.com; s=arc-20160816; b=CLx9u7fKkTr05C22cbv3GKtoEXoZjxeLjRcUluKvn2/JoBsAQZMc782XMuByZRPkdY f51kyrxJlLvea0HfZngPKQ5roUIlG6Ijic0jj5vuw8yAWSgUJUiCIU2xjVE9sG2WVWme Xc8cq+ieO86EMe/suqEcCZzSMYDYr9CLM9yW5kFDyrek6DhBVnMV7WFNv7rFp2BxvPgW NmFcUPJItxQjuKbsTmqMJ8FZHWkBbucJCJdS1C65mKiBvdT4rgEjG90BlSlJk4DzFcn7 8dtLQXUvboDFCBqRgU8HqbZPhnuIyjNnTopzj4sihDCJuDJspZuQ0MMp7UpgNP4I5gkI osLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=FOT19wRVlGpEvoffhC0bj6I/P0YfEDxJeoIJF656Jec=; b=U2OkzUu+107dGxi0Qse4aUe7hl27o/e8mKGlGetjapoedVSGEffhlgoKuBOaQeLCnp fK2HCS3BaJ4UrYVUSC53b4Pn//AMyjasVc6KtogvtwKMFGGl/FlWfvEXayf/iJQBPB/I uvLYpsQlh7OV+pDsHmtVpvv9WqmvjSNcAjjXf54m2eps8bHE43QbC90CRkdJ9TCT/duU kHtWdcuZVoTWw46t46lKO/LguGoMohLwc7gU8rmAxtOQMGs6hHpJxPz+4L619EUZIu4o rnp0MVPDlqXUHaz7NJDOrNfVaJboE/rLcijj8B3Emofn+iCJq4DOLXGlGXzh9SrFj4Lv Tc8Q== 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 k1si15212679pll.317.2019.05.26.19.09.08; Sun, 26 May 2019 19:09:26 -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; 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 S1726255AbfE0CH4 (ORCPT + 99 others); Sun, 26 May 2019 22:07:56 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:17579 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725923AbfE0CHz (ORCPT ); Sun, 26 May 2019 22:07:55 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 5FB2233BD9F184B792E4; Mon, 27 May 2019 10:07:53 +0800 (CST) Received: from localhost.localdomain (10.67.212.132) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.439.0; Mon, 27 May 2019 10:07:45 +0800 From: Shaokun Zhang To: , CC: Shaokun Zhang , Greg Kroah-Hartman , "Rafael J. Wysocki" , "Sudeep Holla" , Catalin Marinas , Jeremy Linton , Will Deacon Subject: [PATCH v3 1/2] drivers: base: cacheinfo: Add variable to record max cache line size Date: Mon, 27 May 2019 10:06:07 +0800 Message-ID: <1558922768-29155-1-git-send-email-zhangshaokun@hisilicon.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.212.132] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add coherency_max_size variable to record the maximum cache line size for different cache levels. We will synchronize it with CTR_EL0.CWG reporting in cache_line_size() for arm64. Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Cc: Sudeep Holla Cc: Catalin Marinas Cc: Jeremy Linton Cc: Will Deacon Signed-off-by: Shaokun Zhang --- ChangeLog since v2: -- Rebase to 5.2-rc2 -- Export cache_line_size for I/O driver ChangeLog since v1: -- Move coherency_max_size to drivers/base/cacheinfo.c -- Address Catalin's comments Link: https://www.spinics.net/lists/arm-kernel/msg723615.html drivers/base/cacheinfo.c | 5 +++++ include/linux/cacheinfo.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c index a7359535caf5..8827c60f51e2 100644 --- a/drivers/base/cacheinfo.c +++ b/drivers/base/cacheinfo.c @@ -213,6 +213,8 @@ int __weak cache_setup_acpi(unsigned int cpu) return -ENOTSUPP; } +unsigned int coherency_max_size; + static int cache_shared_cpu_map_setup(unsigned int cpu) { struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu); @@ -251,6 +253,9 @@ static int cache_shared_cpu_map_setup(unsigned int cpu) cpumask_set_cpu(i, &this_leaf->shared_cpu_map); } } + /* record the maximum cache line size */ + if (this_leaf->coherency_line_size > coherency_max_size) + coherency_max_size = this_leaf->coherency_line_size; } return 0; diff --git a/include/linux/cacheinfo.h b/include/linux/cacheinfo.h index 70e19bc6cc9f..46b92cd61d0c 100644 --- a/include/linux/cacheinfo.h +++ b/include/linux/cacheinfo.h @@ -17,6 +17,8 @@ enum cache_type { CACHE_TYPE_UNIFIED = BIT(2), }; +extern unsigned int coherency_max_size; + /** * struct cacheinfo - represent a cache leaf node * @id: This cache's id. It is unique among caches with the same (type, level). -- 2.7.4