From patchwork Fri Aug 16 21:05:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 19261 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-gh0-f199.google.com (mail-gh0-f199.google.com [209.85.160.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C551F25A1B for ; Fri, 16 Aug 2013 21:06:28 +0000 (UTC) Received: by mail-gh0-f199.google.com with SMTP id g14sf226566ghb.2 for ; Fri, 16 Aug 2013 14:06:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-gm-message-state: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=gLR+axdjSt+2unsXpL/OEW/Bu3lkK5oFimrybNNUvVA=; b=C8y2mN53XQIybd0CF9r09xBeQw8cAIngwkivOeZngyor4KsfDfuZpLd/NAPEV/F7DT wT1q/+64l5wtTlvxKuZG7uLZ3XBKoTavlqcYFtrjKAdy2vG9LdfGcF7hP8fczTbJf2m3 kXNujw2PQl5K2zqaUHWRThfuWPxYDs5ulVNL6KV3cn5KknNsHtrbmvN8XmE/AfjQpiyS 14WpUrrT8YXGSCwlEn/wk62HdfTMB7ARL8Q77cDFp7Xk24+XCPWAqvwc+hY1ZoXltQ1+ qPibt8R7XF0bawDwfJfSDK8yM2QPuG74il8QTKy2nomAz4ew8V8mzBUeSTbw/+ayNl7O 0wCg== X-Received: by 10.236.54.68 with SMTP id h44mr1261250yhc.21.1376687188534; Fri, 16 Aug 2013 14:06:28 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.97.197 with SMTP id ec5ls893548qeb.26.gmail; Fri, 16 Aug 2013 14:06:28 -0700 (PDT) X-Received: by 10.220.11.7 with SMTP id r7mr2904204vcr.12.1376687188419; Fri, 16 Aug 2013 14:06:28 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id k11si782533vcm.42.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 16 Aug 2013 14:06:28 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.180 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.180; Received: by mail-vc0-f180.google.com with SMTP id gf11so1828524vcb.11 for ; Fri, 16 Aug 2013 14:06:28 -0700 (PDT) X-Gm-Message-State: ALoCoQn01Dvly5E0iqJ1NJ3nEAXpHLUhZU8t01aZAdx6xvGGirdi3E3i1DvCwW0qBjcdwtVgNTSu X-Received: by 10.220.91.16 with SMTP id k16mr2949098vcm.21.1376687188330; Fri, 16 Aug 2013 14:06:28 -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 u4csp89457vcz; Fri, 16 Aug 2013 14:06:27 -0700 (PDT) X-Received: by 10.180.38.73 with SMTP id e9mr583630wik.37.1376687187305; Fri, 16 Aug 2013 14:06:27 -0700 (PDT) Received: from mail-we0-f172.google.com (mail-we0-f172.google.com [74.125.82.172]) by mx.google.com with ESMTPS id ma4si242047wic.31.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 16 Aug 2013 14:06:27 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.82.172 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=74.125.82.172; Received: by mail-we0-f172.google.com with SMTP id t61so2123304wes.3 for ; Fri, 16 Aug 2013 14:06:26 -0700 (PDT) X-Received: by 10.180.36.74 with SMTP id o10mr610148wij.23.1376687186880; Fri, 16 Aug 2013 14:06:26 -0700 (PDT) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id b13sm797327wic.9.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 16 Aug 2013 14:06:26 -0700 (PDT) From: Julien Grall To: stefano.stabellini@eu.citrix.com, ian.campbell@citrix.com Cc: patches@linaro.org, andre.przywara@linaro.org, xen-devel@lists.xen.org, Julien Grall Subject: [RFC 13/24] xen/dts: Check the CPU ID is not greater than NR_CPUS Date: Fri, 16 Aug 2013 22:05:45 +0100 Message-Id: <1376687156-6737-14-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1376687156-6737-1-git-send-email-julien.grall@linaro.org> References: <1376687156-6737-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.180 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 8a5bfc3..6bdab14 100644 --- a/xen/common/device_tree.c +++ b/xen/common/device_tree.c @@ -439,6 +439,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); }