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

Merge tag 'amd-drm-fixes-6.10-2024-05-30' of https://gitlab.freedesktop.org/agd5f/linux into drm-fixes

amd-drm-fixes-6.10-2024-05-30:

amdgpu:
- RAS fix
- Fix colorspace property for MST connectors
- Fix for PCIe DPM
- Silence UBSAN warning
- GPUVM robustness fix
- Partition fix
- Drop deprecated I2C_CLASS_SPD

amdkfd:
- Revert unused changes for certain 11.0.3 devices
- Simplify APU VRAM handling

Signed-off-by: Dave Airlie <airlied@redhat.com>

From: Alex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240530202316.2246826-1-alexander.deucher@amd.com

+36 -35
+8 -8
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
··· 196 196 return -EINVAL; 197 197 198 198 vram_size = KFD_XCP_MEMORY_SIZE(adev, xcp_id); 199 - if (adev->gmc.is_app_apu || adev->flags & AMD_IS_APU) { 199 + if (adev->flags & AMD_IS_APU) { 200 200 system_mem_needed = size; 201 201 ttm_mem_needed = size; 202 202 } ··· 233 233 if (adev && xcp_id >= 0) { 234 234 adev->kfd.vram_used[xcp_id] += vram_needed; 235 235 adev->kfd.vram_used_aligned[xcp_id] += 236 - (adev->gmc.is_app_apu || adev->flags & AMD_IS_APU) ? 236 + (adev->flags & AMD_IS_APU) ? 237 237 vram_needed : 238 238 ALIGN(vram_needed, VRAM_AVAILABLITY_ALIGN); 239 239 } ··· 261 261 262 262 if (adev) { 263 263 adev->kfd.vram_used[xcp_id] -= size; 264 - if (adev->gmc.is_app_apu || adev->flags & AMD_IS_APU) { 264 + if (adev->flags & AMD_IS_APU) { 265 265 adev->kfd.vram_used_aligned[xcp_id] -= size; 266 266 kfd_mem_limit.system_mem_used -= size; 267 267 kfd_mem_limit.ttm_mem_used -= size; ··· 890 890 * if peer device has large BAR. In contrast, access over xGMI is 891 891 * allowed for both small and large BAR configurations of peer device 892 892 */ 893 - if ((adev != bo_adev && !(adev->gmc.is_app_apu || adev->flags & AMD_IS_APU)) && 893 + if ((adev != bo_adev && !(adev->flags & AMD_IS_APU)) && 894 894 ((mem->domain == AMDGPU_GEM_DOMAIN_VRAM) || 895 895 (mem->alloc_flags & KFD_IOC_ALLOC_MEM_FLAGS_DOORBELL) || 896 896 (mem->alloc_flags & KFD_IOC_ALLOC_MEM_FLAGS_MMIO_REMAP))) { ··· 1658 1658 - atomic64_read(&adev->vram_pin_size) 1659 1659 - reserved_for_pt; 1660 1660 1661 - if (adev->gmc.is_app_apu || adev->flags & AMD_IS_APU) { 1661 + if (adev->flags & AMD_IS_APU) { 1662 1662 system_mem_available = no_system_mem_limit ? 1663 1663 kfd_mem_limit.max_system_mem_limit : 1664 1664 kfd_mem_limit.max_system_mem_limit - ··· 1706 1706 if (flags & KFD_IOC_ALLOC_MEM_FLAGS_VRAM) { 1707 1707 domain = alloc_domain = AMDGPU_GEM_DOMAIN_VRAM; 1708 1708 1709 - if (adev->gmc.is_app_apu || adev->flags & AMD_IS_APU) { 1709 + if (adev->flags & AMD_IS_APU) { 1710 1710 domain = AMDGPU_GEM_DOMAIN_GTT; 1711 1711 alloc_domain = AMDGPU_GEM_DOMAIN_GTT; 1712 1712 alloc_flags = 0; ··· 1953 1953 if (size) { 1954 1954 if (!is_imported && 1955 1955 (mem->bo->preferred_domains == AMDGPU_GEM_DOMAIN_VRAM || 1956 - ((adev->gmc.is_app_apu || adev->flags & AMD_IS_APU) && 1956 + ((adev->flags & AMD_IS_APU) && 1957 1957 mem->bo->preferred_domains == AMDGPU_GEM_DOMAIN_GTT))) 1958 1958 *size = bo_size; 1959 1959 else ··· 2376 2376 (*mem)->bo = bo; 2377 2377 (*mem)->va = va; 2378 2378 (*mem)->domain = (bo->preferred_domains & AMDGPU_GEM_DOMAIN_VRAM) && 2379 - !(adev->gmc.is_app_apu || adev->flags & AMD_IS_APU) ? 2379 + !(adev->flags & AMD_IS_APU) ? 2380 2380 AMDGPU_GEM_DOMAIN_VRAM : AMDGPU_GEM_DOMAIN_GTT; 2381 2381 2382 2382 (*mem)->mapped_to_gpu_memory = 0;
+12 -7
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
··· 5944 5944 *speed = PCI_SPEED_UNKNOWN; 5945 5945 *width = PCIE_LNK_WIDTH_UNKNOWN; 5946 5946 5947 - while ((parent = pci_upstream_bridge(parent))) { 5948 - /* skip upstream/downstream switches internal to dGPU*/ 5949 - if (parent->vendor == PCI_VENDOR_ID_ATI) 5950 - continue; 5951 - *speed = pcie_get_speed_cap(parent); 5952 - *width = pcie_get_width_cap(parent); 5953 - break; 5947 + if (amdgpu_device_pcie_dynamic_switching_supported(adev)) { 5948 + while ((parent = pci_upstream_bridge(parent))) { 5949 + /* skip upstream/downstream switches internal to dGPU*/ 5950 + if (parent->vendor == PCI_VENDOR_ID_ATI) 5951 + continue; 5952 + *speed = pcie_get_speed_cap(parent); 5953 + *width = pcie_get_width_cap(parent); 5954 + break; 5955 + } 5956 + } else { 5957 + /* use the current speeds rather than max if switching is not supported */ 5958 + pcie_bandwidth_available(adev->pdev, NULL, speed, width); 5954 5959 } 5955 5960 } 5956 5961
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
··· 46 46 #define AMDGPU_RAS_GPU_ERR_HBM_BIST_TEST(x) AMDGPU_GET_REG_FIELD(x, 7, 7) 47 47 #define AMDGPU_RAS_GPU_ERR_SOCKET_ID(x) AMDGPU_GET_REG_FIELD(x, 10, 8) 48 48 #define AMDGPU_RAS_GPU_ERR_AID_ID(x) AMDGPU_GET_REG_FIELD(x, 12, 11) 49 - #define AMDGPU_RAS_GPU_ERR_HBM_ID(x) AMDGPU_GET_REG_FIELD(x, 13, 13) 49 + #define AMDGPU_RAS_GPU_ERR_HBM_ID(x) AMDGPU_GET_REG_FIELD(x, 14, 13) 50 50 #define AMDGPU_RAS_GPU_ERR_BOOT_STATUS(x) AMDGPU_GET_REG_FIELD(x, 31, 31) 51 51 52 52 #define AMDGPU_RAS_BOOT_STATUS_POLLING_LIMIT 1000
+5 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c
··· 706 706 struct amdgpu_vm_bo_base *entry) 707 707 { 708 708 struct amdgpu_vm_bo_base *parent = amdgpu_vm_pt_parent(entry); 709 - struct amdgpu_bo *bo = parent->bo, *pbo; 709 + struct amdgpu_bo *bo, *pbo; 710 710 struct amdgpu_vm *vm = params->vm; 711 711 uint64_t pde, pt, flags; 712 712 unsigned int level; 713 713 714 + if (WARN_ON(!parent)) 715 + return -EINVAL; 716 + 717 + bo = parent->bo; 714 718 for (level = 0, pbo = bo->parent; pbo; ++level) 715 719 pbo = pbo->parent; 716 720
+1 -1
drivers/gpu/drm/amd/amdgpu/aqua_vanjaram.c
··· 422 422 423 423 if (adev->gmc.num_mem_partitions == num_xcc / 2) 424 424 return (adev->flags & AMD_IS_APU) ? AMDGPU_TPX_PARTITION_MODE : 425 - AMDGPU_QPX_PARTITION_MODE; 425 + AMDGPU_CPX_PARTITION_MODE; 426 426 427 427 if (adev->gmc.num_mem_partitions == 2 && !(adev->flags & AMD_IS_APU)) 428 428 return AMDGPU_DPX_PARTITION_MODE;
+2 -9
drivers/gpu/drm/amd/amdkfd/kfd_device.c
··· 408 408 f2g = &gfx_v11_kfd2kgd; 409 409 break; 410 410 case IP_VERSION(11, 0, 3): 411 - if ((adev->pdev->device == 0x7460 && 412 - adev->pdev->revision == 0x00) || 413 - (adev->pdev->device == 0x7461 && 414 - adev->pdev->revision == 0x00)) 415 - /* Note: Compiler version is 11.0.5 while HW version is 11.0.3 */ 416 - gfx_target_version = 110005; 417 - else 418 - /* Note: Compiler version is 11.0.1 while HW version is 11.0.3 */ 419 - gfx_target_version = 110001; 411 + /* Note: Compiler version is 11.0.1 while HW version is 11.0.3 */ 412 + gfx_target_version = 110001; 420 413 f2g = &gfx_v11_kfd2kgd; 421 414 break; 422 415 case IP_VERSION(11, 5, 0):
+1 -1
drivers/gpu/drm/amd/amdkfd/kfd_migrate.c
··· 1023 1023 if (amdgpu_ip_version(adev, GC_HWIP, 0) < IP_VERSION(9, 0, 1)) 1024 1024 return -EINVAL; 1025 1025 1026 - if (adev->gmc.is_app_apu || adev->flags & AMD_IS_APU) 1026 + if (adev->flags & AMD_IS_APU) 1027 1027 return 0; 1028 1028 1029 1029 pgmap = &kfddev->pgmap;
+2 -4
drivers/gpu/drm/amd/amdkfd/kfd_svm.c
··· 2619 2619 return -1; 2620 2620 } 2621 2621 2622 - if (node->adev->gmc.is_app_apu || 2623 - node->adev->flags & AMD_IS_APU) 2622 + if (node->adev->flags & AMD_IS_APU) 2624 2623 return 0; 2625 2624 2626 2625 if (prange->preferred_loc == gpuid || ··· 3337 3338 goto out; 3338 3339 } 3339 3340 3340 - if (bo_node->adev->gmc.is_app_apu || 3341 - bo_node->adev->flags & AMD_IS_APU) { 3341 + if (bo_node->adev->flags & AMD_IS_APU) { 3342 3342 best_loc = 0; 3343 3343 goto out; 3344 3344 }
-1
drivers/gpu/drm/amd/amdkfd/kfd_svm.h
··· 201 201 * is initialized to not 0 when page migration register device memory. 202 202 */ 203 203 #define KFD_IS_SVM_API_SUPPORTED(adev) ((adev)->kfd.pgmap.type != 0 ||\ 204 - (adev)->gmc.is_app_apu ||\ 205 204 ((adev)->flags & AMD_IS_APU)) 206 205 207 206 void svm_range_bo_unref_async(struct svm_range_bo *svm_bo);
+3
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
··· 613 613 &connector->base, 614 614 dev->mode_config.tile_property, 615 615 0); 616 + connector->colorspace_property = master->base.colorspace_property; 617 + if (connector->colorspace_property) 618 + drm_connector_attach_colorspace_property(connector); 616 619 617 620 drm_connector_set_path_property(connector, pathprop); 618 621
+1 -1
drivers/gpu/drm/amd/include/atomfirmware.h
··· 3583 3583 uint8_t phase_delay_us; // phase delay in unit of micro second 3584 3584 uint8_t reserved; 3585 3585 uint32_t gpio_mask_val; // GPIO Mask value 3586 - struct atom_voltage_gpio_map_lut voltage_gpio_lut[1]; 3586 + struct atom_voltage_gpio_map_lut voltage_gpio_lut[] __counted_by(gpio_entry_num); 3587 3587 }; 3588 3588 3589 3589 struct atom_svid2_voltage_object_v4
-1
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
··· 1562 1562 smu_i2c->port = i; 1563 1563 mutex_init(&smu_i2c->mutex); 1564 1564 control->owner = THIS_MODULE; 1565 - control->class = I2C_CLASS_SPD; 1566 1565 control->dev.parent = &adev->pdev->dev; 1567 1566 control->algo = &smu_v14_0_2_i2c_algo; 1568 1567 snprintf(control->name, sizeof(control->name), "AMDGPU SMU %d", i);