Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1672146imm; Fri, 6 Jul 2018 04:34:07 -0700 (PDT) X-Google-Smtp-Source: AAOMgperLbT0DxP1VzPmOSPBCMd72IivSe6nx0DCqWWLujVcH6Bzf3HGbZ7hT13CQZLTaPXiNGsi X-Received: by 2002:a17:902:a505:: with SMTP id s5-v6mr10104489plq.66.1530876847365; Fri, 06 Jul 2018 04:34:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530876847; cv=none; d=google.com; s=arc-20160816; b=BSzWUvR9wYZU++vPgQp6y9Spd9ZeHFl/c9pp1eViwXpv5hqLhZhniM8hMWzjvlP/Sx K1duGqw7+dc649RTITudiZMGnvft/uXbAZMktneQXXmLvVLifYjGt08QAcj19kDPZnrO P9VSA5Uq3+tSVY6jViULnIPg6PhEjfwkzqGe5tMsB2G93xYwl+hzcb4IxdE41YREaA9P ZKdZQPrx9Sp5rqT7jA3g0CYezfUrYlhunV2H3apSEmDcv8LwfISgIqQM8sLqVka4Zd2U pb+/O0ijJnc7QdnpmQQb5b0TAj6HFpWNEjjtijIczS96tO8RNM60RQ1/QMnBxR0GlDOd 36wA== 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=2YAxxOLZqqdZT3C93HU34CVvmhxMi1FEShV1xk2JAws=; b=ajjUwpoAeqasG+Yq6ZIe6KBBc3Ywa1VcULABsMWfHCC/N7rQTTjwK+Lz9jOR6L3E+a W2/xukpcj17cG3tElOwcsh4ofAcymbpPKSZiWfNZLpc+1pfx54zsgsP+mDY52k1gI1QK Crhit4xC5aWtrpnbzlXp/JJMAN2INsrS5MkRHNLQSjCEVO410piCNajboe3jlZrbFolz O1bBc7NbN4IwVnZD2Mu5KOGhsLRGRBJtTB1oDFF8WOS2oEzbcUboK7kNirBAcXG6Oqte sTQEhjSYmCr2+AE9ezQ+/eWgGpvFKyU0qekKtsy5vwl+b+MjhUZRt0PS8jbtyH9JXKqF 7UXw== 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 v4-v6si7259883pgs.299.2018.07.06.04.33.43; Fri, 06 Jul 2018 04:34:07 -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 S932665AbeGFLce (ORCPT + 99 others); Fri, 6 Jul 2018 07:32:34 -0400 Received: from smtp2200-217.mail.aliyun.com ([121.197.200.217]:49569 "EHLO smtp2200-217.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932236AbeGFLcd (ORCPT ); Fri, 6 Jul 2018 07:32:33 -0400 X-Alimail-AntiSpam: AC=CONTINUE;BC=0.07571276|-1;CH=green;FP=0|0|0|0|0|-1|-1|-1;HT=e02c03302;MF=ren_guo@c-sky.com;NM=1;PH=DS;RN=12;RT=12;SR=0;TI=SMTPD_---.CN49ibC_1530876721; Received: from localhost(mailfrom:ren_guo@c-sky.com fp:SMTPD_---.CN49ibC_1530876721) by smtp.aliyun-inc.com(10.147.41.121); Fri, 06 Jul 2018 19:32:01 +0800 Date: Fri, 6 Jul 2018 19:32:01 +0800 From: Guo Ren To: Mark Rutland 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: <20180706113200.GA27148@guoren> References: <21d859826fe19aecaa2aefe3103d6d33e6f1b925.1530465326.git.ren_guo@c-sky.com> <20180706052432.q74gql32dtj5gj3b@salmiak> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180706052432.q74gql32dtj5gj3b@salmiak> User-Agent: Mutt/1.5.24 (2015-08-30) 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 06:24:33AM +0100, Mark Rutland wrote: > > + 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); Ok. > "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. cpus { #address-cells = <1>; #size-cells = <0>; cpu@0 { device_type = "cpu"; reg = <0>; status = "on"; }; cpu@1 { device_type = "cpu"; reg = <1>; status = "off"; }; }; > What is the value in the reg property, exactly? See above, I'll remove the reg property and it's no use. > Is there a unique ID in > hardware for each CPU in the system? There is no unique ID in current CPU: ck860. > > It would be good to document this, e.g. as arm does in > Documentation/devicetree/bindings/arm/cpus.txt Ok. > > + > > + 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? Bug. I'll add NR_CPUS limit. > > +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? No, not a fixed address. I put it arch/csky/kernel/traps.c:79-83 trap_init() #ifdef CONFIG_SMP mtcr("cr<28, 0>", virt_to_phys(vec_base)); VEC_INIT(VEC_RESET, (void *)virt_to_phys(_start_smp_secondary)); #endi Guo Ren