From patchwork Wed Jun 14 16:51:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 9786977 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C124D60325 for ; Wed, 14 Jun 2017 16:54:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B33961FF15 for ; Wed, 14 Jun 2017 16:54:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A7CA628604; Wed, 14 Jun 2017 16:54:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 562B31FF15 for ; Wed, 14 Jun 2017 16:54:58 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dLBWt-0006MQ-DU; Wed, 14 Jun 2017 16:52:27 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dLBWs-0006LW-Mz for xen-devel@lists.xenproject.org; Wed, 14 Jun 2017 16:52:26 +0000 Received: from [193.109.254.147] by server-7.bemta-6.messagelabs.com id 0A/D3-03620-AC961495; Wed, 14 Jun 2017 16:52:26 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrGLMWRWlGSWpSXmKPExsVysyfVTfdkpmO kwaWfKhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8b2WUcZC74IVXxd94K9gfE3fxcjF4eQwGZG iclzNrFAOMsZJR4+eszWxcjJwSagK7Hj5mtmEFtEIFTi6YLvzCBFzALXGSVO75gPViQs4COx5 uEJsCIWAVWJKbe+gdm8AlYS+56uAquREJCTaDh/HyzOKWAtMXX7ZKYuRg6gbVYSN1foT2DkXs DIsIpRvTi1qCy1SNdcL6koMz2jJDcxM0fX0MBMLze1uDgxPTUnMalYLzk/dxMj0L8MQLCDceZ l/0OMkhxMSqK8UwUdI4X4kvJTKjMSizPii0pzUosPMcpwcChJ8J5JB8oJFqWmp1akZeYAAw0m LcHBoyTCuzUVKM1bXJCYW5yZDpE6xagoJc4bmAGUEABJZJTmwbXBgvsSo6yUMC8j0CFCPAWpR bmZJajyrxjFORiVhHnLQLbzZOaVwE1/BbSYCWhx0AUHkMUliQgpqQZGu8nZfHrtYkfaj/rcvm vB8/04y9tDPP8ac1cuWb5OZfpZPmmzqSkGW6zlGNZM/Fyd+3xXaLFEuP4T6ceOXy/X1Vz5yvh Az+FT91kPWZUni87fNnlR/1OaNayoYd0tP9+yU9O+mhpFC20vS9t+p3L+RvVaLk1uhnvbnwVN buuRPbbxy8Ey/uVdSizFGYmGWsxFxYkAOuspP2kCAAA= X-Env-Sender: andre.przywara@arm.com X-Msg-Ref: server-10.tower-27.messagelabs.com!1497459145!84482265!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.19; banners=-,-,- X-VirusChecked: Checked Received: (qmail 48018 invoked from network); 14 Jun 2017 16:52:25 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-10.tower-27.messagelabs.com with SMTP; 14 Jun 2017 16:52:25 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DE89015B2; Wed, 14 Jun 2017 09:52:24 -0700 (PDT) Received: from e104803-lin.lan (unknown [10.1.207.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8FAC03F3E1; Wed, 14 Jun 2017 09:52:23 -0700 (PDT) From: Andre Przywara To: Julien Grall , Stefano Stabellini Date: Wed, 14 Jun 2017 17:51:56 +0100 Message-Id: <20170614165223.7543-8-andre.przywara@arm.com> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170614165223.7543-1-andre.przywara@arm.com> References: <20170614165223.7543-1-andre.przywara@arm.com> Cc: xen-devel@lists.xenproject.org, Vijaya Kumar K , Vijay Kilari , Shanker Donthineni , Manish Jaggi Subject: [Xen-devel] [PATCH v12 07/34] ARM: vGIC: introduce gic_remove_irq_from_queues() X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP To avoid code duplication in a later patch, introduce a generic function to remove a virtual IRQ from the VGIC. Call that function instead of the open-coded version in vgic_migrate_irq(). Signed-off-by: Andre Przywara Acked-by: Julien Grall --- xen/arch/arm/gic.c | 9 +++++++++ xen/arch/arm/vgic.c | 4 +--- xen/include/asm-arm/gic.h | 1 + 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c index 6c0c9c3..a59591d 100644 --- a/xen/arch/arm/gic.c +++ b/xen/arch/arm/gic.c @@ -407,6 +407,15 @@ void gic_remove_from_lr_pending(struct vcpu *v, struct pending_irq *p) list_del_init(&p->lr_queue); } +void gic_remove_irq_from_queues(struct vcpu *v, struct pending_irq *p) +{ + ASSERT(spin_is_locked(&v->arch.vgic.lock)); + + clear_bit(GIC_IRQ_GUEST_QUEUED, &p->status); + list_del_init(&p->inflight); + gic_remove_from_lr_pending(v, p); +} + void gic_raise_inflight_irq(struct vcpu *v, unsigned int virtual_irq) { struct pending_irq *n = irq_to_pending(v, virtual_irq); diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c index f2f423f..9771463 100644 --- a/xen/arch/arm/vgic.c +++ b/xen/arch/arm/vgic.c @@ -266,9 +266,7 @@ bool vgic_migrate_irq(struct vcpu *old, struct vcpu *new, unsigned int irq) /* If the IRQ is still lr_pending, re-inject it to the new vcpu */ if ( !list_empty(&p->lr_queue) ) { - clear_bit(GIC_IRQ_GUEST_QUEUED, &p->status); - list_del_init(&p->lr_queue); - list_del_init(&p->inflight); + gic_remove_irq_from_queues(old, p); irq_set_affinity(p->desc, cpumask_of(new->processor)); spin_unlock_irqrestore(&old->arch.vgic.lock, flags); vgic_vcpu_inject_irq(new, irq); diff --git a/xen/include/asm-arm/gic.h b/xen/include/asm-arm/gic.h index 3130634..7b2e98c 100644 --- a/xen/include/asm-arm/gic.h +++ b/xen/include/asm-arm/gic.h @@ -244,6 +244,7 @@ extern void gic_raise_guest_irq(struct vcpu *v, unsigned int irq, unsigned int priority); extern void gic_raise_inflight_irq(struct vcpu *v, unsigned int virtual_irq); extern void gic_remove_from_lr_pending(struct vcpu *v, struct pending_irq *p); +extern void gic_remove_irq_from_queues(struct vcpu *v, struct pending_irq *p); /* Accept an interrupt from the GIC and dispatch its handler */ extern void gic_interrupt(struct cpu_user_regs *regs, int is_fiq);