All of lore.kernel.org
 help / color / mirror / Atom feed
From: marc.zyngier@arm.com (Marc Zyngier)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 10/19] KVM: ARM: vgic: move underflow handling to vgic_ops
Date: Thu, 20 Mar 2014 11:52:57 +0000	[thread overview]
Message-ID: <1395316386-12617-11-git-send-email-marc.zyngier@arm.com> (raw)
In-Reply-To: <1395316386-12617-1-git-send-email-marc.zyngier@arm.com>

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>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 include/kvm/arm_vgic.h |  2 ++
 virt/kvm/arm/vgic.c    | 28 +++++++++++++++++++++++++---
 2 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/include/kvm/arm_vgic.h b/include/kvm/arm_vgic.h
index 95085a6..407e104 100644
--- a/include/kvm/arm_vgic.h
+++ b/include/kvm/arm_vgic.h
@@ -87,6 +87,8 @@ struct vgic_ops {
 	u64	(*get_elrsr)(const struct kvm_vcpu *vcpu);
 	u64	(*get_eisr)(const struct kvm_vcpu *vcpu);
 	u32	(*get_interrupt_status)(const struct kvm_vcpu *vcpu);
+	void	(*set_underflow)(struct kvm_vcpu *vcpu);
+	void	(*clear_underflow)(struct kvm_vcpu *vcpu);
 };
 
 struct vgic_dist {
diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c
index 9e100f6..13dad1f 100644
--- a/virt/kvm/arm/vgic.c
+++ b/virt/kvm/arm/vgic.c
@@ -1047,12 +1047,24 @@ static u32 vgic_v2_get_interrupt_status(const struct kvm_vcpu *vcpu)
 	return ret;
 }
 
+static void vgic_v2_set_underflow(struct kvm_vcpu *vcpu)
+{
+	vcpu->arch.vgic_cpu.vgic_v2.vgic_hcr |= GICH_HCR_UIE;
+}
+
+static void vgic_v2_clear_underflow(struct kvm_vcpu *vcpu)
+{
+	vcpu->arch.vgic_cpu.vgic_v2.vgic_hcr &= ~GICH_HCR_UIE;
+}
+
 static const struct vgic_ops vgic_ops = {
 	.get_lr			= vgic_v2_get_lr,
 	.set_lr			= vgic_v2_set_lr,
 	.get_elrsr		= vgic_v2_get_elrsr,
 	.get_eisr		= vgic_v2_get_eisr,
 	.get_interrupt_status	= vgic_v2_get_interrupt_status,
+	.set_underflow		= vgic_v2_set_underflow,
+	.clear_underflow	= vgic_v2_clear_underflow,
 };
 
 static inline struct vgic_lr vgic_get_lr(const struct kvm_vcpu *vcpu, int lr)
@@ -1081,6 +1093,16 @@ static inline u32 vgic_get_interrupt_status(struct kvm_vcpu *vcpu)
 	return vgic_ops.get_interrupt_status(vcpu);
 }
 
+static inline void vgic_set_underflow(struct kvm_vcpu *vcpu)
+{
+	vgic_ops.set_underflow(vcpu);
+}
+
+static inline void vgic_clear_underflow(struct kvm_vcpu *vcpu)
+{
+	vgic_ops.clear_underflow(vcpu);
+}
+
 static void vgic_retire_lr(int lr_nr, int irq, struct kvm_vcpu *vcpu)
 {
 	struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
@@ -1262,9 +1284,9 @@ static void __kvm_vgic_flush_hwstate(struct kvm_vcpu *vcpu)
 
 epilog:
 	if (overflow) {
-		vgic_cpu->vgic_v2.vgic_hcr |= GICH_HCR_UIE;
+		vgic_set_underflow(vcpu);
 	} else {
-		vgic_cpu->vgic_v2.vgic_hcr &= ~GICH_HCR_UIE;
+		vgic_clear_underflow(vcpu);
 		/*
 		 * We're about to run this VCPU, and we've consumed
 		 * everything the distributor had in store for
@@ -1311,7 +1333,7 @@ static bool vgic_process_maintenance(struct kvm_vcpu *vcpu)
 	}
 
 	if (status & INT_STATUS_UNDERFLOW)
-		vgic_cpu->vgic_v2.vgic_hcr &= ~GICH_HCR_UIE;
+		vgic_clear_underflow(vcpu);
 
 	return level_pending;
 }
-- 
1.8.3.4

  parent reply	other threads:[~2014-03-20 11:52 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-20 11:52 [PATCH v2 00/19] arm64: GICv3 support Marc Zyngier
2014-03-20 11:52 ` [PATCH v2 01/19] ARM: GIC: move some bits of GICv2 to a library-type file Marc Zyngier
2014-03-20 11:52 ` [PATCH v2 02/19] arm64: initial support for GICv3 Marc Zyngier
     [not found]   ` <CAMDttNew0S7xVVKge7AAR3W6bdQzKdvN9Z7cHPDUCq=jZ98q1A@mail.gmail.com>
2014-03-24 11:10     ` Marc Zyngier
     [not found]       ` <CABg9mcucJ_UouRbJ_Urirz6ita5uUvYuQkmeA1-Df00KSjFcnA@mail.gmail.com>
2014-03-25  7:33         ` Marc Zyngier
2014-03-25 10:13         ` Marc Zyngier
     [not found]           ` <CABg9mcsWrjsBaDbk0fdJPJdzhQ6jmgZOkDNG0_r7ZbWzcCdb0A@mail.gmail.com>
2014-03-25 19:29             ` Marc Zyngier
2014-03-24 19:03   ` Sudeep Holla
2014-03-24 19:07     ` Marc Zyngier
2014-03-20 11:52 ` [PATCH v2 03/19] arm64: GICv3 device tree binding documentation Marc Zyngier
2014-03-20 11:52 ` [PATCH v2 04/19] arm64: boot protocol documentation update for GICv3 Marc Zyngier
2014-03-20 11:52 ` [PATCH v2 05/19] KVM: arm/arm64: vgic: move GICv2 registers to their own structure Marc Zyngier
2014-03-20 11:52 ` [PATCH v2 06/19] KVM: ARM: vgic: introduce vgic_ops and LR manipulation primitives Marc Zyngier
2014-03-20 11:52 ` [PATCH v2 07/19] KVM: ARM: vgic: abstract access to the ELRSR bitmap Marc Zyngier
2014-03-20 11:52 ` [PATCH v2 08/19] KVM: ARM: vgic: abstract EISR bitmap access Marc Zyngier
2014-03-20 11:52 ` [PATCH v2 09/19] KVM: ARM: vgic: abstract MISR decoding Marc Zyngier
2014-03-20 11:52 ` Marc Zyngier [this message]
2014-03-20 11:52 ` [PATCH v2 11/19] KVM: ARM: vgic: abstract VMCR access Marc Zyngier
2014-03-20 11:52 ` [PATCH v2 12/19] KVM: ARM: vgic: introduce vgic_enable Marc Zyngier
2014-03-20 11:53 ` [PATCH v2 13/19] KVM: ARM: introduce vgic_params structure Marc Zyngier
2014-03-20 11:53 ` [PATCH v2 14/19] KVM: ARM: vgic: split GICv2 backend from the main vgic code Marc Zyngier
2014-03-20 11:53 ` [PATCH v2 15/19] arm64: KVM: remove __kvm_hyp_code_{start, end} from hyp.S Marc Zyngier
2014-03-20 11:53 ` [PATCH v2 16/19] arm64: KVM: split GICv2 world switch from hyp code Marc Zyngier
2014-03-20 11:53 ` [PATCH v2 17/19] arm64: KVM: move hcr_el2 setting into vgic-v2-switch.S Marc Zyngier
2014-03-20 11:53 ` [PATCH v2 18/19] KVM: ARM: vgic: add the GICv3 backend Marc Zyngier
2014-03-20 11:53 ` [PATCH v2 19/19] arm64: KVM: vgic: add GICv3 world switch Marc Zyngier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1395316386-12617-11-git-send-email-marc.zyngier@arm.com \
    --to=marc.zyngier@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.