From patchwork Fri Sep 13 12:49:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 20033 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f71.google.com (mail-vb0-f71.google.com [209.85.212.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BC5D2202E6 for ; Fri, 13 Sep 2013 12:49:49 +0000 (UTC) Received: by mail-vb0-f71.google.com with SMTP id g17sf1163300vbg.6 for ; Fri, 13 Sep 2013 05:49:49 -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=cky2jZyxWwuepkKBhTeSgDVWkbrfT/R4q2gMfy81FMs=; b=HeoxVFlGCLA9CP2Wutf7dwEngMeunJws5nYFGrwRvYJU7R5vhL1sMBnVcUmiZjpMqd Y0JSb9jqVsmF3Y68zE76I4Nu3Zf3cGM5L+zCBqTYdSMbqN9KyTaHOGkdbvKNtopzVfpd LzUoA9PoKDeRIB90D4/77rFBcfHWR4DmUMrUDVWPEzZ1LY52q8owgXSAHRrKodWdiAlH ZWVDfyo1hvhSq/ZxBbpqRpTnM6RM11wEr9oYXLUqC+D5gYgAt5rhBIathG3Nm7H/NDUJ Aj/qwUPCg9CujfeveljWXmhwGP5AzgtQSgGjym8LD32E9MQ/xtcZGTsWLqaLkvcTg1qf hrQQ== X-Gm-Message-State: ALoCoQmchPjvOsHG7MBNePP9fmNzlEZ6mzQK0PkNlTfp1JDkNZsrEdWxmzUkPzfE7XUFES6Pjh72 X-Received: by 10.236.108.233 with SMTP id q69mr4977488yhg.11.1379076589369; Fri, 13 Sep 2013 05:49:49 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.83.7 with SMTP id m7ls1170508qey.0.gmail; Fri, 13 Sep 2013 05:49:49 -0700 (PDT) X-Received: by 10.52.118.73 with SMTP id kk9mr9897870vdb.13.1379076589140; Fri, 13 Sep 2013 05:49:49 -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 x9si3093966vec.4.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 05:49:49 -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 gf12so863686vcb.22 for ; Fri, 13 Sep 2013 05:49:49 -0700 (PDT) X-Received: by 10.58.171.4 with SMTP id aq4mr1513940vec.26.1379076589055; Fri, 13 Sep 2013 05:49:49 -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 u4csp78772vcz; Fri, 13 Sep 2013 05:49:48 -0700 (PDT) X-Received: by 10.14.198.197 with SMTP id v45mr3148953een.52.1379076587949; Fri, 13 Sep 2013 05:49:47 -0700 (PDT) Received: from mail-ea0-f176.google.com (mail-ea0-f176.google.com [209.85.215.176]) by mx.google.com with ESMTPS id x49si3362210een.24.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 05:49:47 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.215.176 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=209.85.215.176; Received: by mail-ea0-f176.google.com with SMTP id q16so559042ead.35 for ; Fri, 13 Sep 2013 05:49:47 -0700 (PDT) X-Received: by 10.14.213.68 with SMTP id z44mr2703272eeo.70.1379076587149; Fri, 13 Sep 2013 05:49:47 -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:46 -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 08/27] xen/dts: Check the CPU ID is not greater than NR_CPUS Date: Fri, 13 Sep 2013 13:49:15 +0100 Message-Id: <1379076574-28316-9-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: , On some board CPU IDs are not contiguous (for instance the Versatile Express with big.LITTLE supports). If the CPU ID is greater than NR_CPUS Xen will hang without any message. This is because console driver is not yet initialized and hypervisor data abort uses printk. For the moment check the CPU ID and print an warning if an error occured. Signed-off-by: Julien Grall Acked-by: Ian Campbell --- xen/common/device_tree.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c index 9d300ec..d2262ce 100644 --- a/xen/common/device_tree.c +++ b/xen/common/device_tree.c @@ -445,6 +445,13 @@ static void __init process_cpu_node(const void *fdt, int node, cpuid = dt_read_number((const __be32 *)prop->data, 1); + /* TODO: handle non-contiguous CPU ID */ + if ( cpuid >= NR_CPUS ) + { + dt_printk("fdt: node `%s': reg(0x%x) >= NR_CPUS(%d)\n", + name, cpuid, NR_CPUS); + return; + } cpumask_set_cpu(cpuid, &cpu_possible_map); }