From patchwork Wed Jul 19 19:07:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Berger X-Patchwork-Id: 9853029 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 61B2F602BD for ; Wed, 19 Jul 2017 19:09:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 49A3028695 for ; Wed, 19 Jul 2017 19:09:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3E85528698; Wed, 19 Jul 2017 19:09:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 26E6B2866A for ; Wed, 19 Jul 2017 19:09:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=uk+Mgot0WxDih0oGESb2lLxkSTmQCAY8VCHWQs7JWxc=; b=cY6c+R6Q85LvY2BxlcQqTkPz1D 8UKDuubrSa3Ti6ldYRCdOehzrOLgJRlhhz1XStsgGzPu+5vJWkhdGUP7RU0jXfNylRPsGz1lfE0eu TKiZoVQ99eAkRHZWAGxVTV+gWjcB0RaAQELkfWNgaM9A+3lUNVpb53natOgTmWk9jNhL5eiTP11dm AXoKqhiQd4v8a0P9Uwmd+AeIAlDZ3gy6hNO1C0P4MxNU6bHPUof/yv2UEyDsjCx/lRaCOMXukC3wY 24NFTC0AxCtYE6Lw48pPzBooaNQ3rDlZDHtUbAOiHIIMnaRn7tSRWUFDY9XCwkNAGU+pY22oTzr03 RE0iRFlA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dXuLW-000172-2T; Wed, 19 Jul 2017 19:09:18 +0000 Received: from mail-qt0-x244.google.com ([2607:f8b0:400d:c0d::244]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dXuLF-0000gr-Um for linux-arm-kernel@lists.infradead.org; Wed, 19 Jul 2017 19:09:10 +0000 Received: by mail-qt0-x244.google.com with SMTP id 19so1283463qty.1 for ; Wed, 19 Jul 2017 12:08:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Q+Rwf2fsp1i1CklUpVeSQbSDTeODAkwZs2/BoCo3blM=; b=BSUgT5yUeyfeZ3LF376kJ1mfTkXAoKr0ZMgxVL4SFatbqeW4ZN5D3r5oQ6Ccp+fTrC eepiYHEy1XaP4V2KiTMVxLFXFs6u1IZmoML8zRtmnSrAftkA5zkujYPG63EPuDRhHXb/ VT48O0oJB3EPZaF+RAhFNIM9K5OkfJ5vhcTTDo2cmqD+YqSZs9ACJzPflRRLuGkD1LGm RCIH4Oc4WrxKm7oVK9B6EvEydzpX8dnHM1uJWI4PT7WVUUo5zyfw38Df094VM9yRAI0F Qjw9kXGDtOho14vcwxinQ8exZRfy1FDldMmeO0o4SlRiLZTAVR0jJ8MoK0dzQH8rtx48 0M8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Q+Rwf2fsp1i1CklUpVeSQbSDTeODAkwZs2/BoCo3blM=; b=VImnZcLcgE7o8Vu3Fnm++GxjpvEo+a21ME4/kybUao7SuqnF5ZtIO6bZbMSMfN9NFE 6rxtSIeKw+Ad8ChZvkDZYqD2Bu2lBf+MwiM2dPjdhGMvZKcv1XXAiKrBPtMm7kKe+u7K eX56Iy/GC2CN4Sxoqkm4FOkj4hhrHMJhCsNenwfaO5dAKr6cn+xHLpI605/3qxY9PtHB YrY20WsbJF/lArXV2wzLQgkO4QRhFTCzQvlKVe1ZxMz4xwmvssW3kYm/FwRCSGYxSqBe aisitce/gEA5fKeH1p9BSY5GLFn6nRCIjGivwv/oH8Fb1K7QH5ODd8VTKdViJThrirCm 50YA== X-Gm-Message-State: AIVw1125RbRsPCujNW8L7fNKLSRculGZWR6j5iIJQdfjsbaQGd+SdjjO 2fGrdwgBu6V8RA== X-Received: by 10.200.50.2 with SMTP id x2mr1643251qta.23.1500491320608; Wed, 19 Jul 2017 12:08:40 -0700 (PDT) Received: from stb-bld-02.irv.broadcom.com ([192.19.255.250]) by smtp.gmail.com with ESMTPSA id 73sm518082qkx.30.2017.07.19.12.08.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Jul 2017 12:08:39 -0700 (PDT) From: Doug Berger To: Thomas Gleixner Subject: [PATCH v2 1/6] genirq: generic chip: add irq_gc_mask_disable_and_ack_set() Date: Wed, 19 Jul 2017 12:07:29 -0700 Message-Id: <20170719190734.18566-2-opendmb@gmail.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170719190734.18566-1-opendmb@gmail.com> References: <20170719190734.18566-1-opendmb@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170719_120902_618933_9028C184 X-CRM114-Status: GOOD ( 17.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Sebastian Frias , Doug Berger , Jason Cooper , linux-mips@linux-mips.org, Boris Brezillon , Marc Zyngier , Bartosz Golaszewski , Kevin Cernekee , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Rob Herring , bcm-kernel-feedback-list@broadcom.com, Gregory Fong , Florian Fainelli , Brian Norris , linux-arm-kernel@lists.infradead.org, Marc Gonzalez MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The irq_gc_mask_disable_reg_and_ack() function name implies that it provides the combined functions of irq_gc_mask_disable_reg() and irq_gc_ack(). However, the implementation does not actually do that since it writes the mask instead of the disable register. It also does not maintain the mask cache which makes it inappropriate to use with other masking functions. In addition, commit 659fb32d1b67 ("genirq: replace irq_gc_ack() with {set,clr}_bit variants (fwd)") effectively renamed irq_gc_ack() to irq_gc_ack_set_bit() so this function probably should have also been renamed at that time. The generic chip code currently provides three functions for use with the irq_mask member of the irq_chip structure and two functions for use with the irq_ack member of the irq_chip structure. These functions could be combined into six functions for use with the irq_mask_ack member of the irq_chip structure. However, since only one of the combinations is currently used, only the function irq_gc_mask_disable_and_ack_set() is added by this commit. The '_reg' and '_bit' portions of the base function name were left out of the new combined function name in an attempt to keep the function name length manageable with the 80 character source code line length while still allowing the distinct aspects of each combination to be captured by the name. If other combinations are desired in the future please add them to the irq generic chip library at that time. Signed-off-by: Doug Berger --- include/linux/irq.h | 1 + kernel/irq/generic-chip.c | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/include/linux/irq.h b/include/linux/irq.h index 00db35b61e9e..5b27f65c47d0 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h @@ -1003,6 +1003,7 @@ void irq_gc_unmask_enable_reg(struct irq_data *d); void irq_gc_ack_set_bit(struct irq_data *d); void irq_gc_ack_clr_bit(struct irq_data *d); void irq_gc_mask_disable_reg_and_ack(struct irq_data *d); +void irq_gc_mask_disable_and_ack_set(struct irq_data *d); void irq_gc_eoi(struct irq_data *d); int irq_gc_set_wake(struct irq_data *d, unsigned int on); diff --git a/kernel/irq/generic-chip.c b/kernel/irq/generic-chip.c index f7086b78ad6e..7f61b6e9f5ca 100644 --- a/kernel/irq/generic-chip.c +++ b/kernel/irq/generic-chip.c @@ -151,6 +151,31 @@ void irq_gc_mask_disable_reg_and_ack(struct irq_data *d) } /** + * irq_gc_mask_disable_and_ack_set - Mask and ack pending interrupt + * @d: irq_data + * + * This generic implementation of the irq_mask_ack method is for chips + * with separate enable/disable registers instead of a single mask + * register and where a pending interrupt is acknowledged by setting a + * bit. + * + * Note: This is the only permutation currently used. Similar generic + * functions should be added here if other permutations are required. + */ +void irq_gc_mask_disable_and_ack_set(struct irq_data *d) +{ + struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); + struct irq_chip_type *ct = irq_data_get_chip_type(d); + u32 mask = d->mask; + + irq_gc_lock(gc); + irq_reg_writel(gc, mask, ct->regs.disable); + *ct->mask_cache &= ~mask; + irq_reg_writel(gc, mask, ct->regs.ack); + irq_gc_unlock(gc); +} + +/** * irq_gc_eoi - EOI interrupt * @d: irq_data */