From 44b9cd147a5672685a441e666909726a4f6c352b Mon Sep 17 00:00:00 2001 From: Ivan Priest Date: Thu, 7 Jun 2018 17:13:55 +0100 Subject: [PATCH] [9610] wlbt: don't pack mxconf on Android P. After correcting mxconf structures to fix the warning reported by Clang, WLBT FW crashes due to disagreement of the alignment of shared data structures between driver and FW. I suspect that because of the "__packed struct foo" syntax used for mxconf.h on both sides, the structures don't really get packed at all, so correcting it on one side only doesn't work. Change-Id: Ie1c451d009531a2fa86a3e864a02f02647341cc4 SCSC-Bug-Id: SSB-40175 Signed-off-by: Ivan Priest --- drivers/misc/samsung/scsc/mxconf.h | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/misc/samsung/scsc/mxconf.h b/drivers/misc/samsung/scsc/mxconf.h index 85f5e5e66d0a..47951253430d 100644 --- a/drivers/misc/samsung/scsc/mxconf.h +++ b/drivers/misc/samsung/scsc/mxconf.h @@ -24,6 +24,13 @@ /* Uses */ +/* It appears that due to the previous syntax "__packed struct foo" used in this + * header, the structures here don't actually get packed. Clang warns that + * that syntax is ignored. But correcting it causes a misalignment with FW. + * The __MXPACKED macro is used to stop packing the structures in this + * header until we've investigated further. + */ +#define __MXPACKED /* TODO: HACK - don't actually pack! */ /* Definitions */ @@ -54,7 +61,7 @@ struct mxcbufconf { uint32_t packet_size; /**< Size of each individual packet within the buffer */ scsc_mifram_ref read_index_loc; /**< Location of 32bit read index in DRAM or Mailbox */ scsc_mifram_ref write_index_loc; /**< Location of 32bit write index */ -} __packed; +} __MXPACKED; /** * Maxwell Management Simplex Stream Configuration @@ -70,7 +77,7 @@ struct mxstreamconf { /** Allocated MIF Interrupt Write Bit Index */ uint8_t write_bit_idx; -} __packed; +} __MXPACKED; /** * Maxwell Management Transport Configuration @@ -80,7 +87,7 @@ struct mxstreamconf { struct mxtransconf { struct mxstreamconf to_ap_stream_conf; struct mxstreamconf from_ap_stream_conf; -} __packed; +} __MXPACKED; /** * Maxwell Infrastructure Configuration Version @@ -88,7 +95,7 @@ struct mxtransconf { struct mxconfversion { uint16_t major; uint16_t minor; -} __packed; +} __MXPACKED; /** * Mxlog Event Buffer Configuration. @@ -98,7 +105,7 @@ struct mxconfversion { struct mxlogconf { struct mxstreamconf stream_conf; -} __packed; +} __MXPACKED; /** * Maxwell Infrastructure Configuration @@ -136,6 +143,6 @@ struct mxconf { */ struct mxlogconf mxlogconf; -} __packed; +} __MXPACKED; #endif /* MXCONF_H__ */ -- 2.20.1