Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp204377lqb; Tue, 28 May 2024 13:01:02 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWynhCI+gRNTtwvzr1RhJm8zc1VY3JlRjq+akYPk9cvkTHiF38D4MBQGZ/WvJBdsZyANw11mJoCeEIUdjrcXTU0yUwsZIO/SALfDWkkAw== X-Google-Smtp-Source: AGHT+IEwYyewd512X8bsQh+ngvYqM+CcL1Cf5xgkdJoUKdRX/K9SJyQldVunZvUnt0Ip8/hfAGbe X-Received: by 2002:a67:f4c7:0:b0:47c:2c84:4321 with SMTP id ada2fe7eead31-48a38575d3cmr12274579137.16.1716926461990; Tue, 28 May 2024 13:01:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716926461; cv=pass; d=google.com; s=arc-20160816; b=W4ubM4Xbwf5G1m5uCDlX5CLjckMSw1ryWrJIsaMLe7iD5PvGE3z2rQkMRcAK7slR3V PmJ7nbDAuHF7lLFGmylZD+nX5otvE6eKn4/3RxOjF8hoKjkGvudQ8yY+9uB3y2b34+NO Bbv6NrmB4c2/sfL1KWdzkFSnz+pmBnWD590mUmuqnqdK1jgBL9xZVgrl3NYbTxIekwCy AH0l+dXWnu+jrN8DWTGcjnCAHnxqhXSTMB0Qp1OhjCT85x8JRFNrjGAEopraI7IIP6ap /WYHzpJ2T5iDX/dWHZa4IFaHaXald3enxlq102vKnH4JQR6g0cXSZzuAVEMRl6BKrhNr uimw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=RZciUwF++oiTO6CgD2RTiN7HBVXvPit+69YVjRETT4Q=; fh=+PNpbn9jFJw12GiQDUnzQgD2hnlxKUUPn3JeUZQ5OLg=; b=uHXPU1/bGuZxKTUKZ1EeryBrs9/R6Pu4qdccdmv/pmq1yL0BGR8VFJCYEyqX83V7fw HVb61jpwy3lOYXNpLZ/JH/j0vkSyX9anve1TnklTSrPCOWev/T73YlGb9UyR+8UEyFJr 0ruFOhREr1V6I0t/XhgNlsxZcJa6pcupHl4ZZW+0ylhVXIYwPuJWI4d1iACa0TkOSO9V l32gHo5skH4yz8cnuY2Q7L0gtyLqjwB7ygF/tAKkE4BYomJkQUvejEOed7eh8RThV546 5Ud1Iqct4s+rlkl3PUt8Ej6Tb63kcvge/sjA9plt5cy/WL0lZYz/8hiNc0wxUdpJyfUZ htZg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=owCVVocN; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-192992-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192992-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id ada2fe7eead31-48b8a465129si1064687137.48.2024.05.28.13.01.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 13:01:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-192992-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=owCVVocN; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-192992-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192992-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 7D4A11C24DDE for ; Tue, 28 May 2024 20:01:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AB37B178391; Tue, 28 May 2024 20:00:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="owCVVocN" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9136E29402; Tue, 28 May 2024 20:00:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716926453; cv=none; b=aMyetZNLczYP+hUdizCNDSrEyMmIdLNn2f7HoPverYBTkZ1RreSbzC9At+TD87wn2dljY4tQ7vDrOoRvU5oFlv+IaMt6V4TCPBtfJxcy4GWmzsACg8uFayIQHN9LyqfeJ6IhuvEKyP9FXMZg3MiM1FG9YskDRMwb1j0NvtJvKHk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716926453; c=relaxed/simple; bh=nTbDhwyviaLMbfaJtiOxxx3LkcPgQ3xSCNmD1vg86bc=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=pnN9HbOjcwumjUKl7ZXc/hYANa7ZolbzFA67232K+YOzcxfKfb5hm6qQVypuM/jHc1Pc5zp34shnUzMiLVGxOgAgAsqCbl08eHbHxktR7wt2xCN0ADOHq2CPCfa7+oay8tNH8WZv1mV2zaq/+/1fRoefpOF1Ilq8o0g/FXkpjWw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=owCVVocN; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0171CC32786; Tue, 28 May 2024 20:00:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716926453; bh=nTbDhwyviaLMbfaJtiOxxx3LkcPgQ3xSCNmD1vg86bc=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=owCVVocN8NuAMtXNRgBZCZEwTvdQgWHpV6mACAUokIiIrngzZfjuB3G9VyJrF646h fCdLJF/pw+uYGcJVHiivPj9lXGa6est3vPsUl6I7qjWSdV/CeqqGUWk3/zcE9eEhh/ 7EQyGb6H/HaI9r461E4YKqVCNbjUjF+GUUYc6PI2woCnSrNUtNZODMEac/EDR3V3Wh Ehzzr/PWHRo4MxDWkgn+b75H4AnSF7iLpcjytXTjQr9A71tr68vPLrjbr2hNj2Hun+ pD9zuzMmuacu/fE76SvZoDAuRx2xNz3IkgIP1BooALKCtTh+gbxhuiZUxya0Uuj57B g9f74EizWzWaA== Received: by mail-oo1-f53.google.com with SMTP id 006d021491bc7-5b2fbe85f82so191202eaf.1; Tue, 28 May 2024 13:00:52 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCVOirMGAHOUMeWR7jxe6w/1D2jn5z2GaQYF7VoMTzXHqirhscs2+90njtukflOdrIPUacG0QSadSMuJdE7im2GepGXdW5NqQUas2JvKo+VdbHuX7upiSEZJo4I0RYMhyBPCXa16Z5E= X-Gm-Message-State: AOJu0YxEGl7t7P3ixH6GO3RVm/ss9Ad2We12MiZb6JoaYaU4xEjKowuF ipUWgxeNvZWIGB1pbAQlIvtwWo1UuLB7bUAEdzRAp8r7SZ+7QQhxARt37gcrg0Jod3V2zr1XlBV tmM7x2vKXcuuBVQugGjedwEWl2cE= X-Received: by 2002:a4a:ba86:0:b0:5b2:8017:fb68 with SMTP id 006d021491bc7-5b95cde3ec5mr14458580eaf.0.1716926452133; Tue, 28 May 2024 13:00:52 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240528121124.3588248-1-arnd@kernel.org> <0edd0485-274a-4b3f-8ecb-60708963db8a@amd.com> In-Reply-To: <0edd0485-274a-4b3f-8ecb-60708963db8a@amd.com> From: "Rafael J. Wysocki" Date: Tue, 28 May 2024 22:00:40 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] cpufreq: amd-pstate: remove global header file To: Mario Limonciello , Arnd Bergmann Cc: Huang Rui , "Gautham R. Shenoy" , "Rafael J. Wysocki" , Viresh Kumar , Perry Yuan , Wyes Karny , Arnd Bergmann , Meng Li , Swapnil Sapkal , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, May 28, 2024 at 7:49=E2=80=AFPM Mario Limonciello wrote: > > On 5/28/2024 07:09, Arnd Bergmann wrote: > > From: Arnd Bergmann > > > > When extra warnings are enabled, gcc points out a global variable > > definition in a header: > > > > In file included from drivers/cpufreq/amd-pstate-ut.c:29: > > include/linux/amd-pstate.h:123:27: error: 'amd_pstate_mode_string' defi= ned but not used [-Werror=3Dunused-const-variable=3D] > > 123 | static const char * const amd_pstate_mode_string[] =3D { > > | ^~~~~~~~~~~~~~~~~~~~~~ > > > > This header is only included from two files in the same directory, > > and one of them uses only a single definition from it, so clean it > > up by moving most of the contents into the driver that uses them, > > and making shared bits a local header file. > > > > Fixes: 36c5014e5460 ("cpufreq: amd-pstate: optimize driver working mode= selection in amd_pstate_param()") > > Signed-off-by: Arnd Bergmann > > Thanks! > > Acked-by: Mario Limonciello Applied as 6.10-rc material, thanks! > > --- > > MAINTAINERS | 1 - > > drivers/cpufreq/amd-pstate-ut.c | 3 +- > > drivers/cpufreq/amd-pstate.c | 34 ++++++++++++++++++= - > > .../linux =3D> drivers/cpufreq}/amd-pstate.h | 33 ----------------= -- > > 4 files changed, 35 insertions(+), 36 deletions(-) > > rename {include/linux =3D> drivers/cpufreq}/amd-pstate.h (82%) > > > > diff --git a/MAINTAINERS b/MAINTAINERS > > index 070a39b2b098..35a75ab8ef05 100644 > > --- a/MAINTAINERS > > +++ b/MAINTAINERS > > @@ -1107,7 +1107,6 @@ L: linux-pm@vger.kernel.org > > S: Supported > > F: Documentation/admin-guide/pm/amd-pstate.rst > > F: drivers/cpufreq/amd-pstate* > > -F: include/linux/amd-pstate.h > > F: tools/power/x86/amd_pstate_tracer/amd_pstate_trace.py > > > > AMD PTDMA DRIVER > > diff --git a/drivers/cpufreq/amd-pstate-ut.c b/drivers/cpufreq/amd-psta= te-ut.c > > index f04ae67dda37..fc275d41d51e 100644 > > --- a/drivers/cpufreq/amd-pstate-ut.c > > +++ b/drivers/cpufreq/amd-pstate-ut.c > > @@ -26,10 +26,11 @@ > > #include > > #include > > #include > > -#include > > > > #include > > > > +#include "amd-pstate.h" > > + > > /* > > * Abbreviations: > > * amd_pstate_ut: used as a shortform for AMD P-State unit test. > > diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.= c > > index 1b7e82a0ad2e..91993647e09e 100644 > > --- a/drivers/cpufreq/amd-pstate.c > > +++ b/drivers/cpufreq/amd-pstate.c > > @@ -36,7 +36,6 @@ > > #include > > #include > > #include > > -#include > > #include > > > > #include > > @@ -46,6 +45,8 @@ > > #include > > #include > > #include > > + > > +#include "amd-pstate.h" > > #include "amd-pstate-trace.h" > > > > #define AMD_PSTATE_TRANSITION_LATENCY 20000 > > @@ -53,6 +54,37 @@ > > #define CPPC_HIGHEST_PERF_PERFORMANCE 196 > > #define CPPC_HIGHEST_PERF_DEFAULT 166 > > > > +#define AMD_CPPC_EPP_PERFORMANCE 0x00 > > +#define AMD_CPPC_EPP_BALANCE_PERFORMANCE 0x80 > > +#define AMD_CPPC_EPP_BALANCE_POWERSAVE 0xBF > > +#define AMD_CPPC_EPP_POWERSAVE 0xFF > > + > > +/* > > + * enum amd_pstate_mode - driver working mode of amd pstate > > + */ > > +enum amd_pstate_mode { > > + AMD_PSTATE_UNDEFINED =3D 0, > > + AMD_PSTATE_DISABLE, > > + AMD_PSTATE_PASSIVE, > > + AMD_PSTATE_ACTIVE, > > + AMD_PSTATE_GUIDED, > > + AMD_PSTATE_MAX, > > +}; > > + > > +static const char * const amd_pstate_mode_string[] =3D { > > + [AMD_PSTATE_UNDEFINED] =3D "undefined", > > + [AMD_PSTATE_DISABLE] =3D "disable", > > + [AMD_PSTATE_PASSIVE] =3D "passive", > > + [AMD_PSTATE_ACTIVE] =3D "active", > > + [AMD_PSTATE_GUIDED] =3D "guided", > > + NULL, > > +}; > > + > > +struct quirk_entry { > > + u32 nominal_freq; > > + u32 lowest_freq; > > +}; > > + > > /* > > * TODO: We need more time to fine tune processors with shared memory= solution > > * with community together. > > diff --git a/include/linux/amd-pstate.h b/drivers/cpufreq/amd-pstate.h > > similarity index 82% > > rename from include/linux/amd-pstate.h > > rename to drivers/cpufreq/amd-pstate.h > > index d58fc022ec46..e6a28e7f4dbf 100644 > > --- a/include/linux/amd-pstate.h > > +++ b/drivers/cpufreq/amd-pstate.h > > @@ -1,7 +1,5 @@ > > /* SPDX-License-Identifier: GPL-2.0-only */ > > /* > > - * linux/include/linux/amd-pstate.h > > - * > > * Copyright (C) 2022 Advanced Micro Devices, Inc. > > * > > * Author: Meng Li > > @@ -12,11 +10,6 @@ > > > > #include > > > > -#define AMD_CPPC_EPP_PERFORMANCE 0x00 > > -#define AMD_CPPC_EPP_BALANCE_PERFORMANCE 0x80 > > -#define AMD_CPPC_EPP_BALANCE_POWERSAVE 0xBF > > -#define AMD_CPPC_EPP_POWERSAVE 0xFF > > - > > /********************************************************************= * > > * AMD P-state INTERFACE = * > > ********************************************************************= */ > > @@ -108,30 +101,4 @@ struct amd_cpudata { > > bool suspended; > > }; > > > > -/* > > - * enum amd_pstate_mode - driver working mode of amd pstate > > - */ > > -enum amd_pstate_mode { > > - AMD_PSTATE_UNDEFINED =3D 0, > > - AMD_PSTATE_DISABLE, > > - AMD_PSTATE_PASSIVE, > > - AMD_PSTATE_ACTIVE, > > - AMD_PSTATE_GUIDED, > > - AMD_PSTATE_MAX, > > -}; > > - > > -static const char * const amd_pstate_mode_string[] =3D { > > - [AMD_PSTATE_UNDEFINED] =3D "undefined", > > - [AMD_PSTATE_DISABLE] =3D "disable", > > - [AMD_PSTATE_PASSIVE] =3D "passive", > > - [AMD_PSTATE_ACTIVE] =3D "active", > > - [AMD_PSTATE_GUIDED] =3D "guided", > > - NULL, > > -}; > > - > > -struct quirk_entry { > > - u32 nominal_freq; > > - u32 lowest_freq; > > -}; > > - > > #endif /* _LINUX_AMD_PSTATE_H */ >