summaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
authorMarc Zyngier <marc.zyngier@arm.com>2016-03-03 10:43:58 -0500
committerMarc Zyngier <marc.zyngier@arm.com>2016-03-08 23:23:00 -0500
commitd6400d77463d5c3dd386c27d07a236a07daaf33e (patch)
treecca97ef1066cd935cc6f799e3d948bf5fb24a576 /virt
parentf8cfbce1bb85984d2601a18e8f21dacc1b79dce3 (diff)
KVM: arm/arm64: vgic-v2: Reset LRs at boot time
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 <christoffer.dall@linaro.org> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/arm/vgic-v2.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/virt/kvm/arm/vgic-v2.c b/virt/kvm/arm/vgic-v2.c
index ff02f08df74d..67ec334ce1d0 100644
--- a/virt/kvm/arm/vgic-v2.c
+++ b/virt/kvm/arm/vgic-v2.c
@@ -176,6 +176,15 @@ static const struct vgic_ops vgic_v2_ops = {
176 176
177static struct vgic_params vgic_v2_params; 177static struct vgic_params vgic_v2_params;
178 178
179static void vgic_cpu_init_lrs(void *params)
180{
181 struct vgic_params *vgic = params;
182 int i;
183
184 for (i = 0; i < vgic->nr_lr; i++)
185 writel_relaxed(0, vgic->vctrl_base + GICH_LR0 + (i * 4));
186}
187
179/** 188/**
180 * vgic_v2_probe - probe for a GICv2 compatible interrupt controller in DT 189 * vgic_v2_probe - probe for a GICv2 compatible interrupt controller in DT
181 * @node: pointer to the DT node 190 * @node: pointer to the DT node
@@ -257,6 +266,9 @@ int vgic_v2_probe(struct device_node *vgic_node,
257 266
258 vgic->type = VGIC_V2; 267 vgic->type = VGIC_V2;
259 vgic->max_gic_vcpus = VGIC_V2_MAX_CPUS; 268 vgic->max_gic_vcpus = VGIC_V2_MAX_CPUS;
269
270 on_each_cpu(vgic_cpu_init_lrs, vgic, 1);
271
260 *ops = &vgic_v2_ops; 272 *ops = &vgic_v2_ops;
261 *params = vgic; 273 *params = vgic;
262 goto out; 274 goto out;