Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5614498imu; Mon, 26 Nov 2018 03:02:23 -0800 (PST) X-Google-Smtp-Source: AFSGD/X7a8oc0Y3uJ/MmPy+o76YqLlo7q5jfaIQRBpw9HP32i/S/xb4WoxFBwoPeXY3vPGIpVfVi X-Received: by 2002:a63:1e17:: with SMTP id e23mr24161867pge.130.1543230143478; Mon, 26 Nov 2018 03:02:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543230143; cv=none; d=google.com; s=arc-20160816; b=JsaxEPE2jY7lbeEzFP4HzChLTz0emETum+dQjx3XLFyIOqghseBFXWlP9Dmb55+Lks VTQ/IXyDxoLEH8sCANPj0W6oDHcI0GSA5Z/GikCf6WruJTJGDfkneT6TwcsAQqplE2EQ cIIfL+DkF5dUn3/wcwbBj4tvXZRVVv3zsEpZvd15y1p2u2DTsemxxVnpyjIrjN3Wy+lK rV7LgOclPdTatGju3PSZEMHuAh22epeyAMSusGD6bpGxPmbZcfY+p6D0tIYRX0W2TiYr SrUgAfCv+H+RntdnEqGIaf+GxhSro0kJIbO164EyKB62RjKuTowsPK0RNiKEdtrGRFz8 bz4Q== 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=KRQjOb5M8xDHshu5yDCxUUmubKhb9Jdb46JiZfzHmCA=; b=TLihfA07P4jmmYpHgx5pBQhpM0OtN3TjtmVZw6KdMTMfR9hZzMxNDgJrWytorkVM4s xUysRYboXFxik20+AS1ByO4CoDXro0cGfCm+HF+8Uamxqj2pKHUGej2DxJRuvJXrOeMm h6bUeMY1MaDm2FqCyiNIuQ4xd1vlHjicA06kvLabuGyl7lcqjJy4U1YJvMMU35QzQ4I7 a5KTzad2UWWfx6lMCahQN7/xZcZCJ1gDMCbbYHqvFID5fAtaY2TYEqCglwibq3doZIV5 VuS7yAtMdalMpapbDyk5/H3ndpg9HxYt+SHe95XY8sKcjgA3x8KfS5kGjqebpmjDQUIK J0TA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=k4rOLw87; 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 g32si61643617pgg.400.2018.11.26.03.02.07; Mon, 26 Nov 2018 03:02:23 -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=k4rOLw87; 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 S1729823AbeKZVyJ (ORCPT + 99 others); Mon, 26 Nov 2018 16:54:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:36080 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728039AbeKZVyJ (ORCPT ); Mon, 26 Nov 2018 16:54:09 -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 27E90214C4; Mon, 26 Nov 2018 11:00:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543230023; bh=2xEgGal1hKWUSJU2Jmyu0vXFwYqU3/nww2yReyi7TtM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k4rOLw87vfKM+fTGSRZIJBgr0RcDv8SYMfEdHp0pyntVHEGmbqib7Ca2lM+/mykRF x30Pxg9cLK1spGLacfpGfNthHy+zZbGf+sPBZrNw30vt0Vz70JRh/S6uBv7B1YE8mw fZtu1R7E4jkZiAXTivxzMJEiZk6ilmwfYd37bu98= 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.14 42/62] ACPI / watchdog: Prefer iTCO_wdt always when WDAT table uses RTC SRAM Date: Mon, 26 Nov 2018 11:51:23 +0100 Message-Id: <20181126105054.026794176@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181126105050.592727680@linuxfoundation.org> References: <20181126105050.592727680@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.14-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 4bde16fb97d8..95600309ce42 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