mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] interconnect: qcom: fix endian annotations of BCM aux data
@ 2026-09-22 18:27 Rosen Penev
  2026-09-23  8:52 ` Konrad Dybcio
  0 siblings, 1 reply; 2+ messages in thread
From: Rosen Penev @ 2026-09-22 18:27 UTC (permalink / raw)
  To: linux-pm
  Cc: Georgi Djakov, Dmitry Baryshkov, Rosen Penev,
	open list:ARM/QUALCOMM MAILING LIST, open list

struct qcom_icc_bcm::aux_data stores the values parsed from the command
db, converted to native byte order, but is typed as the raw little-endian
struct bcm_db. Sparse therefore complains when the converted values are
assigned to the __le32/__le16 fields and when those restricted fields
are used in bandwidth calculations.

Give aux_data its own native-endian struct type so the parsed values are
stored with matching annotations, keeping struct bcm_db as the on-disk
format returned by cmd_db_read_aux_data(). No functional change.

Fixes: c96fc14322ce ("interconnect: qcom: add COMPILE_TEST")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202609221350.3Y8MOce9-lkp@intel.com/
Assisted-by: LLM
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 drivers/interconnect/qcom/icc-rpmh.h | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/interconnect/qcom/icc-rpmh.h b/drivers/interconnect/qcom/icc-rpmh.h
index 09d8791402dc..30ec31eafcfb 100644
--- a/drivers/interconnect/qcom/icc-rpmh.h
+++ b/drivers/interconnect/qcom/icc-rpmh.h
@@ -45,6 +45,9 @@ struct qcom_icc_provider {
  * @width: multiplier used to convert bytes/sec bw value to an RPMh msg
  * @vcd: virtual clock domain that this bcm belongs to
  * @reserved: reserved field
+ *
+ * This is the little-endian on-disk format returned by
+ * cmd_db_read_aux_data().
  */
 struct bcm_db {
 	__le32 unit;
@@ -53,6 +56,20 @@ struct bcm_db {
 	u8 reserved;
 };
 
+/**
+ * struct bcm_aux_data - Auxiliary data of a BCM in native byte order
+ * @unit: divisor used to convert bytes/sec bw value to an RPMh msg
+ * @width: multiplier used to convert bytes/sec bw value to an RPMh msg
+ * @vcd: virtual clock domain that this bcm belongs to
+ * @reserved: reserved field
+ */
+struct bcm_aux_data {
+	u32 unit;
+	u16 width;
+	u8 vcd;
+	u8 reserved;
+};
+
 #define MAX_PORTS		4
 
 /**
@@ -135,7 +152,7 @@ struct qcom_icc_bcm {
 	u32 enable_mask;
 	bool dirty;
 	bool keepalive;
-	struct bcm_db aux_data;
+	struct bcm_aux_data aux_data;
 	struct list_head list;
 	struct list_head ws_list;
 	size_t num_nodes;
-- 
2.55.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] interconnect: qcom: fix endian annotations of BCM aux data
  2026-09-22 18:27 [PATCH] interconnect: qcom: fix endian annotations of BCM aux data Rosen Penev
@ 2026-09-23  8:52 ` Konrad Dybcio
  0 siblings, 0 replies; 2+ messages in thread
From: Konrad Dybcio @ 2026-09-23  8:52 UTC (permalink / raw)
  To: Rosen Penev, linux-pm
  Cc: Georgi Djakov, Dmitry Baryshkov,
	open list:ARM/QUALCOMM MAILING LIST, open list

On 9/22/26 8:27 PM, Rosen Penev wrote:
> struct qcom_icc_bcm::aux_data stores the values parsed from the command
> db, converted to native byte order, but is typed as the raw little-endian
> struct bcm_db. Sparse therefore complains when the converted values are
> assigned to the __le32/__le16 fields and when those restricted fields
> are used in bandwidth calculations.

This should be fixed by using cpu_to_leXX()/leXX_to_cpu() when
accessing these fields instead

Konrad

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-23  8:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-22 18:27 [PATCH] interconnect: qcom: fix endian annotations of BCM aux data Rosen Penev
2026-09-23  8:52 ` Konrad Dybcio

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®