Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1380616pxb; Fri, 21 Jan 2022 17:05:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJyEyyBL07p7/K3ISYJ4DcNCxFaTn+aYHr185BiLpjPr8V3lnZnBIBORA84RtcvTe7Z44Vzs X-Received: by 2002:a17:902:830c:b0:14a:dffe:d2f2 with SMTP id bd12-20020a170902830c00b0014adffed2f2mr6321160plb.24.1642813527763; Fri, 21 Jan 2022 17:05:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642813527; cv=none; d=google.com; s=arc-20160816; b=VOH3ohMcCMs7VwUBq1LoP0+5JryzG8i4JvexalD3Vl5MWNkEv43fzeFkPWJQJLexL+ 2fAF4agSLnWMquBrR70rJnXn4PndWI0mQ2f1jNkj+X6ZiDqAaP1urSAdYVh72GSV0Nxg Pp9wRhTwZ3kZt7UBAySXT9Jd8qiSZvcRToZLOZD/kjVP2hkeLAj2PjbxCG1FqWzxQFj5 jYDWNBBoorFGvvF4sdCBNwOA6IMab0jLjH4hKu0LAFGLUNF9h4cgMyjlHdCi5MaUQ8aq x0cCcw3SumGDNA44PlP6aHE9U7Bj98F1Y+xLzpjokdYeebtWecWqE8qIOS6xF0YmY/b2 j58g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:cms-type:content-transfer-encoding :in-reply-to:from:cc:to:content-language:subject:user-agent :mime-version:date:message-id:dkim-signature:dkim-filter; bh=RrzB8h/bMnzcV+j+1Jb+7Ew0T99xNnjQpPe8goU3pU0=; b=wP90qAN26F6oTGN+cInXG/KHQnwjnQSvmTi6B/uzyM4irMXXDkyA/wSJZo6Nnb2E9A e2Ro9T179rxAEmR6/SCf1uB/7e65fJU+zEzAe+Gi6RUthOhKvYRGewPFnDNMDOaxl8ZV oKtqJLMxb4FBeJPC8S8lkdKwjiBR4yWerQN+8hsQrdHRLgzbhPU/bO0+8E5RuuWh6f6+ XG3PNegVhVmAnNUXSocYvX20UXegfp0dv6EOyFsJyyJuyYaKdGEchR+IvyWiw0HY8TAs OIlSK//MnJUmzBS5MqWO2/uPhi1E7Ul2SmqfeBr5I4INFCD5HuqmtHtZ9lil/iRQ8quY oYQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=r+VH1Tq8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k11si7727293pgh.102.2022.01.21.17.05.16; Fri, 21 Jan 2022 17:05:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=r+VH1Tq8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380378AbiAUMbZ (ORCPT + 99 others); Fri, 21 Jan 2022 07:31:25 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:61614 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350448AbiAUMbW (ORCPT ); Fri, 21 Jan 2022 07:31:22 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20220121123121euoutp0154f669487e13b26dc040cde6572b8e64~MSQxYre8r1009410094euoutp01Y for ; Fri, 21 Jan 2022 12:31:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20220121123121euoutp0154f669487e13b26dc040cde6572b8e64~MSQxYre8r1009410094euoutp01Y DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1642768281; bh=RrzB8h/bMnzcV+j+1Jb+7Ew0T99xNnjQpPe8goU3pU0=; h=Date:Subject:To:Cc:From:In-Reply-To:References:From; b=r+VH1Tq8fsFunC7dJNx/uB0Iy75wVmmWUEVWCzYZbVJ2bkrCJyP7SxrCw0BzAZKwV 0GfRHWH1RmU1T79FDIcF/T0zZvtLu6jnAG24LP89yx4BlMD6kRbkp1tfPizmIqHe9v 8qjtnOBpD1XozSsAL7ZN3BLdAQsMQ3dJD6IfHRjM= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20220121123120eucas1p294c92264f37be911af0be1cb16846432~MSQw7SOKC2476624766eucas1p2m; Fri, 21 Jan 2022 12:31:20 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 14.E8.10009.897AAE16; Fri, 21 Jan 2022 12:31:20 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20220121123120eucas1p1b3dd2371deca8485b9d9371097fdb14f~MSQwXdv4K1413914139eucas1p1W; Fri, 21 Jan 2022 12:31:20 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20220121123120eusmtrp24fb48e291e91fbc00debcfbe610aa982~MSQwWYdhl0056800568eusmtrp2Y; Fri, 21 Jan 2022 12:31:20 +0000 (GMT) X-AuditID: cbfec7f2-e95ff70000002719-5d-61eaa7987050 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 2E.18.09522.897AAE16; Fri, 21 Jan 2022 12:31:20 +0000 (GMT) Received: from [106.210.134.192] (unknown [106.210.134.192]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220121123119eusmtip13e3280ba3efd5ab0ad34cf54b204d2a2~MSQvLEE7k0395503955eusmtip1X; Fri, 21 Jan 2022 12:31:19 +0000 (GMT) Message-ID: <54b76143-dff3-8a19-7ab9-57fb80d59743@samsung.com> Date: Fri, 21 Jan 2022 13:31:17 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [RFC 2/3] iommu/samsung: Introduce Exynos sysmmu-v8 driver Content-Language: en-US To: Sam Protsenko , Krzysztof Kozlowski Cc: Joerg Roedel , Will Deacon , Sumit Semwal , Rob Herring , Catalin Marinas , Cho KyongHo , Hyesoo Yu , Janghyuck Kim , Jinkyu Yang , Alex , Carlos Llamas , Daniel Mentz , Erick Reyes , "J . Avila" , Jonglin Lee , Mark Salyzyn , Thierry Strudel , Will McVicker , Shawn Guo , Bjorn Andersson , linux-samsung-soc@vger.kernel.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org From: Marek Szyprowski In-Reply-To: Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA02SfUxTVxjGd27bey81xduC6REWlnViNhNAki0epzG6MWkAs804t4gRL3gH VSispdvcQgSlDdTysZkIVESmY7hCEUqDo86PVoQMHFQaWtHCdHYy60qFYjbka16KG/897/O+ v/fj5JAcUQUeQcrk+YxCTmdLcD63o3t6IKa60Uuvf9QWg3ptCzjquzrORf4fdABNXRskUGWJ GkOerrMEmvU6uWiu1M5D9Vc3ofZaJbIYrhNoxl3GQ6WnWgnU5vsHQ6YHTh5yWGpxVD1wBUPz ZVaA1Je7CNRQ1IGjsfLn3p9mMeodCRCoSWMAqNj9FjJMLoCtEVKPtQ6TNtc1A6m+sAyX1ptU UpOhFJe6nT/j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 20220121123120eucas1p1b3dd2371deca8485b9d9371097fdb14f X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20220121110911eucas1p28d11e1b04773e8174b9d65f011dc1977 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20220121110911eucas1p28d11e1b04773e8174b9d65f011dc1977 References: <20220120201958.2649-1-semen.protsenko@linaro.org> <20220120201958.2649-3-semen.protsenko@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sam, On 21.01.2022 12:08, Sam Protsenko wrote: > On Fri, 21 Jan 2022 at 10:40, Krzysztof Kozlowski > wrote: >> On 20/01/2022 21:19, Sam Protsenko wrote: >>> Introduce new driver for modern Exynos ARMv8 SoCs, e.g. Exynos850. Also >>> it's used for Google's GS101 SoC. >>> >>> This is squashed commit, contains next patches of different authors. See >>> `iommu-exynos850-dev' branch for details: [1]. >>> >>> Original authors (Samsung): >>> >>> - Cho KyongHo >>> - Hyesoo Yu >>> - Janghyuck Kim >>> - Jinkyu Yang >>> >>> Some improvements were made by Google engineers: >>> >>> - Alex >>> - Carlos Llamas >>> - Daniel Mentz >>> - Erick Reyes >>> - J. Avila >>> - Jonglin Lee >>> - Mark Salyzyn >>> - Thierry Strudel >>> - Will McVicker >>> >>> [1] https://protect2.fireeye.com/v1/url?k=19bd3571-46260c3c-19bcbe3e-0cc47aa8f5ba-8a160a7fd38bb35a&q=1&e=eb3f71b3-8df2-46c6-b6d8-0a931ef99024&u=https%3A%2F%2Fgithub.com%2Fjoe-skb7%2Flinux%2Ftree%2Fiommu-exynos850-dev >>> >>> Signed-off-by: Sam Protsenko >>> --- >>> drivers/iommu/Kconfig | 13 + >>> drivers/iommu/Makefile | 3 + >>> drivers/iommu/samsung-iommu-fault.c | 617 +++++++++++ >>> drivers/iommu/samsung-iommu-group.c | 50 + >>> drivers/iommu/samsung-iommu.c | 1521 +++++++++++++++++++++++++++ >>> drivers/iommu/samsung-iommu.h | 216 ++++ >>> 6 files changed, 2420 insertions(+) >>> create mode 100644 drivers/iommu/samsung-iommu-fault.c >>> create mode 100644 drivers/iommu/samsung-iommu-group.c >>> create mode 100644 drivers/iommu/samsung-iommu.c >>> create mode 100644 drivers/iommu/samsung-iommu.h >>> >> Existing driver supports several different Exynos SysMMU IP block >> versions. Several. Please explain why it cannot support one more version? >> >> Similarity of vendor driver with mainline is not an argument. >> >>> ... >> You just copy-pasted vendor stuff, without actually going through it. >> >> It is very disappointing because instead of putting your own effort, you >> expect community to do your job. >> >> What the hell is CONFIG_EXYNOS_CONTENT_PATH_PROTECTION? >> >> I'll stop reviewing. Please work on extending existing driver. If you >> submitted something nice and clean, ready for upstream, instead of >> vendor junk, you could get away with separate driver. But you did not. >> It looks really bad. >> > Krzysztof, that's not what I asked in my patch 0/3. I probably wasn't > really clear, sorry. Let me please try and describe that better, and > maybe provide some context. > > I'm just starting to work on that driver, it's basically downstream > version of it. Of course I'm going to rework it before sending the > actual patch series (that's why this series has RFC tag). I'd never > asked community to do my job for me and really review the downstream > driver! I just want to know from the starters some *very* basic and > high-level info, which could help me to rework the driver in correct > way. Like naming of files, compatible strings, should it be part of > existing driver or it's ok to have it as another platform_driver. In > other words, that kind of "review" shouldn't take more than 2 minutes > of your time. And it could spare us all unneeded extra review rounds > in future. Right now I don't need the code review per se (and I'm > really sorry you had to spend your time on that, knowing how busy > maintainers can be during the MW). I thought about omitting the code > at all, only asking the questions, but then I figured it's a good idea > to attach some code for the reference. Maybe it wasn't a good idea > after all. > > For the record, I'm well aware that we don't send downstream code > without making it upstreamable first, and I know it must be tested > well, etc. For example, you already saw me sending clk-exynos850 > driver, which I re-implemented from scratch, and it has ~0.0% of > downstream code. So why would I change my policy about that all of the > sudden... Anyway, hope you understand now that there weren't any ill > intentions on my side, w.r.t. this RFC. Well, for starting point the existing exynos-iommu driver is really enough. I've played a bit with newer Exyos SoCs some time ago. If I remember right, if you limit the iommu functionality to the essential things like mapping pages to IO-virtual space, the hardware differences between SYSMMU v5 (already supported by the exynos-iommu driver) and v7 are just a matter of changing a one register during the initialization and different bits the page fault reason decoding. You must of course rely on the DMA-mapping framework and its implementation based on mainline DMA-IOMMU helpers. All the code for custom iommu group(s) handling or extended fault management are not needed for the initial version. The IOMMU driver on its own doesn't really make much sense, so you need the other driver/device pair which will make use of it. You have mentioned DPU, so you are trying to bring the display stack. Please check the existing Exynos DRM driver(s). They nicely use DMA-mapping framework and are really modular, so adding hw-specific sub-drivers for Exynos850 shouldn't be that hard. Don't expect that the vendor's drivers based on custom frameworks will work there though. Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland