[PATCH v2] drm/imagination: Align rogue_fwif_hwrtdata to 64 bytes

Michal Wilczynski posted 1 patch 3 weeks ago
There is a newer version of this series
drivers/gpu/drm/imagination/pvr_rogue_fwif.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH v2] drm/imagination: Align rogue_fwif_hwrtdata to 64 bytes
Posted by Michal Wilczynski 3 weeks ago
The build fails on RISC-V using GCC because `SIZE_CHECK(struct
rogue_fwif_hwrtdata, 384)` expects 384 bytes, but the compiler generates
a 336-byte structure.

This is due to an alignment conflict: the inner member `cleanup_state`
requires 64-byte alignment, but the outer struct is explicitly marked
`__aligned(8)`.

While GCC on ARM64 implicitly pads the size to a multiple of 64, GCC on
RISC-V strictly respects the 8-byte outer alignment, resulting in a size
mismatch.

Fix this by aligning the entire structure to 64 bytes, which resolves
the contradiction and forces the correct 384 byte size on all
architectures.

Fixes: a26f067feac1 ("drm/imagination: Add FWIF headers")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202512131851.1WNXk3BC-lkp@intel.com/
Signed-off-by: Michal Wilczynski <m.wilczynski@samsung.com>
---
Changes in v2:
- EDITME: describe what is new in this series revision.
- EDITME: use bulletpoints and terse descriptions.
- Link to v1: https://lore.kernel.org/r/20251222-fix_imagination-v1-1-0ac80a2ff317@samsung.com
---
 drivers/gpu/drm/imagination/pvr_rogue_fwif.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/imagination/pvr_rogue_fwif.h b/drivers/gpu/drm/imagination/pvr_rogue_fwif.h
index 172886be4c820a32ae1b08d62bf0814250f2a9bd..1ba2a167a38b31911e0846923e4dc70626f5ca65 100644
--- a/drivers/gpu/drm/imagination/pvr_rogue_fwif.h
+++ b/drivers/gpu/drm/imagination/pvr_rogue_fwif.h
@@ -2170,7 +2170,7 @@ struct rogue_fwif_hwrtdata {
 	bool geom_caches_need_zeroing __aligned(4);
 
 	struct rogue_fwif_cleanup_ctl cleanup_state __aligned(64);
-} __aligned(8);
+} __aligned(64);
 
 /*
  ******************************************************************************

---
base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
change-id: 20251222-fix_imagination-8ef0c94122c4

Best regards,
-- 
Michal Wilczynski <m.wilczynski@samsung.com>
Re: [PATCH v2] drm/imagination: Align rogue_fwif_hwrtdata to 64 bytes
Posted by kernel test robot 6 days, 12 hours ago
Hi Michal,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 8f0b4cce4481fb22653697cced8d0d04027cb1e8]

url:    https://github.com/intel-lab-lkp/linux/commits/Michal-Wilczynski/drm-imagination-Align-rogue_fwif_hwrtdata-to-64-bytes/20260805-213722
base:   8f0b4cce4481fb22653697cced8d0d04027cb1e8
patch link:    https://lore.kernel.org/r/20260805-fix_imagination-v2-1-7391a13c891f%40samsung.com
patch subject: [PATCH v2] drm/imagination: Align rogue_fwif_hwrtdata to 64 bytes
config: riscv-randconfig-r131-20260820 (https://download.01.org/0day-ci/archive/20260820/202608201552.P4LSH5IX-lkp@intel.com/config)
compiler: riscv64-linux-gcc (GCC) 8.5.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260820/202608201552.P4LSH5IX-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202608201552.P4LSH5IX-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/gpu/drm/imagination/pvr_power.c:62:16: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got unsigned int [usertype] *power_sync @@
   drivers/gpu/drm/imagination/pvr_power.c:62:16: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/gpu/drm/imagination/pvr_power.c:62:16: sparse:     got unsigned int [usertype] *power_sync

vim +62 drivers/gpu/drm/imagination/pvr_power.c

cc1aeedb98ad34 Sarah Walker 2023-11-22  46  
727538a4bbff07 Sarah Walker 2023-11-22  47  static int
727538a4bbff07 Sarah Walker 2023-11-22  48  pvr_power_send_command(struct pvr_device *pvr_dev, struct rogue_fwif_kccb_cmd *pow_cmd)
727538a4bbff07 Sarah Walker 2023-11-22  49  {
cc1aeedb98ad34 Sarah Walker 2023-11-22  50  	struct pvr_fw_device *fw_dev = &pvr_dev->fw_dev;
cc1aeedb98ad34 Sarah Walker 2023-11-22  51  	u32 slot_nr;
cc1aeedb98ad34 Sarah Walker 2023-11-22  52  	u32 value;
cc1aeedb98ad34 Sarah Walker 2023-11-22  53  	int err;
cc1aeedb98ad34 Sarah Walker 2023-11-22  54  
cc1aeedb98ad34 Sarah Walker 2023-11-22  55  	WRITE_ONCE(*fw_dev->power_sync, 0);
cc1aeedb98ad34 Sarah Walker 2023-11-22  56  
cc1aeedb98ad34 Sarah Walker 2023-11-22  57  	err = pvr_kccb_send_cmd_powered(pvr_dev, pow_cmd, &slot_nr);
cc1aeedb98ad34 Sarah Walker 2023-11-22  58  	if (err)
cc1aeedb98ad34 Sarah Walker 2023-11-22  59  		return err;
cc1aeedb98ad34 Sarah Walker 2023-11-22  60  
cc1aeedb98ad34 Sarah Walker 2023-11-22  61  	/* Wait for FW to acknowledge. */
cc1aeedb98ad34 Sarah Walker 2023-11-22 @62  	return readl_poll_timeout(pvr_dev->fw_dev.power_sync, value, value != 0, 100,
cc1aeedb98ad34 Sarah Walker 2023-11-22  63  				  POWER_SYNC_TIMEOUT_US);
727538a4bbff07 Sarah Walker 2023-11-22  64  }
727538a4bbff07 Sarah Walker 2023-11-22  65  

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Re: [PATCH v2] drm/imagination: Align rogue_fwif_hwrtdata to 64 bytes
Posted by Luigi Santivetti 2 weeks, 2 days ago
On Wed, 2026-08-05 at 21:37 +0200, Michal Wilczynski wrote:
> The build fails on RISC-V using GCC because `SIZE_CHECK(struct
> rogue_fwif_hwrtdata, 384)` expects 384 bytes, but the compiler generates
> a 336-byte structure.
> 
> This is due to an alignment conflict: the inner member `cleanup_state`
> requires 64-byte alignment, but the outer struct is explicitly marked
> `__aligned(8)`.
> 
> While GCC on ARM64 implicitly pads the size to a multiple of 64, GCC on
> RISC-V strictly respects the 8-byte outer alignment, resulting in a size
> mismatch.
> 
> Fix this by aligning the entire structure to 64 bytes, which resolves
> the contradiction and forces the correct 384 byte size on all
> architectures.
> 
> Fixes: a26f067feac1 ("drm/imagination: Add FWIF headers")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes:
> https://lore.kernel.org/oe-kbuild-all/202512131851.1WNXk3BC-lkp@intel.com/
> Signed-off-by: Michal Wilczynski <m.wilczynski@samsung.com>

Reviewed-by: Luigi Santivetti <luigi.santivetti@imgtec.com>

> ---
> Changes in v2:
> - EDITME: describe what is new in this series revision.
> - EDITME: use bulletpoints and terse descriptions.
> - Link to v1:
> https://lore.kernel.org/r/20251222-fix_imagination-v1-1-0ac80a2ff317@samsung.com
> ---
>  drivers/gpu/drm/imagination/pvr_rogue_fwif.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/imagination/pvr_rogue_fwif.h
> b/drivers/gpu/drm/imagination/pvr_rogue_fwif.h
> index
> 172886be4c820a32ae1b08d62bf0814250f2a9bd..1ba2a167a38b31911e0846923e4dc70626f5
> ca65 100644
> --- a/drivers/gpu/drm/imagination/pvr_rogue_fwif.h
> +++ b/drivers/gpu/drm/imagination/pvr_rogue_fwif.h
> @@ -2170,7 +2170,7 @@ struct rogue_fwif_hwrtdata {
>  	bool geom_caches_need_zeroing __aligned(4);
>  
>  	struct rogue_fwif_cleanup_ctl cleanup_state __aligned(64);
> -} __aligned(8);
> +} __aligned(64);
>  
>  /*
>  
> ******************************************************************************
> 
> ---
> base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
> change-id: 20251222-fix_imagination-8ef0c94122c4
> 
> Best regards,
Re: [PATCH v2] drm/imagination: Align rogue_fwif_hwrtdata to 64 bytes
Posted by Alessio Belle 2 weeks, 4 days ago
Hi Michal,

Did you mean to make any changes to this patch? Because apart from the stub
changelog, everything else seems the same as in v1.

Thanks,
Alessio

On Wed, 2026-08-05 at 21:37 +0200, Michal Wilczynski wrote:
> The build fails on RISC-V using GCC because `SIZE_CHECK(struct
> rogue_fwif_hwrtdata, 384)` expects 384 bytes, but the compiler generates
> a 336-byte structure.
> 
> This is due to an alignment conflict: the inner member `cleanup_state`
> requires 64-byte alignment, but the outer struct is explicitly marked
> `__aligned(8)`.
> 
> While GCC on ARM64 implicitly pads the size to a multiple of 64, GCC on
> RISC-V strictly respects the 8-byte outer alignment, resulting in a size
> mismatch.
> 
> Fix this by aligning the entire structure to 64 bytes, which resolves
> the contradiction and forces the correct 384 byte size on all
> architectures.
> 
> Fixes: a26f067feac1 ("drm/imagination: Add FWIF headers")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202512131851.1WNXk3BC-lkp@intel.com/
> Signed-off-by: Michal Wilczynski <m.wilczynski@samsung.com>
> ---
> Changes in v2:
> - EDITME: describe what is new in this series revision.
> - EDITME: use bulletpoints and terse descriptions.
> - Link to v1: https://lore.kernel.org/r/20251222-fix_imagination-v1-1-0ac80a2ff317@samsung.com
> ---
>  drivers/gpu/drm/imagination/pvr_rogue_fwif.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/imagination/pvr_rogue_fwif.h b/drivers/gpu/drm/imagination/pvr_rogue_fwif.h
> index 172886be4c820a32ae1b08d62bf0814250f2a9bd..1ba2a167a38b31911e0846923e4dc70626f5ca65 100644
> --- a/drivers/gpu/drm/imagination/pvr_rogue_fwif.h
> +++ b/drivers/gpu/drm/imagination/pvr_rogue_fwif.h
> @@ -2170,7 +2170,7 @@ struct rogue_fwif_hwrtdata {
>  	bool geom_caches_need_zeroing __aligned(4);
>  
>  	struct rogue_fwif_cleanup_ctl cleanup_state __aligned(64);
> -} __aligned(8);
> +} __aligned(64);
>  
>  /*
>   ******************************************************************************
> 
> ---
> base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
> change-id: 20251222-fix_imagination-8ef0c94122c4
> 
> Best regards,

Re: [PATCH v2] drm/imagination: Align rogue_fwif_hwrtdata to 64 bytes
Posted by Michal Wilczynski 2 weeks, 2 days ago

On 8/8/26 11:27, Alessio Belle wrote:
> Hi Michal,
> 
> Did you mean to make any changes to this patch? Because apart from the stub
> changelog, everything else seems the same as in v1.

Hi Alessio,

Yes, the only intended change for v2 was expanding the commit message
based on the feedback from v1 [1].

I completely missed replacing the "EDITME" template in the changelog
section, sorry.

Let me know if you'd like me to send a v3 just to clean up the changelog
block, or if you're fine taking it as-is.

[1] - https://lore.kernel.org/all/09a1028b03d614ffedc49dee24eee51578fa0d96.camel@imgtec.com/

Best regards,
-- 
Michal Wilczynski <m.wilczynski@samsung.com>

> 
> Thanks,
> Alessio
> 
> On Wed, 2026-08-05 at 21:37 +0200, Michal Wilczynski wrote:
>> The build fails on RISC-V using GCC because `SIZE_CHECK(struct
>> rogue_fwif_hwrtdata, 384)` expects 384 bytes, but the compiler generates
>> a 336-byte structure.
>>
>> This is due to an alignment conflict: the inner member `cleanup_state`
>> requires 64-byte alignment, but the outer struct is explicitly marked
>> `__aligned(8)`.
>>
>> While GCC on ARM64 implicitly pads the size to a multiple of 64, GCC on
>> RISC-V strictly respects the 8-byte outer alignment, resulting in a size
>> mismatch.
>>
>> Fix this by aligning the entire structure to 64 bytes, which resolves
>> the contradiction and forces the correct 384 byte size on all
>> architectures.
>>
>> Fixes: a26f067feac1 ("drm/imagination: Add FWIF headers")
>> Reported-by: kernel test robot <lkp@intel.com>
>> Closes: https://lore.kernel.org/oe-kbuild-all/202512131851.1WNXk3BC-lkp@intel.com/
>> Signed-off-by: Michal Wilczynski <m.wilczynski@samsung.com>
>> ---
>> Changes in v2:
>> - EDITME: describe what is new in this series revision.
>> - EDITME: use bulletpoints and terse descriptions.
>> - Link to v1: https://lore.kernel.org/r/20251222-fix_imagination-v1-1-0ac80a2ff317@samsung.com
>> ---
>>  drivers/gpu/drm/imagination/pvr_rogue_fwif.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/imagination/pvr_rogue_fwif.h b/drivers/gpu/drm/imagination/pvr_rogue_fwif.h
>> index 172886be4c820a32ae1b08d62bf0814250f2a9bd..1ba2a167a38b31911e0846923e4dc70626f5ca65 100644
>> --- a/drivers/gpu/drm/imagination/pvr_rogue_fwif.h
>> +++ b/drivers/gpu/drm/imagination/pvr_rogue_fwif.h
>> @@ -2170,7 +2170,7 @@ struct rogue_fwif_hwrtdata {
>>  	bool geom_caches_need_zeroing __aligned(4);
>>  
>>  	struct rogue_fwif_cleanup_ctl cleanup_state __aligned(64);
>> -} __aligned(8);
>> +} __aligned(64);
>>  
>>  /*
>>   ******************************************************************************
>>
>> ---
>> base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
>> change-id: 20251222-fix_imagination-8ef0c94122c4
>>
>> Best regards,
>
Re: [PATCH v2] drm/imagination: Align rogue_fwif_hwrtdata to 64 bytes
Posted by Luigi Santivetti 2 weeks, 2 days ago
On Mon, 2026-08-10 at 10:53 +0200, Michal Wilczynski wrote:
> 
> 
> On 8/8/26 11:27, Alessio Belle wrote:
> > Hi Michal,
> > 
> > Did you mean to make any changes to this patch? Because apart from the stub
> > changelog, everything else seems the same as in v1.
> 
> Hi Alessio,
> 
> Yes, the only intended change for v2 was expanding the commit message
> based on the feedback from v1 [1].
> 
> I completely missed replacing the "EDITME" template in the changelog
> section, sorry.
> 
> Let me know if you'd like me to send a v3 just to clean up the changelog
> block, or if you're fine taking it as-is.
> 

Hi Michal,

As Alessio is OOO I'd reply by saying you could send a v3 cleaning up the
changelog and adding my reviewed-by (I'll attach this by replying to the patch).

Thank you,
Luigi

> [1] -
> https://lore.kernel.org/all/09a1028b03d614ffedc49dee24eee51578fa0d96.camel@imgtec.com/
> 
> Best regards,