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=1796498754; b=IlhAGnsO+4i9w8eXx/XF8GedHN6U0EAYdfY/11Iqww/SLSUGe9jW3GV7LFIfFJAwesAa 2i5qmXaOx1/G9WdNPKI1tqYMxYZ20oPmouRjc4wcTD7pQzkXoOGV0ZsOCyQzWQFjuk/uh ZsruCg921YOcK859T7ADAk2Uc4czfZptwxrmt6wCVicqIhhrz/+BuAM8XUsEyPbIC4EKA 5CMWw2v9yMxNkIfElk7YlqvuMxn5TuxdgFPX95no0+lgrGNKf/NSrUbj0G9CwYa75Kwgd Y6cJDf4hkw+4E4jxDoTzQLtE/l3q60BFvw98AcL1tcsdiN9RPl1swZienfw88vEEEVA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796498754; h=Received:DKIM-Signature:From:To:Cc:Subject:In-Reply-To:References: Date:Message-ID:MIME-Version:Content-Type; bh=mb8vMepo+YZ+nyo9/rB6xvwtHXVVYnWYKKZNNGU4/L8=; b=F4Ybc1p83IU4qAYqEeA+os3TNhB+AjMTUx0U5qxoqNLhmPRy8k0QxRY1R3JiwhusPWSr d87b56RTqL/M5hS4V9LWNdzzeV+bKwFi+icsTYVq171dKCRGbTUg9m7CW24PZPEjLSV2L IXY6UAGoWEB4ZOZhujCA/meMMeucSa13sWvbX1nHaabIS1KnIPnkvldaPYn4jIuNWveAo UnYCFadzCSoECMqUy84pER4ox250x1Gqj1V4MgVYmVeATUJJWCet6YCYQRsFO8VCqewDS ynsRRKeVDYhJi/mLCAvkkt5W/c6xBvsWJFPVqdUgowg49lSS5P4i1dPjG8C17vJDN5A== 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=LH7Qv2Vv; 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 3466B606A31F; Sat, 5 Dec 2026 19:25:53 +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=LH7Qv2Vv Received: by smtp.kernel.org (Postfix) with ESMTPSA id 250741F0092B; Sat, 5 Dec 2026 19:25:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796498753; bh=mb8vMepo+YZ+nyo9/rB6xvwtHXVVYnWYKKZNNGU4/L8=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=LH7Qv2Vvq67f/1Qr+vUb2ZuUX69g/qbbD1x8V0ZwB8CcRoknOxIvUMBbU8nBU1a0+ mutUQ5vPc/+19IzSQk84wMK8qlb/F6GHW3Z9NRrwct92NqnX383vV94mUMtag4VEH0 RZjTbBUpffFF+KJ3oI/qlDMO9wrsH05g6O+4f/C46HjthQSZwuYOQZdMBaPLf8nxMM fpCiFHcAZcx/VVZECsFJXUOJL555HeKQgZch5GMxlte9eDJ7LEMoShuffCRO1o/U64 BGf8w0SgOr5caa2gglys/B6TQ3AlEjybISh5GvqxaOZN09WORvQe28UV07x8lvzC4M DNEGhvfgrusCQ== From: Thomas Gleixner To: Alex Elder , radu@rendec.net, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: Daniel Thompson , p.zabel@pengutronix.de, mohd.anwar@oss.qualcomm.com, lorenzo.bianconi@oss.qualcomm.com, danielt@kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] irqchip: introduce TC9564 SoC MSIGEN support In-Reply-To: References: <20261012190245.3988619-1-elder@riscstar.com> <20261012190245.3988619-3-elder@riscstar.com> <871p8vvx8x.ffs@fw13> <6c3c21e0-e499-4b6b-83b9-b4f63e6c9b7e@riscstar.com> Date: Sat, 05 Dec 2026 20:25:50 +0100 Message-ID: <87tskrlebl.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 17:46, Alex Elder wrote: > On 11/9/26 4:37 PM, Alex Elder wrote: >>> You want to use generic_handle_demux_domain_irq(), which allows you to >>> actually implement affinity settings for individual interrupts. >> >> That sounds better, thanks for pointing it out. > > Implementing affinity for individual interrupts would be great. > We have a bunch TX and RX queues with independent DMA channels > so it might be beneficial. > > However I don't think it will work, and if what I'm saying > is correct, maybe you can guide me toward a way we can still > use something like this. > > I'm going to reproduce the core of the function, with > line numbers, so it's less split up and easier to refer to. > > 1 chained_irq_enter(chip, desc); Missed to point out that you should use guard_chained_irq(chip, desc); instead. > 3 status = irq_reg_readl(gc, INT_STS_OFFSET); > 4 for_each_set_bit(hwirq, &status, HWIRQ_COUNT) > 5 generic_handle_domain_irq(irq_domain, hwirq); > 6 > 7 /* > 8 * Clear the MSI flag. Most interrupts within TC9564 are > 9 * leveh-high type. If any interrupts are still asserted Most? Better all of them are or you are in trouble with handling those which are edge type via handle_level_irq() independent of redirect. > 10 * then clearing this flag will cause the (edge-triggered) > 11 * MSI to be regenerated. > 12 */ > 13 irq_reg_writel(gc, MSI_MASK_VALUE, MSI_MASK_CLR_OFFSET); > 14 > 15 chained_irq_exit(chip, desc); > > The key parts are the loop on lines 4 and 5, and the write > on line 13. > > Your suggestion is to replace generic_handle_domain_irq() > on line 5 with generic_handle_demux_domain_irq(). > > The two functions differ in that the "demux" one calls > demux_redirect_remote(), which is able to ship handling > of sn IRQ over to another CPU, via a call to > irq_work_queue_on(). If that happens, the redirected > handler completes asynchronously (right?). Correct. > The bits in the INT_STS_OFFSET register represent 17 > possible interrupt conditions--8 RX + 8 TX DMA interrupts > plus a general MAC interrupt. I suspect it won't be > unusual to have more than one condition pending when > a single MSI interrupt fires. > > The problem I see is that the final irq_reg_writel() > call is telling the MSIGEN hardware that we have > finished handling *this* MSI interrupt, which implies > we have handled some number of underlying conditions. > > But if demux_redirect_remote() queued an interrupt > condition to be handled on a different CPU, its > handler might not have completed yet. And in that > case, we should not issue that irq_reg_writel(). As your input interrupts to the MSIGEN IP are level type according to the generic chip initializer in your patch, the obvious solution here is to implement the irq_chip::irq_pre_redirect() callback, which is invoked _before_ the redirect. static void tc_irq_pre_redirect(struct irq_data *data) { struct irq_chip_generic *gc = irq_data_get_irq_chip_data(data); irq_gc_mask_set_bit(data); } That's unfortunately a redundant operation as handle_level_irq() masks anyway, but that's harmless. This can be optimized and probably replaced by a generic implementation. We'll do that once we have a couple of users and can see their requirements. So far they are straight forward and very much the same. Let's see. So if the interrupt is not yet handled, the input line is still active, but the masking excludes it from the re-trigger condition of the MSI output block. After handle_level_irq() completes (either local or remote) the interrupt is unmasked again (if appropriate) and everything works as before. If the interrupt input line is still or again active, then the retrigger logic will send another MSI message. That's not different from how temporarily disabled level or threaded level type interrupts are handled. Hint: You could have looked at the two in tree users of this mechanism :) Thanks, tglx