drm/radeon/kms: implement reading active PCIE lanes on R600+
Subsystems (2)
PATCH v3 1/1 drm/radeon/kms: implement reading active PCIE lanes on R600+
---
V2: use already implemented functions for reading/writing PCIE PORT
V3: fix rreg/wreg typo in macro
Thanks Alex for reviewing!
--- drivers/gpu/drm/radeon/r300.c | 5 ++++- drivers/gpu/drm/radeon/radeon.h | 2 ++ drivers/gpu/drm/radeon/radeon_asic.h | 4 ++-- drivers/gpu/drm/radeon/radeon_pm.c | 2 ++ 4 files changed, 10 insertions(+), 3 deletions(-)
drivers/gpu/drm/radeon/r300.c +4 -1
@@ -549,7 +549,10 @@ int rv370_get_pcie_lanes(struct radeon_device *rdev)/* FIXME wait for idle */ - link_width_cntl =RREG32_PCIE (RADEON_PCIE_LC_LINK_WIDTH_CNTL ); +if (rdev->family <CHIP_R600 ) + link_width_cntl =RREG32_PCIE (RADEON_PCIE_LC_LINK_WIDTH_CNTL ); +else + link_width_cntl =RREG32_PCIE_P (RADEON_PCIE_LC_LINK_WIDTH_CNTL );switch ((link_width_cntl &RADEON_PCIE_LC_LINK_WIDTH_RD_MASK ) >>RADEON_PCIE_LC_LINK_WIDTH_RD_SHIFT ) {case RADEON_PCIE_LC_LINK_WIDTH_X0 :
drivers/gpu/drm/radeon/radeon.h +2 -0
@@ -1014,6 +1014,8 @@ static inline void r100_mm_wreg(struct radeon_device *rdev, uint32_t reg, uint32#define WREG32_MC (reg, v) rdev->mc_wreg(rdev, (reg), (v))#define RREG32_PCIE (reg) rv370_pcie_rreg(rdev, (reg))#define WREG32_PCIE (reg, v) rv370_pcie_wreg(rdev, (reg), (v)) +#define RREG32_PCIE_P (reg) rdev->pciep_rreg(rdev, (reg)) +#define WREG32_PCIE_P (reg, v) rdev->pciep_wreg(rdev, (reg), (v))#define WREG32_P (reg, val, mask) \ do { \ uint32_t tmp_ = RREG32(reg); \
drivers/gpu/drm/radeon/radeon_asic.h +2 -2
@@ -626,7 +626,7 @@ static struct radeon_asic r600_asic = { .set_engine_clock = &radeon_atom_set_engine_clock, .get_memory_clock = &radeon_atom_get_memory_clock, .set_memory_clock = &radeon_atom_set_memory_clock, - .get_pcie_lanes = NULL, + .get_pcie_lanes = &rv370_get_pcie_lanes, .set_pcie_lanes = NULL, .set_clock_gating = NULL, .set_surface_reg = r600_set_surface_reg,
@@ -672,7 +672,7 @@ static struct radeon_asic rv770_asic = { .set_engine_clock = &radeon_atom_set_engine_clock, .get_memory_clock = &radeon_atom_get_memory_clock, .set_memory_clock = &radeon_atom_set_memory_clock, - .get_pcie_lanes = NULL, + .get_pcie_lanes = &rv370_get_pcie_lanes, .set_pcie_lanes = NULL, .set_clock_gating = &radeon_atom_set_clock_gating, .set_surface_reg = r600_set_surface_reg,
drivers/gpu/drm/radeon/radeon_pm.c +2 -0
@@ -442,6 +442,8 @@ static int radeon_debugfs_pm_info(struct seq_file *m, void *data)seq_printf (m,"default memory clock: %u0 kHz\n" , rdev->clock.default_mclk);if (rdev->asic->get_memory_clock)seq_printf (m,"current memory clock: %u0 kHz\n" ,radeon_get_memory_clock (rdev)); +if (rdev->asic->get_pcie_lanes) +seq_printf (m,"PCIE lanes: %d\n" ,radeon_get_pcie_lanes (rdev));return 0 ; }
Signature · 14 lines
1.6.4.2 ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev -- _______________________________________________ Dri-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/dri-devel
2010/2/18 Rafał Miłecki <[email protected]>:
Quoted 18 lines
Signed-off-by Rafał Miłecki <[email protected]>---
V2: use already implemented functions for reading/writing PCIE PORT
V3: fix rreg/wreg typo in macroThanks Alex for reviewing!
---
drivers/gpu/drm/radeon/r300.c | 5 ++++-drivers/gpu/drm/radeon/radeon.h| 2 ++drivers/gpu/drm/radeon/radeon_asic.h| 4 ++--drivers/gpu/drm/radeon/radeon_pm.c| 2 ++4 files changed, 10 insertions(+), 3 deletions(-)drivers/gpu/drm/radeon/r300.c +0
-0
drivers/gpu/drm/radeon/r300.c int rv370_get_pcie_lanes(struct radeon_device *rdev) · line 555
Quoted 8 lines
drivers/gpu/drm/radeon/r300.c +4
-1@@ -549,7 +549,10 @@ int rv370_get_pcie_lanes(struct radeon_device *rdev) /* FIXME wait for idle */ - link_width_cntl = RREG32_PCIE(RADEON_PCIE_LC_LINK_WIDTH_CNTL); + if (rdev->family < CHIP_R600) + link_width_cntl = RREG32_PCIE(RADEON_PCIE_LC_LINK_WIDTH_CNTL); + else + link_width_cntl = RREG32_PCIE_P(RADEON_PCIE_LC_LINK_WIDTH_CNTL);
Since you also have a patch to implement setting the number of lanes, it would be better to create a new r600 version of get_pcie_lanes() since we may need other r6xx+ specific stuff in it.
Alex
Quoted 55 lines
drivers/gpu/drm/radeon/r300.c +0
-0switch ((link_width_cntl & RADEON_PCIE_LC_LINK_WIDTH_RD_MASK) >> RADEON_PCIE_LC_LINK_WIDTH_RD_SHIFT) {case
RADEON_PCIE_LC_LINK_WIDTH_X0:drivers/gpu/drm/radeon/radeon.h +2
-0@@ -1014,6 +1014,8 @@ static inline void r100_mm_wreg(struct radeon_device *rdev, uint32_t reg, uint32 #define WREG32_MC(reg, v) rdev->mc_wreg(rdev, (reg), (v)) #define RREG32_PCIE(reg) rv370_pcie_rreg(rdev, (reg)) #define WREG32_PCIE(reg, v) rv370_pcie_wreg(rdev, (reg), (v)) +#define RREG32_PCIE_P (reg) rdev->pciep_rreg(rdev, (reg)) +#define WREG32_PCIE_P (reg, v) rdev->pciep_wreg(rdev, (reg), (v)) #define WREG32_P(reg, val, mask) \ do { \ uint32_t tmp_ = RREG32(reg); \drivers/gpu/drm/radeon/radeon_asic.h +2
-2@@ -626,7 +626,7 @@ static struct radeon_asic r600_asic = { .set_engine_clock = &radeon_atom_set_engine_clock, .get_memory_clock = &radeon_atom_get_memory_clock, .set_memory_clock = &radeon_atom_set_memory_clock, - .get_pcie_lanes = NULL, + .get_pcie_lanes = &rv370_get_pcie_lanes, .set_pcie_lanes = NULL, .set_clock_gating = NULL, .set_surface_reg = r600_set_surface_reg,@@ -672,7 +672,7 @@ static struct radeon_asic rv770_asic = { .set_engine_clock = &radeon_atom_set_engine_clock, .get_memory_clock = &radeon_atom_get_memory_clock, .set_memory_clock = &radeon_atom_set_memory_clock, - .get_pcie_lanes = NULL, + .get_pcie_lanes = &rv370_get_pcie_lanes, .set_pcie_lanes = NULL, .set_clock_gating = &radeon_atom_set_clock_gating, .set_surface_reg = r600_set_surface_reg,drivers/gpu/drm/radeon/radeon_pm.c +2
-1@@ -442,6 +442,8 @@ static int radeon_debugfs_pm_info(struct seq_file *m, void *data) seq_printf(m, "default memory clock: %u0 kHz\n", rdev->clock.default_mclk); if (rdev->asic->get_memory_clock) seq_printf(m, "current memory clock: %u0 kHz\n", radeon_get_memory_clock(rdev)); + if (rdev->asic->get_pcie_lanes) + seq_printf(m, "PCIE lanes: %d\n", radeon_get_pcie_lanes(rdev)); return 0; } --1.6.4.2
Quoted 12 lines
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel
W dniu 18 lutego 2010 22:04 użytkownik Alex Deucher
Quoted 22 lines · <[email protected]> napisał:
2010/2/18 Rafał Miłecki <[email protected]>:
Quoted 21 lines
Signed-off-by Rafał Miłecki <[email protected]>---
V2: use already implemented functions for reading/writing PCIE PORT
V3: fix rreg/wreg typo in macroThanks Alex for reviewing!
---
drivers/gpu/drm/radeon/r300.c | 5 ++++-drivers/gpu/drm/radeon/radeon.h| 2 ++drivers/gpu/drm/radeon/radeon_asic.h| 4 ++--drivers/gpu/drm/radeon/radeon_pm.c| 2 ++4 files changed, 10 insertions(+), 3 deletions(-)drivers/gpu/drm/radeon/r300.c +0
-0@@ -549,7 +549,10 @@ int rv370_get_pcie_lanes(struct radeon_device *rdev) /* FIXME wait for idle */
Quoted 9 lines
drivers/gpu/drm/radeon/r300.c int rv370_get_pcie_lanes(struct radeon_device *rdev) · line 555
Quoted 5 lines
drivers/gpu/drm/radeon/r300.c +4
-1- link_width_cntl = RREG32_PCIE(RADEON_PCIE_LC_LINK_WIDTH_CNTL); + if (rdev->family < CHIP_R600) + link_width_cntl = RREG32_PCIE(RADEON_PCIE_LC_LINK_WIDTH_CNTL); + else + link_width_cntl = RREG32_PCIE_P(RADEON_PCIE_LC_LINK_WIDTH_CNTL);Since you also have a patch to implement setting the number of lanes, it would be better to create a new r600 version of
get_pcie_lanes()since we may need other r6xx+ specific stuff in it.
If we get to point where r6xx+ code will differ more, I'm ready to implement that. But if that's matter of just one condition, is that worth splitting it into two functions?
Signature · 13 lines
Rafał ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev -- _______________________________________________ Dri-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/dri-devel
2010/2/18 Rafał Miłecki <[email protected]>:
Quoted 34 lines
W dniu 18 lutego 2010 22:04 użytkownik Alex Deucher
Quoted 22 lines · <[email protected]> napisał:
2010/2/18 Rafał Miłecki <[email protected]>:
Quoted 21 lines
Signed-off-by Rafał Miłecki <[email protected]>---
V2: use already implemented functions for reading/writing PCIE PORT
V3: fix rreg/wreg typo in macroThanks Alex for reviewing!
---
drivers/gpu/drm/radeon/r300.c | 5 ++++-drivers/gpu/drm/radeon/radeon.h| 2 ++drivers/gpu/drm/radeon/radeon_asic.h| 4 ++--drivers/gpu/drm/radeon/radeon_pm.c| 2 ++4 files changed, 10 insertions(+), 3 deletions(-)drivers/gpu/drm/radeon/r300.c +0
-0@@ -549,7 +549,10 @@ int rv370_get_pcie_lanes(struct radeon_device *rdev) /* FIXME wait for idle */Quoted 9 lines
drivers/gpu/drm/radeon/r300.c int rv370_get_pcie_lanes(struct radeon_device *rdev) · line 555
Quoted 5 lines
drivers/gpu/drm/radeon/r300.c +4
-1- link_width_cntl = RREG32_PCIE(RADEON_PCIE_LC_LINK_WIDTH_CNTL); + if (rdev->family < CHIP_R600) + link_width_cntl = RREG32_PCIE(RADEON_PCIE_LC_LINK_WIDTH_CNTL); + else + link_width_cntl = RREG32_PCIE_P(RADEON_PCIE_LC_LINK_WIDTH_CNTL);Since you also have a patch to implement setting the number of lanes, it would be better to create a new r600 version of
get_pcie_lanes()since we may need other r6xx+ specific stuff in it.
Quoted 3 lines
If we get to point where r6xx+ code will differ more, I'm ready to implement that. But if that's matter of just one condition, is that worth splitting it into two functions?
I guess it's ok for now. I just don't want to get make it too confusing later on. BTW, does it actually work? I found that generally it always reads back 0 regardless of how many lanes are enabled.
Alex
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
--
W dniu 18 lutego 2010 23:36 użytkownik Alex Deucher
Quoted 35 lines · <[email protected]> napisał:
2010/2/18 Rafał Miłecki <[email protected]>:
Quoted 34 lines
W dniu 18 lutego 2010 22:04 użytkownik Alex Deucher
Quoted 31 lines · <[email protected]> napisał:
2010/2/18 Rafał Miłecki <[email protected]>:
Quoted 18 lines
Signed-off-by Rafał Miłecki <[email protected]>---
V2: use already implemented functions for reading/writing PCIE PORT
V3: fix rreg/wreg typo in macroThanks Alex for reviewing!
---
drivers/gpu/drm/radeon/r300.c | 5 ++++-drivers/gpu/drm/radeon/radeon.h| 2 ++drivers/gpu/drm/radeon/radeon_asic.h| 4 ++--drivers/gpu/drm/radeon/radeon_pm.c| 2 ++4 files changed, 10 insertions(+), 3 deletions(-)drivers/gpu/drm/radeon/r300.c +0
-0drivers/gpu/drm/radeon/r300.c int rv370_get_pcie_lanes(struct radeon_device *rdev) · line 555
Quoted 8 lines
drivers/gpu/drm/radeon/r300.c +4
-1@@ -549,7 +549,10 @@ int rv370_get_pcie_lanes(struct radeon_device *rdev) /* FIXME wait for idle */ - link_width_cntl = RREG32_PCIE(RADEON_PCIE_LC_LINK_WIDTH_CNTL); + if (rdev->family < CHIP_R600) + link_width_cntl = RREG32_PCIE(RADEON_PCIE_LC_LINK_WIDTH_CNTL); + else + link_width_cntl = RREG32_PCIE_P(RADEON_PCIE_LC_LINK_WIDTH_CNTL);Since you also have a patch to implement setting the number of lanes, it would be better to create a new r600 version of
get_pcie_lanes()since we may need other r6xx+ specific stuff in it.
Quoted 8 lines
Quoted 3 lines
If we get to point where r6xx+ code will differ more, I'm ready to implement that. But if that's matter of just one condition, is that worth splitting it into two functions?
I guess it's ok for now. I just don't want to get make it too confusing later on. BTW, does it actually work? I found that generally it always reads back 0 regardless of how many lanes are enabled.
It reads fine for me... 16 for default :| Not sure about changing to lower values.
Signature · 13 lines
Rafał ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev -- _______________________________________________ Dri-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/dri-devel