Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp522293pxu; Thu, 7 Jan 2021 10:48:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJy6uo6XU1qxP4bf/wVO2nb4pK5fA6TRCPz9zV6aK1efRx17sjFMhTtD4CVwb7XPY7BRgIui X-Received: by 2002:aa7:db01:: with SMTP id t1mr2658545eds.185.1610045300049; Thu, 07 Jan 2021 10:48:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610045300; cv=none; d=google.com; s=arc-20160816; b=WJ/i1g2y9jxpBdZvwYf1VfPgwMKjM2uJ3gAz7nDL0U6YAN8m0juynsZ1zcr3EhG5lq bkhpETXC9diiV7yql910ez2nzp09tp7LN2BIaoz73x4tYWeEaCft0JZQOLRn/twEjB+r 3oi4zzyjAMF2da+zhnIFJco1Pg7a6ZEvJ9mpSe8T2eRLyLdQq+cybiu9c2tMlnEsPaa+ jzVGKvMZxj1ar9DxsJiI61z71NaPPj8K0kw9dIlFhiIQGbsRVmLV4wY/C+vQRpV8L6dw WWb4mePTaizu7U9bHIxJ8Z9GdeBn1dX66MPpocrfZX898GcXG/5ikbCWLiIW3C2dZ2/C qjEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=pDLOvjC/NnCSeuUOqB8pBFGho72F1zceF91JoSoYfcw=; b=tXR27J0Qz6xNgpnwmKxLcnwaSQPl0dCB110Ex+dW/VYDXHsRD8wgeWNlHEL91CZRv7 tloNm1GQn0UeyNDz+jJ/YURrDoDXtdx4uVaKaQsBn2clzJuvFQt/fhGvT84qpJ5Carih VUfu8PcEiEWKpHRahVBhndscQO5165qzFk5lXUwYKYldqrspEzmOcHafIh8PxS1EXmU0 skIjA2zQRH2MaP4EwF75LpkQT8B8OxFukT2e4xzJ9VCvlNDPQEjEIOuNP06iTGSVZZn9 NXuAtNMmnPyFRrXx0sRNKfiKYuDLKfnyNMqNPro1cX9gAdHeG6qYNN+BZN6+dfI01qhe lThA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z7si2640141edx.473.2021.01.07.10.47.56; Thu, 07 Jan 2021 10:48:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729292AbhAGSpR (ORCPT + 99 others); Thu, 7 Jan 2021 13:45:17 -0500 Received: from cloudserver094114.home.pl ([79.96.170.134]:59348 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728105AbhAGSpN (ORCPT ); Thu, 7 Jan 2021 13:45:13 -0500 Received: from 89-64-81-64.dynamic.chello.pl (89.64.81.64) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.537) id 83169161bdda93df; Thu, 7 Jan 2021 19:44:31 +0100 From: "Rafael J. Wysocki" To: Linux PM Cc: LKML , Srinivas Pandruvada , Chen Yu Subject: [PATCH v1 2/3] cpufreq: intel_pstate: Change intel_pstate_get_hwp_max() argument Date: Thu, 07 Jan 2021 19:43:30 +0100 Message-ID: <2241039.bdjsIDbar3@kreacher> In-Reply-To: <5701645.lOV4Wx5bFT@kreacher> References: <5701645.lOV4Wx5bFT@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafael J. Wysocki All of the callers of intel_pstate_get_hwp_max() access the struct cpudata object that corresponds to the given CPU already and the function itself needs to access that object (in order to update hwp_cap_cached), so modify the code to pass a struct cpudata pointer to it instead of the CPU number. Signed-off-by: Rafael J. Wysocki --- drivers/cpufreq/intel_pstate.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) Index: linux-pm/drivers/cpufreq/intel_pstate.c =================================================================== --- linux-pm.orig/drivers/cpufreq/intel_pstate.c +++ linux-pm/drivers/cpufreq/intel_pstate.c @@ -819,13 +819,13 @@ static struct freq_attr *hwp_cpufreq_att NULL, }; -static void intel_pstate_get_hwp_max(unsigned int cpu, int *phy_max, +static void intel_pstate_get_hwp_max(struct cpudata *cpu, int *phy_max, int *current_max) { u64 cap; - rdmsrl_on_cpu(cpu, MSR_HWP_CAPABILITIES, &cap); - WRITE_ONCE(all_cpu_data[cpu]->hwp_cap_cached, cap); + rdmsrl_on_cpu(cpu->cpu, MSR_HWP_CAPABILITIES, &cap); + WRITE_ONCE(cpu->hwp_cap_cached, cap); if (global.no_turbo || global.turbo_disabled) *current_max = HWP_GUARANTEED_PERF(cap); else @@ -1213,7 +1213,7 @@ static void update_qos_request(enum freq continue; if (hwp_active) - intel_pstate_get_hwp_max(i, &turbo_max, &max_state); + intel_pstate_get_hwp_max(cpu, &turbo_max, &max_state); else turbo_max = cpu->pstate.turbo_pstate; @@ -1723,7 +1723,7 @@ static void intel_pstate_get_cpu_pstates if (hwp_active && !hwp_mode_bdw) { unsigned int phy_max, current_max; - intel_pstate_get_hwp_max(cpu->cpu, &phy_max, ¤t_max); + intel_pstate_get_hwp_max(cpu, &phy_max, ¤t_max); cpu->pstate.turbo_freq = phy_max * cpu->pstate.scaling; cpu->pstate.turbo_pstate = phy_max; } else { @@ -2208,7 +2208,7 @@ static void intel_pstate_update_perf_lim * rather than pure ratios. */ if (hwp_active) { - intel_pstate_get_hwp_max(cpu->cpu, &turbo_max, &max_state); + intel_pstate_get_hwp_max(cpu, &turbo_max, &max_state); } else { max_state = global.no_turbo || global.turbo_disabled ? cpu->pstate.max_pstate : cpu->pstate.turbo_pstate; @@ -2323,7 +2323,7 @@ static void intel_pstate_verify_cpu_poli if (hwp_active) { int max_state, turbo_max; - intel_pstate_get_hwp_max(cpu->cpu, &turbo_max, &max_state); + intel_pstate_get_hwp_max(cpu, &turbo_max, &max_state); max_freq = max_state * cpu->pstate.scaling; } else { max_freq = intel_pstate_get_max_freq(cpu); @@ -2710,7 +2710,7 @@ static int intel_cpufreq_cpu_init(struct if (hwp_active) { u64 value; - intel_pstate_get_hwp_max(policy->cpu, &turbo_max, &max_state); + intel_pstate_get_hwp_max(cpu, &turbo_max, &max_state); policy->transition_delay_us = INTEL_CPUFREQ_TRANSITION_DELAY_HWP; rdmsrl_on_cpu(cpu->cpu, MSR_HWP_REQUEST, &value); WRITE_ONCE(cpu->hwp_req_cached, value);