Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp48851img; Tue, 19 Mar 2019 15:22:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqxHEk2PWPDdJW8jCdmMPpn022cz2LBQKlqO2w5TSBZ2tkUmzMETU5LiBjyp9kRbNKrJjfd9 X-Received: by 2002:a63:f310:: with SMTP id l16mr3968843pgh.72.1553034139681; Tue, 19 Mar 2019 15:22:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553034139; cv=none; d=google.com; s=arc-20160816; b=RgdZTC0h2xLl5UUyEkNrbYIAmdM9Ozo2mbtDuVzwLZh8krkAT+GDe8OmZigU1duj7l kzJaqNFQ/ARfXQb46PSdGBdamMsV1QoclE+YVXXyRQZ/C2xgOUlJ9p8pxaLRRq2XYGVx rpB+4qBMcUP6oxi01Jv7XBImO7MiVZPkZ3EaogPgjbVN8K0qOfcBa4Xbl2myTKImC0rF FwU2oAvmTpnSjq4xXsesc8WJY8h5GA1XTcf5bRVNSeKGWyET01EqYXKDDU2Cc0EWyecC K1FMADXxlKxgqDTRQj4BBoYWT4DqmQEVDjdPCoIQU+kw7ZkQWzM1SWIV97JV8jRvdWUd f2yA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr:dkim-signature; bh=vIDR1yDB2MMJxT1UvgFuBU43UwC8IImTDqu66/Zg7bA=; b=xuQZBangx0BzD6L1iTNgxP4lUSxUGeW/Pt3T5SnV/HN8Z6NQO4RbIH5vzuO+uRF4DU ej8Kz4OOXyF2EcVzYjXWK0YRfkCntibJnPrB0++vfgyesJh3thpXeDrPOt6tj6ezENLs sIkVShfYzuNmMmSWNjB5qO/grfn800kWZPwgsH4/byaz5LWhVPnRdDsFL4jKv1vWYdH5 /dpskdG4LerTE0iBw7QweFOxPj4cjKkD5+Y2dtCVSps43ugD2tAan43ISOYgfYLK7+c0 68jDJDMcemBDrs20AS+zP5IXbUeT1mJsDvUPJYPWNW++d/mVSB5nawoXLAJBMs2Tjfj+ 1J5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=nE2ueLYU; 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=fail (p=NONE sp=NONE dis=NONE) header.from=wdc.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p70si88579pfa.9.2019.03.19.15.22.04; Tue, 19 Mar 2019 15:22:19 -0700 (PDT) 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=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=nE2ueLYU; 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=fail (p=NONE sp=NONE dis=NONE) header.from=wdc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727674AbfCSWUp (ORCPT + 99 others); Tue, 19 Mar 2019 18:20:45 -0400 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:6016 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727655AbfCSWUn (ORCPT ); Tue, 19 Mar 2019 18:20:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1553034043; x=1584570043; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=L+ofvLBu3teqXjyuNvizoBfdnh+2OK/Hq+Is5NyQizk=; b=nE2ueLYUpkEZFGFCAo1XgT5WbMLAq3JK3eFf+mkdLvPxyH/EJBh0CODZ mL4MkbCYD+4TDmCPzAl4R1l9USMjw4yDpdTUaB92nFnNaahc5OLgSCcoD 7BTyruU6S6gn5taN1WEXe23swArfiqhZwd7atAELU1NOniCO8K1McAqM+ 4wOlS9heNvTQaHVk0JHO8sapfVaNf7p3I3Qts+oGF1PIqi+SFB/jYxbBb MSfViUD1kQWF6hy/Ugj8POO1W/mkxM0k7qzzFjFiaY31X7KVBeT6RK76K i0DmGzG6IXDma552mD6N56qIeYbK4p6SneHKkpDhfgEnMIGpUcb44KF6/ w==; X-IronPort-AV: E=Sophos;i="5.60,246,1549900800"; d="scan'208";a="105523542" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 20 Mar 2019 06:20:43 +0800 IronPort-SDR: lxPgpNvV+B3gjLQsp6+FmFCUB7cDimAld31ye6EJO3qd5JmCh76p6PBCuO7bZrHllj5w67OyNr OSNVWDZ4WE/gkNRmx2Lfdn+M6+15HymJhnG+fUIBpxvrXDNfFQf5bNL1WG2BMySIJ9fssqXHBG ptlAgcswllqzQTb39KaixH3O33FrxV0nH00Z8k5XQaaOJsp1D5TfnMngu26rwZBewxncgbYjNO dXVrfvCGKvZ++RhMIeOolRURo3piKcSZ4YajwJif/DcpiAqM59Rq3D8hVhtmBxQFLlm5te9334 N5VCY1/pv42cDx2gJMVDuo48 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 19 Mar 2019 14:58:20 -0700 IronPort-SDR: VcKq2dqPDs/FdGnf+fVnkyRVToeqlLSVJ7/l5js6EPxjNkDWo3KcMkYjyoDiiKm3LHkTogiUMY hgdWkDLRevhuHVM/JAMf7UpjznW7YtgYFW+Rctq/nGIdMxFXJbsqJKbYvqAicMDbZeCE2WGyZZ pSGv3d3vuGALE0Q1j6Ka21To44+GFz8Y9qb/jRlHbjyNvMhxyNpAmVagm7pHNemcnQFehPk5an z/PG4qc1fPR6YWIA8dgIxTHiHQ1YCYdSuPqP2bi+OKDkN4mXXP7mvJV9dJHuHoMUnxj42IyT5s EgY= Received: from jedi-01.sdcorp.global.sandisk.com (HELO jedi-01.int.fusionio.com) ([10.11.143.218]) by uls-op-cesaip02.wdc.com with ESMTP; 19 Mar 2019 15:20:43 -0700 From: Atish Patra To: linux-riscv@lists.infradead.org Cc: Atish Patra , Albert Ou , Andreas Schwab , Anup Patel , Dmitriy Cherkasov , Johan Hovold , linux-kernel@vger.kernel.org, Palmer Dabbelt , Paul Walmsley , Damien Le Moal , Anup Patel Subject: [v1 PATCH 3/4] RISC-V: Implement nosmp commandline option. Date: Tue, 19 Mar 2019 15:20:27 -0700 Message-Id: <20190319222028.4293-3-atish.patra@wdc.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190319222028.4293-1-atish.patra@wdc.com> References: <20190319222028.4293-1-atish.patra@wdc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org nosmp command line option sets max_cpus to zero. No secondary harts will boot if this is enabled. But present cpu mask will still point to all possible masks. Fix present cpu mask for nosmp usecase. Signed-off-by: Atish Patra --- arch/riscv/kernel/smpboot.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c index df353199..609475c5 100644 --- a/arch/riscv/kernel/smpboot.c +++ b/arch/riscv/kernel/smpboot.c @@ -49,6 +49,17 @@ void __init smp_prepare_boot_cpu(void) void __init smp_prepare_cpus(unsigned int max_cpus) { + int cpuid; + + /* This covers non-smp usecase mandated by "nosmp" option */ + if (max_cpus == 0) + return; + + for_each_possible_cpu(cpuid) { + if (cpuid == smp_processor_id()) + continue; + set_cpu_present(cpuid, true); + } } void __init setup_smp(void) @@ -76,7 +87,6 @@ void __init setup_smp(void) cpuid_to_hartid_map(cpuid) = hart; set_cpu_possible(cpuid, true); - set_cpu_present(cpuid, true); cpuid++; } -- 2.21.0