Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1785649ybh; Tue, 14 Jul 2020 07:20:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/qFinzEgxyZbZ8CJf2tnr5rMpCD13rUheH2qvFilY88j2SlzdBUcU5L5yccjViR6CQMqg X-Received: by 2002:a17:906:2b12:: with SMTP id a18mr4654183ejg.186.1594736412199; Tue, 14 Jul 2020 07:20:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594736412; cv=none; d=google.com; s=arc-20160816; b=H/G19muoPz7xqXi0B82Ji90hFNkXuiwDQj9429QqRPGoZa3kKHuP20yreI7S0j4e2W 0zVNg5dbUjCG3QzcN68Wr8SQk9V4DvhyvcBKWJneXrNtNyv4KL0AyLADhDLgj7Nd/qMD kYbEGyI74GU4enoZnSzqKrCB5axiQ4pz3xc1/Cw9c04Ugik2+d+a2B/RcAUH7ERpwKY3 cfMjdwVsoTY76rGN5+DxpfamyXuo6a0PBvfseO/R/f4MjorbSEgTkG8Fi5n141/VjTAk L1mMdXI5K3414kphEm3JrMi40Ka8TlAAjuv5FniQjEQze469RujSQ3BTBYZ1UL4f6K7b gNRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=ry891l2ccwBK6jwvjqRHd2yVLYrQde51dupu47OPLSY=; b=ftpGoKy8CRuKZ9L6tpZazWDd706fvJGYSM8k7gf2Dxv+BhatU+HouH9vCVkCMZ7Rl5 gMS0FPXlCDMnJ+9ISsxlZIVa8ghYVlA7Fi9EKOzKQMXN0BgwZcC3OdSe6vG9w5OuRcYq fyAj9o600ccQt9TbIaJZsFUFd4/lcHEIn4AdtEX6N2yMymxRmXEpjBbCbcu7fhpSobH4 nfQsJp92o8eTSwOlds5bQRdSI86rB9UKkEx5+FCTzGV8K1BQhzuYyIgEOQJWF0qP/vtT pImNqxIh599mvBhQHNspsmhe7sW2tI1pLSX0VyrCLqFahnAXXkZ0zL+tm+b9AmvysKvR tm8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tEXKXZHY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h11si12242328edl.235.2020.07.14.07.19.48; Tue, 14 Jul 2020 07:20:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tEXKXZHY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1726945AbgGNORg (ORCPT + 99 others); Tue, 14 Jul 2020 10:17:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:46678 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725876AbgGNORg (ORCPT ); Tue, 14 Jul 2020 10:17:36 -0400 Received: from mail-ot1-f45.google.com (mail-ot1-f45.google.com [209.85.210.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6CC9F2250F; Tue, 14 Jul 2020 14:17:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594736255; bh=I3SPnbWvrlqPWcUw8Ly0jOC7pjCtY/t7mW2VHJnhfYs=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=tEXKXZHYMSeUr2w1D0flXG1iPI7kKgnsLloe6dJl3ETNeb8ac8ovqDagLCMUZwgda GI1HZ8mR0RevDrYoveCU6YF31GxJAllUFFOMpqAFztvrHG3ZWhqBw+DqBo+g0qy97l gG2919JA2DgwTnrxd45dLaORxGEcOGz2OttVGa8k= Received: by mail-ot1-f45.google.com with SMTP id 72so13142479otc.3; Tue, 14 Jul 2020 07:17:35 -0700 (PDT) X-Gm-Message-State: AOAM531DHlZSZRw/1P9vovI/hit/afpa0KSDX4OvXlIDiFI96Va2LYlX 8B4uD6xFzPHChE3P24p2DzprC8BAgizK0z6g7g== X-Received: by 2002:a9d:4002:: with SMTP id m2mr4313931ote.129.1594736254805; Tue, 14 Jul 2020 07:17:34 -0700 (PDT) MIME-Version: 1.0 References: <1592312214-9347-1-git-send-email-bharat.kumar.gogada@xilinx.com> <1592312214-9347-3-git-send-email-bharat.kumar.gogada@xilinx.com> <20200713112613.GB25865@e121166-lin.cambridge.arm.com> In-Reply-To: From: Rob Herring Date: Tue, 14 Jul 2020 08:17:21 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v9 2/2] PCI: xilinx-cpm: Add Versal CPM Root Port driver To: Bharat Kumar Gogada Cc: "lorenzo.pieralisi@arm.com" , PCI , "linux-kernel@vger.kernel.org" , Bjorn Helgaas , Marc Zyngier Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 13, 2020 at 6:24 AM Bharat Kumar Gogada wrote: > > > Subject: Re: [PATCH v9 2/2] PCI: xilinx-cpm: Add Versal CPM Root Port driver > > > > On Fri, Jul 10, 2020 at 09:16:57AM -0600, Rob Herring wrote: > > > On Tue, Jun 16, 2020 at 6:57 AM 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. > > > > > > > > Signed-off-by: Bharat Kumar Gogada > > > > --- > > > > drivers/pci/controller/Kconfig | 8 + > > > > drivers/pci/controller/Makefile | 1 + > > > > drivers/pci/controller/pcie-xilinx-cpm.c | 617 > > > > +++++++++++++++++++++++++++++++ > > > > 3 files changed, 626 insertions(+) > > > > create mode 100644 drivers/pci/controller/pcie-xilinx-cpm.c > > > > > > [...] > > > > > > > +static int xilinx_cpm_pcie_probe(struct platform_device *pdev) { > > > > + struct xilinx_cpm_pcie_port *port; > > > > + struct device *dev = &pdev->dev; > > > > + struct pci_host_bridge *bridge; > > > > + struct resource *bus_range; > > > > + int err; > > > > + > > > > + bridge = devm_pci_alloc_host_bridge(dev, sizeof(*port)); > > > > + if (!bridge) > > > > + return -ENODEV; > > > > + > > > > + port = pci_host_bridge_priv(bridge); > > > > + > > > > + port->dev = dev; > > > > + > > > > + err = pci_parse_request_of_pci_ranges(dev, &bridge->windows, > > > > + &bridge->dma_ranges, &bus_range); > > > > + if (err) { > > > > + dev_err(dev, "Getting bridge resources failed\n"); > > > > + return err; > > > > + } > > > > + > > > > + err = xilinx_cpm_pcie_init_irq_domain(port); > > > > + if (err) > > > > + return err; > > > > + > > > > + err = xilinx_cpm_pcie_parse_dt(port, bus_range); > > > > + if (err) { > > > > + dev_err(dev, "Parsing DT failed\n"); > > > > + goto err_parse_dt; > > > > + } > > > > + > > > > + xilinx_cpm_pcie_init_port(port); > > > > + > > > > + err = xilinx_cpm_setup_irq(port); > > > > + if (err) { > > > > + dev_err(dev, "Failed to set up interrupts\n"); > > > > + goto err_setup_irq; > > > > + } > > > > > > All the h/w init here can be moved to an .init() function in ecam ops > > > and then use pci_host_common_probe. Given this is v9, that can be a > > > follow-up I guess. > > > > I think there is time to get it done, Bharat please let me know if you can > > repost it shortly with Rob's requested change implemented. > > > Thanks Rob for your time. > Thanks Lorenzo, the reason I cannot use pci_host_common_probe is, > I need pci_config_window locally as the we use same ecam space for local bridge register access. > In xilinx_cpm_pcie_parse_dt funciton > port->reg_base = port->cfg->win; The .init() function is passed cfg, so what's the issue? You'll need to alloc struct xilinx_cpm_pcie_port and then set it to cfg->priv. I'd expect some fields to also be removed as there's no reason to store things twice. Rob