Back to QEMU
GSoC 2026

Support X86 Process Context Identifiers (PCID) in COCONUT-SVSM

COCONUT-SVSM is a Secure Virtual Machine Service Module running at a privileged level inside Confidential VMs to provide trusted services (e.g., virtual TPM) independent of the host hypervisor. Currently, the SVSM kernel performs full TLB flushes on every context switch, discarding all TLB entries indiscriminately and causing significant runtime TLB miss overhead. This project enhances COCONUT-SVSM to leverage the x86 PCID (Process Context Identifiers) hardware feature to tag TLB entries per task, preserving them across context switches and enabling selective TLB invalidation. The work is structured in three phases: Phase 1 builds a code-generated Rust crate (x86-cpuid) from the authoritative x86-cpuid-db v2.4 XML database, replacing all scattered, magic-bit-position CPUID checks across the codebase with a type-safe cpu_has(leaf_0x1::ecx::Pcid) API unified across SNP, TDX, and native platforms via a CpuidReader trait. Phase 2 designs and implements a PCID assignment strategy for all virtual pages in the COCONUT kernel, enabling the CPU to tag TLB entries per task(same for all threads of task) and preserve them across context switches. Phase 3 converts global TLB flush operations in into selective, PCID-aware invalidations: using AMD's INVLPGB broadcast instruction to flush a specific PCID across all cores without IPIs. Key Deliverables are x86-cpuid Rust crate with code generator consuming x86-cpuid-db XML, refactored COCONUT-SVSM codebase with all open-coded CPUID checks replaced with new code generated by x86-cpuid Rust crate, PCID allocator, applying the PCIDs in the COCONUT page-tables and selective TLB flush functions (flush_tlb_pcid, flush_tlb_range_pcid) with AMD INVLPGB.

Project details

Contributor

Tanish Desai

Mentors

Not available

Technologies

Not listed in the archive