From patchwork Mon Jan 29 19:47:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roy Pledge X-Patchwork-Id: 10190389 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 1D0456056E for ; Mon, 29 Jan 2018 19:48:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B51A20121 for ; Mon, 29 Jan 2018 19:48:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0020D200DF; Mon, 29 Jan 2018 19:48:44 +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=-4.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_MED 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 10DC41FF66 for ; Mon, 29 Jan 2018 19:48:44 +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:Cc:Reply-To:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date: Subject:To:From:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=pJ5/51rnm3Q8BYoTHV6n6PLysqdWOtAd+D2oJocAOSE=; b=B6NtKykKxv97eY nYc5jVM//rbmjVXAvl3dzbcIV3F74Kb5u5z5k0krqhuQ47a52KI4KhrXLug3KLXH83CW7gJPAU9w5 px+BqWo1D+qv0wXqNM74ePS+163yfH08Qr+F4zGGDugrk0NAuAsPfWmsYkXBW+uDA/Z4Y6Xv8Mzug B9UpPbdvU0xFoz9zNfvHVqJCPGMN3OCsQK2qQL+DxHasZ8CisDNFmVqX78qfj9p/dRWBkpne+I7Oz 7NFX47wNatp8bQ7t3ACU0/x4c8onhEzdK3xeWRiUu+7S7dFneeu2HJLa/8QIwSyTWjrAjgu8hn+Qi iKlDmB1XxFVaOjynP83w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1egFQ1-0007dn-0u; Mon, 29 Jan 2018 19:48:41 +0000 Received: from mail-eopbgr50049.outbound.protection.outlook.com ([40.107.5.49] helo=EUR03-VE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1egFPx-0007cv-78 for linux-arm-kernel@lists.infradead.org; Mon, 29 Jan 2018 19:48:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=KBHdKMSnZGXQLyvCebi69ilqC/2FcMzFmM/BERnv1EQ=; b=Gmn9rytZR3JnqRDPf9OxgubfXqhZp/pmEFd1p3sPXMwzYkNqh3sKoauM8/UM6SoLRVxE7hqYFMKUgIzI/KORS0oAUgKkKl85h+xwCmQQ/JP0NZgdRU/pu6cxH1MmFjWvX08lAoU72azb1f+5EdWMVx2RQk8bAOp3bzft9FaJwVk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=roy.pledge@nxp.com; Received: from otc-sw1.am.freescale.net (192.88.168.1) by VI1PR04MB3007.eurprd04.prod.outlook.com (2603:10a6:802:9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.444.14; Mon, 29 Jan 2018 19:48:19 +0000 From: Roy Pledge To: linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, leoyang.li@nxp.com Subject: [PATCH] soc/fsl/qbman: Check if CPU is offline when initializing portals Date: Mon, 29 Jan 2018 14:47:53 -0500 Message-Id: <1517255273-10178-1-git-send-email-roy.pledge@nxp.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [192.88.168.1] X-ClientProxiedBy: BN6PR22CA0036.namprd22.prod.outlook.com (2603:10b6:404:37::22) To VI1PR04MB3007.eurprd04.prod.outlook.com (2603:10a6:802:9::13) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 68cf42f6-fbc3-4dc5-f687-08d56751409b X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:VI1PR04MB3007; X-Microsoft-Exchange-Diagnostics: 1; VI1PR04MB3007; 3:Z8MDfdhjQZOAR164lQyprZHFSBK8gIzeULdSOHpzNokY270df3Zd+qkcE8kR0lmJwUsR+l1kBYpgvoL3kU14d3BPG1kC+CY1GVV4yN+ODRCL8x7Vql/3cr+Ix9hXK0Yi+RsLZrwbeAyEjIuNGzxwjqKd/WerQY7DAp2uCikYmXLQmy1rb2cKALEN+co8QymEglK8VByleTM4UnsocLa/dV2/aMl8L+um8SCOKuR1erPCzFzbd7i6lwxnBxpLs+b5; 25:DBVsOe68Wpqwj9yoUANRMHaVPMx8svbP2mNK7qzSinSVMAUU225u3Xf+m5edyVVs71xHniVgUpQn0X11YrekaE+2d1dBul9XBHvrj4UJ1OubP7YAPdaoTsO+JPLHwl48Fp7D7vvJoq1M8zONAN3iE2LFp+wlcdVi25FYBVgJxIxQY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8nIRJNKp/xPcP9Z+cfUKrdEEPOUwzUtX/aq7RshA0+7y3NlNBX95IA/0gvRtj7s5rvWxx5SaIhXcIIiTlf9sibE4esWvZdTAJcBWXwxO1bG6BWtWX/YHnNBbcDRQLs6S77NGMag7nwUZNMgpnrHdmXfGytQkjEX1QXNp55ppwgs8c9Q28QHJ/eW76mI9y4CtQ/9o9fg9W7YDCl1m5kQ+gN7tPQfI9u+2tS+xwk9NdVxsxx93crIoilgApKjJjgW/60y3ey0ZjjmiSf4VxrST4y1cDY/yst3jcluvbvOXA0Tudj9TzJdTdAoMMhN4HO4n9MqJ5gmp1ooxIJHag= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(209352067349851)(185117386973197)(227817650892897)(275809806118684); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231101)(944501161)(3002001)(10201501046)(6055026)(6041288)(20161123562045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011); SRVR:VI1PR04MB3007; BCL:0; PCL:0; RULEID:; SRVR:VI1PR04MB3007; X-Forefront-PRVS: 0567A15835 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(366004)(39860400002)(396003)(376002)(346002)(189003)(199004)(105586002)(43066004)(8676002)(16526019)(16586007)(316002)(305945005)(478600001)(81166006)(6512007)(86362001)(81156014)(6486002)(53936002)(50466002)(50226002)(8936002)(48376002)(2906002)(66066001)(3846002)(4326008)(6116002)(106356001)(26005)(52116002)(25786009)(47776003)(5660300001)(68736007)(386003)(6506007)(51416003)(59450400001)(7736002)(97736004)(186003)(6636002)(3450700001)(6666003)(36756003); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR04MB3007; H:otc-sw1.am.freescale.net; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR04MB3007; 23:Tz6vQ7dVTq7UeHCpmiJrgOp0WNaKZAbKPyAqgxseO?= =?us-ascii?Q?wK/5bVflcpuF3lTdFvzBK8fc/6IeXRZ5s59h+xQ6YWCV0gO//+MDl0H8TKo3?= =?us-ascii?Q?9XGHxoOv5zKCysJ1OwaEQt+DxGYVroNjhG/+n8BenfzTCQim8yQ5k4HQ7bsK?= =?us-ascii?Q?N/QHdD1XXyQWKzeCrRHZVNjLCCeVKIgZ+WIHvPfj4cqsseocnRIklFlb6pL/?= =?us-ascii?Q?5oge+ekKX5+bAWUmT8dn6bqsz2JP/XZ2lJRobIWloXCVQtYVFLdZmCU/s9DD?= =?us-ascii?Q?AB+FD/6q7x8o75kjQ2s+U3rH/vVAJ2dCDkezWC2BlTr6HyLAjVrrVTzlTvjs?= =?us-ascii?Q?M4hRIowdntDS+Hp3NBqs5V2ZEI99DSlZcRBznsrGmTP7pypuh32AEJL+lEBe?= =?us-ascii?Q?t0K3A5u00cYQ5ob4jEEIEHD2prguXWj5gS9sN/0mGPGiVgP8H4u6j3YlcTCq?= =?us-ascii?Q?G9xj6puJ3KT5fGVuzQj7Qh+a0eCh8EXijw29RF2dWmWuWlWvr+OjmJiUqOZ3?= =?us-ascii?Q?wmEDAfpymmHMJ3R2TwIJHd2i4w9zQwiLELF/9kQNaI0HKF3LBFrwUZsbDoCs?= =?us-ascii?Q?ADSkBm0HfokjmO9gGxxkT/ttB+Yzi5QKkOoKpSmikdoAPn9MlW5a/cvLQUpH?= =?us-ascii?Q?kpnA1DTPPNAESCbpJSIHWlkmqLrdnGOHx/CHyxcyJTSdvlLWlawb9hySdLpL?= =?us-ascii?Q?cvfMaOhCVDQoFbH111Ud0vN39olTr2h7BMA+HyLpRDjMUOUwnjv4h+pUzR9X?= =?us-ascii?Q?6dkt/sZFd73eJ76ibqbCipUoSDEa0uHhG4tYmgr22E4gjfohIEB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Ze9qkVYsGe40ZQ6iPVYjQlkBy5g=; 7:vnQcAljP0T4CWqBDmOFBDMQBIoMJqS9Domyyhgb5/L2P1Nunt+1sIMoF52Z/z29Pxc+0dp193Y6JbFizS+Tcsw9a3TMxf5+8lh0dYNnfJPrOpXaq7FT1KlA9Z0bFCWSUZmwGO8PNhSOcYC+VuNdWg14S8/kHF9ED5oBpjLE4IR5tt9ilysESbJ+CwDKkSTK02LANOrQFhOK/GEEvEpfx+x2PU74NYC5EvZDIHpK0eGj6YUbIhaQvjdkxlnmBPy/I SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jan 2018 19:48:19.7080 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 68cf42f6-fbc3-4dc5-f687-08d56751409b X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB3007 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: , Reply-To: roy.pledge@nxp.com Cc: Roy Pledge , madalin.bucur@nxp.com 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 If the affine portal for a specific CPU is offline at boot time affine its interrupt to CPU 0. If the CPU is later brought online the hotplug handler will correctly adjust the affinity. Signed-off-by: Roy Pledge --- drivers/soc/fsl/qbman/bman.c | 17 +++++++++++++---- drivers/soc/fsl/qbman/qman.c | 18 +++++++++++++----- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/drivers/soc/fsl/qbman/bman.c b/drivers/soc/fsl/qbman/bman.c index f9485ce..2e6e682 100644 --- a/drivers/soc/fsl/qbman/bman.c +++ b/drivers/soc/fsl/qbman/bman.c @@ -562,10 +562,19 @@ static int bman_create_portal(struct bman_portal *portal, dev_err(c->dev, "request_irq() failed\n"); goto fail_irq; } - if (c->cpu != -1 && irq_can_set_affinity(c->irq) && - irq_set_affinity(c->irq, cpumask_of(c->cpu))) { - dev_err(c->dev, "irq_set_affinity() failed\n"); - goto fail_affinity; + if (cpu_online(c->cpu) && c->cpu != -1 && + irq_can_set_affinity(c->irq)) { + if (irq_set_affinity(c->irq, cpumask_of(c->cpu))) { + dev_err(c->dev, "irq_set_affinity() failed %d\n", + c->cpu); + goto fail_affinity; + } + } else { + /* CPU is offline, direct IRQ to CPU 0 */ + if (irq_set_affinity(c->irq, cpumask_of(0))) { + dev_err(c->dev, "irq_set_affinity() cpu 0 failed\n"); + goto fail_affinity; + } } /* Need RCR to be empty before continuing */ diff --git a/drivers/soc/fsl/qbman/qman.c b/drivers/soc/fsl/qbman/qman.c index e4f5bb0..463e65d 100644 --- a/drivers/soc/fsl/qbman/qman.c +++ b/drivers/soc/fsl/qbman/qman.c @@ -935,7 +935,6 @@ static inline int qm_mc_result_timeout(struct qm_portal *portal, break; udelay(1); } while (--timeout); - return timeout; } @@ -1209,10 +1208,19 @@ static int qman_create_portal(struct qman_portal *portal, dev_err(c->dev, "request_irq() failed\n"); goto fail_irq; } - if (c->cpu != -1 && irq_can_set_affinity(c->irq) && - irq_set_affinity(c->irq, cpumask_of(c->cpu))) { - dev_err(c->dev, "irq_set_affinity() failed\n"); - goto fail_affinity; + if (cpu_online(c->cpu) && c->cpu != -1 && + irq_can_set_affinity(c->irq)) { + if (irq_set_affinity(c->irq, cpumask_of(c->cpu))) { + dev_err(c->dev, "irq_set_affinity() failed %d\n", + c->cpu); + goto fail_affinity; + } + } else { + /* CPU is offline, direct IRQ to CPU 0 */ + if (irq_set_affinity(c->irq, cpumask_of(0))) { + dev_err(c->dev, "irq_set_affinity() cpu 0 failed\n"); + goto fail_affinity; + } } /* Need EQCR to be empty before continuing */