Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp7276278rwp; Tue, 18 Jul 2023 12:43:53 -0700 (PDT) X-Google-Smtp-Source: APBJJlEFxYf1DcjfiemnLh01WqNBN83JUoiHO3Dq8n5ugH9VyQd6X1heQWx2R3f+Vz42VDfHjpFe X-Received: by 2002:a17:906:6487:b0:994:33b2:c32d with SMTP id e7-20020a170906648700b0099433b2c32dmr533163ejm.5.1689709432952; Tue, 18 Jul 2023 12:43:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689709432; cv=none; d=google.com; s=arc-20160816; b=R9w8y+7bHX04QnVSk3r2YPXpzIq34v74i02L0mCcC1rzTtmcByCiWyUhzyfbFKhRr/ 8cWmSz3efb8TWCfDPBlekGUPvnrOwCh6NHVk59SdSPV1RCIubpIpiNtyOugVzXVLSuPY EsRUQyMBDhovNvlCRLGL/hfPlLSgXPHe2PEzqTRd+naGhh6YTnnsKhrFt3xvVyOJcbmM 9hmSPqdQCJ2LIBoTIsnbt3U6aPQuzWeusugIrdS+f0YdUlaK3CjzSObB/6G3VB9Jnx1P owIC51hku+ylH0ggKq+lfy9W+yxLPmkAONZd6V27C6pyyJRUSch761wyoID+x5QEvqJ9 cPOQ== 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:dkim-signature; bh=YWDxOdiEo182qQTrdfRT1NqU4AQWgKjDTPUDJMk0vho=; fh=TULWyCF5Shn/VIlQb0eGRCImjMs1ZqpmrCsPq/qxVrE=; b=EEGp2e1AdC6w4TCckEU1AtbPTBEpvHLRKmwVGpGDsAxnb9qJPefKmCylHxn3XMJHKO R+VlhLEZXyGrL31jDpZX/O/7FGLiA9PnBABrk0t4ckaIZvZYoUhzCDAtPzlqdIOSR3qr dDOLTTN5qtBa4XB5miMu092YUjn/0RGoA6shbouYQn2oXzaHmuMb/TxTwNu+hpPEZ6Fw QwVjYCBXCbP8z+XdeU7alPhklyfiPmyIe52zkUmILOqoliugmf7/7OC+LlU+r25UZyuS FTTZjbKQeoJl4UgTVgNvhmzSQurow4t8zKt1d1G9tFwD+0S4+Q5YzVjqbp3W7vv/78vV VsKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oM+zaRth; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h5-20020a170906718500b0098d2f716c75si1762527ejk.597.2023.07.18.12.43.27; Tue, 18 Jul 2023 12:43:52 -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=@linaro.org header.s=google header.b=oM+zaRth; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230401AbjGRSms (ORCPT + 99 others); Tue, 18 Jul 2023 14:42:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229452AbjGRSmq (ORCPT ); Tue, 18 Jul 2023 14:42:46 -0400 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99B3CF0 for ; Tue, 18 Jul 2023 11:42:45 -0700 (PDT) Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-986d8332f50so783697466b.0 for ; Tue, 18 Jul 2023 11:42:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689705764; x=1692297764; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=YWDxOdiEo182qQTrdfRT1NqU4AQWgKjDTPUDJMk0vho=; b=oM+zaRthwE4f1r8MkTbNFtjNtHOKecZtu+MAMEo0rp8+TxOC3AczvBqG74Wq+XGe9z ayeOGgPv2iSjCSC8JS5AVBnqntVcodyk/VvMSJcBHxiwtRRRKP8HOHgSTxwGw9NsxM+m 5/ePv26ZjawWFhwQDjYTAvkA+/BdJCX7wz94mKhpWSUunUZJRDl68l6SlNJhOooMXDhK XkRWgjaFHT5joJWlLLpy1vAFUwgB5jnxpZgcLbNQSlwYyLWOfTzekB0N8u/VAYKEXkBM O2UgCYLq1kiV3oAlEcxVRALJhxZtPQPtsuXsq1zYPeIwAEO4NNkQvPK8g8kNcWcsinm3 3B2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689705764; x=1692297764; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=YWDxOdiEo182qQTrdfRT1NqU4AQWgKjDTPUDJMk0vho=; b=HUYpnfoEva0v6FeL7F51q6/IRMJo4INO0V29+wZGUiVNP7zI18Oi4N5vAMgHgNeYkC ODe/JM4jZUT0VqP0B9+LtEXUlq3pNjnD5GXz3/BtZyN9tVoIizDGWmomQG6723NfUCr/ 825LpWXu0oC/XpdMUvxpdO7e7PrIC91+vrNYDkSyZJlLWKrngWOIBmWF+R6BJMtmVXS4 qmoyqcd9qn8v/EfJrxw5ja1mHX0bxeCNkRipKzDIFhHl3Nf5Io5uKDfDkLSNPT+kwKPZ RKA49X6MH6W8i8LN1AYmiSqoUECIQYXWUFGzQU+Z9Lgm0EC4jMpb4ggwm/StkNRATou5 JsAw== X-Gm-Message-State: ABy/qLbR1wZ6Ti8H3fK6rs6ttiXq5hPfe3QkAw4C0slyp6CuD60tvst1 Aogr2AGOynK+EyCSJhcr0LA1SQ== X-Received: by 2002:a17:907:78cf:b0:994:2fa9:7444 with SMTP id kv15-20020a17090778cf00b009942fa97444mr641821ejc.42.1689705764057; Tue, 18 Jul 2023 11:42:44 -0700 (PDT) Received: from [192.168.1.20] ([178.197.223.104]) by smtp.gmail.com with ESMTPSA id rp25-20020a170906d97900b009786ae9ed50sm1309961ejb.194.2023.07.18.11.42.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 18 Jul 2023 11:42:43 -0700 (PDT) Message-ID: Date: Tue, 18 Jul 2023 20:42:41 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH 2/2] firmware: arm_scmi: Add qcom hvc/shmem transport Content-Language: en-US To: Nikunj Kela , sudeep.holla@arm.com Cc: cristian.marussi@arm.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org References: <20230718160833.36397-1-quic_nkela@quicinc.com> <20230718160833.36397-3-quic_nkela@quicinc.com> <3ae2d618-490a-06da-b4b6-b5a24b0a9747@quicinc.com> From: Krzysztof Kozlowski In-Reply-To: <3ae2d618-490a-06da-b4b6-b5a24b0a9747@quicinc.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, 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: X-Mailing-List: linux-kernel@vger.kernel.org On 18/07/2023 20:25, Nikunj Kela wrote: >>> + >>> + scmi_info = devm_kzalloc(dev, sizeof(*scmi_info), GFP_KERNEL); >>> + if (!scmi_info) >>> + return -ENOMEM; >>> + >>> + np = of_parse_phandle(cdev->of_node, "shmem", 0); >>> + if (!of_device_is_compatible(np, "arm,scmi-shmem")) >> You leak here reference. > Wouldn't the devm_* API take care of that implicitly? It is same in > smc.c as well. Thanks for bringing my attention to this. I sent a fix for smc.c. Fix your patch as well, please. >>> + return -ENXIO; >>> + >>> + ret = of_address_to_resource(np, 0, &res); >>> + of_node_put(np); >>> + if (ret) { >>> + dev_err(cdev, "failed to get SCMI Tx shared memory\n"); >>> + return ret; >>> + } >>> + >>> + size = resource_size(&res); >>> + >>> + /* let's map 2 additional ulong since >>> + * func-id & capability-id are kept after shmem. >>> + * +-------+ >>> + * | | >>> + * | shmem | >>> + * | | >>> + * | | >>> + * +-------+ <-- size >>> + * | funcId| >>> + * +-------+ <-- size + sizeof(ulong) >>> + * | capId | >>> + * +-------+ <-- size + 2*sizeof(ulong) >>> + */ >>> + >>> + scmi_info->shmem = devm_ioremap(dev, res.start, >>> + size + 2 * sizeof(unsigned long)); >>> + if (!scmi_info->shmem) { >>> + dev_err(dev, "failed to ioremap SCMI Tx shared memory\n"); >>> + return -EADDRNOTAVAIL; >>> + } >>> + >>> + func_id = readl((void *)(scmi_info->shmem) + size); >>> + >>> +#ifdef CONFIG_ARM64 >>> + cap_id = readq((void *)(scmi_info->shmem) + size + >>> + sizeof(unsigned long)); >>> +#else >>> + cap_id = readl((void *)(scmi_info->shmem) + size + >>> + sizeof(unsigned long)); >>> +#endif >>> + >>> + /* >>> + * If there is an interrupt named "a2p", then the service and >>> + * completion of a message is signaled by an interrupt rather than by >>> + * the return of the hvc call. >>> + */ >>> + irq = of_irq_get_byname(cdev->of_node, "a2p"); >>> + if (irq > 0) { >>> + ret = devm_request_irq(dev, irq, qcom_hvc_msg_done_isr, >>> + IRQF_NO_SUSPEND, >>> + dev_name(dev), scmi_info); >>> + if (ret) { >>> + dev_err(dev, "failed to setup SCMI completion irq\n"); >> return dev_err_probe, unless this is not called in probe... but then >> using devm-interface raises questions. > This is copied as is from existing smc.c I understand and I hope you understand the code you copied. If there is a bug in existing code, please do not copy it to new code (like leaking OF node reference). Best regards, Krzysztof