Commit ff89511e authored by Marc Zyngier's avatar Marc Zyngier

KVM: arm64: Enable GICv3 common sysreg trapping via command-line

Now that we're able to safely handle common sysreg access, let's
give the user the opportunity to enable it by passing a specific
command-line option (vgic_v3.common_trap).
Tested-by: default avatarAlexander Graf <agraf@suse.de>
Acked-by: default avatarDavid Daney <david.daney@cavium.com>
Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
Acked-by: default avatarChristoffer Dall <cdall@linaro.org>
Signed-off-by: default avatarChristoffer Dall <cdall@linaro.org>
parent 6293d651
...@@ -1837,6 +1837,10 @@ ...@@ -1837,6 +1837,10 @@
[KVM,ARM] Trap guest accesses to GICv3 group-1 [KVM,ARM] Trap guest accesses to GICv3 group-1
system registers system registers
kvm-arm.vgic_v3_common_trap=
[KVM,ARM] Trap guest accesses to GICv3 common
system registers
kvm-intel.ept= [KVM,Intel] Disable extended page tables kvm-intel.ept= [KVM,Intel] Disable extended page tables
(virtualized MMU) support on capable Intel chips. (virtualized MMU) support on capable Intel chips.
Default is 1 (enabled) Default is 1 (enabled)
......
...@@ -417,6 +417,7 @@ ...@@ -417,6 +417,7 @@
#define ICH_HCR_EN (1 << 0) #define ICH_HCR_EN (1 << 0)
#define ICH_HCR_UIE (1 << 1) #define ICH_HCR_UIE (1 << 1)
#define ICH_HCR_TC (1 << 10)
#define ICH_HCR_TALL0 (1 << 11) #define ICH_HCR_TALL0 (1 << 11)
#define ICH_HCR_TALL1 (1 << 12) #define ICH_HCR_TALL1 (1 << 12)
#define ICH_HCR_EOIcount_SHIFT 27 #define ICH_HCR_EOIcount_SHIFT 27
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
static bool group0_trap; static bool group0_trap;
static bool group1_trap; static bool group1_trap;
static bool common_trap;
void vgic_v3_set_underflow(struct kvm_vcpu *vcpu) void vgic_v3_set_underflow(struct kvm_vcpu *vcpu)
{ {
...@@ -265,6 +266,8 @@ void vgic_v3_enable(struct kvm_vcpu *vcpu) ...@@ -265,6 +266,8 @@ void vgic_v3_enable(struct kvm_vcpu *vcpu)
vgic_v3->vgic_hcr |= ICH_HCR_TALL0; vgic_v3->vgic_hcr |= ICH_HCR_TALL0;
if (group1_trap) if (group1_trap)
vgic_v3->vgic_hcr |= ICH_HCR_TALL1; vgic_v3->vgic_hcr |= ICH_HCR_TALL1;
if (common_trap)
vgic_v3->vgic_hcr |= ICH_HCR_TC;
} }
int vgic_v3_lpi_sync_pending_status(struct kvm *kvm, struct vgic_irq *irq) int vgic_v3_lpi_sync_pending_status(struct kvm *kvm, struct vgic_irq *irq)
...@@ -450,6 +453,12 @@ static int __init early_group1_trap_cfg(char *buf) ...@@ -450,6 +453,12 @@ static int __init early_group1_trap_cfg(char *buf)
} }
early_param("kvm-arm.vgic_v3_group1_trap", early_group1_trap_cfg); early_param("kvm-arm.vgic_v3_group1_trap", early_group1_trap_cfg);
static int __init early_common_trap_cfg(char *buf)
{
return strtobool(buf, &common_trap);
}
early_param("kvm-arm.vgic_v3_common_trap", early_common_trap_cfg);
/** /**
* vgic_v3_probe - probe for a GICv3 compatible interrupt controller in DT * vgic_v3_probe - probe for a GICv3 compatible interrupt controller in DT
* @node: pointer to the DT node * @node: pointer to the DT node
...@@ -508,7 +517,7 @@ int vgic_v3_probe(const struct gic_kvm_info *info) ...@@ -508,7 +517,7 @@ int vgic_v3_probe(const struct gic_kvm_info *info)
} }
#endif #endif
if (group0_trap || group1_trap) { if (group0_trap || group1_trap || common_trap) {
kvm_info("GICv3 sysreg trapping enabled (reduced performance)\n"); kvm_info("GICv3 sysreg trapping enabled (reduced performance)\n");
static_branch_enable(&vgic_v3_cpuif_trap); static_branch_enable(&vgic_v3_cpuif_trap);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment