Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2714837pxb; Tue, 23 Feb 2021 13:50:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJxwtIF0FP0HFRFq23+nxn/pNWT84byJbcXhQsMIfFr/BqbbEK5yX1S7W22bEXpa5ndA1ex2 X-Received: by 2002:a17:906:a147:: with SMTP id bu7mr17529716ejb.383.1614117006027; Tue, 23 Feb 2021 13:50:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614117006; cv=none; d=google.com; s=arc-20160816; b=gimbrGJwmq2R7emYzrbRbohlyO+Ld3Lp807SGgfCt8jBdli351MGbUlq80j6aC+6RB p8eddpWunF/1FMZrYDcaWvwNoj/njnX/5ON1Rec5mMr07+RrNaBWyjmrcXbpzbsHeOZL gk9oUhhFjBieITlB2QmhUU6XIXKA3kpoAH966/Et5pKLiaat1ndZBNI5rbfENup9RMxw 1BlfofXp8sRXViJZzCVwJEvGoeMgpVeHOwRTLCkg091WWPQ4MoOxtRKgjM5YZeteQDWf l55dnLkHUlvvWvqEpDEbaC13Nk4omZyW+oEToFDOFamPpoEF82pwbW6j1zn3PoBGBn90 rx7w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tqWQhT3LjBz5MByIC+aXJToZ1jZ2b58/ZuDpVrbD+Uo=; b=GN+Ztg7dXGEqsPXHJWmW91KdzQA4spBiZGS+KAZhgnoUgvY12MqEYIeOMpvZrIT7SH /U4W+BEDtzG1xqTZq30mVZql5vqG8bwKGTrA1QtM8Nnc7ZOVXVR2YnCB+AxFvkOTpbMe siexckqEixok9aPFtyN/9OkKMpjFAnFehstacHOqbXuLU3xugSjc9fLd6wfpOKVg//t+ JzLTdXG3GrzZlMRvBnVHzVGZek4+niLLMkHyVpNhzA6fHYyc6y1yNSVvigruwsPk4WcN eM/wVG8K1BtIl8+lVaAh75d0QCO+Do8AFb9bKugDQux7xS5jgKIDvgfhrvAaAt452yAU fO+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="Y/jL/5Nh"; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bi18si40603ejb.369.2021.02.23.13.49.41; Tue, 23 Feb 2021 13:50:06 -0800 (PST) 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=@chromium.org header.s=google header.b="Y/jL/5Nh"; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232450AbhBWVrF (ORCPT + 99 others); Tue, 23 Feb 2021 16:47:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231969AbhBWVrC (ORCPT ); Tue, 23 Feb 2021 16:47:02 -0500 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C45AC061793 for ; Tue, 23 Feb 2021 13:45:45 -0800 (PST) Received: by mail-pf1-x42b.google.com with SMTP id v200so1250895pfc.0 for ; Tue, 23 Feb 2021 13:45:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tqWQhT3LjBz5MByIC+aXJToZ1jZ2b58/ZuDpVrbD+Uo=; b=Y/jL/5NhCl6kU+DaTLgVV6B8EkXtSb37eblUKcVW8JjbDaqdAo6oQ6glZf3vUe+i+N 9j9IM24PzKejIsunuWX5gdlecz8ZDBWOgV3zYKDJlChOfRinURMmxSZE1bWB7JSbP0wO 2yGti4I1CX8vc8Szvs6L+bsxKCtk0rzj7C9Qc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tqWQhT3LjBz5MByIC+aXJToZ1jZ2b58/ZuDpVrbD+Uo=; b=Zq++wA8VVTd47S0sVrR35WGmPbHA6S3OEgQ/m+KesVkhWk+uiy6nilgoRB0KU5ygX4 CUYDArbf2fqHMCQRfz9a7rrVbG8Dj/bpQwzwUGAORVqlyFBdZr+zyyLBONZQMNq+oX4+ AUxYe9oGPZnVL+ctJDznTeTt1FgEIm6+LVT4aRk9YucqkEAohGfvwhLbJ/3WslO3OpUC jJD9YDUAk9r94Nv56RKsZv8LkASshIEFgsvpF5CRTtfoHSbWDGzrc5tNk6dIuw2vOvZT nMoaJIy45C6Zh7WvOGOROHtZSVMLhhAq5fR9QPxP0q6uAuCI1rW8tQTd1ehDzkRr53OK fYEw== X-Gm-Message-State: AOAM530kQuHgut9ciwfcf4syYM1lwFEtzDgUYGOSqDfa5WZbfFyOtvus Q8X/wg3VnGJ9eXPRXYIZ8nahdw== X-Received: by 2002:a05:6a00:1a01:b029:1da:a7ee:438f with SMTP id g1-20020a056a001a01b02901daa7ee438fmr4126793pfv.77.1614116744909; Tue, 23 Feb 2021 13:45:44 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:68e6:d68b:3887:f216]) by smtp.gmail.com with ESMTPSA id r68sm137951pfc.49.2021.02.23.13.45.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Feb 2021 13:45:44 -0800 (PST) From: Stephen Boyd To: Andy Gross , Bjorn Andersson Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Elliot Berman , Brian Masney , Stephan Gerhold , Jeffrey Hugo , Douglas Anderson Subject: [PATCH 3/6] firmware: qcom_scm: Workaround lack of "is available" call on SC7180 Date: Tue, 23 Feb 2021 13:45:36 -0800 Message-Id: <20210223214539.1336155-4-swboyd@chromium.org> X-Mailer: git-send-email 2.30.0.617.g56c4b15f3c-goog In-Reply-To: <20210223214539.1336155-1-swboyd@chromium.org> References: <20210223214539.1336155-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 @@ static enum qcom_scm_convention __get_convention(void) 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); -- https://chromeos.dev