Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5612007imu; Mon, 26 Nov 2018 03:00:35 -0800 (PST) X-Google-Smtp-Source: AFSGD/VfJqz6YpeUip83UQEYtfBnhbJAGJJvQhzOxT0bnkudb2gEP5xXUtw/RGtPpbiR+57vAmQz X-Received: by 2002:a17:902:15c5:: with SMTP id a5-v6mr26802446plh.136.1543230035518; Mon, 26 Nov 2018 03:00:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543230035; cv=none; d=google.com; s=arc-20160816; b=IEhrWR+VqutuUjZI9Z9FoFzt2z5vDEgDvkynPK5kKw4pJ9/lsVgYqZs3FSAPyzfyzz vBKSnvyO1J+G4nERjsNfLpZ7cqPMjIJg76sSfxmQhmci4pcEyanN9s2CSgJHvEWLlbl7 aG/LSCX01RvkkhHQlaBVfOqw2WDBgp64dmXgMFYOX61rfqmhqlHIvV39Bivr95SaFMXn z095HPXNf6c0ooK9w/uy62D2lnQSzc60D+qlM/CqHGH7aVIssWWKm8kv1t/p+eRlvy+M +2WraMs22OGR9sWOt8tXK1LYbhdeO5EQRCHTKYsV8KKI4pXTNfCNNOFsfGMTW+Q4ipUw 0RRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=19yUlR2eOYK79xPNvpxB1q6zUTEWGPJ4oamERsZAs5M=; b=hh6MPVqcn8bLZOmuPCusZMBK6gb4717GdWpafZdxESm1dS48r7sfVDQgqWDWDeytor itF2rfrSuq5aSXRwm9fEzEVPIyrIuXsxCdV/D3iKILUKuMvcJCnEhI3Ys4f+qyKlrSog qiUJmdjxtK6y5IbUrNmYjOhIytkpyfrMcGIKm5mZAJRgdtKpxKBWAW/lDc1B1b00ZQop AxR9P2oGrRQTfJCwsUICLMgqjNDbUgEWnge+qyYUbfyQ+1HyQXeEV0ZkBYyT8omdcHis Ks3YPEyj0ce+xJaHKxhYy1WYh3OFrO33WmUJtO8B4WixtmeY3jHPueA/7T5W1y4OsNak PSCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TcC28WNA; 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 q14si60490937pgq.197.2018.11.26.03.00.20; Mon, 26 Nov 2018 03:00:35 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=TcC28WNA; 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 S1728955AbeKZVv1 (ORCPT + 99 others); Mon, 26 Nov 2018 16:51:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:60848 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726200AbeKZVv1 (ORCPT ); Mon, 26 Nov 2018 16:51:27 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E374820817; Mon, 26 Nov 2018 10:57:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543229862; bh=G3k+FTa+WkB+wh7BqmilwAEZZOLY1LmvG6VNeEaPPms=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TcC28WNAr6d84xXv48jTgzKPylV7JemDownVsZKNkvzcSL7Znq3ha0nR48ubfplBA 25ZDGL/3O4tv5i2u8Nl76bYOcH5EWF7zZAq3KotcptfACwYXVr7pDrovzwp900Frbk zPYgF0EUP3vjeeFi3B2GISgeCm1yhdiRyR87kzs4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnold Guy , Alois Nespor , Yury Pakin , Ihor Chyhin , Mika Westerberg , Guenter Roeck , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 4.9 29/46] ACPI / watchdog: Prefer iTCO_wdt always when WDAT table uses RTC SRAM Date: Mon, 26 Nov 2018 11:51:18 +0100 Message-Id: <20181126105048.880481831@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181126105045.447291262@linuxfoundation.org> References: <20181126105045.447291262@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 5a802a7a285c8877ca872e44eeb0f06afcb5212f ] After we added quirk for Lenovo Z50-70 it turns out there are at least two more systems where WDAT table includes instructions accessing RTC SRAM. Instead of quirking each system separately, look for such instructions in the table and automatically prefer iTCO_wdt if found. Link: https://bugzilla.kernel.org/show_bug.cgi?id=199033 Reported-by: Arnold Guy Reported-by: Alois Nespor Reported-by: Yury Pakin Reported-by: Ihor Chyhin Signed-off-by: Mika Westerberg Acked-by: Guenter Roeck Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/acpi/acpi_watchdog.c | 72 ++++++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 27 deletions(-) diff --git a/drivers/acpi/acpi_watchdog.c b/drivers/acpi/acpi_watchdog.c index ca2724893541..396e358c2cee 100644 --- a/drivers/acpi/acpi_watchdog.c +++ b/drivers/acpi/acpi_watchdog.c @@ -12,35 +12,51 @@ #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"), - }, - }, - {} -}; +#ifdef CONFIG_RTC_MC146818_LIB +#include + +/* + * There are several systems where the WDAT table is accessing RTC SRAM to + * store persistent information. This does not work well with the Linux RTC + * driver so on those systems we skip WDAT driver and prefer iTCO_wdt + * instead. + * + * See also https://bugzilla.kernel.org/show_bug.cgi?id=199033. + */ +static bool acpi_watchdog_uses_rtc(const struct acpi_table_wdat *wdat) +{ + const struct acpi_wdat_entry *entries; + int i; + + entries = (struct acpi_wdat_entry *)(wdat + 1); + for (i = 0; i < wdat->entries; i++) { + const struct acpi_generic_address *gas; + + gas = &entries[i].register_region; + if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_IO) { + switch (gas->address) { + case RTC_PORT(0): + case RTC_PORT(1): + case RTC_PORT(2): + case RTC_PORT(3): + return true; + } + } + } + + return false; +} +#else +static bool acpi_watchdog_uses_rtc(const struct acpi_table_wdat *wdat) +{ + return false; +} +#endif static const struct acpi_table_wdat *acpi_watchdog_get_wdat(void) { @@ -50,9 +66,6 @@ static const struct acpi_table_wdat *acpi_watchdog_get_wdat(void) 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)) { @@ -60,6 +73,11 @@ static const struct acpi_table_wdat *acpi_watchdog_get_wdat(void) return NULL; } + if (acpi_watchdog_uses_rtc(wdat)) { + pr_info("Skipping WDAT on this system because it uses RTC SRAM\n"); + return NULL; + } + return wdat; } -- 2.17.1