diff mbox series

[kvm-unit-tests,2/4] s390x: lib: Add QUI getter

Message ID 20220127141559.35250-3-seiden@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series s390x: Attestation tests | expand

Commit Message

Steffen Eiden Jan. 27, 2022, 2:15 p.m. UTC
Some tests need the information provided by the QUI UVC and lib/s390x/uv.c
already has cached the qui result. Let's add a function to avoid
unnecessary  QUI UVCs.

Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
---
 lib/s390x/uv.c | 10 +++++++++-
 lib/s390x/uv.h |  1 +
 2 files changed, 10 insertions(+), 1 deletion(-)

Comments

Janosch Frank Jan. 28, 2022, 9:02 a.m. UTC | #1
On 1/27/22 15:15, Steffen Eiden wrote:
> Some tests need the information provided by the QUI UVC and lib/s390x/uv.c
> already has cached the qui result. Let's add a function to avoid
> unnecessary  QUI UVCs.

Double space

> 
> Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
> ---
>   lib/s390x/uv.c | 10 +++++++++-
>   lib/s390x/uv.h |  1 +
>   2 files changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/s390x/uv.c b/lib/s390x/uv.c
> index 6fe11dff..5625a1ee 100644
> --- a/lib/s390x/uv.c
> +++ b/lib/s390x/uv.c
> @@ -2,7 +2,7 @@
>   /*
>    * Ultravisor related functionality
>    *
> - * Copyright 2020 IBM Corp.
> + * Copyright 2020, 2022 IBM Corp.
>    *
>    * Authors:
>    *    Janosch Frank <frankja@linux.ibm.com>
> @@ -47,6 +47,14 @@ bool uv_query_test_call(unsigned int nr)
>   	return test_bit_inv(nr, uvcb_qui.inst_calls_list);
>   }
>   
> +const struct uv_cb_qui *uv_get_info(void)

uv_get_query_data?

> +{
> +	/* Query needs to be called first */
> +	assert(uvcb_qui.header.rc);
> +
> +	return &uvcb_qui;
> +}
> +
>   int uv_setup(void)
>   {
>   	if (!test_facility(158))
> diff --git a/lib/s390x/uv.h b/lib/s390x/uv.h
> index 8175d9c6..e9935fd2 100644
> --- a/lib/s390x/uv.h
> +++ b/lib/s390x/uv.h
> @@ -8,6 +8,7 @@
>   bool uv_os_is_guest(void);
>   bool uv_os_is_host(void);
>   bool uv_query_test_call(unsigned int nr);
> +const struct uv_cb_qui *uv_get_info(void);
>   void uv_init(void);
>   int uv_setup(void);
>   void uv_create_guest(struct vm *vm);
>
diff mbox series

Patch

diff --git a/lib/s390x/uv.c b/lib/s390x/uv.c
index 6fe11dff..5625a1ee 100644
--- a/lib/s390x/uv.c
+++ b/lib/s390x/uv.c
@@ -2,7 +2,7 @@ 
 /*
  * Ultravisor related functionality
  *
- * Copyright 2020 IBM Corp.
+ * Copyright 2020, 2022 IBM Corp.
  *
  * Authors:
  *    Janosch Frank <frankja@linux.ibm.com>
@@ -47,6 +47,14 @@  bool uv_query_test_call(unsigned int nr)
 	return test_bit_inv(nr, uvcb_qui.inst_calls_list);
 }
 
+const struct uv_cb_qui *uv_get_info(void)
+{
+	/* Query needs to be called first */
+	assert(uvcb_qui.header.rc);
+
+	return &uvcb_qui;
+}
+
 int uv_setup(void)
 {
 	if (!test_facility(158))
diff --git a/lib/s390x/uv.h b/lib/s390x/uv.h
index 8175d9c6..e9935fd2 100644
--- a/lib/s390x/uv.h
+++ b/lib/s390x/uv.h
@@ -8,6 +8,7 @@ 
 bool uv_os_is_guest(void);
 bool uv_os_is_host(void);
 bool uv_query_test_call(unsigned int nr);
+const struct uv_cb_qui *uv_get_info(void);
 void uv_init(void);
 int uv_setup(void);
 void uv_create_guest(struct vm *vm);