From 29d214774458051fa2836c83943b542856184821 Mon Sep 17 00:00:00 2001 From: Vijayakumar Date: Thu, 16 Mar 2017 22:31:09 +0530 Subject: gpu: nvgpu: adapt pwrpolicy code to vbios changes VBIOS might change size of the power policy table and add new fields. So driver should validate a minimum size, not absolute size. Also driver should use header size from data read from vbios to parse the table further. bug 200287822 Change-Id: Ica60de444c3f81cbf61af8684ce4e32ae288188d Signed-off-by: Vijayakumar Reviewed-on: http://git-master/r/1322242 Reviewed-by: svccoveritychecker Reviewed-by: Thomas Fleury GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom Tested-by: Terje Bergstrom --- drivers/gpu/nvgpu/pmgr/pwrpolicy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/gpu/nvgpu/pmgr/pwrpolicy.c') diff --git a/drivers/gpu/nvgpu/pmgr/pwrpolicy.c b/drivers/gpu/nvgpu/pmgr/pwrpolicy.c index 4c007337..c2053469 100644 --- a/drivers/gpu/nvgpu/pmgr/pwrpolicy.c +++ b/drivers/gpu/nvgpu/pmgr/pwrpolicy.c @@ -543,7 +543,7 @@ static u32 devinit_get_pwr_policy_table(struct gk20a *g, goto done; } - if (packed_hdr->table_entry_size != + if (packed_hdr->table_entry_size < VBIOS_POWER_POLICY_3X_ENTRY_SIZE_2E) { status = -EINVAL; goto done; @@ -552,7 +552,7 @@ static u32 devinit_get_pwr_policy_table(struct gk20a *g, /* unpack power policy table header */ devinit_unpack_pwr_policy_header(&hdr, packed_hdr); - ptr += VBIOS_POWER_POLICY_3X_HEADER_SIZE_25; + ptr += (u32)hdr.header_size; for (index = 0; index < hdr.num_table_entries; index++, ptr += (u32)hdr.table_entry_size) { -- cgit v1.2.2