From patchwork Thu Jan 23 01:34:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 23564 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f71.google.com (mail-oa0-f71.google.com [209.85.219.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B8E90218E2 for ; Thu, 23 Jan 2014 01:35:25 +0000 (UTC) Received: by mail-oa0-f71.google.com with SMTP id g12sf4515960oah.10 for ; Wed, 22 Jan 2014 17:35:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=aS2w4idpU30nqyEzFrApnvanasv9suf0WXC7cQN1aaY=; b=iMuchjfwpyzXw4vq7qWr+PWyYdF4+G31ONvjitlBrVvX/EYNyRQVB1yHCCYGGPTgOk +PgnIPRHmz7YU8i2mVg79v4Hcfa4ZyT5G3UJHeDOW1xOCs1JDqN0F0PLYI+ZwsjZ72hW PfB3SfHiLfc+qH5A9nqah83nvOg82fs/JItPMZW+fsaK+DboxK6eaUPE5h9LW5+iL/4G 1j1fIhAUQEQQQvUa2drIOoEWgn+sicWethKRQlfP7BSB4+d0tg9oOE4WMrwqZJnaM/Yt AzTokrWqTreW+tV7yB8U8cKwDuDplQU194IOrDOgG5IcYGUEvB3upWFyQCYremZFIjfT vEIQ== X-Gm-Message-State: ALoCoQmaNHKzqsRpSlTlF6l4FH/61KvDitDf2vbU9h4dRNmQyO/mOCbx9bgDR0XW79pMsx3i4fCF X-Received: by 10.182.126.137 with SMTP id my9mr1964700obb.13.1390440924792; Wed, 22 Jan 2014 17:35:24 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.38.36 with SMTP id d4ls8334qek.28.gmail; Wed, 22 Jan 2014 17:35:24 -0800 (PST) X-Received: by 10.58.80.103 with SMTP id q7mr3035893vex.33.1390440924651; Wed, 22 Jan 2014 17:35:24 -0800 (PST) Received: from mail-ve0-f170.google.com (mail-ve0-f170.google.com [209.85.128.170]) by mx.google.com with ESMTPS id kp12si5674372vcb.91.2014.01.22.17.35.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 22 Jan 2014 17:35:24 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.170; Received: by mail-ve0-f170.google.com with SMTP id cz12so744985veb.1 for ; Wed, 22 Jan 2014 17:35:24 -0800 (PST) X-Received: by 10.58.37.67 with SMTP id w3mr3030699vej.22.1390440924559; Wed, 22 Jan 2014 17:35:24 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp224923vcz; Wed, 22 Jan 2014 17:35:24 -0800 (PST) X-Received: by 10.66.136.131 with SMTP id qa3mr4938909pab.77.1390440920015; Wed, 22 Jan 2014 17:35:20 -0800 (PST) Received: from mail-pd0-f173.google.com (mail-pd0-f173.google.com [209.85.192.173]) by mx.google.com with ESMTPS id qx4si11861775pbc.315.2014.01.22.17.35.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 22 Jan 2014 17:35:19 -0800 (PST) Received-SPF: neutral (google.com: 209.85.192.173 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.192.173; Received: by mail-pd0-f173.google.com with SMTP id y10so1120877pdj.32 for ; Wed, 22 Jan 2014 17:35:19 -0800 (PST) X-Received: by 10.66.192.162 with SMTP id hh2mr5040077pac.150.1390440919596; Wed, 22 Jan 2014 17:35:19 -0800 (PST) Received: from localhost.localdomain (c-67-170-153-23.hsd1.or.comcast.net. [67.170.153.23]) by mx.google.com with ESMTPSA id j3sm29268483pbh.38.2014.01.22.17.35.18 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 22 Jan 2014 17:35:18 -0800 (PST) From: John Stultz To: stable Cc: Borislav Petkov , Brecht Machiels , Thomas Gleixner , John Stultz , Rabin Vincent , Borislav Petkov Subject: [PATCH 6/6] 3.13.y: rtc-cmos: Add an alarm disable quirk Date: Wed, 22 Jan 2014 17:34:59 -0800 Message-Id: <1390440899-10273-7-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1390440899-10273-1-git-send-email-john.stultz@linaro.org> References: <1390440899-10273-1-git-send-email-john.stultz@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Borislav Petkov This is a 3.13-stable backport of d5a1c7e3fc38d9c7d629e1e47f32f863acbdec3d 41c7f7424259f ("rtc: Disable the alarm in the hardware (v2)") added the functionality to disable the RTC wake alarm when shutting down the box. However, there are at least two b0rked BIOSes we know about: https://bugzilla.novell.com/show_bug.cgi?id=812592 https://bugzilla.novell.com/show_bug.cgi?id=805740 where, when wakeup alarm is enabled in the BIOS, the machine reboots automatically right after shutdown, regardless of what wakeup time is programmed. Bisecting the issue lead to this patch so disable its functionality with a DMI quirk only for those boxes. Cc: Brecht Machiels Cc: Thomas Gleixner Cc: John Stultz Cc: Rabin Vincent Cc: stable Signed-off-by: Borislav Petkov [jstultz: Changed variable name for clarity, added extra dmi entry] Tested-by: Brecht Machiels Tested-by: Borislav Petkov Signed-off-by: John Stultz --- drivers/rtc/rtc-cmos.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c index f148762..a2325bc 100644 --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c @@ -34,11 +34,11 @@ #include #include #include -#include #include #include #include #include +#include /* this is for "generic access to PC-style RTC" using CMOS_READ/CMOS_WRITE */ #include @@ -377,6 +377,51 @@ static int cmos_set_alarm(struct device *dev, struct rtc_wkalrm *t) return 0; } +/* + * Do not disable RTC alarm on shutdown - workaround for b0rked BIOSes. + */ +static bool alarm_disable_quirk; + +static int __init set_alarm_disable_quirk(const struct dmi_system_id *id) +{ + alarm_disable_quirk = true; + pr_info("rtc-cmos: BIOS has alarm-disable quirk. "); + pr_info("RTC alarms disabled\n"); + return 0; +} + +static const struct dmi_system_id rtc_quirks[] __initconst = { + /* https://bugzilla.novell.com/show_bug.cgi?id=805740 */ + { + .callback = set_alarm_disable_quirk, + .ident = "IBM Truman", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), + DMI_MATCH(DMI_PRODUCT_NAME, "4852570"), + }, + }, + /* https://bugzilla.novell.com/show_bug.cgi?id=812592 */ + { + .callback = set_alarm_disable_quirk, + .ident = "Gigabyte GA-990XA-UD3", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, + "Gigabyte Technology Co., Ltd."), + DMI_MATCH(DMI_PRODUCT_NAME, "GA-990XA-UD3"), + }, + }, + /* http://permalink.gmane.org/gmane.linux.kernel/1604474 */ + { + .callback = set_alarm_disable_quirk, + .ident = "Toshiba Satellite L300", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), + DMI_MATCH(DMI_PRODUCT_NAME, "Satellite L300"), + }, + }, + {} +}; + static int cmos_alarm_irq_enable(struct device *dev, unsigned int enabled) { struct cmos_rtc *cmos = dev_get_drvdata(dev); @@ -385,6 +430,9 @@ static int cmos_alarm_irq_enable(struct device *dev, unsigned int enabled) if (!is_valid_irq(cmos->irq)) return -EINVAL; + if (alarm_disable_quirk) + return 0; + spin_lock_irqsave(&rtc_lock, flags); if (enabled) @@ -1157,6 +1205,8 @@ static int __init cmos_init(void) platform_driver_registered = true; } + dmi_check_system(rtc_quirks); + if (retval == 0) return 0;