Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4465450ybi; Mon, 27 May 2019 19:21:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqwcyWzBRgOPFWwBdo4ztPlzNgUcHKQtD2isZXULF8xGzUPF/qI2BSbJXjaa/75F5Hj+iLg4 X-Received: by 2002:a17:90a:a27:: with SMTP id o36mr2272493pjo.95.1559010093602; Mon, 27 May 2019 19:21:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559010093; cv=none; d=google.com; s=arc-20160816; b=vO739OEj0orj+J0jzh8L/X9wvM5Z8P3zmilNn05+WD9mNiyTFFBntLxs3Pmuz8meaN QzuoX0CHxLvI2lFIAWaEgNwwt52lcNN9vkdK9eC5IBGm/OlmvvxVYU0ui0KtZ/uSw8ov mRHtC51cu1BBu4Ncjr1dtnUuSwu0VL6yb4Qc5kDSQrIcfdFrgyDLYylnoFTZx3A+HYH0 CCEBok0N2A0vIl3yzivjkPTlB1AyEfSG35kghhN3nyp5Q2nCK94vSmpY4oR3j2zWEUOe +sqbq/Tsoh8p92Yym5PCzJns40Pu6zbe6Kdaj4d4QIwmJ7fFD1hdkPS5eh5oLkMvZv3J VUUg== 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=D9nJucDgvI1sOj/Sbd0PmM9kn4FaZWIFbYM3do9ZLdE=; b=0id1GxmUXOBiJvvdVenjBfvLo2xNYq/DFS+w5BIhlAPLlK4QE3pOfpqxeBog6QkzmA LXE37g6RoRlcE4KDdLCmtuW1kIWv102/NhakyUfBsMEkeB8v0zxFmagW3KLk6n1yXt45 1EJy51hBhMr+JtDVmk6DppFcDmu9UuKSWc2AuiUgZRJZGtDg+/N4CWyf0sVtF+tCYN3l slgQNjlP1xp0a7TSWx81NTJPlrsI+E+cMAmYChiVhorCYeMjotBDTLyyO0Q4T6H4xTES 2WlAttWf909OjeqE3vjNb4u2jqZhmTOqETOY/hDu5A2kHI9jDC07p0vF8a6mQI337NNv tkAA== 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 z16si1233230pjq.99.2019.05.27.19.21.06; Mon, 27 May 2019 19:21:33 -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 S1727976AbfE1CSk (ORCPT + 99 others); Mon, 27 May 2019 22:18:40 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:17584 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727313AbfE1CSj (ORCPT ); Mon, 27 May 2019 22:18:39 -0400 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id A04CAB7387BA1A0B5B88; Tue, 28 May 2019 10:18:37 +0800 (CST) Received: from localhost.localdomain (10.67.212.132) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.439.0; Tue, 28 May 2019 10:18:29 +0800 From: Shaokun Zhang To: , CC: Shaokun Zhang , Greg Kroah-Hartman , "Rafael J. Wysocki" , "Sudeep Holla" , Catalin Marinas , Jeremy Linton , Will Deacon Subject: [PATCH v4 1/2] drivers: base: cacheinfo: Add variable to record max cache line size Date: Tue, 28 May 2019 10:16:53 +0800 Message-ID: <1559009814-17004-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. If it is available, we will synchronize it as cache line size, otherwise we will use 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 v3: -- Address Greg's comments -- Fix some commit information 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