From patchwork Fri Jun 16 15:14:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13282881 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 ECEFCEB64DA for ; Fri, 16 Jun 2023 15:18:50 +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=LKPwLQqn1GugoninN69YxFcU1HCfWOMe4LxKrIfAv5I=; b=uNMgCVO5z6i7DG GvXk9vYgYH0pXjFol6sIC4k8I3O6++tPVc6/sXDSa0xrA4EXrsE15M8m/JXOiVfZh6o+Dt9meP97f 1smJ/yz4RghNbd2bWXnjqwOWpgm3jpkDx//g4RMDWwQKeJoLUBdSpJtOHP6hRzf/SpBS/jSxE0gan HeBmRHrzwMZiCc6nRtuIn6iABrRbU0NJ0pE0FL/GigRZ5FXQOVtbzII03qWJQ1ra7HW+AmAeU0Ctw 1jq90ygexBxEkFnW/IChAmwznsnyIe1j54ZpcRmxc4M/HTMBBw7ia/nR0Zlwn5DLIHvygNBfPVXs3 9fHecjAS7YOeD6Ko4w4Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qABDS-000vUn-2k; Fri, 16 Jun 2023 15:18:22 +0000 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qABDP-000vTv-37 for linux-arm-kernel@lists.infradead.org; Fri, 16 Jun 2023 15:18:21 +0000 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-6664a9f0b10so774628b3a.0 for ; Fri, 16 Jun 2023 08:18:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1686928699; x=1689520699; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=JjK5uSBUBCtKUiHKGw2fDzcH80L9Te7xYyX5HYmSKZk=; b=Gazntjz7fU9vAVPqqzRdDRac27cecBITu2YvqyJ/AerXxYtOfZN2wz718g7xcI3NJj iGK8DZvU6z1+Z3BId6izQhVmrGv1ygnshSs9Q09cAXjmSoRXh1OzSNajVzmt9kbmlqwM zgNgQpgihqEhJaCqPN565bpB2w/NQFTyfXs2o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686928699; x=1689520699; 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=JjK5uSBUBCtKUiHKGw2fDzcH80L9Te7xYyX5HYmSKZk=; b=gwQSvbvakkf1BlV/qK7WB7djr+roH+PuIh3Y+aUroDFPgny7rC5rSwXixeQs3s9Lqk q1eGenUuaLnlb2V4K8CvhF6nKx2rwiWzO/NxzpAsLMAjDMAQUT9Bvfh3Eea3mAYaR0Pp vfWo/MWKzJanqMI37NzywHuYDgGRAF/J8o4Zj71JINOJjeQBRVUJE7lvevmTEK3TALod iNUb71cehuu6eX1tEXSKfFo9t2fwX9U4S8TXBd46aaBY8Hl3n7B7oWy1kSOAVabtaREG Gcx26p3EG42CQ9NkUH0K90hBEBiP3axew+xoDGxMORYWpsg0XBtZk5f5UayIHUL7IuK5 fd4Q== X-Gm-Message-State: AC+VfDy6y/KLAS1oNgblusMTSqK2nOuuPT1HDMEkkddTdXbvesLPnn2e M3PrZf53gLCdBL2MdjHzQq7EIA== X-Google-Smtp-Source: ACHHUZ4BIE6TbLK8kpe1owsqwPPBjFMHGvq1+gRfy4HufbUwKn/5NGiepHfgtjSj1AGPlndAamWF0w== X-Received: by 2002:a05:6a21:7890:b0:11f:1aa2:666b with SMTP id bf16-20020a056a21789000b0011f1aa2666bmr1412485pzc.32.1686928698728; Fri, 16 Jun 2023 08:18:18 -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.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Jun 2023 08:18:18 -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 , Andy Gross , Conor Dooley , Das Srinagesh , Konrad Dybcio , Krzysztof Kozlowski , Rob Herring , Robert Marko , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/4] dt-bindings: firmware: qcom,scm: Document that SCM can be dma-coherent Date: Fri, 16 Jun 2023 08:14:38 -0700 Message-ID: <20230616081440.v2.1.Ie79b5f0ed45739695c9970df121e11d724909157@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-20230616_081820_052237_DD6B2917 X-CRM114-Status: GOOD ( 10.68 ) 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 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. Let's allow devices like trogdor to be described properly by allowing "dma-coherent" in the SCM node. Signed-off-by: Douglas Anderson Acked-by: Krzysztof Kozlowski --- Changes in v2: - Bindings change new for v2. Documentation/devicetree/bindings/firmware/qcom,scm.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/firmware/qcom,scm.yaml b/Documentation/devicetree/bindings/firmware/qcom,scm.yaml index 367d04ad1923..83381f3a1341 100644 --- a/Documentation/devicetree/bindings/firmware/qcom,scm.yaml +++ b/Documentation/devicetree/bindings/firmware/qcom,scm.yaml @@ -71,6 +71,8 @@ properties: minItems: 1 maxItems: 3 + dma-coherent: true + interconnects: maxItems: 1 From patchwork Fri Jun 16 15:14:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13282883 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 55964EB64D8 for ; Fri, 16 Jun 2023 15:18:51 +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:References:In-Reply-To: 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: List-Owner; bh=u9v38CUVGY788zOBAySZU+1a7TruuwSFlStvn/P/hxQ=; b=MY/39oUWnKNrtO EukZUiSlRH28RbkG+j68LIiIFrWNbPuIxLFuZK5D9EuW3ZHv5JF+c71ICfr36ipUVClYE87gR5NZs xYAwCHJ3aWpS9qQx2QURQ+YQxdkPhlhclhL5HRua4ycYkJPWz/D0v1+B+XvZx9kf6TD4UyKgkyosX vE1MYweGRz4mhjaOG8vr3vgbD7BbLjhcTix8nlcTAGonQvwl4Zrj5SLDkfH56recJ1ohIFIFLrJMQ IRn5l2ihPkZ+ctsgYRV2slozHTym9rKgA6wP3PE/vdJtw+iKO4MYrG6qs0oEu5sAuY/dLOFQgjBVk yoFhjluPt7qfaPDlJh4A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qABDY-000vWT-1b; Fri, 16 Jun 2023 15:18:28 +0000 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qABDS-000vUS-0s for linux-arm-kernel@lists.infradead.org; Fri, 16 Jun 2023 15:18:23 +0000 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-666b20700deso746942b3a.1 for ; Fri, 16 Jun 2023 08:18:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1686928701; x=1689520701; 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=C5Nhe0vFqRJeb1rQZmWBqjIq4WANx09DJJT4hbC9des=; b=QwpecvflqoGMWutvgaPcnPls7DoObDDt0d0vjpKsZE6NG1fUoWbpGIAIbISWoE12o9 Hls8pUslxLD0pUrP38RxhYHlsV2zpEWl+Sff4pDuzEc6iMzkP9epITtxGOCV6uGHqKYH wpa74oTP7DJWe/n7NZp3wgbzqYdIg9kCTuHro= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686928701; x=1689520701; 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=C5Nhe0vFqRJeb1rQZmWBqjIq4WANx09DJJT4hbC9des=; b=Ig7/m7JrRoeb3smExYdkn8vSVsOXczhMwiptneK8XzddI8LmUsL9h4d5Y0d8B/7mDZ aMfZ3QCHm9mqkRmuBN8wJRFj9ReLWTSRQP16t+Y0Xvasva1rSxcdVQIxy8WBDt6okS6c RkihFVNecrlusWVMEfoM5Z4uyNw8l7D1gAwkatTh75iPGqHByuoUsPsOzIOc6qrM7zWu dxaF/J5AZ3V4CsE6DqQyQpzPjd1/HmtuMS7uudLikVK9zErfTZMqUrShxvcBPSf84u6B R5q9louRqZd59EKSlYeecPMX8a6J2ymHjCf4MjsGuPGeGxtNrZ5iM+/tpXQAds3lCwJa gHdg== X-Gm-Message-State: AC+VfDzZMUEYsOGRqAZkAeXJebwvV/8DHjiLeaf10svTIDkwJpQSUioT 4uyrpy6IeFz1dnGIZ+Cx6abjaw== X-Google-Smtp-Source: ACHHUZ5kULJgYYKPVBKzjr2NKrXoKtFUZad8SKsKaJsNvvuqBIOeHlOBYw+g/i2luJy6VuTljO125Q== X-Received: by 2002:a05:6a00:1392:b0:651:3e9d:2a05 with SMTP id t18-20020a056a00139200b006513e9d2a05mr2713555pfg.19.1686928700957; Fri, 16 Jun 2023 08:18:20 -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.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Jun 2023 08:18:20 -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 , Andy Gross , Conor Dooley , Konrad Dybcio , Krzysztof Kozlowski , Rob Herring , Sibi Sankar , cros-qcom-dts-watchers@chromium.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/4] arm64: dts: qcom: sc7180: Mark SCM as dma-coherent for IDP Date: Fri, 16 Jun 2023 08:14:39 -0700 Message-ID: <20230616081440.v2.2.I3c17d546d553378aa8a0c68c3fe04bccea7cba17@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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230616_081822_310636_28FB4999 X-CRM114-Status: GOOD ( 16.81 ) 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 sc7180-idp is, for most intents and purposes, a trogdor device. Specifically, sc7180-idp is designed to run the same style of firmware as trogdor devices. This can be seen from the fact that IDP has the same "Reserved memory changes" in its device tree that trogdor has. Recently it was realized that we need to mark SCM as dma-coherent to match what trogdor's style of firmware (based on TF-A) does [1]. That means we need this dma-coherent tag on IDP as well. Without this, on newer versions of Linux, specifically those with commit 7bd6680b47fa ("Revert "Revert "arm64: dma: Drop cache invalidation from arch_dma_prep_coherent()"""), WiFi will fail to work. At bootup you'll see: 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 [1] https://lore.kernel.org/r/20230615145253.1.Ic62daa649b47b656b313551d646c4de9a7da4bd4@changeid Fixes: 7bd6680b47fa ("Revert "Revert "arm64: dma: Drop cache invalidation from arch_dma_prep_coherent()""") Fixes: f5ab220d162c ("arm64: dts: qcom: sc7180: Add remoteproc enablers") Signed-off-by: Douglas Anderson --- I realized that this needed to be in IDP as well and that the IDP patch actually needed to come _before_ the trogdor one given the order that things landed upstream. I still left most of the description of the problem in the trogdor patch, though. Hopefully that's OK. Changes in v2: - sc7180-IDP patch added for v2. arch/arm64/boot/dts/qcom/sc7180-idp.dts | 5 +++++ arch/arm64/boot/dts/qcom/sc7180.dtsi | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/qcom/sc7180-idp.dts b/arch/arm64/boot/dts/qcom/sc7180-idp.dts index 9f052270e090..299ef5dc225a 100644 --- a/arch/arm64/boot/dts/qcom/sc7180-idp.dts +++ b/arch/arm64/boot/dts/qcom/sc7180-idp.dts @@ -393,6 +393,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"; 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"; }; }; 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: 13282880 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 7068BEB64D7 for ; Fri, 16 Jun 2023 15:18:50 +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:References:In-Reply-To: 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: List-Owner; bh=NVD10kogk34/8iMlGsVpMA/VUhrdl9SXnKBudsFUdy8=; b=Sb2BQvY+n93v6Z HZ3w8+YWLmxrnIuv1o/VX3pMr34CajftUpQojOJSjuIO45CyQf1PEMRtbqd01j/Yzhl1R10nS3e3+ h/gAbm4pXlqnHgWeagEpT9roZKC6zcgy8zW+3XzrCC/qCtkDKFBUG0SLK2axun2C2TWNhhCNnEFFT YNw3binRlBgtbzeHBsahofn/oPA4qDs3HsfDndUwocQOk3sl+w8cEO8Z99TgA/sG1YOnBERceGEUP qP641lusfSyNXjXqFrbBJyyQYsuWUY4NN1kiU1vIOyCnlGGnKQSor637nquGuKHaT0am4jaou3Sfg 2w5c370K19Bfwr/+waLw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qABDY-000vWq-3A; Fri, 16 Jun 2023 15:18:28 +0000 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qABDU-000vUu-25 for linux-arm-kernel@lists.infradead.org; Fri, 16 Jun 2023 15:18:26 +0000 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-666aa1b79a3so775321b3a.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=F/qBiw7hhy1Ju8oO3CTLgjYbydLhwPkRy4Wgs6zKLF6N9/k2AZuHeqj+53zAHvCVhk ODrwVJATm7acs1bjE5YCcKvbteJ7UclAIjlsJxsws878x8SOLIeJU5p5ce2TPBF1QFgC lv3L1yvc/+Tlwt4qwaEv55Ygl887W8wXwHWy3SKMIbSiAb8cT+LSr4aLmPS2MgIf6Fw4 2GDJxSi1fOoLs/WKjcksYxUF9ql7QjCQ4JsSa0oVaf+rVD3loS7/cpdDnyjYEcUXnaVy 4pmj5q8YEZiOh8kGTf46LOPKckP7WE/uEP5aS7jbMHFtv27doymJkLcPaOiOCSftptwP Selw== X-Gm-Message-State: AC+VfDwNRxqjacJ2Q2LC6ozTpDVmOUZoL1DmbG9rFYl+X67033i0YiWR WZIJemXnZQBXK4AG4Oi3b98WnA== X-Google-Smtp-Source: ACHHUZ6q/PKHT/Y8LJI0/Lhl1x89/ervnctEFB9g0IQqT1NdRVzz9jh8vZkPG/Uu4lHnWKRC4m93Hw== 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230616_081824_683306_72C746E4 X-CRM114-Status: GOOD ( 14.79 ) 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 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"; From patchwork Fri Jun 16 15:14:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13282882 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 384C6EB64DB for ; Fri, 16 Jun 2023 15:18:52 +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:References:In-Reply-To: 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: List-Owner; bh=lwA122wOQtpfl0HgiG17B7iA76BEd+wa5xIGa+PoYv4=; b=LR/4PfCoC4O4G0 AgLmt6L0fMVsPMA0uKIGI4skcZS2bhrnmN3dQBUHPX0rxvhWf+j6fRBwtptKmBWcXfhEvTvcm60aF TNyFbNAiNP0LanXbtyZVqGOzS8b1ZlCEy8qYyfMKHKMBAtfSXTrMqqYzmhhKv+wM8dOGmSai0sVEk lc+9sHYAz/+Da4W1jhyfM8XeraD4s69VJYKx8Fum/vCbQ4wbBYe+EgjhXmpLc4k3XOBRdXBuoZ2pw T59iJhwAzoroD1oxDtPzDX0xqfWu06SdNKZ6ZAA9+dpKdaJN1x8RJnXi9KQt+qkKGhINkGyVQ6i67 R/NV/SZJyw5hbxOcFU9A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qABDe-000vYb-0i; Fri, 16 Jun 2023 15:18:34 +0000 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qABDW-000vVV-1A for linux-arm-kernel@lists.infradead.org; Fri, 16 Jun 2023 15:18:27 +0000 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-6667a0811a2so771572b3a.0 for ; Fri, 16 Jun 2023 08:18:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1686928705; x=1689520705; 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=VIqsH2Iv+JcyNkylOi9qtvbVK2jAXhmRaUsdt3ONyh4=; b=GpPAIZitPXFRSuOZt2/v1lUUx6zLZ+8adsfg0EcyOH/0Zb2pls1gvbR0yXhpS2nQ1a udqKcrhHiCVT91HKPEz/QAZXyFMGjBypbLotzvurvYwRmhTXSWW3LGdCQpSqQeFArnhE XS9LKJvRnA+C8924skamWh5ZKpxdrCWSQLz04= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686928705; x=1689520705; 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=VIqsH2Iv+JcyNkylOi9qtvbVK2jAXhmRaUsdt3ONyh4=; b=XI1Ef0ACvd5BOD4Ltii1VCFSWN+gktojYOu8tQ01ktQoVMzI45XuS3JJ0wrl/zI07R WBsRzBRM2Xr/dTty/GyUeJ82esHKu7jNxfFbG+XAMRG3qxg70QDgXOXnKO1VWpasK4kw /EQksXBA3pIet3XsKkJEFQC0F7AcNzW00bXsPLMyvUIMmYwbW8iuQfbyngRcY1D2y9AH gM4RQ7RKGnYzRnUGWeL8Hc4h1ZlNkzNYeE2rotWA1/p9z39m3ulDEZFv55G1MQHdY3kt ZbQBu8VjiMfUcb1jUxKOu5iGshTwHKNS5Je949uwvWJeURVY1JKJGz4hkr6GmPWLaajf wYWA== X-Gm-Message-State: AC+VfDy3HwnjRqK1jKy2aNqFSbr7p4K5T73/leXRsp9ayTBWErEPzMK7 AffmSdcuGtHAyEY374hxdqY8UA== X-Google-Smtp-Source: ACHHUZ4kiLB93/ITh5JfoMue+NcL7jHg5BRy3O4ysBFELCyhx65drmzzRSsbFhR7aX1DfB3Ku3E6ag== X-Received: by 2002:a05:6a20:158a:b0:114:7637:3451 with SMTP id h10-20020a056a20158a00b0011476373451mr2561868pzj.37.1686928705404; Fri, 16 Jun 2023 08:18:25 -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.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Jun 2023 08:18:24 -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 , Andy Gross , Conor Dooley , Konrad Dybcio , Krzysztof Kozlowski , Rajendra Nayak , Rob Herring , cros-qcom-dts-watchers@chromium.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 4/4] arm64: dts: qcom: sc7280: Mark SCM as dma-coherent for chrome devices Date: Fri, 16 Jun 2023 08:14:41 -0700 Message-ID: <20230616081440.v2.4.I21dc14a63327bf81c6bb58fe8ed91dbdc9849ee2@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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230616_081826_397517_007AF831 X-CRM114-Status: GOOD ( 16.09 ) 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 Just like for sc7180 devices using the Chrome bootflow (AKA trogdor and IDP), sc7280 devices using the Chrome bootflow also need their firmware marked dma-coherent. On sc7280 this wasn't causing WiFi to fail to startup, since WiFi works differently there. However, on sc7280 devices we were still getting the message at bootup after commit 7bd6680b47fa ("Revert "Revert "arm64: dma: Drop cache invalidation from arch_dma_prep_coherent()"""): qcom_scm firmware:scm: Assign memory protection call failed -22 qcom_rmtfs_mem 9c900000.memory: assign memory failed qcom_rmtfs_mem: probe of 9c900000.memory failed with error -22 We should mark SCM properly just like we did for trogdor. Fixes: 7bd6680b47fa ("Revert "Revert "arm64: dma: Drop cache invalidation from arch_dma_prep_coherent()""") Fixes: 7a1f4e7f740d ("arm64: dts: qcom: sc7280: Add basic dts/dtsi files for sc7280 soc") Signed-off-by: Douglas Anderson --- I marked this as "Fixes" for the patch that first added the SCM node to sc7280. Given all the reorganization of the files it wouldn't be all that easy to really backport it to there, but that should be OK. Things seemed to work fine before commit 7bd6680b47fa ("Revert "Revert "arm64: dma: Drop cache invalidation from arch_dma_prep_coherent()""") anyway. Changes in v2: - sc7280 patch new for v2. arch/arm64/boot/dts/qcom/sc7280-chrome-common.dtsi | 5 +++++ arch/arm64/boot/dts/qcom/sc7280.dtsi | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/qcom/sc7280-chrome-common.dtsi b/arch/arm64/boot/dts/qcom/sc7280-chrome-common.dtsi index f562e4d2b655..2e1cd219fc18 100644 --- a/arch/arm64/boot/dts/qcom/sc7280-chrome-common.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7280-chrome-common.dtsi @@ -79,6 +79,11 @@ &remoteproc_wpss { firmware-name = "ath11k/WCN6750/hw1.0/wpss.mdt"; }; +&scm { + /* TF-A firmware maps memory cached so mark dma-coherent to match. */ + dma-coherent; +}; + &wifi { status = "okay"; diff --git a/arch/arm64/boot/dts/qcom/sc7280.dtsi b/arch/arm64/boot/dts/qcom/sc7280.dtsi index 2fd1d3c0eb34..36f0bb9b3cbb 100644 --- a/arch/arm64/boot/dts/qcom/sc7280.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7280.dtsi @@ -656,7 +656,7 @@ memory@80000000 { }; firmware { - scm { + scm: scm { compatible = "qcom,scm-sc7280", "qcom,scm"; }; };