Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4596926pxj; Wed, 12 May 2021 08:57:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKhTvMQbgFKlR2pWkaCA+VQ5JNZmzX+4MPv1aJNDwxP64w3/gcC/3hKCFIoFVWnRJsLSRB X-Received: by 2002:a05:6402:2550:: with SMTP id l16mr44412319edb.249.1620835029608; Wed, 12 May 2021 08:57:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620835029; cv=none; d=google.com; s=arc-20160816; b=wyXDOkEuZZNPL9o7ylvv3/Khuv+eKK+aWbCdC5aM9BGYID0PcK1Gd7wQQjmdcO7wUR 4nW0RYXCUBYrULFZZ4NtGi3AFIL400syYiKtf3MfRMP5XUa7mhKhDlcHHOe3KCKT/+fP sh/MHqX0JeDuyBbPloIlJxxs7/jlZW9HcXWDJv+juJgw3YUR9VfxB1lLbII/qpvgBrAY RDQhYjOApyrHybIMSdthxvfQzsCmVBeIw8wBcJocoh9t8wo1TdvYxj+nooTYxlYIMnml 7H9M9bxwBxIcGSf/scfrlw5mfTq8lKXPuG5/qAyn7Yg2avu6XmrvPS88b0CpGqsKf4QR niIg== 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=RLNF3IfJ6GQrV4HDWNiJy510NSaixWh2Iiz8q6XZ+aQ=; b=u4aN8kMPbM4zD2hxSGbBLt+5KqbIk5HYl8GwnEc6HDkdjG/HRBh8ifp34ayVml63xu vFb9/KhbRQWzE5IRTmgczuKCrNY0Mv2DBJXXrHXCgg0IDwBEt6Jo7YHXWEhKppihs5nd jLaQnpGl+Z4cNbjKAG5CLnRdL0Qk7ZO7NDsDTW1X+kWm58/Wbpa9ELYpylSKj5Ile5Qm MuimoFCVLlw8fAjXVzHWJjEcGjJ7XeTqUfQoyIOHlRZSC020Mx0PviK7NxAJ2dltOD17 DSj7VzRPWf6o8G6sFZq4yKh7Pb00Qmn/tDiExNbHx/lxF2PknCuwY/HI5O0AFxv4wuEu Ad2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mTQtHRxt; 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 r12si122883edp.101.2021.05.12.08.56.39; Wed, 12 May 2021 08:57:09 -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=mTQtHRxt; 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 S232535AbhELPxG (ORCPT + 99 others); Wed, 12 May 2021 11:53:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:40954 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234909AbhELPZy (ORCPT ); Wed, 12 May 2021 11:25:54 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3EAC261606; Wed, 12 May 2021 15:10:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832256; bh=SFsEdzgUCHwvpU+fpW+I16Oy+MkLtZXnhsQTC7kfIpw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mTQtHRxt7q7Qc17BUWH92kYvivPuFt/0OjRxPDx2EcM9IIV5I3jzKLKMOYerVGiD0 leoe65cEhPLkXJhw8GVZhqY8pm5BULLL2QxvOwwOoV6HIr9YkNh2JjwVOFUqta7kqE s1D3nGuaG0ZgxwKdxPSN8XeP4eBoQPG7GU1v6LpA= 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.10 205/530] firmware: qcom_scm: Workaround lack of "is available" call on SC7180 Date: Wed, 12 May 2021 16:45:15 +0200 Message-Id: <20210512144826.582522217@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@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 a455c22bcdbd..c5b20bdc08e9 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