From f14d9a36b76dc0cc13e41508121a61dd7fff59c5 Mon Sep 17 00:00:00 2001 From: rmylavarapu Date: Fri, 6 Sep 2019 12:16:19 +0530 Subject: [PATCH] nvgpu: gpu: Changes in therm_channel table parsing -As auto profile support only GPU class therm devices, we need to have a check in therm channel tables to parse only GPU class device table. NVGPU-4008 Change-Id: I2bade2899e43659f754879ed635cf1ead17b3386 Signed-off-by: rmylavarapu Reviewed-on: https://git-master.nvidia.com/r/2191526 Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Mahantesh Kumbar GVS: Gerrit_Virtual_Submit Reviewed-by: Vijayakumar Subbu Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/pmu/therm/thrmchannel.c | 6 ++++++ drivers/gpu/nvgpu/common/pmu/therm/thrmdev.c | 6 ++++++ drivers/gpu/nvgpu/common/pmu/therm/thrmdev.h | 3 ++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/nvgpu/common/pmu/therm/thrmchannel.c b/drivers/gpu/nvgpu/common/pmu/therm/thrmchannel.c index 0ae827d07..0e6319088 100644 --- a/drivers/gpu/nvgpu/common/pmu/therm/thrmchannel.c +++ b/drivers/gpu/nvgpu/common/pmu/therm/thrmchannel.c @@ -29,6 +29,7 @@ #include #include "thrmchannel.h" +#include "thrmdev.h" #include "thrm.h" static int _therm_channel_pmudatainit_device(struct gk20a *g, @@ -182,6 +183,11 @@ static int devinit_get_therm_channel_table(struct gk20a *g, } therm_channel_data.device.therm_dev_idx = therm_channel_table_entry->param0; + /* Check for valid therm device index */ + if (!nvgpu_therm_dev_idx_is_valid(g->pmu->therm_pmu, + therm_channel_data.device.therm_dev_idx)) { + continue; + } therm_channel_data.device.therm_dev_prov_idx = therm_channel_table_entry->param1; therm_channel_size = sizeof(struct therm_channel_device); diff --git a/drivers/gpu/nvgpu/common/pmu/therm/thrmdev.c b/drivers/gpu/nvgpu/common/pmu/therm/thrmdev.c index 38f7c1b41..e025a2ab8 100644 --- a/drivers/gpu/nvgpu/common/pmu/therm/thrmdev.c +++ b/drivers/gpu/nvgpu/common/pmu/therm/thrmdev.c @@ -32,6 +32,12 @@ #include "thrmdev.h" #include "thrm.h" +bool nvgpu_therm_dev_idx_is_valid(struct therm_pmupstate *therm_pmu, u8 idx) +{ + return boardobjgrp_idxisvalid( + &(therm_pmu->therm_deviceobjs.super.super), idx); +} + static int _therm_device_pmudata_instget(struct gk20a *g, struct nv_pmu_boardobjgrp *pmuboardobjgrp, struct nv_pmu_boardobj **ppboardobjpmudata, diff --git a/drivers/gpu/nvgpu/common/pmu/therm/thrmdev.h b/drivers/gpu/nvgpu/common/pmu/therm/thrmdev.h index 0837087dc..8bbe57b6f 100644 --- a/drivers/gpu/nvgpu/common/pmu/therm/thrmdev.h +++ b/drivers/gpu/nvgpu/common/pmu/therm/thrmdev.h @@ -1,7 +1,7 @@ /* * general thermal device structures & definitions * - * Copyright (c) 2016-2018, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -58,5 +58,6 @@ struct therm_device_hbm2_combined { }; int therm_device_sw_setup(struct gk20a *g); +bool nvgpu_therm_dev_idx_is_valid(struct therm_pmupstate *therm_pmu, u8 idx); #endif /* NVGPU_THERM_THRMDEV_H */