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

Configure Feed

Select the types of activity you want to include in your feed.

drm/amdgpu: Add function to fill fw reserve region

Add a function to fill in details for firmware reserve region.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Lijo Lazar and committed by
Alex Deucher
2c7b0e37 5dad4394

+41 -29
+41 -29
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
··· 1687 1687 resv->needs_cpu_map = needs_cpu_map; 1688 1688 } 1689 1689 1690 + static void amdgpu_ttm_init_fw_resv_region(struct amdgpu_device *adev) 1691 + { 1692 + uint32_t reserve_size = 0; 1693 + 1694 + if (!adev->discovery.reserve_tmr) 1695 + return; 1696 + 1697 + /* 1698 + * Query reserved tmr size through atom firmwareinfo for Sienna_Cichlid and onwards for all 1699 + * the use cases (IP discovery/G6 memory training/profiling/diagnostic data.etc) 1700 + * 1701 + * Otherwise, fallback to legacy approach to check and reserve tmr block for ip 1702 + * discovery data and G6 memory training data respectively 1703 + */ 1704 + if (adev->bios) 1705 + reserve_size = 1706 + amdgpu_atomfirmware_get_fw_reserved_fb_size(adev); 1707 + 1708 + if (!adev->bios && 1709 + (amdgpu_ip_version(adev, GC_HWIP, 0) == IP_VERSION(9, 4, 3) || 1710 + amdgpu_ip_version(adev, GC_HWIP, 0) == IP_VERSION(9, 4, 4) || 1711 + amdgpu_ip_version(adev, GC_HWIP, 0) == IP_VERSION(9, 5, 0))) 1712 + reserve_size = max(reserve_size, (uint32_t)280 << 20); 1713 + else if (!adev->bios && 1714 + amdgpu_ip_version(adev, GC_HWIP, 0) == IP_VERSION(12, 1, 0)) { 1715 + if (hweight32(adev->aid_mask) == 1) 1716 + reserve_size = max(reserve_size, (uint32_t)128 << 20); 1717 + else 1718 + reserve_size = max(reserve_size, (uint32_t)144 << 20); 1719 + } else if (!reserve_size) 1720 + reserve_size = DISCOVERY_TMR_OFFSET; 1721 + 1722 + amdgpu_ttm_init_vram_resv(adev, AMDGPU_RESV_FW, 1723 + adev->gmc.real_vram_size - reserve_size, 1724 + reserve_size, false); 1725 + } 1726 + 1690 1727 static void amdgpu_ttm_init_vram_resv_regions(struct amdgpu_device *adev) 1691 1728 { 1692 1729 /* Initialize memory reservations as required for VGA. ··· 1732 1695 * and driver. 1733 1696 */ 1734 1697 amdgpu_gmc_init_vga_resv_regions(adev); 1698 + amdgpu_ttm_init_fw_resv_region(adev); 1735 1699 } 1736 1700 1737 1701 int amdgpu_ttm_mark_vram_reserved(struct amdgpu_device *adev, ··· 1826 1788 { 1827 1789 struct psp_memory_training_context *ctx = &adev->psp.mem_train_ctx; 1828 1790 bool mem_train_support = false; 1829 - uint32_t reserve_size = 0; 1791 + uint32_t reserve_size; 1830 1792 int ret; 1793 + 1794 + reserve_size = adev->mman.resv_region[AMDGPU_RESV_FW].size; 1831 1795 1832 1796 if (adev->bios && !amdgpu_sriov_vf(adev)) { 1833 1797 if (amdgpu_atomfirmware_mem_training_supported(adev)) ··· 1837 1797 else 1838 1798 DRM_DEBUG("memory training does not support!\n"); 1839 1799 } 1840 - 1841 - /* 1842 - * Query reserved tmr size through atom firmwareinfo for Sienna_Cichlid and onwards for all 1843 - * the use cases (IP discovery/G6 memory training/profiling/diagnostic data.etc) 1844 - * 1845 - * Otherwise, fallback to legacy approach to check and reserve tmr block for ip 1846 - * discovery data and G6 memory training data respectively 1847 - */ 1848 - if (adev->bios) 1849 - reserve_size = 1850 - amdgpu_atomfirmware_get_fw_reserved_fb_size(adev); 1851 - 1852 - if (!adev->bios && 1853 - (amdgpu_ip_version(adev, GC_HWIP, 0) == IP_VERSION(9, 4, 3) || 1854 - amdgpu_ip_version(adev, GC_HWIP, 0) == IP_VERSION(9, 4, 4) || 1855 - amdgpu_ip_version(adev, GC_HWIP, 0) == IP_VERSION(9, 5, 0))) 1856 - reserve_size = max(reserve_size, (uint32_t)280 << 20); 1857 - else if (!adev->bios && 1858 - amdgpu_ip_version(adev, GC_HWIP, 0) == IP_VERSION(12, 1, 0)) { 1859 - if (hweight32(adev->aid_mask) == 1) 1860 - reserve_size = max(reserve_size, (uint32_t)128 << 20); 1861 - else 1862 - reserve_size = max(reserve_size, (uint32_t)144 << 20); 1863 - } else if (!reserve_size) 1864 - reserve_size = DISCOVERY_TMR_OFFSET; 1865 1800 1866 1801 if (mem_train_support) { 1867 1802 /* reserve vram for mem train according to TMR location */ ··· 1852 1837 ctx->init = PSP_MEM_TRAIN_RESERVE_SUCCESS; 1853 1838 } 1854 1839 1855 - amdgpu_ttm_init_vram_resv(adev, AMDGPU_RESV_FW, 1856 - adev->gmc.real_vram_size - reserve_size, 1857 - reserve_size, false); 1858 1840 ret = amdgpu_ttm_mark_vram_reserved(adev, AMDGPU_RESV_FW); 1859 1841 if (ret) { 1860 1842 dev_err(adev->dev, "alloc tmr failed(%d)!\n", ret);