All-round reclocking improvements
Subsystems (3)
In bulletpoints:
- Add some support for G94 and G96 reclocking. Has been tested on literally two cards, which is hardly adequate as "full coverage". On the other hand, the changes were small enough to make me confident this might work for others as well.
- Fix NV50 wait for VBLANK when no monitor is plugged in.
- Voltage related inprovements for GT21x.
- Slightly improve Keplers handling of DDR3 cards where the DLL should be disabled. Lays the foundation for a similar improvement in GDDR5 cards, but lacking such a card I can't test any changes here.
If you don't feel confident about patch 9 feel free to drop it. But better:
test this series and report with me on IRC #nouveau when things don't work. Cheers,
Roy
_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau
A message that is not in the archive (sent off-list or not yet received): 1443569032-13817-1-git-send-email-rspliet-pPYjZ15w/[email protected]
PATCH 1/9 bios/rammap: Identify DLLoff for >= GF100
--- .../drm/nouveau/include/nvkm/subdev/bios/ramcfg.h | 1 - drivers/gpu/drm/nouveau/nvkm/subdev/bios/rammap.c | 2 +- drivers/gpu/drm/nouveau/nvkm/subdev/fb/gddr5.c | 3 +- drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgk104.c | 41 ++++++++++++++++++---- drivers/gpu/drm/nouveau/nvkm/subdev/fb/sddr3.c | 4 +-- 5 files changed, 39 insertions(+), 12 deletions(-)
drivers/gpu/drm/nouveau/include/nvkm/subdev/bios/ramcfg.h +0 -1
@@ -78,7 +78,6 @@ struct nvbios_ramcfg { unsigned ramcfg_11_01_04:1; unsigned ramcfg_11_01_08:1; unsigned ramcfg_11_01_10:1; - unsigned ramcfg_11_01_20:1; unsigned ramcfg_11_01_40:1; unsigned ramcfg_11_01_80:1; unsigned ramcfg_11_02_03:2;
drivers/gpu/drm/nouveau/nvkm/subdev/bios/rammap.c +1 -1
@@ -219,7 +219,7 @@ nvbios_rammapSp(struct nvkm_bios *bios, u32 data, p->ramcfg_11_01_04 = (nvbios_rd08 (bios, data +0x01 ) &0x04 ) >>2 ; p->ramcfg_11_01_08 = (nvbios_rd08 (bios, data +0x01 ) &0x08 ) >>3 ; p->ramcfg_11_01_10 = (nvbios_rd08 (bios, data +0x01 ) &0x10 ) >>4 ; - p->ramcfg_11_01_20 = (nvbios_rd08 (bios, data +0x01 ) &0x20 ) >>5 ; + p->ramcfg_DLLoff = (nvbios_rd08 (bios, data +0x01 ) &0x20 ) >>5 ; p->ramcfg_11_01_40 = (nvbios_rd08 (bios, data +0x01 ) &0x40 ) >>6 ; p->ramcfg_11_01_80 = (nvbios_rd08 (bios, data +0x01 ) &0x80 ) >>7 ; p->ramcfg_11_02_03 = (nvbios_rd08 (bios, data +0x02 ) &0x03 ) >>0 ;
drivers/gpu/drm/nouveau/nvkm/subdev/fb/gddr5.c +2 -1
@@ -38,11 +38,12 @@ nvkm_gddr5_calc(struct nvkm_ram *ram, bool nuts)int WL ,CL ,WR , at[2 ], dt, ds;int rq = ram->freq <1000000 ;/* XXX */ + xd = !ram->next->bios.ramcfg_DLLoff; +switch (ram->next->bios.ramcfg_ver) {case 0x11 : pd = ram->next->bios.ramcfg_11_01_80; lf = ram->next->bios.ramcfg_11_01_40; - xd = !ram->next->bios.ramcfg_11_01_20; vh = ram->next->bios.ramcfg_11_02_10; vr = ram->next->bios.ramcfg_11_02_04; vo = ram->next->bios.ramcfg_11_06;
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgk104.c +34 -7
69 lines not on this page · raw message
drivers/gpu/drm/nouveau/nvkm/subdev/fb/sddr3.c +2 -2
@@ -70,6 +70,8 @@ nvkm_sddr3_calc(struct nvkm_ram *ram) {int CWL ,CL ,WR ,DLL =0 ,ODT =0 ; +DLL = !ram->next->bios.ramcfg_DLLoff; +switch (ram->next->bios.timing_ver) {case 0x10 :if (ram->next->bios.timing_hdr <0x17 ) {
@@ -79,7 +81,6 @@ nvkm_sddr3_calc(struct nvkm_ram *ram)CWL = ram->next->bios.timing_10_CWL;CL = ram->next->bios.timing_10_CL;WR = ram->next->bios.timing_10_WR; -DLL = !ram->next->bios.ramcfg_DLLoff;ODT = ram->next->bios.timing_10_ODT;break ;case 0x20 :
@@ -87,7 +88,6 @@ nvkm_sddr3_calc(struct nvkm_ram *ram)CL = (ram->next->bios.timing[1 ] &0x0000001f ) >>0 ;WR = (ram->next->bios.timing[2 ] &0x007f0000 ) >>16 ;/* XXX: Get these values from the VBIOS instead */ -DLL = !(ram->mr[1 ] &0x1 );ODT = (ram->mr[1 ] &0x004 ) >>2 | (ram->mr[1 ] &0x040 ) >>5 | (ram->mr[1 ] &0x200 ) >>7 ;
Signature · 8 lines
2.4.3 _______________________________________________ Nouveau mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH 2/9 fb/ramgt215: Transform GPIO ramfuc method from FBVREF-specific to generic
In reply to a message not in the archiveIn preparation of changing FBVDDQ, as observed on at least one GDDR3 card. While at it, adhere to func.log[1] properly for consistency.
--- drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c | 41 ++++++++++------------- drivers/gpu/drm/nouveau/nvkm/subdev/gpio/nv50.c | 2 +- 2 files changed, 19 insertions(+), 24 deletions(-)
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c +18 -23
@@ -34,9 +34,6 @@#include <subdev/clk/gt215.h> #include <subdev/gpio.h> -/* XXX: Remove when memx gains GPIO support */ -extern int nv50_gpio_location (int line,u32 *reg,u32 *shift); -struct gt215_ramfuc {struct ramfuc base;struct ramfuc_reg r_0x001610;
@@ -75,7 +72,7 @@ struct gt215_ramfuc {struct ramfuc_reg r_0x111400;struct ramfuc_reg r_0x611200;struct ramfuc_reg r_mr[4 ]; -struct ramfuc_reg r_gpioFBVREF; +struct ramfuc_reg r_gpio[4 ]; };struct gt215_ltrain {
@@ -466,24 +463,27 @@ gt215_ram_lock_pll(struct gt215_ramfuc *fuc, struct gt215_clk_info *mclk) }static void -gt215_ram_fbvref (struct gt215_ramfuc *fuc,u32 val) +gt215_ram_gpio (struct gt215_ramfuc *fuc,u8 tag,u32 val) {struct nvkm_gpio *gpio = fuc->base.fb->subdev.device->gpio;struct dcb_gpio_func func;u32 reg, sh, gpio_val;int ret; -if (nvkm_gpio_get (gpio,0 ,0x2e ,DCB_GPIO_UNUSED ) != val) { - ret =nvkm_gpio_find (gpio,0 ,0x2e ,DCB_GPIO_UNUSED , &func); +if (nvkm_gpio_get (gpio,0 , tag,DCB_GPIO_UNUSED ) != val) { + ret =nvkm_gpio_find (gpio,0 , tag,DCB_GPIO_UNUSED , &func);if (ret)return ; -nv50_gpio_location (func.line, ®, &sh); - gpio_val =ram_rd32 (fuc, gpioFBVREF); + reg = func.line >>3 ; + sh = (func.line &0x7 ) <<2 ; + gpio_val =ram_rd32 (fuc, gpio[reg]);if (gpio_val & (8 << sh)) val = !val; +if (!(func.log[1 ] &1 )) + val = !val; -ram_mask (fuc, gpioFBVREF, (0x3 << sh), ((val |0x2 ) << sh)); +ram_mask (fuc, gpio[reg], (0x3 << sh), ((val |0x2 ) << sh));ram_nsec (fuc,20000 ); } }
@@ -642,8 +642,8 @@ gt215_ram_calc(struct nvkm_ram *base, u32 freq)break ; } -if (fuc->r_gpioFBVREF.addr && next->bios.timing_10_ODT) -gt215_ram_fbvref (fuc,0 ); +if (next->bios.timing_10_ODT) +gt215_ram_gpio (fuc,0x2e ,1 );/* Brace RAM for impact */ ram_wr32 (fuc,0x1002d4 ,0x00000001 );
@@ -809,8 +809,8 @@ gt215_ram_calc(struct nvkm_ram *base, u32 freq)ram_mask (fuc,0x100718 ,0xffffffff , unk718);ram_mask (fuc,0x111100 ,0xffffffff , r111100); -if (fuc->r_gpioFBVREF.addr && !next->bios.timing_10_ODT) -gt215_ram_fbvref (fuc,1 ); +if (!next->bios.timing_10_ODT) +gt215_ram_gpio (fuc,0x2e ,0 );/* Reset DLL */ if (!next->bios.ramcfg_DLLoff)
@@ -919,10 +919,7 @@ gt215_ram_func = {int gt215_ram_new (struct nvkm_fb *fb,struct nvkm_ram **pram) { -struct nvkm_gpio *gpio = fb->subdev.device->gpio; -struct dcb_gpio_func func;struct gt215_ram *ram; -u32 reg, shift;int ret, i;if (!(ram =kzalloc (sizeof (*ram),GFP_KERNEL )))
@@ -981,12 +978,10 @@ gt215_ram_new(struct nvkm_fb *fb, struct nvkm_ram **pram) ram->fuc.r_mr[2 ] =ramfuc_reg (0x1002e0 ); ram->fuc.r_mr[3 ] =ramfuc_reg (0x1002e4 ); } - - ret =nvkm_gpio_find (gpio,0 ,0x2e ,DCB_GPIO_UNUSED , &func); -if (ret ==0 ) { -nv50_gpio_location (func.line, ®, &shift); - ram->fuc.r_gpioFBVREF =ramfuc_reg (reg); - } + ram->fuc.r_gpio[0 ] =ramfuc_reg (0x00e104 ); + ram->fuc.r_gpio[1 ] =ramfuc_reg (0x00e108 ); + ram->fuc.r_gpio[2 ] =ramfuc_reg (0x00e120 ); + ram->fuc.r_gpio[3 ] =ramfuc_reg (0x00e124 );return 0 ; }
drivers/gpu/drm/nouveau/nvkm/subdev/gpio/nv50.c +1 -1
@@ -54,7 +54,7 @@ nv50_gpio_reset(struct nvkm_gpio *gpio, u8 match) } } -int +static int nv50_gpio_location (int line,u32 *reg,u32 *shift) {const u32 nv50_gpio_reg[4 ] = {0xe104 ,0xe108 ,0xe280 ,0xe284 };
Signature · 8 lines
2.4.3 _______________________________________________ Nouveau mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH 3/9 fb/ramgt215: Change FBVDD/Q when BIOS asks for it
In reply to a message not in the archive--- .../gpu/drm/nouveau/include/nvkm/subdev/bios/ramcfg.h | 1 + drivers/gpu/drm/nouveau/nvkm/subdev/bios/rammap.c | 1 + drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+)
drivers/gpu/drm/nouveau/include/nvkm/subdev/bios/ramcfg.h +1 -0
@@ -39,6 +39,7 @@ struct nvbios_ramcfg {unsigned ramcfg_timing;unsigned ramcfg_DLLoff;unsigned ramcfg_RON; +unsigned ramcfg_FBVDDQ; union { struct { unsigned ramcfg_00_03_01:1;
drivers/gpu/drm/nouveau/nvkm/subdev/bios/rammap.c +1 -0
@@ -205,6 +205,7 @@ nvbios_rammapSp(struct nvkm_bios *bios, u32 data, p->ramcfg_DLLoff = (nvbios_rd08 (bios, data +0x02 ) &0x40 ) >>6 ; p->ramcfg_10_03_0f = (nvbios_rd08 (bios, data +0x03 ) &0x0f ) >>0 ; p->ramcfg_10_04_01 = (nvbios_rd08 (bios, data +0x04 ) &0x01 ) >>0 ; + p->ramcfg_FBVDDQ = (nvbios_rd08 (bios, data +0x04 ) &0x08 ) >>3 ; p->ramcfg_10_05 = (nvbios_rd08 (bios, data +0x05 ) &0xff ) >>0 ; p->ramcfg_10_06 = (nvbios_rd08 (bios, data +0x06 ) &0xff ) >>0 ; p->ramcfg_10_07 = (nvbios_rd08 (bios, data +0x07 ) &0xff ) >>0 ;
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c +18 -0
@@ -498,6 +498,7 @@ gt215_ram_calc(struct nvkm_ram *base, u32 freq)struct nvkm_device *device = subdev->device;struct nvkm_bios *bios = device->bios;struct gt215_clk_info mclk; +struct nvkm_gpio *gpio = device->gpio;struct nvkm_ram_data *next;u8 ver, hdr, cnt, len, strap;u32 data;
@@ -656,6 +657,23 @@ gt215_ram_calc(struct nvkm_ram *base, u32 freq)if (device->chipset ==0xa3 && freq <=500000 )ram_mask (fuc,0x100700 ,0x00000006 ,0x00000006 ); +/* Alter FBVDD/Q, apparently must be done with PLL disabled, thus +* set it to bypass */ +if (nvkm_gpio_get (gpio,0 ,0x18 ,DCB_GPIO_UNUSED ) == + next->bios.ramcfg_FBVDDQ) { + data =ram_rd32 (fuc,0x004000 ) &0x9 ; + +if (data ==0x1 ) +ram_mask (fuc,0x004000 ,0x8 ,0x8 ); +if (data &0x1 ) +ram_mask (fuc,0x004000 ,0x1 ,0x0 ); + +gt215_ram_gpio (fuc,0x18 , !next->bios.ramcfg_FBVDDQ); + +if (data &0x1 ) +ram_mask (fuc,0x004000 ,0x1 ,0x1 ); + } +/* Fiddle with clocks */ /* There's 4 scenario's * pll->pll: first switch to a 324MHz clock, set up new PLL, switch
Signature · 8 lines
2.4.3 _______________________________________________ Nouveau mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH 4/9 fb/ramgt215: Restructure r111100 calculation for DDR2
In reply to a message not in the archiveSeems to be mostly equal to DDR3 on < GT218, should improve stability for DDR2 reclocks.
--- drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c | 70 ++++++++++++----------- 1 file changed, 37 insertions(+), 33 deletions(-)
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgt215.c +37 -33
@@ -771,41 +771,45 @@ gt215_ram_calc(struct nvkm_ram *base, u32 freq) unk71c =ram_rd32 (fuc,0x10071c ) & ~0x00000100 ; r111100 =ram_rd32 (fuc,0x111100 ) & ~0x3a800000 ; -if (next->bios.ramcfg_10_02_04) { -switch (ram->base.type) { -case NVKM_RAM_TYPE_DDR3 : -if (device->chipset !=0xa8 ) - r111100 |=0x00000004 ; -/* no break */ -case NVKM_RAM_TYPE_DDR2 : - r111100 |=0x08000000 ; -break ; -default : -break ; - } +/* NVA8 seems to skip various bits related to ramcfg_10_02_04 */ +if (device->chipset ==0xa8 ) { + r111100 |=0x08000000 ; +if (!next->bios.ramcfg_10_02_04) + unk714 |=0x00000010 ; }else { -switch (ram->base.type) { -case NVKM_RAM_TYPE_DDR2 : - r111100 |=0x1a800000 ; - unk714 |=0x00000010 ; -break ; -case NVKM_RAM_TYPE_DDR3 : -if (device->chipset ==0xa8 ) { - r111100 |=0x08000000 ; - }else { - r111100 &= ~0x00000004 ; - r111100 |=0x12800000 ; +if (next->bios.ramcfg_10_02_04) { +switch (ram->base.type) { +case NVKM_RAM_TYPE_DDR2 : +case NVKM_RAM_TYPE_DDR3 : + r111100 &= ~0x00000020 ; +if (next->bios.ramcfg_10_02_10) + r111100 |=0x08000004 ; +else + r111100 |=0x00000024 ; +break ; +default : +break ; } - unk714 |=0x00000010 ; -break ; -case NVKM_RAM_TYPE_GDDR3 : - r111100 |=0x30000000 ; - unk714 |=0x00000020 ; -break ; -default : -break ; - } - } + }else { +switch (ram->base.type) { +case NVKM_RAM_TYPE_DDR2 : +case NVKM_RAM_TYPE_DDR3 : + r111100 &= ~0x00000024 ; + r111100 |=0x12800000 ; + +if (next->bios.ramcfg_10_02_10) + r111100 |=0x08000000 ; + unk714 |=0x00000010 ; +break ; +case NVKM_RAM_TYPE_GDDR3 : + r111100 |=0x30000000 ; + unk714 |=0x00000020 ; +break ; +default : +break ; + } + } + } unk714 |= (next->bios.ramcfg_10_04_01) <<8 ;
Signature · 8 lines
2.4.3 _______________________________________________ Nouveau mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH 5/9 fb/ramnv50: Voltage GPIOs
In reply to a message not in the archiveDoes not seem to be necessary for NVA0, hence untested by me.
--- drivers/gpu/drm/nouveau/nvkm/subdev/bios/rammap.c | 1 + drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c | 41 +++++++++++++++++++++++ 2 files changed, 42 insertions(+)
drivers/gpu/drm/nouveau/nvkm/subdev/bios/rammap.c +1 -0
@@ -171,6 +171,7 @@ nvbios_rammapSp_from_perf(struct nvkm_bios *bios, u32 data, u8 size, int idx, p->ramcfg_DLLoff = (nvbios_rd08 (bios, data +0x03 ) &0x04 ) >>2 ; p->ramcfg_00_03_08 = (nvbios_rd08 (bios, data +0x03 ) &0x08 ) >>3 ; p->ramcfg_RON = (nvbios_rd08 (bios, data +0x03 ) &0x10 ) >>3 ; + p->ramcfg_FBVDDQ = (nvbios_rd08 (bios, data +0x03 ) &0x80 ) >>7 ; p->ramcfg_00_04_02 = (nvbios_rd08 (bios, data +0x04 ) &0x02 ) >>1 ; p->ramcfg_00_04_04 = (nvbios_rd08 (bios, data +0x04 ) &0x04 ) >>2 ; p->ramcfg_00_04_20 = (nvbios_rd08 (bios, data +0x04 ) &0x20 ) >>5 ;
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c +41 -0
82 lines not on this page · raw message
Signature · 8 lines
2.4.3 _______________________________________________ Nouveau mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH 6/9 fb/ramnv50: Deal with cards without timing entries
In reply to a message not in the archiveLike Pierre's G94. We might want to structure Kepler similarly in a follow-up.
--- drivers/gpu/drm/nouveau/nvkm/subdev/fb/gddr3.c | 10 +++--- drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c | 41 ++++++++++++++++++++++-- drivers/gpu/drm/nouveau/nvkm/subdev/fb/sddr2.c | 6 ++++ 3 files changed, 50 insertions(+), 7 deletions(-)
drivers/gpu/drm/nouveau/nvkm/subdev/fb/gddr3.c +6 -4
@@ -63,7 +63,7 @@ ramgddr3_wr_lo[] = { { 5, 2 }, { 7, 4 }, { 8, 5 }, { 9, 6 }, { 10, 7 }, { 11, 0 }, { 13 , 1 },/* the below are mentioned in some, but not all, gddr3 docs */ - { 4, 1 }, { 6, 3 }, { 12, 1 }, + { 4, 0 }, { 6, 3 }, { 12, 1 }, { -1 } };
@@ -87,15 +87,17 @@ nvkm_gddr3_calc(struct nvkm_ram *ram)WR = (ram->next->bios.timing[2 ] &0x007f0000 ) >>16 ;/* XXX: Get these values from the VBIOS instead */ DLL = !(ram->mr[1 ] &0x1 ); -ODT = (ram->mr[1 ] &0x004 ) >>2 | - (ram->mr[1 ] &0x040 ) >>5 | - (ram->mr[1 ] &0x200 ) >>7 ;RON = !(ram->mr[1 ] &0x300 ) >>8 ;break ;default :return -ENOSYS ; } +if (ram->next->bios.timing_ver ==0x20 || + ram->next->bios.ramcfg_timing ==0xff ) { +ODT = (ram->mr[1 ] &0xc ) >>2 ; + } + hi = ram->mr[2 ] &0x1 ;CL =ramxlat (hi ? ramgddr3_cl_hi : ramgddr3_cl_lo,CL );WR =ramxlat (ramgddr3_wr_lo,WR );
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c +38 -3
62 lines not on this page · raw message
drivers/gpu/drm/nouveau/nvkm/subdev/fb/sddr2.c +6 -0
@@ -76,6 +76,12 @@ nvkm_sddr2_calc(struct nvkm_ram *ram)return -ENOSYS ; } +if (ram->next->bios.timing_ver ==0x20 || + ram->next->bios.ramcfg_timing ==0xff ) { +ODT = (ram->mr[1 ] &0x004 ) >>2 | + (ram->mr[1 ] &0x040 ) >>5 ; + } +CL =ramxlat (ramddr2_cl,CL );WR =ramxlat (ramddr2_wr,WR );if (CL <0 ||WR <0 )
Signature · 8 lines
2.4.3 _______________________________________________ Nouveau mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH 7/9 fb/ramnv50: Script changes for G94 and up
In reply to a message not in the archive10053c is not even read on some cards, and I have no idea exactly what the criteria are. Likely NVIDIA pre-scans the VBIOS and in their driver disables all features that are never used. The practical effect should be the same as this implementation though.
--- drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c | 36 ++++++++++++++++++++---- 1 file changed, 30 insertions(+), 6 deletions(-)
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c +30 -6
@@ -302,6 +302,9 @@ nv50_ram_calc(struct nvkm_ram *base, u32 freq)return ret; } +if (subdev->device->chipset <=0x96 && !next->bios.ramcfg_00_03_02) +ram_mask (hwsq,0x100710 ,0x00000200 ,0x00000000 ); +/* Always disable this bit during reclock */ ram_mask (hwsq,0x100200 ,0x00000800 ,0x00000000 );
@@ -353,8 +356,11 @@ nv50_ram_calc(struct nvkm_ram *base, u32 freq) next->bios.rammap_00_16_40 << 14);ram_mask (hwsq,0x00400c ,0x0000ffff , (N1 <<8 ) |M1 );ram_mask (hwsq,0x004008 ,0x91ff0000 , r004008); -if (subdev->device->chipset >=0x96 ) + +/* XXX: GDDR3 only? */ +if (subdev->device->chipset >=0x92 )ram_wr32 (hwsq,0x100da0 , r100da0); +nv50_ram_gpio (hwsq,0x18 , !next->bios.ramcfg_FBVDDQ);ram_nsec (hwsq,64000 );/*XXX*/ ram_nsec (hwsq,32000 );/*XXX*/
@@ -397,19 +403,33 @@ nv50_ram_calc(struct nvkm_ram *base, u32 freq)ram_mask (hwsq,0x100200 ,0x00001000 , !next->bios.ramcfg_00_04_02 <<12 );/* XXX: A lot of this could be "chipset"/"ram type" specific stuff */ - unk710 =ram_rd32 (hwsq,0x100710 ) & ~0x00000101 ; + unk710 =ram_rd32 (hwsq,0x100710 ) & ~0x00000100 ; unk714 =ram_rd32 (hwsq,0x100714 ) & ~0xf0000020 ; unk718 =ram_rd32 (hwsq,0x100718 ) & ~0x00000100 ; unk71c =ram_rd32 (hwsq,0x10071c ) & ~0x00000100 ; +if (subdev->device->chipset <=0x96 ) { + unk710 &= ~0x0000006e ; + unk714 &= ~0x00000100 ; + +if (!next->bios.ramcfg_00_03_08) + unk710 |=0x00000060 ; +if (!next->bios.ramcfg_FBVDDQ) + unk714 |=0x00000100 ; +if ( next->bios.ramcfg_00_04_04) + unk710 |=0x0000000e ; + }else { + unk710 &= ~0x00000001 ; + +if (!next->bios.ramcfg_00_03_08) + unk710 |=0x00000001 ; + }if ( next->bios.ramcfg_00_03_01) unk71c |=0x00000100 ;if ( next->bios.ramcfg_00_03_02) unk710 |=0x00000100 ; -if (!next->bios.ramcfg_00_03_08) { - unk710 |=0x1 ; - unk714 |=0x20 ; - } +if (!next->bios.ramcfg_00_03_08) + unk714 |=0x00000020 ;if ( next->bios.ramcfg_00_04_04) unk714 |=0x70000000 ;if ( next->bios.ramcfg_00_04_20)
@@ -420,6 +440,8 @@ nv50_ram_calc(struct nvkm_ram *base, u32 freq)ram_mask (hwsq,0x100718 ,0xffffffff , unk718);ram_mask (hwsq,0x100710 ,0xffffffff , unk710); +/* XXX: G94 does not even test these regs in trace. Harmless we do it, +* but why is it omitted? */ if (next->bios.rammap_00_16_20) { ram_wr32(hwsq, 0x1005a0, next->bios.ramcfg_00_07 << 16 | next->bios.ramcfg_00_06 << 8 |
@@ -450,6 +472,8 @@ nv50_ram_calc(struct nvkm_ram *base, u32 freq)ram_mask (hwsq,0x004008 ,0x00004000 ,0x00000000 );if (next->bios.ramcfg_00_03_02)ram_mask (hwsq,0x10021c ,0x00010000 ,0x00010000 ); +if (subdev->device->chipset <=0x96 && next->bios.ramcfg_00_03_02) +ram_mask (hwsq,0x100710 ,0x00000200 ,0x00000200 );return 0 ; }
Signature · 8 lines
2.4.3 _______________________________________________ Nouveau mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/nouveau
A message that is not in the archive (sent off-list or not yet received): 1443569032-13817-8-git-send-email-rspliet-pPYjZ15w/[email protected]
Re: [PATCH 7/9] fb/ramnv50: Script changes for G94 and up
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Quoted 4 lines · Roy Spliet
10053c is not even read on some cards, and I have no idea exactly what the criteria are. Likely NVIDIA pre-scans the VBIOS and in their driver disables all features that are never used. The practical effect should be the same as this implementation though.
I haven't fully reviewed the series properly yet, but wanted to put my two cents worth in here.
If this works like it does on Kepler, you're going to get bitten here if you don't do this correctly.
NVIDIA scans the full memory configurations for every "rammap" entry (yes, even the ones that can never be referenced by the perf table) and where all values are the same (doesn't matter if they're all on or all off, just that they're the same) in every entry, they don't touch that particular part of the configuration.
Depending on what DEVINIT did, this can leave something either enabled or disabled, you don't know which, you're just supposed to just not touch it.
I tried to ignore this on Kepler initially, but eventually got bitten by it and had to implement it properly (gk104_ram_ctor_data() handles this for the most part).
I'd *strongly* recommend you verify if the behaviour is the same on these boards, and implement it if it is.
Ben.
Quoted 63 lines
Signed-off-by Roy Spliet <[email protected]> Tested-by: PierreMoreau <[email protected]> ---
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c| 36 ++++++++++++++++++++---- 1 file changed, 30 insertions(+), 6 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.cindex 1c6ae6b..651b74a 100644 ---a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c+++b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c@@ -302,6 +302,9 @@nv50_ram_calc(struct nvkm_ram *base, u32 freq)return ret; }(quoted diff) +1
-0+ if (subdev->device->chipset <= 0x96 &&!next->bios.ramcfg_00_03_02) + ram_mask(hwsq,
0x100710,0x00000200,0x00000000); + /* Always disable this bit during reclock */ram_mask(hwsq, 0x100200, 0x00000800, 0x00000000);(quoted diff) +0
-0@@ -353,8 +356,11 @@ nv50_ram_calc(struct nvkm_ram *base, u32 freq) next->bios.rammap_00_16_40 << 14); ram_mask(hwsq, 0x00400c, 0x0000ffff, (N1 << 8) | M1); ram_mask(hwsq, 0x004008, 0x91ff0000,r004008); - if (
subdev->device->chipset>=0x96) + + /* XXX: GDDR3
only? */ + if (subdev->device->chipset>=0x92) ram_wr32(hwsq,0x100da0, r100da0); +nv50_ram_gpio(hwsq, 0x18, !next->bios.ramcfg_FBVDDQ);ram_nsec(hwsq, 64000); /*XXX*/ram_nsec(hwsq, 32000); /*XXX*/ @@ -397,19 +403,33 @@nv50_ram_calc(struct nvkm_ram *base, u32 freq)ram_mask(hwsq, 0x100200, 0x00001000, !next->bios.ramcfg_00_04_02 << 12);/* XXX: A lot of this could be "chipset"/"ram type" specific stuff
*/ - unk710 =ram_rd32(hwsq, 0x100710)& ~0x00000101; + unk710 =ram_rd32(hwsq, 0x100710)& ~0x00000100; unk714 =ram_rd32(hwsq, 0x100714)& ~0xf0000020; unk718 =ram_rd32(hwsq, 0x100718)&
~0x00000100; unk71c =ram_rd32(hwsq, 0x10071c)& ~0x00000100; + if
(subdev->device->chipset<=0x96) { + unk710 &= ~0x0000006e; +
unk714 &= ~0x00000100; + + if (!next->bios.ramcfg_00_03_08) +
unk710 |=0x00000060; + if (!next->bios.ramcfg_FBVDDQ) + unk714
|=0x00000100; + if (next->bios.ramcfg_00_04_04) + unk710 |=0x0000000e; + } else { + unk710 &= ~0x00000001; + + if
(!next->bios.ramcfg_00_03_08) + unk710 |=0x00000001; + }if (
next->bios.ramcfg_00_03_01) unk71c |=0x00000100; if (next->bios.ramcfg_00_03_02) unk710 |=0x00000100; - if
(!next->bios.ramcfg_00_03_08) { - unk710 |=0x1; - unk714 |=0x20; - } + if (!next->bios.ramcfg_00_03_08) + unk714 |=0x00000020; if (next->bios.ramcfg_00_04_04) unk714 |=0x70000000; if (next->bios.ramcfg_00_04_20) @@ -420,6 +440,8 @@nv50_ram_calc(struct nvkm_ram *base, u32 freq)ram_mask(hwsq, 0x100718, 0xffffffff, unk718);ram_mask(hwsq, 0x100710, 0xffffffff, unk710);(quoted diff) +1
-0+ /* XXX: G94 does not even test these regs in trace. Harmless wedo it, + * but why is it omitted? */ if
(next->bios.rammap_00_16_20) { ram_wr32(hwsq,0x1005a0,next->bios.ramcfg_00_07<< 16 |next->bios.ramcfg_00_06<< 8 | @@ -450,6 +472,8 @@nv50_ram_calc(struct nvkm_ram *base, u32 freq)ram_mask(hwsq, 0x004008, 0x00004000, 0x00000000); if (next->bios.ramcfg_00_03_02) ram_mask(hwsq,0x10021c,0x00010000,0x00010000); + if (subdev->device->chipset<=0x96&&next->bios.ramcfg_00_03_02) + ram_mask(hwsq,0x100710,0x00000200,0x00000200);
Quoted 2 lines
return 0; }
_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 7/9] fb/ramnv50: Script changes for G94 and up
Hey Ben,
--- original message ---
From: Ben Skeggs <[email protected]>
Date: 05:05:34 30-09-2015
To: Roy Spliet <[email protected]>, Nouveau Mailinglist <[email protected]>
Subject: Re: [PATCH 7/9] fb/ramnv50: Script changes for G94 and up
Quoted 11 lines
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256Quoted 4 lines · Roy Spliet
10053c is not even read on some cards, and I have no idea exactly what the criteria are. Likely NVIDIA pre-scans the VBIOS and in their driver disables all features that are never used. The practical effect should be the same as this implementation though.
I haven't fully reviewed the series properly yet, but wanted to put my two cents worth in here.
Quoted 6 lines
If this works like it does on Kepler, you're going to get bitten here if you don't do this correctly.
[snip]
Depending on what DEVINIT did, this can leave something either enabled or disabled, you don't know which, you're just supposed to just not touch it.
Yes, this is precisely what I have observed, but thanks for restating. I realise I have been living on the edge by ignoring this for now. Quite honestly though, I haven't come across an example where this would become a problem *yet*. I reckon this is something you could expect a follow-up patch for once I have time for it.
Quoted 7 lines
I tried to ignore this on Kepler initially, but eventually got bitten by it and had to implement it properly (
gk104_ram_ctor_data()handles this for the most part).I'd *strongly* recommend you verify if the behaviour is the same on these boards, and implement it if it is.
Agreed, but given I am probably running out of time quite soon, I do recommend taking the current work upstream as is or suggest minor fixes, and not first wait for this proposed change. That's purely from a practical stance: what I pushed to the ML are improvements. Some people benefit from it and it'd be a shame to let that bit-rot.
Roy.
Quoted 70 lines
Ben.
Quoted 26 lines
Signed-off-by Roy Spliet <[email protected]> Tested-by: PierreMoreau <[email protected]> ---
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c| 36 ++++++++++++++++++++---- 1 file changed, 30 insertions(+), 6 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.cindex 1c6ae6b..651b74a 100644 ---a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c+++b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c@@ -302,6 +302,9@@
nv50_ram_calc(struct nvkm_ram *base, u32 freq)return ret; }(quoted diff) +1
-0+ if (subdev->device->chipset <= 0x96 &&!next->bios.ramcfg_00_03_02) + ram_mask(hwsq,
0x100710,0x00000200,0x00000000); + /* Always disable this bit during reclock */ram_mask(hwsq, 0x100200, 0x00000800, 0x00000000);(quoted diff) +0
-0@@ -353,8 +356,11 @@ nv50_ram_calc(struct nvkm_ram *base, u32 freq) next->bios.rammap_00_16_40 << 14); ram_mask(hwsq, 0x00400c, 0x0000ffff, (N1 << 8) | M1); ram_mask(hwsq, 0x004008, 0x91ff0000,Quoted 1 line
r004008); - if (
subdev->device->chipset>=0x96) + + /* XXX:GDDR3
Quoted 9 lines
only? */ + if (
subdev->device->chipset>=0x92) ram_wr32(hwsq,
0x100da0, r100da0); +nv50_ram_gpio(hwsq, 0x18, !next->bios.ramcfg_FBVDDQ);ram_nsec(hwsq, 64000); /*XXX*/ram_nsec(hwsq, 32000); /*XXX*/ @@ -397,19 +403,33 @@nv50_ram_calc(struct nvkm_ram *base, u32 freq)ram_mask(hwsq, 0x100200, 0x00001000, !next->bios.ramcfg_00_04_02 << 12);/* XXX: A lot of this could be "chipset"/"ram type"
specific stuff
Quoted 1 line
*/ - unk710 =
ram_rd32(hwsq, 0x100710)& ~0x00000101; + unk710=
Quoted 5 lines
ram_rd32(hwsq, 0x100710)& ~0x00000100; unk714 = ram_rd32(hwsq,
0x100714) & ~0xf0000020; unk718 =ram_rd32(hwsq, 0x100718)&~0x00000100; unk71c =
ram_rd32(hwsq, 0x10071c)& ~0x00000100; +if
Quoted 1 line
(
subdev->device->chipset<=0x96) { + unk710 &= ~0x0000006e;+
Quoted 1 line
unk714 &= ~0x00000100; + + if (!next->bios.ramcfg_00_03_08)
+
Quoted 16 lines
unk710 |=
0x00000060; + if (!next->bios.ramcfg_FBVDDQ) + unk714|=
0x00000100; + if (next->bios.ramcfg_00_04_04) + unk710 |=
0x0000000e; + } else { + unk710 &= ~0x00000001; + + if
(!next->bios.ramcfg_00_03_08) + unk710 |=0x00000001; + }if (
next->bios.ramcfg_00_03_01) unk71c |=0x00000100; if (next->bios.ramcfg_00_03_02) unk710 |=0x00000100; - if
(!next->bios.ramcfg_00_03_08) { - unk710 |=0x1; - unk714 |=0x20; - } + if (!next->bios.ramcfg_00_03_08) + unk714 |=0x00000020; if (next->bios.ramcfg_00_04_04) unk714 |=0x70000000;if (
next->bios.ramcfg_00_04_20) @@ -420,6 +440,8 @@nv50_ram_calc(struct nvkm_ram *base, u32 freq)ram_mask(hwsq, 0x100718, 0xffffffff, unk718); ram_mask(hwsq,0x100710,0xffffffff,
Quoted 20 lines
Quoted 6 lines
unk710);
(quoted diff) +1
-0+ /* XXX: G94 does not even test these regs in trace. Harmless wedo it, + * but why is it omitted? */ if
(next->bios.rammap_00_16_20) { ram_wr32(hwsq,0x1005a0,next->bios.ramcfg_00_07<< 16 |next->bios.ramcfg_00_06<< 8 | @@
Quoted 12 lines
-450,6 +472,8 @@
nv50_ram_calc(struct nvkm_ram *base, u32 freq)ram_mask(hwsq, 0x004008, 0x00004000, 0x00000000); if (next->bios.ramcfg_00_03_02) ram_mask(hwsq,0x10021c,0x00010000,
0x00010000); + if (subdev->device->chipset<=0x96&&
next->bios.ramcfg_00_03_02) + ram_mask(hwsq,0x100710,0x00000200,
0x00000200);return 0; }
_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH 8/9 bus/hwsq: Implement VBLANK waiting heuristic
In reply to a message not in the archiveAvoids waiting for VBLANKS that never arrive on headless or otherwise unconventional set-ups. Strategy taken from MEMX.
--- drivers/gpu/drm/nouveau/include/nvkm/subdev/bus.h | 1 + drivers/gpu/drm/nouveau/nvkm/subdev/bus/hwsq.c | 32 +++++++++++++++++++++++ drivers/gpu/drm/nouveau/nvkm/subdev/bus/hwsq.h | 6 +++++ drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c | 3 +-- drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramseq.h | 1 + 5 files changed, 41 insertions(+), 2 deletions(-)
drivers/gpu/drm/nouveau/include/nvkm/subdev/bus.h +1 -0
@@ -14,6 +14,7 @@ int nvkm_hwsq_fini(struct nvkm_hwsq **, bool exec);void nvkm_hwsq_wr32 (struct nvkm_hwsq *,u32 addr,u32 data);void nvkm_hwsq_setf (struct nvkm_hwsq *,u8 flag,int data);void nvkm_hwsq_wait (struct nvkm_hwsq *,u8 flag,u8 data); +void nvkm_hwsq_wait_vblank (struct nvkm_hwsq *);void nvkm_hwsq_nsec (struct nvkm_hwsq *,u32 nsec);int nv04_bus_new (struct nvkm_device *,int ,struct nvkm_bus **);
drivers/gpu/drm/nouveau/nvkm/subdev/bus/hwsq.c +32 -0
@@ -132,6 +132,38 @@ nvkm_hwsq_wait(struct nvkm_hwsq *hwsq, u8 flag, u8 data) }void +nvkm_hwsq_wait_vblank (struct nvkm_hwsq *hwsq) +{ +struct nvkm_subdev *subdev = hwsq->subdev; +struct nvkm_device *device = subdev->device; +u32 heads, x, y, px =0 ; +int i, head_sync; + + heads =nvkm_rd32 (device,0x610050 ); +for (i =0 ; i <2 ; i++) { +/* Heuristic: sync to head with biggest resolution */ +if (heads & (2 << (i <<3 ))) { + x =nvkm_rd32 (device,0x610b40 + (0x540 * i)); + y = (x &0xffff0000 ) >>16 ; + x &=0x0000ffff ; +if ((x * y) > px) { + px = (x * y); + head_sync = i; + } + } + } + +if (px ==0 ) { +nvkm_debug (subdev,"WAIT VBLANK !NO ACTIVE HEAD\n" ); +return ; + } + +nvkm_debug (subdev,"WAIT VBLANK HEAD%d\n" , head_sync); +nvkm_hwsq_wait (hwsq, head_sync ?0x3 :0x1 ,0x0 ); +nvkm_hwsq_wait (hwsq, head_sync ?0x3 :0x1 ,0x1 ); +} + +void nvkm_hwsq_nsec (struct nvkm_hwsq *hwsq,u32 nsec) {u8 shift =0 , usec = nsec /1000 ;
drivers/gpu/drm/nouveau/nvkm/subdev/bus/hwsq.h +6 -0
@@ -134,6 +134,12 @@ hwsq_wait(struct hwsq *ram, u8 flag, u8 data) }static inline void +hwsq_wait_vblank (struct hwsq *ram) +{ +nvkm_hwsq_wait_vblank (ram->hwsq); +} + +static inline void hwsq_nsec (struct hwsq *ram,u32 nsec) {nvkm_hwsq_nsec (ram->hwsq, nsec);
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramnv50.c +1 -2
@@ -308,8 +308,7 @@ nv50_ram_calc(struct nvkm_ram *base, u32 freq)/* Always disable this bit during reclock */ ram_mask (hwsq,0x100200 ,0x00000800 ,0x00000000 ); -ram_wait (hwsq,0x01 ,0x00 );/* wait for !vblank */ -ram_wait (hwsq,0x01 ,0x01 );/* wait for vblank */ +ram_wait_vblank (hwsq);ram_wr32 (hwsq,0x611200 ,0x00003300 );ram_wr32 (hwsq,0x002504 ,0x00000001 );/* block fifo */ ram_nsec (hwsq,8000 );
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramseq.h +1 -0
@@ -11,5 +11,6 @@#define ram_mask (s,r,m,d) hwsq_mask(&(s)->base, &(s)->r_##r, (m), (d))#define ram_setf (s,f,d) hwsq_setf(&(s)->base, (f), (d))#define ram_wait (s,f,d) hwsq_wait(&(s)->base, (f), (d)) +#define ram_wait_vblank (s) hwsq_wait_vblank(&(s)->base)#define ram_nsec (s,n) hwsq_nsec(&(s)->base, (n))#endif
Signature · 8 lines
2.4.3 _______________________________________________ Nouveau mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/nouveau
PATCH 9/9 clk/g84: Enable reclocking for GDDR3 G94-G200
In reply to a message not in the archiveYour milage may vary, as it's only been tested on a single G94 and one G96.
--- drivers/gpu/drm/nouveau/nvkm/subdev/clk/g84.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/subdev/clk/g84.c +1 -1
@@ -44,5 +44,5 @@ int g84_clk_new(struct nvkm_device *device, int index, struct nvkm_clk **pclk) { return nv50_clk_new_(&g84_clk, device, index, - (device->chipset == 0xa0), pclk); + (device->chipset >= 0x94), pclk); }
Signature · 8 lines
2.4.3 _______________________________________________ Nouveau mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/nouveau