* [PATCH] powerpc/pci: check the bus address instead of resource address in pcibios_fixup_resources
@ 2013-06-05 12:26 Kevin Hao
2013-06-05 13:10 ` David Laight
0 siblings, 1 reply; 3+ messages in thread
From: Kevin Hao @ 2013-06-05 12:26 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc
If a BAR has the value of 0, we would assume that it is unset yet and
then mark the resource as unset and would reassign it later. But after
commit 6c5705fe (powerpc/PCI: get rid of device resource fixups)
the pcibios_fixup_resources is invoked after the bus address was
translated to linux resource. So the value of res->start is resource
address. And since the resource and bus address may be different, we
should translate it to the bus address before doing the check.
Signed-off-by: Kevin Hao <haokexin@gmail.com>
---
arch/powerpc/kernel/pci-common.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 7f2273c..eabeec9 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -827,6 +827,7 @@ static void pcibios_fixup_resources(struct pci_dev *dev)
}
for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
struct resource *res = dev->resource + i;
+ struct pci_bus_region reg;
if (!res->flags)
continue;
@@ -835,8 +836,9 @@ static void pcibios_fixup_resources(struct pci_dev *dev)
* at 0 as unset as well, except if PCI_PROBE_ONLY is also set
* since in that case, we don't want to re-assign anything
*/
+ pcibios_resource_to_bus(dev, ®, res);
if (pci_has_flag(PCI_REASSIGN_ALL_RSRC) ||
- (res->start == 0 && !pci_has_flag(PCI_PROBE_ONLY))) {
+ (reg.start == 0 && !pci_has_flag(PCI_PROBE_ONLY))) {
/* Only print message if not re-assigning */
if (!pci_has_flag(PCI_REASSIGN_ALL_RSRC))
pr_debug("PCI:%s Resource %d %016llx-%016llx [%x] "
--
1.8.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [PATCH] powerpc/pci: check the bus address instead of resource address in pcibios_fixup_resources
2013-06-05 12:26 [PATCH] powerpc/pci: check the bus address instead of resource address in pcibios_fixup_resources Kevin Hao
@ 2013-06-05 13:10 ` David Laight
2013-06-05 22:38 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 3+ messages in thread
From: David Laight @ 2013-06-05 13:10 UTC (permalink / raw)
To: Kevin Hao, Benjamin Herrenschmidt; +Cc: linuxppc
> If a BAR has the value of 0, we would assume that it is unset yet and
> then mark the resource as unset and would reassign it later.
IIRC the PCI spec allows a BAR address of zero.
Certainly some sparc systems have assigned 0 to a BAR.
So assuming a BAR of 0 means it is unset may not be
true for all systems.
David
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc/pci: check the bus address instead of resource address in pcibios_fixup_resources
2013-06-05 13:10 ` David Laight
@ 2013-06-05 22:38 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2013-06-05 22:38 UTC (permalink / raw)
To: David Laight; +Cc: linuxppc, Kevin Hao
On Wed, 2013-06-05 at 14:10 +0100, David Laight wrote:
> > If a BAR has the value of 0, we would assume that it is unset yet and
> > then mark the resource as unset and would reassign it later.
>
> IIRC the PCI spec allows a BAR address of zero.
> Certainly some sparc systems have assigned 0 to a BAR.
> So assuming a BAR of 0 means it is unset may not be
> true for all systems.
Yes, look at the code and the comment above :-) It tries to make a
guess... which so far has worked well for us.
Note that people assigning 0 to BARs are asking for trouble anyway.
Cheers,
Ben.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-06-05 22:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-05 12:26 [PATCH] powerpc/pci: check the bus address instead of resource address in pcibios_fixup_resources Kevin Hao
2013-06-05 13:10 ` David Laight
2013-06-05 22:38 ` Benjamin Herrenschmidt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).