From patchwork Tue Aug 1 10:35:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 9874097 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 B1CDF60365 for ; Tue, 1 Aug 2017 10:36:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B0D5A27F91 for ; Tue, 1 Aug 2017 10:36:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A583828676; Tue, 1 Aug 2017 10:36:57 +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_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE 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 6A08228173 for ; Tue, 1 Aug 2017 10:36:56 +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=XuYhSoGtp1PVwm4MdwLGdHpMYRjesPBOm+HK3g/lGaM=; b=W4GLkNUNBwtuPqBc9E0SfbJE1K yjfBi5ETNpxxXvXlVHbTjpWv1TwdXLt5xzs0pPK1yYJ9LJU9KnBHzjqpW90xS200SYtNH/9q5bLAv +9X9QVSD9BmhXHylbLXE73RIIGu7A5EwY/cIoA3JhwjeK/yeRlm9cgrT6p4CwXqCmCvfHrezswpKV C+E2mP4tbBV9L7iUiWZTe9caWjptesyhGL/muVa2anxZOtoPh0+w3ASa2AElRxTR1qK8sznl7b/BD HhnBIh/v9GTMYvvt+1+bxlSvt5ocvYkp2wHhC4MrqbCKrRRNKFpqde1EgWFNbnFJOGzrRJ6uj8B5s NXOqesmg==; 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 1dcUXk-0001va-AW; Tue, 01 Aug 2017 10:36:52 +0000 Received: from mail-qt0-x22c.google.com ([2607:f8b0:400d:c0d::22c]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dcUXX-0001h3-6u for linux-arm-kernel@lists.infradead.org; Tue, 01 Aug 2017 10:36:40 +0000 Received: by mail-qt0-x22c.google.com with SMTP id v29so6406741qtv.3 for ; Tue, 01 Aug 2017 03:36:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=hg87gsvFYRn7/gwZNCM1eAGmY2JhzF+tyZuuK+HoJr4=; b=PiKIh0UjFA0XxvZpcLIbyEPtKDiGAai5e1Yc+7gjWg+4sEGJ+0RUKl3EESyhuP/DoV hBDdTiC2OB7suLTAvCoX8Sxs8tpjmLY55pVJhTFaNBjdhsITP4P/aYYY7ABMX0mWzonM hXv0pDN0in2wQ/X3mIf5pMaTsA8y5kFsm1Qpc= 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=hg87gsvFYRn7/gwZNCM1eAGmY2JhzF+tyZuuK+HoJr4=; b=aHY720vz+F74D6gdRGt088nd7F16I3jT/qYku7L7Cu1BVvWv3vHjGhvc0wslOEgEsD NjCF4Gb3QxG2R+6CzEZ4dZZrMXFtO43zLt3a45vBu7XADRpTgDm5T9I/ZFhkyjjZ9lDW wH+7H3/Der8Zg8wFFxYTzqFAm7xWLyxLmi/tXS0WY6f4+dHqrZussqh6zC30bqSW3AJ3 VQv0raNHJKjLVh9EqP/ZxVlpKRkUP3epWC7EvIvKWaGWIGMjjck/Dvt6JEQHRr4xdIUU b41IhPhpuEsk9rcc57b3dpmi/6dX2g1FhYvyc7axlnTPuUK3NlaWAW5RSB4kDUteqm8C +FKQ== X-Gm-Message-State: AIVw112wEgWQM1Mv05Au2A7wdGOYvpMmiLxfleUkDM/CtfjWqjuUDgg+ Gm+HUZ3E8/2d76hv X-Received: by 10.237.33.162 with SMTP id l31mr10661503qtc.188.1501583777558; Tue, 01 Aug 2017 03:36:17 -0700 (PDT) Received: from anup-HP-Compaq-8100-Elite-CMT-PC.dhcp.avagotech.net ([192.19.237.250]) by smtp.gmail.com with ESMTPSA id d14sm23961629qtd.21.2017.08.01.03.36.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 01 Aug 2017 03:36:17 -0700 (PDT) From: Anup Patel To: Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , Jassi Brar Subject: [PATCH v3 1/5] mailbox: bcm-flexrm-mailbox: Set IRQ affinity hint for FlexRM ring IRQs Date: Tue, 1 Aug 2017 16:05:50 +0530 Message-Id: <1501583754-31969-2-git-send-email-anup.patel@broadcom.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1501583754-31969-1-git-send-email-anup.patel@broadcom.com> References: <1501583754-31969-1-git-send-email-anup.patel@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170801_033639_360922_BE02FEAA X-CRM114-Status: GOOD ( 12.35 ) 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: devicetree@vger.kernel.org, Florian Fainelli , Anup Patel , Scott Branden , Ray Jui , linux-kernel@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org 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 This patch set IRQ affinity hint for FlexRM ring IRQ at time of enabling ring (i.e. flexrm_startup()). The IRQ affinity hint will allow FlexRM driver to distribute FlexRM ring IRQs across online CPUs so that all FlexRM ring IRQs don't land in CPU0 by default. Signed-off-by: Anup Patel Reviewed-by: Ray Jui Reviewed-by: Scott Branden --- drivers/mailbox/bcm-flexrm-mailbox.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/mailbox/bcm-flexrm-mailbox.c b/drivers/mailbox/bcm-flexrm-mailbox.c index da67882..e8c3666 100644 --- a/drivers/mailbox/bcm-flexrm-mailbox.c +++ b/drivers/mailbox/bcm-flexrm-mailbox.c @@ -260,6 +260,7 @@ struct flexrm_ring { void __iomem *regs; bool irq_requested; unsigned int irq; + cpumask_t irq_aff_hint; unsigned int msi_timer_val; unsigned int msi_count_threshold; struct ida requests_ida; @@ -1217,6 +1218,18 @@ static int flexrm_startup(struct mbox_chan *chan) } ring->irq_requested = true; + /* Set IRQ affinity hint */ + ring->irq_aff_hint = CPU_MASK_NONE; + val = ring->mbox->num_rings; + val = (num_online_cpus() < val) ? val / num_online_cpus() : 1; + cpumask_set_cpu((ring->num / val) % num_online_cpus(), + &ring->irq_aff_hint); + ret = irq_set_affinity_hint(ring->irq, &ring->irq_aff_hint); + if (ret) { + dev_err(ring->mbox->dev, "failed to set IRQ affinity hint\n"); + goto fail_free_irq; + } + /* Disable/inactivate ring */ writel_relaxed(0x0, ring->regs + RING_CONTROL); @@ -1261,6 +1274,9 @@ static int flexrm_startup(struct mbox_chan *chan) return 0; +fail_free_irq: + free_irq(ring->irq, ring); + ring->irq_requested = false; fail_free_cmpl_memory: dma_pool_free(ring->mbox->cmpl_pool, ring->cmpl_base, ring->cmpl_dma_base); @@ -1314,6 +1330,7 @@ static void flexrm_shutdown(struct mbox_chan *chan) /* Release IRQ */ if (ring->irq_requested) { + irq_set_affinity_hint(ring->irq, NULL); free_irq(ring->irq, ring); ring->irq_requested = false; }