ARM SCMI fixes for v5.14
A small set of fixes: - adding check for presence of probe while registering the driver to prevent NULL pointer access - dropping the duplicate check as the driver core already takes care of it - fix for possible scmi_linux_errmap buffer overflow - fix to avoid sensor message structure padding - fix the range check for the maximum number of pending SCMI messages - fix for various kernel-doc warnings -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEunHlEgbzHrJD3ZPhAEG6vDF+4pgFAmDvEU4ACgkQAEG6vDF+ 4phHnRAAomAQqhO4EvCLl2DTo9cC7Mtlnz2rrWgViBcF1pHYUXfoUWFPlCiesyDm 8K8jWmbTKkZ3ERoSa+uvGVZgYsQJMZcmZ76w9srupmM3gq8cs8BtuZIIVYMCEiLF Ud3pK69jkrTlCn7JM12YoO+2tvAy2y0dTfj1Ii2uUW2hTTxNx9/mBwAZMm770EaS XZvC9RS2OnpluRbt7dQFXbP4EqfgQ5EwnxUXNb5CAgwJBBPWpR109jZTwPvyLAs8 yJIOu/sYn2yeCHLn1fOcAeh95K9B0U1kfekbYxjihVgdhmFuq4IZ+g3e8FY7Lzb0 BcWVnvCqRzxRp3qwqEi5NfxrEbiOSGexszngxb9Bg3l0hg/Jycnw66GY/opij5kq pxN5jg7vEfS9DPzG11SLYSjR+TvldY2gVHhFYfTU+D1K8Cn+kLdXSGRZQkk5fEgo 6dyd/3wDrHUdGLafdDmXT48nHD6Y/DyM407QY5E4gjd0IXJt37/MsJslTo8h1IE7 DgvcmlR697y6dc65OoWxvAT3tdApNzZkwFbgl3Ku0E4pPCZi+XQC1VgCjtI3mQpk MKS/vbkyxaTf4R4/jJC54SS2fmLe9EXNJZ7JuoQ0AIZ6hFey6GQQMnHIfT8Cxdw+ PIV6RtsbKlZdbc8tcs4LgRhKrJd1VvMzJPUROOq4nEl+tZKFsDU= =5mvF -----END PGP SIGNATURE----- gpgsig -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEo6/YBQwIrVS28WGKmmx57+YAGNkFAmDx86UACgkQmmx57+YA GNlmJBAApE5+PET3nWnWNMMaccKbdb21NalFRNpRCJApGanZOmDZ2k0qx+OfL9rK IysFmAowEdot8KwmvbH7ZZoWhCjwKmlYyyRR9PtrRBgfZlMKEyy6s1jlbiYRvU6i eL+gj2Tt2wgEu21U/SMG+T3JSKTGO4iyp7TqGefO/uSVk7VfoTZq1oHu8vEwVVbE LHEepHVExf5Lg0NMn/9G6WwjyELcl+24Gk1VkNaNbUft9GsgF2yj+j64h6KryqQf p8/ClipI9wJM5NJBosLS/pZobdbByei/+4l59+0OZzBjo9yWJEgLIFU9TxfqAGIL uejRA0XP17DZNcz2kiPv96dOSvrC0STl61W7mM7A+tH90GT0Lp8LL16PnvsGKekO 2sXIusjr44dr+nhrqN8FQBVG/h/ZK5yuLN2/9LroSHoX9srhqWJMfcko0bOcggjt h432KMOxRjuOCOkES1TBi5Hp8X4Bo6PGZ9BqKaBs2ievk3Va08FKUTeaA4B49sYD BoMPL9kQH1Zl2YbLuGtyRS3D6MByvCnVTnw8lerWesKMTvURRYHVlVzZ74AtDf+L +NoaocH5viDVX9Z8Nsb/BYuOPAdCkbpcPdfxzaio5/UlmVlKDpkEQ9ziacC4cm9W GvRQtEDsteND+30jjKgB/G04n7AuwDvJgW8BoMm63/A4qGze4A4= =g/zQ -----END PGP SIGNATURE----- Merge tag 'scmi-fixes-5.14' of git://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux into arm/fixes ARM SCMI fixes for v5.14 A small set of fixes: - adding check for presence of probe while registering the driver to prevent NULL pointer access - dropping the duplicate check as the driver core already takes care of it - fix for possible scmi_linux_errmap buffer overflow - fix to avoid sensor message structure padding - fix the range check for the maximum number of pending SCMI messages - fix for various kernel-doc warnings * tag 'scmi-fixes-5.14' of git://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux: firmware: arm_scmi: Fix range check for the maximum number of pending messages firmware: arm_scmi: Avoid padding in sensor message structure firmware: arm_scmi: Fix kernel doc warnings about return values firmware: arm_scpi: Fix kernel doc warnings firmware: arm_scmi: Fix kernel doc warnings firmware: arm_scmi: Fix possible scmi_linux_errmap buffer overflow firmware: arm_scmi: Ensure drivers provide a probe function firmware: arm_scmi: Simplify device probe function on the bus Link: https://lore.kernel.org/r/20210714165831.2617437-1-sudeep.holla@arm.com Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
commit
2526112b68
|
@ -104,11 +104,6 @@ static int scmi_dev_probe(struct device *dev)
|
|||
{
|
||||
struct scmi_driver *scmi_drv = to_scmi_driver(dev->driver);
|
||||
struct scmi_device *scmi_dev = to_scmi_dev(dev);
|
||||
const struct scmi_device_id *id;
|
||||
|
||||
id = scmi_dev_match_id(scmi_dev, scmi_drv);
|
||||
if (!id)
|
||||
return -ENODEV;
|
||||
|
||||
if (!scmi_dev->handle)
|
||||
return -EPROBE_DEFER;
|
||||
|
@ -139,6 +134,9 @@ int scmi_driver_register(struct scmi_driver *driver, struct module *owner,
|
|||
{
|
||||
int retval;
|
||||
|
||||
if (!driver->probe)
|
||||
return -EINVAL;
|
||||
|
||||
retval = scmi_protocol_device_request(driver->id_table);
|
||||
if (retval)
|
||||
return retval;
|
||||
|
|
|
@ -47,7 +47,6 @@ enum scmi_error_codes {
|
|||
SCMI_ERR_GENERIC = -8, /* Generic Error */
|
||||
SCMI_ERR_HARDWARE = -9, /* Hardware Error */
|
||||
SCMI_ERR_PROTOCOL = -10,/* Protocol Error */
|
||||
SCMI_ERR_MAX
|
||||
};
|
||||
|
||||
/* List of all SCMI devices active in system */
|
||||
|
@ -166,8 +165,10 @@ static const int scmi_linux_errmap[] = {
|
|||
|
||||
static inline int scmi_to_linux_errno(int errno)
|
||||
{
|
||||
if (errno < SCMI_SUCCESS && errno > SCMI_ERR_MAX)
|
||||
return scmi_linux_errmap[-errno];
|
||||
int err_idx = -errno;
|
||||
|
||||
if (err_idx >= SCMI_SUCCESS && err_idx < ARRAY_SIZE(scmi_linux_errmap))
|
||||
return scmi_linux_errmap[err_idx];
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
|
@ -1025,8 +1026,9 @@ static int __scmi_xfer_info_init(struct scmi_info *sinfo,
|
|||
const struct scmi_desc *desc = sinfo->desc;
|
||||
|
||||
/* Pre-allocated messages, no more than what hdr.seq can support */
|
||||
if (WARN_ON(desc->max_msg >= MSG_TOKEN_MAX)) {
|
||||
dev_err(dev, "Maximum message of %d exceeds supported %ld\n",
|
||||
if (WARN_ON(!desc->max_msg || desc->max_msg > MSG_TOKEN_MAX)) {
|
||||
dev_err(dev,
|
||||
"Invalid maximum messages %d, not in range [1 - %lu]\n",
|
||||
desc->max_msg, MSG_TOKEN_MAX);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -1137,6 +1139,8 @@ scmi_txrx_setup(struct scmi_info *info, struct device *dev, int prot_id)
|
|||
* @proto_id and @name: if device was still not existent it is created as a
|
||||
* child of the specified SCMI instance @info and its transport properly
|
||||
* initialized as usual.
|
||||
*
|
||||
* Return: A properly initialized scmi device, NULL otherwise.
|
||||
*/
|
||||
static inline struct scmi_device *
|
||||
scmi_get_protocol_device(struct device_node *np, struct scmi_info *info,
|
||||
|
|
|
@ -1457,6 +1457,8 @@ static void scmi_devm_release_notifier(struct device *dev, void *res)
|
|||
*
|
||||
* Generic devres managed helper to register a notifier_block against a
|
||||
* protocol event.
|
||||
*
|
||||
* Return: 0 on Success
|
||||
*/
|
||||
static int scmi_devm_notifier_register(struct scmi_device *sdev,
|
||||
u8 proto_id, u8 evt_id,
|
||||
|
@ -1523,6 +1525,8 @@ static int scmi_devm_notifier_match(struct device *dev, void *res, void *data)
|
|||
* Generic devres managed helper to explicitly un-register a notifier_block
|
||||
* against a protocol event, which was previously registered using the above
|
||||
* @scmi_devm_notifier_register.
|
||||
*
|
||||
* Return: 0 on Success
|
||||
*/
|
||||
static int scmi_devm_notifier_unregister(struct scmi_device *sdev,
|
||||
u8 proto_id, u8 evt_id,
|
||||
|
|
|
@ -166,7 +166,8 @@ struct scmi_msg_sensor_reading_get {
|
|||
|
||||
struct scmi_resp_sensor_reading_complete {
|
||||
__le32 id;
|
||||
__le64 readings;
|
||||
__le32 readings_low;
|
||||
__le32 readings_high;
|
||||
};
|
||||
|
||||
struct scmi_sensor_reading_resp {
|
||||
|
@ -717,7 +718,8 @@ static int scmi_sensor_reading_get(const struct scmi_protocol_handle *ph,
|
|||
|
||||
resp = t->rx.buf;
|
||||
if (le32_to_cpu(resp->id) == sensor_id)
|
||||
*value = get_unaligned_le64(&resp->readings);
|
||||
*value =
|
||||
get_unaligned_le64(&resp->readings_low);
|
||||
else
|
||||
ret = -EPROTO;
|
||||
}
|
||||
|
|
|
@ -101,6 +101,10 @@ struct scmi_clk_proto_ops {
|
|||
* to sustained performance level mapping
|
||||
* @est_power_get: gets the estimated power cost for a given performance domain
|
||||
* at a given frequency
|
||||
* @fast_switch_possible: indicates if fast DVFS switching is possible or not
|
||||
* for a given device
|
||||
* @power_scale_mw_get: indicates if the power values provided are in milliWatts
|
||||
* or in some other (abstract) scale
|
||||
*/
|
||||
struct scmi_perf_proto_ops {
|
||||
int (*limits_set)(const struct scmi_protocol_handle *ph, u32 domain,
|
||||
|
@ -153,7 +157,7 @@ struct scmi_power_proto_ops {
|
|||
};
|
||||
|
||||
/**
|
||||
* scmi_sensor_reading - represent a timestamped read
|
||||
* struct scmi_sensor_reading - represent a timestamped read
|
||||
*
|
||||
* Used by @reading_get_timestamped method.
|
||||
*
|
||||
|
@ -167,7 +171,7 @@ struct scmi_sensor_reading {
|
|||
};
|
||||
|
||||
/**
|
||||
* scmi_range_attrs - specifies a sensor or axis values' range
|
||||
* struct scmi_range_attrs - specifies a sensor or axis values' range
|
||||
* @min_range: The minimum value which can be represented by the sensor/axis.
|
||||
* @max_range: The maximum value which can be represented by the sensor/axis.
|
||||
*/
|
||||
|
@ -177,7 +181,7 @@ struct scmi_range_attrs {
|
|||
};
|
||||
|
||||
/**
|
||||
* scmi_sensor_axis_info - describes one sensor axes
|
||||
* struct scmi_sensor_axis_info - describes one sensor axes
|
||||
* @id: The axes ID.
|
||||
* @type: Axes type. Chosen amongst one of @enum scmi_sensor_class.
|
||||
* @scale: Power-of-10 multiplier applied to the axis unit.
|
||||
|
@ -205,8 +209,8 @@ struct scmi_sensor_axis_info {
|
|||
};
|
||||
|
||||
/**
|
||||
* scmi_sensor_intervals_info - describes number and type of available update
|
||||
* intervals
|
||||
* struct scmi_sensor_intervals_info - describes number and type of available
|
||||
* update intervals
|
||||
* @segmented: Flag for segmented intervals' representation. When True there
|
||||
* will be exactly 3 intervals in @desc, with each entry
|
||||
* representing a member of a segment in this order:
|
||||
|
|
|
@ -51,6 +51,14 @@ struct scpi_sensor_info {
|
|||
* OPP is an index to the list return by @dvfs_get_info
|
||||
* @dvfs_get_info: returns the DVFS capabilities of the given power
|
||||
* domain. It includes the OPP list and the latency information
|
||||
* @device_domain_id: gets the scpi domain id for a given device
|
||||
* @get_transition_latency: gets the DVFS transition latency for a given device
|
||||
* @add_opps_to_device: adds all the OPPs for a given device
|
||||
* @sensor_get_capability: get the list of capabilities for the sensors
|
||||
* @sensor_get_info: get the information of the specified sensor
|
||||
* @sensor_get_value: gets the current value of the sensor
|
||||
* @device_get_power_state: gets the power state of a power domain
|
||||
* @device_set_power_state: sets the power state of a power domain
|
||||
*/
|
||||
struct scpi_ops {
|
||||
u32 (*get_version)(void);
|
||||
|
|
Loading…
Reference in New Issue