Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2313702pxp; Mon, 21 Mar 2022 16:40:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWrl9yhIpR+kzwHmXzFDaZgx41tF3G0++FcTJIBMcBQAW4Q+v+HKOaN1atMJJGDkySeS4r X-Received: by 2002:a17:902:f64e:b0:14d:20db:8478 with SMTP id m14-20020a170902f64e00b0014d20db8478mr15668507plg.158.1647906038612; Mon, 21 Mar 2022 16:40:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647906038; cv=none; d=google.com; s=arc-20160816; b=Os+PJQNvYN0yvGFoioUd2ZdTb2d74Ob3ZeMEd/cb8BXWQ0ulrHVe2H0nJ11E5MtrSo EV3hvkxspCjz2CJ/CA3PrGSOUAL7vXtl0Y7Zsjdul5YkuDZpIFAmQ6sIJmq9UzTIlbEA +8MvKrTAq91XJMaZwFvFlZ4nDiYe2SvMISnL26KqWYt9/bO0/beRy8doEoJNmXQftQi+ G9+56oKL0IDch3Wke/kycO0euLYHGjn/iNz1k9UjKTziJsUGrsBqwCVMg1UH0tj8sPgd I5DPZl5jDURNXAStroM/aBHuDh5BLOtuVouUDnphhfPtpmUXJa8RwNg/EHpb4gz6aBrr psLQ== 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 :references:message-id:subject:cc:to:from:date:dkim-signature; bh=XDxK5C2+TSZ+aKZ0Wy4YRhUpCIrlRUVGIVSk2+SABTU=; b=j0iBJfLmcHvdSDkljHLsoTggfvoXJu1i3TA/ickpVJ4yD7DpiX+Vx3X6ssA6jSUK2X aJVo812Lq732xbu2wr57YQfkleT5wX0piOGgQWiGiB65XsisAapsESAYhBkPwRHYa52t haPjVqLUoMDYD8/cEARHh8ZsgaWKcIVRkKDLC/dgj+0Tw5Ccjlc60GbXMnOntB+7OtXM tYKMOgXsTEB3itM/T+aG41JEF4MTDD3Y/5EaAXj1p+qym8VKU/VFQLIlv6KOwppyTfnh G9LuyY8Df296vtIIDdvXv2dFTNg91lLnP+gbTK2pV/FHBpLSowZyHvHbZItkvi86E0wP 819Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=tqIgojDW; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id cl2-20020a17090af68200b001c71583fda1si668243pjb.29.2022.03.21.16.40.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 16:40:38 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=tqIgojDW; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 83D593A7229; Mon, 21 Mar 2022 15:54:02 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230258AbiCUWx4 (ORCPT + 99 others); Mon, 21 Mar 2022 18:53:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229948AbiCUWxh (ORCPT ); Mon, 21 Mar 2022 18:53:37 -0400 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71F1A3CD8C5 for ; Mon, 21 Mar 2022 15:32:48 -0700 (PDT) Received: from mail-il1-f198.google.com (mail-il1-f198.google.com [209.85.166.198]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 9085B3F1FC for ; Mon, 21 Mar 2022 22:32:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1647901965; bh=XDxK5C2+TSZ+aKZ0Wy4YRhUpCIrlRUVGIVSk2+SABTU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:In-Reply-To; b=tqIgojDWSHJyPdZcyqFpL6o7ZVnZAmuDGRyK9juvO1iBokpBxtaeo4HpmAUj+S/Q6 JHodkUAHBUxfvJ+Uopa70FxlpAMbPNC9VvbI1Ef63Dh7TNY34kBKHCt3iXArIBlRyf XG8MxI9bLmlN7dWkm481SoG0CKw54lCQ+QL9AppckOkEIIKpckEVV2uWpU9G5cGWr8 +w57c+e4jyPMiJ1Ex3ra7e3bxZAqfVOVsLZ/AxslvWGmrvEHBQfx7v8BNoaQ+f2/R2 JYW7VTlO+x9H31t9J5KYXSJp6sTvquLnyzqDxlc39wlkt1gmjzv+e4SXYy27n2NLkw om9AH1zRK7k0w== Received: by mail-il1-f198.google.com with SMTP id y7-20020a92d207000000b002c7f55e413bso5044647ily.5 for ; Mon, 21 Mar 2022 15:32:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=XDxK5C2+TSZ+aKZ0Wy4YRhUpCIrlRUVGIVSk2+SABTU=; b=cBMJoAxmETxdXUhNfiGNoRytgdz6OhwJOd+dngn0axbMWut5riilfsz2cTgiimfr/5 1AszKKg8d5xEu2dKHaQE8TZ4SviZycYJNOu71aQz8g7N5Kh5b3Z+rRnzWyyjtjwN6gGw JsnN2iYM+s0tNAoxT+B5eB/ZafopluEfbbnA7pAVhPPS9g0nGzelQkARnSJG4CkRRK1r CdT0BuxnQuz7NruskgQPtVWWAEnO7ZER40mKYJb9VEE7pihrtQn8KRhNiQeNdfpak0Di SmW3sVFN/RF8RjXLiKy5XgFKpBXcoUcsZSbYvc3pUbOWNCLELFUtX6dxHBWZbgKvYJYf 6rzQ== X-Gm-Message-State: AOAM533uDwHre8cCcNZUbIU8EFn9FpLpZX7bLomQe4JnJXwidPK++t1t 2q5qHM8HwcxM0LWGFZDGN+e9MIHYOBMvYoI8cTV+4WQ7u8Yh/DCmBoSdu6pGPJLJj0Ae0qKqxay QL0Du3UMB7RL6iNAuAbccgOj5LLf15VK/BwF1FDziQw== X-Received: by 2002:a05:6e02:5b1:b0:2c6:218d:fb38 with SMTP id k17-20020a056e0205b100b002c6218dfb38mr10945926ils.266.1647901963708; Mon, 21 Mar 2022 15:32:43 -0700 (PDT) X-Received: by 2002:a05:6e02:5b1:b0:2c6:218d:fb38 with SMTP id k17-20020a056e0205b100b002c6218dfb38mr10945920ils.266.1647901963429; Mon, 21 Mar 2022 15:32:43 -0700 (PDT) Received: from xps13.dannf (c-73-14-97-161.hsd1.co.comcast.net. [73.14.97.161]) by smtp.gmail.com with ESMTPSA id s10-20020a6b740a000000b006413d13477dsm9219017iog.33.2022.03.21.15.32.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:32:42 -0700 (PDT) Date: Mon, 21 Mar 2022 16:32:40 -0600 From: dann frazier To: Rob Herring Cc: Marc Zyngier , "linux-kernel@vger.kernel.org" , linux-arm-kernel , PCI , Toan Le , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Bjorn Helgaas , =?iso-8859-1?Q?St=E9phane?= Graber , Android Kernel Team Subject: Re: [PATCH v2 0/2] PCI: xgene: Restore working PCIe functionnality Message-ID: References: <20220321104843.949645-1-maz@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE 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 Mon, Mar 21, 2022 at 11:08:20AM -0500, Rob Herring wrote: > On Mon, Mar 21, 2022 at 09:50:24AM -0600, dann frazier wrote: > > On Mon, Mar 21, 2022 at 10:17:34AM -0500, Rob Herring wrote: > > > On Mon, Mar 21, 2022 at 5:49 AM Marc Zyngier wrote: > > > > > > > > Since 6dce5aa59e0b ("PCI: xgene: Use inbound resources for setup") was > > > > merged in the 5.5 time frame, PCIe on the venerable XGene platform has > > > > been unusable: 6dce5aa59e0b broke both XGene-1 (Mustang and m400) and > > > > XGene-2 (Merlin), while the addition of c7a75d07827a ("PCI: xgene: Fix > > > > IB window setup") fixed XGene-2, but left the rest of the zoo > > > > unusable. > > > > > > > > It is understood that this systems come with "creative" DTs that don't > > > > match the expectations of modern kernels. However, there is little to > > > > be gained by forcing these changes on users -- the firmware is not > > > > upgradable, and the current owner of the IP will deny that these > > > > machines have ever existed. > > > > > > The gain for fixing this properly is not having drivers do their own > > > dma-ranges parsing. We've seen what happens when drivers do their own > > > parsing of standard properties (e.g. interrupt-map). Currently, we > > > don't have any drivers doing their own parsing: > > > > > > $ git grep of_pci_dma_range_parser_init > > > drivers/of/address.c:int of_pci_dma_range_parser_init(struct > > > of_pci_range_parser *parser, > > > drivers/of/address.c:EXPORT_SYMBOL_GPL(of_pci_dma_range_parser_init); > > > drivers/of/address.c:#define of_dma_range_parser_init > > > of_pci_dma_range_parser_init > > > drivers/of/unittest.c: if (of_pci_dma_range_parser_init(&parser, np)) { > > > drivers/pci/of.c: err = of_pci_dma_range_parser_init(&parser, dev_node); > > > include/linux/of_address.h:extern int > > > of_pci_dma_range_parser_init(struct of_pci_range_parser *parser, > > > include/linux/of_address.h:static inline int > > > of_pci_dma_range_parser_init(struct of_pci_range_parser *parser, > > > > > > And we can probably further refactor this to be private to drivers/pci/of.c. > > > > > > For XGene-2 the issue is simply that the driver depends on the order > > > of dma-ranges entries. > > > > > > For XGene-1, I'd still like to understand what the issue is. Reverting > > > the first fix and fixing 'dma-ranges' should have fixed it. I need a > > > dump of how the IB registers are initialized in both cases. > > > > Happy to provide that for the m400 if told how :) > > Something like the below patch. This should be with the 'dma-ranges' > DT change and only c7a75d07827a reverted. https://paste.ubuntu.com/p/RHzBd5jT6v/ Note that networking does come up with this setup. That surprised me because I thought I'd tested this combo before, but apparently what I'd tested before was 6dce5aa59e0b reverted + the dtb change: https://lore.kernel.org/linux-pci/YgXG838iMrS1l8SC@xps13.dannf/ -dann > 8<------------------------------------------------------------------- > diff --git a/drivers/pci/controller/pci-xgene.c b/drivers/pci/controller/pci-xgene.c > index 0d5acbfc7143..6a435c31f45e 100644 > --- a/drivers/pci/controller/pci-xgene.c > +++ b/drivers/pci/controller/pci-xgene.c > @@ -78,6 +78,7 @@ static u32 xgene_pcie_readl(struct xgene_pcie *port, u32 reg) > > static void xgene_pcie_writel(struct xgene_pcie *port, u32 reg, u32 val) > { > + dev_info(port->dev, "0x%04x <- 0x%08x\n", reg, val); > writel(val, port->csr_base + reg); > } > > @@ -508,7 +509,9 @@ static void xgene_pcie_setup_ib_reg(struct xgene_pcie *port, > case 0: > xgene_pcie_set_ib_mask(port, BRIDGE_CFG_4, flags, size); > bar_addr = cfg_base + PCI_BASE_ADDRESS_0; > + dev_info(port->dev, "BAR0L <- 0x%08x\n", bar_low); > writel(bar_low, bar_addr); > + dev_info(port->dev, "BAR0H <- 0x%08x\n", upper_32_bits(cpu_addr)); > writel(upper_32_bits(cpu_addr), bar_addr + 0x4); > pim_reg = PIM1_1L; > break;