From patchwork Tue Aug 14 10:55:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vivek Gautam X-Patchwork-Id: 10565341 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3E2541815 for ; Tue, 14 Aug 2018 10:55:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2AB3F2981E for ; Tue, 14 Aug 2018 10:55:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E40C29936; Tue, 14 Aug 2018 10:55:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BDE582981E for ; Tue, 14 Aug 2018 10:55:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject: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=neXrIGxXen6Lj1VP9ZDbRpcspPSJGUTFI5XJkYZVCYk=; b=AoS hriFJdTfAGiPlWQJkZymJCCTFbooL9rqqq4OVRYOxyPYsvmstFnPmfM0327D0T1DAU5XGehQfeDNk jNSDoEanUxZe51ZT9e0yyYegTPJ0+R/Wqedxy9887/W11nH+bP3yX0emP4i0Hyb4Yju1amJtxJlzR secEish87BzOrRRV2C0mMyN1+0Fyk5fWQ90+DinPdmYOsoiVdT9ooZOq9X67eu6MpZ015QfgBmdb6 +INWUJlS6TAu5fQSzUCrEtt12xlygXSFGgypE0CBEQImBvKWeV5u9ZFjfPZLeQWpiE4dcolnTNEjF 2WawYyjiUUo2roubGZf7HDZFxKjY4PQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fpWzS-0005z7-RD; Tue, 14 Aug 2018 10:55:54 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fpWzP-0005wg-Mu for linux-arm-kernel@lists.infradead.org; Tue, 14 Aug 2018 10:55:53 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 3EB0560B7D; Tue, 14 Aug 2018 10:55:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1534244141; bh=HcfwXDcKEA2QSHc2q2KAUyU3TDHZU+6FtprQd1h3Cg0=; h=From:To:Cc:Subject:Date:From; b=MmmeEPw2kvTOxOgdkCiFAh4gr/y+hbhF9Ynrzk3li9UJV16F9fHmZnZko5Odcz5Iz gEg6FG6HrkXkVkBYt1g/jyGR/Ue7jUB9fWBl4I2I6DH3VAtQ7J53cgxhDAnL2MBqLs 4brpvAjLQcrTyJ0SuXfNJDeTtQKAjVa7CgkDWHjA= 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 E67766079C; Tue, 14 Aug 2018 10:55:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1534244140; bh=HcfwXDcKEA2QSHc2q2KAUyU3TDHZU+6FtprQd1h3Cg0=; h=From:To:Cc:Subject:Date:From; b=ODyhDiG9YEfbCgmsH374PclQN5HTl/P+e5C33mGYg7q7jZjngbrFEl2jKAqXyZy// f4SQ+LDUf589ekhFoBf9FOiMUTitgCXG0EdX0mMRfRBlFmHTgyxLMGer0TQ49ejMM0 eH0hqZ6fT007031P6xzEsk4OkTN+ZR/KuxqqeLyY= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org E67766079C 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 Subject: [PATCH 0/5] Qcom smmu-500 TLB invalidation errata for sdm845 Date: Tue, 14 Aug 2018 16:25:23 +0530 Message-Id: <20180814105528.20592-1-vivek.gautam@codeaurora.org> X-Mailer: git-send-email 2.16.1.72.g5be1f00a9a70 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180814_035551_788560_43D9A498 X-CRM114-Status: GOOD ( 11.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, swboyd@chromium.org, david.brown@linaro.org, Vivek Gautam , tfiga@chromium.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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]. [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 Vivek Gautam (5): 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: Make way to add Qcom's smmu-500 errata handling 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 | 168 ++++++++++++++++++++++++++++++++++++-- include/linux/qcom_scm.h | 6 ++ 7 files changed, 348 insertions(+), 53 deletions(-)