From patchwork Fri Sep 13 12:49:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 20043 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f197.google.com (mail-qc0-f197.google.com [209.85.216.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6860228E99 for ; Fri, 13 Sep 2013 12:50:02 +0000 (UTC) Received: by mail-qc0-f197.google.com with SMTP id r5sf1174346qcx.4 for ; Fri, 13 Sep 2013 05:50:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=vCvYSNIh6cpMaeSLehp1cY4kHKnbPS+WEC2JHniIXyk=; b=SWhzbXT/D5LV7+lD9+lgp9AhRrYnSS36ItxXzKI/k7IIjTg3Y1632G1rSNO5v6C0FE paveaDRYn7IQxa8e2qqI85PVdYwVI+301ULKadEeK88Y1LxMVs4o1v2Mx7rtT3oQwFLY D1xiGhhXqNP5SKXs57dKLXzX+Sk0LDnfVMzi5b48nDaLMFPQ581KF5x0d+AHrmmh827j 8MNfZaJGcFfWWsbgz1F3WATRMmGdCY/l/w6qU0oJZsVBJuZn/kHKJMnf9rzvKopKr5QL ocIXEdog+xzqOm2MNR81k3MIHFv8Iy3jwA0+0sO/4RzJYUKoURjpfHT3MjNobWBPC19g +jDg== X-Gm-Message-State: ALoCoQnrP0h4t9IXZbdHNhCgH4hKbF+OXSqots50nTqo6r+LDleR0EffhaxQjDbTXjJ2qV+lX63r X-Received: by 10.236.66.244 with SMTP id h80mr5094876yhd.30.1379076602018; Fri, 13 Sep 2013 05:50:02 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.117.129 with SMTP id ke1ls1138715qeb.88.gmail; Fri, 13 Sep 2013 05:50:01 -0700 (PDT) X-Received: by 10.221.56.194 with SMTP id wd2mr12037870vcb.7.1379076601800; Fri, 13 Sep 2013 05:50:01 -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 wp10si3085370vdb.19.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 05:50:01 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.177 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.177; Received: by mail-vc0-f177.google.com with SMTP id gf12so862985vcb.8 for ; Fri, 13 Sep 2013 05:50:01 -0700 (PDT) X-Received: by 10.220.181.136 with SMTP id by8mr12078123vcb.11.1379076601689; Fri, 13 Sep 2013 05:50:01 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp78789vcz; Fri, 13 Sep 2013 05:50:01 -0700 (PDT) X-Received: by 10.14.211.195 with SMTP id w43mr2850704eeo.57.1379076600597; Fri, 13 Sep 2013 05:50:00 -0700 (PDT) Received: from mail-ee0-f42.google.com (mail-ee0-f42.google.com [74.125.83.42]) by mx.google.com with ESMTPS id x42si3777549eel.266.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 05:50:00 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.83.42 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=74.125.83.42; Received: by mail-ee0-f42.google.com with SMTP id b45so559451eek.15 for ; Fri, 13 Sep 2013 05:50:00 -0700 (PDT) X-Received: by 10.14.213.68 with SMTP id z44mr2704494eeo.70.1379076599935; Fri, 13 Sep 2013 05:49:59 -0700 (PDT) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id p5sm14678420eeg.5.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 05:49:59 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Cc: stefano.stabellini@eu.citrix.com, ian.campbell@citrix.com, patches@linaro.org, andre.przywara@linaro.org, Julien Grall Subject: [PATCH v4 18/27] xen/arm: Create a fake timer node in dom0 device tree Date: Fri, 13 Sep 2013 13:49:25 +0100 Message-Id: <1379076574-28316-19-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1379076574-28316-1-git-send-email-julien.grall@linaro.org> References: <1379076574-28316-1-git-send-email-julien.grall@linaro.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.177 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 Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Recreate the timer node and remove hypervisor specific interrupt. Signed-off-by: Julien Grall --- Changes in v4: - Replace interrupt_t and set_interrupts respectively by gic_interrupt_t and set_interrupt_ppi - Use fdt_property_interrupts Changes in v3: - Use DT_MATCH_TIMER --- xen/arch/arm/domain_build.c | 66 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 87382d5..cda1e13 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -512,6 +512,67 @@ static int make_gic_node(const struct domain *d, void *fdt, return res; } +static int make_timer_node(const struct domain *d, void *fdt, + const struct dt_device_node *parent) +{ + static const struct dt_device_match timer_ids[] __initconst = + { + DT_MATCH_COMPATIBLE("arm,armv7-timer"), + DT_MATCH_COMPATIBLE("arm,armv8-timer"), + { /* sentinel */ }, + }; + struct dt_device_node *dev; + u32 len; + const void *compatible; + int res; + const struct dt_irq *irq; + gic_interrupt_t intrs[3]; + + DPRINT("Create timer node\n"); + + dev = dt_find_matching_node(NULL, timer_ids); + if ( !dev ) + { + dprintk(XENLOG_ERR, "Missing timer node in the device tree?\n"); + return -FDT_ERR_XEN(ENOENT); + } + + compatible = dt_get_property(dev, "compatible", &len); + if ( !compatible ) + { + dprintk(XENLOG_ERR, "Can't find compatible property for timer node\n"); + return -FDT_ERR_XEN(ENOENT); + } + + res = fdt_begin_node(fdt, "timer"); + if ( res ) + return res; + + res = fdt_property(fdt, "compatible", compatible, len); + if ( res ) + return res; + + irq = timer_dt_irq(TIMER_PHYS_SECURE_PPI); + DPRINT(" Secure interrupt %u\n", irq->irq); + set_interrupt_ppi(intrs[0], irq->irq, 0xf, irq->type); + + irq = timer_dt_irq(TIMER_PHYS_NONSECURE_PPI); + DPRINT(" Non secure interrupt %u\n", irq->irq); + set_interrupt_ppi(intrs[1], irq->irq, 0xf, irq->type); + + irq = timer_dt_irq(TIMER_VIRT_PPI); + DPRINT(" Virt interrupt %u\n", irq->irq); + set_interrupt_ppi(intrs[2], irq->irq, 0xf, irq->type); + + res = fdt_property_interrupts(fdt, intrs, 3); + if ( res ) + return res; + + res = fdt_end_node(fdt); + + return res; +} + /* Map the device in the domain */ static int map_device(struct domain *d, const struct dt_device_node *dev) { @@ -602,6 +663,7 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo, DT_MATCH_COMPATIBLE("arm,psci"), DT_MATCH_PATH("/cpus"), DT_MATCH_GIC, + DT_MATCH_TIMER, { /* sentinel */ }, }; const struct dt_device_node *child; @@ -679,6 +741,10 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo, res = make_gic_node(d, kinfo->fdt, np); if ( res ) return res; + + res = make_timer_node(d, kinfo->fdt, np); + if ( res ) + return res; } res = fdt_end_node(kinfo->fdt);