Linux Confidential Computing Development
 help / color / mirror / Atom feed
* [RFC] CoCo: Use MMIO-based protocols (instead of vmcalls) for guest-host talk
@ 2026-12-04  7:32 Xu Yilun
  2026-12-04 18:10 ` Edgecombe, Rick P
  0 siblings, 1 reply; 3+ messages in thread
From: Xu Yilun @ 2026-12-04  7:32 UTC (permalink / raw)
  To: kvm, linux-coco
  Cc: yilun.xu, yilun.xu, seanjc, pbonzini, jgg, kevin.tian,
	rick.p.edgecombe, linux-pci, kas, aneesh.kumar, aik, x86,
	zhenzhong.duan, peter.fang, chao.gao, xiaoyao.li, jiewen.yao,
	elena.reshetova

Hi all,

This is to discuss the use of MMIO-based protocols for generic guest-host
communication, e.g., getting a TSM report, delivering TDISP requests...

Note this is not formal proposals that have been agreed internally, just
to start the conversation and gather feedback.


Background & Problem
====================
In CoCo world, many vCPU operations are handled by VMM via firmware-based
vmcalls(GHCI/GHCB). The scope also extends to system operations like page
attribute conversion & system event reporting. KVM handles these requests.

Later, people tend to use this vmcall mechanism as a generic communication
channel: guest exchanges some requests with userspace VMM/firmware on the
channel. KVM doesn't actually handle these requests.

So KVM needs to interpret each vendor's vmcall opcode to find out which
request needs to be parsed by KVM, which passes through to userspace/firmware.
KVM also would like to define every request exiting to userspace via KVM uAPI
instead of punting all vendor defined register states to userspace [1]. It is a
maintenance burden that KVM doesn't act on these pass-through requests but
needs continuous changes to relay them according to vendor SPEC.

TSM report(Quote) are the existing ones that use vmcalls to exchange
attestation blobs with the firmware, see SVM_VMGEXIT_(EXT)_GUEST_REQUEST for
AMD and TDVMCALL_GET_QUOTE for Intel. Trusted I/O are the upcoming ones,
SVM_VMGEXIT_SEV_TIO_OP for AMD [2] and TDVMCALL_TDCM for Intel [3].

[1]: https://lore.kernel.org/kvm/Zg18ul8Q4PGQMWam@google.com/
[2]: https://lore.kernel.org/all/20260916115159.1938195-15-aik@amd.com/
[3]: https://lore.kernel.org/all/20260924041032.1096569-3-zhenzhong.duan@intel.com/

BTW, more background for Trusted I/O requests: A guest exchanges TDISP-related
requests/responses with the host to move an untrusted assigned device(TDI) into
a trusted state. These requests include: TDI state transition (LOCK -> RUN ->
UNLOCK); getting TDI attestation blobs; even some platform-specific requests,
e.g., AMD has some requests to let the firmware verify that the MMIO/DMA mapping
are set up as required and finally enable Trusted DMA. These Trusted I/O requests
don't require KVM action, but need host driver (vendor TSM driver) mediation.
For example, TDISP messages go through PCIe DOE mailbox, but the firmware can't
control the device directly, the TSM driver relays the message.


New Direction
=============
Actually KVM doesn't need to be involved.

In last KVM forum, Sean mentions if we could use emulated MMIO to exit to
userspace VMM and carry these request blobs ([1] also mentioned this approach).
It seems we would need to define some virtual device. The guest writes the
request into a shared buffer and triggers the VMM handler by an MMIO access.

Some research has been done before, mainly leveraging the virtio-vsock. The
main concern was that virtio is too complex, and some VMMs, guests and guest
boot phases can't support it. So we are looking for a lightweight MMIO-based
protocol.

Some ideas:
==========
- Option 1:

 - An lightweight virtio-mmio like device, enumerated by ACPI or Device tree.
   It supports all "guest requests" that GHCI/GHCB now has: Each vCPU can issue
   guest requests in parallel via its shared page.
 - Concerns:
   - The definition of the device is vague, the architectures decides which
     requests go through it. No clear definition.
   - To mimic the nature of vmcalls which executes on per vCPU basis. A
     device should have per vCPU interfaces, seems weird.

- Option 2:

 - Narrow the scope to Trusted-I/O. A virtual PCIe capability (a DVSEC) for
   TDISP capable devices which forwards the TDISP state transition/attestation
   request to the userspace VMM/firmware, so the scope of carried requests are
   naturally affined to the device
 - One PCI config register receives a shared communication page (GPA).
 - Another config register for the doorbell.
  -  Concerns:
      - No support to other features like TSM report. Keep on using vmcall or
     make a dedicated MMIO device for it?


Thanks for your time.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-12-04 18:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04  7:32 [RFC] CoCo: Use MMIO-based protocols (instead of vmcalls) for guest-host talk Xu Yilun
2026-12-04 18:10 ` Edgecombe, Rick P
2026-12-04 18:45   ` Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox