Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1393001imm; Thu, 5 Jul 2018 22:25:38 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeUVhgndwrapzaWr04OkRF4/OnGyqyprvDoTLbdGj7yu4eK+kShyZRdkhOWwOG1aVqSH/b8 X-Received: by 2002:a17:902:22:: with SMTP id 31-v6mr9045539pla.332.1530854738465; Thu, 05 Jul 2018 22:25:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530854738; cv=none; d=google.com; s=arc-20160816; b=gKmUKIXGyS+xKbX6u70zx/f72kyBayz/6vZzJKXTaZeJaWDoXtsYYVmLt+4f/2fxLT Kmxls6k40RA5dCPZSJKZ/LKflVQhAOwau3RkkRzCtHqoddbCbxEW/Uk+KxQd96CbGG8P obuFgbnp4mcjWNQWeqD1NAH+TLexpmm99hCZ9AAiaknIAMWEavqllURbrQkJ0NO3SWpn tBPs3qoacem7QjnF7cFqYY7M2WmWxqYvstcjywizHJh2bWz7sHT9MPo9f8Apx04KRWyo aSfRdxlyO8lWSoBi1tbsp04znjPECAM4vVWSIiPA3rpl54VCrNZ4GFKeYS/dJRy6gQyG dl+A== 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=5crcXVCUzSbYZkSdaESa3IrwvvWNhWrbUNPhxAZueo8=; b=oBurOMTU3pE4Snkn4R6Kq5IAHZzP6Jq89Ee0S5/Qu68BlhsnSANN/tUNrDn4v9auxl KeOrJi0YerZDQ7ZCWGlxdhRAMflQJ/FCltYntGudFEsqJURgjPBFYWy6r7kHUGSncZBB 0mAOgloguBaTix97N/m2HSWGy65jAsTPqcau5e9jTb5YDJu33jUqEWo1j50ZSUgwwCwx Hya8FQjypsEmTx29vmLmnrbBwDkVPH2Binz0OiU6DTEmpRXSD+p30gW1sd+fueJclU0s /VcT+4K1cWOy4MeEqrKOViw2jp5YezXRynupi29ZJzB0pGWnOwOzEonurytUWVZrrQI8 RdGQ== 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 w6-v6si7140697pgb.61.2018.07.05.22.25.23; Thu, 05 Jul 2018 22:25:38 -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 S932318AbeGFFYo (ORCPT + 99 others); Fri, 6 Jul 2018 01:24:44 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:58748 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932199AbeGFFYm (ORCPT ); Fri, 6 Jul 2018 01:24:42 -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 E0B1DED1; Thu, 5 Jul 2018 22:24:41 -0700 (PDT) Received: from salmiak (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 70C343F5BA; Thu, 5 Jul 2018 22:24:39 -0700 (PDT) Date: Fri, 6 Jul 2018 06:24:33 +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: <20180706052432.q74gql32dtj5gj3b@salmiak> References: <21d859826fe19aecaa2aefe3103d6d33e6f1b925.1530465326.git.ren_guo@c-sky.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <21d859826fe19aecaa2aefe3103d6d33e6f1b925.1530465326.git.ren_guo@c-sky.com> 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 Mon, Jul 02, 2018 at 01:30:19AM +0800, Guo Ren wrote: > +static int csky_of_cpu(struct device_node *node) > +{ > + const char *status; > + int cpu; > + > + if (of_property_read_u32(node, "reg", &cpu)) > + goto error; > + > + if (cpu >= NR_CPUS) > + goto error; > + > + if (of_property_read_string(node, "status", &status)) > + status = "enable"; > + > + if (strcmp(status, "disable") == 0) > + goto error; Please use of_device_is_available(node); "enable" is not a sensible value for the status property, and "disable" (rather than "disabled") is simply unusual. Neither "enable" nor "disable" are correct values for the status property. What is the value in the reg property, exactly? Is there a unique ID in hardware for each CPU in the system? It would be good to document this, e.g. as arm does in Documentation/devicetree/bindings/arm/cpus.txt > + > + return cpu; > +error: > + return -ENODEV; > +} > + > +void __init setup_smp(void) > +{ > + struct device_node *node = NULL; > + int cpu; > + > + while ((node = of_find_node_by_type(node, "cpu"))) { > + cpu = csky_of_cpu(node); > + if (cpu >= 0) { > + set_cpu_possible(cpu, true); > + set_cpu_present(cpu, true); > + } > + } > +} What happens if/when the value in the reg property is larger than NR_CPUS? > +int __cpu_up(unsigned int cpu, struct task_struct *tidle) > +{ > + unsigned int tmp; > + > + secondary_stack = (unsigned int)tidle->stack + THREAD_SIZE; > + > + secondary_hint = mfcr("cr31"); > + > + secondary_ccr = mfcr("cr18"); > + > + pr_info("%s: CPU%u\n", __func__, cpu); > + > + tmp = mfcr("cr<29, 0>"); > + tmp |= 1 << cpu; > + mtcr("cr<29, 0>", tmp); > + > + while (!cpu_online(cpu)); > + > + secondary_stack = 0; > + > + return 0; > +} I don't see a start address being setup here, so I assume that CPUs branch to a fixed address out-of-reset. Does that mean that the kernel has to be loaded at a particular physical address on a given platform? Thanks, Mark.