From patchwork Wed Jul 9 13:23:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 33312 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f197.google.com (mail-ig0-f197.google.com [209.85.213.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3766A208CF for ; Wed, 9 Jul 2014 13:25:41 +0000 (UTC) Received: by mail-ig0-f197.google.com with SMTP id r10sf6122707igi.8 for ; Wed, 09 Jul 2014 06:25:40 -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=oxYEJ/GMFY98ejPOi7cEWXRzWV9ZvCMgiBPI3vswAmc=; b=UshRBMedBC2gJLH8RCeiauCv966KdNut+LzcwUdBL5bJJ3QU4Z54o+jRn8a0oeGNPU NoSNA5bD/DlDU7VS9eQqU7zCv6xztJPDAImI+sAW8vKDUvy8KXMfi5203nopKIkqhpZp sjiB9wxvGsIIPUk0WsAH8djdwOkkx+XbCE0/KE9Pj93FC+KAWFdk7Z3V/s3CVtnEUxW/ yiwrJGewyROERWx50ZBahdQlMMq8QACfYJsXOeiEobOWd+4SpIV0JbeEw7S7JO0mPkZv AceDywSYnClKHidbO4nFqLCLwqCwUAMdOBZvYtIaGvvatz4rwx7tkFORcmKHjEnh54Ta uPxg== X-Gm-Message-State: ALoCoQnKZUDSakmDLhbakcynXJgBlml6X3yZoYnV7/2HrvyEzn9BA+dGRM4sSiNzKWHSddH2rgif X-Received: by 10.182.249.115 with SMTP id yt19mr20820233obc.25.1404912340761; Wed, 09 Jul 2014 06:25:40 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.94.163 with SMTP id g32ls2397205qge.17.gmail; Wed, 09 Jul 2014 06:25:40 -0700 (PDT) X-Received: by 10.52.27.208 with SMTP id v16mr33505069vdg.21.1404912340679; Wed, 09 Jul 2014 06:25:40 -0700 (PDT) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id p7si4075521ves.39.2014.07.09.06.25.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 09 Jul 2014 06:25:40 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.170 as permitted sender) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id hy10so6971040vcb.1 for ; Wed, 09 Jul 2014 06:25:40 -0700 (PDT) X-Received: by 10.58.209.7 with SMTP id mi7mr127054vec.80.1404912340607; Wed, 09 Jul 2014 06:25:40 -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.221.37.5 with SMTP id tc5csp47706vcb; Wed, 9 Jul 2014 06:25:40 -0700 (PDT) X-Received: by 10.50.124.227 with SMTP id ml3mr12821510igb.46.1404912340073; Wed, 09 Jul 2014 06:25:40 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id f12si7988111igh.45.2014.07.09.06.25.39 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 09 Jul 2014 06:25:40 -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 1X4rqi-0003nN-SA; Wed, 09 Jul 2014 13:23:52 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1X4rqh-0003nA-ND for xen-devel@lists.xenproject.org; Wed, 09 Jul 2014 13:23:51 +0000 Received: from [85.158.143.35:31142] by server-1.bemta-4.messagelabs.com id 07/91-09496-7624DB35; Wed, 09 Jul 2014 13:23:51 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-10.tower-21.messagelabs.com!1404912230!16861346!1 X-Originating-IP: [209.85.212.178] 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 13910 invoked from network); 9 Jul 2014 13:23:50 -0000 Received: from mail-wi0-f178.google.com (HELO mail-wi0-f178.google.com) (209.85.212.178) by server-10.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 9 Jul 2014 13:23:50 -0000 Received: by mail-wi0-f178.google.com with SMTP id f8so2248208wiw.11 for ; Wed, 09 Jul 2014 06:23:50 -0700 (PDT) X-Received: by 10.194.6.134 with SMTP id b6mr49387466wja.64.1404912230183; Wed, 09 Jul 2014 06:23:50 -0700 (PDT) Received: from belegaer.uk.xensource.com ([185.25.64.249]) by mx.google.com with ESMTPSA id o9sm19359855wib.22.2014.07.09.06.23.48 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Jul 2014 06:23:49 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Wed, 9 Jul 2014 14:23:43 +0100 Message-Id: <1404912223-9320-2-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1404912223-9320-1-git-send-email-julien.grall@linaro.org> References: <1404912223-9320-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 2/2] xen/dt: Allow only IRQ translation that are mapped to main GIC 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.170 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: Xen is only able to handle one GIC controller. Some platform may contain other interrupt controller. Make sure to only translate IRQ mapped into the GIC handled by Xen. Signed-off-by: Julien Grall --- Changes in v3: - Add an ASSERT to check that dt_interrupt_controller is not NULL. Changes in v2: - Fix compilation... --- xen/common/device_tree.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c index 310635e..cc45bd1 100644 --- a/xen/common/device_tree.c +++ b/xen/common/device_tree.c @@ -1442,9 +1442,12 @@ int dt_irq_translate(const struct dt_raw_irq *raw, struct dt_irq *out_irq) { ASSERT(dt_irq_xlate != NULL); + ASSERT(dt_interrupt_controller != NULL); - /* TODO: Retrieve the right irq_xlate. This is only work for the gic */ + if ( raw->controller != dt_interrupt_controller ) + return -EINVAL; + /* TODO: Retrieve the right irq_xlate. This is only work for the gic */ return dt_irq_xlate(raw->specifier, raw->size, &out_irq->irq, &out_irq->type); }