* [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* Re: [RFC] CoCo: Use MMIO-based protocols (instead of vmcalls) for guest-host talk
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
0 siblings, 1 reply; 3+ messages in thread
From: Edgecombe, Rick P @ 2026-12-04 18:10 UTC (permalink / raw)
To: kvm@vger.kernel.org, linux-coco@lists.linux.dev,
yilun.xu@linux.intel.com
Cc: Li, Xiaoyao, Yao, Jiewen, Reshetova, Elena, kas@kernel.org,
seanjc@google.com, Xu, Yilun, pbonzini@redhat.com, Tian, Kevin,
jgg@nvidia.com, aneesh.kumar@kernel.org, Fang, Peter,
Duan, Zhenzhong, Gao, Chao, linux-pci@vger.kernel.org,
aik@amd.com, x86@kernel.org
On Fri, 2026-12-04 at 15:32 +0800, Xu Yilun wrote:
I was initially pretty excited about this, for the reason of getting to skip
adding KVM support for each new type of data that needs to be shuffled to
userspace. But I've started to wonder if it actually makes sense once you apply
it to the specific cases.
> 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.
The nice thing about this is we could put all future GHCI calls that go to
userspace in it too. However, what goes to userspace and what is handled within
KVM is a KVM specific detail. Where as GHCI is supposed to be a cross-VMM
interface.
>
> - 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?
For option 2, then this doesn't become a generic GHCI mechanism for the future.
But on the point of what to do about trusted IO GHCI calls. Today some GHCI
calls are handled by the kernel and some are morphed into KVM exits. Either to
existing exits or new TDX specific ones.
The TDX TDCM GHCI calls closely mirror the standard TDISP operations. IIUC SNP
has a special exit type, with a shared GPA. There is a clear text header in the
payload involved in these VM exits, which also mirrors the standard TDISP
operations.
We expect these will need to be passed to userspace too? So at least on the SNP
side, these will either need to go out with one big KVM exit type, or morphed
into 7-8 individual exits. Since the specific TDISP operation is embedded in the
data in the shared memory, it probably ends up looking like one big exit.
So we might have the case where KVM has an exit type for this already. The
matching SNP and TDX calls could be nudged to match, and use the same exit type
or routing that SNP ends up needing to add. (I think the formats are pretty
close already?) Then they share something like a KVM_EXIT_TIO.
But this would leave the generic problem still open.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC] CoCo: Use MMIO-based protocols (instead of vmcalls) for guest-host talk
2026-12-04 18:10 ` Edgecombe, Rick P
@ 2026-12-04 18:45 ` Jason Gunthorpe
0 siblings, 0 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2026-12-04 18:45 UTC (permalink / raw)
To: Edgecombe, Rick P
Cc: kvm@vger.kernel.org, linux-coco@lists.linux.dev,
yilun.xu@linux.intel.com, Li, Xiaoyao, Yao, Jiewen,
Reshetova, Elena, kas@kernel.org, seanjc@google.com, Xu, Yilun,
pbonzini@redhat.com, Tian, Kevin, aneesh.kumar@kernel.org,
Fang, Peter, Duan, Zhenzhong, Gao, Chao,
linux-pci@vger.kernel.org, aik@amd.com, x86@kernel.org
On Fri, Dec 04, 2026 at 06:10:37PM +0000, Edgecombe, Rick P wrote:
> We expect these will need to be passed to userspace too? So at least on the SNP
> side, these will either need to go out with one big KVM exit type, or morphed
> into 7-8 individual exits. Since the specific TDISP operation is embedded in the
> data in the shared memory, it probably ends up looking like one big
> exit.
Yeah, all the GHCI mechanisms related to tdisp should go out to
userspace, the VMM has to relay them back into the kernel on a
different uAPI that is tied to the vdevice.
KVM doesn't have enough information to forward these on its own and we
don't want to teach kvm about the vfio devices, or how the VMM has
layed out the vPCI bus and so on.
I feel like everyone has already set their guest side specifications,
so it is unlikely at this point we can just say we don't support those
in a Linux hypervisor. So a new method is just going to be added along
side the old ones without making things in aggregate simpler.
The time for standards was ages ago when all could have got together
and made a Guest/VMM message channel with some standard messages on it
for every implementation. That would have been tremendously helpful to
the industry and greatly sped up upstreaming all of this.
Oh well.
Jason
^ 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