From mboxrd@z Thu Jan 1 00:00:00 1970 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 BC382C38145 for ; Wed, 7 Sep 2022 08:37:30 +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-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=D75ueld1AuVQuOcH1cX/3gNetPKLqqJorN/hjJpzzB4=; b=fYwG7fpPNPf0rj /x/5UhCurOcOIx6AvZ4NHhczi29eWh26GdHpohkOsgNDUE3lfHUMeMYppOclFMLEZqPqNWF99F3/c x2Zv3v+IhTk5oX7+TIFKGDMCY/ccYxID+j1RwitmuSc6YDEMA/WiIzR05LXgvZy6piKj1PS6iyufZ WB+MdJWXOyUm8tQgz3dL3VvCVSEGVnd6YX8XVNMDACaMlALitqvna/JZxt63tEP+h5CxXa4bGRXjz jQw9LHWNwMa1Mli9acOVlTzhK5wv6D1dhtRoXnbUMep/Y0ZAUQ54x9r7sVfGEsJWdHRe118IedCe0 0FAbhA3Cir35F8pl3h7A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVqXe-004LWI-05; Wed, 07 Sep 2022 08:36:14 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVqPF-004FVL-HV for linux-arm-kernel@lists.infradead.org; Wed, 07 Sep 2022 08:27:36 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4BE24D6E; Wed, 7 Sep 2022 01:27:34 -0700 (PDT) Received: from [10.57.15.197] (unknown [10.57.15.197]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A58783F534; Wed, 7 Sep 2022 01:27:48 -0700 (PDT) Message-ID: Date: Wed, 7 Sep 2022 09:27:14 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:102.0) Gecko/20100101 Thunderbird/102.2.1 Subject: Re: [RFC PATCH v3 3/7] iommu/arm-smmu-v3: support ops registration for CDX bus Content-Language: en-GB To: "Gupta, Nipun" , Saravana Kannan Cc: "robh+dt@kernel.org" , "krzysztof.kozlowski+dt@linaro.org" , "gregkh@linuxfoundation.org" , "rafael@kernel.org" , "eric.auger@redhat.com" , "alex.williamson@redhat.com" , "cohuck@redhat.com" , "Gupta, Puneet (DCG-ENG)" , "song.bao.hua@hisilicon.com" , "mchehab+huawei@kernel.org" , "maz@kernel.org" , "f.fainelli@gmail.com" , "jeffrey.l.hugo@gmail.com" , "Michael.Srba@seznam.cz" , "mani@kernel.org" , "yishaih@nvidia.com" , "jgg@ziepe.ca" , "jgg@nvidia.com" , "will@kernel.org" , "joro@8bytes.org" , "masahiroy@kernel.org" , "ndesaulniers@google.com" , "linux-arm-kernel@lists.infradead.org" , "linux-kbuild@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "devicetree@vger.kernel.org" , "kvm@vger.kernel.org" , "okaya@kernel.org" , "Anand, Harpreet" , "Agarwal, Nikhil" , "Simek, Michal" , "Radovanovic, Aleksandar" , "git (AMD-Xilinx)" References: <20220803122655.100254-1-nipun.gupta@amd.com> <20220906134801.4079497-1-nipun.gupta@amd.com> <20220906134801.4079497-4-nipun.gupta@amd.com> From: Robin Murphy In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220907_012733_740490_DA8C2C0D X-CRM114-Status: GOOD ( 18.65 ) 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: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2022-09-07 04:17, Gupta, Nipun wrote: > [AMD Official Use Only - General] > > > >> -----Original Message----- >> From: Saravana Kannan >> Sent: Wednesday, September 7, 2022 5:41 AM >> To: Gupta, Nipun >> Cc: robh+dt@kernel.org; krzysztof.kozlowski+dt@linaro.org; >> gregkh@linuxfoundation.org; rafael@kernel.org; eric.auger@redhat.com; >> alex.williamson@redhat.com; cohuck@redhat.com; Gupta, Puneet (DCG-ENG) >> ; song.bao.hua@hisilicon.com; >> mchehab+huawei@kernel.org; maz@kernel.org; f.fainelli@gmail.com; >> jeffrey.l.hugo@gmail.com; Michael.Srba@seznam.cz; mani@kernel.org; >> yishaih@nvidia.com; jgg@ziepe.ca; jgg@nvidia.com; robin.murphy@arm.com; >> will@kernel.org; joro@8bytes.org; masahiroy@kernel.org; >> ndesaulniers@google.com; linux-arm-kernel@lists.infradead.org; linux- >> kbuild@vger.kernel.org; linux-kernel@vger.kernel.org; >> devicetree@vger.kernel.org; kvm@vger.kernel.org; okaya@kernel.org; Anand, >> Harpreet ; Agarwal, Nikhil >> ; Simek, Michal ; >> Radovanovic, Aleksandar ; git (AMD-Xilinx) >> >> Subject: Re: [RFC PATCH v3 3/7] iommu/arm-smmu-v3: support ops registration >> for CDX bus >> >> [CAUTION: External Email] >> >> On Tue, Sep 6, 2022 at 6:48 AM Nipun Gupta wrote: >>> >>> With new CDX bus supported for AMD FPGA devices on ARM >>> platform, the bus requires registration for the SMMU v3 >>> driver. >>> >>> Signed-off-by: Nipun Gupta >>> --- >>> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 16 ++++++++++++++-- >>> 1 file changed, 14 insertions(+), 2 deletions(-) >>> >>> diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c >> b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c >>> index d32b02336411..8ec9f2baf12d 100644 >>> --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c >>> +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c >>> @@ -29,6 +29,7 @@ >>> #include >>> >>> #include >>> +#include >>> >>> #include "arm-smmu-v3.h" >>> #include "../../iommu-sva-lib.h" >>> @@ -3690,16 +3691,27 @@ static int arm_smmu_set_bus_ops(struct >> iommu_ops *ops) >>> if (err) >>> goto err_reset_pci_ops; >>> } >>> +#endif >>> +#ifdef CONFIG_CDX_BUS >>> + if (cdx_bus_type.iommu_ops != ops) { >>> + err = bus_set_iommu(&cdx_bus_type, ops); >>> + if (err) >>> + goto err_reset_amba_ops; >>> + } >> >> I'm not an expert on IOMMUs, so apologies if the question is stupid. >> >> Why does the CDX bus need special treatment here (like PCI) when there >> are so many other busses (eg: I2C, SPI, etc) that don't need any >> changes here? > > AFAIU, the devices on I2C/SPI does not use SMMU. Apart from PCI/AMBA, > FSL-MC is another similar bus (on SMMUv2) which uses SMMU ops. > > The devices here are behind SMMU. Robin can kindly correct or add > more here from SMMU perspective. Indeed, there is no need to describe and handle how DMA may or may not be translated for I2C/SPI/USB/etc. because they are not DMA-capable buses (in those cases the relevant bus *controller* often does DMA, but it does that for itself as the platform/PCI/etc. device it is). Note that I have a series pending[1] that will make this patch a whole lot simpler. Thanks, Robin. [1] https://lore.kernel.org/linux-iommu/cover.1660572783.git.robin.murphy@arm.com/T/#t > > Thanks, > Nipun > >> >> -Saravana >> >>> #endif >>> if (platform_bus_type.iommu_ops != ops) { >>> err = bus_set_iommu(&platform_bus_type, ops); >>> if (err) >>> - goto err_reset_amba_ops; >>> + goto err_reset_cdx_ops; >>> } >>> >>> return 0; >>> >>> -err_reset_amba_ops: >>> +err_reset_cdx_ops: >>> +#ifdef CONFIG_CDX_BUS >>> + bus_set_iommu(&cdx_bus_type, NULL); >>> +#endif >>> +err_reset_amba_ops: __maybe_unused; >>> #ifdef CONFIG_ARM_AMBA >>> bus_set_iommu(&amba_bustype, NULL); >>> #endif >>> -- >>> 2.25.1 >>> _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel