public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kai Huang <kai.huang@intel.com>
To: dave.hansen@intel.com, kirill.shutemov@linux.intel.com,
	tglx@linutronix.de, bp@alien8.de, peterz@infradead.org,
	mingo@redhat.com, hpa@zytor.com, dan.j.williams@intel.com,
	seanjc@google.com, pbonzini@redhat.com
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
	rick.p.edgecombe@intel.com, isaku.yamahata@intel.com,
	adrian.hunter@intel.com, nik.borisov@suse.com,
	kai.huang@intel.com
Subject: [PATCH v8 0/9] TDX host: metadata reading tweaks and bug fixes
Date: Thu, 14 Nov 2024 00:57:05 +1300	[thread overview]
Message-ID: <cover.1731498635.git.kai.huang@intel.com> (raw)

This series replaces the existing TDX module metadata reading code with
a new auto-generated global metadata infrastructure to:

1) address two issues in the current TDX module initialization code, and
2) have an extendable infrastructure which is super easy to read more
   metadata and share with KVM for KVM TDX support (and other kernel
   components for TDX Connect in the future).

And the reason that we need a new global metadata infrastructure is the
current one can only read TDMR related metadata fields and it is not
extendable to read more metadata fields, which is required to address
both 1) and 2) above.

Specifically, below two issues in the current module initialization code
need to be addressed:

1) Module initialization may fail on some large systems (e.g., with 4 or
   more sockets) [1].
2) Some old modules can clobber host's RBP when existing from the TDX
   guest, and currently they can be initialized successfully.  We don't
   want to use such modules thus we should just fail to initialize them
   to avoid memory/cpu cycle cost of initializing TDX module [2].

The first 6 patches introduce the new auto-generated global metadata
infrastructure (which is auto-generated using a script [3]), and the
rest patches address the above two issues.

Hi Dave,

This series targets x86 tip.  This is also a pre-work of the "quite near
future" KVM TDX support.  I appreciate if you can review, comment and
take this series if the patches look good to you.

The script used to auto-generate the metadata reading code in patch 3
can be found in [3].

Also cc Dan for TDX Connect, and cc Paolo/Sean for KVM TDX (but I
removed KVM list since this series doesn't touch KVM code).

History:

v7 -> v8:
 - Address Dave's comments to remove the code to print module version
   and CMRs:
   - Remove the code which reads module version in the auto-generated
     code.
   - Remove the patch which prints module version (patch 10 in v7)
   - Remove the code which prints CMRs in patch 7.
   - Update the changelog of some patches that mentioned "reading module
     version" and "print CMRs".
 - Collect Nikolay's tag.

Previous versions and more background info please see:

 - https://lore.kernel.org/kvm/6ab90fd332bccdec7b64e5909cb4637732d6bb01.1731318868.git.kai.huang@intel.com/T/

[1]: https://github.com/canonical/tdx/issues/135
[2]: https://lore.kernel.org/fc0e8ab7-86d4-4428-be31-82e1ece6dd21@intel.com/
[3]: https://lore.kernel.org/d5aed06ae4b46df5db97fdbac9c01843920a2f96.camel@intel.com/


Kai Huang (8):
  x86/virt/tdx: Rename 'struct tdx_tdmr_sysinfo' to reflect the spec
    better
  x86/virt/tdx: Start to track all global metadata in one structure
  x86/virt/tdx: Use dedicated struct members for PAMT entry sizes
  x86/virt/tdx: Add missing header file inclusion to local tdx.h
  x86/virt/tdx: Switch to use auto-generated global metadata reading
    code
  x86/virt/tdx: Trim away tail null CMRs
  x86/virt/tdx: Reduce TDMR's reserved areas by using CMRs to find
    memory holes
  x86/virt/tdx: Require the module to assert it has the NO_RBP_MOD
    mitigation

Paolo Bonzini (1):
  x86/virt/tdx: Use auto-generated code to read global metadata

 arch/x86/virt/vmx/tdx/tdx.c                 | 146 +++++++++++---------
 arch/x86/virt/vmx/tdx/tdx.h                 |  43 +-----
 arch/x86/virt/vmx/tdx/tdx_global_metadata.c |  67 +++++++++
 arch/x86/virt/vmx/tdx/tdx_global_metadata.h |  32 +++++
 4 files changed, 183 insertions(+), 105 deletions(-)
 create mode 100644 arch/x86/virt/vmx/tdx/tdx_global_metadata.c
 create mode 100644 arch/x86/virt/vmx/tdx/tdx_global_metadata.h


base-commit: 7ae15e2f69bad06527668b478dff7c099ad2e6ae
-- 
2.46.2


             reply	other threads:[~2024-11-13 11:57 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-13 11:57 Kai Huang [this message]
2024-11-13 11:57 ` [PATCH v8 1/9] x86/virt/tdx: Rename 'struct tdx_tdmr_sysinfo' to reflect the spec better Kai Huang
2024-11-13 11:57 ` [PATCH v8 2/9] x86/virt/tdx: Start to track all global metadata in one structure Kai Huang
2024-11-13 11:57 ` [PATCH v8 3/9] x86/virt/tdx: Use auto-generated code to read global metadata Kai Huang
2024-12-13 11:17   ` Huang, Kai
2024-11-13 11:57 ` [PATCH v8 4/9] x86/virt/tdx: Use dedicated struct members for PAMT entry sizes Kai Huang
2024-11-13 11:57 ` [PATCH v8 5/9] x86/virt/tdx: Add missing header file inclusion to local tdx.h Kai Huang
2024-11-13 11:57 ` [PATCH v8 6/9] x86/virt/tdx: Switch to use auto-generated global metadata reading code Kai Huang
2024-11-13 11:57 ` [PATCH v8 7/9] x86/virt/tdx: Trim away tail null CMRs Kai Huang
2024-11-13 11:57 ` [PATCH v8 8/9] x86/virt/tdx: Reduce TDMR's reserved areas by using CMRs to find memory holes Kai Huang
2024-12-04 14:22   ` Huang, Kai
2024-12-05 12:45     ` Huang, Kai
2024-12-05 12:40   ` [PATCH v8 8.1/9] " Kai Huang
2024-12-05 18:10     ` Dave Hansen
2024-12-06  2:45       ` Huang, Kai
2024-12-09  6:57       ` Huang, Kai
2024-12-09  6:50   ` [PATCH v8 8.2/9] " Kai Huang
2024-12-09 22:54     ` Dave Hansen
2024-12-10  2:26       ` Huang, Kai
2024-12-10  2:46         ` Dan Williams
2024-12-10  4:24           ` Huang, Kai
2024-12-10 16:58             ` Dave Hansen
2024-12-11  4:34               ` Huang, Kai
2024-11-13 11:57 ` [PATCH v8 9/9] x86/virt/tdx: Require the module to assert it has the NO_RBP_MOD mitigation Kai Huang
2024-11-13 22:25 ` [PATCH v8 0/9] TDX host: metadata reading tweaks and bug fixes Edgecombe, Rick P
2024-11-13 22:40   ` Huang, Kai
2024-11-13 22:53     ` Edgecombe, Rick P
2024-11-13 23:35       ` Huang, Kai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1731498635.git.kai.huang@intel.com \
    --to=kai.huang@intel.com \
    --cc=adrian.hunter@intel.com \
    --cc=bp@alien8.de \
    --cc=dan.j.williams@intel.com \
    --cc=dave.hansen@intel.com \
    --cc=hpa@zytor.com \
    --cc=isaku.yamahata@intel.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=nik.borisov@suse.com \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rick.p.edgecombe@intel.com \
    --cc=seanjc@google.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox