Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp904617rwd; Tue, 13 Jun 2023 01:52:20 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5MWbBV5LYMnhYIbDvkVfsSd4mU7cmMn1sRuEV6VOkpivxwdKopZ4cVn8S/PL3Prjaq4sL+ X-Received: by 2002:a17:90a:fb53:b0:25b:d0ab:8184 with SMTP id iq19-20020a17090afb5300b0025bd0ab8184mr7727465pjb.15.1686646339732; Tue, 13 Jun 2023 01:52:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686646339; cv=none; d=google.com; s=arc-20160816; b=soW9EfLRzTyAP3UhPt3O16GejwTc+eHyC/ogCxYPBDLTNT6sJgwvn2vO3YVRVOKFKu 6hoMIDqc2h0kNBkDaPYYqtPT2eb/YabZkwLoMzex/ittrMHTE0I5Z9+WmC3zMTZ6xW5C 9vnxLSRaRyAaI/U/g1xw5TfcdexNodUxxPi0QlkChP9gElYDHR++Y4WttINpooXBcc3w IRdWfOuJ7I8/6L2ap4jgKiBMy4tHrVI9esrQKG+eSyRWdJVRL6Zzd4Ro2UAiOJxF3uMm wxETlYf9SHjH1z8I8zUpdMCWI3U7/Y8HxO03Jw3KM+N8E8HOV3NA3X8i6Uc/zmQQsJ5p HmlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=1k/4HquP2HeWTu3gqyEqAfIouxpypkLo7uElSrv6hWc=; b=j9iVEtl2zC3FbnLnfl93rQ/8IGEoZHpg4GLQ4u3phOSc36u2bxAd+sUJujZDeREM/E abGCTIwiC6FQVmYsttE+DHTv8rlaUlDmr7J8G1QhE6NNMFfObxz3AEb7wD157wJsddGA htxES0vsiRDy16tDhFsrQYVvYyCbs2OsX34vbWS0uizZGJMn7R4mJ3zaHoSIaxE1Bvec +3sslSDfe8ZiC+PGzeIRiZjlWQlwhNSK5xHMUP31w55pavd754YkW6ZCBNYvYErXMS2Q ZPeisitwCDcedCdSOam9NmgilQAaBpnOmL2+TN1H4Az6Y880omS+Rqga9jWByvukMoPg muvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=awkBk+ho; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 23-20020a17090a199700b0024bccf6609dsi10129018pji.114.2023.06.13.01.52.08; Tue, 13 Jun 2023 01:52:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=awkBk+ho; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240367AbjFMIGL (ORCPT + 99 others); Tue, 13 Jun 2023 04:06:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234044AbjFMIGJ (ORCPT ); Tue, 13 Jun 2023 04:06:09 -0400 Received: from mail-yw1-x112a.google.com (mail-yw1-x112a.google.com [IPv6:2607:f8b0:4864:20::112a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81F35EE for ; Tue, 13 Jun 2023 01:06:06 -0700 (PDT) Received: by mail-yw1-x112a.google.com with SMTP id 00721157ae682-561b7729a12so91655417b3.1 for ; Tue, 13 Jun 2023 01:06:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1686643565; x=1689235565; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=1k/4HquP2HeWTu3gqyEqAfIouxpypkLo7uElSrv6hWc=; b=awkBk+howhXC9J91GGN+gEhLJqzy4lI2+Nm2ME0HsBbRSUGNzB9llZL0mmuInqWVYv goSHwsqToUzZst/eUhuADOvGa79vijbWRbT4TcdQ2JmJleqsoTRcCvxuusNEuv6phnbg RcFVy5pFpePMCFA0meViSbb2mb42Bx5rqvMemzvomS6qHphXqCA6RmLGATsD2HzrkCA1 BkLuRJCoQE77Ziur1z4yQgYkJD1IJuA9j7kkcYm63Qc/WQZ672nsx8jaG3lyN5ld0Qc/ D3GNmDLwiLZE+jQJmHUTQzfaOhAFnuIcRdTgLn9/Ia/jM4+weREaTvv8hYftc1NWFSLr EJGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686643565; x=1689235565; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1k/4HquP2HeWTu3gqyEqAfIouxpypkLo7uElSrv6hWc=; b=fPP84P3gw66Azhy3Et2FpDSrcf/G5/M5Lujz0hOk5Ey4CUTGbbEUrHuVfgTlBQ4gVF jn9OLeV1zumWW7XTK7KLMC8M8HY75vq5kpJnqolt9AqeXDh5F59lS4RPfX3O/I4Z4vD6 QuUNA/0jRcnYXgZFjm0eESpZ9tZE0DowW9PB1v4AvFvNKiG/I8kB4QM+oPcjcx9K7X8+ UKaRbQo1pDA2SVPvoAcRnsp5X+sM7TG4qX5OsOXRafF7r4a9361D1Tt30LWwztRuAdEJ 2P87M0PDZvk0f6k0PmRKMl8kEEO6Eqo2uVxpT3cMhXNHiooXQfUDFHy0nLIexDAtlxBK q1aQ== X-Gm-Message-State: AC+VfDx7a2fDkT21Sttt5OEWEX7lRfQAJux2HnmdCHXwfgXRzNByFhcf cwZzOQPikw2BQiB6dxOyhYdsPPxQHU/eOmTBtxv6Zw== X-Received: by 2002:a25:a423:0:b0:bc4:77a:22a0 with SMTP id f32-20020a25a423000000b00bc4077a22a0mr878350ybi.15.1686643565505; Tue, 13 Jun 2023 01:06:05 -0700 (PDT) MIME-Version: 1.0 References: <20230508142842.854564-1-apatel@ventanamicro.com> <20230508142842.854564-2-apatel@ventanamicro.com> <20230510-squealing-pruning-2c94b85785b0@wendy> In-Reply-To: <20230510-squealing-pruning-2c94b85785b0@wendy> From: Anup Patel Date: Tue, 13 Jun 2023 13:35:54 +0530 Message-ID: Subject: Re: [PATCH v3 01/11] RISC-V: Add riscv_fw_parent_hartid() function To: Conor Dooley Cc: Palmer Dabbelt , Paul Walmsley , Thomas Gleixner , Marc Zyngier , Rob Herring , Krzysztof Kozlowski , Robin Murphy , Joerg Roedel , Will Deacon , Frank Rowand , Atish Patra , Andrew Jones , Anup Patel , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, iommu@lists.linux.dev Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 10, 2023 at 6:15=E2=80=AFPM Conor Dooley wrote: > > On Mon, May 08, 2023 at 07:58:32PM +0530, Anup Patel wrote: > > We add common riscv_fw_parent_hartid() which help device drivers > > to get parent hartid of the INTC (i.e. local interrupt controller) > > fwnode. Currently, this new function only supports device tree > > but it can be extended to support ACPI as well. > > > > Signed-off-by: Anup Patel > > --- > > arch/riscv/include/asm/processor.h | 3 +++ > > arch/riscv/kernel/cpu.c | 12 ++++++++++++ > > 2 files changed, 15 insertions(+) > > > > diff --git a/arch/riscv/include/asm/processor.h b/arch/riscv/include/as= m/processor.h > > index 94a0590c6971..6fb8bbec8459 100644 > > --- a/arch/riscv/include/asm/processor.h > > +++ b/arch/riscv/include/asm/processor.h > > @@ -77,6 +77,9 @@ struct device_node; > > int riscv_of_processor_hartid(struct device_node *node, unsigned long = *hartid); > > int riscv_of_parent_hartid(struct device_node *node, unsigned long *ha= rtid); > > > > +struct fwnode_handle; > > +int riscv_fw_parent_hartid(struct fwnode_handle *node, unsigned long *= hartid); > > + > > extern void riscv_fill_hwcap(void); > > extern int arch_dup_task_struct(struct task_struct *dst, struct task_s= truct *src); > > > > diff --git a/arch/riscv/kernel/cpu.c b/arch/riscv/kernel/cpu.c > > index 5de6fb703cc2..1adbe48b2b58 100644 > > --- a/arch/riscv/kernel/cpu.c > > +++ b/arch/riscv/kernel/cpu.c > > @@ -73,6 +73,18 @@ int riscv_of_parent_hartid(struct device_node *node,= unsigned long *hartid) > > return -1; > > } > > > > +/* Find hart ID of the CPU fwnode under which given fwnode falls. */ > > +int riscv_fw_parent_hartid(struct fwnode_handle *node, unsigned long *= hartid) > > +{ > > + /* > > + * Currently, this function only supports DT but it can be > > + * extended to support ACPI as well. > > + */ > > Statement of the obvious here, no? > Although, it seems a little odd to read this comment & the corresponding > statement in the commit message, when the series appears to have been > based on the ACPI? > > Perhaps by the time v4 comes around, ACPI support will have been merged > & that'll be moot. Yes, I was anyway going to update this in v4 to support both DT and ACPI. > > > + if (!is_of_node(node)) > > + return -EINVAL; > > + return riscv_of_parent_hartid(to_of_node(node), hartid); > > nit: blank line before the return here please. Okay, I will update. > > Thanks, > Conor. Regards, Anup