From patchwork Fri Jul 21 06:55:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 9856243 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 031BA60392 for ; Fri, 21 Jul 2017 06:56:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D66D52876B for ; Fri, 21 Jul 2017 06:56:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CB6C92877C; Fri, 21 Jul 2017 06:56:50 +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 4FEBD2876B for ; Fri, 21 Jul 2017 06:56:50 +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=d6jZcYZMeoE2bVpxXcgagdHOof QVdXavkbEBVTqt3G6aImX/j3oDyoDVjPuFgnz9L7JbjXsK4or4UydEi61gFZ/zLiqEnDG98Ykfqep 06LGpKwFyWkbxZS06imNkNvOVwda2hBE3mcd+lg3oV2SLGh8XZKObwuqRzlkhkYH6g45rsRck7PcN Bg7IgXz9Q+PBwfsvXEsN3XOgPz7PiNxgJ2oLmK1GFQ3z/dELGT4qO0c6T5rnnsyY9ArC5tEisnKCh 5b5/kMcJzq6w511kuzIHUtqPTlEloveGAHVjS7yraG5vOku+R1yh26LacT5TsBqoAyJ6x9wwJcYk4 AI4f2fpw==; 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 1dYRrg-000600-Rj; Fri, 21 Jul 2017 06:56:44 +0000 Received: from mail-wr0-x229.google.com ([2a00:1450:400c:c0c::229]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dYRrR-0005hp-8N for linux-arm-kernel@lists.infradead.org; Fri, 21 Jul 2017 06:56:33 +0000 Received: by mail-wr0-x229.google.com with SMTP id y43so78555813wrd.3 for ; Thu, 20 Jul 2017 23:56:08 -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=Usb+3wwdNfmyykZc6VGoQFwogxBm7I7GK847dIKb+rGfdZai9DwcHBXepn66UWa7UX Jt0MU8TeptVKv+tuOLEwhYeEgrZwnP8+o/G8f5U4AlfsqP9N6DV1zT+xobel2o31Y8Ym wv858whlk8KFjBdhnFg/traWGbBEFS6roCP7Q= 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=qyjtS4eZX5lVysM1wzTIU6/qP0YPX3hxhw8rX19ZGX+cUT0SD3BMcbn2PTuF6pZJvS jUs/G3wwUWUcAVLF9sSASbhOINu6c65TzUNOdjhUHteskVGzP/uWv7zQtCWWLcSIwbzy P4aUG8fHOBXY37jmNRskhzyIMAjBJFQu0Ew+HkFwQ435GVTGYVxixk7czF1v6Ch3ThUn 8y/rxCi2HiA/PLVSHyNYA8uu1kpdLZUjgeNuJHo6AmNwmp4/uBhEJ7+qk7IA2uH8++hP fjY1sg7Dh7eboFvIYeaJdCj7tN38H+hn8nf6ZJvyqXw5hjrbO6EYUcOY4D7fxQlliZS4 k6bg== X-Gm-Message-State: AIVw113hXWQEIEOL94a8GHQcRRj9REWAqS1wuERhLXXgYoNy5dBDQdU/ X1xKyIal25M25O7S X-Received: by 10.223.170.70 with SMTP id q6mr8521045wrd.205.1500620166916; Thu, 20 Jul 2017 23:56:06 -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 77sm751684wmk.8.2017.07.20.23.56.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 20 Jul 2017 23:56:06 -0700 (PDT) From: Anup Patel To: Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , Jassi Brar Subject: [PATCH v2 1/7] mailbox: bcm-flexrm-mailbox: Set IRQ affinity hint for FlexRM ring IRQs Date: Fri, 21 Jul 2017 12:25:36 +0530 Message-Id: <1500620142-910-2-git-send-email-anup.patel@broadcom.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1500620142-910-1-git-send-email-anup.patel@broadcom.com> References: <1500620142-910-1-git-send-email-anup.patel@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170720_235629_495360_ADE7FA91 X-CRM114-Status: GOOD ( 11.91 ) 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; }