Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3860171pxb; Tue, 17 Nov 2020 05:36:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJzMc4I/IrrO5nc8SRYGvTMkeNlWpCEQAxsOWCDchLvNv0xq9Uitg939HejmLjl9pC9Hg2eW X-Received: by 2002:aa7:cd41:: with SMTP id v1mr4320165edw.147.1605620181032; Tue, 17 Nov 2020 05:36:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605620181; cv=none; d=google.com; s=arc-20160816; b=s7TSQ1nK/naKYpk4k0clvhjmYgGFQ82U4ymVCapcM6kyIwP0zuxSoxAMe75y3CT243 TnI23Vo1M4C4xj5z/J5VRJ15PZs/YLJT3bCYuL0CbKZWkoNwcycYz0+hpSx8hAprOAAV fXOwG1wQKBhAqxpN2TbDG4/jt4xCHo10M6414OPdYMrYY3VSfd2dNOkUUP/5FjKw5f1t bjns/Obgmx1o/kOS44F/WXoFMRW7kZJfpw4GtQAIt9jNO/BvX/gBl3j93HgozlpeJn5X jEV0fPilwolb/8Fpmm2dE9jCBVEpTnje/1SjaZb31Iv+xZ0hCPaJQsI7GFSUa3pdpmI+ 9hXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=S7tQ2Keny7bvy6JngvaaOGtI54ZZuCcDT6ZVrvgD6uc=; b=KMFR9H0zkbFbQY1ZGIglnC6Y4fTJog/zIOq/yOUPh2KNiaKsBr0yPuOKJmbFMczCvF Xi/1xgWNZyrDdnxsa/RJ/VNPJjWmufes+LPTn0h9VAZRvpLIDL+68czlQVKY5E7P/oVO KYK6ZTIICX4W5VYSpbFF/IDINn6WPYr1zTXB7g1x49yjR68G52MWilJu7rAvKiFTIjVa KMD/ZkBxpVDqq/zDfSXfnbzaXu4UvwwrHFf7T7IijOSTdIu6xR7+QBrPYQGSl8KuTQUy +b4O6p80elWndd5Pp0bD0RCXelDc/br7Jiax+U0HZya6eEQ8JI7hcP5YGOpvcdpIMefM 2OOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fqo5oLog; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a20si16926454edn.39.2020.11.17.05.35.57; Tue, 17 Nov 2020 05:36:21 -0800 (PST) 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=fqo5oLog; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732171AbgKQNeW (ORCPT + 99 others); Tue, 17 Nov 2020 08:34:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:44740 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731644AbgKQNeP (ORCPT ); Tue, 17 Nov 2020 08:34:15 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 87A8321534; Tue, 17 Nov 2020 13:34:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605620055; bh=pA8mLgTej4GQSGeBviRneyMprTgwzHUFWXb1tmMzlWM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fqo5oLogpCUWAcL2h0NhHsjyiNZO4CJ0phJpPR/4R0OGmCn1Yd4THF9WVktcrPVt8 BapsneIlZdzGSr9BmFuf4ZBJB772xOej8rH6W07hrjCpVWNxkImInuGeUxuDkmsNHJ BcNj0ne8Es/XhRFx0FT6DdNW+U14Jx/Sz6rxG+Ws= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, vtolkm@googlemail.com, =?UTF-8?q?Jan=20Kundr=C3=A1t?= , Rob Herring , Bjorn Helgaas , Lorenzo Pieralisi , Thomas Petazzoni , Jason Cooper , Russell King , Sasha Levin Subject: [PATCH 5.9 063/255] PCI: mvebu: Fix duplicate resource requests Date: Tue, 17 Nov 2020 14:03:23 +0100 Message-Id: <20201117122142.017735222@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122138.925150709@linuxfoundation.org> References: <20201117122138.925150709@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rob Herring [ Upstream commit 832ea234277a2465ec6602fa6a4db5cd9ee87ae3 ] With commit 669cbc708122 ("PCI: Move DT resource setup into devm_pci_alloc_host_bridge()"), the DT 'ranges' is parsed and populated into resources when the host bridge is allocated. The resources are requested as well, but that happens a second time for the mvebu driver in mvebu_pcie_parse_request_resources(). We should only be requesting the additional resources added in mvebu_pcie_parse_request_resources(). These are not added by default because they use custom properties rather than standard DT address translation. Also, the bus ranges was also populated by default, so we can remove it from mvebu_pci_host_probe(). Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=209729 Fixes: 669cbc708122 ("PCI: Move DT resource setup into devm_pci_alloc_host_bridge()") Link: https://lore.kernel.org/r/20201023145252.2691779-1-robh@kernel.org Reported-by: vtolkm@googlemail.com Tested-by: Jan Kundrát Signed-off-by: Rob Herring Signed-off-by: Bjorn Helgaas Acked-by: Lorenzo Pieralisi Cc: Thomas Petazzoni Cc: Jason Cooper Cc: Russell King Signed-off-by: Sasha Levin --- drivers/pci/controller/pci-mvebu.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pci-mvebu.c index c39978b750ec6..653c0b3d29125 100644 --- a/drivers/pci/controller/pci-mvebu.c +++ b/drivers/pci/controller/pci-mvebu.c @@ -960,25 +960,16 @@ static void mvebu_pcie_powerdown(struct mvebu_pcie_port *port) } /* - * We can't use devm_of_pci_get_host_bridge_resources() because we - * need to parse our special DT properties encoding the MEM and IO - * apertures. + * devm_of_pci_get_host_bridge_resources() only sets up translateable resources, + * so we need extra resource setup parsing our special DT properties encoding + * the MEM and IO apertures. */ static int mvebu_pcie_parse_request_resources(struct mvebu_pcie *pcie) { struct device *dev = &pcie->pdev->dev; - struct device_node *np = dev->of_node; struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie); int ret; - /* Get the bus range */ - ret = of_pci_parse_bus_range(np, &pcie->busn); - if (ret) { - dev_err(dev, "failed to parse bus-range property: %d\n", ret); - return ret; - } - pci_add_resource(&bridge->windows, &pcie->busn); - /* Get the PCIe memory aperture */ mvebu_mbus_get_pcie_mem_aperture(&pcie->mem); if (resource_size(&pcie->mem) == 0) { @@ -988,6 +979,9 @@ static int mvebu_pcie_parse_request_resources(struct mvebu_pcie *pcie) pcie->mem.name = "PCI MEM"; pci_add_resource(&bridge->windows, &pcie->mem); + ret = devm_request_resource(dev, &iomem_resource, &pcie->mem); + if (ret) + return ret; /* Get the PCIe IO aperture */ mvebu_mbus_get_pcie_io_aperture(&pcie->io); @@ -1001,9 +995,12 @@ static int mvebu_pcie_parse_request_resources(struct mvebu_pcie *pcie) pcie->realio.name = "PCI I/O"; pci_add_resource(&bridge->windows, &pcie->realio); + ret = devm_request_resource(dev, &ioport_resource, &pcie->realio); + if (ret) + return ret; } - return devm_request_pci_bus_resources(dev, &bridge->windows); + return 0; } /* -- 2.27.0