From patchwork Mon Feb 10 21:11:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 24424 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f200.google.com (mail-ie0-f200.google.com [209.85.223.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3570820143 for ; Mon, 10 Feb 2014 21:12:04 +0000 (UTC) Received: by mail-ie0-f200.google.com with SMTP id tp5sf23548185ieb.3 for ; Mon, 10 Feb 2014 13:12:03 -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=Q5/esR6nkOjAYe3MKxpieFMLenW+HKLdzgdwnPTU4g8=; b=HAC/Bm5SbJTyMf+ygkAguxyaJYIT8Aho9u++9UhmgbOEeY47VK84ZoHlyzGCfvzoEi upPGHcY04j2r/NfX8g9D9FGXZCH8pOkYY32wMjVXWVxhx3XabrWFBLTd6WrRoiPa1KxX 6KE8uxvtq6fFmcLKL8z4Unzl6s3n2POW2+bUN7A2B6N7+viogTJqZ1CxW4ePrlC4UBMY U8VGlsutl92DivtqfZpGvkV8rK/YKG2XPb9epUGAylDv/VwHrAIJOE3J46DZ8VbDP1Uc t7/DgwzqKMWy1afVYOEXMVx/yVwl90QaCB8DuSxywRl+NnFH48YHJ1nBbkaE/4aYnH/l TUzg== X-Gm-Message-State: ALoCoQkdbTYBVT09+sx91IfojAEWx673GLzYCPKTjlwW23txbX92gVAzkXv/OqPz23Fl8kpzAkYL X-Received: by 10.182.126.137 with SMTP id my9mr13461776obb.13.1392066723249; Mon, 10 Feb 2014 13:12:03 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.29.102 with SMTP id a93ls2119090qga.33.gmail; Mon, 10 Feb 2014 13:12:03 -0800 (PST) X-Received: by 10.52.246.42 with SMTP id xt10mr21263448vdc.9.1392066723137; Mon, 10 Feb 2014 13:12:03 -0800 (PST) Received: from mail-vb0-f48.google.com (mail-vb0-f48.google.com [209.85.212.48]) by mx.google.com with ESMTPS id rl1si5149035vcb.149.2014.02.10.13.12.03 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Feb 2014 13:12:03 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.48 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.48; Received: by mail-vb0-f48.google.com with SMTP id q16so5214326vbe.35 for ; Mon, 10 Feb 2014 13:12:03 -0800 (PST) X-Received: by 10.220.10.2 with SMTP id n2mr2794815vcn.26.1392066723033; Mon, 10 Feb 2014 13:12:03 -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 u4csp198045vcz; Mon, 10 Feb 2014 13:12:02 -0800 (PST) X-Received: by 10.66.240.4 with SMTP id vw4mr27935562pac.26.1392066721884; Mon, 10 Feb 2014 13:12:01 -0800 (PST) Received: from mail-pa0-f54.google.com (mail-pa0-f54.google.com [209.85.220.54]) by mx.google.com with ESMTPS id gx4si16655575pbc.51.2014.02.10.13.11.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Feb 2014 13:12:01 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.54 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.220.54; Received: by mail-pa0-f54.google.com with SMTP id fa1so6718365pad.13 for ; Mon, 10 Feb 2014 13:11:59 -0800 (PST) X-Received: by 10.68.51.39 with SMTP id h7mr40007804pbo.101.1392066718934; Mon, 10 Feb 2014 13:11:58 -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 qh2sm119192622pab.13.2014.02.10.13.11.57 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Feb 2014 13:11:58 -0800 (PST) From: John Stultz To: stable Cc: Borislav Petkov , Brecht Machiels , Thomas Gleixner , John Stultz , Rabin Vincent , Borislav Petkov Subject: [PATCH 1/5] 3.10.y rtc-cmos: Add an alarm disable quirk Date: Mon, 10 Feb 2014 13:11:49 -0800 Message-Id: <1392066713-5025-2-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1392066713-5025-1-git-send-email-john.stultz@linaro.org> References: <1392066713-5025-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.212.48 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.10-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 f1cb706..6ae046b 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) @@ -1163,6 +1211,8 @@ static int __init cmos_init(void) platform_driver_registered = true; } + dmi_check_system(rtc_quirks); + if (retval == 0) return 0;