diff mbox series

[kvm-unit-tests,v3,2/3] lib: s390x: add function to test available UV features

Message ID 20241218135138.51348-3-imbrenda@linux.ibm.com (mailing list archive)
State New
Headers show
Series s390x: pv: Add test for large host pages backing | expand

Commit Message

Claudio Imbrenda Dec. 18, 2024, 1:51 p.m. UTC
Add uv_query_test_feature(), to test specific bits in the
uv_feature_indications bitmask, similar to uv_query_test_call().

Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 lib/s390x/uv.h | 1 +
 lib/s390x/uv.c | 9 +++++++++
 2 files changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/lib/s390x/uv.h b/lib/s390x/uv.h
index 00a37041..b0fbc478 100644
--- a/lib/s390x/uv.h
+++ b/lib/s390x/uv.h
@@ -10,6 +10,7 @@  bool uv_os_is_guest(void);
 bool uv_os_is_host(void);
 bool uv_host_requirement_checks(void);
 bool uv_query_test_call(unsigned int nr);
+bool uv_query_test_feature(unsigned int nr);
 const struct uv_cb_qui *uv_get_query_data(void);
 void uv_init(void);
 int uv_setup(void);
diff --git a/lib/s390x/uv.c b/lib/s390x/uv.c
index 723bb4f2..03499272 100644
--- a/lib/s390x/uv.c
+++ b/lib/s390x/uv.c
@@ -67,6 +67,15 @@  bool uv_query_test_call(unsigned int nr)
 	return test_bit_inv(nr, uvcb_qui.inst_calls_list);
 }
 
+bool uv_query_test_feature(unsigned int nr)
+{
+	/* Query needs to be called first */
+	assert(uvcb_qui.header.rc);
+	assert(nr < BITS_PER_LONG);
+
+	return test_bit_inv(nr, &uvcb_qui.uv_feature_indications);
+}
+
 const struct uv_cb_qui *uv_get_query_data(void)
 {
 	/* Query needs to be called first */