-
Notifications
You must be signed in to change notification settings - Fork 82
/
ras-page-isolation.h
125 lines (105 loc) · 2.28 KB
/
ras-page-isolation.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
*/
#ifndef __RAS_PAGE_ISOLATION_H
#define __RAS_PAGE_ISOLATION_H
#include <sys/types.h>
#include <sys/queue.h>
#include <stdbool.h>
#include <time.h>
#include "rbtree.h"
#include "types.h"
#define PAGE_SHIFT 12
#define PAGE_SIZE BIT(PAGE_SHIFT)
#define PAGE_MASK (~(PAGE_SIZE - 1))
struct config {
char *name;
unsigned long val;
};
enum otype {
OFFLINE_OFF,
OFFLINE_ACCOUNT,
OFFLINE_SOFT,
OFFLINE_HARD,
OFFLINE_SOFT_THEN_HARD,
};
enum pstate {
PAGE_ONLINE,
PAGE_OFFLINE,
PAGE_OFFLINE_FAILED,
};
struct page_record {
struct rb_node entry;
unsigned long long addr;
time_t start;
enum pstate offlined;
unsigned long count;
unsigned long excess;
};
enum row_location_type {
GHES,
DSM
};
enum apei_location_field_index {
APEI_NODE,
APEI_CARD,
APEI_MODULE,
APEI_RANK,
APEI_DEVICE,
APEI_BANK,
APEI_ROW,
APEI_FIELD_NUM
};
enum dsm_location_field_index {
DSM_ProcessorSocketId,
DSM_MemoryControllerId,
DSM_ChannelId,
DSM_DimmSlotId,
DSM_PhysicalRankId,
DSM_ChipId,
DSM_BankGroup,
DSM_Bank,
DSM_Row,
DSM_FIELD_NUM
};
#define APEI_FIELD_NUM_CONST ((int)APEI_FIELD_NUM)
#define DSM_FIELD_NUM_CONST ((int)DSM_FIELD_NUM)
struct memory_location_field {
const char *name;
const char *anchor_str;
const int value_base;
};
struct page_addr {
LIST_ENTRY(page_addr) entry;
unsigned long long addr;
enum pstate offlined;
int count;
time_t start;
};
#define ROW_LOCATION_FIELDS_NUM (DSM_FIELD_NUM_CONST > APEI_FIELD_NUM_CONST ? \
DSM_FIELD_NUM_CONST : APEI_FIELD_NUM_CONST)
struct row_record {
LIST_ENTRY(row_record) entry;
LIST_HEAD(page_listhead, page_addr) page_head;
enum row_location_type type;
int location_fields[ROW_LOCATION_FIELDS_NUM];
time_t start;
unsigned long count;
};
struct isolation {
char *name;
char *env;
const struct config *units;
unsigned long val;
bool overflow;
char *unit;
};
void ras_page_account_init(void);
void ras_record_page_error(unsigned long long addr,
unsigned int count, time_t time);
void ras_row_account_init(void);
void ras_record_row_error(const char *detail, unsigned int count, time_t time,
unsigned long long addr);
void row_record_infos_free(void);
#endif