From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796416818; b=aCox0iQ9L0BlKfvbl9ZU3jkEUBPR/d/K6J3qznNxQ0Ecmjezn4ehce9vwfJjoEUvy458 awXoi4XsP2e/jVG+mOY9Kxcv8iTew9XHxm/wCBkhGWw1QcBe0ZMCHZNbDMtWSmZWX8KrM O47XnH5mrU4Gu2k5KwU4MrcPOW0rT5SASfgjsCeA8LLJ/EKeDcg8t5q0B8z33zZFOr+Yo QEgMG3Bi8SWmdMM9AuY8BaaT+CNDYrv9GY04uKsgYNM0gsWHJJalXWVFXq0fTSsbgR/45 8U9J+obNtBnj0lKi748gKxjfO4KT/SKkIde2cKrM4ff0KJZuSJVQeRhYWa8NQcGO6wA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796416818; h=Received:DKIM-Signature:From:To:Cc:Subject:In-Reply-To:References: Date:Message-ID:MIME-Version:Content-Type; bh=CXBinlc79iYJHDwgvufBh1YGDNaWll1xm48YUgic1hc=; b=fkKiU69pk98SdL6BGf50PTaCHhaOWwB6MUM4NEp5Um/7n+C7K+eOKoRZPzC4DWCFHicn +h9NsgieS7e0bEjYQqPNxvmqj/JCY7HH16yp4tO3+SU+TToI/NDL/owfUpdhRv6IXCerx 2zgE119QCZRLvEutoXpaoCmtPlheEy7sWC3LVLfEgvbtCWnJocGRreCp8YQOLG+oHzkiH i/4AtjdIIL84bW/0NFvVbNMLkyq3C1dbt66HQfFNmvqJMjnzog7TSJWzt046cG4y8JcGl gcF7g4s4DwqZZIHCdE/3Av64PRS5rvLE6zdWnXnYtpwnxdcK9SSdpi1MNzjqRJoNbKQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=hOOy6QiM; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 26EDF606A322; Fri, 4 Dec 2026 20:40:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=hOOy6QiM Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3663C1F00936; Fri, 4 Dec 2026 20:40:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796416818; bh=CXBinlc79iYJHDwgvufBh1YGDNaWll1xm48YUgic1hc=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=hOOy6QiMK2Di6xLH4QbjjA2Ud478F5B5aFp2mIj7cfGUr/lCviitSuTe7SO44dM3v OpXrJPLYLvrw23qiR7wp5dY4vH+vSAHv1Twm0kbS0k8Q7qajkJX9inF7FhT/N4C7dh l8+cCpeMxVi4mQyGQQ3HgoEAMExNueMz9vuOZY4QJUcUVXRfOojy6aAWWIi89DlFzC Z36lui3hWZGdvHHd9YD8WZeD0++Fhj20Q+aPYqzxYiIbQfcsTma0N9inlBY57ruLKL dpcK78/8R5IpZg8PtJQtfVZG7QDqtuZ4l1HLb/lCt1jRh7TLOt5Rloyw8LVLdcH2Bw MMwuZDh5lJzbA== From: Thomas Gleixner To: Charles Perry Cc: Charles Perry , Radu Rendec , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Romain Caritey , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: Re: [PATCH 2/2] irqchip: Add Microchip PIC64-HPSC/HX NVM interrupt controller In-Reply-To: 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> Date: Fri, 04 Dec 2026 21:40:14 +0100 Message-ID: <87a4mkn5jl.ffs@fw13> X-Mailing-List: devicetree@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 On Fri, Dec 04 2026 at 10:54, Charles Perry wrote: > On Fri, Dec 04, 2026 at 11:57:00AM +0100, Thomas Gleixner wrote: >> 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? Not if you mask it out with the enabled bits. But ... >> 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. .. you say the input is latched into status on a raising edge, right? Which means the input logic is edge type. The output is level type. But you claim the input is level type too. That doesn't make any sense. A strict level type interrupt source in a device is not required to have a 1-0-1 transition. The interrupt line can stay asserted even when the first interrupt is handled by the device driver. A typical scenario is that in the device there is a interrupt status register. So the following can happen: Device dev-irq IS == 0 0 IS == 1 1 interrupt mask_ack() handler() // Reads 1 pending = read(IS); IS == 3 // Clears bit(0) IS == 2 handle(pending) return; unmask(); That's legit from a device driver POV if the device interrupt is strictly level type output because the driver can rely on the interrupt being re-raised in the CPU after the unmask. If your input logic latches on a rising edge, then this case is not re-raising the interrupt because the mask_ack() clears the status bit and if there is no 1-0-1 transition on the input line, then the interrupt line becomes stale. So none of this adds up. If the interrupt is latched on a rising edge, then you need to treat it as edge interrupt type. The underlying APLIC interrupt can still be level type because that's an independent interrupt. Thanks, tglx