ras.c (0f54bddefe7f5e4c98bea6f945ebdf85d1c44117) ras.c (cc15ff3275694fedc33cd3d53212a43eec7aa0bc)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Copyright (C) 2001 Dave Engebretsen IBM Corporation
4 */
5
6#include <linux/sched.h>
7#include <linux/interrupt.h>
8#include <linux/irq.h>

--- 9 unchanged lines hidden (view full) ---

18
19#include "pseries.h"
20
21static unsigned char ras_log_buf[RTAS_ERROR_LOG_MAX];
22static DEFINE_SPINLOCK(ras_log_buf_lock);
23
24static int ras_check_exception_token;
25
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Copyright (C) 2001 Dave Engebretsen IBM Corporation
4 */
5
6#include <linux/sched.h>
7#include <linux/interrupt.h>
8#include <linux/irq.h>

--- 9 unchanged lines hidden (view full) ---

18
19#include "pseries.h"
20
21static unsigned char ras_log_buf[RTAS_ERROR_LOG_MAX];
22static DEFINE_SPINLOCK(ras_log_buf_lock);
23
24static int ras_check_exception_token;
25
26static void mce_process_errlog_event(struct irq_work *work);
27static struct irq_work mce_errlog_process_work = {
28 .func = mce_process_errlog_event,
29};
30
31#define EPOW_SENSOR_TOKEN 9
32#define EPOW_SENSOR_INDEX 0
33
34/* EPOW events counter variable */
35static int num_epow_events;
36
37static irqreturn_t ras_hotplug_interrupt(int irq, void *dev_id);
38static irqreturn_t ras_epow_interrupt(int irq, void *dev_id);

--- 701 unchanged lines hidden (view full) ---

740 return disposition;
741}
742
743static int mce_handle_error(struct pt_regs *regs, struct rtas_error_log *errp)
744{
745 struct pseries_errorlog *pseries_log;
746 struct pseries_mc_errorlog *mce_log = NULL;
747 int disposition = rtas_error_disposition(errp);
26#define EPOW_SENSOR_TOKEN 9
27#define EPOW_SENSOR_INDEX 0
28
29/* EPOW events counter variable */
30static int num_epow_events;
31
32static irqreturn_t ras_hotplug_interrupt(int irq, void *dev_id);
33static irqreturn_t ras_epow_interrupt(int irq, void *dev_id);

--- 701 unchanged lines hidden (view full) ---

735 return disposition;
736}
737
738static int mce_handle_error(struct pt_regs *regs, struct rtas_error_log *errp)
739{
740 struct pseries_errorlog *pseries_log;
741 struct pseries_mc_errorlog *mce_log = NULL;
742 int disposition = rtas_error_disposition(errp);
748 unsigned long msr;
749 u8 error_type;
750
751 if (!rtas_error_extended(errp))
752 goto out;
753
754 pseries_log = get_pseries_errorlog(errp, PSERIES_ELOG_SECT_ID_MCE);
755 if (!pseries_log)
756 goto out;
757
758 mce_log = (struct pseries_mc_errorlog *)pseries_log->data;
759 error_type = mce_log->error_type;
760
761 disposition = mce_handle_err_realmode(disposition, error_type);
743 u8 error_type;
744
745 if (!rtas_error_extended(errp))
746 goto out;
747
748 pseries_log = get_pseries_errorlog(errp, PSERIES_ELOG_SECT_ID_MCE);
749 if (!pseries_log)
750 goto out;
751
752 mce_log = (struct pseries_mc_errorlog *)pseries_log->data;
753 error_type = mce_log->error_type;
754
755 disposition = mce_handle_err_realmode(disposition, error_type);
762
763 /*
764 * Enable translation as we will be accessing per-cpu variables
765 * in save_mce_event() which may fall outside RMO region, also
766 * leave it enabled because subsequently we will be queuing work
767 * to workqueues where again per-cpu variables accessed, besides
768 * fwnmi_release_errinfo() crashes when called in realmode on
769 * pseries.
770 * Note: All the realmode handling like flushing SLB entries for
771 * SLB multihit is done by now.
772 */
773out:
756out:
774 msr = mfmsr();
775 mtmsr(msr | MSR_IR | MSR_DR);
776
777 disposition = mce_handle_err_virtmode(regs, errp, mce_log,
778 disposition);
757 disposition = mce_handle_err_virtmode(regs, errp, mce_log,
758 disposition);
779
780 /*
781 * Queue irq work to log this rtas event later.
782 * irq_work_queue uses per-cpu variables, so do this in virt
783 * mode as well.
784 */
785 irq_work_queue(&mce_errlog_process_work);
786
787 mtmsr(msr);
788
789 return disposition;
790}
791
792/*
793 * Process MCE rtas errlog event.
794 */
759 return disposition;
760}
761
762/*
763 * Process MCE rtas errlog event.
764 */
795static void mce_process_errlog_event(struct irq_work *work)
765void pSeries_machine_check_log_err(void)
796{
797 struct rtas_error_log *err;
798
799 err = fwnmi_get_errlog();
800 log_error((char *)err, ERR_TYPE_RTAS_LOG, 0);
801}
802
803/*

--- 109 unchanged lines hidden ---
766{
767 struct rtas_error_log *err;
768
769 err = fwnmi_get_errlog();
770 log_error((char *)err, ERR_TYPE_RTAS_LOG, 0);
771}
772
773/*

--- 109 unchanged lines hidden ---