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 X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C1A5C433DF for ; Thu, 6 Aug 2020 17:34:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8F1C1206B2 for ; Thu, 6 Aug 2020 17:34:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596735287; bh=DVhuP8UL/Dey1HcALXY+xyYV4uOthFoT+uVqZoV82jQ=; h=Date:From:To:Cc:Subject:In-Reply-To:List-ID:From; b=L0vPXMaLPZw38dH0ls4GRO5ot9zN/pM1+pE1OVcvUE5S8qQinjwIIHVLN404oddsR Cdlh9MG958G0OJKFjc4QdO7sZtQ3nLUwOBtb8Sy4DPkz/4fHSn+r3MFM47hrPVRSey O/EAvDP3UfPW6rFat49qUlOh0RcKzGWNd6SARSFk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730235AbgHFRep (ORCPT ); Thu, 6 Aug 2020 13:34:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:55134 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729687AbgHFRbo (ORCPT ); Thu, 6 Aug 2020 13:31:44 -0400 Received: from localhost (mobile-166-175-186-42.mycingular.net [166.175.186.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 208C823122; Thu, 6 Aug 2020 13:13:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596719609; bh=DVhuP8UL/Dey1HcALXY+xyYV4uOthFoT+uVqZoV82jQ=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=QYI7mLwkFAuWc+zsX3QicF8JtRLiIXc6aQxLd/8zcKr/Xiw2xjevHZmfWg71/6uHz aWbfsTAyUkDUcbnwj82ljAIRJE9ulBdYa1mFX3Zzro5zlPb9LiBEUxdRpP6yosMeeN TgYC+TfNJJL7A0ETqQDmr9zO9bK0U4B9SndYOw+o= Date: Thu, 6 Aug 2020 08:13:27 -0500 From: Bjorn Helgaas To: Lorenzo Pieralisi Cc: Bharat Kumar Gogada , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, bhelgaas@google.com, robh@kernel.org, maz@kernel.org Subject: Re: [PATCH v9 2/2] PCI: xilinx-cpm: Add Versal CPM Root Port driver Message-ID: <20200806131327.GA654295@bjorn-Precision-5520> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200806095445.GA9715@e121166-lin.cambridge.arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 06, 2020 at 10:54:45AM +0100, Lorenzo Pieralisi wrote: > On Wed, Aug 05, 2020 at 06:30:50PM -0500, Bjorn Helgaas wrote: > > On Wed, Aug 05, 2020 at 05:03:26PM -0500, Bjorn Helgaas wrote: > > > On Wed, Aug 05, 2020 at 10:39:28PM +0100, Lorenzo Pieralisi wrote: > > > > On Wed, Aug 05, 2020 at 03:43:58PM -0500, Bjorn Helgaas wrote: > > > > > On Tue, Jun 16, 2020 at 06:26:54PM +0530, Bharat Kumar Gogada wrote: > > > > > > - Add support for Versal CPM as Root Port. > > > > > > - The Versal ACAP devices include CCIX-PCIe Module (CPM). The integrated > > > > > > block for CPM along with the integrated bridge can function > > > > > > as PCIe Root Port. > > > > > > - Bridge error and legacy interrupts in Versal CPM are handled using > > > > > > Versal CPM specific interrupt line. > > > > > > > > > > > +static void xilinx_cpm_pcie_init_port(struct xilinx_cpm_pcie_port *port) > > > > > > +{ > > > > > > + if (cpm_pcie_link_up(port)) > > > > > > + dev_info(port->dev, "PCIe Link is UP\n"); > > > > > > + else > > > > > > + dev_info(port->dev, "PCIe Link is DOWN\n"); > > > > > > + > > > > > > + /* Disable all interrupts */ > > > > > > + pcie_write(port, ~XILINX_CPM_PCIE_IDR_ALL_MASK, > > > > > > + XILINX_CPM_PCIE_REG_IMR); > > > > > > + > > > > > > + /* Clear pending interrupts */ > > > > > > + pcie_write(port, pcie_read(port, XILINX_CPM_PCIE_REG_IDR) & > > > > > > + XILINX_CPM_PCIE_IMR_ALL_MASK, > > > > > > + XILINX_CPM_PCIE_REG_IDR); > > > > > > + > > > > > > + /* > > > > > > + * XILINX_CPM_PCIE_MISC_IR_ENABLE register is mapped to > > > > > > + * CPM SLCR block. > > > > > > + */ > > > > > > + writel(XILINX_CPM_PCIE_MISC_IR_LOCAL, > > > > > > + port->cpm_base + XILINX_CPM_PCIE_MISC_IR_ENABLE); > > > > > > + /* Enable the Bridge enable bit */ > > > > > > + pcie_write(port, pcie_read(port, XILINX_CPM_PCIE_REG_RPSC) | > > > > > > + XILINX_CPM_PCIE_REG_RPSC_BEN, > > > > > > + XILINX_CPM_PCIE_REG_RPSC); > > > > > > +} > > > > > > + > > > > > > +/** > > > > > > + * xilinx_cpm_pcie_parse_dt - Parse Device tree > > > > > > + * @port: PCIe port information > > > > > > + * @bus_range: Bus resource > > > > > > + * > > > > > > + * Return: '0' on success and error value on failure > > > > > > + */ > > > > > > +static int xilinx_cpm_pcie_parse_dt(struct xilinx_cpm_pcie_port *port, > > > > > > + struct resource *bus_range) > > > > > > +{ > > > > > > + struct device *dev = port->dev; > > > > > > + struct platform_device *pdev = to_platform_device(dev); > > > > > > + struct resource *res; > > > > > > + > > > > > > + port->cpm_base = devm_platform_ioremap_resource_byname(pdev, > > > > > > + "cpm_slcr"); > > > > > > + if (IS_ERR(port->cpm_base)) > > > > > > + return PTR_ERR(port->cpm_base); > > > > > > + > > > > > > + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg"); > > > > > > + if (!res) > > > > > > + return -ENXIO; > > > > > > + > > > > > > + port->cfg = pci_ecam_create(dev, res, bus_range, > > > > > > + &pci_generic_ecam_ops); > > > > > > > > > > Aren't we passing an uninitialized pointer (bus_range) here? This > > > > > looks broken to me. > > > > > > > > > > The kernelci build warns about it: > > > > > https://kernelci.org/build/next/branch/master/kernel/next-20200805/ > > > > > > > > > > /scratch/linux/drivers/pci/controller/pcie-xilinx-cpm.c:557:39: warning: variable 'bus_range' is uninitialized when used here [-Wuninitialized] > > > > > > > > > > I'm dropping this for now. I can't believe this actually works. > > > > > > > > It is caused by my rebase to fix -next after the rework in pci/misc > > > > (I had to drop the call to pci_parse_request_of_pci_ranges()). > > > > > > > > I will look into this tomorrow if Rob does not beat me to it. > > > > > > > > Apologies, it is a new driver that was based on an interface > > > > that is being reworked, for good reasons, in pci/misc. > > > > > > Oh, yep, I think I see what happened. I'll try to fix this in hopes > > > of making linux-next tonight. > > > > OK, I think I fixed it. Man, that was a lot of work for a git novice > > like me ;) Current head: 6f119ec8d9c8 ("Merge branch 'pci/irq-error'") > > Sorry about that. No problem, if I were less OCD and more smart about git, it would have been trivial. But it did make it into the Aug 6 linux-next, so that's good!