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: Move validation of reserve region info

Keep validation of reserved regions also as part of filling details. If
the information is invalid, size is kept as 0 so that it's not
considered for reservation.

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
6845355a 7b0af160

+14 -16
+14 -16
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
··· 1748 1748 1749 1749 static void amdgpu_ttm_init_vram_resv_regions(struct amdgpu_device *adev) 1750 1750 { 1751 + uint64_t vram_size = adev->gmc.visible_vram_size; 1752 + 1751 1753 /* Initialize memory reservations as required for VGA. 1752 1754 * This is used for VGA emulation and pre-OS scanout buffers to 1753 1755 * avoid display artifacts while transitioning between pre-OS ··· 1758 1756 amdgpu_gmc_init_vga_resv_regions(adev); 1759 1757 amdgpu_ttm_init_fw_resv_region(adev); 1760 1758 amdgpu_ttm_init_mem_train_resv_region(adev); 1759 + 1760 + if (adev->mman.resv_region[AMDGPU_RESV_FW_VRAM_USAGE].size > vram_size) 1761 + adev->mman.resv_region[AMDGPU_RESV_FW_VRAM_USAGE].size = 0; 1762 + 1763 + if (adev->mman.resv_region[AMDGPU_RESV_DRV_VRAM_USAGE].size > vram_size) 1764 + adev->mman.resv_region[AMDGPU_RESV_DRV_VRAM_USAGE].size = 0; 1761 1765 } 1762 1766 1763 1767 int amdgpu_ttm_mark_vram_reserved(struct amdgpu_device *adev, ··· 2130 2122 *The reserved vram for firmware must be pinned to the specified 2131 2123 *place on the VRAM, so reserve it early. 2132 2124 */ 2133 - if (adev->mman.resv_region[AMDGPU_RESV_FW_VRAM_USAGE].size > 2134 - adev->gmc.visible_vram_size) { 2135 - adev->mman.resv_region[AMDGPU_RESV_FW_VRAM_USAGE].size = 0; 2136 - } else { 2137 - r = amdgpu_ttm_mark_vram_reserved(adev, AMDGPU_RESV_FW_VRAM_USAGE); 2138 - if (r) 2139 - return r; 2140 - } 2125 + r = amdgpu_ttm_mark_vram_reserved(adev, AMDGPU_RESV_FW_VRAM_USAGE); 2126 + if (r) 2127 + return r; 2141 2128 2142 2129 /* 2143 2130 * The reserved VRAM for the driver must be pinned to a specific 2144 2131 * location in VRAM, so reserve it early. 2145 2132 */ 2146 - if (adev->mman.resv_region[AMDGPU_RESV_DRV_VRAM_USAGE].size > 2147 - adev->gmc.visible_vram_size) { 2148 - adev->mman.resv_region[AMDGPU_RESV_DRV_VRAM_USAGE].size = 0; 2149 - } else { 2150 - r = amdgpu_ttm_mark_vram_reserved(adev, AMDGPU_RESV_DRV_VRAM_USAGE); 2151 - if (r) 2152 - return r; 2153 - } 2133 + r = amdgpu_ttm_mark_vram_reserved(adev, AMDGPU_RESV_DRV_VRAM_USAGE); 2134 + if (r) 2135 + return r; 2154 2136 2155 2137 /* 2156 2138 * only NAVI10 and later ASICs support IP discovery.