media: rkvdec: vp9: Fix probs struct alignment
Subsystems (3)
Detlev Casanova
maintainerPATCH 1/1 media: rkvdec: vp9: Fix probs struct alignment
When building for arm 32 bits, the struct alignment changes and the compiler adds 3 padding bits to the anonymous mv struct in rkvdec_vp9_inter_frame_probs.
Therefore, the BUILD_BUG_ON used to check that the struct size is aligned to 128 bits (hardware requirement) fails.
As that mv struct is at the end of the global rkvdec_vp9_probs struct and is followed by 11 padding bits, the 3 padding bits can be explicitely set in the mv struct and removed from the 11 following it.
This makes sure that the mv struct is 32 bits aligned.
--- drivers/media/platform/rockchip/rkvdec/rkvdec-vp9.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/platform/rockchip/rkvdec/rkvdec-vp9.c +3 -1
@@ -66,6 +66,8 @@ struct rkvdec_vp9_inter_frame_probs {u8 fr[2 ][3 ];u8 class0_hp[2 ];u8 hp[2 ]; +/* 32 bit alignment */ +u8 padding6[3 ]; } mv; };
@@ -85,7 +87,7 @@ struct rkvdec_vp9_probs {struct rkvdec_vp9_intra_only_frame_probs intra_only; };/* 128 bit alignment */ -u8 padding1[11 ]; +u8 padding1[8 ]; };/* Data structure describing auxiliary buffer format. */
Signature · 1 line
2.52.0
Le vendredi 12 décembre 2025 à 11:01 -0500, Detlev Casanova a écrit :
Quoted 11 lines
When building for arm 32 bits, the struct alignment changes and the compiler adds 3 padding bits to the anonymous mv struct in
rkvdec_vp9_inter_frame_probs.Therefore, the
BUILD_BUG_ONused to check that the struct size is aligned to 128 bits (hardware requirement) fails.As that mv struct is at the end of the global
rkvdec_vp9_probsstruct and is followed by 11 padding bits, the 3 padding bits can be explicitely set in the mv struct and removed from the 11 following it.
Quoted 8 lines
This makes sure that the mv struct is 32 bits aligned.
Reported-by kernel test robot <[email protected]>Closes:
https://lore.kernel.org/oe-kbuild-all/[email protected]/Fixes d968e50b5c26 ("media: rkvdec: Unstage the driver")Suggested-by Nicolas Dufresne <[email protected]>Signed-off-by Detlev Casanova <[email protected]>
Quoted 27 lines
---
drivers/media/platform/rockchip/rkvdec/rkvdec-vp9.c | 4 +++-1 file changed, 3 insertions(+), 1 deletion(-)drivers/media/platform/rockchip/rkvdec/rkvdec-vp9.c +2
-0@@ -66,6 +66,8 @@ struct rkvdec_vp9_inter_frame_probs { u8 fr[2][3]; u8 class0_hp[2]; u8 hp[2]; +/* 32 bit alignment */ +u8 padding6[3 ]; } mv; };drivers/media/platform/rockchip/rkvdec/rkvdec-vp9.c +1
-1@@ -85,7 +87,7 @@ struct rkvdec_vp9_probs { struct rkvdec_vp9_intra_only_frame_probs intra_only; }; /* 128 bit alignment */ -u8 padding1[11 ]; +u8 padding1[8 ]; };
/* Data structure describing auxiliary buffer format. */
Hi,
Le vendredi 12 décembre 2025 à 11:01 -0500, Detlev Casanova a écrit :
Quoted 1 line
When building for arm 32 bits, the struct alignment changes and the compiler
Reported by checkpatch [0], this needs a reflow, it exceeds 75 chars.
Quoted 8 lines
adds 3 padding bits to the anonymous mv struct in
rkvdec_vp9_inter_frame_probs.Therefore, the
BUILD_BUG_ONused to check that the struct size is aligned to 128 bits (hardware requirement) fails.As that mv struct is at the end of the global
rkvdec_vp9_probsstruct and is followed by 11 padding bits, the 3 padding bits can be explicitely
Also from checkpatch:
explicitely -> explicitly
Quoted 3 lines
set in the mv struct and removed from the 11 following it.
This makes sure that the mv struct is 32 bits aligned.
Unless someone request a change, I will be able to apply these fixes while picking it up.
cheers,
Nicolas
Quoted 32 lines
Reported-by kernel test robot <[email protected]>Fixes d968e50b5c26 ("media: rkvdec: Unstage the driver")Suggested-by Nicolas Dufresne <[email protected]>Signed-off-by Detlev Casanova <[email protected]>---
drivers/media/platform/rockchip/rkvdec/rkvdec-vp9.c | 4 +++-1 file changed, 3 insertions(+), 1 deletion(-)drivers/media/platform/rockchip/rkvdec/rkvdec-vp9.c +2
-0@@ -66,6 +66,8 @@ struct rkvdec_vp9_inter_frame_probs { u8 fr[2][3]; u8 class0_hp[2]; u8 hp[2]; +/* 32 bit alignment */ +u8 padding6[3 ]; } mv; };drivers/media/platform/rockchip/rkvdec/rkvdec-vp9.c +1
-1@@ -85,7 +87,7 @@ struct rkvdec_vp9_probs { struct rkvdec_vp9_intra_only_frame_probs intra_only; }; /* 128 bit alignment */ -u8 padding1[11 ]; +u8 padding1[8 ]; };
/* Data structure describing auxiliary buffer format. */
Detlev Casanova
maintainerHi all,
Sorry, I need to rewrite the commit message with some s/bit/byte...
Will do a v2 soon.
Regards,
Detlev.
Quoted 44 lines · Detlev Casanova
When building for arm 32 bits, the struct alignment changes and the compiler adds 3 padding bits to the anonymous mv struct in
rkvdec_vp9_inter_frame_probs.Therefore, the
BUILD_BUG_ONused to check that the struct size is aligned to 128 bits (hardware requirement) fails.As that mv struct is at the end of the global
rkvdec_vp9_probsstruct and is followed by 11 padding bits, the 3 padding bits can be explicitely set in the mv struct and removed from the 11 following it.This makes sure that the mv struct is 32 bits aligned.
Reported-by kernel test robot <[email protected]>Fixes d968e50b5c26 ("media: rkvdec: Unstage the driver")Suggested-by Nicolas Dufresne <[email protected]>Signed-off-by Detlev Casanova <[email protected]>--- drivers/media/platform/rockchip/rkvdec/rkvdec-vp9.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/media/platform/rockchip/rkvdec/rkvdec-vp9.c +3
-1@@ -66,6 +66,8 @@ struct rkvdec_vp9_inter_frame_probs {u8 fr[2 ][3 ];u8 class0_hp[2 ];u8 hp[2 ]; +/* 32 bit alignment */ +u8 padding6[3 ]; } mv; };@@ -85,7 +87,7 @@ struct rkvdec_vp9_probs {struct rkvdec_vp9_intra_only_frame_probs intra_only; };/* 128 bit alignment */ -u8 padding1[11 ]; +u8 padding1[8 ]; };/* Data structure describing auxiliary buffer format. */