From patchwork Tue Feb 4 15:00:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 11364781 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 528BC1395 for ; Tue, 4 Feb 2020 15:01:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2FE512087E for ; Tue, 4 Feb 2020 15:01:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ced4XvfP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727419AbgBDPA6 (ORCPT ); Tue, 4 Feb 2020 10:00:58 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:36823 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727305AbgBDPA6 (ORCPT ); Tue, 4 Feb 2020 10:00:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580828457; 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=+Ut4XoP/Hrpe2MidinxPjS+a6EQ5ccTH+FceX9o7das=; b=ced4XvfPq0diGmWlhlqhu51wGohfbVCtprEqm7d/INkhq46L4JfeAclgLbb6j4ETJkvhaG Sk3VudHOT8IlecHoWpI7bdOW1Bh9T1ZNLdqb8VYbrESsYSZUjz57IT0FksS40dveKjIIWq q5H562LzC9oS/xNGNznJNeux4AzzO2s= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-393-89EjOiL0NGml79LQGV0gQg-1; Tue, 04 Feb 2020 10:00:52 -0500 X-MC-Unique: 89EjOiL0NGml79LQGV0gQg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 658E518FE866; Tue, 4 Feb 2020 15:00:51 +0000 (UTC) Received: from laptop.redhat.com (ovpn-116-37.ams2.redhat.com [10.36.116.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id D8F2584D90; Tue, 4 Feb 2020 15:00:44 +0000 (UTC) From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, pbonzini@redhat.com, vkuznets@redhat.com Cc: thuth@redhat.com, drjones@redhat.com, wei.huang2@amd.com Subject: [PATCH v3 0/3] selftests: KVM: AMD Nested SVM test infrastructure Date: Tue, 4 Feb 2020 16:00:37 +0100 Message-Id: <20200204150040.2465-1-eric.auger@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Add the basic infrastructure needed to test AMD nested SVM. Also add a first basic vmcall test. Best regards Eric This series can be found at: https://github.com/eauger/linux/tree/v5.5-amd-svm-v3 History: v2 -> v3: - Took into account Vitaly's comment: - added "selftests: KVM: Replace get_gdt/idt_base() by get_gdt/idt()" - svm.h now is a copy of arch/x86/include/asm/svm.h - avoid duplicates v1 -> v2: - split into 2 patches - remove the infrastructure to run low-level sub-tests and only keep vmmcall's one. - move struct regs into processor.h - force vmcb_gpa into rax in run_guest() Eric Auger (3): selftests: KVM: Replace get_gdt/idt_base() by get_gdt/idt() selftests: KVM: AMD Nested test infrastructure selftests: KVM: SVM: Add vmcall test tools/testing/selftests/kvm/Makefile | 3 +- .../selftests/kvm/include/x86_64/processor.h | 28 +- .../selftests/kvm/include/x86_64/svm.h | 297 ++++++++++++++++++ .../selftests/kvm/include/x86_64/svm_util.h | 36 +++ tools/testing/selftests/kvm/lib/x86_64/svm.c | 159 ++++++++++ tools/testing/selftests/kvm/lib/x86_64/vmx.c | 6 +- .../selftests/kvm/x86_64/svm_vmcall_test.c | 85 +++++ 7 files changed, 606 insertions(+), 8 deletions(-) create mode 100644 tools/testing/selftests/kvm/include/x86_64/svm.h create mode 100644 tools/testing/selftests/kvm/include/x86_64/svm_util.h create mode 100644 tools/testing/selftests/kvm/lib/x86_64/svm.c create mode 100644 tools/testing/selftests/kvm/x86_64/svm_vmcall_test.c