Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4689454pxj; Wed, 12 May 2021 10:57:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLXywsSySE/8eKFdYKe+VAYxSQesB8xESdyrkAsAbRL2UHuvBrRHAaKKnmjm2hLgL8O4s/ X-Received: by 2002:a17:906:9141:: with SMTP id y1mr40599826ejw.111.1620842247717; Wed, 12 May 2021 10:57:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620842247; cv=none; d=google.com; s=arc-20160816; b=Z2IodKE2r0jJcN6ZUhN5kxabmX1ZXVJK/01YESS8HcBcEoWLeaZf9SpgvzsQAefShG sXjmlM6IDxCbipmOA106zqEYuBz7IOaYmNcURDeYvuQKHyWTpBueJ7HWplYX2Td7D8y1 EY2+++TufRigDyX5IuVTAtlRupB+mwP3GsRiQXYjzvNIBp1J4l2zYjgvcnVzKKOaZz5g RT0qpe0irRHZN4REA+/r47oZin59R5FHfug0tGYJZxq2LE/XhFoXzuRGa/dOYl2Lijub mpsSQtYbkH6wVGnhEo94Isuw3CzzkT1GIPT15YJ8VjhTeL58hX9v2E+x54hx9X09GqU0 EjjA== 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=WDi4hfbYasvkV2yGs2xxMCdYivG23SeA3JS3VSKHCYc=; b=d4roLKHWGcdsAx2N47e6wS7YRkTWn07/AfDWUKkora5c8HlCLmUdemNcJTlkDf2Gac N21XRH5JO0A6sSKe6eCcipuZNvv668lszvI0GK7JRqe/7l3u0x2qd1yfMfJYtelebyxH mA/xEQi6ozECa36HIIQniYC6s0Bd7dsi/ZEPw2Z8gIPPkN9XPcQIN4k2SvRn1avtxCGB eQzOPuJlN3573moCK9Wkeo4Fz5m8bc9tFbw8xxQSWCdfsa683/FV5hzURXPxs2AHxgfH EeP1R4yofL4YnI/w+bU7L/jLvzzQMbZS808UJgLhXKz4H8y9XDDXAnUKpFRSKCXvAn3Q SjUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rqKAOk4L; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g8si327271eds.14.2021.05.12.10.56.59; Wed, 12 May 2021 10:57:27 -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=@linuxfoundation.org header.s=korg header.b=rqKAOk4L; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350838AbhELRw0 (ORCPT + 99 others); Wed, 12 May 2021 13:52:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:59020 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236670AbhELQWi (ORCPT ); Wed, 12 May 2021 12:22:38 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2C36A613C4; Wed, 12 May 2021 15:46:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620834417; bh=PbfKYe+osiPgdsnQSlzfrRC76DNdtXx/z2RiJMzamGA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rqKAOk4Lg2mAsDGYvcPeNi+j9Q6Qu6TfzmM7JX/6jHIVb5BYDprulL0xuV7hjRA0h Q1dsIl4O6qRVnN+xecqhAj0MsVw2VGwUJLsKLQFCxMYz9SFIYjv/U/UP5uaP9Ig6TG lJk/CXV0W0lktp95ARYfO3yUKM7OlrpgKj3YUzZM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ilya Lipnitskiy , Liviu Dudau , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 5.11 518/601] MIPS: pci-legacy: stop using of_pci_range_to_resource Date: Wed, 12 May 2021 16:49:55 +0200 Message-Id: <20210512144844.914248404@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144827.811958675@linuxfoundation.org> References: <20210512144827.811958675@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: Ilya Lipnitskiy [ Upstream commit 3ecb9dc1581eebecaee56decac70e35365260866 ] Mirror commit aeba3731b150 ("powerpc/pci: Fix IO space breakage after of_pci_range_to_resource() change"). Most MIPS platforms do not define PCI_IOBASE, nor implement pci_address_to_pio(). Moreover, IO_SPACE_LIMIT is 0xffff for most MIPS platforms. of_pci_range_to_resource passes the _start address_ of the IO range into pci_address_to_pio, which then checks it against IO_SPACE_LIMIT and fails, because for MIPS platforms that use pci-legacy (pci-lantiq, pci-rt3883, pci-mt7620), IO ranges start much higher than 0xffff. In fact, pci-mt7621 in staging already works around this problem, see commit 09dd629eeabb ("staging: mt7621-pci: fix io space and properly set resource limits") So just stop using of_pci_range_to_resource, which does not work for MIPS. Fixes PCI errors like: pci_bus 0000:00: root bus resource [io 0xffffffff] Fixes: 0b0b0893d49b ("of/pci: Fix the conversion of IO ranges into IO resources") Signed-off-by: Ilya Lipnitskiy Cc: Liviu Dudau Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin --- arch/mips/pci/pci-legacy.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/mips/pci/pci-legacy.c b/arch/mips/pci/pci-legacy.c index 39052de915f3..3a909194284a 100644 --- a/arch/mips/pci/pci-legacy.c +++ b/arch/mips/pci/pci-legacy.c @@ -166,8 +166,13 @@ void pci_load_of_ranges(struct pci_controller *hose, struct device_node *node) res = hose->mem_resource; break; } - if (res != NULL) - of_pci_range_to_resource(&range, node, res); + if (res != NULL) { + res->name = node->full_name; + res->flags = range.flags; + res->start = range.cpu_addr; + res->end = range.cpu_addr + range.size - 1; + res->parent = res->child = res->sibling = NULL; + } } } -- 2.30.2