powerpc/powernv: report error messages from opal
RFC PATCH 1/1 powerpc/powernv: report error messages from opal
In reply to a message not in the archiveRecent versions of skiboot will raise an OPAL event (read: interrupt) when firmware writes an error message to its internal console. In conjunction they provide an OPAL call that the kernel can use to extract these messages from the OPAL log to allow them to be written into the kernel's log buffer where someone will (hopefully) look at them.
For the companion skiboot patches see:
https://lists.ozlabs.org/pipermail/skiboot/2016-December/005861.html
--- arch/powerpc/include/asm/opal-api.h | 5 +++- arch/powerpc/include/asm/opal.h | 1 + arch/powerpc/platforms/powernv/opal-msglog.c | 41 ++++++++++++++++++++++++++ arch/powerpc/platforms/powernv/opal-wrappers.S | 1 + 4 files changed, 47 insertions(+), 1 deletion(-)
arch/powerpc/include/asm/opal-api.h +4 -1
@@ -167,7 +167,8 @@#define OPAL_INT_EOI 124#define OPAL_INT_SET_MFRR 125#define OPAL_PCI_TCE_KILL 126 -#define OPAL_LAST 126 +#define OPAL_SCRAPE_LOG 128 +#define OPAL_LAST 128/* Device tree flags */
@@ -288,6 +289,7 @@ enum OpalPendingState {OPAL_EVENT_PCI_ERROR =0x200 ,OPAL_EVENT_DUMP_AVAIL =0x400 ,OPAL_EVENT_MSG_PENDING =0x800 , + OPAL_EVENT_LOG_PENDING = 0x1000, }; enum OpalThreadStatus {
@@ -406,6 +408,7 @@ enum opal_msg_type {OPAL_MSG_DPO =5 ,OPAL_MSG_PRD =6 ,OPAL_MSG_OCC =7 , +OPAL_MSG_LOG =8 , OPAL_MSG_TYPE_MAX, };
arch/powerpc/include/asm/opal.h +1 -0
@@ -232,6 +232,7 @@ int64_t opal_pci_tce_kill(uint64_t phb_id, uint32_t kill_type,int64_t opal_rm_pci_tce_kill (uint64_t phb_id,uint32_t kill_type,uint32_t pe_num,uint32_t tce_size,uint64_t dma_addr,uint32_t npages); +int64_t opal_scrape_log (int64_t *offset,char *buf,int64_t len,int64_t *lvl);/* Internal functions */ extern int early_init_dt_scan_opal(unsigned long node, const char *uname,
arch/powerpc/platforms/powernv/opal-msglog.c +41 -0
61 lines not on this page · raw message
arch/powerpc/platforms/powernv/opal-wrappers.S +1 -0
@@ -312,3 +312,4 @@ OPAL_CALL(opal_int_set_mfrr, OPAL_INT_SET_MFRR); OPAL_CALL_REAL(opal_rm_int_set_mfrr, OPAL_INT_SET_MFRR); OPAL_CALL(opal_pci_tce_kill, OPAL_PCI_TCE_KILL); OPAL_CALL_REAL(opal_rm_pci_tce_kill, OPAL_PCI_TCE_KILL); +OPAL_CALL(opal_scrape_log, OPAL_SCRAPE_LOG);
Signature · 1 line
2.7.4
Quoted 23 lines · Oliver O'Halloran
Recent versions of skiboot will raise an OPAL event (read: interrupt) when firmware writes an error message to its internal console. In conjunction they provide an OPAL call that the kernel can use to extract these messages from the OPAL log to allow them to be written into the kernel's log buffer where someone will (hopefully) look at them.
For the companion skiboot patches see:
https://lists.ozlabs.org/pipermail/skiboot/2016-December/005861.htmlSigned-off-by Oliver O'Halloran <[email protected]>--- arch/powerpc/include/asm/opal-api.h | 5 +++- arch/powerpc/include/asm/opal.h | 1 + arch/powerpc/platforms/powernv/opal-msglog.c | 41 ++++++++++++++++++++++++++ arch/powerpc/platforms/powernv/opal-wrappers.S | 1 + 4 files changed, 47 insertions(+), 1 deletion(-)arch/powerpc/include/asm/opal-api.h +0
-0
arch/powerpc/include/asm/opal-api.h line 170
Quoted 5 lines
arch/powerpc/include/asm/opal-api.h +1
-1@@ -167,7 +167,8 @@#define OPAL_INT_EOI 124#define OPAL_INT_SET_MFRR 125#define OPAL_PCI_TCE_KILL 126 -#define OPAL_LAST 126 +#define OPAL_SCRAPE_LOG 128
(another thought, along with the skiboot thoughts), I don't like the SCRAPE_LOG name so much, as it's more of a "hey linux, here's some log messages from firmware, possibly before you were involved"... OPAL_FETCH_LOG ?
Signature · 2 lines
Stewart Smith OPAL Architect, IBM.
Michael Ellerman
reviewerQuoted 16 lines · Stewart Smith
arch/powerpc/include/asm/opal-api.h line 170
Quoted 10 lines · Oliver O'Halloran
arch/powerpc/include/asm/opal-api.h +1
-1@@ -167,7 +167,8 @@#define OPAL_INT_EOI 124#define OPAL_INT_SET_MFRR 125#define OPAL_PCI_TCE_KILL 126 -#define OPAL_LAST 126 +#define OPAL_SCRAPE_LOG 128(another thought, along with the skiboot thoughts), I don't like the
SCRAPE_LOGname so much, as it's more of a "hey linux, here's some log messages from firmware, possibly before you were involved"...OPAL_FETCH_LOG?
I'm not a huge fan of an interrupt followed by an opal call just to fetch a single line of log.
Can't we do something more like the existing msglog code, where we have a ring buffer and then the interrupt just becomes "hey Linux you should look at your ring buffer".
cheers
Quoted 18 lines · Michael Ellerman
Quoted 16 lines · Stewart Smith
arch/powerpc/include/asm/opal-api.h line 170
Quoted 10 lines · Oliver O'Halloran
arch/powerpc/include/asm/opal-api.h +1
-1@@ -167,7 +167,8 @@#define OPAL_INT_EOI 124#define OPAL_INT_SET_MFRR 125#define OPAL_PCI_TCE_KILL 126 -#define OPAL_LAST 126 +#define OPAL_SCRAPE_LOG 128(another thought, along with the skiboot thoughts), I don't like the
SCRAPE_LOGname so much, as it's more of a "hey linux, here's some log messages from firmware, possibly before you were involved"...OPAL_FETCH_LOG?
Quoted 6 lines
I'm not a huge fan of an interrupt followed by an opal call just to fetch a single line of log.
Can't we do something more like the existing msglog code, where we have a ring buffer and then the interrupt just becomes "hey Linux you should look at your ring buffer".
Yeah... that would probably be a bit better...
Although that would mean we can only ever tell the running kernel what's in the ring buffer. We couldn't work out a way to (after kexec) resend important bits of info such as "we garded things out, your OCC didn't start and we trained everything at really slow speeds"
Signature · 2 lines
Stewart Smith OPAL Architect, IBM.
Quoted 18 lines · Michael Ellerman
Quoted 16 lines · Stewart Smith
arch/powerpc/include/asm/opal-api.h line 170
Quoted 10 lines · Oliver O'Halloran
arch/powerpc/include/asm/opal-api.h +1
-1@@ -167,7 +167,8 @@#define OPAL_INT_EOI 124#define OPAL_INT_SET_MFRR 125#define OPAL_PCI_TCE_KILL 126 -#define OPAL_LAST 126 +#define OPAL_SCRAPE_LOG 128(another thought, along with the skiboot thoughts), I don't like the
SCRAPE_LOGname so much, as it's more of a "hey linux, here's some log messages from firmware, possibly before you were involved"...OPAL_FETCH_LOG?
Quoted 6 lines
I'm not a huge fan of an interrupt followed by an opal call just to fetch a single line of log.
Can't we do something more like the existing msglog code, where we have a ring buffer and then the interrupt just becomes "hey Linux you should look at your ring buffer".
eh... personally I don't see the overhead of the OPAL call as being important. OPAL errors are infrequent and there's no need to make fetching OPAL errors fast.
I think we have a bit of a recurring problem where we make random Skiboot implementation details into part of the OPAL ABI. There is *no* reason the kernel should care about the skiboot log format so I'd rather we just kept the details of parsing it inside of Skiboot. I'm open to suggestions of how to improve the interface, but I think we should keep it.
oliver
Quoted 26 lines · Stewart Smith
Quoted 18 lines · Michael Ellerman
Quoted 16 lines · Stewart Smith
arch/powerpc/include/asm/opal-api.h line 170
Quoted 10 lines · Oliver O'Halloran
arch/powerpc/include/asm/opal-api.h +1
-1@@ -167,7 +167,8 @@#define OPAL_INT_EOI 124#define OPAL_INT_SET_MFRR 125#define OPAL_PCI_TCE_KILL 126 -#define OPAL_LAST 126 +#define OPAL_SCRAPE_LOG 128(another thought, along with the skiboot thoughts), I don't like the
SCRAPE_LOGname so much, as it's more of a "hey linux, here's some log messages from firmware, possibly before you were involved"...OPAL_FETCH_LOG?Quoted 6 lines
I'm not a huge fan of an interrupt followed by an opal call just to fetch a single line of log.
Can't we do something more like the existing msglog code, where we have a ring buffer and then the interrupt just becomes "hey Linux you should look at your ring buffer".
Quoted 6 lines
Yeah... that would probably be a bit better...
Although that would mean we can only ever tell the running kernel what's in the ring buffer. We couldn't work out a way to (after kexec) resend important bits of info such as "we garded things out, your OCC didn't start and we trained everything at really slow speeds"
Isn't this is the use case for BMC based error logs? A ring buffer is fundamentally a structure for transient data. There's no real way to hack in permanence other than making sure that making sure it never fills.