public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* RE: [Patch] PCI: check szhi when sz is 0 for 64 bit pref mem
@ 2006-11-08 19:15 Lu, Yinghai
  2006-11-10  0:50 ` Greg KH
  0 siblings, 1 reply; 9+ messages in thread
From: Lu, Yinghai @ 2006-11-08 19:15 UTC (permalink / raw)
  To: Andrew Morton, ebiederm; +Cc: Greg KH, Andi Kleen, linux-kernel

-----Original Message-----
From: Andrew Morton [mailto:akpm@osdl.org] 

>I've basically given up in exhaustion on that patch.  Maybe when I have
a
>burst of extra energy I'll go back and take the time to understand it,
>or maybe when Greg comes back he'll save me.

Please 
http://lkml.org/lkml/2006/11/6/341

that would be more clean.

Thanks

Yinghai Lu






^ permalink raw reply	[flat|nested] 9+ messages in thread
* RE: [Patch] PCI: check szhi when sz is 0 for 64 bit pref mem
@ 2006-11-06 22:15 Lu, Yinghai
  2006-11-07  0:04 ` Andrew Morton
  0 siblings, 1 reply; 9+ messages in thread
From: Lu, Yinghai @ 2006-11-06 22:15 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Greg KH, Andi Kleen, linux-kernel

-----Original Message-----
From: Andrew Morton [mailto:akpm@osdl.org] 
>I don't really understand what this patch does.
>We have a PCI device with a 64-bit BAR and the size is also 64-bit and
is
>larger than 4G, yes?

Yes

>But the code appears to already be attempting to handle such devices. 
>Confused.

The old code will 
Try to calculate the sz from lo 32 bit addr reg, and sz is 0 if the 64
bit resource size if 4G above, so it will continue can skip that
register, and it will go on try to treat the hi 32bit addr reg as
another 32 bit resource addr reg.

YH






^ permalink raw reply	[flat|nested] 9+ messages in thread
* [Patch] PCI: check szhi when sz is 0 for 64 bit pref mem
@ 2006-11-04  5:27 Yinghai Lu
  2006-11-06 22:04 ` Andrew Morton
  0 siblings, 1 reply; 9+ messages in thread
From: Yinghai Lu @ 2006-11-04  5:27 UTC (permalink / raw)
  To: Greg KH, Andi Kleen, Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 24 bytes --]

Please check the patch.

[-- Attachment #2: pci_64bit_pref_4g.patch --]
[-- Type: text/x-patch, Size: 1564 bytes --]

[Patch] PCI: check szhi when sz is 0 for 64 bit pref mem

	For co-prcessor with mem installed, the ram will be treated to pref mem.	
	Under 64bit kernel, when 64bit pref mem size is above 4G, sz from pci_size in low bits, will get 0, 
	at this point, we need to check szhi too. Otherwise the pre-set value by firmware can not be read 
	to resrource struct, it will skip that resource, and try to hi 32 bit as another 32bit resource.

	Cc: Myles Watson <myles@mouselemur.cs.byu.edu>
	Signed-off-by: Yinghai Lu <yinghai.lu@amd.com>	


--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -165,8 +165,13 @@ static void pci_read_bases(struct pci_de
 			l = 0;
 		if ((l & PCI_BASE_ADDRESS_SPACE) == PCI_BASE_ADDRESS_SPACE_MEMORY) {
 			sz = pci_size(l, sz, (u32)PCI_BASE_ADDRESS_MEM_MASK);
-			if (!sz)
-				continue;
+			/* for 64bit pref, sz could be 0, if the real size is bigger than 4G,
+				so need to check szhi for it
+			 */
+			if ((l & (PCI_BASE_ADDRESS_SPACE | PCI_BASE_ADDRESS_MEM_TYPE_MASK))
+			    != (PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_64)) 
+				if (!sz)
+					continue;
 			res->start = l & PCI_BASE_ADDRESS_MEM_MASK;
 			res->flags |= l & ~PCI_BASE_ADDRESS_MEM_MASK;
 		} else {
@@ -188,6 +193,12 @@ static void pci_read_bases(struct pci_de
 			szhi = pci_size(lhi, szhi, 0xffffffff);
 			next++;
 #if BITS_PER_LONG == 64
+			if( !sz && !szhi) {
+				res->start = 0;
+				res->end = 0;
+				res->flags = 0;
+				continue;
+			}
 			res->start |= ((unsigned long) lhi) << 32;
 			res->end = res->start + sz;
 			if (szhi) {

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

end of thread, other threads:[~2006-11-10  8:35 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-08 19:15 [Patch] PCI: check szhi when sz is 0 for 64 bit pref mem Lu, Yinghai
2006-11-10  0:50 ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2006-11-06 22:15 Lu, Yinghai
2006-11-07  0:04 ` Andrew Morton
2006-11-07  4:35   ` Yinghai Lu
2006-11-04  5:27 Yinghai Lu
2006-11-06 22:04 ` Andrew Morton
2006-11-08 18:19   ` Eric W. Biederman
2006-11-08 19:10     ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox