All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
To: Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
	Sergey Ryazanov <ryazanov.s.a@gmail.com>
Cc: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>,
	Liviu Dudau <Liviu.Dudau@arm.com>
Subject: [PATCH v2 5/8] MIPS: pci-legacy: stop using of_pci_range_to_resource
Date: Tue, 13 Apr 2021 20:12:37 -0700	[thread overview]
Message-ID: <20210414031240.313852-6-ilya.lipnitskiy@gmail.com> (raw)
In-Reply-To: <20210414031240.313852-1-ilya.lipnitskiy@gmail.com>

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 <ilya.lipnitskiy@gmail.com>
Cc: Liviu Dudau <Liviu.Dudau@arm.com>
---
 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.31.1


  parent reply	other threads:[~2021-04-14  3:14 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-14  3:12 [PATCH v2 0/8] MIPS: fixes for PCI legacy drivers (rt2880, rt3883) Ilya Lipnitskiy
2021-04-14  3:12 ` [PATCH v2 1/8] MIPS: pci-rt2880: fix slot 0 configuration Ilya Lipnitskiy
2021-04-14  3:12 ` [PATCH v2 2/8] MIPS: pci-rt2880: remove unneeded locks Ilya Lipnitskiy
2021-04-15  8:07   ` Sergey Ryazanov
2021-04-14  3:12 ` [PATCH v2 3/8] MIPS: pci-rt3883: trivial: remove unused variable Ilya Lipnitskiy
2021-04-14  3:12 ` [PATCH v2 4/8] MIPS: pci-rt3883: more accurate DT error messages Ilya Lipnitskiy
2021-04-14  3:12 ` Ilya Lipnitskiy [this message]
2021-04-16 16:00   ` [PATCH v2 5/8] MIPS: pci-legacy: stop using of_pci_range_to_resource Liviu Dudau
2021-04-14  3:12 ` [PATCH v2 6/8] MIPS: pci-legacy: remove redundant info messages Ilya Lipnitskiy
2021-04-14  3:12 ` [PATCH v2 7/8] MIPS: pci-legacy: remove busn_resource field Ilya Lipnitskiy
2021-04-14  3:12 ` [PATCH v2 8/8] MIPS: pci-legacy: use generic pci_enable_resources Ilya Lipnitskiy
2021-04-20  5:23   ` Guenter Roeck
2021-04-20  6:39     ` [PATCH] MIPS: pci-legacy: revert "use generic pci_enable_resources" Ilya Lipnitskiy
2021-04-20 22:56       ` Guenter Roeck
2021-04-21 12:02       ` Thomas Bogendoerfer
2021-04-16  7:22 ` [PATCH v2 0/8] MIPS: fixes for PCI legacy drivers (rt2880, rt3883) Thomas Bogendoerfer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210414031240.313852-6-ilya.lipnitskiy@gmail.com \
    --to=ilya.lipnitskiy@gmail.com \
    --cc=Liviu.Dudau@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=ryazanov.s.a@gmail.com \
    --cc=tsbogend@alpha.franken.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.