Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp1692031ybc; Wed, 20 Nov 2019 02:35:23 -0800 (PST) X-Google-Smtp-Source: APXvYqxewR3Wiq+m88Q44XHBx17gds6M3iQAabFMc/VAlw37IWf2fU+tEeAeen2S7jr4xDtGF4d+ X-Received: by 2002:a17:906:c314:: with SMTP id s20mr4528546ejz.118.1574246123172; Wed, 20 Nov 2019 02:35:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574246123; cv=none; d=google.com; s=arc-20160816; b=icqI2zI16I3to6hdtVoW9CqbydEPHt04/9FNszf7ckoaOg+BkXnsm7GrZK0I9zjUg2 Dbxr6KRr8PXoI6SZefzuHXqvjCg3jOloSGkGmb3grOe/LeB3rgEChCMbjyWEYpvbGJIR dIz0KB3lEPxa32uhMHl9A2aPn5bmSqwbt8NVRO8Lv041rqKV7RpAJSc19XeOrD89Ns7r SUqSUDzVinlLzvUbXnJxRetEyiTL1fSgaFpPbdnRh4rZ0RWOsMOa2ItPK5PIpUXIlQ2b KDk1fsBUMKNTD71Ne22DfVcov8aWC+Qf8id0ivR13N/FwAzyPrOGb20YyW/15V1sypvB NNkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:cc:from:date:content-transfer-encoding:mime-version :subject:to; bh=x3eGfxxu824TxcHhQPgLAMdBiclX/PviJJCXkriqpCk=; b=s/8JFOgmuZcklr3EUXaQVmU+DCsVG1xasyv05myx3wsW2c7OLzjozYjiKolOu6bVic i1DqvV0DJXuhUsfA+f5IjYsWAxeyvKrSMLEBFmMCel0hnT6sjoNAl9SRFPkDk22Djkq/ MFiyOmgpCcVOP14e9zC6TcSTDzzZiGnQ5d5mbsbqsdUwk8ippWxTginH7MOiN2RyAiS6 cVWsUU0SoC90FxQ6um+hIIkez+GesQ8VQ55/J3BPe2/lSgz5CQh0LdWYyXamBckxA78P 9pKJ0B4PkF2mYjmVCFfaujWaFw21D6dHnIxBtzYaasi6H2fgq7dM5coEqvvBHmGDky7c vL0w== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (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 mj12si16041824ejb.186.2019.11.20.02.34.59; Wed, 20 Nov 2019 02:35:23 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728615AbfKTKUW (ORCPT + 99 others); Wed, 20 Nov 2019 05:20:22 -0500 Received: from inca-roads.misterjones.org ([213.251.177.50]:41902 "EHLO inca-roads.misterjones.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728384AbfKTKUW (ORCPT ); Wed, 20 Nov 2019 05:20:22 -0500 Received: from www-data by cheepnis.misterjones.org with local (Exim 4.80) (envelope-from ) id 1iXN5w-0001Hp-MP; Wed, 20 Nov 2019 11:20:20 +0100 To: =?UTF-8?Q?Andreas_F=C3=A4rber?= Subject: Re: [PATCH v4 2/8] irqchip: Add Realtek RTD1295 mux driver X-PHP-Originating-Script: 0:main.inc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Wed, 20 Nov 2019 10:20:20 +0000 From: Marc Zyngier Cc: , , , Aleix Roca Nonell , James Tai , Thomas Gleixner , Jason Cooper In-Reply-To: References: <20191119021917.15917-1-afaerber@suse.de> <20191119021917.15917-3-afaerber@suse.de> <20191119222956.23665e5d@why> Message-ID: X-Sender: maz@kernel.org User-Agent: Roundcube Webmail/0.7.2 X-SA-Exim-Connect-IP: X-SA-Exim-Rcpt-To: afaerber@suse.de, linux-realtek-soc@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernelrocks@gmail.com, james.tai@realtek.com, tglx@linutronix.de, jason@lakedaemon.net X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on cheepnis.misterjones.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019-11-19 23:33, Andreas Färber wrote: > Am 19.11.19 um 23:29 schrieb Marc Zyngier: >> On Tue, 19 Nov 2019 21:56:48 +0100 >> Andreas Färber wrote: >>> Am 19.11.19 um 13:01 schrieb Marc Zyngier: >>>> On 2019-11-19 02:19, Andreas Färber wrote: >>>>> +static void rtd1195_mux_enable_irq(struct irq_data *data) >>>>> +{ >>>>> +    struct rtd1195_irq_mux_data *mux_data = >>>>> irq_data_get_irq_chip_data(data); >>>>> +    unsigned long flags; >>>>> +    u32 mask; >>>>> + >>>>> +    mask = mux_data->info->isr_to_int_en_mask[data->hwirq]; >>>>> +    if (!mask) >>>>> +        return; >>>> >>>> How can this happen? You've mapped the interrupt, so it exists. >>>> I can't see how you can decide to fail such enable. >>> >>> The [UMSK_]ISR bits and the SCPU_INT_EN bits are not (all) the >>> same. >>> >>> My ..._isr_to_scpu_int_en[] arrays have 32 entries for O(1) lookup, >>> but >>> are sparsely populated. So there are circumstances such as WDOG_NMI >>> as >>> well as reserved bits that we cannot enable. >> >> But the you should have failed the map. The moment you allow the >> mapping to occur, you have accepted the contract that this interrupt >> is >> usable. >> >>> This check should be >>> identical to v3; the equivalent mask check inside the interrupt >>> handler >>> was extended with "mask &&" to do the same in this v4. >> >> Spurious interrupts are a different matter. What I'm objecting to >> here >> is a simple question of logic, whether or not you are allowed to >> fail >> enabling an interrupt that you've otherwise allowed to be populated. > > Then what are you suggesting instead? I don't see how my array map > lookup could fail other than returning a zero value, given its static > initialization. Check for a zero mask in > rtd1195_mux_irq_domain_map()? > Then we wouldn't be able to use the mentioned WDOG_NMI. Add another > per-mux info field for which interrupts are valid to map? I'm suggesting that you fail the map if you're unable to allow the interrupt to be enabled. M. -- Jazz is not dead. It just smells funny...