From patchwork Tue Aug 3 21:56:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Rob Herring (Arm)" X-Patchwork-Id: 12417381 X-Patchwork-Delegate: bhelgaas@google.com 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=-17.0 required=3.0 tests=BAYES_00,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham 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 E7374C4338F for ; Tue, 3 Aug 2021 21:57:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CF24F60EB9 for ; Tue, 3 Aug 2021 21:57:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231329AbhHCV5L (ORCPT ); Tue, 3 Aug 2021 17:57:11 -0400 Received: from mail-il1-f182.google.com ([209.85.166.182]:44589 "EHLO mail-il1-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230124AbhHCV5K (ORCPT ); Tue, 3 Aug 2021 17:57:10 -0400 Received: by mail-il1-f182.google.com with SMTP id i13so8963310ilm.11 for ; Tue, 03 Aug 2021 14:56:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=yn4O9xEl6ru3rpDSJ+8kj55TrJUZvu9sqWFIWkVC+Pg=; b=c12MSABvtrr4Uh6JRu8VRLw8ESgF2bNhcmnxOji28EA9RLXvkRUN7pQVFW1+38mpB5 I8BIkTHvRKZGKS0Nw76TDTRKDnGqgrlULvj75TbSbUWAGp8IQBgPIHrNtkwPnhgx2TlA +hO7nuuIylsqBNcvmYMm5nh3SQJfHXbOGhNRd+/PxjtSP6JWbUhwL/Se6wz+snEUoIoN hX3VjBJUU/R4XAYntGzVbIrW8Xl78d77oEuZf1ZUMt/i+0Ta1I1jU7Tsn2b73NGTDVUr GlreATlSMMN9K0EW3AI/EKuYnvyZqXgGazIFiA727ggHKmt651+mMtjNIlz4Rkl8gLL0 uGIA== X-Gm-Message-State: AOAM532W9+tOnwHpckl+rmHgDtIL5kYELfKqKdvb7Nv3bbumOTAU6DgD FowPJxEMgf5HxUJFs+3GbQ== X-Google-Smtp-Source: ABdhPJwNKianj0C+7zTvckxnhOj3b3Q0ZNocwW6PPcIY+xaavptFIG5JGlf3uP6IUcaPevqtQBZUPw== X-Received: by 2002:a92:ca8f:: with SMTP id t15mr1052313ilo.262.1628027819042; Tue, 03 Aug 2021 14:56:59 -0700 (PDT) Received: from xps15.herring.priv ([64.188.179.248]) by smtp.googlemail.com with ESMTPSA id r24sm221635ioa.31.2021.08.03.14.56.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Aug 2021 14:56:58 -0700 (PDT) From: Rob Herring To: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Cc: linux-pci@vger.kernel.org, Srinath Mannam , Roman Bacik , Bharat Gooty , Abhishek Shah , Jitendra Bhivare , Ray Jui , Florian Fainelli , BCM Kernel Feedback , Scott Branden , Bjorn Helgaas , Lorenzo Pieralisi Subject: [PATCH 1/2] PCI: of: Don't fail devm_pci_alloc_host_bridge() on missing 'ranges' Date: Tue, 3 Aug 2021 15:56:55 -0600 Message-Id: <20210803215656.3803204-1-robh@kernel.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Commit 669cbc708122 ("PCI: Move DT resource setup into devm_pci_alloc_host_bridge()") made devm_pci_alloc_host_bridge() fail on any DT resource parsing errors, but Broadcom iProc uses devm_pci_alloc_host_bridge() on BCMA bus devices that don't have DT resources. In particular, there is no 'ranges' property. Fix iProc by making 'ranges' optional. If 'ranges' is required by a platform, there's going to be more errors latter on if it is missing. Fixes: 669cbc708122 ("PCI: Move DT resource setup into devm_pci_alloc_host_bridge()") Reported-by: Rafał Miłecki Cc: Srinath Mannam Cc: Roman Bacik Cc: Bharat Gooty Cc: Abhishek Shah Cc: Jitendra Bhivare Cc: Ray Jui Cc: Florian Fainelli Cc: BCM Kernel Feedback Cc: Scott Branden Cc: Bjorn Helgaas Cc: Lorenzo Pieralisi Signed-off-by: Rob Herring Acked-by: Bjorn Helgaas Tested-by: Rafał Miłecki --- drivers/pci/of.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/of.c b/drivers/pci/of.c index a143b02b2dcd..d84381ce82b5 100644 --- a/drivers/pci/of.c +++ b/drivers/pci/of.c @@ -310,7 +310,7 @@ static int devm_of_pci_get_host_bridge_resources(struct device *dev, /* Check for ranges property */ err = of_pci_range_parser_init(&parser, dev_node); if (err) - goto failed; + return 0; dev_dbg(dev, "Parsing ranges property...\n"); for_each_of_pci_range(&parser, &range) { From patchwork Tue Aug 3 21:56:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Rob Herring (Arm)" X-Patchwork-Id: 12417383 X-Patchwork-Delegate: bhelgaas@google.com 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=-17.0 required=3.0 tests=BAYES_00,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham 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 A9A99C4338F for ; Tue, 3 Aug 2021 21:57:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9254560EB9 for ; Tue, 3 Aug 2021 21:57:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231334AbhHCV5O (ORCPT ); Tue, 3 Aug 2021 17:57:14 -0400 Received: from mail-io1-f48.google.com ([209.85.166.48]:46721 "EHLO mail-io1-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231351AbhHCV5N (ORCPT ); Tue, 3 Aug 2021 17:57:13 -0400 Received: by mail-io1-f48.google.com with SMTP id z7so115596iog.13 for ; Tue, 03 Aug 2021 14:57:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=f39+ZfEU0MYphAoUTpkKGDjbwcWbmNZrQnSFOfMBoJk=; b=Q5ekeYXamYmUPfd+8pak6IcLH3gAHjqP1gxDIKwE2EJvRfBa+WEX61DvdFNz4F16Ys F8vTWq8e8El2iSf1Vxd+YfsXPxk7mYNPnlzp+pAyK3paZfFqU3XlOF/7PN7vFeABPNZ5 /OQyrtZjQr0D1MmfbbOfCOlgmR6ISz1aegnERkd46rd5JHTQHF1N8DMCnF6Xpjf8Lsu8 Vp8x+KTxY4IqOPyRyTCTfpKsYhZ3prDZus5sWRf4TR375dEdpFLDPMcKk5bETaJQhMZ1 +pqaapGL42mSHloF8VWe3f3CwF5hHZ1R36HSIriN4JPZQMjFILp/N8FhxZHiJyOb7xIk 4lZA== X-Gm-Message-State: AOAM532VfniWUQQ+sdy49Z8WMmRmFab7jUhr7fUfoVG097moaQKq+Lfj ha64uIzULsOe0fejQw9oLA== X-Google-Smtp-Source: ABdhPJwsMB46UwRyJ09qoIRVfqwOT/0rBTT7rHBROQOuQ6FiPVr2P3+Ye/q9vOS3P4P3APACokQ+OA== X-Received: by 2002:a05:6602:2099:: with SMTP id a25mr449ioa.143.1628027820973; Tue, 03 Aug 2021 14:57:00 -0700 (PDT) Received: from xps15.herring.priv ([64.188.179.248]) by smtp.googlemail.com with ESMTPSA id r24sm221635ioa.31.2021.08.03.14.56.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Aug 2021 14:57:00 -0700 (PDT) From: Rob Herring To: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Cc: linux-pci@vger.kernel.org, Srinath Mannam , Roman Bacik , Bharat Gooty , Abhishek Shah , Jitendra Bhivare , Ray Jui , Florian Fainelli , BCM Kernel Feedback , Scott Branden , Bjorn Helgaas , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= Subject: [PATCH 2/2] PCI: iproc: Fix BCMA probe resource handling Date: Tue, 3 Aug 2021 15:56:56 -0600 Message-Id: <20210803215656.3803204-2-robh@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210803215656.3803204-1-robh@kernel.org> References: <20210803215656.3803204-1-robh@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org In commit 7ef1c871da16 ("PCI: iproc: Use pci_parse_request_of_pci_ranges()"), calling devm_request_pci_bus_resources() was dropped from the common iProc probe code, but is still needed for BCMA bus probing. Without it, there will be lots of warnings like this: pci 0000:00:00.0: BAR 8: no space for [mem size 0x00c00000] pci 0000:00:00.0: BAR 8: failed to assign [mem size 0x00c00000] Add back calling devm_request_pci_bus_resources() and adding the resources to pci_host_bridge.windows for BCMA bus probe. Fixes: 7ef1c871da16 ("PCI: iproc: Use pci_parse_request_of_pci_ranges()") Reported-by: Rafał Miłecki Cc: Srinath Mannam Cc: Roman Bacik Cc: Bharat Gooty Cc: Abhishek Shah Cc: Jitendra Bhivare Cc: Ray Jui Cc: Florian Fainelli Cc: BCM Kernel Feedback Cc: Scott Branden Cc: Lorenzo Pieralisi Cc: "Krzysztof Wilczyński" Cc: Bjorn Helgaas Signed-off-by: Rob Herring Tested-by: Rafał Miłecki --- drivers/pci/controller/pcie-iproc-bcma.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/pci/controller/pcie-iproc-bcma.c b/drivers/pci/controller/pcie-iproc-bcma.c index 56b8ee7bf330..f918c713afb0 100644 --- a/drivers/pci/controller/pcie-iproc-bcma.c +++ b/drivers/pci/controller/pcie-iproc-bcma.c @@ -35,7 +35,6 @@ static int iproc_pcie_bcma_probe(struct bcma_device *bdev) { struct device *dev = &bdev->dev; struct iproc_pcie *pcie; - LIST_HEAD(resources); struct pci_host_bridge *bridge; int ret; @@ -60,19 +59,16 @@ static int iproc_pcie_bcma_probe(struct bcma_device *bdev) pcie->mem.end = bdev->addr_s[0] + SZ_128M - 1; pcie->mem.name = "PCIe MEM space"; pcie->mem.flags = IORESOURCE_MEM; - pci_add_resource(&resources, &pcie->mem); + pci_add_resource(&bridge->windows, &pcie->mem); + ret = devm_request_pci_bus_resources(dev, &bridge->windows); + if (ret) + return ret; pcie->map_irq = iproc_pcie_bcma_map_irq; - ret = iproc_pcie_setup(pcie, &resources); - if (ret) { - dev_err(dev, "PCIe controller setup failed\n"); - pci_free_resource_list(&resources); - return ret; - } - bcma_set_drvdata(bdev, pcie); - return 0; + + return iproc_pcie_setup(pcie, &bridge->windows); } static void iproc_pcie_bcma_remove(struct bcma_device *bdev)