Commit 00fbeb4e authored by Eryk Brol's avatar Eryk Brol Committed by Alex Deucher

drm/amd/display: DC VM Fixes

[Why]
VM_helper needs to be intialized with the dc struct in order to fix
an unallocated memory issue. System aperture settings should be
initialized to 0 and guarded with a check to make sure vm_config
is valid.

[How]
Allocate and free memory for vm_helper with other dc members.
Check whether the vm_config valid bit is set before initializing
aperture settings.
Signed-off-by: default avatarEryk Brol <eryk.brol@amd.com>
Reviewed-by: default avatarJun Lei <Jun.Lei@amd.com>
Acked-by: default avatarBhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent b9d4b330
......@@ -621,7 +621,6 @@ static bool construct(struct dc *dc,
#endif
enum dce_version dc_version = DCE_VERSION_UNKNOWN;
dc_dceip = kzalloc(sizeof(*dc_dceip), GFP_KERNEL);
if (!dc_dceip) {
dm_error("%s: failed to create dceip\n", __func__);
......
......@@ -112,16 +112,12 @@ uint8_t get_vmid_for_ptb(struct vm_helper *vm_helper, int64_t ptb, uint8_t hubp_
return vmid;
}
struct vm_helper init_vm_helper(unsigned int num_vmid, unsigned int num_hubp)
void init_vm_helper(struct vm_helper *vm_helper, unsigned int num_vmid, unsigned int num_hubp)
{
static uint64_t ptb_assigned_to_vmid[MAX_VMID];
static struct vmid_usage hubp_vmid_usage[MAX_HUBP];
return (struct vm_helper){
.num_vmid = num_vmid,
.num_hubp = num_hubp,
.num_vmids_available = num_vmid - 1,
.ptb_assigned_to_vmid = ptb_assigned_to_vmid,
.hubp_vmid_usage = hubp_vmid_usage
};
vm_helper->num_vmid = num_vmid;
vm_helper->num_hubp = num_hubp;
vm_helper->num_vmids_available = num_vmid - 1;
memset(vm_helper->hubp_vmid_usage, 0, sizeof(vm_helper->hubp_vmid_usage[0]) * MAX_HUBP);
memset(vm_helper->ptb_assigned_to_vmid, 0, sizeof(vm_helper->ptb_assigned_to_vmid[0]) * MAX_VMID);
}
......@@ -265,7 +265,6 @@ struct dc_debug_data {
uint32_t auxErrorCount;
};
struct dc_state;
struct resource_pool;
struct dce_hwseq;
......
......@@ -39,8 +39,8 @@ struct vm_helper {
unsigned int num_vmid;
unsigned int num_hubp;
unsigned int num_vmids_available;
uint64_t *ptb_assigned_to_vmid;
struct vmid_usage *hubp_vmid_usage;
uint64_t ptb_assigned_to_vmid[MAX_VMID];
struct vmid_usage hubp_vmid_usage[MAX_HUBP];
};
uint8_t get_vmid_for_ptb(
......@@ -48,7 +48,8 @@ uint8_t get_vmid_for_ptb(
int64_t ptb,
uint8_t pipe_idx);
struct vm_helper init_vm_helper(
void init_vm_helper(
struct vm_helper *vm_helper,
unsigned int num_vmid,
unsigned int num_hubp);
......
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