From patchwork Thu Jan 2 22:23:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 22871 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f71.google.com (mail-pa0-f71.google.com [209.85.220.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6788223FE2 for ; Thu, 2 Jan 2014 22:23:46 +0000 (UTC) Received: by mail-pa0-f71.google.com with SMTP id kp14sf42292908pab.2 for ; Thu, 02 Jan 2014 14:23:45 -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=ILuOxgo1sOaLcHF/qbWFp6R8KTHdic9/y9xMBVb+RF0=; b=BOwBrpEaaeXhEXhgtaCaP6vRkx8F0qfb07duKDPU3Ywizq/Prfrw9An4LtMlC/mSoe 5c06TIBocsa1a8m4MpRqiSfewNL0odlN17RYt8F/Z1Q7/oGHZvMu6GMFz1Kv+03VU05H 9uMOKMeYIN8vUPTwX7ruDPiG+ha+eTBI35JoOHnDSGEnDTavrMXMsq+Ja7oajlPAd2/k kvu5cnc4grrBCEoTpK4yDr+VrivWcRtbDTHiUY7XnVqy9kef5NrM90mpRZ2Zvi4i3mdf nxNV98hTS8WnW8j06lG+wAK4WKrV37fyVGasHzSch85ltohMXE9lFJ11mAR6cORDYGqb cPBQ== X-Gm-Message-State: ALoCoQlJbaQ5LLL7NoqTeU5ypCIJhj53ZxxKmGZ3W6kuivQzFYAlFshQLpSVFh6KntWVqUYcywco X-Received: by 10.66.190.38 with SMTP id gn6mr38771016pac.30.1388701425702; Thu, 02 Jan 2014 14:23:45 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.88.68 with SMTP id be4ls4428751qeb.46.gmail; Thu, 02 Jan 2014 14:23:45 -0800 (PST) X-Received: by 10.53.9.201 with SMTP id du9mr8270vdd.36.1388701425531; Thu, 02 Jan 2014 14:23:45 -0800 (PST) Received: from mail-ve0-f175.google.com (mail-ve0-f175.google.com [209.85.128.175]) by mx.google.com with ESMTPS id a6si8187662vdp.27.2014.01.02.14.23.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 02 Jan 2014 14:23:45 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.175 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.175; Received: by mail-ve0-f175.google.com with SMTP id jx11so7625257veb.34 for ; Thu, 02 Jan 2014 14:23:45 -0800 (PST) X-Received: by 10.52.157.1 with SMTP id wi1mr40739988vdb.12.1388701425442; Thu, 02 Jan 2014 14:23:45 -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.59.13.131 with SMTP id ey3csp795765ved; Thu, 2 Jan 2014 14:23:44 -0800 (PST) X-Received: by 10.66.241.73 with SMTP id wg9mr26079410pac.69.1388701424534; Thu, 02 Jan 2014 14:23:44 -0800 (PST) Received: from mail-pa0-f50.google.com (mail-pa0-f50.google.com [209.85.220.50]) by mx.google.com with ESMTPS id r7si43760373pbk.27.2014.01.02.14.23.44 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 02 Jan 2014 14:23:44 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.50 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.220.50; Received: by mail-pa0-f50.google.com with SMTP id kp14so13198178pab.37 for ; Thu, 02 Jan 2014 14:23:44 -0800 (PST) X-Received: by 10.68.244.103 with SMTP id xf7mr45302692pbc.50.1388701424111; Thu, 02 Jan 2014 14:23:44 -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 ju10sm104179969pbd.33.2014.01.02.14.23.42 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 02 Jan 2014 14:23:43 -0800 (PST) From: John Stultz To: LKML Cc: Borislav Petkov , Brecht Machiels , Thomas Gleixner , John Stultz , Rabin Vincent , stable , Borislav Petkov Subject: [PATCH 8/9] rtc-cmos: Add an alarm disable quirk Date: Thu, 2 Jan 2014 14:23:26 -0800 Message-Id: <1388701407-5029-8-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1388701407-5029-1-git-send-email-john.stultz@linaro.org> References: <52C5E6A0.7010507@linaro.org> <1388701407-5029-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.175 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 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;