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";