Re: [kvm-unit-tests PATCH 3/5] s390x: diag308: Only test subcode 2 under QEMU

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 14/01/2022 11.02, Janosch Frank wrote:
Other hypervisors might implement it and therefore not send a
specification exception.

Signed-off-by: Janosch Frank <frankja@xxxxxxxxxxxxx>
---
  s390x/diag308.c | 15 ++++++++++++++-
  1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/s390x/diag308.c b/s390x/diag308.c
index c9d6c499..414dbdf4 100644
--- a/s390x/diag308.c
+++ b/s390x/diag308.c
@@ -8,6 +8,7 @@
  #include <libcflat.h>
  #include <asm/asm-offsets.h>
  #include <asm/interrupt.h>
+#include <vm.h>
/* The diagnose calls should be blocked in problem state */
  static void test_priv(void)
@@ -75,7 +76,7 @@ static void test_subcode6(void)
  /* Unsupported subcodes should generate a specification exception */
  static void test_unsupported_subcode(void)
  {
-	int subcodes[] = { 2, 0x101, 0xffff, 0x10001, -1 };
+	int subcodes[] = { 0x101, 0xffff, 0x10001, -1 };
  	int idx;
for (idx = 0; idx < ARRAY_SIZE(subcodes); idx++) {
@@ -85,6 +86,18 @@ static void test_unsupported_subcode(void)
  		check_pgm_int_code(PGM_INT_CODE_SPECIFICATION);
  		report_prefix_pop();
  	}
+
+	/*
+	 * Subcode 2 is not available under QEMU but might be on other
+	 * hypervisors.
+	 */
+	if (vm_is_tcg() || vm_is_kvm()) {
+		report_prefix_pushf("0x%04x", 2);

Maybe replace the format string with "0002" and drop the "2" parameter?

+		expect_pgm_int();
+		asm volatile ("diag %0,%1,0x308" :: "d"(0), "d"(2));
+		check_pgm_int_code(PGM_INT_CODE_SPECIFICATION);
+		report_prefix_pop();
+	}
  }
static struct {

Reviewed-by: Thomas Huth <thuth@xxxxxxxxxx>




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux