Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp526057rdb; Thu, 8 Feb 2024 12:50:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IFMsE5Xrygbdwtei5FE+j9Ty2X4/UruYuAySRT7zK/vICIm+mkXioKjEdUjxUC5xOqUf12S X-Received: by 2002:a05:6a20:b797:b0:19b:81be:34e4 with SMTP id fh23-20020a056a20b79700b0019b81be34e4mr564442pzb.50.1707425437497; Thu, 08 Feb 2024 12:50:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707425437; cv=pass; d=google.com; s=arc-20160816; b=zeDp8m4Hb91pX+Kaov9se0t40J9PfTY6BzW6nj6J60MxJDM2Tlb5tyKPIT2fegfz6m VCm7hSYjzjsfFFdZg7pa0naztOLqbdqwkQNP2bXrB72dk/vqHnCJpIrX5/U3b0wJ/SXd ML7fLHyYOs+wC0vQrgGzHv92oimF263O7e9wumGswDjsX9h8BP5OAi6nw72UYVRhuTB7 NjvPmYpqIcphwZvYBYaR0iyvDsAqOhu5ji4L4AqurRLWqTHjIdvvzyIanzFJh4oDK1QR oxYYqQgsef3haPxX3tl0j4KW9zLAEBoJgZGRUx07CwLBMYCWy+jMra3QfsEgx/0+6a6e WLCQ== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=NjzbgvZWqOOP842jfLLt5QLs4+yDffYTw25/cut6/mc=; fh=NIJX2h7CqAnQvNQOA1+oh+XzpzS0jxFtccXKxdOQKs8=; b=sngshTzi1fAsxFqu8n5EH2yutYcD/aFZTiiL5slKURPV0DRIDTsyzIlJgNSOdrgWjl YQHGfNgbG9jl1nu4oUfhhYmjHc7IHANylz91bNss8DobyGCkZWPThpTPEhedGtGc/Qzf jI/YlWputPl0oBQ51wzwfhKOlrCk/x1gPwTmlDEla0NfIV1TYCgPPR7KbmTN0fPA5PF1 2I7idRl1kDiWz1MvP7nQ0lk4cO+O2+IUh14WMvwJ8wI+IGNMZxNXGrKLfFfaXVAzEoAl fE3o99KGv67NtJW0rvzp6/Wfql0jJT8TFI6Drm15RcMZkY6jqJgdEXKZtlm7qnm57/Ln bhbw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KHz2HL8O; 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-58677-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58677-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; AJvYcCWC0ztelM+Wlj9prVLVntqdu5kOetTpifGI97ChJGrjnSSZ3H9KtSf3Sc3Kj4o5ah21EekMtb/YyliKCy+6YbiyZspFUquaG18tkxjnpA== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id z2-20020a633302000000b005dbf22da5e9si382751pgz.470.2024.02.08.12.50.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 12:50:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58677-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KHz2HL8O; 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-58677-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58677-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id CA92928311E for ; Thu, 8 Feb 2024 20:49:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1E13F4EB4B; Thu, 8 Feb 2024 20:48:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="KHz2HL8O" 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 B2056381D1 for ; Thu, 8 Feb 2024 20:48:53 +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=1707425335; cv=none; b=ld2Qg+PzfC3uldJPPeHkXfZqJm2NNVsP4SQODfZp+Xe8y3of/cVkh+qNLphRf0AoEfQlGpAhAHwD6mWdohKaSEEPcev6xG1ExDISrj7NaPwFmFiN2WHhk8H0uZgKfNJyAeqnjHJtUosmOQs+kQiAjQ0ToUMLAqXXO/yWwlUdcuc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707425335; c=relaxed/simple; bh=hQPpfJEcu1TBw9wCkVbp3RFuJW56wCEGbFWMn8aip4k=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=knFq5pAetdILysBs1DWaRv5aYUJ2tt1trmpbFEH0f/wzhvE4XIUvV3ROEsM7T9MEHBZAyCzaqbn/LL0/vPd5kQOyJkQcLiGfQEdajBHLTF+JRarWLB8B40OD01oXMVV1QOcBX7RXmNqaP5i03e4RLk3YVfPs0hYTGj1xMM9pPGw= 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=KHz2HL8O; 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=1707425332; 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; bh=NjzbgvZWqOOP842jfLLt5QLs4+yDffYTw25/cut6/mc=; b=KHz2HL8ODyL8fe7OC3vB+LtiD8YGb10Eu2kOW7ku4G+GZR7Mv6Zrglbb8WU7rzCarHPxT9 kTJyqk5Bf3GCVXy1NciQevPmKWZJ5od2kz5p7p6U3SV77fWNz0iJRRYq/260L7Jl5YXqfW c+OX0dyKxPb3Ei+O0A1ff+pLf/lntG0= 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-604-Zf_C2lMwNNSk9wblRrq7XQ-1; Thu, 08 Feb 2024 15:48:48 -0500 X-MC-Unique: Zf_C2lMwNNSk9wblRrq7XQ-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 886B73810790; Thu, 8 Feb 2024 20:48:47 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id D81121C10C0C; Thu, 8 Feb 2024 20:48:45 +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 0/8] Use TAP in some more x86 KVM selftests Date: Thu, 8 Feb 2024 21:48:36 +0100 Message-ID: <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 Basic idea of this series is now to use the kselftest_harness.h framework to get TAP output in the tests, so that it is easier for the user to see what is going on, and e.g. to be able to detect whether a certain test is part of the test binary or not (which is useful when tests get extended in the course of time). Since most tests also need a vcpu, we introduce our own macros to define such tests, so we don't have to repeat this code all over the place. v3: - Add patch from Sean to allow setting vCPU's entry points seperately - Let each test define the entry point via KVM_ONE_VCPU_TEST(), don't do it globally from KVM_ONE_VCPU_TEST_SUITE() v2: - Dropped the "Rename the ASSERT_EQ macro" patch (already merged) - Split the fixes in the sync_regs_test into separate patches (see the first two patches) - Introduce the KVM_ONE_VCPU_TEST_SUITE() macro as suggested by Sean (see third patch) and use it in the following patches - Add a new patch to convert vmx_pmu_caps_test.c, too Sean Christopherson (1): KVM: selftests: Move setting a vCPU's entry point to a dedicated API Thomas Huth (7): KVM: selftests: x86: sync_regs_test: Use vcpu_run() where appropriate KVM: selftests: x86: sync_regs_test: Get regs structure before modifying it KVM: selftests: Add a macro to define a test with one vcpu KVM: selftests: x86: Use TAP interface in the sync_regs test KVM: selftests: x86: Use TAP interface in the fix_hypercall test KVM: selftests: x86: Use TAP interface in the vmx_pmu_caps test KVM: selftests: x86: Use TAP interface in the userspace_msr_exit test .../selftests/kvm/include/kvm_test_harness.h | 36 ++++++ .../selftests/kvm/include/kvm_util_base.h | 11 +- .../selftests/kvm/lib/aarch64/processor.c | 23 +++- .../selftests/kvm/lib/riscv/processor.c | 9 +- .../selftests/kvm/lib/s390x/processor.c | 13 +- .../selftests/kvm/lib/x86_64/processor.c | 13 +- .../selftests/kvm/x86_64/fix_hypercall_test.c | 27 ++-- .../selftests/kvm/x86_64/sync_regs_test.c | 121 +++++++++++++----- .../kvm/x86_64/userspace_msr_exit_test.c | 52 ++------ .../selftests/kvm/x86_64/vmx_pmu_caps_test.c | 50 ++------ 10 files changed, 215 insertions(+), 140 deletions(-) create mode 100644 tools/testing/selftests/kvm/include/kvm_test_harness.h -- 2.43.0