Skip to content

Commit a0a3786

Browse files
westerirafaeljw
authored andcommitted
ACPI / watchdog: Prefer iTCO_wdt on Lenovo Z50-70
WDAT table on Lenovo Z50-70 is using RTC SRAM (ports 0x70 and 0x71) to store state of the timer. This conflicts with Linux RTC driver (rtc-cmos.c) who fails to reserve those ports for itself preventing RTC from functioning. In addition the WDAT table seems not to be fully functional because it does not reset the system when the watchdog times out. On this system iTCO_wdt works just fine so we simply prefer to use it instead of WDAT. This makes RTC working again and also results working watchdog via iTCO_wdt. Reported-by: Peter Milley <pbmilley@gmail.com> Link: https://bugzilla.kernel.org/show_bug.cgi?id=199033 Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 6d08b06 commit a0a3786

1 file changed

Lines changed: 49 additions & 10 deletions

File tree

‎drivers/acpi/acpi_watchdog.c‎

Lines changed: 49 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,64 @@
1212
#define pr_fmt(fmt) "ACPI: watchdog: " fmt
1313

1414
#include <linux/acpi.h>
15+
#include <linux/dmi.h>
1516
#include <linux/ioport.h>
1617
#include <linux/platform_device.h>
1718

1819
#include "internal.h"
1920

21+
static const struct dmi_system_id acpi_watchdog_skip[] = {
22+
{
23+
/*
24+
* On Lenovo Z50-70 there are two issues with the WDAT
25+
* table. First some of the instructions use RTC SRAM
26+
* to store persistent information. This does not work well
27+
* with Linux RTC driver. Second, more important thing is
28+
* that the instructions do not actually reset the system.
29+
*
30+
* On this particular system iTCO_wdt seems to work just
31+
* fine so we prefer that over WDAT for now.
32+
*
33+
* See also https://bugzilla.kernel.org/show_bug.cgi?id=199033.
34+
*/
35+
.ident = "Lenovo Z50-70",
36+
.matches = {
37+
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
38+
DMI_MATCH(DMI_PRODUCT_NAME, "20354"),
39+
DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Z50-70"),
40+
},
41+
},
42+
{}
43+
};
44+
45+
static const struct acpi_table_wdat *acpi_watchdog_get_wdat(void)
46+
{
47+
const struct acpi_table_wdat *wdat = NULL;
48+
acpi_status status;
49+
50+
if (acpi_disabled)
51+
return NULL;
52+
53+
if (dmi_check_system(acpi_watchdog_skip))
54+
return NULL;
55+
56+
status = acpi_get_table(ACPI_SIG_WDAT, 0,
57+
(struct acpi_table_header **)&wdat);
58+
if (ACPI_FAILURE(status)) {
59+
/* It is fine if there is no WDAT */
60+
return NULL;
61+
}
62+
63+
return wdat;
64+
}
65+
2066
/**
2167
* Returns true if this system should prefer ACPI based watchdog instead of
2268
* the native one (which are typically the same hardware).
2369
*/
2470
bool acpi_has_watchdog(void)
2571
{
26-
struct acpi_table_header hdr;
27-
28-
if (acpi_disabled)
29-
return false;
30-
31-
return ACPI_SUCCESS(acpi_get_table_header(ACPI_SIG_WDAT, 0, &hdr));
72+
return !!acpi_watchdog_get_wdat();
3273
}
3374
EXPORT_SYMBOL_GPL(acpi_has_watchdog);
3475

@@ -41,12 +82,10 @@ void __init acpi_watchdog_init(void)
4182
struct platform_device *pdev;
4283
struct resource *resources;
4384
size_t nresources = 0;
44-
acpi_status status;
4585
int i;
4686

47-
status = acpi_get_table(ACPI_SIG_WDAT, 0,
48-
(struct acpi_table_header **)&wdat);
49-
if (ACPI_FAILURE(status)) {
87+
wdat = acpi_watchdog_get_wdat();
88+
if (!wdat) {
5089
/* It is fine if there is no WDAT */
5190
return;
5291
}

0 commit comments

Comments
 (0)