Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3794757imm; Mon, 18 Jun 2018 04:18:32 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLiW7JfFfONZSgqZIb5SMv3gGpzoSKTgBXxNB1foHh7JQ/4+ECtHrer7fKAmA5coJOlCAVW X-Received: by 2002:a17:902:42c3:: with SMTP id h61-v6mr13597966pld.319.1529320712537; Mon, 18 Jun 2018 04:18:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529320712; cv=none; d=google.com; s=arc-20160816; b=vxyHAhyXdAkVeXfRdxysWBVE74qdz0PHa0RYOeMdr4sJZbuo4noxwTbXXWTFV6dZKK 6I5mG5WWJ7VL4FxHiR2tsNWz/S7KLtsZYIE270WoqjLcem8c11QMP8Be6olb6Jt6rMI9 wUXIzQwIlZlrfE3RZQed1MqVCCZSukW6K6gWbeaBjdthuyG1CdBG315l9lfCbP6IJhKw OPDK2UcaCrKosAb8iCZSejf8I+PL/G+4k9m+wKD1R9dFhLnOEqxtweL5ywIrOiuqusHt bVimgL62uguupHr9ILmU2UymIdD/YzFK6JCotZgQ2aYPtP/CugT+zXzqgG6HrO3I8gwN MXpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=r8q4mouYYsX/3sPy+unsxtt7/JAwc9nvJahoM5G6pUE=; b=wjBBaR3dnt7ohcCsPSR0yM6I7hgVe/yBJBv4KWsCPYJTSAUlwniZeYlUy4K4Lw6xFx 5kwOTxifv3dVmLkkibAhQ7i9pHzGlfZQlhIr+OtoQH9pBzN5wj4X6fBrErK+aUju8EN/ 6ePs7IkDF3yQ6tzlMbzhYCcXq6DXCIH53xANm/tXok3CxYJxPAhwbhXucWvtXXe98R1T MGc8Yfz7PjwAENhEiEtj0pwHqMo3myqW2zNJMlTmj2KkgCSVpbqddhvYnIiFFoZKXXSw GtVt2gilPwLJzVlx+8jqYeDMyc9xlj7y6ROGVpCBi5s9Ycu4vBoe0BMxxEhNiSd7TPPB QeVw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k185-v6si11540629pgc.468.2018.06.18.04.18.19; Mon, 18 Jun 2018 04:18:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935294AbeFRISq (ORCPT + 99 others); Mon, 18 Jun 2018 04:18:46 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:54716 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935241AbeFRISo (ORCPT ); Mon, 18 Jun 2018 04:18:44 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 2C37ABAD; Mon, 18 Jun 2018 08:18:44 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Milley , Mika Westerberg , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 4.16 083/279] ACPI / watchdog: Prefer iTCO_wdt on Lenovo Z50-70 Date: Mon, 18 Jun 2018 10:11:08 +0200 Message-Id: <20180618080612.242764308@linuxfoundation.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180618080608.851973560@linuxfoundation.org> References: <20180618080608.851973560@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mika Westerberg [ Upstream commit a0a37862a4e1844793d39aca9ccb8fecbdcb8659 ] 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 Link: https://bugzilla.kernel.org/show_bug.cgi?id=199033 Signed-off-by: Mika Westerberg Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/acpi/acpi_watchdog.c | 59 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 49 insertions(+), 10 deletions(-) --- a/drivers/acpi/acpi_watchdog.c +++ b/drivers/acpi/acpi_watchdog.c @@ -12,23 +12,64 @@ #define pr_fmt(fmt) "ACPI: watchdog: " fmt #include +#include #include #include #include "internal.h" +static const struct dmi_system_id acpi_watchdog_skip[] = { + { + /* + * On Lenovo Z50-70 there are two issues with the WDAT + * table. First some of the instructions use RTC SRAM + * to store persistent information. This does not work well + * with Linux RTC driver. Second, more important thing is + * that the instructions do not actually reset the system. + * + * On this particular system iTCO_wdt seems to work just + * fine so we prefer that over WDAT for now. + * + * See also https://bugzilla.kernel.org/show_bug.cgi?id=199033. + */ + .ident = "Lenovo Z50-70", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_NAME, "20354"), + DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Z50-70"), + }, + }, + {} +}; + +static const struct acpi_table_wdat *acpi_watchdog_get_wdat(void) +{ + const struct acpi_table_wdat *wdat = NULL; + acpi_status status; + + if (acpi_disabled) + return NULL; + + if (dmi_check_system(acpi_watchdog_skip)) + return NULL; + + status = acpi_get_table(ACPI_SIG_WDAT, 0, + (struct acpi_table_header **)&wdat); + if (ACPI_FAILURE(status)) { + /* It is fine if there is no WDAT */ + return NULL; + } + + return wdat; +} + /** * Returns true if this system should prefer ACPI based watchdog instead of * the native one (which are typically the same hardware). */ bool acpi_has_watchdog(void) { - struct acpi_table_header hdr; - - if (acpi_disabled) - return false; - - return ACPI_SUCCESS(acpi_get_table_header(ACPI_SIG_WDAT, 0, &hdr)); + return !!acpi_watchdog_get_wdat(); } EXPORT_SYMBOL_GPL(acpi_has_watchdog); @@ -41,12 +82,10 @@ void __init acpi_watchdog_init(void) struct platform_device *pdev; struct resource *resources; size_t nresources = 0; - acpi_status status; int i; - status = acpi_get_table(ACPI_SIG_WDAT, 0, - (struct acpi_table_header **)&wdat); - if (ACPI_FAILURE(status)) { + wdat = acpi_watchdog_get_wdat(); + if (!wdat) { /* It is fine if there is no WDAT */ return; }