From patchwork Fri Apr 21 00:49:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Matlack X-Patchwork-Id: 9691563 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F007E6038D for ; Fri, 21 Apr 2017 00:51:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E28582843F for ; Fri, 21 Apr 2017 00:51:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D79D12847C; Fri, 21 Apr 2017 00:51:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 86F7C2843F for ; Fri, 21 Apr 2017 00:51:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1034333AbdDUAv1 (ORCPT ); Thu, 20 Apr 2017 20:51:27 -0400 Received: from mail-oi0-f51.google.com ([209.85.218.51]:34971 "EHLO mail-oi0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1033931AbdDUAu2 (ORCPT ); Thu, 20 Apr 2017 20:50:28 -0400 Received: by mail-oi0-f51.google.com with SMTP id j201so73635112oih.2 for ; Thu, 20 Apr 2017 17:50:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=CNRynOyYIjrt4KBvJfnvz7hx2UgRzolDDrQ4nxXPQWc=; b=f1fx0XdVBGPVbJ0Zut2Ujya+RlxmE8ETRYZW1DF0+lCz5EdKqOmneWdtbi2SnKZYo4 MuXC/dSj+8XmbWTVhr2syt0EQRpzXyPjjbaLs5UqeTDVbcOIML5M9eIT/gM7rcF/hOtB FxHMzPdEBKJmzSZzOd9SgCqNpn1FSGZvSvltKqWYNERJDYpjG4gxjQ0BO0pncFhE7p8B Yzf4GYmR0l7deOdhDEUPpnXDdGQh87fqZVL2g3lN86plvdM6ECJIcJtDJlBs9I/WKZCI +TcT1zqoOHjR6s/AhthcBcI9cGp64+RN/fBGzxLyYT1MH9S9IrjB9nbpoXWbdHlDhaMo xu4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=CNRynOyYIjrt4KBvJfnvz7hx2UgRzolDDrQ4nxXPQWc=; b=TSTeHGg3+EdqdMKh+BcWqfBD5YjlsRrWKTA8tXOq+nvlYVUQeJXvkBtLt0Ld7nDP6N j8BSedFwl0oxLdkm7sPNQrtdxm68P5920vNfqX1i/WR036uoJUNKvzO44ClCygPHj8/H Mxe3NH6je+DEoZo6glTMSW5sqIA+XDWVpoU9pkjyuBH8clZ4jKMHStKjaEFRfousnIqh d2OyWk6DJIeMPP8grRE7O+2fKdPGphi440eigH8LLEt1b4D7qBn/fwZtcfypCKE8jVPQ U+oSmRw+0GH39RU5g6zEMBgO5kFKmFwkOWijnk/0eeAWrvnfKyLANwXDKyq2dm6Is0vQ gP/A== X-Gm-Message-State: AN3rC/7SztbHBntTzSwqVLL+hZz4GvNwWOvaQEtDPUqSFAjbflx6a+ch u1ZKV6ybwJKTN8iR X-Received: by 10.84.178.131 with SMTP id z3mr12756032plb.139.1492735820903; Thu, 20 Apr 2017 17:50:20 -0700 (PDT) Received: from dmatlack.sea.corp.google.com ([100.100.206.82]) by smtp.gmail.com with ESMTPSA id e13sm12466486pfb.30.2017.04.20.17.50.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 20 Apr 2017 17:50:20 -0700 (PDT) From: David Matlack To: kvm@vger.kernel.org Cc: Peter Feiner , David Matlack Subject: [kvm-unit-tests PATCH 13/32] x86: don't special case vmx null test Date: Thu, 20 Apr 2017 17:49:45 -0700 Message-Id: <20170421005004.137260-14-dmatlack@google.com> X-Mailer: git-send-email 2.12.2.816.g2cccc81164-goog In-Reply-To: <20170421005004.137260-1-dmatlack@google.com> References: <20170421005004.137260-1-dmatlack@google.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Peter Feiner Signed-off-by: Peter Feiner Signed-off-by: David Matlack --- x86/unittests.cfg | 6 ++++++ x86/vmx.c | 25 ++++--------------------- x86/vmx_tests.c | 1 + 3 files changed, 11 insertions(+), 21 deletions(-) diff --git a/x86/unittests.cfg b/x86/unittests.cfg index 0f2c94fb548d..8a89eb0ef0ad 100644 --- a/x86/unittests.cfg +++ b/x86/unittests.cfg @@ -200,6 +200,12 @@ extra_params = -cpu host,+vmx -append -exit_monitor_from_l2_test arch = x86_64 groups = vmx +[vmx_null] +file = vmx.flat +extra_params = -cpu host,+vmx -append null +arch = x86_64 +groups = vmx + [vmx_test_vmx_feature_control] file = vmx.flat extra_params = -cpu host,+vmx -append test_vmx_feature_control diff --git a/x86/vmx.c b/x86/vmx.c index 9ca37f63b636..15ed94af56fd 100644 --- a/x86/vmx.c +++ b/x86/vmx.c @@ -563,14 +563,6 @@ static void test_vmclear(void) test_vmclear_flushing(); } -static void test_vmxoff(void) -{ - int ret; - - ret = vmx_off(); - report("test vmxoff", !ret); -} - static void __attribute__((__used__)) guest_main(void) { current->guest_main(); @@ -1550,9 +1542,6 @@ int main(int argc, const char *argv[]) wrmsr(MSR_IA32_FEATURE_CONTROL, 0x5); } - /* Set basic test ctxt the same as "null" */ - current = &vmx_tests[0]; - if (test_wanted("test_vmxon", argv, argc)) { /* Enables VMX */ if (test_vmxon() != 0) @@ -1574,19 +1563,13 @@ int main(int argc, const char *argv[]) test_vmwrite_vmread(); if (test_wanted("test_vmcs_lifecycle", argv, argc)) test_vmcs_lifecycle(); - - init_vmcs(&vmcs_root); - if (vmx_run()) { - report("test vmlaunch", 0); - goto exit; - } - - test_vmxoff(); - if (test_wanted("test_vmx_caps", argv, argc)) test_vmx_caps(); - while (vmx_tests[++i].name != NULL) { + /* Balance vmxon from test_vmxon. */ + vmx_off(); + + for (; vmx_tests[i].name != NULL; i++) { if (!test_wanted(vmx_tests[i].name, argv, argc)) continue; if (test_run(&vmx_tests[i])) diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c index 35af67744971..918cade2a3e8 100644 --- a/x86/vmx_tests.c +++ b/x86/vmx_tests.c @@ -29,6 +29,7 @@ static inline void vmcall() void basic_guest_main() { + report("Basic VMX test", 1); } int basic_exit_handler()