diff options
author | Eryk Brol <eryk.brol@amd.com> | 2019-01-21 22:40:16 +0300 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2019-02-06 21:30:12 +0300 |
commit | 00fbeb4e2f9eda0ebd57eefdcf25e41958f98fa5 (patch) | |
tree | 16ca74fccf53575c3b022aa7bffc47cdb3981141 /drivers/gpu/drm/amd/display/dc/core/dc_vm_helper.c | |
parent | b9d4b33059b86147bcde8f53ad19b97792837f75 (diff) | |
download | linux-00fbeb4e2f9eda0ebd57eefdcf25e41958f98fa5.tar.xz |
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: Eryk Brol <eryk.brol@amd.com>
Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/display/dc/core/dc_vm_helper.c')
-rw-r--r-- | drivers/gpu/drm/amd/display/dc/core/dc_vm_helper.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_vm_helper.c b/drivers/gpu/drm/amd/display/dc/core/dc_vm_helper.c index e54b8ac339b2..6ce87b682a32 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_vm_helper.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_vm_helper.c @@ -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); } |