From patchwork Tue Jan 13 14:25:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 42995 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F015120DE8 for ; Tue, 13 Jan 2015 14:27:49 +0000 (UTC) Received: by mail-la0-f72.google.com with SMTP id gq15sf1856871lab.3 for ; Tue, 13 Jan 2015 06:27:48 -0800 (PST) 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:cc:subject:precedence:list-id:list-unsubscribe:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:list-archive; bh=HoLzPFVoak4vusMy8P6gvDxdonypZlLTLtyMOpocHnc=; b=JZy6MCiJ7vH3v6/k+UuxVoB/xr9VORUqWZElJeFGxMhSxpbQtYOItqSLkZJPv/jAFr 3jMIrWKK2kz+THf2OnuWcoUJqWu83k0DpRBdwI79sxNRaLkPgEy5tJBmnj4qDsHG+15d 8THLerq2C+hYZ7H6Dp6/vGb3wZmjPs1Cm3hFFXAACn5DI42nnodn3KDW2ZYXg0Y9v/sI 6PyVSG7lxL99ucDML1xeFnx5+/rgOln3feH1O2PHGd4hek80DVXNQaIBvP3lf087H98g Ju/cQW22tCGJSBj7hiZD3yVcAt2TUd+L6vfmoc0HtfoDiOr1VLB8z34099e10sms+zr2 PLkg== X-Gm-Message-State: ALoCoQnVm6NyfFqR9/AVZYvfP4fBE/PeC00wXYL1Fv40GgQM/925Rcn2QCokW12wnE7exTvKXOJj X-Received: by 10.180.19.42 with SMTP id b10mr2913943wie.0.1421159268906; Tue, 13 Jan 2015 06:27:48 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.23.98 with SMTP id l2ls754335laf.73.gmail; Tue, 13 Jan 2015 06:27:48 -0800 (PST) X-Received: by 10.152.23.98 with SMTP id l2mr42164741laf.46.1421159268679; Tue, 13 Jan 2015 06:27:48 -0800 (PST) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id aa1si24447707lbc.24.2015.01.13.06.27.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 Jan 2015 06:27:48 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by mail-la0-f49.google.com with SMTP id hs14so2860792lab.8 for ; Tue, 13 Jan 2015 06:27:48 -0800 (PST) X-Received: by 10.112.52.229 with SMTP id w5mr42502291lbo.52.1421159268588; Tue, 13 Jan 2015 06:27:48 -0800 (PST) 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.9.200 with SMTP id c8csp1398746lbb; Tue, 13 Jan 2015 06:27:47 -0800 (PST) X-Received: by 10.221.43.198 with SMTP id ud6mr21345670vcb.64.1421159264434; Tue, 13 Jan 2015 06:27:44 -0800 (PST) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id yh4si1128404vdc.30.2015.01.13.06.27.43 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 13 Jan 2015 06:27:44 -0800 (PST) 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 1YB2QZ-0001Bz-1c; Tue, 13 Jan 2015 14:26:39 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YB2QW-00019p-Ts for xen-devel@lists.xenproject.org; Tue, 13 Jan 2015 14:26:37 +0000 Received: from [85.158.139.211] by server-6.bemta-5.messagelabs.com id 30/B4-26652-C1B25B45; Tue, 13 Jan 2015 14:26:36 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-7.tower-206.messagelabs.com!1421159195!17833888!1 X-Originating-IP: [209.85.212.177] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.12.5; banners=-,-,- X-VirusChecked: Checked Received: (qmail 17293 invoked from network); 13 Jan 2015 14:26:35 -0000 Received: from mail-wi0-f177.google.com (HELO mail-wi0-f177.google.com) (209.85.212.177) by server-7.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 13 Jan 2015 14:26:35 -0000 Received: by mail-wi0-f177.google.com with SMTP id l15so4268077wiw.4 for ; Tue, 13 Jan 2015 06:26:35 -0800 (PST) X-Received: by 10.181.13.105 with SMTP id ex9mr6175743wid.69.1421159190252; Tue, 13 Jan 2015 06:26:30 -0800 (PST) Received: from chilopoda.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id ni15sm14513482wic.18.2015.01.13.06.26.28 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 13 Jan 2015 06:26:29 -0800 (PST) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Tue, 13 Jan 2015 14:25:14 +0000 Message-Id: <1421159133-31526-6-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1421159133-31526-1-git-send-email-julien.grall@linaro.org> References: <1421159133-31526-1-git-send-email-julien.grall@linaro.org> Cc: stefano.stabellini@citrix.com, Julien Grall , tim@xen.org, ian.campbell@citrix.com Subject: [Xen-devel] [PATCH v3 05/24] 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: , MIME-Version: 1.0 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: julien.grall@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.215.49 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: The structure pending_irq is initialized on the same way in 2 differents place. Introduce vgic_init_pending_irq to avoid code duplication. Also move the setting of the irq field in 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 --- 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 63147f3..eb0c5d6 100644 --- a/xen/arch/arm/gic.c +++ b/xen/arch/arm/gic.c @@ -627,7 +627,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 0b24eec..38216f7 100644 --- a/xen/arch/arm/vgic.c +++ b/xen/arch/arm/vgic.c @@ -60,6 +60,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; @@ -100,10 +107,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); @@ -147,10 +152,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); @@ -407,7 +409,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 460a2f3..8582d9d 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;