From patchwork Mon Feb 10 21:16:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 24428 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f200.google.com (mail-ob0-f200.google.com [209.85.214.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B3A2E20143 for ; Mon, 10 Feb 2014 21:16:40 +0000 (UTC) Received: by mail-ob0-f200.google.com with SMTP id wo20sf28225978obc.7 for ; Mon, 10 Feb 2014 13:16:39 -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=IW8kdxP3I3/TdNp2UUFL+pcDziOx40xhwxVp908gtrU=; b=ORS0cPBF0TrXUbvzh5XK++E5Xul4kujVD1nif0jIZnhdduwdcpXIan3Tgckp/51oHh Y4D4zIcKtTOEKjSdmkP4X5i5zi/doFBlpp2ZA2mqrdr7xCN1qTf1wmBLzzwXvEkZTD19 tjgaHOoU6sFlV9eiWufCEdgka7RWMzpMZLnty8i/fUrUoZEvEJYm/WJRgVvYNT9v4Dno Z4Kv2UM9tqkkQPUGCBW+qxHFIxaLFYIDEiBnQqtkBFURbvrbtiiPR4bri59pmM7BWjzc 0sk8q5Xkg2N+NvTugsm81T8vLuVhNeutIOTMaozRJ9VYaMKx/uygFDj9e/demzc2je0c lRtQ== X-Gm-Message-State: ALoCoQn5tSiUAclzX2Vml/sh7MUXEx0yQHjtOtCDpqVSeZVsytkFB4QpzKx9ITyaoTS0Kv7fcHjS X-Received: by 10.42.51.141 with SMTP id e13mr6400380icg.28.1392066999655; Mon, 10 Feb 2014 13:16:39 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.32.116 with SMTP id g107ls2366406qgg.49.gmail; Mon, 10 Feb 2014 13:16:39 -0800 (PST) X-Received: by 10.58.161.227 with SMTP id xv3mr1801782veb.31.1392066999539; Mon, 10 Feb 2014 13:16:39 -0800 (PST) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id wm4si5169841vcb.4.2014.02.10.13.16.39 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Feb 2014 13:16:39 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id ks9so5152149vcb.39 for ; Mon, 10 Feb 2014 13:16:39 -0800 (PST) X-Received: by 10.52.94.77 with SMTP id da13mr57882vdb.55.1392066999445; Mon, 10 Feb 2014 13:16:39 -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 u4csp198268vcz; Mon, 10 Feb 2014 13:16:38 -0800 (PST) X-Received: by 10.69.20.139 with SMTP id hc11mr40112769pbd.63.1392066998517; Mon, 10 Feb 2014 13:16:38 -0800 (PST) Received: from mail-pb0-f43.google.com (mail-pb0-f43.google.com [209.85.160.43]) by mx.google.com with ESMTPS id sj5si16661676pab.81.2014.02.10.13.16.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Feb 2014 13:16:38 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.43 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.160.43; Received: by mail-pb0-f43.google.com with SMTP id md12so6793215pbc.30 for ; Mon, 10 Feb 2014 13:16:38 -0800 (PST) X-Received: by 10.66.241.73 with SMTP id wg9mr28452972pac.69.1392066998127; Mon, 10 Feb 2014 13:16:38 -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 bc4sm45674905pbb.2.2014.02.10.13.16.36 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Feb 2014 13:16:37 -0800 (PST) From: John Stultz To: stable Cc: Borislav Petkov , Brecht Machiels , Thomas Gleixner , John Stultz , Rabin Vincent , Borislav Petkov Subject: [PATCH 1/3] 3.4.y: rtc-cmos: Add an alarm disable quirk Date: Mon, 10 Feb 2014 13:16:27 -0800 Message-Id: <1392066989-5113-2-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1392066989-5113-1-git-send-email-john.stultz@linaro.org> References: <1392066989-5113-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.220.180 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.4-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 5f8844c..5f2eddb 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) @@ -1166,6 +1214,8 @@ static int __init cmos_init(void) platform_driver_registered = true; } + dmi_check_system(rtc_quirks); + if (retval == 0) return 0;