Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp2154218imn; Mon, 1 Aug 2022 13:14:38 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tXwY1tiOIJKP2Yx6Db3eGybCyQJltxXowo/vctlCfqy1O2R+6bVZxZhxTKfPeJ1pnH0nFZ X-Received: by 2002:a17:907:7294:b0:72b:1ae:9c47 with SMTP id dt20-20020a170907729400b0072b01ae9c47mr13877339ejc.253.1659384878589; Mon, 01 Aug 2022 13:14:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659384878; cv=none; d=google.com; s=arc-20160816; b=g+aDVmtAsVg5XJ6TZPF0kPRNscfH0Kp/ymtEJEKXUNWqFK1X+x7xdhMBqOvDIavL8d gPZlyHLbUxoNMvOqA+AIPWaMdDnj7n1KpTFGypE4oDDOxd3PuRPOm+V+x3WNcI9O4Y2D EJywEFo4A+FbiD/Z+KMr/TbQ9FRf9dg/7JrIx8xIIWIGiJoeL54L/Qe+CxQlIzD/MfJX LjXeUQZ6IOVZ5edZHPNG6xcKClFHu3ZeuIpRDFY0XSoGe5jKjau6kqgde74n6OZyl6q8 BqXhTgPQLVkQPUvwVNwVh5PkLMqbN93IxHQPYMY2/gkM3nNXoQ4QT4HWUboU+a8hxzSB fltQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:mime-version:message-id:date :dkim-signature; bh=spLa+8cqriOZAhw1Zi4AYOlRklLSR96sO0vwvWIpDDs=; b=V5tP94EyZ+Z2D8pezVTp7Adc4/9pl5zYij6PhrlLFI3u8gczMVp0qAXADUkGWQN1kX +nlSBK0/JjQnZJcOXGYTXm3S2cv0LfOxH0F95nodpnZsrfBBU6lhHV5RcWwZ9zIchOYz M/+SUnTSOPAbc7IPNrup0IAc2bL8Yn8pkD42ZJ9Nr1kT63rljmHF4NcOpH8PgMgiO2C7 3Yv5VB+F3wlFOyFzR5sjjK3AHv2Az5rz7oVmM79UbFCYTojPhagWO0IG97F9LAb0VKx6 LSbMqKLTNT4PSkSZJX3hFb2C06UPlaXcZqsgAS+QSLT9sn/9mV9sAX8+rOnx9ChN9iO1 EUvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=NOWEDdkg; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sb12-20020a1709076d8c00b007262d20d6cesi706609ejc.200.2022.08.01.13.14.13; Mon, 01 Aug 2022 13:14:38 -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=@google.com header.s=20210112 header.b=NOWEDdkg; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234132AbiHAULR (ORCPT + 99 others); Mon, 1 Aug 2022 16:11:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233778AbiHAULP (ORCPT ); Mon, 1 Aug 2022 16:11:15 -0400 Received: from mail-pj1-x1049.google.com (mail-pj1-x1049.google.com [IPv6:2607:f8b0:4864:20::1049]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FAEC1A04D for ; Mon, 1 Aug 2022 13:11:13 -0700 (PDT) Received: by mail-pj1-x1049.google.com with SMTP id b8-20020a17090a010800b001f1f4fc8178so6422151pjb.8 for ; Mon, 01 Aug 2022 13:11:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:message-id:mime-version:subject:from:to:cc; bh=spLa+8cqriOZAhw1Zi4AYOlRklLSR96sO0vwvWIpDDs=; b=NOWEDdkgFqZDD8hZ0NEfLZMXqE32QLY4UxFy8k2Nc5sI+vpryX39pHFxsWXpJ3Zvky xuuubFLBR7kkMlia5/tS8XGvZYhSF9iL18Gv8IEVO5UYX7JHuijqyqLiZiQ7rw66IzeB bcFm3UlkHTRb8oDdeLATcB9lab3n59LRpLAfr4C6X8R/P6G0VUwA8k6IVf78jtBq/qB+ 34QR8FEBRnzrWGBgs0oozXdZreNy9Q0hOUSHbW9q7ghnKBRirG+eI9Q1SPedw7NTx3iR y1ovkgjD+jLXafOW+sFrznI2rQIB81Saqj0J2mjUAvI7/++EcDFyqt4z0pcnVkNcwo8e 0+MA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=spLa+8cqriOZAhw1Zi4AYOlRklLSR96sO0vwvWIpDDs=; b=pQSJWO3tp8f4QrgZGKD4gLKUXfHzqTejgVfPXkPPZgOu1Zs+kFAjear1B9DG0/oI+u QlTfRhRKlzL2F6/FdY7skLCnh2OcZAkF67NevIo5yvqxXyn/0h4y2CwwAEHR5hjTpeMf vCKa9L9r8hP7swifUTGwaE4BlglHRkquEm1gvwIDdAoQRYGWm6T65Rdi5qL+J1l6osMY CMaKkhbtwoTREAiFmDNLI73/quTE/zZEHo+JTjToZKK77Fw3DhaAs/cSU1/x2wH4aCIe XqzU/kTXUnukTKNkWOZE10TAkvWfVEQLKMAaEi8kX+QOY52lDHw7rE1yCtcyM7j7H4lF tNgQ== X-Gm-Message-State: AJIora9yo84jGhIkDWc+R4SedkT04xI0+7kqQQbkJTewiUsCXftdKuTy mg8yQKDgQDmkd/ZpUntF6MXC80/yR6k= X-Received: from pgonda1.kir.corp.google.com ([2620:15c:29:203:6be2:f99c:e23c:fa12]) (user=pgonda job=sendgmr) by 2002:a05:6a00:e0e:b0:522:990c:ab60 with SMTP id bq14-20020a056a000e0e00b00522990cab60mr17866513pfb.8.1659384672663; Mon, 01 Aug 2022 13:11:12 -0700 (PDT) Date: Mon, 1 Aug 2022 13:10:58 -0700 Message-Id: <20220801201109.825284-1-pgonda@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.37.1.455.g008518b4e5-goog Subject: [V2 00/11] KVM: selftests: Add simple SEV test From: Peter Gonda To: kvm@vger.kernel.org Cc: linux-kernel@vger.kernel.org, marcorr@google.com, seanjc@google.com, michael.roth@amd.com, thomas.lendacky@amd.com, joro@8bytes.org, mizhang@google.com, pbonzini@redhat.com, Peter Gonda Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham 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 This patch series combines the work Michael Roth has done in supporting SEV guests in selftests and the work Sean Christopherson suggested to allow ucalls from SEV guests. And the work Sean has sent to consolidate the ucall boilerplate code. Along with a very simple version of the SEV selftests Michael originally proposed. V2 * Dropped RFC tag * Correctly seperated Sean's ucall patches into 2 as originally intended. * Addressed andrew.jones@ in ucall patches. * Fixed ucall pool usage to work for other archs V1 * https://lore.kernel.org/all/20220715192956.1873315-1-pgonda@google.com/ Michael Roth (6): KVM: selftests: move vm_phy_pages_alloc() earlier in file KVM: selftests: sparsebit: add const where appropriate KVM: selftests: add hooks for managing encrypted guest memory KVM: selftests: handle encryption bits in page tables KVM: selftests: add support for encrypted vm_vaddr_* allocations KVM: selftests: add library for creating/interacting with SEV guests Peter Gonda (3): tools: Add atomic_test_and_set_bit() KVM: selftests: Make ucall work with encrypted guests KVM: selftests: Add simple sev vm testing Sean Christopherson (2): KVM: selftests: Consolidate common code for popuplating KVM: selftests: Consolidate boilerplate code in get_ucall() tools/arch/x86/include/asm/atomic.h | 7 + tools/testing/selftests/kvm/.gitignore | 1 + tools/testing/selftests/kvm/Makefile | 3 + .../selftests/kvm/include/kvm_util_base.h | 26 ++ .../testing/selftests/kvm/include/sparsebit.h | 36 +-- .../selftests/kvm/include/ucall_common.h | 15 +- .../selftests/kvm/include/x86_64/sev.h | 47 +++ .../testing/selftests/kvm/lib/aarch64/ucall.c | 33 +-- tools/testing/selftests/kvm/lib/kvm_util.c | 267 +++++++++++++----- tools/testing/selftests/kvm/lib/riscv/ucall.c | 40 +-- tools/testing/selftests/kvm/lib/s390x/ucall.c | 37 +-- tools/testing/selftests/kvm/lib/sparsebit.c | 48 ++-- .../testing/selftests/kvm/lib/ucall_common.c | 139 +++++++++ .../selftests/kvm/lib/x86_64/processor.c | 15 +- tools/testing/selftests/kvm/lib/x86_64/sev.c | 249 ++++++++++++++++ .../testing/selftests/kvm/lib/x86_64/ucall.c | 37 +-- .../selftests/kvm/x86_64/sev_all_boot_test.c | 131 +++++++++ 17 files changed, 885 insertions(+), 246 deletions(-) create mode 100644 tools/testing/selftests/kvm/include/x86_64/sev.h create mode 100644 tools/testing/selftests/kvm/lib/ucall_common.c create mode 100644 tools/testing/selftests/kvm/lib/x86_64/sev.c create mode 100644 tools/testing/selftests/kvm/x86_64/sev_all_boot_test.c -- 2.37.1.455.g008518b4e5-goog