Commit c703bf9e authored by Dave Airlie's avatar Dave Airlie

Merge branch 'drm-next-5.1' of git://people.freedesktop.org/~agd5f/linux into drm-next

Fixes for 5.1:
- Powerplay fixes
- DC fixes
- Fix locking around indirect register access in some cases
- KFD MQD fix
- Disable BACO for vega20 for now (fixes pending)
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
From: Alex Deucher <alexdeucher@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190307202528.3148-1-alexander.deucher@amd.com
parents 96413c78 59d3191f
...@@ -947,10 +947,6 @@ int amdgpu_vm_alloc_pts(struct amdgpu_device *adev, ...@@ -947,10 +947,6 @@ int amdgpu_vm_alloc_pts(struct amdgpu_device *adev,
if (r) if (r)
return r; return r;
r = amdgpu_vm_clear_bo(adev, vm, pt, cursor.level, ats);
if (r)
goto error_free_pt;
if (vm->use_cpu_for_update) { if (vm->use_cpu_for_update) {
r = amdgpu_bo_kmap(pt, NULL); r = amdgpu_bo_kmap(pt, NULL);
if (r) if (r)
...@@ -963,6 +959,10 @@ int amdgpu_vm_alloc_pts(struct amdgpu_device *adev, ...@@ -963,6 +959,10 @@ int amdgpu_vm_alloc_pts(struct amdgpu_device *adev,
pt->parent = amdgpu_bo_ref(cursor.parent->base.bo); pt->parent = amdgpu_bo_ref(cursor.parent->base.bo);
amdgpu_vm_bo_base_init(&entry->base, vm, pt); amdgpu_vm_bo_base_init(&entry->base, vm, pt);
r = amdgpu_vm_clear_bo(adev, vm, pt, cursor.level, ats);
if (r)
goto error_free_pt;
} }
return 0; return 0;
...@@ -3033,13 +3033,14 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm, ...@@ -3033,13 +3033,14 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
if (r) if (r)
goto error_unreserve; goto error_unreserve;
amdgpu_vm_bo_base_init(&vm->root.base, vm, root);
r = amdgpu_vm_clear_bo(adev, vm, root, r = amdgpu_vm_clear_bo(adev, vm, root,
adev->vm_manager.root_level, adev->vm_manager.root_level,
vm->pte_support_ats); vm->pte_support_ats);
if (r) if (r)
goto error_unreserve; goto error_unreserve;
amdgpu_vm_bo_base_init(&vm->root.base, vm, root);
amdgpu_bo_unreserve(vm->root.base.bo); amdgpu_bo_unreserve(vm->root.base.bo);
if (pasid) { if (pasid) {
......
...@@ -500,9 +500,7 @@ static bool psp_v3_1_smu_reload_quirk(struct psp_context *psp) ...@@ -500,9 +500,7 @@ static bool psp_v3_1_smu_reload_quirk(struct psp_context *psp)
struct amdgpu_device *adev = psp->adev; struct amdgpu_device *adev = psp->adev;
uint32_t reg; uint32_t reg;
reg = smnMP1_FIRMWARE_FLAGS | 0x03b00000; reg = RREG32_PCIE(smnMP1_FIRMWARE_FLAGS | 0x03b00000);
WREG32_SOC15(NBIO, 0, mmPCIE_INDEX2, reg);
reg = RREG32_SOC15(NBIO, 0, mmPCIE_DATA2);
return (reg & MP1_FIRMWARE_FLAGS__INTERRUPTS_ENABLED_MASK) ? true : false; return (reg & MP1_FIRMWARE_FLAGS__INTERRUPTS_ENABLED_MASK) ? true : false;
} }
......
...@@ -461,7 +461,6 @@ static int soc15_asic_reset(struct amdgpu_device *adev) ...@@ -461,7 +461,6 @@ static int soc15_asic_reset(struct amdgpu_device *adev)
switch (adev->asic_type) { switch (adev->asic_type) {
case CHIP_VEGA10: case CHIP_VEGA10:
case CHIP_VEGA20:
soc15_asic_get_baco_capability(adev, &baco_reset); soc15_asic_get_baco_capability(adev, &baco_reset);
break; break;
default: default:
......
...@@ -323,57 +323,7 @@ static int init_mqd_hiq(struct mqd_manager *mm, void **mqd, ...@@ -323,57 +323,7 @@ static int init_mqd_hiq(struct mqd_manager *mm, void **mqd,
struct kfd_mem_obj **mqd_mem_obj, uint64_t *gart_addr, struct kfd_mem_obj **mqd_mem_obj, uint64_t *gart_addr,
struct queue_properties *q) struct queue_properties *q)
{ {
uint64_t addr; return init_mqd(mm, mqd, mqd_mem_obj, gart_addr, q);
struct cik_mqd *m;
int retval;
retval = kfd_gtt_sa_allocate(mm->dev, sizeof(struct cik_mqd),
mqd_mem_obj);
if (retval != 0)
return -ENOMEM;
m = (struct cik_mqd *) (*mqd_mem_obj)->cpu_ptr;
addr = (*mqd_mem_obj)->gpu_addr;
memset(m, 0, ALIGN(sizeof(struct cik_mqd), 256));
m->header = 0xC0310800;
m->compute_pipelinestat_enable = 1;
m->compute_static_thread_mgmt_se0 = 0xFFFFFFFF;
m->compute_static_thread_mgmt_se1 = 0xFFFFFFFF;
m->compute_static_thread_mgmt_se2 = 0xFFFFFFFF;
m->compute_static_thread_mgmt_se3 = 0xFFFFFFFF;
m->cp_hqd_persistent_state = DEFAULT_CP_HQD_PERSISTENT_STATE |
PRELOAD_REQ;
m->cp_hqd_quantum = QUANTUM_EN | QUANTUM_SCALE_1MS |
QUANTUM_DURATION(10);
m->cp_mqd_control = MQD_CONTROL_PRIV_STATE_EN;
m->cp_mqd_base_addr_lo = lower_32_bits(addr);
m->cp_mqd_base_addr_hi = upper_32_bits(addr);
m->cp_hqd_ib_control = DEFAULT_MIN_IB_AVAIL_SIZE;
/*
* Pipe Priority
* Identifies the pipe relative priority when this queue is connected
* to the pipeline. The pipe priority is against the GFX pipe and HP3D.
* In KFD we are using a fixed pipe priority set to CS_MEDIUM.
* 0 = CS_LOW (typically below GFX)
* 1 = CS_MEDIUM (typically between HP3D and GFX
* 2 = CS_HIGH (typically above HP3D)
*/
m->cp_hqd_pipe_priority = 1;
m->cp_hqd_queue_priority = 15;
*mqd = m;
if (gart_addr)
*gart_addr = addr;
retval = mm->update_mqd(mm, m, q);
return retval;
} }
static int update_mqd_hiq(struct mqd_manager *mm, void *mqd, static int update_mqd_hiq(struct mqd_manager *mm, void *mqd,
......
...@@ -886,6 +886,7 @@ static void emulated_link_detect(struct dc_link *link) ...@@ -886,6 +886,7 @@ static void emulated_link_detect(struct dc_link *link)
return; return;
} }
/* dc_sink_create returns a new reference */
link->local_sink = sink; link->local_sink = sink;
edid_status = dm_helpers_read_local_edid( edid_status = dm_helpers_read_local_edid(
...@@ -952,6 +953,8 @@ static int dm_resume(void *handle) ...@@ -952,6 +953,8 @@ static int dm_resume(void *handle)
if (aconnector->fake_enable && aconnector->dc_link->local_sink) if (aconnector->fake_enable && aconnector->dc_link->local_sink)
aconnector->fake_enable = false; aconnector->fake_enable = false;
if (aconnector->dc_sink)
dc_sink_release(aconnector->dc_sink);
aconnector->dc_sink = NULL; aconnector->dc_sink = NULL;
amdgpu_dm_update_connector_after_detect(aconnector); amdgpu_dm_update_connector_after_detect(aconnector);
mutex_unlock(&aconnector->hpd_lock); mutex_unlock(&aconnector->hpd_lock);
...@@ -1061,6 +1064,8 @@ amdgpu_dm_update_connector_after_detect(struct amdgpu_dm_connector *aconnector) ...@@ -1061,6 +1064,8 @@ amdgpu_dm_update_connector_after_detect(struct amdgpu_dm_connector *aconnector)
sink = aconnector->dc_link->local_sink; sink = aconnector->dc_link->local_sink;
if (sink)
dc_sink_retain(sink);
/* /*
* Edid mgmt connector gets first update only in mode_valid hook and then * Edid mgmt connector gets first update only in mode_valid hook and then
...@@ -1085,21 +1090,24 @@ amdgpu_dm_update_connector_after_detect(struct amdgpu_dm_connector *aconnector) ...@@ -1085,21 +1090,24 @@ amdgpu_dm_update_connector_after_detect(struct amdgpu_dm_connector *aconnector)
* to it anymore after disconnect, so on next crtc to connector * to it anymore after disconnect, so on next crtc to connector
* reshuffle by UMD we will get into unwanted dc_sink release * reshuffle by UMD we will get into unwanted dc_sink release
*/ */
if (aconnector->dc_sink != aconnector->dc_em_sink) dc_sink_release(aconnector->dc_sink);
dc_sink_release(aconnector->dc_sink);
} }
aconnector->dc_sink = sink; aconnector->dc_sink = sink;
dc_sink_retain(aconnector->dc_sink);
amdgpu_dm_update_freesync_caps(connector, amdgpu_dm_update_freesync_caps(connector,
aconnector->edid); aconnector->edid);
} else { } else {
amdgpu_dm_update_freesync_caps(connector, NULL); amdgpu_dm_update_freesync_caps(connector, NULL);
if (!aconnector->dc_sink) if (!aconnector->dc_sink) {
aconnector->dc_sink = aconnector->dc_em_sink; aconnector->dc_sink = aconnector->dc_em_sink;
else if (aconnector->dc_sink != aconnector->dc_em_sink)
dc_sink_retain(aconnector->dc_sink); dc_sink_retain(aconnector->dc_sink);
}
} }
mutex_unlock(&dev->mode_config.mutex); mutex_unlock(&dev->mode_config.mutex);
if (sink)
dc_sink_release(sink);
return; return;
} }
...@@ -1107,8 +1115,10 @@ amdgpu_dm_update_connector_after_detect(struct amdgpu_dm_connector *aconnector) ...@@ -1107,8 +1115,10 @@ amdgpu_dm_update_connector_after_detect(struct amdgpu_dm_connector *aconnector)
* TODO: temporary guard to look for proper fix * TODO: temporary guard to look for proper fix
* if this sink is MST sink, we should not do anything * if this sink is MST sink, we should not do anything
*/ */
if (sink && sink->sink_signal == SIGNAL_TYPE_DISPLAY_PORT_MST) if (sink && sink->sink_signal == SIGNAL_TYPE_DISPLAY_PORT_MST) {
dc_sink_release(sink);
return; return;
}
if (aconnector->dc_sink == sink) { if (aconnector->dc_sink == sink) {
/* /*
...@@ -1117,6 +1127,8 @@ amdgpu_dm_update_connector_after_detect(struct amdgpu_dm_connector *aconnector) ...@@ -1117,6 +1127,8 @@ amdgpu_dm_update_connector_after_detect(struct amdgpu_dm_connector *aconnector)
*/ */
DRM_DEBUG_DRIVER("DCHPD: connector_id=%d: dc_sink didn't change.\n", DRM_DEBUG_DRIVER("DCHPD: connector_id=%d: dc_sink didn't change.\n",
aconnector->connector_id); aconnector->connector_id);
if (sink)
dc_sink_release(sink);
return; return;
} }
...@@ -1138,6 +1150,7 @@ amdgpu_dm_update_connector_after_detect(struct amdgpu_dm_connector *aconnector) ...@@ -1138,6 +1150,7 @@ amdgpu_dm_update_connector_after_detect(struct amdgpu_dm_connector *aconnector)
amdgpu_dm_update_freesync_caps(connector, NULL); amdgpu_dm_update_freesync_caps(connector, NULL);
aconnector->dc_sink = sink; aconnector->dc_sink = sink;
dc_sink_retain(aconnector->dc_sink);
if (sink->dc_edid.length == 0) { if (sink->dc_edid.length == 0) {
aconnector->edid = NULL; aconnector->edid = NULL;
drm_dp_cec_unset_edid(&aconnector->dm_dp_aux.aux); drm_dp_cec_unset_edid(&aconnector->dm_dp_aux.aux);
...@@ -1158,11 +1171,15 @@ amdgpu_dm_update_connector_after_detect(struct amdgpu_dm_connector *aconnector) ...@@ -1158,11 +1171,15 @@ amdgpu_dm_update_connector_after_detect(struct amdgpu_dm_connector *aconnector)
amdgpu_dm_update_freesync_caps(connector, NULL); amdgpu_dm_update_freesync_caps(connector, NULL);
drm_connector_update_edid_property(connector, NULL); drm_connector_update_edid_property(connector, NULL);
aconnector->num_modes = 0; aconnector->num_modes = 0;
dc_sink_release(aconnector->dc_sink);
aconnector->dc_sink = NULL; aconnector->dc_sink = NULL;
aconnector->edid = NULL; aconnector->edid = NULL;
} }
mutex_unlock(&dev->mode_config.mutex); mutex_unlock(&dev->mode_config.mutex);
if (sink)
dc_sink_release(sink);
} }
static void handle_hpd_irq(void *param) static void handle_hpd_irq(void *param)
...@@ -2977,6 +2994,7 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector, ...@@ -2977,6 +2994,7 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector,
return stream; return stream;
} else { } else {
sink = aconnector->dc_sink; sink = aconnector->dc_sink;
dc_sink_retain(sink);
} }
stream = dc_create_stream_for_sink(sink); stream = dc_create_stream_for_sink(sink);
...@@ -3042,8 +3060,7 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector, ...@@ -3042,8 +3060,7 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector,
update_stream_signal(stream, sink); update_stream_signal(stream, sink);
finish: finish:
if (sink && sink->sink_signal == SIGNAL_TYPE_VIRTUAL && aconnector->base.force != DRM_FORCE_ON) dc_sink_release(sink);
dc_sink_release(sink);
return stream; return stream;
} }
...@@ -3301,6 +3318,14 @@ static void amdgpu_dm_connector_destroy(struct drm_connector *connector) ...@@ -3301,6 +3318,14 @@ static void amdgpu_dm_connector_destroy(struct drm_connector *connector)
dm->backlight_dev = NULL; dm->backlight_dev = NULL;
} }
#endif #endif
if (aconnector->dc_em_sink)
dc_sink_release(aconnector->dc_em_sink);
aconnector->dc_em_sink = NULL;
if (aconnector->dc_sink)
dc_sink_release(aconnector->dc_sink);
aconnector->dc_sink = NULL;
drm_dp_cec_unregister_connector(&aconnector->dm_dp_aux.aux); drm_dp_cec_unregister_connector(&aconnector->dm_dp_aux.aux);
drm_connector_unregister(connector); drm_connector_unregister(connector);
drm_connector_cleanup(connector); drm_connector_cleanup(connector);
...@@ -3398,10 +3423,12 @@ static void create_eml_sink(struct amdgpu_dm_connector *aconnector) ...@@ -3398,10 +3423,12 @@ static void create_eml_sink(struct amdgpu_dm_connector *aconnector)
(edid->extensions + 1) * EDID_LENGTH, (edid->extensions + 1) * EDID_LENGTH,
&init_params); &init_params);
if (aconnector->base.force == DRM_FORCE_ON) if (aconnector->base.force == DRM_FORCE_ON) {
aconnector->dc_sink = aconnector->dc_link->local_sink ? aconnector->dc_sink = aconnector->dc_link->local_sink ?
aconnector->dc_link->local_sink : aconnector->dc_link->local_sink :
aconnector->dc_em_sink; aconnector->dc_em_sink;
dc_sink_retain(aconnector->dc_sink);
}
} }
static void handle_edid_mgmt(struct amdgpu_dm_connector *aconnector) static void handle_edid_mgmt(struct amdgpu_dm_connector *aconnector)
......
...@@ -191,6 +191,7 @@ static int dm_dp_mst_get_modes(struct drm_connector *connector) ...@@ -191,6 +191,7 @@ static int dm_dp_mst_get_modes(struct drm_connector *connector)
&init_params); &init_params);
dc_sink->priv = aconnector; dc_sink->priv = aconnector;
/* dc_link_add_remote_sink returns a new reference */
aconnector->dc_sink = dc_sink; aconnector->dc_sink = dc_sink;
if (aconnector->dc_sink) if (aconnector->dc_sink)
......
...@@ -1348,12 +1348,12 @@ void dcn_bw_update_from_pplib(struct dc *dc) ...@@ -1348,12 +1348,12 @@ void dcn_bw_update_from_pplib(struct dc *dc)
struct dm_pp_clock_levels_with_voltage fclks = {0}, dcfclks = {0}; struct dm_pp_clock_levels_with_voltage fclks = {0}, dcfclks = {0};
bool res; bool res;
kernel_fpu_begin();
/* TODO: This is not the proper way to obtain fabric_and_dram_bandwidth, should be min(fclk, memclk) */ /* TODO: This is not the proper way to obtain fabric_and_dram_bandwidth, should be min(fclk, memclk) */
res = dm_pp_get_clock_levels_by_type_with_voltage( res = dm_pp_get_clock_levels_by_type_with_voltage(
ctx, DM_PP_CLOCK_TYPE_FCLK, &fclks); ctx, DM_PP_CLOCK_TYPE_FCLK, &fclks);
kernel_fpu_begin();
if (res) if (res)
res = verify_clock_values(&fclks); res = verify_clock_values(&fclks);
...@@ -1372,9 +1372,13 @@ void dcn_bw_update_from_pplib(struct dc *dc) ...@@ -1372,9 +1372,13 @@ void dcn_bw_update_from_pplib(struct dc *dc)
} else } else
BREAK_TO_DEBUGGER(); BREAK_TO_DEBUGGER();
kernel_fpu_end();
res = dm_pp_get_clock_levels_by_type_with_voltage( res = dm_pp_get_clock_levels_by_type_with_voltage(
ctx, DM_PP_CLOCK_TYPE_DCFCLK, &dcfclks); ctx, DM_PP_CLOCK_TYPE_DCFCLK, &dcfclks);
kernel_fpu_begin();
if (res) if (res)
res = verify_clock_values(&dcfclks); res = verify_clock_values(&dcfclks);
......
...@@ -794,6 +794,7 @@ bool dc_link_detect(struct dc_link *link, enum dc_detect_reason reason) ...@@ -794,6 +794,7 @@ bool dc_link_detect(struct dc_link *link, enum dc_detect_reason reason)
sink->link->dongle_max_pix_clk = sink_caps.max_hdmi_pixel_clock; sink->link->dongle_max_pix_clk = sink_caps.max_hdmi_pixel_clock;
sink->converter_disable_audio = converter_disable_audio; sink->converter_disable_audio = converter_disable_audio;
/* dc_sink_create returns a new reference */
link->local_sink = sink; link->local_sink = sink;
edid_status = dm_helpers_read_local_edid( edid_status = dm_helpers_read_local_edid(
...@@ -2037,6 +2038,9 @@ static enum dc_status enable_link( ...@@ -2037,6 +2038,9 @@ static enum dc_status enable_link(
break; break;
} }
if (status == DC_OK)
pipe_ctx->stream->link->link_status.link_active = true;
return status; return status;
} }
...@@ -2060,6 +2064,14 @@ static void disable_link(struct dc_link *link, enum signal_type signal) ...@@ -2060,6 +2064,14 @@ static void disable_link(struct dc_link *link, enum signal_type signal)
dp_disable_link_phy_mst(link, signal); dp_disable_link_phy_mst(link, signal);
} else } else
link->link_enc->funcs->disable_output(link->link_enc, signal); link->link_enc->funcs->disable_output(link->link_enc, signal);
if (signal == SIGNAL_TYPE_DISPLAY_PORT_MST) {
/* MST disable link only when no stream use the link */
if (link->mst_stream_alloc_table.stream_count <= 0)
link->link_status.link_active = false;
} else {
link->link_status.link_active = false;
}
} }
static bool dp_active_dongle_validate_timing( static bool dp_active_dongle_validate_timing(
...@@ -2623,8 +2635,6 @@ void core_link_enable_stream( ...@@ -2623,8 +2635,6 @@ void core_link_enable_stream(
} }
} }
stream->link->link_status.link_active = true;
core_dc->hwss.enable_audio_stream(pipe_ctx); core_dc->hwss.enable_audio_stream(pipe_ctx);
/* turn off otg test pattern if enable */ /* turn off otg test pattern if enable */
...@@ -2659,8 +2669,6 @@ void core_link_disable_stream(struct pipe_ctx *pipe_ctx, int option) ...@@ -2659,8 +2669,6 @@ void core_link_disable_stream(struct pipe_ctx *pipe_ctx, int option)
core_dc->hwss.disable_stream(pipe_ctx, option); core_dc->hwss.disable_stream(pipe_ctx, option);
disable_link(pipe_ctx->stream->link, pipe_ctx->stream->signal); disable_link(pipe_ctx->stream->link, pipe_ctx->stream->signal);
pipe_ctx->stream->link->link_status.link_active = false;
} }
void core_link_set_avmute(struct pipe_ctx *pipe_ctx, bool enable) void core_link_set_avmute(struct pipe_ctx *pipe_ctx, bool enable)
......
...@@ -724,7 +724,7 @@ static void build_vrr_infopacket_v1(enum signal_type signal, ...@@ -724,7 +724,7 @@ static void build_vrr_infopacket_v1(enum signal_type signal,
static void build_vrr_infopacket_v2(enum signal_type signal, static void build_vrr_infopacket_v2(enum signal_type signal,
const struct mod_vrr_params *vrr, const struct mod_vrr_params *vrr,
const enum color_transfer_func *app_tf, enum color_transfer_func app_tf,
struct dc_info_packet *infopacket) struct dc_info_packet *infopacket)
{ {
unsigned int payload_size = 0; unsigned int payload_size = 0;
...@@ -732,8 +732,7 @@ static void build_vrr_infopacket_v2(enum signal_type signal, ...@@ -732,8 +732,7 @@ static void build_vrr_infopacket_v2(enum signal_type signal,
build_vrr_infopacket_header_v2(signal, infopacket, &payload_size); build_vrr_infopacket_header_v2(signal, infopacket, &payload_size);
build_vrr_infopacket_data(vrr, infopacket); build_vrr_infopacket_data(vrr, infopacket);
if (app_tf != NULL) build_vrr_infopacket_fs2_data(app_tf, infopacket);
build_vrr_infopacket_fs2_data(*app_tf, infopacket);
build_vrr_infopacket_checksum(&payload_size, infopacket); build_vrr_infopacket_checksum(&payload_size, infopacket);
...@@ -757,7 +756,7 @@ void mod_freesync_build_vrr_infopacket(struct mod_freesync *mod_freesync, ...@@ -757,7 +756,7 @@ void mod_freesync_build_vrr_infopacket(struct mod_freesync *mod_freesync,
const struct dc_stream_state *stream, const struct dc_stream_state *stream,
const struct mod_vrr_params *vrr, const struct mod_vrr_params *vrr,
enum vrr_packet_type packet_type, enum vrr_packet_type packet_type,
const enum color_transfer_func *app_tf, enum color_transfer_func app_tf,
struct dc_info_packet *infopacket) struct dc_info_packet *infopacket)
{ {
/* SPD info packet for FreeSync /* SPD info packet for FreeSync
......
...@@ -145,7 +145,7 @@ void mod_freesync_build_vrr_infopacket(struct mod_freesync *mod_freesync, ...@@ -145,7 +145,7 @@ void mod_freesync_build_vrr_infopacket(struct mod_freesync *mod_freesync,
const struct dc_stream_state *stream, const struct dc_stream_state *stream,
const struct mod_vrr_params *vrr, const struct mod_vrr_params *vrr,
enum vrr_packet_type packet_type, enum vrr_packet_type packet_type,
const enum color_transfer_func *app_tf, enum color_transfer_func app_tf,
struct dc_info_packet *infopacket); struct dc_info_packet *infopacket);
void mod_freesync_build_vrr_params(struct mod_freesync *mod_freesync, void mod_freesync_build_vrr_params(struct mod_freesync *mod_freesync,
......
...@@ -277,8 +277,7 @@ int psm_adjust_power_state_dynamic(struct pp_hwmgr *hwmgr, bool skip_display_set ...@@ -277,8 +277,7 @@ int psm_adjust_power_state_dynamic(struct pp_hwmgr *hwmgr, bool skip_display_set
if (!skip_display_settings) if (!skip_display_settings)
phm_notify_smc_display_config_after_ps_adjustment(hwmgr); phm_notify_smc_display_config_after_ps_adjustment(hwmgr);
if ((hwmgr->request_dpm_level != hwmgr->dpm_level) && if (!phm_force_dpm_levels(hwmgr, hwmgr->request_dpm_level))
!phm_force_dpm_levels(hwmgr, hwmgr->request_dpm_level))
hwmgr->dpm_level = hwmgr->request_dpm_level; hwmgr->dpm_level = hwmgr->request_dpm_level;
if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL) { if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL) {
......
...@@ -489,15 +489,16 @@ int pp_atomfwctrl_get_gpio_information(struct pp_hwmgr *hwmgr, ...@@ -489,15 +489,16 @@ int pp_atomfwctrl_get_gpio_information(struct pp_hwmgr *hwmgr,
} }
int pp_atomfwctrl_get_clk_information_by_clkid(struct pp_hwmgr *hwmgr, int pp_atomfwctrl_get_clk_information_by_clkid(struct pp_hwmgr *hwmgr,
uint8_t id, uint32_t *frequency) uint8_t clk_id, uint8_t syspll_id,
uint32_t *frequency)
{ {
struct amdgpu_device *adev = hwmgr->adev; struct amdgpu_device *adev = hwmgr->adev;
struct atom_get_smu_clock_info_parameters_v3_1 parameters; struct atom_get_smu_clock_info_parameters_v3_1 parameters;
struct atom_get_smu_clock_info_output_parameters_v3_1 *output; struct atom_get_smu_clock_info_output_parameters_v3_1 *output;
uint32_t ix; uint32_t ix;
parameters.clk_id = id; parameters.clk_id = clk_id;
parameters.syspll_id = 0; parameters.syspll_id = syspll_id;
parameters.command = GET_SMU_CLOCK_INFO_V3_1_GET_CLOCK_FREQ; parameters.command = GET_SMU_CLOCK_INFO_V3_1_GET_CLOCK_FREQ;
parameters.dfsdid = 0; parameters.dfsdid = 0;
...@@ -530,20 +531,23 @@ static void pp_atomfwctrl_copy_vbios_bootup_values_3_2(struct pp_hwmgr *hwmgr, ...@@ -530,20 +531,23 @@ static void pp_atomfwctrl_copy_vbios_bootup_values_3_2(struct pp_hwmgr *hwmgr,
boot_values->ulSocClk = 0; boot_values->ulSocClk = 0;
boot_values->ulDCEFClk = 0; boot_values->ulDCEFClk = 0;
if (!pp_atomfwctrl_get_clk_information_by_clkid(hwmgr, SMU11_SYSPLL0_SOCCLK_ID, &frequency)) if (!pp_atomfwctrl_get_clk_information_by_clkid(hwmgr, SMU11_SYSPLL0_SOCCLK_ID, SMU11_SYSPLL0_ID, &frequency))
boot_values->ulSocClk = frequency; boot_values->ulSocClk = frequency;
if (!pp_atomfwctrl_get_clk_information_by_clkid(hwmgr, SMU11_SYSPLL0_DCEFCLK_ID, &frequency)) if (!pp_atomfwctrl_get_clk_information_by_clkid(hwmgr, SMU11_SYSPLL0_DCEFCLK_ID, SMU11_SYSPLL0_ID, &frequency))
boot_values->ulDCEFClk = frequency; boot_values->ulDCEFClk = frequency;
if (!pp_atomfwctrl_get_clk_information_by_clkid(hwmgr, SMU11_SYSPLL0_ECLK_ID, &frequency)) if (!pp_atomfwctrl_get_clk_information_by_clkid(hwmgr, SMU11_SYSPLL0_ECLK_ID, SMU11_SYSPLL0_ID, &frequency))
boot_values->ulEClk = frequency; boot_values->ulEClk = frequency;
if (!pp_atomfwctrl_get_clk_information_by_clkid(hwmgr, SMU11_SYSPLL0_VCLK_ID, &frequency)) if (!pp_atomfwctrl_get_clk_information_by_clkid(hwmgr, SMU11_SYSPLL0_VCLK_ID, SMU11_SYSPLL0_ID, &frequency))
boot_values->ulVClk = frequency; boot_values->ulVClk = frequency;
if (!pp_atomfwctrl_get_clk_information_by_clkid(hwmgr, SMU11_SYSPLL0_DCLK_ID, &frequency)) if (!pp_atomfwctrl_get_clk_information_by_clkid(hwmgr, SMU11_SYSPLL0_DCLK_ID, SMU11_SYSPLL0_ID, &frequency))
boot_values->ulDClk = frequency; boot_values->ulDClk = frequency;
if (!pp_atomfwctrl_get_clk_information_by_clkid(hwmgr, SMU11_SYSPLL1_0_FCLK_ID, SMU11_SYSPLL1_2_ID, &frequency))
boot_values->ulFClk = frequency;
} }
static void pp_atomfwctrl_copy_vbios_bootup_values_3_1(struct pp_hwmgr *hwmgr, static void pp_atomfwctrl_copy_vbios_bootup_values_3_1(struct pp_hwmgr *hwmgr,
...@@ -563,19 +567,19 @@ static void pp_atomfwctrl_copy_vbios_bootup_values_3_1(struct pp_hwmgr *hwmgr, ...@@ -563,19 +567,19 @@ static void pp_atomfwctrl_copy_vbios_bootup_values_3_1(struct pp_hwmgr *hwmgr,
boot_values->ulSocClk = 0; boot_values->ulSocClk = 0;
boot_values->ulDCEFClk = 0; boot_values->ulDCEFClk = 0;
if (!pp_atomfwctrl_get_clk_information_by_clkid(hwmgr, SMU9_SYSPLL0_SOCCLK_ID, &frequency)) if (!pp_atomfwctrl_get_clk_information_by_clkid(hwmgr, SMU9_SYSPLL0_SOCCLK_ID, 0, &frequency))
boot_values->ulSocClk = frequency; boot_values->ulSocClk = frequency;
if (!pp_atomfwctrl_get_clk_information_by_clkid(hwmgr, SMU9_SYSPLL0_DCEFCLK_ID, &frequency)) if (!pp_atomfwctrl_get_clk_information_by_clkid(hwmgr, SMU9_SYSPLL0_DCEFCLK_ID, 0, &frequency))
boot_values->ulDCEFClk = frequency; boot_values->ulDCEFClk = frequency;
if (!pp_atomfwctrl_get_clk_information_by_clkid(hwmgr, SMU9_SYSPLL0_ECLK_ID, &frequency)) if (!pp_atomfwctrl_get_clk_information_by_clkid(hwmgr, SMU9_SYSPLL0_ECLK_ID, 0, &frequency))
boot_values->ulEClk = frequency; boot_values->ulEClk = frequency;
if (!pp_atomfwctrl_get_clk_information_by_clkid(hwmgr, SMU9_SYSPLL0_VCLK_ID, &frequency)) if (!pp_atomfwctrl_get_clk_information_by_clkid(hwmgr, SMU9_SYSPLL0_VCLK_ID, 0, &frequency))
boot_values->ulVClk = frequency; boot_values->ulVClk = frequency;
if (!pp_atomfwctrl_get_clk_information_by_clkid(hwmgr, SMU9_SYSPLL0_DCLK_ID, &frequency)) if (!pp_atomfwctrl_get_clk_information_by_clkid(hwmgr, SMU9_SYSPLL0_DCLK_ID, 0, &frequency))
boot_values->ulDClk = frequency; boot_values->ulDClk = frequency;
} }
......
...@@ -139,6 +139,7 @@ struct pp_atomfwctrl_bios_boot_up_values { ...@@ -139,6 +139,7 @@ struct pp_atomfwctrl_bios_boot_up_values {
uint32_t ulEClk; uint32_t ulEClk;
uint32_t ulVClk; uint32_t ulVClk;
uint32_t ulDClk; uint32_t ulDClk;
uint32_t ulFClk;
uint16_t usVddc; uint16_t usVddc;
uint16_t usVddci; uint16_t usVddci;
uint16_t usMvddc; uint16_t usMvddc;
...@@ -236,7 +237,8 @@ int pp_atomfwctrl_get_vbios_bootup_values(struct pp_hwmgr *hwmgr, ...@@ -236,7 +237,8 @@ int pp_atomfwctrl_get_vbios_bootup_values(struct pp_hwmgr *hwmgr,
int pp_atomfwctrl_get_smc_dpm_information(struct pp_hwmgr *hwmgr, int pp_atomfwctrl_get_smc_dpm_information(struct pp_hwmgr *hwmgr,
struct pp_atomfwctrl_smc_dpm_parameters *param); struct pp_atomfwctrl_smc_dpm_parameters *param);
int pp_atomfwctrl_get_clk_information_by_clkid(struct pp_hwmgr *hwmgr, int pp_atomfwctrl_get_clk_information_by_clkid(struct pp_hwmgr *hwmgr,
uint8_t id, uint32_t *frequency); uint8_t clk_id, uint8_t syspll_id,
uint32_t *frequency);
#endif #endif
...@@ -2575,10 +2575,10 @@ static int vega10_init_smc_table(struct pp_hwmgr *hwmgr) ...@@ -2575,10 +2575,10 @@ static int vega10_init_smc_table(struct pp_hwmgr *hwmgr)
data->vbios_boot_state.gfx_clock = boot_up_values.ulGfxClk; data->vbios_boot_state.gfx_clock = boot_up_values.ulGfxClk;
data->vbios_boot_state.mem_clock = boot_up_values.ulUClk; data->vbios_boot_state.mem_clock = boot_up_values.ulUClk;
pp_atomfwctrl_get_clk_information_by_clkid(hwmgr, pp_atomfwctrl_get_clk_information_by_clkid(hwmgr,
SMU9_SYSPLL0_SOCCLK_ID, &boot_up_values.ulSocClk); SMU9_SYSPLL0_SOCCLK_ID, 0, &boot_up_values.ulSocClk);
pp_atomfwctrl_get_clk_information_by_clkid(hwmgr, pp_atomfwctrl_get_clk_information_by_clkid(hwmgr,
SMU9_SYSPLL0_DCEFCLK_ID, &boot_up_values.ulDCEFClk); SMU9_SYSPLL0_DCEFCLK_ID, 0, &boot_up_values.ulDCEFClk);
data->vbios_boot_state.soc_clock = boot_up_values.ulSocClk; data->vbios_boot_state.soc_clock = boot_up_values.ulSocClk;
data->vbios_boot_state.dcef_clock = boot_up_values.ulDCEFClk; data->vbios_boot_state.dcef_clock = boot_up_values.ulDCEFClk;
...@@ -4407,9 +4407,9 @@ static int vega10_set_ppfeature_status(struct pp_hwmgr *hwmgr, uint64_t new_ppfe ...@@ -4407,9 +4407,9 @@ static int vega10_set_ppfeature_status(struct pp_hwmgr *hwmgr, uint64_t new_ppfe
return ret; return ret;
features_to_disable = features_to_disable =
(features_enabled ^ new_ppfeature_masks) & features_enabled; features_enabled & ~new_ppfeature_masks;
features_to_enable = features_to_enable =
(features_enabled ^ new_ppfeature_masks) ^ features_to_disable; ~features_enabled & new_ppfeature_masks;
pr_debug("features_to_disable 0x%llx\n", features_to_disable); pr_debug("features_to_disable 0x%llx\n", features_to_disable);
pr_debug("features_to_enable 0x%llx\n", features_to_enable); pr_debug("features_to_enable 0x%llx\n", features_to_enable);
......
...@@ -2009,9 +2009,9 @@ static int vega12_set_ppfeature_status(struct pp_hwmgr *hwmgr, uint64_t new_ppfe ...@@ -2009,9 +2009,9 @@ static int vega12_set_ppfeature_status(struct pp_hwmgr *hwmgr, uint64_t new_ppfe
return ret; return ret;
features_to_disable = features_to_disable =
(features_enabled ^ new_ppfeature_masks) & features_enabled; features_enabled & ~new_ppfeature_masks;
features_to_enable = features_to_enable =
(features_enabled ^ new_ppfeature_masks) ^ features_to_disable; ~features_enabled & new_ppfeature_masks;
pr_debug("features_to_disable 0x%llx\n", features_to_disable); pr_debug("features_to_disable 0x%llx\n", features_to_disable);
pr_debug("features_to_enable 0x%llx\n", features_to_enable); pr_debug("features_to_enable 0x%llx\n", features_to_enable);
......
...@@ -42,6 +42,8 @@ ...@@ -42,6 +42,8 @@
#define AVFS_CURVE 0 #define AVFS_CURVE 0
#define OD8_HOTCURVE_TEMPERATURE 85 #define OD8_HOTCURVE_TEMPERATURE 85
#define VG20_CLOCK_MAX_DEFAULT 0xFFFF
typedef uint32_t PP_Clock; typedef uint32_t PP_Clock;
enum { enum {
...@@ -219,6 +221,7 @@ struct vega20_vbios_boot_state { ...@@ -219,6 +221,7 @@ struct vega20_vbios_boot_state {
uint32_t eclock; uint32_t eclock;
uint32_t dclock; uint32_t dclock;
uint32_t vclock; uint32_t vclock;
uint32_t fclock;
}; };
#define DPMTABLE_OD_UPDATE_SCLK 0x00000001 #define DPMTABLE_OD_UPDATE_SCLK 0x00000001
...@@ -523,6 +526,10 @@ struct vega20_hwmgr { ...@@ -523,6 +526,10 @@ struct vega20_hwmgr {
unsigned long metrics_time; unsigned long metrics_time;
SmuMetrics_t metrics_table; SmuMetrics_t metrics_table;
bool pcie_parameters_override;
uint32_t pcie_gen_level1;
uint32_t pcie_width_level1;
}; };
#define VEGA20_DPM2_NEAR_TDP_DEC 10 #define VEGA20_DPM2_NEAR_TDP_DEC 10
......
...@@ -2330,6 +2330,7 @@ static uint32_t polaris10_get_offsetof(uint32_t type, uint32_t member) ...@@ -2330,6 +2330,7 @@ static uint32_t polaris10_get_offsetof(uint32_t type, uint32_t member)
case DRAM_LOG_BUFF_SIZE: case DRAM_LOG_BUFF_SIZE:
return offsetof(SMU74_SoftRegisters, DRAM_LOG_BUFF_SIZE); return offsetof(SMU74_SoftRegisters, DRAM_LOG_BUFF_SIZE);
} }
break;
case SMU_Discrete_DpmTable: case SMU_Discrete_DpmTable:
switch (member) { switch (member) {
case UvdBootLevel: case UvdBootLevel:
...@@ -2339,6 +2340,7 @@ static uint32_t polaris10_get_offsetof(uint32_t type, uint32_t member) ...@@ -2339,6 +2340,7 @@ static uint32_t polaris10_get_offsetof(uint32_t type, uint32_t member)
case LowSclkInterruptThreshold: case LowSclkInterruptThreshold:
return offsetof(SMU74_Discrete_DpmTable, LowSclkInterruptThreshold); return offsetof(SMU74_Discrete_DpmTable, LowSclkInterruptThreshold);
} }
break;
} }
pr_warn("can't get the offset of type %x member %x\n", type, member); pr_warn("can't get the offset of type %x member %x\n", type, member);
return 0; return 0;
......
...@@ -40,10 +40,8 @@ bool smu9_is_smc_ram_running(struct pp_hwmgr *hwmgr) ...@@ -40,10 +40,8 @@ bool smu9_is_smc_ram_running(struct pp_hwmgr *hwmgr)
struct amdgpu_device *adev = hwmgr->adev; struct amdgpu_device *adev = hwmgr->adev;
uint32_t mp1_fw_flags; uint32_t mp1_fw_flags;
WREG32_SOC15(NBIF, 0, mmPCIE_INDEX2, mp1_fw_flags = RREG32_PCIE(MP1_Public |
(MP1_Public | (smnMP1_FIRMWARE_FLAGS & 0xffffffff))); (smnMP1_FIRMWARE_FLAGS & 0xffffffff));
mp1_fw_flags = RREG32_SOC15(NBIF, 0, mmPCIE_DATA2);
if (mp1_fw_flags & MP1_FIRMWARE_FLAGS__INTERRUPTS_ENABLED_MASK) if (mp1_fw_flags & MP1_FIRMWARE_FLAGS__INTERRUPTS_ENABLED_MASK)
return true; return true;
......
...@@ -49,10 +49,8 @@ static bool vega20_is_smc_ram_running(struct pp_hwmgr *hwmgr) ...@@ -49,10 +49,8 @@ static bool vega20_is_smc_ram_running(struct pp_hwmgr *hwmgr)
struct amdgpu_device *adev = hwmgr->adev; struct amdgpu_device *adev = hwmgr->adev;
uint32_t mp1_fw_flags; uint32_t mp1_fw_flags;
WREG32_SOC15(NBIF, 0, mmPCIE_INDEX2, mp1_fw_flags = RREG32_PCIE(MP1_Public |
(MP1_Public | (smnMP1_FIRMWARE_FLAGS & 0xffffffff))); (smnMP1_FIRMWARE_FLAGS & 0xffffffff));
mp1_fw_flags = RREG32_SOC15(NBIF, 0, mmPCIE_DATA2);
if ((mp1_fw_flags & MP1_FIRMWARE_FLAGS__INTERRUPTS_ENABLED_MASK) >> if ((mp1_fw_flags & MP1_FIRMWARE_FLAGS__INTERRUPTS_ENABLED_MASK) >>
MP1_FIRMWARE_FLAGS__INTERRUPTS_ENABLED__SHIFT) MP1_FIRMWARE_FLAGS__INTERRUPTS_ENABLED__SHIFT)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment