From patchwork Wed Oct 6 16:43:21 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: 515358 Delivered-To: patch@linaro.org Received: by 2002:ac0:b5cc:0:0:0:0:0 with SMTP id x12csp590132ime; Wed, 6 Oct 2021 09:43:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwg6mb1G9FhCYAAhPxwHSG8VLev3vN1Lms8iO3P50muNLEsdBHhsqTe1PfrjdNe+EMS39Or X-Received: by 2002:a17:90b:4a8d:: with SMTP id lp13mr12369544pjb.32.1633538621185; Wed, 06 Oct 2021 09:43:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633538621; cv=none; d=google.com; s=arc-20160816; b=oF3Ea1wbK8SYTsUMe3OBQqAlbYDK15CNsQlSab8ex/SdsMRpPdThxGoN/ISmSd2WFQ UHinQepPnWplR7ovtzONWBqJzdDUOjgViHzUJL2GAoMOo6CBA/UOXgDUk9WzkIeFZFKy v+/Qs7Wy1HeboAQqKMawfogpKnKm1qSZD+IQIbiKDqaxaW+pTTw1Z3CVSLzuxyST1yFP eKnORq7qDy4FsKM0xzlZoyUEtGblhk9jqwQtKlejKAnG9xqqArt+eJ3+7R57FSuJdP5w 4DjB8cgnmcOUZ6w+X1sAF4Heql+st7QJJkCdNgHAsvPpTQ8BQOUdYnAHKcAxegzbwRBM cgug== 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=uA/cSYcpVyY62IJQPXwhEfvcH0a7DNNoh6QF/gbSv/o=; b=htTJ6BMqal27PE+P0e8cMNhHoip+Vn/oWleklYhN53Inwuf3DFThQGmDUQ5i+f+bxm oa7o/yYADGkeabW4d11ZRbrNoCM/E5Lr+s9fVC8m6XhjECo6UvYHu0PWiHZoYgHkpClO DpFytDTAmANhfP79nfKEqGGHg0kI/ID1ftmjy7S9owy+GZthrrA/IinKrknEWBv9l84p 4EjaOFfinEE6WKeZGFMbhxYB6gwGamPEEI/+vUWUouYiGKTHioujp3HW4gndcYRtH2V7 2YJS+om4Hhz7y/Ja6OcLZ2cH9HJZHDgILjUBznbEkEOAbpOCJiOM1Z26G//2aFnVeeOW k+OQ== 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 y1si28350370pll.239.2021.10.06.09.43.40; Wed, 06 Oct 2021 09:43:41 -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 S235957AbhJFQpb (ORCPT + 7 others); Wed, 6 Oct 2021 12:45:31 -0400 Received: from mail-oi1-f169.google.com ([209.85.167.169]:42791 "EHLO mail-oi1-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232381AbhJFQpa (ORCPT ); Wed, 6 Oct 2021 12:45:30 -0400 Received: by mail-oi1-f169.google.com with SMTP id x187so2464376oix.9; Wed, 06 Oct 2021 09:43:37 -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=uA/cSYcpVyY62IJQPXwhEfvcH0a7DNNoh6QF/gbSv/o=; b=ODDM5tXYhSPxk2r/bCjAb5vFG1of6jbKB2UaKspq/dUbxxnFM9foFyghdlXZvWqxeJ 3q0DQJ5gkypQ+i7dJ0Id6IprWk22PuoDb3Ig+xEuyQKjUBTYLLxT22x3GTiwv/Oosco5 oslX8k+wVOYYJfmNdGJM8EiSGAjvQeptoK4Q1RmWInxnIsASFsKBhTfGRcHdUI5pqCNd CMMa1NPTe+UjJt+WsUNPbPn1jPNQX/uK7+9pSlS0qgz1X79wOzyooUTU373PYGoXTKmT t+PTgYTiAT0m3y65w6RWVx9jXPS4nBcn/xhUVzkBj819Y4fpXBOybO2OzdlpLw5+2gmT 2O+Q== X-Gm-Message-State: AOAM532RtxGJ8v/7tj8ZHsPCewZ8T5MtEdGeTGTrnxh6QktQEAK6tvCu yA7Jq1q4EmEMHPJjk9NCvQ== X-Received: by 2002:a05:6808:231f:: with SMTP id bn31mr855081oib.66.1633538617237; Wed, 06 Oct 2021 09:43:37 -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.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 09:43:36 -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 01/12] of: Add of_get_cpu_hwid() to read hardware ID from CPU nodes Date: Wed, 6 Oct 2021 11:43:21 -0500 Message-Id: <20211006164332.1981454-2-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 There are various open coded implementions parsing the CPU node 'reg' property which contains the CPU's hardware ID. Introduce a new function, of_get_cpu_hwid(), to read the hardware ID. All the callers should be DT only code, so no need for an empty function. Cc: Frank Rowand Signed-off-by: Rob Herring --- drivers/of/base.c | 22 ++++++++++++++++++++++ include/linux/of.h | 1 + 2 files changed, 23 insertions(+) -- 2.30.2 diff --git a/drivers/of/base.c b/drivers/of/base.c index f720c0d246f2..e587ab44be22 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -286,6 +286,28 @@ const void *of_get_property(const struct device_node *np, const char *name, } EXPORT_SYMBOL(of_get_property); +/** + * of_get_cpu_hwid - Get the hardware ID from a CPU device node + * + * @cpun: CPU number(logical index) for which device node is required + * @thread: The local thread number to get the hardware ID for. + * + * Return: The hardware ID for the CPU node or ~0ULL if not found. + */ +u64 of_get_cpu_hwid(struct device_node *cpun, unsigned int thread) +{ + const __be32 *cell; + int ac, len; + + ac = of_n_addr_cells(cpun); + cell = of_get_property(cpun, "reg", &len); + if (!cell || !ac || ((sizeof(*cell) * ac * (thread + 1)) > len)) + return ~0ULL; + + cell += ac * thread; + return of_read_number(cell, ac); +} + /* * arch_match_cpu_phys_id - Match the given logical CPU and physical id * diff --git a/include/linux/of.h b/include/linux/of.h index 6f1c41f109bb..807f8168dad9 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -353,6 +353,7 @@ extern struct device_node *of_get_cpu_node(int cpu, unsigned int *thread); extern struct device_node *of_get_next_cpu_node(struct device_node *prev); extern struct device_node *of_get_cpu_state_node(struct device_node *cpu_node, int index); +extern u64 of_get_cpu_hwid(struct device_node *cpun, unsigned int thread); #define for_each_property_of_node(dn, pp) \ for (pp = dn->properties; pp != NULL; pp = pp->next) 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 \(Arm\)" 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; } From patchwork Wed Oct 6 16:43:23 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: 515360 Delivered-To: patch@linaro.org Received: by 2002:ac0:b5cc:0:0:0:0:0 with SMTP id x12csp590221ime; Wed, 6 Oct 2021 09:43:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLHVy6xGwAKmuIr/zLRF3LeAtmy0PdixG09Cbs+mbxakw/qHOtsSiWKZhwTqK8STr7NtAp X-Received: by 2002:a17:907:7803:: with SMTP id la3mr34252586ejc.235.1633538628562; Wed, 06 Oct 2021 09:43:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633538628; cv=none; d=google.com; s=arc-20160816; b=y6kOx2Eg6n0CLhLPPNuPanHzsCbYoma0QSGBPOYVUoMQrFXNpDjAnsuRb7XRFXpSOJ Wsk/m82H/32xeaT8N+/a4K7eHjB4nvrF7do0NjfDw3l2GrDkzuc3DbvMM+fOSjUtki0S EUhUtfOYE9fkhpwlLVollD1V1YLQT34Tfb/p6zd45V7nzoWLuwwacPircnDo73C117Lm bIQkbkX2/AuIoALTIBbWC87iCrTzS6w698Z25bvucb2gbTpiTHkqIHJHluXBxdW6oTvz aqlOM0s85DNn+DoqoO2HfqQ0G6EDgDHCHwx8Dres+bJ21Bx5F+XNdcNSo7q2Tqd5Ea6F e6oQ== 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=SdvZjQ/BWS45GZwLPJ4dVbNMr/Wj7uXKHO/Bl7X5Es4=; b=ryNZDObIQFEzSLiwXZ9spjKOCY/IkjE46J3kvZVoGjmZcWASKbJ3Z4rZMi5YbyD722 Ka9jhvGRtafLPEjIMI7chl6uPZQHuN8Zv+1uT94PF6oTFsykbDIUlOIMLnqMiAHyZIA0 MjGa7GFuodraruKHeCPPOy2MoaVuOxWEuvLWeLb9vy7LqbLBe56SuxPnFC/iFmQbocQN k7Y/PbdQgfZ+mJ2VSYxqPunBQPUnXrU6zcHMJdlTi8g8a9s7eWtW1joT7EsND3ADQ8kj hEjmufWEYEfL3B8Fqm2ZjlcwDjS6t6uanx/nkD3JUiU+JkoJa2Sre8EZpJEugPclMcNm Fktg== 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.47; Wed, 06 Oct 2021 09:43:48 -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 S239415AbhJFQpf (ORCPT + 7 others); Wed, 6 Oct 2021 12:45:35 -0400 Received: from mail-oo1-f50.google.com ([209.85.161.50]:41971 "EHLO mail-oo1-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239395AbhJFQpd (ORCPT ); Wed, 6 Oct 2021 12:45:33 -0400 Received: by mail-oo1-f50.google.com with SMTP id b5-20020a4ac285000000b0029038344c3dso1022241ooq.8; Wed, 06 Oct 2021 09:43:41 -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=SdvZjQ/BWS45GZwLPJ4dVbNMr/Wj7uXKHO/Bl7X5Es4=; b=oU55qGR6BHceUgiewU1iBrshR/CxA3A9igLkdkXMmtO5+kFjEQcJVZoUvP9rFh7XHE /+U2bTaQDZevTs0Dh5mWc0IYfhGY0ke6qSdsr2ZsgLETkpwkow8jzBKKdkSTBJAZZfTA d3UG0CKOsVd/yAvkDvKpNK94QZbvaZsJL7Rhr3q4EKqFtIQIPS63sgvpoGL3k49zNMFG zFFuyK0CLOCzemTQ8rRxqBMKLNSqY0R2HBvXDe5lS9TUQeMRxdpE7GwaKzv/bqTCDGqc 7wY7cWM66PXzWvG5jIORTVl+KkHUMo5DT0KaBtoRBd8z23GT2WQpWcxsuMWaXVLJUWR2 ASJw== X-Gm-Message-State: AOAM530SdEENQYPczjZ7XJWdg7qpyXpIizsimlPvs6KzIFbBOoR+Ddse 3yjzuS6q5+N3HDPCtXxUhw== X-Received: by 2002:a4a:4c46:: with SMTP id a67mr18657206oob.72.1633538621020; Wed, 06 Oct 2021 09:43:41 -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.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 09:43:40 -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 03/12] ARM: broadcom: Use of_get_cpu_hwid() Date: Wed, 6 Oct 2021 11:43:23 -0500 Message-Id: <20211006164332.1981454-4-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 open coded parsing of CPU nodes 'reg' property with of_get_cpu_hwid(). Cc: Florian Fainelli Cc: Ray Jui Cc: Scott Branden Cc: bcm-kernel-feedback-list@broadcom.com Cc: Russell King Signed-off-by: Rob Herring --- arch/arm/mach-bcm/bcm63xx_pmb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.30.2 Acked-by: Florian Fainelli diff --git a/arch/arm/mach-bcm/bcm63xx_pmb.c b/arch/arm/mach-bcm/bcm63xx_pmb.c index 0e5a05bac3ea..003f1472ab45 100644 --- a/arch/arm/mach-bcm/bcm63xx_pmb.c +++ b/arch/arm/mach-bcm/bcm63xx_pmb.c @@ -91,10 +91,10 @@ static int bcm63xx_pmb_get_resources(struct device_node *dn, struct of_phandle_args args; int ret; - ret = of_property_read_u32(dn, "reg", cpu); - if (ret) { + *cpu = of_get_cpu_hwid(dn, 0); + if (*cpu == ~0U) { pr_err("CPU is missing a reg node\n"); - return ret; + return -ENODEV; } ret = of_parse_phandle_with_args(dn, "resets", "#reset-cells", 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)) { From patchwork Wed Oct 6 16:43:25 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: 515362 Delivered-To: patch@linaro.org Received: by 2002:ac0:b5cc:0:0:0:0:0 with SMTP id x12csp590259ime; Wed, 6 Oct 2021 09:43:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyF6vFf/jZoRNi9dYmIH12DKbXgwhsWEmsgZCdZ06xLaOP6HSgs1M9RsdttQJ3wmq4FGOjT X-Received: by 2002:a17:906:6549:: with SMTP id u9mr32607028ejn.514.1633538630778; Wed, 06 Oct 2021 09:43:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633538630; cv=none; d=google.com; s=arc-20160816; b=hiS9k81UUnmySghgrFmaJyzdoWfhXoZZmXy5wJZlhvkLgViRhOwBaPzukDlvo1ybQm G4fVINet69qNAhzBuBuxJ151wLHthe9F2mZd5lveFjISM+zddhXOF8p8hlTuxd6cZ9GO TQaMGx6WSgaSGqFLPhULDIjfTro2jsDGUn9WL1CacRj841nhJF5Hbb6LuksGgqV1DDSD 5vp2olv4GranP8r2n+FayDVU05FcytieCnTtHALerGBvaukcBw/V3rPv0UkIanfxsQgF adhVA9y8zb3VG8tRV30xdQtnwWXSXKJx6Q+gXT+i727HzVLS4Tvh465SUkWdbcebF3ws q41g== 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=CN2tRnfV0nmrSbuDbyHoypag3neEaofRCNv6xL7Eiog=; b=SyF+VpOBtgZsjmS8t4EIC4aNXljWVt7i/H3XgGVlAuCJuYWSvSG5WzIVsaHAthfaHY mIBB0nxzZV+2fQJ7MEv1oXLbGd/ZokVbTc/7FpO2MD9Rkhsz3a+YZ5TaqPDsKONx7JTg ErAkLRCNFk3lAngjpb1QFKseFknTef5tlb8JrJj3IoAjAMz/D3RlfY1GYnwL7qdjRCOd GNwUHzK9FLFpKu/RBuK/MpG+cGmXz05eblGzuKCka6eL+Jb2PirDOjmY7UdqgwPTjiCE F5Xq0zmhn3JTjvcmIVTewqEjRhkyEjmELURZsZtFfZQKQ5jYKalK1oOsKvIW9pNk48jx y2EQ== 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.50; Wed, 06 Oct 2021 09:43:50 -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 S239423AbhJFQpl (ORCPT + 7 others); Wed, 6 Oct 2021 12:45:41 -0400 Received: from mail-oi1-f182.google.com ([209.85.167.182]:35658 "EHLO mail-oi1-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239428AbhJFQph (ORCPT ); Wed, 6 Oct 2021 12:45:37 -0400 Received: by mail-oi1-f182.google.com with SMTP id n64so4890194oih.2; Wed, 06 Oct 2021 09:43:44 -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=CN2tRnfV0nmrSbuDbyHoypag3neEaofRCNv6xL7Eiog=; b=BEgHC543RKZC7CqBo05WKnJagmM8YIIneNefpzsqjJRmQ2hoFkKPOsiZl1OdmEZrPw OojVSelb1RkV2fMbsnvreceDSxtpWe1OSddW/4iCh2gLB91D81XPywbKwdn3+lIPCVmx 02v5MOrmhN88a8pWVPUD4r3GUg0cIW5ejbUerPYZr+YaaQbPXjc9SaZTKd/HPYQNoM52 q6D4Yfdkw4GytF2NUuuF3eB85RPmaD5wsZsVcU3vauW62THts/G+E0C7ak3GVxLGVxgU 2KtwbD6TNsvFRQyDRAJka6f7Amyx9CwqxeDwqie7M1df+K5klplIQ1WWHNOKuyCu/6aY nlxA== X-Gm-Message-State: AOAM532wgalESwiX1Xs/oJCu86OZmpkETuBdUToxMtj6bd156aV6YXkI M1sdYMZ1Yt4ahJHsAMoVXQ== X-Received: by 2002:aca:30c9:: with SMTP id w192mr7839682oiw.93.1633538624646; Wed, 06 Oct 2021 09:43:44 -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.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 09:43:44 -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 05/12] csky: Use of_get_cpu_hwid() Date: Wed, 6 Oct 2021 11:43:25 -0500 Message-Id: <20211006164332.1981454-6-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 open coded parsing of CPU nodes 'reg' property with of_get_cpu_hwid(). Cc: Guo Ren Cc: linux-csky@vger.kernel.org Signed-off-by: Rob Herring --- arch/csky/kernel/smp.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) -- 2.30.2 diff --git a/arch/csky/kernel/smp.c b/arch/csky/kernel/smp.c index e2993539af8e..6bb38bc2f39b 100644 --- a/arch/csky/kernel/smp.c +++ b/arch/csky/kernel/smp.c @@ -180,15 +180,13 @@ void __init setup_smp_ipi(void) void __init setup_smp(void) { struct device_node *node = NULL; - int cpu; + unsigned int cpu; for_each_of_cpu_node(node) { if (!of_device_is_available(node)) continue; - if (of_property_read_u32(node, "reg", &cpu)) - continue; - + cpu = of_get_cpu_hwid(node, 0); if (cpu >= NR_CPUS) continue; From patchwork Wed Oct 6 16:43:26 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: 515363 Delivered-To: patch@linaro.org Received: by 2002:ac0:b5cc:0:0:0:0:0 with SMTP id x12csp590310ime; Wed, 6 Oct 2021 09:43:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwV14DoimzXsWSGecjS4GslrJp+Oru8agpYVRllybMjYR88+MKm1hnnFKCtEOPNEQIUvh4v X-Received: by 2002:a50:e08c:: with SMTP id f12mr35500997edl.178.1633538634718; Wed, 06 Oct 2021 09:43:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633538634; cv=none; d=google.com; s=arc-20160816; b=bZQ1olGJuIcvp/LAtWatp+ov9NRMxc96lVCjv6U5z4caTvD3KkPPDEbWNKx8hiwTOp xor7uf0/qiW/SSeqnTLN7hwiIW7VwlIPqbcEQVSBdwrudvMjuUPRSexlpwFAaED3HnxK +sjj5L00esa5OuXk08b/Bqp01bRGr7j4V2hETz35PdFSLHiVqKU2D8KgWIIUE45S8LCt IuvmEhFhmvCfCfXOUZwRgWYlwu77wnj7rTmWUhh6Ij6LLudxiHsVpfIw88FymBLHTcCy IcOhNCHy7Vri0CQfNlh6p+Bc3hr3K3plGYDcssOpHT2O2R+f/GI1XXBNu2uadwKKblLY U3Yg== 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=E46c5KotLBJJxu4fxLSa91xNqDqPq5a/10Op+mtdz/c=; b=EY6lK5Rn7Y638/QU6w17fyF2Bg37Zd8/SQvdGPY8Hb6fumOTqu1uKG15g64HaSJRmB 3y8/jaPKd5gXPoQ9Z24yYsYisT4X4UWNKRMxcdfLcaetLec8UQjrQLqDr1wJpGRc6yne FvFy3Zs28OnVj0dWVSIDxe5djcX78dLAq/M5/HZUednRxnYcgF4nQPwaImsjYlltEPBM MPDMt2UpgbWqPbjFSQrghg4CufFRotXT1WXd2i9PhFiesEHK6feiVODqawtqt1jJw5hv 97FXpEXeqU5apv9+UJzMy9SLHc/kZOaKzOR8Kk+fl3AutM1ucE4Bjv7+UUIJTcndBwOC 8oFg== 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 i22si34249256ejw.286.2021.10.06.09.43.53; Wed, 06 Oct 2021 09:43:54 -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 S239428AbhJFQpn (ORCPT + 7 others); Wed, 6 Oct 2021 12:45:43 -0400 Received: from mail-ot1-f54.google.com ([209.85.210.54]:37615 "EHLO mail-ot1-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239438AbhJFQpj (ORCPT ); Wed, 6 Oct 2021 12:45:39 -0400 Received: by mail-ot1-f54.google.com with SMTP id r43-20020a05683044ab00b0054716b40005so3859905otv.4; Wed, 06 Oct 2021 09:43:46 -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=E46c5KotLBJJxu4fxLSa91xNqDqPq5a/10Op+mtdz/c=; b=7a/a5xV9WpA2+5JPBQQwIp7Xji11STygmFR/tXP06Y+odK/1qCniygFlvhES6nMKQk 942NVqTkBTaDyTKQzeAxKojmIGht6SHpSMDoqa+RJYD/kwwXfxZkJDpFFmpbZPhdPT4R K0Tg15tyLJX2yYPy5uZrls5qDd7y9gGDn8hl7CaUn/9AFbOOU7+izjS+JJe8e7A9gToE SUJk1WXqujCbfKUcZFjiauIJ2EKvKDUtfbaNBgbhLIvLP77OD9SblK/OPWwBkMnEVdOf TsSb5oS3nRNQvgZ0i1Dfsf9PbWWDQIa6aQN5W0FgUazCZYdTFroDp1/B2MNWpuyHiGIw MvwA== X-Gm-Message-State: AOAM5309hVNSeMvfe3hpLw7Ciqn7C5cQJuoUYszRmKOsL45vLFY54ULt 3aL+SMst8suuE54W4bwBTA== X-Received: by 2002:a05:6830:1d8b:: with SMTP id y11mr20406228oti.291.1633538626550; Wed, 06 Oct 2021 09:43:46 -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.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 09:43:45 -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 06/12] openrisc: Use of_get_cpu_hwid() Date: Wed, 6 Oct 2021 11:43:26 -0500 Message-Id: <20211006164332.1981454-7-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 open coded parsing of CPU nodes' 'reg' property with of_get_cpu_hwid(). Cc: Jonas Bonn Cc: Stefan Kristiansson Cc: Stafford Horne Cc: openrisc@lists.librecores.org Signed-off-by: Rob Herring --- arch/openrisc/kernel/smp.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) -- 2.30.2 Acked-by: Stafford Horne diff --git a/arch/openrisc/kernel/smp.c b/arch/openrisc/kernel/smp.c index 415e209732a3..7d5a4f303a5a 100644 --- a/arch/openrisc/kernel/smp.c +++ b/arch/openrisc/kernel/smp.c @@ -65,11 +65,7 @@ void __init smp_init_cpus(void) u32 cpu_id; for_each_of_cpu_node(cpu) { - if (of_property_read_u32(cpu, "reg", &cpu_id)) { - pr_warn("%s missing reg property", cpu->full_name); - continue; - } - + cpu_id = of_get_cpu_hwid(cpu); if (cpu_id < NR_CPUS) set_cpu_possible(cpu_id, true); } From patchwork Wed Oct 6 16:43:27 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: 515364 Delivered-To: patch@linaro.org Received: by 2002:ac0:b5cc:0:0:0:0:0 with SMTP id x12csp590363ime; Wed, 6 Oct 2021 09:43:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQFCQqMZNR16dXYohqPaOfbgM27Yw2fXil63gfExaaJPY1UvPje/qSEs/aXd777SVh+p1n X-Received: by 2002:aa7:c2ca:: with SMTP id m10mr36510246edp.394.1633538638292; Wed, 06 Oct 2021 09:43:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633538638; cv=none; d=google.com; s=arc-20160816; b=KxDffVG6liZ/b0ty+GKoeFvIaYYxOf3xXt+nysH/cPqfVUufsfjjI1YKnybEIVrpah vjyojMoB6jAoz+cAi/ePy3yxZZuq3hqngZWMwjzRz7oIs5tYQhzuF4sZ1JicmA8umddG KlDd6TQ09kbc/M1v3or9zFbpzHwDrR7PuAp3cuzceQLnaFg2WIgGmYOob6u2RhpqI8oT MNgYFvv8NaZBkaqI+WP+Yo6g7ZL5OzR72I1wq/ptSl4z6Lj0/FbAuq+KbdxBpDKuLvUN Pg0xiQjmVPPAaTijAAfLTQB2sXqEUdeXN2GhEKXJNbdnGEZKwL08scOgtBeGmdCvhXuP uFHQ== 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=lY59MK3rRpvbu1Z+VUSRhTP9oCogI9gtd3qobuL4xSE=; b=FzIBjDS/n8suKoBb9VlX2ATzMjitQgbTEEuq4yFYMo4IAfmOfv9ibFvnHtHsdpdgzt UwN3FXRmmDNIpGfjPL8Dsn8ugjJghVvsRydi1vZ+Kq8Nav8yrLZHobX8aNQqWnhXc/WL hvk932uPcAcRGLSRW8VtMvU6IIBPX97uIdKBYoYOwYu866Be+BF0ExiXp/JbDGBlvdav /E5ijGmqiNbuYVw11X6wX5HgqroRWNHc05FDw+nHPLNDGUKZeHiBXpKG1T2rSGeTBjj3 N/HICWrSil77VziZkDZp+ujuTP67yg/IustoSLpxEpYyHOBg/HyG0lGjv/YghZu8l7/g y3+g== 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 g17si32429334ejm.145.2021.10.06.09.43.58; Wed, 06 Oct 2021 09:43:58 -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 S239501AbhJFQps (ORCPT + 7 others); Wed, 6 Oct 2021 12:45:48 -0400 Received: from mail-oo1-f42.google.com ([209.85.161.42]:37659 "EHLO mail-oo1-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239426AbhJFQpl (ORCPT ); Wed, 6 Oct 2021 12:45:41 -0400 Received: by mail-oo1-f42.google.com with SMTP id h11-20020a4aa74b000000b002a933d156cbso1032591oom.4; Wed, 06 Oct 2021 09:43:49 -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=lY59MK3rRpvbu1Z+VUSRhTP9oCogI9gtd3qobuL4xSE=; b=VrtFmor9aA0ypN/F0xXijVY6hfMS82MC7K1tVqot7IPidnHRp0iU6214DiS/mAQ3x9 AQz30PPIlMfHHWesFBTh+9N5UHWm9EEWbMdrYAW2FgglvYd1f+WSr5rrbzrwu1VMhuuo ivIezeBHqRh0/nkYb5kONv+qJEZf8sb+nI4YyAkWRQuoMJRnakbKhiQyfOaXBXCYFW4m BIbqqiPSKCsHrcxt6dEazg6BVAeEpMNeLIS1T2VFuL/BN8waayiQ8tHX7vNK1Zp6r5rS uF7c3s7jV5bfVGd2X3ZCzx210kgQXzjtNqui4u5OFhfGER2wh3lPxjLs5QlMM0esU2Tk HpyQ== X-Gm-Message-State: AOAM531Y5XbQJHgFYSYKnW2KDCRTyivpVj+D026havtY+t0Rjc7yXngr WGFKLTipU/adwfPk+mq0Cw== X-Received: by 2002:a05:6820:1018:: with SMTP id v24mr19468852oor.27.1633538628646; Wed, 06 Oct 2021 09:43:48 -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.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 09:43:47 -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 07/12] powerpc: Use of_get_cpu_hwid() Date: Wed, 6 Oct 2021 11:43:27 -0500 Message-Id: <20211006164332.1981454-8-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 open coded parsing of CPU nodes' 'reg' property with of_get_cpu_hwid(). Cc: Michael Ellerman Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Rob Herring --- arch/powerpc/kernel/smp.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) -- 2.30.2 Acked-by: Michael Ellerman diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index 9cc7d3dbf439..d96b0e361a73 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c @@ -1313,18 +1313,13 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle) int cpu_to_core_id(int cpu) { struct device_node *np; - const __be32 *reg; int id = -1; np = of_get_cpu_node(cpu, NULL); if (!np) goto out; - reg = of_get_property(np, "reg", NULL); - if (!reg) - goto out; - - id = be32_to_cpup(reg); + id = of_get_cpu_hwid(np, 0); out: of_node_put(np); return id; From patchwork Wed Oct 6 16:43:28 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: 515365 Delivered-To: patch@linaro.org Received: by 2002:ac0:b5cc:0:0:0:0:0 with SMTP id x12csp590411ime; Wed, 6 Oct 2021 09:44:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVM8t7ziFUJfX4l16obY1q4QZJ10xiwa535UhKfO84IUsz2mSv7RtzbQOA1yV6OM43w0JK X-Received: by 2002:a17:906:4d19:: with SMTP id r25mr1353350eju.264.1633538640957; Wed, 06 Oct 2021 09:44:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633538640; cv=none; d=google.com; s=arc-20160816; b=QuBGh5nS6G7DMEaL5knRIN0zBUjdFFld9DVE1/qR776TpPIV43ZEj6rJdn7FSRgmZo mqKmo3ujPaLiw89LTE7S7JfLbVB2VjCQwcQZ4OvgReDmmsT7f7TwcsWMSb+UyOAF6Xse 6blyfn3ysIQ0yolsJFSxheMfRMCTvc10RLJuuu/DrtV438mASiEbcTXjYDK/tIbrxhUh j1mb+wPw549iPctsDvHp8UOWk1fT4Eg0olGy+ZmnhchWsY4EkWUl0y5yrKNMZVH7U15s KqFHm3X5Cs5/5Iz9sGgOyuO53XJD+KyOQKeNa3s83UOir1igxFSCaGAfBGq1WoJQNKf/ gwCg== 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=YhacG1oflfweV+ZMxYJrdhD3dQtCOWEVKc3UA01qLrg=; b=X1x3No0KgxSrZKQJ070PUdcMleUenkxZvob3vzHnBnkFyc4dkD77EZ1AmsSDbe8e80 1rsyfgzC34cp64toHx1Poxw20Gut2A1dq8+iR66GEbO9MDJMOMVDjM4ilzoavPY/JzRn ttoZ5ogNlJxZlqBIRDabGTjJqnf6BdWJhzf+bmSbjTqz/VX7x1beX9jrQ5ttdpPupbSf O9ZveEXvGisO2EcjkAq+bK5Phypr68V1Bn/ta4ET4/ZhP1lBbBuZMBBNaG71n6TpB4AP 0moyin/2n54wz2TXp5mkIxu9OKRSkVLDNd8IQJZvAi7Ir3bg+Mb8HOpZl3bWR7Ao1bRO tkBA== 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 p15si28163076edj.97.2021.10.06.09.44.00; Wed, 06 Oct 2021 09:44:00 -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 S239512AbhJFQpv (ORCPT + 7 others); Wed, 6 Oct 2021 12:45:51 -0400 Received: from mail-ot1-f48.google.com ([209.85.210.48]:34784 "EHLO mail-ot1-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239474AbhJFQpo (ORCPT ); Wed, 6 Oct 2021 12:45:44 -0400 Received: by mail-ot1-f48.google.com with SMTP id g62-20020a9d2dc4000000b0054752cfbc59so3952950otb.1; Wed, 06 Oct 2021 09:43:51 -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=YhacG1oflfweV+ZMxYJrdhD3dQtCOWEVKc3UA01qLrg=; b=kSh3oWroS+XO4aAllMH2APeg/Nwl+0EPsAkgwZhzHyw1FdEoYAzcJhtLit8Fypi9RB OYxIx34PzchUjqLWSQB93JDoA7xZqUwOXZ7iryr5cWs/8hdH+xYlvt+coPwV7ymRSiU7 YvSEgEWvU5Cj0LTc75yrz/D9IP7yHa3ELgpYrhk5LhTci2GSuGjNdJUpGSmC8rz/FsR/ 5ppcpKCbHA4bdTnwKEBHrWWoCCXnwcMh9gz1jNxMqE1YPTvYLWmn5BCyUWmaZJEbGQQd SnZ7gawf70T7LHlUbqfrIOpqFvA+Ql+WlDi2RHFD4M7ki8VUU+bKlStmAs7TdhWI10yu xkVw== X-Gm-Message-State: AOAM532nlfwwrfW5o/Ptp54MJsnVuKeBiN7JfF2zayimLfBCdTgh4UXy uvkUu14rM2+p5SHX+3RvRA== X-Received: by 2002:a05:6830:455:: with SMTP id d21mr20503877otc.300.1633538631080; Wed, 06 Oct 2021 09:43:51 -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.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 09:43:49 -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 08/12] riscv: Use of_get_cpu_hwid() Date: Wed, 6 Oct 2021 11:43:28 -0500 Message-Id: <20211006164332.1981454-9-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 open coded parsing of CPU nodes' 'reg' property with of_get_cpu_hwid(). Cc: Paul Walmsley Cc: Palmer Dabbelt Cc: Albert Ou Cc: linux-riscv@lists.infradead.org Signed-off-by: Rob Herring --- arch/riscv/kernel/cpu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.30.2 diff --git a/arch/riscv/kernel/cpu.c b/arch/riscv/kernel/cpu.c index 6d59e6906fdd..f13b2c9ea912 100644 --- a/arch/riscv/kernel/cpu.c +++ b/arch/riscv/kernel/cpu.c @@ -22,7 +22,8 @@ int riscv_of_processor_hartid(struct device_node *node) return -ENODEV; } - if (of_property_read_u32(node, "reg", &hart)) { + hart = of_get_cpu_hwid(node, 0); + if (hart == ~0U) { pr_warn("Found CPU without hart ID\n"); return -ENODEV; } From patchwork Wed Oct 6 16:43:29 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: 515366 Delivered-To: patch@linaro.org Received: by 2002:ac0:b5cc:0:0:0:0:0 with SMTP id x12csp590435ime; Wed, 6 Oct 2021 09:44:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwz4uCxgsSY36QyLbz/AXH7LrILfZFAHrfDoostM39ypyjn5bqO/E5S7xFjtEnEf/XevOgM X-Received: by 2002:a17:906:2f15:: with SMTP id v21mr32982338eji.444.1633538644289; Wed, 06 Oct 2021 09:44:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633538644; cv=none; d=google.com; s=arc-20160816; b=WutCY1iNN/V/RKCJrxfu9IHs3zDcOzi9oYU7BIrrxROMjo1K/38e29LhiQVKQugwm/ woyG/dEULEw7tq4HK23qRx10MBSOODKZiJgDWqoq6/IrNGTCNsac7sUcaG23Am7asfC9 zBIL2kGxBFDCeLsV+t7esfo010dCD3HluZRo7b4FB3p4+89DBHh7GTlPr9iHPOQADV2E EgbwhoylSJsNTS9O7gb3ygyEO2nGMGPjGRCLDNfG5WMQCAstehnf5xXWJpFiCRpAAhjp 0Ugdhh+rhZHAcFQlVDd14Cm6ApERuqSKxRYcBTwRvrhIuh9uG7hn3Qu2OL2qmIsZmaTK NS+Q== 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=qVDBxu87TJi7lJ0TsvF77hW6cToukGJnTBFK4bAPEHE=; b=mKn8nJO0QnKyM7rY8NRdnKcAwoYbWsGrgpqirQDEK5L5KDacvFnT+dQ31TkjB9L0QT 85hlnjGJxy0fHZXVmHezmfvCISgkSkv/fxv9OYui1aVCikKO3FXqv7+A3hXnEoBPyVFo 0n8CYk3AoLXur8VeMtL2lSOja0HzLFSTbmk/beQlCpn+YAftFQsaxESpyM6Tjzd54Cgv ZZBYSZWUWFVgBMQ1dpQA2r55nsS0jq+dr1qdbyBkbUj73dwl/Hf5qlvjIX7RqlVdQIL+ 7dfphLGJggWsPPpMOpgHVJgva24CdE0qDEPeH0S4qRbhuGjdEfr82Mg7QB5n8JegOsN9 msQg== 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 p15si28163076edj.97.2021.10.06.09.44.04; Wed, 06 Oct 2021 09:44:04 -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 S239485AbhJFQpz (ORCPT + 7 others); Wed, 6 Oct 2021 12:45:55 -0400 Received: from mail-oo1-f41.google.com ([209.85.161.41]:36628 "EHLO mail-oo1-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239476AbhJFQpp (ORCPT ); Wed, 6 Oct 2021 12:45:45 -0400 Received: by mail-oo1-f41.google.com with SMTP id e19-20020a4a7353000000b002b5a2c0d2b8so1029974oof.3; Wed, 06 Oct 2021 09:43:53 -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=qVDBxu87TJi7lJ0TsvF77hW6cToukGJnTBFK4bAPEHE=; b=yK4hHPrJnssJl72XgmZ9NbKgB+3h/U3+gTnqb0YNqjkHpu1j8D3hNTaK3yGbgAJq8d bAmEzwSzcMtAQDMnteCAkdbK4pXAlpPfJzrgN0w4H5vvfi5knIM/2ORXE556NGhk+kvU kYkfnZruyykjXwB9YVTz7uE3R+xiWHw5OfzFl5KLUIirNyEYvqK3xRP60q5BCXRd4lgI NqDqIZSKlnLNfVWIEfJczsXfZUumIIKmuBvHacdbVQFDXxQktOvzN0kqtTV8EWDpZNQb 1fdtPzUzz8neXqmq5jnye2bjusqMFuRDl9Dv/qTDxsophjznuq1x9ALq7MNCF2PWSme3 7txw== X-Gm-Message-State: AOAM5339ZnVjNt1rY9IHmf/ZW1KkVkqyvc2ipKgoieQzp0otrOZxPp55 RFubDWIanJ/fTxsa+j1Hbw== X-Received: by 2002:a4a:e597:: with SMTP id o23mr6391984oov.96.1633538632948; Wed, 06 Oct 2021 09:43:52 -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.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 09:43:52 -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 09/12] sh: Use of_get_cpu_hwid() Date: Wed, 6 Oct 2021 11:43:29 -0500 Message-Id: <20211006164332.1981454-10-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 open coded parsing of CPU nodes' 'reg' property with of_get_cpu_hwid(). Cc: Yoshinori Sato Cc: Rich Felker Cc: linux-sh@vger.kernel.org Signed-off-by: Rob Herring --- arch/sh/boards/of-generic.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) -- 2.30.2 diff --git a/arch/sh/boards/of-generic.c b/arch/sh/boards/of-generic.c index 921d76fc3358..f7f3e618e85b 100644 --- a/arch/sh/boards/of-generic.c +++ b/arch/sh/boards/of-generic.c @@ -62,9 +62,8 @@ static void sh_of_smp_probe(void) init_cpu_possible(cpumask_of(0)); for_each_of_cpu_node(np) { - const __be32 *cell = of_get_property(np, "reg", NULL); - u64 id = -1; - if (cell) id = of_read_number(cell, of_n_addr_cells(np)); + u64 id = of_get_cpu_hwid(np, 0); + if (id < NR_CPUS) { if (!method) of_property_read_string(np, "enable-method", &method); From patchwork Wed Oct 6 16:43:30 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: 515367 Delivered-To: patch@linaro.org Received: by 2002:ac0:b5cc:0:0:0:0:0 with SMTP id x12csp590463ime; Wed, 6 Oct 2021 09:44:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJweT+zzImySuC9rUIxWoFgjum3Ms5wassGBxnhfT98vXF8cd+Qgh7ARakLWxMg5tE1BSnWc X-Received: by 2002:a17:906:12c6:: with SMTP id l6mr32725390ejb.373.1633538647201; Wed, 06 Oct 2021 09:44:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633538647; cv=none; d=google.com; s=arc-20160816; b=ibBvM+KaWMKNmtzaNQ++J4ORruUDIQo6onySoZ5vKbb0z4uxTGLaV2uIJlIdNz2HTR qBmJDLHAI2c5pXwcrmD2LeVMMXi27yIrq4/hbw+y+BElXay6FPoUoNoMdQTJ8poCZ6AH bXp86/IxPcQysaETyVJwTZflEG3RmWJrFAvk6GlIZFiHcBKuh96Ef81iCfYSQz1BPhKg 3+Be76HzPLspVUD3Uj8dktwxCzT60DRanqk57DsddsFkfPtRLBMDua5PFYYAHIeOCfwN wPGxJMiU17zetOn6n+VHyN7EKA3dChho8kkvhkX8Kh42uaeWyPAJ/LW51ZN92Ne2+ujm dh5w== 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=J13zoIHrX4tLH3WneJUTeWV7jFKNgk6/LfnJOFSAv7E=; b=ilEtXm8DEhfRvtqfFbFqspJ4Dfuq5xG+LjwLk4v6piEXv2QWIUEJ2WROtCGnyY9K2/ B0YWB+g0tA6TCM4VU/h/ukIP0J0F8ox0Y95620y9TqYCUw8mNcyyNxORifE9Nnj/Wl2g PrHMFYjah8m5wIouE61Za84gRjqFnaeeT28sQcMVmc5mgf9lG0moWvQg76tpnEtX3NR2 DPhszNs70BKmhZRGgO2BFOtNSmueXAUECS0wCL0TSpiO7Q/hlMruEj+8hJJUD2HEPvlj tj+5rUJnxIvx0xMYZl4KGafrKn5u2STaG6N8+BoPyUEZ6hzP7IlJq1x/UjL+qJxlaOJR Fywg== 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 p15si28163076edj.97.2021.10.06.09.44.06; Wed, 06 Oct 2021 09:44:07 -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 S239538AbhJFQp5 (ORCPT + 7 others); Wed, 6 Oct 2021 12:45:57 -0400 Received: from mail-oi1-f178.google.com ([209.85.167.178]:45968 "EHLO mail-oi1-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239496AbhJFQpr (ORCPT ); Wed, 6 Oct 2021 12:45:47 -0400 Received: by mail-oi1-f178.google.com with SMTP id v10so4795392oic.12; Wed, 06 Oct 2021 09:43:55 -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=J13zoIHrX4tLH3WneJUTeWV7jFKNgk6/LfnJOFSAv7E=; b=D2q5si30HENPddgh9NAhi3id+d7hMzBibYaQjh8aFhAXmC5sZp1/uZXxxVFK2U8bsn zVlUIobvs/vlwbDEJ7KS6FVppDsLt97lCDGB7DBkx3Iu5xsr+SJLnxwcnQD51GMFdBgK TtB1Wybv6C99jAXp9Y1+D9BvzQv8edrYlJhI1ACAW8w1/Y4Ou8gnY63xdyHKm7sOcQqm uFUDcetrGuffv2EipBxUEyS8TS2MvjUX/Ae4Asmjlnes2ArM7hAlQjp8qntUK1zKe8U4 0Pc9JpZKqoBSvoCs9guqtHqzPLJBq75BnrYJe6t/NH8rtKF9NhMWUUAQjYt/5NaVEdb+ h/fQ== X-Gm-Message-State: AOAM531ImG11BE73+oeNwxbv9089HTclcJBdPuP4LJbEpt+YUFaS0QyN LA9F3X9Cfu0Z2mhKWqrYkA== X-Received: by 2002:aca:c288:: with SMTP id s130mr7509039oif.138.1633538634953; Wed, 06 Oct 2021 09:43:54 -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.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 09:43:54 -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 10/12] x86: dt: Use of_get_cpu_hwid() Date: Wed, 6 Oct 2021 11:43:30 -0500 Message-Id: <20211006164332.1981454-11-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 open coded parsing of CPU nodes' 'reg' property with of_get_cpu_hwid(). Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: x86@kernel.org Cc: "H. Peter Anvin" Signed-off-by: Rob Herring --- arch/x86/kernel/devicetree.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) -- 2.30.2 diff --git a/arch/x86/kernel/devicetree.c b/arch/x86/kernel/devicetree.c index 6a4cb71c2498..3aa1e99df2a9 100644 --- a/arch/x86/kernel/devicetree.c +++ b/arch/x86/kernel/devicetree.c @@ -139,12 +139,11 @@ static void __init dtb_cpu_setup(void) { struct device_node *dn; u32 apic_id, version; - int ret; version = GET_APIC_VERSION(apic_read(APIC_LVR)); for_each_of_cpu_node(dn) { - ret = of_property_read_u32(dn, "reg", &apic_id); - if (ret < 0) { + apic_id = of_get_cpu_hwid(dn, 0); + if (apic_id == ~0U) { pr_warn("%pOF: missing local APIC ID\n", dn); continue; } From patchwork Wed Oct 6 16:43:31 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: 515368 Delivered-To: patch@linaro.org Received: by 2002:ac0:b5cc:0:0:0:0:0 with SMTP id x12csp590503ime; Wed, 6 Oct 2021 09:44:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCGssj5GGpVaXXNqURd0TK5ufi5xMp4fwv1+dg7CYqtjfZmEdDlLRGg0tCFUEDS/kBTYQS X-Received: by 2002:a17:906:64a:: with SMTP id t10mr35210847ejb.5.1633538649816; Wed, 06 Oct 2021 09:44:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633538649; cv=none; d=google.com; s=arc-20160816; b=B7Ay8T7qHXhnvyT/zpft3Qf3koySxdNqamBLpZnITeARIe3+Fv2CCM96G88HvFu2yg Smy0T5kYT/2i6z7YAGUD4oi3c8ksQD78XfxmJCUTXg1W7MAOLpm3MCQwKksAkJXBXPg3 BcvOpr7MpsUo1c0saUe/cVimTl6+CmmbeZ3F57YWWKBQnd2A7Bx5gGHkt13fU0pz532W +QXZgOfyWoADLXnCRo7aC7WAXMGXK9kBR4+W0hccXi9+upOdkKvlxQxm3MHqgYrvAD/h n6Xur2RgsfuhyayENkTR1NJko42BCBDouCWddW4KYNc3GCXU9lNRAgY4wS9B69Rzs54x M1Bw== 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=hDUPVdWmFpBgvCkQTCBoljrAdHSMkkZBVQWsyUTyf5E=; b=z2TYNwza/if87Jpbx7Y/RxxmI3gu65yJWcwjjwKu6YCK8edFanE36IoP0pGhEpB0ts fAIulrkYPXx6+m/qNAIYuY2oRtBHYRXpLuLpW2IKQOauW3vCMq8Rs0oB4NH3Et9a8J2v fVI/5gjvZkhkDxlINRbLcB3T7/tNc3B9y+7eq8TOAqw9Wc6aNIzZiVwBrVIG0L8jqnHK xQFgLgVc8CHVV9sztDw7Wih39isvdvf6ITTFI4hg9fkBqo3MBK3TqfYtmxVQaK+JZyV6 M/vzV7fEEY9affYaTghl/zwD6YT8+mt/NXq+TKMSsKuFbTEYu/SJeG0PItW0h36ZGBQI lz2w== 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 ch8si13461453edb.559.2021.10.06.09.44.09; Wed, 06 Oct 2021 09:44:09 -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 S239545AbhJFQp7 (ORCPT + 7 others); Wed, 6 Oct 2021 12:45:59 -0400 Received: from mail-oi1-f173.google.com ([209.85.167.173]:38636 "EHLO mail-oi1-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239425AbhJFQpt (ORCPT ); Wed, 6 Oct 2021 12:45:49 -0400 Received: by mail-oi1-f173.google.com with SMTP id t4so3023591oie.5; Wed, 06 Oct 2021 09:43:57 -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=hDUPVdWmFpBgvCkQTCBoljrAdHSMkkZBVQWsyUTyf5E=; b=HVHty+JRfnGzPW9Uo8hUF9uAy0GUQ5hz+A6ojh62JFPwD8ymg62r9rc2xuHrOoXyBO kqra0WEDPi6OI/C/+x8ZdLw2w70WbtbNaySVHimH3UEgapdR9m9bnAUBgXdz7iU4nvNN dEvPW3Z7JXx85jC+Xnt6JN/M2scp096213JrhH++5GRkHPZPGd3kdwa1gdWluq+KaO0v JSb64lC0btDt80WXbRfaGa2ExGKQjrbqJfQ53m4B8m4e6ARAIiU3DppHbMc0RYSPpa0q 8n049PdDBPwHiwCPsWyJ0NH3Z370lYqevWnd+u97uc1PLN2HsT9Firntb4y7X6sv860T iBEA== X-Gm-Message-State: AOAM531RbW6CdzG/XJfep5n9ukX1jAmRuE7puVac4087rNta6Ywgo7W0 nKQYVTW6x/+Q7d7S2XVhww== X-Received: by 2002:a54:4f8f:: with SMTP id g15mr7727342oiy.178.1633538636692; Wed, 06 Oct 2021 09:43:56 -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.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 09:43:56 -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 11/12] cacheinfo: Allow for >32-bit cache 'id' Date: Wed, 6 Oct 2021 11:43:31 -0500 Message-Id: <20211006164332.1981454-12-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 In preparation to set the cache 'id' based on the CPU h/w ids, allow for 64-bit bit 'id' value. The only case that needs this is arm64, so unsigned long is sufficient. Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Signed-off-by: Rob Herring --- drivers/base/cacheinfo.c | 8 +++++++- include/linux/cacheinfo.h | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) -- 2.30.2 diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c index dad296229161..66d10bdb863b 100644 --- a/drivers/base/cacheinfo.c +++ b/drivers/base/cacheinfo.c @@ -366,13 +366,19 @@ static ssize_t file_name##_show(struct device *dev, \ return sysfs_emit(buf, "%u\n", this_leaf->object); \ } -show_one(id, id); show_one(level, level); show_one(coherency_line_size, coherency_line_size); show_one(number_of_sets, number_of_sets); show_one(physical_line_partition, physical_line_partition); show_one(ways_of_associativity, ways_of_associativity); +static ssize_t id_show(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct cacheinfo *this_leaf = dev_get_drvdata(dev); + + return sysfs_emit(buf, "%lu\n", this_leaf->id); +} + static ssize_t size_show(struct device *dev, struct device_attribute *attr, char *buf) { diff --git a/include/linux/cacheinfo.h b/include/linux/cacheinfo.h index 2f909ed084c6..b2e7f3e40204 100644 --- a/include/linux/cacheinfo.h +++ b/include/linux/cacheinfo.h @@ -48,7 +48,7 @@ extern unsigned int coherency_max_size; * keeping, the remaining members form the core properties of the cache */ struct cacheinfo { - unsigned int id; + unsigned long id; enum cache_type type; unsigned int level; unsigned int coherency_line_size; From patchwork Wed Oct 6 16:43:32 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: 515369 Delivered-To: patch@linaro.org Received: by 2002:ac0:b5cc:0:0:0:0:0 with SMTP id x12csp590527ime; Wed, 6 Oct 2021 09:44:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVW+LQMxD//Ji2/88BgJe8Zji2BlgTDTWLEiGl9x2seDxF5LsG7w9rfgkB6nQJL9mM/xGU X-Received: by 2002:a17:906:7250:: with SMTP id n16mr32349170ejk.147.1633538652298; Wed, 06 Oct 2021 09:44:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633538652; cv=none; d=google.com; s=arc-20160816; b=fDCRI7f/6iNIq+qOxnlk8I4XuC6McKykf7Rq5d10RVsF7ggA6LYdvBMcPGjbAo7XMx qKUZFSjsv+H5VnUg6ARULqoKfdp6xhP0iSX2Jb4Za6pncA15WdpG5Eu30hZU/mVnQBRc I7/hNH/p2jAj9ABjbgBwy+7zj4NhmhV6oZ1ZHpq6ZKLgoy+3AyJfIKiKboR9dfp9ALWW AVtsm6qNTq02L6p3/1QAtWue7U6DYB8uj4xtk343PygEYgsHi8+dGhPKzzn3cVr2XQc5 UI9wsoC/BUGy5fIC8A7M4+Fraf5VOFpDOZDkU5vOs6s1rWlQYXpNj+CsfVj99g0szUtr uAxg== 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=ODdwkiH4tXq9GvyXH7/gt65PfkKCS+62hrrbhfBOAKY=; b=Oh3Ba9y6jTLJL9lzRXjUj/DmpjCCsgHcQBimVUe2Ru7euReLD6PJmUTrP2fFrfBPwp 4LN7nUc8zB2I+xjt8AAwuMPfZpNN0SMP2r9G0PMUgXFu4rcmCCdv1lwt3jb2stKATOkA Y9P6XY+wJDpiqkBfFlvJYKf6GtQziaWHsz8QncsKVYyiA78CZdDoNNeeer/zYxycRucR PpyzZG/mSymghst5QKAztnW4PmnIpyz03TLk+BE0/u4cbMT7znqUMGumELOYwEETqt3m sHd5u/40lIqIYhoY61GIBrGyC5lqkM+LQZnduTQaQiLxbnu8p5C8YgQnaJPLKRcOCcEy IhLA== 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 18si24613928ejj.476.2021.10.06.09.44.12; Wed, 06 Oct 2021 09:44:12 -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 S239551AbhJFQqB (ORCPT + 7 others); Wed, 6 Oct 2021 12:46:01 -0400 Received: from mail-ot1-f47.google.com ([209.85.210.47]:37639 "EHLO mail-ot1-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239473AbhJFQpv (ORCPT ); Wed, 6 Oct 2021 12:45:51 -0400 Received: by mail-ot1-f47.google.com with SMTP id r43-20020a05683044ab00b0054716b40005so3860784otv.4; Wed, 06 Oct 2021 09:43:59 -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=ODdwkiH4tXq9GvyXH7/gt65PfkKCS+62hrrbhfBOAKY=; b=KjVsZlxx2i4DNdKl4plQ7nquC69f93FQm8Z8JNSY/+Jeif9it35gDBSFUpOamO4Kfy Sh8VqPOHRHNQjJvpdQvavgc/MpFrpG85PnWD1GsLbIsR3kt+WWRaYC9ND0k8j/yME2Kt 350QGD0gNz0yQBrWlgVUeliy0h3SSIU0wI1KXj03GXf5XiOB1Hcs9oDz/jGtz6jW7KAk tT046I82ScmDM7729vVDQq3orDhfgKsWAQJC4XWtxeyjX2boA65FGbEREl5Auc/id+2Z s8GYN+MupuutmZHYVWDtRIoQZwB7e2qBlkYxLsBiYywHgrtI1iR+kmE33FFMauKtrvCD 3jPw== X-Gm-Message-State: AOAM530mQ60mKh0xHJFsGFNudKEAeyKedbJL21F82tHwLS+xnuz58fGb wauKdYjBaXpvaBGbYiXjWw== X-Received: by 2002:a05:6830:1ad3:: with SMTP id r19mr19253078otc.98.1633538638626; Wed, 06 Oct 2021 09:43:58 -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.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 09:43:57 -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 12/12] cacheinfo: Set cache 'id' based on DT data Date: Wed, 6 Oct 2021 11:43:32 -0500 Message-Id: <20211006164332.1981454-13-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 Use the minimum CPU h/w id of the CPUs associated with the cache for the cache 'id'. This will provide a stable id value for a given system. As we need to check all possible CPUs, we can't use the shared_cpu_map which is just online CPUs. As there's not a cache to CPUs mapping in DT, we have to walk all CPU nodes and then walk cache levels. Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Signed-off-by: Rob Herring --- drivers/base/cacheinfo.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) -- 2.30.2 diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c index 66d10bdb863b..44547fd96f72 100644 --- a/drivers/base/cacheinfo.c +++ b/drivers/base/cacheinfo.c @@ -136,6 +136,31 @@ static bool cache_node_is_unified(struct cacheinfo *this_leaf, return of_property_read_bool(np, "cache-unified"); } +static void cache_of_set_id(struct cacheinfo *this_leaf, struct device_node *np) +{ + struct device_node *cpu; + unsigned long min_id = ~0UL; + + for_each_of_cpu_node(cpu) { + struct device_node *cache_node = cpu; + u64 id = of_get_cpu_hwid(cache_node, 0); + + while ((cache_node = of_find_next_cache_node(cache_node))) { + if ((cache_node == np) && (id < min_id)) { + min_id = id; + of_node_put(cache_node); + break; + } + of_node_put(cache_node); + } + } + + if (min_id != ~0UL) { + this_leaf->id = min_id; + this_leaf->attributes |= CACHE_ID; + } +} + static void cache_of_set_props(struct cacheinfo *this_leaf, struct device_node *np) { @@ -151,6 +176,7 @@ static void cache_of_set_props(struct cacheinfo *this_leaf, cache_get_line_size(this_leaf, np); cache_nr_sets(this_leaf, np); cache_associativity(this_leaf); + cache_of_set_id(this_leaf, np); } static int cache_setup_of_node(unsigned int cpu)