Skip to content

Commit 3e8a8a5

Browse files
author
Marc Zyngier
committed
KVM: arm: vgic-v3: Add support for ICC_SGI0R and ICC_ASGI1R accesses
In order to generate Group0 SGIs, let's add some decoding logic to access_gic_sgi(), and pass the generating group accordingly. Reviewed-by: Eric Auger <eric.auger@redhat.com> Reviewed-by: Christoffer Dall <christoffer.dall@arm.com> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
1 parent 03bd646 commit 3e8a8a5

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

arch/arm/kvm/coproc.c

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,14 +246,33 @@ static bool access_gic_sgi(struct kvm_vcpu *vcpu,
246246
const struct coproc_reg *r)
247247
{
248248
u64 reg;
249+
bool g1;
249250

250251
if (!p->is_write)
251252
return read_from_write_only(vcpu, p);
252253

253254
reg = (u64)*vcpu_reg(vcpu, p->Rt2) << 32;
254255
reg |= *vcpu_reg(vcpu, p->Rt1) ;
255256

256-
vgic_v3_dispatch_sgi(vcpu, reg, true);
257+
/*
258+
* In a system where GICD_CTLR.DS=1, a ICC_SGI0R access generates
259+
* Group0 SGIs only, while ICC_SGI1R can generate either group,
260+
* depending on the SGI configuration. ICC_ASGI1R is effectively
261+
* equivalent to ICC_SGI0R, as there is no "alternative" secure
262+
* group.
263+
*/
264+
switch (p->Op1) {
265+
default: /* Keep GCC quiet */
266+
case 0: /* ICC_SGI1R */
267+
g1 = true;
268+
break;
269+
case 1: /* ICC_ASGI1R */
270+
case 2: /* ICC_SGI0R */
271+
g1 = false;
272+
break;
273+
}
274+
275+
vgic_v3_dispatch_sgi(vcpu, reg, g1);
257276

258277
return true;
259278
}
@@ -459,6 +478,10 @@ static const struct coproc_reg cp15_regs[] = {
459478

460479
/* ICC_SGI1R */
461480
{ CRm64(12), Op1( 0), is64, access_gic_sgi},
481+
/* ICC_ASGI1R */
482+
{ CRm64(12), Op1( 1), is64, access_gic_sgi},
483+
/* ICC_SGI0R */
484+
{ CRm64(12), Op1( 2), is64, access_gic_sgi},
462485

463486
/* VBAR: swapped by interrupt.S. */
464487
{ CRn(12), CRm( 0), Op1( 0), Op2( 0), is32,

0 commit comments

Comments
 (0)