From patchwork Thu Jun 15 21:52:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13281773 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0F374EB64D9 for ; Thu, 15 Jun 2023 22:00:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=K7aWQLJL0psx3HiZrUJLY/rd7Y1g7+O4Qp54T/BtoCo=; b=T2/OGlPTx/uLF5 6Ymsg69u3dUV3lSJ1s+k93kS819N1ZHdRKFwaQEXFywGOUtPV8yLa6YseIUEg2fdlQZsi9cYRiwP2 vkwV4/vfXk4FpCAW8mxGM9zEPlWdP0qp8YBg8BnlY326JTQ97hIJlVMMnmio6FKBzV/JsQWUOQ9/0 pdM7Dvn65t6D1tAyIofO1mFCjJN6lhGCMyzJzkrXSWFP6KZ+WgL7bR03ew6VAP06KhEx45dQSmo86 fTUZn1tLkxKZdxtwysbdjJON3PZ2RZEZGy7FVSQIMr3+YrZXeqYaj9ODHc2R/c97leWHZmd+pfJbB fbtsJI1dlffbTucmPXZQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q9v0Q-00GCOB-2L; Thu, 15 Jun 2023 21:59:50 +0000 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q9v0N-00GCNX-1o for linux-arm-kernel@lists.infradead.org; Thu, 15 Jun 2023 21:59:49 +0000 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1b4f9583404so725875ad.2 for ; Thu, 15 Jun 2023 14:59:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1686866385; x=1689458385; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=KAopO22c0cQo1B07Jq3YUI7vEfeeDJIOwK+yowMMuCw=; b=kYdPWziqJQTKOZXK/DeQi6LSn/tnUZgPUTDMltfwTCtwAYRel8VcpDykKl4LRwEPVi qd6MvPYft5hpQYDP1sqw2gwPNeAzZdnp6uRv7I+QJoFZRxcHOcusHGQ+kSUyNuVsWvjo Sq9s7pio/+DQg+rsOqUWZwpHNAb5d2osLyE7Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686866385; x=1689458385; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=KAopO22c0cQo1B07Jq3YUI7vEfeeDJIOwK+yowMMuCw=; b=lFvwPFe5hwK/llgYeiTs4UgfQpb9JmclkJIsdWgc5viAgQkVsJ4BKb2mJdRMipSkaW GYIDu3vdaCF1sMJDDXKXvkXoiRXfrJzthAm/XimzHL4QdmHBvHSWsZ6sC/oH34mv2Rdt WMYcgYYIZqr8ROv5eHDTG1PJ/KCT+L9uYgLWMAzsitMlAlkP6AjP1zpN7i2yVkpBpFHl kzqaWSI4XeofuIFAfA8oG4lZ4LF0MU2X/j2IFJsske83IFd3maHL5MPtyarPaACoaqU6 NjmBodHjB+0HH+qP+gDfFdSpg50pKGcCZzKz3k9OaNRGaaKUtkTiv5ZhWH26OcSAaWzq eYIg== X-Gm-Message-State: AC+VfDyIVQAaIkbNnJlfPWyxu96446ZZaKy6tYQLDwl1p+tq5wp6qvEj XmaAIsibFAZ8jKenlN286VcS9Q== X-Google-Smtp-Source: ACHHUZ7ibj6YXo2cm2cUI3yIc/xSJ69nj5gKAmX8pc+S2mYs2ZfSzcz2E2uwo6sPZgJFvHj3RKf5Tw== X-Received: by 2002:a17:902:9a0a:b0:1b4:5697:d991 with SMTP id v10-20020a1709029a0a00b001b45697d991mr266430plp.15.1686866384959; Thu, 15 Jun 2023 14:59:44 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:3cfa:2bcd:1a5:27ce]) by smtp.gmail.com with ESMTPSA id u18-20020a170902e5d200b0019f3cc463absm14525354plf.0.2023.06.15.14.59.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Jun 2023 14:59:44 -0700 (PDT) From: Douglas Anderson To: andersson@kernel.org Cc: Manivannan Sadhasivam , konrad.dybcio@somainline.org, sumit.semwal@linaro.org, Will Deacon , amit.pundir@linaro.org, Sibi Sankar , linux-arm-msm@vger.kernel.org, Stephen Boyd , linux-arm-kernel@lists.infradead.org, Douglas Anderson , Andy Gross , Conor Dooley , Konrad Dybcio , Krzysztof Kozlowski , Rob Clark , Rob Herring , cros-qcom-dts-watchers@chromium.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] arm64: dts: qcom: sc7180: Mark SCM as dma-coherent for trogdor Date: Thu, 15 Jun 2023 14:52:54 -0700 Message-ID: <20230615145253.1.Ic62daa649b47b656b313551d646c4de9a7da4bd4@changeid> X-Mailer: git-send-email 2.41.0.162.gfafddb0af9-goog MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230615_145947_630158_743A65BA X-CRM114-Status: GOOD ( 16.10 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Trogdor devices use firmware backed by TF-A instead of Qualcomm's normal TZ. On TF-A we end up mapping memory as cachable. 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-cachable. 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") Signed-off-by: Douglas Anderson Reviewed-by: Konrad Dybcio --- arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi | 4 ++++ arch/arm64/boot/dts/qcom/sc7180.dtsi | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi index ca6920de7ea8..5e1e7c5bd474 100644 --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi @@ -1194,6 +1194,10 @@ &pm6150l_gpios { ""; }; +&scm { + dma-coherent; +}; + &tlmm { /* * pinctrl settings for pins that have no real owners. diff --git a/arch/arm64/boot/dts/qcom/sc7180.dtsi b/arch/arm64/boot/dts/qcom/sc7180.dtsi index f479cab8ab45..a65be760d1a7 100644 --- a/arch/arm64/boot/dts/qcom/sc7180.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7180.dtsi @@ -369,7 +369,7 @@ CLUSTER_SLEEP_0: cluster-sleep-0 { }; firmware { - scm { + scm: scm { compatible = "qcom,scm-sc7180", "qcom,scm"; }; };