Message ID | 20230518140224.2248782-2-robimarko@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp525542vqo; Thu, 18 May 2023 07:14:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7RY8Nf1sT/JARvaV4XVkvZoMaQuiVxpoz/ELmfMVpltoeTI/S1CsXlhr3smTIo6EVTxaCp X-Received: by 2002:a05:6a21:3946:b0:106:feff:71d with SMTP id ac6-20020a056a21394600b00106feff071dmr2157109pzc.39.1684419251517; Thu, 18 May 2023 07:14:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684419251; cv=none; d=google.com; s=arc-20160816; b=VoukSG6k++/uGh68kBdcGAiy3Tk48/B0lWttuxeyKGyjcWhMjLAdQ90BFGPgw5jHPk BDopGMyMiM92tB2mHkINkJfr8tHAxQ8B3gQPfKw9DzB0yCUfzZob3+l7ORQREpUPqOto rddJtHnhuzpm+tVs7JaRp7hm9Ht70dkB2vAMFY702zqNUyNHeCzb+FmVXOpdaJ1nMq5c pv2qG4rJd8PeninVHPbO+6bzJAo83w3QQnrS06MrnxnMMfj5tXduiNHU6NCWF28t0Sm3 siYlQcsWsJsVK6WWKpQo0cHRIgQWPhnKYTcGBvx0w7K2VWs9Gw8w/otF0cblFKXeO+pX bOWA== 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=Y2Hw87l7Ts/Jxr3HsiObApCTHPM3x3z16x4yMMIWg7U=; b=fL3u2honE3/63BUQerxCQF9y6yrvQWCFgYwj8Av+KRytdwr1gJa71hnmoN1V+dBqiK H4dtg64BXCVG1lZ2LelYZs+z1zwPGsGNYQXC9iVCoZgSsWnlF83hZD815XWdBGb6XZmP TxAP5ZBUF9Fu9gt4nk5WeAFyYSw0NaevUu8QJeNmAKFIEd5Oa/As5+4BjUETv+uHQlL7 OckmuomG2lMbAJZFmQiX1Ym5r5sDQ9fLqEIxoNT+CheLuHGFE01KgAnS9iwt1fuMlB5b FlAA/VGLguflaxQwX8gx4XHqCDGMjszhGDBLxNbHDVj4qnvkRGXTsJ3KIUag6mSoMKPR FKCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=UbH1d1Rv; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c13-20020a17090abf0d00b002533664401esi1650493pjs.151.2023.05.18.07.13.55; Thu, 18 May 2023 07:14:11 -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=@gmail.com header.s=20221208 header.b=UbH1d1Rv; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231575AbjEROCh (ORCPT <rfc822;pacteraone@gmail.com> + 99 others); Thu, 18 May 2023 10:02:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231258AbjEROCc (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 18 May 2023 10:02:32 -0400 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FA40E51; Thu, 18 May 2023 07:02:31 -0700 (PDT) Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-510ea8d0bb5so797599a12.0; Thu, 18 May 2023 07:02:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684418549; x=1687010549; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Y2Hw87l7Ts/Jxr3HsiObApCTHPM3x3z16x4yMMIWg7U=; b=UbH1d1RvF5tQKqhb7d53yj0gbmWx4JmBW7ux3rULr/Kjj0RuhefLvFoKuKO0kuGFm/ V0D0VT8n89q4OS2WsJqIWcEEGnQLhbvyhjaVN8TMCqRgmYZP5xKc07kNTiHAgLcgBEN5 t0qTXum3ZUoTrHXW7fdqxSyPbp4wH8G+W/xmC0+/VP8HHr9PIhpcIaVu0bfaZpalwmS9 OWPS3v9iQ6AlKx0SSIcmUEZQ8BvxeQzWx/KGKjoObMxmfzzpXCnqc3Mu4zIilMQyjhY3 fCiYZ5oRZ22P5VxBilzTB1TFn2XsqMNN3abIdzGxRkEIWX9b4vVgbYfdBrR4p48cnFia jpqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684418549; x=1687010549; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Y2Hw87l7Ts/Jxr3HsiObApCTHPM3x3z16x4yMMIWg7U=; b=SKUpUP2PehJpDex6UEG2I6Ag9j67xvU8LZlNwWGaZMw1lFe4vqVoKNOKuSffYRAo0D 4FNU7GNuFatrO4w8maTosttiw6a2LXw5l3kNINUP4pgKlOyVavrehxrYxrsQ+nsc+enI bxvcJYO556WRfbJ3zuTR2RFOiBdwAS9ipCiXTxWmfJSa6dI465Xfwwl/sKrcyr4h8f5W OI/ReeupjHQJMgIVBfUCoZ5e4yjWIozNLK152pvQeyP2y8GKQ57l1LfmLpsg/ZmE2FrV 15z5gPNMClOZ7SS/mwMc2MR203MP+ZDTHgEaUZV20xRRraBpiiGHnqTzlYAbRJxjMixU +WZQ== X-Gm-Message-State: AC+VfDzvdwS0Fnpdzn7QCJ4ekXv5YRpFbC/Pocfo3hawTrpt3/crXVRC hEK3SFQVeHADvad61cLvNs6cWhkyN14= X-Received: by 2002:a17:906:fd8c:b0:94f:3cf5:6d7f with SMTP id xa12-20020a170906fd8c00b0094f3cf56d7fmr38420982ejb.46.1684418549192; Thu, 18 May 2023 07:02:29 -0700 (PDT) Received: from fedora.. (cpezg-94-253-130-143-cbl.xnet.hr. [94.253.130.143]) by smtp.googlemail.com with ESMTPSA id m14-20020a170906258e00b0096f272206b3sm997025ejb.125.2023.05.18.07.02.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 May 2023 07:02:28 -0700 (PDT) From: Robert Marko <robimarko@gmail.com> To: agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, srichara@quicinc.com Cc: Robert Marko <robimarko@gmail.com> Subject: [RESEND,PATCH 2/2] firmware: qcom: scm: disable SDI on IPQ5018 Date: Thu, 18 May 2023 16:02:24 +0200 Message-Id: <20230518140224.2248782-2-robimarko@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230518140224.2248782-1-robimarko@gmail.com> References: <20230518140224.2248782-1-robimarko@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766241601201403085?= X-GMAIL-MSGID: =?utf-8?q?1766241601201403085?= |
Series |
[1/2] firmware: qcom: scm: Add SDI disable support
|
|
Commit Message
Robert Marko
May 18, 2023, 2:02 p.m. UTC
IPQ5018 seems to have SDI (Secure Debug Image) enabled by default which
prevents normal reboot from working causing the board to just hang after
reboot is called.
So, let disable SDI during SCM probe for IPQ5018.
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
drivers/firmware/qcom_scm.c | 8 ++++++++
1 file changed, 8 insertions(+)
Comments
On Thu, May 18, 2023 at 04:02:24PM +0200, Robert Marko wrote: > IPQ5018 seems to have SDI (Secure Debug Image) enabled by default which > prevents normal reboot from working causing the board to just hang after > reboot is called. > > So, let disable SDI during SCM probe for IPQ5018. > > Signed-off-by: Robert Marko <robimarko@gmail.com> > --- > drivers/firmware/qcom_scm.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c > index bdc9324d4e62..c6a38ce49fb0 100644 > --- a/drivers/firmware/qcom_scm.c > +++ b/drivers/firmware/qcom_scm.c > @@ -1525,6 +1525,14 @@ static int qcom_scm_probe(struct platform_device *pdev) > if (download_mode) > qcom_scm_set_download_mode(true); > > + /* IPQ5018 seems to have SDI (Secure Debug Image) enabled by default > + * which will prevent normal reboot causing the board to hang after > + * making the reboot call. > + * So, make a call to SCM to disable SDI. > + */ > + if (of_machine_is_compatible("qcom,ipq5018")) > + qcom_scm_disable_sdi(); > + I see there has been some reservation expressed on this patch (via patch 1 comments). I suppose this would be a nice time (though months-late) to add my own potentially-constructive thoughts. First, this is definitely a real problem, and for multiple products. See my prior art with the exact same problem: Subject: [RFC PATCH] firmware: qcom_scm: disable SDI at boot https://lore.kernel.org/all/20200721080054.2803881-1-computersforpeace@gmail.com/ (I think you found this one already, although independently.) Secondly, I think some reservation from patch 1 is on the precise method of identifying such problematic systems, and I think I agree with the sentiment. For one, I'm sure that in my case, not all IPQ4019-based systems leave SDI enabled, and similarly, I doubt all IPQ5018 systems do either. I believe any firmware that has this enabled in a production system is essentially an oversight and a bug; it provides negative value to non-Qualcomm-employees (who can't inspect this "debug" mode), and I also believe it can potentially be "fixed" by firmware updates. So you have cases where depending on which software updates have been applied to an original product before being reprogrammed with a properly-open Linux kernel/distro, the "same" product may or may not behave differently. On the other hand, my guess is that it is truly safe (or, redundant) to make this call on *any* SCM system; if it was already disabled, then it's a no-op. Now, that may be inconvenient for Qualcomm employees trying to debug prototype boards, but that's a different problem... So, it feels like either this should be: (1) done inconditionally (like my RFC above), or (2) supported by some kind of dedicated firmware or device tree flag, to denote precisely which systems need this behavior, and not just guess based on SoCs. We don't have any firmware interface for this [1], so I think the next best thing is Device Tree, which I believe is sometimes(?) allowed to carry "firmware" information, instead of just "hardware" information. For example, maybe we document a "qcom,firmware-sdi-enabled" boolean, to represent the fact that the particular board in question may hold firmware which leaves SDI enabled? I'd personally also be OK with (1), unless we (or more likely, Qualcomm) can find some reason that it's not safe/redundant to do this unconditionally. Regards, Brian [1] As far as I know. There's no documentation about Qualcomm's SCM APIs that I'm aware of.
diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c index bdc9324d4e62..c6a38ce49fb0 100644 --- a/drivers/firmware/qcom_scm.c +++ b/drivers/firmware/qcom_scm.c @@ -1525,6 +1525,14 @@ static int qcom_scm_probe(struct platform_device *pdev) if (download_mode) qcom_scm_set_download_mode(true); + /* IPQ5018 seems to have SDI (Secure Debug Image) enabled by default + * which will prevent normal reboot causing the board to hang after + * making the reboot call. + * So, make a call to SCM to disable SDI. + */ + if (of_machine_is_compatible("qcom,ipq5018")) + qcom_scm_disable_sdi(); + return 0; }