Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp79043pxv; Thu, 24 Jun 2021 03:17:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCnokOntx9U+s+ueKSxRFUQGopcmh2MMUEPYr6EucCkrq5/k421Zw0JuGUgmSZNIK8WqEN X-Received: by 2002:a17:906:dbd5:: with SMTP id yc21mr4625866ejb.223.1624529840863; Thu, 24 Jun 2021 03:17:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624529840; cv=none; d=google.com; s=arc-20160816; b=a6QTYFQ237rNAepJ4gsAwBQV3spqEwM0t3ENFRrvryewru22/R7dn1Ai0QoSrOlzvF eLI2A1kEZ9E3p/wpTz1U46M1jv/UWw4ZELY3wslWuf6oYW9l9YpYqBDT5BKMTj617t8s QLDdrMqNwBcsibl4IpKh+a/wF1EXu2RsdiWAvV22ULMYRJ3orsUPGGm7Bf8rNHuztd6R k/RH+IuxsFT8nup1r+iFDoxeSeMltt7orzW3MyZ2k0TmWuAePGuMimg+afcpXHCe5b95 jegGBLUopTJ9T2QUgepzv55iniYwrJSc7gO48zVqgFm+sWp4RA3KMdx3SdknsIMKILTn E4nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature:dkim-signature:dkim-signature; bh=wmskX7ULKgzDGDKyyD8iLetwEAVX0RxiPXHbdGQ61uE=; b=Uk/TmiuWQVNSnPjMi8y0cJGP2qCMcYbGPXJTEtiorI1s5NDpn6QBeaxpTyw443ItRO uQiKlx1ybns+9ozZj732h9WK+WbhvlmsRn1+QRQ/3Wgwky3t1Jo9+RCtcHN1d78K+7j/ WcU5YFH1y7jXQcJPpa5L6sS/peHCuYr1ZL04aPVdhHmU0JbfAMMSzGZHrx4GlwzgAZCG QQD139Rd/UDGmG3d8upByx+qUJgKgeX2AOA6FlCyN7KMhAilAKVP5Vz8jFMNS5RaqGFn Px7Jewhitb6WYbSK2Qpo2cFgtLAU1946/PWJiO+e26gLNqjMBXcQEozyylOmNxFwk5ng xc6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=SXO0V596; dkim=neutral (no key) header.i=@suse.de; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=SXO0V596; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dq7si1181497ejc.675.2021.06.24.03.16.56; Thu, 24 Jun 2021 03:17:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=SXO0V596; dkim=neutral (no key) header.i=@suse.de; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=SXO0V596; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232019AbhFXKRP (ORCPT + 99 others); Thu, 24 Jun 2021 06:17:15 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:38386 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232043AbhFXKRO (ORCPT ); Thu, 24 Jun 2021 06:17:14 -0400 Received: from imap.suse.de (imap-alt.suse-dmz.suse.de [192.168.254.47]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 7C3EA1FD66; Thu, 24 Jun 2021 10:14:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1624529694; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=wmskX7ULKgzDGDKyyD8iLetwEAVX0RxiPXHbdGQ61uE=; b=SXO0V596zOTGpvl2QkhQ7AhwKp8CSWnUX59Eia6sCNdviguLyBfzEY39AC0w3Sn61LZMTN sjF/zfQgm2QKWRmUoSt6DXfAy6B7dHx1MOlv+EBnr2Gy+ICTD8ISQW+p7n0SyfmRB0sDqt LilbUz3Mv5VFK4YXQsuq8mZMr4Yi2TU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1624529694; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=wmskX7ULKgzDGDKyyD8iLetwEAVX0RxiPXHbdGQ61uE=; b=mOZXF95/V/xhX7F5hPhGet0dFO3SYf1iXV5vLsMO4jJ1OpSSh3icSE4IljtUJCa1m/IAcU mHa2Ce9gWIau+8Cg== Received: from imap3-int (imap-alt.suse-dmz.suse.de [192.168.254.47]) by imap.suse.de (Postfix) with ESMTP id 4893511A97; Thu, 24 Jun 2021 10:14:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1624529694; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=wmskX7ULKgzDGDKyyD8iLetwEAVX0RxiPXHbdGQ61uE=; b=SXO0V596zOTGpvl2QkhQ7AhwKp8CSWnUX59Eia6sCNdviguLyBfzEY39AC0w3Sn61LZMTN sjF/zfQgm2QKWRmUoSt6DXfAy6B7dHx1MOlv+EBnr2Gy+ICTD8ISQW+p7n0SyfmRB0sDqt LilbUz3Mv5VFK4YXQsuq8mZMr4Yi2TU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1624529694; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=wmskX7ULKgzDGDKyyD8iLetwEAVX0RxiPXHbdGQ61uE=; b=mOZXF95/V/xhX7F5hPhGet0dFO3SYf1iXV5vLsMO4jJ1OpSSh3icSE4IljtUJCa1m/IAcU mHa2Ce9gWIau+8Cg== Received: from director2.suse.de ([192.168.254.72]) by imap3-int with ESMTPSA id YE5YEB5b1GByWwAALh3uQQ (envelope-from ); Thu, 24 Jun 2021 10:14:54 +0000 Date: Thu, 24 Jun 2021 12:14:52 +0200 From: Mian Yousaf Kaukab To: Bruno Thomsen Cc: Alessandro Zummo , Alexandre Belloni , linux-rtc@vger.kernel.org, open list , biwen.li@nxp.com Subject: Re: [PATCH RESEND v4] rtc: pcf2127: handle timestamp interrupts Message-ID: <20210624101452.GC81946@suse.de> References: <20210602104956.806-1-ykaukab@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 24, 2021 at 08:31:00AM +0200, Bruno Thomsen wrote: > Hi Mian, > > Den ons. 2. jun. 2021 kl. 17.19 skrev Mian Yousaf Kaukab : > > > > commit 03623b4b041c ("rtc: pcf2127: add tamper detection support") > > added support for timestamp interrupts. However they are not being > > handled in the irq handler. If a timestamp interrupt occurs it > > results in kernel disabling the interrupt and displaying the call > > trace: > > > > [ 121.145580] irq 78: nobody cared (try booting with the "irqpoll" option) > > ... > > [ 121.238087] [<00000000c4d69393>] irq_default_primary_handler threaded [<000000000a90d25b>] pcf2127_rtc_irq [rtc_pcf2127] > > [ 121.248971] Disabling IRQ #78 > > This must have been introduced when alarm IRQ was added, as > I always thought that tamper IRQ should be handled in user space > with gpiomon. [...] Correct. > I can see that it looks like I only added a cover letter > to the first 2 versions of patch series[1] and not the 3rd that got applied[2]. > It contains a link to how the tamper timestamp feature was tested[3]. > The script is a simple version of what is running in the product, but > missing D-Bus call with busctl and hardware init when booted for the > first time. With the addition of alarm IRQ a IRQ handler (pcf2127_rtc_irq) has been added in the driver. This handler must handle the tamper interrupt when alarm IRQ is configured. Otherwise an IRQ storm happens as described above. > > I have just tested your patch with an upstream device tree[4] that uses > the tamper feature, and that does not work. Probably caused by the > fact that it does not use RTC alarm IRQ. Make sense. > > What device tree did you see the error on? If it's not upstream can you > share how you configured the pcf2127 chip? https://elixir.bootlin.com/linux/latest/source/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts#L75 > > I am not against changing how the tamper feature works, but I would like > to see the upstream device tree[4] work before merging this patch. If you agree to handle tamper detection via an interrupt, I can send another revision to move initialization of tamper detection within 'if (alarm_irq > 0)'. tamper.sh can then just poll timestamp0 and check return value. Rest of this patch stays the same. Second option is to provide support for both cases. Let me know what do you prefer. > > /Bruno > > [1] https://patchwork.ozlabs.org/project/rtc-linux/cover/20190813153600.12406-1-bruno.thomsen@gmail.com/ > [2] https://patchwork.ozlabs.org/project/rtc-linux/patch/20190822131936.18772-5-bruno.thomsen@gmail.com/ > [3] https://github.com/baxeno/linux-emc-test/blob/master/tamper/tamper.sh > [4] https://elixir.bootlin.com/linux/latest/source/arch/arm/boot/dts/imx7d-flex-concentrator.dts BR, Yousaf