@@ -59,6 +59,10 @@ static struct acpi_table_erst *erst_tab;
59
59
#define ERST_RANGE_NVRAM 0x0002
60
60
#define ERST_RANGE_SLOW 0x0004
61
61
62
+ /* ERST Exec max timings */
63
+ #define ERST_EXEC_TIMING_MAX_MASK 0xFFFFFFFF00000000
64
+ #define ERST_EXEC_TIMING_MAX_SHIFT 32
65
+
62
66
/*
63
67
* ERST Error Log Address Range, used as buffer for reading/writing
64
68
* error records.
@@ -68,6 +72,7 @@ static struct erst_erange {
68
72
u64 size ;
69
73
void __iomem * vaddr ;
70
74
u32 attr ;
75
+ u64 timings ;
71
76
} erst_erange ;
72
77
73
78
/*
@@ -97,6 +102,19 @@ static inline int erst_errno(int command_status)
97
102
}
98
103
}
99
104
105
+ static inline u64 erst_get_timeout (void )
106
+ {
107
+ u64 timeout = FIRMWARE_TIMEOUT ;
108
+
109
+ if (erst_erange .attr & ERST_RANGE_SLOW ) {
110
+ timeout = ((erst_erange .timings & ERST_EXEC_TIMING_MAX_MASK ) >>
111
+ ERST_EXEC_TIMING_MAX_SHIFT ) * NSEC_PER_MSEC ;
112
+ if (timeout < FIRMWARE_TIMEOUT )
113
+ timeout = FIRMWARE_TIMEOUT ;
114
+ }
115
+ return timeout ;
116
+ }
117
+
100
118
static int erst_timedout (u64 * t , u64 spin_unit )
101
119
{
102
120
if ((s64 )* t < spin_unit ) {
@@ -191,9 +209,11 @@ static int erst_exec_stall_while_true(struct apei_exec_context *ctx,
191
209
{
192
210
int rc ;
193
211
u64 val ;
194
- u64 timeout = FIRMWARE_TIMEOUT ;
212
+ u64 timeout ;
195
213
u64 stall_time ;
196
214
215
+ timeout = erst_get_timeout ();
216
+
197
217
if (ctx -> var1 > FIRMWARE_MAX_STALL ) {
198
218
if (!in_nmi ())
199
219
pr_warn (FW_WARN
@@ -389,6 +409,13 @@ static int erst_get_erange(struct erst_erange *range)
389
409
if (rc )
390
410
return rc ;
391
411
range -> attr = apei_exec_ctx_get_output (& ctx );
412
+ rc = apei_exec_run (& ctx , ACPI_ERST_EXECUTE_TIMINGS );
413
+ if (rc == 0 )
414
+ range -> timings = apei_exec_ctx_get_output (& ctx );
415
+ else if (rc == - ENOENT )
416
+ range -> timings = 0 ;
417
+ else
418
+ return rc ;
392
419
393
420
return 0 ;
394
421
}
@@ -621,10 +648,12 @@ EXPORT_SYMBOL_GPL(erst_get_record_id_end);
621
648
static int __erst_write_to_storage (u64 offset )
622
649
{
623
650
struct apei_exec_context ctx ;
624
- u64 timeout = FIRMWARE_TIMEOUT ;
651
+ u64 timeout ;
625
652
u64 val ;
626
653
int rc ;
627
654
655
+ timeout = erst_get_timeout ();
656
+
628
657
erst_exec_ctx_init (& ctx );
629
658
rc = apei_exec_run_optional (& ctx , ACPI_ERST_BEGIN_WRITE );
630
659
if (rc )
@@ -660,10 +689,12 @@ static int __erst_write_to_storage(u64 offset)
660
689
static int __erst_read_from_storage (u64 record_id , u64 offset )
661
690
{
662
691
struct apei_exec_context ctx ;
663
- u64 timeout = FIRMWARE_TIMEOUT ;
692
+ u64 timeout ;
664
693
u64 val ;
665
694
int rc ;
666
695
696
+ timeout = erst_get_timeout ();
697
+
667
698
erst_exec_ctx_init (& ctx );
668
699
rc = apei_exec_run_optional (& ctx , ACPI_ERST_BEGIN_READ );
669
700
if (rc )
@@ -703,10 +734,12 @@ static int __erst_read_from_storage(u64 record_id, u64 offset)
703
734
static int __erst_clear_from_storage (u64 record_id )
704
735
{
705
736
struct apei_exec_context ctx ;
706
- u64 timeout = FIRMWARE_TIMEOUT ;
737
+ u64 timeout ;
707
738
u64 val ;
708
739
int rc ;
709
740
741
+ timeout = erst_get_timeout ();
742
+
710
743
erst_exec_ctx_init (& ctx );
711
744
rc = apei_exec_run_optional (& ctx , ACPI_ERST_BEGIN_CLEAR );
712
745
if (rc )
0 commit comments