From patchwork Wed Apr 1 16:21:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 46640 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6B91C216D1 for ; Wed, 1 Apr 2015 16:35:52 +0000 (UTC) Received: by wixm2 with SMTP id m2sf12922308wix.0 for ; Wed, 01 Apr 2015 09:35:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-post:list-help:list-subscribe:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:list-archive; bh=3trqEFZmOmwDIF1rt9L+3RbhVgLUeqaGNUquiobdkg8=; b=gEn9x3Cz6bWM1tXW+knFdDTJMJvaXMOZ2mTd/PrEmyq5mS512FzMiQid4HEY9txY6e 48mjk9sdVXzSnPWmsVnOuI4BjbSBWSwj8RL2XPqj8qg3gTH4eFkWxqpQl8i91+kiKO0d xLv7ykOrAJc1qzDByFWYLzYQ2tlgoA3X1oPDYfId4spNpHgEDxU9ZuyCMvo1Gpc0ZUrK rV33Hyfy4kiKl9sRvfxYAaWmTmFVmGlBdY4gY+2l/wKEAZDp3IxIbebcF0RudZ7MzlKU QqQ0l6IZlvTfsVk5NAcqmnssYbHrmbDOyHjMhe7IVD5GSFUEDIABYCae3rLjsyhWErzw Wk4A== X-Gm-Message-State: ALoCoQllMSsEiGhnMiEwhok6K8iJ4tuy84C+fpiqDGe4D42kcyMBQhH2d3eelGo+hFOPIv7AvKjF X-Received: by 10.180.35.230 with SMTP id l6mr2113490wij.0.1427906151746; Wed, 01 Apr 2015 09:35:51 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.6.200 with SMTP id d8ls92222laa.34.gmail; Wed, 01 Apr 2015 09:35:51 -0700 (PDT) X-Received: by 10.152.22.104 with SMTP id c8mr36087133laf.87.1427906151609; Wed, 01 Apr 2015 09:35:51 -0700 (PDT) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id m4si2019584lam.97.2015.04.01.09.35.51 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Apr 2015 09:35:51 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by lbdc10 with SMTP id c10so40393605lbd.2 for ; Wed, 01 Apr 2015 09:35:51 -0700 (PDT) X-Received: by 10.152.36.169 with SMTP id r9mr13487041laj.29.1427906151429; Wed, 01 Apr 2015 09:35:51 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.57.201 with SMTP id k9csp777578lbq; Wed, 1 Apr 2015 09:35:50 -0700 (PDT) X-Received: by 10.52.94.6 with SMTP id cy6mr29689928vdb.48.1427906149236; Wed, 01 Apr 2015 09:35:49 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id bq19si1705088vdb.2.2015.04.01.09.35.48 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 01 Apr 2015 09:35:49 -0700 (PDT) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YdLao-0007Q3-5X; Wed, 01 Apr 2015 16:34:14 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YdLam-0007PB-2V for xen-devel@lists.xenproject.org; Wed, 01 Apr 2015 16:34:12 +0000 Received: from [85.158.139.211] by server-4.bemta-5.messagelabs.com id 35/F8-29354-30E1C155; Wed, 01 Apr 2015 16:34:11 +0000 X-Env-Sender: julien.grall@citrix.com X-Msg-Ref: server-13.tower-206.messagelabs.com!1427906048!13294816!1 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 6.13.6; banners=-,-,- X-VirusChecked: Checked Received: (qmail 23742 invoked from network); 1 Apr 2015 16:34:10 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-13.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 1 Apr 2015 16:34:10 -0000 X-IronPort-AV: E=Sophos;i="5.11,504,1422921600"; d="scan'208";a="248610208" From: Julien Grall To: Date: Wed, 1 Apr 2015 17:21:37 +0100 Message-ID: <1427905307-23749-5-git-send-email-julien.grall@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1427905307-23749-1-git-send-email-julien.grall@citrix.com> References: <1427905307-23749-1-git-send-email-julien.grall@citrix.com> MIME-Version: 1.0 X-DLP: MIA1 Cc: stefano.stabellini@citrix.com, Julien Grall , tim@xen.org, ian.campbell@citrix.com, Stefano Stabellini Subject: [Xen-devel] [PATCH v5 p1 04/14] xen/arm: vgic: Introduce a function to initialize pending_irq X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: patch@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: From: Julien Grall The structure pending_irq is initialized in the same way in 2 different places. Introduce vgic_init_pending_irq to avoid code duplication. Also move the setting of the irq field into this function as we need to initialize it once rather than every time an IRQ is injected to the guest. Finally, use unsigned int for the "irq" field to be consistent with the virq variable Signed-off-by: Julien Grall Acked-by: Stefano Stabellini Acked-by: Ian Campbell --- Changes in v4: - Add Ian's ack - Typoes in the commit message Changes in v3: - Add Stefano's acked - The irq field is now unsigned int - Update commit message to speak about the int -> unsigned int change - Use "unsigned int" rather than "unsigned" Changes in v2: - Patch added --- xen/arch/arm/gic.c | 2 +- xen/arch/arm/vgic.c | 19 ++++++++++--------- xen/include/asm-arm/vgic.h | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c index 8e7f24b..ba7950b 100644 --- a/xen/arch/arm/gic.c +++ b/xen/arch/arm/gic.c @@ -630,7 +630,7 @@ void gic_dump_info(struct vcpu *v) list_for_each_entry ( p, &v->arch.vgic.inflight_irqs, inflight ) { - printk("Inflight irq=%d lr=%u\n", p->irq, p->lr); + printk("Inflight irq=%u lr=%u\n", p->irq, p->lr); } list_for_each_entry( p, &v->arch.vgic.lr_pending, lr_queue ) diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c index 7b27900..fc6f851 100644 --- a/xen/arch/arm/vgic.c +++ b/xen/arch/arm/vgic.c @@ -61,6 +61,13 @@ struct vgic_irq_rank *vgic_rank_irq(struct vcpu *v, unsigned int irq) return vgic_get_rank(v, rank); } +static void vgic_init_pending_irq(struct pending_irq *p, unsigned int virq) +{ + INIT_LIST_HEAD(&p->inflight); + INIT_LIST_HEAD(&p->lr_queue); + p->irq = virq; +} + int domain_vgic_init(struct domain *d) { int i; @@ -101,10 +108,8 @@ int domain_vgic_init(struct domain *d) return -ENOMEM; for (i=0; iarch.vgic.nr_spis; i++) - { - INIT_LIST_HEAD(&d->arch.vgic.pending_irqs[i].inflight); - INIT_LIST_HEAD(&d->arch.vgic.pending_irqs[i].lr_queue); - } + vgic_init_pending_irq(&d->arch.vgic.pending_irqs[i], i + 32); + for (i=0; iarch.vgic.shared_irqs[i].lock); @@ -148,10 +153,7 @@ int vcpu_vgic_init(struct vcpu *v) memset(&v->arch.vgic.pending_irqs, 0, sizeof(v->arch.vgic.pending_irqs)); for (i = 0; i < 32; i++) - { - INIT_LIST_HEAD(&v->arch.vgic.pending_irqs[i].inflight); - INIT_LIST_HEAD(&v->arch.vgic.pending_irqs[i].lr_queue); - } + vgic_init_pending_irq(&v->arch.vgic.pending_irqs[i], i); INIT_LIST_HEAD(&v->arch.vgic.inflight_irqs); INIT_LIST_HEAD(&v->arch.vgic.lr_pending); @@ -409,7 +411,6 @@ void vgic_vcpu_inject_irq(struct vcpu *v, unsigned int irq) goto out; } - n->irq = irq; n->priority = priority; /* the irq is enabled */ diff --git a/xen/include/asm-arm/vgic.h b/xen/include/asm-arm/vgic.h index dd93872..0d0d114 100644 --- a/xen/include/asm-arm/vgic.h +++ b/xen/include/asm-arm/vgic.h @@ -67,7 +67,7 @@ struct pending_irq #define GIC_IRQ_GUEST_MIGRATING 4 unsigned long status; struct irq_desc *desc; /* only set it the irq corresponds to a physical irq */ - int irq; + unsigned int irq; #define GIC_INVALID_LR ~(uint8_t)0 uint8_t lr; uint8_t priority;