From: Thomas Huth <thuth@redhat.com>
To: kvm@vger.kernel.org
Cc: David Hildenbrand <david@redhat.com>,
Janosch Frank <frankja@linux.ibm.com>,
Cornelia Huck <cohuck@redhat.com>
Subject: [kvm-unit-tests PATCH] s390x/cpumodel: The missing DFP facility on TCG is expected
Date: Tue, 7 Jul 2020 07:56:19 +0200 [thread overview]
Message-ID: <20200707055619.6162-1-thuth@redhat.com> (raw)
When running the kvm-unit-tests with TCG on s390x, the cpumodel test
always reports the error about the missing DFP (decimal floating point)
facility. This is kind of expected, since DFP is not required for
running Linux and thus nobody is really interested in implementing
this facility in TCG. Thus let's mark this as an expected error instead,
so that we can run the kvm-unit-tests also with TCG without getting
test failures that we do not care about.
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
s390x/cpumodel.c | 51 ++++++++++++++++++++++++++++++++++++++++++------
1 file changed, 45 insertions(+), 6 deletions(-)
diff --git a/s390x/cpumodel.c b/s390x/cpumodel.c
index 5d232c6..4310b92 100644
--- a/s390x/cpumodel.c
+++ b/s390x/cpumodel.c
@@ -11,6 +11,7 @@
*/
#include <asm/facility.h>
+#include <alloc_page.h>
static int dep[][2] = {
/* from SA22-7832-11 4-98 facility indications */
@@ -38,6 +39,49 @@ static int dep[][2] = {
{ 155, 77 },
};
+/*
+ * A hack to detect TCG (instead of KVM): QEMU uses "TCGguest" as guest
+ * name by default when we are running with TCG (otherwise it's "KVMguest")
+ */
+static bool is_tcg(void)
+{
+ bool ret = false;
+ uint8_t *buf;
+
+ buf = alloc_page();
+ if (!buf)
+ return false;
+
+ if (stsi(buf, 3, 2, 2)) {
+ goto out;
+ }
+
+ /* Does the name start with "TCG" in EBCDIC? */
+ if (buf[2048] == 0x54 && buf[2049] == 0x43 && buf[2050] == 0x47)
+ ret = true;
+
+out:
+ free_page(buf);
+ return ret;
+}
+
+static void check_dependency(int dep1, int dep2)
+{
+ if (test_facility(dep1)) {
+ if (dep1 == 37) {
+ /* TCG does not have DFP and is unlikely to
+ * get it implemented soon. */
+ report_xfail(is_tcg(), test_facility(dep2),
+ "%d implies %d", dep1, dep2);
+ } else {
+ report(test_facility(dep2), "%d implies %d",
+ dep1, dep2);
+ }
+ } else {
+ report_skip("facility %d not present", dep1);
+ }
+}
+
int main(void)
{
int i;
@@ -46,12 +90,7 @@ int main(void)
report_prefix_push("dependency");
for (i = 0; i < ARRAY_SIZE(dep); i++) {
- if (test_facility(dep[i][0])) {
- report(test_facility(dep[i][1]), "%d implies %d",
- dep[i][0], dep[i][1]);
- } else {
- report_skip("facility %d not present", dep[i][0]);
- }
+ check_dependency(dep[i][0], dep[i][1]);
}
report_prefix_pop();
--
2.18.1
next reply other threads:[~2020-07-07 5:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-07 5:56 Thomas Huth [this message]
2020-07-07 7:22 ` [kvm-unit-tests PATCH] s390x/cpumodel: The missing DFP facility on TCG is expected Cornelia Huck
2020-07-07 7:28 ` Thomas Huth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200707055619.6162-1-thuth@redhat.com \
--to=thuth@redhat.com \
--cc=cohuck@redhat.com \
--cc=david@redhat.com \
--cc=frankja@linux.ibm.com \
--cc=kvm@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox