From: Helge Deller <deller@gmx.de>
To: linux-parisc@vger.kernel.org,
James Bottomley <James.Bottomley@HansenPartnership.com>,
Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Subject: Re: [PATCH] parisc: fix LMMIO mismatch between PAT length and MASK register
Date: Tue, 18 Jun 2013 23:21:25 +0200 [thread overview]
Message-ID: <20130618212125.GA20423@p100.box> (raw)
In-Reply-To: <20130614071142.GB10443@p100.box>
* Helge Deller <deller@gmx.de>:
> From: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
>
> The LMMIO length reported by PAT and the length given by the LBA MASK
> register are not consistent. This leads e.g. to a non-working ATI FireGL
> card with the radeon DRM driver since the memory can't be mapped.
>
> Fix this by correctly adjusting the resource sizes.
>
> Signed-off-by: Helge Deller <deller@gmx.de>
This is an updated/cleaner approach to this problem.
Still I want some more testing on it with various machines.
Basically we now extend the LMMIO range up to 256MB above the initial
start of the region if the value of the MASK register seems to allow it.
Signed-off-by: Helge Deller <deller@gmx.de>
diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c
index 1f05913..acc3fe8 100644
--- a/drivers/parisc/lba_pci.c
+++ b/drivers/parisc/lba_pci.c
@@ -613,6 +613,46 @@ truncate_pat_collision(struct resource *root, struct resource *new)
return 0; /* truncation successful */
}
+/*
+ * extend_lmmio_len: extend lmmio range to maximum length
+ */
+static unsigned long
+extend_lmmio_len(unsigned long start, unsigned long end, unsigned long lba_len)
+{
+ struct resource *tmp;
+
+ pr_debug("LMMIO mismatch: PAT length = 0x%lx, MASK register = 0x%lx\n",
+ end - start, lba_len);
+
+ lba_len = min(lba_len+1, 256UL*1024*1024); /* limit to 256 MB */
+
+ pr_info("LBA: lmmio_space [0x%lx-0x%lx] - original\n", start, end);
+
+ end += lba_len;
+ if (end < start) /* fix overflow */
+ end = -1ULL;
+
+ pr_debug("LBA: lmmio_space [0x%lx-0x%lx] - current\n", start, end);
+
+ /* first overlap */
+ for (tmp = iomem_resource.child; tmp; tmp = tmp->sibling) {
+ pr_debug("LBA: testing %pR\n", tmp);
+ if (tmp->start == start)
+ continue; /* ignore ourself */
+ if (tmp->end < start)
+ continue;
+ if (tmp->start > end)
+ continue;
+ if (end >= tmp->start)
+ end = tmp->start - 1;
+ }
+
+ pr_info("LBA: lmmio_space [0x%lx-0x%lx] - new\n", start, end);
+
+ /* return new end */
+ return end;
+}
+
#else
#define truncate_pat_collision(r,n) (0)
#endif
@@ -994,6 +1034,14 @@ lba_pat_resources(struct parisc_device *pa_dev, struct lba_device *lba_dev)
case PAT_LMMIO:
/* used to fix up pre-initialized MEM BARs */
if (!lba_dev->hba.lmmio_space.flags) {
+ unsigned long lba_len;
+
+ lba_len = ~READ_REG32(lba_dev->hba.base_addr
+ + LBA_LMMIO_MASK);
+ if ((p->end - p->start) != lba_len)
+ p->end = extend_lmmio_len(p->start,
+ p->end, lba_len);
+
sprintf(lba_dev->hba.lmmio_name,
"PCI%02x LMMIO",
(int)lba_dev->hba.bus_num.start);
next prev parent reply other threads:[~2013-06-18 21:21 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-14 7:11 [PATCH] parisc: fix LMMIO mismatch between PAT length and MASK register Helge Deller
2013-06-14 7:28 ` Matt Turner
2013-06-14 7:38 ` Helge Deller
2013-06-14 7:40 ` Helge Deller
2013-06-14 8:38 ` Thomas Bogendoerfer
2013-07-09 5:34 ` Alex Ivanov
2013-07-09 15:18 ` John David Anglin
2013-07-09 19:45 ` Alex Ivanov
2013-07-09 20:59 ` John David Anglin
2013-07-09 23:35 ` John David Anglin
2013-07-10 20:19 ` Alex Ivanov
2013-07-10 20:28 ` John David Anglin
2013-07-10 21:14 ` Matt Turner
2013-07-10 21:29 ` Alex Ivanov
[not found] ` <51DF0B90.3040506@gmx.de>
2013-07-11 19:47 ` Helge Deller
2013-08-04 11:00 ` Alex Ivanov
2013-08-04 15:44 ` John David Anglin
2013-08-04 16:28 ` Matt Turner
2013-08-10 19:41 ` John David Anglin
2013-06-14 8:39 ` Thomas Bogendoerfer
2013-06-18 21:21 ` Helge Deller [this message]
[not found] <A7728478-8754-4B8E-81DD-CDB70165FFAB@p0n4ik.tk>
2013-08-10 19:56 ` Fwd: " Alex Ivanov
2013-08-14 23:36 ` John David Anglin
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=20130618212125.GA20423@p100.box \
--to=deller@gmx.de \
--cc=James.Bottomley@HansenPartnership.com \
--cc=linux-parisc@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox