Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2266947ybd; Mon, 24 Jun 2019 03:35:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqzRB1ohTvF7BvTfVFq1Cghv2SD7rpcx7lxEOj2KcV9H34hCBgfEatUQme3WxmhsqR6L+t93 X-Received: by 2002:a17:90a:342c:: with SMTP id o41mr23956912pjb.1.1561372525631; Mon, 24 Jun 2019 03:35:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561372525; cv=none; d=google.com; s=arc-20160816; b=qk6opbhEClIBn5NEKlJ4w/KZjiQvCSwD/dQUz4oZuSu4mnPiEf9TSBu3aONW0/d1C4 ERj4/vPD2PIabGHk9UunkijjgqTgUfiTZ0fYDxXLvatI/ktzmkj0d5o80fY6RN5e8UEM 9I/FoWf6/UXls6Bn3fHkX1/V+3JZwNpI5t2MMYl8uEobJMHV/bQZIfLuO0sYb0/OwBmI M/8UUZmE3m08XOF+73uvznFFq81FbONBv15nFCfqxHtR/C6bxFQ6R+OEOCgoOpiaoCZw JmgnhzL+4ais+J3UFUH84vRUXIYW1Ug5tbgeKJYgfEn9vecyfjX2tye2zRJnTU++stQJ LDtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=DjQ2IkIdJZQiHqQ6QKPL/9HJKdPs1xAG9CT0kb6ED/Y=; b=nzXjC+FIUQKKzkOG932+A/wIL6EhT0LV+uXu8laq7iMYZZoOkiVIvZ3QsPepympHi3 r4kPsEWuSPyqUnyJllP8jBgCGZ4qXmUGtCgSuaKkpQLfFEBsOvldfSCvg0Lq5xGFKBgu KF2mnBs9ZWYEYj855IliZ02b0hTUvCnleU8EJZ3Fbm+2O1SZ3u6Az3jzQCnjrEqlMNS4 GKS5J0XfgEZEbF4pQ0p0z7o0oNm3ylCaTiAuD7pGLofkT5iIB4ai6Z6hDWx1CR8m43HO vDM6cA1+3JS/zkl9a9e8X1oWp5JKf83wyDY+gVDefLlWdiUjTxd+f7XsHGoMSqJPA0Vf 6+Dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KHXvwsNq; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n14si9903068pgv.81.2019.06.24.03.35.09; Mon, 24 Jun 2019 03:35:25 -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; dkim=pass header.i=@kernel.org header.s=default header.b=KHXvwsNq; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728848AbfFXKem (ORCPT + 99 others); Mon, 24 Jun 2019 06:34:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:34228 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726774AbfFXKem (ORCPT ); Mon, 24 Jun 2019 06:34:42 -0400 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 91F7920674; Mon, 24 Jun 2019 10:34:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561372480; bh=SV0KHLSN6vZLGUuMtl2V9cwKaGSyM/pYO/cQlIB7+N8=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=KHXvwsNq1LygJo8JdUvMLWgk46PFYmBHeLBdlNfQw3UC89qCWnRZmfG6IOB21ylON sX4XSQm8nZzE3qS7ahxxH/zkrTtLrYOOv68hB7DwPIyJWqMEzeAgesl5XLhbwarzMb f/MogTTy76s13ELZfcWWC7vYoiRCQOZtx3USwQ7U= Received: by mail-wr1-f41.google.com with SMTP id f9so13278489wre.12; Mon, 24 Jun 2019 03:34:40 -0700 (PDT) X-Gm-Message-State: APjAAAUnMlt9Lkdp+F40LQsUHHFP4ZLqzKp03mbQVZ3T8lYvh6DzHMiW A6iYgwsfEliwnDmrKLE2xDtG1FFnK+yx/Q7uJt0= X-Received: by 2002:adf:fc85:: with SMTP id g5mr22528717wrr.324.1561372479250; Mon, 24 Jun 2019 03:34:39 -0700 (PDT) MIME-Version: 1.0 References: <20190604042337.26129-1-wens@kernel.org> <20190620162220.GA23549@piout.net> In-Reply-To: <20190620162220.GA23549@piout.net> From: Chen-Yu Tsai Date: Mon, 24 Jun 2019 18:34:29 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 0/3] rtc: pcf8563: Fix unhandled interrupt storm To: Alexandre Belloni Cc: Chen-Yu Tsai , Maxime Ripard , Alessandro Zummo , Vincent Donnefort , linux-rtc@vger.kernel.org, devicetree , linux-arm-kernel , linux-kernel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 21, 2019 at 12:22 AM Alexandre Belloni wrote: > > On 04/06/2019 12:23:34+0800, Chen-Yu Tsai wrote: > > From: Chen-Yu Tsai > > > > Hi everyone, > > > > While bringing up my Pine H64, I encountered an interrupt storm from the > > pcf8563 RTC. The RTC chip's interrupt line is shared with the PMIC, and > > was not properly added to the device tree. Also, the driver was using an > > trigger method incompatible with the PMIC, preventing the interrupt line > > from being shared. Last, the driver only clears and masks the alarm > > interrupt, while leaving the timer interrupt untouched. This is a > > problem if previous systems left the timer interrupt enabled, and there > > was an interrupt pending. > > > > This patch set fixes all three issues, one per patch. > > > > Please have a look. > > > > I don't have that particular RTC so I can't test but the interrupt > handling in pcf8563_irq seems problematic too. I guess the RTC will only > trigger once per second because the call to pcf8563_set_alarm_mode will > explicitely leave the alarm enabled. The core doesn't really care but it > doesn't really expect the alarm to stay enabled. i.e. It will ensure the > alarm is enabled again after setting it when necessary. I think it would > be safer to simply clear both AIE and AF here. Could you test? Yeah, that bit looked weird to me as well. And actually the alarm doesn't go down to the second, only the minute. Is there a test program I can use to test the alarms? Thanks ChenYu > > Chen-Yu Tsai (3): > > rtc: pcf8563: Fix interrupt trigger method > > rtc: pcf8563: Clear event flags and disable interrupts before > > requesting irq > > arm64: dts: allwinner: h6: Pine H64: Add interrupt line for RTC > > > > .../arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dts | 2 ++ > > drivers/rtc/rtc-pcf8563.c | 13 ++++++------- > > 2 files changed, 8 insertions(+), 7 deletions(-) > > > > -- > > 2.20.1 > > > > -- > Alexandre Belloni, Bootlin > Embedded Linux and Kernel engineering > https://bootlin.com