Skip to content

Commit fc58764

Browse files
committed
Merge tag 'amd-drm-next-6.2-2022-11-18' of https://gitlab.freedesktop.org/agd5f/linux into drm-next
amd-drm-next-6.2-2022-11-18: amdgpu: - SR-IOV fixes - Clean up DC checks - DCN 3.2.x fixes - DCN 3.1.x fixes - Don't enable degamma on asics which don't support it - IP discovery fixes - BACO fixes - Fix vbios allocation handling when vkms is enabled - Drop buggy tdr advanced mode GPU reset handling - Fix the build when DCN is not set in kconfig - MST DSC fixes - Userptr fixes - FRU and RAS EEPROM fixes - VCN 4.x RAS support - Aldrebaran CU occupancy reporting fix - PSP ring cleanup amdkfd: - Memory limit fix - Enable cooperative launch on gfx 10.3 amd-drm-next-6.2-2022-11-11: amdgpu: - SMU 13.x updates - GPUVM TLB race fix - DCN 3.1.4 updates - DCN 3.2.x updates - PSR fixes - Kerneldoc fix - Vega10 fan fix - GPUVM locking fixes in error pathes - BACO fix for Beige Goby - EEPROM I2C address cleanup - GFXOFF fix - Fix DC memory leak in error pathes - Flexible array updates - Mtype fix for GPUVM PTEs - Move Kconfig into amdgpu directory - SR-IOV updates - Fix possible memory leak in CS IOCTL error path amdkfd: - Fix possible memory overrun - CRIU fixes radeon: - ACPI ref count fix - HDA audio notifier support - Move Kconfig into radeon directory UAPI: - Add new GEM_CREATE flags to help to transition more KFD functionality to the DRM UAPI. These are used internally in the driver to align location based memory coherency requirements from memory allocated in the KFD with how we manage GPUVM PTEs. They are currently blocked in the GEM_CREATE IOCTL as we don't have a user right now. They are just used internally in the kernel driver for now for existing KFD memory allocations. So a change to the UAPI header, but no functional change in the UAPI. From: Alex Deucher <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Dave Airlie <[email protected]>
2 parents 819683a + aec3bb3 commit fc58764

File tree

176 files changed

+2686
-1643
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

176 files changed

+2686
-1643
lines changed

drivers/gpu/drm/Kconfig

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -233,64 +233,8 @@ source "drivers/gpu/drm/i2c/Kconfig"
233233

234234
source "drivers/gpu/drm/arm/Kconfig"
235235

236-
config DRM_RADEON
237-
tristate "ATI Radeon"
238-
depends on DRM && PCI && MMU
239-
depends on AGP || !AGP
240-
select FW_LOADER
241-
select DRM_DISPLAY_DP_HELPER
242-
select DRM_DISPLAY_HELPER
243-
select DRM_KMS_HELPER
244-
select DRM_TTM
245-
select DRM_TTM_HELPER
246-
select POWER_SUPPLY
247-
select HWMON
248-
select BACKLIGHT_CLASS_DEVICE
249-
select INTERVAL_TREE
250-
# radeon depends on ACPI_VIDEO when ACPI is enabled, for select to work
251-
# ACPI_VIDEO's dependencies must also be selected.
252-
select INPUT if ACPI
253-
select ACPI_VIDEO if ACPI
254-
# On x86 ACPI_VIDEO also needs ACPI_WMI
255-
select X86_PLATFORM_DEVICES if ACPI && X86
256-
select ACPI_WMI if ACPI && X86
257-
help
258-
Choose this option if you have an ATI Radeon graphics card. There
259-
are both PCI and AGP versions. You don't need to choose this to
260-
run the Radeon in plain VGA mode.
261-
262-
If M is selected, the module will be called radeon.
263-
264236
source "drivers/gpu/drm/radeon/Kconfig"
265237

266-
config DRM_AMDGPU
267-
tristate "AMD GPU"
268-
depends on DRM && PCI && MMU
269-
select FW_LOADER
270-
select DRM_DISPLAY_DP_HELPER
271-
select DRM_DISPLAY_HDMI_HELPER
272-
select DRM_DISPLAY_HELPER
273-
select DRM_KMS_HELPER
274-
select DRM_SCHED
275-
select DRM_TTM
276-
select DRM_TTM_HELPER
277-
select POWER_SUPPLY
278-
select HWMON
279-
select BACKLIGHT_CLASS_DEVICE
280-
select INTERVAL_TREE
281-
select DRM_BUDDY
282-
# amdgpu depends on ACPI_VIDEO when ACPI is enabled, for select to work
283-
# ACPI_VIDEO's dependencies must also be selected.
284-
select INPUT if ACPI
285-
select ACPI_VIDEO if ACPI
286-
# On x86 ACPI_VIDEO also needs ACPI_WMI
287-
select X86_PLATFORM_DEVICES if ACPI && X86
288-
select ACPI_WMI if ACPI && X86
289-
help
290-
Choose this option if you have a recent AMD Radeon graphics card.
291-
292-
If M is selected, the module will be called amdgpu.
293-
294238
source "drivers/gpu/drm/amd/amdgpu/Kconfig"
295239

296240
source "drivers/gpu/drm/nouveau/Kconfig"

drivers/gpu/drm/amd/amdgpu/Kconfig

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,33 @@
11
# SPDX-License-Identifier: MIT
2+
3+
config DRM_AMDGPU
4+
tristate "AMD GPU"
5+
depends on DRM && PCI && MMU
6+
select FW_LOADER
7+
select DRM_DISPLAY_DP_HELPER
8+
select DRM_DISPLAY_HDMI_HELPER
9+
select DRM_DISPLAY_HELPER
10+
select DRM_KMS_HELPER
11+
select DRM_SCHED
12+
select DRM_TTM
13+
select DRM_TTM_HELPER
14+
select POWER_SUPPLY
15+
select HWMON
16+
select BACKLIGHT_CLASS_DEVICE
17+
select INTERVAL_TREE
18+
select DRM_BUDDY
19+
# amdgpu depends on ACPI_VIDEO when ACPI is enabled, for select to work
20+
# ACPI_VIDEO's dependencies must also be selected.
21+
select INPUT if ACPI
22+
select ACPI_VIDEO if ACPI
23+
# On x86 ACPI_VIDEO also needs ACPI_WMI
24+
select X86_PLATFORM_DEVICES if ACPI && X86
25+
select ACPI_WMI if ACPI && X86
26+
help
27+
Choose this option if you have a recent AMD Radeon graphics card.
28+
29+
If M is selected, the module will be called amdgpu.
30+
231
config DRM_AMDGPU_SI
332
bool "Enable amdgpu support for SI parts"
433
depends on DRM_AMDGPU

drivers/gpu/drm/amd/amdgpu/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ endif
250250
amdgpu-$(CONFIG_COMPAT) += amdgpu_ioc32.o
251251
amdgpu-$(CONFIG_VGA_SWITCHEROO) += amdgpu_atpx_handler.o
252252
amdgpu-$(CONFIG_ACPI) += amdgpu_acpi.o
253-
amdgpu-$(CONFIG_HMM_MIRROR) += amdgpu_mn.o
253+
amdgpu-$(CONFIG_HMM_MIRROR) += amdgpu_hmm.o
254254

255255
include $(FULL_AMD_PATH)/pm/Makefile
256256

drivers/gpu/drm/amd/amdgpu/amdgpu.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@
8282
#include "amdgpu_vce.h"
8383
#include "amdgpu_vcn.h"
8484
#include "amdgpu_jpeg.h"
85-
#include "amdgpu_mn.h"
8685
#include "amdgpu_gmc.h"
8786
#include "amdgpu_gfx.h"
8887
#include "amdgpu_sdma.h"
@@ -1065,6 +1064,7 @@ struct amdgpu_device {
10651064
struct work_struct reset_work;
10661065

10671066
bool job_hang;
1067+
bool dc_enabled;
10681068
};
10691069

10701070
static inline struct amdgpu_device *drm_to_adev(struct drm_device *ddev)
@@ -1122,6 +1122,8 @@ void amdgpu_device_indirect_wreg64(struct amdgpu_device *adev,
11221122
bool amdgpu_device_asic_has_dc_support(enum amd_asic_type asic_type);
11231123
bool amdgpu_device_has_dc_support(struct amdgpu_device *adev);
11241124

1125+
void amdgpu_device_set_sriov_virtual_display(struct amdgpu_device *adev);
1126+
11251127
int amdgpu_device_pre_asic_reset(struct amdgpu_device *adev,
11261128
struct amdgpu_reset_context *reset_context);
11271129

@@ -1295,6 +1297,7 @@ void amdgpu_device_pcie_port_wreg(struct amdgpu_device *adev,
12951297
u32 reg, u32 v);
12961298
struct dma_fence *amdgpu_device_switch_gang(struct amdgpu_device *adev,
12971299
struct dma_fence *gang);
1300+
bool amdgpu_device_has_display_hardware(struct amdgpu_device *adev);
12981301

12991302
/* atpx handler */
13001303
#if defined(CONFIG_VGA_SWITCHEROO)

drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -847,7 +847,7 @@ int amdgpu_acpi_init(struct amdgpu_device *adev)
847847
struct amdgpu_atif *atif = &amdgpu_acpi_priv.atif;
848848

849849
if (atif->notifications.brightness_change) {
850-
if (amdgpu_device_has_dc_support(adev)) {
850+
if (adev->dc_enabled) {
851851
#if defined(CONFIG_DRM_AMD_DC)
852852
struct amdgpu_display_manager *dm = &adev->dm;
853853

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_aldebaran.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,6 @@ const struct kfd2kgd_calls aldebaran_kfd2kgd = {
4141
.get_atc_vmid_pasid_mapping_info =
4242
kgd_gfx_v9_get_atc_vmid_pasid_mapping_info,
4343
.set_vm_context_page_table_base = kgd_gfx_v9_set_vm_context_page_table_base,
44+
.get_cu_occupancy = kgd_gfx_v9_get_cu_occupancy,
4445
.program_trap_handler_settings = kgd_gfx_v9_program_trap_handler_settings
4546
};

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c

Lines changed: 21 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "amdgpu_object.h"
3030
#include "amdgpu_gem.h"
3131
#include "amdgpu_vm.h"
32+
#include "amdgpu_hmm.h"
3233
#include "amdgpu_amdkfd.h"
3334
#include "amdgpu_dma_buf.h"
3435
#include <uapi/linux/kfd_ioctl.h>
@@ -171,9 +172,7 @@ int amdgpu_amdkfd_reserve_mem_limit(struct amdgpu_device *adev,
171172
(kfd_mem_limit.ttm_mem_used + ttm_mem_needed >
172173
kfd_mem_limit.max_ttm_mem_limit) ||
173174
(adev && adev->kfd.vram_used + vram_needed >
174-
adev->gmc.real_vram_size -
175-
atomic64_read(&adev->vram_pin_size) -
176-
reserved_for_pt)) {
175+
adev->gmc.real_vram_size - reserved_for_pt)) {
177176
ret = -ENOMEM;
178177
goto release;
179178
}
@@ -405,63 +404,15 @@ static int vm_update_pds(struct amdgpu_vm *vm, struct amdgpu_sync *sync)
405404

406405
static uint64_t get_pte_flags(struct amdgpu_device *adev, struct kgd_mem *mem)
407406
{
408-
struct amdgpu_device *bo_adev = amdgpu_ttm_adev(mem->bo->tbo.bdev);
409-
bool coherent = mem->alloc_flags & KFD_IOC_ALLOC_MEM_FLAGS_COHERENT;
410-
bool uncached = mem->alloc_flags & KFD_IOC_ALLOC_MEM_FLAGS_UNCACHED;
411-
uint32_t mapping_flags;
412-
uint64_t pte_flags;
413-
bool snoop = false;
407+
uint32_t mapping_flags = AMDGPU_VM_PAGE_READABLE |
408+
AMDGPU_VM_MTYPE_DEFAULT;
414409

415-
mapping_flags = AMDGPU_VM_PAGE_READABLE;
416410
if (mem->alloc_flags & KFD_IOC_ALLOC_MEM_FLAGS_WRITABLE)
417411
mapping_flags |= AMDGPU_VM_PAGE_WRITEABLE;
418412
if (mem->alloc_flags & KFD_IOC_ALLOC_MEM_FLAGS_EXECUTABLE)
419413
mapping_flags |= AMDGPU_VM_PAGE_EXECUTABLE;
420414

421-
switch (adev->ip_versions[GC_HWIP][0]) {
422-
case IP_VERSION(9, 4, 1):
423-
case IP_VERSION(9, 4, 2):
424-
if (mem->alloc_flags & KFD_IOC_ALLOC_MEM_FLAGS_VRAM) {
425-
if (bo_adev == adev) {
426-
if (uncached)
427-
mapping_flags |= AMDGPU_VM_MTYPE_UC;
428-
else if (coherent)
429-
mapping_flags |= AMDGPU_VM_MTYPE_CC;
430-
else
431-
mapping_flags |= AMDGPU_VM_MTYPE_RW;
432-
if ((adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 2)) &&
433-
adev->gmc.xgmi.connected_to_cpu)
434-
snoop = true;
435-
} else {
436-
if (uncached || coherent)
437-
mapping_flags |= AMDGPU_VM_MTYPE_UC;
438-
else
439-
mapping_flags |= AMDGPU_VM_MTYPE_NC;
440-
if (amdgpu_xgmi_same_hive(adev, bo_adev))
441-
snoop = true;
442-
}
443-
} else {
444-
if (uncached || coherent)
445-
mapping_flags |= AMDGPU_VM_MTYPE_UC;
446-
else
447-
mapping_flags |= AMDGPU_VM_MTYPE_NC;
448-
snoop = true;
449-
}
450-
break;
451-
default:
452-
if (uncached || coherent)
453-
mapping_flags |= AMDGPU_VM_MTYPE_UC;
454-
else
455-
mapping_flags |= AMDGPU_VM_MTYPE_NC;
456-
457-
if (!(mem->alloc_flags & KFD_IOC_ALLOC_MEM_FLAGS_VRAM))
458-
snoop = true;
459-
}
460-
461-
pte_flags = amdgpu_gem_va_map_flags(adev, mapping_flags);
462-
pte_flags |= snoop ? AMDGPU_PTE_SNOOPED : 0;
463-
464-
return pte_flags;
415+
return amdgpu_gem_va_map_flags(adev, mapping_flags);
465416
}
466417

467418
/**
@@ -988,6 +939,7 @@ static int init_user_pages(struct kgd_mem *mem, uint64_t user_addr,
988939
struct amdkfd_process_info *process_info = mem->process_info;
989940
struct amdgpu_bo *bo = mem->bo;
990941
struct ttm_operation_ctx ctx = { true, false };
942+
struct hmm_range *range;
991943
int ret = 0;
992944

993945
mutex_lock(&process_info->lock);
@@ -998,7 +950,7 @@ static int init_user_pages(struct kgd_mem *mem, uint64_t user_addr,
998950
goto out;
999951
}
1000952

1001-
ret = amdgpu_mn_register(bo, user_addr);
953+
ret = amdgpu_hmm_register(bo, user_addr);
1002954
if (ret) {
1003955
pr_err("%s: Failed to register MMU notifier: %d\n",
1004956
__func__, ret);
@@ -1017,7 +969,7 @@ static int init_user_pages(struct kgd_mem *mem, uint64_t user_addr,
1017969
return 0;
1018970
}
1019971

1020-
ret = amdgpu_ttm_tt_get_user_pages(bo, bo->tbo.ttm->pages);
972+
ret = amdgpu_ttm_tt_get_user_pages(bo, bo->tbo.ttm->pages, &range);
1021973
if (ret) {
1022974
pr_err("%s: Failed to get user pages: %d\n", __func__, ret);
1023975
goto unregister_out;
@@ -1035,10 +987,10 @@ static int init_user_pages(struct kgd_mem *mem, uint64_t user_addr,
1035987
amdgpu_bo_unreserve(bo);
1036988

1037989
release_out:
1038-
amdgpu_ttm_tt_get_user_pages_done(bo->tbo.ttm);
990+
amdgpu_ttm_tt_get_user_pages_done(bo->tbo.ttm, range);
1039991
unregister_out:
1040992
if (ret)
1041-
amdgpu_mn_unregister(bo);
993+
amdgpu_hmm_unregister(bo);
1042994
out:
1043995
mutex_unlock(&process_info->lock);
1044996
return ret;
@@ -1673,6 +1625,11 @@ int amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu(
16731625
}
16741626
}
16751627

1628+
if (flags & KFD_IOC_ALLOC_MEM_FLAGS_COHERENT)
1629+
alloc_flags |= AMDGPU_GEM_CREATE_COHERENT;
1630+
if (flags & KFD_IOC_ALLOC_MEM_FLAGS_UNCACHED)
1631+
alloc_flags |= AMDGPU_GEM_CREATE_UNCACHED;
1632+
16761633
*mem = kzalloc(sizeof(struct kgd_mem), GFP_KERNEL);
16771634
if (!*mem) {
16781635
ret = -ENOMEM;
@@ -1817,7 +1774,7 @@ int amdgpu_amdkfd_gpuvm_free_memory_of_gpu(
18171774
mutex_unlock(&process_info->lock);
18181775

18191776
/* No more MMU notifiers */
1820-
amdgpu_mn_unregister(mem->bo);
1777+
amdgpu_hmm_unregister(mem->bo);
18211778

18221779
ret = reserve_bo_and_cond_vms(mem, NULL, BO_VM_ALL, &ctx);
18231780
if (unlikely(ret))
@@ -2362,6 +2319,8 @@ static int update_invalid_user_pages(struct amdkfd_process_info *process_info,
23622319
/* Go through userptr_inval_list and update any invalid user_pages */
23632320
list_for_each_entry(mem, &process_info->userptr_inval_list,
23642321
validate_list.head) {
2322+
struct hmm_range *range;
2323+
23652324
invalid = atomic_read(&mem->invalid);
23662325
if (!invalid)
23672326
/* BO hasn't been invalidated since the last
@@ -2372,7 +2331,8 @@ static int update_invalid_user_pages(struct amdkfd_process_info *process_info,
23722331
bo = mem->bo;
23732332

23742333
/* Get updated user pages */
2375-
ret = amdgpu_ttm_tt_get_user_pages(bo, bo->tbo.ttm->pages);
2334+
ret = amdgpu_ttm_tt_get_user_pages(bo, bo->tbo.ttm->pages,
2335+
&range);
23762336
if (ret) {
23772337
pr_debug("Failed %d to get user pages\n", ret);
23782338

@@ -2391,7 +2351,7 @@ static int update_invalid_user_pages(struct amdkfd_process_info *process_info,
23912351
* FIXME: Cannot ignore the return code, must hold
23922352
* notifier_lock
23932353
*/
2394-
amdgpu_ttm_tt_get_user_pages_done(bo->tbo.ttm);
2354+
amdgpu_ttm_tt_get_user_pages_done(bo->tbo.ttm, range);
23952355
}
23962356

23972357
/* Mark the BO as valid unless it was invalidated

0 commit comments

Comments
 (0)