Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp7415180ioo; Fri, 3 Jun 2022 06:14:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4E+piAuhX7h91ESHpxWfDnATuRTkMVj8g3davGQKpyVEQWiHuRV+obtXgN2wOkuafzKxe X-Received: by 2002:a05:6402:2805:b0:42a:ea9b:e6a0 with SMTP id h5-20020a056402280500b0042aea9be6a0mr10557439ede.102.1654262099146; Fri, 03 Jun 2022 06:14:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654262099; cv=none; d=google.com; s=arc-20160816; b=QXn4csqXZPi+7aHtnixepLHWz6EJN8yVyG+s7iXO9+gw1oriNYbupueF+P7ilFDp3o fzQeRC9ANXbvGCUF/5xUdIwQsRGVcpNm0+7Kk/nIth9vJjIAceHmseud7/U1V78FnG0+ 20uxAqHxi4OYGwCchwabAuURtJW/cLKSqoK+51WfxYhEv4gqAzyxwvuGrDGEJeSz3mzK 2fP9UAqGH424xug1lACRE+7raLlETQJ+mp2lrvZMqaqKu8gd/824s0sUa56ZPTE104sA /BagfpxDF311le6/b/sduRAosyei5TJ9JXL30dNU6fDvDyumLgw7FdttyaNAnrsIfkhe 08fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=sH7JSvhzggcV3sAiPyuPfa/QmH5vQUDyIAwEYU+MsH8=; b=lPHAqaYd1lGCMceWElex7OvtP2Qii9vzltrRwyaDHvJjpT5TadexLZP+h4QYNo90oi WvXvXLMB+BePz2s6VY0azxl/h8wcHaW/pyoOOk2JWTod8GF5t8Vemzgk9qiu6vw+sjKS 1YeL+Ef6b1vnGrk+n/CD/KoeWD2JM6Bpe314d2tbwugMhWWLJoNkZTw72jzHonRk1YA9 rjUN8dQC7hjoG40npCzOKt1KNnActUIC5Py8WWmPlauSq8pOid1MN1pw+6ujr81LWP84 g8ZYh0/6WdBgg71nhQA/dA/PbdIhGD4Wfo0OExwx7EM394Yafuud4DAOoyOAsuUEH3xp C7aw== ARC-Authentication-Results: i=1; mx.google.com; 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 hz3-20020a1709072ce300b0070b822ea6d5si3954347ejc.460.2022.06.03.06.14.29; Fri, 03 Jun 2022 06:14:59 -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; 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 S239396AbiFBVHL (ORCPT + 99 others); Thu, 2 Jun 2022 17:07:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239370AbiFBVHJ (ORCPT ); Thu, 2 Jun 2022 17:07:09 -0400 Received: from smtp.smtpout.orange.fr (smtp07.smtpout.orange.fr [80.12.242.129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCC7C25E2 for ; Thu, 2 Jun 2022 14:07:07 -0700 (PDT) Received: from [192.168.1.18] ([90.11.190.129]) by smtp.orange.fr with ESMTPA id ws21nB6svvNzHws21nz3MA; Thu, 02 Jun 2022 23:07:04 +0200 X-ME-Helo: [192.168.1.18] X-ME-Auth: YWZlNiIxYWMyZDliZWIzOTcwYTEyYzlhMmU3ZiQ1M2U2MzfzZDfyZTMxZTBkMTYyNDBjNDJlZmQ3ZQ== X-ME-Date: Thu, 02 Jun 2022 23:07:04 +0200 X-ME-IP: 90.11.190.129 Message-ID: <82e9f075-0526-ac34-fa92-14a7402825fd@wanadoo.fr> Date: Thu, 2 Jun 2022 23:07:01 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v8 6/6] drivers: remoteproc: Add Xilinx r5 remoteproc driver Content-Language: fr To: tanmay.shah@xilinx.com Cc: ben.levinsky@xilinx.com, bjorn.andersson@linaro.org, devicetree@vger.kernel.org, krzk+dt@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org, mathieu.poirier@linaro.org, michal.simek@xilinx.com, openamp-system-reference@lists.openampproject.org, robh+dt@kernel.org References: <20220602203834.3675160-1-tanmay.shah@xilinx.com> <20220602203834.3675160-7-tanmay.shah@xilinx.com> From: Christophe JAILLET In-Reply-To: <20220602203834.3675160-7-tanmay.shah@xilinx.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 Hi, should there be a v9, a nitpick below. Le 02/06/2022 à 22:38, Tanmay Shah a écrit : > This driver enables r5f dual core Real time Processing Unit subsystem > available on Xilinx Zynq Ultrascale MPSoC Platform. RPU subsystem > (cluster) can be configured in different modes e.g. split mode in which > two r5f cores work independent of each other and lock-step mode in which > both r5f cores execute same code clock-for-clock and notify if the > result is different. > > The Xilinx r5 Remoteproc Driver boots the RPU cores via calls to the Xilinx > Platform Management Unit that handles the R5 configuration, memory access > and R5 lifecycle management. The interface to this manager is done in this > driver via zynqmp_pm_* function calls. > > Signed-off-by: Ben Levinsky > Signed-off-by: Tanmay Shah > --- > [...] > +static void zynqmp_r5_cluster_exit(void *data) > +{ > + struct platform_device *pdev = (struct platform_device *)data; > + struct zynqmp_r5_cluster *cluster; > + int i; > + > + cluster = (struct zynqmp_r5_cluster *)platform_get_drvdata(pdev); > + if (!cluster) > + return; > + > + for (i = 0; i < cluster->core_count; i++) { > + zynqmp_r5_core_exit(cluster->r5_cores[i]); > + cluster->r5_cores[i] = NULL; > + } > + > + kfree(cluster->r5_cores); > + kfree(cluster); why not remove this kfree(cluster) here... > + platform_set_drvdata(pdev, NULL); > +} > + > +/* > + * zynqmp_r5_remoteproc_probe() > + * > + * @pdev: domain platform device for R5 cluster > + * > + * called when driver is probed, for each R5 core specified in DT, > + * setup as needed to do remoteproc-related operations > + * > + * Return: 0 for success, negative value for failure. > + */ > +static int zynqmp_r5_remoteproc_probe(struct platform_device *pdev) > +{ > + int ret; > + struct zynqmp_r5_cluster *cluster; > + struct device *dev = &pdev->dev; > + > + cluster = kzalloc(sizeof(*cluster), GFP_KERNEL); ... devm_kzalloc() here... > + if (!cluster) > + return -ENOMEM; > + > + cluster->dev = dev; > + > + ret = devm_of_platform_populate(dev); > + if (ret) { > + dev_err_probe(dev, ret, "failed to populate platform dev\n"); > + kfree(cluster); > + return ret; and return dev_err_probe() here (without the kfree)? Would'nt it be cleaner? just my 2c CJ > + } > + > + /* wire in so each core can be cleaned up at driver remove */ > + platform_set_drvdata(pdev, cluster); > + > + ret = zynqmp_r5_cluster_init(cluster); > + if (ret) { > + zynqmp_r5_cluster_exit(pdev); > + dev_err_probe(dev, ret, "Invalid r5f subsystem device tree\n"); > + return ret; > + } > + > + ret = devm_add_action_or_reset(dev, zynqmp_r5_cluster_exit, pdev); > + if (ret) > + return ret; > + > + return 0; > +} > + [...]