[10/14] drm/amdgpu: add rv770_get_memory_type to set the GDDR5 flag

Submitted by Huang, Ray on Aug. 30, 2016, 11:50 a.m.

Details

Message ID 1472557811-8015-11-git-send-email-ray.huang@amd.com
State New
Headers show
Series "drm/amdgpu/si: Make SI DPM workable" ( rev: 1 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Huang, Ray Aug. 30, 2016, 11:50 a.m.
Add rv770_get_memory_type to set mem_gddr5 flag, because it will be
used on the whole si dpm part.

Change-Id: I60f7ef38775c3b27e475f38f939905483fbb56f5
Signed-off-by: Huang Rui <ray.huang@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/si_dpm.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/amdgpu/si_dpm.c b/drivers/gpu/drm/amd/amdgpu/si_dpm.c
index 5f1e5fe..563aeea 100644
--- a/drivers/gpu/drm/amd/amdgpu/si_dpm.c
+++ b/drivers/gpu/drm/amd/amdgpu/si_dpm.c
@@ -6433,8 +6433,24 @@  static void si_set_pcie_lane_width_in_smc(struct amdgpu_device *adev,
 	}
 }
 
+void rv770_get_memory_type(struct amdgpu_device *adev)
+{
+	struct rv7xx_power_info *pi = rv770_get_pi(adev);
+	u32 tmp;
+
+	tmp = RREG32(MC_SEQ_MISC0);
+
+	if (((tmp & MC_SEQ_MISC0_GDDR5_MASK) >> MC_SEQ_MISC0_GDDR5_SHIFT) ==
+	    MC_SEQ_MISC0_GDDR5_VALUE)
+		pi->mem_gddr5 = true;
+	else
+		pi->mem_gddr5 = false;
+
+}
+
 static void si_dpm_setup_asic(struct amdgpu_device *adev)
 {
+	rv770_get_memory_type(adev);
 	si_read_clock_registers(adev);
 	si_enable_acpi_power_management(adev);
 }

Comments

> -----Original Message-----

> From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On Behalf

> Of Huang Rui

> Sent: Tuesday, August 30, 2016 7:50 AM

> To: amd-gfx@lists.freedesktop.org; Deucher, Alexander

> Cc: Wang, Ken; Yu, Hui; Huang, Ray; Huan, Alvin

> Subject: [PATCH 10/14] drm/amdgpu: add rv770_get_memory_type to set

> the GDDR5 flag

> 

> Add rv770_get_memory_type to set mem_gddr5 flag, because it will be

> used on the whole si dpm part.

> 

> Change-Id: I60f7ef38775c3b27e475f38f939905483fbb56f5

> Signed-off-by: Huang Rui <ray.huang@amd.com>

> ---

>  drivers/gpu/drm/amd/amdgpu/si_dpm.c | 16 ++++++++++++++++

>  1 file changed, 16 insertions(+)

> 

> diff --git a/drivers/gpu/drm/amd/amdgpu/si_dpm.c

> b/drivers/gpu/drm/amd/amdgpu/si_dpm.c

> index 5f1e5fe..563aeea 100644

> --- a/drivers/gpu/drm/amd/amdgpu/si_dpm.c

> +++ b/drivers/gpu/drm/amd/amdgpu/si_dpm.c

> @@ -6433,8 +6433,24 @@ static void si_set_pcie_lane_width_in_smc(struct

> amdgpu_device *adev,

>  	}

>  }

> 

> +void rv770_get_memory_type(struct amdgpu_device *adev)


adev->mc.vram_type should be set in the gmc module.  Use that instead of pi->mem_gddr5.  See ci_dpm.c for example.

Alex

> +{

> +	struct rv7xx_power_info *pi = rv770_get_pi(adev);

> +	u32 tmp;

> +

> +	tmp = RREG32(MC_SEQ_MISC0);

> +

> +	if (((tmp & MC_SEQ_MISC0_GDDR5_MASK) >>

> MC_SEQ_MISC0_GDDR5_SHIFT) ==

> +	    MC_SEQ_MISC0_GDDR5_VALUE)

> +		pi->mem_gddr5 = true;

> +	else

> +		pi->mem_gddr5 = false;

> +

> +}

> +

>  static void si_dpm_setup_asic(struct amdgpu_device *adev)

>  {

> +	rv770_get_memory_type(adev);

>  	si_read_clock_registers(adev);

>  	si_enable_acpi_power_management(adev);

>  }

> --

> 2.7.4

> 

> _______________________________________________

> amd-gfx mailing list

> amd-gfx@lists.freedesktop.org

> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
On Tue, Aug 30, 2016 at 10:21:21PM +0800, Deucher, Alexander wrote:
> > -----Original Message-----
> > From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On Behalf
> > Of Huang Rui
> > Sent: Tuesday, August 30, 2016 7:50 AM
> > To: amd-gfx@lists.freedesktop.org; Deucher, Alexander
> > Cc: Wang, Ken; Yu, Hui; Huang, Ray; Huan, Alvin
> > Subject: [PATCH 10/14] drm/amdgpu: add rv770_get_memory_type to set
> > the GDDR5 flag
> > 
> > Add rv770_get_memory_type to set mem_gddr5 flag, because it will be
> > used on the whole si dpm part.
> > 
> > Change-Id: I60f7ef38775c3b27e475f38f939905483fbb56f5
> > Signed-off-by: Huang Rui <ray.huang@amd.com>
> > ---
> >  drivers/gpu/drm/amd/amdgpu/si_dpm.c | 16 ++++++++++++++++
> >  1 file changed, 16 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/amd/amdgpu/si_dpm.c
> > b/drivers/gpu/drm/amd/amdgpu/si_dpm.c
> > index 5f1e5fe..563aeea 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/si_dpm.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/si_dpm.c
> > @@ -6433,8 +6433,24 @@ static void si_set_pcie_lane_width_in_smc(struct
> > amdgpu_device *adev,
> >  	}
> >  }
> > 
> > +void rv770_get_memory_type(struct amdgpu_device *adev)
> 
> adev->mc.vram_type should be set in the gmc module.  Use that instead of pi->mem_gddr5.  See ci_dpm.c for example.
> 

So should I use "adev->mc.vram_type == AMDGPU_VRAM_TYPE_GDDR5" check
instead? I will update it in V2.

Thanks,
Rui
> -----Original Message-----

> From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On Behalf

> Of Huang Rui

> Sent: Tuesday, August 30, 2016 12:07 PM

> To: Deucher, Alexander

> Cc: Huan, Alvin; Wang, Ken; amd-gfx@lists.freedesktop.org; Yu, Hui

> Subject: Re: [PATCH 10/14] drm/amdgpu: add rv770_get_memory_type to

> set the GDDR5 flag

> 

> On Tue, Aug 30, 2016 at 10:21:21PM +0800, Deucher, Alexander wrote:

> > > -----Original Message-----

> > > From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On

> Behalf

> > > Of Huang Rui

> > > Sent: Tuesday, August 30, 2016 7:50 AM

> > > To: amd-gfx@lists.freedesktop.org; Deucher, Alexander

> > > Cc: Wang, Ken; Yu, Hui; Huang, Ray; Huan, Alvin

> > > Subject: [PATCH 10/14] drm/amdgpu: add rv770_get_memory_type to

> set

> > > the GDDR5 flag

> > >

> > > Add rv770_get_memory_type to set mem_gddr5 flag, because it will be

> > > used on the whole si dpm part.

> > >

> > > Change-Id: I60f7ef38775c3b27e475f38f939905483fbb56f5

> > > Signed-off-by: Huang Rui <ray.huang@amd.com>

> > > ---

> > >  drivers/gpu/drm/amd/amdgpu/si_dpm.c | 16 ++++++++++++++++

> > >  1 file changed, 16 insertions(+)

> > >

> > > diff --git a/drivers/gpu/drm/amd/amdgpu/si_dpm.c

> > > b/drivers/gpu/drm/amd/amdgpu/si_dpm.c

> > > index 5f1e5fe..563aeea 100644

> > > --- a/drivers/gpu/drm/amd/amdgpu/si_dpm.c

> > > +++ b/drivers/gpu/drm/amd/amdgpu/si_dpm.c

> > > @@ -6433,8 +6433,24 @@ static void

> si_set_pcie_lane_width_in_smc(struct

> > > amdgpu_device *adev,

> > >  	}

> > >  }

> > >

> > > +void rv770_get_memory_type(struct amdgpu_device *adev)

> >

> > adev->mc.vram_type should be set in the gmc module.  Use that instead of

> pi->mem_gddr5.  See ci_dpm.c for example.

> >

> 

> So should I use "adev->mc.vram_type == AMDGPU_VRAM_TYPE_GDDR5"

> check

> instead? I will update it in V2.


Sure.  Either that or set pi->mem_gddr5 = adev->mc.vram_type == AMDGPU_VRAM_TYPE_GDDR5;

Also, double check that the gmc6 module properly sets vram_type.  See the gmc 7 module for reference.

Alex

> 

> Thanks,

> Rui

> _______________________________________________

> amd-gfx mailing list

> amd-gfx@lists.freedesktop.org

> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
On Wed, Aug 31, 2016 at 12:17:27AM +0800, Deucher, Alexander wrote:
> > -----Original Message-----
> > From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On Behalf
> > Of Huang Rui
> > Sent: Tuesday, August 30, 2016 12:07 PM
> > To: Deucher, Alexander
> > Cc: Huan, Alvin; Wang, Ken; amd-gfx@lists.freedesktop.org; Yu, Hui
> > Subject: Re: [PATCH 10/14] drm/amdgpu: add rv770_get_memory_type to
> > set the GDDR5 flag
> > 
> > On Tue, Aug 30, 2016 at 10:21:21PM +0800, Deucher, Alexander wrote:
> > > > -----Original Message-----
> > > > From: amd-gfx [mailto:amd-gfx-bounces@lists.freedesktop.org] On
> > Behalf
> > > > Of Huang Rui
> > > > Sent: Tuesday, August 30, 2016 7:50 AM
> > > > To: amd-gfx@lists.freedesktop.org; Deucher, Alexander
> > > > Cc: Wang, Ken; Yu, Hui; Huang, Ray; Huan, Alvin
> > > > Subject: [PATCH 10/14] drm/amdgpu: add rv770_get_memory_type to
> > set
> > > > the GDDR5 flag
> > > >
> > > > Add rv770_get_memory_type to set mem_gddr5 flag, because it will be
> > > > used on the whole si dpm part.
> > > >
> > > > Change-Id: I60f7ef38775c3b27e475f38f939905483fbb56f5
> > > > Signed-off-by: Huang Rui <ray.huang@amd.com>
> > > > ---
> > > >  drivers/gpu/drm/amd/amdgpu/si_dpm.c | 16 ++++++++++++++++
> > > >  1 file changed, 16 insertions(+)
> > > >
> > > > diff --git a/drivers/gpu/drm/amd/amdgpu/si_dpm.c
> > > > b/drivers/gpu/drm/amd/amdgpu/si_dpm.c
> > > > index 5f1e5fe..563aeea 100644
> > > > --- a/drivers/gpu/drm/amd/amdgpu/si_dpm.c
> > > > +++ b/drivers/gpu/drm/amd/amdgpu/si_dpm.c
> > > > @@ -6433,8 +6433,24 @@ static void
> > si_set_pcie_lane_width_in_smc(struct
> > > > amdgpu_device *adev,
> > > >  	}
> > > >  }
> > > >
> > > > +void rv770_get_memory_type(struct amdgpu_device *adev)
> > >
> > > adev->mc.vram_type should be set in the gmc module.  Use that instead of
> > pi->mem_gddr5.  See ci_dpm.c for example.
> > >
> > 
> > So should I use "adev->mc.vram_type == AMDGPU_VRAM_TYPE_GDDR5"
> > check
> > instead? I will update it in V2.
> 
> Sure.  Either that or set pi->mem_gddr5 = adev->mc.vram_type == AMDGPU_VRAM_TYPE_GDDR5;
> 
> Also, double check that the gmc6 module properly sets vram_type.  See the gmc 7 module for reference.
> 

I see. vram_type is already inited as gmc_v6_0_convert_vram_type(tmp) in
early_init of gmc 6. Good to know, thanks.

Rui