From 92a7d8d7df58d44ce30cde50ea5c12704174fb55 Mon Sep 17 00:00:00 2001 From: "yucong.park" Date: Tue, 28 Oct 2025 17:27:26 +0800 Subject: [PATCH] modify the enum to a fixed size --- backend/device/src/device/handle_impl.hpp | 2 +- backend/device/src/device/hwcnt/sampler/base/backend.hpp | 2 +- .../device/src/device/hwcnt/sampler/vinstr/sample_layout.hpp | 2 +- backend/device/src/device/ioctl/kbase/commands.hpp | 2 +- backend/device/src/device/ioctl/kbase_pre_r21/commands.hpp | 2 +- backend/device/src/device/ioctl/kinstr_prfcnt/commands.hpp | 2 +- backend/device/src/device/ioctl/vinstr/commands.hpp | 2 +- backend/device/src/device/kbase_version.hpp | 2 +- hwcpipe/include/hwcpipe/hwcpipe_counter.h | 3 ++- 9 files changed, 10 insertions(+), 9 deletions(-) diff --git a/backend/device/src/device/handle_impl.hpp b/backend/device/src/device/handle_impl.hpp index c95a7d2..e8dc0b2 100644 --- a/backend/device/src/device/handle_impl.hpp +++ b/backend/device/src/device/handle_impl.hpp @@ -44,7 +44,7 @@ template class handle_impl : public handle, private syscall_iface_t { public: /** Determines how descriptor should be treated. */ - enum class mode { + enum class mode : uint8_t { /** The descriptor is closed at destruction time. */ internal, /** the descriptor is kept open at destruction time. */ diff --git a/backend/device/src/device/hwcnt/sampler/base/backend.hpp b/backend/device/src/device/hwcnt/sampler/base/backend.hpp index 05306b5..b01e9ef 100644 --- a/backend/device/src/device/hwcnt/sampler/base/backend.hpp +++ b/backend/device/src/device/hwcnt/sampler/base/backend.hpp @@ -62,7 +62,7 @@ class backend : public detail::backend, public reader, private syscall_iface_t { ~backend() override { get_syscall_iface().close(fd_); } /** Sampler type. */ - enum class sampler_type { + enum class sampler_type : uint8_t { /** Manual sampler. */ manual, /** Periodic sampler. */ diff --git a/backend/device/src/device/hwcnt/sampler/vinstr/sample_layout.hpp b/backend/device/src/device/hwcnt/sampler/vinstr/sample_layout.hpp index a38bb94..85ad528 100644 --- a/backend/device/src/device/hwcnt/sampler/vinstr/sample_layout.hpp +++ b/backend/device/src/device/hwcnt/sampler/vinstr/sample_layout.hpp @@ -42,7 +42,7 @@ namespace sampler { namespace vinstr { /** Sample layout type. */ -enum class sample_layout_type { +enum class sample_layout_type : uint8_t { /** v4 layout type. */ v4, /** v5 layout or newer.*/ diff --git a/backend/device/src/device/ioctl/kbase/commands.hpp b/backend/device/src/device/ioctl/kbase/commands.hpp index cae261b..f1dedf5 100644 --- a/backend/device/src/device/ioctl/kbase/commands.hpp +++ b/backend/device/src/device/ioctl/kbase/commands.hpp @@ -41,7 +41,7 @@ constexpr auto iface_number = 0x80; namespace command { /** Commands describing kbase ioctl interface. */ -enum command_type { +enum class command_type : uintptr_t { /** Check version compatibility between JM kernel and userspace. */ version_check_jm = _IOWR(iface_number, 0x0, ::hwcpipe::device::ioctl::kbase::version_check), /** Check version compatibility between CSF kernel and userspace. */ diff --git a/backend/device/src/device/ioctl/kbase_pre_r21/commands.hpp b/backend/device/src/device/ioctl/kbase_pre_r21/commands.hpp index ecac21b..be17f68 100644 --- a/backend/device/src/device/ioctl/kbase_pre_r21/commands.hpp +++ b/backend/device/src/device/ioctl/kbase_pre_r21/commands.hpp @@ -41,7 +41,7 @@ constexpr auto iface_number = 0x80; namespace command { /** Commands describing kbase_pre_r21 ioctl interface. */ -enum command_type { +enum command_type : uintptr_t { /** Check version compatibility between JM kernel and userspace. */ version_check = _IOWR(iface_number, 0x0, ::hwcpipe::device::ioctl::kbase_pre_r21::version_check_args), /** Set kernel context creation flags. */ diff --git a/backend/device/src/device/ioctl/kinstr_prfcnt/commands.hpp b/backend/device/src/device/ioctl/kinstr_prfcnt/commands.hpp index 828454f..596e5df 100644 --- a/backend/device/src/device/ioctl/kinstr_prfcnt/commands.hpp +++ b/backend/device/src/device/ioctl/kinstr_prfcnt/commands.hpp @@ -41,7 +41,7 @@ constexpr auto iface_number = 0xbf; namespace command { /** Commands describing kinstr_prfcnt ioctl interface. */ -enum command_type { +enum command_type : uintptr_t { /** Issue command. */ issue_command = _IOW(iface_number, 0x0, ::hwcpipe::device::ioctl::kinstr_prfcnt::control_cmd), /** Get sample. */ diff --git a/backend/device/src/device/ioctl/vinstr/commands.hpp b/backend/device/src/device/ioctl/vinstr/commands.hpp index c2ff76a..3005ee7 100644 --- a/backend/device/src/device/ioctl/vinstr/commands.hpp +++ b/backend/device/src/device/ioctl/vinstr/commands.hpp @@ -41,7 +41,7 @@ constexpr auto iface_number = 0xbe; namespace command { /** Commands describing vinstr ioctl interface. */ -enum command_type { +enum command_type : uintptr_t { /** Get HW version. */ get_hwver = _IOR(iface_number, 0x0, uint32_t), /** Get HWCNT dump buffer size. */ diff --git a/backend/device/src/device/kbase_version.hpp b/backend/device/src/device/kbase_version.hpp index 656e919..3686964 100644 --- a/backend/device/src/device/kbase_version.hpp +++ b/backend/device/src/device/kbase_version.hpp @@ -46,7 +46,7 @@ namespace hwcpipe { namespace device { /** Kbase ioctl interface type. */ -enum class ioctl_iface_type { +enum class ioctl_iface_type : uint32_t { /** Pre R21 release Job manager kernel. */ jm_pre_r21, /** Post R21 release Job manager kernel. */ diff --git a/hwcpipe/include/hwcpipe/hwcpipe_counter.h b/hwcpipe/include/hwcpipe/hwcpipe_counter.h index b20b43b..67bfc8f 100644 --- a/hwcpipe/include/hwcpipe/hwcpipe_counter.h +++ b/hwcpipe/include/hwcpipe/hwcpipe_counter.h @@ -6,10 +6,11 @@ #ifndef HWCPIPE_COUNTER_H #define HWCPIPE_COUNTER_H +#include // NOLINTBEGIN(readability-identifier-naming) // all possible counters -typedef enum hwcpipe_counter { +typedef enum class hwcpipe_counter : uint16_t { MaliGPUActiveCy, MaliGPUIRQActiveCy, MaliFragQueueJob,