Linux-EDAC Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] EDAC, pnd2: Fix ioremap() size in dnv_rd_reg() from 64K -> 32K
@ 2019-08-08 20:52 Stephen Douthit
  2019-08-08 21:05 ` Luck, Tony
  2019-08-09  7:07 ` Zhuo, Qiuxu
  0 siblings, 2 replies; 4+ messages in thread
From: Stephen Douthit @ 2019-08-08 20:52 UTC (permalink / raw)
  To: Tony Luck, Borislav Petkov, Mauro Carvalho Chehab, James Morse
  Cc: Stephen Douthit, linux-edac, linux-kernel

BIOS has marked the 32K MCHBAR window as reserved, so when dnv_rd_reg()
tries to ioremap() a 64KB region you get warnings like:

resource sanity check: requesting [mem 0xfed10000-0xfed1ffff], which spans more than reserved [mem 0xfed10000-0xfed17fff]
caller dnv_rd_reg+0xc8/0x240 [pnd2_edac] mapping multiple BARs

ioremap() the correct size on Denverton platforms to get rid of those
warnings.

Signed-off-by: Stephen Douthit <stephend@silicom-usa.com>
---
 drivers/edac/pnd2_edac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/edac/pnd2_edac.c b/drivers/edac/pnd2_edac.c
index 903a4f1fadcc..1d16f2ac776e 100644
--- a/drivers/edac/pnd2_edac.c
+++ b/drivers/edac/pnd2_edac.c
@@ -295,7 +295,7 @@ static int dnv_rd_reg(int port, int off, int op, void *data, size_t sz, char *na
 			addr += (port << 16);
 		}
 
-		base = ioremap((resource_size_t)addr, 0x10000);
+		base = ioremap((resource_size_t)addr, 0x8000);
 		if (!base)
 			return -ENODEV;
 
-- 
2.21.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] EDAC, pnd2: Fix ioremap() size in dnv_rd_reg() from 64K -> 32K
  2019-08-08 20:52 [PATCH] EDAC, pnd2: Fix ioremap() size in dnv_rd_reg() from 64K -> 32K Stephen Douthit
@ 2019-08-08 21:05 ` Luck, Tony
  2019-08-09 14:13   ` Stephen Douthit
  2019-08-09  7:07 ` Zhuo, Qiuxu
  1 sibling, 1 reply; 4+ messages in thread
From: Luck, Tony @ 2019-08-08 21:05 UTC (permalink / raw)
  To: Stephen Douthit, Borislav Petkov, Mauro Carvalho Chehab, James Morse
  Cc: linux-edac, linux-kernel

-		base = ioremap((resource_size_t)addr, 0x10000);
+		base = ioremap((resource_size_t)addr, 0x8000);

Changing one magic value for another.  :-(

Do different BIOS do different things?  I don't recall seeing this error
(but perhaps I missed it, or perhaps the kernel has added better checks).

If this number is at the whim of the BIOS, is there some way to
figure out what is the right value on a specific implementation?

-Tony

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] EDAC, pnd2: Fix ioremap() size in dnv_rd_reg() from 64K -> 32K
  2019-08-08 20:52 [PATCH] EDAC, pnd2: Fix ioremap() size in dnv_rd_reg() from 64K -> 32K Stephen Douthit
  2019-08-08 21:05 ` Luck, Tony
@ 2019-08-09  7:07 ` Zhuo, Qiuxu
  1 sibling, 0 replies; 4+ messages in thread
From: Zhuo, Qiuxu @ 2019-08-09  7:07 UTC (permalink / raw)
  To: Stephen Douthit, Luck, Tony, Borislav Petkov,
	Mauro Carvalho Chehab, James Morse
  Cc: linux-edac, linux-kernel

> 
> BIOS has marked the 32K MCHBAR window as reserved, so when dnv_rd_reg()
> tries to ioremap() a 64KB region you get warnings like:
> 
> resource sanity check: requesting [mem 0xfed10000-0xfed1ffff], which spans
> more than reserved [mem 0xfed10000-0xfed17fff] caller
> dnv_rd_reg+0xc8/0x240 [pnd2_edac] mapping multiple BARs
> 
> ioremap() the correct size on Denverton platforms to get rid of those warnings.

I've several dmesg logs for loading the pnd2_edac driver on a Denverton server successfully. But the logs haven't got such warning.

-Qiuxu 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] EDAC, pnd2: Fix ioremap() size in dnv_rd_reg() from 64K -> 32K
  2019-08-08 21:05 ` Luck, Tony
@ 2019-08-09 14:13   ` Stephen Douthit
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Douthit @ 2019-08-09 14:13 UTC (permalink / raw)
  To: Luck, Tony, Borislav Petkov, Mauro Carvalho Chehab, James Morse
  Cc: linux-edac, linux-kernel

On 8/8/19 5:05 PM, Luck, Tony wrote:
> -		base = ioremap((resource_size_t)addr, 0x10000);
> +		base = ioremap((resource_size_t)addr, 0x8000);
> 
> Changing one magic value for another.  :-(

Ok, I'll give it a name.

> Do different BIOS do different things?  I don't recall seeing this error
> (but perhaps I missed it, or perhaps the kernel has added better checks).

Sure, depending on where a BIOS locates MMIO resources the reported
reserved ranges will vary.  Normally those resources are packed by size
so any changes in the installed/enabled device list can change the
layout of the MMIO reserved regions as well.

The BIOS could also choose to report adjacent MMIO resources as one
larger reserved region.

> If this number is at the whim of the BIOS, is there some way to
> figure out what is the right value on a specific implementation?
Digging back though the EDS (Intel Doc #558579) I found that there are
two sizes we need to handle.  If we're reading via the memory controller
hub that BAR is 32KB per section 44.2.7 of the EDS.

All sideband ports are 64KB, I'll resubmit taking that into account.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-08 20:52 [PATCH] EDAC, pnd2: Fix ioremap() size in dnv_rd_reg() from 64K -> 32K Stephen Douthit
2019-08-08 21:05 ` Luck, Tony
2019-08-09 14:13   ` Stephen Douthit
2019-08-09  7:07 ` Zhuo, Qiuxu

Linux-EDAC Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-edac/0 linux-edac/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-edac linux-edac/ https://lore.kernel.org/linux-edac \
		linux-edac@vger.kernel.org linux-edac@archiver.kernel.org
	public-inbox-index linux-edac


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-edac


AGPL code for this site: git clone https://public-inbox.org/ public-inbox