RE: [PATCH] drm/amdgpu: export gpu always on cu bitmap

2017-06-21 Thread Deucher, Alexander
> -Original Message-
> From: amd-gfx [mailto:amd-gfx-boun...@lists.freedesktop.org] On Behalf
> Of Flora Cui
> Sent: Wednesday, June 21, 2017 3:42 AM
> To: Alex Deucher
> Cc: amd-gfx list
> Subject: Re: [PATCH] drm/amdgpu: export gpu always on cu bitmap
> 
> On Tue, Jun 20, 2017 at 10:47:39AM -0400, Alex Deucher wrote:
> > On Tue, Jun 20, 2017 at 4:15 AM, Flora Cui  wrote:
> > > Change-Id: I056d8af23340d46e5140bd10cc38dfb887cc78ab
> > > Signed-off-by: Flora Cui 
> > > ---
> > >  drivers/gpu/drm/amd/amdgpu/amdgpu.h | 7 +--
> > >  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++-
> > >  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 3 ++-
> > >  drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c   | 4 +++-
> > >  drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c   | 4 +++-
> > >  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c   | 4 +++-
> > >  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c   | 4 +++-
> > >  include/uapi/drm/amdgpu_drm.h   | 2 +-
> > >  8 files changed, 22 insertions(+), 9 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> > > index 6b7d2a1..6b9a91c 100644
> > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> > > @@ -1029,12 +1029,15 @@ struct amdgpu_gfx_config {
> > >  };
> > >
> > >  struct amdgpu_cu_info {
> > > -   uint32_t number; /* total active CU number */
> > > -   uint32_t ao_cu_mask;
> > > uint32_t max_waves_per_simd;
> > > uint32_t wave_front_size;
> > > uint32_t max_scratch_slots_per_cu;
> > > uint32_t lds_size;
> > > +
> > > +   /* total active CU number */
> > > +   uint32_t number;
> > > +   uint32_t ao_cu_mask;
> > > +   uint32_t ao_cu_bitmap[4][4];
> > > uint32_t bitmap[4][4];
> > >  };
> > >
> > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > > index 0424711..5a1d794 100644
> > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > > @@ -67,9 +67,10 @@
> > >   * - 3.15.0 - Export more gpu info for gfx9
> > >   * - 3.16.0 - Add reserved vmid support
> > >   * - 3.17.0 - Add AMDGPU_NUM_VRAM_CPU_PAGE_FAULTS.
> > > + * - 3.18.0 - Export gpu always on cu bitmap
> > >   */
> > >  #define KMS_DRIVER_MAJOR   3
> > > -#define KMS_DRIVER_MINOR   17
> > > +#define KMS_DRIVER_MINOR   18
> > >  #define KMS_DRIVER_PATCHLEVEL  0
> > >
> > >  int amdgpu_vram_limit = 0;
> > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> > > index f68ced6..6ba8204 100644
> > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> > > @@ -591,8 +591,9 @@ static int amdgpu_info_ioctl(struct drm_device
> *dev, void *data, struct drm_file
> > > dev_info.gart_page_size = AMDGPU_GPU_PAGE_SIZE;
> > >
> > > dev_info.cu_active_number = adev->gfx.cu_info.number;
> > > -   dev_info.cu_ao_mask = adev->gfx.cu_info.ao_cu_mask;
> > > dev_info.ce_ram_size = adev->gfx.ce_ram_size;
> > > +   memcpy(&dev_info.cu_ao_bitmap[0], &adev-
> >gfx.cu_info.ao_cu_bitmap[0],
> > > +  sizeof(adev->gfx.cu_info.ao_cu_bitmap));
> > > memcpy(&dev_info.cu_bitmap[0], &adev-
> >gfx.cu_info.bitmap[0],
> > >sizeof(adev->gfx.cu_info.bitmap));
> > > dev_info.vram_type = adev->mc.vram_type;
> > > diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
> b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
> > > index 7b0b3cf..5173ca1 100644
> > > --- a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
> > > +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
> > > @@ -3535,7 +3535,9 @@ static void gfx_v6_0_get_cu_info(struct
> amdgpu_device *adev)
> > > mask <<= 1;
> > > }
> > > active_cu_number += counter;
> > > -   ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
> > > +   if (i < 2 && j < 2)
> > > +   ao_cu_mask |= (ao_bitmap << (i 

Re: [PATCH] drm/amdgpu: export gpu always on cu bitmap

2017-06-21 Thread Christian König

Am 21.06.2017 um 09:42 schrieb Flora Cui:

On Tue, Jun 20, 2017 at 10:47:39AM -0400, Alex Deucher wrote:

On Tue, Jun 20, 2017 at 4:15 AM, Flora Cui  wrote:

Change-Id: I056d8af23340d46e5140bd10cc38dfb887cc78ab
Signed-off-by: Flora Cui 
---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h | 7 +--
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++-
  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 3 ++-
  drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c   | 4 +++-
  drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c   | 4 +++-
  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c   | 4 +++-
  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c   | 4 +++-
  include/uapi/drm/amdgpu_drm.h   | 2 +-
  8 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 6b7d2a1..6b9a91c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -1029,12 +1029,15 @@ struct amdgpu_gfx_config {
  };

  struct amdgpu_cu_info {
-   uint32_t number; /* total active CU number */
-   uint32_t ao_cu_mask;
 uint32_t max_waves_per_simd;
 uint32_t wave_front_size;
 uint32_t max_scratch_slots_per_cu;
 uint32_t lds_size;
+
+   /* total active CU number */
+   uint32_t number;
+   uint32_t ao_cu_mask;
+   uint32_t ao_cu_bitmap[4][4];
 uint32_t bitmap[4][4];
  };

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 0424711..5a1d794 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -67,9 +67,10 @@
   * - 3.15.0 - Export more gpu info for gfx9
   * - 3.16.0 - Add reserved vmid support
   * - 3.17.0 - Add AMDGPU_NUM_VRAM_CPU_PAGE_FAULTS.
+ * - 3.18.0 - Export gpu always on cu bitmap
   */
  #define KMS_DRIVER_MAJOR   3
-#define KMS_DRIVER_MINOR   17
+#define KMS_DRIVER_MINOR   18
  #define KMS_DRIVER_PATCHLEVEL  0

  int amdgpu_vram_limit = 0;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index f68ced6..6ba8204 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -591,8 +591,9 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void 
*data, struct drm_file
 dev_info.gart_page_size = AMDGPU_GPU_PAGE_SIZE;

 dev_info.cu_active_number = adev->gfx.cu_info.number;
-   dev_info.cu_ao_mask = adev->gfx.cu_info.ao_cu_mask;
 dev_info.ce_ram_size = adev->gfx.ce_ram_size;
+   memcpy(&dev_info.cu_ao_bitmap[0], 
&adev->gfx.cu_info.ao_cu_bitmap[0],
+  sizeof(adev->gfx.cu_info.ao_cu_bitmap));
 memcpy(&dev_info.cu_bitmap[0], &adev->gfx.cu_info.bitmap[0],
sizeof(adev->gfx.cu_info.bitmap));
 dev_info.vram_type = adev->mc.vram_type;
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
index 7b0b3cf..5173ca1 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
@@ -3535,7 +3535,9 @@ static void gfx_v6_0_get_cu_info(struct amdgpu_device 
*adev)
 mask <<= 1;
 }
 active_cu_number += counter;
-   ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+   if (i < 2 && j < 2)
+   ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+   cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
 }
 }

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
index fb0a94c..8c4dd7b 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
@@ -5427,7 +5427,9 @@ static void gfx_v7_0_get_cu_info(struct amdgpu_device 
*adev)
 mask <<= 1;
 }
 active_cu_number += counter;
-   ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+   if (i < 2 && j < 2)
+   ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+   cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
 }
 }
 gfx_v7_0_select_se_sh(adev, 0x, 0x, 0x);
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index 1a75ab1..9edb509 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
@@ -7080,7 +7080,9 @@ static void gfx_v8_0_get_cu_info(struct amdgpu_device 
*adev)
 mask <<= 1;
 }
 active_cu_number += counter;
-   ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+   if (i < 2 && j < 2)
+   ao_cu_mask |= (ao_bitm

Re: [PATCH] drm/amdgpu: export gpu always on cu bitmap

2017-06-21 Thread Flora Cui
On Tue, Jun 20, 2017 at 10:47:39AM -0400, Alex Deucher wrote:
> On Tue, Jun 20, 2017 at 4:15 AM, Flora Cui  wrote:
> > Change-Id: I056d8af23340d46e5140bd10cc38dfb887cc78ab
> > Signed-off-by: Flora Cui 
> > ---
> >  drivers/gpu/drm/amd/amdgpu/amdgpu.h | 7 +--
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++-
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 3 ++-
> >  drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c   | 4 +++-
> >  drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c   | 4 +++-
> >  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c   | 4 +++-
> >  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c   | 4 +++-
> >  include/uapi/drm/amdgpu_drm.h   | 2 +-
> >  8 files changed, 22 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h 
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> > index 6b7d2a1..6b9a91c 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> > @@ -1029,12 +1029,15 @@ struct amdgpu_gfx_config {
> >  };
> >
> >  struct amdgpu_cu_info {
> > -   uint32_t number; /* total active CU number */
> > -   uint32_t ao_cu_mask;
> > uint32_t max_waves_per_simd;
> > uint32_t wave_front_size;
> > uint32_t max_scratch_slots_per_cu;
> > uint32_t lds_size;
> > +
> > +   /* total active CU number */
> > +   uint32_t number;
> > +   uint32_t ao_cu_mask;
> > +   uint32_t ao_cu_bitmap[4][4];
> > uint32_t bitmap[4][4];
> >  };
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > index 0424711..5a1d794 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > @@ -67,9 +67,10 @@
> >   * - 3.15.0 - Export more gpu info for gfx9
> >   * - 3.16.0 - Add reserved vmid support
> >   * - 3.17.0 - Add AMDGPU_NUM_VRAM_CPU_PAGE_FAULTS.
> > + * - 3.18.0 - Export gpu always on cu bitmap
> >   */
> >  #define KMS_DRIVER_MAJOR   3
> > -#define KMS_DRIVER_MINOR   17
> > +#define KMS_DRIVER_MINOR   18
> >  #define KMS_DRIVER_PATCHLEVEL  0
> >
> >  int amdgpu_vram_limit = 0;
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c 
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> > index f68ced6..6ba8204 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> > @@ -591,8 +591,9 @@ static int amdgpu_info_ioctl(struct drm_device *dev, 
> > void *data, struct drm_file
> > dev_info.gart_page_size = AMDGPU_GPU_PAGE_SIZE;
> >
> > dev_info.cu_active_number = adev->gfx.cu_info.number;
> > -   dev_info.cu_ao_mask = adev->gfx.cu_info.ao_cu_mask;
> > dev_info.ce_ram_size = adev->gfx.ce_ram_size;
> > +   memcpy(&dev_info.cu_ao_bitmap[0], 
> > &adev->gfx.cu_info.ao_cu_bitmap[0],
> > +  sizeof(adev->gfx.cu_info.ao_cu_bitmap));
> > memcpy(&dev_info.cu_bitmap[0], &adev->gfx.cu_info.bitmap[0],
> >sizeof(adev->gfx.cu_info.bitmap));
> > dev_info.vram_type = adev->mc.vram_type;
> > diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c 
> > b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
> > index 7b0b3cf..5173ca1 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
> > @@ -3535,7 +3535,9 @@ static void gfx_v6_0_get_cu_info(struct amdgpu_device 
> > *adev)
> > mask <<= 1;
> > }
> > active_cu_number += counter;
> > -   ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
> > +   if (i < 2 && j < 2)
> > +   ao_cu_mask |= (ao_bitmap << (i * 16 + j * 
> > 8));
> > +   cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
> > }
> > }
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c 
> > b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
> > index fb0a94c..8c4dd7b 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
> > @@ -5427,7 +5427,9 @@ static void gfx_v7_0_get_cu_info(struct amdgpu_device 
> > *adev)
> > mask <<= 1;
> > }
> > active_cu_number += counter;
> > -   ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
> > +   if (i < 2 && j < 2)
> > +   ao_cu_mask |= (ao_bitmap << (i * 16 + j * 
> > 8));
> > +   cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
> > }
> > }
> > gfx_v7_0_select_se_sh(adev, 0x, 0x, 0x);
> > diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c 
> > b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> > index 1a75ab1..9edb509 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> > @@ -7080,7 +7080

Re: [PATCH] drm/amdgpu: export gpu always on cu bitmap

2017-06-20 Thread Alex Deucher
On Tue, Jun 20, 2017 at 4:15 AM, Flora Cui  wrote:
> Change-Id: I056d8af23340d46e5140bd10cc38dfb887cc78ab
> Signed-off-by: Flora Cui 
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu.h | 7 +--
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 3 ++-
>  drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c   | 4 +++-
>  drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c   | 4 +++-
>  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c   | 4 +++-
>  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c   | 4 +++-
>  include/uapi/drm/amdgpu_drm.h   | 2 +-
>  8 files changed, 22 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index 6b7d2a1..6b9a91c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -1029,12 +1029,15 @@ struct amdgpu_gfx_config {
>  };
>
>  struct amdgpu_cu_info {
> -   uint32_t number; /* total active CU number */
> -   uint32_t ao_cu_mask;
> uint32_t max_waves_per_simd;
> uint32_t wave_front_size;
> uint32_t max_scratch_slots_per_cu;
> uint32_t lds_size;
> +
> +   /* total active CU number */
> +   uint32_t number;
> +   uint32_t ao_cu_mask;
> +   uint32_t ao_cu_bitmap[4][4];
> uint32_t bitmap[4][4];
>  };
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 0424711..5a1d794 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -67,9 +67,10 @@
>   * - 3.15.0 - Export more gpu info for gfx9
>   * - 3.16.0 - Add reserved vmid support
>   * - 3.17.0 - Add AMDGPU_NUM_VRAM_CPU_PAGE_FAULTS.
> + * - 3.18.0 - Export gpu always on cu bitmap
>   */
>  #define KMS_DRIVER_MAJOR   3
> -#define KMS_DRIVER_MINOR   17
> +#define KMS_DRIVER_MINOR   18
>  #define KMS_DRIVER_PATCHLEVEL  0
>
>  int amdgpu_vram_limit = 0;
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> index f68ced6..6ba8204 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> @@ -591,8 +591,9 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void 
> *data, struct drm_file
> dev_info.gart_page_size = AMDGPU_GPU_PAGE_SIZE;
>
> dev_info.cu_active_number = adev->gfx.cu_info.number;
> -   dev_info.cu_ao_mask = adev->gfx.cu_info.ao_cu_mask;
> dev_info.ce_ram_size = adev->gfx.ce_ram_size;
> +   memcpy(&dev_info.cu_ao_bitmap[0], 
> &adev->gfx.cu_info.ao_cu_bitmap[0],
> +  sizeof(adev->gfx.cu_info.ao_cu_bitmap));
> memcpy(&dev_info.cu_bitmap[0], &adev->gfx.cu_info.bitmap[0],
>sizeof(adev->gfx.cu_info.bitmap));
> dev_info.vram_type = adev->mc.vram_type;
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c 
> b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
> index 7b0b3cf..5173ca1 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
> @@ -3535,7 +3535,9 @@ static void gfx_v6_0_get_cu_info(struct amdgpu_device 
> *adev)
> mask <<= 1;
> }
> active_cu_number += counter;
> -   ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
> +   if (i < 2 && j < 2)
> +   ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
> +   cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
> }
> }
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c 
> b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
> index fb0a94c..8c4dd7b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
> @@ -5427,7 +5427,9 @@ static void gfx_v7_0_get_cu_info(struct amdgpu_device 
> *adev)
> mask <<= 1;
> }
> active_cu_number += counter;
> -   ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
> +   if (i < 2 && j < 2)
> +   ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
> +   cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
> }
> }
> gfx_v7_0_select_se_sh(adev, 0x, 0x, 0x);
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c 
> b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> index 1a75ab1..9edb509 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> @@ -7080,7 +7080,9 @@ static void gfx_v8_0_get_cu_info(struct amdgpu_device 
> *adev)
> mask <<= 1;
> }
> active_cu_number += counter;
> -   ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
> +