KVM: arm/arm64: vgic-new: Add vgic_v2/v3_enable
Enable the VGIC operation by properly initialising the registers in the hypervisor GIC interface. Signed-off-by: Eric Auger <eric.auger@linaro.org> Signed-off-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
This commit is contained in:
parent
b0442ee227
commit
f7b6985cc3
|
@ -206,9 +206,18 @@ void vgic_v2_get_vmcr(struct kvm_vcpu *vcpu, struct vgic_vmcr *vmcrp)
|
||||||
GICH_VMCR_PRIMASK_SHIFT;
|
GICH_VMCR_PRIMASK_SHIFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* not yet implemented */
|
|
||||||
void vgic_v2_enable(struct kvm_vcpu *vcpu)
|
void vgic_v2_enable(struct kvm_vcpu *vcpu)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* By forcing VMCR to zero, the GIC will restore the binary
|
||||||
|
* points to their reset values. Anything else resets to zero
|
||||||
|
* anyway.
|
||||||
|
*/
|
||||||
|
vcpu->arch.vgic_cpu.vgic_v2.vgic_vmcr = 0;
|
||||||
|
vcpu->arch.vgic_cpu.vgic_v2.vgic_elrsr = ~0;
|
||||||
|
|
||||||
|
/* Get the show on the road... */
|
||||||
|
vcpu->arch.vgic_cpu.vgic_v2.vgic_hcr = GICH_HCR_EN;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check for overlapping regions and for regions crossing the end of memory */
|
/* check for overlapping regions and for regions crossing the end of memory */
|
||||||
|
|
|
@ -186,9 +186,30 @@ void vgic_v3_get_vmcr(struct kvm_vcpu *vcpu, struct vgic_vmcr *vmcrp)
|
||||||
vmcrp->pmr = (vmcr & ICH_VMCR_PMR_MASK) >> ICH_VMCR_PMR_SHIFT;
|
vmcrp->pmr = (vmcr & ICH_VMCR_PMR_MASK) >> ICH_VMCR_PMR_SHIFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* not yet implemented */
|
|
||||||
void vgic_v3_enable(struct kvm_vcpu *vcpu)
|
void vgic_v3_enable(struct kvm_vcpu *vcpu)
|
||||||
{
|
{
|
||||||
|
struct vgic_v3_cpu_if *vgic_v3 = &vcpu->arch.vgic_cpu.vgic_v3;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* By forcing VMCR to zero, the GIC will restore the binary
|
||||||
|
* points to their reset values. Anything else resets to zero
|
||||||
|
* anyway.
|
||||||
|
*/
|
||||||
|
vgic_v3->vgic_vmcr = 0;
|
||||||
|
vgic_v3->vgic_elrsr = ~0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If we are emulating a GICv3, we do it in an non-GICv2-compatible
|
||||||
|
* way, so we force SRE to 1 to demonstrate this to the guest.
|
||||||
|
* This goes with the spec allowing the value to be RAO/WI.
|
||||||
|
*/
|
||||||
|
if (vcpu->kvm->arch.vgic.vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3)
|
||||||
|
vgic_v3->vgic_sre = ICC_SRE_EL1_SRE;
|
||||||
|
else
|
||||||
|
vgic_v3->vgic_sre = 0;
|
||||||
|
|
||||||
|
/* Get the show on the road... */
|
||||||
|
vgic_v3->vgic_hcr = ICH_HCR_EN;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check for overlapping regions and for regions crossing the end of memory */
|
/* check for overlapping regions and for regions crossing the end of memory */
|
||||||
|
|
Loading…
Reference in New Issue