]> xenbits.xensource.com Git - people/andrewcoop/xen-test-framework.git/commitdiff
KVM kvm
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 4 Dec 2019 21:30:29 +0000 (21:30 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 10 Jan 2024 16:13:09 +0000 (16:13 +0000)
arch/x86/hvm/traps.c
arch/x86/setup.c
build/common.mk
build/gen.mk
common/lib.c
common/report.c
include/xen/arch-x86/xen.h
xtf-runner

index 6eee8124023126f6d0a5bd0013b5a8c2b5099dab..241ba45d3e1b0ec793726c16ec2622c59116a7c7 100644 (file)
@@ -146,6 +146,8 @@ void arch_init_traps(void)
 
 void __noreturn arch_crash_hard(void)
 {
+    outb(0, 0xf4);
+
     /*
      * Clear interrupts and halt.  Xen should catch this condition and shut
      * the VM down.  If that fails, sit in a loop.
index 3c84e963f90bb83e79ddec2892e5bb7b0a06774a..d1cde76b3f059612ee35304412db10847ac435fb 100644 (file)
@@ -235,12 +235,7 @@ static void qemu_console_write(const char *buf, size_t len)
 {
     asm volatile("rep; outsb"
                  : "+S" (buf), "+c" (len)
-                 : "d" (0x12));
-}
-
-static void xen_console_write(const char *buf, size_t len)
-{
-    hypercall_console_write(buf, len);
+                 : "d" (0xe9));
 }
 
 void arch_setup(void)
@@ -248,14 +243,14 @@ void arch_setup(void)
     if ( IS_DEFINED(CONFIG_HVM) && !pvh_start_info )
         register_console_callback(qemu_console_write);
 
-    register_console_callback(xen_console_write);
-
     collect_cpuid(IS_DEFINED(CONFIG_PV) ? pv_cpuid_count : cpuid_count);
 
     sort_extable();
 
     arch_init_traps();
 
+    return;
+
     init_hypercalls();
 
     if ( !is_initdomain() )
index 644961c03fa835cd48e8709a7cfd08480f3e1684..ce6d74e776265daf068ab89274cc82f167e0944d 100644 (file)
@@ -64,7 +64,7 @@ CFLAGS_$(1) := $$(CFLAGS_$($(1)_arch)) $$(COMMON_CFLAGS-$(1)) -DCONFIG_ENV_$(1)
 
 link-$(1) := $(ROOT)/arch/x86/link-$(1).lds
 
-LDFLAGS_$(1) := -T $$(link-$(1)) -nostdlib $(LDFLAGS-y)
+LDFLAGS_$(1) := -T $$(link-$(1)) -nostdlib -static -m32 $(LDFLAGS-y)
 
 # Needs to pick up test-provided obj-perenv and obj-perbits
 DEPS-$(1) = \
index df474a121de9b6a2606bc89114a09e0148d1ace8..e292735504310df7616313e6d1c1c9f4676154a8 100644 (file)
@@ -36,7 +36,7 @@ build: $(foreach env,$(TEST-ENVS),test-$(env)-$(NAME)) $(TEST-CFGS)
 build: info.json
 
 info.json: $(ROOT)/build/mkinfo.py Makefile
-       $(PYTHON) $< $@ "$(NAME)" "$(CATEGORY)" "$(TEST-ENVS)" "$(VARY-CFG)"
+       @$(PYTHON) $< $@.tmp "$(NAME)" "$(CATEGORY)" "$(filter-out pv%,$(TEST-ENVS))" ""
 
 .PHONY: install install-each-env
 install: install-each-env info.json
@@ -55,7 +55,7 @@ else
 # hvm64 needs linking normally, then converting to elf32-x86-64 or elf32-i386
 test-$(1)-$(NAME): $$(DEPS-$(1)) $$(link-$(1))
        $(LD) $$(LDFLAGS_$(1)) $$(DEPS-$(1)) -o $$@.tmp
-       $(OBJCOPY) $$@.tmp -O $(hvm64-format) $$@
+       $(OBJCOPY) $$@.tmp -O elf32-i386 $$@
        rm -f $$@.tmp
 endif
 
index 58f49656d00f178bac582330a6c3179e0751ef26..ecc257163bb7824c285c63c65a653b0c9c22c96a 100644 (file)
@@ -25,7 +25,6 @@ void __noreturn panic(const char *fmt, ...)
 
     printk("******************************\n");
 
-    hypercall_shutdown(SHUTDOWN_crash);
     arch_crash_hard();
 }
 
index ffdf09871eb1652b454627d4c4eaa72800732140..d24635a9736727aea29505cbdb6e37aa8a27e914 100644 (file)
@@ -1,6 +1,7 @@
 #include <xtf/lib.h>
 #include <xtf/report.h>
 #include <xtf/hypercall.h>
+#include <arch/lib.h>
 
 enum test_status {
     STATUS_RUNNING, /**< Test not yet completed.       */
@@ -124,7 +125,8 @@ bool xtf_status_reported(void)
 void xtf_exit(void)
 {
     xtf_report_status();
-    hypercall_shutdown(SHUTDOWN_poweroff);
+
+    outb(0, 0xf4);
     panic("xtf_exit(): hypercall_shutdown(SHUTDOWN_poweroff) returned\n");
 }
 
index 87747392c7d34e3e33012c584109cc1fa88bf2d2..562ad0832cde051f362a6b63a045b7ffbba995d1 100644 (file)
@@ -145,10 +145,10 @@ struct arch_shared_info {
  * hypervisor's x86 emulator.
  */
 #ifdef __ASSEMBLY__
-#define _ASM_XEN_FEP ud2a; .ascii "xen";
+#define _ASM_XEN_FEP ud2a; .ascii "kvm";
 #else
-#define _ASM_XEN_FEP "ud2a; .ascii \"xen\";"
-#define _BIN_XEN_FEP "\x0f\x0bxen"
+#define _ASM_XEN_FEP "ud2a; .ascii \"kvm\";"
+#define _BIN_XEN_FEP "\x0f\x0bkvm"
 #endif
 
 #endif /* XEN_PUBLIC_ARCH_X86_XEN_H */
index 4a6e5904de53b795c11aa482348d019c682a287c..ba46c40c79e8d7238cd31064e4c0793fdd29ed80 100755 (executable)
@@ -93,9 +93,12 @@ class TestInstance(object):
         """ Return the VM name as `xl` expects it. """
         return repr(self)
 
+    def vm_path(self):
+        return path.join("tests", self.name, repr(self))
+
     def cfg_path(self):
         """ Return the path to the `xl` config file for this test. """
-        return path.join("tests", self.name, repr(self) + ".cfg")
+        return self.vm_path() + ".cfg"
 
     def __repr__(self):
         if not self.variation:
@@ -461,40 +464,17 @@ def interpret_result(logline):
 def run_test_console(opts, test):
     """ Run a specific, obtaining results via xenconsole """
 
-    cmd = ['xl', 'create', '-p', test.cfg_path()]
-    if not opts.quiet:
-        print("Executing '{0}'".format(" ".join(cmd)))
+    cmd = ["qemu-system-x86_64",
+           "-nodefaults", "-nographic", "-cpu", "host", "-machine", "accel=kvm",
+           "-debugcon",  "stdio",
+           "-device", "isa-debug-exit,iobase=0xf4,iosize=0x4",
+           "-kernel", test.vm_path()]
 
-    create = Popen(cmd, stdout = PIPE, stderr = PIPE)
-    _, stderr = create.communicate()
-
-    if create.returncode:
-        if opts.quiet:
-            print("Executing '{0}'".format(" ".join(cmd)))
-        print(stderr)
-        raise RunnerError("Failed to create VM")
-
-    cmd = ['xl', 'console', test.vm_name()]
     if not opts.quiet:
         print("Executing '{0}'".format(" ".join(cmd)))
 
-    console = Popen(cmd, stdout = PIPE)
-
-    cmd = ['xl', 'unpause', test.vm_name()]
-    if not opts.quiet:
-        print("Executing '{0}'".format(" ".join(cmd)))
-
-    rc = subproc_call(cmd)
-    if rc:
-        if opts.quiet:
-            print("Executing '{0}'".format(" ".join(cmd)))
-        raise RunnerError("Failed to unpause VM")
-
+    console = Popen(cmd, stdout = PIPE, stderr = PIPE)
     stdout, _ = console.communicate()
-
-    if console.returncode:
-        raise RunnerError("Failed to obtain VM console")
-
     lines = stdout.splitlines()
 
     if lines: