Message ID | 20230719113542.2293295-3-apatel@ventanamicro.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp2395272vqt; Wed, 19 Jul 2023 05:18:32 -0700 (PDT) X-Google-Smtp-Source: APBJJlFqbwJeOZQoGKVll9QFngYAYlkw99FB9vwlu3jo8EHaCSUp9D2wPY9K4Q7XaN5hd6Xmj09b X-Received: by 2002:a17:906:10d2:b0:98e:16b7:e038 with SMTP id v18-20020a17090610d200b0098e16b7e038mr2538793ejv.23.1689769112349; Wed, 19 Jul 2023 05:18:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689769112; cv=none; d=google.com; s=arc-20160816; b=W337b2XvG9vyOv8G45UMRyNWuW/GUJTuz4AfP6Zx5TfvbRXR/HtjWjpvXYRB63r+qv znBKbbPFIROtADejg30iCVGAVdFAoahpWCoCtoJZMHk4jrYtEVq3kvWzhuDmYXXVkbdD PyZ2gpAaLIQiOapT8tTS8PbSkxI6xGoXleZvbke3q4mkx1cmejH88qgmSEaCnYQAXvds IBo/kgPxDPUHC28oCds5j17bEnmXVqwpKMiN0/ON+qB7GdWCg5T7RWaaukowI9OZfCpT xRPv035Rp5FsA3/6a4rcUqA/t30AcUD1TmMg4AONCvBCDyVeHr6Ku9zhCYJ39vc8jF/N 83XQ== 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=ASJ6N1f2HtTSaai3pJY5ayecgWjGnn9m1BypIphubd8=; fh=f+ph7VIwhX7iLJOrfHJ1YQ1ojo0XBG5+jaAb/hL4mCY=; b=LDVRLzWou2pOq6jh1KyQbccmUC4SqtxkU30dmUxkCD5JnokyoBRXknRKqTlEw2N7HW wFLrBSbGmaTvQ9Cocdm1i4cHKmQ7twPo635KSWvlKG97eoW8aihk/ZRmvvhPrTNTOpS8 M+8hiQq2kFAgCs/msAzi4tQrj67lZTsKivr79Atk1eKU/zkuvA0M3zdGqkwpfImZ2cWl RXMdOTT9i0Vjz9qJZPNG7sT5npKEe+4/2PHgscXOwiXJeYfUIXv8Xx+55BWktjTgfaua aAN/LD5Fj4pS3cDHkStgPEn4rc4H2s1VPOBbtPPbTVdcnWVmDYtd9caYqYv2qpg6Mz0z 5kzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=FNUJTTod; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jr1-20020a170906a98100b00992c7f7356dsi3007036ejb.8.2023.07.19.05.18.08; Wed, 19 Jul 2023 05:18:32 -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=FNUJTTod; 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 S229847AbjGSLgL (ORCPT <rfc822;assdfgzxcv4@gmail.com> + 99 others); Wed, 19 Jul 2023 07:36:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230086AbjGSLgH (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 19 Jul 2023 07:36:07 -0400 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6832F170E for <linux-kernel@vger.kernel.org>; Wed, 19 Jul 2023 04:36:05 -0700 (PDT) Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-666edfc50deso508384b3a.0 for <linux-kernel@vger.kernel.org>; Wed, 19 Jul 2023 04:36:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1689766565; x=1690371365; 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=ASJ6N1f2HtTSaai3pJY5ayecgWjGnn9m1BypIphubd8=; b=FNUJTTod8d8lkD0j2EWesqH3a2UI3TMHlDsCBF6GwyZAmOkXqcKEwV7u2/cVonYeiR LtQRO9edVmljFnQKOqJNIrd/xe/R1sZZY6PKCdm7l8CcXkLO6A6iBBF0RnhZVFiBd8mc GykZ3jM3Fzm8Ki7dKbZCksXdykfCpHEuNvd9ISOUhYa7AA9t5Ur7F+PhTagSyDzVY0YL nAdfgFdS9Plri5I+ku5NEbfrmRLqqU8vDErM99MLo9OJGBN1a6ecXpUCbScUtYV2Z8iD 3TfS7WUMdTk+iEHmSEo09Vbj5bGCfWrfXuGhWNZxFCOnVEWA+eQS0RnS2dZu9bj4BK1R CEKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689766565; x=1690371365; 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=ASJ6N1f2HtTSaai3pJY5ayecgWjGnn9m1BypIphubd8=; b=QGI9/mKNPo/u8acCEcVzSm/+r5Q+0aELF+EuC+pdm9UQmBqHDn6lni+/38XucUBl7d WQXCOWIifyoYx8vHKgNvjstp2berfmOXKm/9QJui4+44Zjp8UoaoyUxtY81SoGjXQqcb WA1zNqBVgfSRa3S3ErKtfo3VFO685NYeIjrR250DTpB0jm3dF5QTCotIm3ah1DYvgLgQ KMgDdi2m5I9gJ2sDy21eBk7gxbUoCEJPwUIm754peeauQAVgoojzW6HanIkM7U+AwNv5 HVyB2LxU/SLwpRIMB0AUh5kpujHnhHnRXKkzGvHFj49qNLTvj3tiMgVfrurXAhSQ2ZBy TiNg== X-Gm-Message-State: ABy/qLZIC+BKzVJSgw7XTJndH7ReIVKcVgrXfrKXdvjbn19Au/4/FbhN HMJwc2JRN52/wyd27QLVxlJ8YA== X-Received: by 2002:a05:6a20:430f:b0:f0:50c4:4c43 with SMTP id h15-20020a056a20430f00b000f050c44c43mr2313038pzk.5.1689766564723; Wed, 19 Jul 2023 04:36:04 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([171.76.86.130]) by smtp.gmail.com with ESMTPSA id j10-20020aa783ca000000b00669c99d05fasm3050408pfn.150.2023.07.19.04.35.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jul 2023 04:36:04 -0700 (PDT) From: Anup Patel <apatel@ventanamicro.com> To: Palmer Dabbelt <palmer@dabbelt.com>, Paul Walmsley <paul.walmsley@sifive.com>, Thomas Gleixner <tglx@linutronix.de>, Marc Zyngier <maz@kernel.org>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Frank Rowand <frowand.list@gmail.com>, Conor Dooley <conor+dt@kernel.org> Cc: Atish Patra <atishp@atishpatra.org>, Andrew Jones <ajones@ventanamicro.com>, Sunil V L <sunilvl@ventanamicro.com>, Saravana Kannan <saravanak@google.com>, Anup Patel <anup@brainfault.org>, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Anup Patel <apatel@ventanamicro.com> Subject: [PATCH v6 02/14] of: property: Add fw_devlink support for msi-parent Date: Wed, 19 Jul 2023 17:05:30 +0530 Message-Id: <20230719113542.2293295-3-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230719113542.2293295-1-apatel@ventanamicro.com> References: <20230719113542.2293295-1-apatel@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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_BLOCKED, 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771851336666337255 X-GMAIL-MSGID: 1771851336666337255 |
Series |
Linux RISC-V AIA Support
|
|
Commit Message
Anup Patel
July 19, 2023, 11:35 a.m. UTC
This allows fw_devlink to create device links between consumers of
a MSI and the supplier of the MSI.
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
---
drivers/of/property.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
Comments
On Wed, Jul 19, 2023 at 4:36 AM Anup Patel <apatel@ventanamicro.com> wrote: > > This allows fw_devlink to create device links between consumers of > a MSI and the supplier of the MSI. > > Signed-off-by: Anup Patel <apatel@ventanamicro.com> > --- > drivers/of/property.c | 32 ++++++++++++++++++++++++++++++++ > 1 file changed, 32 insertions(+) > > diff --git a/drivers/of/property.c b/drivers/of/property.c > index ddc75cd50825..e4096b79a872 100644 > --- a/drivers/of/property.c > +++ b/drivers/of/property.c > @@ -1325,6 +1325,37 @@ static struct device_node *parse_interrupts(struct device_node *np, > return of_irq_parse_one(np, index, &sup_args) ? NULL : sup_args.np; > } > > +static struct device_node *parse_msi_parent(struct device_node *np, > + const char *prop_name, int index) > +{ > + struct of_phandle_args sup_args; > + struct device_node *msi_np; > + > + if (!IS_ENABLED(CONFIG_OF_IRQ)) > + return NULL; > + > + if (strcmp(prop_name, "msi-parent")) > + return NULL; > + > + msi_np = of_parse_phandle(np, prop_name, 0); > + if (msi_np) { > + if (!of_property_read_bool(msi_np, "#msi-cells")) { > + if (index) { > + of_node_put(msi_np); > + return NULL; > + } > + return msi_np; > + } > + of_node_put(msi_np); > + } > + > + if (of_parse_phandle_with_args(np, prop_name, "#msi-cells", index, > + &sup_args)) > + return NULL; > + > + return sup_args.np; > +} > + I'm amazed by the different ways you choose to waste people's time. Did you even scroll up to see how the other properties are handled? Why can't this be handled using DEFINE_SIMPLE_PROP macro? -Saravana > static const struct supplier_bindings of_supplier_bindings[] = { > { .parse_prop = parse_clocks, }, > { .parse_prop = parse_interconnects, }, > @@ -1359,6 +1390,7 @@ static const struct supplier_bindings of_supplier_bindings[] = { > { .parse_prop = parse_regulators, }, > { .parse_prop = parse_gpio, }, > { .parse_prop = parse_gpios, }, > + { .parse_prop = parse_msi_parent, }, > {} > }; > > -- > 2.34.1 >
On Wed, Jul 19, 2023 at 05:05:30PM +0530, Anup Patel wrote: > This allows fw_devlink to create device links between consumers of > a MSI and the supplier of the MSI. > > Signed-off-by: Anup Patel <apatel@ventanamicro.com> > --- > drivers/of/property.c | 32 ++++++++++++++++++++++++++++++++ > 1 file changed, 32 insertions(+) > > diff --git a/drivers/of/property.c b/drivers/of/property.c > index ddc75cd50825..e4096b79a872 100644 > --- a/drivers/of/property.c > +++ b/drivers/of/property.c > @@ -1325,6 +1325,37 @@ static struct device_node *parse_interrupts(struct device_node *np, > return of_irq_parse_one(np, index, &sup_args) ? NULL : sup_args.np; > } > > +static struct device_node *parse_msi_parent(struct device_node *np, > + const char *prop_name, int index) > +{ > + struct of_phandle_args sup_args; > + struct device_node *msi_np; > + > + if (!IS_ENABLED(CONFIG_OF_IRQ)) > + return NULL; Why do we need this? Sparc is not going to have MSI properties to begin with. I guess it saves a little bit of code. Though Sparc doesn't need any of this file. Or maybe there's a better kconfig symbol to use here if MSIs are not supported? > + > + if (strcmp(prop_name, "msi-parent")) > + return NULL; > + > + msi_np = of_parse_phandle(np, prop_name, 0); > + if (msi_np) { > + if (!of_property_read_bool(msi_np, "#msi-cells")) { > + if (index) { > + of_node_put(msi_np); > + return NULL; > + } > + return msi_np; > + } > + of_node_put(msi_np); > + } > + > + if (of_parse_phandle_with_args(np, prop_name, "#msi-cells", index, > + &sup_args)) > + return NULL; > + > + return sup_args.np; > +} > + > static const struct supplier_bindings of_supplier_bindings[] = { > { .parse_prop = parse_clocks, }, > { .parse_prop = parse_interconnects, }, > @@ -1359,6 +1390,7 @@ static const struct supplier_bindings of_supplier_bindings[] = { > { .parse_prop = parse_regulators, }, > { .parse_prop = parse_gpio, }, > { .parse_prop = parse_gpios, }, > + { .parse_prop = parse_msi_parent, }, > {} > }; > > -- > 2.34.1 >
On Thu, Jul 20, 2023 at 3:55 AM Saravana Kannan <saravanak@google.com> wrote: > > On Wed, Jul 19, 2023 at 4:36 AM Anup Patel <apatel@ventanamicro.com> wrote: > > > > This allows fw_devlink to create device links between consumers of > > a MSI and the supplier of the MSI. > > > > Signed-off-by: Anup Patel <apatel@ventanamicro.com> > > --- > > drivers/of/property.c | 32 ++++++++++++++++++++++++++++++++ > > 1 file changed, 32 insertions(+) > > > > diff --git a/drivers/of/property.c b/drivers/of/property.c > > index ddc75cd50825..e4096b79a872 100644 > > --- a/drivers/of/property.c > > +++ b/drivers/of/property.c > > @@ -1325,6 +1325,37 @@ static struct device_node *parse_interrupts(struct device_node *np, > > return of_irq_parse_one(np, index, &sup_args) ? NULL : sup_args.np; > > } > > > > +static struct device_node *parse_msi_parent(struct device_node *np, > > + const char *prop_name, int index) > > +{ > > + struct of_phandle_args sup_args; > > + struct device_node *msi_np; > > + > > + if (!IS_ENABLED(CONFIG_OF_IRQ)) > > + return NULL; > > + > > + if (strcmp(prop_name, "msi-parent")) > > + return NULL; > > + > > + msi_np = of_parse_phandle(np, prop_name, 0); > > + if (msi_np) { > > + if (!of_property_read_bool(msi_np, "#msi-cells")) { > > + if (index) { > > + of_node_put(msi_np); > > + return NULL; > > + } > > + return msi_np; > > + } > > + of_node_put(msi_np); > > + } > > + > > + if (of_parse_phandle_with_args(np, prop_name, "#msi-cells", index, > > + &sup_args)) > > + return NULL; > > + > > + return sup_args.np; > > +} > > + > > I'm amazed by the different ways you choose to waste people's time. > Did you even scroll up to see how the other properties are handled? > > Why can't this be handled using DEFINE_SIMPLE_PROP macro? DEFINE_SIMPLE_PROP() is not suitable for msi-parent because we have a special case where for a single MSI parent the "#msi-cells" property won't be present in the supplier DT node. The of_msi_get_domain() function also handles this special case separately. Regards, Anup > > -Saravana > > > static const struct supplier_bindings of_supplier_bindings[] = { > > { .parse_prop = parse_clocks, }, > > { .parse_prop = parse_interconnects, }, > > @@ -1359,6 +1390,7 @@ static const struct supplier_bindings of_supplier_bindings[] = { > > { .parse_prop = parse_regulators, }, > > { .parse_prop = parse_gpio, }, > > { .parse_prop = parse_gpios, }, > > + { .parse_prop = parse_msi_parent, }, > > {} > > }; > > > > -- > > 2.34.1 > >
On Thu, Jul 20, 2023 at 4:08 AM Rob Herring <robh@kernel.org> wrote: > > On Wed, Jul 19, 2023 at 05:05:30PM +0530, Anup Patel wrote: > > This allows fw_devlink to create device links between consumers of > > a MSI and the supplier of the MSI. > > > > Signed-off-by: Anup Patel <apatel@ventanamicro.com> > > --- > > drivers/of/property.c | 32 ++++++++++++++++++++++++++++++++ > > 1 file changed, 32 insertions(+) > > > > diff --git a/drivers/of/property.c b/drivers/of/property.c > > index ddc75cd50825..e4096b79a872 100644 > > --- a/drivers/of/property.c > > +++ b/drivers/of/property.c > > @@ -1325,6 +1325,37 @@ static struct device_node *parse_interrupts(struct device_node *np, > > return of_irq_parse_one(np, index, &sup_args) ? NULL : sup_args.np; > > } > > > > +static struct device_node *parse_msi_parent(struct device_node *np, > > + const char *prop_name, int index) > > +{ > > + struct of_phandle_args sup_args; > > + struct device_node *msi_np; > > + > > + if (!IS_ENABLED(CONFIG_OF_IRQ)) > > + return NULL; > > Why do we need this? Sparc is not going to have MSI properties to begin > with. I guess it saves a little bit of code. Though Sparc doesn't need > any of this file. Or maybe there's a better kconfig symbol to use here > if MSIs are not supported? I can't think of a better kconfig symbol over here but since Sparc does not have MSI properties, I think following is better: if (IS_ENABLED(CONFIG_SPARC)) return NULL; Any other suggestions ? Regards, Anup > > > + > > + if (strcmp(prop_name, "msi-parent")) > > + return NULL; > > + > > + msi_np = of_parse_phandle(np, prop_name, 0); > > + if (msi_np) { > > + if (!of_property_read_bool(msi_np, "#msi-cells")) { > > + if (index) { > > + of_node_put(msi_np); > > + return NULL; > > + } > > + return msi_np; > > + } > > + of_node_put(msi_np); > > + } > > + > > + if (of_parse_phandle_with_args(np, prop_name, "#msi-cells", index, > > + &sup_args)) > > + return NULL; > > + > > + return sup_args.np; > > +} > > + > > static const struct supplier_bindings of_supplier_bindings[] = { > > { .parse_prop = parse_clocks, }, > > { .parse_prop = parse_interconnects, }, > > @@ -1359,6 +1390,7 @@ static const struct supplier_bindings of_supplier_bindings[] = { > > { .parse_prop = parse_regulators, }, > > { .parse_prop = parse_gpio, }, > > { .parse_prop = parse_gpios, }, > > + { .parse_prop = parse_msi_parent, }, > > {} > > }; > > > > -- > > 2.34.1 > >
diff --git a/drivers/of/property.c b/drivers/of/property.c index ddc75cd50825..e4096b79a872 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -1325,6 +1325,37 @@ static struct device_node *parse_interrupts(struct device_node *np, return of_irq_parse_one(np, index, &sup_args) ? NULL : sup_args.np; } +static struct device_node *parse_msi_parent(struct device_node *np, + const char *prop_name, int index) +{ + struct of_phandle_args sup_args; + struct device_node *msi_np; + + if (!IS_ENABLED(CONFIG_OF_IRQ)) + return NULL; + + if (strcmp(prop_name, "msi-parent")) + return NULL; + + msi_np = of_parse_phandle(np, prop_name, 0); + if (msi_np) { + if (!of_property_read_bool(msi_np, "#msi-cells")) { + if (index) { + of_node_put(msi_np); + return NULL; + } + return msi_np; + } + of_node_put(msi_np); + } + + if (of_parse_phandle_with_args(np, prop_name, "#msi-cells", index, + &sup_args)) + return NULL; + + return sup_args.np; +} + static const struct supplier_bindings of_supplier_bindings[] = { { .parse_prop = parse_clocks, }, { .parse_prop = parse_interconnects, }, @@ -1359,6 +1390,7 @@ static const struct supplier_bindings of_supplier_bindings[] = { { .parse_prop = parse_regulators, }, { .parse_prop = parse_gpio, }, { .parse_prop = parse_gpios, }, + { .parse_prop = parse_msi_parent, }, {} };