From patchwork Wed Jul 12 07:59:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 118908 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp989869vqm; Wed, 12 Jul 2023 01:14:30 -0700 (PDT) X-Google-Smtp-Source: APBJJlFulWXHZJMFFCMFlMuVSBdGsnLnl5jEAI9Z/uGtA/+97hUlKe9WmJMwMYhkS7pr2WXV1qtA X-Received: by 2002:a17:903:2351:b0:1b8:77b3:6bf6 with SMTP id c17-20020a170903235100b001b877b36bf6mr16628093plh.33.1689149670543; Wed, 12 Jul 2023 01:14:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689149670; cv=none; d=google.com; s=arc-20160816; b=g7TWeN3WyCSYyABafUuD5c8+WLJuj7XyrsfeuSD39pRRpEQRM0LHBUqcJOQ6eGgCB1 8WKy/hd4Zqeex+GeHgRq6EqJsas/JF/py/vmZyiPiJqUxifNpxoWKfMxEXoC4pc+rRDe LE0NSLRlkWPEfDcvIgsgRYeJZTi5Srhqk4DyoLJaP+17OcAGmHwXZLv8F8jagjAG/qDR 3t03kWF0hCc0aLfqX08O3PF/ZawrWKvMgJmeZh/mia7s2oHenzE/rxiLHcCP0lODmQJy NN/djUxMJcGA8r1FxnQbITzfrx9q1kMQeGHiyRfmDmDRW+Zndcl+T1w6LFhq/yZKwT+Y a2jQ== 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=hgo9YuUU2jqiHTi7UEl9pw/Cu7nUbHUeFZMun2ueh0k=; fh=CoqLVoHqzprQiJNt8WDryjpq4BuBxl6+dCSpUOnVgUQ=; b=Z/JJF/pWczEYZsFh/IOtEq99kFlN+bIpM7wXn5zTS4WKZYrayAt2GSW3IQoafbw7MX SdMaxaL2HF9dAxtPAUyoT6JgCB7VDuc1SBq1icobj5ap/K8H66iowgHj9X/2fn0V/lOl YX1DeyS3SJ8Psth1qNBlMetugECeOh17607kIUAtoygjhMw0+oe41n7FAraabG1vEDiV 90SocE4hOk1NUxXWdHwOCzwxZzmmsWp6X2NLgLvE/YH0K8nlCKBscOWfNZQR98ikmfBJ aQbfhfcBhuOB5oQEOX8dC1oDHSk4sNW4pWh5//GlyCEnfHcwAOuzVBIVhhbtCx4GtVZ+ yr8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Hha/pPzi"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y1-20020a1709027c8100b001b665d8d63asi2895991pll.356.2023.07.12.01.14.16; Wed, 12 Jul 2023 01:14:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Hha/pPzi"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232035AbjGLIAK (ORCPT + 99 others); Wed, 12 Jul 2023 04:00:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231916AbjGLIAI (ORCPT ); Wed, 12 Jul 2023 04:00:08 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6649519B4 for ; Wed, 12 Jul 2023 00:59:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689148763; 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=hgo9YuUU2jqiHTi7UEl9pw/Cu7nUbHUeFZMun2ueh0k=; b=Hha/pPzip5tW473B9u6kl/7Tovl77U0H0NK4X69X4pu7NAoY2ctZ7/ncY09exwndoDXOFK 8i2/bBMxcA/QhAQn6Yxj8C0/p4VQ+T2IBSCipitbqdtLLRCOrkuzk/hBK+mO1NsoxzcpU8 UE/7svSdcEd9ESWrPRQemuJ3/Jg6Phk= 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-178-7NJDwfmRMBCQ48jNY0ihQQ-1; Wed, 12 Jul 2023 03:59:19 -0400 X-MC-Unique: 7NJDwfmRMBCQ48jNY0ihQQ-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4E8358EBBA6; Wed, 12 Jul 2023 07:59:19 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.120]) by smtp.corp.redhat.com (Postfix) with ESMTP id CA7B4492C13; Wed, 12 Jul 2023 07:59:17 +0000 (UTC) From: Thomas Huth To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Paolo Bonzini , Sean Christopherson Cc: linux-kselftest@vger.kernel.org, David Matlack Subject: [PATCH 3/4] KVM: selftests: x86: Use TAP interface in the fix_hypercall test Date: Wed, 12 Jul 2023 09:59:09 +0200 Message-Id: <20230712075910.22480-4-thuth@redhat.com> In-Reply-To: <20230712075910.22480-1-thuth@redhat.com> References: <20230712075910.22480-1-thuth@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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,T_SCC_BODY_TEXT_LINE 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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771201805256469222 X-GMAIL-MSGID: 1771201805256469222 Use the kselftest_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 | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 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..7621942a072ec 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 "kselftest_harness.h" #include "apic.h" #include "test_util.h" #include "kvm_util.h" @@ -126,10 +127,19 @@ static void test_fix_hypercall(bool disable_quirk) enter_guest(vcpu); } -int main(void) +TEST(fix_hypercall) { - TEST_REQUIRE(kvm_check_cap(KVM_CAP_DISABLE_QUIRKS2) & KVM_X86_QUIRK_FIX_HYPERCALL_INSN); - test_fix_hypercall(false); +} + +TEST(fix_hypercall_disable_quirk) +{ test_fix_hypercall(true); } + +int main(int argc, char *argv[]) +{ + TEST_REQUIRE(kvm_check_cap(KVM_CAP_DISABLE_QUIRKS2) & KVM_X86_QUIRK_FIX_HYPERCALL_INSN); + + return test_harness_run(argc, argv); +}