Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp526468rdb; Thu, 8 Feb 2024 12:51:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IGYLpQ5SdGKPe6WXrLuCzwX6erh5CBihMHOTVaFcd+OFDjINrEkoXmD4xayek8iKmsBtnrA X-Received: by 2002:a2e:3c19:0:b0:2d0:be0f:96ff with SMTP id j25-20020a2e3c19000000b002d0be0f96ffmr393535lja.17.1707425492388; Thu, 08 Feb 2024 12:51:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707425492; cv=pass; d=google.com; s=arc-20160816; b=bWo6Vg8MiY6hAHljFOLRjXLoGEWK2EcFbDrljfqo0LKUtim2V4euT1nJi2gPIukglN OA/E49c7fdpcerSVDSCZguHNHHVvIvyzlUPv5rNDULshRBMtBBFYZV582b29um4ijpq7 XOKK+ue9yCIKgCe30EFjF+I6q4Vn0sz0E+2jjZYUVyivRpHPz3PauzFsLlxcZt56MgDW 67C551RzsYJx3DTi5rnfM/Xx5xbUg8+eUc6Ps3shsMgW/xMSmjw1FpW37kOUjuyYD7Wi cc8ARrtNjWwqzABI/1XBWpZ3zEm94z57xT5zxummxe0fEMkCFJQmd0dxLxuGtluihX9k pTlQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=1FjsFqrrKXsl521gM/hDv0+tlQIs54sn7FNkgqZxeow=; fh=eRDJoPtDHLADFf8+TP7gh21pbgI/c5mhM9lWQiTWuF4=; b=QVL7iCaoO01wzs6tpJY+I4qB/o6ERJRDlZYD0ZN4elJ9W0liuljhUnOFBYHdTVPkzg z6JdmLOsKAhJCUGAu9agDDjDdLxDRY2MVE18jFRwTHzdzkykZ747hHtGOrZMWymP+/ua GIvSF6MNJrOiuxHHWbVcsBAWeKTiDL2KraAFo2+yvDHEZH0jPFJ8Lmu4tEVrw+3obOh7 mmrwSkWT8WZmrTbS4Ig0IyYhObR1Q7JafPjk1m1DIsM6wjytxETB3GCbTAEJyR2CwyIR B8Z+bSNZADNBqKainkcmLqizdApP/POfiLQi1S4b1Wsj+pCV0YFGwIubeA23ds5x/lk5 QHWA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NQQSL2sK; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-58683-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58683-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Forwarded-Encrypted: i=2; AJvYcCWOyhD0bmtAjTcRlZe24G9KM/smu5MLhZEQi4rb+JTlxPel+SP8WJR2HUDoz6zRQ1OlpzUxhjaK0BqEcTBpd0qp90JIdpwjqJm2CovLKw== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id cx24-20020a05640222b800b005612755663asi96069edb.113.2024.02.08.12.51.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 12:51:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58683-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NQQSL2sK; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-58683-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58683-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 4C7201F21500 for ; Thu, 8 Feb 2024 20:51:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 98B6451016; Thu, 8 Feb 2024 20:49:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="NQQSL2sK" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 283ED4F8A3 for ; Thu, 8 Feb 2024 20:49:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707425348; cv=none; b=c759/FIwl4j4rNQqc9CWEuUpJyvB8gNwbCxgOKilRI4zSNNecW5KYIpOp+mPshOkDsisEXDaqj+fF9+ComTXxqsqQeL62qCgfVV74Lh9ZI7Yin47+UXIrh/r390M+J7OCGqhlMIX39/AAgwpa4nFraXhkwyzFqOBExTgFe6EYq4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707425348; c=relaxed/simple; bh=W5to7iDa4oRE760XTEaEtgW3bD/CXiFOButwlNgLoZg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=An/6SpjFEwjVUs+QzzEHoyNisSQ9xm7cYz0G9IaDRiAoa5OCB/KevWuuGQmmLswDN4Tz3RK0/wYKz+JmDgtAWUqgjqRx7qZFEuSedK67e8k9S4faP2kUA+Cq4q+HGaD/CGbh4ZBeNCRord2CCz6Dl+oL8H5+fTxWNNAKbZM7qG0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=NQQSL2sK; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707425346; 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=1FjsFqrrKXsl521gM/hDv0+tlQIs54sn7FNkgqZxeow=; b=NQQSL2sKXY5WrsgmBmIy14nII5cq5uz9Cx89PCGFaXw4D/oKXmr9YZa4Fx7WbUGWIAlGuz uuGIekkWLkrKICZgg+Yf2C5iLKx0Up+Ujr0Dwwn0bNWMaTRA5ZNENd/fb5rWIyvF26D3/t lanXwIiwYZocHdArABzew21fkofOhTE= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-528-Ckeg5F9OOzOY29lxHvM9Pg-1; Thu, 08 Feb 2024 15:49:01 -0500 X-MC-Unique: Ckeg5F9OOzOY29lxHvM9Pg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 75C5F29AA3AC; Thu, 8 Feb 2024 20:49:00 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6F46D1C10C0E; Thu, 8 Feb 2024 20:48:58 +0000 (UTC) From: Thomas Huth To: kvm@vger.kernel.org, Sean Christopherson Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Paolo Bonzini , Andrew Jones Subject: [PATCH v3 6/8] KVM: selftests: x86: Use TAP interface in the fix_hypercall test Date: Thu, 8 Feb 2024 21:48:42 +0100 Message-ID: <20240208204844.119326-7-thuth@redhat.com> In-Reply-To: <20240208204844.119326-1-thuth@redhat.com> References: <20240208204844.119326-1-thuth@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 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..f3c2239228b10 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); + 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, guest_main) +{ + test_fix_hypercall(vcpu, false); +} + +KVM_ONE_VCPU_TEST(fix_hypercall, disable_quirk, guest_main) +{ + 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.43.0