From patchwork Mon Jun 16 16:18:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 31979 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f200.google.com (mail-vc0-f200.google.com [209.85.220.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E1E5620E7A for ; Mon, 16 Jun 2014 16:20:00 +0000 (UTC) Received: by mail-vc0-f200.google.com with SMTP id id10sf20961439vcb.7 for ; Mon, 16 Jun 2014 09:20:00 -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=fLRW5z7DUOdzKtaH89EHeb41Xq4Q4KYe9TuW4fJOkYw=; b=UfqUPVCsoaKrT8W/X9V1kV4C2V8SAHr5UgKAoD+k3pGQUmefhN1IjCnuiYizWPhEQy B7Tdpl4gOaf2ANmomDdeIzI7baWmN+C1CVK8Sc2bx1Z7oOXdF/cyYeR2UclfuwjKHmuG UgRXlCQlUdmGuXMF3cYyif1rpgr1sPKKlxsSduRBjgxLr43ua15tbjwL2vI5jloDd2va eh/I6s3eACwnM5GkPf585ybZ/c9MblpW+8vw7NAN27K/tqQrJQZ0PlkS3raNEQY3mk9H N4/UNanJ/zU+zwcOJS/04eFdVepm/9tynR/8r92/S5fz/wSkDPbc0wrgD4fgbuQzcRaE S0WQ== X-Gm-Message-State: ALoCoQlL3ORy0hg3GTebJKMNlC6WIUhnpek+kRFjJB85c6TUOV3bqxb4lirywNrY18U8eQL0y9CX X-Received: by 10.236.149.230 with SMTP id x66mr519112yhj.24.1402935600723; Mon, 16 Jun 2014 09:20:00 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.87.148 with SMTP id r20ls1637505qgd.12.gmail; Mon, 16 Jun 2014 09:20:00 -0700 (PDT) X-Received: by 10.220.106.7 with SMTP id v7mr910684vco.46.1402935600604; Mon, 16 Jun 2014 09:20:00 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id rn6si4283214vcb.80.2014.06.16.09.20.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Jun 2014 09:20:00 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id id10so5083417vcb.24 for ; Mon, 16 Jun 2014 09:20:00 -0700 (PDT) X-Received: by 10.221.26.10 with SMTP id rk10mr17208901vcb.0.1402935600521; Mon, 16 Jun 2014 09:20:00 -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 vs6csp146158vcb; Mon, 16 Jun 2014 09:20:00 -0700 (PDT) X-Received: by 10.224.169.6 with SMTP id w6mr5661703qay.102.1402935600028; Mon, 16 Jun 2014 09:20:00 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id e10si13803520qai.96.2014.06.16.09.19.59 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 16 Jun 2014 09:20:00 -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 1WwZcH-0006wA-0r; Mon, 16 Jun 2014 16:18:41 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WwZcF-0006td-EH for xen-devel@lists.xenproject.org; Mon, 16 Jun 2014 16:18:39 +0000 Received: from [85.158.143.35:31792] by server-3.bemta-4.messagelabs.com id AD/07-16194-ED81F935; Mon, 16 Jun 2014 16:18:38 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-11.tower-21.messagelabs.com!1402935518!11680386!1 X-Originating-IP: [74.125.82.177] X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50 X-StarScan-Received: X-StarScan-Version: 6.11.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 30144 invoked from network); 16 Jun 2014 16:18:38 -0000 Received: from mail-we0-f177.google.com (HELO mail-we0-f177.google.com) (74.125.82.177) by server-11.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 16 Jun 2014 16:18:38 -0000 Received: by mail-we0-f177.google.com with SMTP id u56so5859002wes.22 for ; Mon, 16 Jun 2014 09:18:38 -0700 (PDT) X-Received: by 10.194.77.39 with SMTP id p7mr5987297wjw.85.1402935517948; Mon, 16 Jun 2014 09:18:37 -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.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Jun 2014 09:18:37 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 16 Jun 2014 17:18:03 +0100 Message-Id: <1402935486-29136-17-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 16/19] libxl/arm: Introduce DT_IRQ_TYPE_* 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.179 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: Avoid to use hardcode value when the interrupt type is set. Signed-off-by: Julien Grall Cc: Ian Jackson Cc: Stefano Stabellini Cc: Ian Campbell Acked-by: Ian Campbell --- tools/libxl/libxl_arm.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c index 21c3399..1edb87a 100644 --- a/tools/libxl/libxl_arm.c +++ b/tools/libxl/libxl_arm.c @@ -6,6 +6,23 @@ #include #include +/** + * IRQ line type. + * DT_IRQ_TYPE_NONE - default, unspecified type + * DT_IRQ_TYPE_EDGE_RISING - rising edge triggered + * DT_IRQ_TYPE_EDGE_FALLING - falling edge triggered + * DT_IRQ_TYPE_EDGE_BOTH - rising and falling edge triggered + * DT_IRQ_TYPE_LEVEL_HIGH - high level triggered + * DT_IRQ_TYPE_LEVEL_LOW - low level triggered + */ +#define DT_IRQ_TYPE_NONE 0x00000000 +#define DT_IRQ_TYPE_EDGE_RISING 0x00000001 +#define DT_IRQ_TYPE_EDGE_FALLING 0x00000002 +#define DT_IRQ_TYPE_EDGE_BOTH \ + (DT_IRQ_TYPE_EDGE_FALLING | DT_IRQ_TYPE_EDGE_RISING) +#define DT_IRQ_TYPE_LEVEL_HIGH 0x00000004 +#define DT_IRQ_TYPE_LEVEL_LOW 0x00000008 + int libxl__arch_domain_create(libxl__gc *gc, libxl_domain_config *d_config, uint32_t domid) { @@ -338,9 +355,12 @@ 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, 0x8); - set_interrupt_ppi(ints[1], GUEST_TIMER_PHYS_NS_PPI, 0xf, 0x8); - set_interrupt_ppi(ints[2], GUEST_TIMER_VIRT_PPI, 0xf, 0x8); + 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); res = fdt_property_interrupts(gc, fdt, ints, 3); if (res) return res; @@ -378,7 +398,8 @@ static int make_hypervisor_node(libxl__gc *gc, void *fdt, * - Active-low level-sensitive * - All cpus */ - set_interrupt_ppi(intr, GUEST_EVTCHN_PPI, 0xf, 0x8); + set_interrupt_ppi(intr, GUEST_EVTCHN_PPI, 0xf, + DT_IRQ_TYPE_LEVEL_LOW); res = fdt_property_interrupts(gc, fdt, &intr, 1); if (res) return res;