From patchwork Fri Jun 16 15:14:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 109204 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1432917vqr; Fri, 16 Jun 2023 08:39:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6yCzqUt2MqfdZxSCdwcWt8mm1phT0fnRJISGoasLtPf3D0KcGefY6XyMyDtFO7LYsyRdAt X-Received: by 2002:a17:902:82c5:b0:1b0:6c3:e851 with SMTP id u5-20020a17090282c500b001b006c3e851mr2193139plz.18.1686929991200; Fri, 16 Jun 2023 08:39:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686929991; cv=none; d=google.com; s=arc-20160816; b=rJ7/xiHZ/u92KQ2+rX6kZ1eZ72AKh9W9Ffdo4IQR/65MgatebGchch8QhQ1uAmuckr AJgUiXH/osPJLQer1gq3My4thuabHLu/1jkORFfYUO6p6DXgSMGHkCdwTkdBdZaWkDh1 F/p+B8+NoJdMKHUHFKMbIKnomGGjpvpAA+DDZsQP2DkNwjoVyqbhmcyIwdin25NbjiAP pWaQNOK1V+WEsUVyRsMR5bYvRWAjCCXMq7QAP0T3zrckGPWJI4lwlby8gy+ijB40bzKO nohpvqF0I1NVCl51hvofV2tW72Y//GEGItDWNRd0ZvKpV7CV5b5GayerpdLI4UbRrGVh lIiw== 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=4bzr12EWQk1Ia1QIrIwm9/FyosBVEjDXlJSMbab2hS4=; b=pxGZX0GGlzlLxx+zl1r6OgmzIMcueyKZv4jODwv2lkdftAN0lMOCbL4U3tXYi0teho E1cAuG1/1XN9vkbmk1WXqf9pIXSb1SYRDErb3MdAIqcidQUlDBTeT13NXKE/af3GpSEi c0+K09xe9/Gg2qVwWkBU/hv0jFhsr/dBSVfRSpGhNQai8wrYoRyr1HitR1EdLp8muLfx eQnORQIPCEdwlW0MpATzwcTcZtAUiDELFqLVSngAY+7YOw9Yez+DmBHvAG80YRc+daE2 XF6d67YdvsNJBjyzTe4t0RWWy5GNddB49l77p3/Oeq1QTI0CHL8nWFXpCkw9caCFurqg WRbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=LUUemacR; 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=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w11-20020a170902ca0b00b001ab039a411csi9631453pld.17.2023.06.16.08.39.36; Fri, 16 Jun 2023 08:39:51 -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=@chromium.org header.s=google header.b=LUUemacR; 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=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345937AbjFPPS3 (ORCPT + 99 others); Fri, 16 Jun 2023 11:18:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345596AbjFPPSZ (ORCPT ); Fri, 16 Jun 2023 11:18:25 -0400 Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C087930FF for ; Fri, 16 Jun 2023 08:18:23 -0700 (PDT) Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-666aa1b79a3so775320b3a.3 for ; Fri, 16 Jun 2023 08:18:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1686928703; x=1689520703; 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=4bzr12EWQk1Ia1QIrIwm9/FyosBVEjDXlJSMbab2hS4=; b=LUUemacRAYGTnOP8agRg8L7wFh3FfgjT5qcwrPkVa2r7X32BpPmPLJs+wZcR7Cuj1d LRkHyFDtzuJGJ1WRqyRW1P+Sg8ebz6yvixHJPDQeiDczvn7dK6E3rVErs+O41nJNWW8l w5XzPugEJUYOu7KbDIOLAkAKN92EWh4EMk6iE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686928703; x=1689520703; 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=4bzr12EWQk1Ia1QIrIwm9/FyosBVEjDXlJSMbab2hS4=; b=aECKcs7yE1abGKs6rzy8jGim14YjEqHQXvghoVepciDbINwx1Oq6Spd1SkLPJY4da5 S8egi9YGXw/Wuu/FGtZwFpuGCVRMDonJobDLjzfNlASUaK9l339ZMrWj3JO+qnN4zJXD vvv9wUFZDI5wACrocKH53fW1qYDXLBDZLDiIRt1L8op3P7h3faiwTo4gIUMXtYJ/lJ9X Bd2Slj6T2wax7Fxdon1cKE31UYG0Rtn5tuDsff5bAF5o4X5crKJgNW+a2fgekbMP0RbL ZdmVln6FxI++CMhHLAnj6ChV/E3tOExq82sISiEpVDCEpFXF/AP8Ww++xsg3YWkH0ZrP M3dA== X-Gm-Message-State: AC+VfDwjKpGeKO4Nz3IpMVegijzTKEOi6qt+qv54B9FwOPTZuHZtYiDY QUIf1a99QOkQr0v5UXDs02uCKw== X-Received: by 2002:a05:6a00:995:b0:664:2f24:5578 with SMTP id u21-20020a056a00099500b006642f245578mr2788544pfg.13.1686928703185; Fri, 16 Jun 2023 08:18:23 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:3cfa:2bcd:1a5:27ce]) by smtp.gmail.com with ESMTPSA id a12-20020aa780cc000000b0063d24fcc2besm4593656pfn.125.2023.06.16.08.18.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Jun 2023 08:18:22 -0700 (PDT) From: Douglas Anderson To: andersson@kernel.org Cc: amit.pundir@linaro.org, Will Deacon , sumit.semwal@linaro.org, linux-arm-msm@vger.kernel.org, konrad.dybcio@somainline.org, linux-arm-kernel@lists.infradead.org, Stephan Gerhold , Manivannan Sadhasivam , Nikita Travkin , Stephen Boyd , Sibi Sankar , Douglas Anderson , Konrad Dybcio , Andy Gross , Conor Dooley , Krzysztof Kozlowski , Rob Clark , Rob Herring , cros-qcom-dts-watchers@chromium.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/4] arm64: dts: qcom: sc7180: Mark SCM as dma-coherent for trogdor Date: Fri, 16 Jun 2023 08:14:40 -0700 Message-ID: <20230616081440.v2.3.Ic62daa649b47b656b313551d646c4de9a7da4bd4@changeid> X-Mailer: git-send-email 2.41.0.162.gfafddb0af9-goog In-Reply-To: <20230616081440.v2.1.Ie79b5f0ed45739695c9970df121e11d724909157@changeid> References: <20230616081440.v2.1.Ie79b5f0ed45739695c9970df121e11d724909157@changeid> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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?1768874302945973976?= X-GMAIL-MSGID: =?utf-8?q?1768874302945973976?= Trogdor devices use firmware backed by TF-A instead of Qualcomm's normal TZ. On TF-A we end up mapping memory as cacheable. Specifically, you can see in Trogdor's TF-A code [1] in qti_sip_mem_assign() that we call qti_mmap_add_dynamic_region() with MT_RO_DATA. This translates down to MT_MEMORY instead of MT_NON_CACHEABLE or MT_DEVICE. Apparently Qualcomm's normal TZ implementation maps the memory as non-cacheable. Let's add the "dma-coherent" attribute to the SCM for trogdor. Adding "dma-coherent" like this fixes WiFi on sc7180-trogdor devices. WiFi was broken as of commit 7bd6680b47fa ("Revert "Revert "arm64: dma: Drop cache invalidation from arch_dma_prep_coherent()"""). Specifically at bootup we'd get: qcom_scm firmware:scm: Assign memory protection call failed -22 qcom_rmtfs_mem 94600000.memory: assign memory failed qcom_rmtfs_mem: probe of 94600000.memory failed with error -22 From discussion on the mailing lists [2] and over IRC [3], it was determined that we should always have been tagging the SCM as dma-coherent on trogdor but that the old "invalidate" happened to make things work most of the time. Tagging it properly like this is a much more robust solution. [1] https://chromium.googlesource.com/chromiumos/third_party/arm-trusted-firmware/+/refs/heads/firmware-trogdor-13577.B/plat/qti/common/src/qti_syscall.c [2] https://lore.kernel.org/r/20230614165904.1.I279773c37e2c1ed8fbb622ca6d1397aea0023526@changeid [3] https://oftc.irclog.whitequark.org/linux-msm/2023-06-15 Fixes: 7bd6680b47fa ("Revert "Revert "arm64: dma: Drop cache invalidation from arch_dma_prep_coherent()""") Fixes: 7ec3e67307f8 ("arm64: dts: qcom: sc7180-trogdor: add initial trogdor and lazor dt") Reviewed-by: Konrad Dybcio Signed-off-by: Douglas Anderson --- Changes in v2: - Add comment in dts. - Moved scm node out of pinctrl section to the proper place. arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi index ca6920de7ea8..1472e7f10831 100644 --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi @@ -892,6 +892,11 @@ &remoteproc_mpss { qcom,spare-regs = <&tcsr_regs_2 0xb3e4>; }; +&scm { + /* TF-A firmware maps memory cached so mark dma-coherent to match. */ + dma-coherent; +}; + &sdhc_1 { status = "okay";