Linux userland API discussions
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: linux-coco@lists.linux.dev
Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org,
	x86@kernel.org, kvm@vger.kernel.org, linux-doc@vger.kernel.org,
	jgg@ziepe.ca, david.quigley@intel.com, lukas@wunner.de,
	ksinyuk@kernel.org, rodrigo.vivi@intel.com,
	cedric.xing@intel.com, sameo@meta.com, drdeeglaze@gmail.com,
	James.Bottomley@HansenPartnership.com, aik@amd.com,
	jpiotrowski@nvidia.com, qinkun@google.com, pgonda@google.com,
	jic23@kernel.org, alistair.francis@wdc.com, ankita@nvidia.com,
	suzuki.poulose@arm.com, kas@kernel.org,
	rick.p.edgecombe@intel.com, elena.reshetova@intel.com,
	dave.hansen@linux.intel.com,
	sathyanarayanan.kuppuswamy@linux.intel.com, peter.fang@intel.com
Subject: [PATCH RFC 00/20] attestation: Add a common subsystem and TDX support
Date: Thu, 15 Oct 2026 16:50:33 +0200	[thread overview]
Message-ID: <20261015145053.3664509-1-jiri@resnulli.us> (raw)

From: Jiri Pirko <jiri@nvidia.com>

Linux has several attestation interfaces tied to individual technologies.
That makes evidence retrieval, measurement registers, device state and
kernel consumers provider-specific.

This series introduces a common attestation subsystem. Its goal is to
support platform, TEE and device providers through one model, including
TPM2, TDX, SEV-SNP, Arm CCA, FIRME, Caliptra and PCI/TSM-backed devices.
This first series implements the common subsystem and a TDX provider.
Existing native TDX tsm_mr and tsm_report interfaces remain independent.

Attestation devices use CTLV, a schema-driven character-device TLV UAPI.
Compared with sysfs or configfs, CTLV executes one validated request
atomically instead of assembling a transaction through several files.
Compared with netlink, an opened device fd directly identifies authority
and lifetime, can be delegated normally, and owns its event queue. CTLV
also provides:

  - generated kernel metadata, UAPI constants and documentation;
  - strict type, bounds, nesting and required-field validation;
  - runtime operation and schema introspection;
  - family inheritance and extension points;
  - fragmented queries with generation checks;
  - per-fd event subscription, overflow reporting and removal notification;
  - large input and output blobs.

The attestation family exposes capabilities, evidence, measurement-register
topology and operations, an append-only MR journal and journal
notifications. This first ABI contains the paths exercised by TDX. Extended
evidence classes, dynamic registers, record payloads, verdict recording and
device-security transitions follow with providers that need them and are out
of scope of this initial patchset. The broader direction is illustrated here:

https://github.com/jpirko/linux_mlxsw/commits/wip_attestation_all_1

That branch also contains additional providers (test and sim),
attestation core extensions, libctlv and ctlvctl. With the tools
and kernel specifications, an attestation device can be used as follows:

  # Discover CTLV devices and their family chains.
  ctlvctl --spec-dir Documentation/ctlv/specs list

  # Inspect the root-family lineage and attestation capabilities.
  ctlvctl --spec-dir Documentation/ctlv/specs query ctlv0 families-dump
  ctlvctl --spec-dir Documentation/ctlv/specs query ctlv0 device-get

  # List the measurement registers of the attestation device.
  ctlvctl --spec-dir Documentation/ctlv/specs query ctlv0 mr-dump

  # Read RTMR0 (MR 1).
  ctlvctl --spec-dir Documentation/ctlv/specs \
          query ctlv0 mr-read mr.id=1

  # Extend RTMR0 with 48 zero bytes (SHA-384).
  digest=$(printf '%096d' 0)
  ctlvctl --spec-dir Documentation/ctlv/specs \
          exec ctlv0 mr-extend --json \
          '{"id":1,"value":[{"hash-algo":5,"data":"hex:'"$digest"'"}]}'

  # Retrieve the RTMR0 journal.
  ctlvctl --spec-dir Documentation/ctlv/specs \
          query ctlv0 mr-log-get --json '{"selection":[{"id":1}]}'

The 20 patches are organized as follows:

  1-13    add CTLV, its generator and documentation
  14-17   add the base attestation family and implementation
  18-20   expose the native TDX service and add the TDX family

Note to reviewers: Please focus on the overall design, UAPI and internal
attestation-provider API. The internal CTLV and attestation implementations
remain rough around the edges.

Jiri Pirko (20):
  ctlv: Add the schema language and generator
  ctlv: Add the UAPI wire format and family API
  ctlv: Add the root family specification and generated files
  Documentation: ctlv: Add userspace ABI
  ctlv: Prepare message input handling
  ctlv: Prepare blob descriptor validation
  ctlv: Prepare schema validation
  ctlv: Prepare message output handling
  ctlv: Prepare VA blob handling
  ctlv: Prepare event queue support
  ctlv: Prepare runtime introspection
  ctlv: Add device and operation dispatch
  Documentation: ctlv: Describe how to write a family
  attestation: Add the base family specification and generated files
  attestation: Prepare provider and instance core
  attestation: Prepare measurement register journal
  attestation: Add CTLV operation handling
  tdx-guest: Expose the native attestation service API
  attestation: Add the TDX family specification and generated files
  attestation: Add the TDX family implementation

 .../ctlv/abi/ctlv-attestation-tdx.yaml        |   22 +
 Documentation/ctlv/abi/ctlv-attestation.yaml  |  184 ++
 Documentation/ctlv/abi/ctlv.yaml              |  186 ++
 Documentation/ctlv/abi/families.registry.yaml |    9 +
 Documentation/ctlv/ctlv-registry-schema.yaml  |   38 +
 Documentation/ctlv/ctlv-schema.yaml           |  359 ++++
 Documentation/ctlv/families.yaml              |   15 +
 .../ctlv/generated-files-schema.yaml          |   64 +
 Documentation/ctlv/generated-files.yaml       |   31 +
 .../ctlv/specs/ctlv-attestation-tdx.yaml      |   30 +
 .../ctlv/specs/ctlv-attestation.yaml          |  347 ++++
 Documentation/ctlv/specs/ctlv.yaml            |  379 ++++
 Documentation/driver-api/attestation.rst      |   64 +
 Documentation/driver-api/ctlv.rst             |  422 +++++
 Documentation/driver-api/index.rst            |    2 +
 Documentation/userspace-api/ctlv.rst          |  507 ++++++
 Documentation/userspace-api/index.rst         |    1 +
 .../userspace-api/ioctl/ioctl-number.rst      |    2 +
 Documentation/virt/coco/tdx-guest.rst         |   18 +
 MAINTAINERS                                   |   26 +
 drivers/Kconfig                               |    4 +
 drivers/Makefile                              |    2 +
 drivers/attestation/Kconfig                   |   26 +
 drivers/attestation/Makefile                  |   10 +
 drivers/attestation/core/core.c               |  354 ++++
 drivers/attestation/core/ctlv.c               |  520 ++++++
 drivers/attestation/core/events.c             |   65 +
 drivers/attestation/core/internal.h           |  108 ++
 drivers/attestation/core/mr.c                 |  376 ++++
 .../generated/ctlv_attestation_gen.c          |  234 +++
 .../generated/ctlv_attestation_gen.h          |  198 +++
 .../generated/ctlv_attestation_tdx_gen.c      |   61 +
 .../generated/ctlv_attestation_tdx_gen.h      |   66 +
 drivers/attestation/providers/tdx.c           |  277 +++
 drivers/ctlv/Kconfig                          |   12 +
 drivers/ctlv/Makefile                         |    5 +
 drivers/ctlv/blob.c                           |  355 ++++
 drivers/ctlv/blob.h                           |   15 +
 drivers/ctlv/blob_desc.c                      |  102 ++
 drivers/ctlv/blob_desc.h                      |   29 +
 drivers/ctlv/builder.c                        |  374 ++++
 drivers/ctlv/builder.h                        |   14 +
 drivers/ctlv/core.c                           | 1517 +++++++++++++++++
 drivers/ctlv/ctlv_gen.c                       |  229 +++
 drivers/ctlv/device.h                         |   55 +
 drivers/ctlv/event.c                          |  713 ++++++++
 drivers/ctlv/event.h                          |   69 +
 drivers/ctlv/internal.h                       |   81 +
 drivers/ctlv/introspection.c                  |  512 ++++++
 drivers/ctlv/message.c                        |  403 +++++
 drivers/ctlv/message.h                        |   92 +
 drivers/ctlv/schema.c                         | 1047 ++++++++++++
 drivers/ctlv/schema.h                         |   50 +
 drivers/virt/coco/tdx-guest/tdx-guest.c       |  258 ++-
 include/linux/attestation.h                   |  138 ++
 include/linux/ctlv.h                          |  249 +++
 include/linux/ctlv_family.h                   |  551 ++++++
 include/linux/ctlv_gen.h                      |  137 ++
 include/linux/tdx-guest.h                     |   75 +
 include/uapi/linux/ctlv.h                     |  183 ++
 include/uapi/linux/ctlv_attestation_gen.h     |  252 +++
 include/uapi/linux/ctlv_attestation_tdx_gen.h |   44 +
 include/uapi/linux/ctlv_families_gen.h        |   17 +
 include/uapi/linux/ctlv_gen.h                 |  271 +++
 tools/ctlv/Makefile                           |   59 +
 tools/ctlv/ctlv-regen.sh                      |   55 +
 tools/ctlv/ctlvgen/__init__.py                |    1 +
 tools/ctlv/ctlvgen/cli.py                     |  172 ++
 tools/ctlv/ctlvgen/lib/__init__.py            |    1 +
 tools/ctlv/ctlvgen/lib/cgen.py                |  825 +++++++++
 tools/ctlv/ctlvgen/lib/compat.py              |  821 +++++++++
 tools/ctlv/ctlvgen/lib/errors.py              |   14 +
 tools/ctlv/ctlvgen/lib/gen_family.py          |  347 ++++
 tools/ctlv/ctlvgen/lib/gen_kernel.py          |  517 ++++++
 tools/ctlv/ctlvgen/lib/gen_uapi.py            |  223 +++
 tools/ctlv/ctlvgen/lib/outputs.py             |  329 ++++
 tools/ctlv/ctlvgen/lib/semantics.py           |  893 ++++++++++
 tools/ctlv/ctlvgen/lib/sizes.py               |  238 +++
 tools/ctlv/ctlvgen/lib/spec.py                |  583 +++++++
 tools/ctlv/ctlvgen/lib/tree.py                |   71 +
 tools/ctlv/ctlvgen/lib/yamlload.py            |   83 +
 tools/ctlv/pyproject.toml                     |   22 +
 tools/ctlv/requirements.txt                   |    2 +
 83 files changed, 18084 insertions(+), 28 deletions(-)
 create mode 100644 Documentation/ctlv/abi/ctlv-attestation-tdx.yaml
 create mode 100644 Documentation/ctlv/abi/ctlv-attestation.yaml
 create mode 100644 Documentation/ctlv/abi/ctlv.yaml
 create mode 100644 Documentation/ctlv/abi/families.registry.yaml
 create mode 100644 Documentation/ctlv/ctlv-registry-schema.yaml
 create mode 100644 Documentation/ctlv/ctlv-schema.yaml
 create mode 100644 Documentation/ctlv/families.yaml
 create mode 100644 Documentation/ctlv/generated-files-schema.yaml
 create mode 100644 Documentation/ctlv/generated-files.yaml
 create mode 100644 Documentation/ctlv/specs/ctlv-attestation-tdx.yaml
 create mode 100644 Documentation/ctlv/specs/ctlv-attestation.yaml
 create mode 100644 Documentation/ctlv/specs/ctlv.yaml
 create mode 100644 Documentation/driver-api/attestation.rst
 create mode 100644 Documentation/driver-api/ctlv.rst
 create mode 100644 Documentation/userspace-api/ctlv.rst
 create mode 100644 drivers/attestation/Kconfig
 create mode 100644 drivers/attestation/Makefile
 create mode 100644 drivers/attestation/core/core.c
 create mode 100644 drivers/attestation/core/ctlv.c
 create mode 100644 drivers/attestation/core/events.c
 create mode 100644 drivers/attestation/core/internal.h
 create mode 100644 drivers/attestation/core/mr.c
 create mode 100644 drivers/attestation/generated/ctlv_attestation_gen.c
 create mode 100644 drivers/attestation/generated/ctlv_attestation_gen.h
 create mode 100644 drivers/attestation/generated/ctlv_attestation_tdx_gen.c
 create mode 100644 drivers/attestation/generated/ctlv_attestation_tdx_gen.h
 create mode 100644 drivers/attestation/providers/tdx.c
 create mode 100644 drivers/ctlv/Kconfig
 create mode 100644 drivers/ctlv/Makefile
 create mode 100644 drivers/ctlv/blob.c
 create mode 100644 drivers/ctlv/blob.h
 create mode 100644 drivers/ctlv/blob_desc.c
 create mode 100644 drivers/ctlv/blob_desc.h
 create mode 100644 drivers/ctlv/builder.c
 create mode 100644 drivers/ctlv/builder.h
 create mode 100644 drivers/ctlv/core.c
 create mode 100644 drivers/ctlv/ctlv_gen.c
 create mode 100644 drivers/ctlv/device.h
 create mode 100644 drivers/ctlv/event.c
 create mode 100644 drivers/ctlv/event.h
 create mode 100644 drivers/ctlv/internal.h
 create mode 100644 drivers/ctlv/introspection.c
 create mode 100644 drivers/ctlv/message.c
 create mode 100644 drivers/ctlv/message.h
 create mode 100644 drivers/ctlv/schema.c
 create mode 100644 drivers/ctlv/schema.h
 create mode 100644 include/linux/attestation.h
 create mode 100644 include/linux/ctlv.h
 create mode 100644 include/linux/ctlv_family.h
 create mode 100644 include/linux/ctlv_gen.h
 create mode 100644 include/linux/tdx-guest.h
 create mode 100644 include/uapi/linux/ctlv.h
 create mode 100644 include/uapi/linux/ctlv_attestation_gen.h
 create mode 100644 include/uapi/linux/ctlv_attestation_tdx_gen.h
 create mode 100644 include/uapi/linux/ctlv_families_gen.h
 create mode 100644 include/uapi/linux/ctlv_gen.h
 create mode 100644 tools/ctlv/Makefile
 create mode 100755 tools/ctlv/ctlv-regen.sh
 create mode 100644 tools/ctlv/ctlvgen/__init__.py
 create mode 100755 tools/ctlv/ctlvgen/cli.py
 create mode 100644 tools/ctlv/ctlvgen/lib/__init__.py
 create mode 100644 tools/ctlv/ctlvgen/lib/cgen.py
 create mode 100644 tools/ctlv/ctlvgen/lib/compat.py
 create mode 100644 tools/ctlv/ctlvgen/lib/errors.py
 create mode 100644 tools/ctlv/ctlvgen/lib/gen_family.py
 create mode 100644 tools/ctlv/ctlvgen/lib/gen_kernel.py
 create mode 100644 tools/ctlv/ctlvgen/lib/gen_uapi.py
 create mode 100644 tools/ctlv/ctlvgen/lib/outputs.py
 create mode 100644 tools/ctlv/ctlvgen/lib/semantics.py
 create mode 100644 tools/ctlv/ctlvgen/lib/sizes.py
 create mode 100644 tools/ctlv/ctlvgen/lib/spec.py
 create mode 100644 tools/ctlv/ctlvgen/lib/tree.py
 create mode 100644 tools/ctlv/ctlvgen/lib/yamlload.py
 create mode 100644 tools/ctlv/pyproject.toml
 create mode 100644 tools/ctlv/requirements.txt

-- 
2.56.0


             reply	other threads:[~2026-10-15 14:51 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15 14:50 Jiri Pirko [this message]
2026-10-15 14:50 ` [PATCH RFC 01/20] ctlv: Add the schema language and generator Jiri Pirko
2026-10-15 14:50 ` [PATCH RFC 02/20] ctlv: Add the UAPI wire format and family API Jiri Pirko
2026-10-15 14:50 ` [PATCH RFC 03/20] ctlv: Add the root family specification and generated files Jiri Pirko
2026-10-15 14:50 ` [PATCH RFC 04/20] Documentation: ctlv: Add userspace ABI Jiri Pirko
2026-10-15 14:50 ` [PATCH RFC 05/20] ctlv: Prepare message input handling Jiri Pirko
2026-10-15 14:50 ` [PATCH RFC 06/20] ctlv: Prepare blob descriptor validation Jiri Pirko
2026-10-15 14:50 ` [PATCH RFC 07/20] ctlv: Prepare schema validation Jiri Pirko
2026-10-15 14:50 ` [PATCH RFC 08/20] ctlv: Prepare message output handling Jiri Pirko
2026-10-15 14:50 ` [PATCH RFC 09/20] ctlv: Prepare VA blob handling Jiri Pirko
2026-10-15 14:50 ` [PATCH RFC 10/20] ctlv: Prepare event queue support Jiri Pirko
2026-10-15 14:50 ` [PATCH RFC 11/20] ctlv: Prepare runtime introspection Jiri Pirko
2026-10-15 14:50 ` [PATCH RFC 12/20] ctlv: Add device and operation dispatch Jiri Pirko
2026-10-15 14:50 ` [PATCH RFC 13/20] Documentation: ctlv: Describe how to write a family Jiri Pirko
2026-10-15 14:50 ` [PATCH RFC 14/20] attestation: Add the base family specification and generated files Jiri Pirko
2026-10-15 14:50 ` [PATCH RFC 15/20] attestation: Prepare provider and instance core Jiri Pirko
2026-10-15 14:50 ` [PATCH RFC 16/20] attestation: Prepare measurement register journal Jiri Pirko
2026-10-15 14:50 ` [PATCH RFC 17/20] attestation: Add CTLV operation handling Jiri Pirko
2026-10-15 14:50 ` [PATCH RFC 18/20] tdx-guest: Expose the native attestation service API Jiri Pirko
2026-10-15 14:50 ` [PATCH RFC 19/20] attestation: Add the TDX family specification and generated files Jiri Pirko
2026-10-15 14:50 ` [PATCH RFC 20/20] attestation: Add the TDX family implementation Jiri Pirko

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=20261015145053.3664509-1-jiri@resnulli.us \
    --to=jiri@resnulli.us \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=aik@amd.com \
    --cc=alistair.francis@wdc.com \
    --cc=ankita@nvidia.com \
    --cc=cedric.xing@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=david.quigley@intel.com \
    --cc=drdeeglaze@gmail.com \
    --cc=elena.reshetova@intel.com \
    --cc=jgg@ziepe.ca \
    --cc=jic23@kernel.org \
    --cc=jpiotrowski@nvidia.com \
    --cc=kas@kernel.org \
    --cc=ksinyuk@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=peter.fang@intel.com \
    --cc=pgonda@google.com \
    --cc=qinkun@google.com \
    --cc=rick.p.edgecombe@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=sameo@meta.com \
    --cc=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=suzuki.poulose@arm.com \
    --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