From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoffer Dall Subject: Re: [PATCH v2 20/25] KVM: arm64: vgic-v3: Add ICV_DIR_EL1 handler Date: Tue, 6 Jun 2017 14:59:30 +0200 Message-ID: <20170606125930.GR9464@cbox> References: <20170601102117.17750-1-marc.zyngier@arm.com> <20170601102117.17750-21-marc.zyngier@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, David Daney , Catalin Marinas , Robert Richter , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu To: Marc Zyngier Return-path: Content-Disposition: inline In-Reply-To: <20170601102117.17750-21-marc.zyngier@arm.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu List-Id: kvm.vger.kernel.org On Thu, Jun 01, 2017 at 11:21:12AM +0100, Marc Zyngier wrote: > Add a handler for writing the guest's view of the ICC_DIR_EL1 > register, performing the deactivation of an interrupt if EOImode > is set ot 1. > > Signed-off-by: Marc Zyngier Reviewed-by: Christoffer Dall > --- > virt/kvm/arm/hyp/vgic-v3-sr.c | 27 +++++++++++++++++++++++++++ > 1 file changed, 27 insertions(+) > > diff --git a/virt/kvm/arm/hyp/vgic-v3-sr.c b/virt/kvm/arm/hyp/vgic-v3-sr.c > index 5ff788d308ee..b86a0776c407 100644 > --- a/virt/kvm/arm/hyp/vgic-v3-sr.c > +++ b/virt/kvm/arm/hyp/vgic-v3-sr.c > @@ -634,6 +634,30 @@ static void __hyp_text __vgic_v3_bump_eoicount(void) > write_gicreg(hcr, ICH_HCR_EL2); > } > > +static void __hyp_text __vgic_v3_write_dir(struct kvm_vcpu *vcpu, > + u32 vmcr, int rt) > +{ > + u32 vid = vcpu_get_reg(vcpu, rt); > + u64 lr_val; > + int lr; > + > + /* EOImode == 0, nothing to be done here */ > + if (!(vmcr & ICH_VMCR_EOIM_MASK)) > + return; > + > + /* No deactivate to be performed on an LPI */ > + if (vid >= VGIC_MIN_LPI) > + return; > + > + lr = __vgic_v3_find_active_lr(vcpu, vid, &lr_val); > + if (lr == -1) { > + __vgic_v3_bump_eoicount(); > + return; > + } > + > + __vgic_v3_clear_active_lr(lr, lr_val); > +} > + > static void __hyp_text __vgic_v3_write_eoir(struct kvm_vcpu *vcpu, u32 vmcr, int rt) > { > u32 vid = vcpu_get_reg(vcpu, rt); > @@ -936,6 +960,9 @@ int __hyp_text __vgic_v3_perform_cpuif_access(struct kvm_vcpu *vcpu) > else > fn = __vgic_v3_write_bpr0; > break; > + case SYS_ICC_DIR_EL1: > + fn = __vgic_v3_write_dir; > + break; > default: > return 0; > } > -- > 2.11.0 > From mboxrd@z Thu Jan 1 00:00:00 1970 From: cdall@linaro.org (Christoffer Dall) Date: Tue, 6 Jun 2017 14:59:30 +0200 Subject: [PATCH v2 20/25] KVM: arm64: vgic-v3: Add ICV_DIR_EL1 handler In-Reply-To: <20170601102117.17750-21-marc.zyngier@arm.com> References: <20170601102117.17750-1-marc.zyngier@arm.com> <20170601102117.17750-21-marc.zyngier@arm.com> Message-ID: <20170606125930.GR9464@cbox> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Thu, Jun 01, 2017 at 11:21:12AM +0100, Marc Zyngier wrote: > Add a handler for writing the guest's view of the ICC_DIR_EL1 > register, performing the deactivation of an interrupt if EOImode > is set ot 1. > > Signed-off-by: Marc Zyngier Reviewed-by: Christoffer Dall > --- > virt/kvm/arm/hyp/vgic-v3-sr.c | 27 +++++++++++++++++++++++++++ > 1 file changed, 27 insertions(+) > > diff --git a/virt/kvm/arm/hyp/vgic-v3-sr.c b/virt/kvm/arm/hyp/vgic-v3-sr.c > index 5ff788d308ee..b86a0776c407 100644 > --- a/virt/kvm/arm/hyp/vgic-v3-sr.c > +++ b/virt/kvm/arm/hyp/vgic-v3-sr.c > @@ -634,6 +634,30 @@ static void __hyp_text __vgic_v3_bump_eoicount(void) > write_gicreg(hcr, ICH_HCR_EL2); > } > > +static void __hyp_text __vgic_v3_write_dir(struct kvm_vcpu *vcpu, > + u32 vmcr, int rt) > +{ > + u32 vid = vcpu_get_reg(vcpu, rt); > + u64 lr_val; > + int lr; > + > + /* EOImode == 0, nothing to be done here */ > + if (!(vmcr & ICH_VMCR_EOIM_MASK)) > + return; > + > + /* No deactivate to be performed on an LPI */ > + if (vid >= VGIC_MIN_LPI) > + return; > + > + lr = __vgic_v3_find_active_lr(vcpu, vid, &lr_val); > + if (lr == -1) { > + __vgic_v3_bump_eoicount(); > + return; > + } > + > + __vgic_v3_clear_active_lr(lr, lr_val); > +} > + > static void __hyp_text __vgic_v3_write_eoir(struct kvm_vcpu *vcpu, u32 vmcr, int rt) > { > u32 vid = vcpu_get_reg(vcpu, rt); > @@ -936,6 +960,9 @@ int __hyp_text __vgic_v3_perform_cpuif_access(struct kvm_vcpu *vcpu) > else > fn = __vgic_v3_write_bpr0; > break; > + case SYS_ICC_DIR_EL1: > + fn = __vgic_v3_write_dir; > + break; > default: > return 0; > } > -- > 2.11.0 >