From patchwork Mon May 12 17:57:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 29993 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f70.google.com (mail-pa0-f70.google.com [209.85.220.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 38989238ED for ; Mon, 12 May 2014 17:59:46 +0000 (UTC) Received: by mail-pa0-f70.google.com with SMTP id lj1sf44453456pab.1 for ; Mon, 12 May 2014 10:59:45 -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:cc:subject:precedence:list-id:list-unsubscribe:list-post :list-help:list-subscribe:mime-version:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list :list-archive:content-type:content-transfer-encoding; bh=dT8vLEoeyzrdbFnv1Mh4q2YOHLokyAMECZ17NLo6Bxs=; b=gZ68T3sgq/VKjA4U5HYUQw7cy/q4HNWQKpKvoTOQCPQEuOZOYSGp33xdLEdQIH61lG RlgSTJJD7vGrm6KC9us893cNB+pDXJ34C76IvSSqbjHfuszWJKC58g2NANefAbkdk8/i Ng9UEF7ZJwcj6Ya5d2iZL1+L2tPExo4rd5MaXN6hXFbvSWq0XadqZ0ASAFYvj1oakbl8 kXlC+h4rb2RX+kjmgaaWKVWVBOqZq0wrUZr31oNyVnrJAOe3+eTKxLcxSdpvgmcyK7sd 37ry5Sz4TP2rlroZ0xDnMoO5OgLj7/RlQIkjZUdiIsJKK/j5wumlTGeWUvbW6oK+y0eF /e/Q== X-Gm-Message-State: ALoCoQmeH8agfx0TFj7K2W9P+RapksaAIJrTlSXUXuC0fSc6apRX2c+7pA/ENPUqMr9ITHRzguf6 X-Received: by 10.66.65.109 with SMTP id w13mr12125747pas.21.1399917585512; Mon, 12 May 2014 10:59:45 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.40.209 with SMTP id x75ls1427393qgx.46.gmail; Mon, 12 May 2014 10:59:45 -0700 (PDT) X-Received: by 10.221.50.70 with SMTP id vd6mr1917085vcb.51.1399917585421; Mon, 12 May 2014 10:59:45 -0700 (PDT) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id uv3si2188407vdc.113.2014.05.12.10.59.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 12 May 2014 10:59:45 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.177 as permitted sender) client-ip=209.85.220.177; Received: by mail-vc0-f177.google.com with SMTP id if17so4765990vcb.8 for ; Mon, 12 May 2014 10:59:45 -0700 (PDT) X-Received: by 10.221.69.68 with SMTP id yb4mr1929710vcb.49.1399917585340; Mon, 12 May 2014 10:59:45 -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.220.221.72 with SMTP id ib8csp88781vcb; Mon, 12 May 2014 10:59:45 -0700 (PDT) X-Received: by 10.220.183.4 with SMTP id ce4mr1913292vcb.54.1399917571123; Mon, 12 May 2014 10:59:31 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id ql8si557259veb.140.2014.05.12.10.59.30 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 12 May 2014 10:59:31 -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 1WjuTl-0005es-Cn; Mon, 12 May 2014 17:57:33 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WjuTj-0005eA-L1 for xen-devel@lists.xenproject.org; Mon, 12 May 2014 17:57:31 +0000 Received: from [85.158.139.211:51317] by server-8.bemta-5.messagelabs.com id CB/D4-11310-A8B01735; Mon, 12 May 2014 17:57:30 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-11.tower-206.messagelabs.com!1399917449!3793948!1 X-Originating-IP: [74.125.83.47] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.11.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 23369 invoked from network); 12 May 2014 17:57:29 -0000 Received: from mail-ee0-f47.google.com (HELO mail-ee0-f47.google.com) (74.125.83.47) by server-11.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 12 May 2014 17:57:29 -0000 Received: by mail-ee0-f47.google.com with SMTP id c13so4979047eek.20 for ; Mon, 12 May 2014 10:57:29 -0700 (PDT) X-Received: by 10.15.53.69 with SMTP id q45mr34254118eew.22.1399917449747; Mon, 12 May 2014 10:57:29 -0700 (PDT) Received: from belegaer.uk.xensource.com ([185.25.64.249]) by mx.google.com with ESMTPSA id l3sm34404295eeo.43.2014.05.12.10.57.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 May 2014 10:57:28 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 12 May 2014 18:57:14 +0100 Message-Id: <1399917438-21475-4-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1399917438-21475-1-git-send-email-julien.grall@linaro.org> References: <1399917438-21475-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 v6 3/6] xen/arm: Replace route_guest_dt_irq by route_guest_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.220.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: We can use platform_get_irq to get the IRQ which will be route to the guest. platform_get_irq will store the type of IRQ (e.g level/edge...) directly in the irq_desc. This will avoid to have device tree specific routing function. Signed-off-by: Julien Grall Acked-by: Ian Campbell --- Changes in v6: - Patch added --- xen/arch/arm/domain_build.c | 16 +++++++++------- xen/arch/arm/irq.c | 12 +++++------- xen/arch/arm/platforms/xgene-storm.c | 15 ++++++++++----- xen/include/asm-arm/irq.h | 4 ++-- 4 files changed, 26 insertions(+), 21 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index af5cd6c..fd35223 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -685,7 +685,7 @@ static int map_device(struct domain *d, const struct dt_device_node *dev) unsigned int naddr; unsigned int i; int res; - struct dt_irq irq; + unsigned int irq; struct dt_raw_irq rirq; u64 addr, size; @@ -716,20 +716,22 @@ static int map_device(struct domain *d, const struct dt_device_node *dev) continue; } - res = dt_irq_translate(&rirq, &irq); - if ( res ) + res = platform_get_irq(dev, i); + if ( res < 0 ) { - printk(XENLOG_ERR "Unable to translate irq %u for %s\n", + printk(XENLOG_ERR "Unable to get irq %u for %s\n", i, dt_node_full_name(dev)); return res; } - DPRINT("irq %u = %u type = 0x%x\n", i, irq.irq, irq.type); - res = route_dt_irq_to_guest(d, &irq, dt_node_name(dev)); + irq = res; + + DPRINT("irq %u = %u\n", i, irq); + res = route_irq_to_guest(d, irq, dt_node_name(dev)); if ( res ) { printk(XENLOG_ERR "Unable to route IRQ %u to domain %u\n", - irq.irq, d->domain_id); + irq, d->domain_id); return res; } } diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c index 34238a1..4b0d534 100644 --- a/xen/arch/arm/irq.c +++ b/xen/arch/arm/irq.c @@ -316,11 +316,11 @@ err: return rc; } -int route_dt_irq_to_guest(struct domain *d, const struct dt_irq *irq, - const char * devname) +int route_irq_to_guest(struct domain *d, unsigned int irq, + const char * devname) { struct irqaction *action; - struct irq_desc *desc = irq_to_desc(irq->irq); + struct irq_desc *desc = irq_to_desc(irq); unsigned long flags; int retval = 0; @@ -348,10 +348,9 @@ int route_dt_irq_to_guest(struct domain *d, const struct dt_irq *irq, if ( desc->status & IRQ_GUEST ) printk(XENLOG_ERR "ERROR: IRQ %u is already used by domain %u\n", - irq->irq, ad->domain_id); + irq, ad->domain_id); else - printk(XENLOG_ERR "ERROR: IRQ %u is already used by Xen\n", - irq->irq); + printk(XENLOG_ERR "ERROR: IRQ %u is already used by Xen\n", irq); retval = -EBUSY; goto out; } @@ -360,7 +359,6 @@ int route_dt_irq_to_guest(struct domain *d, const struct dt_irq *irq, if ( retval ) goto out; - desc->arch.type = irq->type; gic_route_irq_to_guest(d, desc, cpumask_of(smp_processor_id()), GIC_PRI_IRQ); spin_unlock_irqrestore(&desc->lock, flags); diff --git a/xen/arch/arm/platforms/xgene-storm.c b/xen/arch/arm/platforms/xgene-storm.c index 70aab73..37a0bf1 100644 --- a/xen/arch/arm/platforms/xgene-storm.c +++ b/xen/arch/arm/platforms/xgene-storm.c @@ -57,16 +57,21 @@ static int map_one_mmio(struct domain *d, const char *what, static int map_one_spi(struct domain *d, const char *what, unsigned int spi, unsigned int type) { - struct dt_irq irq; + unsigned int irq; int ret; - irq.type = type; + irq = spi + 32; /* SPIs start at IRQ 32 */ - irq.irq = spi + 32; /* SPIs start at IRQ 32 */ + ret = irq_set_type(irq, type); + if ( ret ) + { + printk("Failed to set the type for IRQ%u\n", irq); + return ret; + } - printk("Additional IRQ %u (%s)\n", irq.irq, what); + printk("Additional IRQ %u (%s)\n", irq, what); - ret = route_dt_irq_to_guest(d, &irq, what); + ret = route_irq_to_guest(d, irq, what); if ( ret ) printk("Failed to route %s to dom%d\n", what, d->domain_id); diff --git a/xen/include/asm-arm/irq.h b/xen/include/asm-arm/irq.h index c23faa4..3bf0363 100644 --- a/xen/include/asm-arm/irq.h +++ b/xen/include/asm-arm/irq.h @@ -40,8 +40,8 @@ void do_IRQ(struct cpu_user_regs *regs, unsigned int irq, int is_fiq); void init_IRQ(void); void init_secondary_IRQ(void); -int route_dt_irq_to_guest(struct domain *d, const struct dt_irq *irq, - const char *devname); +int route_irq_to_guest(struct domain *d, unsigned int irq, + const char *devname); /* Set IRQ type for an SPI */ int irq_set_type(unsigned int spi, unsigned int type);