From patchwork Mon Jun 16 16:18:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 31991 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f199.google.com (mail-ve0-f199.google.com [209.85.128.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 773DB2107C for ; Mon, 16 Jun 2014 16:20:12 +0000 (UTC) Received: by mail-ve0-f199.google.com with SMTP id oy12sf17598225veb.6 for ; Mon, 16 Jun 2014 09:20:12 -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=QN9M/FZF0+yD859KxBwlWKvy0CluV+0keKfx0fqoljM=; b=JNs6L6VD7uA0y5Mrp6la4DniSzfq4I+sxbWGGi8ed7dqO54DFPeI/N7K46oZ/zSraN Z2NTO/2NsRpqLuuHQz/AJpLFUSvSgEJH9P7x0A3h6vgziBmLL5cTyn1B8o/421JtCZVs xe99rsyUFkH0RX7ricnrr8GUVPDWMTlm1WSN7BHLOS64VRfDDKISLVzzWHxEE+Kyzhfn Lpqb2cgeX2qWkO3NozpK09HhojusBdhel4qsx0r7bPrnAWvts3I8QGjVytUahFbvu9ql EwaaPMVlfoDIg94MaWDY8X4Rs/OJnqMQwZdovRzD9qiACxJMBL1zI6+QzASekrT6yL1J LZ1A== X-Gm-Message-State: ALoCoQnBUnKQLY4rxu38hHPOQlVkvTsUkNW28a0IK0VhU9q43/hFPOFdbSIYZr/FYI139NEULF2u X-Received: by 10.236.202.143 with SMTP id d15mr4657506yho.18.1402935612282; Mon, 16 Jun 2014 09:20:12 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.88.80 with SMTP id s74ls172950qgd.50.gmail; Mon, 16 Jun 2014 09:20:12 -0700 (PDT) X-Received: by 10.220.190.197 with SMTP id dj5mr16928464vcb.19.1402935612201; Mon, 16 Jun 2014 09:20:12 -0700 (PDT) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) by mx.google.com with ESMTPS id od9si4288839vcb.32.2014.06.16.09.20.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Jun 2014 09:20:12 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) client-ip=209.85.220.172; Received: by mail-vc0-f172.google.com with SMTP id hy10so5203135vcb.31 for ; Mon, 16 Jun 2014 09:20:12 -0700 (PDT) X-Received: by 10.58.112.65 with SMTP id io1mr900950veb.61.1402935612118; Mon, 16 Jun 2014 09:20:12 -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.54.6 with SMTP id vs6csp146188vcb; Mon, 16 Jun 2014 09:20:11 -0700 (PDT) X-Received: by 10.224.80.74 with SMTP id s10mr22664892qak.77.1402935610479; Mon, 16 Jun 2014 09:20:10 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id fo10si13304818qcb.35.2014.06.16.09.20.10 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 16 Jun 2014 09:20:10 -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 1WwZcI-0006xf-IR; Mon, 16 Jun 2014 16:18:42 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WwZcH-0006vy-4h for xen-devel@lists.xenproject.org; Mon, 16 Jun 2014 16:18:41 +0000 Received: from [85.158.139.211:21756] by server-2.bemta-5.messagelabs.com id 63/FF-01647-0E81F935; Mon, 16 Jun 2014 16:18:40 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-3.tower-206.messagelabs.com!1402935519!2661767!1 X-Originating-IP: [209.85.212.175] 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 20860 invoked from network); 16 Jun 2014 16:18:39 -0000 Received: from mail-wi0-f175.google.com (HELO mail-wi0-f175.google.com) (209.85.212.175) by server-3.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 16 Jun 2014 16:18:39 -0000 Received: by mail-wi0-f175.google.com with SMTP id r20so4404097wiv.8 for ; Mon, 16 Jun 2014 09:18:39 -0700 (PDT) X-Received: by 10.194.77.2 with SMTP id o2mr29794273wjw.68.1402935519401; Mon, 16 Jun 2014 09:18:39 -0700 (PDT) Received: from belegaer.uk.xensource.com ([185.25.64.249]) by mx.google.com with ESMTPSA id l45sm34836161eep.25.2014.06.16.09.18.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Jun 2014 09:18:38 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 16 Jun 2014 17:18:04 +0100 Message-Id: <1402935486-29136-18-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1402935486-29136-1-git-send-email-julien.grall@linaro.org> References: <1402935486-29136-1-git-send-email-julien.grall@linaro.org> Cc: ian.campbell@citrix.com, Stefano Stabellini , tim@xen.org, Julien Grall , Ian Jackson , stefano.stabellini@citrix.com Subject: [Xen-devel] [RFC 17/19] libxl/arm: Rename set_interrupt_ppi to set_interrupt and handle SPIs 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.172 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 function will be used later during device passthrough to create interrupts in the device tree. Those interrupts are usually SPIs. Signed-off-by: Julien Grall Cc: Ian Jackson Cc: Stefano Stabellini Cc: Ian Campbell Acked-by: Ian Campbell --- tools/libxl/libxl_arm.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c index 1edb87a..e19e2f4 100644 --- a/tools/libxl/libxl_arm.c +++ b/tools/libxl/libxl_arm.c @@ -64,14 +64,20 @@ static void set_cell(be32 **cellp, int size, uint64_t val) (*cellp) += cells; } -static void set_interrupt_ppi(gic_interrupt interrupt, unsigned int irq, - unsigned int cpumask, unsigned int level) +static void set_interrupt(gic_interrupt interrupt, unsigned int irq, + unsigned int cpumask, unsigned int level) { be32 *cells = interrupt; + int is_ppi = (irq < 32); + + /* SGIs are not describe in the device tree */ + assert(irq >= 16); + + irq -= (is_ppi) ? 16: 32; /* PPIs start at 16, SPIs at 32 */ /* See linux Documentation/devictree/bindings/arm/gic.txt */ - set_cell(&cells, 1, 1); /* is a PPI */ - set_cell(&cells, 1, irq - 16); /* PPIs start at 16 */ + set_cell(&cells, 1, is_ppi); /* is a PPI? */ + set_cell(&cells, 1, irq); set_cell(&cells, 1, (cpumask << 8) | level); } @@ -355,12 +361,9 @@ static int make_timer_node(libxl__gc *gc, void *fdt, const struct arch_info *ain res = fdt_property_compat(gc, fdt, 1, ainfo->timer_compat); if (res) return res; - set_interrupt_ppi(ints[0], GUEST_TIMER_PHYS_S_PPI, 0xf, - DT_IRQ_TYPE_LEVEL_LOW); - set_interrupt_ppi(ints[1], GUEST_TIMER_PHYS_NS_PPI, 0xf, - DT_IRQ_TYPE_LEVEL_LOW); - set_interrupt_ppi(ints[2], GUEST_TIMER_VIRT_PPI, 0xf, - DT_IRQ_TYPE_LEVEL_LOW); + set_interrupt(ints[0], GUEST_TIMER_PHYS_S_PPI, 0xf, DT_IRQ_TYPE_LEVEL_LOW); + set_interrupt(ints[1], GUEST_TIMER_PHYS_NS_PPI, 0xf, DT_IRQ_TYPE_LEVEL_LOW); + set_interrupt(ints[2], GUEST_TIMER_VIRT_PPI, 0xf, DT_IRQ_TYPE_LEVEL_LOW); res = fdt_property_interrupts(gc, fdt, ints, 3); if (res) return res; @@ -398,8 +401,7 @@ static int make_hypervisor_node(libxl__gc *gc, void *fdt, * - Active-low level-sensitive * - All cpus */ - set_interrupt_ppi(intr, GUEST_EVTCHN_PPI, 0xf, - DT_IRQ_TYPE_LEVEL_LOW); + set_interrupt(intr, GUEST_EVTCHN_PPI, 0xf, DT_IRQ_TYPE_LEVEL_LOW); res = fdt_property_interrupts(gc, fdt, &intr, 1); if (res) return res;