powerpc/powernv: Error logging interfaces
v5 cover powerpc/powernv: Error logging interfaces
This patch series defines generic interfaces for error logging to push down critical errors from powernv platform to FSP.
Also, it contains few minor fixes for the exisiting error logging framework that retrieves error logs from FSP.
Changes from V4:
* Reverted OPAL token for ELOG_OPAL_SEND to 92
* Use __pa() to obtain the physical address of the error log buffer.
Changes from V3:
* Change memory allocation to GFP_ATOMIC, to generate errors in bad context
* Move all error log generation related code to arch/powernv rename it from opal_* to pnv_* .
Changes from V2:
* Review comments from V2 have been addressed
includes comment formats, changing naming
conventions and incorporated error handling
of the buffers.
* Minor typo fix and use of pr_err/pr_fmt to
log errors.
Deepthi Dharwar (3):
powernv: Push critical error logs to FSP
powernv: Correct spell error in opal-elog.c
powernv: Have uniform logging of errors in opal-elog.c
arch/powerpc/include/asm/opal.h | 36 +++++++++ arch/powerpc/platforms/powernv/opal-elog.c | 92 +++++++++++++++++++++--- arch/powerpc/platforms/powernv/opal-wrappers.S | 1 arch/powerpc/platforms/powernv/powernv.h | 84 ++++++++++++++++++++++ 4 files changed, 203 insertions(+), 10 deletions(-)
-- Deepthi
PATCH v5 1/3 powernv: Push critical error logs to FSP
This patch provides error logging interfaces to report critical powernv error logs to FSP.
All the required information to dump the error is collected at POWERNV level through error log interfaces
and then pushed on to FSP.
--- arch/powerpc/include/asm/opal.h | 36 ++++++++++ arch/powerpc/platforms/powernv/opal-elog.c | 76 +++++++++++++++++++++- arch/powerpc/platforms/powernv/opal-wrappers.S | 1 arch/powerpc/platforms/powernv/powernv.h | 84 ++++++++++++++++++++++++ 4 files changed, 196 insertions(+), 1 deletion(-)
arch/powerpc/include/asm/opal.h +36 -0
@@ -174,6 +174,7 @@ extern int opal_enter_rtas(struct rtas_args *args,#define OPAL_GET_PARAM 89#define OPAL_SET_PARAM 90#define OPAL_DUMP_RESEND 91 +#define OPAL_ELOG_SEND 92#ifndef __ASSEMBLY__
@@ -268,6 +269,40 @@ enum OpalMessageType { OPAL_MSG_TYPE_MAX, }; +/* Max user dump size is 14K */ +#define OPAL_LOG_MAX_DUMP 14336 + +/* Multiple user data sections */ +struct __attribute__((__packed__ ))opal_user_data_section { +uint32_t tag; +uint16_t size; +uint16_t component_id; +char data_dump[1 ]; +}; + +/* +* All the information regarding an error/event to be reported +* needs to populate this structure using pre-defined interfaces +* only +*/ +struct __attribute__((__packed__ ))opal_errorlog { + +uint16_t component_id; +uint8_t error_event_type; +uint8_t subsystem_id; + +uint8_t event_severity; +uint8_t event_subtype; +uint8_t user_section_count; +uint8_t elog_origin; + +uint32_t user_section_size; +uint32_t reason_code; +uint32_t additional_info[4 ]; + +char user_data_dump[OPAL_LOG_MAX_DUMP ]; +}; +/* Machine check related definitions */ enum OpalMCE_Version { OpalMCE_V1 =1 ,
@@ -862,6 +897,7 @@ int64_t opal_get_elog_size(uint64_t *log_id, size_t *size, uint64_t *elog_type);int64_t opal_write_elog (uint64_t buffer,uint64_t size,uint64_t offset);int64_t opal_send_ack_elog (uint64_t log_id);void opal_resend_pending_logs (void ); +int64_t opal_elog_send (void *buffer);int64_t opal_validate_flash (uint64_t buffer,uint32_t *size,uint32_t *result);int64_t opal_manage_flash (uint8_t op);int64_t opal_update_flash (uint64_t blk_list);
arch/powerpc/platforms/powernv/opal-elog.c +75 -1
95 lines not on this page · raw message
arch/powerpc/platforms/powernv/opal-wrappers.S +1 -0
@@ -137,3 +137,4 @@ OPAL_CALL(opal_sensor_read, OPAL_SENSOR_READ); OPAL_CALL(opal_get_param, OPAL_GET_PARAM); OPAL_CALL(opal_set_param, OPAL_SET_PARAM); OPAL_CALL(opal_dump_resend_notification, OPAL_DUMP_RESEND); +OPAL_CALL(opal_elog_send, OPAL_ELOG_SEND);
arch/powerpc/platforms/powernv/powernv.h +84 -0
94 lines not on this page · raw message
PATCH v5 2/3 powernv: Correct spell error in opal-elog.c
In reply to Deepthi DharwarCorrect spell error in opal-elog.c
--- arch/powerpc/platforms/powernv/opal-elog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/platforms/powernv/opal-elog.c +1 -1
@@ -26,7 +26,7 @@/* Maximum size of a single log on FSP is 16KB */ #define OPAL_MAX_ERRLOG_SIZE 16384 -/* maximu number of records powernv can hold */ +/* Maximum number of records powernv platform can hold */ #define MAX_NUM_RECORD 128struct opal_err_log {
PATCH v5 3/3 powernv: Have uniform logging of errors in opal-elog.c
In reply to Deepthi DharwarCurrently some errors/info to be reported use
printk and the rest pr_fmt(). This patch
makes the complete error logging uniform.
--- arch/powerpc/platforms/powernv/opal-elog.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
arch/powerpc/platforms/powernv/opal-elog.c +6 -8
@@ -63,7 +63,7 @@ void opal_elog_ack(uint64_t ack_id)struct opal_err_log *record, *next;bool found = false; -printk (KERN_INFO "OPAL Log ACK=%llx" , ack_id); +pr_info ("OPAL Log ACK=%llx" , ack_id);/* once user acknowledge a log delete record from list */ spin_lock_irqsave (&opal_elog_lock, flags);
@@ -189,7 +189,7 @@ static void opal_elog_read(void)/* read log size and log ID from OPAL */ rc =opal_get_elog_size (&log_id, &elog_size, &elog_type);if (rc !=OPAL_SUCCESS ) { -pr_err ("ELOG: Opal log read failed\n" ); +pr_err ("Opal log read failed\n" );return ; }if (elog_size >=OPAL_MAX_ERRLOG_SIZE )
@@ -203,7 +203,7 @@ static void opal_elog_read(void) rc =opal_read_elog (__pa (err_log_data), elog_size, log_id);if (rc !=OPAL_SUCCESS ) {mutex_unlock (&err_log_data_mutex); -pr_err ("ELOG: log read failed for log-id=%llx\n" , log_id); +pr_err ("Reading of log failed for log-id=%llx\n" , log_id);/* put back the free node. */ spin_lock_irqsave (&opal_elog_lock, flags);list_add (&record->link, &elog_ack_list);
@@ -265,7 +265,7 @@ static int init_err_log_buffer(void) buf_ptr =vmalloc (sizeof (struct opal_err_log ) *MAX_NUM_RECORD );if (!buf_ptr) { -printk (KERN_ERR "ELOG: failed to allocate memory.\n" ); +pr_err ("Failed to allocate memory for error logging buffers.\n" );return -ENOMEM ; }memset (buf_ptr,0 ,sizeof (struct opal_err_log ) *MAX_NUM_RECORD );
@@ -357,15 +357,13 @@ int __init opal_elog_init(void) rc =sysfs_create_bin_file (opal_kobj, &opal_elog_attr);if (rc) { -printk (KERN_ERR "ELOG: unable to create sysfs file" -"opal_elog (%d)\n" , rc); +pr_err ("Unable to create sysfs file opal_elog (%d)\n" , rc);return rc; } rc =sysfs_create_file (opal_kobj, &opal_elog_ack_attr.attr);if (rc) { -printk (KERN_ERR "ELOG: unable to create sysfs file" -" opal_elog_ack (%d)\n" , rc); +pr_err ("Unable to create sysfs file opal_elog_ack (%d)\n" , rc);return rc; }