* [PATCH v2 01/12] PCI: make pci_flags always available
2012-02-23 19:43 [PATCH v2 00/12] generic pci_probe_only flag Bjorn Helgaas
@ 2012-02-23 19:43 ` Bjorn Helgaas
2012-02-23 19:43 ` [PATCH v2 02/12] PCI: add pci_clear_flags() Bjorn Helgaas
` (10 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: Bjorn Helgaas @ 2012-02-23 19:43 UTC (permalink / raw)
To: linux-pci; +Cc: linux-arch
If we move resource assignment functions into the core, we'll still
need a way for architectures to prevent reassignment, e.g., the
"pci_probe_only" functionality, and we'll need a generic, always
available way the core can test for that. The "pci_flags"
arrangement used by several architectures seems like a convenient
way to do this.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
drivers/pci/setup-bus.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 86b69f85..7b7d7e9 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -25,8 +25,11 @@
#include <linux/ioport.h>
#include <linux/cache.h>
#include <linux/slab.h>
+#include <asm-generic/pci-bridge.h>
#include "pci.h"
+unsigned int __weak pci_flags;
+
struct resource_list_x {
struct resource_list_x *next;
struct resource *res;
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH v2 02/12] PCI: add pci_clear_flags()
2012-02-23 19:43 [PATCH v2 00/12] generic pci_probe_only flag Bjorn Helgaas
2012-02-23 19:43 ` [PATCH v2 01/12] PCI: make pci_flags always available Bjorn Helgaas
@ 2012-02-23 19:43 ` Bjorn Helgaas
2012-02-23 19:43 ` [PATCH v2 03/12] alpha/PCI: replace pci_probe_only with pci_flags Bjorn Helgaas
` (9 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: Bjorn Helgaas @ 2012-02-23 19:43 UTC (permalink / raw)
To: linux-pci; +Cc: linux-arch
Add a pci_clear_flags() for cases when we statically initialize
pci_flags, then decide to clear things out later.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
include/asm-generic/pci-bridge.h | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/include/asm-generic/pci-bridge.h b/include/asm-generic/pci-bridge.h
index 4a5aca2..a5b5d5a 100644
--- a/include/asm-generic/pci-bridge.h
+++ b/include/asm-generic/pci-bridge.h
@@ -45,6 +45,11 @@ static inline void pci_add_flags(int flags)
pci_flags |= flags;
}
+static inline void pci_clear_flags(int flags)
+{
+ pci_flags &= ~flags;
+}
+
static inline int pci_has_flag(int flag)
{
return pci_flags & flag;
@@ -52,6 +57,7 @@ static inline int pci_has_flag(int flag)
#else
static inline void pci_set_flags(int flags) { }
static inline void pci_add_flags(int flags) { }
+static inline void pci_clear_flags(int flags) { }
static inline int pci_has_flag(int flag)
{
return 0;
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH v2 03/12] alpha/PCI: replace pci_probe_only with pci_flags
2012-02-23 19:43 [PATCH v2 00/12] generic pci_probe_only flag Bjorn Helgaas
2012-02-23 19:43 ` [PATCH v2 01/12] PCI: make pci_flags always available Bjorn Helgaas
2012-02-23 19:43 ` [PATCH v2 02/12] PCI: add pci_clear_flags() Bjorn Helgaas
@ 2012-02-23 19:43 ` Bjorn Helgaas
2012-02-23 19:43 ` Bjorn Helgaas
` (8 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: Bjorn Helgaas @ 2012-02-23 19:43 UTC (permalink / raw)
To: linux-pci; +Cc: linux-arch, linux-alpha
Some architectures (alpha, mips, powerpc) have an arch-specific
"pci_probe_only" flag. Others use PCI_PROBE_ONLY in pci_flags for
the same purpose. This moves alpha to the pci_flags approach so
generic code can use the same test across all architectures.
CC: linux-alpha@vger.kernel.org
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
arch/alpha/include/asm/pci.h | 1 +
arch/alpha/kernel/pci.c | 15 +++++++--------
arch/alpha/kernel/pci_impl.h | 3 ---
arch/alpha/kernel/sys_marvel.c | 3 ++-
arch/alpha/kernel/sys_titan.c | 3 ++-
5 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/arch/alpha/include/asm/pci.h b/arch/alpha/include/asm/pci.h
index 28d0497..6a3fe07 100644
--- a/arch/alpha/include/asm/pci.h
+++ b/arch/alpha/include/asm/pci.h
@@ -7,6 +7,7 @@
#include <linux/dma-mapping.h>
#include <asm/scatterlist.h>
#include <asm/machvec.h>
+#include <asm-generic/pci-bridge.h>
/*
* The following structure is used to manage multiple PCI busses.
diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
index 8c723c1..3a5cdf2 100644
--- a/arch/alpha/kernel/pci.c
+++ b/arch/alpha/kernel/pci.c
@@ -43,12 +43,10 @@ const char *const pci_mem_names[] = {
const char pci_hae0_name[] = "HAE0";
-/* Indicate whether we respect the PCI setup left by console. */
/*
- * Make this long-lived so that we know when shutting down
- * whether we probed only or not.
+ * If PCI_PROBE_ONLY in pci_flags is set, we don't change any PCI resource
+ * assignments.
*/
-int pci_probe_only;
/*
* The PCI controller list.
@@ -215,7 +213,7 @@ pdev_save_srm_config(struct pci_dev *dev)
struct pdev_srm_saved_conf *tmp;
static int printed = 0;
- if (!alpha_using_srm || pci_probe_only)
+ if (!alpha_using_srm || pci_has_flag(PCI_PROBE_ONLY))
return;
if (!printed) {
@@ -242,7 +240,7 @@ pci_restore_srm_config(void)
struct pdev_srm_saved_conf *tmp;
/* No need to restore if probed only. */
- if (pci_probe_only)
+ if (pci_has_flag(PCI_PROBE_ONLY))
return;
/* Restore SRM config. */
@@ -283,7 +281,7 @@ pcibios_fixup_bus(struct pci_bus *bus)
{
struct pci_dev *dev = bus->self;
- if (pci_probe_only && dev &&
+ if (pci_has_flag(PCI_PROBE_ONLY) && dev &&
(dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) {
pci_read_bridge_bases(bus);
pcibios_fixup_device_resources(dev, bus);
@@ -374,7 +372,8 @@ pcibios_claim_one_bus(struct pci_bus *b)
if (r->parent || !r->start || !r->flags)
continue;
- if (pci_probe_only || (r->flags & IORESOURCE_PCI_FIXED))
+ if (pci_has_flag(PCI_PROBE_ONLY) ||
+ (r->flags & IORESOURCE_PCI_FIXED))
pci_claim_resource(dev, i);
}
}
diff --git a/arch/alpha/kernel/pci_impl.h b/arch/alpha/kernel/pci_impl.h
index 85457b2..2b0ac42 100644
--- a/arch/alpha/kernel/pci_impl.h
+++ b/arch/alpha/kernel/pci_impl.h
@@ -173,9 +173,6 @@ extern void pci_restore_srm_config(void);
extern struct pci_controller *hose_head, **hose_tail;
extern struct pci_controller *pci_isa_hose;
-/* Indicate that we trust the console to configure things properly. */
-extern int pci_probe_only;
-
extern unsigned long alpha_agpgart_size;
extern void common_init_pci(void);
diff --git a/arch/alpha/kernel/sys_marvel.c b/arch/alpha/kernel/sys_marvel.c
index 95cfc83..fc8b125 100644
--- a/arch/alpha/kernel/sys_marvel.c
+++ b/arch/alpha/kernel/sys_marvel.c
@@ -384,7 +384,8 @@ marvel_init_pci(void)
marvel_register_error_handlers();
- pci_probe_only = 1;
+ /* Indicate that we trust the console to configure things properly */
+ pci_set_flags(PCI_PROBE_ONLY);
common_init_pci();
locate_and_init_vga(NULL);
diff --git a/arch/alpha/kernel/sys_titan.c b/arch/alpha/kernel/sys_titan.c
index f47b30a..b8eafa0 100644
--- a/arch/alpha/kernel/sys_titan.c
+++ b/arch/alpha/kernel/sys_titan.c
@@ -331,7 +331,8 @@ titan_init_pci(void)
*/
titan_late_init();
- pci_probe_only = 1;
+ /* Indicate that we trust the console to configure things properly */
+ pci_set_flags(PCI_PROBE_ONLY);
common_init_pci();
SMC669_Init(0);
locate_and_init_vga(NULL);
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH v2 04/12] arm/PCI: remove arch pci_flags definition
2012-02-23 19:43 [PATCH v2 00/12] generic pci_probe_only flag Bjorn Helgaas
@ 2012-02-23 19:43 ` Bjorn Helgaas
2012-02-23 19:43 ` [PATCH v2 02/12] PCI: add pci_clear_flags() Bjorn Helgaas
` (10 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: Bjorn Helgaas @ 2012-02-23 19:43 UTC (permalink / raw)
To: linux-pci; +Cc: linux-arch, Russell King, linux-arm-kernel, Rob Herring
The PCI core provides a pci_flags definition (currently __weak), so drop
the arm definition in favor of that.
We EXPORT_SYMBOL(pci_flags) as arm did previously. I'm dubious about
this: no other architecture exports it, and I didn't see any modules in
the tree that reference it.
CC: Rob Herring <rob.herring@calxeda.com>
CC: Russell King <linux@arm.linux.org.uk>
CC: linux-arm-kernel@lists.infradead.org
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
arch/arm/kernel/bios32.c | 2 ++
arch/arm/mm/iomap.c | 3 ---
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index f58ba35..f3fd52b 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -525,6 +525,7 @@ void __init pci_common_init(struct hw_pci *hw)
INIT_LIST_HEAD(&hw->buses);
+ pci_add_flags(PCI_REASSIGN_ALL_RSRC);
if (hw->preinit)
hw->preinit();
pcibios_init_hw(hw);
@@ -559,6 +560,7 @@ void __init pci_common_init(struct hw_pci *hw)
pci_bus_add_devices(bus);
}
}
+EXPORT_SYMBOL(pci_flags);
#ifndef CONFIG_PCI_HOST_ITE8152
void pcibios_set_master(struct pci_dev *dev)
diff --git a/arch/arm/mm/iomap.c b/arch/arm/mm/iomap.c
index e62956e..4614208 100644
--- a/arch/arm/mm/iomap.c
+++ b/arch/arm/mm/iomap.c
@@ -32,9 +32,6 @@ EXPORT_SYMBOL(pcibios_min_io);
unsigned long pcibios_min_mem = 0x01000000;
EXPORT_SYMBOL(pcibios_min_mem);
-unsigned int pci_flags = PCI_REASSIGN_ALL_RSRC;
-EXPORT_SYMBOL(pci_flags);
-
void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
{
if ((unsigned long)addr >= VMALLOC_START &&
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH v2 04/12] arm/PCI: remove arch pci_flags definition
@ 2012-02-23 19:43 ` Bjorn Helgaas
0 siblings, 0 replies; 20+ messages in thread
From: Bjorn Helgaas @ 2012-02-23 19:43 UTC (permalink / raw)
To: linux-arm-kernel
The PCI core provides a pci_flags definition (currently __weak), so drop
the arm definition in favor of that.
We EXPORT_SYMBOL(pci_flags) as arm did previously. I'm dubious about
this: no other architecture exports it, and I didn't see any modules in
the tree that reference it.
CC: Rob Herring <rob.herring@calxeda.com>
CC: Russell King <linux@arm.linux.org.uk>
CC: linux-arm-kernel at lists.infradead.org
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
arch/arm/kernel/bios32.c | 2 ++
arch/arm/mm/iomap.c | 3 ---
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index f58ba35..f3fd52b 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -525,6 +525,7 @@ void __init pci_common_init(struct hw_pci *hw)
INIT_LIST_HEAD(&hw->buses);
+ pci_add_flags(PCI_REASSIGN_ALL_RSRC);
if (hw->preinit)
hw->preinit();
pcibios_init_hw(hw);
@@ -559,6 +560,7 @@ void __init pci_common_init(struct hw_pci *hw)
pci_bus_add_devices(bus);
}
}
+EXPORT_SYMBOL(pci_flags);
#ifndef CONFIG_PCI_HOST_ITE8152
void pcibios_set_master(struct pci_dev *dev)
diff --git a/arch/arm/mm/iomap.c b/arch/arm/mm/iomap.c
index e62956e..4614208 100644
--- a/arch/arm/mm/iomap.c
+++ b/arch/arm/mm/iomap.c
@@ -32,9 +32,6 @@ EXPORT_SYMBOL(pcibios_min_io);
unsigned long pcibios_min_mem = 0x01000000;
EXPORT_SYMBOL(pcibios_min_mem);
-unsigned int pci_flags = PCI_REASSIGN_ALL_RSRC;
-EXPORT_SYMBOL(pci_flags);
-
void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
{
if ((unsigned long)addr >= VMALLOC_START &&
^ permalink raw reply related [flat|nested] 20+ messages in thread* Re: [PATCH v2 04/12] arm/PCI: remove arch pci_flags definition
2012-02-23 19:43 ` Bjorn Helgaas
@ 2012-02-23 21:39 ` Rob Herring
-1 siblings, 0 replies; 20+ messages in thread
From: Rob Herring @ 2012-02-23 21:39 UTC (permalink / raw)
To: Bjorn Helgaas; +Cc: linux-pci, linux-arch, Russell King, linux-arm-kernel
Bjorn,
On 02/23/2012 01:43 PM, Bjorn Helgaas wrote:
> The PCI core provides a pci_flags definition (currently __weak), so drop
> the arm definition in favor of that.
>
> We EXPORT_SYMBOL(pci_flags) as arm did previously. I'm dubious about
> this: no other architecture exports it, and I didn't see any modules in
> the tree that reference it.
I think you're right that it doesn't need to be exported.
Rob
> CC: Rob Herring <rob.herring@calxeda.com>
> CC: Russell King <linux@arm.linux.org.uk>
> CC: linux-arm-kernel@lists.infradead.org
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
> arch/arm/kernel/bios32.c | 2 ++
> arch/arm/mm/iomap.c | 3 ---
> 2 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
> index f58ba35..f3fd52b 100644
> --- a/arch/arm/kernel/bios32.c
> +++ b/arch/arm/kernel/bios32.c
> @@ -525,6 +525,7 @@ void __init pci_common_init(struct hw_pci *hw)
>
> INIT_LIST_HEAD(&hw->buses);
>
> + pci_add_flags(PCI_REASSIGN_ALL_RSRC);
> if (hw->preinit)
> hw->preinit();
> pcibios_init_hw(hw);
> @@ -559,6 +560,7 @@ void __init pci_common_init(struct hw_pci *hw)
> pci_bus_add_devices(bus);
> }
> }
> +EXPORT_SYMBOL(pci_flags);
>
> #ifndef CONFIG_PCI_HOST_ITE8152
> void pcibios_set_master(struct pci_dev *dev)
> diff --git a/arch/arm/mm/iomap.c b/arch/arm/mm/iomap.c
> index e62956e..4614208 100644
> --- a/arch/arm/mm/iomap.c
> +++ b/arch/arm/mm/iomap.c
> @@ -32,9 +32,6 @@ EXPORT_SYMBOL(pcibios_min_io);
> unsigned long pcibios_min_mem = 0x01000000;
> EXPORT_SYMBOL(pcibios_min_mem);
>
> -unsigned int pci_flags = PCI_REASSIGN_ALL_RSRC;
> -EXPORT_SYMBOL(pci_flags);
> -
> void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
> {
> if ((unsigned long)addr >= VMALLOC_START &&
>
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH v2 04/12] arm/PCI: remove arch pci_flags definition
@ 2012-02-23 21:39 ` Rob Herring
0 siblings, 0 replies; 20+ messages in thread
From: Rob Herring @ 2012-02-23 21:39 UTC (permalink / raw)
To: linux-arm-kernel
Bjorn,
On 02/23/2012 01:43 PM, Bjorn Helgaas wrote:
> The PCI core provides a pci_flags definition (currently __weak), so drop
> the arm definition in favor of that.
>
> We EXPORT_SYMBOL(pci_flags) as arm did previously. I'm dubious about
> this: no other architecture exports it, and I didn't see any modules in
> the tree that reference it.
I think you're right that it doesn't need to be exported.
Rob
> CC: Rob Herring <rob.herring@calxeda.com>
> CC: Russell King <linux@arm.linux.org.uk>
> CC: linux-arm-kernel at lists.infradead.org
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
> arch/arm/kernel/bios32.c | 2 ++
> arch/arm/mm/iomap.c | 3 ---
> 2 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
> index f58ba35..f3fd52b 100644
> --- a/arch/arm/kernel/bios32.c
> +++ b/arch/arm/kernel/bios32.c
> @@ -525,6 +525,7 @@ void __init pci_common_init(struct hw_pci *hw)
>
> INIT_LIST_HEAD(&hw->buses);
>
> + pci_add_flags(PCI_REASSIGN_ALL_RSRC);
> if (hw->preinit)
> hw->preinit();
> pcibios_init_hw(hw);
> @@ -559,6 +560,7 @@ void __init pci_common_init(struct hw_pci *hw)
> pci_bus_add_devices(bus);
> }
> }
> +EXPORT_SYMBOL(pci_flags);
>
> #ifndef CONFIG_PCI_HOST_ITE8152
> void pcibios_set_master(struct pci_dev *dev)
> diff --git a/arch/arm/mm/iomap.c b/arch/arm/mm/iomap.c
> index e62956e..4614208 100644
> --- a/arch/arm/mm/iomap.c
> +++ b/arch/arm/mm/iomap.c
> @@ -32,9 +32,6 @@ EXPORT_SYMBOL(pcibios_min_io);
> unsigned long pcibios_min_mem = 0x01000000;
> EXPORT_SYMBOL(pcibios_min_mem);
>
> -unsigned int pci_flags = PCI_REASSIGN_ALL_RSRC;
> -EXPORT_SYMBOL(pci_flags);
> -
> void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
> {
> if ((unsigned long)addr >= VMALLOC_START &&
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v2 05/12] arm/PCI: use pci_flags PCI_PROBE_ONLY instead of arm-specific flag
2012-02-23 19:43 [PATCH v2 00/12] generic pci_probe_only flag Bjorn Helgaas
@ 2012-02-23 19:43 ` Bjorn Helgaas
2012-02-23 19:43 ` [PATCH v2 02/12] PCI: add pci_clear_flags() Bjorn Helgaas
` (10 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: Bjorn Helgaas @ 2012-02-23 19:43 UTC (permalink / raw)
To: linux-pci; +Cc: linux-arch, Russell King, linux-arm-kernel
CC: Russell King <linux@arm.linux.org.uk>
CC: linux-arm-kernel@lists.infradead.org
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
arch/arm/kernel/bios32.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index f3fd52b..8d7c22d 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -16,7 +16,6 @@
#include <asm/mach/pci.h>
static int debug_pci;
-static int use_firmware;
/*
* We can't use pci_find_device() here since we are
@@ -537,7 +536,7 @@ void __init pci_common_init(struct hw_pci *hw)
list_for_each_entry(sys, &hw->buses, node) {
struct pci_bus *bus = sys->bus;
- if (!use_firmware) {
+ if (!pci_has_flag(PCI_PROBE_ONLY)) {
/*
* Size the bridge windows.
*/
@@ -575,7 +574,7 @@ char * __init pcibios_setup(char *str)
debug_pci = 1;
return NULL;
} else if (!strcmp(str, "firmware")) {
- use_firmware = 1;
+ pci_add_flags(PCI_PROBE_ONLY);
return NULL;
}
return str;
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH v2 05/12] arm/PCI: use pci_flags PCI_PROBE_ONLY instead of arm-specific flag
@ 2012-02-23 19:43 ` Bjorn Helgaas
0 siblings, 0 replies; 20+ messages in thread
From: Bjorn Helgaas @ 2012-02-23 19:43 UTC (permalink / raw)
To: linux-arm-kernel
CC: Russell King <linux@arm.linux.org.uk>
CC: linux-arm-kernel at lists.infradead.org
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
arch/arm/kernel/bios32.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index f3fd52b..8d7c22d 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -16,7 +16,6 @@
#include <asm/mach/pci.h>
static int debug_pci;
-static int use_firmware;
/*
* We can't use pci_find_device() here since we are
@@ -537,7 +536,7 @@ void __init pci_common_init(struct hw_pci *hw)
list_for_each_entry(sys, &hw->buses, node) {
struct pci_bus *bus = sys->bus;
- if (!use_firmware) {
+ if (!pci_has_flag(PCI_PROBE_ONLY)) {
/*
* Size the bridge windows.
*/
@@ -575,7 +574,7 @@ char * __init pcibios_setup(char *str)
debug_pci = 1;
return NULL;
} else if (!strcmp(str, "firmware")) {
- use_firmware = 1;
+ pci_add_flags(PCI_PROBE_ONLY);
return NULL;
}
return str;
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v2 06/12] microblaze/PCI: remove unused pci_flags
2012-02-23 19:43 [PATCH v2 00/12] generic pci_probe_only flag Bjorn Helgaas
` (4 preceding siblings ...)
2012-02-23 19:43 ` Bjorn Helgaas
@ 2012-02-23 19:43 ` Bjorn Helgaas
2012-02-23 19:43 ` [PATCH v2 07/12] mips/PCI: replace pci_probe_only with pci_flags Bjorn Helgaas
` (5 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: Bjorn Helgaas @ 2012-02-23 19:43 UTC (permalink / raw)
To: linux-pci; +Cc: linux-arch, microblaze-uclinux, Michal Simek
pci_flags is initialized to zero and never modified (I think this was just
copied from powerpc). Therefore, "(pci_flags & XX)" is always false and
"!(pci_flags & XX)" is always true, and we can remove all references
to pci_flags.
CC: Michal Simek <monstr@monstr.eu>
CC: microblaze-uclinux@itee.uq.edu.au
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
arch/microblaze/include/asm/pci-bridge.h | 1 -
arch/microblaze/pci/pci-common.c | 48 ++++++------------------------
2 files changed, 9 insertions(+), 40 deletions(-)
diff --git a/arch/microblaze/include/asm/pci-bridge.h b/arch/microblaze/include/asm/pci-bridge.h
index e9834b2..cb5d397 100644
--- a/arch/microblaze/include/asm/pci-bridge.h
+++ b/arch/microblaze/include/asm/pci-bridge.h
@@ -10,7 +10,6 @@
#include <linux/pci.h>
#include <linux/list.h>
#include <linux/ioport.h>
-#include <asm-generic/pci-bridge.h>
struct device_node;
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index 85f2ac1..8a257a7 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -46,9 +46,6 @@ static int global_phb_number; /* Global phb counter */
/* ISA Memory physical address */
resource_size_t isa_mem_base;
-/* Default PCI flags is 0 on ppc32, modified at boot on ppc64 */
-unsigned int pci_flags;
-
static struct dma_map_ops *pci_dma_ops = &dma_direct_ops;
unsigned long isa_io_base;
@@ -833,11 +830,7 @@ int pci_proc_domain(struct pci_bus *bus)
{
struct pci_controller *hose = pci_bus_to_host(bus);
- if (!(pci_flags & PCI_ENABLE_PROC_DOMAINS))
- return 0;
- if (pci_flags & PCI_COMPAT_DOMAIN_0)
- return hose->global_number != 0;
- return 1;
+ return 0;
}
void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
@@ -910,13 +903,7 @@ static void __devinit pcibios_fixup_resources(struct pci_dev *dev)
struct resource *res = dev->resource + i;
if (!res->flags)
continue;
- /* On platforms that have PCI_PROBE_ONLY set, we don't
- * consider 0 as an unassigned BAR value. It's technically
- * a valid value, but linux doesn't like it... so when we can
- * re-assign things, we do so, but if we can't, we keep it
- * around and hope for the best...
- */
- if (res->start == 0 && !(pci_flags & PCI_PROBE_ONLY)) {
+ if (res->start == 0) {
pr_debug("PCI:%s Resource %d %016llx-%016llx [%x]" \
"is unassigned\n",
pci_name(dev), i,
@@ -959,10 +946,6 @@ static int __devinit pcibios_uninitialized_bridge_resource(struct pci_bus *bus,
u16 command;
int i;
- /* We don't do anything if PCI_PROBE_ONLY is set */
- if (pci_flags & PCI_PROBE_ONLY)
- return 0;
-
/* Job is a bit different between memory and IO */
if (res->flags & IORESOURCE_MEM) {
/* If the BAR is non-0 (res != pci_mem_offset) then it's
@@ -1107,9 +1090,6 @@ EXPORT_SYMBOL(pcibios_fixup_bus);
static int skip_isa_ioresource_align(struct pci_dev *dev)
{
- if ((pci_flags & PCI_CAN_SKIP_ISA_ALIGN) &&
- !(dev->bus->bridge_ctl & PCI_BRIDGE_CTL_ISA))
- return 1;
return 0;
}
@@ -1236,8 +1216,6 @@ void pcibios_allocate_bus_resources(struct pci_bus *bus)
* and as such ensure proper re-allocation
* later.
*/
- if (pci_flags & PCI_REASSIGN_ALL_RSRC)
- goto clear_resource;
pr = pci_find_parent_resource(bus->self, res);
if (pr == res) {
/* this happens when the generic PCI
@@ -1422,27 +1400,19 @@ void __init pcibios_resource_survey(void)
list_for_each_entry(b, &pci_root_buses, node)
pcibios_allocate_bus_resources(b);
- if (!(pci_flags & PCI_REASSIGN_ALL_RSRC)) {
- pcibios_allocate_resources(0);
- pcibios_allocate_resources(1);
- }
+ pcibios_allocate_resources(0);
+ pcibios_allocate_resources(1);
/* Before we start assigning unassigned resource, we try to reserve
* the low IO area and the VGA memory area if they intersect the
* bus available resources to avoid allocating things on top of them
*/
- if (!(pci_flags & PCI_PROBE_ONLY)) {
- list_for_each_entry(b, &pci_root_buses, node)
- pcibios_reserve_legacy_regions(b);
- }
+ list_for_each_entry(b, &pci_root_buses, node)
+ pcibios_reserve_legacy_regions(b);
- /* Now, if the platform didn't decide to blindly trust the firmware,
- * we proceed to assigning things that were left unassigned
- */
- if (!(pci_flags & PCI_PROBE_ONLY)) {
- pr_debug("PCI: Assigning unassigned resources...\n");
- pci_assign_unassigned_resources();
- }
+ /* Now proceed to assigning things that were left unassigned */
+ pr_debug("PCI: Assigning unassigned resources...\n");
+ pci_assign_unassigned_resources();
}
#ifdef CONFIG_HOTPLUG
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH v2 07/12] mips/PCI: replace pci_probe_only with pci_flags
2012-02-23 19:43 [PATCH v2 00/12] generic pci_probe_only flag Bjorn Helgaas
` (5 preceding siblings ...)
2012-02-23 19:43 ` [PATCH v2 06/12] microblaze/PCI: remove unused pci_flags Bjorn Helgaas
@ 2012-02-23 19:43 ` Bjorn Helgaas
2012-02-23 19:43 ` [PATCH v2 08/12] mips/PCI: removed unused pci_probe configurability Bjorn Helgaas
` (4 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: Bjorn Helgaas @ 2012-02-23 19:43 UTC (permalink / raw)
To: linux-pci; +Cc: linux-arch, linux-mips, Ralf Baechle
Some architectures (alpha, mips, powerpc) have an arch-specific
"pci_probe_only" flag. Others use PCI_PROBE_ONLY in pci_flags for
the same purpose. This moves mips to the pci_flags approach so
generic code can use the same test across all architectures.
CC: Ralf Baechle <ralf@linux-mips.org>
CC: linux-mips@linux-mips.org
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
arch/mips/include/asm/pci.h | 3 +--
arch/mips/pci/pci-bcm1480.c | 2 +-
arch/mips/pci/pci-ip27.c | 2 +-
arch/mips/pci/pci-lantiq.c | 3 ++-
arch/mips/pci/pci-sb1250.c | 2 +-
arch/mips/pci/pci-xlr.c | 2 +-
arch/mips/pci/pci.c | 13 +++++--------
7 files changed, 12 insertions(+), 15 deletions(-)
diff --git a/arch/mips/include/asm/pci.h b/arch/mips/include/asm/pci.h
index 576397c..1e4fa3d 100644
--- a/arch/mips/include/asm/pci.h
+++ b/arch/mips/include/asm/pci.h
@@ -92,6 +92,7 @@ extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
#include <asm/scatterlist.h>
#include <linux/string.h>
#include <asm/io.h>
+#include <asm-generic/pci-bridge.h>
struct pci_dev;
@@ -145,8 +146,6 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
#define arch_setup_msi_irqs arch_setup_msi_irqs
#endif
-extern int pci_probe_only;
-
extern char * (*pcibios_plat_setup)(char *str);
#endif /* _ASM_PCI_H */
diff --git a/arch/mips/pci/pci-bcm1480.c b/arch/mips/pci/pci-bcm1480.c
index af8c319..37b52dc 100644
--- a/arch/mips/pci/pci-bcm1480.c
+++ b/arch/mips/pci/pci-bcm1480.c
@@ -204,7 +204,7 @@ static int __init bcm1480_pcibios_init(void)
uint64_t reg;
/* CFE will assign PCI resources */
- pci_probe_only = 1;
+ pci_set_flags(PCI_PROBE_ONLY);
/* Avoid ISA compat ranges. */
PCIBIOS_MIN_IO = 0x00008000UL;
diff --git a/arch/mips/pci/pci-ip27.c b/arch/mips/pci/pci-ip27.c
index 193e949..0fbe4c0 100644
--- a/arch/mips/pci/pci-ip27.c
+++ b/arch/mips/pci/pci-ip27.c
@@ -50,7 +50,7 @@ int __cpuinit bridge_probe(nasid_t nasid, int widget_id, int masterwid)
bridge_t *bridge;
int slot;
- pci_probe_only = 1;
+ pci_set_flags(PCI_PROBE_ONLY);
printk("a bridge\n");
diff --git a/arch/mips/pci/pci-lantiq.c b/arch/mips/pci/pci-lantiq.c
index be1e1af..030c77e 100644
--- a/arch/mips/pci/pci-lantiq.c
+++ b/arch/mips/pci/pci-lantiq.c
@@ -270,7 +270,8 @@ static int __devinit ltq_pci_probe(struct platform_device *pdev)
{
struct ltq_pci_data *ltq_pci_data =
(struct ltq_pci_data *) pdev->dev.platform_data;
- pci_probe_only = 0;
+
+ pci_clear_flags(PCI_PROBE_ONLY);
ltq_pci_irq_map = ltq_pci_data->irq;
ltq_pci_membase = ioremap_nocache(PCI_CR_BASE_ADDR, PCI_CR_SIZE);
ltq_pci_mapped_cfg =
diff --git a/arch/mips/pci/pci-sb1250.c b/arch/mips/pci/pci-sb1250.c
index 1711e8e..dd97f3a 100644
--- a/arch/mips/pci/pci-sb1250.c
+++ b/arch/mips/pci/pci-sb1250.c
@@ -213,7 +213,7 @@ static int __init sb1250_pcibios_init(void)
uint64_t reg;
/* CFE will assign PCI resources */
- pci_probe_only = 1;
+ pci_set_flags(PCI_PROBE_ONLY);
/* Avoid ISA compat ranges. */
PCIBIOS_MIN_IO = 0x00008000UL;
diff --git a/arch/mips/pci/pci-xlr.c b/arch/mips/pci/pci-xlr.c
index 3d701a9..1644805 100644
--- a/arch/mips/pci/pci-xlr.c
+++ b/arch/mips/pci/pci-xlr.c
@@ -292,7 +292,7 @@ int pcibios_plat_dev_init(struct pci_dev *dev)
static int __init pcibios_init(void)
{
/* PSB assigns PCI resources */
- pci_probe_only = 1;
+ pci_set_flags(PCI_PROBE_ONLY);
pci_config_base = ioremap(DEFAULT_PCI_CONFIG_BASE, 16 << 20);
/* Extend IO port for memory mapped io */
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index aec2b11..2a11045 100644
--- a/arch/mips/pci/pci.c
+++ b/arch/mips/pci/pci.c
@@ -20,12 +20,9 @@
#include <asm/cpu-info.h>
/*
- * Indicate whether we respect the PCI setup left by the firmware.
- *
- * Make this long-lived so that we know when shutting down
- * whether we probed only or not.
+ * If PCI_PROBE_ONLY in pci_flags is set, we don't change any PCI resource
+ * assignments.
*/
-int pci_probe_only;
#define PCI_ASSIGN_ALL_BUSSES 1
@@ -92,7 +89,7 @@ static void __devinit pcibios_scanbus(struct pci_controller *hose)
if (!hose->iommu)
PCI_DMA_BUS_IS_PHYS = 1;
- if (hose->get_busno && pci_probe_only)
+ if (hose->get_busno && pci_has_flag(PCI_PROBE_ONLY))
next_busno = (*hose->get_busno)();
pci_add_resource(&resources, hose->mem_resource);
@@ -115,7 +112,7 @@ static void __devinit pcibios_scanbus(struct pci_controller *hose)
need_domain_info = 1;
}
- if (!pci_probe_only) {
+ if (!pci_has_flag(PCI_PROBE_ONLY)) {
pci_bus_size_bridges(bus);
pci_bus_assign_resources(bus);
pci_enable_bridges(bus);
@@ -282,7 +279,7 @@ void __devinit pcibios_fixup_bus(struct pci_bus *bus)
struct list_head *ln;
struct pci_dev *dev = bus->self;
- if (pci_probe_only && dev &&
+ if (pci_has_flag(PCI_PROBE_ONLY) && dev &&
(dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) {
pci_read_bridge_bases(bus);
pcibios_fixup_device_resources(dev, bus);
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH v2 08/12] mips/PCI: removed unused pci_probe configurability
2012-02-23 19:43 [PATCH v2 00/12] generic pci_probe_only flag Bjorn Helgaas
` (6 preceding siblings ...)
2012-02-23 19:43 ` [PATCH v2 07/12] mips/PCI: replace pci_probe_only with pci_flags Bjorn Helgaas
@ 2012-02-23 19:43 ` Bjorn Helgaas
2012-02-23 19:43 ` [PATCH v2 09/12] powerpc/PCI: make pci_probe_only default to 0 Bjorn Helgaas
` (3 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: Bjorn Helgaas @ 2012-02-23 19:43 UTC (permalink / raw)
To: linux-pci; +Cc: linux-arch, linux-mips, Ralf Baechle
We never assign anything other than PCI_ASSIGN_ALL_BUSSES to pci_probe,
so just remove the indirection. If configurability is required in the
future, please use the pci_flags/PCI_REASSIGN_ALL_BUS functionality
as is done for powerpc.
CC: Ralf Baechle <ralf@linux-mips.org>
CC: linux-mips@linux-mips.org
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
arch/mips/pci/pci.c | 6 +-----
1 files changed, 1 insertions(+), 5 deletions(-)
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index 2a11045..19f6d19 100644
--- a/arch/mips/pci/pci.c
+++ b/arch/mips/pci/pci.c
@@ -24,10 +24,6 @@
* assignments.
*/
-#define PCI_ASSIGN_ALL_BUSSES 1
-
-unsigned int pci_probe = PCI_ASSIGN_ALL_BUSSES;
-
/*
* The PCI controller list.
*/
@@ -238,7 +234,7 @@ static int pcibios_enable_resources(struct pci_dev *dev, int mask)
unsigned int pcibios_assign_all_busses(void)
{
- return (pci_probe & PCI_ASSIGN_ALL_BUSSES) ? 1 : 0;
+ return 1;
}
int pcibios_enable_device(struct pci_dev *dev, int mask)
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH v2 09/12] powerpc/PCI: make pci_probe_only default to 0
2012-02-23 19:43 [PATCH v2 00/12] generic pci_probe_only flag Bjorn Helgaas
` (7 preceding siblings ...)
2012-02-23 19:43 ` [PATCH v2 08/12] mips/PCI: removed unused pci_probe configurability Bjorn Helgaas
@ 2012-02-23 19:43 ` Bjorn Helgaas
2012-02-23 19:43 ` Bjorn Helgaas
` (2 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: Bjorn Helgaas @ 2012-02-23 19:43 UTC (permalink / raw)
To: linux-pci; +Cc: linux-arch, Benjamin Herrenschmidt
pci_probe_only is set on ppc64 to prevent resource re-allocation
by the core. It's meant to be used in very specific circumstances
such as when operating under a hypervisor that may prevent such
re-allocation.
Instead of default to 1, we make it default to 0 and explicitly
set it in the few cases where we need it.
This fixes FSL PCI which wants it clear among others.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
arch/powerpc/kernel/pci_64.c | 2 +-
arch/powerpc/platforms/powermac/pci.c | 3 ---
arch/powerpc/platforms/powernv/pci.c | 3 ---
arch/powerpc/platforms/pseries/setup.c | 3 +++
arch/powerpc/platforms/wsp/wsp_pci.c | 1 -
5 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 3318d39..f627eb7 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -33,7 +33,7 @@
#include <asm/machdep.h>
#include <asm/ppc-pci.h>
-unsigned long pci_probe_only = 1;
+unsigned long pci_probe_only = 0;
/* pci_io_base -- the base address from which io bars are offsets.
* This is the lowest I/O base address (so bar values are always positive),
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
index 31a7d3a..43bbe1b 100644
--- a/arch/powerpc/platforms/powermac/pci.c
+++ b/arch/powerpc/platforms/powermac/pci.c
@@ -1059,9 +1059,6 @@ void __init pmac_pci_init(void)
}
/* pmac_check_ht_link(); */
- /* We can allocate missing resources if any */
- pci_probe_only = 0;
-
#else /* CONFIG_PPC64 */
init_p2pbridge();
init_second_ohare();
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
index f92b9ef..94ed056 100644
--- a/arch/powerpc/platforms/powernv/pci.c
+++ b/arch/powerpc/platforms/powernv/pci.c
@@ -563,9 +563,6 @@ void __init pnv_pci_init(void)
pci_set_flags(PCI_CAN_SKIP_ISA_ALIGN);
- /* We do not want to just probe */
- pci_probe_only = 0;
-
/* OPAL absent, try POPAL first then RTAS detection of PHBs */
if (!firmware_has_feature(FW_FEATURE_OPAL)) {
#ifdef CONFIG_PPC_POWERNV_RTAS
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index f79f127..386e265 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -380,6 +380,9 @@ static void __init pSeries_setup_arch(void)
fwnmi_init();
+ /* By default, only probe PCI (can be overriden by rtas_pci */
+ pci_probe_only = 1;
+
/* Find and initialize PCI host bridges */
init_pci_config_tokens();
find_and_init_phbs();
diff --git a/arch/powerpc/platforms/wsp/wsp_pci.c b/arch/powerpc/platforms/wsp/wsp_pci.c
index d24b3ac..763014c 100644
--- a/arch/powerpc/platforms/wsp/wsp_pci.c
+++ b/arch/powerpc/platforms/wsp/wsp_pci.c
@@ -682,7 +682,6 @@ static int __init wsp_setup_one_phb(struct device_node *np)
/* XXX Force re-assigning of everything for now */
pci_add_flags(PCI_REASSIGN_ALL_BUS | PCI_REASSIGN_ALL_RSRC |
PCI_ENABLE_PROC_DOMAINS);
- pci_probe_only = 0;
/* Calculate how the TCE space is divided */
phb->dma32_base = 0;
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH v2 10/12] powerpc/PCI: replace pci_probe_only with pci_flags
2012-02-23 19:43 [PATCH v2 00/12] generic pci_probe_only flag Bjorn Helgaas
@ 2012-02-23 19:43 ` Bjorn Helgaas
2012-02-23 19:43 ` [PATCH v2 02/12] PCI: add pci_clear_flags() Bjorn Helgaas
` (10 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: Bjorn Helgaas @ 2012-02-23 19:43 UTC (permalink / raw)
To: linux-pci; +Cc: linux-arch, Benjamin Herrenschmidt, linuxppc-dev
We already use pci_flags, so this just sets pci_flags directly and removes
the intermediate step of figuring out pci_probe_only, then using it to set
pci_flags.
The PCI core provides a pci_flags definition (currently __weak), so drop
the powerpc definitions in favor of that.
CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
arch/powerpc/include/asm/ppc-pci.h | 2 --
arch/powerpc/kernel/pci-common.c | 3 ---
arch/powerpc/kernel/pci_64.c | 5 -----
arch/powerpc/kernel/rtas_pci.c | 10 +++++++---
arch/powerpc/platforms/iseries/pci.c | 2 +-
arch/powerpc/platforms/maple/pci.c | 2 +-
arch/powerpc/platforms/pasemi/pci.c | 2 +-
arch/powerpc/platforms/powernv/pci-ioda.c | 5 ++---
arch/powerpc/platforms/powernv/pci.c | 2 +-
arch/powerpc/platforms/pseries/setup.c | 4 ++--
10 files changed, 15 insertions(+), 22 deletions(-)
diff --git a/arch/powerpc/include/asm/ppc-pci.h b/arch/powerpc/include/asm/ppc-pci.h
index 6d42297..a96d012 100644
--- a/arch/powerpc/include/asm/ppc-pci.h
+++ b/arch/powerpc/include/asm/ppc-pci.h
@@ -45,8 +45,6 @@ extern void init_pci_config_tokens (void);
extern unsigned long get_phb_buid (struct device_node *);
extern int rtas_setup_phb(struct pci_controller *phb);
-extern unsigned long pci_probe_only;
-
/* ---- EEH internal-use-only related routines ---- */
#ifdef CONFIG_EEH
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index cce98d7..6d03da4 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -50,9 +50,6 @@ static int global_phb_number; /* Global phb counter */
/* ISA Memory physical address */
resource_size_t isa_mem_base;
-/* Default PCI flags is 0 on ppc32, modified at boot on ppc64 */
-unsigned int pci_flags = 0;
-
static struct dma_map_ops *pci_dma_ops = &dma_direct_ops;
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index f627eb7..75417fd 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -33,8 +33,6 @@
#include <asm/machdep.h>
#include <asm/ppc-pci.h>
-unsigned long pci_probe_only = 0;
-
/* pci_io_base -- the base address from which io bars are offsets.
* This is the lowest I/O base address (so bar values are always positive),
* and it *must* be the start of ISA space if an ISA bus exists because
@@ -55,9 +53,6 @@ static int __init pcibios_init(void)
*/
ppc_md.phys_mem_access_prot = pci_phys_mem_access_prot;
- if (pci_probe_only)
- pci_add_flags(PCI_PROBE_ONLY);
-
/* On ppc64, we always enable PCI domains and we keep domain 0
* backward compatible in /proc for video cards
*/
diff --git a/arch/powerpc/kernel/rtas_pci.c b/arch/powerpc/kernel/rtas_pci.c
index 6cd8f01..140735c 100644
--- a/arch/powerpc/kernel/rtas_pci.c
+++ b/arch/powerpc/kernel/rtas_pci.c
@@ -276,7 +276,7 @@ void __init find_and_init_phbs(void)
pci_devs_phb_init();
/*
- * pci_probe_only and pci_assign_all_buses can be set via properties
+ * PCI_PROBE_ONLY and PCI_REASSIGN_ALL_BUS can be set via properties
* in chosen.
*/
if (of_chosen) {
@@ -284,8 +284,12 @@ void __init find_and_init_phbs(void)
prop = of_get_property(of_chosen,
"linux,pci-probe-only", NULL);
- if (prop)
- pci_probe_only = *prop;
+ if (prop) {
+ if (*prop)
+ pci_add_flags(PCI_PROBE_ONLY);
+ else
+ pci_clear_flags(PCI_PROBE_ONLY);
+ }
#ifdef CONFIG_PPC32 /* Will be made generic soon */
prop = of_get_property(of_chosen,
diff --git a/arch/powerpc/platforms/iseries/pci.c b/arch/powerpc/platforms/iseries/pci.c
index c754128..171b2f3 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -868,7 +868,7 @@ void __init iSeries_pcibios_init(void)
/* Install IO hooks */
ppc_pci_io = iseries_pci_io;
- pci_probe_only = 1;
+ pci_add_flags(PCI_PROBE_ONLY);
/* iSeries has no IO space in the common sense, it needs to set
* the IO base to 0
diff --git a/arch/powerpc/platforms/maple/pci.c b/arch/powerpc/platforms/maple/pci.c
index 401e3f3..465ee8f 100644
--- a/arch/powerpc/platforms/maple/pci.c
+++ b/arch/powerpc/platforms/maple/pci.c
@@ -620,7 +620,7 @@ void __init maple_pci_init(void)
}
/* Tell pci.c to not change any resource allocations. */
- pci_probe_only = 1;
+ pci_add_flags(PCI_PROBE_ONLY);
}
int maple_pci_get_legacy_ide_irq(struct pci_dev *pdev, int channel)
diff --git a/arch/powerpc/platforms/pasemi/pci.c b/arch/powerpc/platforms/pasemi/pci.c
index b6a0ec4..b27d886 100644
--- a/arch/powerpc/platforms/pasemi/pci.c
+++ b/arch/powerpc/platforms/pasemi/pci.c
@@ -231,7 +231,7 @@ void __init pas_pci_init(void)
pci_devs_phb_init();
/* Use the common resource allocation mechanism */
- pci_probe_only = 1;
+ pci_add_flags(PCI_PROBE_ONLY);
}
void __iomem *pasemi_pci_getcfgaddr(struct pci_dev *dev, int offset)
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 5e155df..fbdd74d 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -1299,15 +1299,14 @@ void __init pnv_pci_init_ioda1_phb(struct device_node *np)
/* Setup MSI support */
pnv_pci_init_ioda_msis(phb);
- /* We set both probe_only and PCI_REASSIGN_ALL_RSRC. This is an
+ /* We set both PCI_PROBE_ONLY and PCI_REASSIGN_ALL_RSRC. This is an
* odd combination which essentially means that we skip all resource
* fixups and assignments in the generic code, and do it all
* ourselves here
*/
- pci_probe_only = 1;
ppc_md.pcibios_fixup_phb = pnv_pci_ioda_fixup_phb;
ppc_md.pcibios_enable_device_hook = pnv_pci_enable_device_hook;
- pci_add_flags(PCI_REASSIGN_ALL_RSRC);
+ pci_add_flags(PCI_PROBE_ONLY | PCI_REASSIGN_ALL_RSRC);
/* Reset IODA tables to a clean state */
rc = opal_pci_reset(phb_id, OPAL_PCI_IODA_TABLE_RESET, OPAL_ASSERT_RESET);
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
index 94ed056..15f4e73 100644
--- a/arch/powerpc/platforms/powernv/pci.c
+++ b/arch/powerpc/platforms/powernv/pci.c
@@ -561,7 +561,7 @@ void __init pnv_pci_init(void)
{
struct device_node *np;
- pci_set_flags(PCI_CAN_SKIP_ISA_ALIGN);
+ pci_add_flags(PCI_CAN_SKIP_ISA_ALIGN);
/* OPAL absent, try POPAL first then RTAS detection of PHBs */
if (!firmware_has_feature(FW_FEATURE_OPAL)) {
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 386e265..fc2a6f6 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -380,8 +380,8 @@ static void __init pSeries_setup_arch(void)
fwnmi_init();
- /* By default, only probe PCI (can be overriden by rtas_pci */
- pci_probe_only = 1;
+ /* By default, only probe PCI (can be overriden by rtas_pci) */
+ pci_add_flags(PCI_PROBE_ONLY);
/* Find and initialize PCI host bridges */
init_pci_config_tokens();
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH v2 10/12] powerpc/PCI: replace pci_probe_only with pci_flags
@ 2012-02-23 19:43 ` Bjorn Helgaas
0 siblings, 0 replies; 20+ messages in thread
From: Bjorn Helgaas @ 2012-02-23 19:43 UTC (permalink / raw)
To: linux-pci; +Cc: linux-arch, linuxppc-dev
We already use pci_flags, so this just sets pci_flags directly and removes
the intermediate step of figuring out pci_probe_only, then using it to set
pci_flags.
The PCI core provides a pci_flags definition (currently __weak), so drop
the powerpc definitions in favor of that.
CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
arch/powerpc/include/asm/ppc-pci.h | 2 --
arch/powerpc/kernel/pci-common.c | 3 ---
arch/powerpc/kernel/pci_64.c | 5 -----
arch/powerpc/kernel/rtas_pci.c | 10 +++++++---
arch/powerpc/platforms/iseries/pci.c | 2 +-
arch/powerpc/platforms/maple/pci.c | 2 +-
arch/powerpc/platforms/pasemi/pci.c | 2 +-
arch/powerpc/platforms/powernv/pci-ioda.c | 5 ++---
arch/powerpc/platforms/powernv/pci.c | 2 +-
arch/powerpc/platforms/pseries/setup.c | 4 ++--
10 files changed, 15 insertions(+), 22 deletions(-)
diff --git a/arch/powerpc/include/asm/ppc-pci.h b/arch/powerpc/include/asm/ppc-pci.h
index 6d42297..a96d012 100644
--- a/arch/powerpc/include/asm/ppc-pci.h
+++ b/arch/powerpc/include/asm/ppc-pci.h
@@ -45,8 +45,6 @@ extern void init_pci_config_tokens (void);
extern unsigned long get_phb_buid (struct device_node *);
extern int rtas_setup_phb(struct pci_controller *phb);
-extern unsigned long pci_probe_only;
-
/* ---- EEH internal-use-only related routines ---- */
#ifdef CONFIG_EEH
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index cce98d7..6d03da4 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -50,9 +50,6 @@ static int global_phb_number; /* Global phb counter */
/* ISA Memory physical address */
resource_size_t isa_mem_base;
-/* Default PCI flags is 0 on ppc32, modified at boot on ppc64 */
-unsigned int pci_flags = 0;
-
static struct dma_map_ops *pci_dma_ops = &dma_direct_ops;
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index f627eb7..75417fd 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -33,8 +33,6 @@
#include <asm/machdep.h>
#include <asm/ppc-pci.h>
-unsigned long pci_probe_only = 0;
-
/* pci_io_base -- the base address from which io bars are offsets.
* This is the lowest I/O base address (so bar values are always positive),
* and it *must* be the start of ISA space if an ISA bus exists because
@@ -55,9 +53,6 @@ static int __init pcibios_init(void)
*/
ppc_md.phys_mem_access_prot = pci_phys_mem_access_prot;
- if (pci_probe_only)
- pci_add_flags(PCI_PROBE_ONLY);
-
/* On ppc64, we always enable PCI domains and we keep domain 0
* backward compatible in /proc for video cards
*/
diff --git a/arch/powerpc/kernel/rtas_pci.c b/arch/powerpc/kernel/rtas_pci.c
index 6cd8f01..140735c 100644
--- a/arch/powerpc/kernel/rtas_pci.c
+++ b/arch/powerpc/kernel/rtas_pci.c
@@ -276,7 +276,7 @@ void __init find_and_init_phbs(void)
pci_devs_phb_init();
/*
- * pci_probe_only and pci_assign_all_buses can be set via properties
+ * PCI_PROBE_ONLY and PCI_REASSIGN_ALL_BUS can be set via properties
* in chosen.
*/
if (of_chosen) {
@@ -284,8 +284,12 @@ void __init find_and_init_phbs(void)
prop = of_get_property(of_chosen,
"linux,pci-probe-only", NULL);
- if (prop)
- pci_probe_only = *prop;
+ if (prop) {
+ if (*prop)
+ pci_add_flags(PCI_PROBE_ONLY);
+ else
+ pci_clear_flags(PCI_PROBE_ONLY);
+ }
#ifdef CONFIG_PPC32 /* Will be made generic soon */
prop = of_get_property(of_chosen,
diff --git a/arch/powerpc/platforms/iseries/pci.c b/arch/powerpc/platforms/iseries/pci.c
index c754128..171b2f3 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -868,7 +868,7 @@ void __init iSeries_pcibios_init(void)
/* Install IO hooks */
ppc_pci_io = iseries_pci_io;
- pci_probe_only = 1;
+ pci_add_flags(PCI_PROBE_ONLY);
/* iSeries has no IO space in the common sense, it needs to set
* the IO base to 0
diff --git a/arch/powerpc/platforms/maple/pci.c b/arch/powerpc/platforms/maple/pci.c
index 401e3f3..465ee8f 100644
--- a/arch/powerpc/platforms/maple/pci.c
+++ b/arch/powerpc/platforms/maple/pci.c
@@ -620,7 +620,7 @@ void __init maple_pci_init(void)
}
/* Tell pci.c to not change any resource allocations. */
- pci_probe_only = 1;
+ pci_add_flags(PCI_PROBE_ONLY);
}
int maple_pci_get_legacy_ide_irq(struct pci_dev *pdev, int channel)
diff --git a/arch/powerpc/platforms/pasemi/pci.c b/arch/powerpc/platforms/pasemi/pci.c
index b6a0ec4..b27d886 100644
--- a/arch/powerpc/platforms/pasemi/pci.c
+++ b/arch/powerpc/platforms/pasemi/pci.c
@@ -231,7 +231,7 @@ void __init pas_pci_init(void)
pci_devs_phb_init();
/* Use the common resource allocation mechanism */
- pci_probe_only = 1;
+ pci_add_flags(PCI_PROBE_ONLY);
}
void __iomem *pasemi_pci_getcfgaddr(struct pci_dev *dev, int offset)
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 5e155df..fbdd74d 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -1299,15 +1299,14 @@ void __init pnv_pci_init_ioda1_phb(struct device_node *np)
/* Setup MSI support */
pnv_pci_init_ioda_msis(phb);
- /* We set both probe_only and PCI_REASSIGN_ALL_RSRC. This is an
+ /* We set both PCI_PROBE_ONLY and PCI_REASSIGN_ALL_RSRC. This is an
* odd combination which essentially means that we skip all resource
* fixups and assignments in the generic code, and do it all
* ourselves here
*/
- pci_probe_only = 1;
ppc_md.pcibios_fixup_phb = pnv_pci_ioda_fixup_phb;
ppc_md.pcibios_enable_device_hook = pnv_pci_enable_device_hook;
- pci_add_flags(PCI_REASSIGN_ALL_RSRC);
+ pci_add_flags(PCI_PROBE_ONLY | PCI_REASSIGN_ALL_RSRC);
/* Reset IODA tables to a clean state */
rc = opal_pci_reset(phb_id, OPAL_PCI_IODA_TABLE_RESET, OPAL_ASSERT_RESET);
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
index 94ed056..15f4e73 100644
--- a/arch/powerpc/platforms/powernv/pci.c
+++ b/arch/powerpc/platforms/powernv/pci.c
@@ -561,7 +561,7 @@ void __init pnv_pci_init(void)
{
struct device_node *np;
- pci_set_flags(PCI_CAN_SKIP_ISA_ALIGN);
+ pci_add_flags(PCI_CAN_SKIP_ISA_ALIGN);
/* OPAL absent, try POPAL first then RTAS detection of PHBs */
if (!firmware_has_feature(FW_FEATURE_OPAL)) {
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 386e265..fc2a6f6 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -380,8 +380,8 @@ static void __init pSeries_setup_arch(void)
fwnmi_init();
- /* By default, only probe PCI (can be overriden by rtas_pci */
- pci_probe_only = 1;
+ /* By default, only probe PCI (can be overriden by rtas_pci) */
+ pci_add_flags(PCI_PROBE_ONLY);
/* Find and initialize PCI host bridges */
init_pci_config_tokens();
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH v2 11/12] unicore32/PCI: use pci_flags PCI_PROBE_ONLY instead of arm-specific flag
2012-02-23 19:43 [PATCH v2 00/12] generic pci_probe_only flag Bjorn Helgaas
` (9 preceding siblings ...)
2012-02-23 19:43 ` Bjorn Helgaas
@ 2012-02-23 19:43 ` Bjorn Helgaas
2012-02-24 6:19 ` Guan Xuetao
2012-02-23 19:44 ` [PATCH v2 12/12] PCI: make pci_flags non-weak Bjorn Helgaas
11 siblings, 1 reply; 20+ messages in thread
From: Bjorn Helgaas @ 2012-02-23 19:43 UTC (permalink / raw)
To: linux-pci; +Cc: linux-arch, Guan Xuetao
CC: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
arch/unicore32/kernel/pci.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/unicore32/kernel/pci.c b/arch/unicore32/kernel/pci.c
index a8f07fe..6c1248f 100644
--- a/arch/unicore32/kernel/pci.c
+++ b/arch/unicore32/kernel/pci.c
@@ -19,9 +19,9 @@
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/io.h>
+#include <asm-generic/pci-bridge.h>
static int debug_pci;
-static int use_firmware;
#define CONFIG_CMD(bus, devfn, where) \
(0x80000000 | (bus->number << 16) | (devfn << 8) | (where & ~3))
@@ -276,7 +276,7 @@ static int __init pci_common_init(void)
pci_fixup_irqs(pci_common_swizzle, pci_puv3_map_irq);
- if (!use_firmware) {
+ if (!pci_has_flag(PCI_PROBE_ONLY)) {
/*
* Size the bridge windows.
*/
@@ -303,7 +303,7 @@ char * __devinit pcibios_setup(char *str)
debug_pci = 1;
return NULL;
} else if (!strcmp(str, "firmware")) {
- use_firmware = 1;
+ pci_add_flags(PCI_PROBE_ONLY);
return NULL;
}
return str;
^ permalink raw reply related [flat|nested] 20+ messages in thread* Re: [PATCH v2 11/12] unicore32/PCI: use pci_flags PCI_PROBE_ONLY instead of arm-specific flag
2012-02-23 19:43 ` [PATCH v2 11/12] unicore32/PCI: use pci_flags PCI_PROBE_ONLY instead of arm-specific flag Bjorn Helgaas
@ 2012-02-24 6:19 ` Guan Xuetao
2012-02-24 22:20 ` Bjorn Helgaas
0 siblings, 1 reply; 20+ messages in thread
From: Guan Xuetao @ 2012-02-24 6:19 UTC (permalink / raw)
To: Bjorn Helgaas; +Cc: linux-pci, linux-arch
On Thu, 2012-02-23 at 12:43 -0700, Bjorn Helgaas wrote:
> CC: Guan Xuetao <gxt@mprc.pku.edu.cn>
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
> arch/unicore32/kernel/pci.c | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/unicore32/kernel/pci.c b/arch/unicore32/kernel/pci.c
> index a8f07fe..6c1248f 100644
> --- a/arch/unicore32/kernel/pci.c
> +++ b/arch/unicore32/kernel/pci.c
> @@ -19,9 +19,9 @@
> #include <linux/slab.h>
> #include <linux/init.h>
> #include <linux/io.h>
> +#include <asm-generic/pci-bridge.h>
I recommend that asm-generic/pci-bridge.h should be inserted into
asm/pci.h file.
Regards,
Guan Xuetao
>
> static int debug_pci;
> -static int use_firmware;
>
> #define CONFIG_CMD(bus, devfn, where) \
> (0x80000000 | (bus->number << 16) | (devfn << 8) | (where & ~3))
> @@ -276,7 +276,7 @@ static int __init pci_common_init(void)
>
> pci_fixup_irqs(pci_common_swizzle, pci_puv3_map_irq);
>
> - if (!use_firmware) {
> + if (!pci_has_flag(PCI_PROBE_ONLY)) {
> /*
> * Size the bridge windows.
> */
> @@ -303,7 +303,7 @@ char * __devinit pcibios_setup(char *str)
> debug_pci = 1;
> return NULL;
> } else if (!strcmp(str, "firmware")) {
> - use_firmware = 1;
> + pci_add_flags(PCI_PROBE_ONLY);
> return NULL;
> }
> return str;
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH v2 11/12] unicore32/PCI: use pci_flags PCI_PROBE_ONLY instead of arm-specific flag
2012-02-24 6:19 ` Guan Xuetao
@ 2012-02-24 22:20 ` Bjorn Helgaas
0 siblings, 0 replies; 20+ messages in thread
From: Bjorn Helgaas @ 2012-02-24 22:20 UTC (permalink / raw)
To: gxt; +Cc: linux-pci, linux-arch
On Thu, Feb 23, 2012 at 10:19 PM, Guan Xuetao <gxt@mprc.pku.edu.cn> wrote:
> On Thu, 2012-02-23 at 12:43 -0700, Bjorn Helgaas wrote:
>> CC: Guan Xuetao <gxt@mprc.pku.edu.cn>
>> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
>> ---
>> arch/unicore32/kernel/pci.c | 6 +++---
>> 1 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/unicore32/kernel/pci.c b/arch/unicore32/kernel/pci.c
>> index a8f07fe..6c1248f 100644
>> --- a/arch/unicore32/kernel/pci.c
>> +++ b/arch/unicore32/kernel/pci.c
>> @@ -19,9 +19,9 @@
>> #include <linux/slab.h>
>> #include <linux/init.h>
>> #include <linux/io.h>
>> +#include <asm-generic/pci-bridge.h>
> I recommend that asm-generic/pci-bridge.h should be inserted into
> asm/pci.h file.
Yes, you're right. I goofed on that. If/when I update the series,
I'll include that change.
I don't think anything will break the way it is, because the only user
of pci-bridge.h stuff is pci.c, but all the other arches include it in
asm/pci.h, so it makes sense to do it that way in unicore32 as well.
Bjorn
>>
>> static int debug_pci;
>> -static int use_firmware;
>>
>> #define CONFIG_CMD(bus, devfn, where) \
>> (0x80000000 | (bus->number << 16) | (devfn << 8) | (where & ~3))
>> @@ -276,7 +276,7 @@ static int __init pci_common_init(void)
>>
>> pci_fixup_irqs(pci_common_swizzle, pci_puv3_map_irq);
>>
>> - if (!use_firmware) {
>> + if (!pci_has_flag(PCI_PROBE_ONLY)) {
>> /*
>> * Size the bridge windows.
>> */
>> @@ -303,7 +303,7 @@ char * __devinit pcibios_setup(char *str)
>> debug_pci = 1;
>> return NULL;
>> } else if (!strcmp(str, "firmware")) {
>> - use_firmware = 1;
>> + pci_add_flags(PCI_PROBE_ONLY);
>> return NULL;
>> }
>> return str;
>
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v2 12/12] PCI: make pci_flags non-weak
2012-02-23 19:43 [PATCH v2 00/12] generic pci_probe_only flag Bjorn Helgaas
` (10 preceding siblings ...)
2012-02-23 19:43 ` [PATCH v2 11/12] unicore32/PCI: use pci_flags PCI_PROBE_ONLY instead of arm-specific flag Bjorn Helgaas
@ 2012-02-23 19:44 ` Bjorn Helgaas
11 siblings, 0 replies; 20+ messages in thread
From: Bjorn Helgaas @ 2012-02-23 19:44 UTC (permalink / raw)
To: linux-pci; +Cc: linux-arch
No architecture defines its own pci_flags, so the core symbol does not
need to be weak.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
drivers/pci/setup-bus.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 7b7d7e9..c172ebb 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -28,7 +28,7 @@
#include <asm-generic/pci-bridge.h>
#include "pci.h"
-unsigned int __weak pci_flags;
+unsigned int pci_flags;
struct resource_list_x {
struct resource_list_x *next;
^ permalink raw reply related [flat|nested] 20+ messages in thread