Re: [PATCH] PCI: Clear bridge MEM_64 flag if one child does not support it

Bjorn Helgaas
2014-12-09T18:21:34Z

On Tue, Dec 9, 2014 at 12:56 AM, Wei Yang <weiyang@linux.vnet.ibm.com> wrote:

> As you mentioned in another thread, "5b28541552ef is taking the wrong
> approach". (http://www.spinics.net/lists/linux-pci/msg37374.html) Maybe I
> don't catch it clearly. Put a 32bit prefetchable resource in a 32bit
> non-prefetchable bridge window is a bad idea?

A 32-bit prefetchable resource *can* be put in a 32-bit
non-prefetchable window, but the device won't perform as well as it
would if the resource were in a prefetchable window.

What I object to is the fact that we put a 32-bit prefetchable
resource in the non-prefetchable window and leave the 64-bit
prefetchable window unused. This gives up performance for no benefit.

> But in my mind, if the bridge
> prefetchable window is 64bit, we can't put a 32bit prefetchable resource in
> it.

If the window is programmed to be above 4GB, of course we can't put a
32-bit resource in it. My point is that if the bridge *supports* a
64-bit prefetchable window, we can decide where to place it. If we
put the window below 4GB, we can put a 32-bit prefetchable resource in
it.

I think maybe you're thinking of "64-bit window" as "a window
programmed to be above 4GB." I'm using "64-bit window" to mean "a
window that supports 64-bit addressing," i.e., one where
PCI_PREF_BASE_UPPER32 and PCI_PREF_LIMIT_UPPER32 are implemented.
That's analogous to the way we talk about 64-bit BARs. A 64-bit BAR
is still a 64-bit BAR even if it is currently programmed to be below
4GB.

Bjorn