mirror of
git://nv-tegra.nvidia.com/linux-hwpm.git
synced 2025-12-22 09:12:05 +03:00
Initial change for libnvsochwpm userspace library. Change-Id: I20b11f9d253b65583db97dfebd9ff78b4d33d50c Signed-off-by: Besar Wicaksono <bwicaksono@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/3267999 Reviewed-by: Vasuki Shankar <vasukis@nvidia.com> Reviewed-by: Yifei Wan <ywan@nvidia.com> GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
103 lines
2.6 KiB
C++
103 lines
2.6 KiB
C++
/* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
* SPDX-License-Identifier: GPL-2.0-only
|
|
*
|
|
* 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.
|
|
*
|
|
*/
|
|
|
|
#ifndef T241_TEST_H
|
|
#define T241_TEST_H
|
|
|
|
#include "nv_soc_hwpm_test.h"
|
|
|
|
#define T241_MAX_SOCKETS 4
|
|
|
|
class T241Tests : public NvSocHwpmTests
|
|
{
|
|
public:
|
|
T241Tests();
|
|
~T241Tests() override;
|
|
|
|
protected:
|
|
struct PmaConfigurationParams
|
|
{
|
|
PmaConfigurationParams()
|
|
{
|
|
enable_streaming = false;
|
|
pulse_interval = 0;
|
|
enable_pma_record = false;
|
|
keep_latest = false;
|
|
}
|
|
|
|
bool enable_streaming;
|
|
uint32_t pulse_interval;
|
|
bool enable_pma_record;
|
|
bool keep_latest;
|
|
};
|
|
|
|
struct PmmConfigurationParams
|
|
{
|
|
enum Mode {
|
|
MODE_B,
|
|
MODE_C,
|
|
MODE_E
|
|
};
|
|
|
|
PmmConfigurationParams()
|
|
{
|
|
mode = MODE_B;
|
|
perfmon_idx = 0;
|
|
enable_local_triggering = false;
|
|
enable_overflow_priming = false;
|
|
collect_one = false;
|
|
}
|
|
|
|
|
|
Mode mode;
|
|
uint32_t perfmon_idx;
|
|
|
|
bool enable_local_triggering;
|
|
bool enable_overflow_priming;
|
|
bool collect_one;
|
|
};
|
|
|
|
void SetUp() override;
|
|
void TearDown() override;
|
|
|
|
void GetDevices();
|
|
|
|
void TestRegopsRead(nv_soc_hwpm_session session,
|
|
uint64_t pma_record_buffer_pma_va,
|
|
size_t record_buffer_size);
|
|
void TestRegopsWrite(nv_soc_hwpm_session session);
|
|
|
|
void RegOpWrite32(
|
|
nv_soc_hwpm_session session, uint64_t address, uint32_t value, uint32_t mask);
|
|
void RegOpRead32(
|
|
nv_soc_hwpm_session session, uint64_t address, uint32_t *value);
|
|
|
|
void SetupPma(nv_soc_hwpm_session session, const PmaConfigurationParams& params);
|
|
void EnablePmaStreaming(nv_soc_hwpm_session session, const PmaConfigurationParams& params);
|
|
void SetupPmm(nv_soc_hwpm_session session, const PmmConfigurationParams& params);
|
|
void SetupWatchbus(nv_soc_hwpm_session session, const PmmConfigurationParams& params);
|
|
void TeardownPma(nv_soc_hwpm_session session);
|
|
void TeardownPmm(nv_soc_hwpm_session session, const PmmConfigurationParams& params);
|
|
void TeardownPerfmux(nv_soc_hwpm_session session);
|
|
void IssuePmaTrigger(nv_soc_hwpm_session session);
|
|
void HarvestCounters(
|
|
nv_soc_hwpm_session session,
|
|
const PmmConfigurationParams& params,
|
|
const uint32_t sig_val[4]);
|
|
|
|
nv_soc_hwpm_device t241_dev[T241_MAX_SOCKETS];
|
|
uint32_t t241_dev_count;
|
|
};
|
|
|
|
#endif // T241_TEST_H
|