Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2239830pxp; Mon, 21 Mar 2022 14:41:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzG9hI58GENdbXXpPDtl758i5b0PtukNOlIm8hoU9M2DfLOo1bcD2H6ObBKMUMqZRJl3D6X X-Received: by 2002:a17:90b:4c8e:b0:1c6:d1ed:f6b2 with SMTP id my14-20020a17090b4c8e00b001c6d1edf6b2mr1230161pjb.166.1647898916664; Mon, 21 Mar 2022 14:41:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647898916; cv=none; d=google.com; s=arc-20160816; b=YWsxXegK1reufH2Si4m+Onrk1NUupWO6yxhZlAF7F5+77pN0yGncAlzff3YTwPRJVb 00JFqspr3PvUhzLM6w/Fs229IQX+YxVrrSPEUYB3snQlKQ6GOVUSlseRgXCV48LMYYdw IubmVLqiv4nanenapWruSCl/Zj8q6VrnTFCCn2PfpjEtaSuEDi50HTTDAe2zq+rj0xT1 p29fG2ZthtTijSNh6YxSXO4lCii6y3GDLxl3CFWUEJEmOAGjYoNMGerUzMMMPSM/4tLY StC4v3IbSFFQUzwK2grVIVAcrQI8Q2UCKlr1g8fx8f5Z75TWOrzgepTBUXBDaolGYiYo UTgw== 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; bh=tCOTznouFD+iWjgYbDVoQOww7ryqponRKYWNROGxryg=; b=qpePiPccY7H8j1aS/aua1FZhvmoTXNr283x/5Kkd1j9bzT3aLvGFk4+0Wh9rvgvOAO NpPqsc5crlIykY5gelV1AxHyop0foB7tamUvsc3bJl5XqvymjMDnnM8yXEXMOrqtICqK W39CNxbcQ8gU+04qgEtcnr4vRwapeNIlDK9zQLFww5AdkRaIG10WOnq7llEDKt6dSW6k xn8U3CY2dgZv9LdSH8QE4gW2nzNZ01ahtx8/KL7mRJ6CqB96OxTx7t8UBQZicZT9QwmB EDVeKUPqhteyeQRzzlK+2TLeB5D6siAWxw67IgsWpAzP9eeFeAnL9JP7PfBXxJF6do2n xvdA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id i8-20020a628708000000b004f70dcc690csi8036764pfe.1.2022.03.21.14.41.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 14:41:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 18AE826D10D; Mon, 21 Mar 2022 14:14:55 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350796AbiCUQKQ (ORCPT + 99 others); Mon, 21 Mar 2022 12:10:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350698AbiCUQJv (ORCPT ); Mon, 21 Mar 2022 12:09:51 -0400 Received: from mail-oi1-f179.google.com (mail-oi1-f179.google.com [209.85.167.179]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEB7A289B8; Mon, 21 Mar 2022 09:08:24 -0700 (PDT) Received: by mail-oi1-f179.google.com with SMTP id z8so16692359oix.3; Mon, 21 Mar 2022 09:08:24 -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=tCOTznouFD+iWjgYbDVoQOww7ryqponRKYWNROGxryg=; b=661k3fO36NOv1fvvvx8yLnymdt4NT0+73nAvxySHskd/ZQoa7dWRub+SKplOXMefU8 GPSChkGMKOQenY24fRlgtQ3d7KDKZAVMV9ishgGbCvVvMJC1uK2cTHVtpHPdFBVLQUU3 SKKrmSJRvoypOymb0a3e89UTm9R3rY9dcIT3hDCU9Oetg36VkU/6Xd0kxNmdbVma6CHh eh/uWTQ3XfzZt7TkycPeeFM44QGD3pTIf7I71nneGhWbBv8Tpl257lssNoJVsYclSu0p nJWaJ6+90aW+L9dz5uEA9uH4aYq9F3Ykmi2LRmxeAoBZPbaDOG1XoRuXmaXdmbL+uU6o bzbA== X-Gm-Message-State: AOAM533GRal4ZtTx5F2C5or1xYMXqmjy2GQT1FsevSE///5tqAbPNltq Ik/SshpdjdQ0nfFEYAkkZA== X-Received: by 2002:aca:3643:0:b0:2ec:cb84:c5ba with SMTP id d64-20020aca3643000000b002eccb84c5bamr14905569oia.183.1647878904067; Mon, 21 Mar 2022 09:08:24 -0700 (PDT) Received: from robh.at.kernel.org (66-90-144-107.dyn.grandenetworks.net. [66.90.144.107]) by smtp.gmail.com with ESMTPSA id bc36-20020a05682016a400b003240a532a1csm6859115oob.29.2022.03.21.09.08.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 09:08:22 -0700 (PDT) Received: (nullmailer pid 139178 invoked by uid 1000); Mon, 21 Mar 2022 16:08:20 -0000 Date: Mon, 21 Mar 2022 11:08:20 -0500 From: Rob Herring To: dann frazier 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=-2.1 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 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. 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;