* [PATCH] firmware: arm_scmi: Avoid padding in sensor message structure
@ 2021-06-28 17:00 ` Cristian Marussi
0 siblings, 0 replies; 4+ messages in thread
From: Cristian Marussi @ 2021-06-28 17:00 UTC (permalink / raw)
To: linux-kernel, linux-arm-kernel; +Cc: sudeep.holla, cristian.marussi
Structure scmi_resp_sensor_reading_complete is meant to represent an SCMI
asynchronous reading complete message: representing the readings field with
a 64bit type forces padding and breaks reads in scmi_sensor_reading_get.
Split it in two adjacent 32bit readings_low/high subfields to avoid padding
or the need to make it packed.
Fixes: e2083d3673916 ("firmware: arm_scmi: Add SCMI v3.0 sensors timestamped reads")
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
---
drivers/firmware/arm_scmi/sensors.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/firmware/arm_scmi/sensors.c b/drivers/firmware/arm_scmi/sensors.c
index 2c88aa221559..308471586381 100644
--- a/drivers/firmware/arm_scmi/sensors.c
+++ b/drivers/firmware/arm_scmi/sensors.c
@@ -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;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] firmware: arm_scmi: Avoid padding in sensor message structure
@ 2021-06-28 17:00 ` Cristian Marussi
0 siblings, 0 replies; 4+ messages in thread
From: Cristian Marussi @ 2021-06-28 17:00 UTC (permalink / raw)
To: linux-kernel, linux-arm-kernel; +Cc: sudeep.holla, cristian.marussi
Structure scmi_resp_sensor_reading_complete is meant to represent an SCMI
asynchronous reading complete message: representing the readings field with
a 64bit type forces padding and breaks reads in scmi_sensor_reading_get.
Split it in two adjacent 32bit readings_low/high subfields to avoid padding
or the need to make it packed.
Fixes: e2083d3673916 ("firmware: arm_scmi: Add SCMI v3.0 sensors timestamped reads")
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
---
drivers/firmware/arm_scmi/sensors.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/firmware/arm_scmi/sensors.c b/drivers/firmware/arm_scmi/sensors.c
index 2c88aa221559..308471586381 100644
--- a/drivers/firmware/arm_scmi/sensors.c
+++ b/drivers/firmware/arm_scmi/sensors.c
@@ -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;
}
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] firmware: arm_scmi: Avoid padding in sensor message structure
2021-06-28 17:00 ` Cristian Marussi
@ 2021-07-14 16:38 ` Sudeep Holla
-1 siblings, 0 replies; 4+ messages in thread
From: Sudeep Holla @ 2021-07-14 16:38 UTC (permalink / raw)
To: Cristian Marussi, linux-arm-kernel, linux-kernel; +Cc: Sudeep Holla
On Mon, 28 Jun 2021 18:00:42 +0100, Cristian Marussi wrote:
> Structure scmi_resp_sensor_reading_complete is meant to represent an SCMI
> asynchronous reading complete message: representing the readings field with
> a 64bit type forces padding and breaks reads in scmi_sensor_reading_get.
>
> Split it in two adjacent 32bit readings_low/high subfields to avoid padding
> or the need to make it packed.
Applied to sudeep.holla/linux (for-next/scmi), thanks!
[1/1] firmware: arm_scmi: Avoid padding in sensor message structure
https://git.kernel.org/sudeep.holla/c/187a002b07
--
Regards,
Sudeep
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] firmware: arm_scmi: Avoid padding in sensor message structure
@ 2021-07-14 16:38 ` Sudeep Holla
0 siblings, 0 replies; 4+ messages in thread
From: Sudeep Holla @ 2021-07-14 16:38 UTC (permalink / raw)
To: Cristian Marussi, linux-arm-kernel, linux-kernel; +Cc: Sudeep Holla
On Mon, 28 Jun 2021 18:00:42 +0100, Cristian Marussi wrote:
> Structure scmi_resp_sensor_reading_complete is meant to represent an SCMI
> asynchronous reading complete message: representing the readings field with
> a 64bit type forces padding and breaks reads in scmi_sensor_reading_get.
>
> Split it in two adjacent 32bit readings_low/high subfields to avoid padding
> or the need to make it packed.
Applied to sudeep.holla/linux (for-next/scmi), thanks!
[1/1] firmware: arm_scmi: Avoid padding in sensor message structure
https://git.kernel.org/sudeep.holla/c/187a002b07
--
Regards,
Sudeep
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-07-14 16:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-28 17:00 [PATCH] firmware: arm_scmi: Avoid padding in sensor message structure Cristian Marussi
2021-06-28 17:00 ` Cristian Marussi
2021-07-14 16:38 ` Sudeep Holla
2021-07-14 16:38 ` Sudeep Holla
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.