Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1177383rwd; Wed, 31 May 2023 10:22:50 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ745ZLbYX55jKs8xsuND8lyqLzMt14vSTBULpkcd34kSCP/flU6IvuzrW47JoyKPN85lPfh X-Received: by 2002:a05:6a20:8f02:b0:10c:6dbc:2806 with SMTP id b2-20020a056a208f0200b0010c6dbc2806mr8619206pzk.46.1685553769981; Wed, 31 May 2023 10:22:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685553769; cv=none; d=google.com; s=arc-20160816; b=qYkAx40yJLgsnKFUeSiqD0PlzC2LvFS0yAdvGy4X5GsE6GfWsaKYQ/5oijV4Fvug7Q iBM1uE5cWBJ7BBPwbwLS6oY4HflsAL+RC5X97smSEt8aMBsKaDbPN69Jc18Luhfvr437 Apyqh8wKMi7Jdedz/faaICdT2LNnJhzQO7lD2mx/Jr0mR2P2XIj6YWO4arR4eUPkptiy A0WGd5V3fkPZ8+4x3D8Cz7RsuR0KaSkM6yQo21aR72WQ5OHygeh7pWEu12TaHa5jWh5e MQZ+byLtOxeSx7JMdC8qoj89RjQ+xeqEF26/iIUy2YKe3Mz64JG8FtDcbakZyiq25qwo Ge4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=Pobis8OEL8sOvJW3Sc2fIcIxgg9BQBSPCmvqUrNX+Tw=; b=q81yPm21FFDai+eJtKFZ2IoH2gD+QKUZiq7D4QKQ3S6VcGMzIOHxNxX60UcqOtE0Tr nwl+738Ejmw87kEhAjoOZtKL78xShQ8TXD5o/AFDgoJcFKrkLBjqjb2mCqQbbd6ITEI5 wIOQcLS5mDUxUaSkHDaNCmFlA0JZYNps8sCNy9CHsPOMq6Jow3uD/vwiqzDZRZS5urNK pB2c/eMTeKGM0yZ1ciDKNKmRR57caIv262qMiM2qpJGbBhY3DUF2CtPAavlLzh3qSDiQ T8X0Xyfli0KBqaOm67wduURfCMXNgIrOM9rwE2nNV5dCTlSEO3h3mq2D1TuRP1Gm3Ynv C4Qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BYw8uvSK; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w13-20020a637b0d000000b00517aa9db92dsi1211929pgc.396.2023.05.31.10.22.23; Wed, 31 May 2023 10:22:49 -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=@kernel.org header.s=k20201202 header.b=BYw8uvSK; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230019AbjEaRM0 (ORCPT + 99 others); Wed, 31 May 2023 13:12:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229872AbjEaRMY (ORCPT ); Wed, 31 May 2023 13:12:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47CF593; Wed, 31 May 2023 10:12:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D33BB60DE9; Wed, 31 May 2023 17:12:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1AD87C4339C; Wed, 31 May 2023 17:12:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685553134; bh=+Ml1j+mRUJgmXvowGAHL7NQaz1pxH/evVJuvs2hRgso=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=BYw8uvSKtQqAvjDQ1+aUtduoiKuESJASt6I+ZqQvJA20//6FeGNg1f866MI0WmXrT ruslzv5W28Kb6NwsYa/Ad9LZOTko8KfxpqzYAE5WtJWktKj6c06tq4gtDVwv/0Pwaa mDJqQwfoyV5LITBF0ptaPtkQU62PGfvfZrYX/EoeTekMyu8tbdC4xAoE58FqEESk2p eFIBgNmgyA68cfWPAbwwdKubtp/VUXFKB8qg6me5gxLsMyb5ASRluj4WLsfXQxe4Un /blsTaEObx/P02q5JlLcYRt8k4n4G5SotCTPWArugBDQtmsIg6K2A530cZDiM7CjtV unjSWwsaoEZtA== Date: Wed, 31 May 2023 12:12:12 -0500 From: Bjorn Helgaas To: Thippeswamy Havalige Cc: krzysztof.kozlowski@linaro.org, bhelgaas@google.com, devicetree@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, robh+dt@kernel.org, lorenzo.pieralisi@arm.com, linux-arm-kernel@lists.infradead.org, bharat.kumar.gogada@amd.com, michals@amd.com, nagaradhesh.yeleswarapu@amd.com Subject: Re: [PATCH v4 3/3] PCI: xilinx-xdma: Add Xilinx XDMA Root Port driver Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230531083825.985584-4-thippeswamy.havalige@amd.com> X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,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 Wed, May 31, 2023 at 02:08:25PM +0530, Thippeswamy Havalige wrote: > Add support for Xilinx XDMA Soft IP core as Root Port. > > The Zynq UltraScale+ MPSoCs devices support XDMA soft IP module in > programmable logic. > > The integrated XDMA soft IP block has integrated bridge function that > can act as PCIe Root Port. > > Signed-off-by: Thippeswamy Havalige > Signed-off-by: Bharat Kumar Gogada > |Reported-by: kernel test robot > |Reported-by: Dan Carpenter > |Closes: https://lore.kernel.org/r/202305261250.2cs1phTS-lkp@intel.com/ Not relevant. These are basically review comments. > + Add support for the Xilinx PL DMA PCIe host bridge, > + The controller is an soft IP which can act as Root Port. > + If you know your system provides xilinx PCIe host controller > + bridge DMA as soft IP say Y; if you are not sure, say N. s/is an soft/is soft/ s/xilinx/Xilinx/ > +#define XILINX_PCIE_DMA_REG_IMR 0x0000013c > +#define XILINX_PCIE_DMA_REG_MSIBASE1 0x0000014c > +#define XILINX_PCIE_DMA_REG_MSI_HI_MASK 0x0000017c > ... > +#define XILINX_PCIE_DMA_IMR_ALL_MASK 0x0FF30FE9 > +#define XILINX_PCIE_DMA_IDR_ALL_MASK 0xFFFFFFFF Pick upper-case hex or lower-case hex and use it consistently. > +static inline bool xilinx_pl_dma_pcie_linkup(struct pl_dma_pcie *port) Name this *_pcie_link_up() (not *_pcie_linkup()) to match other drivers. > +static bool xilinx_pl_dma_pcie_valid_device(struct pci_bus *bus, unsigned int devfn) > +{ > + struct pl_dma_pcie *port = bus->sysdata; > + > + /* Check if link is up when trying to access downstream ports */ > + if (!pci_is_root_bus(bus)) { > + if (!xilinx_pl_dma_pcie_linkup(port)) > + return false; > + } else if (devfn > 0) > + /* Only one device down on each root port */ > + return false; > + > + return true; > +} > + > +static void __iomem *xilinx_pl_dma_pcie_map_bus(struct pci_bus *bus, > + unsigned int devfn, int where) > +{ > + struct pl_dma_pcie *port = bus->sysdata; > + > + if (!xilinx_pl_dma_pcie_valid_device(bus, devfn)) > + return NULL; Checking whether the link is up is racy because the link may be up, so xilinx_pl_dma_pcie_valid_device() returns true, then the link may go down before the read below. What happens then? If it's an error that you can recover from, it would better to skip the link up check and just handle the error. > + return port->reg_base + PCIE_ECAM_OFFSET(bus->number, devfn, where); > +} > + /*set the Bridge enable bit */ /* Set ... */ (add space before "Set" and capitalize it) Bjorn