]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
KVM: arm64: vgic-v3: Enable trapping of Group-0 system registers
authorMarc Zyngier <marc.zyngier@arm.com>
Fri, 9 Jun 2017 11:49:45 +0000 (12:49 +0100)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 9 Aug 2017 14:47:58 +0000 (16:47 +0200)
BugLink: https://bugs.launchpad.net/bugs/1673564
In order to be able to trap Group-0 GICv3 system registers, we need to
set ICH_HCR_EL2.TALL0 begore entering the guest. This is conditionnaly
done after having restored the guest's state, and cleared on exit.

Tested-by: Alexander Graf <agraf@suse.de>
Acked-by: David Daney <david.daney@cavium.com>
Acked-by: Christoffer Dall <cdall@linaro.org>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Christoffer Dall <cdall@linaro.org>
(backported from commit abf55766f7b062234083ff612446ff8d47e2417e)
[ dannf: context fixes ]
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
include/linux/irqchip/arm-gic-v3.h
virt/kvm/arm/vgic/vgic-v3.c

index 5048db2b819b8945b8b2c59a6ed7fc96b2522a86..6c3406dc1187c6424fce41990014454972faff38 100644 (file)
 
 #define ICH_HCR_EN                     (1 << 0)
 #define ICH_HCR_UIE                    (1 << 1)
+#define ICH_HCR_TALL0                  (1 << 11)
 #define ICH_HCR_TALL1                  (1 << 12)
 #define ICH_HCR_EOIcount_SHIFT         27
 #define ICH_HCR_EOIcount_MASK          (0x1f << ICH_HCR_EOIcount_SHIFT)
index 6fd6cbd70b8ca4b7c7dc8e391d7695f3674f4e68..9b6e1f58d6259196b78f64e2a1e54a49185a3766 100644 (file)
@@ -60,6 +60,7 @@ void vgic_v3_process_maintenance(struct kvm_vcpu *vcpu)
        cpuif->vgic_hcr &= ~ICH_HCR_UIE;
 }
 
+static bool group0_trap;
 static bool group1_trap;
 
 void vgic_v3_set_underflow(struct kvm_vcpu *vcpu)
@@ -228,6 +229,8 @@ void vgic_v3_enable(struct kvm_vcpu *vcpu)
 
        /* Get the show on the road... */
        vgic_v3->vgic_hcr = ICH_HCR_EN;
+       if (group0_trap)
+               vgic_v3->vgic_hcr |= ICH_HCR_TALL0;
        if (group1_trap)
                vgic_v3->vgic_hcr |= ICH_HCR_TALL1;
 }
@@ -367,7 +370,7 @@ int vgic_v3_probe(const struct gic_kvm_info *info)
        if (kvm_vgic_global_state.vcpu_base == 0)
                kvm_info("disabling GICv2 emulation\n");
 
-       if (group1_trap) {
+       if (group0_trap || group1_trap) {
                kvm_info("GICv3 sysreg trapping enabled (reduced performance)\n");
                static_branch_enable(&vgic_v3_cpuif_trap);
        }