Re: [PATCH v2 12/25] KVM: arm64: Enable GICv3 Group-1 sysreg trapping via command-line

Christoffer Dall
2017-06-06T14:38:28Z

On Tue, Jun 06, 2017 at 02:59:34PM +0100, Marc Zyngier wrote:
> On 06/06/17 13:06, Christoffer Dall wrote:
> > On Thu, Jun 01, 2017 at 11:21:04AM +0100, Marc Zyngier wrote:
> >> Now that we're able to safely handle Group-1 sysreg access, let's
> >> give the user the opportunity to enable it by passing a specific
> >> command-line option (vgic_v3.group1_trap).
> >>
> >> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> >> ---
> >> virt/kvm/arm/hyp/vgic-v3-sr.c | 6 +++++-
> >> virt/kvm/arm/vgic/vgic-v3.c | 11 +++++++++++
> >> 2 files changed, 16 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/virt/kvm/arm/hyp/vgic-v3-sr.c b/virt/kvm/arm/hyp/vgic-v3-sr.c
> >> index 8973bad35748..42ac9ee7650a 100644
> >> --- a/virt/kvm/arm/hyp/vgic-v3-sr.c
> >> +++ b/virt/kvm/arm/hyp/vgic-v3-sr.c
> >> @@ -334,7 +334,11 @@ void __hyp_text __vgic_v3_restore_state(struct kvm_vcpu *vcpu)
> >> for (i = 0; i < used_lrs; i++)
> >> __gic_v3_set_lr(cpu_if->vgic_lr[i], i);
> >> } else {
> >> - /* Always write ICH_HCR_EL2 to enable trapping */
> >> + /*
> >> + * If we don't have any interrupt to inject, but that
> >> + * trapping is enabled, write the ICH_HCR_EL2 config
> >> + * anyway.
> >> + */
> >
> > nit: Whitespace and grammar issues, and maybe this hunk was supposed to
> > be in the last patch?
>
> Indeed, on both counts.
>
> >
> >> if (static_branch_unlikely(&vgic_v3_cpuif_trap))
> >> write_gicreg(cpu_if->vgic_hcr, ICH_HCR_EL2);
> >> }
> >> diff --git a/virt/kvm/arm/vgic/vgic-v3.c b/virt/kvm/arm/vgic/vgic-v3.c
> >> index fbd678bc046d..a16769276efd 100644
> >> --- a/virt/kvm/arm/vgic/vgic-v3.c
> >> +++ b/virt/kvm/arm/vgic/vgic-v3.c
> >> @@ -416,6 +416,12 @@ int vgic_v3_map_resources(struct kvm *kvm)
> >>
> >> DEFINE_STATIC_KEY_FALSE(vgic_v3_cpuif_trap);
> >>
> >> +static int __init early_group1_trap_cfg(char *buf)
> >> +{
> >> + return strtobool(buf, &group1_trap);
> >> +}
> >> +early_param("vgic_v3.group1_trap", early_group1_trap_cfg);
> >> +
> >
> > this shouldn't be named something with KVM (we're not going to trap
> > anything on the host somehow are we?)?
>
> Good point. kvm_vgic_v3.whatever?
>

Yeah, sounds fine.

Thanks,
-Christoffer