Received: by 10.223.176.5 with SMTP id f5csp3325884wra; Mon, 29 Jan 2018 11:50:10 -0800 (PST) X-Google-Smtp-Source: AH8x225b3QJqxCgaTNINonjVN/X17y79Jl9d0kmS/4dvL675pHdXORl/xBZV6MOVdWOEYsv3mX7B X-Received: by 2002:a17:902:a24:: with SMTP id 33-v6mr23092086plo.141.1517255410488; Mon, 29 Jan 2018 11:50:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517255410; cv=none; d=google.com; s=arc-20160816; b=iwiDbVBsoCI0ZX+Il0uJehQPRJ8UuLBMoNMUWQHgE5WPhr3QZ7ckT3Yf2WX8lZtK9c zeuqPjMrZC7cgaF3Fk2rENvmyxqVcNJoPnPk1zGC5E6vnkM8mZS1F4ZROU5F/biYMTpA 7GBvmw5jV2vniNixmi8pea6FhNCj3K+ibr1CWWZSnKhC8p5LuMkXAQ6lvZHAthsSa+mn T2H4Iml30WgZqphr2L+Op4CoSCCFYiMqQt5GYS0I50qnSDLwQQPvjUXFDjhEVqNpxnG+ nvfnVpMb7k9wKIC2rDFrhL7IhtB0+pIk1PGjtVcZ8T1+Cf6515yDqn5a7QY3NI9zhV+G iQpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:reply-to:message-id:date:subject :cc:to:from:dkim-signature:arc-authentication-results; bh=KBHdKMSnZGXQLyvCebi69ilqC/2FcMzFmM/BERnv1EQ=; b=mjuG3zNO5q0Qa0+gimvckHpuxYzpw3fGfbkINtYXMrbEht0dGHQKXctdi7zpu7t9YP bIzj/TPYdc7h9pzpY4HPzgVonAiRFLEOSTvjxFojAy1kUgAejfirPUScIspeg5USaG66 j1mMcWLybdjHWFizdJHDMVJjns0hObrscZzv32193zHNzk84vVsc+hY74CmGQPr/QlG7 YY7srAMqxyrmmPZFYwHb/LQQopzoK8QgJq409Ll/9Ar+3lsrf6mBgkwWgsHIc3yuQwsB 0ZAX/Goz4B0Rosy4lkfU5CgNIfI+TVpakPhapjkte3mmgrLjWwO6l0eiyX/GwhFlNuKu ma+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector1 header.b=Gmn9rytZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h10-v6si2319813plk.706.2018.01.29.11.49.56; Mon, 29 Jan 2018 11:50:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector1 header.b=Gmn9rytZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752038AbeA2Ts0 (ORCPT + 99 others); Mon, 29 Jan 2018 14:48:26 -0500 Received: from mail-eopbgr50073.outbound.protection.outlook.com ([40.107.5.73]:64608 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751762AbeA2TsY (ORCPT ); Mon, 29 Jan 2018 14:48:24 -0500 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 Cc: madalin.bucur@nxp.com, Roy Pledge 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 Reply-to: roy.pledge@nxp.com MIME-Version: 1.0 Content-Type: text/plain 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+OD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crlGSG09WkXv2c8erh+sQlzxw8XXYEjJIWD+TN+d72OygJYpGYepWPGVsm2OIDZsktdO/YhnTBTd0dYXFhqwwEaGg6FDNWqrYJAdqXB96aYbK8ttXcj6s3v/PmSeQXv0Gok4zdGna4rGfP25w8VcluCukULrfmmmkglXXR1xqdklvbJO2yvJLhAxz3u7msMRbxQCDYIDHpgHxMgshFArWr0sW8ygVraBG4L/kLyr9;4:THwBYKWiC1j5Xp8qx3ICSVTjMbBtekG7jb/KwBLyslpRyQ+TfPFwjTBVYdqrWP/8A+sjNdROs3I9SQhTTbrzBastkZ8nIRJNKp/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?wmEDAfpymmHMJ3R2TwIJHd2i4w9zQ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ejn4XOY7MuRTYUFKAAi7SLX7o6l6mVCU2kHD/1nEexy+r948k9yM=;5:e8AJsAbmQ3U0bjDjqagOrmfyq96pZ3HuEMUWtr8ly0LqFeJW3mZEwtkvT2i+bNV6rY2OKRywqfHh3BpTfMnx890xv+iZYS2QesoKbkjJsScouE8zyOH+AGNYpLaGrh+aXHRqe5pGyw7DmLT/Uv2tdDwdIXqF+pAadXGWzF71pJU=;24:4yDm4ZQK88WMpfZONaEr+QEe/DKDA27gEVMNaJFF7Z3dyUiiK8bK2Lu6HYaBXIO05XeNtPT6yS7gQsrDZe9qkVYsGe40ZQ6iPVYjQlkBy5g=;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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 */ -- 2.7.4