Compare commits

...

4 Commits

Author SHA1 Message Date
Jon Hunter
4b2fd8250d tegra: hwpm: Use conftest for 'struct class' changes
In Linux v6.2, the 'struct class.devnode()' function was updated to take
a 'const struct device *' instead of a 'struct device *'. A test has
been added to the conftest script to check for this and so instead of
relying on kernel version, use the definition generated by conftest to
select the appropriate function to use.

This is beneficial for working with 3rd party Linux kernels that may
have back-ported upstream changes into their kernel and so the kernel
version checks do not work.

Bug 4119327

Change-Id: I751b7401adee7b337192e255253b974cbd803642
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/2991966
Reviewed-by: Vedashree Vidwans <vvidwans@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-10-10 11:54:25 -07:00
Jon Hunter
971645b49c tegra: hwpm: Add compilation flag for iosys-map.h
Determining whether the header file iosys-map.h is present in the kernel
is currently determine by kernel version. However, for Linux v5.15,
iosys-map.h has been backported in order to support simple-framebuffer
for early display. Therefore, we cannot rely on the kernel version to
indicate whether iosys-map is present. This is also true for 3rd party
Linux kernels that backport changes as well. Fix this by adding a
compile time flag, that will be set accordingly by the conftest script
if this header is present.

Bug 4119327
Bug 4228080

Change-Id: I9de07a4615a6c9da504b36750c48e73e200da301
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/2974080
(cherry picked from commit 54ce334474)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/2946966
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-19 06:54:29 -07:00
Vedashree Vidwans
d69752c349 tegra: hwpm: enable video unit profiling
Enable HWPM profiling for VIC, OFA and NVENC video units in external
builds.

Bug 4158291

Change-Id: I09589bbd70de2f1061dc91926f689266f36d062c
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2914401
(cherry picked from commit f8c37a91ff73c951426a679c1b87684c2e38b916)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/2928956
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Vasuki Shankar <vasukis@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
2023-07-06 14:56:59 -07:00
Vedashree Vidwans
6b78463b8a tegra: hwpm: include all ip files
The config flags defined in Kconfig file are not available/used with
OOT kernel builds. To support all kernel versions, HWPM compiles
independent of CONFIG_TEGRA_SOC_HWPM flag. This also applies to
IP config flags which are not supported as well. Hence,
include HWPM IP files irrespective of the IP config flag status.

For OOT builds, use tegra_is_hypervisor_mode() instead of using
static function defined in HWPM driver.

Bug 4061775

Change-Id: Ifab4ad5c7c652a4ad17820a82b363e92280fdd1a
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/2918870
(cherry picked from commit 91d75567c0)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/2928930
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Vasuki Shankar <vasukis@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
2023-07-06 14:56:54 -07:00
5 changed files with 27 additions and 39 deletions

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2022-2023, NVIDIA CORPORATION. All rights reserved.
#
# Tegra SOC HWPM
#
@@ -25,6 +25,7 @@ ccflags-y += -DCONFIG_TEGRA_HWPM_OOT
CONFIG_TEGRA_FUSE_UPSTREAM := y
ccflags-y += -DCONFIG_TEGRA_FUSE_UPSTREAM
LINUXINCLUDE += -I$(srctree.nvconftest)
LINUXINCLUDE += -I$(srctree.hwpm)/include
LINUXINCLUDE += -I$(srctree.hwpm)/drivers/tegra/hwpm/include
LINUXINCLUDE += -I$(srctree.hwpm)/drivers/tegra/hwpm

View File

@@ -52,79 +52,55 @@ CONFIG_TEGRA_HWPM_MINIMAL_IP_ENABLE=y
ccflags-y += -DCONFIG_TEGRA_HWPM_MINIMAL_IP_ENABLE
endif
ifeq ($(CONFIG_TEGRA_GRHOST_NVDLA),y)
ccflags-y += -DCONFIG_T234_HWPM_IP_NVDLA
nvhwpm-t234-objs += hal/t234/ip/nvdla/t234_nvdla.o
endif
ifeq ($(CONFIG_TEGRA_GRHOST_PVA),y)
ccflags-y += -DCONFIG_T234_HWPM_IP_PVA
nvhwpm-t234-objs += hal/t234/ip/pva/t234_pva.o
endif
ifeq ($(CONFIG_NV_TEGRA_MC),y)
ccflags-y += -DCONFIG_T234_HWPM_IP_MSS_CHANNEL
nvhwpm-t234-objs += hal/t234/ip/mss_channel/t234_mss_channel.o
endif
ccflags-y += -DCONFIG_T234_HWPM_IP_NVENC
nvhwpm-t234-objs += hal/t234/ip/nvenc/t234_nvenc.o
ccflags-y += -DCONFIG_T234_HWPM_IP_OFA
nvhwpm-t234-objs += hal/t234/ip/ofa/t234_ofa.o
ccflags-y += -DCONFIG_T234_HWPM_IP_VIC
nvhwpm-t234-objs += hal/t234/ip/vic/t234_vic.o
# Include other IPs if minimal build is not enabled.
ifneq ($(CONFIG_TEGRA_HWPM_MINIMAL_IP_ENABLE),y)
ccflags-y += -DCONFIG_T234_HWPM_IP_DISPLAY
nvhwpm-t234-objs += hal/t234/ip/display/t234_display.o
ifeq ($(CONFIG_TEGRA_GRHOST_ISP),y)
ccflags-y += -DCONFIG_T234_HWPM_IP_ISP
nvhwpm-t234-objs += hal/t234/ip/isp/t234_isp.o
endif
ifeq ($(CONFIG_NVETHERNET),y)
ccflags-y += -DCONFIG_T234_HWPM_IP_MGBE
nvhwpm-t234-objs += hal/t234/ip/mgbe/t234_mgbe.o
endif
ifeq ($(CONFIG_NV_TEGRA_MC),y)
ccflags-y += -DCONFIG_T234_HWPM_IP_MSS_ISO_NISO_HUBS
nvhwpm-t234-objs += hal/t234/ip/mss_iso_niso_hubs/t234_mss_iso_niso_hubs.o
ccflags-y += -DCONFIG_T234_HWPM_IP_MSS_MCF
nvhwpm-t234-objs += hal/t234/ip/mss_mcf/t234_mss_mcf.o
endif
ccflags-y += -DCONFIG_T234_HWPM_IP_MSS_GPU_HUB
nvhwpm-t234-objs += hal/t234/ip/mss_gpu_hub/t234_mss_gpu_hub.o
ifeq ($(CONFIG_TEGRA_GRHOST_NVDEC),y)
ccflags-y += -DCONFIG_T234_HWPM_IP_NVDEC
nvhwpm-t234-objs += hal/t234/ip/nvdec/t234_nvdec.o
endif
ifeq ($(CONFIG_TEGRA_GRHOST_NVENC),y)
ccflags-y += -DCONFIG_T234_HWPM_IP_NVENC
nvhwpm-t234-objs += hal/t234/ip/nvenc/t234_nvenc.o
endif
ifeq ($(CONFIG_TEGRA_GRHOST_OFA),y)
ccflags-y += -DCONFIG_T234_HWPM_IP_OFA
nvhwpm-t234-objs += hal/t234/ip/ofa/t234_ofa.o
endif
ifeq ($(CONFIG_PCIE_TEGRA194),y)
ccflags-y += -DCONFIG_T234_HWPM_IP_PCIE
nvhwpm-t234-objs += hal/t234/ip/pcie/t234_pcie.o
endif
ccflags-y += -DCONFIG_T234_HWPM_IP_SCF
nvhwpm-t234-objs += hal/t234/ip/scf/t234_scf.o
ifeq ($(CONFIG_VIDEO_TEGRA_VI),y)
ccflags-y += -DCONFIG_T234_HWPM_IP_VI
nvhwpm-t234-objs += hal/t234/ip/vi/t234_vi.o
endif
ifeq ($(CONFIG_TEGRA_GRHOST_VIC),y)
ccflags-y += -DCONFIG_T234_HWPM_IP_VIC
nvhwpm-t234-objs += hal/t234/ip/vic/t234_vic.o
endif
endif

View File

@@ -14,6 +14,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <nvidia/conftest.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/module.h>
@@ -50,10 +52,10 @@ static const struct of_device_id tegra_soc_hwpm_of_match[] = {
};
MODULE_DEVICE_TABLE(of, tegra_soc_hwpm_of_match);
#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0))
static char *tegra_hwpm_get_devnode(struct device *dev, umode_t *mode)
#else
#if defined(NV_CLASS_STRUCT_DEVNODE_HAS_CONST_DEV_ARG)
static char *tegra_hwpm_get_devnode(const struct device *dev, umode_t *mode)
#else
static char *tegra_hwpm_get_devnode(struct device *dev, umode_t *mode)
#endif
{
if (!mode) {

View File

@@ -17,9 +17,11 @@
#ifndef TEGRA_HWPM_OS_LINUX_MEM_MGMT_UTILS_H
#define TEGRA_HWPM_OS_LINUX_MEM_MGMT_UTILS_H
#include <nvidia/conftest.h>
#include <linux/types.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
#if defined(NV_LINUX_IOSYS_MAP_H_PRESENT)
#include <linux/iosys-map.h>
#else
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0)
@@ -49,7 +51,7 @@ struct tegra_hwpm_mem_mgmt {
struct dma_buf *mem_bytes_dma_buf;
struct dma_buf_attachment *mem_bytes_attach;
void *mem_bytes_kernel;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
#if defined(NV_LINUX_IOSYS_MAP_H_PRESENT)
struct iosys_map mem_bytes_map;
#else
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0)

View File

@@ -25,6 +25,9 @@
#include <os/linux/driver.h>
#if defined(CONFIG_TEGRA_HWPM_OOT)
#ifdef CONFIG_SOC_TEGRA_PLATFORM_HELPER
#include <soc/tegra/tegra-platform-helper.h>
#endif
#if defined(CONFIG_TEGRA_NEXT1_HWPM)
#include <os/linux/next1_soc_utils.h>
#endif
@@ -139,7 +142,11 @@ bool tegra_hwpm_is_platform_vsp_impl(void)
bool tegra_hwpm_is_hypervisor_mode_impl(void)
{
#ifdef CONFIG_SOC_TEGRA_PLATFORM_HELPER
return tegra_is_hypervisor_mode();
#else
return false;
#endif
}
#else /* !CONFIG_TEGRA_HWPM_OOT */