Skip to content

Commit 90e17ed

Browse files
committed
Merge branches 'acpi-apei', 'acpi-prm' and 'acpi-docs'
Merge APEI, PRM and documentation udpates for 5.16-rc1: - Mark apei_hest_parse() static (Christoph Hellwig). - Relax platform response timeout to 1 second after instructing it to inject an error (Shuai Xue). - Make the PRM code handle memory allocation and remapping failures more gracefully and drop some unnecessary blank lines from that code (Aubrey Li). - Fix spelling mistake in the ACPI documentation (Colin Ian King). * acpi-apei: ACPI: APEI: mark apei_hest_parse() static ACPI: APEI: EINJ: Relax platform response timeout to 1 second * acpi-prm: ACPI: PRM: Handle memory allocation and memory remap failure ACPI: PRM: Remove unnecessary blank lines * acpi-docs: Documentation: ACPI: Fix spelling mistake "Millenium" -> "Millennium"
4 parents f8df160 + 0660664 + c52ca71 + 11ca0d6 commit 90e17ed

File tree

5 files changed

+38
-22
lines changed

5 files changed

+38
-22
lines changed

Documentation/firmware-guide/acpi/osi.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ The ACPI BIOS flow would include an evaluation of _OS, and the AML
7474
interpreter in the kernel would return to it a string identifying the OS:
7575

7676
Windows 98, SE: "Microsoft Windows"
77-
Windows ME: "Microsoft WindowsME:Millenium Edition"
77+
Windows ME: "Microsoft WindowsME:Millennium Edition"
7878
Windows NT: "Microsoft Windows NT"
7979

8080
The idea was on a platform tasked with running multiple OS's,

drivers/acpi/apei/einj.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@
2828
#undef pr_fmt
2929
#define pr_fmt(fmt) "EINJ: " fmt
3030

31-
#define SPIN_UNIT 100 /* 100ns */
32-
/* Firmware should respond within 1 milliseconds */
33-
#define FIRMWARE_TIMEOUT (1 * NSEC_PER_MSEC)
31+
#define SLEEP_UNIT_MIN 1000 /* 1ms */
32+
#define SLEEP_UNIT_MAX 5000 /* 5ms */
33+
/* Firmware should respond within 1 seconds */
34+
#define FIRMWARE_TIMEOUT (1 * USEC_PER_SEC)
3435
#define ACPI5_VENDOR_BIT BIT(31)
3536
#define MEM_ERROR_MASK (ACPI_EINJ_MEMORY_CORRECTABLE | \
3637
ACPI_EINJ_MEMORY_UNCORRECTABLE | \
@@ -171,13 +172,13 @@ static int einj_get_available_error_type(u32 *type)
171172

172173
static int einj_timedout(u64 *t)
173174
{
174-
if ((s64)*t < SPIN_UNIT) {
175+
if ((s64)*t < SLEEP_UNIT_MIN) {
175176
pr_warn(FW_WARN "Firmware does not respond in time\n");
176177
return 1;
177178
}
178-
*t -= SPIN_UNIT;
179-
ndelay(SPIN_UNIT);
180-
touch_nmi_watchdog();
179+
*t -= SLEEP_UNIT_MIN;
180+
usleep_range(SLEEP_UNIT_MIN, SLEEP_UNIT_MAX);
181+
181182
return 0;
182183
}
183184

drivers/acpi/apei/hest.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ static int hest_esrc_len(struct acpi_hest_header *hest_hdr)
8686
return len;
8787
};
8888

89-
int apei_hest_parse(apei_hest_func_t func, void *data)
89+
typedef int (*apei_hest_func_t)(struct acpi_hest_header *hest_hdr, void *data);
90+
91+
static int apei_hest_parse(apei_hest_func_t func, void *data)
9092
{
9193
struct acpi_hest_header *hest_hdr;
9294
int i, rc, len;
@@ -121,7 +123,6 @@ int apei_hest_parse(apei_hest_func_t func, void *data)
121123

122124
return 0;
123125
}
124-
EXPORT_SYMBOL_GPL(apei_hest_parse);
125126

126127
/*
127128
* Check if firmware advertises firmware first mode. We need FF bit to be set

drivers/acpi/prmt.c

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ struct prm_context_buffer {
4949
};
5050
#pragma pack()
5151

52-
5352
static LIST_HEAD(prm_module_list);
5453

5554
struct prm_handler_info {
@@ -73,7 +72,6 @@ struct prm_module_info {
7372
struct prm_handler_info handlers[];
7473
};
7574

76-
7775
static u64 efi_pa_va_lookup(u64 pa)
7876
{
7977
efi_memory_desc_t *md;
@@ -88,7 +86,6 @@ static u64 efi_pa_va_lookup(u64 pa)
8886
return 0;
8987
}
9088

91-
9289
#define get_first_handler(a) ((struct acpi_prmt_handler_info *) ((char *) (a) + a->handler_info_offset))
9390
#define get_next_handler(a) ((struct acpi_prmt_handler_info *) (sizeof(struct acpi_prmt_handler_info) + (char *) a))
9491

@@ -99,7 +96,7 @@ acpi_parse_prmt(union acpi_subtable_headers *header, const unsigned long end)
9996
struct acpi_prmt_handler_info *handler_info;
10097
struct prm_handler_info *th;
10198
struct prm_module_info *tm;
102-
u64 mmio_count = 0;
99+
u64 *mmio_count;
103100
u64 cur_handler = 0;
104101
u32 module_info_size = 0;
105102
u64 mmio_range_size = 0;
@@ -108,6 +105,8 @@ acpi_parse_prmt(union acpi_subtable_headers *header, const unsigned long end)
108105
module_info = (struct acpi_prmt_module_info *) header;
109106
module_info_size = struct_size(tm, handlers, module_info->handler_info_count);
110107
tm = kmalloc(module_info_size, GFP_KERNEL);
108+
if (!tm)
109+
goto parse_prmt_out1;
111110

112111
guid_copy(&tm->guid, (guid_t *) module_info->module_guid);
113112
tm->major_rev = module_info->major_rev;
@@ -120,14 +119,24 @@ acpi_parse_prmt(union acpi_subtable_headers *header, const unsigned long end)
120119
* Each module is associated with a list of addr
121120
* ranges that it can use during the service
122121
*/
123-
mmio_count = *(u64 *) memremap(module_info->mmio_list_pointer, 8, MEMREMAP_WB);
124-
mmio_range_size = struct_size(tm->mmio_info, addr_ranges, mmio_count);
122+
mmio_count = (u64 *) memremap(module_info->mmio_list_pointer, 8, MEMREMAP_WB);
123+
if (!mmio_count)
124+
goto parse_prmt_out2;
125+
126+
mmio_range_size = struct_size(tm->mmio_info, addr_ranges, *mmio_count);
125127
tm->mmio_info = kmalloc(mmio_range_size, GFP_KERNEL);
128+
if (!tm->mmio_info)
129+
goto parse_prmt_out3;
130+
126131
temp_mmio = memremap(module_info->mmio_list_pointer, mmio_range_size, MEMREMAP_WB);
132+
if (!temp_mmio)
133+
goto parse_prmt_out4;
127134
memmove(tm->mmio_info, temp_mmio, mmio_range_size);
128135
} else {
129-
mmio_range_size = struct_size(tm->mmio_info, addr_ranges, mmio_count);
130-
tm->mmio_info = kmalloc(mmio_range_size, GFP_KERNEL);
136+
tm->mmio_info = kmalloc(sizeof(*tm->mmio_info), GFP_KERNEL);
137+
if (!tm->mmio_info)
138+
goto parse_prmt_out2;
139+
131140
tm->mmio_info->mmio_count = 0;
132141
}
133142

@@ -145,6 +154,15 @@ acpi_parse_prmt(union acpi_subtable_headers *header, const unsigned long end)
145154
} while (++cur_handler < tm->handler_count && (handler_info = get_next_handler(handler_info)));
146155

147156
return 0;
157+
158+
parse_prmt_out4:
159+
kfree(tm->mmio_info);
160+
parse_prmt_out3:
161+
memunmap(mmio_count);
162+
parse_prmt_out2:
163+
kfree(tm);
164+
parse_prmt_out1:
165+
return -ENOMEM;
148166
}
149167

150168
#define GET_MODULE 0
@@ -171,7 +189,6 @@ static void *find_guid_info(const guid_t *guid, u8 mode)
171189
return NULL;
172190
}
173191

174-
175192
static struct prm_module_info *find_prm_module(const guid_t *guid)
176193
{
177194
return (struct prm_module_info *)find_guid_info(guid, GET_MODULE);

include/acpi/apei.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ void __init acpi_hest_init(void);
3737
static inline void acpi_hest_init(void) { return; }
3838
#endif
3939

40-
typedef int (*apei_hest_func_t)(struct acpi_hest_header *hest_hdr, void *data);
41-
int apei_hest_parse(apei_hest_func_t func, void *data);
42-
4340
int erst_write(const struct cper_record_header *record);
4441
ssize_t erst_get_record_count(void);
4542
int erst_get_record_id_begin(int *pos);

0 commit comments

Comments
 (0)