Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp1691288ybc; Wed, 20 Nov 2019 02:34:39 -0800 (PST) X-Google-Smtp-Source: APXvYqzE03TtGO2K0GqG/Sa9Eo4FxA8l44T66gnYRZSxhRp4lnlrqb602q5qC3GCF7zz+N6siE7N X-Received: by 2002:a17:906:1d02:: with SMTP id n2mr4364634ejh.219.1574246079150; Wed, 20 Nov 2019 02:34:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574246079; cv=none; d=google.com; s=arc-20160816; b=nTdKyjX9qcsYcvFj8v1R6Rpbqx0InkA3xpC9HVqmaxliXjZFM+8kNLEkAqkrn97QPD s032ovDQ8OOje62KKIVA3E391VF7lXG3d4cB3NKYyI6KJDft5pJbDav0VQCCjcxLlz6k zA6qkbMPWw1Mv2Xvb6m4EIdQyvTyxZNDr4l+Yd16t2R8MNLhSz1I96JbawBzQWU3OgRp +ov1cF2MUCh7oGv5AfVau6Vf0OGrk2foAOeNqS1K9NrG1IgnYOa8z/iixGH4MQ1hhraf tzoQ43B6nTDbwudLNicycXPLZPXOOW/AIHKWyj+isrwbvyMMAZZgbijW1dn1j64tcqNI Jvlg== 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=rxR3fyTVYy1cn5MXwzdSCoPpfPxtCsWISQlv169tYQw=; b=ugT/XfgECjN1DWSCbQ7L5w0H6SjSxzAccxSCFxC9Su3UX8AllMJOvHyR2p7uxbiNyi d5uZ8RIuo/2Zztwav1zpNE0PNQCn/sM5/V/D7i3uVvpMpGT5zxtnocLUuRHIwnIJ1riT djzNWn87UhIyFvbCBQ8wt942uyYDJLyAIQS4UI6XfSu5Q8BdgOTJ3CBZHmfag3QPbFBm j0uEu+csMQFjWs1kvnJb0Q0EIwK0HLFtQaGh3XX4SZbM6sWRBz3bt1+gMFMFRD2OgdCW JrTxSDRyBOiMznahJxETV2F4elWJI7STu/6tPbxbPz3izDvryPbyDtGQOaDdsDNRrRfw 98/w== 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 gr10si16335811ejb.414.2019.11.20.02.34.14; Wed, 20 Nov 2019 02:34:39 -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 S1728609AbfKTKTB (ORCPT + 99 others); Wed, 20 Nov 2019 05:19:01 -0500 Received: from inca-roads.misterjones.org ([213.251.177.50]:48643 "EHLO inca-roads.misterjones.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728355AbfKTKTA (ORCPT ); Wed, 20 Nov 2019 05:19:00 -0500 Received: from www-data by cheepnis.misterjones.org with local (Exim 4.80) (envelope-from ) id 1iXN4b-0001G1-Pc; Wed, 20 Nov 2019 11:18:57 +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:18:57 +0000 From: Marc Zyngier Cc: , , , Aleix Roca Nonell , James Tai , Thomas Gleixner , Jason Cooper In-Reply-To: <0bff78c1-a1d0-9631-fbf4-e0d1ef1264ea@suse.de> References: <20191119021917.15917-1-afaerber@suse.de> <20191119021917.15917-3-afaerber@suse.de> <0bff78c1-a1d0-9631-fbf4-e0d1ef1264ea@suse.de> Message-ID: <8137861d0a89dd246b3334ac596da8be@www.loen.fr> 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:25, Andreas Färber wrote: > Am 19.11.19 um 13:01 schrieb Marc Zyngier: >> On 2019-11-19 02:19, Andreas Färber wrote: >>> diff --git a/drivers/irqchip/irq-rtd1195-mux.c >>> b/drivers/irqchip/irq-rtd1195-mux.c >>> new file mode 100644 >>> index 000000000000..e6b08438b23c >>> --- /dev/null >>> +++ b/drivers/irqchip/irq-rtd1195-mux.c > [...] >>> +static void rtd1195_mux_irq_handle(struct irq_desc *desc) >>> +{ >>> +    struct rtd1195_irq_mux_data *data = >>> irq_desc_get_handler_data(desc); >>> +    struct irq_chip *chip = irq_desc_get_chip(desc); >>> +    u32 isr, mask; >>> +    int i; >>> + >>> +    chained_irq_enter(chip, desc); >>> + >>> +    isr = readl_relaxed(data->reg_isr); >>> + >>> +    while (isr) { >>> +        i = __ffs(isr); >>> +        isr &= ~BIT(i); >>> + >>> +        mask = data->info->isr_to_int_en_mask[i]; >>> +        if (mask && !(data->scpu_int_en & mask)) >>> +            continue; >>> + >>> +        if (!generic_handle_irq(irq_find_mapping(data->domain, >>> i))) >>> +            writel_relaxed(BIT(i), data->reg_isr); >> >> What does this write do exactly? It is the same thing as a 'mask', >> which is pretty odd. So either: >> >> - this is not doing anything and your 'mask' callback is bogus >>   (otherwise you'd never have more than a single interrupt) >> >> - or this is an ACK operation, and this should be described as >>   such (and then fix the mask/unmask/enable/disable mess that >>   results from it). > > This is supposed to be an ACK, i.e. clear-1-bits operation. If it is an ACK, model it as such, and do not open-code it. > > The BSP had extended various drivers, such as 8250 UART, to do this > ack > in their interrupt handler through an additional DT reg region. I > tried > to clean that up by handling it centrally here in the irqchip driver. > >> >> as I can't see how the same register can be used for both purposes. >> You should be able to verify this experimentally, even without >> documentation. > > There are three registers here: > > MIS_UMSK_ISR - MISC unmasked interrupt status register > MIS_ISR - MISC masked interrupt status register > MIS_SCPU_INT_EN - MISC SCPU interrupt enable register > > The latter is a regular R/W register; the former two have a > write_data > field as BIT(0), with 1 indicating a write vs. 0 indicating clear, > RAZ. > > By enabling/disabling in _SCPU_INT_EN we mask/unmask them in _ISR but > not in _UMSK_ISR. > > Does that shed any more light? None whatsoever. Your mask callback doesn't make any sense, since it actually acks the interrupt. My gut feeling is that your enable/disable should really be mask/unmask. > > So given that we're iterating over reg_isr above, we could probably > drop > the mask check here... > > In addition there are MIS_[UMSK_]ISR_SWC and MIS_SETTING_SWC > registers > for Secure World, and MIS_FAST_INT_EN_* and MIS_FAST_ISR as well as > various GPIO interrupt registers. This doesn't seem relevant to the discussion here. M. -- Jazz is not dead. It just smells funny...