Received: by 2002:a05:7412:518d:b0:e2:908c:2ebd with SMTP id fn13csp356387rdb; Thu, 5 Oct 2023 07:58:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHLmUEDFW6DnxT/1JGDNWygLxJq9k+lQvFrMPrmlluBegpp0vuL4ONKvUr31G3DkVVdTn+D X-Received: by 2002:a17:90a:31c7:b0:271:bc40:5097 with SMTP id j7-20020a17090a31c700b00271bc405097mr5073797pjf.30.1696517905751; Thu, 05 Oct 2023 07:58:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696517905; cv=none; d=google.com; s=arc-20160816; b=RrMaVtfhqKxEhW7UIac0w17TN4KT6oKb/ycNAawHHJaVzcuExhjm4Qg1x3SrKmZJ9T lMLNkdKxUEY84Pbgz9uCPHhbAyEzB3tQvWz7mDl74piK0BIePo5Bd8UMfyhCJQRA9SEQ nxZjUv0NdjXEekCsy0xwK0S6xtdemGzifExHLoc9Qm1gNJDN3I64YRrR7iYoi53HINEZ ydERhXls0XD8TBFTv1scNwqKg05XTJsyw7XMI+aARlhlNdpB+jDRGienm0NbI7VFRtu7 Vo+zLQ4NJUX+U24JIu2OYDizPkdc8gLmhlUhgjZLuUeQ+9n2Ld4Mw+NAe8MLe3zzIr5x Bm5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0ftZTUSszjDaBYMwepJocwkUW/juZNz/Q5LGCufgOFs=; fh=WOoc99rHeo9qxHvnIaWffALNRebT/42m1dldSuRpBY0=; b=u6f5L5dmodxxJYDO/O6Dart+iiUhrxgzfAquGJWabdi5S/a4bh+F133AcNZML8XLyF qjcwtYt84njxc80z7uv7kJDj2jrpxGZq3LXK3OkCsUCnPCU2hFabFpFZ7Fs3gkLwgtGE PmR7/hZFtFNrtkNPr3x11zkgJ4bwxgupUM25Jn78nT7BIMOxfLsgWiOMf2TA9OkvK8IZ KwRTv/HhOhxVJfNPTyU2cMAw20sj9VgYmVAnVnu7EiOdIYMEPs4ERxawuoedkpet1Lgr i+c65Hj7xqix1iRCZ2IgpXfRAghkyVxt8hH82Cb7+A9FHonaOYnCms4UyMlnwNHe5+px E9vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SnBYr1fN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id ls11-20020a17090b350b00b002746ab58dfcsi1910160pjb.18.2023.10.05.07.58.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 07:58:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SnBYr1fN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 9B97C867FEA3; Thu, 5 Oct 2023 07:58:24 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234328AbjJEO5C (ORCPT + 99 others); Thu, 5 Oct 2023 10:57:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237666AbjJEOzg (ORCPT ); Thu, 5 Oct 2023 10:55:36 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79D7826A74 for ; Thu, 5 Oct 2023 07:38:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696516732; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0ftZTUSszjDaBYMwepJocwkUW/juZNz/Q5LGCufgOFs=; b=SnBYr1fN+gmtbBOEPqNRfvkw3U87jMSZTS60h1T55lDcILw9Fux3LQr4RX//jyrSEcBHuH f0LsqWuPKhtfcOdr1viKUgGmOY43ahestB3E7ezzrgIu6NIihydrnVdhD/X58VWSB2eSXF iWh/LBLhd/J8lh0PVlGPFIfVq1dQq/Q= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-627-HpW_D5Y1Peequ5SsnYIDUA-1; Thu, 05 Oct 2023 10:38:50 -0400 X-MC-Unique: HpW_D5Y1Peequ5SsnYIDUA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C216981D795; Thu, 5 Oct 2023 14:38:49 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.168]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8DC9340C6EA8; Thu, 5 Oct 2023 14:38:48 +0000 (UTC) From: Thomas Huth To: Sean Christopherson , Paolo Bonzini , kvm@vger.kernel.org Cc: Shuah Khan , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v2 5/7] KVM: selftests: x86: Use TAP interface in the fix_hypercall test Date: Thu, 5 Oct 2023 16:38:37 +0200 Message-ID: <20231005143839.365297-6-thuth@redhat.com> In-Reply-To: <20231005143839.365297-1-thuth@redhat.com> References: <20231005143839.365297-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 05 Oct 2023 07:58:24 -0700 (PDT) Use the kvm_test_harness.h interface in this test to get TAP output, so that it is easier for the user to see what the test is doing. Signed-off-by: Thomas Huth --- .../selftests/kvm/x86_64/fix_hypercall_test.c | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/tools/testing/selftests/kvm/x86_64/fix_hypercall_test.c b/tools/testing/selftests/kvm/x86_64/fix_hypercall_test.c index 0f728f05ea82f..59c389aff3961 100644 --- a/tools/testing/selftests/kvm/x86_64/fix_hypercall_test.c +++ b/tools/testing/selftests/kvm/x86_64/fix_hypercall_test.c @@ -9,6 +9,7 @@ #include #include +#include "kvm_test_harness.h" #include "apic.h" #include "test_util.h" #include "kvm_util.h" @@ -83,6 +84,8 @@ static void guest_main(void) GUEST_DONE(); } +KVM_ONE_VCPU_TEST_SUITE(fix_hypercall, guest_main); + static void enter_guest(struct kvm_vcpu *vcpu) { struct kvm_run *run = vcpu->run; @@ -103,14 +106,11 @@ static void enter_guest(struct kvm_vcpu *vcpu) } } -static void test_fix_hypercall(bool disable_quirk) +static void test_fix_hypercall(struct kvm_vcpu *vcpu, bool disable_quirk) { - struct kvm_vcpu *vcpu; - struct kvm_vm *vm; - - vm = vm_create_with_one_vcpu(&vcpu, guest_main); + struct kvm_vm *vm = vcpu->vm; - vm_init_descriptor_tables(vcpu->vm); + vm_init_descriptor_tables(vm); vcpu_init_descriptor_tables(vcpu); vm_install_exception_handler(vcpu->vm, UD_VECTOR, guest_ud_handler); @@ -126,10 +126,19 @@ static void test_fix_hypercall(bool disable_quirk) enter_guest(vcpu); } -int main(void) +KVM_ONE_VCPU_TEST(fix_hypercall, enable_quirk) +{ + test_fix_hypercall(vcpu, false); +} + +KVM_ONE_VCPU_TEST(fix_hypercall, disable_quirk) +{ + test_fix_hypercall(vcpu, true); +} + +int main(int argc, char *argv[]) { TEST_REQUIRE(kvm_check_cap(KVM_CAP_DISABLE_QUIRKS2) & KVM_X86_QUIRK_FIX_HYPERCALL_INSN); - test_fix_hypercall(false); - test_fix_hypercall(true); + return test_harness_run(argc, argv); } -- 2.41.0