Skip to content

Commit

Permalink
KVM: arm/arm64: vgic-v2: Reset LRs at boot time
Browse files Browse the repository at this point in the history
In order to let make the GICv2 code more lazy in the way it
accesses the LRs, it is necessary to start with a clean slate.

Let's reset the LRs on each CPU when the vgic is probed.

Reviewed-by: Christoffer Dall <[email protected]>
Signed-off-by: Marc Zyngier <[email protected]>
  • Loading branch information
Marc Zyngier committed Mar 9, 2016
1 parent f8cfbce commit d6400d7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions virt/kvm/arm/vgic-v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,15 @@ static const struct vgic_ops vgic_v2_ops = {

static struct vgic_params vgic_v2_params;

static void vgic_cpu_init_lrs(void *params)
{
struct vgic_params *vgic = params;
int i;

for (i = 0; i < vgic->nr_lr; i++)
writel_relaxed(0, vgic->vctrl_base + GICH_LR0 + (i * 4));
}

/**
* vgic_v2_probe - probe for a GICv2 compatible interrupt controller in DT
* @node: pointer to the DT node
Expand Down Expand Up @@ -257,6 +266,9 @@ int vgic_v2_probe(struct device_node *vgic_node,

vgic->type = VGIC_V2;
vgic->max_gic_vcpus = VGIC_V2_MAX_CPUS;

on_each_cpu(vgic_cpu_init_lrs, vgic, 1);

*ops = &vgic_v2_ops;
*params = vgic;
goto out;
Expand Down

0 comments on commit d6400d7

Please sign in to comment.