Skip to content

Commit cbca197

Browse files
author
Marc Zyngier
committed
KVM: arm64: pkvm: Handle GICv3 traps as required
Forward accesses to the ICV_*SGI*_EL1 registers to EL1, and emulate ICV_SRE_EL1 by returning a fixed value. This should be enough to support GICv3 in a protected guest. Signed-off-by: Marc Zyngier <[email protected]> Reviewed-by: Fuad Tabba <[email protected]> Tested-by: Fuad Tabba <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent f3d5cca commit cbca197

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

arch/arm64/kvm/hyp/nvhe/sys_regs.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
* Author: Fuad Tabba <[email protected]>
55
*/
66

7+
#include <linux/irqchip/arm-gic-v3.h>
8+
79
#include <asm/kvm_asm.h>
810
#include <asm/kvm_fixed_config.h>
911
#include <asm/kvm_mmu.h>
@@ -303,6 +305,17 @@ static bool pvm_access_id_aarch64(struct kvm_vcpu *vcpu,
303305
return true;
304306
}
305307

308+
static bool pvm_gic_read_sre(struct kvm_vcpu *vcpu,
309+
struct sys_reg_params *p,
310+
const struct sys_reg_desc *r)
311+
{
312+
/* pVMs only support GICv3. 'nuf said. */
313+
if (!p->is_write)
314+
p->regval = ICC_SRE_EL1_DIB | ICC_SRE_EL1_DFB | ICC_SRE_EL1_SRE;
315+
316+
return true;
317+
}
318+
306319
/* Mark the specified system register as an AArch32 feature id register. */
307320
#define AARCH32(REG) { SYS_DESC(REG), .access = pvm_access_id_aarch32 }
308321

@@ -386,7 +399,10 @@ static const struct sys_reg_desc pvm_sys_reg_descs[] = {
386399

387400
/* Limited Ordering Regions Registers are restricted. */
388401

389-
/* GIC CPU Interface registers are restricted. */
402+
HOST_HANDLED(SYS_ICC_SGI1R_EL1),
403+
HOST_HANDLED(SYS_ICC_ASGI1R_EL1),
404+
HOST_HANDLED(SYS_ICC_SGI0R_EL1),
405+
{ SYS_DESC(SYS_ICC_SRE_EL1), .access = pvm_gic_read_sre, },
390406

391407
HOST_HANDLED(SYS_CCSIDR_EL1),
392408
HOST_HANDLED(SYS_CLIDR_EL1),

0 commit comments

Comments
 (0)