Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2377185imm; Sun, 9 Sep 2018 23:27:50 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaOV+oJL199uEnCer9xXu34EUuu2R6kX7UJ+4/UqXHUXxZxzgQGBn6nAtyIIPaw8KtOboMF X-Received: by 2002:a63:6c05:: with SMTP id h5-v6mr20452251pgc.367.1536560870148; Sun, 09 Sep 2018 23:27:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536560870; cv=none; d=google.com; s=arc-20160816; b=po2mQr7TcscIMTSRiVWLb+57T7rZeSBKIpaYLJA2O6CkFo7MeDM2J9wRaIB2Eypi/r I7ULEbKJ2dvFKPvR5Xb6smZNIb82dxBuW2qHBl37QeTBCHQSEEEHA67trAy+zlY05c1D SkxnJNaIkZinlW3h3OCsAhUVPSfWnFGIzwJn27y9zkF2gmDTLVRh8xkxkFwPIM14x8CR LIsIXcmbGuQPDgFEIvu86zR07LNquaCoZW3f7dzD1fYVVVDeyS6bfYIs8nlU1xNT3QV3 JkyDuA2cWfCtHwt6yvdKcQ6A94EQ5+2jl18SuFhZ/Ywed+p97SLB/CFlu7uyjqZt1jKA nduA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dmarc-filter:dkim-signature:dkim-signature; bh=qHiPqIbYk7JTVs70+HQXNXj+lez7kjJ8tCYnKgT6nmc=; b=UtIR85UA8N3EkjX3PPz0yPWo1a6xQRZs9teO1OoJPF8Vt/o8o6zUWEmmxsDMv9oqZq mksLsRfXAgfVCfBOt5ojAYQoRpHj2e+KUBT+4vz/IKetMKEBpUk6WpGblE/uQ3WS7dXG fP5SOEk5SFCDr9B01zOyqlNZfbbtkk9KlJaUbBceiUSug6VNROv4gPYc0snYEExLD8+7 UAPKXDtTX/wOFTigTh212a7uFME+M8kYBCs+Z3ZLbW1mhPAf+6jjlnISRLqpy+THU4Fj JsYqtPlxB+xZKhHCbtqs1eB/rn7f/lbTTLFizeiiWCIGocpCTYHfDWDUbg5s00e5B/HH V7Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=aFMwXSGE; dkim=pass header.i=@codeaurora.org header.s=default header.b=AF1sa0Hd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n15-v6si17776020pgc.309.2018.09.09.23.27.35; Sun, 09 Sep 2018 23:27:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=aFMwXSGE; dkim=pass header.i=@codeaurora.org header.s=default header.b=AF1sa0Hd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727411AbeIJLSj (ORCPT + 99 others); Mon, 10 Sep 2018 07:18:39 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:38854 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726405AbeIJLSj (ORCPT ); Mon, 10 Sep 2018 07:18:39 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 983A46053B; Mon, 10 Sep 2018 06:26:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1536560772; bh=i4lACEsQgF5s2kirjXBD2e/PQzU10q26/V7kKuu1hRs=; h=From:To:Cc:Subject:Date:From; b=aFMwXSGEcyrbZoQlGNYd5C5JXSnDIPloNbwME4j5u7pEWmIFNrwdG6+S7L5gW60ew F7jXW9LA0reIyaor1WmKwRImJyTytPn94RNHCu+QI1qxhHWls1oi9lyS32pZaKOS/9 3IpbJzLgeDru//lmLS4yU+E6OMP1lov1ZHfJmlH8= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from blr-ubuntu-41.ap.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.18.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: vivek.gautam@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 7FE0860721; Mon, 10 Sep 2018 06:26:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1536560771; bh=i4lACEsQgF5s2kirjXBD2e/PQzU10q26/V7kKuu1hRs=; h=From:To:Cc:Subject:Date:From; b=AF1sa0Hd/EGO5EihjNWzBOkTkZOTLifKQDPP8Tr8lIb4iggUT1dCqyawxl91kYNz3 2egWSP/ohVnDpjq4LHyvypMdxDceqi8HZO0ogiRJfLMJHdEsq2RXj8ZdKzk2SBk3YD JRUhzgj5N0+4qd9qQh1IJU63i/yhMn3eEoOzAMTM= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 7FE0860721 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=vivek.gautam@codeaurora.org From: Vivek Gautam To: joro@8bytes.org, andy.gross@linaro.org, will.deacon@arm.com, robin.murphy@arm.com, bjorn.andersson@linaro.org, iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org Cc: david.brown@linaro.org, tfiga@chromium.org, swboyd@chromium.org, linux-kernel@vger.kernel.org, robdclark@gmail.com, Vivek Gautam Subject: [PATCH v2 0/4] Qcom smmu-500 TLB invalidation errata for sdm845 Date: Mon, 10 Sep 2018 11:55:47 +0530 Message-Id: <20180910062551.28175-1-vivek.gautam@codeaurora.org> X-Mailer: git-send-email 2.16.1.72.g5be1f00a9a70 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Qcom's implementation of arm,mmu-500 on sdm845 has a functional/performance errata [1] because of which the TCU cache look ups are stalled during invalidation cycle. This is mitigated by serializing all the invalidation requests coming to the smmu. This patch series addresses this errata by adding new tlb_ops for qcom,sdm845-smmu-500 [2]. These ops take context bank locks for all the tlb_ops that queue and sync the TLB invalidation requests. Besides adding locks, there's a way to expadite these TLB invalidations for display and camera devices by turning off the 'wait-for-safe' logic in hardware that holds the tlb invalidations until a safe level. This 'wait-for-safe' logic is controlled by toggling a chicken bit through a secure register. This secure register is accessed by making an explicit SCM call into the EL3 firmware. There are two ways of handling this logic - * Firmware, such as tz present on sdm845-mtp devices has a handler to do all the register access and bit set/clear. So is the handling in downstream arm-smmu driver [3]. * Other firmwares can have handlers to just read/write this secure register. In such cases the kernel make io_read/writel scm calls to modify the register. This patch series adds APIs in qcom-scm driver to handle both of these cases. Lastly, since these TLB invalidations can happen in atomic contexts there's a need to add atomic versions of qcom_scm_io_readl/writel() and qcom_scm_call() APIs. The traditional scm calls take mutex and we therefore can't use these calls in atomic contexts. This patch series is adapted version of how the errata is handled in downstream [1]. Changes since v1: * Addressed Will and Robin's comments: - Dropped the patch[4] that forked out __arm_smmu_tlb_inv_range_nosync(), and __arm_smmu_tlb_sync(). - Cleaned up the errata patch further to use downstream polling mechanism for tlb sync. * No change in SCM call patches - patches 1 to 3. [1] https://source.codeaurora.org/quic/la/kernel/msm-4.9/tree/drivers/iommu/arm-smmu.c?h=msm-4.9#n4842 [2] https://lore.kernel.org/patchwork/patch/974114/ [3] https://source.codeaurora.org/quic/la/kernel/msm-4.9/tree/drivers/iommu/arm-smmu.c?h=msm-4.9#n4864 [4] https://patchwork.kernel.org/patch/10565349/ Vivek Gautam (4): firmware: qcom_scm-64: Add atomic version of qcom_scm_call firmware/qcom_scm: Add atomic version of io read/write APIs firmware/qcom_scm: Add scm call to handle smmu errata iommu/arm-smmu: Add support to handle Qcom's TLBI serialization errata drivers/firmware/qcom_scm-32.c | 17 ++++ drivers/firmware/qcom_scm-64.c | 181 +++++++++++++++++++++++++++++++---------- drivers/firmware/qcom_scm.c | 18 ++++ drivers/firmware/qcom_scm.h | 9 ++ drivers/iommu/arm-smmu-regs.h | 2 + drivers/iommu/arm-smmu.c | 133 +++++++++++++++++++++++++++++- include/linux/qcom_scm.h | 6 ++ 7 files changed, 320 insertions(+), 46 deletions(-) -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation