Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1960960imm; Fri, 6 Jul 2018 09:23:21 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfD3kDogUHDGCKJdHynU0jknOhZ59c4LbYUQFJj0VLAvc6a3GNRVzoRN4kVGPVPbwWi6sDw X-Received: by 2002:a63:a5c:: with SMTP id z28-v6mr9944305pgk.209.1530894201632; Fri, 06 Jul 2018 09:23:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530894201; cv=none; d=google.com; s=arc-20160816; b=kcqg9Qs3ZXLxEeVEdK5fzLs2re3uKsUpYU2wFSkZdlIXqrg1NKXYMqZtpUVeF1Pw6I lc7jgCaODsA6kfjPk9zXTxyPmfTRadh6NJHcLvEqDlTS3HJgjq6IiFJdCrjYukrQ5Xo5 ErfcLshNMS4h/0ktTGMY77cAEhpY9VZwiMvkzk8RMxm89m6WDR8PPiPKcgJ877I/NaOd Kpqa1f29C0vnLweaayQlKoHxEEEI7OSBTR7RMkAjgLn0DscVAnnnFboxAozTsXsL/+DP l0lTuZoc2iEZjiynCghXooyy7yo7n75Ro0x20MGlAmjz7fOT+vN3poLeiclWSQBlE2Li YdQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=DD30SgRk0iQO9WbBY9r6UuVlbRFrpXjGZIs4N+ybyr4=; b=aVOkWVRxN7TOagQpNO8QO632J3ee4tN7B8l6oD/XJ+qRFqD7hZuLY2BQJdF1cj+WUP XX2WEthm+Ho+AWYlUjH90vGvPHR9CPekzRZxrkPIanTjahZQf4AnKcUiWXqlQzF/fHul C9q1gXocyHJ4KLcKAacaj/bp+RbbKYN+nTKJrnCKJwMPFdLspB0hTpvc/rMujpkVhwtl NVw3J2WN9+xDEAtiS1XhmGd/166M9Bml5uEqQAGxxIW/P16iNwe263TJpgqTUIi9L5Ob H23lEi68YIPlgdSV26UjvnGjyXypwmPnv+SorFgRo8Yl9TNqIIOThPvSPdxKYrRtQiIW K+zg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m141-v6si9373726pfd.310.2018.07.06.09.23.02; Fri, 06 Jul 2018 09:23:21 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933481AbeGFQVJ (ORCPT + 99 others); Fri, 6 Jul 2018 12:21:09 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:39658 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932483AbeGFQVI (ORCPT ); Fri, 6 Jul 2018 12:21:08 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C8BBC18A; Fri, 6 Jul 2018 09:21:07 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B80763F2EA; Fri, 6 Jul 2018 09:21:05 -0700 (PDT) Date: Fri, 6 Jul 2018 17:21:00 +0100 From: Mark Rutland To: Guo Ren Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, daniel.lezcano@linaro.org, jason@lakedaemon.net, arnd@arndb.de, c-sky_gcc_upstream@c-sky.com, gnu-csky@mentor.com, thomas.petazzoni@bootlin.com, wbx@uclibc-ng.org, green.hu@gmail.com Subject: Re: [PATCH V2 16/19] csky: SMP support Message-ID: <20180706162100.3iimik242cied2c6@lakrids.cambridge.arm.com> References: <21d859826fe19aecaa2aefe3103d6d33e6f1b925.1530465326.git.ren_guo@c-sky.com> <20180706052432.q74gql32dtj5gj3b@salmiak> <20180706113200.GA27148@guoren> <20180706114352.6r7zkjunoafqtr3s@lakrids.cambridge.arm.com> <20180706122631.GA30265@guoren> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180706122631.GA30265@guoren> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 06, 2018 at 08:26:31PM +0800, Guo Ren wrote: > On Fri, Jul 06, 2018 at 12:43:52PM +0100, Mark Rutland wrote: > > Please see the devicetree spec [1], section 2.3.4. Valid values are: > > > > * "okay" // equivalent to no status property present > > * "disabled" > > * "fail" > > * "fail-sss" > Nice tip, thx. > > > I'm a bit confused. You write (1 << cpu) into cv<29, 0>, to enable a > > particular CPU, so I assume that bit uniquely identifies a CPU, > Yes, you're right and cr<29, 0>'s bit uniquely identifies a cpu. > > > and > > therefore the reg is some unique ID for the CPU. > static int csky_of_cpu(struct device_node *node) > { > const char *status; > > if (of_property_read_string(node, "status", &status)) > status = "okay"; > > if (strcmp(status, "disabled") == 0) > goto error; > > return 1; > error: > return 0; > } Please don't open-code this. Use of_device_is_available(), which checks the status property itself. e.g. void __init setup_smp(void) { struct device_node *node = NULL; while ((node = of_find_node_by_type(node, "cpu"))) { if (!of_device_is_available(node)) continue; ... } } > void __init setup_smp(void) > { > struct device_node *node = NULL; > int i = 0; > > while ((node = of_find_node_by_type(node, "cpu"))) { > if (!csky_of_cpu(node)) > continue; > > set_cpu_possible(i, true); > set_cpu_present(i, true); > > i++; > } > } > Hmm? > > No in next version patch, it's no use. Please use the reg property, you need it to describe which particular CPUs are available. You probably also want a mapping from Linux logical CPU id to your physical CPU id, and a sanity check on this. See arm64 for an example. > > I see. > > > > Is this SMP bringup mechanism architectual, or are you likely to need > > another mechanism to turn on CPUs on future chips? > It's the only SMP bringup mechanism architectual for C-SKY SMP. There is > no another way in future and SOC vendor couldn't change it. > > > You probably want to use an enable-method property to describe this. > No, thx. Fair enough. Thanks, Mark.