From patchwork Fri Jul 2 22:05:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isaku Yamahata X-Patchwork-Id: 12356729 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4231AC07E97 for ; Fri, 2 Jul 2021 22:07:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 24ECF61422 for ; Fri, 2 Jul 2021 22:07:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234540AbhGBWKW (ORCPT ); Fri, 2 Jul 2021 18:10:22 -0400 Received: from mga17.intel.com ([192.55.52.151]:15304 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234181AbhGBWJS (ORCPT ); Fri, 2 Jul 2021 18:09:18 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10033"; a="189168428" X-IronPort-AV: E=Sophos;i="5.83,320,1616482800"; d="scan'208";a="189168428" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jul 2021 15:05:33 -0700 X-IronPort-AV: E=Sophos;i="5.83,320,1616482800"; d="scan'208";a="642814908" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jul 2021 15:05:32 -0700 From: isaku.yamahata@intel.com To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , Paolo Bonzini , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , erdemaktas@google.com, Connor Kuehl , Sean Christopherson , x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: isaku.yamahata@intel.com, isaku.yamahata@gmail.com Subject: [RFC PATCH v2 68/69] KVM: TDX: add document on TDX MODULE Date: Fri, 2 Jul 2021 15:05:14 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Isaku Yamahata Add a document on how to integrate TDX MODULE into initrd so that TDX MODULE can be updated on kernel startup. Signed-off-by: Isaku Yamahata --- Documentation/virt/kvm/tdx-module.rst | 48 +++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Documentation/virt/kvm/tdx-module.rst diff --git a/Documentation/virt/kvm/tdx-module.rst b/Documentation/virt/kvm/tdx-module.rst new file mode 100644 index 000000000000..8beea8302f94 --- /dev/null +++ b/Documentation/virt/kvm/tdx-module.rst @@ -0,0 +1,48 @@ +.. SPDX-License-Identifier: GPL-2.0 + +========== +TDX MODULE +========== + +Integrating TDX MODULE into initrd +================================== +If TDX is enabled in KVM(CONFIG_KVM_INTEL_TDX=y), kernel is able to load +tdx seam module from initrd. +The related modules (seamldr.ac, libtdx.so and libtdx.so.sigstruct) need to be +stored in initrd. + +tdx-seam is a sample hook script for initramfs-tools. +TDXSEAM_SRCDIR are the directory in the host file system to store files related +to TDX MODULE. + +Since it heavily depends on distro how to prepare initrd, here's a example how +to prepare an initrd. +(Actually this is taken from Documentation/x86/microcode.rst) +:: + #!/bin/bash + + if [ -z "$1" ]; then + echo "You need to supply an initrd file" + exit 1 + fi + + INITRD="$1" + + DSTDIR=lib/firmware/intel-seam + TMPDIR=/tmp/initrd + LIBTDX="/lib/firmware/intel-seam/seamldr.acm /lib/firmware/intel-seam/libtdx.so /lib/firmware/intel-seam/libtdx.so.sigstruct" + + rm -rf $TMPDIR + + mkdir $TMPDIR + cd $TMPDIR + mkdir -p $DSTDIR + + cp ${LIBTDX} ${DSTDIR} + + find . | cpio -o -H newc > ../tdx-seam.cpio + cd .. + mv $INITRD $INITRD.orig + cat tdx-seam.cpio $INITRD.orig > $INITRD + + rm -rf $TMPDIR