firmware: arm_scmi: Get detailed power scale from perf
In SCMI v3.1 the power scale can be in micro-Watts. The upper layers, e.g. cpufreq and EM should handle received power values properly (upscale when needed). Thus, provide an interface which allows to check what is the scale for power values. The old interface allowed to distinguish between bogo-Watts and milli-Watts only (which was good for older SCMI spec). Acked-by: Sudeep Holla <sudeep.holla@arm.com> Signed-off-by: Lukasz Luba <lukasz.luba@arm.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
Родитель
c5d39fae89
Коммит
5e0fd2026c
|
@ -170,8 +170,7 @@ struct perf_dom_info {
|
||||||
struct scmi_perf_info {
|
struct scmi_perf_info {
|
||||||
u32 version;
|
u32 version;
|
||||||
int num_domains;
|
int num_domains;
|
||||||
bool power_scale_mw;
|
enum scmi_power_scale power_scale;
|
||||||
bool power_scale_uw;
|
|
||||||
u64 stats_addr;
|
u64 stats_addr;
|
||||||
u32 stats_size;
|
u32 stats_size;
|
||||||
struct perf_dom_info *dom_info;
|
struct perf_dom_info *dom_info;
|
||||||
|
@ -201,9 +200,13 @@ static int scmi_perf_attributes_get(const struct scmi_protocol_handle *ph,
|
||||||
u16 flags = le16_to_cpu(attr->flags);
|
u16 flags = le16_to_cpu(attr->flags);
|
||||||
|
|
||||||
pi->num_domains = le16_to_cpu(attr->num_domains);
|
pi->num_domains = le16_to_cpu(attr->num_domains);
|
||||||
pi->power_scale_mw = POWER_SCALE_IN_MILLIWATT(flags);
|
|
||||||
|
if (POWER_SCALE_IN_MILLIWATT(flags))
|
||||||
|
pi->power_scale = SCMI_POWER_MILLIWATTS;
|
||||||
if (PROTOCOL_REV_MAJOR(pi->version) >= 0x3)
|
if (PROTOCOL_REV_MAJOR(pi->version) >= 0x3)
|
||||||
pi->power_scale_uw = POWER_SCALE_IN_MICROWATT(flags);
|
if (POWER_SCALE_IN_MICROWATT(flags))
|
||||||
|
pi->power_scale = SCMI_POWER_MICROWATTS;
|
||||||
|
|
||||||
pi->stats_addr = le32_to_cpu(attr->stats_addr_low) |
|
pi->stats_addr = le32_to_cpu(attr->stats_addr_low) |
|
||||||
(u64)le32_to_cpu(attr->stats_addr_high) << 32;
|
(u64)le32_to_cpu(attr->stats_addr_high) << 32;
|
||||||
pi->stats_size = le32_to_cpu(attr->stats_size);
|
pi->stats_size = le32_to_cpu(attr->stats_size);
|
||||||
|
@ -792,11 +795,12 @@ static bool scmi_fast_switch_possible(const struct scmi_protocol_handle *ph,
|
||||||
return dom->fc_info && dom->fc_info->level_set_addr;
|
return dom->fc_info && dom->fc_info->level_set_addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool scmi_power_scale_mw_get(const struct scmi_protocol_handle *ph)
|
static enum scmi_power_scale
|
||||||
|
scmi_power_scale_get(const struct scmi_protocol_handle *ph)
|
||||||
{
|
{
|
||||||
struct scmi_perf_info *pi = ph->get_priv(ph);
|
struct scmi_perf_info *pi = ph->get_priv(ph);
|
||||||
|
|
||||||
return pi->power_scale_mw;
|
return pi->power_scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct scmi_perf_proto_ops perf_proto_ops = {
|
static const struct scmi_perf_proto_ops perf_proto_ops = {
|
||||||
|
@ -811,7 +815,7 @@ static const struct scmi_perf_proto_ops perf_proto_ops = {
|
||||||
.freq_get = scmi_dvfs_freq_get,
|
.freq_get = scmi_dvfs_freq_get,
|
||||||
.est_power_get = scmi_dvfs_est_power_get,
|
.est_power_get = scmi_dvfs_est_power_get,
|
||||||
.fast_switch_possible = scmi_fast_switch_possible,
|
.fast_switch_possible = scmi_fast_switch_possible,
|
||||||
.power_scale_mw_get = scmi_power_scale_mw_get,
|
.power_scale_get = scmi_power_scale_get,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int scmi_perf_set_notify_enabled(const struct scmi_protocol_handle *ph,
|
static int scmi_perf_set_notify_enabled(const struct scmi_protocol_handle *ph,
|
||||||
|
|
|
@ -60,6 +60,12 @@ struct scmi_clock_info {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum scmi_power_scale {
|
||||||
|
SCMI_POWER_BOGOWATTS,
|
||||||
|
SCMI_POWER_MILLIWATTS,
|
||||||
|
SCMI_POWER_MICROWATTS
|
||||||
|
};
|
||||||
|
|
||||||
struct scmi_handle;
|
struct scmi_handle;
|
||||||
struct scmi_device;
|
struct scmi_device;
|
||||||
struct scmi_protocol_handle;
|
struct scmi_protocol_handle;
|
||||||
|
@ -135,7 +141,7 @@ struct scmi_perf_proto_ops {
|
||||||
unsigned long *rate, unsigned long *power);
|
unsigned long *rate, unsigned long *power);
|
||||||
bool (*fast_switch_possible)(const struct scmi_protocol_handle *ph,
|
bool (*fast_switch_possible)(const struct scmi_protocol_handle *ph,
|
||||||
struct device *dev);
|
struct device *dev);
|
||||||
bool (*power_scale_mw_get)(const struct scmi_protocol_handle *ph);
|
enum scmi_power_scale (*power_scale_get)(const struct scmi_protocol_handle *ph);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Загрузка…
Ссылка в новой задаче