Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1744718ybl; Sat, 11 Jan 2020 01:58:01 -0800 (PST) X-Google-Smtp-Source: APXvYqzvIGmdpAUYu6fT6kSoKkZHty9YgffgCwqZjJ7CPdUWKiO7WwqEyh3AEQRfLVSe8q9wbBYp X-Received: by 2002:a05:6830:1042:: with SMTP id b2mr6151419otp.306.1578736681206; Sat, 11 Jan 2020 01:58:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578736681; cv=none; d=google.com; s=arc-20160816; b=bgjld+x5Ku9FmPgc1DbjNyHqlS5SGeTyQoq9NGeKjyoEMgihL/Rwh6J4TcpgUmWBqI ezkssvD8iCsjj2ljoGuh+hLyEiCJr7eMIM5/QrpdqQtJPUhZ3RQEtGZEXy28SsGG/Fh7 iV4gs5Czr3F36zTsl4QyfCFdL2hfyizSWNfS9kWm5QRe3cPrNr6zik/lbKezCmmRs6aW 3frdF4QoTwzQolyFxH6BLuvL5Svsxo7JI/8zFm86muF7zH3K+Loc88DJIMJM0S0QLMZv 3XJm7xDp+equeyLMNC7jTPz+04lVHqdw4XX4Mqki/8v5PP7jiSnBScHRjj/tUu+zSAow qLXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sSWV2xF7dNAe4mvOzzWHaC4miVocCm58YVFIto7f7H0=; b=JYJlvzbzpgAhLOjLl/Rb6pwIEXzuxUdouxpb1qFjLUPoezUVBr7G1nVL52k5teZk9Z cUOBlODkfv+a5FGUEgxzHoJVP7N8QVDyLp7tyB8eRVRmtZhILmt7Td6hZxXiCemTPKen prwp7mCkL5gaNJj+JgA6je0NAfkbAJRJwRGyFplLIq+MdX0ZpckimyYhyZnfZiAjpEVP jumRa5RwxVd46wUb3BhujUXdIv/Gb0Yn0R7X7vnkheJwYiNqd8g2KqLvxZIJud0gwp6+ L/1fG3UVa+0EJdSPISnRkqR02V9lbsHa93lIMGkaZf/D8pDFOkD63KNSY76bd0QjNpJ9 NMWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RuyjnaTM; 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 h139si2495477oib.85.2020.01.11.01.57.50; Sat, 11 Jan 2020 01:58:01 -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; dkim=pass header.i=@kernel.org header.s=default header.b=RuyjnaTM; 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 S1729042AbgAKJ5A (ORCPT + 99 others); Sat, 11 Jan 2020 04:57:00 -0500 Received: from mail.kernel.org ([198.145.29.99]:48754 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728808AbgAKJ5A (ORCPT ); Sat, 11 Jan 2020 04:57:00 -0500 Received: from localhost (unknown [62.119.166.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3AB122064C; Sat, 11 Jan 2020 09:56:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578736619; bh=B/WPZinwqaU3N5CEePyKCWSzXduU7EUxFTX6m0gZr/s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RuyjnaTMGXBZXanc/NYQQG7eEZB+HqRPQrY+dp/e358xR8M+4yARuvQyk0P/3r9nS ncHnp/Phcrf46ZmUaa13rzEHzNLrXrWnz/tCDzjIHS7QLB/yvwZeqBIZ3zq3zn07+w vnb/PE46L6DIwk/dxE4h/EmL7be32kFqGm7WISoU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liviu Dudau , Lorenzo Pieralisi , Viresh Kumar , Dietmar Eggemann , Sudeep Holla , Sasha Levin Subject: [PATCH 4.4 36/59] ARM: vexpress: Set-up shared OPP table instead of individual for each CPU Date: Sat, 11 Jan 2020 10:49:45 +0100 Message-Id: <20200111094845.435506033@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200111094835.417654274@linuxfoundation.org> References: <20200111094835.417654274@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sudeep Holla [ Upstream commit 2a76352ad2cc6b78e58f737714879cc860903802 ] Currently we add individual copy of same OPP table for each CPU within the cluster. This is redundant and doesn't reflect the reality. We can't use core cpumask to set policy->cpus in ve_spc_cpufreq_init() anymore as it gets called via cpuhp_cpufreq_online()->cpufreq_online() ->cpufreq_driver->init() and the cpumask gets updated upon CPU hotplug operations. It also may cause issues when the vexpress_spc_cpufreq driver is built as a module. Since ve_spc_clk_init is built-in device initcall, we should be able to use the same topology_core_cpumask to set the opp sharing cpumask via dev_pm_opp_set_sharing_cpus and use the same later in the driver via dev_pm_opp_get_sharing_cpus. Cc: Liviu Dudau Cc: Lorenzo Pieralisi Acked-by: Viresh Kumar Tested-by: Dietmar Eggemann Signed-off-by: Sudeep Holla Signed-off-by: Sasha Levin --- arch/arm/mach-vexpress/spc.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-vexpress/spc.c b/arch/arm/mach-vexpress/spc.c index 5766ce2be32b..29eb945075e3 100644 --- a/arch/arm/mach-vexpress/spc.c +++ b/arch/arm/mach-vexpress/spc.c @@ -555,8 +555,9 @@ static struct clk *ve_spc_clk_register(struct device *cpu_dev) static int __init ve_spc_clk_init(void) { - int cpu; + int cpu, cluster; struct clk *clk; + bool init_opp_table[MAX_CLUSTERS] = { false }; if (!info) return 0; /* Continue only if SPC is initialised */ @@ -582,8 +583,17 @@ static int __init ve_spc_clk_init(void) continue; } + cluster = topology_physical_package_id(cpu_dev->id); + if (init_opp_table[cluster]) + continue; + if (ve_init_opp_table(cpu_dev)) pr_warn("failed to initialise cpu%d opp table\n", cpu); + else if (dev_pm_opp_set_sharing_cpus(cpu_dev, + topology_core_cpumask(cpu_dev->id))) + pr_warn("failed to mark OPPs shared for cpu%d\n", cpu); + else + init_opp_table[cluster] = true; } platform_device_register_simple("vexpress-spc-cpufreq", -1, NULL, 0); -- 2.20.1