Skip to contentSkip to conversation

Implement save and restore for gic (template impl)

RFC PATCH Jaeyong Yoo 1 participant 1 message Jun 5, 2013

lore
Share & tools
lore
#0 lore raw
Quoted 18 lines
Quoted 4 lines
(quoted diff) +4 -0
+static int gic_save(struct domain *d, hvm_domain_context_t *h)
+{
+    struct hvm_hw_gic ctxt;
+    struct vcpu *v;

Review

Quoted 10 lines
(quoted diff) +10 -0
+
+    /* Save the state of GICs */
+    for_each_vcpu( d, v )
+    {
+        ctxt.gic_hcr = v->arch.gic_hcr;
+        ctxt.gic_vmcr = v->arch.gic_vmcr;
+        ctxt.gic_apr = v->arch.gic_apr;
+        memcpy( ctxt.gic_lr, v->arch.gic_lr, sizeof(v->arch.gic_lr) );
+        ctxt.event_mask = v->arch.event_mask;
+        ctxt.lr_mask = v->arch.lr_mask;

In general on x86 the policy is that hvm headers should store only architectural state. I think this is a good policy to carry over to ARM.

Quoted 4 lines

With that in mind I don't think either event_mask or lr_mask are architectural state but are actually internal state of the vgic "emulation" which can and should be reconstructed when loading the architectural state.

Thanks! That is very helpful :)

Jaeyong