Commit 6b0538da authored by Dave Airlie's avatar Dave Airlie

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

Fixes for 5.2:
- Fix for DMCU firmware issues for stable
- Add missing polaris10 pci id to kfd
- Screen corruption fix on picasso
- Fix for driver reload on vega10
- SR-IOV fixes
- Locking fix in new SMU code
- Compute profile switching fix for KFD
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
From: Alex Deucher <alexdeucher@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190522205425.3657-1-alexander.deucher@amd.com
parents eab007dd 43d8107f
...@@ -877,13 +877,16 @@ static int psp_load_fw(struct amdgpu_device *adev) ...@@ -877,13 +877,16 @@ static int psp_load_fw(struct amdgpu_device *adev)
if (!psp->cmd) if (!psp->cmd)
return -ENOMEM; return -ENOMEM;
ret = amdgpu_bo_create_kernel(adev, PSP_1_MEG, PSP_1_MEG, /* this fw pri bo is not used under SRIOV */
AMDGPU_GEM_DOMAIN_GTT, if (!amdgpu_sriov_vf(psp->adev)) {
&psp->fw_pri_bo, ret = amdgpu_bo_create_kernel(adev, PSP_1_MEG, PSP_1_MEG,
&psp->fw_pri_mc_addr, AMDGPU_GEM_DOMAIN_GTT,
&psp->fw_pri_buf); &psp->fw_pri_bo,
if (ret) &psp->fw_pri_mc_addr,
goto failed; &psp->fw_pri_buf);
if (ret)
goto failed;
}
ret = amdgpu_bo_create_kernel(adev, PSP_FENCE_BUFFER_SIZE, PAGE_SIZE, ret = amdgpu_bo_create_kernel(adev, PSP_FENCE_BUFFER_SIZE, PAGE_SIZE,
AMDGPU_GEM_DOMAIN_VRAM, AMDGPU_GEM_DOMAIN_VRAM,
......
...@@ -626,6 +626,7 @@ static bool gmc_v9_0_keep_stolen_memory(struct amdgpu_device *adev) ...@@ -626,6 +626,7 @@ static bool gmc_v9_0_keep_stolen_memory(struct amdgpu_device *adev)
case CHIP_VEGA10: case CHIP_VEGA10:
return true; return true;
case CHIP_RAVEN: case CHIP_RAVEN:
return (adev->pdev->device == 0x15d8);
case CHIP_VEGA12: case CHIP_VEGA12:
case CHIP_VEGA20: case CHIP_VEGA20:
default: default:
...@@ -812,8 +813,16 @@ static int gmc_v9_0_mc_init(struct amdgpu_device *adev) ...@@ -812,8 +813,16 @@ static int gmc_v9_0_mc_init(struct amdgpu_device *adev)
int chansize, numchan; int chansize, numchan;
int r; int r;
if (amdgpu_emu_mode != 1) if (amdgpu_sriov_vf(adev)) {
/* For Vega10 SR-IOV, vram_width can't be read from ATOM as RAVEN,
* and DF related registers is not readable, seems hardcord is the
* only way to set the correct vram_width
*/
adev->gmc.vram_width = 2048;
} else if (amdgpu_emu_mode != 1) {
adev->gmc.vram_width = amdgpu_atomfirmware_get_vram_width(adev); adev->gmc.vram_width = amdgpu_atomfirmware_get_vram_width(adev);
}
if (!adev->gmc.vram_width) { if (!adev->gmc.vram_width) {
/* hbm memory channel size */ /* hbm memory channel size */
if (adev->flags & AMD_IS_APU) if (adev->flags & AMD_IS_APU)
......
...@@ -730,6 +730,11 @@ static bool soc15_need_reset_on_init(struct amdgpu_device *adev) ...@@ -730,6 +730,11 @@ static bool soc15_need_reset_on_init(struct amdgpu_device *adev)
{ {
u32 sol_reg; u32 sol_reg;
/* Just return false for soc15 GPUs. Reset does not seem to
* be necessary.
*/
return false;
if (adev->flags & AMD_IS_APU) if (adev->flags & AMD_IS_APU)
return false; return false;
......
...@@ -355,6 +355,7 @@ static const struct kfd_deviceid supported_devices[] = { ...@@ -355,6 +355,7 @@ static const struct kfd_deviceid supported_devices[] = {
{ 0x67CF, &polaris10_device_info }, /* Polaris10 */ { 0x67CF, &polaris10_device_info }, /* Polaris10 */
{ 0x67D0, &polaris10_vf_device_info }, /* Polaris10 vf*/ { 0x67D0, &polaris10_vf_device_info }, /* Polaris10 vf*/
{ 0x67DF, &polaris10_device_info }, /* Polaris10 */ { 0x67DF, &polaris10_device_info }, /* Polaris10 */
{ 0x6FDF, &polaris10_device_info }, /* Polaris10 */
{ 0x67E0, &polaris11_device_info }, /* Polaris11 */ { 0x67E0, &polaris11_device_info }, /* Polaris11 */
{ 0x67E1, &polaris11_device_info }, /* Polaris11 */ { 0x67E1, &polaris11_device_info }, /* Polaris11 */
{ 0x67E3, &polaris11_device_info }, /* Polaris11 */ { 0x67E3, &polaris11_device_info }, /* Polaris11 */
...@@ -462,6 +463,7 @@ struct kfd_dev *kgd2kfd_probe(struct kgd_dev *kgd, ...@@ -462,6 +463,7 @@ struct kfd_dev *kgd2kfd_probe(struct kgd_dev *kgd,
kfd->pdev = pdev; kfd->pdev = pdev;
kfd->init_complete = false; kfd->init_complete = false;
kfd->kfd2kgd = f2g; kfd->kfd2kgd = f2g;
atomic_set(&kfd->compute_profile, 0);
mutex_init(&kfd->doorbell_mutex); mutex_init(&kfd->doorbell_mutex);
memset(&kfd->doorbell_available_index, 0, memset(&kfd->doorbell_available_index, 0,
...@@ -1036,6 +1038,21 @@ void kgd2kfd_set_sram_ecc_flag(struct kfd_dev *kfd) ...@@ -1036,6 +1038,21 @@ void kgd2kfd_set_sram_ecc_flag(struct kfd_dev *kfd)
atomic_inc(&kfd->sram_ecc_flag); atomic_inc(&kfd->sram_ecc_flag);
} }
void kfd_inc_compute_active(struct kfd_dev *kfd)
{
if (atomic_inc_return(&kfd->compute_profile) == 1)
amdgpu_amdkfd_set_compute_idle(kfd->kgd, false);
}
void kfd_dec_compute_active(struct kfd_dev *kfd)
{
int count = atomic_dec_return(&kfd->compute_profile);
if (count == 0)
amdgpu_amdkfd_set_compute_idle(kfd->kgd, true);
WARN_ONCE(count < 0, "Compute profile ref. count error");
}
#if defined(CONFIG_DEBUG_FS) #if defined(CONFIG_DEBUG_FS)
/* This function will send a package to HIQ to hang the HWS /* This function will send a package to HIQ to hang the HWS
......
...@@ -811,8 +811,8 @@ static int register_process(struct device_queue_manager *dqm, ...@@ -811,8 +811,8 @@ static int register_process(struct device_queue_manager *dqm,
retval = dqm->asic_ops.update_qpd(dqm, qpd); retval = dqm->asic_ops.update_qpd(dqm, qpd);
if (dqm->processes_count++ == 0) dqm->processes_count++;
amdgpu_amdkfd_set_compute_idle(dqm->dev->kgd, false); kfd_inc_compute_active(dqm->dev);
dqm_unlock(dqm); dqm_unlock(dqm);
...@@ -835,9 +835,8 @@ static int unregister_process(struct device_queue_manager *dqm, ...@@ -835,9 +835,8 @@ static int unregister_process(struct device_queue_manager *dqm,
if (qpd == cur->qpd) { if (qpd == cur->qpd) {
list_del(&cur->list); list_del(&cur->list);
kfree(cur); kfree(cur);
if (--dqm->processes_count == 0) dqm->processes_count--;
amdgpu_amdkfd_set_compute_idle( kfd_dec_compute_active(dqm->dev);
dqm->dev->kgd, true);
goto out; goto out;
} }
} }
...@@ -1539,6 +1538,7 @@ static int process_termination_nocpsch(struct device_queue_manager *dqm, ...@@ -1539,6 +1538,7 @@ static int process_termination_nocpsch(struct device_queue_manager *dqm,
list_del(&cur->list); list_del(&cur->list);
kfree(cur); kfree(cur);
dqm->processes_count--; dqm->processes_count--;
kfd_dec_compute_active(dqm->dev);
break; break;
} }
} }
...@@ -1626,6 +1626,7 @@ static int process_termination_cpsch(struct device_queue_manager *dqm, ...@@ -1626,6 +1626,7 @@ static int process_termination_cpsch(struct device_queue_manager *dqm,
list_del(&cur->list); list_del(&cur->list);
kfree(cur); kfree(cur);
dqm->processes_count--; dqm->processes_count--;
kfd_dec_compute_active(dqm->dev);
break; break;
} }
} }
......
...@@ -279,6 +279,9 @@ struct kfd_dev { ...@@ -279,6 +279,9 @@ struct kfd_dev {
/* SRAM ECC flag */ /* SRAM ECC flag */
atomic_t sram_ecc_flag; atomic_t sram_ecc_flag;
/* Compute Profile ref. count */
atomic_t compute_profile;
}; };
enum kfd_mempool { enum kfd_mempool {
...@@ -978,6 +981,10 @@ int dbgdev_wave_reset_wavefronts(struct kfd_dev *dev, struct kfd_process *p); ...@@ -978,6 +981,10 @@ int dbgdev_wave_reset_wavefronts(struct kfd_dev *dev, struct kfd_process *p);
bool kfd_is_locked(void); bool kfd_is_locked(void);
/* Compute profile */
void kfd_inc_compute_active(struct kfd_dev *dev);
void kfd_dec_compute_active(struct kfd_dev *dev);
/* Debugfs */ /* Debugfs */
#if defined(CONFIG_DEBUG_FS) #if defined(CONFIG_DEBUG_FS)
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "dm_services_types.h" #include "dm_services_types.h"
#include "dc.h" #include "dc.h"
#include "dc/inc/core_types.h" #include "dc/inc/core_types.h"
#include "dal_asic_id.h"
#include "vid.h" #include "vid.h"
#include "amdgpu.h" #include "amdgpu.h"
...@@ -640,7 +641,7 @@ static void amdgpu_dm_fini(struct amdgpu_device *adev) ...@@ -640,7 +641,7 @@ static void amdgpu_dm_fini(struct amdgpu_device *adev)
static int load_dmcu_fw(struct amdgpu_device *adev) static int load_dmcu_fw(struct amdgpu_device *adev)
{ {
const char *fw_name_dmcu; const char *fw_name_dmcu = NULL;
int r; int r;
const struct dmcu_firmware_header_v1_0 *hdr; const struct dmcu_firmware_header_v1_0 *hdr;
...@@ -663,7 +664,14 @@ static int load_dmcu_fw(struct amdgpu_device *adev) ...@@ -663,7 +664,14 @@ static int load_dmcu_fw(struct amdgpu_device *adev)
case CHIP_VEGA20: case CHIP_VEGA20:
return 0; return 0;
case CHIP_RAVEN: case CHIP_RAVEN:
fw_name_dmcu = FIRMWARE_RAVEN_DMCU; if (ASICREV_IS_PICASSO(adev->external_rev_id))
fw_name_dmcu = FIRMWARE_RAVEN_DMCU;
#if defined(CONFIG_DRM_AMD_DC_DCN1_01)
else if (ASICREV_IS_RAVEN2(adev->external_rev_id))
fw_name_dmcu = FIRMWARE_RAVEN_DMCU;
#endif
else
return 0;
break; break;
default: default:
DRM_ERROR("Unsupported ASIC type: 0x%X\n", adev->asic_type); DRM_ERROR("Unsupported ASIC type: 0x%X\n", adev->asic_type);
......
...@@ -138,13 +138,14 @@ ...@@ -138,13 +138,14 @@
#endif #endif
#define RAVEN_UNKNOWN 0xFF #define RAVEN_UNKNOWN 0xFF
#if defined(CONFIG_DRM_AMD_DC_DCN1_01)
#define ASICREV_IS_RAVEN2(eChipRev) ((eChipRev >= RAVEN2_A0) && (eChipRev < 0xF0))
#endif /* DCN1_01 */
#define ASIC_REV_IS_RAVEN(eChipRev) ((eChipRev >= RAVEN_A0) && eChipRev < RAVEN_UNKNOWN) #define ASIC_REV_IS_RAVEN(eChipRev) ((eChipRev >= RAVEN_A0) && eChipRev < RAVEN_UNKNOWN)
#define RAVEN1_F0 0xF0 #define RAVEN1_F0 0xF0
#define ASICREV_IS_RV1_F0(eChipRev) ((eChipRev >= RAVEN1_F0) && (eChipRev < RAVEN_UNKNOWN)) #define ASICREV_IS_RV1_F0(eChipRev) ((eChipRev >= RAVEN1_F0) && (eChipRev < RAVEN_UNKNOWN))
#if defined(CONFIG_DRM_AMD_DC_DCN1_01)
#define ASICREV_IS_PICASSO(eChipRev) ((eChipRev >= PICASSO_A0) && (eChipRev < RAVEN2_A0))
#define ASICREV_IS_RAVEN2(eChipRev) ((eChipRev >= RAVEN2_A0) && (eChipRev < 0xF0))
#endif /* DCN1_01 */
#define FAMILY_RV 142 /* DCN 1*/ #define FAMILY_RV 142 /* DCN 1*/
......
...@@ -280,7 +280,7 @@ int smu_feature_set_supported(struct smu_context *smu, int feature_id, ...@@ -280,7 +280,7 @@ int smu_feature_set_supported(struct smu_context *smu, int feature_id,
WARN_ON(feature_id > feature->feature_num); WARN_ON(feature_id > feature->feature_num);
mutex_unlock(&feature->mutex); mutex_lock(&feature->mutex);
if (enable) if (enable)
test_and_set_bit(feature_id, feature->supported); test_and_set_bit(feature_id, feature->supported);
else else
......
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