Skip to contentSkip to conversation

drm/amdgpu/userq: fix struct drm_amdgpu_info_device padding for 32bit compile

PATCH In review Yogesh Mohan Marimuthu 3 participants 10 messages Aug 20 – Aug 28

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu/userq: fix struct drm_amdgpu_info_device padding for 32bit compile

need to pad before __u64 tcc_disabled_mask variable.

---
 include/uapi/drm/amdgpu_drm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/drm/amdgpu_drm.h +1 -1
index 0a113529b..5beef3eaa 100644
@@ -1517,6 +1517,7 @@ struct drm_amdgpu_info_device {
 	__u64 high_va_max;
 	/* gfx10 pa_sc_tile_steering_override */
 	__u32 pa_sc_tile_steering_override;
+	__u32 pad;
 	/* disabled TCCs */
 	__u64 tcc_disabled_mask;
 	__u64 min_engine_clock;
@@ -1541,7 +1542,6 @@ struct drm_amdgpu_info_device {
 	__u32 csa_alignment;
 	/* Userq IP mask (1 << AMDGPU_HW_IP_*) */
 	__u32 userq_ip_mask;
-	__u32 pad;
 };
 
 struct drm_amdgpu_info_hw_ip {
Signature · 1 line
2.43.0
#1 lore raw
Quoted 4 lines · Yogesh Mohan Marimuthu

need to pad before __u64 tcc_disabled_mask variable.

This will break UAPI.

Alex

Quoted 27 lines
---
 include/uapi/drm/amdgpu_drm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/drm/amdgpu_drm.h +1 -2
index 0a113529b..5beef3eaa 100644
@@ -1517,6 +1517,7 @@ struct drm_amdgpu_info_device {
        __u64 high_va_max;
        /* gfx10 pa_sc_tile_steering_override */
        __u32 pa_sc_tile_steering_override;
+       __u32 pad;
        /* disabled TCCs */
        __u64 tcc_disabled_mask;
        __u64 min_engine_clock;
@@ -1541,7 +1542,6 @@ struct drm_amdgpu_info_device {
        __u32 csa_alignment;
        /* Userq IP mask (1 << AMDGPU_HW_IP_*) */
        __u32 userq_ip_mask;
-       __u32 pad;
 };
 
 struct drm_amdgpu_info_hw_ip {
--

2.43.0

#2 lore raw

AMD General

Hi Alex,

In 32bit mesa, I did not get the correct userq_ip_mask value.
I checked for variable alignment and tcc_disabled_mask was not on 8 byte alignment. This patch fixes it.

Can you please tell how it would break UAPI. What did I miss.

Thank you,
Yogesh

________________________________
From: Alex Deucher <[email protected]>
Sent: Thursday, August 20, 2026 7:23 PM
To: Mohan Marimuthu, Yogesh <[email protected]>
Cc: [email protected] <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Khatri, Sunil <[email protected]>
Subject: Re: [PATCH] drm/amdgpu/userq: fix struct drm_amdgpu_info_device padding for 32bit compile

Quoted 4 lines · Yogesh Mohan Marimuthu

need to pad before __u64 tcc_disabled_mask variable.

This will break UAPI.

Alex

Quoted 27 lines
---
 include/uapi/drm/amdgpu_drm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/drm/amdgpu_drm.h +1 -2
index 0a113529b..5beef3eaa 100644
@@ -1517,6 +1517,7 @@ struct drm_amdgpu_info_device {
        __u64 high_va_max;
        /* gfx10 pa_sc_tile_steering_override */
        __u32 pa_sc_tile_steering_override;
+       __u32 pad;
        /* disabled TCCs */
        __u64 tcc_disabled_mask;
        __u64 min_engine_clock;
@@ -1541,7 +1542,6 @@ struct drm_amdgpu_info_device {
        __u32 csa_alignment;
        /* Userq IP mask (1 << AMDGPU_HW_IP_*) */
        __u32 userq_ip_mask;
-       __u32 pad;
 };
 
 struct drm_amdgpu_info_hw_ip {
--

2.43.0

#3 lore raw
Quoted 9 lines · Yogesh

AMD General

Hi Alex,

In 32bit mesa, I did not get the correct userq_ip_mask value.
I checked for variable alignment and tcc_disabled_mask was not on 8 byte alignment. This patch fixes it.

Can you please tell how it would break UAPI. What did I miss.

You are changing the layout of the structure that existing apps expect.

Alex

Quoted 49 lines

Thank you,
Yogesh

________________________________
From: Alex Deucher <[email protected]>
Sent: Thursday, August 20, 2026 7:23 PM
To: Mohan Marimuthu, Yogesh <[email protected]>
Cc: [email protected] <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Khatri, Sunil <[email protected]>
Subject: Re: [PATCH] drm/amdgpu/userq: fix struct drm_amdgpu_info_device padding for 32bit compile

Quoted 4 lines · Yogesh Mohan Marimuthu

need to pad before __u64 tcc_disabled_mask variable.

This will break UAPI.

Alex

Quoted 27 lines
---
 include/uapi/drm/amdgpu_drm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/drm/amdgpu_drm.h +1 -2
index 0a113529b..5beef3eaa 100644
@@ -1517,6 +1517,7 @@ struct drm_amdgpu_info_device {
        __u64 high_va_max;
        /* gfx10 pa_sc_tile_steering_override */
        __u32 pa_sc_tile_steering_override;
+       __u32 pad;
        /* disabled TCCs */
        __u64 tcc_disabled_mask;
        __u64 min_engine_clock;
@@ -1541,7 +1542,6 @@ struct drm_amdgpu_info_device {
        __u32 csa_alignment;
        /* Userq IP mask (1 << AMDGPU_HW_IP_*) */
        __u32 userq_ip_mask;
-       __u32 pad;
 };
 
 struct drm_amdgpu_info_hw_ip {
--

2.43.0

#4 lore raw

AMD General

Hi Alex,

I am not changing the layout.

For 64 bit gcc, default alignment for __u64 is 8bytes. For 32 bit gcc, default alignment for __u64 is 4bytes.

For 32 bit gcc, I have manually padded 4bytes so that it is 8bytes aligned for __u64. This will make 64bit kernel compatible with 32bit mesa compiled using gcc.

Thank you,
Yogesh

________________________________
From: Alex Deucher <[email protected]>
Sent: Thursday, August 20, 2026 8:51 PM
To: Mohan Marimuthu, Yogesh <[email protected]>
Cc: [email protected] <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Khatri, Sunil <[email protected]>
Subject: Re: [PATCH] drm/amdgpu/userq: fix struct drm_amdgpu_info_device padding for 32bit compile

Quoted 9 lines · Yogesh

AMD General

Hi Alex,

In 32bit mesa, I did not get the correct userq_ip_mask value.
I checked for variable alignment and tcc_disabled_mask was not on 8 byte alignment. This patch fixes it.

Can you please tell how it would break UAPI. What did I miss.

You are changing the layout of the structure that existing apps expect.

Alex

Quoted 49 lines

Thank you,
Yogesh

________________________________
From: Alex Deucher <[email protected]>
Sent: Thursday, August 20, 2026 7:23 PM
To: Mohan Marimuthu, Yogesh <[email protected]>
Cc: [email protected] <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Khatri, Sunil <[email protected]>
Subject: Re: [PATCH] drm/amdgpu/userq: fix struct drm_amdgpu_info_device padding for 32bit compile

Quoted 4 lines · Yogesh Mohan Marimuthu

need to pad before __u64 tcc_disabled_mask variable.

This will break UAPI.

Alex

Quoted 27 lines
---
 include/uapi/drm/amdgpu_drm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/drm/amdgpu_drm.h +1 -2
index 0a113529b..5beef3eaa 100644
@@ -1517,6 +1517,7 @@ struct drm_amdgpu_info_device {
        __u64 high_va_max;
        /* gfx10 pa_sc_tile_steering_override */
        __u32 pa_sc_tile_steering_override;
+       __u32 pad;
        /* disabled TCCs */
        __u64 tcc_disabled_mask;
        __u64 min_engine_clock;
@@ -1541,7 +1542,6 @@ struct drm_amdgpu_info_device {
        __u32 csa_alignment;
        /* Userq IP mask (1 << AMDGPU_HW_IP_*) */
        __u32 userq_ip_mask;
-       __u32 pad;
 };
 
 struct drm_amdgpu_info_hw_ip {
--

2.43.0

#5 lore raw
Quoted 12 lines · Yogesh

AMD General

Hi Alex,

I am not changing the layout.

For 64 bit gcc, default alignment for __u64 is 8bytes. For 32 bit gcc, default alignment for __u64 is 4bytes.

For 32 bit gcc, I have manually padded 4bytes so that it is 8bytes aligned for __u64. This will make 64bit kernel compatible with 32bit mesa compiled using gcc.

Won't this break 32 bit kernels?

Alex

Quoted 75 lines

Thank you,
Yogesh

________________________________
From: Alex Deucher <[email protected]>
Sent: Thursday, August 20, 2026 8:51 PM
To: Mohan Marimuthu, Yogesh <[email protected]>
Cc: [email protected] <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Khatri, Sunil <[email protected]>
Subject: Re: [PATCH] drm/amdgpu/userq: fix struct drm_amdgpu_info_device padding for 32bit compile

Quoted 9 lines · Yogesh

AMD General

Hi Alex,

In 32bit mesa, I did not get the correct userq_ip_mask value.
I checked for variable alignment and tcc_disabled_mask was not on 8 byte alignment. This patch fixes it.

Can you please tell how it would break UAPI. What did I miss.

You are changing the layout of the structure that existing apps expect.

Alex

Quoted 49 lines

Thank you,
Yogesh

________________________________
From: Alex Deucher <[email protected]>
Sent: Thursday, August 20, 2026 7:23 PM
To: Mohan Marimuthu, Yogesh <[email protected]>
Cc: [email protected] <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Khatri, Sunil <[email protected]>
Subject: Re: [PATCH] drm/amdgpu/userq: fix struct drm_amdgpu_info_device padding for 32bit compile

Quoted 4 lines · Yogesh Mohan Marimuthu

need to pad before __u64 tcc_disabled_mask variable.

This will break UAPI.

Alex

Quoted 27 lines
---
 include/uapi/drm/amdgpu_drm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/drm/amdgpu_drm.h +1 -2
index 0a113529b..5beef3eaa 100644
@@ -1517,6 +1517,7 @@ struct drm_amdgpu_info_device {
        __u64 high_va_max;
        /* gfx10 pa_sc_tile_steering_override */
        __u32 pa_sc_tile_steering_override;
+       __u32 pad;
        /* disabled TCCs */
        __u64 tcc_disabled_mask;
        __u64 min_engine_clock;
@@ -1541,7 +1542,6 @@ struct drm_amdgpu_info_device {
        __u32 csa_alignment;
        /* Userq IP mask (1 << AMDGPU_HW_IP_*) */
        __u32 userq_ip_mask;
-       __u32 pad;
 };
 
 struct drm_amdgpu_info_hw_ip {
--

2.43.0

#6 lore raw

AMD General

Hi Alex,

With 32bit Kernel + patch and older userspace will be broken. It will need userspace to be recompiled.
The current situation is "64bit Kernel + 32bit userspace" already broken. It can be said that the current Kernel "struct drm_amdgpu_info_device" is broken.

Though "64bit Kernel + 32bit userspace" is already broken but it has not been noticed until now, it was noticed with userq_ip_mask variable retuning zero.

I think we have only two options,

1.
Probably "32bit Kernel + 32bit UMD" combination is not used and hence picking this patch might not trigger any compatibility issue.
2.
Create AMDGPU_INFO_DEV_INFO_2 version 2 for DRM_AMDGPU_INFO ioctl to pass the fixed data structure, but this would keep the older structure that is already broken still broken.

Thank you,
Yogesh

________________________________
From: Alex Deucher <[email protected]>
Sent: Thursday, August 20, 2026 11:00 PM
To: Mohan Marimuthu, Yogesh <[email protected]>
Cc: [email protected] <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Khatri, Sunil <[email protected]>
Subject: Re: [PATCH] drm/amdgpu/userq: fix struct drm_amdgpu_info_device padding for 32bit compile

Quoted 12 lines · Yogesh

AMD General

Hi Alex,

I am not changing the layout.

For 64 bit gcc, default alignment for __u64 is 8bytes. For 32 bit gcc, default alignment for __u64 is 4bytes.

For 32 bit gcc, I have manually padded 4bytes so that it is 8bytes aligned for __u64. This will make 64bit kernel compatible with 32bit mesa compiled using gcc.

Won't this break 32 bit kernels?

Alex

Quoted 75 lines

Thank you,
Yogesh

________________________________
From: Alex Deucher <[email protected]>
Sent: Thursday, August 20, 2026 8:51 PM
To: Mohan Marimuthu, Yogesh <[email protected]>
Cc: [email protected] <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Khatri, Sunil <[email protected]>
Subject: Re: [PATCH] drm/amdgpu/userq: fix struct drm_amdgpu_info_device padding for 32bit compile

Quoted 9 lines · Yogesh

AMD General

Hi Alex,

In 32bit mesa, I did not get the correct userq_ip_mask value.
I checked for variable alignment and tcc_disabled_mask was not on 8 byte alignment. This patch fixes it.

Can you please tell how it would break UAPI. What did I miss.

You are changing the layout of the structure that existing apps expect.

Alex

Quoted 49 lines

Thank you,
Yogesh

________________________________
From: Alex Deucher <[email protected]>
Sent: Thursday, August 20, 2026 7:23 PM
To: Mohan Marimuthu, Yogesh <[email protected]>
Cc: [email protected] <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Khatri, Sunil <[email protected]>
Subject: Re: [PATCH] drm/amdgpu/userq: fix struct drm_amdgpu_info_device padding for 32bit compile

Quoted 4 lines · Yogesh Mohan Marimuthu

need to pad before __u64 tcc_disabled_mask variable.

This will break UAPI.

Alex

Quoted 27 lines
---
 include/uapi/drm/amdgpu_drm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/drm/amdgpu_drm.h +1 -2
index 0a113529b..5beef3eaa 100644
@@ -1517,6 +1517,7 @@ struct drm_amdgpu_info_device {
        __u64 high_va_max;
        /* gfx10 pa_sc_tile_steering_override */
        __u32 pa_sc_tile_steering_override;
+       __u32 pad;
        /* disabled TCCs */
        __u64 tcc_disabled_mask;
        __u64 min_engine_clock;
@@ -1541,7 +1542,6 @@ struct drm_amdgpu_info_device {
        __u32 csa_alignment;
        /* Userq IP mask (1 << AMDGPU_HW_IP_*) */
        __u32 userq_ip_mask;
-       __u32 pad;
 };
 
 struct drm_amdgpu_info_hw_ip {
--

2.43.0

maintainer Reviewed-by Alex Deucher
#7 lore raw

Hi guys,

if it looks like this means that the UAPI is broken since:

commit cf21e76a6005016474623a375ae2e90364a02168

Author: Marek Olšák <[email protected]>
Date:   Tue Sep 24 17:53:25 2019 -0400

drm/amdgpu: return tcc_disabled_mask to userspace

UMDs need this for correct programming of harvested chips.

It's just that nobody really noticed.

*sigh* this is exactly one of the reasons why I don't wanted to extend the drm_amdgpu_info_device structure. If I'm not completely mistaken we have messed things up massively now.

This currently works with 32bit kernels / 32bit userspace and 64bit kernel / 64bit userspace, but breaks as soon as you have 64bit kernel / 32bit userspace combination.

We have now the choice to apply this patch and essentially break 32bit kernel and 32bit userspace combination or use some other hacky workaround.

Alex and Yogesh let's discuss that on my Thursday meeting.

Regards,
Christian.

Quoted 121 lines · Yogesh

AMD General

Hi Alex,

With 32bit Kernel + patch and older userspace will be broken. It will need userspace to be recompiled.
The current situation is "64bit Kernel + 32bit userspace" already broken. It can be said that the current Kernel "struct drm_amdgpu_info_device" is broken.

Though "64bit Kernel + 32bit userspace" is already broken but it has not been noticed until now, it was noticed with userq_ip_mask variable retuning zero.

I think we have only two options,

1.
Probably "32bit Kernel + 32bit UMD" combination is not used and hence picking this patch might not trigger any compatibility issue.
2.
Create AMDGPU_INFO_DEV_INFO_2 version 2 for DRM_AMDGPU_INFO ioctl to pass the fixed data structure, but this would keep the older structure that is already broken still broken.

Thank you,
Yogesh

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
*From:* Alex Deucher <[email protected]>
*Sent:* Thursday, August 20, 2026 11:00 PM
*To:* Mohan Marimuthu, Yogesh <[email protected]>
*Cc:* [email protected] <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Khatri, Sunil <[email protected]> *Subject:* Re: [PATCH] drm/amdgpu/userq: fix struct drm_amdgpu_info_device padding for 32bit compile

Quoted 12 lines · Yogesh

AMD General

Hi Alex,

I am not changing the layout.

For 64 bit gcc, default alignment for __u64 is 8bytes. For 32 bit gcc, default alignment for __u64 is 4bytes.

For 32 bit gcc, I have manually padded 4bytes so that it is 8bytes aligned for __u64. This will make 64bit kernel compatible with 32bit mesa compiled using gcc.

Won't this break 32 bit kernels?

Alex

Quoted 75 lines

Thank you,
Yogesh

________________________________
From: Alex Deucher <[email protected]>
Sent: Thursday, August 20, 2026 8:51 PM
To: Mohan Marimuthu, Yogesh <[email protected]>
Cc: [email protected] <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Khatri, Sunil <[email protected]>
Subject: Re: [PATCH] drm/amdgpu/userq: fix struct drm_amdgpu_info_device padding for 32bit compile

Quoted 9 lines · Yogesh

AMD General

Hi Alex,

In 32bit mesa, I did not get the correct userq_ip_mask value.
I checked for variable alignment and tcc_disabled_mask was not on 8 byte alignment. This patch fixes it.

Can you please tell how it would break UAPI. What did I miss.

You are changing the layout of the structure that existing apps expect.

Alex

Quoted 49 lines

Thank you,
Yogesh

________________________________
From: Alex Deucher <[email protected]>
Sent: Thursday, August 20, 2026 7:23 PM
To: Mohan Marimuthu, Yogesh <[email protected]>
Cc: [email protected] <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Khatri, Sunil <[email protected]>
Subject: Re: [PATCH] drm/amdgpu/userq: fix struct drm_amdgpu_info_device padding for 32bit compile

Quoted 4 lines · Yogesh Mohan Marimuthu

need to pad before __u64 tcc_disabled_mask variable.

This will break UAPI.

Alex

Quoted 27 lines

---
  include/uapi/drm/amdgpu_drm.h | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/drm/amdgpu_drm.h +1 -2
index 0a113529b..5beef3eaa 100644
@@ -1517,6 +1517,7 @@ struct drm_amdgpu_info_device {
          __u64 high_va_max;
          /* gfx10 pa_sc_tile_steering_override */
          __u32 pa_sc_tile_steering_override;
+       __u32 pad;
          /* disabled TCCs */
          __u64 tcc_disabled_mask;
          __u64 min_engine_clock;
@@ -1541,7 +1542,6 @@ struct drm_amdgpu_info_device {
          __u32 csa_alignment;
          /* Userq IP mask (1 << AMDGPU_HW_IP_*) */
          __u32 userq_ip_mask;
-       __u32 pad;
   };
 
   struct drm_amdgpu_info_hw_ip {
--

2.43.0

#8 lore raw

We discussed this today and currently today 32 bit kernel + 32 bit userspace and 64 bit kernel and 64 bit userspace work. Mixed 64 bit kernel and 32 bit userspace is currently broken. Since 32 bit kernel and userspace is probably pretty rare these days and the data affected by this is not critical, I think we can go ahead with this. Please write this up in the commit message.

Alex

Quoted 153 lines · Christian König

Hi guys,

if it looks like this means that the UAPI is broken since:

commit cf21e76a6005016474623a375ae2e90364a02168

Author: Marek Olšák <[email protected]>
Date:   Tue Sep 24 17:53:25 2019 -0400

drm/amdgpu: return tcc_disabled_mask to userspace

UMDs need this for correct programming of harvested chips.

It's just that nobody really noticed.

*sigh* this is exactly one of the reasons why I don't wanted to extend the drm_amdgpu_info_device structure. If I'm not completely mistaken we have messed things up massively now.

This currently works with 32bit kernels / 32bit userspace and 64bit kernel / 64bit userspace, but breaks as soon as you have 64bit kernel / 32bit userspace combination.

We have now the choice to apply this patch and essentially break 32bit kernel and 32bit userspace combination or use some other hacky workaround.

Alex and Yogesh let's discuss that on my Thursday meeting.

Regards,
Christian.

Quoted 121 lines · Yogesh

AMD General

Hi Alex,

With 32bit Kernel + patch and older userspace will be broken. It will need userspace to be recompiled.
The current situation is "64bit Kernel + 32bit userspace" already broken. It can be said that the current Kernel "struct drm_amdgpu_info_device" is broken.

Though "64bit Kernel + 32bit userspace" is already broken but it has not been noticed until now, it was noticed with userq_ip_mask variable retuning zero.

I think we have only two options,

1.
Probably "32bit Kernel + 32bit UMD" combination is not used and hence picking this patch might not trigger any compatibility issue.
2.
Create AMDGPU_INFO_DEV_INFO_2 version 2 for DRM_AMDGPU_INFO ioctl to pass the fixed data structure, but this would keep the older structure that is already broken still broken.

Thank you,
Yogesh

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
*From:* Alex Deucher <[email protected]>
*Sent:* Thursday, August 20, 2026 11:00 PM
*To:* Mohan Marimuthu, Yogesh <[email protected]>
*Cc:* [email protected] <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Khatri, Sunil <[email protected]> *Subject:* Re: [PATCH] drm/amdgpu/userq: fix struct drm_amdgpu_info_device padding for 32bit compile

Quoted 12 lines · Yogesh

AMD General

Hi Alex,

I am not changing the layout.

For 64 bit gcc, default alignment for __u64 is 8bytes. For 32 bit gcc, default alignment for __u64 is 4bytes.

For 32 bit gcc, I have manually padded 4bytes so that it is 8bytes aligned for __u64. This will make 64bit kernel compatible with 32bit mesa compiled using gcc.

Won't this break 32 bit kernels?

Alex

Quoted 75 lines

Thank you,
Yogesh

________________________________
From: Alex Deucher <[email protected]>
Sent: Thursday, August 20, 2026 8:51 PM
To: Mohan Marimuthu, Yogesh <[email protected]>
Cc: [email protected] <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Khatri, Sunil <[email protected]>
Subject: Re: [PATCH] drm/amdgpu/userq: fix struct drm_amdgpu_info_device padding for 32bit compile

Quoted 9 lines · Yogesh

AMD General

Hi Alex,

In 32bit mesa, I did not get the correct userq_ip_mask value.
I checked for variable alignment and tcc_disabled_mask was not on 8 byte alignment. This patch fixes it.

Can you please tell how it would break UAPI. What did I miss.

You are changing the layout of the structure that existing apps expect.

Alex

Quoted 49 lines

Thank you,
Yogesh

________________________________
From: Alex Deucher <[email protected]>
Sent: Thursday, August 20, 2026 7:23 PM
To: Mohan Marimuthu, Yogesh <[email protected]>
Cc: [email protected] <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Khatri, Sunil <[email protected]>
Subject: Re: [PATCH] drm/amdgpu/userq: fix struct drm_amdgpu_info_device padding for 32bit compile

Quoted 4 lines · Yogesh Mohan Marimuthu

need to pad before __u64 tcc_disabled_mask variable.

This will break UAPI.

Alex

Quoted 27 lines
---
 include/uapi/drm/amdgpu_drm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/drm/amdgpu_drm.h +1 -2
index 0a113529b..5beef3eaa 100644
@@ -1517,6 +1517,7 @@ struct drm_amdgpu_info_device {
        __u64 high_va_max;
        /* gfx10 pa_sc_tile_steering_override */
        __u32 pa_sc_tile_steering_override;
+       __u32 pad;
        /* disabled TCCs */
        __u64 tcc_disabled_mask;
        __u64 min_engine_clock;
@@ -1541,7 +1542,6 @@ struct drm_amdgpu_info_device {
        __u32 csa_alignment;
        /* Userq IP mask (1 << AMDGPU_HW_IP_*) */
        __u32 userq_ip_mask;
-       __u32 pad;
 };
 
 struct drm_amdgpu_info_hw_ip {
--

2.43.0

#9 lore raw

AMD General

Thank you Alex.

I have updated the patch commit and sent the updated patch for review.

Thank you,
Yogesh
________________________________
From: Alex Deucher <[email protected]>
Sent: Thursday, August 27, 2026 9:06 PM
To: Koenig, Christian <[email protected]>
Cc: Mohan Marimuthu, Yogesh <[email protected]>; [email protected] <[email protected]>; Deucher, Alexander <[email protected]>; Khatri, Sunil <[email protected]>
Subject: Re: [PATCH] drm/amdgpu/userq: fix struct drm_amdgpu_info_device padding for 32bit compile

We discussed this today and currently today 32 bit kernel + 32 bit userspace and 64 bit kernel and 64 bit userspace work. Mixed 64 bit kernel and 32 bit userspace is currently broken. Since 32 bit kernel and userspace is probably pretty rare these days and the data affected by this is not critical, I think we can go ahead with this. Please write this up in the commit message.

Alex

Quoted 153 lines · Christian König

Hi guys,

if it looks like this means that the UAPI is broken since:

commit cf21e76a6005016474623a375ae2e90364a02168

Author: Marek Olšák <[email protected]>
Date:   Tue Sep 24 17:53:25 2019 -0400

drm/amdgpu: return tcc_disabled_mask to userspace

UMDs need this for correct programming of harvested chips.

It's just that nobody really noticed.

*sigh* this is exactly one of the reasons why I don't wanted to extend the drm_amdgpu_info_device structure. If I'm not completely mistaken we have messed things up massively now.

This currently works with 32bit kernels / 32bit userspace and 64bit kernel / 64bit userspace, but breaks as soon as you have 64bit kernel / 32bit userspace combination.

We have now the choice to apply this patch and essentially break 32bit kernel and 32bit userspace combination or use some other hacky workaround.

Alex and Yogesh let's discuss that on my Thursday meeting.

Regards,
Christian.

Quoted 121 lines · Yogesh

AMD General

Hi Alex,

With 32bit Kernel + patch and older userspace will be broken. It will need userspace to be recompiled.
The current situation is "64bit Kernel + 32bit userspace" already broken. It can be said that the current Kernel "struct drm_amdgpu_info_device" is broken.

Though "64bit Kernel + 32bit userspace" is already broken but it has not been noticed until now, it was noticed with userq_ip_mask variable retuning zero.

I think we have only two options,

1.
Probably "32bit Kernel + 32bit UMD" combination is not used and hence picking this patch might not trigger any compatibility issue.
2.
Create AMDGPU_INFO_DEV_INFO_2 version 2 for DRM_AMDGPU_INFO ioctl to pass the fixed data structure, but this would keep the older structure that is already broken still broken.

Thank you,
Yogesh

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
*From:* Alex Deucher <[email protected]>
*Sent:* Thursday, August 20, 2026 11:00 PM
*To:* Mohan Marimuthu, Yogesh <[email protected]>
*Cc:* [email protected] <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Khatri, Sunil <[email protected]> *Subject:* Re: [PATCH] drm/amdgpu/userq: fix struct drm_amdgpu_info_device padding for 32bit compile

Quoted 12 lines · Yogesh

AMD General

Hi Alex,

I am not changing the layout.

For 64 bit gcc, default alignment for __u64 is 8bytes. For 32 bit gcc, default alignment for __u64 is 4bytes.

For 32 bit gcc, I have manually padded 4bytes so that it is 8bytes aligned for __u64. This will make 64bit kernel compatible with 32bit mesa compiled using gcc.

Won't this break 32 bit kernels?

Alex

Quoted 75 lines

Thank you,
Yogesh

________________________________
From: Alex Deucher <[email protected]>
Sent: Thursday, August 20, 2026 8:51 PM
To: Mohan Marimuthu, Yogesh <[email protected]>
Cc: [email protected] <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Khatri, Sunil <[email protected]>
Subject: Re: [PATCH] drm/amdgpu/userq: fix struct drm_amdgpu_info_device padding for 32bit compile

Quoted 9 lines · Yogesh

AMD General

Hi Alex,

In 32bit mesa, I did not get the correct userq_ip_mask value.
I checked for variable alignment and tcc_disabled_mask was not on 8 byte alignment. This patch fixes it.

Can you please tell how it would break UAPI. What did I miss.

You are changing the layout of the structure that existing apps expect.

Alex

Quoted 49 lines

Thank you,
Yogesh

________________________________
From: Alex Deucher <[email protected]>
Sent: Thursday, August 20, 2026 7:23 PM
To: Mohan Marimuthu, Yogesh <[email protected]>
Cc: [email protected] <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Khatri, Sunil <[email protected]>
Subject: Re: [PATCH] drm/amdgpu/userq: fix struct drm_amdgpu_info_device padding for 32bit compile

Quoted 4 lines · Yogesh Mohan Marimuthu

need to pad before __u64 tcc_disabled_mask variable.

This will break UAPI.

Alex

Quoted 27 lines
---
 include/uapi/drm/amdgpu_drm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/drm/amdgpu_drm.h +1 -2
index 0a113529b..5beef3eaa 100644
@@ -1517,6 +1517,7 @@ struct drm_amdgpu_info_device {
        __u64 high_va_max;
        /* gfx10 pa_sc_tile_steering_override */
        __u32 pa_sc_tile_steering_override;
+       __u32 pad;
        /* disabled TCCs */
        __u64 tcc_disabled_mask;
        __u64 min_engine_clock;
@@ -1541,7 +1542,6 @@ struct drm_amdgpu_info_device {
        __u32 csa_alignment;
        /* Userq IP mask (1 << AMDGPU_HW_IP_*) */
        __u32 userq_ip_mask;
-       __u32 pad;
 };
 
 struct drm_amdgpu_info_hw_ip {
--

2.43.0