From 7c1ae11f78e097354f11013d86d1ac861be7c360 Mon Sep 17 00:00:00 2001 From: Vedashree Vidwans Date: Wed, 5 Oct 2022 16:05:20 -0700 Subject: [PATCH] tegra: hwpm: move files to appropriate path HWPM files are copied from the previous source in linux-nvidia repo withgit history. Create folders and move files to obtain expected folder structure. Bug 3787076 Signed-off-by: Vedashree Vidwans --- Kconfig => drivers/tegra/hwpm/Kconfig | 0 Makefile => drivers/tegra/hwpm/Makefile | 0 .../tegra/hwpm/Makefile.common.sources | 0 .../tegra/hwpm/Makefile.linux.sources | 0 .../tegra/hwpm/Makefile.t234.sources | 0 .../tegra/hwpm/common}/allowlist.c | 0 .../tegra/hwpm/common}/aperture.c | 0 {common => drivers/tegra/hwpm/common}/init.c | 0 {common => drivers/tegra/hwpm/common}/ip.c | 0 .../tegra/hwpm/common}/resource.c | 0 .../hal}/t234/hw/t234_addr_map_soc_hwpm.h | 0 .../hwpm/hal}/t234/hw/t234_pmasys_soc_hwpm.h | 0 .../hwpm/hal}/t234/hw/t234_pmmsys_soc_hwpm.h | 0 .../hwpm/hal}/t234/ip/display/t234_display.c | 0 .../hwpm/hal}/t234/ip/display/t234_display.h | 0 .../tegra/hwpm/hal}/t234/ip/isp/t234_isp.c | 0 .../tegra/hwpm/hal}/t234/ip/isp/t234_isp.h | 0 .../tegra/hwpm/hal}/t234/ip/mgbe/t234_mgbe.c | 0 .../tegra/hwpm/hal}/t234/ip/mgbe/t234_mgbe.h | 0 .../t234/ip/mss_channel/t234_mss_channel.c | 0 .../t234/ip/mss_channel/t234_mss_channel.h | 0 .../t234/ip/mss_gpu_hub/t234_mss_gpu_hub.c | 0 .../t234/ip/mss_gpu_hub/t234_mss_gpu_hub.h | 0 .../t234_mss_iso_niso_hubs.c | 0 .../t234_mss_iso_niso_hubs.h | 0 .../hwpm/hal}/t234/ip/mss_mcf/t234_mss_mcf.c | 0 .../hwpm/hal}/t234/ip/mss_mcf/t234_mss_mcf.h | 0 .../hwpm/hal}/t234/ip/nvdec/t234_nvdec.c | 0 .../hwpm/hal}/t234/ip/nvdec/t234_nvdec.h | 0 .../hwpm/hal}/t234/ip/nvdla/t234_nvdla.c | 0 .../hwpm/hal}/t234/ip/nvdla/t234_nvdla.h | 0 .../hwpm/hal}/t234/ip/nvenc/t234_nvenc.c | 0 .../hwpm/hal}/t234/ip/nvenc/t234_nvenc.h | 0 .../tegra/hwpm/hal}/t234/ip/ofa/t234_ofa.c | 0 .../tegra/hwpm/hal}/t234/ip/ofa/t234_ofa.h | 0 .../tegra/hwpm/hal}/t234/ip/pcie/t234_pcie.c | 0 .../tegra/hwpm/hal}/t234/ip/pcie/t234_pcie.h | 0 .../tegra/hwpm/hal}/t234/ip/pma/t234_pma.c | 0 .../tegra/hwpm/hal}/t234/ip/pma/t234_pma.h | 0 .../tegra/hwpm/hal}/t234/ip/pva/t234_pva.c | 0 .../tegra/hwpm/hal}/t234/ip/pva/t234_pva.h | 0 .../tegra/hwpm/hal}/t234/ip/rtr/t234_rtr.c | 0 .../tegra/hwpm/hal}/t234/ip/rtr/t234_rtr.h | 0 .../tegra/hwpm/hal}/t234/ip/scf/t234_scf.c | 0 .../tegra/hwpm/hal}/t234/ip/scf/t234_scf.h | 0 .../tegra/hwpm/hal}/t234/ip/vi/t234_vi.c | 0 .../tegra/hwpm/hal}/t234/ip/vi/t234_vi.h | 0 .../tegra/hwpm/hal}/t234/ip/vic/t234_vic.c | 0 .../tegra/hwpm/hal}/t234/ip/vic/t234_vic.h | 0 .../tegra/hwpm/hal}/t234/t234_aperture.c | 0 .../tegra/hwpm/hal}/t234/t234_init.h | 0 .../tegra/hwpm/hal}/t234/t234_interface.c | 0 .../tegra/hwpm/hal}/t234/t234_internal.h | 0 .../tegra/hwpm/hal}/t234/t234_ip.c | 0 .../tegra/hwpm/hal}/t234/t234_mem_mgmt.c | 0 .../hwpm/hal}/t234/t234_regops_allowlist.c | 0 .../hwpm/hal}/t234/t234_regops_allowlist.h | 0 .../tegra/hwpm/hal}/t234/t234_resource.c | 0 .../tegra/hwpm/include}/tegra_hwpm.h | 0 .../tegra/hwpm/include}/tegra_hwpm_aperture.h | 0 .../tegra/hwpm/include}/tegra_hwpm_clk_rst.h | 0 .../tegra/hwpm/include}/tegra_hwpm_common.h | 0 .../tegra/hwpm/include}/tegra_hwpm_io.h | 0 .../tegra/hwpm/include}/tegra_hwpm_ip.h | 0 .../tegra/hwpm/include}/tegra_hwpm_kmem.h | 0 .../tegra/hwpm/include}/tegra_hwpm_log.h | 0 .../tegra/hwpm/include}/tegra_hwpm_mem_mgmt.h | 0 .../tegra/hwpm/include}/tegra_hwpm_soc.h | 0 .../include}/tegra_hwpm_static_analysis.h | 0 .../tegra/hwpm/include}/tegra_hwpm_timers.h | 0 .../tegra/hwpm/include}/tegra_hwpm_types.h | 0 .../tegra/hwpm/os}/linux/aperture_utils.c | 0 .../tegra/hwpm/os}/linux/aperture_utils.h | 0 .../tegra/hwpm/os}/linux/clk_rst_utils.c | 0 .../tegra/hwpm/os}/linux/clk_rst_utils.h | 0 {os => drivers/tegra/hwpm/os}/linux/debugfs.c | 0 {os => drivers/tegra/hwpm/os}/linux/debugfs.h | 0 {os => drivers/tegra/hwpm/os}/linux/driver.c | 0 {os => drivers/tegra/hwpm/os}/linux/driver.h | 0 .../tegra/hwpm/os}/linux/io_utils.c | 0 .../tegra/hwpm/os}/linux/io_utils.h | 0 {os => drivers/tegra/hwpm/os}/linux/ioctl.c | 0 .../tegra/hwpm/os}/linux/ip_utils.c | 0 .../tegra/hwpm/os}/linux/ip_utils.h | 0 {os => drivers/tegra/hwpm/os}/linux/kmem.c | 0 {os => drivers/tegra/hwpm/os}/linux/kmem.h | 0 {os => drivers/tegra/hwpm/os}/linux/log.c | 0 {os => drivers/tegra/hwpm/os}/linux/log.h | 0 .../tegra/hwpm/os}/linux/mem_mgmt_utils.c | 0 .../tegra/hwpm/os}/linux/mem_mgmt_utils.h | 0 .../tegra/hwpm/os}/linux/regops_utils.c | 0 .../tegra/hwpm/os}/linux/regops_utils.h | 0 .../tegra/hwpm/os}/linux/soc_utils.c | 0 .../tegra/hwpm/os}/linux/soc_utils.h | 0 {os => drivers/tegra/hwpm/os}/linux/timers.c | 0 {os => drivers/tegra/hwpm/os}/linux/timers.h | 0 include/uapi/linux/tegra-soc-hwpm-uapi.h | 500 ++++++++++++++++++ 97 files changed, 500 insertions(+) rename Kconfig => drivers/tegra/hwpm/Kconfig (100%) rename Makefile => drivers/tegra/hwpm/Makefile (100%) rename Makefile.common.sources => drivers/tegra/hwpm/Makefile.common.sources (100%) rename Makefile.linux.sources => drivers/tegra/hwpm/Makefile.linux.sources (100%) rename Makefile.t234.sources => drivers/tegra/hwpm/Makefile.t234.sources (100%) rename {common => drivers/tegra/hwpm/common}/allowlist.c (100%) rename {common => drivers/tegra/hwpm/common}/aperture.c (100%) rename {common => drivers/tegra/hwpm/common}/init.c (100%) rename {common => drivers/tegra/hwpm/common}/ip.c (100%) rename {common => drivers/tegra/hwpm/common}/resource.c (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/hw/t234_addr_map_soc_hwpm.h (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/hw/t234_pmasys_soc_hwpm.h (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/hw/t234_pmmsys_soc_hwpm.h (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/ip/display/t234_display.c (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/ip/display/t234_display.h (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/ip/isp/t234_isp.c (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/ip/isp/t234_isp.h (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/ip/mgbe/t234_mgbe.c (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/ip/mgbe/t234_mgbe.h (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/ip/mss_channel/t234_mss_channel.c (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/ip/mss_channel/t234_mss_channel.h (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/ip/mss_gpu_hub/t234_mss_gpu_hub.c (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/ip/mss_gpu_hub/t234_mss_gpu_hub.h (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/ip/mss_iso_niso_hubs/t234_mss_iso_niso_hubs.c (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/ip/mss_iso_niso_hubs/t234_mss_iso_niso_hubs.h (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/ip/mss_mcf/t234_mss_mcf.c (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/ip/mss_mcf/t234_mss_mcf.h (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/ip/nvdec/t234_nvdec.c (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/ip/nvdec/t234_nvdec.h (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/ip/nvdla/t234_nvdla.c (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/ip/nvdla/t234_nvdla.h (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/ip/nvenc/t234_nvenc.c (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/ip/nvenc/t234_nvenc.h (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/ip/ofa/t234_ofa.c (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/ip/ofa/t234_ofa.h (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/ip/pcie/t234_pcie.c (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/ip/pcie/t234_pcie.h (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/ip/pma/t234_pma.c (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/ip/pma/t234_pma.h (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/ip/pva/t234_pva.c (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/ip/pva/t234_pva.h (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/ip/rtr/t234_rtr.c (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/ip/rtr/t234_rtr.h (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/ip/scf/t234_scf.c (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/ip/scf/t234_scf.h (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/ip/vi/t234_vi.c (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/ip/vi/t234_vi.h (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/ip/vic/t234_vic.c (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/ip/vic/t234_vic.h (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/t234_aperture.c (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/t234_init.h (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/t234_interface.c (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/t234_internal.h (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/t234_ip.c (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/t234_mem_mgmt.c (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/t234_regops_allowlist.c (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/t234_regops_allowlist.h (100%) rename {hal => drivers/tegra/hwpm/hal}/t234/t234_resource.c (100%) rename {include => drivers/tegra/hwpm/include}/tegra_hwpm.h (100%) rename {include => drivers/tegra/hwpm/include}/tegra_hwpm_aperture.h (100%) rename {include => drivers/tegra/hwpm/include}/tegra_hwpm_clk_rst.h (100%) rename {include => drivers/tegra/hwpm/include}/tegra_hwpm_common.h (100%) rename {include => drivers/tegra/hwpm/include}/tegra_hwpm_io.h (100%) rename {include => drivers/tegra/hwpm/include}/tegra_hwpm_ip.h (100%) rename {include => drivers/tegra/hwpm/include}/tegra_hwpm_kmem.h (100%) rename {include => drivers/tegra/hwpm/include}/tegra_hwpm_log.h (100%) rename {include => drivers/tegra/hwpm/include}/tegra_hwpm_mem_mgmt.h (100%) rename {include => drivers/tegra/hwpm/include}/tegra_hwpm_soc.h (100%) rename {include => drivers/tegra/hwpm/include}/tegra_hwpm_static_analysis.h (100%) rename {include => drivers/tegra/hwpm/include}/tegra_hwpm_timers.h (100%) rename {include => drivers/tegra/hwpm/include}/tegra_hwpm_types.h (100%) rename {os => drivers/tegra/hwpm/os}/linux/aperture_utils.c (100%) rename {os => drivers/tegra/hwpm/os}/linux/aperture_utils.h (100%) rename {os => drivers/tegra/hwpm/os}/linux/clk_rst_utils.c (100%) rename {os => drivers/tegra/hwpm/os}/linux/clk_rst_utils.h (100%) rename {os => drivers/tegra/hwpm/os}/linux/debugfs.c (100%) rename {os => drivers/tegra/hwpm/os}/linux/debugfs.h (100%) rename {os => drivers/tegra/hwpm/os}/linux/driver.c (100%) rename {os => drivers/tegra/hwpm/os}/linux/driver.h (100%) rename {os => drivers/tegra/hwpm/os}/linux/io_utils.c (100%) rename {os => drivers/tegra/hwpm/os}/linux/io_utils.h (100%) rename {os => drivers/tegra/hwpm/os}/linux/ioctl.c (100%) rename {os => drivers/tegra/hwpm/os}/linux/ip_utils.c (100%) rename {os => drivers/tegra/hwpm/os}/linux/ip_utils.h (100%) rename {os => drivers/tegra/hwpm/os}/linux/kmem.c (100%) rename {os => drivers/tegra/hwpm/os}/linux/kmem.h (100%) rename {os => drivers/tegra/hwpm/os}/linux/log.c (100%) rename {os => drivers/tegra/hwpm/os}/linux/log.h (100%) rename {os => drivers/tegra/hwpm/os}/linux/mem_mgmt_utils.c (100%) rename {os => drivers/tegra/hwpm/os}/linux/mem_mgmt_utils.h (100%) rename {os => drivers/tegra/hwpm/os}/linux/regops_utils.c (100%) rename {os => drivers/tegra/hwpm/os}/linux/regops_utils.h (100%) rename {os => drivers/tegra/hwpm/os}/linux/soc_utils.c (100%) rename {os => drivers/tegra/hwpm/os}/linux/soc_utils.h (100%) rename {os => drivers/tegra/hwpm/os}/linux/timers.c (100%) rename {os => drivers/tegra/hwpm/os}/linux/timers.h (100%) create mode 100644 include/uapi/linux/tegra-soc-hwpm-uapi.h diff --git a/Kconfig b/drivers/tegra/hwpm/Kconfig similarity index 100% rename from Kconfig rename to drivers/tegra/hwpm/Kconfig diff --git a/Makefile b/drivers/tegra/hwpm/Makefile similarity index 100% rename from Makefile rename to drivers/tegra/hwpm/Makefile diff --git a/Makefile.common.sources b/drivers/tegra/hwpm/Makefile.common.sources similarity index 100% rename from Makefile.common.sources rename to drivers/tegra/hwpm/Makefile.common.sources diff --git a/Makefile.linux.sources b/drivers/tegra/hwpm/Makefile.linux.sources similarity index 100% rename from Makefile.linux.sources rename to drivers/tegra/hwpm/Makefile.linux.sources diff --git a/Makefile.t234.sources b/drivers/tegra/hwpm/Makefile.t234.sources similarity index 100% rename from Makefile.t234.sources rename to drivers/tegra/hwpm/Makefile.t234.sources diff --git a/common/allowlist.c b/drivers/tegra/hwpm/common/allowlist.c similarity index 100% rename from common/allowlist.c rename to drivers/tegra/hwpm/common/allowlist.c diff --git a/common/aperture.c b/drivers/tegra/hwpm/common/aperture.c similarity index 100% rename from common/aperture.c rename to drivers/tegra/hwpm/common/aperture.c diff --git a/common/init.c b/drivers/tegra/hwpm/common/init.c similarity index 100% rename from common/init.c rename to drivers/tegra/hwpm/common/init.c diff --git a/common/ip.c b/drivers/tegra/hwpm/common/ip.c similarity index 100% rename from common/ip.c rename to drivers/tegra/hwpm/common/ip.c diff --git a/common/resource.c b/drivers/tegra/hwpm/common/resource.c similarity index 100% rename from common/resource.c rename to drivers/tegra/hwpm/common/resource.c diff --git a/hal/t234/hw/t234_addr_map_soc_hwpm.h b/drivers/tegra/hwpm/hal/t234/hw/t234_addr_map_soc_hwpm.h similarity index 100% rename from hal/t234/hw/t234_addr_map_soc_hwpm.h rename to drivers/tegra/hwpm/hal/t234/hw/t234_addr_map_soc_hwpm.h diff --git a/hal/t234/hw/t234_pmasys_soc_hwpm.h b/drivers/tegra/hwpm/hal/t234/hw/t234_pmasys_soc_hwpm.h similarity index 100% rename from hal/t234/hw/t234_pmasys_soc_hwpm.h rename to drivers/tegra/hwpm/hal/t234/hw/t234_pmasys_soc_hwpm.h diff --git a/hal/t234/hw/t234_pmmsys_soc_hwpm.h b/drivers/tegra/hwpm/hal/t234/hw/t234_pmmsys_soc_hwpm.h similarity index 100% rename from hal/t234/hw/t234_pmmsys_soc_hwpm.h rename to drivers/tegra/hwpm/hal/t234/hw/t234_pmmsys_soc_hwpm.h diff --git a/hal/t234/ip/display/t234_display.c b/drivers/tegra/hwpm/hal/t234/ip/display/t234_display.c similarity index 100% rename from hal/t234/ip/display/t234_display.c rename to drivers/tegra/hwpm/hal/t234/ip/display/t234_display.c diff --git a/hal/t234/ip/display/t234_display.h b/drivers/tegra/hwpm/hal/t234/ip/display/t234_display.h similarity index 100% rename from hal/t234/ip/display/t234_display.h rename to drivers/tegra/hwpm/hal/t234/ip/display/t234_display.h diff --git a/hal/t234/ip/isp/t234_isp.c b/drivers/tegra/hwpm/hal/t234/ip/isp/t234_isp.c similarity index 100% rename from hal/t234/ip/isp/t234_isp.c rename to drivers/tegra/hwpm/hal/t234/ip/isp/t234_isp.c diff --git a/hal/t234/ip/isp/t234_isp.h b/drivers/tegra/hwpm/hal/t234/ip/isp/t234_isp.h similarity index 100% rename from hal/t234/ip/isp/t234_isp.h rename to drivers/tegra/hwpm/hal/t234/ip/isp/t234_isp.h diff --git a/hal/t234/ip/mgbe/t234_mgbe.c b/drivers/tegra/hwpm/hal/t234/ip/mgbe/t234_mgbe.c similarity index 100% rename from hal/t234/ip/mgbe/t234_mgbe.c rename to drivers/tegra/hwpm/hal/t234/ip/mgbe/t234_mgbe.c diff --git a/hal/t234/ip/mgbe/t234_mgbe.h b/drivers/tegra/hwpm/hal/t234/ip/mgbe/t234_mgbe.h similarity index 100% rename from hal/t234/ip/mgbe/t234_mgbe.h rename to drivers/tegra/hwpm/hal/t234/ip/mgbe/t234_mgbe.h diff --git a/hal/t234/ip/mss_channel/t234_mss_channel.c b/drivers/tegra/hwpm/hal/t234/ip/mss_channel/t234_mss_channel.c similarity index 100% rename from hal/t234/ip/mss_channel/t234_mss_channel.c rename to drivers/tegra/hwpm/hal/t234/ip/mss_channel/t234_mss_channel.c diff --git a/hal/t234/ip/mss_channel/t234_mss_channel.h b/drivers/tegra/hwpm/hal/t234/ip/mss_channel/t234_mss_channel.h similarity index 100% rename from hal/t234/ip/mss_channel/t234_mss_channel.h rename to drivers/tegra/hwpm/hal/t234/ip/mss_channel/t234_mss_channel.h diff --git a/hal/t234/ip/mss_gpu_hub/t234_mss_gpu_hub.c b/drivers/tegra/hwpm/hal/t234/ip/mss_gpu_hub/t234_mss_gpu_hub.c similarity index 100% rename from hal/t234/ip/mss_gpu_hub/t234_mss_gpu_hub.c rename to drivers/tegra/hwpm/hal/t234/ip/mss_gpu_hub/t234_mss_gpu_hub.c diff --git a/hal/t234/ip/mss_gpu_hub/t234_mss_gpu_hub.h b/drivers/tegra/hwpm/hal/t234/ip/mss_gpu_hub/t234_mss_gpu_hub.h similarity index 100% rename from hal/t234/ip/mss_gpu_hub/t234_mss_gpu_hub.h rename to drivers/tegra/hwpm/hal/t234/ip/mss_gpu_hub/t234_mss_gpu_hub.h diff --git a/hal/t234/ip/mss_iso_niso_hubs/t234_mss_iso_niso_hubs.c b/drivers/tegra/hwpm/hal/t234/ip/mss_iso_niso_hubs/t234_mss_iso_niso_hubs.c similarity index 100% rename from hal/t234/ip/mss_iso_niso_hubs/t234_mss_iso_niso_hubs.c rename to drivers/tegra/hwpm/hal/t234/ip/mss_iso_niso_hubs/t234_mss_iso_niso_hubs.c diff --git a/hal/t234/ip/mss_iso_niso_hubs/t234_mss_iso_niso_hubs.h b/drivers/tegra/hwpm/hal/t234/ip/mss_iso_niso_hubs/t234_mss_iso_niso_hubs.h similarity index 100% rename from hal/t234/ip/mss_iso_niso_hubs/t234_mss_iso_niso_hubs.h rename to drivers/tegra/hwpm/hal/t234/ip/mss_iso_niso_hubs/t234_mss_iso_niso_hubs.h diff --git a/hal/t234/ip/mss_mcf/t234_mss_mcf.c b/drivers/tegra/hwpm/hal/t234/ip/mss_mcf/t234_mss_mcf.c similarity index 100% rename from hal/t234/ip/mss_mcf/t234_mss_mcf.c rename to drivers/tegra/hwpm/hal/t234/ip/mss_mcf/t234_mss_mcf.c diff --git a/hal/t234/ip/mss_mcf/t234_mss_mcf.h b/drivers/tegra/hwpm/hal/t234/ip/mss_mcf/t234_mss_mcf.h similarity index 100% rename from hal/t234/ip/mss_mcf/t234_mss_mcf.h rename to drivers/tegra/hwpm/hal/t234/ip/mss_mcf/t234_mss_mcf.h diff --git a/hal/t234/ip/nvdec/t234_nvdec.c b/drivers/tegra/hwpm/hal/t234/ip/nvdec/t234_nvdec.c similarity index 100% rename from hal/t234/ip/nvdec/t234_nvdec.c rename to drivers/tegra/hwpm/hal/t234/ip/nvdec/t234_nvdec.c diff --git a/hal/t234/ip/nvdec/t234_nvdec.h b/drivers/tegra/hwpm/hal/t234/ip/nvdec/t234_nvdec.h similarity index 100% rename from hal/t234/ip/nvdec/t234_nvdec.h rename to drivers/tegra/hwpm/hal/t234/ip/nvdec/t234_nvdec.h diff --git a/hal/t234/ip/nvdla/t234_nvdla.c b/drivers/tegra/hwpm/hal/t234/ip/nvdla/t234_nvdla.c similarity index 100% rename from hal/t234/ip/nvdla/t234_nvdla.c rename to drivers/tegra/hwpm/hal/t234/ip/nvdla/t234_nvdla.c diff --git a/hal/t234/ip/nvdla/t234_nvdla.h b/drivers/tegra/hwpm/hal/t234/ip/nvdla/t234_nvdla.h similarity index 100% rename from hal/t234/ip/nvdla/t234_nvdla.h rename to drivers/tegra/hwpm/hal/t234/ip/nvdla/t234_nvdla.h diff --git a/hal/t234/ip/nvenc/t234_nvenc.c b/drivers/tegra/hwpm/hal/t234/ip/nvenc/t234_nvenc.c similarity index 100% rename from hal/t234/ip/nvenc/t234_nvenc.c rename to drivers/tegra/hwpm/hal/t234/ip/nvenc/t234_nvenc.c diff --git a/hal/t234/ip/nvenc/t234_nvenc.h b/drivers/tegra/hwpm/hal/t234/ip/nvenc/t234_nvenc.h similarity index 100% rename from hal/t234/ip/nvenc/t234_nvenc.h rename to drivers/tegra/hwpm/hal/t234/ip/nvenc/t234_nvenc.h diff --git a/hal/t234/ip/ofa/t234_ofa.c b/drivers/tegra/hwpm/hal/t234/ip/ofa/t234_ofa.c similarity index 100% rename from hal/t234/ip/ofa/t234_ofa.c rename to drivers/tegra/hwpm/hal/t234/ip/ofa/t234_ofa.c diff --git a/hal/t234/ip/ofa/t234_ofa.h b/drivers/tegra/hwpm/hal/t234/ip/ofa/t234_ofa.h similarity index 100% rename from hal/t234/ip/ofa/t234_ofa.h rename to drivers/tegra/hwpm/hal/t234/ip/ofa/t234_ofa.h diff --git a/hal/t234/ip/pcie/t234_pcie.c b/drivers/tegra/hwpm/hal/t234/ip/pcie/t234_pcie.c similarity index 100% rename from hal/t234/ip/pcie/t234_pcie.c rename to drivers/tegra/hwpm/hal/t234/ip/pcie/t234_pcie.c diff --git a/hal/t234/ip/pcie/t234_pcie.h b/drivers/tegra/hwpm/hal/t234/ip/pcie/t234_pcie.h similarity index 100% rename from hal/t234/ip/pcie/t234_pcie.h rename to drivers/tegra/hwpm/hal/t234/ip/pcie/t234_pcie.h diff --git a/hal/t234/ip/pma/t234_pma.c b/drivers/tegra/hwpm/hal/t234/ip/pma/t234_pma.c similarity index 100% rename from hal/t234/ip/pma/t234_pma.c rename to drivers/tegra/hwpm/hal/t234/ip/pma/t234_pma.c diff --git a/hal/t234/ip/pma/t234_pma.h b/drivers/tegra/hwpm/hal/t234/ip/pma/t234_pma.h similarity index 100% rename from hal/t234/ip/pma/t234_pma.h rename to drivers/tegra/hwpm/hal/t234/ip/pma/t234_pma.h diff --git a/hal/t234/ip/pva/t234_pva.c b/drivers/tegra/hwpm/hal/t234/ip/pva/t234_pva.c similarity index 100% rename from hal/t234/ip/pva/t234_pva.c rename to drivers/tegra/hwpm/hal/t234/ip/pva/t234_pva.c diff --git a/hal/t234/ip/pva/t234_pva.h b/drivers/tegra/hwpm/hal/t234/ip/pva/t234_pva.h similarity index 100% rename from hal/t234/ip/pva/t234_pva.h rename to drivers/tegra/hwpm/hal/t234/ip/pva/t234_pva.h diff --git a/hal/t234/ip/rtr/t234_rtr.c b/drivers/tegra/hwpm/hal/t234/ip/rtr/t234_rtr.c similarity index 100% rename from hal/t234/ip/rtr/t234_rtr.c rename to drivers/tegra/hwpm/hal/t234/ip/rtr/t234_rtr.c diff --git a/hal/t234/ip/rtr/t234_rtr.h b/drivers/tegra/hwpm/hal/t234/ip/rtr/t234_rtr.h similarity index 100% rename from hal/t234/ip/rtr/t234_rtr.h rename to drivers/tegra/hwpm/hal/t234/ip/rtr/t234_rtr.h diff --git a/hal/t234/ip/scf/t234_scf.c b/drivers/tegra/hwpm/hal/t234/ip/scf/t234_scf.c similarity index 100% rename from hal/t234/ip/scf/t234_scf.c rename to drivers/tegra/hwpm/hal/t234/ip/scf/t234_scf.c diff --git a/hal/t234/ip/scf/t234_scf.h b/drivers/tegra/hwpm/hal/t234/ip/scf/t234_scf.h similarity index 100% rename from hal/t234/ip/scf/t234_scf.h rename to drivers/tegra/hwpm/hal/t234/ip/scf/t234_scf.h diff --git a/hal/t234/ip/vi/t234_vi.c b/drivers/tegra/hwpm/hal/t234/ip/vi/t234_vi.c similarity index 100% rename from hal/t234/ip/vi/t234_vi.c rename to drivers/tegra/hwpm/hal/t234/ip/vi/t234_vi.c diff --git a/hal/t234/ip/vi/t234_vi.h b/drivers/tegra/hwpm/hal/t234/ip/vi/t234_vi.h similarity index 100% rename from hal/t234/ip/vi/t234_vi.h rename to drivers/tegra/hwpm/hal/t234/ip/vi/t234_vi.h diff --git a/hal/t234/ip/vic/t234_vic.c b/drivers/tegra/hwpm/hal/t234/ip/vic/t234_vic.c similarity index 100% rename from hal/t234/ip/vic/t234_vic.c rename to drivers/tegra/hwpm/hal/t234/ip/vic/t234_vic.c diff --git a/hal/t234/ip/vic/t234_vic.h b/drivers/tegra/hwpm/hal/t234/ip/vic/t234_vic.h similarity index 100% rename from hal/t234/ip/vic/t234_vic.h rename to drivers/tegra/hwpm/hal/t234/ip/vic/t234_vic.h diff --git a/hal/t234/t234_aperture.c b/drivers/tegra/hwpm/hal/t234/t234_aperture.c similarity index 100% rename from hal/t234/t234_aperture.c rename to drivers/tegra/hwpm/hal/t234/t234_aperture.c diff --git a/hal/t234/t234_init.h b/drivers/tegra/hwpm/hal/t234/t234_init.h similarity index 100% rename from hal/t234/t234_init.h rename to drivers/tegra/hwpm/hal/t234/t234_init.h diff --git a/hal/t234/t234_interface.c b/drivers/tegra/hwpm/hal/t234/t234_interface.c similarity index 100% rename from hal/t234/t234_interface.c rename to drivers/tegra/hwpm/hal/t234/t234_interface.c diff --git a/hal/t234/t234_internal.h b/drivers/tegra/hwpm/hal/t234/t234_internal.h similarity index 100% rename from hal/t234/t234_internal.h rename to drivers/tegra/hwpm/hal/t234/t234_internal.h diff --git a/hal/t234/t234_ip.c b/drivers/tegra/hwpm/hal/t234/t234_ip.c similarity index 100% rename from hal/t234/t234_ip.c rename to drivers/tegra/hwpm/hal/t234/t234_ip.c diff --git a/hal/t234/t234_mem_mgmt.c b/drivers/tegra/hwpm/hal/t234/t234_mem_mgmt.c similarity index 100% rename from hal/t234/t234_mem_mgmt.c rename to drivers/tegra/hwpm/hal/t234/t234_mem_mgmt.c diff --git a/hal/t234/t234_regops_allowlist.c b/drivers/tegra/hwpm/hal/t234/t234_regops_allowlist.c similarity index 100% rename from hal/t234/t234_regops_allowlist.c rename to drivers/tegra/hwpm/hal/t234/t234_regops_allowlist.c diff --git a/hal/t234/t234_regops_allowlist.h b/drivers/tegra/hwpm/hal/t234/t234_regops_allowlist.h similarity index 100% rename from hal/t234/t234_regops_allowlist.h rename to drivers/tegra/hwpm/hal/t234/t234_regops_allowlist.h diff --git a/hal/t234/t234_resource.c b/drivers/tegra/hwpm/hal/t234/t234_resource.c similarity index 100% rename from hal/t234/t234_resource.c rename to drivers/tegra/hwpm/hal/t234/t234_resource.c diff --git a/include/tegra_hwpm.h b/drivers/tegra/hwpm/include/tegra_hwpm.h similarity index 100% rename from include/tegra_hwpm.h rename to drivers/tegra/hwpm/include/tegra_hwpm.h diff --git a/include/tegra_hwpm_aperture.h b/drivers/tegra/hwpm/include/tegra_hwpm_aperture.h similarity index 100% rename from include/tegra_hwpm_aperture.h rename to drivers/tegra/hwpm/include/tegra_hwpm_aperture.h diff --git a/include/tegra_hwpm_clk_rst.h b/drivers/tegra/hwpm/include/tegra_hwpm_clk_rst.h similarity index 100% rename from include/tegra_hwpm_clk_rst.h rename to drivers/tegra/hwpm/include/tegra_hwpm_clk_rst.h diff --git a/include/tegra_hwpm_common.h b/drivers/tegra/hwpm/include/tegra_hwpm_common.h similarity index 100% rename from include/tegra_hwpm_common.h rename to drivers/tegra/hwpm/include/tegra_hwpm_common.h diff --git a/include/tegra_hwpm_io.h b/drivers/tegra/hwpm/include/tegra_hwpm_io.h similarity index 100% rename from include/tegra_hwpm_io.h rename to drivers/tegra/hwpm/include/tegra_hwpm_io.h diff --git a/include/tegra_hwpm_ip.h b/drivers/tegra/hwpm/include/tegra_hwpm_ip.h similarity index 100% rename from include/tegra_hwpm_ip.h rename to drivers/tegra/hwpm/include/tegra_hwpm_ip.h diff --git a/include/tegra_hwpm_kmem.h b/drivers/tegra/hwpm/include/tegra_hwpm_kmem.h similarity index 100% rename from include/tegra_hwpm_kmem.h rename to drivers/tegra/hwpm/include/tegra_hwpm_kmem.h diff --git a/include/tegra_hwpm_log.h b/drivers/tegra/hwpm/include/tegra_hwpm_log.h similarity index 100% rename from include/tegra_hwpm_log.h rename to drivers/tegra/hwpm/include/tegra_hwpm_log.h diff --git a/include/tegra_hwpm_mem_mgmt.h b/drivers/tegra/hwpm/include/tegra_hwpm_mem_mgmt.h similarity index 100% rename from include/tegra_hwpm_mem_mgmt.h rename to drivers/tegra/hwpm/include/tegra_hwpm_mem_mgmt.h diff --git a/include/tegra_hwpm_soc.h b/drivers/tegra/hwpm/include/tegra_hwpm_soc.h similarity index 100% rename from include/tegra_hwpm_soc.h rename to drivers/tegra/hwpm/include/tegra_hwpm_soc.h diff --git a/include/tegra_hwpm_static_analysis.h b/drivers/tegra/hwpm/include/tegra_hwpm_static_analysis.h similarity index 100% rename from include/tegra_hwpm_static_analysis.h rename to drivers/tegra/hwpm/include/tegra_hwpm_static_analysis.h diff --git a/include/tegra_hwpm_timers.h b/drivers/tegra/hwpm/include/tegra_hwpm_timers.h similarity index 100% rename from include/tegra_hwpm_timers.h rename to drivers/tegra/hwpm/include/tegra_hwpm_timers.h diff --git a/include/tegra_hwpm_types.h b/drivers/tegra/hwpm/include/tegra_hwpm_types.h similarity index 100% rename from include/tegra_hwpm_types.h rename to drivers/tegra/hwpm/include/tegra_hwpm_types.h diff --git a/os/linux/aperture_utils.c b/drivers/tegra/hwpm/os/linux/aperture_utils.c similarity index 100% rename from os/linux/aperture_utils.c rename to drivers/tegra/hwpm/os/linux/aperture_utils.c diff --git a/os/linux/aperture_utils.h b/drivers/tegra/hwpm/os/linux/aperture_utils.h similarity index 100% rename from os/linux/aperture_utils.h rename to drivers/tegra/hwpm/os/linux/aperture_utils.h diff --git a/os/linux/clk_rst_utils.c b/drivers/tegra/hwpm/os/linux/clk_rst_utils.c similarity index 100% rename from os/linux/clk_rst_utils.c rename to drivers/tegra/hwpm/os/linux/clk_rst_utils.c diff --git a/os/linux/clk_rst_utils.h b/drivers/tegra/hwpm/os/linux/clk_rst_utils.h similarity index 100% rename from os/linux/clk_rst_utils.h rename to drivers/tegra/hwpm/os/linux/clk_rst_utils.h diff --git a/os/linux/debugfs.c b/drivers/tegra/hwpm/os/linux/debugfs.c similarity index 100% rename from os/linux/debugfs.c rename to drivers/tegra/hwpm/os/linux/debugfs.c diff --git a/os/linux/debugfs.h b/drivers/tegra/hwpm/os/linux/debugfs.h similarity index 100% rename from os/linux/debugfs.h rename to drivers/tegra/hwpm/os/linux/debugfs.h diff --git a/os/linux/driver.c b/drivers/tegra/hwpm/os/linux/driver.c similarity index 100% rename from os/linux/driver.c rename to drivers/tegra/hwpm/os/linux/driver.c diff --git a/os/linux/driver.h b/drivers/tegra/hwpm/os/linux/driver.h similarity index 100% rename from os/linux/driver.h rename to drivers/tegra/hwpm/os/linux/driver.h diff --git a/os/linux/io_utils.c b/drivers/tegra/hwpm/os/linux/io_utils.c similarity index 100% rename from os/linux/io_utils.c rename to drivers/tegra/hwpm/os/linux/io_utils.c diff --git a/os/linux/io_utils.h b/drivers/tegra/hwpm/os/linux/io_utils.h similarity index 100% rename from os/linux/io_utils.h rename to drivers/tegra/hwpm/os/linux/io_utils.h diff --git a/os/linux/ioctl.c b/drivers/tegra/hwpm/os/linux/ioctl.c similarity index 100% rename from os/linux/ioctl.c rename to drivers/tegra/hwpm/os/linux/ioctl.c diff --git a/os/linux/ip_utils.c b/drivers/tegra/hwpm/os/linux/ip_utils.c similarity index 100% rename from os/linux/ip_utils.c rename to drivers/tegra/hwpm/os/linux/ip_utils.c diff --git a/os/linux/ip_utils.h b/drivers/tegra/hwpm/os/linux/ip_utils.h similarity index 100% rename from os/linux/ip_utils.h rename to drivers/tegra/hwpm/os/linux/ip_utils.h diff --git a/os/linux/kmem.c b/drivers/tegra/hwpm/os/linux/kmem.c similarity index 100% rename from os/linux/kmem.c rename to drivers/tegra/hwpm/os/linux/kmem.c diff --git a/os/linux/kmem.h b/drivers/tegra/hwpm/os/linux/kmem.h similarity index 100% rename from os/linux/kmem.h rename to drivers/tegra/hwpm/os/linux/kmem.h diff --git a/os/linux/log.c b/drivers/tegra/hwpm/os/linux/log.c similarity index 100% rename from os/linux/log.c rename to drivers/tegra/hwpm/os/linux/log.c diff --git a/os/linux/log.h b/drivers/tegra/hwpm/os/linux/log.h similarity index 100% rename from os/linux/log.h rename to drivers/tegra/hwpm/os/linux/log.h diff --git a/os/linux/mem_mgmt_utils.c b/drivers/tegra/hwpm/os/linux/mem_mgmt_utils.c similarity index 100% rename from os/linux/mem_mgmt_utils.c rename to drivers/tegra/hwpm/os/linux/mem_mgmt_utils.c diff --git a/os/linux/mem_mgmt_utils.h b/drivers/tegra/hwpm/os/linux/mem_mgmt_utils.h similarity index 100% rename from os/linux/mem_mgmt_utils.h rename to drivers/tegra/hwpm/os/linux/mem_mgmt_utils.h diff --git a/os/linux/regops_utils.c b/drivers/tegra/hwpm/os/linux/regops_utils.c similarity index 100% rename from os/linux/regops_utils.c rename to drivers/tegra/hwpm/os/linux/regops_utils.c diff --git a/os/linux/regops_utils.h b/drivers/tegra/hwpm/os/linux/regops_utils.h similarity index 100% rename from os/linux/regops_utils.h rename to drivers/tegra/hwpm/os/linux/regops_utils.h diff --git a/os/linux/soc_utils.c b/drivers/tegra/hwpm/os/linux/soc_utils.c similarity index 100% rename from os/linux/soc_utils.c rename to drivers/tegra/hwpm/os/linux/soc_utils.c diff --git a/os/linux/soc_utils.h b/drivers/tegra/hwpm/os/linux/soc_utils.h similarity index 100% rename from os/linux/soc_utils.h rename to drivers/tegra/hwpm/os/linux/soc_utils.h diff --git a/os/linux/timers.c b/drivers/tegra/hwpm/os/linux/timers.c similarity index 100% rename from os/linux/timers.c rename to drivers/tegra/hwpm/os/linux/timers.c diff --git a/os/linux/timers.h b/drivers/tegra/hwpm/os/linux/timers.h similarity index 100% rename from os/linux/timers.h rename to drivers/tegra/hwpm/os/linux/timers.h diff --git a/include/uapi/linux/tegra-soc-hwpm-uapi.h b/include/uapi/linux/tegra-soc-hwpm-uapi.h new file mode 100644 index 0000000..1be1607 --- /dev/null +++ b/include/uapi/linux/tegra-soc-hwpm-uapi.h @@ -0,0 +1,500 @@ +/* + * Copyright (c) 2021-2022, NVIDIA CORPORATION. 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, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * tegra-soc-hwpm-uapi.h: + * This is the userspace API header for the Tegra SOC HWPM driver. + */ + +#ifndef TEGRA_SOC_HWPM_UAPI_H +#define TEGRA_SOC_HWPM_UAPI_H + +#include +#include + +#define TEGRA_SOC_HWPM_DEV_NODE "/dev/tegra-soc-hwpm" + +/* IPs supported for HW configurations queries */ +enum tegra_soc_hwpm_ip { + TEGRA_SOC_HWPM_IP_VI, + TEGRA_SOC_HWPM_IP_ISP, + TEGRA_SOC_HWPM_IP_VIC, + TEGRA_SOC_HWPM_IP_OFA, + TEGRA_SOC_HWPM_IP_PVA, + TEGRA_SOC_HWPM_IP_NVDLA, + TEGRA_SOC_HWPM_IP_MGBE, + TEGRA_SOC_HWPM_IP_SCF, + TEGRA_SOC_HWPM_IP_NVDEC, + TEGRA_SOC_HWPM_IP_NVENC, + TEGRA_SOC_HWPM_IP_PCIE, + TEGRA_SOC_HWPM_IP_DISPLAY, + TEGRA_SOC_HWPM_IP_MSS_CHANNEL, + TEGRA_SOC_HWPM_IP_MSS_GPU_HUB, + TEGRA_SOC_HWPM_IP_MSS_ISO_NISO_HUBS, + TEGRA_SOC_HWPM_IP_MSS_MCF, + TEGRA_SOC_HWPM_IP_APE, + TERGA_SOC_HWPM_NUM_IPS +}; + +/* TEGRA_CTRL_CMD_SOC_HWPM_DEVICE_INFO IOCTL */ +struct tegra_soc_hwpm_device_info { + __u32 chip; /* chip id, eg. 0x23 (t23x) */ + __u32 chip_revision; /* chip_id revision, eg. 0x4 (t234) */ + __u32 revision; /* major-minor revision, eg. A01, A02 */ + __u32 platform; /* Eg. Pre-Si, Si */ +}; + +/* TEGRA_CTRL_CMD_SOC_HWPM_IP_FLOORSWEEP_INFO IOCTL */ +struct tegra_soc_hwpm_ip_floorsweep_info_query { + /* input */ + __u16 ip; /* enum tegra_soc_hwpm_ip */ + /* output */ +#define TEGRA_SOC_HWPM_IP_STATUS_VALID 0 +#define TEGRA_SOC_HWPM_IP_STATUS_INVALID 1 + __u8 status; /* IP status */ + __u8 reserved1; + __u32 reserved2; + /* + * flattened availability mask of IP elements. + * Each set bit corresponds to available IP element. + */ + __u64 ip_inst_mask; +}; + +#define TEGRA_SOC_HWPM_IP_QUERIES_MAX 32 +struct tegra_soc_hwpm_ip_floorsweep_info { + /* Holds queries */ + struct tegra_soc_hwpm_ip_floorsweep_info_query ip_fsinfo[TEGRA_SOC_HWPM_IP_QUERIES_MAX]; + __u32 num_queries; +}; + +/* The resources which can be reserved for profiling */ +enum tegra_soc_hwpm_resource { + TEGRA_SOC_HWPM_RESOURCE_VI, + TEGRA_SOC_HWPM_RESOURCE_ISP, + TEGRA_SOC_HWPM_RESOURCE_VIC, + TEGRA_SOC_HWPM_RESOURCE_OFA, + TEGRA_SOC_HWPM_RESOURCE_PVA, + TEGRA_SOC_HWPM_RESOURCE_NVDLA, + TEGRA_SOC_HWPM_RESOURCE_MGBE, + TEGRA_SOC_HWPM_RESOURCE_SCF, + TEGRA_SOC_HWPM_RESOURCE_NVDEC, + TEGRA_SOC_HWPM_RESOURCE_NVENC, + TEGRA_SOC_HWPM_RESOURCE_PCIE, + TEGRA_SOC_HWPM_RESOURCE_DISPLAY, + TEGRA_SOC_HWPM_RESOURCE_MSS_CHANNEL, + TEGRA_SOC_HWPM_RESOURCE_MSS_GPU_HUB, + TEGRA_SOC_HWPM_RESOURCE_MSS_ISO_NISO_HUBS, + TEGRA_SOC_HWPM_RESOURCE_MSS_MCF, + + /* + * - SYS0 PERMON in RPG_PMG + * - PERFMUX: PMA_CHANNEL_PERFMUX_CONFIG_SECURE + */ + TEGRA_SOC_HWPM_RESOURCE_PMA, + + /* + * - PMA: Everything except PMA_CHANNEL_PERFMUX_CONFIG_SECURE + * - RTR: Entire aperture + */ + TEGRA_SOC_HWPM_RESOURCE_CMD_SLICE_RTR, + TEGRA_SOC_HWPM_RESOURCE_APE, + + TERGA_SOC_HWPM_NUM_RESOURCES +}; + +/* TEGRA_CTRL_CMD_SOC_HWPM_RESOURCE_INFO IOCTL */ +struct tegra_soc_hwpm_resource_info_query { + /* input */ + __u16 resource; /* enum tegra_soc_hwpm_resource */ + /* output */ +#define TEGRA_SOC_HWPM_RESOURCE_STATUS_INVALID 0 +#define TEGRA_SOC_HWPM_RESOURCE_STATUS_VALID 1 + __u8 status; /* Resource status */ + __u8 reserved1; + __u32 reserved2; +}; + +#define TEGRA_SOC_HWPM_RESOURCE_QUERIES_MAX 32 +struct tegra_soc_hwpm_resource_info { + /* Holds queries */ + struct tegra_soc_hwpm_resource_info_query resource_info[ + TEGRA_SOC_HWPM_RESOURCE_QUERIES_MAX]; + __u32 num_queries; +}; + +/* TEGRA_CTRL_CMD_SOC_HWPM_RESERVE_RESOURCE IOCTL */ +struct tegra_soc_hwpm_reserve_resource { + /* + * Inputs + */ + enum tegra_soc_hwpm_resource resource; +}; + +/* TEGRA_CTRL_CMD_SOC_HWPM_ALLOC_PMA_STREAM IOCTL */ +struct tegra_soc_hwpm_alloc_pma_stream { + /* + * Inputs + */ + __u64 stream_buf_size; + __u64 stream_buf_fd; /* NvRmMemHandle */ + __u64 mem_bytes_buf_fd; /* NvRmMemHandle */ + + /* + * Outputs + */ + __u64 stream_buf_pma_va; /* SMMU mapped VA */ +}; + +/* + * TEGRA_CTRL_CMD_SOC_HWPM_QUERY_ALLOWLIST IOCTL + * + * This IOCTL needs to be called twice. In the first IOCTL call userspace will + * set the allowlist pointer to NULL and the driver will return allowlist_size. + * Userspace will then allocate a buffer to hold allowlist_size entries. In the + * 2nd IOCTL call, userspace will provide the allowlist buffer pointer, and the + * driver will fill in the buffer. + */ +struct tegra_soc_hwpm_query_allowlist { + /* + * Inputs and Outputs + */ + __u64 *allowlist; + + /* + * Outputs + */ + __u64 allowlist_size; /* The number of entires in the map */ +}; + +/* Register read/write op */ +struct tegra_soc_hwpm_reg_op { + __u64 phys_addr; + + /* + * For 32 bit reg-ops this is the value used for reading/writing. + * For 64 bit reg-ops this is the value of the lower register (i.e. phys_addr). + */ + __u32 reg_val_lo; + + /* + * For 32 bit reg-ops this value is unused. + * For 64 bit reg-ops this is the value of the higher register (i.e. phys_addr + 4). + */ + __u32 reg_val_hi; + + /* + * For 32 bit reg-ops this is the mask used for writing. + * For 64 bit reg-ops this is the mask for the lower register (i.e. phys_addr). + */ + __u32 mask_lo; + + /* + * For 32 bit reg-ops this mask is unused. + * For 64 bit reg-ops this is the mask for the higher register (i.e. phys_addr + 4). + */ + __u32 mask_hi; + +/* + * INVALID is first so the default value of 0 is not a valid value. + * User is forced to pick a real value + */ +#define TEGRA_SOC_HWPM_REG_OP_CMD_INVALID 0 +#define TEGRA_SOC_HWPM_REG_OP_CMD_RD32 1 +#define TEGRA_SOC_HWPM_REG_OP_CMD_RD64 2 +#define TEGRA_SOC_HWPM_REG_OP_CMD_WR32 3 +#define TEGRA_SOC_HWPM_REG_OP_CMD_WR64 4 + __u8 cmd; + +/* + * Return RegOps status + */ +#define TEGRA_SOC_HWPM_REG_OP_STATUS_SUCCESS 0 +#define TEGRA_SOC_HWPM_REG_OP_STATUS_INVALID_CMD 1 + /* FIXME: What is this error code for? */ +#define TEGRA_SOC_HWPM_REG_OP_STATUS_INVALID_ADDR 2 + /* not in allowlist */ +#define TEGRA_SOC_HWPM_REG_OP_STATUS_INSUFFICIENT_PERMISSIONS 3 +#define TEGRA_SOC_HWPM_REG_OP_STATUS_WR_FAILED 4 +#define TEGRA_SOC_HWPM_REG_OP_STATUS_RD_FAILED 5 + __u8 status; + + /* Explicit padding for 8 Byte alignment */ + __u8 reserved[6]; +}; + +/* TEGRA_CTRL_CMD_SOC_HWPM_EXEC_REG_OPS IOCTL */ +struct tegra_soc_hwpm_exec_reg_ops { + /* + * Inputs and Outputs + */ +#define TEGRA_SOC_HWPM_REG_OPS_SIZE 127 + struct tegra_soc_hwpm_reg_op ops[TEGRA_SOC_HWPM_REG_OPS_SIZE]; + __u32 op_count; + + /* Inputs */ +/* + * INVALID is first so the default value of 0 is not a valid value. + * User is forced to pick a real value + */ +#define TEGRA_SOC_HWPM_REG_OP_MODE_INVALID 0 +/* Fail the entire IOCTL on the first malformed REG_OP */ +#define TEGRA_SOC_HWPM_REG_OP_MODE_FAIL_ON_FIRST 1 +/* + * If a malformed REG_OP is encountered, set the status in + * struct tegra_soc_hwpm_reg_op.status. Then continue processing the remaining + * REG_OPs. + */ +#define TEGRA_SOC_HWPM_REG_OP_MODE_CONT_ON_ERR 2 + __u8 mode; + + /* Output */ + __u8 b_all_reg_ops_passed; +}; + +/* TEGRA_CTRL_CMD_SOC_HWPM_UPDATE_GET_PUT IOCTL */ +#define TEGRA_SOC_HWPM_MEM_BYTES_INVALID 0xffffffff +struct tegra_soc_hwpm_update_get_put { + /* + * Inputs + */ + __u64 mem_bump; /* Increase SW get pointer by mem_bump bytes */ + __u8 b_stream_mem_bytes; /* Stream MEM_BYTES value to MEM_BYTES buffer */ + /* + * FIXME: This is not needed right now + * __u8 b_wait_for_stream; + */ + __u8 b_read_mem_head; + __u8 b_check_overflow; + + /* + * Outputs + */ + __u64 mem_head; /* HW put pointer value */ + /* + * FIXME: This is not needed right now + * __u64 mem_bytes; + */ + __u8 b_overflowed; +}; + +/* IOCTL enum */ +enum tegra_soc_hwpm_ioctl_num { + TEGRA_SOC_HWPM_IOCTL_DEVICE_INFO, + TEGRA_SOC_HWPM_IOCTL_FLOORSWEEP_INFO, + TEGRA_SOC_HWPM_IOCTL_RESOURCE_INFO, + TEGRA_SOC_HWPM_IOCTL_RESERVE_RESOURCE, + TEGRA_SOC_HWPM_IOCTL_ALLOC_PMA_STREAM, + TEGRA_SOC_HWPM_IOCTL_BIND, + TEGRA_SOC_HWPM_IOCTL_QUERY_ALLOWLIST, + TEGRA_SOC_HWPM_IOCTL_EXEC_REG_OPS, + TEGRA_SOC_HWPM_IOCTL_UPDATE_GET_PUT, + TERGA_SOC_HWPM_NUM_IOCTLS +}; + +/* FIXME: Does this have to be unique? */ +#define TEGRA_SOC_HWPM_IOC_MAGIC 'P' + +/* + * IOCTL for finding which physical instances of an IP are present in the chip + * + * FIXME: Convert to batch mode - refer to NV2080_CTRL_CMD_FB_GET_FS_INFO + */ +#define TEGRA_CTRL_CMD_SOC_HWPM_DEVICE_INFO \ + _IOWR(TEGRA_SOC_HWPM_IOC_MAGIC, \ + TEGRA_SOC_HWPM_IOCTL_DEVICE_INFO, \ + struct tegra_soc_hwpm_device_info) + +/* + * IOCTL for querying IP instance info + */ +#define TEGRA_CTRL_CMD_SOC_HWPM_IP_FLOORSWEEP_INFO \ + _IOWR(TEGRA_SOC_HWPM_IOC_MAGIC, \ + TEGRA_SOC_HWPM_IOCTL_FLOORSWEEP_INFO, \ + struct tegra_soc_hwpm_ip_floorsweep_info) + +/* + * IOCTL for resource status + */ +#define TEGRA_CTRL_CMD_SOC_HWPM_RESOURCE_INFO \ + _IOWR(TEGRA_SOC_HWPM_IOC_MAGIC, \ + TEGRA_SOC_HWPM_IOCTL_RESOURCE_INFO, \ + struct tegra_soc_hwpm_resource_info) + +/* + * IOCTL for reserving a resource for profiling + * + * This IOCTL can only be called before BIND. + * + * FIXME: Convert to batch mode - refer to NV2080_CTRL_CMD_FB_GET_FS_INFO + */ +#define TEGRA_CTRL_CMD_SOC_HWPM_RESERVE_RESOURCE \ + _IOW(TEGRA_SOC_HWPM_IOC_MAGIC, \ + TEGRA_SOC_HWPM_IOCTL_RESERVE_RESOURCE, \ + struct tegra_soc_hwpm_reserve_resource) + +/* + * IOCTL for allocating the PMA output stream + * + * This IOCTL can only be called before BIND. + */ +#define TEGRA_CTRL_CMD_SOC_HWPM_ALLOC_PMA_STREAM \ + _IOWR(TEGRA_SOC_HWPM_IOC_MAGIC, \ + TEGRA_SOC_HWPM_IOCTL_ALLOC_PMA_STREAM, \ + struct tegra_soc_hwpm_alloc_pma_stream) + +/* + * IOCTL for finalizing the initialization + * + * SOC HWPM driver will program the HW to finalize the initialiation. + * + * The following IOCTLs can only be called before BIND: + * - RESERVE_RESOURCE + * - ALLOC_PMA_STREAM + * + * The following IOCTLs can only be called after BIND: + * - QUERY_ALLOWLIST + * - EXEC_REG_OPS + * - UPDATE_GET_PUT + */ +#define TEGRA_CTRL_CMD_BIND \ + _IO(TEGRA_SOC_HWPM_IOC_MAGIC, \ + TEGRA_SOC_HWPM_IOCTL_BIND) + +/* + * IOCTL for requesting the driver's allowlist map + * + * This IOCTL can only be called after the BIND IOCTL + * + * FIXME: "ALLOWLIST" might have to be renamed to "ALLOWLIST" + */ +#define TEGRA_CTRL_CMD_SOC_HWPM_QUERY_ALLOWLIST \ + _IOWR(TEGRA_SOC_HWPM_IOC_MAGIC, \ + TEGRA_SOC_HWPM_IOCTL_QUERY_ALLOWLIST, \ + struct tegra_soc_hwpm_query_allowlist) + +/* + * IOCTL for executing register read/write operations + * + * This IOCTL can only be called after the BIND IOCTL + */ +#define TEGRA_CTRL_CMD_SOC_HWPM_EXEC_REG_OPS \ + _IOWR(TEGRA_SOC_HWPM_IOC_MAGIC, \ + TEGRA_SOC_HWPM_IOCTL_EXEC_REG_OPS, \ + struct tegra_soc_hwpm_exec_reg_ops) + +/* + * IOCTL for updating get/put pointers for PMA streamout buffer + * + * This IOCTL can only be called after the BIND IOCTL + */ +#define TEGRA_CTRL_CMD_SOC_HWPM_UPDATE_GET_PUT \ + _IOWR(TEGRA_SOC_HWPM_IOC_MAGIC, \ + TEGRA_SOC_HWPM_IOCTL_UPDATE_GET_PUT, \ + struct tegra_soc_hwpm_update_get_put) + +#define TEGRA_SOC_HWPM_MAX_ARG_SIZE \ + sizeof(struct tegra_soc_hwpm_exec_reg_ops) + + + +/* Interface for IP driver communication */ + +/* + * Enums for IP register read/write, to make things simple + * from SOC HWPM driver, read or write of only 32 bit data + * requested at a time. + */ +enum tegra_soc_hwpm_ip_reg_op { + TEGRA_SOC_HWPM_IP_REG_OP_INVALID, + TEGRA_SOC_HWPM_IP_REG_OP_READ, + TEGRA_SOC_HWPM_IP_REG_OP_WRITE +}; + +/* + * Structure describing hwpm ip ops. Once IP driver is ready + * it will register with SOC HWPM driver with data and callback + * functions listed here. On IP driver removal, un-register with + * SOC HWPM driver. + */ +struct tegra_soc_hwpm_ip_ops { + /* + * IP instance identfier for SOC HWPM usage. This is base + * address of IP instance included in device tree entry. + * SOC HWPM should be able to map this to one instance in + * supported IP aperture. + */ + __u64 ip_base_address; + + /* + * IP is a resource from HWPM perspective. Pass IP driver enum respect + * to enum tegra_soc_hwpm_resource for HWPM usage. SOC HWPM should be + * ableto map this identifier to one of supported resource structures. + */ + __u32 resource_enum; + + /* + * Opaque ip device handle used for callback from + * SOC HWPM driver to IP drivers. This handle can be used + * to access IP driver functionality with the callbacks. + */ + void *ip_dev; + /* + * hwpm_ip_pm is callback function to disable/enable + * IP driver power management. Before SOC HWPM doing + * perf measuremnts, this callback is called with + * "disable = true ", so that IP driver will disable IP specific + * power management to keep IP driver responsive. Once SOC HWPM is + * done with perf measurement, this callaback is called + * with "disable = true", so that IP driver can restore back + * it's orignal power management. + */ + int (*hwpm_ip_pm)(void *dev, bool disable); + /* + * hwpm_ip_reg_op is callback function to do IP + * register 32 bit read or write. + * For read: + * input : dev - IP device handle + * input : reg_op - TEGRA_SOC_HWPM_IP_REG_OP_READ + * input : inst_element_index - element index within IP instance + * input : reg_offset - register offset + * output: reg_data - u32 read value + * For write: + * input : dev - IP device handle + * input : reg_op - TEGRA_SOC_HWPM_IP_REG_OP_WRITE + * input : inst_element_index - element index within IP instance + * input : reg_offset - register offset + * output: reg_data - u32 write value + * Return: + * reg_op success / failure + */ + int (*hwpm_ip_reg_op)(void *dev, + enum tegra_soc_hwpm_ip_reg_op reg_op, + __u32 inst_element_index, + __u64 reg_offset, __u32 *reg_data); + +}; + +/* + * tegra_soc_hwpm_ip_register: IP driver will call this function to register + * with SOC HWPM driver with it's data and callbacks + */ +void tegra_soc_hwpm_ip_register(struct tegra_soc_hwpm_ip_ops *hwpm_ip_ops); +/* + * tegra_soc_hwpm_ip_unregister: IP driver will call this function to unregister + * with SOC HWPM driver. + */ +void tegra_soc_hwpm_ip_unregister(struct tegra_soc_hwpm_ip_ops *hwpm_ip_ops); + +#endif /* TEGRA_SOC_HWPM_UAPI_H */