From patchwork Thu Jun 15 16:50:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 108658 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp790296vqr; Thu, 15 Jun 2023 10:13:46 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Roda1nL8QKPmvyrRLD/rdYD6Xya9wT0sbv8BEa5mDGxcGvwhbjeMB+aYfDEpIcN9/ukvL X-Received: by 2002:a17:903:2656:b0:1b3:cd90:79bb with SMTP id je22-20020a170903265600b001b3cd9079bbmr9985386plb.25.1686849225825; Thu, 15 Jun 2023 10:13:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686849225; cv=pass; d=google.com; s=arc-20160816; b=BkdKI7AxvYeCw1vzo1BR46tUsPBo4Hf9h/CoRiwfymxTpV4Xw+2Qkvd82Xg377FPR3 XRriKk05QRAcrIiVaKz4IgUhRqITtSmPRfoKy2EQpeLQgpECTWtn47IlrtcGcG/Jewcz hksBuNLkTUY+kqVW70zt9k2hA8scHinZA2Y+yssi1XYuBIzyZuA4Y3LL9Jo+eJ9rZzBS 71+z86kbdjO/PByBiQNmU9say6rvHIHwaOwxlMkzaL4Xk2yTJCauCjaTCUM0puzueqlD Lf+gpKIPlZKK9KlysWbhTN0MSHCm49fhlEloyA6zUYdWAxY3E7ciwvAhkrmtlNuCAiKs Z3zA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature:dkim-signature; bh=K48pbbaDvIU0qCx1fn2eZU+dBmyCQ+5LoqGBbasUvkc=; b=0fO93fcWHwBM8UBu+947OvxFgdSXKru3zSR/zInRAkeO8lpMw+LqJGfGYh4PM3LCLH GMBZ1OQOPm5MA3ThHq4r4OWTqiy4SM9Ncm6xsvUn5TifUzdnFus0saXfn7cnOnFxaKhY R1xd3D0m2PVHyg6ksDwciiBrUrVFyYwnPzG2oPYom1KapChglgvnNVvBYLvn83YVOJDV YqNI0VroQvdYlPt9i1zt7u0oU7ShsWtWWtIuUYI7GCtyfJ3sdmKWzLBzdSfeIiOPRMcC s9hkIG3yyZkRxcHCVu2jufOH/a4Zg0yd6Gbgoomnw88Uc/EhcNpI/gBDur/xT/oa7S0e ZAew== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gerhold.net header.s=strato-dkim-0002 header.b=TCjUsfHD; dkim=neutral (no key) header.i=@gerhold.net; arc=pass (i=1); 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 kt11-20020a170903088b00b001afe1f44c02si12649733plb.60.2023.06.15.10.13.31; Thu, 15 Jun 2023 10:13:45 -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=@gerhold.net header.s=strato-dkim-0002 header.b=TCjUsfHD; dkim=neutral (no key) header.i=@gerhold.net; arc=pass (i=1); 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 S238117AbjFOQvs (ORCPT + 99 others); Thu, 15 Jun 2023 12:51:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237283AbjFOQvN (ORCPT ); Thu, 15 Jun 2023 12:51:13 -0400 Received: from mo4-p03-ob.smtp.rzone.de (mo4-p03-ob.smtp.rzone.de [85.215.255.104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11726295C; Thu, 15 Jun 2023 09:51:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686847857; cv=none; d=strato.com; s=strato-dkim-0002; b=HII6CaEfPfY9I8npVL+uNhpzkGgJxJILSDFzzhD6gX1YuhRuzAX4bkjL728hK/umiT bvUpg+R6R9IFQpbQyGzvaKtR5TV+mU83J22I4ekkCg5iYkbW32/1DdiMS2v5w4mLZF7h J2SclRSdBW1/0DiDIbtXx8vCKgA04bTESF6o8vjWaVL4rODRX5zyeWagMUIitaOo6PvN csTDq0tNtenehr9zmy+Yvb4FZj0deo38k6CN/t8dVG0v3n3F0yHfTmwgykJqRWPQOfEI EAPETpEypVB7ov47ReQ4V6wBti1wD/sWkNmBuOr0ZLpzNJJCSZpNxo5R5arCfKpWoDGb PaPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1686847857; s=strato-dkim-0002; d=strato.com; h=Cc:To:In-Reply-To:References:Message-Id:Subject:Date:From:Cc:Date: From:Subject:Sender; bh=K48pbbaDvIU0qCx1fn2eZU+dBmyCQ+5LoqGBbasUvkc=; b=ZGTsCH8BU0+apnkqv1swsoM7HKPMLV5PZqnOuediPDM+4AyGcmlqZvp4xc2Dr4/HoX +/xJUOKZNhTMM6U92TZiw1UVlCB1Dw6+i3h8cZBm9MZNXyqBn7Fb4sIe2oWUpFs9fXrc v1OZqvrneP7H2ex3o1mi+KaIOfrR+bwz//hdIXACFXWSdhmmGQCjk5DPEZtsExALu07d KBzwb2p2o0bCNIuc63r0/Xm5pPmLkw4LtzQ3FtSj3CIP4rFLjqBNwsOnobn6rafw3RpY QRWuGqpoPPXoBqbm8TGAUrAO5m7cZmqdxqra6IPYbwiUJV+bhxiJ/2+m3KINIl6dGZTZ 5DfA== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo03 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1686847857; s=strato-dkim-0002; d=gerhold.net; h=Cc:To:In-Reply-To:References:Message-Id:Subject:Date:From:Cc:Date: From:Subject:Sender; bh=K48pbbaDvIU0qCx1fn2eZU+dBmyCQ+5LoqGBbasUvkc=; b=TCjUsfHDl+S9wgWEKYJ9omBYUgBagteqCuCxYTwX2EI9iY0OkGra18QCrB/dwceo5b L1J+dVRhjo9QbC3mPSfbrwPEoQMwiqGtqfwP6GG+kGoP21PnD+i81EFcYUVDHVC/6CXo 4hX7GPgs3OdGPgUL/L02RpOa2ek6KLm+8TbyMwM0kek7mz3E7DDVzk3zjsFCnZCSGJBA EC8kfXxescGtlum1UINyvcNuy6KznFUYuTe1IqNI7g2zWaC10IL4w5qWugn0bTNXxNzI BUlPgFftRxvIgXqPWC1qtM5gCqty7rScmt9/3BHj/2/Is8wun0xmXboE5dMv1VgbnLrE a4rA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1686847857; s=strato-dkim-0003; d=gerhold.net; h=Cc:To:In-Reply-To:References:Message-Id:Subject:Date:From:Cc:Date: From:Subject:Sender; bh=K48pbbaDvIU0qCx1fn2eZU+dBmyCQ+5LoqGBbasUvkc=; b=BOh5kB2C6FmxeBUbyxxpXFGfUftRHVBQhnq7FzCodRGvpC+9uZCQYbM+XM5nss7a/A nKgnqAROusBaMrOegvAw== X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVOQjVd4CteZ/7jYgS+mLFY+H0JAn9VOf59w==" Received: from [192.168.244.3] by smtp.strato.de (RZmta 49.6.0 DYNA|AUTH) with ESMTPSA id D0d0a8z5FGou42i (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Thu, 15 Jun 2023 18:50:56 +0200 (CEST) From: Stephan Gerhold Date: Thu, 15 Jun 2023 18:50:40 +0200 Subject: [PATCH v3 07/13] soc: qcom: smem: Add qcom_smem_is_available() MIME-Version: 1.0 Message-Id: <20230531-rpm-rproc-v3-7-a07dcdefd918@gerhold.net> References: <20230531-rpm-rproc-v3-0-a07dcdefd918@gerhold.net> In-Reply-To: <20230531-rpm-rproc-v3-0-a07dcdefd918@gerhold.net> To: Bjorn Andersson Cc: Andy Gross , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Mathieu Poirier , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org, Stephan Gerhold X-Mailer: b4 0.12.2 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, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768789613785859908?= X-GMAIL-MSGID: =?utf-8?q?1768789613785859908?= Avoid having to look up a dummy item from SMEM to detect if it is already available or if we need to defer probing. Reviewed-by: Konrad Dybcio Signed-off-by: Stephan Gerhold --- drivers/soc/qcom/smem.c | 11 +++++++++++ include/linux/soc/qcom/smem.h | 1 + 2 files changed, 12 insertions(+) diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c index b0d59e815c3b..29193151cf4c 100644 --- a/drivers/soc/qcom/smem.c +++ b/drivers/soc/qcom/smem.c @@ -359,6 +359,17 @@ static struct qcom_smem *__smem; /* Timeout (ms) for the trylock of remote spinlocks */ #define HWSPINLOCK_TIMEOUT 1000 +/** + * qcom_smem_is_available() - Check if SMEM is available + * + * Return: true if SMEM is available, false otherwise. + */ +bool qcom_smem_is_available(void) +{ + return !!__smem; +} +EXPORT_SYMBOL(qcom_smem_is_available); + static int qcom_smem_alloc_private(struct qcom_smem *smem, struct smem_partition *part, unsigned item, diff --git a/include/linux/soc/qcom/smem.h b/include/linux/soc/qcom/smem.h index 223db6a9c733..a36a3b9d4929 100644 --- a/include/linux/soc/qcom/smem.h +++ b/include/linux/soc/qcom/smem.h @@ -4,6 +4,7 @@ #define QCOM_SMEM_HOST_ANY -1 +bool qcom_smem_is_available(void); int qcom_smem_alloc(unsigned host, unsigned item, size_t size); void *qcom_smem_get(unsigned host, unsigned item, size_t *size);