rust-vmm / vmm-reference

A VMM implementation based of rust-vmm components
Apache License 2.0
146 stars 61 forks source link

GIC state save/restore #222

Closed gsserge closed 2 years ago

gsserge commented 2 years ago

Summary of the PR

Save and restore the state of GIC (Generic Interrupt Controller) as part of the general VM state on aarch64.

The GIC state consists of three groups of registers:

  1. Distributor registers, implemented in the vm-vcpu-ref/aarch64/regs/dist module.
  2. Redistributors registers per vCPU, implemented in vm-vcpu-ref/aarch64/regs/redist.
  3. System (ICC) registers per vCPU, implemented in vm-vcpu-ref/aarch64/regs/icc.

For redistributors and system registers, target vCPUs are identified by MPIDR registers, stored as part of the per-vCPU state. However, when doing get attr and set attr operations on a KVM device, the value of a MPIDR register should be packed in a specific way defined in https://www.kernel.org/doc/html/latest/virt/kvm/devices/arm-vgic-v3.html. The helper function construct_kvm_mpidrs() is used for this conversion.

Requirements

Before submitting your PR, please make sure you addressed the following requirements:

gsserge commented 2 years ago

Is it possible to add more tests?

More tests for what? These changes are tested by the existing save/restore tests in vm-vcpu.