From patchwork Wed Oct 6 16:43:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring \(Arm\)" X-Patchwork-Id: 515361 Delivered-To: patch@linaro.org Received: by 2002:ac0:b5cc:0:0:0:0:0 with SMTP id x12csp590241ime; Wed, 6 Oct 2021 09:43:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqp6e1WTdliHFxzlMmO79PtNUGUuAuEECkPFL2t/wgXxK9AwnGvXcLPHJkGWbxSw7JqrUy X-Received: by 2002:a50:e041:: with SMTP id g1mr36133950edl.4.1633538629635; Wed, 06 Oct 2021 09:43:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633538629; cv=none; d=google.com; s=arc-20160816; b=JQSX9kEeKXqJdyjFTYKj7VV4ql7cWF79oQqcmUNHU5HXgRykx5SkSl9KWvwNXOPnLg EuUY/FWkwaZKoNJnMDNOAwvBi5YIWOO+N2AlOH/evdHB1JPvrSRYmZ1e9T87sKmQrFMp XU90uuDEJYeiqdI1oPK5iwCxLNtrunl4SB9We+CYs4ZA65dgHo6laxJOk5eVGEUuqUhU wd/nPgthEmdmXUd4nDETkZyDAO3n5VDyesYYa440v/0k/+uURtxlcNEcABr9mE525sPu +02+78SNUYGEahqxM3DrZajlcjVyFa5VKKCN45UZia45LdUF6OiUmttwL/0l1nWaZC0k qWXw== 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=nz2VNzL+ydy4chpa3d7bE/r1R6JeAbCb1Q1l6nn9BO4=; b=FU6+F3DpcM6kiL8cRjkIk06GkA4+9Ck4bfG1g9LtkQYSOFZ+la9pGyOE1SIlVEbal7 AP8m7zrzlACzZKNmNsn/WeVRZmQXVSiQotnuMO+GYUy3/O0oCoZe6aZsGUk18FHmuMW5 2sSG8kQ1MRqn4BrgvKP9js7w0eoApt/SlYD5tUYRRxf5NZG9q1jW3+E6f1h9WJpFo1V8 ixkjipA+YmTglik4R0OkrN+/w/Bxz85hc5RrYGxrfSbWm0/EU8GvwHljbuNLDXeDUzF7 RTqD+uZd7MuNNLBxQURNvk0iYh0cC0wRmrmKi/670iYH8Zk22mRJv3WUq6bUWNtRjrtg O5nw== 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 b3si19117438ejp.504.2021.10.06.09.43.49; Wed, 06 Oct 2021 09:43:49 -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 S239447AbhJFQpk (ORCPT + 7 others); Wed, 6 Oct 2021 12:45:40 -0400 Received: from mail-ot1-f45.google.com ([209.85.210.45]:44582 "EHLO mail-ot1-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235329AbhJFQpg (ORCPT ); Wed, 6 Oct 2021 12:45:36 -0400 Received: by mail-ot1-f45.google.com with SMTP id o27-20020a9d411b000000b005453f95356cso2937157ote.11; Wed, 06 Oct 2021 09:43:43 -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=nz2VNzL+ydy4chpa3d7bE/r1R6JeAbCb1Q1l6nn9BO4=; b=7kHkpTbRlj/Vf9sv2yc65QC96Q/cOPyHMyMqdZYVbDm8TEbOGv9xCeOHVn7lN3Mats c0Nhc2itkn347UWtG/javVV71VKm952HnqtqGJP/UWf/80S1PXjt4WjzuLocBOOdIBcZ ps0hLIgpdUFnlS3mjoqIqsNBdkmDbPCiFkoShj3Nl+PvLPdgxoVlpF1ORuC1YCgL4yMZ xmf8tQBvE1V/kRpZXfwVkxpteS82JavSyk1xbFtEtJT9CTg5uSmaR0uTuZOosUHBeZh+ EXT08CyO+1rI3MIxdiU7ehv/12XZ3LvvyNeE3qTAo0RtgupENtKIZ8GMTGAzFw3m2e3N v8AQ== X-Gm-Message-State: AOAM5311zfuKi/5NPBPaRcOr6hfjH2CYQGPOl7etXyrUndiao78Hp92e TsuJHchT/2IwHRYlN/MzCw== X-Received: by 2002:a9d:6ac7:: with SMTP id m7mr20566678otq.49.1633538622946; Wed, 06 Oct 2021 09:43:42 -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.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 09:43:42 -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 04/12] arm64: Use of_get_cpu_hwid() Date: Wed, 6 Oct 2021 11:43:24 -0500 Message-Id: <20211006164332.1981454-5-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: Catalin Marinas Cc: Will Deacon Signed-off-by: Rob Herring --- arch/arm64/kernel/smp.c | 31 ++----------------------------- 1 file changed, 2 insertions(+), 29 deletions(-) -- 2.30.2 Acked-by: Will Deacon diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index 6f6ff072acbd..c5cebc406d24 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -466,33 +466,6 @@ void __init smp_prepare_boot_cpu(void) kasan_init_hw_tags(); } -static u64 __init of_get_cpu_mpidr(struct device_node *dn) -{ - const __be32 *cell; - u64 hwid; - - /* - * A cpu node with missing "reg" property is - * considered invalid to build a cpu_logical_map - * entry. - */ - cell = of_get_property(dn, "reg", NULL); - if (!cell) { - pr_err("%pOF: missing reg property\n", dn); - return INVALID_HWID; - } - - hwid = of_read_number(cell, of_n_addr_cells(dn)); - /* - * Non affinity bits must be set to 0 in the DT - */ - if (hwid & ~MPIDR_HWID_BITMASK) { - pr_err("%pOF: invalid reg property\n", dn); - return INVALID_HWID; - } - return hwid; -} - /* * Duplicate MPIDRs are a recipe for disaster. Scan all initialized * entries and check for duplicates. If any is found just ignore the @@ -656,9 +629,9 @@ static void __init of_parse_and_init_cpus(void) struct device_node *dn; for_each_of_cpu_node(dn) { - u64 hwid = of_get_cpu_mpidr(dn); + u64 hwid = of_get_cpu_hwid(dn, 0); - if (hwid == INVALID_HWID) + if (hwid & ~MPIDR_HWID_BITMASK) goto next; if (is_mpidr_duplicate(cpu_count, hwid)) {