From 034993b547fd7f259cdacf69b56b0b6820ae6e60 Mon Sep 17 00:00:00 2001 From: Vedashree Vidwans Date: Wed, 14 Jun 2023 09:21:41 -0700 Subject: [PATCH] tegra: hwpm: add hwpm-next, k5.10 support Kernel 5.10 support - Use code from HWPM repo with kernel 5.10 builds. - Add HWPM source files as built-in driver as IP drivers like PVA, DLA are built-in and dependent on HWPM for IP registration. HWPM next chips support - Currently, only HWPM code in the current (public) repo is included in compilation on TOT. This patch includes Makefile from HWPM next repo for next/future chips. Jira THWPM-69 Change-Id: I8f2bbcabf0c01f2b2cbc722c481a1fe83490c76b Signed-off-by: Vedashree Vidwans Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/2921358 Reviewed-by: Adeel Raza GVS: Gerrit_Virtual_Submit --- drivers/tegra/hwpm/Kconfig | 4 +-- drivers/tegra/hwpm/Makefile | 10 +++--- drivers/tegra/hwpm/Makefile.hwpm.sources | 45 ++++++++++++++++++++++++ drivers/tegra/hwpm/Makefile.sources | 18 ---------- 4 files changed, 53 insertions(+), 24 deletions(-) create mode 100644 drivers/tegra/hwpm/Makefile.hwpm.sources delete mode 100644 drivers/tegra/hwpm/Makefile.sources diff --git a/drivers/tegra/hwpm/Kconfig b/drivers/tegra/hwpm/Kconfig index 96f6a42..025146e 100644 --- a/drivers/tegra/hwpm/Kconfig +++ b/drivers/tegra/hwpm/Kconfig @@ -1,6 +1,6 @@ config TEGRA_SOC_HWPM - tristate "Tegra SOC HWPM driver" - default m + bool "Tegra SOC HWPM driver" + default y help The SOC HWPM driver enables performance monitoring for various Tegra IPs. diff --git a/drivers/tegra/hwpm/Makefile b/drivers/tegra/hwpm/Makefile index 5ed0a1a..28d64b3 100644 --- a/drivers/tegra/hwpm/Makefile +++ b/drivers/tegra/hwpm/Makefile @@ -6,6 +6,7 @@ GCOV_PROFILE := y ifeq ($(origin srctree.hwpm), undefined) +# Set HWPM source repo path srctree.hwpm := $(abspath $(shell dirname $(lastword $(MAKEFILE_LIST))))/../../.. endif @@ -15,10 +16,10 @@ ccflags-y += -DCONFIG_TEGRA_SOC_HWPM CONFIG_TEGRA_T234_HWPM := y ccflags-y += -DCONFIG_TEGRA_T234_HWPM -NVHWPM_OBJ = m - # For OOT builds, set required config flags ifeq ($(CONFIG_TEGRA_OOT_MODULE),m) +NVHWPM_OBJ = m + CONFIG_TEGRA_HWPM_OOT := y ccflags-y += -DCONFIG_TEGRA_HWPM_OOT @@ -30,7 +31,8 @@ LINUXINCLUDE += -I$(srctree.hwpm)/drivers/tegra/hwpm/include LINUXINCLUDE += -I$(srctree.hwpm)/drivers/tegra/hwpm else -ccflags-y += -I$(srctree.nvidia)/include +NVHWPM_OBJ = y + ccflags-y += -I$(srctree.hwpm)/include ccflags-y += -I$(srctree.hwpm)/drivers/tegra/hwpm/include ccflags-y += -I$(srctree.hwpm)/drivers/tegra/hwpm @@ -42,7 +44,7 @@ nvhwpm-y := tegra_hwpm_mock.o else # Add required objects to nvhwpm object variable -include $(srctree.hwpm)/drivers/tegra/hwpm/Makefile.sources +include $(srctree.hwpm)/drivers/tegra/hwpm/Makefile.hwpm.sources endif diff --git a/drivers/tegra/hwpm/Makefile.hwpm.sources b/drivers/tegra/hwpm/Makefile.hwpm.sources new file mode 100644 index 0000000..6439481 --- /dev/null +++ b/drivers/tegra/hwpm/Makefile.hwpm.sources @@ -0,0 +1,45 @@ +# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved. +# +# Tegra SOC HWPM Sources +# + +ifeq ($(CONFIG_TEGRA_OOT_MODULE),m) + +srctree.hwpm-next := ${srctree.hwpm} +# Include next sources only if Makefile.hwpm-next.sources exists +ifneq ($(wildcard ${srctree.hwpm-next}/drivers/tegra/hwpm/Makefile.hwpm-next.sources),) +include ${srctree.hwpm-next}/drivers/tegra/hwpm/Makefile.hwpm-next.sources +nvhwpm-objs += ${nvhwpm-next-objs} +endif + +else # Non-OOT kernel + +ifeq ($(origin NV_SOURCE), undefined) +ifeq ($(origin TEGRA_TOP), undefined) +# No reference to hwpm-next repo +else +srctree.hwpm-next := ${TEGRA_TOP}/kernel/hwpm-next +endif +else +srctree.hwpm-next := ${NV_SOURCE}/kernel/hwpm-next +endif +ifneq ($(origin srctree.hwpm-next), undefined) +include ${srctree.hwpm-next}/drivers/tegra/Makefile.hwpm-next.sources +nvhwpm-objs += ${nvhwpm-next-objs} +endif + +endif + +# Include common files +include ${srctree.hwpm}/drivers/tegra/hwpm/Makefile.common.sources +nvhwpm-objs += ${nvhwpm-common-objs} + +# Include linux files +include ${srctree.hwpm}/drivers/tegra/hwpm/Makefile.linux.sources +nvhwpm-objs += ${nvhwpm-linux-objs} + +ifeq ($(CONFIG_TEGRA_T234_HWPM),y) +# Include T234 files +include ${srctree.hwpm}/drivers/tegra/hwpm/Makefile.t234.sources +nvhwpm-objs += ${nvhwpm-t234-objs} +endif diff --git a/drivers/tegra/hwpm/Makefile.sources b/drivers/tegra/hwpm/Makefile.sources deleted file mode 100644 index 1521f55..0000000 --- a/drivers/tegra/hwpm/Makefile.sources +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved. -# -# Tegra SOC HWPM Sources -# - -# Include common files -include $(srctree.hwpm)/drivers/tegra/hwpm/Makefile.common.sources -nvhwpm-objs += ${nvhwpm-common-objs} - -# Include linux files -include $(srctree.hwpm)/drivers/tegra/hwpm/Makefile.linux.sources -nvhwpm-objs += ${nvhwpm-linux-objs} - -ifeq ($(CONFIG_TEGRA_T234_HWPM),y) -# Include T234 files -include $(srctree.hwpm)/drivers/tegra/hwpm/Makefile.t234.sources -nvhwpm-objs += ${nvhwpm-t234-objs} -endif