From patchwork Wed Jul 18 20:26:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 10533233 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 151C8602CA for ; Wed, 18 Jul 2018 20:27:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 080AC29D71 for ; Wed, 18 Jul 2018 20:27:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F0CB029D78; Wed, 18 Jul 2018 20:27:08 +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=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 9BC2629D71 for ; Wed, 18 Jul 2018 20:27:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730436AbeGRVGj (ORCPT ); Wed, 18 Jul 2018 17:06:39 -0400 Received: from mga12.intel.com ([192.55.52.136]:37426 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730397AbeGRVGj (ORCPT ); Wed, 18 Jul 2018 17:06:39 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Jul 2018 13:27:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,371,1526367600"; d="scan'208";a="68004822" Received: from sjchrist-coffee.jf.intel.com ([10.54.74.132]) by orsmga003.jf.intel.com with ESMTP; 18 Jul 2018 13:27:06 -0700 From: Sean Christopherson To: kvm@vger.kernel.org, pbonzini@redhat.com, rkrcmar@redhat.com Cc: sean.j.christopherson@intel.com, Krish Sadhukhan Subject: [PATCH kvm-unit-tests 2/4] x86: vmx: shift TPR threshold when generating vTPR Date: Wed, 18 Jul 2018 13:26:49 -0700 Message-Id: <20180718202651.19802-3-sean.j.christopherson@intel.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180718202651.19802-1-sean.j.christopherson@intel.com> References: <20180718202651.19802-1-sean.j.christopherson@intel.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The TPR thresold field stores its value in bits 3:0, while the vTPR's effective value is in bits 7:4. Shift the threshold value accordingly when generating an "interesting" vTPR, otherwise we'll always use an effective vTPR of 0, which is...uninteresting. Cc: Krish Sadhukhan Signed-off-by: Sean Christopherson Reviewed-by: Krish Sadhukhan --- 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 ab6e089..c4803a3 100644 --- a/x86/vmx_tests.c +++ b/x86/vmx_tests.c @@ -4010,9 +4010,9 @@ static void test_invalid_event_injection(void) */ static void test_vtpr_values(unsigned threshold) { - try_tpr_threshold_and_vtpr(threshold, threshold - 1); - try_tpr_threshold_and_vtpr(threshold, threshold); - try_tpr_threshold_and_vtpr(threshold, threshold + 1); + try_tpr_threshold_and_vtpr(threshold, (threshold - 1) << 4); + try_tpr_threshold_and_vtpr(threshold, threshold << 4); + try_tpr_threshold_and_vtpr(threshold, (threshold + 1) << 4); } static void try_tpr_threshold(unsigned threshold)