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