Skip to content

RFC coco/TSM: Arm CCA guest TDISP lock/accept flow with verification and DMA enable

Aneesh Kumar K.V (Arm) kvmarm linux-arm-kernel linux-coco lkml 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 RFC Latest11 patches 7 repliesIn review
  2. v3 RFC11 patches 0 repliesSuperseded
  3. v211 patches 18 repliesSuperseded

Changes in v4 from the cover letter

https://lore.kernel.org/all/[email protected]
* updated the patches to follow the RMM 2.0bet1 specification
* updated the guest-side DA code to use the renamed identity/protocol digest fields and id_index

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11coco: guest: arm64: Guest TSM callback and realm device lock supportarch/arm64/include/asm/rsi.h arch/arm64/include/asm/rsi_cmds.h arch/arm64/include/asm/rsi_smc.h +5 more+129 -20 replies
2/11coco: guest: arm64: Fix a typo in the ARM_CCA_GUEST Kconfig help string ("and" -> "an").drivers/virt/coco/arm-cca-guest/Kconfig+1 -10 replies
3/11coco: guest: arm64: Add Realm Host Interface and guest DA helperarch/arm64/include/asm/rhi.h drivers/virt/coco/arm-cca-guest/Makefile drivers/virt/coco/arm-cca-guest/arm-cca.c +2 more+218 -11 reply
4/11coco: guest: arm64: Support guest-initiated TDI lock/unlock transitionsdrivers/virt/coco/arm-cca-guest/Makefile drivers/virt/coco/arm-cca-guest/arm-cca.c drivers/virt/coco/arm-cca-guest/rsi-da.c +1 more+45 -30 replies
5/11coco: guest: arm64: Refresh interface-report cache during device lockarch/arm64/include/asm/rhi.h drivers/virt/coco/arm-cca-guest/arm-cca.c drivers/virt/coco/arm-cca-guest/rhi-da.c +3 more+67 -00 replies
6/11coco: guest: arm64: Add measurement refresh via RHI_DA_VDEV_GET_MEASUREMENTSarch/arm64/include/asm/rhi.h drivers/virt/coco/arm-cca-guest/arm-cca.c drivers/virt/coco/arm-cca-guest/rhi-da.c +3 more+134 -10 replies
7/11coco: guest: arm64: Add guest APIs to read host-cached DA objectsarch/arm64/include/asm/rhi.h drivers/virt/coco/arm-cca-guest/rhi-da.c drivers/virt/coco/arm-cca-guest/rhi-da.h +1 more+82 -02 replies
8/11coco: guest: arm64: Verify DA evidence with RSI_VDEV_GET_INFO digestsarch/arm64/include/asm/rsi_cmds.h arch/arm64/include/asm/rsi_smc.h drivers/virt/coco/arm-cca-guest/Kconfig +3 more+545 -112 replies
9/11coco: guest: arm64: Hook TSM accept to Realm TDISP RUN transitiondrivers/virt/coco/arm-cca-guest/arm-cca.c drivers/virt/coco/arm-cca-guest/rsi-da.c drivers/virt/coco/arm-cca-guest/rsi-da.h+64 -02 replies
10/11coco: arm64: dma: Update force_dma_unencrypted for accepted devicesarch/arm64/include/asm/mem_encrypt.h arch/arm64/mm/mem_encrypt.c include/linux/swiotlb.h +2 more+25 -50 replies
11/11coco: guest: arm64: Enable vdev DMA after attestationarch/arm64/include/asm/rsi_cmds.h arch/arm64/include/asm/rsi_smc.h drivers/virt/coco/arm-cca-guest/rsi-da.c+32 -00 replies

Reviews trailers per patch

2 of 11 patches have a Reviewed-by or Acked-by.

PatchJonathan Cameron
1/11
2/11
3/11
4/11
5/11
6/11
7/11
8/11
9/11R-b
10/11
11/11R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [RFC PATCH v4 00/11] coco/TSM: Arm CCA guest TDISP lock/accept flow with verification and DMA enable

This patch series implements the TSM ->lock(), ->unlock(), and ->accept() callbacks required for the TDISP setup with Arm CCA as per as per the RMM 2.0bet1 specification [1].

The series adds the guest-side DA plumbing needed to transition a device through TDI LOCK and RUN states, verify host-provided evidence against RMM-provided digests, validate interface-report MMIO mappings, and enable DMA only after attestation succeeds.

At a high level, the series includes:
- guest TSM callback registration and lock/unlock/accept hooks
- RHI DA helper support for TDI state transitions and object refresh
- host-cached DA object fetch APIs in guest
- RSI_VDEV_GET_INFO digest verification of certificate/VCA/report/measurement
- mapping validation for interface-report ranges and teardown on unlock
- DMA behavior updates for accepted devices (including swiotlb restrictions)
- vdev DMA enable after successful attestation

The series builds upon the TSM framework patches posted at [2]. A git repository containing all the related changes is available at [3].

Testing / Usage

echo ${DEVICE} > /sys/bus/pci/devices/${DEVICE}/driver/unbind

To transition the device to TDISP LOCK state:
echo tsm0 > /sys/bus/pci/devices/${DEVICE}/tsm/lock

To transition the device to TDISP RUN state:
echo 1 > /sys/bus/pci/devices/${DEVICE}/tsm/accept

echo ${DEVICE} > /sys/bus/pci/drivers_probe

Changes from v3:
https://lore.kernel.org/all/[email protected]
* updated the patches to follow the RMM 2.0bet1 specification
* updated the guest-side DA code to use the renamed identity/protocol digest fields and id_index

Changes from v2:
rfc-v2: https://lore.kernel.org/all/[email protected]
* rebase to latest kernel and core TSM changes
* Address review feedback.
* Interface report is now collected using core TSM framework
* swiotlb is now considered shared-memory pool and is not allowed to be used by accepted devices.

v1:
rfc-v1: https://lore.kernel.org/all/[email protected]

[1] https://developer.arm.com/documentation/den0137/2-0bet1/
[2] https://lore.kernel.org/all/[email protected]
[3] https://gitlab.arm.com/linux-arm/linux-cca.git cca/topics/cca-tdisp-upstream-rfc-v4

Cc Alexey Kardashevskiy <[email protected]>
Cc Catalin Marinas <[email protected]>
Cc Dan Williams <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc Jonathan Cameron <[email protected]>
Cc Marc Zyngier <[email protected]>
Cc Samuel Ortiz <[email protected]>
Cc Steven Price <[email protected]>
Cc Suzuki K Poulose <[email protected]>
Cc Will Deacon <[email protected]>
Cc Xu Yilun <[email protected]>

Aneesh Kumar K.V (Arm) (11):
coco: guest: arm64: Guest TSM callback and realm device lock support
coco: guest: arm64: Fix a typo in the ARM_CCA_GUEST Kconfig help

    string ("and" -> "an").

coco: guest: arm64: Add Realm Host Interface and guest DA helper
coco: guest: arm64: Support guest-initiated TDI lock/unlock
transitions
coco: guest: arm64: Refresh interface-report cache during device lock
coco: guest: arm64: Add measurement refresh via
RHI_DA_VDEV_GET_MEASUREMENTS
coco: guest: arm64: Add guest APIs to read host-cached DA objects
coco: guest: arm64: Verify DA evidence with RSI_VDEV_GET_INFO digests
coco: guest: arm64: Hook TSM accept to Realm TDISP RUN transition
coco: arm64: dma: Update force_dma_unencrypted for accepted devices
coco: guest: arm64: Enable vdev DMA after attestation

 arch/arm64/include/asm/mem_encrypt.h      |   6 +-
 arch/arm64/include/asm/rhi.h              |  59 ++++
 arch/arm64/include/asm/rsi.h              |   1 +
 arch/arm64/include/asm/rsi_cmds.h         |  73 +++++
 arch/arm64/include/asm/rsi_smc.h          |  63 ++++
 arch/arm64/kernel/rsi.c                   |  10 +
 arch/arm64/mm/mem_encrypt.c               |  10 +
 drivers/virt/coco/Makefile                |   2 +-
 drivers/virt/coco/arm-cca-guest/Kconfig   |   9 +-
 drivers/virt/coco/arm-cca-guest/Makefile  |   1 +
 drivers/virt/coco/arm-cca-guest/arm-cca.c | 358 +++++++++++++++++++++-
 drivers/virt/coco/arm-cca-guest/rhi-da.c  | 356 +++++++++++++++++++++
 drivers/virt/coco/arm-cca-guest/rhi-da.h  |  17 +
 drivers/virt/coco/arm-cca-guest/rsi-da.c  | 289 +++++++++++++++++
 drivers/virt/coco/arm-cca-guest/rsi-da.h  |  66 ++++
 include/linux/swiotlb.h                   |   3 +
 kernel/dma/direct.c                       |   8 +
 kernel/dma/swiotlb.c                      |   3 +
 18 files changed, 1326 insertions(+), 8 deletions(-)
 create mode 100644 drivers/virt/coco/arm-cca-guest/rhi-da.c
 create mode 100644 drivers/virt/coco/arm-cca-guest/rhi-da.h
 create mode 100644 drivers/virt/coco/arm-cca-guest/rsi-da.c
 create mode 100644 drivers/virt/coco/arm-cca-guest/rsi-da.h
Signature · 1 line
2.43.0