Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd/pm: allocate a new buffer for pstate dummy reading

This dummy reading buffer will be used for the new Navi1x
UMC CDR workaround.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Evan Quan and committed by
Alex Deucher
2379be2f 3646c00e

+46
+1
drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h
··· 270 270 */ 271 271 struct smu_table driver_table; 272 272 struct smu_table memory_pool; 273 + struct smu_table dummy_read_1_table; 273 274 uint8_t thermal_controller_type; 274 275 275 276 void *overdrive_table;
+45
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
··· 663 663 return 0; 664 664 } 665 665 666 + static int smu_alloc_dummy_read_table(struct smu_context *smu) 667 + { 668 + struct smu_table_context *smu_table = &smu->smu_table; 669 + struct smu_table *dummy_read_1_table = 670 + &smu_table->dummy_read_1_table; 671 + struct amdgpu_device *adev = smu->adev; 672 + int ret = 0; 673 + 674 + dummy_read_1_table->size = 0x40000; 675 + dummy_read_1_table->align = PAGE_SIZE; 676 + dummy_read_1_table->domain = AMDGPU_GEM_DOMAIN_VRAM; 677 + 678 + ret = amdgpu_bo_create_kernel(adev, 679 + dummy_read_1_table->size, 680 + dummy_read_1_table->align, 681 + dummy_read_1_table->domain, 682 + &dummy_read_1_table->bo, 683 + &dummy_read_1_table->mc_address, 684 + &dummy_read_1_table->cpu_addr); 685 + if (ret) 686 + dev_err(adev->dev, "VRAM allocation for dummy read table failed!\n"); 687 + 688 + return ret; 689 + } 690 + 691 + static void smu_free_dummy_read_table(struct smu_context *smu) 692 + { 693 + struct smu_table_context *smu_table = &smu->smu_table; 694 + struct smu_table *dummy_read_1_table = 695 + &smu_table->dummy_read_1_table; 696 + 697 + 698 + amdgpu_bo_free_kernel(&dummy_read_1_table->bo, 699 + &dummy_read_1_table->mc_address, 700 + &dummy_read_1_table->cpu_addr); 701 + 702 + memset(dummy_read_1_table, 0, sizeof(struct smu_table)); 703 + } 704 + 666 705 static int smu_smc_table_sw_init(struct smu_context *smu) 667 706 { 668 707 int ret; ··· 737 698 if (ret) 738 699 return ret; 739 700 701 + ret = smu_alloc_dummy_read_table(smu); 702 + if (ret) 703 + return ret; 704 + 740 705 ret = smu_i2c_init(smu, &smu->adev->pm.smu_i2c); 741 706 if (ret) 742 707 return ret; ··· 753 710 int ret; 754 711 755 712 smu_i2c_fini(smu, &smu->adev->pm.smu_i2c); 713 + 714 + smu_free_dummy_read_table(smu); 756 715 757 716 ret = smu_free_memory_pool(smu); 758 717 if (ret)