Skip to content

Commit 45be204

Browse files
committed
Merge tag 'amd-drm-next-6.3-2023-01-06' of https://gitlab.freedesktop.org/agd5f/linux into drm-next
amd-drm-next-6.3-2023-01-06: amdgpu: - secure display support for multiple displays - DML optimizations - DCN 3.2 updates - PSR updates - DP 2.1 updates - SR-IOV RAS updates - VCN RAS support - SMU 13.x updates - Switch 1 element arrays to flexible arrays - Add RAS support for DF 4.3 - Stack size improvements - S0ix rework - Soft reset fix - Allow 0 as a vram limit on APUs - Display fixes - Misc code cleanups - Documentation fixes - Handle profiling modes for SMU13.x amdkfd: - Error handling fixes - PASID fixes radeon: - Switch 1 element arrays to flexible arrays drm: - Add DP adaptive sync DPCD definitions UAPI: - Add new INFO queries for peak and min sclk/mclk for profile modes on newer chips Proposed mesa patch: https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/278 Signed-off-by: Dave Airlie <airlied@redhat.com> From: Alex Deucher <alexander.deucher@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230106222037.7870-1-alexander.deucher@amd.com
2 parents 03a0a10 + f6e856e commit 45be204

138 files changed

Lines changed: 1979 additions & 999 deletions

File tree

Some content is hidden

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

drivers/gpu/drm/amd/amdgpu/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ amdgpu-y += \
8181
# add DF block
8282
amdgpu-y += \
8383
df_v1_7.o \
84-
df_v3_6.o
84+
df_v3_6.o \
85+
df_v4_3.o
8586

8687
# add GMC block
8788
amdgpu-y += \

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ struct amdgpu_watchdog_timer
149149
* Modules parameters.
150150
*/
151151
extern int amdgpu_modeset;
152-
extern int amdgpu_vram_limit;
152+
extern unsigned int amdgpu_vram_limit;
153153
extern int amdgpu_vis_vram_limit;
154154
extern int amdgpu_gart_size;
155155
extern int amdgpu_gtt_size;
@@ -194,6 +194,7 @@ extern int amdgpu_emu_mode;
194194
extern uint amdgpu_smu_memory_pool_size;
195195
extern int amdgpu_smu_pptable_id;
196196
extern uint amdgpu_dc_feature_mask;
197+
extern uint amdgpu_freesync_vid_mode;
197198
extern uint amdgpu_dc_debug_mask;
198199
extern uint amdgpu_dc_visual_confirm;
199200
extern uint amdgpu_dm_abm_level;
@@ -607,7 +608,7 @@ int amdgpu_cs_wait_fences_ioctl(struct drm_device *dev, void *data,
607608
struct drm_file *filp);
608609

609610
/* VRAM scratch page for HDP bug, default vram page */
610-
struct amdgpu_vram_scratch {
611+
struct amdgpu_mem_scratch {
611612
struct amdgpu_bo *robj;
612613
volatile uint32_t *ptr;
613614
u64 gpu_addr;
@@ -754,6 +755,11 @@ struct amdgpu_mqd {
754755
#define AMDGPU_PRODUCT_NAME_LEN 64
755756
struct amdgpu_reset_domain;
756757

758+
/*
759+
* Non-zero (true) if the GPU has VRAM. Zero (false) otherwise.
760+
*/
761+
#define AMDGPU_HAS_VRAM(_adev) ((_adev)->gmc.real_vram_size)
762+
757763
struct amdgpu_device {
758764
struct device *dev;
759765
struct pci_dev *pdev;
@@ -847,7 +853,7 @@ struct amdgpu_device {
847853

848854
/* memory management */
849855
struct amdgpu_mman mman;
850-
struct amdgpu_vram_scratch vram_scratch;
856+
struct amdgpu_mem_scratch mem_scratch;
851857
struct amdgpu_wb wb;
852858
atomic64_t num_bytes_moved;
853859
atomic64_t num_evictions;
@@ -869,7 +875,7 @@ struct amdgpu_device {
869875
struct amdgpu_vkms_output *amdgpu_vkms_output;
870876
struct amdgpu_mode_info mode_info;
871877
/* For pre-DCE11. DCE11 and later are in "struct amdgpu_device->dm" */
872-
struct work_struct hotplug_work;
878+
struct delayed_work hotplug_work;
873879
struct amdgpu_irq_src crtc_irq;
874880
struct amdgpu_irq_src vline0_irq;
875881
struct amdgpu_irq_src vupdate_irq;

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

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -996,13 +996,33 @@ amdgpu_connector_dvi_detect(struct drm_connector *connector, bool force)
996996
}
997997
}
998998

999+
if (amdgpu_connector->detected_hpd_without_ddc) {
1000+
force = true;
1001+
amdgpu_connector->detected_hpd_without_ddc = false;
1002+
}
1003+
9991004
if (!force && amdgpu_connector_check_hpd_status_unchanged(connector)) {
10001005
ret = connector->status;
10011006
goto exit;
10021007
}
10031008

1004-
if (amdgpu_connector->ddc_bus)
1009+
if (amdgpu_connector->ddc_bus) {
10051010
dret = amdgpu_display_ddc_probe(amdgpu_connector, false);
1011+
1012+
/* Sometimes the pins required for the DDC probe on DVI
1013+
* connectors don't make contact at the same time that the ones
1014+
* for HPD do. If the DDC probe fails even though we had an HPD
1015+
* signal, try again later
1016+
*/
1017+
if (!dret && !force &&
1018+
amdgpu_display_hpd_sense(adev, amdgpu_connector->hpd.hpd)) {
1019+
DRM_DEBUG_KMS("hpd detected without ddc, retrying in 1 second\n");
1020+
amdgpu_connector->detected_hpd_without_ddc = true;
1021+
schedule_delayed_work(&adev->hotplug_work,
1022+
msecs_to_jiffies(1000));
1023+
goto exit;
1024+
}
1025+
}
10061026
if (dret) {
10071027
amdgpu_connector->detected_by_load = false;
10081028
amdgpu_connector_free_edid(connector);

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

Lines changed: 31 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -924,32 +924,33 @@ static int amdgpu_device_asic_init(struct amdgpu_device *adev)
924924
}
925925

926926
/**
927-
* amdgpu_device_vram_scratch_init - allocate the VRAM scratch page
927+
* amdgpu_device_mem_scratch_init - allocate the VRAM scratch page
928928
*
929929
* @adev: amdgpu_device pointer
930930
*
931931
* Allocates a scratch page of VRAM for use by various things in the
932932
* driver.
933933
*/
934-
static int amdgpu_device_vram_scratch_init(struct amdgpu_device *adev)
934+
static int amdgpu_device_mem_scratch_init(struct amdgpu_device *adev)
935935
{
936-
return amdgpu_bo_create_kernel(adev, AMDGPU_GPU_PAGE_SIZE,
937-
PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM,
938-
&adev->vram_scratch.robj,
939-
&adev->vram_scratch.gpu_addr,
940-
(void **)&adev->vram_scratch.ptr);
936+
return amdgpu_bo_create_kernel(adev, AMDGPU_GPU_PAGE_SIZE, PAGE_SIZE,
937+
AMDGPU_GEM_DOMAIN_VRAM |
938+
AMDGPU_GEM_DOMAIN_GTT,
939+
&adev->mem_scratch.robj,
940+
&adev->mem_scratch.gpu_addr,
941+
(void **)&adev->mem_scratch.ptr);
941942
}
942943

943944
/**
944-
* amdgpu_device_vram_scratch_fini - Free the VRAM scratch page
945+
* amdgpu_device_mem_scratch_fini - Free the VRAM scratch page
945946
*
946947
* @adev: amdgpu_device pointer
947948
*
948949
* Frees the VRAM scratch page.
949950
*/
950-
static void amdgpu_device_vram_scratch_fini(struct amdgpu_device *adev)
951+
static void amdgpu_device_mem_scratch_fini(struct amdgpu_device *adev)
951952
{
952-
amdgpu_bo_free_kernel(&adev->vram_scratch.robj, NULL, NULL);
953+
amdgpu_bo_free_kernel(&adev->mem_scratch.robj, NULL, NULL);
953954
}
954955

955956
/**
@@ -2390,9 +2391,9 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev)
23902391
if (amdgpu_sriov_vf(adev))
23912392
amdgpu_virt_exchange_data(adev);
23922393

2393-
r = amdgpu_device_vram_scratch_init(adev);
2394+
r = amdgpu_device_mem_scratch_init(adev);
23942395
if (r) {
2395-
DRM_ERROR("amdgpu_vram_scratch_init failed %d\n", r);
2396+
DRM_ERROR("amdgpu_mem_scratch_init failed %d\n", r);
23962397
goto init_failed;
23972398
}
23982399
r = adev->ip_blocks[i].version->funcs->hw_init((void *)adev);
@@ -2410,8 +2411,9 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev)
24102411
/* right after GMC hw init, we create CSA */
24112412
if (amdgpu_mcbp) {
24122413
r = amdgpu_allocate_static_csa(adev, &adev->virt.csa_obj,
2413-
AMDGPU_GEM_DOMAIN_VRAM,
2414-
AMDGPU_CSA_SIZE);
2414+
AMDGPU_GEM_DOMAIN_VRAM |
2415+
AMDGPU_GEM_DOMAIN_GTT,
2416+
AMDGPU_CSA_SIZE);
24152417
if (r) {
24162418
DRM_ERROR("allocate CSA failed %d\n", r);
24172419
goto init_failed;
@@ -2581,9 +2583,10 @@ int amdgpu_device_set_cg_state(struct amdgpu_device *adev,
25812583
i = state == AMD_CG_STATE_GATE ? j : adev->num_ip_blocks - j - 1;
25822584
if (!adev->ip_blocks[i].status.late_initialized)
25832585
continue;
2584-
/* skip CG for GFX on S0ix */
2586+
/* skip CG for GFX, SDMA on S0ix */
25852587
if (adev->in_s0ix &&
2586-
adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GFX)
2588+
(adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GFX ||
2589+
adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_SDMA))
25872590
continue;
25882591
/* skip CG for VCE/UVD, it's handled specially */
25892592
if (adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_UVD &&
@@ -2617,9 +2620,10 @@ int amdgpu_device_set_pg_state(struct amdgpu_device *adev,
26172620
i = state == AMD_PG_STATE_GATE ? j : adev->num_ip_blocks - j - 1;
26182621
if (!adev->ip_blocks[i].status.late_initialized)
26192622
continue;
2620-
/* skip PG for GFX on S0ix */
2623+
/* skip PG for GFX, SDMA on S0ix */
26212624
if (adev->in_s0ix &&
2622-
adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GFX)
2625+
(adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GFX ||
2626+
adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_SDMA))
26232627
continue;
26242628
/* skip CG for VCE/UVD, it's handled specially */
26252629
if (adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_UVD &&
@@ -2871,7 +2875,7 @@ static int amdgpu_device_ip_fini(struct amdgpu_device *adev)
28712875
amdgpu_ucode_free_bo(adev);
28722876
amdgpu_free_static_csa(&adev->virt.csa_obj);
28732877
amdgpu_device_wb_fini(adev);
2874-
amdgpu_device_vram_scratch_fini(adev);
2878+
amdgpu_device_mem_scratch_fini(adev);
28752879
amdgpu_ib_pool_fini(adev);
28762880
}
28772881

@@ -3027,6 +3031,12 @@ static int amdgpu_device_ip_suspend_phase2(struct amdgpu_device *adev)
30273031
adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_MES))
30283032
continue;
30293033

3034+
/* SDMA 5.x+ is part of GFX power domain so it's covered by GFXOFF */
3035+
if (adev->in_s0ix &&
3036+
(adev->ip_versions[SDMA0_HWIP][0] >= IP_VERSION(5, 0, 0)) &&
3037+
(adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_SDMA))
3038+
continue;
3039+
30303040
/* XXX handle errors */
30313041
r = adev->ip_blocks[i].version->funcs->suspend(adev);
30323042
/* XXX handle errors */
@@ -3227,15 +3237,6 @@ static int amdgpu_device_ip_resume_phase2(struct amdgpu_device *adev)
32273237
return r;
32283238
}
32293239
adev->ip_blocks[i].status.hw = true;
3230-
3231-
if (adev->in_s0ix && adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_SMC) {
3232-
/* disable gfxoff for IP resume. The gfxoff will be re-enabled in
3233-
* amdgpu_device_resume() after IP resume.
3234-
*/
3235-
amdgpu_gfx_off_ctrl(adev, false);
3236-
DRM_DEBUG("will disable gfxoff for re-initializing other blocks\n");
3237-
}
3238-
32393240
}
32403241

32413242
return 0;
@@ -4221,13 +4222,6 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon)
42214222
/* Make sure IB tests flushed */
42224223
flush_delayed_work(&adev->delayed_init_work);
42234224

4224-
if (adev->in_s0ix) {
4225-
/* re-enable gfxoff after IP resume. This re-enables gfxoff after
4226-
* it was disabled for IP resume in amdgpu_device_ip_resume_phase2().
4227-
*/
4228-
amdgpu_gfx_off_ctrl(adev, true);
4229-
DRM_DEBUG("will enable gfxoff for the mission mode\n");
4230-
}
42314225
if (fbcon)
42324226
drm_fb_helper_set_suspend_unlocked(adev_to_drm(adev)->fb_helper, false);
42334227

@@ -4608,11 +4602,6 @@ bool amdgpu_device_should_recover_gpu(struct amdgpu_device *adev)
46084602
if (!amdgpu_ras_is_poison_mode_supported(adev))
46094603
return true;
46104604

4611-
if (!amdgpu_device_ip_check_soft_reset(adev)) {
4612-
dev_info(adev->dev,"Timeout, but no hardware hang detected.\n");
4613-
return false;
4614-
}
4615-
46164605
if (amdgpu_sriov_vf(adev))
46174606
return true;
46184607

@@ -4737,7 +4726,8 @@ int amdgpu_device_pre_asic_reset(struct amdgpu_device *adev,
47374726
if (!need_full_reset)
47384727
need_full_reset = amdgpu_device_ip_need_full_reset(adev);
47394728

4740-
if (!need_full_reset && amdgpu_gpu_recovery) {
4729+
if (!need_full_reset && amdgpu_gpu_recovery &&
4730+
amdgpu_device_ip_check_soft_reset(adev)) {
47414731
amdgpu_device_ip_pre_soft_reset(adev);
47424732
r = amdgpu_device_ip_soft_reset(adev);
47434733
amdgpu_device_ip_post_soft_reset(adev);

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "gmc_v9_0.h"
3434
#include "df_v1_7.h"
3535
#include "df_v3_6.h"
36+
#include "df_v4_3.h"
3637
#include "nbio_v6_1.h"
3738
#include "nbio_v7_0.h"
3839
#include "nbio_v7_4.h"
@@ -2329,6 +2330,9 @@ int amdgpu_discovery_set_ip_blocks(struct amdgpu_device *adev)
23292330
case IP_VERSION(3, 5, 2):
23302331
adev->df.funcs = &df_v1_7_funcs;
23312332
break;
2333+
case IP_VERSION(4, 3, 0):
2334+
adev->df.funcs = &df_v4_3_funcs;
2335+
break;
23322336
default:
23332337
break;
23342338
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
void amdgpu_display_hotplug_work_func(struct work_struct *work)
6464
{
6565
struct amdgpu_device *adev = container_of(work, struct amdgpu_device,
66-
hotplug_work);
66+
hotplug_work.work);
6767
struct drm_device *dev = adev_to_drm(adev);
6868
struct drm_mode_config *mode_config = &dev->mode_config;
6969
struct drm_connector *connector;

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

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,15 @@
105105
* - 3.46.0 - To enable hot plug amdgpu tests in libdrm
106106
* - 3.47.0 - Add AMDGPU_GEM_CREATE_DISCARDABLE and AMDGPU_VM_NOALLOC flags
107107
* - 3.48.0 - Add IP discovery version info to HW INFO
108-
* 3.49.0 - Add gang submit into CS IOCTL
108+
* - 3.49.0 - Add gang submit into CS IOCTL
109+
* - 3.50.0 - Update AMDGPU_INFO_DEV_INFO IOCTL for minimum engine and memory clock
110+
* Update AMDGPU_INFO_SENSOR IOCTL for PEAK_PSTATE engine and memory clock
109111
*/
110112
#define KMS_DRIVER_MAJOR 3
111-
#define KMS_DRIVER_MINOR 49
113+
#define KMS_DRIVER_MINOR 50
112114
#define KMS_DRIVER_PATCHLEVEL 0
113115

114-
int amdgpu_vram_limit;
116+
unsigned int amdgpu_vram_limit = UINT_MAX;
115117
int amdgpu_vis_vram_limit;
116118
int amdgpu_gart_size = -1; /* auto */
117119
int amdgpu_gtt_size = -1; /* auto */
@@ -181,6 +183,7 @@ int amdgpu_mes_kiq;
181183
int amdgpu_noretry = -1;
182184
int amdgpu_force_asic_type = -1;
183185
int amdgpu_tmz = -1; /* auto */
186+
uint amdgpu_freesync_vid_mode;
184187
int amdgpu_reset_method = -1; /* auto */
185188
int amdgpu_num_kcq = -1;
186189
int amdgpu_smartshift_bias;
@@ -879,6 +882,32 @@ module_param_named(backlight, amdgpu_backlight, bint, 0444);
879882
MODULE_PARM_DESC(tmz, "Enable TMZ feature (-1 = auto (default), 0 = off, 1 = on)");
880883
module_param_named(tmz, amdgpu_tmz, int, 0444);
881884

885+
/**
886+
* DOC: freesync_video (uint)
887+
* Enable the optimization to adjust front porch timing to achieve seamless
888+
* mode change experience when setting a freesync supported mode for which full
889+
* modeset is not needed.
890+
*
891+
* The Display Core will add a set of modes derived from the base FreeSync
892+
* video mode into the corresponding connector's mode list based on commonly
893+
* used refresh rates and VRR range of the connected display, when users enable
894+
* this feature. From the userspace perspective, they can see a seamless mode
895+
* change experience when the change between different refresh rates under the
896+
* same resolution. Additionally, userspace applications such as Video playback
897+
* can read this modeset list and change the refresh rate based on the video
898+
* frame rate. Finally, the userspace can also derive an appropriate mode for a
899+
* particular refresh rate based on the FreeSync Mode and add it to the
900+
* connector's mode list.
901+
*
902+
* Note: This is an experimental feature.
903+
*
904+
* The default value: 0 (off).
905+
*/
906+
MODULE_PARM_DESC(
907+
freesync_video,
908+
"Enable freesync modesetting optimization feature (0 = off (default), 1 = on)");
909+
module_param_named(freesync_video, amdgpu_freesync_vid_mode, uint, 0444);
910+
882911
/**
883912
* DOC: reset_method (int)
884913
* GPU reset method (-1 = auto (default), 0 = legacy, 1 = mode0, 2 = mode1, 3 = mode2, 4 = baco)

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,11 @@ int amdgpu_gfx_mqd_sw_init(struct amdgpu_device *adev,
372372
* KIQ MQD no matter SRIOV or Bare-metal
373373
*/
374374
r = amdgpu_bo_create_kernel(adev, mqd_size, PAGE_SIZE,
375-
AMDGPU_GEM_DOMAIN_VRAM, &ring->mqd_obj,
376-
&ring->mqd_gpu_addr, &ring->mqd_ptr);
375+
AMDGPU_GEM_DOMAIN_VRAM |
376+
AMDGPU_GEM_DOMAIN_GTT,
377+
&ring->mqd_obj,
378+
&ring->mqd_gpu_addr,
379+
&ring->mqd_ptr);
377380
if (r) {
378381
dev_warn(adev->dev, "failed to create ring mqd ob (%d)", r);
379382
return r;

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,13 +202,20 @@ uint64_t amdgpu_gmc_agp_addr(struct ttm_buffer_object *bo)
202202
void amdgpu_gmc_vram_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc,
203203
u64 base)
204204
{
205+
uint64_t vis_limit = (uint64_t)amdgpu_vis_vram_limit << 20;
205206
uint64_t limit = (uint64_t)amdgpu_vram_limit << 20;
206207

207208
mc->vram_start = base;
208209
mc->vram_end = mc->vram_start + mc->mc_vram_size - 1;
209-
if (limit && limit < mc->real_vram_size)
210+
if (limit < mc->real_vram_size)
210211
mc->real_vram_size = limit;
211212

213+
if (vis_limit && vis_limit < mc->visible_vram_size)
214+
mc->visible_vram_size = vis_limit;
215+
216+
if (mc->real_vram_size < mc->visible_vram_size)
217+
mc->visible_vram_size = mc->real_vram_size;
218+
212219
if (mc->xgmi.num_physical_nodes == 0) {
213220
mc->fb_start = mc->vram_start;
214221
mc->fb_end = mc->vram_end;

0 commit comments

Comments
 (0)