File drivers/gpu/alga/amd/si/drv.c changed (mode: 100644) (index d6f8f55..362b714) |
... |
... |
static long asic_init(struct pci_dev *dev) |
324 |
324 |
/* CFG_MEM_SZ is now valid */ |
/* CFG_MEM_SZ is now valid */ |
325 |
325 |
dev_info(&dev->dev, "vram size is %uMB\n", rr32(dev, CFG_MEM_SZ)); |
dev_info(&dev->dev, "vram size is %uMB\n", rr32(dev, CFG_MEM_SZ)); |
326 |
326 |
|
|
|
327 |
|
r = dyn_pm_ena(dev); |
|
328 |
|
if (r == -SI_ERR) |
|
329 |
|
goto err; |
|
330 |
|
|
327 |
331 |
/* claim back the 256k vga memory at vram beginning */ |
/* claim back the 256k vga memory at vram beginning */ |
328 |
332 |
dce6_vga_off(dd->dce); |
dce6_vga_off(dd->dce); |
329 |
333 |
|
|
|
... |
... |
static long asic_init(struct pci_dev *dev) |
335 |
339 |
/* quiet the memory requests before mc programming: dce then gpu */ |
/* quiet the memory requests before mc programming: dce then gpu */ |
336 |
340 |
r = dce6_crtcs_shutdown(dd->dce); |
r = dce6_crtcs_shutdown(dd->dce); |
337 |
341 |
if (r == -DCE6_ERR) |
if (r == -DCE6_ERR) |
338 |
|
goto err; |
|
|
342 |
|
goto err_disable_dyn_pm; |
339 |
343 |
|
|
340 |
344 |
bif_mc_mem_reqs_dis(dev); |
bif_mc_mem_reqs_dis(dev); |
341 |
345 |
udelay(100); |
udelay(100); |
342 |
346 |
|
|
343 |
347 |
if (mc_wait_for_idle(dev)) { |
if (mc_wait_for_idle(dev)) { |
344 |
348 |
dev_warn(&dev->dev, "wait for mc idle timed out\n"); |
dev_warn(&dev->dev, "wait for mc idle timed out\n"); |
345 |
|
goto err; |
|
|
349 |
|
goto err_disable_dyn_pm; |
346 |
350 |
} |
} |
347 |
351 |
/*--------------------------------------------------------------------*/ |
/*--------------------------------------------------------------------*/ |
348 |
352 |
|
|
|
... |
... |
static long asic_init(struct pci_dev *dev) |
363 |
367 |
GPU_PAGE_SZ, GPU_PAGE_SZ); |
GPU_PAGE_SZ, GPU_PAGE_SZ); |
364 |
368 |
if (r == -ALGA_ERR) { |
if (r == -ALGA_ERR) { |
365 |
369 |
dev_err(&dev->dev, "unable to alloc GPU scratch page\n"); |
dev_err(&dev->dev, "unable to alloc GPU scratch page\n"); |
366 |
|
goto err; |
|
|
370 |
|
goto err_disable_dyn_pm; |
367 |
371 |
} |
} |
368 |
372 |
|
|
369 |
373 |
bif_mc_mem_reqs_ena(dev); |
bif_mc_mem_reqs_ena(dev); |
|
... |
... |
static long asic_init(struct pci_dev *dev) |
426 |
430 |
r = dce6_init(dd->dce, dd->addr_cfg); |
r = dce6_init(dd->dce, dd->addr_cfg); |
427 |
431 |
if (r == -DCE6_ERR) |
if (r == -DCE6_ERR) |
428 |
432 |
goto err_stop_dmas; |
goto err_stop_dmas; |
429 |
|
|
|
430 |
|
r = dyn_pm_ena(dev); |
|
431 |
|
if (r == -SI_ERR) |
|
432 |
|
goto err_stop_dmas; |
|
433 |
433 |
return 0; |
return 0; |
434 |
434 |
|
|
435 |
435 |
err_stop_dmas: |
err_stop_dmas: |
|
... |
... |
err_ba_shutdown: |
458 |
458 |
err_free_scratch_page: |
err_free_scratch_page: |
459 |
459 |
rng_free(&dd->vram.mng, dd->vram.scratch_page); |
rng_free(&dd->vram.mng, dd->vram.scratch_page); |
460 |
460 |
|
|
|
461 |
|
err_disable_dyn_pm: |
|
462 |
|
|
461 |
463 |
err: |
err: |
462 |
464 |
return -SI_ERR; |
return -SI_ERR; |
463 |
465 |
} |
} |
File drivers/gpu/alga/amd/si/dyn_pm/ctx.c changed (mode: 100644) (index ff2211c..d562828) |
... |
... |
static void atb_pp_state_dump(struct atb_pp_state *s, char *name) |
48 |
48 |
|
|
49 |
49 |
lvl = &s->lvls[lvl_idx]; |
lvl = &s->lvls[lvl_idx]; |
50 |
50 |
if (IS_VDDC_LKGE_IDX(lvl->vddc_id)) { |
if (IS_VDDC_LKGE_IDX(lvl->vddc_id)) { |
51 |
|
LOG("atb_pp_%s_lvl[%u]:vddc=0x%04x(leakage index) engine clock=%ukHz memory clock=%ukHz", |
|
|
51 |
|
LOG("atb_pp_%s_lvl[%u]:vddc=0x%04x(leakage index) engine clock=%ukHz memory clock=%ukHz pcie generation=%u", |
52 |
52 |
name, lvl_idx, lvl->vddc_id, lvl->eng_clk * 10, |
name, lvl_idx, lvl->vddc_id, lvl->eng_clk * 10, |
53 |
|
lvl->mem_clk * 10); |
|
|
53 |
|
lvl->mem_clk * 10, lvl->pcie_gen + 1); |
54 |
54 |
} else { |
} else { |
55 |
|
LOG("atb_pp_%s_lvl[%u]:vddc=%umV engine clock=%ukHz memory clock=%ukHz", |
|
|
55 |
|
LOG("atb_pp_%s_lvl[%u]:vddc=%umV engine clock=%ukHz memory clock=%ukHz pcie generation=%u", |
56 |
56 |
name, lvl_idx, lvl->vddc_id, lvl->eng_clk * 10, |
name, lvl_idx, lvl->vddc_id, lvl->eng_clk * 10, |
57 |
|
lvl->mem_clk * 10); |
|
|
57 |
|
lvl->mem_clk * 10, lvl->pcie_gen + 1); |
58 |
58 |
} |
} |
59 |
59 |
} |
} |
60 |
60 |
} |
} |
|
... |
... |
long ctx_init(struct pci_dev *dev, struct ctx *ctx) |
482 |
482 |
|
|
483 |
483 |
ctx->cus_n_max = cus_n_max_compute(ctx); |
ctx->cus_n_max = cus_n_max_compute(ctx); |
484 |
484 |
|
|
485 |
|
ctx->pcie_lanes_n = bif_pcie_lanes_n_get(ctx->dev); |
|
|
485 |
|
ctx->default_pcie_lanes_n = bif_pcie_lanes_n_get(ctx->dev); |
486 |
486 |
|
|
487 |
487 |
r = bif_pcie_root_speeds_get(ctx->dev, &ctx->pcie_root_speeds_mask); |
r = bif_pcie_root_speeds_get(ctx->dev, &ctx->pcie_root_speeds_mask); |
488 |
488 |
if (r == -SI_ERR) |
if (r == -SI_ERR) |
File drivers/gpu/alga/amd/si/dyn_pm/driver.c changed (mode: 100644) (index 26157f0..f9e585d) |
... |
... |
long driver_set_performance(struct ctx *ctx) |
575 |
575 |
goto err; |
goto err; |
576 |
576 |
} |
} |
577 |
577 |
|
|
|
578 |
|
//TODO: forgot the restrict level smc messages |
|
579 |
|
//TODO: may have to set the best pcie gen here |
|
580 |
|
|
578 |
581 |
LOG("smc:switching off the thermal design power clamping"); |
LOG("smc:switching off the thermal design power clamping"); |
579 |
582 |
r = smc_msg(ctx->dev, SMC_TDP_CLAMPING_OFF); |
r = smc_msg(ctx->dev, SMC_TDP_CLAMPING_OFF); |
580 |
583 |
if (r == -SI_ERR) { |
if (r == -SI_ERR) { |
File drivers/gpu/alga/amd/si/dyn_pm/dyn_pm.c changed (mode: 100644) (index 76cd04a..673d0f4) |
... |
... |
long dyn_pm_ena(struct pci_dev *dev) |
863 |
863 |
if (r == -SI_ERR) |
if (r == -SI_ERR) |
864 |
864 |
goto err_free_ctx; |
goto err_free_ctx; |
865 |
865 |
|
|
866 |
|
LOG("disabling clock gating"); |
|
867 |
|
cg_dis(dev); |
|
868 |
|
|
|
869 |
866 |
pre_init(dev); |
pre_init(dev); |
870 |
867 |
|
|
871 |
868 |
r = init(ctx); |
r = init(ctx); |
|
... |
... |
long dyn_pm_ena(struct pci_dev *dev) |
884 |
881 |
|
|
885 |
882 |
ctx_free(ctx); |
ctx_free(ctx); |
886 |
883 |
|
|
887 |
|
LOG("re-enabling clock gating"); |
|
888 |
|
cg_ena(dev); |
|
889 |
|
|
|
890 |
884 |
LOG("switching off the universal video decoder (because mpeg)"); |
LOG("switching off the universal video decoder (because mpeg)"); |
891 |
885 |
r = smc_msg(ctx->dev, SMC_MSG_UVD_PWR_OFF); |
r = smc_msg(ctx->dev, SMC_MSG_UVD_PWR_OFF); |
892 |
886 |
if (r == -SI_ERR) |
if (r == -SI_ERR) |
File drivers/gpu/alga/amd/si/dyn_pm/ulv.c changed (mode: 100644) (index 3b28c39..ff96b5c) |
... |
... |
void smc_sw_regs_ulv_init(struct ctx *ctx) |
84 |
84 |
|
|
85 |
85 |
smc_sw_wr32(ctx->dev, ULV_VOLT_CHANGE_DELAY_DEFAULT, |
smc_sw_wr32(ctx->dev, ULV_VOLT_CHANGE_DELAY_DEFAULT, |
86 |
86 |
SMC_SW_ULV_VOLT_CHANGE_DELAY); |
SMC_SW_ULV_VOLT_CHANGE_DELAY); |
87 |
|
smc_sw_wr32(ctx->dev, ctx->pcie_lanes_n, |
|
|
87 |
|
/* actually the driver and probably the emergency state */ |
|
88 |
|
smc_sw_wr32(ctx->dev, ctx->default_pcie_lanes_n, |
88 |
89 |
SMC_SW_NON_ULV_PCIE_LINK_WIDTH); |
SMC_SW_NON_ULV_PCIE_LINK_WIDTH); |
89 |
90 |
} |
} |
90 |
91 |
|
|