From patchwork Wed Jul 19 09:55:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 9851043 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 3D22860392 for ; Wed, 19 Jul 2017 09:56:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1EC5128632 for ; Wed, 19 Jul 2017 09:56:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 137862863C; Wed, 19 Jul 2017 09:56:39 +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 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 B072728632 for ; Wed, 19 Jul 2017 09:56:38 +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=NP2eg9N7NKYsAZgSPHDtFMC6uf fk1TbFhfFm6xXdorIy6S7WJCFbTTAHtt9HRRowKd0JuDn1F8KKZ3T95CzZOG4O6hPIWSV54T9nP6Z bOCu7xixN1qltI8PdE+uVSQOIsgS8GH7xN+gECEqFGYBNw8l3reftypRRbzoV/mIeGDTiCcTIwQVT ynVB7JkDSEKvi1JoZDKfyhzBL4hKRTPz0eYeflvfQU/k/lwGkzvWiUW4Rbtw52TAkqaOApi7UU8Pv ELAm9fOG79tJ4UXjkjy+vSpicgU4y/q83weXlAXJOX9v3fZW/ho6aAfm/ZsrqgMdwutVw0IS/kdKB Xz4OjIHw==; 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 1dXlid-0004wE-JF; Wed, 19 Jul 2017 09:56:35 +0000 Received: from mail-wm0-x22b.google.com ([2a00:1450:400c:c09::22b]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dXliY-0004ox-Vg for linux-arm-kernel@lists.infradead.org; Wed, 19 Jul 2017 09:56:33 +0000 Received: by mail-wm0-x22b.google.com with SMTP id t70so36632418wmt.1 for ; Wed, 19 Jul 2017 02:56:10 -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=HcOfkArBLvZa0xO4J04oIX3rU/6h5+5SKZ7qjbXfbQPmqkzzaMADp7TQMsisgebnv4 5wLdplJ9Hkp8BcbV2tsbFgK2WAJrwQnbvORxTrNR5hEJRvjb/a1JFRiLDOBZnNnGieJy 3fxcMCVa3HLknsE6BiwJHBgfowzDYJYi7TKKA= 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=LKCEX1ET16kPYxCBwLLkr4Miw7ShGw5wMUvdIuxVxhds9Sf6+MLL/NjeGldnpk2TIA pjgQjZAi5eH3nxDtulpBicSOesYAhRuTPNUCECBioYSzLef6cRsG9B9kEEsSF8pfRP3R ne2nXxlicEJwd8mMB8gES/NcvOrKuat6A7GhfZR9qwJXUwKHmWIGc3zcLi2kBrJeaBSA nRzoWB6kb6KbU3g4Qpsa58S17tlWiLKq4linfTq4g1XDelcDDJOti4LfQ+85ux4c9LyN NCVbvuQRQZZZ/eazlvy2qwABSMSISxEdSLr2p1Olp8e3QgSjGRL1q2wUrGwS4rhwKu9m RtaA== X-Gm-Message-State: AIVw112TVY3/HPtDSsODaLD9h1e0uGUqTRBdHtoQHijy0T/eQDmRH0Zs XUCBZu3P7gaGLqG9 X-Received: by 10.28.22.205 with SMTP id 196mr4579291wmw.56.1500458168907; Wed, 19 Jul 2017 02:56:08 -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 16sm20181480wmk.13.2017.07.19.02.56.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 19 Jul 2017 02:56:08 -0700 (PDT) From: Anup Patel To: Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , Jassi Brar Subject: [PATCH 1/6] mailbox: bcm-flexrm-mailbox: Set IRQ affinity hint for FlexRM ring IRQs Date: Wed, 19 Jul 2017 15:25:37 +0530 Message-Id: <1500458142-19243-2-git-send-email-anup.patel@broadcom.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1500458142-19243-1-git-send-email-anup.patel@broadcom.com> References: <1500458142-19243-1-git-send-email-anup.patel@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170719_025631_317557_EE007250 X-CRM114-Status: GOOD ( 12.36 ) 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; }