Skip to content

Commit

Permalink
Merge amd-staging-dkms-5.4 into amd-mainline-dkms-5.4
Browse files Browse the repository at this point in the history
Change-Id: I431a41684e6a76487dffd481def4e69ad09351c5
Signed-off-by: Rui Teng <rui.teng@amd.com>
  • Loading branch information
Rui Teng committed Feb 12, 2020
2 parents cc903d4 + 8c91349 commit 28e973b
Showing 70 changed files with 1,776 additions and 519 deletions.
15 changes: 8 additions & 7 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
Original file line number Diff line number Diff line change
@@ -2353,15 +2353,16 @@ static int amdgpu_device_ip_suspend_phase2(struct amdgpu_device *adev)
}
adev->ip_blocks[i].status.hw = false;
/* handle putting the SMC in the appropriate state */
if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_SMC) {
r = amdgpu_dpm_set_mp1_state(adev, adev->mp1_state);
if (r) {
DRM_ERROR("SMC failed to set mp1 state %d, %d\n",
adev->mp1_state, r);
return r;
if(!amdgpu_sriov_vf(adev)){
if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_SMC) {
r = amdgpu_dpm_set_mp1_state(adev, adev->mp1_state);
if (r) {
DRM_ERROR("SMC failed to set mp1 state %d, %d\n",
adev->mp1_state, r);
return r;
}
}
}

adev->ip_blocks[i].status.hw = false;
}

27 changes: 1 addition & 26 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c
Original file line number Diff line number Diff line change
@@ -52,11 +52,7 @@ static int amdgpu_perf_event_init(struct perf_event *event)
return -ENOENT;

/* update the hw_perf_event struct with config data */
#if defined(HAVE_HW_PERF_EVENT_CONF_MEMBER)
hwc->conf = event->attr.config;
#else
hwc->config = event->attr.config;
#endif

return 0;
}
@@ -78,13 +74,9 @@ static void amdgpu_perf_start(struct perf_event *event, int flags)
switch (pe->pmu_perf_type) {
case PERF_TYPE_AMDGPU_DF:
if (!(flags & PERF_EF_RELOAD))
#if defined(HAVE_HW_PERF_EVENT_CONF_MEMBER)
pe->adev->df.funcs->pmc_start(pe->adev, hwc->conf, 1);
pe->adev->df.funcs->pmc_start(pe->adev, hwc->conf, 0);
#else
pe->adev->df.funcs->pmc_start(pe->adev, hwc->config, 1);

pe->adev->df.funcs->pmc_start(pe->adev, hwc->config, 0);
#endif
break;
default:
break;
@@ -109,13 +101,8 @@ static void amdgpu_perf_read(struct perf_event *event)

switch (pe->pmu_perf_type) {
case PERF_TYPE_AMDGPU_DF:
#if defined(HAVE_HW_PERF_EVENT_CONF_MEMBER)
pe->adev->df.funcs->pmc_get_count(pe->adev, hwc->conf,
&count);
#else
pe->adev->df.funcs->pmc_get_count(pe->adev, hwc->config,
&count);
#endif
break;
default:
count = 0;
@@ -139,11 +126,7 @@ static void amdgpu_perf_stop(struct perf_event *event, int flags)

switch (pe->pmu_perf_type) {
case PERF_TYPE_AMDGPU_DF:
#if defined(HAVE_HW_PERF_EVENT_CONF_MEMBER)
pe->adev->df.funcs->pmc_stop(pe->adev, hwc->conf, 0);
#else
pe->adev->df.funcs->pmc_stop(pe->adev, hwc->config, 0);
#endif
break;
default:
break;
@@ -173,11 +156,7 @@ static int amdgpu_perf_add(struct perf_event *event, int flags)

switch (pe->pmu_perf_type) {
case PERF_TYPE_AMDGPU_DF:
#if defined(HAVE_HW_PERF_EVENT_CONF_MEMBER)
retval = pe->adev->df.funcs->pmc_start(pe->adev, hwc->conf, 1);
#else
retval = pe->adev->df.funcs->pmc_start(pe->adev, hwc->config, 1);
#endif
break;
default:
return 0;
@@ -205,11 +184,7 @@ static void amdgpu_perf_del(struct perf_event *event, int flags)

switch (pe->pmu_perf_type) {
case PERF_TYPE_AMDGPU_DF:
#if defined(HAVE_HW_PERF_EVENT_CONF_MEMBER)
pe->adev->df.funcs->pmc_stop(pe->adev, hwc->conf, 1);
#else
pe->adev->df.funcs->pmc_stop(pe->adev, hwc->config, 1);
#endif
break;
default:
break;
18 changes: 2 additions & 16 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
Original file line number Diff line number Diff line change
@@ -558,7 +558,7 @@ int psp_xgmi_invoke(struct psp_context *psp, uint32_t ta_cmd_id)
return psp_ta_invoke(psp, ta_cmd_id, psp->xgmi_context.session_id);
}

static int psp_xgmi_terminate(struct psp_context *psp)
int psp_xgmi_terminate(struct psp_context *psp)
{
int ret;

@@ -579,7 +579,7 @@ static int psp_xgmi_terminate(struct psp_context *psp)
return 0;
}

static int psp_xgmi_initialize(struct psp_context *psp)
int psp_xgmi_initialize(struct psp_context *psp)
{
struct ta_xgmi_shared_memory *xgmi_cmd;
int ret;
@@ -1420,16 +1420,6 @@ static int psp_load_fw(struct amdgpu_device *adev)
return ret;
}

if (adev->gmc.xgmi.num_physical_nodes > 1) {
ret = psp_xgmi_initialize(psp);
/* Warning the XGMI seesion initialize failure
* Instead of stop driver initialization
*/
if (ret)
dev_err(psp->adev->dev,
"XGMI: Failed to initialize XGMI session\n");
}

if (psp->adev->psp.ta_fw) {
ret = psp_ras_initialize(psp);
if (ret)
@@ -1494,10 +1484,6 @@ static int psp_hw_fini(void *handle)
void *tmr_buf;
void **pptr;

if (adev->gmc.xgmi.num_physical_nodes > 1 &&
psp->xgmi_context.initialized == 1)
psp_xgmi_terminate(psp);

if (psp->adev->psp.ta_fw) {
psp_ras_terminate(psp);
psp_dtm_terminate(psp);
2 changes: 2 additions & 0 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
Original file line number Diff line number Diff line change
@@ -362,6 +362,8 @@ int psp_gpu_reset(struct amdgpu_device *adev);
int psp_update_vcn_sram(struct amdgpu_device *adev, int inst_idx,
uint64_t cmd_gpu_addr, int cmd_size);

int psp_xgmi_initialize(struct psp_context *psp);
int psp_xgmi_terminate(struct psp_context *psp);
int psp_xgmi_invoke(struct psp_context *psp, uint32_t ta_cmd_id);

int psp_ras_invoke(struct psp_context *psp, uint32_t ta_cmd_id);
3 changes: 1 addition & 2 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h
Original file line number Diff line number Diff line change
@@ -179,6 +179,7 @@ struct amdgpu_vcn_inst {
struct amdgpu_irq_src irq;
struct amdgpu_vcn_reg external;
struct amdgpu_bo *dpg_sram_bo;
struct dpg_pause_state pause_state;
void *dpg_sram_cpu_addr;
uint64_t dpg_sram_gpu_addr;
uint32_t *dpg_sram_curr_addr;
@@ -190,8 +191,6 @@ struct amdgpu_vcn {
const struct firmware *fw; /* VCN firmware */
unsigned num_enc_rings;
enum amd_powergating_state cur_state;
struct dpg_pause_state pause_state;

bool indirect_sram;

uint8_t num_vcn_inst;
15 changes: 12 additions & 3 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
Original file line number Diff line number Diff line change
@@ -365,6 +365,13 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev)
return 0;

if (amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_PSP)) {
ret = psp_xgmi_initialize(&adev->psp);
if (ret) {
dev_err(adev->dev,
"XGMI: Failed to initialize xgmi session\n");
return ret;
}

ret = psp_xgmi_get_hive_id(&adev->psp, &adev->gmc.xgmi.hive_id);
if (ret) {
dev_err(adev->dev,
@@ -451,16 +458,16 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev)
return ret;
}

void amdgpu_xgmi_remove_device(struct amdgpu_device *adev)
int amdgpu_xgmi_remove_device(struct amdgpu_device *adev)
{
struct amdgpu_hive_info *hive;

if (!adev->gmc.xgmi.supported)
return;
return -EINVAL;

hive = amdgpu_get_xgmi_hive(adev, 1);
if (!hive)
return;
return -EINVAL;

if (!(hive->number_devices--)) {
amdgpu_xgmi_sysfs_destroy(adev, hive);
@@ -471,6 +478,8 @@ void amdgpu_xgmi_remove_device(struct amdgpu_device *adev)
amdgpu_xgmi_sysfs_rem_dev_info(adev, hive);
mutex_unlock(&hive->hive_lock);
}

return psp_xgmi_terminate(&adev->psp);
}

int amdgpu_xgmi_ras_late_init(struct amdgpu_device *adev)
2 changes: 1 addition & 1 deletion drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ struct amdgpu_hive_info {
struct amdgpu_hive_info *amdgpu_get_xgmi_hive(struct amdgpu_device *adev, int lock);
int amdgpu_xgmi_update_topology(struct amdgpu_hive_info *hive, struct amdgpu_device *adev);
int amdgpu_xgmi_add_device(struct amdgpu_device *adev);
void amdgpu_xgmi_remove_device(struct amdgpu_device *adev);
int amdgpu_xgmi_remove_device(struct amdgpu_device *adev);
int amdgpu_xgmi_set_pstate(struct amdgpu_device *adev, int pstate);
int amdgpu_xgmi_get_hops_count(struct amdgpu_device *adev,
struct amdgpu_device *peer_adev);
14 changes: 8 additions & 6 deletions drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
Original file line number Diff line number Diff line change
@@ -1207,9 +1207,10 @@ static int vcn_v1_0_pause_dpg_mode(struct amdgpu_device *adev,
struct amdgpu_ring *ring;

/* pause/unpause if state is changed */
if (adev->vcn.pause_state.fw_based != new_state->fw_based) {
if (adev->vcn.inst[inst_idx].pause_state.fw_based != new_state->fw_based) {
DRM_DEBUG("dpg pause state changed %d:%d -> %d:%d",
adev->vcn.pause_state.fw_based, adev->vcn.pause_state.jpeg,
adev->vcn.inst[inst_idx].pause_state.fw_based,
adev->vcn.inst[inst_idx].pause_state.jpeg,
new_state->fw_based, new_state->jpeg);

reg_data = RREG32_SOC15(UVD, 0, mmUVD_DPG_PAUSE) &
@@ -1258,13 +1259,14 @@ static int vcn_v1_0_pause_dpg_mode(struct amdgpu_device *adev,
reg_data &= ~UVD_DPG_PAUSE__NJ_PAUSE_DPG_REQ_MASK;
WREG32_SOC15(UVD, 0, mmUVD_DPG_PAUSE, reg_data);
}
adev->vcn.pause_state.fw_based = new_state->fw_based;
adev->vcn.inst[inst_idx].pause_state.fw_based = new_state->fw_based;
}

/* pause/unpause if state is changed */
if (adev->vcn.pause_state.jpeg != new_state->jpeg) {
if (adev->vcn.inst[inst_idx].pause_state.jpeg != new_state->jpeg) {
DRM_DEBUG("dpg pause state changed %d:%d -> %d:%d",
adev->vcn.pause_state.fw_based, adev->vcn.pause_state.jpeg,
adev->vcn.inst[inst_idx].pause_state.fw_based,
adev->vcn.inst[inst_idx].pause_state.jpeg,
new_state->fw_based, new_state->jpeg);

reg_data = RREG32_SOC15(UVD, 0, mmUVD_DPG_PAUSE) &
@@ -1318,7 +1320,7 @@ static int vcn_v1_0_pause_dpg_mode(struct amdgpu_device *adev,
reg_data &= ~UVD_DPG_PAUSE__JPEG_PAUSE_DPG_REQ_MASK;
WREG32_SOC15(UVD, 0, mmUVD_DPG_PAUSE, reg_data);
}
adev->vcn.pause_state.jpeg = new_state->jpeg;
adev->vcn.inst[inst_idx].pause_state.jpeg = new_state->jpeg;
}

return 0;
6 changes: 3 additions & 3 deletions drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c
Original file line number Diff line number Diff line change
@@ -1137,9 +1137,9 @@ static int vcn_v2_0_pause_dpg_mode(struct amdgpu_device *adev,
int ret_code;

/* pause/unpause if state is changed */
if (adev->vcn.pause_state.fw_based != new_state->fw_based) {
if (adev->vcn.inst[inst_idx].pause_state.fw_based != new_state->fw_based) {
DRM_DEBUG("dpg pause state changed %d -> %d",
adev->vcn.pause_state.fw_based, new_state->fw_based);
adev->vcn.inst[inst_idx].pause_state.fw_based, new_state->fw_based);
reg_data = RREG32_SOC15(UVD, 0, mmUVD_DPG_PAUSE) &
(~UVD_DPG_PAUSE__NJ_PAUSE_DPG_ACK_MASK);

@@ -1185,7 +1185,7 @@ static int vcn_v2_0_pause_dpg_mode(struct amdgpu_device *adev,
reg_data &= ~UVD_DPG_PAUSE__NJ_PAUSE_DPG_REQ_MASK;
WREG32_SOC15(UVD, 0, mmUVD_DPG_PAUSE, reg_data);
}
adev->vcn.pause_state.fw_based = new_state->fw_based;
adev->vcn.inst[inst_idx].pause_state.fw_based = new_state->fw_based;
}

return 0;
6 changes: 3 additions & 3 deletions drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c
Original file line number Diff line number Diff line change
@@ -1367,9 +1367,9 @@ static int vcn_v2_5_pause_dpg_mode(struct amdgpu_device *adev,
int ret_code;

/* pause/unpause if state is changed */
if (adev->vcn.pause_state.fw_based != new_state->fw_based) {
if (adev->vcn.inst[inst_idx].pause_state.fw_based != new_state->fw_based) {
DRM_DEBUG("dpg pause state changed %d -> %d",
adev->vcn.pause_state.fw_based, new_state->fw_based);
adev->vcn.inst[inst_idx].pause_state.fw_based, new_state->fw_based);
reg_data = RREG32_SOC15(UVD, inst_idx, mmUVD_DPG_PAUSE) &
(~UVD_DPG_PAUSE__NJ_PAUSE_DPG_ACK_MASK);

@@ -1414,7 +1414,7 @@ static int vcn_v2_5_pause_dpg_mode(struct amdgpu_device *adev,
reg_data &= ~UVD_DPG_PAUSE__NJ_PAUSE_DPG_REQ_MASK;
WREG32_SOC15(UVD, inst_idx, mmUVD_DPG_PAUSE, reg_data);
}
adev->vcn.pause_state.fw_based = new_state->fw_based;
adev->vcn.inst[inst_idx].pause_state.fw_based = new_state->fw_based;
}

return 0;
7 changes: 7 additions & 0 deletions drivers/gpu/drm/amd/amdkfd/kfd_priv.h
Original file line number Diff line number Diff line change
@@ -43,6 +43,7 @@
#include <drm/drm_drv.h>
#include <drm/drm_device.h>
#include <kgd_kfd_interface.h>
#include <linux/swap.h>

#include "amd_shared.h"

@@ -570,6 +571,9 @@ struct queue {
struct kfd_process *process;
struct kfd_dev *device;
void *gws;

/* procfs */
struct kobject kobj;
};

/*
@@ -864,6 +868,7 @@ struct kfd_process {

/* Kobj for our procfs */
struct kobject *kobj;
struct kobject *kobj_queues;
struct attribute attr_pasid;

/* Keep track cwsr init */
@@ -986,6 +991,8 @@ extern struct device *kfd_device;
/* KFD's procfs */
void kfd_procfs_init(void);
void kfd_procfs_shutdown(void);
int kfd_procfs_add_queue(struct queue *q);
void kfd_procfs_del_queue(struct queue *q);

/* Topology */
int kfd_topology_init(void);
Loading

0 comments on commit 28e973b

Please sign in to comment.