* [PATCH 02/11] Add udbg_console_anytime() which sets udbg console to CON_ANYTIME
2008-04-18 7:54 [PATCH 01/11] Set udbg_console index to 0 Michael Ellerman
@ 2008-04-18 7:54 ` Michael Ellerman
2008-04-18 8:20 ` Benjamin Herrenschmidt
2008-04-18 7:54 ` [PATCH 03/11] Register udbg console early on pseries LPAR Michael Ellerman
` (8 subsequent siblings)
9 siblings, 1 reply; 15+ messages in thread
From: Michael Ellerman @ 2008-04-18 7:54 UTC (permalink / raw)
To: linuxppc-dev
In theory the udbg console should be safe to call basically at any time
after boot. It does not need any per-cpu resources or for the cpu to be
online, as long as there is a udbg_putc routine hooked up it should
work. So it should be able to be marked as CON_ANYTIME.
Verifying this will take a bit of time and testing though, so instead of
marking udbg console as CON_ANYTIME for all platforms, add a routine so
that a platform can opt-in to having udbg console called early.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
arch/powerpc/kernel/udbg.c | 5 +++++
include/asm-powerpc/udbg.h | 1 +
2 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/kernel/udbg.c b/arch/powerpc/kernel/udbg.c
index 9ac5f3a..7b1fd86 100644
--- a/arch/powerpc/kernel/udbg.c
+++ b/arch/powerpc/kernel/udbg.c
@@ -158,6 +158,11 @@ static struct console udbg_console = {
.index = 0,
};
+void udbg_console_anytime(void)
+{
+ udbg_console.flags |= CON_ANYTIME;
+}
+
static int early_console_initialized;
/*
diff --git a/include/asm-powerpc/udbg.h b/include/asm-powerpc/udbg.h
index 6418cee..102fa91 100644
--- a/include/asm-powerpc/udbg.h
+++ b/include/asm-powerpc/udbg.h
@@ -23,6 +23,7 @@ extern int udbg_write(const char *s, int n);
extern int udbg_read(char *buf, int buflen);
extern void register_early_udbg_console(void);
+extern void udbg_console_anytime(void);
extern void udbg_printf(const char *fmt, ...)
__attribute__ ((format (printf, 1, 2)));
extern void udbg_progress(char *s, unsigned short hex);
--
1.5.5
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 02/11] Add udbg_console_anytime() which sets udbg console to CON_ANYTIME
2008-04-18 7:54 ` [PATCH 02/11] Add udbg_console_anytime() which sets udbg console to CON_ANYTIME Michael Ellerman
@ 2008-04-18 8:20 ` Benjamin Herrenschmidt
2008-04-23 5:43 ` Michael Ellerman
0 siblings, 1 reply; 15+ messages in thread
From: Benjamin Herrenschmidt @ 2008-04-18 8:20 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev
On Fri, 2008-04-18 at 17:54 +1000, Michael Ellerman wrote:
> In theory the udbg console should be safe to call basically at any time
> after boot. It does not need any per-cpu resources or for the cpu to be
> online, as long as there is a udbg_putc routine hooked up it should
> work. So it should be able to be marked as CON_ANYTIME.
>
> Verifying this will take a bit of time and testing though, so instead of
> marking udbg console as CON_ANYTIME for all platforms, add a routine so
> that a platform can opt-in to having udbg console called early.
>
> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Nah, just stick it always.
Cheers,
Ben.
> ---
> arch/powerpc/kernel/udbg.c | 5 +++++
> include/asm-powerpc/udbg.h | 1 +
> 2 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/arch/powerpc/kernel/udbg.c b/arch/powerpc/kernel/udbg.c
> index 9ac5f3a..7b1fd86 100644
> --- a/arch/powerpc/kernel/udbg.c
> +++ b/arch/powerpc/kernel/udbg.c
> @@ -158,6 +158,11 @@ static struct console udbg_console = {
> .index = 0,
> };
>
> +void udbg_console_anytime(void)
> +{
> + udbg_console.flags |= CON_ANYTIME;
> +}
> +
> static int early_console_initialized;
>
> /*
> diff --git a/include/asm-powerpc/udbg.h b/include/asm-powerpc/udbg.h
> index 6418cee..102fa91 100644
> --- a/include/asm-powerpc/udbg.h
> +++ b/include/asm-powerpc/udbg.h
> @@ -23,6 +23,7 @@ extern int udbg_write(const char *s, int n);
> extern int udbg_read(char *buf, int buflen);
>
> extern void register_early_udbg_console(void);
> +extern void udbg_console_anytime(void);
> extern void udbg_printf(const char *fmt, ...)
> __attribute__ ((format (printf, 1, 2)));
> extern void udbg_progress(char *s, unsigned short hex);
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 02/11] Add udbg_console_anytime() which sets udbg console to CON_ANYTIME
2008-04-18 8:20 ` Benjamin Herrenschmidt
@ 2008-04-23 5:43 ` Michael Ellerman
0 siblings, 0 replies; 15+ messages in thread
From: Michael Ellerman @ 2008-04-23 5:43 UTC (permalink / raw)
To: benh; +Cc: linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 1279 bytes --]
On Fri, 2008-04-18 at 18:20 +1000, Benjamin Herrenschmidt wrote:
> On Fri, 2008-04-18 at 17:54 +1000, Michael Ellerman wrote:
> > In theory the udbg console should be safe to call basically at any time
> > after boot. It does not need any per-cpu resources or for the cpu to be
> > online, as long as there is a udbg_putc routine hooked up it should
> > work. So it should be able to be marked as CON_ANYTIME.
> >
> > Verifying this will take a bit of time and testing though, so instead of
> > marking udbg console as CON_ANYTIME for all platforms, add a routine so
> > that a platform can opt-in to having udbg console called early.
> >
> > Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
>
> Nah, just stick it always.
Meh, OK. I'm still going to require the platform code to call
register_early_udbg_console() if it wants to register earlier than
setup_system() - so the behaviour will essentially be the same.
NB that if it breaks anything I can now say BenH told me to do it ;)
cheers
--
Michael Ellerman
OzLabs, IBM Australia Development Lab
wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)
We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 03/11] Register udbg console early on pseries LPAR
2008-04-18 7:54 [PATCH 01/11] Set udbg_console index to 0 Michael Ellerman
2008-04-18 7:54 ` [PATCH 02/11] Add udbg_console_anytime() which sets udbg console to CON_ANYTIME Michael Ellerman
@ 2008-04-18 7:54 ` Michael Ellerman
2008-04-18 7:54 ` [PATCH 04/11] Convert from DBG() to pr_debug() in platforms/pseries/setup.c Michael Ellerman
` (7 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Michael Ellerman @ 2008-04-18 7:54 UTC (permalink / raw)
To: linuxppc-dev
On pseries LPAR we can call the udbg routines, and the udbg console very
early. So mark the udbg console as safe to call early in boot, and register
the udbg console as soon as the udbg routines are hooked up.
This allows platforms/pseries code to use printk() and pr_debug() rather
than needing to call udbg_printf() directly for early debugging. This is
nice because a) it's standard, b) it goes via the printk buffer, and c)
you can get printk time stamps.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
arch/powerpc/platforms/pseries/lpar.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index 9235c46..450c237 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -196,6 +196,9 @@ void __init udbg_init_debug_lpar(void)
udbg_putc = udbg_putcLP;
udbg_getc = udbg_getcLP;
udbg_getc_poll = udbg_getc_pollLP;
+
+ udbg_console_anytime();
+ register_early_udbg_console();
}
/* returns 0 if couldn't find or use /chosen/stdout as console */
--
1.5.5
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 04/11] Convert from DBG() to pr_debug() in platforms/pseries/setup.c
2008-04-18 7:54 [PATCH 01/11] Set udbg_console index to 0 Michael Ellerman
2008-04-18 7:54 ` [PATCH 02/11] Add udbg_console_anytime() which sets udbg console to CON_ANYTIME Michael Ellerman
2008-04-18 7:54 ` [PATCH 03/11] Register udbg console early on pseries LPAR Michael Ellerman
@ 2008-04-18 7:54 ` Michael Ellerman
2008-04-22 13:31 ` Olof Johansson
2008-04-18 7:54 ` [PATCH 05/11] Convert from DBG() to pr_debug() in platforms/pseries/smp.c Michael Ellerman
` (6 subsequent siblings)
9 siblings, 1 reply; 15+ messages in thread
From: Michael Ellerman @ 2008-04-18 7:54 UTC (permalink / raw)
To: linuxppc-dev
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
arch/powerpc/platforms/pseries/setup.c | 15 +++++----------
1 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index fccca89..5486bea 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -70,11 +70,6 @@
#include "plpar_wrappers.h"
#include "pseries.h"
-#ifdef DEBUG
-#define DBG(fmt...) udbg_printf(fmt)
-#else
-#define DBG(fmt...)
-#endif
int fwnmi_active; /* TRUE if an FWNMI handler is present */
@@ -310,7 +305,7 @@ static int pseries_set_xdabr(unsigned long dabr)
*/
static void __init pSeries_init_early(void)
{
- DBG(" -> pSeries_init_early()\n");
+ pr_debug(" -> pSeries_init_early()\n");
if (firmware_has_feature(FW_FEATURE_LPAR))
find_udbg_vterm();
@@ -322,7 +317,7 @@ static void __init pSeries_init_early(void)
iommu_init_early_pSeries();
- DBG(" <- pSeries_init_early()\n");
+ pr_debug(" <- pSeries_init_early()\n");
}
/*
@@ -367,7 +362,7 @@ static int __init pSeries_probe(void)
of_flat_dt_is_compatible(root, "IBM,CBEA"))
return 0;
- DBG("pSeries detected, looking for LPAR capability...\n");
+ pr_debug("pSeries detected, looking for LPAR capability...\n");
/* Now try to figure out if we are running on LPAR */
of_scan_flat_dt(pSeries_probe_hypertas, NULL);
@@ -377,8 +372,8 @@ static int __init pSeries_probe(void)
else
hpte_init_native();
- DBG("Machine is%s LPAR !\n",
- (powerpc_firmware_features & FW_FEATURE_LPAR) ? "" : " not");
+ pr_debug("Machine is%s LPAR !\n",
+ (powerpc_firmware_features & FW_FEATURE_LPAR) ? "" : " not");
return 1;
}
--
1.5.5
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 04/11] Convert from DBG() to pr_debug() in platforms/pseries/setup.c
2008-04-18 7:54 ` [PATCH 04/11] Convert from DBG() to pr_debug() in platforms/pseries/setup.c Michael Ellerman
@ 2008-04-22 13:31 ` Olof Johansson
2008-04-23 5:45 ` Michael Ellerman
0 siblings, 1 reply; 15+ messages in thread
From: Olof Johansson @ 2008-04-22 13:31 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev
On Fri, Apr 18, 2008 at 05:54:36PM +1000, Michael Ellerman wrote:
> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
I know it's fun to see yourself in the changeset statistics, but this is
silly. Please bake together all the simple changes to one patch instead
of one per file. They are all trivial.
-Olof
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 04/11] Convert from DBG() to pr_debug() in platforms/pseries/setup.c
2008-04-22 13:31 ` Olof Johansson
@ 2008-04-23 5:45 ` Michael Ellerman
0 siblings, 0 replies; 15+ messages in thread
From: Michael Ellerman @ 2008-04-23 5:45 UTC (permalink / raw)
To: Olof Johansson; +Cc: linuxppc-dev list
[-- Attachment #1: Type: text/plain, Size: 787 bytes --]
On Tue, 2008-04-22 at 08:31 -0500, Olof Johansson wrote:
> On Fri, Apr 18, 2008 at 05:54:36PM +1000, Michael Ellerman wrote:
> > Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
>
> I know it's fun to see yourself in the changeset statistics, but this is
> silly. Please bake together all the simple changes to one patch instead
> of one per file. They are all trivial.
Yeah that's totally what I was going for ...
Thanks for reading them at least, they're mostly trivial but many eyes
make light work.
cheers
--
Michael Ellerman
OzLabs, IBM Australia Development Lab
wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)
We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 05/11] Convert from DBG() to pr_debug() in platforms/pseries/smp.c
2008-04-18 7:54 [PATCH 01/11] Set udbg_console index to 0 Michael Ellerman
` (2 preceding siblings ...)
2008-04-18 7:54 ` [PATCH 04/11] Convert from DBG() to pr_debug() in platforms/pseries/setup.c Michael Ellerman
@ 2008-04-18 7:54 ` Michael Ellerman
2008-04-18 7:54 ` [PATCH 06/11] Convert from DBG() to pr_debug() in platforms/pseries/firmware.c Michael Ellerman
` (5 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Michael Ellerman @ 2008-04-18 7:54 UTC (permalink / raw)
To: linuxppc-dev
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
arch/powerpc/platforms/pseries/smp.c | 10 ++--------
1 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c
index ea4c659..e9bc2a5 100644
--- a/arch/powerpc/platforms/pseries/smp.c
+++ b/arch/powerpc/platforms/pseries/smp.c
@@ -51,12 +51,6 @@
#include "plpar_wrappers.h"
#include "pseries.h"
-#ifdef DEBUG
-#include <asm/udbg.h>
-#define DBG(fmt...) udbg_printf(fmt)
-#else
-#define DBG(fmt...)
-#endif
/*
* The primary thread of each non-boot processor is recorded here before
@@ -231,7 +225,7 @@ static void __init smp_init_pseries(void)
{
int i;
- DBG(" -> smp_init_pSeries()\n");
+ pr_debug(" -> smp_init_pSeries()\n");
/* Mark threads which are still spinning in hold loops. */
if (cpu_has_feature(CPU_FTR_SMT)) {
@@ -255,7 +249,7 @@ static void __init smp_init_pseries(void)
smp_ops->take_timebase = pSeries_take_timebase;
}
- DBG(" <- smp_init_pSeries()\n");
+ pr_debug(" <- smp_init_pSeries()\n");
}
#ifdef CONFIG_MPIC
--
1.5.5
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 06/11] Convert from DBG() to pr_debug() in platforms/pseries/firmware.c
2008-04-18 7:54 [PATCH 01/11] Set udbg_console index to 0 Michael Ellerman
` (3 preceding siblings ...)
2008-04-18 7:54 ` [PATCH 05/11] Convert from DBG() to pr_debug() in platforms/pseries/smp.c Michael Ellerman
@ 2008-04-18 7:54 ` Michael Ellerman
2008-04-18 7:54 ` [PATCH 07/11] Convert from DBG() to pr_debug() in platforms/pseries/iommu.c Michael Ellerman
` (4 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Michael Ellerman @ 2008-04-18 7:54 UTC (permalink / raw)
To: linuxppc-dev
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
arch/powerpc/platforms/pseries/firmware.c | 9 ++-------
1 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/firmware.c b/arch/powerpc/platforms/pseries/firmware.c
index b765b7c..743d494 100644
--- a/arch/powerpc/platforms/pseries/firmware.c
+++ b/arch/powerpc/platforms/pseries/firmware.c
@@ -27,11 +27,6 @@
#include <asm/prom.h>
#include <asm/udbg.h>
-#ifdef DEBUG
-#define DBG(fmt...) udbg_printf(fmt)
-#else
-#define DBG(fmt...)
-#endif
typedef struct {
unsigned long val;
@@ -72,7 +67,7 @@ void __init fw_feature_init(const char *hypertas, unsigned long len)
const char *s;
int i;
- DBG(" -> fw_feature_init()\n");
+ pr_debug(" -> fw_feature_init()\n");
for (s = hypertas; s < hypertas + len; s += strlen(s) + 1) {
for (i = 0; i < FIRMWARE_MAX_FEATURES; i++) {
@@ -88,5 +83,5 @@ void __init fw_feature_init(const char *hypertas, unsigned long len)
}
}
- DBG(" <- fw_feature_init()\n");
+ pr_debug(" <- fw_feature_init()\n");
}
--
1.5.5
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 07/11] Convert from DBG() to pr_debug() in platforms/pseries/iommu.c
2008-04-18 7:54 [PATCH 01/11] Set udbg_console index to 0 Michael Ellerman
` (4 preceding siblings ...)
2008-04-18 7:54 ` [PATCH 06/11] Convert from DBG() to pr_debug() in platforms/pseries/firmware.c Michael Ellerman
@ 2008-04-18 7:54 ` Michael Ellerman
2008-04-18 7:54 ` [PATCH 08/11] Convert from DBG() to pr_debug() in platforms/pseries/lpar.c Michael Ellerman
` (3 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Michael Ellerman @ 2008-04-18 7:54 UTC (permalink / raw)
To: linuxppc-dev
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
arch/powerpc/platforms/pseries/iommu.c | 39 +++++++++++++++----------------
1 files changed, 19 insertions(+), 20 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index a65c763..176f1f3 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -47,7 +47,6 @@
#include "plpar_wrappers.h"
-#define DBG(fmt...)
static void tce_build_pSeries(struct iommu_table *tbl, long index,
long npages, unsigned long uaddr,
@@ -322,7 +321,7 @@ static void pci_dma_bus_setup_pSeries(struct pci_bus *bus)
dn = pci_bus_to_OF_node(bus);
- DBG("pci_dma_bus_setup_pSeries: setting up bus %s\n", dn->full_name);
+ pr_debug("pci_dma_bus_setup_pSeries: setting up bus %s\n", dn->full_name);
if (bus->self) {
/* This is not a root bus, any setup will be done for the
@@ -347,7 +346,7 @@ static void pci_dma_bus_setup_pSeries(struct pci_bus *bus)
for (children = 0, tmp = dn->child; tmp; tmp = tmp->sibling)
children++;
- DBG("Children: %d\n", children);
+ pr_debug("Children: %d\n", children);
/* Calculate amount of DMA window per slot. Each window must be
* a power of two (due to pci_alloc_consistent requirements).
@@ -361,8 +360,8 @@ static void pci_dma_bus_setup_pSeries(struct pci_bus *bus)
while (pci->phb->dma_window_size * children > 0x80000000ul)
pci->phb->dma_window_size >>= 1;
- DBG("No ISA/IDE, window size is 0x%lx\n",
- pci->phb->dma_window_size);
+ pr_debug("No ISA/IDE, window size is 0x%lx\n",
+ pci->phb->dma_window_size);
pci->phb->dma_window_base_cur = 0;
return;
@@ -387,8 +386,7 @@ static void pci_dma_bus_setup_pSeries(struct pci_bus *bus)
while (pci->phb->dma_window_size * children > 0x70000000ul)
pci->phb->dma_window_size >>= 1;
- DBG("ISA/IDE, window size is 0x%lx\n", pci->phb->dma_window_size);
-
+ pr_debug("ISA/IDE, window size is 0x%lx\n", pci->phb->dma_window_size);
}
@@ -401,7 +399,8 @@ static void pci_dma_bus_setup_pSeriesLP(struct pci_bus *bus)
dn = pci_bus_to_OF_node(bus);
- DBG("pci_dma_bus_setup_pSeriesLP: setting up bus %s\n", dn->full_name);
+ pr_debug("pci_dma_bus_setup_pSeriesLP: setting up bus %s\n",
+ dn->full_name);
/* Find nearest ibm,dma-window, walking up the device tree */
for (pdn = dn; pdn != NULL; pdn = pdn->parent) {
@@ -411,14 +410,14 @@ static void pci_dma_bus_setup_pSeriesLP(struct pci_bus *bus)
}
if (dma_window == NULL) {
- DBG(" no ibm,dma-window property !\n");
+ pr_debug(" no ibm,dma-window property !\n");
return;
}
ppci = PCI_DN(pdn);
- DBG(" parent is %s, iommu_table: 0x%p\n",
- pdn->full_name, ppci->iommu_table);
+ pr_debug(" parent is %s, iommu_table: 0x%p\n",
+ pdn->full_name, ppci->iommu_table);
if (!ppci->iommu_table) {
tbl = kmalloc_node(sizeof(struct iommu_table), GFP_KERNEL,
@@ -426,7 +425,7 @@ static void pci_dma_bus_setup_pSeriesLP(struct pci_bus *bus)
iommu_table_setparms_lpar(ppci->phb, pdn, tbl, dma_window,
bus->number);
ppci->iommu_table = iommu_init_table(tbl, ppci->phb->node);
- DBG(" created table: %p\n", ppci->iommu_table);
+ pr_debug(" created table: %p\n", ppci->iommu_table);
}
if (pdn != dn)
@@ -439,7 +438,7 @@ static void pci_dma_dev_setup_pSeries(struct pci_dev *dev)
struct device_node *dn;
struct iommu_table *tbl;
- DBG("pci_dma_dev_setup_pSeries: %s\n", pci_name(dev));
+ pr_debug("pci_dma_dev_setup_pSeries: %s\n", pci_name(dev));
dn = dev->dev.archdata.of_node;
@@ -450,7 +449,7 @@ static void pci_dma_dev_setup_pSeries(struct pci_dev *dev)
if (!dev->bus->self) {
struct pci_controller *phb = PCI_DN(dn)->phb;
- DBG(" --> first child, no bridge. Allocating iommu table.\n");
+ pr_debug(" --> first child, no bridge. Allocating iommu table.\n");
tbl = kmalloc_node(sizeof(struct iommu_table), GFP_KERNEL,
phb->node);
iommu_table_setparms(phb, dn, tbl);
@@ -480,7 +479,7 @@ static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev)
const void *dma_window = NULL;
struct pci_dn *pci;
- DBG("pci_dma_dev_setup_pSeriesLP: %s\n", pci_name(dev));
+ pr_debug("pci_dma_dev_setup_pSeriesLP: %s\n", pci_name(dev));
/* dev setup for LPAR is a little tricky, since the device tree might
* contain the dma-window properties per-device and not neccesarily
@@ -489,7 +488,7 @@ static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev)
* already allocated.
*/
dn = pci_device_to_OF_node(dev);
- DBG(" node is %s\n", dn->full_name);
+ pr_debug(" node is %s\n", dn->full_name);
for (pdn = dn; pdn && PCI_DN(pdn) && !PCI_DN(pdn)->iommu_table;
pdn = pdn->parent) {
@@ -504,13 +503,13 @@ static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev)
pci_name(dev), dn? dn->full_name : "<null>");
return;
}
- DBG(" parent is %s\n", pdn->full_name);
+ pr_debug(" parent is %s\n", pdn->full_name);
/* Check for parent == NULL so we don't try to setup the empty EADS
* slots on POWER4 machines.
*/
if (dma_window == NULL || pdn->parent == NULL) {
- DBG(" no dma window for device, linking to parent\n");
+ pr_debug(" no dma window for device, linking to parent\n");
dev->dev.archdata.dma_data = PCI_DN(pdn)->iommu_table;
return;
}
@@ -522,9 +521,9 @@ static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev)
iommu_table_setparms_lpar(pci->phb, pdn, tbl, dma_window,
pci->phb->bus->number);
pci->iommu_table = iommu_init_table(tbl, pci->phb->node);
- DBG(" created table: %p\n", pci->iommu_table);
+ pr_debug(" created table: %p\n", pci->iommu_table);
} else {
- DBG(" found DMA window, table: %p\n", pci->iommu_table);
+ pr_debug(" found DMA window, table: %p\n", pci->iommu_table);
}
dev->dev.archdata.dma_data = pci->iommu_table;
--
1.5.5
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 08/11] Convert from DBG() to pr_debug() in platforms/pseries/lpar.c
2008-04-18 7:54 [PATCH 01/11] Set udbg_console index to 0 Michael Ellerman
` (5 preceding siblings ...)
2008-04-18 7:54 ` [PATCH 07/11] Convert from DBG() to pr_debug() in platforms/pseries/iommu.c Michael Ellerman
@ 2008-04-18 7:54 ` Michael Ellerman
2008-04-18 7:54 ` [PATCH 09/11] Convert from DEBUG() to pr_debug() in platforms/pseries/rtasd.c Michael Ellerman
` (2 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Michael Ellerman @ 2008-04-18 7:54 UTC (permalink / raw)
To: linuxppc-dev
While we're there, fix some printf specifier mismatches, and add a
newline to one printk.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
arch/powerpc/platforms/pseries/lpar.c | 34 ++++++++++++++------------------
1 files changed, 15 insertions(+), 19 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index 450c237..0ce8c85 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -19,7 +19,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#undef DEBUG_LOW
+/* Enables debugging of low-level hash table routines - careful! */
+#undef DEBUG
#include <linux/kernel.h>
#include <linux/dma-mapping.h>
@@ -42,11 +43,6 @@
#include "plpar_wrappers.h"
#include "pseries.h"
-#ifdef DEBUG_LOW
-#define DBG_LOW(fmt...) do { udbg_printf(fmt); } while(0)
-#else
-#define DBG_LOW(fmt...) do { } while(0)
-#endif
/* in hvCall.S */
EXPORT_SYMBOL(plpar_hcall);
@@ -291,15 +287,15 @@ static long pSeries_lpar_hpte_insert(unsigned long hpte_group,
unsigned long hpte_v, hpte_r;
if (!(vflags & HPTE_V_BOLTED))
- DBG_LOW("hpte_insert(group=%lx, va=%016lx, pa=%016lx, "
- "rflags=%lx, vflags=%lx, psize=%d)\n",
- hpte_group, va, pa, rflags, vflags, psize);
+ pr_debug("hpte_insert(group=%lx, va=%016lx, pa=%016lx, "
+ "rflags=%lx, vflags=%lx, psize=%d)\n",
+ hpte_group, va, pa, rflags, vflags, psize);
hpte_v = hpte_encode_v(va, psize, ssize) | vflags | HPTE_V_VALID;
hpte_r = hpte_encode_r(pa, psize) | rflags;
if (!(vflags & HPTE_V_BOLTED))
- DBG_LOW(" hpte_v=%016lx, hpte_r=%016lx\n", hpte_v, hpte_r);
+ pr_debug(" hpte_v=%016lx, hpte_r=%016lx\n", hpte_v, hpte_r);
/* Now fill in the actual HPTE */
/* Set CEC cookie to 0 */
@@ -316,7 +312,7 @@ static long pSeries_lpar_hpte_insert(unsigned long hpte_group,
lpar_rc = plpar_pte_enter(flags, hpte_group, hpte_v, hpte_r, &slot);
if (unlikely(lpar_rc == H_PTEG_FULL)) {
if (!(vflags & HPTE_V_BOLTED))
- DBG_LOW(" full\n");
+ pr_debug(" full\n");
return -1;
}
@@ -327,11 +323,11 @@ static long pSeries_lpar_hpte_insert(unsigned long hpte_group,
*/
if (unlikely(lpar_rc != H_SUCCESS)) {
if (!(vflags & HPTE_V_BOLTED))
- DBG_LOW(" lpar err %d\n", lpar_rc);
+ pr_debug(" lpar err %lu\n", lpar_rc);
return -2;
}
if (!(vflags & HPTE_V_BOLTED))
- DBG_LOW(" -> slot: %d\n", slot & 7);
+ pr_debug(" -> slot: %lu\n", slot & 7);
/* Because of iSeries, we have to pass down the secondary
* bucket bit here as well
@@ -423,17 +419,17 @@ static long pSeries_lpar_hpte_updatepp(unsigned long slot,
want_v = hpte_encode_avpn(va, psize, ssize);
- DBG_LOW(" update: avpnv=%016lx, hash=%016lx, f=%x, psize: %d ... ",
- want_v, slot, flags, psize);
+ pr_debug(" update: avpnv=%016lx, hash=%016lx, f=%lx, psize: %d ...",
+ want_v, slot, flags, psize);
lpar_rc = plpar_pte_protect(flags, slot, want_v);
if (lpar_rc == H_NOT_FOUND) {
- DBG_LOW("not found !\n");
+ pr_debug("not found !\n");
return -1;
}
- DBG_LOW("ok\n");
+ pr_debug("ok\n");
BUG_ON(lpar_rc != H_SUCCESS);
@@ -508,8 +504,8 @@ static void pSeries_lpar_hpte_invalidate(unsigned long slot, unsigned long va,
unsigned long lpar_rc;
unsigned long dummy1, dummy2;
- DBG_LOW(" inval : slot=%lx, va=%016lx, psize: %d, local: %d",
- slot, va, psize, local);
+ pr_debug(" inval : slot=%lx, va=%016lx, psize: %d, local: %d\n",
+ slot, va, psize, local);
want_v = hpte_encode_avpn(va, psize, ssize);
lpar_rc = plpar_pte_remove(H_AVPN, slot, want_v, &dummy1, &dummy2);
--
1.5.5
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 09/11] Convert from DEBUG() to pr_debug() in platforms/pseries/rtasd.c
2008-04-18 7:54 [PATCH 01/11] Set udbg_console index to 0 Michael Ellerman
` (6 preceding siblings ...)
2008-04-18 7:54 ` [PATCH 08/11] Convert from DBG() to pr_debug() in platforms/pseries/lpar.c Michael Ellerman
@ 2008-04-18 7:54 ` Michael Ellerman
2008-04-18 7:54 ` [PATCH 10/11] Convert from DEBUG() to pr_debug() in platforms/pseries/scanlog.c Michael Ellerman
2008-04-18 7:54 ` [PATCH 11/11] Add CONFIG_PPC_PSERIES_DEBUG to enable debugging for platforms/pseries Michael Ellerman
9 siblings, 0 replies; 15+ messages in thread
From: Michael Ellerman @ 2008-04-18 7:54 UTC (permalink / raw)
To: linuxppc-dev
Add "rtasd" to some messages to make it clear where they're coming from.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
arch/powerpc/platforms/pseries/rtasd.c | 14 +++++---------
1 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/rtasd.c b/arch/powerpc/platforms/pseries/rtasd.c
index e3078ce..befadd4 100644
--- a/arch/powerpc/platforms/pseries/rtasd.c
+++ b/arch/powerpc/platforms/pseries/rtasd.c
@@ -29,11 +29,6 @@
#include <asm/atomic.h>
#include <asm/machdep.h>
-#if 0
-#define DEBUG(A...) printk(KERN_ERR A)
-#else
-#define DEBUG(A...)
-#endif
static DEFINE_SPINLOCK(rtasd_log_lock);
@@ -198,7 +193,7 @@ void pSeries_log_error(char *buf, unsigned int err_type, int fatal)
unsigned long s;
int len = 0;
- DEBUG("logging event\n");
+ pr_debug("rtasd: logging event\n");
if (buf == NULL)
return;
@@ -409,7 +404,8 @@ static int rtasd(void *unused)
daemonize("rtasd");
printk(KERN_DEBUG "RTAS daemon started\n");
- DEBUG("will sleep for %d milliseconds\n", (30000/rtas_event_scan_rate));
+ pr_debug("rtasd: will sleep for %d milliseconds\n",
+ (30000 / rtas_event_scan_rate));
/* See if we have any error stored in NVRAM */
memset(logdata, 0, rtas_error_log_max);
@@ -428,9 +424,9 @@ static int rtasd(void *unused)
do_event_scan_all_cpus(1000);
if (surveillance_timeout != -1) {
- DEBUG("enabling surveillance\n");
+ pr_debug("rtasd: enabling surveillance\n");
enable_surveillance(surveillance_timeout);
- DEBUG("surveillance enabled\n");
+ pr_debug("rtasd: surveillance enabled\n");
}
/* Delay should be at least one second since some
--
1.5.5
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 10/11] Convert from DEBUG() to pr_debug() in platforms/pseries/scanlog.c
2008-04-18 7:54 [PATCH 01/11] Set udbg_console index to 0 Michael Ellerman
` (7 preceding siblings ...)
2008-04-18 7:54 ` [PATCH 09/11] Convert from DEBUG() to pr_debug() in platforms/pseries/rtasd.c Michael Ellerman
@ 2008-04-18 7:54 ` Michael Ellerman
2008-04-18 7:54 ` [PATCH 11/11] Add CONFIG_PPC_PSERIES_DEBUG to enable debugging for platforms/pseries Michael Ellerman
9 siblings, 0 replies; 15+ messages in thread
From: Michael Ellerman @ 2008-04-18 7:54 UTC (permalink / raw)
To: linuxppc-dev
While we're at it, remove the hand-rolled runtime debugging support
in there. This file has been largely unchanged for eons, if we need to
debug it in future we can recompile.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
arch/powerpc/platforms/pseries/scanlog.c | 23 ++++++++---------------
1 files changed, 8 insertions(+), 15 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/scanlog.c b/arch/powerpc/platforms/pseries/scanlog.c
index e5b0ea8..bec3803 100644
--- a/arch/powerpc/platforms/pseries/scanlog.c
+++ b/arch/powerpc/platforms/pseries/scanlog.c
@@ -38,9 +38,7 @@
#define SCANLOG_HWERROR -1
#define SCANLOG_CONTINUE 1
-#define DEBUG(A...) do { if (scanlog_debug) printk(KERN_ERR "scanlog: " A); } while (0)
-static int scanlog_debug;
static unsigned int ibm_scan_log_dump; /* RTAS token */
static struct proc_dir_entry *proc_ppc64_scan_log_dump; /* The proc file */
@@ -86,14 +84,14 @@ static ssize_t scanlog_read(struct file *file, char __user *buf,
memcpy(data, rtas_data_buf, RTAS_DATA_BUF_SIZE);
spin_unlock(&rtas_data_buf_lock);
- DEBUG("status=%d, data[0]=%x, data[1]=%x, data[2]=%x\n",
- status, data[0], data[1], data[2]);
+ pr_debug("scanlog: status=%d, data[0]=%x, data[1]=%x, " \
+ "data[2]=%x\n", status, data[0], data[1], data[2]);
switch (status) {
case SCANLOG_COMPLETE:
- DEBUG("hit eof\n");
+ pr_debug("scanlog: hit eof\n");
return 0;
case SCANLOG_HWERROR:
- DEBUG("hardware error reading scan log data\n");
+ pr_debug("scanlog: hardware error reading data\n");
return -EIO;
case SCANLOG_CONTINUE:
/* We may or may not have data yet */
@@ -110,7 +108,8 @@ static ssize_t scanlog_read(struct file *file, char __user *buf,
/* Assume extended busy */
wait_time = rtas_busy_delay_time(status);
if (!wait_time) {
- printk(KERN_ERR "scanlog: unknown error from rtas: %d\n", status);
+ printk(KERN_ERR "scanlog: unknown error " \
+ "from rtas: %d\n", status);
return -EIO;
}
}
@@ -134,15 +133,9 @@ static ssize_t scanlog_write(struct file * file, const char __user * buf,
if (buf) {
if (strncmp(stkbuf, "reset", 5) == 0) {
- DEBUG("reset scanlog\n");
+ pr_debug("scanlog: reset scanlog\n");
status = rtas_call(ibm_scan_log_dump, 2, 1, NULL, 0, 0);
- DEBUG("rtas returns %d\n", status);
- } else if (strncmp(stkbuf, "debugon", 7) == 0) {
- printk(KERN_ERR "scanlog: debug on\n");
- scanlog_debug = 1;
- } else if (strncmp(stkbuf, "debugoff", 8) == 0) {
- printk(KERN_ERR "scanlog: debug off\n");
- scanlog_debug = 0;
+ pr_debug("scanlog: rtas returns %d\n", status);
}
}
return count;
--
1.5.5
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 11/11] Add CONFIG_PPC_PSERIES_DEBUG to enable debugging for platforms/pseries
2008-04-18 7:54 [PATCH 01/11] Set udbg_console index to 0 Michael Ellerman
` (8 preceding siblings ...)
2008-04-18 7:54 ` [PATCH 10/11] Convert from DEBUG() to pr_debug() in platforms/pseries/scanlog.c Michael Ellerman
@ 2008-04-18 7:54 ` Michael Ellerman
9 siblings, 0 replies; 15+ messages in thread
From: Michael Ellerman @ 2008-04-18 7:54 UTC (permalink / raw)
To: linuxppc-dev
Add a DEBUG config setting which turns on all (most) of the debugging
under platforms/pseries.
To have this take effect we need to remove all the #undef DEBUG's, in
various files. We leave the #undef DEBUG in platforms/pseries/lpar.c,
as this enables debugging printks from the low-level hash table routines,
and tends to make your system unusable. If you want those enabled you
still have to turn them on by hand.
Also some of the RAS code has a DEBUG block which causes a functional
change, so I've keyed this off a different (non-existant) debug #define.
This is only enabled if you have PPC_EARLY_DEBUG enabled also.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
arch/powerpc/platforms/pseries/Kconfig | 5 +++++
arch/powerpc/platforms/pseries/Makefile | 4 ++++
arch/powerpc/platforms/pseries/eeh.c | 1 -
arch/powerpc/platforms/pseries/eeh_cache.c | 1 -
arch/powerpc/platforms/pseries/firmware.c | 1 -
arch/powerpc/platforms/pseries/ras.c | 4 +---
arch/powerpc/platforms/pseries/setup.c | 2 --
arch/powerpc/platforms/pseries/smp.c | 1 -
arch/powerpc/platforms/pseries/xics.c | 1 -
9 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig
index 306a9d0..07fe5b6 100644
--- a/arch/powerpc/platforms/pseries/Kconfig
+++ b/arch/powerpc/platforms/pseries/Kconfig
@@ -34,3 +34,8 @@ config LPARCFG
help
Provide system capacity information via human readable
<key word>=<value> pairs through a /proc/ppc64/lparcfg interface.
+
+config PPC_PSERIES_DEBUG
+ depends on PPC_PSERIES && PPC_EARLY_DEBUG
+ bool "Enable extra debug logging in platforms/pseries"
+ default y
diff --git a/arch/powerpc/platforms/pseries/Makefile b/arch/powerpc/platforms/pseries/Makefile
index bdae04b..bd2593e 100644
--- a/arch/powerpc/platforms/pseries/Makefile
+++ b/arch/powerpc/platforms/pseries/Makefile
@@ -2,6 +2,10 @@ ifeq ($(CONFIG_PPC64),y)
EXTRA_CFLAGS += -mno-minimal-toc
endif
+ifeq ($(CONFIG_PPC_PSERIES_DEBUG),y)
+EXTRA_CFLAGS += -DDEBUG
+endif
+
obj-y := lpar.o hvCall.o nvram.o reconfig.o \
setup.o iommu.o ras.o rtasd.o \
firmware.o power.o
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c
index 550b2f7..a3fd56b 100644
--- a/arch/powerpc/platforms/pseries/eeh.c
+++ b/arch/powerpc/platforms/pseries/eeh.c
@@ -39,7 +39,6 @@
#include <asm/ppc-pci.h>
#include <asm/rtas.h>
-#undef DEBUG
/** Overview:
* EEH, or "Extended Error Handling" is a PCI bridge technology for
diff --git a/arch/powerpc/platforms/pseries/eeh_cache.c b/arch/powerpc/platforms/pseries/eeh_cache.c
index 1e83fcd..ce37040 100644
--- a/arch/powerpc/platforms/pseries/eeh_cache.c
+++ b/arch/powerpc/platforms/pseries/eeh_cache.c
@@ -28,7 +28,6 @@
#include <asm/pci-bridge.h>
#include <asm/ppc-pci.h>
-#undef DEBUG
/**
* The pci address cache subsystem. This subsystem places
diff --git a/arch/powerpc/platforms/pseries/firmware.c b/arch/powerpc/platforms/pseries/firmware.c
index 743d494..9d3a40f 100644
--- a/arch/powerpc/platforms/pseries/firmware.c
+++ b/arch/powerpc/platforms/pseries/firmware.c
@@ -21,7 +21,6 @@
* 2 of the License, or (at your option) any later version.
*/
-#undef DEBUG
#include <asm/firmware.h>
#include <asm/prom.h>
diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c
index a1ab25c..2b548af 100644
--- a/arch/powerpc/platforms/pseries/ras.c
+++ b/arch/powerpc/platforms/pseries/ras.c
@@ -67,8 +67,6 @@ static int ras_check_exception_token;
static irqreturn_t ras_epow_interrupt(int irq, void *dev_id);
static irqreturn_t ras_error_interrupt(int irq, void *dev_id);
-/* #define DEBUG */
-
static void request_ras_irqs(struct device_node *np,
irq_handler_t handler,
@@ -237,7 +235,7 @@ static irqreturn_t ras_error_interrupt(int irq, void *dev_id)
printk(KERN_EMERG "Error: Fatal hardware error <0x%lx 0x%x>\n",
*((unsigned long *)&ras_log_buf), status);
-#ifndef DEBUG
+#ifndef DEBUG_RTAS_POWER_OFF
/* Don't actually power off when debugging so we can test
* without actually failing while injecting errors.
* Error data will not be logged to syslog.
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 5486bea..efc8df4 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -16,8 +16,6 @@
* bootup setup stuff..
*/
-#undef DEBUG
-
#include <linux/cpu.h>
#include <linux/errno.h>
#include <linux/sched.h>
diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c
index e9bc2a5..9d8f8c8 100644
--- a/arch/powerpc/platforms/pseries/smp.c
+++ b/arch/powerpc/platforms/pseries/smp.c
@@ -12,7 +12,6 @@
* 2 of the License, or (at your option) any later version.
*/
-#undef DEBUG
#include <linux/kernel.h>
#include <linux/module.h>
diff --git a/arch/powerpc/platforms/pseries/xics.c b/arch/powerpc/platforms/pseries/xics.c
index a977f20..738f005 100644
--- a/arch/powerpc/platforms/pseries/xics.c
+++ b/arch/powerpc/platforms/pseries/xics.c
@@ -9,7 +9,6 @@
* 2 of the License, or (at your option) any later version.
*/
-#undef DEBUG
#include <linux/types.h>
#include <linux/threads.h>
--
1.5.5
^ permalink raw reply related [flat|nested] 15+ messages in thread