Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp2061682ybc; Wed, 20 Nov 2019 08:20:15 -0800 (PST) X-Google-Smtp-Source: APXvYqxH2iKRzae0qesXTaj2F6YOxBkyhJPXdJwhi2bY9LM+YtlVbf25iIaalgCjO7XNUa4JqXM0 X-Received: by 2002:adf:ec42:: with SMTP id w2mr4233335wrn.32.1574266815034; Wed, 20 Nov 2019 08:20:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574266815; cv=none; d=google.com; s=arc-20160816; b=wYaOeJ6N8UC9/GonFJmWF//ehA/AtgeJ+eERPKeKH9k5nJ2jRGvEi8PzY71steypYD 7rTogRsAyks9puck2Feoq6Tyw5LMMHorTNM7A0UjE9uN+u498eW5NyorIShaidls+rs7 UMT40wVIYCwa9kh/EGvw5+ZGkEbiqnSWlXmjkMTjbJ94nCBNVgLQAirZ3spNGgKdGIa1 pWV6eqhmClUBQoJXoytcwtXf0lx2AOjnKIhXrjyZc24ol8q0fe5+A5lwAp4tX7k1I+xK JA22YoD8T5/jhMZPEe9NeCbC+zdZMM9GDyMiulXryfCkUUiCx/COPt6miUqLeT7NPgMd WHdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject; bh=xVuk9tOMGzKnMNhOyM/0jkSEE2m/mBzUVNHoYbbjxVA=; b=GdT16F8pHJenWdaQ4bH1CwrzJFIkfhPjW7vRUM87Y99g14nUqfbizmiGRRVzANDjog JrrrVixR+x6kuy13IKASoTj9N4H6qCKFXZ4aLHK1GLag4Sgti15v3W03XrzlER/mOhtA xxw2I9N7/kGqBK51QSm8Bt002DW4vbM+yCt+N3/AIlyFqCoDf06b0zzCdRimqAjRQ/je AqAP1vPU0O9lOQQuxTkO2fLvrBLQqeoa/xGhKIavyTYL6UYyKKz7gksvsTIOtTFQbLq0 ofE7Kw3ObvinnB49+1xoAN9Q5ePEyXxdbTuL8PZ9Fyqzct9cm/A5GQpFV9uah/CAe0Rq cYfQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j22si16877723edq.415.2019.11.20.08.19.50; Wed, 20 Nov 2019 08:20:15 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729624AbfKTMMg (ORCPT + 99 others); Wed, 20 Nov 2019 07:12:36 -0500 Received: from mx2.suse.de ([195.135.220.15]:45632 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729466AbfKTMMf (ORCPT ); Wed, 20 Nov 2019 07:12:35 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id A4F0E69C2B; Wed, 20 Nov 2019 12:12:32 +0000 (UTC) Subject: Re: [PATCH v4 2/8] irqchip: Add Realtek RTD1295 mux driver To: Marc Zyngier Cc: linux-realtek-soc@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Aleix Roca Nonell , James Tai , Thomas Gleixner , Jason Cooper References: <20191119021917.15917-1-afaerber@suse.de> <20191119021917.15917-3-afaerber@suse.de> <0bff78c1-a1d0-9631-fbf4-e0d1ef1264ea@suse.de> <8137861d0a89dd246b3334ac596da8be@www.loen.fr> From: =?UTF-8?Q?Andreas_F=c3=a4rber?= Organization: SUSE Software Solutions Germany GmbH Message-ID: <37b3b5d3-b3c8-b513-f8b5-9054f32a4b53@suse.de> Date: Wed, 20 Nov 2019 13:12:31 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.1 MIME-Version: 1.0 In-Reply-To: <8137861d0a89dd246b3334ac596da8be@www.loen.fr> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 20.11.19 um 11:18 schrieb Marc Zyngier: > 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. I have found an .irq_ack callback - moving this there appears to work. Alternatively there is an irq_eoi callback and an IRQCHIP_EOI_IF_HANDLED flag. It would really help me if you spelled out explicitly where you think I should be moving code, as the documentation in irq.h is not all that helpful in terms of when are they called and what should be done there. In case not obvious, this is my first irqchip driver. >> >> 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. Renaming enable -> unmask and disable -> mask works okay. Thanks, Andreas -- SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Felix Imendörffer HRB 36809 (AG Nürnberg)