Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp309184rwn; Wed, 7 Sep 2022 17:17:14 -0700 (PDT) X-Google-Smtp-Source: AA6agR47EyLjtzpcmz62LfZZP5yvVnooSqvp6SPaoa39zEa3cyz62WJvip+nKKjboGcQ9Hpa1qSP X-Received: by 2002:a05:6a00:114c:b0:528:2c7a:630e with SMTP id b12-20020a056a00114c00b005282c7a630emr6505396pfm.86.1662596233916; Wed, 07 Sep 2022 17:17:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662596233; cv=none; d=google.com; s=arc-20160816; b=l7w7YrvRfYVym2tU+OySRMx7JyO+RCEG4EbkSfgPhA0ZjulfBzhw27zr+q2Fyu1cOa GopXMm2Z3NhkF0g98JUPKlHPoUe91Jb+wTCp5/98R/LcXuKV4O4VPIFr0j5Nt595Trfg JlhaezMtohZYq3Y1jHTgwjTi7G5FxIaeZwK0d1rK+3HJpBGoofWwICwUXhic8Wg/r7pI dHWYPsaQ0Ds+pyh7RTioAzYC8KK2szaPJqgu2U2YInCKZSDfLXMavlO2BTryLCmicvhJ 3XRFKt4HqY8ZlA1fz2mK+4mbMzV3m/7mh96kI6qMFbjSuec1pZFRnUiR7/udd/CdrwJV bbzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=GUHy3tTXYEVlHWPOZt/B5s9dwh1oEap8QDDRaqRD42s=; b=bmLvX4vD+Uol6nFRHmVFyaSEgDwWvhkGTV40pMEHiJ3CB6m6rSkhENZm2d1rryz2XM no8jsvUt8O5Lrikm/q95xAfa1sfFhI1zGyFrLzJko/nbfHiMw39nJtamirxQwPOrat/F ++lONBBrFwGJDF1ZLZzhdr5NLZ5L/gS0lk2RX23LyXu9U+jaX8r9c3gNPIyPZVW9y7nQ lidZpNjaapnJnF0gIFnDSJDL588YYv2/Hf+HJ23gByl5/hQdX+QBrFj1oHZ2ZbM5KUoc t6xAO0VhV/dTUzt6z9RaGGNcDwriu+qTAl8vCIRP4MlFG3Y1k/PsFvcj14SwacACnas2 Cjwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=EkFoA2DU; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l10-20020a17090aaa8a00b002005df50fb5si550970pjq.131.2022.09.07.17.16.58; Wed, 07 Sep 2022 17:17:13 -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; dkim=pass header.i=@google.com header.s=20210112 header.b=EkFoA2DU; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230012AbiIHAPG (ORCPT + 99 others); Wed, 7 Sep 2022 20:15:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230038AbiIHAPE (ORCPT ); Wed, 7 Sep 2022 20:15:04 -0400 Received: from mail-yb1-xb34.google.com (mail-yb1-xb34.google.com [IPv6:2607:f8b0:4864:20::b34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 024CE5850C for ; Wed, 7 Sep 2022 17:14:58 -0700 (PDT) Received: by mail-yb1-xb34.google.com with SMTP id y82so15784708yby.6 for ; Wed, 07 Sep 2022 17:14:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=GUHy3tTXYEVlHWPOZt/B5s9dwh1oEap8QDDRaqRD42s=; b=EkFoA2DUckJoc39LOiNtYCaU9cFbXVmazyNV12a3KStazGUhhJR1U6XnXODK0TIRz4 +N76WdVdDqe2MYv/D4T4eFF42LX7csfZYrgd36cDl4ZF2OYpoYcAFEEFgAyx8F58tbal P0WKobLZgcRhq24wI/kQMtsCJmAgIaCYCjQo4lYSmesUuH6LFbT1w/aGaw0ARdAlSFXd J2GIhzFoViVMPvlNGlBbz2nzmN6QV9n01RRBkPte6KTFKKFHwsasefqsYFjEHKOZjYhz aBKTtDKp2Rsg+pzX3OQRfEjjk6SnI7xmv7hIDzZp8hxzLZ5KYlmECPeru8AFaesdazSU faJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=GUHy3tTXYEVlHWPOZt/B5s9dwh1oEap8QDDRaqRD42s=; b=F33mHNry7yiV1cg+AWjNs0vsmRsrO5OeO/kJm+23l1gNWO53j8GDfAOm84azCorOvl B2ZCG4/RLZMLzDjbrRTOb/yEJjgKQwJqZ930JJU6ElJJiA2zFotQfXo9IcPaNc5vUQvT 9aZXryi1dkEokdJSE+MxP11R5+K87Wnm8vq4GlCRZTLGuKjMSO+V94xrZ4siFqh8shQG IyHmyJl4uoOQ9/kx3GID19zi7Le2uxT94N0sqauJFN3pGReIC+THJHSnK9a3+9zoKx83 34Wp7+WevyMBEv3rlVta/O0/JNDuo0qi+cS4xFkYG0aRZEwGWKjRK5+j67axvTiR60Vs c3mg== X-Gm-Message-State: ACgBeo2NbMUS1sr42C9J020FNqrKupJFHRz3muHsk6JWTWRrjtfOgCjw W0muNLJzxXe7rS4GfKU6DvVCcu/0iaqYWlmfALl7Sg== X-Received: by 2002:a25:1486:0:b0:6a8:f3e1:58ba with SMTP id 128-20020a251486000000b006a8f3e158bamr4883435ybu.80.1662596096986; Wed, 07 Sep 2022 17:14:56 -0700 (PDT) MIME-Version: 1.0 References: <20220803122655.100254-1-nipun.gupta@amd.com> <20220906134801.4079497-1-nipun.gupta@amd.com> <20220906134801.4079497-4-nipun.gupta@amd.com> <9e537066-525f-4a8c-ffc1-926ac130c6e6@arm.com> In-Reply-To: <9e537066-525f-4a8c-ffc1-926ac130c6e6@arm.com> From: Saravana Kannan Date: Wed, 7 Sep 2022 17:14:20 -0700 Message-ID: Subject: Re: [RFC PATCH v3 3/7] iommu/arm-smmu-v3: support ops registration for CDX bus To: Robin Murphy 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)" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable 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 Wed, Sep 7, 2022 at 1:40 PM Robin Murphy wrote: > > 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. Ah ok. Also I somehow missed the #ifdef AMBA there and thought there was only #ifdef PCI and the rest of the buses somehow got it working without having to muck around arm-smmu-v3.c. Thanks for the explanation. I'm done here :) -Saravana > 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.