]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/amd/display: DC VM Fixes
authorEryk Brol <eryk.brol@amd.com>
Mon, 21 Jan 2019 19:40:16 +0000 (14:40 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 6 Feb 2019 18:30:12 +0000 (13:30 -0500)
[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>
drivers/gpu/drm/amd/display/dc/core/dc.c
drivers/gpu/drm/amd/display/dc/core/dc_vm_helper.c
drivers/gpu/drm/amd/display/dc/dc.h
drivers/gpu/drm/amd/display/dc/inc/vm_helper.h

index 409097cf58ed9f4ec312cbf3ad24d5033da8214f..af5f486d24e0ab38dd7edc554ae8702a43cf57d7 100644 (file)
@@ -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__);
index e54b8ac339b2b0a3589f8a97a49ddc16db75f106..6ce87b682a324e4eda8547d29509e25ec49a72a4 100644 (file)
@@ -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);
 }
index ee2c7e5b6087f977894dcf3d7f50cc54b5fb8aa9..2224bba914ec6aec75094f9dff46cf5ba522dcdf 100644 (file)
@@ -265,7 +265,6 @@ struct dc_debug_data {
        uint32_t auxErrorCount;
 };
 
-
 struct dc_state;
 struct resource_pool;
 struct dce_hwseq;
index a202206e22a3c8aea2b0f360f15fbaeacbb0428c..193407f76a80e5913283dd54118a124f54c7d587 100644 (file)
@@ -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);