Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4047627pxb; Mon, 8 Feb 2021 06:45:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJxcgOnt3XW/YKXTy9q79qUoUO8prqGaEkdC4cDJW5vIpfLxYBl+hXjknmkp4ax8yMP0/JYL X-Received: by 2002:a17:906:c04f:: with SMTP id bm15mr17349552ejb.364.1612795550701; Mon, 08 Feb 2021 06:45:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612795550; cv=none; d=google.com; s=arc-20160816; b=bVtqE2w3Ovg2ZEG9ZuL/E2lWhkq/gIlSXutsV0bzru785e65L7haN+GpOx2XpNTllR TxRKqx8ajlmKeEUo5cfH30njJa/PPXSd4qznTWsoeq2rfE18OlRIzDtFR0OqpO8eVwOp GAIgsQgYIuByFgw/z4WfEOn0dr+ukrdjctmf6z/BzuKyNzQbS65SeiqzXZLnUoIv1PNP 0ySrg3CJV7FyjaPqIGKFdj6cfMdCoGKWxwqlpXzL7VWY3ogu7dKj5irfHgOR/21trnLt C9uyKxwcwLeQmzjNUqcWnn00lrrLc9/+ihtc2r6bZV7Pw7SlaeGCL1v1tTlzTlDj8gNj L22w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:mime-version:date:subject:cc:to:from; bh=6c/Y1jzqStdESomW/Lpkp2WPgerOwxoi7M7W6MBsyB4=; b=qtDd+9EUQ5jLvd90DmuusLn/RRclRx21KQ74C2uvPHpBTZFX8nc4QQ9w9VhBQ/gLCC Bl36bPMWPHhMulQBq2QOab64gs+kTmIcjFdp6waPohG124b7Jx51eLF43n9+OevLdbA/ DMl9u1fA33unk6jSoXfRRTyes6HhdF8iTeYiiM2I/eZJZNZZkGofCGPjy9+mx1xcaXo/ dYYzBW9b7Mea0aqknhKpFzfNq+l+/KEAzb0Wi+c/thPBgwigs8lcq56qiP9q0lpXrfHv IGo8EnI9tInL+ubLaln5jj4pMnoTAC8ehD6TJzne3Mwg5US195jrehh2f4+5qTnegDGo 56HQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v14si12284351edc.56.2021.02.08.06.45.24; Mon, 08 Feb 2021 06:45:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232930AbhBHOok (ORCPT + 99 others); Mon, 8 Feb 2021 09:44:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232020AbhBHO2c (ORCPT ); Mon, 8 Feb 2021 09:28:32 -0500 Received: from mail-out-4.itc.rwth-aachen.de (mail-out-4.itc.rwth-aachen.de [IPv6:2a00:8a60:1:e501::5:49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDED7C0617AA for ; Mon, 8 Feb 2021 06:27:48 -0800 (PST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2CqBwBDSSFg/5oagoZiHAEBAQEBAQcBA?= =?us-ascii?q?RIBAQQEAQGCD4FTgiZplXAInG4LAQEBAQEBAQEBCAEtAgQBAYRLggQCJTgTAhA?= =?us-ascii?q?BAQYBAQEBAQYEhl+GH1IbgSMBDQWDJoMHAa98M4kcgUQJAYEuiF6FC4FcP4E4D?= =?us-ascii?q?AOCNS4+ijcEgkctYYJduVQHgWuBEpt3BQkgky+Pc5QynTGERQICAgIJAhaBbYF?= =?us-ascii?q?6TSRcCYJTUBcCDY4tF41rATxBMjcCBgoBAQMJTy2LHAEB?= X-IPAS-Result: =?us-ascii?q?A2CqBwBDSSFg/5oagoZiHAEBAQEBAQcBARIBAQQEAQGCD4F?= =?us-ascii?q?TgiZplXAInG4LAQEBAQEBAQEBCAEtAgQBAYRLggQCJTgTAhABAQYBAQEBAQYEh?= =?us-ascii?q?l+GH1IbgSMBDQWDJoMHAa98M4kcgUQJAYEuiF6FC4FcP4E4DAOCNS4+ijcEgkc?= =?us-ascii?q?tYYJduVQHgWuBEpt3BQkgky+Pc5QynTGERQICAgIJAhaBbYF6TSRcCYJTUBcCD?= =?us-ascii?q?Y4tF41rATxBMjcCBgoBAQMJTy2LHAEB?= X-IronPort-AV: E=Sophos;i="5.81,162,1610406000"; d="scan'208";a="98043057" Received: from rwthex-s2-a.rwth-ad.de ([134.130.26.154]) by mail-in-4.itc.rwth-aachen.de with ESMTP; 08 Feb 2021 15:27:44 +0100 Received: from io.fritz.box (2a02:908:1089:e060:794d:ff8:62d5:f86c) by rwthex-s2-a.rwth-ad.de (2a00:8a60:1:e500::26:154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2044.4; Mon, 8 Feb 2021 15:27:41 +0100 From: Jan Henrik Weinstock To: , , , , , CC: Jan Henrik Weinstock Subject: Re: [PATCH] Use devicetree to determine present cpus Date: Mon, 8 Feb 2021 15:27:16 +0100 X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [2a02:908:1089:e060:794d:ff8:62d5:f86c] X-ClientProxiedBy: rwthex-s3-a.rwth-ad.de (2a00:8a60:1:e500::26:160) To rwthex-s2-a.rwth-ad.de (2a00:8a60:1:e500::26:154) Message-ID: <84102952-2468-4616-b28c-cb5941de7e12@rwthex-s2-a.rwth-ad.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: Jan Henrik Weinstock --- Re-send patch with git sendmail arch/openrisc/kernel/smp.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/arch/openrisc/kernel/smp.c b/arch/openrisc/kernel/smp.c index 29c82ef2e..75be7e34f 100644 --- a/arch/openrisc/kernel/smp.c +++ b/arch/openrisc/kernel/smp.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -68,14 +69,25 @@ void __init smp_init_cpus(void) void __init smp_prepare_cpus(unsigned int max_cpus) { - int i; + u32 cpu_id; + struct device_node *cpu, *cpus; /* * Initialise the present map, which describes the set of CPUs * actually populated at the present time. */ - for (i = 0; i < max_cpus; i++) - set_cpu_present(i, true); + cpus = of_find_node_by_path("/cpus"); + for_each_child_of_node(cpus, cpu) { + if (of_property_read_u32(cpu, "reg", &cpu_id)) { + pr_warn("%s missing reg property", cpu->full_name); + continue; + } + + if (cpu_id >= max_cpus) + continue; + + set_cpu_present(cpu_id, true); + } } void __init smp_cpus_done(unsigned int max_cpus) -- 2.17.1