Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp147693rwn; Wed, 7 Sep 2022 14:04:23 -0700 (PDT) X-Google-Smtp-Source: AA6agR4rbSFVbC6+o36yff6oYhNq2YAJZxocsnmoKGgNCN0R2KLNSMaBdFBJaw2f116tFI+VNIpT X-Received: by 2002:a17:902:8d88:b0:175:368a:5e1e with SMTP id v8-20020a1709028d8800b00175368a5e1emr5540132plo.5.1662584663473; Wed, 07 Sep 2022 14:04:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662584663; cv=none; d=google.com; s=arc-20160816; b=F5fgPmWiPgyENDWFUliB1c+nKFIGgz+8By1gIM/BxIcBMtA9T14XR0wPSeC2I5Qvn+ 9Ef9VD14jRnCVL75+STlSagB4A9HjeltDw/fp7/h5sZJ8t2OGmEOTFQ2S7qgzfOHYQnq crwGG+NXL6jtQ0sjToGzGGz2PAGhwz6JXFTdcthjl2qcMnNp5ZigfJN5nH6iIvVZwG6Q wBYJK26z//2TiA6UONsJfJXb/mRGlvB5+lD0hM5PISuZNYi1etoAClf9/Z4nf3ee9B/l wAAheH4oppZ7eiCRRs0neJy9pi+jK11W9lIgBTopIeh/IbgezulHAsggN07R+1qfaeiA 5SJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=ZdEDvmgBc/LN8XW+Bi9alIz4pZRxAfUdmOi8kET8D3I=; b=ycYvYzEf+aG5n/IZqGtGqOg43sYYHn92e3Bp7TBgWKvOxQItLUqiNqr1Sxw6hPN/mU e7ix/pvwQARCmInsKbPGqpJ2HzXIFG0askq/7SlC2K+ckotHSQJqeSkAZg5B4VfWSH5L LCGdkyUzaIaBpPfQpUEn719cVK7ZOwttCm2GMXdMIkU4Pwj6Vat5hiDeOc+u42wjgf2K 2v11e9Hdz/SM3SI59WENJrNKcRkkYsn+km0+TqQLE2rLXZkAbkfSNz+kULO+LUjflwqO fbpvClzI40xhxCpq3azR5el+8z7PUVCoYSxEnYXGUCEpsI1eotczA7pqrbsq5xcKrjtt /sog== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 199-20020a6302d0000000b00434277cd636si1322201pgc.414.2022.09.07.14.03.48; Wed, 07 Sep 2022 14:04:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230096AbiIGUkn (ORCPT + 99 others); Wed, 7 Sep 2022 16:40:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229436AbiIGUkm (ORCPT ); Wed, 7 Sep 2022 16:40:42 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F11C1BCC33; Wed, 7 Sep 2022 13:40:40 -0700 (PDT) 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 F3EEF106F; Wed, 7 Sep 2022 13:40:46 -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 5CF203F7B4; Wed, 7 Sep 2022 13:40:28 -0700 (PDT) Message-ID: <9e537066-525f-4a8c-ffc1-926ac130c6e6@arm.com> Date: Wed, 7 Sep 2022 21:40:21 +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: Saravana Kannan Cc: "Gupta, Nipun" , "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: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022-09-07 19:24, Saravana Kannan wrote: > On Wed, Sep 7, 2022 at 1:27 AM Robin Murphy wrote: >> >> 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). > > Ok this is what I was guessing was the reason, but didn't want to make > that assumption. > > So if there are other cases like AMBA, FSL-MC where the devices can do > direct DMA, why do those buses not need a #ifdef section in this > function like CDX? Or put another way, why does CDX need special treatment? Er, it doesn't? The only non-optional bus here is platform, since the others *can* be configured out and *are* #ifdefed accordingly. This patch is fine for the kernel it was based on, it'll just want rewriting now that I've cleaned all this horrible driver boilerplate up. And according to the thread on patch #4 there might need to be additional changes for CDX to express a reserved MSI region for SMMU support to actually work properly. Robin.