Skip to content

Commit bf71bde

Browse files
committed
Merge tag 'amd-drm-fixes-5.14-2021-08-11' of https://gitlab.freedesktop.org/agd5f/linux into drm-fixes
amd-drm-fixes-5.14-2021-08-11: amdgpu: - Yellow carp update - RAS EEPROM fixes - BACO/BOCO fixes - Fix a memory leak in an error path - Freesync fix - VCN harvesting fix - Display fixes Signed-off-by: Dave Airlie <airlied@redhat.com> From: Alex Deucher <alexander.deucher@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20210812022153.4005-1-alexander.deucher@amd.com
2 parents 1648740 + 0cde63a commit bf71bde

12 files changed

Lines changed: 69 additions & 11 deletions

File tree

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

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,46 @@ bool amdgpu_atomfirmware_dynamic_boot_config_supported(struct amdgpu_device *ade
468468
return (fw_cap & ATOM_FIRMWARE_CAP_DYNAMIC_BOOT_CFG_ENABLE) ? true : false;
469469
}
470470

471+
/*
472+
* Helper function to query RAS EEPROM address
473+
*
474+
* @adev: amdgpu_device pointer
475+
*
476+
* Return true if vbios supports ras rom address reporting
477+
*/
478+
bool amdgpu_atomfirmware_ras_rom_addr(struct amdgpu_device *adev, uint8_t* i2c_address)
479+
{
480+
struct amdgpu_mode_info *mode_info = &adev->mode_info;
481+
int index;
482+
u16 data_offset, size;
483+
union firmware_info *firmware_info;
484+
u8 frev, crev;
485+
486+
if (i2c_address == NULL)
487+
return false;
488+
489+
*i2c_address = 0;
490+
491+
index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1,
492+
firmwareinfo);
493+
494+
if (amdgpu_atom_parse_data_header(adev->mode_info.atom_context,
495+
index, &size, &frev, &crev, &data_offset)) {
496+
/* support firmware_info 3.4 + */
497+
if ((frev == 3 && crev >=4) || (frev > 3)) {
498+
firmware_info = (union firmware_info *)
499+
(mode_info->atom_context->bios + data_offset);
500+
*i2c_address = firmware_info->v34.ras_rom_i2c_slave_addr;
501+
}
502+
}
503+
504+
if (*i2c_address != 0)
505+
return true;
506+
507+
return false;
508+
}
509+
510+
471511
union smu_info {
472512
struct atom_smu_info_v3_1 v31;
473513
};

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ int amdgpu_atomfirmware_get_clock_info(struct amdgpu_device *adev);
3636
int amdgpu_atomfirmware_get_gfx_info(struct amdgpu_device *adev);
3737
bool amdgpu_atomfirmware_mem_ecc_supported(struct amdgpu_device *adev);
3838
bool amdgpu_atomfirmware_sram_ecc_supported(struct amdgpu_device *adev);
39+
bool amdgpu_atomfirmware_ras_rom_addr(struct amdgpu_device *adev, uint8_t* i2c_address);
3940
bool amdgpu_atomfirmware_mem_training_supported(struct amdgpu_device *adev);
4041
bool amdgpu_atomfirmware_dynamic_boot_config_supported(struct amdgpu_device *adev);
4142
int amdgpu_atomfirmware_get_fw_reserved_fb_size(struct amdgpu_device *adev);

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,9 @@ int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev)
299299
ip->major, ip->minor,
300300
ip->revision);
301301

302+
if (le16_to_cpu(ip->hw_id) == VCN_HWID)
303+
adev->vcn.num_vcn_inst++;
304+
302305
for (k = 0; k < num_base_address; k++) {
303306
/*
304307
* convert the endianness of base addresses in place,
@@ -385,7 +388,7 @@ void amdgpu_discovery_harvest_ip(struct amdgpu_device *adev)
385388
{
386389
struct binary_header *bhdr;
387390
struct harvest_table *harvest_info;
388-
int i;
391+
int i, vcn_harvest_count = 0;
389392

390393
bhdr = (struct binary_header *)adev->mman.discovery_bin;
391394
harvest_info = (struct harvest_table *)(adev->mman.discovery_bin +
@@ -397,8 +400,7 @@ void amdgpu_discovery_harvest_ip(struct amdgpu_device *adev)
397400

398401
switch (le32_to_cpu(harvest_info->list[i].hw_id)) {
399402
case VCN_HWID:
400-
adev->harvest_ip_mask |= AMD_HARVEST_IP_VCN_MASK;
401-
adev->harvest_ip_mask |= AMD_HARVEST_IP_JPEG_MASK;
403+
vcn_harvest_count++;
402404
break;
403405
case DMU_HWID:
404406
adev->harvest_ip_mask |= AMD_HARVEST_IP_DMU_MASK;
@@ -407,6 +409,10 @@ void amdgpu_discovery_harvest_ip(struct amdgpu_device *adev)
407409
break;
408410
}
409411
}
412+
if (vcn_harvest_count == adev->vcn.num_vcn_inst) {
413+
adev->harvest_ip_mask |= AMD_HARVEST_IP_VCN_MASK;
414+
adev->harvest_ip_mask |= AMD_HARVEST_IP_JPEG_MASK;
415+
}
410416
}
411417

412418
int amdgpu_discovery_get_gfx_info(struct amdgpu_device *adev)

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1571,6 +1571,8 @@ static int amdgpu_pmops_runtime_suspend(struct device *dev)
15711571
pci_ignore_hotplug(pdev);
15721572
pci_set_power_state(pdev, PCI_D3cold);
15731573
drm_dev->switch_power_state = DRM_SWITCH_POWER_DYNAMIC_OFF;
1574+
} else if (amdgpu_device_supports_boco(drm_dev)) {
1575+
/* nothing to do */
15741576
} else if (amdgpu_device_supports_baco(drm_dev)) {
15751577
amdgpu_device_baco_enter(drm_dev);
15761578
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "amdgpu_ras.h"
2727
#include <linux/bits.h>
2828
#include "atom.h"
29+
#include "amdgpu_atomfirmware.h"
2930

3031
#define EEPROM_I2C_TARGET_ADDR_VEGA20 0xA0
3132
#define EEPROM_I2C_TARGET_ADDR_ARCTURUS 0xA8
@@ -96,6 +97,9 @@ static bool __get_eeprom_i2c_addr(struct amdgpu_device *adev,
9697
if (!i2c_addr)
9798
return false;
9899

100+
if (amdgpu_atomfirmware_ras_rom_addr(adev, (uint8_t*)i2c_addr))
101+
return true;
102+
99103
switch (adev->asic_type) {
100104
case CHIP_VEGA20:
101105
*i2c_addr = EEPROM_I2C_TARGET_ADDR_VEGA20;

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9605,7 +9605,12 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm,
96059605
} else if (amdgpu_freesync_vid_mode && aconnector &&
96069606
is_freesync_video_mode(&new_crtc_state->mode,
96079607
aconnector)) {
9608-
set_freesync_fixed_config(dm_new_crtc_state);
9608+
struct drm_display_mode *high_mode;
9609+
9610+
high_mode = get_highest_refresh_rate_mode(aconnector, false);
9611+
if (!drm_mode_equal(&new_crtc_state->mode, high_mode)) {
9612+
set_freesync_fixed_config(dm_new_crtc_state);
9613+
}
96099614
}
96109615

96119616
ret = dm_atomic_get_state(state, &dm_state);

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ static void amdgpu_dm_irq_schedule_work(struct amdgpu_device *adev,
584584
handler_data = container_of(handler_list->next, struct amdgpu_dm_irq_handler_data, list);
585585

586586
/*allocate a new amdgpu_dm_irq_handler_data*/
587-
handler_data_add = kzalloc(sizeof(*handler_data), GFP_KERNEL);
587+
handler_data_add = kzalloc(sizeof(*handler_data), GFP_ATOMIC);
588588
if (!handler_data_add) {
589589
DRM_ERROR("DM_IRQ: failed to allocate irq handler!\n");
590590
return;

drivers/gpu/drm/amd/display/dc/dcn30/dcn30_resource.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1788,7 +1788,6 @@ static bool dcn30_split_stream_for_mpc_or_odm(
17881788
}
17891789
pri_pipe->next_odm_pipe = sec_pipe;
17901790
sec_pipe->prev_odm_pipe = pri_pipe;
1791-
ASSERT(sec_pipe->top_pipe == NULL);
17921791

17931792
if (!sec_pipe->top_pipe)
17941793
sec_pipe->stream_res.opp = pool->opps[pipe_idx];

drivers/gpu/drm/amd/include/atomfirmware.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ struct atom_firmware_info_v3_4 {
590590
uint8_t board_i2c_feature_id; // enum of atom_board_i2c_feature_id_def
591591
uint8_t board_i2c_feature_gpio_id; // i2c id find in gpio_lut data table gpio_id
592592
uint8_t board_i2c_feature_slave_addr;
593-
uint8_t reserved3;
593+
uint8_t ras_rom_i2c_slave_addr;
594594
uint16_t bootup_mvddq_mv;
595595
uint16_t bootup_mvpp_mv;
596596
uint32_t zfbstartaddrin16mb;

drivers/gpu/drm/amd/pm/inc/smu_v13_0_1_pmfw.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ typedef struct {
111111
uint32_t InWhisperMode : 1;
112112
uint32_t spare0 : 1;
113113
uint32_t ZstateStatus : 4;
114-
uint32_t spare1 :12;
114+
uint32_t spare1 : 4;
115+
uint32_t DstateFun : 4;
116+
uint32_t DstateDev : 4;
115117
// MP1_EXT_SCRATCH2
116118
uint32_t P2JobHandler :24;
117119
uint32_t RsmuPmiP2FinishedCnt : 8;

0 commit comments

Comments
 (0)