Skip to content
Open
Show file tree
Hide file tree
Changes from 45 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
3638396
cca-irq: add initial GICv3 delivery for timer, SGI, and SPI
weiding-msft Aug 3, 2026
0318d4d
cca-irq: fix aarch64 test compilation
weiding-msft Sep 15, 2026
430ed56
virt_support_gic: reconcile CCA list-register interrupt state
weiding-msft Sep 15, 2026
740fff9
virt_mshv_vtl: abstract CVM interrupt-controller polling
weiding-msft Sep 22, 2026
50fd56c
virt_mshv_vtl: handle CCA GIC LR overflow
weiding-msft Sep 29, 2026
bdc7fe1
openhcl: enable CCA virtual GIC CPU interface
weiding-msft Sep 30, 2026
b431034
cca-irq: changing the value returned from reading Gicd TYPER from bei…
Flgodd67 Sep 25, 2026
bad855c
cca-irq: fixing interrupt pending checks
Flgodd67 Oct 1, 2026
6fc7572
cca-irq: adding support for group 0, non-secure group 1 and secure gr…
Flgodd67 Sep 28, 2026
fa21358
cca-irq: adding u8 write and reads for certain sgi registers and dist…
Flgodd67 Sep 28, 2026
bd7dae5
cca: correcting the address calculation in DataAbort branch to match …
Flgodd67 Sep 29, 2026
722f547
cca-irq: code structure change
Flgodd67 Oct 1, 2026
900e84f
cca-irq: advertise GIC capabilities supported by the model
weiding-msft Oct 5, 2026
0586bf6
cca-irq: make GICR priority byte writes atomic
weiding-msft Oct 5, 2026
ed2b803
cca: reject data aborts with an invalid FAR
weiding-msft Oct 5, 2026
e3a19e1
cca: remove obsolete single-interrupt GIC paths
weiding-msft Oct 5, 2026
9f40a4e
cca: clean up software GIC documentation
weiding-msft Oct 6, 2026
4dc12c0
aarch64: use bitfields for CCA interrupt registers
weiding-msft Oct 6, 2026
ce43534
cca-irq: fix level-triggered interrupt lifecycle
weiding-msft Oct 6, 2026
3b799be
aarch64: implement GICv3 Group 0 delivery
weiding-msft Oct 7, 2026
8d85e60
virt_support_gic: deliver SPIs to nonzero VPs
weiding-msft Oct 7, 2026
32f2571
virt_support_gic: preserve SPI pending latch provenance
weiding-msft Nov 4, 2026
716793d
cca: reconcile returned GIC LRs before MMIO writes
weiding-msft Nov 4, 2026
f5f002c
virt_support_gic: include asserted level SPIs in pending readback
weiding-msft Nov 5, 2026
f805284
virt_support_gic: index returned LRs by INTID for SPI reconciliation
weiding-msft Nov 5, 2026
1c01c52
tmk_core: store AArch64 IRQ handlers as typed pointers
weiding-msft Nov 6, 2026
6ff4a76
virt_support_gic: return an error for unsupported interrupt counts
weiding-msft Nov 6, 2026
368ce2f
gic: remove unused MSI helpers and correct SPI route allocation
weiding-msft Nov 9, 2026
ce2fff1
cca: clarify priority masking for CCA pending LRs
weiding-msft Nov 9, 2026
ba2c884
virt_support_gic: fix GICD_TYPER.IDbits encoding
weiding-msft Nov 10, 2026
3b872c5
cca: honor GIC MMIO deactivation when rebuilding LRs
weiding-msft Nov 10, 2026
a5ee33d
cca: release pending SPI reservations before rebuilding LRs
weiding-msft Nov 10, 2026
6a94b13
virt_support_gic: fix duplicated priority write after rebase
weiding-msft Nov 11, 2026
a5552bc
virt_support_gic: fix IRQ tests after rebase
weiding-msft Nov 11, 2026
0105c03
tmk: Keep IRQs masked during AArch64 scope teardown
weiding-msft Nov 11, 2026
b32f5b3
virt_support_gic: Synchronize MMIO active state with CCA LRs
weiding-msft Nov 13, 2026
e9da513
virt_support_gic: Preserve SPI pending readback after LR reservation
weiding-msft Nov 13, 2026
43c3e62
virt_support_gic: Wake target VPs for software-pending SPIs
weiding-msft Nov 17, 2026
1132a55
virt_mshv_vtl: Reject CCA realms with fewer than two GIC LRs
weiding-msft Nov 18, 2026
ff629f2
virt_mshv_vtl: Decode CCA system-register traps only on synchronous e…
weiding-msft Nov 18, 2026
4ff9abb
virt_support_gic: Wake target VPs when SPI configuration enables deli…
weiding-msft Nov 18, 2026
27b1ef7
tmk_vmm: Remove unused aarch64defs dependency
weiding-msft Nov 18, 2026
c00bee4
virt_support_gic: Wake SPI targets after rerouted LR release
weiding-msft Nov 19, 2026
8469fab
virt_support_gic: Wake VPs for software-pending private interrupts
weiding-msft Nov 19, 2026
d75ccf1
virt_support_gic: Wake routed SPI targets after active LR retirement
weiding-msft Nov 19, 2026
9d02a3a
aarch64: Clean up GIC and CCA unit tests
weiding-msft Nov 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8946,6 +8946,7 @@ dependencies = [
"virt_kvm",
"virt_mshv",
"virt_mshv_vtl",
"virt_support_gic",
"virt_whp",
"vm_loader",
"vm_topology",
Expand Down Expand Up @@ -10280,6 +10281,7 @@ dependencies = [
"virt",
"virt_support_aarch64emu",
"virt_support_apic",
"virt_support_gic",
"virt_support_x86emu",
"vm_topology",
"vmcore",
Expand Down Expand Up @@ -10333,6 +10335,7 @@ dependencies = [
"memory_range",
"parking_lot",
"test_with_tracing",
"thiserror 2.0.16",
"tracelimit",
"tracing",
"vm_topology",
Expand Down
18 changes: 17 additions & 1 deletion openhcl/hcl/src/ioctl/cca.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ use memory_range::MemoryRange;
use sidecar_client::SidecarVp;
use user_driver::memory::MemoryBlock;

const RSI_PLANE_EXIT_INVALID: u64 = u64::MAX;

#[derive(Debug, Error)]
#[expect(missing_docs)]
pub enum GetIpaStateError {
Expand Down Expand Up @@ -136,6 +138,16 @@ impl Cca {
}

impl ProcessorRunner<'_, Cca> {
/// Runs the CCA plane and returns whether the RMM produced a fresh plane
/// exit.
pub fn run_cca_plane(&mut self) -> Result<bool, Error> {
self.state.plane_run_mut().exit.exit_reason = RSI_PLANE_EXIT_INVALID;

let intercepted = self.run()?;

Ok(intercepted && self.state.plane_run_ref().exit.exit_reason != RSI_PLANE_EXIT_INVALID)
}

/// Returns a reference to the current VTL's CPU context.
pub fn cpu_context(&self) -> &u64 {
// SAFETY: the cpu context will not be concurrently accessed by the
Expand Down Expand Up @@ -392,7 +404,6 @@ pub struct RsiRealmConfig {
hash_algo: u64,
#[expect(unused)]
num_aux_planes: u64,
#[expect(unused)]
gicv3_vtr: u64,
}

Expand All @@ -401,6 +412,11 @@ impl RsiRealmConfig {
pub fn ipa_width(&self) -> u64 {
self.ipa_width
}

/// Get the GICv3 virtual type register reported for the realm.
pub fn gicv3_vtr(&self) -> u64 {
self.gicv3_vtr
}
}

impl From<mshv_realm_config> for RsiRealmConfig {
Expand Down
1 change: 1 addition & 0 deletions openhcl/virt_mshv_vtl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ safe_intrinsics.workspace = true
aarch64defs.workspace = true
aarch64emu.workspace = true
virt_support_aarch64emu.workspace = true
virt_support_gic.workspace = true
Comment thread
chris-oo marked this conversation as resolved.
Resolved

[build-dependencies]
build_rs_guest_arch.workspace = true
Expand Down
57 changes: 53 additions & 4 deletions openhcl/virt_mshv_vtl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ cfg_select! {
use aarch64defs::Vendor;
use processor::cca::CcaBackedShared;
use safe_intrinsics::read_cntfrq_el0;
use virt_support_gic::GicV3Model;
use virt_support_gic::GicV3ModelError;
}
_ => {
compile_error!("unsupported guest architecture");
Expand Down Expand Up @@ -158,6 +160,9 @@ pub enum Error {
#[error("failed to create cpuid tables for cvm")]
#[cfg(guest_arch = "x86_64")]
CvmCpuid(#[source] cvm_cpuid::CpuidResultsError),
#[error("failed to create GICv3 model")]
#[cfg(guest_arch = "aarch64")]
GicV3Model(#[source] GicV3ModelError),
#[error("failed to update hypercall msr")]
UpdateHypercallMsr,
#[error("failed to update reference tsc msr")]
Expand Down Expand Up @@ -192,6 +197,14 @@ pub enum Error {
GetReg(#[source] hcl::ioctl::register::GetRegError),
#[error("failed to set register")]
SetReg(#[source] hcl::ioctl::register::SetRegError),
#[error(
"CCA realm reports {reported} GIC list registers, but the supported range is {minimum}..={maximum}"
)]
UnsupportedCcaGicListRegisterCount {
reported: usize,
minimum: usize,
maximum: usize,
},
}

/// Error revoking guest VSM.
Expand Down Expand Up @@ -296,9 +309,10 @@ impl BackingShared {
backing_shared_params,
)?),
#[cfg(guest_arch = "aarch64")]
IsolationType::Cca => {
BackingShared::Cca(Box::new(CcaBackedShared::new(backing_shared_params)?))
}
IsolationType::Cca => BackingShared::Cca(Box::new(CcaBackedShared::new(
backing_shared_params,
partition_params.topology.virt_timer_ppi(),
)?)),
_ => unreachable!(),
})
}
Expand Down Expand Up @@ -515,6 +529,9 @@ struct UhCvmPartitionState {
#[cfg(guest_arch = "x86_64")]
/// The emulated local APIC set.
lapic: VtlArray<LocalApicSet, 2>,
#[cfg(guest_arch = "aarch64")]
#[inspect(skip)]
gic: Arc<GicV3Model>,
/// The emulated hypervisor state.
hv: GlobalHv<2>,
/// Guest VSM state.
Expand Down Expand Up @@ -672,6 +689,25 @@ impl GetReferenceTime for TscReferenceTimeSource {

impl virt::irqcon::ControlGic for UhPartitionInner {
fn set_spi_irq(&self, irq_id: u32, high: bool) {
#[cfg(guest_arch = "aarch64")]
if self.isolation == IsolationType::Cca {
let Some(cvm) = self.backing_shared.cvm_state() else {
tracelimit::warn_ratelimited!(
irq = irq_id,
asserted = high,
"failed to request CCA SPI without CVM state"
);
return;
};

for vp_index in cvm.gic.set_spi_irq(irq_id, high) {
if let Some(vp) = self.vp(vp_index) {
vp.wake(GuestVtl::Vtl0, WakeReason::INTCON);
}
}
return;
}

if let Err(err) = self.hcl.request_interrupt(
hvdef::HvInterruptControl::new()
.with_arm64_asserted(high)
Expand Down Expand Up @@ -726,6 +762,15 @@ impl UhProcessorBox {
.sidecar_base_cpu(self.vp_info.base.vp_index.index())
}

/// Returns the partition-owned GICv3 model, when this processor belongs to a CCA partition.
#[cfg(guest_arch = "aarch64")]
pub fn gic_v3_model(&self) -> Option<Arc<GicV3Model>> {
match &self.partition.backing_shared {
BackingShared::Cca(shared) => Some(Arc::clone(&shared.cvm.gic)),
_ => None,
}
}

/// Returns the processor object, bound to this thread.
///
/// If `control` is provided, then this must be called on the VP's
Expand Down Expand Up @@ -857,7 +902,6 @@ impl WakeReason {
const MESSAGE_QUEUES: Self = Self::new().with_message_queues(true);
#[cfg(guest_arch = "x86_64")]
const HV_START_ENABLE_VP_VTL: Self = Self::new().with_hv_start_enable_vtl_vp(true); // StartVp/EnableVpVtl handling
#[cfg(guest_arch = "x86_64")]
const INTCON: Self = Self::new().with_intcon(true);
#[cfg(guest_arch = "x86_64")]
const UPDATE_PROXY_IRR_FILTER: Self = Self::new().with_update_proxy_irr_filter(true);
Expand Down Expand Up @@ -2389,6 +2433,9 @@ impl UhProtoPartition<'_> {
.build()
});

#[cfg(guest_arch = "aarch64")]
let gic = Arc::new(GicV3Model::new(params.topology).map_err(Error::GicV3Model)?);

let tsc_frequency = get_tsc_frequency(params.isolation)?;
let ref_time = ReferenceTimeSource::new(TscReferenceTimeSource::new(tsc_frequency));

Expand All @@ -2415,6 +2462,8 @@ impl UhProtoPartition<'_> {
isolated_memory_protector: late_params.isolated_memory_protector,
#[cfg(guest_arch = "x86_64")]
lapic,
#[cfg(guest_arch = "aarch64")]
gic,
hv,
guest_vsm: RwLock::new(GuestVsmState::from_availability(guest_vsm_available)),
access_vsm_privilege: guest_vsm_available,
Expand Down
Loading
Loading