Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp1251361rdh; Fri, 27 Oct 2023 08:43:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFwCc2EpjhLT2D3Aw/hnUJjllIDc6b1iSwRRQVLLY60UwYvsKkcqk2d4vZSqSuTX3DYqX7z X-Received: by 2002:a05:6870:d8c8:b0:1e9:c7cc:df9a with SMTP id of8-20020a056870d8c800b001e9c7ccdf9amr4041860oac.11.1698421412425; Fri, 27 Oct 2023 08:43:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698421412; cv=none; d=google.com; s=arc-20160816; b=ahH+J8qxtRdYWmkgmE2IxF7bU8EKl6ecdGo+fk/JWR2vaOAEy7y4AIRt/A/eQ/fPq6 H9hEpyP9/EP990ywpasHeeK2V8FV/iDUajBu0+s3RoYwTQg9QdIx3nSr6W/RCQZBshYO IeDu2wmzIq5LpT1r5k86o14C2Kgq00Iw4wJdw/YTNuqmAUjE568zj5//1qc5aaUYSsSn /uUUF+Q3kP4nwg9tYJoDv6j6RCyqxh9IxohWjcfzlCcES6Z41i/CEN9nNa6+WZCiyHl7 EB14f2gB1keQeuPr1ggx44Zrp+36Jt4De1jsw/3u0R9AIPkjJAHXc4jD6NkywtaotCi7 sbqg== 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 :dkim-signature; bh=1W9K1WUX7xqfrQAt8QwBmELFBTwIcr4D86Jl4GnCkM4=; fh=qkZZs+fq4kWnNaZamxh682g1U3Eb94GdM1bHrPc3LjU=; b=mL8J8w5LFEpj5IUIJRu9+wPH1GCwDaVkl0Mc9pW1pCkbaSq43VSkhpJVai0PTYeU7V dxFsvpFvrznVn4FLaezIKV7f84usEgQ46mYJgK8VZ0zwscKTzAWc6qPgxK8p/36/iKuY lOUVQppZJ0y2IKAvM7I3yrOvMG6nzQI2Pbfg7XU33Um5/Dhp6Id1GRsb7QYHy32Srpsh 2/yR45PKs7f+DLq0Qdl7RHTN42dArjiIULIgYFSp8j/9nmuf1yK246rRVUfBto1HdhPU l6zeyNtogTRXEiYu6w9da6rHblKJXN8+tvvNx24Z5eO+Io4YE0apGVPmxClKcfPBMPIo WDFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=h+XFnV1+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id v130-20020a25c588000000b00d5c1dc7b052si2949320ybe.713.2023.10.27.08.43.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 08:43:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=h+XFnV1+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id CE9FD83F9325; Fri, 27 Oct 2023 08:43:27 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346187AbjJ0PnR (ORCPT + 99 others); Fri, 27 Oct 2023 11:43:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346161AbjJ0PnP (ORCPT ); Fri, 27 Oct 2023 11:43:15 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D1F0121 for ; Fri, 27 Oct 2023 08:43:13 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1c434c33ec0so19257025ad.3 for ; Fri, 27 Oct 2023 08:43:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1698421392; x=1699026192; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1W9K1WUX7xqfrQAt8QwBmELFBTwIcr4D86Jl4GnCkM4=; b=h+XFnV1+jn8ECK8Kag4UojjMfRME9WIvP88Z9J4hMYunakKrwo6q3uTK4AE8zKbvwH GmSqKKMF03YMUOpiMxV11Ggg6pG59efeWBUoWVQkcq8o9mAXk9o7nxlUseNMsiDa/oQq NzzIGMiASjkL1sX35lFCSmBP9OL26bQ4ptXuRN5fqBucelsPzD6BgWbWFv9+ZJE5Z0LA M1mGtg+SmEl0KCptsYsvqxIF9AqOlLVZaU0p52x1g3sBXFa9xpiD4n5gAHItnWfU5s9k vvQdCbczzBCKoowg8m1KeUzYq2RTCQzlL9osTntArAg4l4q+qEl6AOeKh2coBky7s4K+ RoWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698421392; x=1699026192; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1W9K1WUX7xqfrQAt8QwBmELFBTwIcr4D86Jl4GnCkM4=; b=Mmr224InFWKD+Ro6fP/cq4PuZkFL7ro99O4saBLEjqX5Gn1ZRkquB2NXKUBXRWeWpv cc0SSGJACvooYL6FGcgDP1n2Dr+5kOOlRLQctoQ/N9Pwrj7VVEYvpmNdXV3gJRkhb12t 7VCiiIbNM9SLcuvcBGJ8QInu5SKWP5GRN67/DgGrlNsDS1KOtgTUWDtxEcG6J5R6m25/ qsCBayN7NV0PTATpnHrwraYGe3ZoyZQK4aFPxw2zdeeOD3KCJA1hdBTTSaCw0DYczlW/ FkN1WimGo1lhi53lZrQ6GKDlHxJJl1fa848/uHBF9Ae6pptyZz7+xVFNsuBvjc/3Qke2 AVZA== X-Gm-Message-State: AOJu0YxQE/YJxYq6r4/WFH6dTj/zmXERNr2SgcVRzHs5TlFB57no3rB9 rLszHLAuwj5IYtYQI2DwVGhA+Q== X-Received: by 2002:a17:902:dcc5:b0:1cc:b3f:dd81 with SMTP id t5-20020a170902dcc500b001cc0b3fdd81mr2446973pll.67.1698421392288; Fri, 27 Oct 2023 08:43:12 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([103.97.165.210]) by smtp.gmail.com with ESMTPSA id n16-20020a170903111000b001b9e9edbf43sm1729246plh.171.2023.10.27.08.43.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 08:43:11 -0700 (PDT) From: Anup Patel To: Palmer Dabbelt , Paul Walmsley , Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Frank Rowand Cc: Conor Dooley , Marc Zyngier , =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Atish Patra , Andrew Jones , Sunil V L , Saravana Kannan , Anup Patel , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Anup Patel , Atish Patra Subject: [PATCH v2 1/2] RISC-V: Don't fail in riscv_of_parent_hartid() for disabled HARTs Date: Fri, 27 Oct 2023 21:12:53 +0530 Message-Id: <20231027154254.355853-2-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231027154254.355853-1-apatel@ventanamicro.com> References: <20231027154254.355853-1-apatel@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 27 Oct 2023 08:43:28 -0700 (PDT) The riscv_of_processor_hartid() used by riscv_of_parent_hartid() fails for HARTs disabled in the DT. This results in the following warning thrown by the RISC-V INTC driver for the E-core on SiFive boards: [ 0.000000] riscv-intc: unable to find hart id for /cpus/cpu@0/interrupt-controller The riscv_of_parent_hartid() is only expected to read the hartid from the DT so we directly call of_get_cpu_hwid() instead of calling riscv_of_processor_hartid(). Fixes: ad635e723e17 ("riscv: cpu: Add 64bit hartid support on RV64") Signed-off-by: Anup Patel Reviewed-by: Atish Patra --- arch/riscv/kernel/cpu.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/riscv/kernel/cpu.c b/arch/riscv/kernel/cpu.c index c17dacb1141c..157ace8b262c 100644 --- a/arch/riscv/kernel/cpu.c +++ b/arch/riscv/kernel/cpu.c @@ -125,13 +125,14 @@ int __init riscv_early_of_processor_hartid(struct device_node *node, unsigned lo */ int riscv_of_parent_hartid(struct device_node *node, unsigned long *hartid) { - int rc; - for (; node; node = node->parent) { if (of_device_is_compatible(node, "riscv")) { - rc = riscv_of_processor_hartid(node, hartid); - if (!rc) - return 0; + *hartid = (unsigned long)of_get_cpu_hwid(node, 0); + if (*hartid == ~0UL) { + pr_warn("Found CPU without hart ID\n"); + return -ENODEV; + } + return 0; } } -- 2.34.1