From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=68.232.154.123 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796399667; b=WKBBSRrKOKO1srm32PHYGb2I5P6S+Z7SwuxMzlO1igu9VKQIB5bJg40cD1geIs4DN3ck ucmlC6a2hWqB0PS4bZI4rXCt6oABfrHxwcOxmQSiATh9ZJDPOL850rWGEriiN5xyB30lD l6ypdEYZuReDQS72DMA+MTvfmRN6eHz2RQK52Hd0v3alfD/xisN262wjAW36CYGqTHDk0 0vmvydaX52KLck7x0c2UaeY0OTTTVZcgiOBRLvyEX7pjYHpJUw4rPvQFMAXGfXbpl7gqB 5uOMvgXj6JEm2fDGo93jK4vVcAaZo0CBgqhh1FnEmTUwYHkebrqgrQjuQDAZxUw3L7Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796399667; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-Amp-Result:Received:Received:Received:Date:From:To:CC: Subject:Message-ID:References:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; bh=Hx0FFIfmllhF09SSs9t9R63EvjqKhE5HawLijRO5Vks=; b=4blJYv6tcSRe88dLEUIqV9a0dvTw3xphPYw92n1hn48CWwLzXJRdIbVtAtRjBo7ldX7v NRSrt5MVCdSxOZi0bU3dboMLYaQFntDCbN8PSMeHy1o3uG28C9Pnl/HnAL1jnr/cqGFkF VIM0XEfTT4DSal5FkHtn+8zXBhv/5kfrB700Geyz5UkJewA7YDOtRj5A07WluGlYZxXxh 7CpxiVt7Va4p9hHZUzUm3kLguKJ82jpj9V0PejWYhhdn+OYG4MePlYHjp2ENcBu3gW2+m xfHIVfmgQ0zSWK7VEcAQYPcKKwAmZyS8Bm6L+N5UifqAhC9PVhEuBCdeWKyxDyE9Egg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=wYSeunY6; arc=none smtp.remote-ip=68.232.154.123 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 77DD7606A338; Fri, 4 Dec 2026 15:54:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 77DD7606A338 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=wYSeunY6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1796399666; x=1827935666; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=j0l2+rsH9s7jB3cPU1I+iw4V/Td/+iLfhA9cjz16xCs=; b=wYSeunY6eEQAXhJ45UNWJxQbfyEE+itK+pjbpnWC1pmeiTdgkCcYdqHG TJw3tGHo4U1YFRFsxUwtvLToGT1VreXPP+8F4vNK32XXeZzad6nCW4Rim 6Ub6ubWfrtRrAN54GibckYwSOFGCd5WqDic39QKIdKwNEGWv+Zyf41iIY AuZgaMmqDkSq0lgsXLvgGTsk//r1UjRH3481o6dLdEqZpBXjp5GiKdBjQ 19xqeoqBHoifEUlfqUwkTJgHrZxgK1/MI843BMsfBUV+UV4SAmnRtNQjk b1ZAZu9XcCfuWWXqkcnfA0XTWWKBxh6vsA9Bab2nRpWdQ/M/Cave1Z3az A==; X-CSE-ConnectionGUID: 7erzIybGSJG9FaUBbZFF7A== X-CSE-MsgGUID: lxZ3qDYcRkygdd8l2jl64g== X-IronPort-AV: E=Sophos;i="6.29,78,1794898800"; d="scan'208";a="234494369" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 04 Dec 2026 08:54:20 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58; Fri, 4 Dec 2026 08:54:19 -0700 Received: from MON-LT-C78453.mchp-main.com (10.10.85.11) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58 via Frontend Transport; Fri, 4 Dec 2026 08:54:18 -0700 Date: Fri, 4 Dec 2026 10:54:16 -0500 From: Charles Perry To: Thomas Gleixner CC: Charles Perry , Radu Rendec , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Romain Caritey , , Subject: Re: [PATCH 2/2] irqchip: Add Microchip PIC64-HPSC/HX NVM interrupt controller Message-ID: References: <20261201-linux-7-4-rc4-pic64hpsc-nvm-intc-v1-0-e87ed786dc1b@microchip.com> <20261201-linux-7-4-rc4-pic64hpsc-nvm-intc-v1-2-e87ed786dc1b@microchip.com> <874icwpzlk.ffs@fw13> <87ecbyodnb.ffs@fw13> <87wlppmhz7.ffs@fw13> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <87wlppmhz7.ffs@fw13> On Fri, Dec 04, 2026 at 11:57:00AM +0100, Thomas Gleixner wrote: > On Thu, Dec 03 2026 at 13:14, Charles Perry wrote: > > > On Thu, Dec 03, 2026 at 11:35:20AM +0100, Thomas Gleixner wrote: > >> On Wed, Dec 02 2026 at 17:20, Charles Perry wrote: > >> > On Tue, Dec 01, 2026 at 08:31:19PM +0100, Thomas Gleixner wrote: > >> >> > + * Clear it, then dispatch only the sources whose line is still high. > >> >> > + */ > >> >> > + writel(pending, intc->base + P64H_NVM_INTC_STATUS); > >> >> > >> >> What happens in the case that there is only BIT(N) pending in STATUS and > >> >> that bit is not set in ENABLED? > >> > > >> > That happens only with PREEMPT_RT. > >> > >> I don't think that's a PREEMPT_RT issue. That's an issue related to > >> threaded interrupts. Just add 'threadirqs' on the kernel command line > >> with a !RT kernel and you should observe the same. > > > > I've tested 'threadirqs' with !RT and I observe the same thing as with RT. > > Not a surprise. > > Let's look how level interrupt controllers work in general: > > Hardware CPU > > Line is raised > interrupt is raised > interrupt() > handle_level_irq() > mask_ack() > device_handler() > Line is cleared ... > unmask() > > The mask_ack() does two things: > > 1) It masks the interrupt so the it can't be raised again until the > device handler completed. That's required because with level type > the interrupt line stays raised until the device handler cleared > it in the device. > > 2) It acks the interrupt, which resets the logic in the interrupt > chip to raise the interrupt in the CPU again. > > So if ACK happens without masking the interrupt stays asserted or the > ACK might cause a 1-0-1 transition in some chips. > > Threaded mode does not really change this: > > interrupt is raised > interrupt() > handle_level_irq() > mask_ack() > wake_thread() > return // interrupt stays masked > > thread() > device_handler() > unmask() > > All what changes is the timing. > > So this sequence: > > pending = read(STATUS) & read(ENABLE); > > write(pending, STATUS); > > pending &= read(STATUS); This read() was on VALUE, see my diagram below. > > does not make sense for a sanely designed level type controller which > usually does: > > STATUS = LINESTATE & ENABLED > > and if it has multiple input lines then the output is simply: > > OUTLINE = STATUS(0) | STATUS(1) .... | STATUS(N) > > From your code and comments it seems STATUS is latched which does not > make sense. We have 3 registers, VALUE, STATUS and ENABLE. VALUE is the live output of the device, STATUS reflects a latched value of each input and ENABLE controls which output gets muxed: +----------------------------------------+ | nvm-intc | | | | | +--------+ VALUE[0] +------+ STATUS[0] +---+ +---+ | | Device |----|------>| Edge |---------->| | | | | | | | | | | | | | | +--------+ | +------+ |AND| | | | | | |-->| | | +--------+ | | | | | | | APLIC | | ENABLE[0]--->| | | | | | | | +---+ | | | | | | | |----->| | +--------+ VALUE[1] +------+ STATUS[1] +---+ |OR | | | | | Device |----------->| Edge |---------->| | | | | | | | | | | | | | | | | | | +--------+ | +------+ |AND|-->| | | +--------+ | | | | | | | | | | | | | ENABLE[1]--->| | | | | | +---+ | | | | | | | | ... | | | +----------------------------------+---+-+ Is it a problem that ENABLE doesn't prevent VALUE from latching STATUS? > > But even then it does not explain how the status bit stays raised with > the mask_ack() sequence of the level handler. Because ENABLE acts on the output, it doesn't prevent VALUE from latching STATUS. So if another interrupt happens while calling the device handler STATUS will be high, even though ENABLE is 0. > > That makes me very confident that these SoCs are redefining the future > for space and mission critical applications :) I'm sure it will with your help! -- Thanks, Charles