Commit 0d573c6a authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

Merge branches 'acpi-x86', 'acpi-cppc' and 'acpi-soc'

* acpi-x86:
  x86: ACPI: make variable names clearer in acpi_parse_madt_lapic_entries()
  x86: ACPI: remove extraneous white space after semicolon

* acpi-cppc:
  ACPI / CPPC: Support PCC with interrupt flag
  ACPI / CPPC: Add prefix cppc to cpudata structure name
  ACPI / CPPC: Add support for functional fixed hardware address
  ACPI / CPPC: Don't return on CPPC probe failure
  ACPI / CPPC: Allow build with ACPI_CPU_FREQ_PSS config
  ACPI / CPPC: check for error bit in PCC status field
  ACPI / CPPC: move all PCC related information into pcc_data
  ACPI / CPPC: add sysfs support to compute delivered performance
  ACPI / CPPC: set a non-zero value for transition_latency
  ACPI / CPPC: support for batching CPPC requests
  ACPI / CPPC: acquire pcc_lock only while accessing PCC subspace
  ACPI / CPPC: restructure read/writes for efficient sys mapped reg ops
  mailbox: pcc: Support HW-Reduced Communication Subspace type 2

* acpi-soc:
  ACPI / APD: constify local structures
  ACPI / APD: Add device HID for Vulcan SPI controller
obj-$(CONFIG_ACPI) += boot.o obj-$(CONFIG_ACPI) += boot.o
obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup_$(BITS).o obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup_$(BITS).o
obj-$(CONFIG_ACPI_APEI) += apei.o obj-$(CONFIG_ACPI_APEI) += apei.o
obj-$(CONFIG_ACPI_CPPC_LIB) += cppc_msr.o
ifneq ($(CONFIG_ACPI_PROCESSOR),) ifneq ($(CONFIG_ACPI_PROCESSOR),)
obj-y += cstate.o obj-y += cstate.o
......
...@@ -1031,8 +1031,8 @@ static int __init acpi_parse_madt_lapic_entries(void) ...@@ -1031,8 +1031,8 @@ static int __init acpi_parse_madt_lapic_entries(void)
return ret; return ret;
} }
x2count = madt_proc[0].count; count = madt_proc[0].count;
count = madt_proc[1].count; x2count = madt_proc[1].count;
} }
if (!count && !x2count) { if (!count && !x2count) {
printk(KERN_ERR PREFIX "No LAPIC entries present\n"); printk(KERN_ERR PREFIX "No LAPIC entries present\n");
......
/*
* cppc_msr.c: MSR Interface for CPPC
* Copyright (c) 2016, Intel Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
*/
#include <acpi/cppc_acpi.h>
#include <asm/msr.h>
/* Refer to drivers/acpi/cppc_acpi.c for the description of functions */
bool cpc_ffh_supported(void)
{
return true;
}
int cpc_read_ffh(int cpunum, struct cpc_reg *reg, u64 *val)
{
int err;
err = rdmsrl_safe_on_cpu(cpunum, reg->address, val);
if (!err) {
u64 mask = GENMASK_ULL(reg->bit_offset + reg->bit_width - 1,
reg->bit_offset);
*val &= mask;
*val >>= reg->bit_offset;
}
return err;
}
int cpc_write_ffh(int cpunum, struct cpc_reg *reg, u64 val)
{
u64 rd_val;
int err;
err = rdmsrl_safe_on_cpu(cpunum, reg->address, &rd_val);
if (!err) {
u64 mask = GENMASK_ULL(reg->bit_offset + reg->bit_width - 1,
reg->bit_offset);
val <<= reg->bit_offset;
val &= mask;
rd_val &= ~mask;
rd_val |= val;
err = wrmsrl_safe_on_cpu(cpunum, reg->address, rd_val);
}
return err;
}
...@@ -227,7 +227,6 @@ config ACPI_MCFG ...@@ -227,7 +227,6 @@ config ACPI_MCFG
config ACPI_CPPC_LIB config ACPI_CPPC_LIB
bool bool
depends on ACPI_PROCESSOR depends on ACPI_PROCESSOR
depends on !ACPI_CPU_FREQ_PSS
select MAILBOX select MAILBOX
select PCC select PCC
help help
......
...@@ -72,7 +72,7 @@ static int acpi_apd_setup(struct apd_private_data *pdata) ...@@ -72,7 +72,7 @@ static int acpi_apd_setup(struct apd_private_data *pdata)
} }
#ifdef CONFIG_X86_AMD_PLATFORM_DEVICE #ifdef CONFIG_X86_AMD_PLATFORM_DEVICE
static struct apd_device_desc cz_i2c_desc = { static const struct apd_device_desc cz_i2c_desc = {
.setup = acpi_apd_setup, .setup = acpi_apd_setup,
.fixed_clk_rate = 133000000, .fixed_clk_rate = 133000000,
}; };
...@@ -84,7 +84,7 @@ static struct property_entry uart_properties[] = { ...@@ -84,7 +84,7 @@ static struct property_entry uart_properties[] = {
{ }, { },
}; };
static struct apd_device_desc cz_uart_desc = { static const struct apd_device_desc cz_uart_desc = {
.setup = acpi_apd_setup, .setup = acpi_apd_setup,
.fixed_clk_rate = 48000000, .fixed_clk_rate = 48000000,
.properties = uart_properties, .properties = uart_properties,
...@@ -92,10 +92,15 @@ static struct apd_device_desc cz_uart_desc = { ...@@ -92,10 +92,15 @@ static struct apd_device_desc cz_uart_desc = {
#endif #endif
#ifdef CONFIG_ARM64 #ifdef CONFIG_ARM64
static struct apd_device_desc xgene_i2c_desc = { static const struct apd_device_desc xgene_i2c_desc = {
.setup = acpi_apd_setup, .setup = acpi_apd_setup,
.fixed_clk_rate = 100000000, .fixed_clk_rate = 100000000,
}; };
static const struct apd_device_desc vulcan_spi_desc = {
.setup = acpi_apd_setup,
.fixed_clk_rate = 133000000,
};
#endif #endif
#else #else
...@@ -164,6 +169,7 @@ static const struct acpi_device_id acpi_apd_device_ids[] = { ...@@ -164,6 +169,7 @@ static const struct acpi_device_id acpi_apd_device_ids[] = {
#endif #endif
#ifdef CONFIG_ARM64 #ifdef CONFIG_ARM64
{ "APMC0D0F", APD_ADDR(xgene_i2c_desc) }, { "APMC0D0F", APD_ADDR(xgene_i2c_desc) },
{ "BRCM900D", APD_ADDR(vulcan_spi_desc) },
#endif #endif
{ } { }
}; };
......
This diff is collapsed.
...@@ -245,8 +245,8 @@ static int __acpi_processor_start(struct acpi_device *device) ...@@ -245,8 +245,8 @@ static int __acpi_processor_start(struct acpi_device *device)
return 0; return 0;
result = acpi_cppc_processor_probe(pr); result = acpi_cppc_processor_probe(pr);
if (result) if (result && !IS_ENABLED(CONFIG_ACPI_CPU_FREQ_PSS))
return -ENODEV; dev_warn(&device->dev, "CPPC data invalid or not present\n");
if (!cpuidle_get_driver() || cpuidle_get_driver() == &acpi_idle_driver) if (!cpuidle_get_driver() || cpuidle_get_driver() == &acpi_idle_driver)
acpi_processor_power_init(pr); acpi_processor_power_init(pr);
......
...@@ -30,13 +30,13 @@ ...@@ -30,13 +30,13 @@
* performance capabilities, desired performance level * performance capabilities, desired performance level
* requested etc. * requested etc.
*/ */
static struct cpudata **all_cpu_data; static struct cppc_cpudata **all_cpu_data;
static int cppc_cpufreq_set_target(struct cpufreq_policy *policy, static int cppc_cpufreq_set_target(struct cpufreq_policy *policy,
unsigned int target_freq, unsigned int target_freq,
unsigned int relation) unsigned int relation)
{ {
struct cpudata *cpu; struct cppc_cpudata *cpu;
struct cpufreq_freqs freqs; struct cpufreq_freqs freqs;
int ret = 0; int ret = 0;
...@@ -66,7 +66,7 @@ static int cppc_verify_policy(struct cpufreq_policy *policy) ...@@ -66,7 +66,7 @@ static int cppc_verify_policy(struct cpufreq_policy *policy)
static void cppc_cpufreq_stop_cpu(struct cpufreq_policy *policy) static void cppc_cpufreq_stop_cpu(struct cpufreq_policy *policy)
{ {
int cpu_num = policy->cpu; int cpu_num = policy->cpu;
struct cpudata *cpu = all_cpu_data[cpu_num]; struct cppc_cpudata *cpu = all_cpu_data[cpu_num];
int ret; int ret;
cpu->perf_ctrls.desired_perf = cpu->perf_caps.lowest_perf; cpu->perf_ctrls.desired_perf = cpu->perf_caps.lowest_perf;
...@@ -79,7 +79,7 @@ static void cppc_cpufreq_stop_cpu(struct cpufreq_policy *policy) ...@@ -79,7 +79,7 @@ static void cppc_cpufreq_stop_cpu(struct cpufreq_policy *policy)
static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy) static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy)
{ {
struct cpudata *cpu; struct cppc_cpudata *cpu;
unsigned int cpu_num = policy->cpu; unsigned int cpu_num = policy->cpu;
int ret = 0; int ret = 0;
...@@ -98,6 +98,7 @@ static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy) ...@@ -98,6 +98,7 @@ static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy)
policy->max = cpu->perf_caps.highest_perf; policy->max = cpu->perf_caps.highest_perf;
policy->cpuinfo.min_freq = policy->min; policy->cpuinfo.min_freq = policy->min;
policy->cpuinfo.max_freq = policy->max; policy->cpuinfo.max_freq = policy->max;
policy->cpuinfo.transition_latency = cppc_get_transition_latency(cpu_num);
policy->shared_type = cpu->shared_type; policy->shared_type = cpu->shared_type;
if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY)
...@@ -134,7 +135,7 @@ static struct cpufreq_driver cppc_cpufreq_driver = { ...@@ -134,7 +135,7 @@ static struct cpufreq_driver cppc_cpufreq_driver = {
static int __init cppc_cpufreq_init(void) static int __init cppc_cpufreq_init(void)
{ {
int i, ret = 0; int i, ret = 0;
struct cpudata *cpu; struct cppc_cpudata *cpu;
if (acpi_disabled) if (acpi_disabled)
return -ENODEV; return -ENODEV;
...@@ -144,7 +145,7 @@ static int __init cppc_cpufreq_init(void) ...@@ -144,7 +145,7 @@ static int __init cppc_cpufreq_init(void)
return -ENOMEM; return -ENOMEM;
for_each_possible_cpu(i) { for_each_possible_cpu(i) {
all_cpu_data[i] = kzalloc(sizeof(struct cpudata), GFP_KERNEL); all_cpu_data[i] = kzalloc(sizeof(struct cppc_cpudata), GFP_KERNEL);
if (!all_cpu_data[i]) if (!all_cpu_data[i])
goto out; goto out;
...@@ -175,7 +176,7 @@ static int __init cppc_cpufreq_init(void) ...@@ -175,7 +176,7 @@ static int __init cppc_cpufreq_init(void)
static void __exit cppc_cpufreq_exit(void) static void __exit cppc_cpufreq_exit(void)
{ {
struct cpudata *cpu; struct cppc_cpudata *cpu;
int i; int i;
cpufreq_unregister_driver(&cppc_cpufreq_driver); cpufreq_unregister_driver(&cppc_cpufreq_driver);
......
This diff is collapsed.
...@@ -24,7 +24,9 @@ ...@@ -24,7 +24,9 @@
#define CPPC_NUM_ENT 21 #define CPPC_NUM_ENT 21
#define CPPC_REV 2 #define CPPC_REV 2
#define PCC_CMD_COMPLETE 1 #define PCC_CMD_COMPLETE_MASK (1 << 0)
#define PCC_ERROR_MASK (1 << 2)
#define MAX_CPC_REG_ENT 19 #define MAX_CPC_REG_ENT 19
/* CPPC specific PCC commands. */ /* CPPC specific PCC commands. */
...@@ -49,6 +51,7 @@ struct cpc_reg { ...@@ -49,6 +51,7 @@ struct cpc_reg {
*/ */
struct cpc_register_resource { struct cpc_register_resource {
acpi_object_type type; acpi_object_type type;
u64 __iomem *sys_mem_vaddr;
union { union {
struct cpc_reg reg; struct cpc_reg reg;
u64 int_value; u64 int_value;
...@@ -60,8 +63,11 @@ struct cpc_desc { ...@@ -60,8 +63,11 @@ struct cpc_desc {
int num_entries; int num_entries;
int version; int version;
int cpu_id; int cpu_id;
int write_cmd_status;
int write_cmd_id;
struct cpc_register_resource cpc_regs[MAX_CPC_REG_ENT]; struct cpc_register_resource cpc_regs[MAX_CPC_REG_ENT];
struct acpi_psd_package domain_info; struct acpi_psd_package domain_info;
struct kobject kobj;
}; };
/* These are indexes into the per-cpu cpc_regs[]. Order is important. */ /* These are indexes into the per-cpu cpc_regs[]. Order is important. */
...@@ -96,7 +102,6 @@ enum cppc_regs { ...@@ -96,7 +102,6 @@ enum cppc_regs {
struct cppc_perf_caps { struct cppc_perf_caps {
u32 highest_perf; u32 highest_perf;
u32 nominal_perf; u32 nominal_perf;
u32 reference_perf;
u32 lowest_perf; u32 lowest_perf;
}; };
...@@ -108,13 +113,13 @@ struct cppc_perf_ctrls { ...@@ -108,13 +113,13 @@ struct cppc_perf_ctrls {
struct cppc_perf_fb_ctrs { struct cppc_perf_fb_ctrs {
u64 reference; u64 reference;
u64 prev_reference;
u64 delivered; u64 delivered;
u64 prev_delivered; u64 reference_perf;
u64 ctr_wrap_time;
}; };
/* Per CPU container for runtime CPPC management. */ /* Per CPU container for runtime CPPC management. */
struct cpudata { struct cppc_cpudata {
int cpu; int cpu;
struct cppc_perf_caps perf_caps; struct cppc_perf_caps perf_caps;
struct cppc_perf_ctrls perf_ctrls; struct cppc_perf_ctrls perf_ctrls;
...@@ -127,6 +132,7 @@ struct cpudata { ...@@ -127,6 +132,7 @@ struct cpudata {
extern int cppc_get_perf_ctrs(int cpu, struct cppc_perf_fb_ctrs *perf_fb_ctrs); extern int cppc_get_perf_ctrs(int cpu, struct cppc_perf_fb_ctrs *perf_fb_ctrs);
extern int cppc_set_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls); extern int cppc_set_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls);
extern int cppc_get_perf_caps(int cpu, struct cppc_perf_caps *caps); extern int cppc_get_perf_caps(int cpu, struct cppc_perf_caps *caps);
extern int acpi_get_psd_map(struct cpudata **); extern int acpi_get_psd_map(struct cppc_cpudata **);
extern unsigned int cppc_get_transition_latency(int cpu);
#endif /* _CPPC_ACPI_H*/ #endif /* _CPPC_ACPI_H*/
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment