Skip to content

Commit 3500e22

Browse files
committed
Merge back cpufreq material for 6.3-rc1.
2 parents 6f098cd + e947925 commit 3500e22

File tree

20 files changed

+893
-305
lines changed

20 files changed

+893
-305
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7020,3 +7020,10 @@
70207020
management firmware translates the requests into actual
70217021
hardware states (core frequency, data fabric and memory
70227022
clocks etc.)
7023+
active
7024+
Use amd_pstate_epp driver instance as the scaling driver,
7025+
driver provides a hint to the hardware if software wants
7026+
to bias toward performance (0x0) or energy efficiency (0xff)
7027+
to the CPPC firmware. then CPPC power algorithm will
7028+
calculate the runtime workload and adjust the realtime cores
7029+
frequency.

Documentation/admin-guide/pm/amd-pstate.rst

Lines changed: 72 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,25 @@ lowest non-linear performance in `AMD CPPC Performance Capability
262262
<perf_cap_>`_.)
263263
This attribute is read-only.
264264

265+
``energy_performance_available_preferences``
266+
267+
A list of all the supported EPP preferences that could be used for
268+
``energy_performance_preference`` on this system.
269+
These profiles represent different hints that are provided
270+
to the low-level firmware about the user's desired energy vs efficiency
271+
tradeoff. ``default`` represents the epp value is set by platform
272+
firmware. This attribute is read-only.
273+
274+
``energy_performance_preference``
275+
276+
The current energy performance preference can be read from this attribute.
277+
and user can change current preference according to energy or performance needs
278+
Please get all support profiles list from
279+
``energy_performance_available_preferences`` attribute, all the profiles are
280+
integer values defined between 0 to 255 when EPP feature is enabled by platform
281+
firmware, if EPP feature is disabled, driver will ignore the written value
282+
This attribute is read-write.
283+
265284
Other performance and frequency values can be read back from
266285
``/sys/devices/system/cpu/cpuX/acpi_cppc/``, see :ref:`cppc_sysfs`.
267286

@@ -280,8 +299,30 @@ module which supports the new AMD P-States mechanism on most of the future AMD
280299
platforms. The AMD P-States mechanism is the more performance and energy
281300
efficiency frequency management method on AMD processors.
282301

283-
Kernel Module Options for ``amd-pstate``
284-
=========================================
302+
303+
AMD Pstate Driver Operation Modes
304+
=================================
305+
306+
``amd_pstate`` CPPC has two operation modes: CPPC Autonomous(active) mode and
307+
CPPC non-autonomous(passive) mode.
308+
active mode and passive mode can be chosen by different kernel parameters.
309+
When in Autonomous mode, CPPC ignores requests done in the Desired Performance
310+
Target register and takes into account only the values set to the Minimum requested
311+
performance, Maximum requested performance, and Energy Performance Preference
312+
registers. When Autonomous is disabled, it only considers the Desired Performance Target.
313+
314+
Active Mode
315+
------------
316+
317+
``amd_pstate=active``
318+
319+
This is the low-level firmware control mode which is implemented by ``amd_pstate_epp``
320+
driver with ``amd_pstate=active`` passed to the kernel in the command line.
321+
In this mode, ``amd_pstate_epp`` driver provides a hint to the hardware if software
322+
wants to bias toward performance (0x0) or energy efficiency (0xff) to the CPPC firmware.
323+
then CPPC power algorithm will calculate the runtime workload and adjust the realtime
324+
cores frequency according to the power supply and thermal, core voltage and some other
325+
hardware conditions.
285326

286327
Passive Mode
287328
------------
@@ -298,6 +339,35 @@ processor must provide at least nominal performance requested and go higher if c
298339
operating conditions allow.
299340

300341

342+
User Space Interface in ``sysfs``
343+
=================================
344+
345+
Global Attributes
346+
-----------------
347+
348+
``amd-pstate`` exposes several global attributes (files) in ``sysfs`` to
349+
control its functionality at the system level. They are located in the
350+
``/sys/devices/system/cpu/amd-pstate/`` directory and affect all CPUs.
351+
352+
``status``
353+
Operation mode of the driver: "active", "passive" or "disable".
354+
355+
"active"
356+
The driver is functional and in the ``active mode``
357+
358+
"passive"
359+
The driver is functional and in the ``passive mode``
360+
361+
"disable"
362+
The driver is unregistered and not functional now.
363+
364+
This attribute can be written to in order to change the driver's
365+
operation mode or to unregister it. The string written to it must be
366+
one of the possible values of it and, if successful, writing one of
367+
these values to the sysfs file will cause the driver to switch over
368+
to the operation mode represented by that string - or to be
369+
unregistered in the "disable" case.
370+
301371
``cpupower`` tool support for ``amd-pstate``
302372
===============================================
303373

arch/mips/include/asm/mach-loongson32/cpufreq.h

Lines changed: 0 additions & 18 deletions
This file was deleted.

arch/mips/include/asm/mach-loongson32/platform.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include <nand.h>
1313

1414
extern struct platform_device ls1x_uart_pdev;
15-
extern struct platform_device ls1x_cpufreq_pdev;
1615
extern struct platform_device ls1x_eth0_pdev;
1716
extern struct platform_device ls1x_eth1_pdev;
1817
extern struct platform_device ls1x_ehci_pdev;

arch/mips/loongson32/common/platform.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
#include <platform.h>
1717
#include <loongson1.h>
18-
#include <cpufreq.h>
1918
#include <dma.h>
2019
#include <nand.h>
2120

@@ -62,21 +61,6 @@ void __init ls1x_serial_set_uartclk(struct platform_device *pdev)
6261
p->uartclk = clk_get_rate(clk);
6362
}
6463

65-
/* CPUFreq */
66-
static struct plat_ls1x_cpufreq ls1x_cpufreq_pdata = {
67-
.clk_name = "cpu_clk",
68-
.osc_clk_name = "osc_clk",
69-
.max_freq = 266 * 1000,
70-
.min_freq = 33 * 1000,
71-
};
72-
73-
struct platform_device ls1x_cpufreq_pdev = {
74-
.name = "ls1x-cpufreq",
75-
.dev = {
76-
.platform_data = &ls1x_cpufreq_pdata,
77-
},
78-
};
79-
8064
/* Synopsys Ethernet GMAC */
8165
static struct stmmac_mdio_bus_data ls1x_mdio_bus_data = {
8266
.phy_mask = 0,

arch/mips/loongson32/ls1b/board.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ static const struct gpio_led_platform_data ls1x_led_pdata __initconst = {
3535

3636
static struct platform_device *ls1b_platform_devices[] __initdata = {
3737
&ls1x_uart_pdev,
38-
&ls1x_cpufreq_pdev,
3938
&ls1x_eth0_pdev,
4039
&ls1x_eth1_pdev,
4140
&ls1x_ehci_pdev,

drivers/acpi/cppc_acpi.c

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,6 +1153,19 @@ int cppc_get_nominal_perf(int cpunum, u64 *nominal_perf)
11531153
return cppc_get_perf(cpunum, NOMINAL_PERF, nominal_perf);
11541154
}
11551155

1156+
/**
1157+
* cppc_get_epp_perf - Get the epp register value.
1158+
* @cpunum: CPU from which to get epp preference value.
1159+
* @epp_perf: Return address.
1160+
*
1161+
* Return: 0 for success, -EIO otherwise.
1162+
*/
1163+
int cppc_get_epp_perf(int cpunum, u64 *epp_perf)
1164+
{
1165+
return cppc_get_perf(cpunum, ENERGY_PERF, epp_perf);
1166+
}
1167+
EXPORT_SYMBOL_GPL(cppc_get_epp_perf);
1168+
11561169
/**
11571170
* cppc_get_perf_caps - Get a CPU's performance capabilities.
11581171
* @cpunum: CPU from which to get capabilities info.
@@ -1365,6 +1378,60 @@ int cppc_get_perf_ctrs(int cpunum, struct cppc_perf_fb_ctrs *perf_fb_ctrs)
13651378
}
13661379
EXPORT_SYMBOL_GPL(cppc_get_perf_ctrs);
13671380

1381+
/*
1382+
* Set Energy Performance Preference Register value through
1383+
* Performance Controls Interface
1384+
*/
1385+
int cppc_set_epp_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls, bool enable)
1386+
{
1387+
int pcc_ss_id = per_cpu(cpu_pcc_subspace_idx, cpu);
1388+
struct cpc_register_resource *epp_set_reg;
1389+
struct cpc_register_resource *auto_sel_reg;
1390+
struct cpc_desc *cpc_desc = per_cpu(cpc_desc_ptr, cpu);
1391+
struct cppc_pcc_data *pcc_ss_data = NULL;
1392+
int ret;
1393+
1394+
if (!cpc_desc) {
1395+
pr_debug("No CPC descriptor for CPU:%d\n", cpu);
1396+
return -ENODEV;
1397+
}
1398+
1399+
auto_sel_reg = &cpc_desc->cpc_regs[AUTO_SEL_ENABLE];
1400+
epp_set_reg = &cpc_desc->cpc_regs[ENERGY_PERF];
1401+
1402+
if (CPC_IN_PCC(epp_set_reg) || CPC_IN_PCC(auto_sel_reg)) {
1403+
if (pcc_ss_id < 0) {
1404+
pr_debug("Invalid pcc_ss_id for CPU:%d\n", cpu);
1405+
return -ENODEV;
1406+
}
1407+
1408+
if (CPC_SUPPORTED(auto_sel_reg)) {
1409+
ret = cpc_write(cpu, auto_sel_reg, enable);
1410+
if (ret)
1411+
return ret;
1412+
}
1413+
1414+
if (CPC_SUPPORTED(epp_set_reg)) {
1415+
ret = cpc_write(cpu, epp_set_reg, perf_ctrls->energy_perf);
1416+
if (ret)
1417+
return ret;
1418+
}
1419+
1420+
pcc_ss_data = pcc_data[pcc_ss_id];
1421+
1422+
down_write(&pcc_ss_data->pcc_lock);
1423+
/* after writing CPC, transfer the ownership of PCC to platform */
1424+
ret = send_pcc_cmd(pcc_ss_id, CMD_WRITE);
1425+
up_write(&pcc_ss_data->pcc_lock);
1426+
} else {
1427+
ret = -ENOTSUPP;
1428+
pr_debug("_CPC in PCC is not supported\n");
1429+
}
1430+
1431+
return ret;
1432+
}
1433+
EXPORT_SYMBOL_GPL(cppc_set_epp_perf);
1434+
13681435
/**
13691436
* cppc_set_enable - Set to enable CPPC on the processor by writing the
13701437
* Continuous Performance Control package EnableRegister field.

drivers/cpufreq/Kconfig

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ menu "CPU Frequency scaling"
33

44
config CPU_FREQ
55
bool "CPU Frequency scaling"
6-
select SRCU
76
help
87
CPU Frequency scaling allows you to change the clock speed of
98
CPUs on the fly. This is a nice method to save power, because
@@ -270,15 +269,6 @@ config LOONGSON2_CPUFREQ
270269

271270
Loongson2F and its successors support this feature.
272271

273-
If in doubt, say N.
274-
275-
config LOONGSON1_CPUFREQ
276-
tristate "Loongson1 CPUFreq Driver"
277-
depends on LOONGSON1_LS1B
278-
help
279-
This option adds a CPUFreq driver for loongson1 processors which
280-
support software configurable cpu frequency.
281-
282272
If in doubt, say N.
283273
endif
284274

drivers/cpufreq/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ obj-$(CONFIG_POWERNV_CPUFREQ) += powernv-cpufreq.o
111111
obj-$(CONFIG_BMIPS_CPUFREQ) += bmips-cpufreq.o
112112
obj-$(CONFIG_IA64_ACPI_CPUFREQ) += ia64-acpi-cpufreq.o
113113
obj-$(CONFIG_LOONGSON2_CPUFREQ) += loongson2_cpufreq.o
114-
obj-$(CONFIG_LOONGSON1_CPUFREQ) += loongson1-cpufreq.o
115114
obj-$(CONFIG_SH_CPU_FREQ) += sh-cpufreq.o
116115
obj-$(CONFIG_SPARC_US2E_CPUFREQ) += sparc-us2e-cpufreq.o
117116
obj-$(CONFIG_SPARC_US3_CPUFREQ) += sparc-us3-cpufreq.o

0 commit comments

Comments
 (0)