Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3385061rwe; Mon, 29 Aug 2022 10:36:04 -0700 (PDT) X-Google-Smtp-Source: AA6agR5i1fWonMYjMBFxEtrxhOfMYW/mS2HZNvroQ9fxacvHwD5SxfEe+hO9+zw6PQFWX3d3V3HZ X-Received: by 2002:a17:907:b15:b0:741:8ae4:f79d with SMTP id h21-20020a1709070b1500b007418ae4f79dmr4322229ejl.247.1661794563944; Mon, 29 Aug 2022 10:36:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661794563; cv=none; d=google.com; s=arc-20160816; b=K0b3FCvS7stLFCazTZcOZef+1j/9GhMBeScg4TYDFnqQWupKHO9WpB5xyxijOiDpHZ z+MZApB8WR+VCx1cJsRU8VqP/HSldTB5oiRci7rqVUSbgFjlNxd8Ly/FLbvuBzr4EKXr fc3PixGTjD0x3nN0L40t2gkd7bfzDK/d1vdqCYZf+e7apCFeCoetOOGe18VG5oCR7+SS +lrbCCKgDYY+otWczleSuW56ZWl6CvCA3yeD3fGv6dQb1aEO4RA9JdFDxWhfiVBJvDvb AzEUa6+CMOSSA04yfg5VE7mH/rWZxBmgA7sWHiw1R9XofLB3P3i/AEY9kdv9Xa3bL8j4 T+4g== 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=2fgeUau+fesji7+UbXHLLRDfif1bUVoiY8cL8+NvcF0=; b=fwt+zSdPB5GE7o7RHuIDXfCigr/XBiugOrM8aSL4HxZjWLrVbctmDfWLz/inuQ7IgR lUIOzvbVsVqxB79p+Os+9/5csp00icngpNr9Vl+QdE8pRG31M8gcKZf/Pqt9rlUS7TjJ wt1xaA7fmQK7miUf+RKFhZE8kluzt1U+TDF26hXm2zDkrk8J0SInyeYF4WO7s8E1NkzY lVOYLB1hwp5s1uY24Xsyq/8NsJyZrpXhYxGMZQc5GllxB2Y9YNi7UHNBwkLw0DQ9Vd/T GIcOw6cfoJEQgxDqqKkPGEig7oTuXaBlH1wV0aIdQ8n35V31F68k1tiyrxF3z0XPwp/B 3F0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=m6sZUE2F; 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 b17-20020a170906709100b0073d8aca07b2si6292604ejk.140.2022.08.29.10.35.37; Mon, 29 Aug 2022 10:36:03 -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=m6sZUE2F; 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 S231286AbiH2RKx (ORCPT + 99 others); Mon, 29 Aug 2022 13:10:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230350AbiH2RKw (ORCPT ); Mon, 29 Aug 2022 13:10:52 -0400 Received: from mail-pg1-x549.google.com (mail-pg1-x549.google.com [IPv6:2607:f8b0:4864:20::549]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 051125466E for ; Mon, 29 Aug 2022 10:10:51 -0700 (PDT) Received: by mail-pg1-x549.google.com with SMTP id c34-20020a631c22000000b0042b6da605d2so4343719pgc.20 for ; Mon, 29 Aug 2022 10:10:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:mime-version:message-id:date:from:to:cc; bh=2fgeUau+fesji7+UbXHLLRDfif1bUVoiY8cL8+NvcF0=; b=m6sZUE2FI2f8PC5MXscjA57qZcILIlnX5dM8oTNtAcyr2CoRmtNGMfmI7X+WMe8xrV IZDsIJ6kuocRikzOL9QC5Kx+ObeOJZE8BxywPDzZ0kl98CUrAFIOkOl9r1r3MKgICRd6 SQ7Zt4oUVrP8ln2bgpWAGe5d/rkVM+pxE7tOdtTFRK5j35NNdX6DVM1ihkYZyOeQhOPR MwLn3Rsk+Hjd1sDm6VHHN6ZNiRITTfvUGh2ucxiw4rqJK4JSVShK/TdzepizJyBfnCxu +yj3vXGfcJJ03qwV4Gm3LgQzhXyizRaMmcJWai96DJtFwTjmX6pn0dN0Vn97uMner9X9 3EGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:mime-version:message-id:date:x-gm-message-state :from:to:cc; bh=2fgeUau+fesji7+UbXHLLRDfif1bUVoiY8cL8+NvcF0=; b=t7K1w1TU6iN7EmFvh0pqeCPxlj4LRz/upWnPcYHoLpiNbYTieRMbCl58DoDaBDGLEl DhW010xhx64NQWdkecLWdhxL7W1JE9dYCmUjGFHxVRkg2UO/eF7KYcBJrXOsZluoZ5Kc cSEMW8pPFjh5XQ/W8wlPsKcSpVnJux6oxFNDSJiNA/ercBbFJpuP3+ziGF/yxpfFC5sM 5gH30JiV9zw9RwAMKbW8It+Unk6dPhHdsh7qgczMLl2IBRDmyRStR/G6KzBNRq+0e5O6 VWAidrBczloXUxfkHMYa31+G2nnKkqe/Ll5omlxHTsk1IweyLunIaSQL6Ob5dCzh4Yd3 WxaA== X-Gm-Message-State: ACgBeo32uhaLKj0bGx1KNwTMjYhKK1XIfIoG2mir2ATHhy1JmsvKADBK BdEHh3OynkS0XEqOHCiz/PkvF2Fshxs= X-Received: from pgonda1.kir.corp.google.com ([2620:15c:29:203:cddb:77a7:c55e:a7a2]) (user=pgonda job=sendgmr) by 2002:a63:3c7:0:b0:42b:9220:a3c8 with SMTP id 190-20020a6303c7000000b0042b9220a3c8mr10924499pgd.366.1661793050510; Mon, 29 Aug 2022 10:10:50 -0700 (PDT) Date: Mon, 29 Aug 2022 10:10:13 -0700 Message-Id: <20220829171021.701198-1-pgonda@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.37.2.672.g94769d06f0-goog Subject: [V4 0/8] 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, andrew.jones@linux.dev, 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,T_SCC_BODY_TEXT_LINE,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 continues the work Michael Roth has done in supporting SEV guests in selftests. It continues on top of the work Sean Christopherson has sent to support ucalls from SEV guests. Along with a very simple version of the SEV selftests Michael originally proposed. V4 * Rebase ontop of seanjc@'s latest Ucall Pool series: https://lore.kernel.org/linux-arm-kernel/20220825232522.3997340-8-seanjc@google.com/ * Fix up review comments from seanjc * Switch authorship on 2 patches because of significant changes, added * Michael as suggested-by or originally-by. V3 * Addressed more of andrew.jones@ in ucall patches. * Fix build in non-x86 archs. V2 * Dropped RFC tag * Correctly separated 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 (5): 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 Peter Gonda (3): KVM: selftests: add library for creating/interacting with SEV guests KVM: selftests: Update ucall pool to allocate from shared memory KVM: selftests: Add simple sev vm testing tools/testing/selftests/kvm/.gitignore | 1 + tools/testing/selftests/kvm/Makefile | 2 + .../selftests/kvm/include/kvm_util_base.h | 23 ++ .../testing/selftests/kvm/include/sparsebit.h | 36 +-- .../selftests/kvm/include/x86_64/sev.h | 47 +++ tools/testing/selftests/kvm/lib/kvm_util.c | 267 +++++++++++++----- tools/testing/selftests/kvm/lib/sparsebit.c | 48 ++-- .../testing/selftests/kvm/lib/ucall_common.c | 2 +- .../selftests/kvm/lib/x86_64/processor.c | 15 +- tools/testing/selftests/kvm/lib/x86_64/sev.c | 232 +++++++++++++++ .../selftests/kvm/x86_64/sev_all_boot_test.c | 127 +++++++++ 11 files changed, 674 insertions(+), 126 deletions(-) create mode 100644 tools/testing/selftests/kvm/include/x86_64/sev.h 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.2.672.g94769d06f0-goog