From patchwork Sat Jul 2 21:37:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 12904096 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 58707C43334 for ; Sat, 2 Jul 2022 21:38:53 +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=CXESkeFGuHwekIqGfZJ9e43OobmaBbV2WBQSlCWjfNE=; b=HWO0+Uy8+KrWCJ M3DaIh4TO8UBdkJhGxj1WZm9M28imX4xS9AkVAWkzklkPlu6L4dGtRIwYl4GXWHzE7WBMDoxZ14hz XOTZ7At0tAwaKvmUjSytwB6HX2kZPwA2v+IGE9fvacP/M692LRIBm4MHFv/C9rbMh2CPvIXVgFRVQ QFRVOQ6xMMlTpGPxwf4U22/jwoUUcChuSEs0Eij+yR4i8uo9uRRWnGPHIa2h9PVsml7Lv5stflF4K /kG0E+9lUzaXUsZhjEwvDKoC2YUlDnf1B6O9eJMhbrt4h3ny3QVdyeomhIlFfsaib+sTqpqt0jk51 n10RzI8YChErNFUbZQDw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o7koI-00Bflv-EQ; Sat, 02 Jul 2022 21:37:50 +0000 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o7kny-00BfXk-HJ for linux-arm-kernel@lists.infradead.org; Sat, 02 Jul 2022 21:37:32 +0000 Received: by mail-ed1-x52f.google.com with SMTP id cf14so6958767edb.8 for ; Sat, 02 Jul 2022 14:37:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=WV81TTrUzfnxlK8f1IHJz4xXjnSjuTWSu4GCpZi6HEY=; b=N6w5oPvPqSon53fXnJZtzHnqdoTIeYCV6XuIzoHbJZvZSPSWEzPKieCj19s19eJcwL RcIaTUHdUUNr9nkU6I8AoMl8MYOb93MYMUeA0voFGALhae/V7epsJgesAM52ZRW0dX2Y 4yxMLoOi6DW/mQkOXwh0GbnbaVTBgbdxWiAiCbpqEsBEKg6pEaxcBiNh8KoKto2CQ+5k VSW2p4QdgRIqPwEEj8mBNKB9BzfGyNCD8VAk1JR6fgYaS+Xp/nbzdZvzdg3/YaSn/Kpz IQD+4eisIUTicjTxgNLfA7Ka4wWJVD1nwiy7AQb07DRuKpbj8Tux5G3x0Zq9odNjaYHP u+Aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=WV81TTrUzfnxlK8f1IHJz4xXjnSjuTWSu4GCpZi6HEY=; b=jrTfeuFwBLXnvJlAOG3FLbgweHFLqpgUwJCctMEzxhS0xusv6hrKa+Gf2UIAD2rAeM ZeJ+DeOE9qdTSZu1kN9tIBgbEZHs31KDYlkzRCMkAFYPT9ANXnu1emxec/i2RMj3bQ0K afaG0t0dWebHZDCzLbyyW2QfIWNdLvBXmyKkFqihINhwhGvWLOLyUgKibAbZ8exMd/oP ePAxBdm0TOCFI3Y2wAN7kT6GLzI/41BZblKm/QSGcWJvZZCL64Hhs8nuQLruAiWEGh5c Va4jDf4OV6KQOHe5crZeqV9ZIvqzvlQwcWndngZJbt6jTCBGrUCX77SE/FFEaShoQeeq j6Xw== X-Gm-Message-State: AJIora8DO8yCGRLYAsCq4Dm2AEUrPW8IGZK8jzl3eRb/Hr0+dfOiNZvY H18AaJ30k/bR+WoZgyVSg9HzjQ== X-Google-Smtp-Source: AGRyM1tKUcbvm7Pv5J7R8O4WaT3he1b97HxgOQBsVTrAmlhI7zbpEK0Cj+SrJSn0blV18Pjxg6AVHA== X-Received: by 2002:aa7:cd91:0:b0:438:33a1:d5aa with SMTP id x17-20020aa7cd91000000b0043833a1d5aamr22690535edv.157.1656797845428; Sat, 02 Jul 2022 14:37:25 -0700 (PDT) Received: from localhost ([31.134.121.151]) by smtp.gmail.com with ESMTPSA id m7-20020a056402050700b004356c0d7436sm17483107edv.42.2022.07.02.14.37.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Jul 2022 14:37:25 -0700 (PDT) From: Sam Protsenko To: Marek Szyprowski , Krzysztof Kozlowski Cc: Joerg Roedel , Will Deacon , Robin Murphy , Janghyuck Kim , Cho KyongHo , Daniel Mentz , Sumit Semwal , iommu@lists.linux-foundation.org, iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/4] iommu/exynos: Add basic support for SysMMU v7 Date: Sun, 3 Jul 2022 00:37:20 +0300 Message-Id: <20220702213724.3949-1-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220702_143730_616203_C9E43E3F X-CRM114-Status: GOOD ( 14.46 ) 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 Existing exynos-iommu driver only supports SysMMU versions up to v5. But it's pretty much ready for basic usage with SysMMU v7, only small changes have to be done. As SysMMU version is tested dynamically (by reading the corresponding register), there is no need to introduce new compatible string. One major change is that SysMMU v7 can have different register layouts: - with Virtual Machine support - without Virtual Machine support That can be checked by reading the capability registers. In case the SysMMU IP-core is VM-capable, the VM registers have to be used, and some additional initialization is needed. That is the case on E850-96 board, which non-secure SysMMU (v7.4) implements VM-capable register set. The patch series was tested on E850-96 board. Because at the moment there are no SysMMU users for that board, the testing was done using so called "Emulated Translation" registers available on SysMMU v7. That allows one to initiate the translation from CPU, by writing to those registers, and then reading the corresponding TLB registers to find out the translation result. The testing driver can be found in [1] tree. [1] https://github.com/joe-skb7/linux/tree/e850-96-mainline-iommu Sam Protsenko (4): iommu/exynos: Set correct dma mask for SysMMU v5+ iommu/exynos: Check if SysMMU v7 has VM registers iommu/exynos: Use lookup based approach to access v7 registers iommu/exynos: Add minimal support for SysMMU v7 with VM registers drivers/iommu/exynos-iommu.c | 112 ++++++++++++++++++++++++++++++++--- 1 file changed, 104 insertions(+), 8 deletions(-)