diff options
author | Marc Zyngier <marc.zyngier@arm.com> | 2013-06-04 06:24:17 -0400 |
---|---|---|
committer | Christoffer Dall <christoffer.dall@linaro.org> | 2014-07-11 07:57:33 -0400 |
commit | 909d9b5025f149af6cfc304a76ad6218e6622cc0 (patch) | |
tree | d4d2f9fe3fb90ed5f98a1284f6312fc31f51071f /virt/kvm/arm/vgic.c | |
parent | 495dd859f304689a7cd5ef413c439cb090dc25e6 (diff) |
KVM: ARM: vgic: move underflow handling to vgic_ops
Move the code dealing with LR underflow handling to its own functions,
and make them accessible through vgic_ops.
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'virt/kvm/arm/vgic.c')
-rw-r--r-- | virt/kvm/arm/vgic.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c index c0bcc9735424..6d618e0b08a1 100644 --- a/virt/kvm/arm/vgic.c +++ b/virt/kvm/arm/vgic.c | |||
@@ -1063,6 +1063,16 @@ static u32 vgic_v2_get_interrupt_status(const struct kvm_vcpu *vcpu) | |||
1063 | return ret; | 1063 | return ret; |
1064 | } | 1064 | } |
1065 | 1065 | ||
1066 | static void vgic_v2_enable_underflow(struct kvm_vcpu *vcpu) | ||
1067 | { | ||
1068 | vcpu->arch.vgic_cpu.vgic_v2.vgic_hcr |= GICH_HCR_UIE; | ||
1069 | } | ||
1070 | |||
1071 | static void vgic_v2_disable_underflow(struct kvm_vcpu *vcpu) | ||
1072 | { | ||
1073 | vcpu->arch.vgic_cpu.vgic_v2.vgic_hcr &= ~GICH_HCR_UIE; | ||
1074 | } | ||
1075 | |||
1066 | static const struct vgic_ops vgic_ops = { | 1076 | static const struct vgic_ops vgic_ops = { |
1067 | .get_lr = vgic_v2_get_lr, | 1077 | .get_lr = vgic_v2_get_lr, |
1068 | .set_lr = vgic_v2_set_lr, | 1078 | .set_lr = vgic_v2_set_lr, |
@@ -1070,6 +1080,8 @@ static const struct vgic_ops vgic_ops = { | |||
1070 | .get_elrsr = vgic_v2_get_elrsr, | 1080 | .get_elrsr = vgic_v2_get_elrsr, |
1071 | .get_eisr = vgic_v2_get_eisr, | 1081 | .get_eisr = vgic_v2_get_eisr, |
1072 | .get_interrupt_status = vgic_v2_get_interrupt_status, | 1082 | .get_interrupt_status = vgic_v2_get_interrupt_status, |
1083 | .enable_underflow = vgic_v2_enable_underflow, | ||
1084 | .disable_underflow = vgic_v2_disable_underflow, | ||
1073 | }; | 1085 | }; |
1074 | 1086 | ||
1075 | static struct vgic_lr vgic_get_lr(const struct kvm_vcpu *vcpu, int lr) | 1087 | static struct vgic_lr vgic_get_lr(const struct kvm_vcpu *vcpu, int lr) |
@@ -1104,6 +1116,16 @@ static inline u32 vgic_get_interrupt_status(struct kvm_vcpu *vcpu) | |||
1104 | return vgic_ops.get_interrupt_status(vcpu); | 1116 | return vgic_ops.get_interrupt_status(vcpu); |
1105 | } | 1117 | } |
1106 | 1118 | ||
1119 | static inline void vgic_enable_underflow(struct kvm_vcpu *vcpu) | ||
1120 | { | ||
1121 | vgic_ops.enable_underflow(vcpu); | ||
1122 | } | ||
1123 | |||
1124 | static inline void vgic_disable_underflow(struct kvm_vcpu *vcpu) | ||
1125 | { | ||
1126 | vgic_ops.disable_underflow(vcpu); | ||
1127 | } | ||
1128 | |||
1107 | static void vgic_retire_lr(int lr_nr, int irq, struct kvm_vcpu *vcpu) | 1129 | static void vgic_retire_lr(int lr_nr, int irq, struct kvm_vcpu *vcpu) |
1108 | { | 1130 | { |
1109 | struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu; | 1131 | struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu; |
@@ -1285,9 +1307,9 @@ static void __kvm_vgic_flush_hwstate(struct kvm_vcpu *vcpu) | |||
1285 | 1307 | ||
1286 | epilog: | 1308 | epilog: |
1287 | if (overflow) { | 1309 | if (overflow) { |
1288 | vgic_cpu->vgic_v2.vgic_hcr |= GICH_HCR_UIE; | 1310 | vgic_enable_underflow(vcpu); |
1289 | } else { | 1311 | } else { |
1290 | vgic_cpu->vgic_v2.vgic_hcr &= ~GICH_HCR_UIE; | 1312 | vgic_disable_underflow(vcpu); |
1291 | /* | 1313 | /* |
1292 | * We're about to run this VCPU, and we've consumed | 1314 | * We're about to run this VCPU, and we've consumed |
1293 | * everything the distributor had in store for | 1315 | * everything the distributor had in store for |
@@ -1340,7 +1362,7 @@ static bool vgic_process_maintenance(struct kvm_vcpu *vcpu) | |||
1340 | } | 1362 | } |
1341 | 1363 | ||
1342 | if (status & INT_STATUS_UNDERFLOW) | 1364 | if (status & INT_STATUS_UNDERFLOW) |
1343 | vgic_cpu->vgic_v2.vgic_hcr &= ~GICH_HCR_UIE; | 1365 | vgic_disable_underflow(vcpu); |
1344 | 1366 | ||
1345 | return level_pending; | 1367 | return level_pending; |
1346 | } | 1368 | } |