From patchwork Tue Apr 22 12:58:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 28784 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f198.google.com (mail-pd0-f198.google.com [209.85.192.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DCBF2203C3 for ; Tue, 22 Apr 2014 13:04:35 +0000 (UTC) Received: by mail-pd0-f198.google.com with SMTP id fp1sf21616510pdb.1 for ; Tue, 22 Apr 2014 06:04:34 -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=Og9iBl/2NWHNIFZPEWdObThIhAqOkE7qgm0Htaiy5rs=; b=Eg76kthVRWB5nrlMZ156YAzLPiAzF6kN7F6+ERUXkk4W63fgGf2V1mPSxPmWT6nl6e OIqXmGyaWwIXJecxQE6SPSmQCTLw04Izq8FdXPFcdyYk/UxZeGWJA0z9rnkVaSTiFsA0 EGazh7Iia1sKxIKBhflbPH+FEBXVvYFxmLO4YzOx8Aq3hagVvWREAJuqCVhZEEEqdIQM a7zxJ0aQBgnGX0vlUxCyoHBw/bg7aM2MkqnmQNDx6gDY+BW4rJDNbXLurRWXh4OjTglx FYZwBLISGrC+zetp58Nu2RrmjGFNwSO+rq33YQGmGcSU/4xycZgZX4H7lmDfHBdJ+7fl I2+g== X-Gm-Message-State: ALoCoQkMMsemJDgLlOrLg+WeA5jodonpN0FDWM6kpVJ4uOuH40Zss0xe6GwEHzpt1rBN70noZqk5 X-Received: by 10.68.253.66 with SMTP id zy2mr22167191pbc.1.1398171874715; Tue, 22 Apr 2014 06:04:34 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.87.177 with SMTP id r46ls92634qgd.98.gmail; Tue, 22 Apr 2014 06:04:34 -0700 (PDT) X-Received: by 10.220.237.146 with SMTP id ko18mr8448vcb.49.1398171874483; Tue, 22 Apr 2014 06:04:34 -0700 (PDT) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id y7si6213777veb.198.2014.04.22.06.04.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 22 Apr 2014 06:04:34 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.182 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.182; Received: by mail-vc0-f182.google.com with SMTP id ib6so2544483vcb.13 for ; Tue, 22 Apr 2014 06:04:34 -0700 (PDT) X-Received: by 10.220.191.134 with SMTP id dm6mr36445892vcb.16.1398171874384; Tue, 22 Apr 2014 06:04:34 -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 ib8csp22880vcb; Tue, 22 Apr 2014 06:04:34 -0700 (PDT) X-Received: by 10.140.91.7 with SMTP id y7mr52247067qgd.3.1398171873205; Tue, 22 Apr 2014 06:04:33 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id o60si16970505qga.160.2014.04.22.06.04.32 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 22 Apr 2014 06:04:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xen.org designates 50.57.142.19 as permitted sender) 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 1WcaJZ-0001y0-48; Tue, 22 Apr 2014 13:00:45 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WcaI3-0001h7-O7 for xen-devel@lists.xenproject.org; Tue, 22 Apr 2014 12:59:44 +0000 Received: from [85.158.137.68:11964] by server-15.bemta-3.messagelabs.com id 16/77-13757-E9766535; Tue, 22 Apr 2014 12:59:10 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-2.tower-31.messagelabs.com!1398171549!6977273!1 X-Originating-IP: [74.125.83.54] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.11.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 32196 invoked from network); 22 Apr 2014 12:59:09 -0000 Received: from mail-ee0-f54.google.com (HELO mail-ee0-f54.google.com) (74.125.83.54) by server-2.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 22 Apr 2014 12:59:09 -0000 Received: by mail-ee0-f54.google.com with SMTP id d49so4637866eek.13 for ; Tue, 22 Apr 2014 05:59:09 -0700 (PDT) X-Received: by 10.14.110.199 with SMTP id u47mr11456564eeg.74.1398171549566; Tue, 22 Apr 2014 05:59:09 -0700 (PDT) Received: from belegaer.uk.xensource.com ([185.25.64.249]) by mx.google.com with ESMTPSA id x45sm112862825eef.15.2014.04.22.05.59.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Apr 2014 05:59:08 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Tue, 22 Apr 2014 13:58:41 +0100 Message-Id: <1398171530-27391-10-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1398171530-27391-1-git-send-email-julien.grall@linaro.org> References: <1398171530-27391-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 v4 09/18] xen/arm: IRQ Introduce irq_get_domain 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=neutral (google.com: 209.85.220.182 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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: This function retrieves a domain from an IRQ. It will be used in several places (such as do_IRQ) to avoid duplicated code when multiple action will be supported. Signed-off-by: Julien Grall Acked-by: Ian Campbell --- Changes in v4: - Return dom_xen when the IRQ is not routed to a guest Changes in v2: - Patch added --- xen/arch/arm/irq.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c index f3a30bd..26574ca 100644 --- a/xen/arch/arm/irq.c +++ b/xen/arch/arm/irq.c @@ -98,6 +98,18 @@ void __cpuinit init_secondary_IRQ(void) BUG_ON(init_local_irq_data() < 0); } +static inline struct domain *irq_get_domain(struct irq_desc *desc) +{ + ASSERT(spin_is_locked(&desc->lock)); + + if ( !(desc->status & IRQ_GUEST) ) + return dom_xen; + + ASSERT(desc->action != NULL); + + return desc->action->dev_id; +} + int request_dt_irq(const struct dt_irq *irq, void (*handler)(int, void *, struct cpu_user_regs *), const char *devname, void *dev_id) @@ -156,7 +168,7 @@ void do_IRQ(struct cpu_user_regs *regs, unsigned int irq, int is_fiq) if ( desc->status & IRQ_GUEST ) { - struct domain *d = action->dev_id; + struct domain *d = irq_get_domain(desc); desc->handler->end(desc);