From patchwork Tue Jan 21 16:21:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 3518881 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B4B5BC02DC for ; Tue, 21 Jan 2014 16:22:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F0AFC200DB for ; Tue, 21 Jan 2014 16:22:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F3CC920160 for ; Tue, 21 Jan 2014 16:22:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755033AbaAUQWd (ORCPT ); Tue, 21 Jan 2014 11:22:33 -0500 Received: from mx1.redhat.com ([209.132.183.28]:2045 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754959AbaAUQW1 (ORCPT ); Tue, 21 Jan 2014 11:22:27 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s0LGMBR2030143 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 21 Jan 2014 11:22:11 -0500 Received: from hawk.usersys.redhat.com.com (dhcp-1-167.brq.redhat.com [10.34.1.167]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s0LGM6NO007833; Tue, 21 Jan 2014 11:22:10 -0500 From: Andrew Jones To: kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org Cc: christoffer.dall@linaro.org Subject: [PATCH 02/17] makefile and run_tests tweaks Date: Tue, 21 Jan 2014 17:21:48 +0100 Message-Id: <1390321323-1855-3-git-send-email-drjones@redhat.com> In-Reply-To: <1390321323-1855-1-git-send-email-drjones@redhat.com> References: <1390321323-1855-1-git-send-email-drjones@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP - remove a redundant '-display none' - remove a redundant -g from CFLAGS - remove a useless -I../include/x86 from CFLAGS - remove lib autodep files on make clean - v3: reword run_tests.sh help text [Christoffer Dall] Signed-off-by: Andrew Jones --- Makefile | 11 ++++++----- config-x86-common.mak | 16 +++++++--------- run_tests.sh | 6 +++--- x86/README | 38 +++++++++++++++++++++++++++++++------- 4 files changed, 47 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index 278791dbbef23..4bb69427caeba 100644 --- a/Makefile +++ b/Makefile @@ -6,15 +6,15 @@ DESTDIR := $(PREFIX)/share/qemu/tests .PHONY: arch_clean clean #make sure env CFLAGS variable is not used -CFLAGS = -g +CFLAGS = libgcc := $(shell $(CC) --print-libgcc-file-name) libcflat := lib/libcflat.a cflatobjs := \ + lib/argv.o \ lib/printf.o \ lib/string.o -cflatobjs += lib/argv.o #include architecure specific make rules include config-$(ARCH).mak @@ -25,8 +25,9 @@ include config-$(ARCH).mak cc-option = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null \ > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;) -CFLAGS += -O1 -CFLAGS += $(autodepend-flags) -g -fomit-frame-pointer -Wall +CFLAGS += -g +CFLAGS += $(autodepend-flags) -Wall +CFLAGS += $(call cc-option, -fomit-frame-pointer, "") CFLAGS += $(call cc-option, -fno-stack-protector, "") CFLAGS += $(call cc-option, -fno-stack-protector-all, "") CFLAGS += -I. @@ -51,4 +52,4 @@ install: install $(tests_and_config) $(DESTDIR) clean: arch_clean - $(RM) *.o *.a .*.d $(libcflat) $(cflatobjs) + $(RM) *.o *.a .*.d lib/.*.d $(libcflat) $(cflatobjs) diff --git a/config-x86-common.mak b/config-x86-common.mak index bf88c672de472..7e481192a0737 100644 --- a/config-x86-common.mak +++ b/config-x86-common.mak @@ -1,13 +1,9 @@ #This is a make file with common rules for both x86 & x86-64 -CFLAGS += -I../include/x86 - all: test_cases -cflatobjs += \ - lib/x86/io.o \ - lib/x86/smp.o - +cflatobjs += lib/x86/io.o +cflatobjs += lib/x86/smp.o cflatobjs += lib/x86/vm.o cflatobjs += lib/x86/fwcfg.o cflatobjs += lib/x86/apic.o @@ -20,15 +16,17 @@ $(libcflat): LDFLAGS += -nostdlib $(libcflat): CFLAGS += -ffreestanding -I lib CFLAGS += -m$(bits) +CFLAGS += -O1 libgcc := $(shell $(CC) -m$(bits) --print-libgcc-file-name) FLATLIBS = lib/libcflat.a $(libgcc) %.elf: %.o $(FLATLIBS) flat.lds - $(CC) $(CFLAGS) -nostdlib -o $@ -Wl,-T,flat.lds $(filter %.o, $^) $(FLATLIBS) + $(CC) $(CFLAGS) -nostdlib -o $@ -Wl,-T,flat.lds \ + $(filter %.o, $^) $(FLATLIBS) %.flat: %.elf - objcopy -O elf32-i386 $^ $@ + $(OBJCOPY) -O elf32-i386 $^ $@ tests-common = $(TEST_DIR)/vmexit.flat $(TEST_DIR)/tsc.flat \ $(TEST_DIR)/smptest.flat $(TEST_DIR)/port80.flat \ @@ -105,7 +103,7 @@ $(TEST_DIR)/vmx.elf: $(cstart.o) $(TEST_DIR)/vmx.o $(TEST_DIR)/vmx_tests.o arch_clean: $(RM) $(TEST_DIR)/*.o $(TEST_DIR)/*.flat $(TEST_DIR)/*.elf \ - $(TEST_DIR)/.*.d $(TEST_DIR)/lib/.*.d $(TEST_DIR)/lib/*.o + $(TEST_DIR)/.*.d lib/x86/.*.d api/%.o: CFLAGS += -m32 diff --git a/run_tests.sh b/run_tests.sh index 55ecac5bed3a4..e5f960958866e 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -27,7 +27,7 @@ function run() return fi - cmdline="./x86-run $kernel -smp $smp -display none $opts" + cmdline="./x86-run $kernel -smp $smp $opts" if [ $verbose != 0 ]; then echo $cmdline fi @@ -92,8 +92,8 @@ Usage: $0 [-g group] [-h] [-v] -h: Output this help text -v: Enables verbose mode -Set the environment variable QEMU=/path/to/qemu-system-x86_64 to allow the -internally used x86-run to pick up the right qemu binary. +Set the environment variable QEMU=/path/to/qemu-system-ARCH to specify +the appropriate qemu binary for ARCH-run. EOF } diff --git a/x86/README b/x86/README index d644abdf31708..c7ec8d593ede5 100644 --- a/x86/README +++ b/x86/README @@ -1,3 +1,24 @@ + +Tests for x86 architecture are run as kernel images for qemu that supports +multiboot format. Tests use an infrastructure called from the bios code. +The infrastructure initialize the system/cpu's, switch to long-mode and calls +the 'main' function of the individual test. Tests uses a qemu's virtual test +device, named testdev, for services like printing, exiting, query memory +size etc. See file docs/testdev.txt for more details. + +An example of a test invocation: +Using qemu-kvm: + +qemu-kvm -device testdev,chardev=testlog \ + -chardev file,id=testlog,path=msr.out \ + -serial stdio -kernel ./x86/msr.flat +This invocation runs the msr test case. The test outputs to stdio. + +Using qemu (supported since qemu 1.3): +qemu-system-x86_64 -enable-kvm -device pc-testdev -serial stdio \ + -device isa-debug-exit,iobase=0xf4,iosize=0x4 \ + -kernel ./x86/msr.flat + Tests in this directory and what they do: access: lots of page table related access (pte/pde) (read/write) @@ -6,11 +27,14 @@ emulator: move to/from regs, cmps, push, pop, to/from cr8, smsw and lmsw hypercall: intel and amd hypercall insn msr: write to msr (only KERNEL_GS_BASE for now) port80: lots of out to port 80 -realmode: goes back to realmode, shld, push/pop, mov immediate, cmp immediate, add immediate, - io, eflags instructions (clc, cli, etc.), jcc short, jcc near, call, long jmp, xchg -sieve: heavy memory access with no paging and with paging static and with paging vmalloc'ed -smptest: run smp_id() on every cpu and compares return value to number -tsc: write to tsc(0) and write to tsc(100000000000) and read it back -vmexit: long loops for each: cpuid, vmcall, mov_from_cr8, mov_to_cr8, inl_pmtimer, ipi, ipi+halt +realmode: goes back to realmode, shld, push/pop, mov immediate, cmp immediate, + add immediate, io, eflags instructions (clc, cli, etc.), jcc short, + jcc near, call, long jmp, xchg +sieve: heavy memory access with no paging and with paging static and with + paging vmalloc'ed +smptest: run smp_id() on every cpu and compares return value to number +tsc: write to tsc(0) and write to tsc(100000000000) and read it back +vmexit: long loops for each: cpuid, vmcall, mov_from_cr8, mov_to_cr8, + inl_pmtimer, ipi, ipi+halt kvmclock_test: test of wallclock, monotonic cycle and performance of kvmclock -pcid: basic functionality test of PCID/INVPCID feature \ No newline at end of file +pcid: basic functionality test of PCID/INVPCID feature