Message ID | 20231212204647.2170650-1-sagis@google.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp7993104vqy; Tue, 12 Dec 2023 12:47:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IHlwqXAIJ+M6cR9O2mSNVdG8iPR+8Bo9GWGO1yeZULW9DbhlOzoVGjAEMi/1OHO0Q7IRnyM X-Received: by 2002:a05:6a20:7286:b0:18a:e176:87e9 with SMTP id o6-20020a056a20728600b0018ae17687e9mr4265260pzk.15.1702414028362; Tue, 12 Dec 2023 12:47:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702414028; cv=none; d=google.com; s=arc-20160816; b=W8qU9YEY32DkwX0O2/L9QO8UINiSzhfJZ70NcE0kZtdhfoFQ3Mj12Iu6PgRGBxdygo 0o4iZyYnFrDfuijhjE84mkr7FlDK4mIkck2NREK4R3i1O9twA4GKrk5vFHer5k+DDCSG f9zxBMOO8Hjwu6RP3Bx/+YcUKxw2LztYOgt507lAR4/N6fgmkSOM0FU+6WtrzdcowXly q4G8kdMhUI2JeTaGnrpZVHnGbTewNXwL6jPewr1lwHirgpV4aviuYG8oHwEONj8dlw4Q XOfRQwfEWOwcktJ6tVaM/p735oZ8L/EN/MCphsyTRfwb9aX6N3VtbthsFESlbvthSo+w iTVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:from:subject :message-id:mime-version:date:dkim-signature; bh=/7dr6LesSd6J0D4aMekJuWGTOXlB00/XOYyVR4kkX9o=; fh=Y5ua58y+ybdOPwRkMynUdu+Hv1LrozBumh8skcuOhBI=; b=ks0Fec9dMHrFZl/Yte8PXyD8X8fO1D9vwygBmzi/LCkaQKFWjYJrtZzu89RRbtz4bF 9TPkm/oAMJp1HrxzzseZvkt5It02j5S0OZw50Red7yMUTYQvwTK44WrAbP4n/wScP3TW 2afeHiWIOiGaOWRPUPB7N4n5GcFgk6/yKw2Qfk3F1rRw108bGjfvdDkvgVA+8oHLUMsG V6doLDEwC7KxblMNhrqGIYptlHBeu+44HKgju6deXs6e+5i91gbW+zLnh1Ur5Mo7PHYy cHs+2zz7d8rnuSwXAqSyQcFq4ROpTVhpHmAOOJf7L0MRPpkryIvs4a2VlUR3ga28F2dD 03Ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=RUrb8xMm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id s33-20020a056a0017a100b006cd8f0ed07csi8239526pfg.191.2023.12.12.12.47.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 12:47:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=RUrb8xMm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 937D480EFC7C; Tue, 12 Dec 2023 12:47:02 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231358AbjLLUqx (ORCPT <rfc822;dexuan.linux@gmail.com> + 99 others); Tue, 12 Dec 2023 15:46:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229800AbjLLUqw (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 12 Dec 2023 15:46:52 -0500 Received: from mail-pl1-x64a.google.com (mail-pl1-x64a.google.com [IPv6:2607:f8b0:4864:20::64a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 839AB9B for <linux-kernel@vger.kernel.org>; Tue, 12 Dec 2023 12:46:58 -0800 (PST) Received: by mail-pl1-x64a.google.com with SMTP id d9443c01a7336-1d33751a322so5234695ad.3 for <linux-kernel@vger.kernel.org>; Tue, 12 Dec 2023 12:46:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1702414018; x=1703018818; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:from:subject:message-id :mime-version:date:from:to:cc:subject:date:message-id:reply-to; bh=/7dr6LesSd6J0D4aMekJuWGTOXlB00/XOYyVR4kkX9o=; b=RUrb8xMmqcPxye6zfPKW+fyjdevULWJOJh0EPAET8OZ4N5Yy9ue9Kg+cJe3Y7mdeAR cDHOfiF6EH9MJTazfHljZpeNQHeefuGQ6Z4gU61zKjPBbmv2LTfmeXjmzneectoz7Mn0 zywgfbpgYwa69CArIgYtIl1AjQRpRuICAk/CVqBQ6zU1oMy7oSvNNtj1AjA8ITntEpYw HTeQqEIGJOdj8k9PlMaQPWai7yb6c8APZwl95b0Il9NIfw9EgrJ7Pp2VOMBJyrAEzG4T 07msYqaxuPe4gmiK2n+g8VbYSxV8S0OGvF/v1Vt4QTmBIodmW1ML1dPybkP8Qnre6B/X HHAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702414018; x=1703018818; h=content-transfer-encoding:cc:to:from:subject:message-id :mime-version:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=/7dr6LesSd6J0D4aMekJuWGTOXlB00/XOYyVR4kkX9o=; b=pL+/X8bymU/dTplJNKx3AeZCfm7Lm4KJN4hVMp3HOnIPHMh8H4d2Aj3mN7iV7BfYJm 5pQNcBswCHoiZZCfUzU93BPqzPWKTn6yricXw4AcBAOkfppvPMnVdcQ+wc4VL9Xbs3Hq 31ECyEZpnEcLMatHjwWDzxn9e1w01SahfdIvC39y7h5OfcrOV6wAP7NeZX7jtXIQ0PvH C3/5VbqRinWk23FB1TSLIjY7/9K4aFVyXYUpgf2tF+wBC94MruOxUrqSlBunEymu/++r rF0irwkdGRNcRvC9X72sDIlDbt7YF3uo6bUgum3kzjWZ1wVlj336CHeGvOsodzpZ4eSa +qsg== X-Gm-Message-State: AOJu0YyjsegbQnujiUVHsKhAcB0qWsjhcAzOYKcvcU6zJjWqO3K3p7Aq tFknsi7yIFHbW4dFsyksOfYiliaqcg== X-Received: from sagi.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:241b]) (user=sagis job=sendgmr) by 2002:a17:903:32c8:b0:1d0:902c:e834 with SMTP id i8-20020a17090332c800b001d0902ce834mr53461plr.12.1702414017857; Tue, 12 Dec 2023 12:46:57 -0800 (PST) Date: Tue, 12 Dec 2023 12:46:15 -0800 Mime-Version: 1.0 X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog Message-ID: <20231212204647.2170650-1-sagis@google.com> Subject: [RFC PATCH v5 00/29] TDX KVM selftests From: Sagi Shahar <sagis@google.com> To: linux-kselftest@vger.kernel.org, Ackerley Tng <ackerleytng@google.com>, Ryan Afranji <afranji@google.com>, Erdem Aktas <erdemaktas@google.com>, Sagi Shahar <sagis@google.com>, Isaku Yamahata <isaku.yamahata@intel.com> Cc: Sean Christopherson <seanjc@google.com>, Paolo Bonzini <pbonzini@redhat.com>, Shuah Khan <shuah@kernel.org>, Peter Gonda <pgonda@google.com>, Haibo Xu <haibo1.xu@intel.com>, Chao Peng <chao.p.peng@linux.intel.com>, Vishal Annapurve <vannapurve@google.com>, Roger Wang <runanwang@google.com>, Vipin Sharma <vipinsh@google.com>, jmattson@google.com, dmatlack@google.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-mm@kvack.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 12 Dec 2023 12:47:02 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785110492382629082 X-GMAIL-MSGID: 1785110492382629082 |
Series |
TDX KVM selftests
|
|
Message
Sagi Shahar
Dec. 12, 2023, 8:46 p.m. UTC
Hello, This is v4 of the patch series for TDX selftests. It has been updated for Intel’s v17 of the TDX host patches which was proposed here: https://lore.kernel.org/all/cover.1699368322.git.isaku.yamahata@intel.com/ The tree can be found at: https://github.com/googleprodkernel/linux-cc/tree/tdx-selftests-rfc-v5 Changes from RFC v4: Added patch to propagate KVM_EXIT_MEMORY_FAULT to userspace. Minor tweaks to align the tests to the new TDX 1.5 spec such as changes in the expected values in TDG.VP.INFO. In RFCv5, TDX selftest code is organized into: + headers in tools/testing/selftests/kvm/include/x86_64/tdx/ + common code in tools/testing/selftests/kvm/lib/x86_64/tdx/ + selftests in tools/testing/selftests/kvm/x86_64/tdx_* Dependencies + Peter’s patches, which provide functions for the host to allocate and track protected memory in the guest. https://lore.kernel.org/all/20230110175057.715453-1-pgonda@google.com/ Further work for this patch series/TODOs + Sean’s comments for the non-confidential UPM selftests patch series at https://lore.kernel.org/lkml/Y8dC8WDwEmYixJqt@google.com/T/#u apply here as well + Add ucall support for TDX selftests I would also like to acknowledge the following people, who helped review or test patches in previous versions: + Sean Christopherson <seanjc@google.com> + Zhenzhong Duan <zhenzhong.duan@intel.com> + Peter Gonda <pgonda@google.com> + Andrew Jones <drjones@redhat.com> + Maxim Levitsky <mlevitsk@redhat.com> + Xiaoyao Li <xiaoyao.li@intel.com> + David Matlack <dmatlack@google.com> + Marc Orr <marcorr@google.com> + Isaku Yamahata <isaku.yamahata@gmail.com> + Maciej S. Szmigiero <maciej.szmigiero@oracle.com> Links to earlier patch series + RFC v1: https://lore.kernel.org/lkml/20210726183816.1343022-1-erdemaktas@google.com/T/#u + RFC v2: https://lore.kernel.org/lkml/20220830222000.709028-1-sagis@google.com/T/#u + RFC v3: https://lore.kernel.org/lkml/20230121001542.2472357-1-ackerleytng@google.com/T/#u + RFC v4: https://lore.kernel.org/lkml/20230725220132.2310657-1-afranji@google.com/ *** BLURB HERE *** Ackerley Tng (12): KVM: selftests: Add function to allow one-to-one GVA to GPA mappings KVM: selftests: Expose function that sets up sregs based on VM's mode KVM: selftests: Store initial stack address in struct kvm_vcpu KVM: selftests: Refactor steps in vCPU descriptor table initialization KVM: selftests: TDX: Use KVM_TDX_CAPABILITIES to validate TDs' attribute configuration KVM: selftests: TDX: Update load_td_memory_region for VM memory backed by guest memfd KVM: selftests: Add functions to allow mapping as shared KVM: selftests: Expose _vm_vaddr_alloc KVM: selftests: TDX: Add support for TDG.MEM.PAGE.ACCEPT KVM: selftests: TDX: Add support for TDG.VP.VEINFO.GET KVM: selftests: TDX: Add TDX UPM selftest KVM: selftests: TDX: Add TDX UPM selftests for implicit conversion Erdem Aktas (3): KVM: selftests: Add helper functions to create TDX VMs KVM: selftests: TDX: Add TDX lifecycle test KVM: selftests: TDX: Adding test case for TDX port IO Roger Wang (1): KVM: selftests: TDX: Add TDG.VP.INFO test Ryan Afranji (2): KVM: selftests: TDX: Verify the behavior when host consumes a TD private memory KVM: selftests: TDX: Add shared memory test Sagi Shahar (11): KVM: selftests: TDX: Add report_fatal_error test KVM: selftests: TDX: Add basic TDX CPUID test KVM: selftests: TDX: Add basic get_td_vmcall_info test KVM: selftests: TDX: Add TDX IO writes test KVM: selftests: TDX: Add TDX IO reads test KVM: selftests: TDX: Add TDX MSR read/write tests KVM: selftests: TDX: Add TDX HLT exit test KVM: selftests: TDX: Add TDX MMIO reads test KVM: selftests: TDX: Add TDX MMIO writes test KVM: selftests: TDX: Add TDX CPUID TDVMCALL test KVM: selftests: Propagate KVM_EXIT_MEMORY_FAULT to userspace tools/testing/selftests/kvm/Makefile | 8 + .../selftests/kvm/include/kvm_util_base.h | 30 + .../selftests/kvm/include/x86_64/processor.h | 4 + .../kvm/include/x86_64/tdx/td_boot.h | 82 + .../kvm/include/x86_64/tdx/td_boot_asm.h | 16 + .../selftests/kvm/include/x86_64/tdx/tdcall.h | 59 + .../selftests/kvm/include/x86_64/tdx/tdx.h | 65 + .../kvm/include/x86_64/tdx/tdx_util.h | 19 + .../kvm/include/x86_64/tdx/test_util.h | 164 ++ tools/testing/selftests/kvm/lib/kvm_util.c | 101 +- .../selftests/kvm/lib/x86_64/processor.c | 77 +- .../selftests/kvm/lib/x86_64/tdx/td_boot.S | 101 ++ .../selftests/kvm/lib/x86_64/tdx/tdcall.S | 158 ++ .../selftests/kvm/lib/x86_64/tdx/tdx.c | 262 ++++ .../selftests/kvm/lib/x86_64/tdx/tdx_util.c | 558 +++++++ .../selftests/kvm/lib/x86_64/tdx/test_util.c | 101 ++ .../kvm/x86_64/tdx_shared_mem_test.c | 135 ++ .../selftests/kvm/x86_64/tdx_upm_test.c | 469 ++++++ .../selftests/kvm/x86_64/tdx_vm_tests.c | 1319 +++++++++++++++++ 19 files changed, 3693 insertions(+), 35 deletions(-) create mode 100644 tools/testing/selftests/kvm/include/x86_64/tdx/td_boot.h create mode 100644 tools/testing/selftests/kvm/include/x86_64/tdx/td_boot_asm.h create mode 100644 tools/testing/selftests/kvm/include/x86_64/tdx/tdcall.h create mode 100644 tools/testing/selftests/kvm/include/x86_64/tdx/tdx.h create mode 100644 tools/testing/selftests/kvm/include/x86_64/tdx/tdx_util.h create mode 100644 tools/testing/selftests/kvm/include/x86_64/tdx/test_util.h create mode 100644 tools/testing/selftests/kvm/lib/x86_64/tdx/td_boot.S create mode 100644 tools/testing/selftests/kvm/lib/x86_64/tdx/tdcall.S create mode 100644 tools/testing/selftests/kvm/lib/x86_64/tdx/tdx.c create mode 100644 tools/testing/selftests/kvm/lib/x86_64/tdx/tdx_util.c create mode 100644 tools/testing/selftests/kvm/lib/x86_64/tdx/test_util.c create mode 100644 tools/testing/selftests/kvm/x86_64/tdx_shared_mem_test.c create mode 100644 tools/testing/selftests/kvm/x86_64/tdx_upm_test.c create mode 100644 tools/testing/selftests/kvm/x86_64/tdx_vm_tests.c