[PATCH 02/10] rv: Remove unused ha_monitor_env_invalid()
From: Gabriele Monaco
Date: Tue Sep 29 2026 - 08:51:14 EST
After forcing a reset() action when starting HA monitors, environment
variables cannot be invalid, hence ha_monitor_env_invalid() and checks
using it are no longer required.
Remove the function and its usage from library and generation scripts.
Signed-off-by: Gabriele Monaco <gmonaco@xxxxxxxxxx>
---
include/rv/ha_monitor.h | 12 ------------
tools/verification/rvgen/rvgen/dot2k.py | 8 --------
.../rvgen/tests/golden/ha_percpu/ha_percpu.c | 13 +++++--------
.../rvgen/tests/golden/test_ha/test_ha.c | 13 +++++--------
.../tests/golden/test_ha_kunit/test_ha_kunit.c | 13 +++++--------
5 files changed, 15 insertions(+), 44 deletions(-)
diff --git a/include/rv/ha_monitor.h b/include/rv/ha_monitor.h
index 93ac99ff7f1d..87cf91abdf67 100644
--- a/include/rv/ha_monitor.h
+++ b/include/rv/ha_monitor.h
@@ -211,14 +211,6 @@ static inline void ha_monitor_reset_env(struct da_monitor *da_mon)
ha_cancel_timer(ha_mon);
}
-/*
- * ha_monitor_env_invalid - return true if env has not been initialised
- */
-static inline bool ha_monitor_env_invalid(struct ha_monitor *ha_mon, enum envs env)
-{
- return READ_ONCE(ha_mon->env_store[env]) == ENV_INVALID_VALUE;
-}
-
static inline void ha_get_env_string(struct seq_buf *s,
struct ha_monitor *ha_mon, u64 time_ns)
{
@@ -360,8 +352,6 @@ static inline u64 ha_invariant_passed_ns(struct ha_monitor *ha_mon, enum envs en
{
if (env < 0 || env >= ENV_MAX_STORED)
return 0;
- if (ha_monitor_env_invalid(ha_mon, env))
- return 0;
return ha_get_env(ha_mon, env, time_ns);
}
@@ -388,8 +378,6 @@ static inline u64 ha_invariant_passed_jiffy(struct ha_monitor *ha_mon, enum envs
{
if (env < 0 || env >= ENV_MAX_STORED)
return 0;
- if (ha_monitor_env_invalid(ha_mon, env))
- return 0;
return ha_get_env(ha_mon, env, time_ns);
}
diff --git a/tools/verification/rvgen/rvgen/dot2k.py b/tools/verification/rvgen/rvgen/dot2k.py
index fd3254ea5b4d..0b4e19ad9bd5 100644
--- a/tools/verification/rvgen/rvgen/dot2k.py
+++ b/tools/verification/rvgen/rvgen/dot2k.py
@@ -279,19 +279,11 @@ class ha2k(dot2k):
def __format_guard_rules(self, rules: list[str]) -> list[str]:
"""
Merge guard constraints as a single C return statement.
- If the rules include a stored env, also check its validity.
Break lines in a best effort way that tries to keep readability.
"""
if not rules:
return []
- invalid_checks = [f"ha_monitor_env_invalid(ha_mon, {env}{self.enum_suffix}) ||"
- for env in self.env_stored if any(env in rule for rule in rules)]
- if invalid_checks and len(rules) > 1:
- rules[0] = "(" + rules[0]
- rules[-1] = rules[-1] + ")"
- rules = invalid_checks + rules
-
separator = "\n\t\t " if sum(len(r) for r in rules) > 80 else " "
return ["res = " + separator.join(rules) + ";"]
diff --git a/tools/verification/rvgen/tests/golden/ha_percpu/ha_percpu.c b/tools/verification/rvgen/tests/golden/ha_percpu/ha_percpu.c
index 3a72e867122c..7357e182e487 100644
--- a/tools/verification/rvgen/tests/golden/ha_percpu/ha_percpu.c
+++ b/tools/verification/rvgen/tests/golden/ha_percpu/ha_percpu.c
@@ -109,16 +109,13 @@ static inline bool ha_verify_guards(struct ha_monitor *ha_mon,
res = ha_get_env(ha_mon, env1_ha_percpu, time_ns) == 0ull;
ha_reset_env(ha_mon, clk_ha_percpu, time_ns);
} else if (curr_state == S2_ha_percpu && event == event1_ha_percpu)
- res = ha_monitor_env_invalid(ha_mon, clk_ha_percpu) ||
- ha_get_env(ha_mon, clk_ha_percpu, time_ns) < foo_ns;
+ res = ha_get_env(ha_mon, clk_ha_percpu, time_ns) < foo_ns;
else if (curr_state == S3_ha_percpu && event == event0_ha_percpu)
- res = ha_monitor_env_invalid(ha_mon, clk_ha_percpu) ||
- (ha_get_env(ha_mon, clk_ha_percpu, time_ns) < FOO_NS &&
- ha_get_env(ha_mon, env2_ha_percpu, time_ns) == 0ull);
+ res = ha_get_env(ha_mon, clk_ha_percpu, time_ns) < FOO_NS &&
+ ha_get_env(ha_mon, env2_ha_percpu, time_ns) == 0ull;
else if (curr_state == S3_ha_percpu && event == event1_ha_percpu) {
- res = ha_monitor_env_invalid(ha_mon, clk_ha_percpu) ||
- (ha_get_env(ha_mon, clk_ha_percpu, time_ns) < 5000ull &&
- ha_get_env(ha_mon, env1_ha_percpu, time_ns) == 1ull);
+ res = ha_get_env(ha_mon, clk_ha_percpu, time_ns) < 5000ull &&
+ ha_get_env(ha_mon, env1_ha_percpu, time_ns) == 1ull;
ha_reset_env(ha_mon, clk_ha_percpu, time_ns);
}
return res;
diff --git a/tools/verification/rvgen/tests/golden/test_ha/test_ha.c b/tools/verification/rvgen/tests/golden/test_ha/test_ha.c
index 9047ff725546..a2bd1eb93b03 100644
--- a/tools/verification/rvgen/tests/golden/test_ha/test_ha.c
+++ b/tools/verification/rvgen/tests/golden/test_ha/test_ha.c
@@ -109,16 +109,13 @@ static inline bool ha_verify_guards(struct ha_monitor *ha_mon,
res = ha_get_env(ha_mon, env1_test_ha, time_ns) == 0ull;
ha_reset_env(ha_mon, clk_test_ha, time_ns);
} else if (curr_state == S2_test_ha && event == event1_test_ha)
- res = ha_monitor_env_invalid(ha_mon, clk_test_ha) ||
- ha_get_env(ha_mon, clk_test_ha, time_ns) < foo_ns;
+ res = ha_get_env(ha_mon, clk_test_ha, time_ns) < foo_ns;
else if (curr_state == S3_test_ha && event == event0_test_ha)
- res = ha_monitor_env_invalid(ha_mon, clk_test_ha) ||
- (ha_get_env(ha_mon, clk_test_ha, time_ns) < FOO_NS &&
- ha_get_env(ha_mon, env2_test_ha, time_ns) == 0ull);
+ res = ha_get_env(ha_mon, clk_test_ha, time_ns) < FOO_NS &&
+ ha_get_env(ha_mon, env2_test_ha, time_ns) == 0ull;
else if (curr_state == S3_test_ha && event == event1_test_ha) {
- res = ha_monitor_env_invalid(ha_mon, clk_test_ha) ||
- (ha_get_env(ha_mon, clk_test_ha, time_ns) < 5000ull &&
- ha_get_env(ha_mon, env1_test_ha, time_ns) == 1ull);
+ res = ha_get_env(ha_mon, clk_test_ha, time_ns) < 5000ull &&
+ ha_get_env(ha_mon, env1_test_ha, time_ns) == 1ull;
ha_reset_env(ha_mon, clk_test_ha, time_ns);
}
return res;
diff --git a/tools/verification/rvgen/tests/golden/test_ha_kunit/test_ha_kunit.c b/tools/verification/rvgen/tests/golden/test_ha_kunit/test_ha_kunit.c
index 239b0539df18..61446e7f32c4 100644
--- a/tools/verification/rvgen/tests/golden/test_ha_kunit/test_ha_kunit.c
+++ b/tools/verification/rvgen/tests/golden/test_ha_kunit/test_ha_kunit.c
@@ -109,16 +109,13 @@ static inline bool ha_verify_guards(struct ha_monitor *ha_mon,
res = ha_get_env(ha_mon, env1_test_ha_kunit, time_ns) == 0ull;
ha_reset_env(ha_mon, clk_test_ha_kunit, time_ns);
} else if (curr_state == S2_test_ha_kunit && event == event1_test_ha_kunit)
- res = ha_monitor_env_invalid(ha_mon, clk_test_ha_kunit) ||
- ha_get_env(ha_mon, clk_test_ha_kunit, time_ns) < foo_ns;
+ res = ha_get_env(ha_mon, clk_test_ha_kunit, time_ns) < foo_ns;
else if (curr_state == S3_test_ha_kunit && event == event0_test_ha_kunit)
- res = ha_monitor_env_invalid(ha_mon, clk_test_ha_kunit) ||
- (ha_get_env(ha_mon, clk_test_ha_kunit, time_ns) < FOO_NS &&
- ha_get_env(ha_mon, env2_test_ha_kunit, time_ns) == 0ull);
+ res = ha_get_env(ha_mon, clk_test_ha_kunit, time_ns) < FOO_NS &&
+ ha_get_env(ha_mon, env2_test_ha_kunit, time_ns) == 0ull;
else if (curr_state == S3_test_ha_kunit && event == event1_test_ha_kunit) {
- res = ha_monitor_env_invalid(ha_mon, clk_test_ha_kunit) ||
- (ha_get_env(ha_mon, clk_test_ha_kunit, time_ns) < 5000ull &&
- ha_get_env(ha_mon, env1_test_ha_kunit, time_ns) == 1ull);
+ res = ha_get_env(ha_mon, clk_test_ha_kunit, time_ns) < 5000ull &&
+ ha_get_env(ha_mon, env1_test_ha_kunit, time_ns) == 1ull;
ha_reset_env(ha_mon, clk_test_ha_kunit, time_ns);
}
return res;
--
2.55.0