From patchwork Fri Mar 4 14:21:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 63597 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp105115lbc; Fri, 4 Mar 2016 06:24:00 -0800 (PST) X-Received: by 10.140.30.195 with SMTP id d61mr9243225qgd.52.1457101440290; Fri, 04 Mar 2016 06:24:00 -0800 (PST) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id y124si3834617qka.2.2016.03.04.06.23.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Mar 2016 06:24:00 -0800 (PST) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1abqcG-0003pF-Ku; Fri, 04 Mar 2016 14:22:04 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1abqcF-0003p5-NM for xen-devel@lists.xen.org; Fri, 04 Mar 2016 14:22:03 +0000 Received: from [85.158.139.211] by server-12.bemta-5.messagelabs.com id F7/6C-11322-A0A99D65; Fri, 04 Mar 2016 14:22:02 +0000 X-Env-Sender: shannon.zhao@linaro.org X-Msg-Ref: server-5.tower-206.messagelabs.com!1457101321!26860959!1 X-Originating-IP: [209.85.192.181] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.11; banners=-,-,- X-VirusChecked: Checked Received: (qmail 5946 invoked from network); 4 Mar 2016 14:22:02 -0000 Received: from mail-pf0-f181.google.com (HELO mail-pf0-f181.google.com) (209.85.192.181) by server-5.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 4 Mar 2016 14:22:02 -0000 Received: by mail-pf0-f181.google.com with SMTP id 4so36276771pfd.1 for ; Fri, 04 Mar 2016 06:22:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=A09Mg2JkHTL9IjiT5U0/bcu2eZinxWo7sBGoVOxuFks=; b=R5FuouWejTZf7WQNMi75JJRnzpbPWYqXl2ptPF1mNgZ+MrP1XqjGUtTZbVCGdj993R g7wEHUiZnxprsNxXHss5YJ//bWCet3IXpGuN0h3ACAUtOaof1alX/prPj4e6WbqYb53U tfgNq0L67BlerfHAGD0VWAq2d1FI+fZMeaoPA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=A09Mg2JkHTL9IjiT5U0/bcu2eZinxWo7sBGoVOxuFks=; b=jN8XTGoeYSSBuExI/zZPsdKVvhunxN3V+EwgbROxY02Juq8QUv0yjTVLcvyjXdfrDk FtamYDdTfhjG5AfrmAil4/obKzteKzOZS4MQn6xervgHQ7FwwNj2N0Obby7Z5UlJ9nUt ha3K/KYimNu1ugHPNVl/vuZexGRCErOmcNdbaRkq4CJXd1vADv0SaA/b+lpSypgBzek1 sOyoTBmtpWTFl/LxMh4xjBZC+9lm07O4RYjrwOb26nZEpynwr8joj58mghHdfXHQ27B1 A8f+U522k+W3Na65EQ9sen4t3Ov3fRhKW+As11jwP2M/uim80s59bVtv5EHXHhF6uxwT VoNw== X-Gm-Message-State: AD7BkJLEScBwAKJdA+sSfAK0vcOPXwgNNNUjj0qRjbBDPNtIwfXtLl40bU+1EZUcj4L9NbfE X-Received: by 10.98.15.67 with SMTP id x64mr12434450pfi.60.1457101321032; Fri, 04 Mar 2016 06:22:01 -0800 (PST) Received: from localhost.localdomain ([104.237.91.197]) by smtp.gmail.com with ESMTPSA id o184sm6028600pfo.36.2016.03.04.06.21.57 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 04 Mar 2016 06:21:59 -0800 (PST) From: Shannon Zhao To: xen-devel@lists.xen.org, stefano.stabellini@citrix.com Date: Fri, 4 Mar 2016 22:21:25 +0800 Message-Id: <1457101285-3458-1-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 2.1.0 Cc: JBeulich@suse.com Subject: [Xen-devel] [PATCH v2] arm/timer: fix panic when booting with DT X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" While to support ACPI, patch "arm/acpi: Parse GTDT to initialize timer" refactors the functions preinit_xen_time and init_xen_time. But it wrongly moves the platform_get_irq from init_xen_time to preinit_dt_xen_time and this will cause booting failure. So move platform_get_irq back to init_xen_time to fix it. Signed-off-by: Shannon Zhao --- v2: refactor the codes as a small function --- xen/arch/arm/time.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/xen/arch/arm/time.c b/xen/arch/arm/time.c index 5f8f974..7dae28b 100644 --- a/xen/arch/arm/time.c +++ b/xen/arch/arm/time.c @@ -119,7 +119,6 @@ static void __init preinit_dt_xen_time(void) }; int res; u32 rate; - unsigned int i; timer = dt_find_matching_node(NULL, timer_ids); if ( !timer ) @@ -133,16 +132,6 @@ static void __init preinit_dt_xen_time(void) cpu_khz = rate / 1000; timer_dt_clock_frequency = rate; } - - /* Retrieve all IRQs for the timer */ - for ( i = TIMER_PHYS_SECURE_PPI; i < MAX_TIMER_PPI; i++ ) - { - res = platform_get_irq(timer, i); - - if ( res < 0 ) - panic("Timer: Unable to retrieve IRQ %u from the device tree", i); - timer_irq[i] = res; - } } void __init preinit_xen_time(void) @@ -165,9 +154,28 @@ void __init preinit_xen_time(void) boot_count = READ_SYSREG64(CNTPCT_EL0); } +static void __init init_dt_xen_time(void) +{ + int res; + unsigned int i; + + /* Retrieve all IRQs for the timer */ + for ( i = TIMER_PHYS_SECURE_PPI; i < MAX_TIMER_PPI; i++ ) + { + res = platform_get_irq(timer, i); + + if ( res < 0 ) + panic("Timer: Unable to retrieve IRQ %u from the device tree", i); + timer_irq[i] = res; + } +} + /* Set up the timer on the boot CPU (late init function) */ int __init init_xen_time(void) { + if ( acpi_disabled ) + init_dt_xen_time(); + /* Check that this CPU supports the Generic Timer interface */ if ( !cpu_has_gentimer ) panic("CPU does not support the Generic Timer v1 interface");