From patchwork Wed Oct 6 16:43:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 515359 Delivered-To: patch@linaro.org Received: by 2002:ac0:b5cc:0:0:0:0:0 with SMTP id x12csp590158ime; Wed, 6 Oct 2021 09:43:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJypffoyX+tDB6iY2KqhlQGTdGkA6O9OIr67Yzpd0/rvmfAKJ8/eebijDpwCImeN8uFY/Q9A X-Received: by 2002:a17:906:ce2c:: with SMTP id sd12mr33008564ejb.488.1633538622945; Wed, 06 Oct 2021 09:43:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633538622; cv=none; d=google.com; s=arc-20160816; b=I22kADyABOCNedM/eaa4+p0yoSLRo2heao9xuyzPQXOlrvt5vWfzy8WTsFjmUBRkgX MWoKp/H1y5lRpmTvDibGsfZrEUOYc597O9/zx/+jwlpomq0mfHS4DEc6ILmhmIDOiHIH Dwni19STOWtpQ2iJ6ysgupAUBThwTcv1qNDllICydhu/ifT7ysbHsnDv8QILYam8ETqg eMY8OUTSw2qr4Gg0YPXUMaujHWGU1ffxQb55Pq3WPuPIEg0XmZ0kim/PocxR6CY49X34 yaLA+XdeugXv2Kms4YZeR6Nk5KiYtHdlTeAjbZjUgFxK7wj+sL0uAyJ20LvBUXcnMTTZ xnag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=lH5lm9ZJrN75WHjiktQyDKNUxUp68MdS3scEafa+VH8=; b=Vm+5M5KhMg+igq3ucvofqFIBnKCE6u5wj7SVlGzr7DJsYizYvIEZYj1uvdFWI9uE11 YtUPHzHGiOHhND0KNEIOTw5SllTZB6hgeooduxpP79oddEAwKsW9MevDI2A0FvlEhou0 z27hzXO2JL7THUvjIe4VdihlgsJjFnqW6dIV5cwthboy7aHlsjHpZxQf0Pr1YUL6I+6k EifB+uPqb8fpRVhFaGJpMn/UL8mq7R/HLGFbI/K+Q8a7ps5xxlTeLrjh4C27yLvIIAOB HSFiehV+MMu1dkQ1I3OwEi/422c1eCv1mkt1dMrOnA6rguT/TKnqIh7J1nBm2HD8eYU7 H9KA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 1si25213697ejg.330.2021.10.06.09.43.42; Wed, 06 Oct 2021 09:43:42 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-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 devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239390AbhJFQpd (ORCPT + 7 others); Wed, 6 Oct 2021 12:45:33 -0400 Received: from mail-oo1-f51.google.com ([209.85.161.51]:37661 "EHLO mail-oo1-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235329AbhJFQpb (ORCPT ); Wed, 6 Oct 2021 12:45:31 -0400 Received: by mail-oo1-f51.google.com with SMTP id h11-20020a4aa74b000000b002a933d156cbso1032380oom.4; Wed, 06 Oct 2021 09:43:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lH5lm9ZJrN75WHjiktQyDKNUxUp68MdS3scEafa+VH8=; b=lH59hLRG3AlfJK9hDLWg+PQLN2leBjtou5Ky52t6amZl+zMcOnJS2FoXmutZnU4JZc S2lx4NPJmDORm6wUxYOwp9Id6HPO1OkkNIN5GPQCcMYjfnbwsVLEWL9MVTIcZA+V2HF+ 1LS8VBSdGyBtAlM1uLhopI3IbqZTVWKNnnSyijxd98yrb2MR76/lwIaxuDQjJzULPtTq N/NkRespD05daTz7OuFTXZ6MPPWUV7bdhBHvywcHuw06NB+QllcQdGwFe2cMA909t6eU 41EO+G4+TQMBBG6sd9hd/p2BVVOvZ61s5OShB5GnKQf3n+O7LkNmUmO2S37pVeXEDKFL TsgQ== X-Gm-Message-State: AOAM532omC/5eXyTGo/6Ew/pC5o2D/QK94I8TSEsuSDAWSpx6A9yGmFi 9jxl+6+XzZDmIwMuTb0GEg== X-Received: by 2002:a4a:d108:: with SMTP id k8mr19009146oor.47.1633538619135; Wed, 06 Oct 2021 09:43:39 -0700 (PDT) Received: from xps15.herring.priv (66-90-148-213.dyn.grandenetworks.net. [66.90.148.213]) by smtp.googlemail.com with ESMTPSA id s29sm4236628otg.60.2021.10.06.09.43.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 09:43:38 -0700 (PDT) From: Rob Herring To: Russell King , James Morse , Catalin Marinas , Will Deacon , Guo Ren , Jonas Bonn , Stefan Kristiansson , Stafford Horne , Michael Ellerman , Paul Walmsley , Palmer Dabbelt , Albert Ou , Yoshinori Sato , Rich Felker , x86@kernel.org, Greg Kroah-Hartman Cc: Florian Fainelli , Ray Jui , Scott Branden , bcm-kernel-feedback-list@broadcom.com, Benjamin Herrenschmidt , Paul Mackerras , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , "Rafael J. Wysocki" , Frank Rowand , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, openrisc@lists.librecores.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-sh@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 02/12] ARM: Use of_get_cpu_hwid() Date: Wed, 6 Oct 2021 11:43:22 -0500 Message-Id: <20211006164332.1981454-3-robh@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211006164332.1981454-1-robh@kernel.org> References: <20211006164332.1981454-1-robh@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Replace the open coded parsing of CPU nodes' 'reg' property with of_get_cpu_hwid(). This change drops an error message for missing 'reg' property, but that should not be necessary as the DT tools will ensure 'reg' is present. Cc: Russell King Signed-off-by: Rob Herring --- arch/arm/kernel/devtree.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) -- 2.30.2 diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c index 28311dd0fee6..02839d8b6202 100644 --- a/arch/arm/kernel/devtree.c +++ b/arch/arm/kernel/devtree.c @@ -84,33 +84,15 @@ void __init arm_dt_init_cpu_maps(void) return; for_each_of_cpu_node(cpu) { - const __be32 *cell; - int prop_bytes; - u32 hwid; + u32 hwid = of_get_cpu_hwid(cpu, 0); pr_debug(" * %pOF...\n", cpu); - /* - * A device tree containing CPU nodes with missing "reg" - * properties is considered invalid to build the - * cpu_logical_map. - */ - cell = of_get_property(cpu, "reg", &prop_bytes); - if (!cell || prop_bytes < sizeof(*cell)) { - pr_debug(" * %pOF missing reg property\n", cpu); - of_node_put(cpu); - return; - } /* * Bits n:24 must be set to 0 in the DT since the reg property * defines the MPIDR[23:0]. */ - do { - hwid = be32_to_cpu(*cell++); - prop_bytes -= sizeof(*cell); - } while (!hwid && prop_bytes > 0); - - if (prop_bytes || (hwid & ~MPIDR_HWID_BITMASK)) { + if (hwid & ~MPIDR_HWID_BITMASK) { of_node_put(cpu); return; }