[kvm-unit-tests PATCH v3 1/9] s390x: uv: Tolerate 0x100 query return code

Janosch Frank
2021-10-07T08:51:57Z

RC 0x100 is not an error but a notice that we could have gotten more
data from the Ultravisor if we had asked for it. So let's tolerate
them in our tests.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
---
s390x/uv-guest.c | 4 +++-
s390x/uv-host.c | 8 +++++---
2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/s390x/uv-guest.c b/s390x/uv-guest.c
index f05ae4c3..44ad2154 100644
--- a/s390x/uv-guest.c
+++ b/s390x/uv-guest.c
@@ -71,7 +71,9 @@ static void test_query(void)

uvcb.header.len = sizeof(uvcb);
cc = uv_call(0, (u64)&uvcb);
- report(cc == 0 && uvcb.header.rc == UVC_RC_EXECUTED, "successful query");
+ report((!cc && uvcb.header.rc == UVC_RC_EXECUTED) ||
+ (cc == 1 && uvcb.header.rc == 0x100),
+ "successful query");

/*
* These bits have been introduced with the very first
diff --git a/s390x/uv-host.c b/s390x/uv-host.c
index 28035707..4b72c24d 100644
--- a/s390x/uv-host.c
+++ b/s390x/uv-host.c
@@ -385,7 +385,7 @@ static void test_init(void)

static void test_query(void)
{
- int i = 0;
+ int i = 0, cc;

uvcb_qui.header.cmd = UVC_CMD_QUI;
uvcb_qui.header.len = sizeof(uvcb_qui);
@@ -400,8 +400,10 @@ static void test_query(void)
report(uvcb_qui.header.rc == 0x100, "insf length");

uvcb_qui.header.len = sizeof(uvcb_qui);
- uv_call(0, (uint64_t)&uvcb_qui);
- report(uvcb_qui.header.rc == UVC_RC_EXECUTED, "successful query");
+ cc = uv_call(0, (uint64_t)&uvcb_qui);
+ report((!cc && uvcb_qui.header.rc == UVC_RC_EXECUTED) ||
+ (cc == 1 && uvcb_qui.header.rc == 0x100),
+ "successful query");

for (i = 0; cmds[i].name; i++)
report(uv_query_test_call(cmds[i].call_bit), "%s", cmds[i].name);
--
2.30.2