From patchwork Mon Feb 10 21:07:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 24421 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f70.google.com (mail-vb0-f70.google.com [209.85.212.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5615F20143 for ; Mon, 10 Feb 2014 21:07:58 +0000 (UTC) Received: by mail-vb0-f70.google.com with SMTP id w17sf15630964vbj.9 for ; Mon, 10 Feb 2014 13:07:57 -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=Y0fFifRyw/iOUVPRjTgdhTJu+WtLG0DXhDW1iwY1Tej7dHyAB7Lu4X5r76Ljk0fcOu asQ8jIASK8NKpO9f4lGme4VqyvXobaKO4o+xRxSIEjNqxJ+OuAE9MUn9II4DmZegZb3A cI77gp2EWSxaB6NXrKWHV5dQMTuHZ1TpxDy69bbA1/j5IPJr8zXQNy+6m9tXx45vvu61 XcNdDqzXoEPfUaeATjA07ITsaNcJs4yQ/v1rlYEq8FYU3JAis+HE1ZNVYz+rAwRA2/1e PM9Gzz59oDoRzigt/DL4iJ1XvSOGS8ih62HoEY6d2o5lzbiNrSjneuTUzG8pN+lu7VM/ JNZQ== X-Gm-Message-State: ALoCoQk0oTB5S0+9S0djr95WKPDMLSWuSjJe28YhkymBz/a1ZOVR6+7hYTwVTtm+u58aalBT91QY X-Received: by 10.236.109.97 with SMTP id r61mr7461570yhg.24.1392066477331; Mon, 10 Feb 2014 13:07:57 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.41.202 with SMTP id z68ls2270217qgz.85.gmail; Mon, 10 Feb 2014 13:07:57 -0800 (PST) X-Received: by 10.58.255.233 with SMTP id at9mr8279648ved.20.1392066477205; Mon, 10 Feb 2014 13:07:57 -0800 (PST) Received: from mail-ve0-f177.google.com (mail-ve0-f177.google.com [209.85.128.177]) by mx.google.com with ESMTPS id sq4si5136435vdc.132.2014.02.10.13.07.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Feb 2014 13:07:57 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.177 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.177; Received: by mail-ve0-f177.google.com with SMTP id jz11so5311921veb.8 for ; Mon, 10 Feb 2014 13:07:57 -0800 (PST) X-Received: by 10.52.118.33 with SMTP id kj1mr2329272vdb.33.1392066477067; Mon, 10 Feb 2014 13:07:57 -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 u4csp197782vcz; Mon, 10 Feb 2014 13:07:56 -0800 (PST) X-Received: by 10.66.26.176 with SMTP id m16mr11373666pag.142.1392066463716; Mon, 10 Feb 2014 13:07:43 -0800 (PST) Received: from mail-pa0-f47.google.com (mail-pa0-f47.google.com [209.85.220.47]) by mx.google.com with ESMTPS id bf5si16603867pad.233.2014.02.10.13.07.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Feb 2014 13:07:43 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.47 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.220.47; Received: by mail-pa0-f47.google.com with SMTP id kp14so6660866pab.6 for ; Mon, 10 Feb 2014 13:07:43 -0800 (PST) X-Received: by 10.68.129.5 with SMTP id ns5mr11375337pbb.147.1392066463227; Mon, 10 Feb 2014 13:07:43 -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 bz4sm45596387pbb.12.2014.02.10.13.07.41 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Feb 2014 13:07:41 -0800 (PST) From: John Stultz To: stable Cc: Borislav Petkov , Brecht Machiels , Thomas Gleixner , John Stultz , Rabin Vincent , Borislav Petkov Subject: [PATCH 7/7] 3.13.y: rtc-cmos: Add an alarm disable quirk Date: Mon, 10 Feb 2014 13:07:24 -0800 Message-Id: <1392066444-4940-8-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1392066444-4940-1-git-send-email-john.stultz@linaro.org> References: <1392066444-4940-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.177 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;