Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1334219imm; Tue, 2 Oct 2018 06:41:46 -0700 (PDT) X-Google-Smtp-Source: ACcGV6011MRP6JksxRNF4kvmnScgsxff1WcE6n7TEmpr3Vctw7Bv/QeoVo0WIRtBcQhTcCM7Lnd+ X-Received: by 2002:a17:902:7142:: with SMTP id u2-v6mr17228701plm.154.1538487706034; Tue, 02 Oct 2018 06:41:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538487706; cv=none; d=google.com; s=arc-20160816; b=IsNndDjfLZUgJV9j/sMS1gihhFaLq+vI3a5FiBGUNUn3TqZ3keDBsGKSLGDY1oBjNW PB/yTLd/3TUHuaIjiTTEY03yakkV8ZntC1xN9Qc5ft+3Oc546H8uUZBaCqTRz6qYefRP VyqWRyI0m4FKnXQLoUywLqIVoHVdSvbjIploB4FSF/5PhPprUazbYEJlhPG+wasMLuXx NvSpwfwlo59+o2pWj3/g1cJSmbRHV0tf4z96g+YmX/qhyNpV7N1mSSKXH2EKU7v1VEfw 2gqHVWqef3eFubNDPqjiP7UeN9jNOPt3+cEkX+/iPY9CBLInLUkzrtr/gppw85Ib1V8a 6XKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=RKtyVwo1iT1l9Fp/ZxId4WfqFGiL9hDoRyGKkEAVh/U=; b=jb1q1sgIUwz17ahq3aHnQuD1UPUWt3IORt9lz40gS6+p4M4pxKuXxaZGYD2vDtRKkg BAtgBzPOtxZWW9rSxMkIqLneuqnUoR3m4jks0o2bfaEatuRxATDtTV77MzGJUtyM+Vx4 fai7YH+Vr0VhtAIxvJVSkoMT2yKkDkihzUdXauMSTiFwL6BAHx5/RFojxZDGY+FSFomX qaOqb/1nbiDPmOqDgha3CdIbgvgTH8tbFeqoxbEKM4Hud6cm/kRV9UAV7kBKFmuAn5ox H006/eoOujHSTZqxB5QWhPnX5HWTlE10bUHt9XwgYz9xmtSSuczaAgDL/zOCttJp6YXS r7cQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w18-v6si15124550ply.66.2018.10.02.06.41.30; Tue, 02 Oct 2018 06:41:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733219AbeJBUTz (ORCPT + 99 others); Tue, 2 Oct 2018 16:19:55 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:36290 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733215AbeJBUTz (ORCPT ); Tue, 2 Oct 2018 16:19:55 -0400 Received: from localhost (24-104-73-23-ip-static.hfc.comcastbusiness.net [24.104.73.23]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 7A0FBB4A; Tue, 2 Oct 2018 13:36:30 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Gerlach , Keerthy , Tony Lindgren , Sasha Levin Subject: [PATCH 4.9 20/94] ARM: hwmod: RTC: Dont assume lock/unlock will be called with irq enabled Date: Tue, 2 Oct 2018 06:24:34 -0700 Message-Id: <20181002132501.877163671@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181002132500.494838053@linuxfoundation.org> References: <20181002132500.494838053@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dave Gerlach [ Upstream commit 6d609b35c815ba20132b7b64bcca04516bb17c56 ] When the RTC lock and unlock functions were introduced it was likely assumed that they would always be called from irq enabled context, hence the use of local_irq_disable/enable. This is no longer true as the RTC+DDR path makes a late call during the suspend path after irqs have been disabled to enable the RTC hwmod which calls both unlock and lock, leading to IRQs being reenabled through the local_irq_enable call in omap_hwmod_rtc_lock call. To avoid this change the local_irq_disable/enable to local_irq_save/restore to ensure that from whatever context this is called the proper IRQ configuration is maintained. Signed-off-by: Dave Gerlach Signed-off-by: Keerthy Signed-off-by: Tony Lindgren Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- arch/arm/mach-omap2/omap_hwmod_reset.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) --- a/arch/arm/mach-omap2/omap_hwmod_reset.c +++ b/arch/arm/mach-omap2/omap_hwmod_reset.c @@ -92,11 +92,13 @@ static void omap_rtc_wait_not_busy(struc */ void omap_hwmod_rtc_unlock(struct omap_hwmod *oh) { - local_irq_disable(); + unsigned long flags; + + local_irq_save(flags); omap_rtc_wait_not_busy(oh); omap_hwmod_write(OMAP_RTC_KICK0_VALUE, oh, OMAP_RTC_KICK0_REG); omap_hwmod_write(OMAP_RTC_KICK1_VALUE, oh, OMAP_RTC_KICK1_REG); - local_irq_enable(); + local_irq_restore(flags); } /** @@ -110,9 +112,11 @@ void omap_hwmod_rtc_unlock(struct omap_h */ void omap_hwmod_rtc_lock(struct omap_hwmod *oh) { - local_irq_disable(); + unsigned long flags; + + local_irq_save(flags); omap_rtc_wait_not_busy(oh); omap_hwmod_write(0x0, oh, OMAP_RTC_KICK0_REG); omap_hwmod_write(0x0, oh, OMAP_RTC_KICK1_REG); - local_irq_enable(); + local_irq_restore(flags); }