From patchwork Fri Aug 30 20:40:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nadav Amit X-Patchwork-Id: 11124747 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 96CCA1510 for ; Sat, 31 Aug 2019 04:01:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7FFAF23697 for ; Sat, 31 Aug 2019 04:01:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725909AbfHaEBL (ORCPT ); Sat, 31 Aug 2019 00:01:11 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:36191 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725781AbfHaEBL (ORCPT ); Sat, 31 Aug 2019 00:01:11 -0400 Received: by mail-wm1-f67.google.com with SMTP id p13so9363279wmh.1 for ; Fri, 30 Aug 2019 21:01:09 -0700 (PDT) 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=w+95+WjAN0K6CXfamZriaVlxGVr5jfuNDPza814XqZQ=; b=AsmQY63eTDxmq3DrXHmvY77bvkuISoBkV7VkJVpXgxLzStMgWbLCJvkcc0T3X4k7cO CRQDdYuawX5dorEMWGtRKJzsxW0MkGgSbdDDJuzYbnJModSz8azXDmB/6sBNjeRZGR17 Z28vXA3iSre8zIQwR4RVz9ki93uzogtWsUsRYZc1dDewd27gAf0QdEeNYBVKIzUChadq 0e9HhmJ5u1nubtGM6iTKkyO+Cd7pZ8AcrhWnxA+bPPRVe7npCatZO16Wf+ETh53yNlkK 6aqIUhDaBC1uEE65s7MSlqlbs9fdLHgoRPWXV2z5nsw5Nso/6zQBSdODXJWYwakPyKZX Lp3g== X-Gm-Message-State: APjAAAXjc9D2znOEGBAGSsbe9N8zONXaL/ceSyfW21yT/WZMZCtEkRrh vyquOTqBCDcI5DyOuwcK8rY= X-Google-Smtp-Source: APXvYqw+n0LzjMqWRWckMdUShFUMfRbdcGvoGkx2tqK9H4wvBR4SC81kXivYX8EPXLjJHihu2DDQgA== X-Received: by 2002:a7b:c758:: with SMTP id w24mr11722472wmk.143.1567224069029; Fri, 30 Aug 2019 21:01:09 -0700 (PDT) Received: from sc2-haas01-esx0118.eng.vmware.com ([66.170.99.1]) by smtp.gmail.com with ESMTPSA id e4sm4656470wro.21.2019.08.30.21.01.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Aug 2019 21:01:08 -0700 (PDT) From: Nadav Amit To: Paolo Bonzini Cc: kvm@vger.kernel.org, Nadav Amit , Krish Sadhukhan Subject: [kvm-unit-tests PATCH 1/2] x86: nVMX: Do not use test_skip() when multiple tests are run Date: Fri, 30 Aug 2019 13:40:30 -0700 Message-Id: <20190830204031.3100-2-namit@vmware.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190830204031.3100-1-namit@vmware.com> References: <20190830204031.3100-1-namit@vmware.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Using test_skip() when multiple tests are run causes all the following tests to be skipped. Instead, just print a message and return. Fixes: 47cc3d85c2fe ("nVMX x86: Check PML and EPT on vmentry of L2 guests") Fixes: 7fd449f2ed2e ("nVMX x86: Check VPID value on vmentry of L2 guests") Fixes: 181219bfd76b ("x86: Add test for checking NMI controls on vmentry of L2 guests") Fixes: 1d70eb823e12 ("nVMX x86: Check EPTP on vmentry of L2 guests") Cc: Krish Sadhukhan Signed-off-by: Nadav Amit --- x86/vmx_tests.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c index f035f24..4ff1570 100644 --- a/x86/vmx_tests.c +++ b/x86/vmx_tests.c @@ -4040,7 +4040,7 @@ static void test_vpid(void) if (!((ctrl_cpu_rev[0].clr & CPU_SECONDARY) && (ctrl_cpu_rev[1].clr & CPU_VPID))) { - test_skip("Secondary controls and/or VPID not supported"); + printf("Secondary controls and/or VPID not supported\n"); return; } @@ -4544,7 +4544,7 @@ static void test_nmi_ctrls(void) if ((ctrl_pin_rev.clr & (PIN_NMI | PIN_VIRT_NMI)) != (PIN_NMI | PIN_VIRT_NMI)) { - test_skip("NMI exiting and Virtual NMIs are not supported !"); + printf("NMI exiting and Virtual NMIs are not supported !\n"); return; } @@ -4657,7 +4657,7 @@ static void test_ept_eptp(void) if (!((ctrl_cpu_rev[0].clr & CPU_SECONDARY) && (ctrl_cpu_rev[1].clr & CPU_EPT))) { - test_skip("\"CPU secondary\" and/or \"enable EPT\" execution controls are not supported !"); + printf("\"CPU secondary\" and/or \"enable EPT\" execution controls are not supported !\n"); return; } @@ -4844,7 +4844,7 @@ static void test_pml(void) if (!((ctrl_cpu_rev[0].clr & CPU_SECONDARY) && (ctrl_cpu_rev[1].clr & CPU_EPT) && (ctrl_cpu_rev[1].clr & CPU_PML))) { - test_skip("\"Secondary execution\" control or \"enable EPT\" control or \"enable PML\" control is not supported !"); + printf("\"Secondary execution\" control or \"enable EPT\" control or \"enable PML\" control is not supported !\n"); return; } From patchwork Fri Aug 30 20:40:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nadav Amit X-Patchwork-Id: 11124749 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C249D14DE for ; Sat, 31 Aug 2019 04:01:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A132623431 for ; Sat, 31 Aug 2019 04:01:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725923AbfHaEBM (ORCPT ); Sat, 31 Aug 2019 00:01:12 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:36191 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725869AbfHaEBM (ORCPT ); Sat, 31 Aug 2019 00:01:12 -0400 Received: by mail-wm1-f65.google.com with SMTP id p13so9363316wmh.1 for ; Fri, 30 Aug 2019 21:01:11 -0700 (PDT) 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=2SGBxTSihRQiNkFL8Y8qSe9MWq+oc5ynCFmmFdrSUI0=; b=Tu757sYJZlC6KA38K4FKyW9rfsuiCGmEN3yhmJU3AcbIDMeCC8NQV+6tq24W7k/nhD LmzU0BNTqvLWk1UyHoViFJZrmqzue0sji87S3PfPfqh+wv+kDrnizDBzqwiAvr/jZoMq QQOMJ69dubmW7wx4/jdjwBEW1t0E3h3qLXUq2Te1vTu+dBqoLidWh8dL0GnyiRAXPbTg mUXUt+27tiopnJ7gZRhRpWi+vZG2CX/3BvSIQM5au//DToZBme7k8/msdvmv1wCOF+jb v8DWhvdokcxuzAmsEdwUw0T/4cDrCSGzGLW9ef+ZGCEjPOstNymnTaDncugswtalANwV FJog== X-Gm-Message-State: APjAAAW+3dO4Zeh3WablKEOnQx6Hbka8e7omvevN7ri+5E4xc12LRA30 vI+a8wHo/JQ8scefVYkF4e4= X-Google-Smtp-Source: APXvYqx0yIl/NtI15eaBMBmfavZ2e7vBFi7OAxtpzQ6pgxIeQfVaaP5urLMLf7M+NFYmVoq1ocPP8Q== X-Received: by 2002:a1c:cfc9:: with SMTP id f192mr7396348wmg.85.1567224070632; Fri, 30 Aug 2019 21:01:10 -0700 (PDT) Received: from sc2-haas01-esx0118.eng.vmware.com ([66.170.99.1]) by smtp.gmail.com with ESMTPSA id e4sm4656470wro.21.2019.08.30.21.01.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Aug 2019 21:01:10 -0700 (PDT) From: Nadav Amit To: Paolo Bonzini Cc: kvm@vger.kernel.org, Nadav Amit , Marc Orr Subject: [kvm-unit-tests PATCH 2/2] x86: nVMX: Fix wrong reserved bits of error-code Date: Fri, 30 Aug 2019 13:40:31 -0700 Message-Id: <20190830204031.3100-3-namit@vmware.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190830204031.3100-1-namit@vmware.com> References: <20190830204031.3100-1-namit@vmware.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org The SDM indeed says that "If deliver-error-code is 1, bits 31:15 of the VM-entry exception error-code field are 0." However, the SDM is wrong, and bits that need to be zeroed are 31:16. Our engineers confirmed that the SDM is wrong with Intel. Fix the test. Note that KVM should be fixed as well. Fixes: 8d2cdb35a07a ("x86: Add test for nested VM entry prereqs") Cc: Marc Orr Signed-off-by: Nadav Amit Reviewed-by: Sean Christopherson --- x86/vmx_tests.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c index 4ff1570..37c56df 100644 --- a/x86/vmx_tests.c +++ b/x86/vmx_tests.c @@ -4306,15 +4306,15 @@ skip_unrestricted_guest: /* * If deliver-error-code is 1 - * bits 31:15 of the VM-entry exception error-code field are 0. + * bits 31:16 of the VM-entry exception error-code field are 0. */ ent_intr_info = ent_intr_info_base | INTR_INFO_DELIVER_CODE_MASK | INTR_TYPE_HARD_EXCEPTION | GP_VECTOR; report_prefix_pushf("%s, VM-entry intr info=0x%x", - "VM-entry exception error code[31:15] clear", + "VM-entry exception error code[31:16] clear", ent_intr_info); vmcs_write(ENT_INTR_INFO, ent_intr_info); - for (cnt = 15; cnt <= 31; cnt++) { + for (cnt = 16; cnt <= 31; cnt++) { ent_intr_err = 1U << cnt; report_prefix_pushf("VM-entry intr error=0x%x [-]", ent_intr_err);