]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - virt/kvm/arm/hyp/vgic-v3-sr.c
KVM: arm64: vgic-v3: Add ICV_PMR_EL1 handler
[mirror_ubuntu-zesty-kernel.git] / virt / kvm / arm / hyp / vgic-v3-sr.c
index d8c5a09b1f5852ed9001ba750c7679c8e5d77bdf..6eb0d67cc528e5182bce94a78e5260e03cf2a4e3 100644 (file)
@@ -933,6 +933,27 @@ spurious:
        vcpu_set_reg(vcpu, rt, lr_val & ICH_LR_VIRTUAL_ID_MASK);
 }
 
+static void __hyp_text __vgic_v3_read_pmr(struct kvm_vcpu *vcpu,
+                                         u32 vmcr, int rt)
+{
+       vmcr &= ICH_VMCR_PMR_MASK;
+       vmcr >>= ICH_VMCR_PMR_SHIFT;
+       vcpu_set_reg(vcpu, rt, vmcr);
+}
+
+static void __hyp_text __vgic_v3_write_pmr(struct kvm_vcpu *vcpu,
+                                          u32 vmcr, int rt)
+{
+       u32 val = vcpu_get_reg(vcpu, rt);
+
+       val <<= ICH_VMCR_PMR_SHIFT;
+       val &= ICH_VMCR_PMR_MASK;
+       vmcr &= ~ICH_VMCR_PMR_MASK;
+       vmcr |= val;
+
+       write_gicreg(vmcr, ICH_VMCR_EL2);
+}
+
 static void __hyp_text __vgic_v3_read_rpr(struct kvm_vcpu *vcpu,
                                          u32 vmcr, int rt)
 {
@@ -1078,6 +1099,12 @@ int __hyp_text __vgic_v3_perform_cpuif_access(struct kvm_vcpu *vcpu)
                else
                        fn = __vgic_v3_write_ctlr;
                break;
+       case ICC_PMR_EL1:
+               if (is_read)
+                       fn = __vgic_v3_read_pmr;
+               else
+                       fn = __vgic_v3_write_pmr;
+               break;
        default:
                return 0;
        }