Skip to content

Commit cacaeb2

Browse files
committed
Merge tag 'amd-drm-next-6.6-2023-08-18' of https://gitlab.freedesktop.org/agd5f/linux into drm-next
amd-drm-next-6.6-2023-08-18: amdgpu: - Panel replay fixes - Misc checkpatch fixes - SMU 13.x fixes - mcbp parameter handling fix for gfx9 - RAS fixes - Misc code cleanups - SR-IOV fixes - Expose both current and average power via hwmon if supported - DP retimer fix - Clockgating fix - Subvp fixes - DMCUB fixes - Gamut remap fix - Misc display fixes - Allow users to force runtime pm when displays are attached - Gracefully handle more partitions than drm nodes - S0ix fixes - GC 9.4.3 fixes amdkfd: - TBA fix for aldebaran - Fix build without CONFIG_DYNAMIC_DEBUG - memdup cleanup - Fix address watch clearing radeon: - Misc code cleanups Signed-off-by: Dave Airlie <airlied@redhat.com> From: Alex Deucher <alexander.deucher@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230818195247.10981-1-alexander.deucher@amd.com
2 parents 5d21db2 + ef35c7b commit cacaeb2

File tree

120 files changed

+2364
-1122
lines changed

Some content is hidden

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

120 files changed

+2364
-1122
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@ extern int amdgpu_emu_mode;
192192
extern uint amdgpu_smu_memory_pool_size;
193193
extern int amdgpu_smu_pptable_id;
194194
extern uint amdgpu_dc_feature_mask;
195-
extern uint amdgpu_freesync_vid_mode;
196195
extern uint amdgpu_dc_debug_mask;
197196
extern uint amdgpu_dc_visual_confirm;
198197
extern uint amdgpu_dm_abm_level;

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ int amdgpu_acpi_pcie_performance_request(struct amdgpu_device *adev,
706706

707707
atcs_input.size = sizeof(struct atcs_pref_req_input);
708708
/* client id (bit 2-0: func num, 7-3: dev num, 15-8: bus num) */
709-
atcs_input.client_id = adev->pdev->devfn | (adev->pdev->bus->number << 8);
709+
atcs_input.client_id = pci_dev_id(adev->pdev);
710710
atcs_input.valid_flags_mask = ATCS_VALID_FLAGS_MASK;
711711
atcs_input.flags = ATCS_WAIT_FOR_COMPLETION;
712712
if (advertise)
@@ -776,7 +776,7 @@ int amdgpu_acpi_power_shift_control(struct amdgpu_device *adev,
776776

777777
atcs_input.size = sizeof(struct atcs_pwr_shift_input);
778778
/* dGPU id (bit 2-0: func num, 7-3: dev num, 15-8: bus num) */
779-
atcs_input.dgpu_id = adev->pdev->devfn | (adev->pdev->bus->number << 8);
779+
atcs_input.dgpu_id = pci_dev_id(adev->pdev);
780780
atcs_input.dev_acpi_state = dev_state;
781781
atcs_input.drv_state = drv_state;
782782

@@ -1141,7 +1141,7 @@ int amdgpu_acpi_get_tmr_info(struct amdgpu_device *adev, u64 *tmr_offset,
11411141
if (!tmr_offset || !tmr_size)
11421142
return -EINVAL;
11431143

1144-
bdf = (adev->pdev->bus->number << 8) | adev->pdev->devfn;
1144+
bdf = pci_dev_id(adev->pdev);
11451145
dev_info = amdgpu_acpi_get_dev(bdf);
11461146
if (!dev_info)
11471147
return -ENOENT;
@@ -1162,7 +1162,7 @@ int amdgpu_acpi_get_mem_info(struct amdgpu_device *adev, int xcc_id,
11621162
if (!numa_info)
11631163
return -EINVAL;
11641164

1165-
bdf = (adev->pdev->bus->number << 8) | adev->pdev->devfn;
1165+
bdf = pci_dev_id(adev->pdev);
11661166
dev_info = amdgpu_acpi_get_dev(bdf);
11671167
if (!dev_info)
11681168
return -ENOENT;

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,6 @@ static uint32_t kgd_gfx_aldebaran_set_address_watch(
163163
return watch_address_cntl;
164164
}
165165

166-
static uint32_t kgd_gfx_aldebaran_clear_address_watch(struct amdgpu_device *adev,
167-
uint32_t watch_id)
168-
{
169-
return 0;
170-
}
171-
172166
const struct kfd2kgd_calls aldebaran_kfd2kgd = {
173167
.program_sh_mem_settings = kgd_gfx_v9_program_sh_mem_settings,
174168
.set_pasid_vmid_mapping = kgd_gfx_v9_set_pasid_vmid_mapping,
@@ -193,7 +187,7 @@ const struct kfd2kgd_calls aldebaran_kfd2kgd = {
193187
.set_wave_launch_trap_override = kgd_aldebaran_set_wave_launch_trap_override,
194188
.set_wave_launch_mode = kgd_aldebaran_set_wave_launch_mode,
195189
.set_address_watch = kgd_gfx_aldebaran_set_address_watch,
196-
.clear_address_watch = kgd_gfx_aldebaran_clear_address_watch,
190+
.clear_address_watch = kgd_gfx_v9_clear_address_watch,
197191
.get_iq_wait_times = kgd_gfx_v9_get_iq_wait_times,
198192
.build_grace_period_packet_info = kgd_gfx_v9_build_grace_period_packet_info,
199193
.program_trap_handler_settings = kgd_gfx_v9_program_trap_handler_settings,

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
#include "amdgpu_xgmi.h"
4040
#include "kfd_priv.h"
4141
#include "kfd_smi_events.h"
42-
#include <drm/ttm/ttm_tt.h>
4342

4443
/* Userptr restore delay, just long enough to allow consecutive VM
4544
* changes to accumulate

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,10 +305,16 @@ size_t amdgpu_device_aper_access(struct amdgpu_device *adev, loff_t pos,
305305

306306
if (write) {
307307
memcpy_toio(addr, buf, count);
308+
/* Make sure HDP write cache flush happens without any reordering
309+
* after the system memory contents are sent over PCIe device
310+
*/
308311
mb();
309312
amdgpu_device_flush_hdp(adev, NULL);
310313
} else {
311314
amdgpu_device_invalidate_hdp(adev, NULL);
315+
/* Make sure HDP read cache is invalidated before issuing a read
316+
* to the PCIe device
317+
*/
312318
mb();
313319
memcpy_fromio(buf, addr, count);
314320
}
@@ -3487,10 +3493,11 @@ static void amdgpu_device_set_mcbp(struct amdgpu_device *adev)
34873493
{
34883494
if (amdgpu_mcbp == 1)
34893495
adev->gfx.mcbp = true;
3490-
3491-
if ((adev->ip_versions[GC_HWIP][0] >= IP_VERSION(9, 0, 0)) &&
3492-
(adev->ip_versions[GC_HWIP][0] < IP_VERSION(10, 0, 0)) &&
3493-
adev->gfx.num_gfx_rings)
3496+
else if (amdgpu_mcbp == 0)
3497+
adev->gfx.mcbp = false;
3498+
else if ((adev->ip_versions[GC_HWIP][0] >= IP_VERSION(9, 0, 0)) &&
3499+
(adev->ip_versions[GC_HWIP][0] < IP_VERSION(10, 0, 0)) &&
3500+
adev->gfx.num_gfx_rings)
34943501
adev->gfx.mcbp = true;
34953502

34963503
if (amdgpu_sriov_vf(adev))
@@ -4153,6 +4160,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon)
41534160
drm_fb_helper_set_suspend_unlocked(adev_to_drm(adev)->fb_helper, true);
41544161

41554162
cancel_delayed_work_sync(&adev->delayed_init_work);
4163+
flush_delayed_work(&adev->gfx.gfx_off_delay_work);
41564164

41574165
amdgpu_ras_suspend(adev);
41584166

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,14 +334,14 @@ enum AMDGPU_DOORBELL_ASSIGNMENT_LAYOUT1 {
334334
AMDGPU_DOORBELL_LAYOUT1_sDMA_ENGINE_END = 0x19F,
335335
/* IH: 0x1A0 ~ 0x1AF */
336336
AMDGPU_DOORBELL_LAYOUT1_IH = 0x1A0,
337-
/* VCN: 0x1B0 ~ 0x1D4 */
337+
/* VCN: 0x1B0 ~ 0x1E8 */
338338
AMDGPU_DOORBELL_LAYOUT1_VCN_START = 0x1B0,
339-
AMDGPU_DOORBELL_LAYOUT1_VCN_END = 0x1D4,
339+
AMDGPU_DOORBELL_LAYOUT1_VCN_END = 0x1E8,
340340

341341
AMDGPU_DOORBELL_LAYOUT1_FIRST_NON_CP = AMDGPU_DOORBELL_LAYOUT1_sDMA_ENGINE_START,
342342
AMDGPU_DOORBELL_LAYOUT1_LAST_NON_CP = AMDGPU_DOORBELL_LAYOUT1_VCN_END,
343343

344-
AMDGPU_DOORBELL_LAYOUT1_MAX_ASSIGNMENT = 0x1D4,
344+
AMDGPU_DOORBELL_LAYOUT1_MAX_ASSIGNMENT = 0x1E8,
345345
AMDGPU_DOORBELL_LAYOUT1_INVALID = 0xFFFF
346346
};
347347

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

Lines changed: 20 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ int amdgpu_mes_kiq;
187187
int amdgpu_noretry = -1;
188188
int amdgpu_force_asic_type = -1;
189189
int amdgpu_tmz = -1; /* auto */
190-
uint amdgpu_freesync_vid_mode;
191190
int amdgpu_reset_method = -1; /* auto */
192191
int amdgpu_num_kcq = -1;
193192
int amdgpu_smartshift_bias;
@@ -348,8 +347,9 @@ module_param_named(aspm, amdgpu_aspm, int, 0444);
348347
* Override for runtime power management control for dGPUs. The amdgpu driver can dynamically power down
349348
* the dGPUs when they are idle if supported. The default is -1 (auto enable).
350349
* Setting the value to 0 disables this functionality.
350+
* Setting the value to -2 is auto enabled with power down when displays are attached.
351351
*/
352-
MODULE_PARM_DESC(runpm, "PX runtime pm (2 = force enable with BAMACO, 1 = force enable with BACO, 0 = disable, -1 = auto)");
352+
MODULE_PARM_DESC(runpm, "PX runtime pm (2 = force enable with BAMACO, 1 = force enable with BACO, 0 = disable, -1 = auto, -2 = autowith displays)");
353353
module_param_named(runpm, amdgpu_runtime_pm, int, 0444);
354354

355355
/**
@@ -871,32 +871,6 @@ module_param_named(backlight, amdgpu_backlight, bint, 0444);
871871
MODULE_PARM_DESC(tmz, "Enable TMZ feature (-1 = auto (default), 0 = off, 1 = on)");
872872
module_param_named(tmz, amdgpu_tmz, int, 0444);
873873

874-
/**
875-
* DOC: freesync_video (uint)
876-
* Enable the optimization to adjust front porch timing to achieve seamless
877-
* mode change experience when setting a freesync supported mode for which full
878-
* modeset is not needed.
879-
*
880-
* The Display Core will add a set of modes derived from the base FreeSync
881-
* video mode into the corresponding connector's mode list based on commonly
882-
* used refresh rates and VRR range of the connected display, when users enable
883-
* this feature. From the userspace perspective, they can see a seamless mode
884-
* change experience when the change between different refresh rates under the
885-
* same resolution. Additionally, userspace applications such as Video playback
886-
* can read this modeset list and change the refresh rate based on the video
887-
* frame rate. Finally, the userspace can also derive an appropriate mode for a
888-
* particular refresh rate based on the FreeSync Mode and add it to the
889-
* connector's mode list.
890-
*
891-
* Note: This is an experimental feature.
892-
*
893-
* The default value: 0 (off).
894-
*/
895-
MODULE_PARM_DESC(
896-
freesync_video,
897-
"Enable freesync modesetting optimization feature (0 = off (default), 1 = on)");
898-
module_param_named(freesync_video, amdgpu_freesync_vid_mode, uint, 0444);
899-
900874
/**
901875
* DOC: reset_method (int)
902876
* GPU reset method (-1 = auto (default), 0 = legacy, 1 = mode0, 2 = mode1, 3 = mode2, 4 = baco)
@@ -2523,24 +2497,26 @@ static int amdgpu_runtime_idle_check_display(struct device *dev)
25232497
struct drm_connector_list_iter iter;
25242498
int ret = 0;
25252499

2526-
/* XXX: Return busy if any displays are connected to avoid
2527-
* possible display wakeups after runtime resume due to
2528-
* hotplug events in case any displays were connected while
2529-
* the GPU was in suspend. Remove this once that is fixed.
2530-
*/
2531-
mutex_lock(&drm_dev->mode_config.mutex);
2532-
drm_connector_list_iter_begin(drm_dev, &iter);
2533-
drm_for_each_connector_iter(list_connector, &iter) {
2534-
if (list_connector->status == connector_status_connected) {
2535-
ret = -EBUSY;
2536-
break;
2500+
if (amdgpu_runtime_pm != -2) {
2501+
/* XXX: Return busy if any displays are connected to avoid
2502+
* possible display wakeups after runtime resume due to
2503+
* hotplug events in case any displays were connected while
2504+
* the GPU was in suspend. Remove this once that is fixed.
2505+
*/
2506+
mutex_lock(&drm_dev->mode_config.mutex);
2507+
drm_connector_list_iter_begin(drm_dev, &iter);
2508+
drm_for_each_connector_iter(list_connector, &iter) {
2509+
if (list_connector->status == connector_status_connected) {
2510+
ret = -EBUSY;
2511+
break;
2512+
}
25372513
}
2538-
}
2539-
drm_connector_list_iter_end(&iter);
2540-
mutex_unlock(&drm_dev->mode_config.mutex);
2514+
drm_connector_list_iter_end(&iter);
2515+
mutex_unlock(&drm_dev->mode_config.mutex);
25412516

2542-
if (ret)
2543-
return ret;
2517+
if (ret)
2518+
return ret;
2519+
}
25442520

25452521
if (adev->dc_enabled) {
25462522
struct drm_crtc *crtc;

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

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,41 @@ int amdgpu_fence_driver_sw_init(struct amdgpu_device *adev)
551551
return 0;
552552
}
553553

554+
/**
555+
* amdgpu_fence_need_ring_interrupt_restore - helper function to check whether
556+
* fence driver interrupts need to be restored.
557+
*
558+
* @ring: ring that to be checked
559+
*
560+
* Interrupts for rings that belong to GFX IP don't need to be restored
561+
* when the target power state is s0ix.
562+
*
563+
* Return true if need to restore interrupts, false otherwise.
564+
*/
565+
static bool amdgpu_fence_need_ring_interrupt_restore(struct amdgpu_ring *ring)
566+
{
567+
struct amdgpu_device *adev = ring->adev;
568+
bool is_gfx_power_domain = false;
569+
570+
switch (ring->funcs->type) {
571+
case AMDGPU_RING_TYPE_SDMA:
572+
/* SDMA 5.x+ is part of GFX power domain so it's covered by GFXOFF */
573+
if (adev->ip_versions[SDMA0_HWIP][0] >= IP_VERSION(5, 0, 0))
574+
is_gfx_power_domain = true;
575+
break;
576+
case AMDGPU_RING_TYPE_GFX:
577+
case AMDGPU_RING_TYPE_COMPUTE:
578+
case AMDGPU_RING_TYPE_KIQ:
579+
case AMDGPU_RING_TYPE_MES:
580+
is_gfx_power_domain = true;
581+
break;
582+
default:
583+
break;
584+
}
585+
586+
return !(adev->in_s0ix && is_gfx_power_domain);
587+
}
588+
554589
/**
555590
* amdgpu_fence_driver_hw_fini - tear down the fence driver
556591
* for all possible rings.
@@ -579,7 +614,8 @@ void amdgpu_fence_driver_hw_fini(struct amdgpu_device *adev)
579614
amdgpu_fence_driver_force_completion(ring);
580615

581616
if (!drm_dev_is_unplugged(adev_to_drm(adev)) &&
582-
ring->fence_drv.irq_src)
617+
ring->fence_drv.irq_src &&
618+
amdgpu_fence_need_ring_interrupt_restore(ring))
583619
amdgpu_irq_put(adev, ring->fence_drv.irq_src,
584620
ring->fence_drv.irq_type);
585621

@@ -655,7 +691,8 @@ void amdgpu_fence_driver_hw_init(struct amdgpu_device *adev)
655691
continue;
656692

657693
/* enable the interrupt */
658-
if (ring->fence_drv.irq_src)
694+
if (ring->fence_drv.irq_src &&
695+
amdgpu_fence_need_ring_interrupt_restore(ring))
659696
amdgpu_irq_get(adev, ring->fence_drv.irq_src,
660697
ring->fence_drv.irq_type);
661698
}

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

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -700,15 +700,8 @@ void amdgpu_gfx_off_ctrl(struct amdgpu_device *adev, bool enable)
700700

701701
if (adev->gfx.gfx_off_req_count == 0 &&
702702
!adev->gfx.gfx_off_state) {
703-
/* If going to s2idle, no need to wait */
704-
if (adev->in_s0ix) {
705-
if (!amdgpu_dpm_set_powergating_by_smu(adev,
706-
AMD_IP_BLOCK_TYPE_GFX, true))
707-
adev->gfx.gfx_off_state = true;
708-
} else {
709-
schedule_delayed_work(&adev->gfx.gfx_off_delay_work,
703+
schedule_delayed_work(&adev->gfx.gfx_off_delay_work,
710704
delay);
711-
}
712705
}
713706
} else {
714707
if (adev->gfx.gfx_off_req_count == 0) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,7 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
10191019
case AMDGPU_INFO_SENSOR_GPU_AVG_POWER:
10201020
/* get average GPU power */
10211021
if (amdgpu_dpm_read_sensor(adev,
1022-
AMDGPU_PP_SENSOR_GPU_POWER,
1022+
AMDGPU_PP_SENSOR_GPU_AVG_POWER,
10231023
(void *)&ui32, &ui32_size)) {
10241024
return -EINVAL;
10251025
}

0 commit comments

Comments
 (0)