History

Merge branches 'acpi-apei', 'acpi-pmic', 'acpi-video' and 'acpi-dptf'

* acpi-apei: arm64: acpi: Make apei_claim_sea() synchronise with APEI's irq work ACPI: APEI: Kick the memory_failure() queue for synchronous errors mm/memory-failure: Add memory_failure_queue_kick() * acpi-pmic: ACPI / PMIC: Add i2c address for thermal control * acpi-video: ACPI: video: Use native backlight on Acer TravelMate 5735Z * acpi-dptf: ACPI: DPTF: Add battery participant driver ACPI: DPTF: Additional sysfs attributes for power participant driver

Rafael J. Wysocki committed 6 years ago

Commit 48ccded5 parents 228b79a 8fcc4ae cc0594c c41c36e 7b52b2010 files · +313 −30Browse files

Unified · Split

10 files
  1. Documentation/ABI/testing/sysfs-platform-dptf +58 −4
  2. arch/arm64/kernel/acpi.c +25 −0
  3. arch/arm64/mm/fault.c +7 −5
  4. drivers/acpi/apei/ghes.c +56 −11
  5. drivers/acpi/dptf/dptf_power.c +138 −9
  6. drivers/acpi/pmic/intel_pmic_chtdc_ti.c +1 −0
  7. drivers/acpi/video_detect.c +10 −0
  8. include/acpi/ghes.h +3 −0
  9. include/linux/mm.h +1 −0
  10. mm/memory-failure.c +14 −1
Documentation/ABI/testing/sysfs-platform-dptf+58−4
@@ -27,10 +27,12 @@ KernelVersion: v4.10 · 26 unmodified lines
2727 Contact: linux-acpi@vger.kernel.org
2828 Description:
2929 (RO) Display the platform power source
30− 0x00 = DC
31− 0x01 = AC
32− 0x02 = USB
33− 0x03 = Wireless Charger
30+ bits[3:0] Current power source
31+ 0x00 = DC
32+ 0x01 = AC
33+ 0x02 = USB
34+ 0x03 = Wireless Charger
35+ bits[7:4] Power source sequence number
3436
3537 What: /sys/bus/platform/devices/INT3407:00/dptf_power/battery_steady_power
3638 Date: Jul, 2016
@@ -38,3 +40,55 @@ KernelVersion: v4.10 · 1 unmodified line
3840 Contact: linux-acpi@vger.kernel.org
3941 Description:
4042 (RO) The maximum sustained power for battery in milliwatts.
43+
44+What: /sys/bus/platform/devices/INT3407:00/dptf_power/rest_of_platform_power_mw
45+Date: June, 2020
46+KernelVersion: v5.8
47+Contact: linux-acpi@vger.kernel.org
48+Description:
49+ (RO) Shows the rest (outside of SoC) of worst-case platform power.
50+
51+What: /sys/bus/platform/devices/INT3407:00/dptf_power/prochot_confirm
52+Date: June, 2020
53+KernelVersion: v5.8
54+Contact: linux-acpi@vger.kernel.org
55+Description:
56+ (WO) Confirm embedded controller about a prochot notification.
57+
58+What: /sys/bus/platform/devices/INT3532:00/dptf_battery/max_platform_power_mw
59+Date: June, 2020
60+KernelVersion: v5.8
61+Contact: linux-acpi@vger.kernel.org
62+Description:
63+ (RO) The maximum platform power that can be supported by the battery in milli watts.
64+
65+What: /sys/bus/platform/devices/INT3532:00/dptf_battery/max_steady_state_power_mw
66+Date: June, 2020
67+KernelVersion: v5.8
68+Contact: linux-acpi@vger.kernel.org
69+Description:
70+ (RO) The maximum sustained power for battery in milli watts.
71+
72+What: /sys/bus/platform/devices/INT3532:00/dptf_battery/high_freq_impedance_mohm
73+Date: June, 2020
74+KernelVersion: v5.8
75+Contact: linux-acpi@vger.kernel.org
76+Description:
77+ (RO) The high frequency impedance value that can be obtained from battery
78+ fuel gauge in milli Ohms.
79+
80+What: /sys/bus/platform/devices/INT3532:00/dptf_battery/no_load_voltage_mv
81+Date: June, 2020
82+KernelVersion: v5.8
83+Contact: linux-acpi@vger.kernel.org
84+Description:
85+ (RO) The no-load voltage that can be obtained from battery fuel gauge in
86+ milli volts.
87+
88+What: /sys/bus/platform/devices/INT3532:00/dptf_battery/current_discharge_capbility_ma
89+Date: June, 2020
90+KernelVersion: v5.8
91+Contact: linux-acpi@vger.kernel.org
92+Description:
93+ (RO) The battery discharge current capability obtained from battery fuel gauge in
94+ milli Amps.
arch/arm64/kernel/acpi.c+25−0
@@ -19,6 +19,7 @@ · 18 unmodified lines
1919 #include <linux/init.h>
2020 #include <linux/irq.h>
2121 #include <linux/irqdomain.h>
22+#include <linux/irq_work.h>
2223 #include <linux/memblock.h>
2324 #include <linux/of_fdt.h>
2425 #include <linux/smp.h>
@@ -269,6 +270,7 @@ pgprot_t __acpi_get_mem_attribute(phys_addr_t addr) · 244 unmodified lines
269270 int apei_claim_sea(struct pt_regs *regs)
270271 {
271272 int err = -ENOENT;
273+ bool return_to_irqs_enabled;
272274 unsigned long current_flags;
273275
274276 if (!IS_ENABLED(CONFIG_ACPI_APEI_GHES))
@@ -276,6 +278,12 @@ int apei_claim_sea(struct pt_regs *regs) · 1 unmodified line
276278
277279 current_flags = local_daif_save_flags();
278280
281+ /* current_flags isn't useful here as daif doesn't tell us about pNMI */
282+ return_to_irqs_enabled = !irqs_disabled_flags(arch_local_save_flags());
283+
284+ if (regs)
285+ return_to_irqs_enabled = interrupts_enabled(regs);
286+
279287 /*
280288 * SEA can interrupt SError, mask it and describe this as an NMI so
281289 * that APEI defers the handling.
@@ -284,6 +292,23 @@ int apei_claim_sea(struct pt_regs *regs) · 2 unmodified lines
284292 nmi_enter();
285293 err = ghes_notify_sea();
286294 nmi_exit();
295+
296+ /*
297+ * APEI NMI-like notifications are deferred to irq_work. Unless
298+ * we interrupted irqs-masked code, we can do that now.
299+ */
300+ if (!err) {
301+ if (return_to_irqs_enabled) {
302+ local_daif_restore(DAIF_PROCCTX_NOIRQ);
303+ __irq_enter();
304+ irq_work_run();
305+ __irq_exit();
306+ } else {
307+ pr_warn_ratelimited("APEI work queued but not completed");
308+ err = -EINPROGRESS;
309+ }
310+ }
311+
287312 local_daif_restore(current_flags);
288313
289314 return err;
arch/arm64/mm/fault.c+7−5
@@ -635,11 +635,13 @@ static int do_sea(unsigned long addr, unsigned int esr, struct pt_regs *regs) · 634 unmodified lines
635635
636636 inf = esr_to_fault_info(esr);
637637
638− /*
639− * Return value ignored as we rely on signal merging.
640− * Future patches will make this more robust.
641− */
642− apei_claim_sea(regs);
638+ if (user_mode(regs) && apei_claim_sea(regs) == 0) {
639+ /*
640+ * APEI claimed this as a firmware-first notification.
641+ * Some processing deferred to task_work before ret_to_user().
642+ */
643+ return 0;
644+ }
643645
644646 if (esr & ESR_ELx_FnV)
645647 siaddr = NULL;
drivers/acpi/apei/ghes.c+56−11
@@ -40,6 +40,7 @@ · 39 unmodified lines
4040 #include <linux/sched/clock.h>
4141 #include <linux/uuid.h>
4242 #include <linux/ras.h>
43+#include <linux/task_work.h>
4344
4445 #include <acpi/actbl1.h>
4546 #include <acpi/ghes.h>
@@ -414,23 +415,46 @@ static void ghes_clear_estatus(struct ghes *ghes, · 368 unmodified lines
414415 ghes_ack_error(ghes->generic_v2);
415416 }
416417
417−static void ghes_handle_memory_failure(struct acpi_hest_generic_data *gdata, int sev)
418+/*
419+ * Called as task_work before returning to user-space.
420+ * Ensure any queued work has been done before we return to the context that
421+ * triggered the notification.
422+ */
423+static void ghes_kick_task_work(struct callback_head *head)
424+{
425+ struct acpi_hest_generic_status *estatus;
426+ struct ghes_estatus_node *estatus_node;
427+ u32 node_len;
428+
429+ estatus_node = container_of(head, struct ghes_estatus_node, task_work);
430+ if (IS_ENABLED(CONFIG_ACPI_APEI_MEMORY_FAILURE))
431+ memory_failure_queue_kick(estatus_node->task_work_cpu);
432+
433+ estatus = GHES_ESTATUS_FROM_NODE(estatus_node);
434+ node_len = GHES_ESTATUS_NODE_LEN(cper_estatus_len(estatus));
435+ gen_pool_free(ghes_estatus_pool, (unsigned long)estatus_node, node_len);
436+}
437+
438+static bool ghes_handle_memory_failure(struct acpi_hest_generic_data *gdata,
439+ int sev)
418440 {
419−#ifdef CONFIG_ACPI_APEI_MEMORY_FAILURE
420441 unsigned long pfn;
421442 int flags = -1;
422443 int sec_sev = ghes_severity(gdata->error_severity);
423444 struct cper_sec_mem_err *mem_err = acpi_hest_get_payload(gdata);
424445
446+ if (!IS_ENABLED(CONFIG_ACPI_APEI_MEMORY_FAILURE))
447+ return false;
448+
425449 if (!(mem_err->validation_bits & CPER_MEM_VALID_PA))
426− return;
450+ return false;
427451
428452 pfn = mem_err->physical_addr >> PAGE_SHIFT;
429453 if (!pfn_valid(pfn)) {
430454 pr_warn_ratelimited(FW_WARN GHES_PFX
431455 "Invalid address in generic error data: %#llx\n",
432456 mem_err->physical_addr);
433− return;
457+ return false;
434458 }
435459
436460 /* iff following two events can be handled properly by now */
@@ -440,9 +464,12 @@ static void ghes_handle_memory_failure(struct acpi_hest_generic_data *gdata, int · 3 unmodified lines
440464 if (sev == GHES_SEV_RECOVERABLE && sec_sev == GHES_SEV_RECOVERABLE)
441465 flags = 0;
442466
443− if (flags != -1)
467+ if (flags != -1) {
444468 memory_failure_queue(pfn, flags);
445−#endif
469+ return true;
470+ }
471+
472+ return false;
446473 }
447474
448475 /*
@@ -490,7 +517,7 @@ static void ghes_handle_aer(struct acpi_hest_generic_data *gdata) · 41 unmodified lines
490517 #endif
491518 }
492519
493−static void ghes_do_proc(struct ghes *ghes,
520+static bool ghes_do_proc(struct ghes *ghes,
494521 const struct acpi_hest_generic_status *estatus)
495522 {
496523 int sev, sec_sev;
@@ -498,6 +525,7 @@ static void ghes_do_proc(struct ghes *ghes, · 1 unmodified line
498525 guid_t *sec_type;
499526 const guid_t *fru_id = &guid_null;
500527 char *fru_text = "";
528+ bool queued = false;
501529
502530 sev = ghes_severity(estatus->error_severity);
503531 apei_estatus_for_each_section(estatus, gdata) {
@@ -515,7 +543,7 @@ static void ghes_do_proc(struct ghes *ghes, · 11 unmodified lines
515543 ghes_edac_report_mem_error(sev, mem_err);
516544
517545 arch_apei_report_mem_error(sev, mem_err);
518− ghes_handle_memory_failure(gdata, sev);
546+ queued = ghes_handle_memory_failure(gdata, sev);
519547 }
520548 else if (guid_equal(sec_type, &CPER_SEC_PCIE)) {
521549 ghes_handle_aer(gdata);
@@ -532,6 +560,8 @@ static void ghes_do_proc(struct ghes *ghes, · 10 unmodified lines
532560 gdata->error_data_length);
533561 }
534562 }
563+
564+ return queued;
535565 }
536566
537567 static void __ghes_print_estatus(const char *pfx,
@@ -827,7 +857,9 @@ static void ghes_proc_in_irq(struct irq_work *irq_work) · 289 unmodified lines
827857 struct ghes_estatus_node *estatus_node;
828858 struct acpi_hest_generic *generic;
829859 struct acpi_hest_generic_status *estatus;
860+ bool task_work_pending;
830861 u32 len, node_len;
862+ int ret;
831863
832864 llnode = llist_del_all(&ghes_estatus_llist);
833865 /*
@@ -842,14 +874,26 @@ static void ghes_proc_in_irq(struct irq_work *irq_work) · 8 unmodified lines
842874 estatus = GHES_ESTATUS_FROM_NODE(estatus_node);
843875 len = cper_estatus_len(estatus);
844876 node_len = GHES_ESTATUS_NODE_LEN(len);
845− ghes_do_proc(estatus_node->ghes, estatus);
877+ task_work_pending = ghes_do_proc(estatus_node->ghes, estatus);
846878 if (!ghes_estatus_cached(estatus)) {
847879 generic = estatus_node->generic;
848880 if (ghes_print_estatus(NULL, generic, estatus))
849881 ghes_estatus_cache_add(generic, estatus);
850882 }
851− gen_pool_free(ghes_estatus_pool, (unsigned long)estatus_node,
852− node_len);
883+
884+ if (task_work_pending && current->mm != &init_mm) {
885+ estatus_node->task_work.func = ghes_kick_task_work;
886+ estatus_node->task_work_cpu = smp_processor_id();
887+ ret = task_work_add(current, &estatus_node->task_work,
888+ true);
889+ if (ret)
890+ estatus_node->task_work.func = NULL;
891+ }
892+
893+ if (!estatus_node->task_work.func)
894+ gen_pool_free(ghes_estatus_pool,
895+ (unsigned long)estatus_node, node_len);
896+
853897 llnode = next;
854898 }
855899 }
@@ -909,6 +953,7 @@ static int ghes_in_nmi_queue_one_entry(struct ghes *ghes, · 53 unmodified lines
909953
910954 estatus_node->ghes = ghes;
911955 estatus_node->generic = ghes->generic;
956+ estatus_node->task_work.func = NULL;
912957 estatus = GHES_ESTATUS_FROM_NODE(estatus_node);
913958
914959 if (__ghes_read_estatus(estatus, buf_paddr, fixmap_idx, len)) {
drivers/acpi/dptf/dptf_power.c+138−9
@@ -10,12 +10,19 @@ · 9 unmodified lines
1010 #include <linux/platform_device.h>
1111
1212 /*
13− * Presentation of attributes which are defined for INT3407. They are:
13+ * Presentation of attributes which are defined for INT3407 and INT3532.
14+ * They are:
1415 * PMAX : Maximum platform powe
1516 * PSRC : Platform power source
1617 * ARTG : Adapter rating
1718 * CTYP : Charger type
1819 * PBSS : Battery steady power
20+ * PROP : Rest of worst case platform Power
21+ * PBSS : Power Battery Steady State
22+ * PBSS : Power Battery Steady State
23+ * RBHF : High Frequency Impedance
24+ * VBNL : Instantaneous No-Load Voltage
25+ * CMPP : Current Discharge Capability
1926 */
2027 #define DPTF_POWER_SHOW(name, object) \
2128 static ssize_t name##_show(struct device *dev,\
@@ -39,12 +46,42 @@ DPTF_POWER_SHOW(platform_power_source, PSRC) · 17 unmodified lines
3946 DPTF_POWER_SHOW(adapter_rating_mw, ARTG)
4047 DPTF_POWER_SHOW(battery_steady_power_mw, PBSS)
4148 DPTF_POWER_SHOW(charger_type, CTYP)
49+DPTF_POWER_SHOW(rest_of_platform_power_mw, PROP)
50+DPTF_POWER_SHOW(max_steady_state_power_mw, PBSS)
51+DPTF_POWER_SHOW(high_freq_impedance_mohm, RBHF)
52+DPTF_POWER_SHOW(no_load_voltage_mv, VBNL)
53+DPTF_POWER_SHOW(current_discharge_capbility_ma, CMPP);
4254
4355 static DEVICE_ATTR_RO(max_platform_power_mw);
4456 static DEVICE_ATTR_RO(platform_power_source);
4557 static DEVICE_ATTR_RO(adapter_rating_mw);
4658 static DEVICE_ATTR_RO(battery_steady_power_mw);
4759 static DEVICE_ATTR_RO(charger_type);
60+static DEVICE_ATTR_RO(rest_of_platform_power_mw);
61+static DEVICE_ATTR_RO(max_steady_state_power_mw);
62+static DEVICE_ATTR_RO(high_freq_impedance_mohm);
63+static DEVICE_ATTR_RO(no_load_voltage_mv);
64+static DEVICE_ATTR_RO(current_discharge_capbility_ma);
65+
66+static ssize_t prochot_confirm_store(struct device *dev,
67+ struct device_attribute *attr,
68+ const char *buf, size_t count)
69+{
70+ struct acpi_device *acpi_dev = dev_get_drvdata(dev);
71+ acpi_status status;
72+ int seq_no;
73+
74+ if (kstrtouint(buf, 0, &seq_no) < 0)
75+ return -EINVAL;
76+
77+ status = acpi_execute_simple_method(acpi_dev->handle, "PBOK", seq_no);
78+ if (ACPI_SUCCESS(status))
79+ return count;
80+
81+ return -EINVAL;
82+}
83+
84+static DEVICE_ATTR_WO(prochot_confirm);
4885
4986 static struct attribute *dptf_power_attrs[] = {
5087 &dev_attr_max_platform_power_mw.attr,
@@ -52,6 +89,8 @@ static struct attribute *dptf_power_attrs[] = { · 1 unmodified line
5289 &dev_attr_adapter_rating_mw.attr,
5390 &dev_attr_battery_steady_power_mw.attr,
5491 &dev_attr_charger_type.attr,
92+ &dev_attr_rest_of_platform_power_mw.attr,
93+ &dev_attr_prochot_confirm.attr,
5594 NULL
5695 };
5796
@@ -60,10 +99,79 @@ static const struct attribute_group dptf_power_attribute_group = { · 2 unmodified lines
6099 .name = "dptf_power"
61100 };
62101
102+static struct attribute *dptf_battery_attrs[] = {
103+ &dev_attr_max_platform_power_mw.attr,
104+ &dev_attr_max_steady_state_power_mw.attr,
105+ &dev_attr_high_freq_impedance_mohm.attr,
106+ &dev_attr_no_load_voltage_mv.attr,
107+ &dev_attr_current_discharge_capbility_ma.attr,
108+ NULL
109+};
110+
111+static const struct attribute_group dptf_battery_attribute_group = {
112+ .attrs = dptf_battery_attrs,
113+ .name = "dptf_battery"
114+};
115+
116+#define MAX_POWER_CHANGED 0x80
117+#define POWER_STATE_CHANGED 0x81
118+#define STEADY_STATE_POWER_CHANGED 0x83
119+#define POWER_PROP_CHANGE_EVENT 0x84
120+#define IMPEDANCED_CHNGED 0x85
121+#define VOLTAGE_CURRENT_CHANGED 0x86
122+
123+static long long dptf_participant_type(acpi_handle handle)
124+{
125+ unsigned long long ptype;
126+ acpi_status status;
127+
128+ status = acpi_evaluate_integer(handle, "PTYP", NULL, &ptype);
129+ if (ACPI_FAILURE(status))
130+ return -ENODEV;
131+
132+ return ptype;
133+}
134+
135+static void dptf_power_notify(acpi_handle handle, u32 event, void *data)
136+{
137+ struct platform_device *pdev = data;
138+ char *attr;
139+
140+ switch (event) {
141+ case POWER_STATE_CHANGED:
142+ attr = "platform_power_source";
143+ break;
144+ case POWER_PROP_CHANGE_EVENT:
145+ attr = "rest_of_platform_power_mw";
146+ break;
147+ case MAX_POWER_CHANGED:
148+ attr = "max_platform_power_mw";
149+ break;
150+ case STEADY_STATE_POWER_CHANGED:
151+ attr = "max_steady_state_power_mw";
152+ break;
153+ case VOLTAGE_CURRENT_CHANGED:
154+ attr = "no_load_voltage_mv";
155+ break;
156+ default:
157+ dev_err(&pdev->dev, "Unsupported event [0x%x]\n", event);
158+ return;
159+ }
160+
161+ /*
162+ * Notify that an attribute is changed, so that user space can read
163+ * again.
164+ */
165+ if (dptf_participant_type(handle) == 0x0CULL)
166+ sysfs_notify(&pdev->dev.kobj, "dptf_battery", attr);
167+ else
168+ sysfs_notify(&pdev->dev.kobj, "dptf_power", attr);
169+}
170+
63171 static int dptf_power_add(struct platform_device *pdev)
64172 {
173+ const struct attribute_group *attr_group;
65174 struct acpi_device *acpi_dev;
66− acpi_status status;
67175 unsigned long long ptype;
68176 int result;
69177
@@ -71,17 +179,29 @@ static int dptf_power_add(struct platform_device *pdev) · 1 unmodified line
71179 if (!acpi_dev)
72180 return -ENODEV;
73181
74− status = acpi_evaluate_integer(acpi_dev->handle, "PTYP", NULL, &ptype);
75− if (ACPI_FAILURE(status))
182+ ptype = dptf_participant_type(acpi_dev->handle);
183+ if (ptype == 0x11)
184+ attr_group = &dptf_power_attribute_group;
185+ else if (ptype == 0x0C)
186+ attr_group = &dptf_battery_attribute_group;
187+ else
76188 return -ENODEV;
77189
78− if (ptype != 0x11)
79− return -ENODEV;
190+ result = acpi_install_notify_handler(acpi_dev->handle,
191+ ACPI_DEVICE_NOTIFY,
192+ dptf_power_notify,
193+ (void *)pdev);
194+ if (result)
195+ return result;
80196
81197 result = sysfs_create_group(&pdev->dev.kobj,
82− &dptf_power_attribute_group);
83− if (result)
198+ attr_group);
199+ if (result) {
200+ acpi_remove_notify_handler(acpi_dev->handle,
201+ ACPI_DEVICE_NOTIFY,
202+ dptf_power_notify);
84203 return result;
204+ }
85205
86206 platform_set_drvdata(pdev, acpi_dev);
87207
@@ -90,14 +210,23 @@ static int dptf_power_add(struct platform_device *pdev) · 2 unmodified lines
90210
91211 static int dptf_power_remove(struct platform_device *pdev)
92212 {
213+ struct acpi_device *acpi_dev = platform_get_drvdata(pdev);
214+
215+ acpi_remove_notify_handler(acpi_dev->handle,
216+ ACPI_DEVICE_NOTIFY,
217+ dptf_power_notify);
93218
94− sysfs_remove_group(&pdev->dev.kobj, &dptf_power_attribute_group);
219+ if (dptf_participant_type(acpi_dev->handle) == 0x0CULL)
220+ sysfs_remove_group(&pdev->dev.kobj, &dptf_battery_attribute_group);
221+ else
222+ sysfs_remove_group(&pdev->dev.kobj, &dptf_power_attribute_group);
95223
96224 return 0;
97225 }
98226
99227 static const struct acpi_device_id int3407_device_ids[] = {
100228 {"INT3407", 0},
229+ {"INT3532", 0},
101230 {"INTC1047", 0},
102231 {"", 0},
103232 };
drivers/acpi/pmic/intel_pmic_chtdc_ti.c+1−0
@@ -102,6 +102,7 @@ static struct intel_pmic_opregion_data chtdc_ti_pmic_opregion_data = { · 101 unmodified lines
102102 .power_table_count = ARRAY_SIZE(chtdc_ti_power_table),
103103 .thermal_table = chtdc_ti_thermal_table,
104104 .thermal_table_count = ARRAY_SIZE(chtdc_ti_thermal_table),
105+ .pmic_i2c_address = 0x5e,
105106 };
106107
107108 static int chtdc_ti_pmic_opregion_probe(struct platform_device *pdev)
drivers/acpi/video_detect.c+10−0
@@ -361,6 +361,16 @@ static const struct dmi_system_id video_detect_dmi_table[] = { · 360 unmodified lines
361361 DMI_MATCH(DMI_BOARD_NAME, "JV50"),
362362 },
363363 },
364+ {
365+ /* https://bugzilla.kernel.org/show_bug.cgi?id=207835 */
366+ .callback = video_detect_force_native,
367+ .ident = "Acer TravelMate 5735Z",
368+ .matches = {
369+ DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
370+ DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 5735Z"),
371+ DMI_MATCH(DMI_BOARD_NAME, "BA51_MV"),
372+ },
373+ },
364374
365375 /*
366376 * Desktops which falsely report a backlight and which our heuristics
include/acpi/ghes.h+3−0
@@ -33,6 +33,9 @@ struct ghes_estatus_node { · 32 unmodified lines
3333 struct llist_node llnode;
3434 struct acpi_hest_generic *generic;
3535 struct ghes *ghes;
36+
37+ int task_work_cpu;
38+ struct callback_head task_work;
3639 };
3740
3841 struct ghes_estatus_cache {
include/linux/mm.h+1−0
@@ -3012,6 +3012,7 @@ enum mf_flags { · 3011 unmodified lines
30123012 };
30133013 extern int memory_failure(unsigned long pfn, int flags);
30143014 extern void memory_failure_queue(unsigned long pfn, int flags);
3015+extern void memory_failure_queue_kick(int cpu);
30153016 extern int unpoison_memory(unsigned long pfn);
30163017 extern int get_hwpoison_page(struct page *page);
30173018 #define put_hwpoison_page(page) put_page(page)
mm/memory-failure.c+14−1
@@ -1493,7 +1493,7 @@ static void memory_failure_work_func(struct work_struct *work) · 1492 unmodified lines
14931493 unsigned long proc_flags;
14941494 int gotten;
14951495
1496− mf_cpu = this_cpu_ptr(&memory_failure_cpu);
1496+ mf_cpu = container_of(work, struct memory_failure_cpu, work);
14971497 for (;;) {
14981498 spin_lock_irqsave(&mf_cpu->lock, proc_flags);
14991499 gotten = kfifo_get(&mf_cpu->fifo, &entry);
@@ -1507,6 +1507,19 @@ static void memory_failure_work_func(struct work_struct *work) · 7 unmodified lines
15071507 }
15081508 }
15091509
1510+/*
1511+ * Process memory_failure work queued on the specified CPU.
1512+ * Used to avoid return-to-userspace racing with the memory_failure workqueue.
1513+ */
1514+void memory_failure_queue_kick(int cpu)
1515+{
1516+ struct memory_failure_cpu *mf_cpu;
1517+
1518+ mf_cpu = &per_cpu(memory_failure_cpu, cpu);
1519+ cancel_work_sync(&mf_cpu->work);
1520+ memory_failure_work_func(&mf_cpu->work);
1521+}
1522+
15101523 static int __init memory_failure_init(void)
15111524 {
15121525 struct memory_failure_cpu *mf_cpu;