Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4716742pxj; Wed, 12 May 2021 11:34:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6oYeJ+vTHOJ+CAGuSoaJkqg74hcpsR+UYMeNaT/kYJe26sqChHKbCMHVNxUQD1eurF/ff X-Received: by 2002:a17:906:6bd2:: with SMTP id t18mr37790814ejs.98.1620844384438; Wed, 12 May 2021 11:33:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620844384; cv=none; d=google.com; s=arc-20160816; b=e8BgmMlM+l5F+Dx2ObdVYUpDOQekodzvS1dPxc8oC5yLi/3g2C/GdPhUKyUld2tDhm xJke1tZARdJ2T9HmisKG2eywS1MW4AWhyzOwGS7JdSeg9IuqWCNUsYZLEnuPUkHgeMXi msgMLv+XDgc993b924dd4KllkWREErY/x3gCGYIL/g6hHErjYIzxc5HoBEyp+PTD7n4E QzZkwkonRb1s4Zv7BDJp3/dSu7nNfkQrWBCW13WMn3q/CTYEGVCrlH5an2h1cn6s0K2G tBQqvukQI+0J9+JTM5sirQEocR2ztgDoEg1r4eMqPWU3sz3tiNunk8ggzrx2/nSUcFs+ 3DlQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jmD0nJqRjGp6M7vuXgsHGO4O7rNOKtUe+RzaJyq2ID8=; b=k4e8QbazfMmW88J0Kh2NHAkJC1dugJgEScIE79LcRrohpkeKf1OjJRrqzKlCUUNoBY BbyNXHeU2J/HPWDv33n+v/Etj4fHAdEpunltCHI3QCzvSlr1W0Lhz3TAfIDoZvTgGKFt iOm7FNPl57q8DKXmeg7WKtruN9XcqI7UO8A7UvV3XUjU+wgyJc2disVg3f8hfqr/8ZLl ui8dim0R8r57YIXZWwU4qLssd8EYzzJRjx4bsJh+qjR0ARV/FgNWXwwNNLQwqcbVFfda 8Zf4cVaPTbLJKyq7kxHwytr3gy/SU0sRm8ivw8pBynB+AxV/aJCzJgZqo+5q89wvE98I ed6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=T1WWeej3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id eb8si583654edb.49.2021.05.12.11.32.40; Wed, 12 May 2021 11:33:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=T1WWeej3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241952AbhELSbC (ORCPT + 99 others); Wed, 12 May 2021 14:31:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:56996 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243119AbhELQgs (ORCPT ); Wed, 12 May 2021 12:36:48 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D083761CC5; Wed, 12 May 2021 16:00:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620835248; bh=UpNsoPznGotp0Nzx3xolEyExjEOP0WI4IAsawjketSQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T1WWeej3E8orh4xGj0wj9E2cNp2oqi1exdZ2NsRuaWpCxnWrg4dr4UCVaxddxH5GA UOu9VlvTHPeBIYK13xlUyqb2aYVUw5MKRVCBgbTzO3K1Hi1xXQz1sKawexKWYJYeUS xzLNMfAVCuWZgN/gefKyjywTSPEctyxiZ/TnoZzQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Elliot Berman , Brian Masney , Stephan Gerhold , Jeffrey Hugo , Douglas Anderson , Stephen Boyd , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.12 260/677] firmware: qcom_scm: Workaround lack of "is available" call on SC7180 Date: Wed, 12 May 2021 16:45:06 +0200 Message-Id: <20210512144845.876723193@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144837.204217980@linuxfoundation.org> References: <20210512144837.204217980@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stephen Boyd [ Upstream commit 257f2935cbbf14b16912c635fcd8ff43345c953b ] Some SC7180 firmwares don't implement the QCOM_SCM_INFO_IS_CALL_AVAIL API, so we can't probe the calling convention. We detect the legacy calling convention on these firmwares, because the availability call always fails and legacy is the fallback. This leads to problems where the rmtfs driver fails to probe, because it tries to assign memory with a bad calling convention, which then leads to modem failing to load and all networking, even wifi, to fail. Ouch! Let's force the calling convention to be what it always is on this SoC, i.e. arm64. Of course, the calling convention is not the same thing as implementing the QCOM_SCM_INFO_IS_CALL_AVAIL API. The absence of the "is this call available" API from the firmware means that any call to __qcom_scm_is_call_available() fails. This is OK for now though because none of the calls that are checked for existence are implemented on firmware running on sc7180. If such a call needs to be checked for existence in the future, we presume that firmware will implement this API and then things will "just work". Cc: Elliot Berman Cc: Brian Masney Cc: Stephan Gerhold Cc: Jeffrey Hugo Cc: Douglas Anderson Fixes: 9a434cee773a ("firmware: qcom_scm: Dynamically support SMCCC and legacy conventions") Signed-off-by: Stephen Boyd Link: https://lore.kernel.org/r/20210223214539.1336155-4-swboyd@chromium.org Signed-off-by: Bjorn Andersson Signed-off-by: Sasha Levin --- drivers/firmware/qcom_scm.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c index 21e07a464bd9..9ac84b5d6ce0 100644 --- a/drivers/firmware/qcom_scm.c +++ b/drivers/firmware/qcom_scm.c @@ -131,6 +131,7 @@ static enum qcom_scm_convention __get_convention(void) struct qcom_scm_res res; enum qcom_scm_convention probed_convention; int ret; + bool forced = false; if (likely(qcom_scm_convention != SMC_CONVENTION_UNKNOWN)) return qcom_scm_convention; @@ -144,6 +145,18 @@ static enum qcom_scm_convention __get_convention(void) if (!ret && res.result[0] == 1) goto found; + /* + * Some SC7180 firmwares didn't implement the + * QCOM_SCM_INFO_IS_CALL_AVAIL call, so we fallback to forcing ARM_64 + * calling conventions on these firmwares. Luckily we don't make any + * early calls into the firmware on these SoCs so the device pointer + * will be valid here to check if the compatible matches. + */ + if (of_device_is_compatible(__scm ? __scm->dev->of_node : NULL, "qcom,scm-sc7180")) { + forced = true; + goto found; + } + probed_convention = SMC_CONVENTION_ARM_32; ret = __scm_smc_call(NULL, &desc, probed_convention, &res, true); if (!ret && res.result[0] == 1) @@ -154,8 +167,9 @@ found: spin_lock_irqsave(&scm_query_lock, flags); if (probed_convention != qcom_scm_convention) { qcom_scm_convention = probed_convention; - pr_info("qcom_scm: convention: %s\n", - qcom_scm_convention_names[qcom_scm_convention]); + pr_info("qcom_scm: convention: %s%s\n", + qcom_scm_convention_names[qcom_scm_convention], + forced ? " (forced)" : ""); } spin_unlock_irqrestore(&scm_query_lock, flags); -- 2.30.2