tegra: hwpm: fix kernel crash on TOT

Currently on TOT, stream buffer map functions results in kernel crash.
The kernel crash is an effect of incorrect conditions in the mapping
function. Fix the code logic to use correct kernel version conditions to
use appropriate DMA buffer structures.

Bug 3893741

Change-Id: I3888ec01fdb2025f6d9c3a22296ca9d1abbcadb0
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
(cherry picked from commit 5a3476cfb6574eb5ace29801a4f428ce9d694ce9)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/2853211
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Vedashree Vidwans
2023-01-24 23:19:15 -08:00
committed by mobile promotions
parent d782c9ee5b
commit dd4f96e5c9
2 changed files with 12 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -15,11 +15,11 @@
#define TEGRA_HWPM_OS_LINUX_MEM_MGMT_UTILS_H
#include <linux/types.h>
#if defined(CONFIG_TEGRA_HWPM_OOT)
#include <linux/version.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
#include <linux/iosys-map.h>
#else
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)
#include <linux/dma-buf-map.h>
#endif
#endif
@@ -46,10 +46,10 @@ struct tegra_hwpm_mem_mgmt {
struct dma_buf *mem_bytes_dma_buf;
struct dma_buf_attachment *mem_bytes_attach;
void *mem_bytes_kernel;
#if defined(CONFIG_TEGRA_HWPM_OOT)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
struct iosys_map mem_bytes_map;
#else
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)
struct dma_buf_map mem_bytes_map;
#endif
#endif