Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1681047imm; Fri, 6 Jul 2018 04:45:00 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeOnUldI1UrckABHTFwsEFBsctIgC1CzY/xgFwfOHjJngbN2xb9hMLbEYTk/5vxPDBDk2Wq X-Received: by 2002:a17:902:be0d:: with SMTP id r13-v6mr9944658pls.299.1530877500244; Fri, 06 Jul 2018 04:45:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530877500; cv=none; d=google.com; s=arc-20160816; b=NwkO5eIJ/Xqj9LTi23QwRS+l9UuC0djVZU1Deo3WoRcSVo5LT3E8OKlOdzciI7eXht hG5EQkRDLfIijPfEaxqJBmX0eQ8YtZWRNBizMzNprbWDaEKXy4nspSEDd5gFFLyKMM+Q aACvSSsTzG1FptuPWU2lL5lCw6qIbDZoAfUL3uoXWkmy+5jNjJW6Eok7z70E77C+/4wc kuSOIqcVUmFYFrtT0IE559EZMTyCMBLsqMrhVrEyn5+0DwK4SVG9PBtKKKkwGoRV4+Nf QK3EddFYOP9pfAhwoN/IpxunvbMraA3Hf/oz16duTmzUaENjS5pAvIf5nuwDpmLXWHMl D2SQ== 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=0iemfizyj5jxGusrH7DVOk9cYO4BSkEefb60w7aUMe8=; b=0Ux7/ifrB5megBMHRIBou0VxBZNflei1R0nJWfXEI1hxzqexCsIe6YKZmxx4m/X2Hw sB4a+sjwZ9tOVuSq/aLl4gNZFXJgjhs3MnHAPngnp3NtVUVwJCjR9NJkJDBjrprVoxvB XMBMH9mBVcKR10uLgSg2c3rLiSJqxfbtEcIlBWjiC+O9APlO0ko3JK5C2XuGLOyWa7ys GeqoDJvf3wxTEie1yomixTsizChX4Bps/6Df0XMKSf9Z4byhlum8koXg8g/j/Eejsm3o MKNHOYv/zpMz8r9FeuDcOIHNxoUnE2xtD6eHbQkSJMOexjzwH/6FkxJY6lfmxqLCGv47 Mw5A== 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 o1-v6si7949299pld.424.2018.07.06.04.44.45; Fri, 06 Jul 2018 04:45:00 -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 S932679AbeGFLn7 (ORCPT + 99 others); Fri, 6 Jul 2018 07:43:59 -0400 Received: from foss.arm.com ([217.140.101.70]:35198 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932348AbeGFLn5 (ORCPT ); Fri, 6 Jul 2018 07:43:57 -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 3DECF18A; Fri, 6 Jul 2018 04:43:57 -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 2DA273F5BA; Fri, 6 Jul 2018 04:43:55 -0700 (PDT) Date: Fri, 6 Jul 2018 12:43:52 +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: <20180706114352.6r7zkjunoafqtr3s@lakrids.cambridge.arm.com> References: <21d859826fe19aecaa2aefe3103d6d33e6f1b925.1530465326.git.ren_guo@c-sky.com> <20180706052432.q74gql32dtj5gj3b@salmiak> <20180706113200.GA27148@guoren> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180706113200.GA27148@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 07:32:01PM +0800, Guo Ren wrote: > 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"; > }; > }; Neither "on" nor "off" are standard status values either. Please see the devicetree spec [1], section 2.3.4. Valid values are: * "okay" // equivalent to no status property present * "disabled" * "fail" * "fail-sss" > > 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. 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, and therefore the reg is some unique ID for the CPU. [...] > > > +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 I see. Is this SMP bringup mechanism architectual, or are you likely to need another mechanism to turn on CPUs on future chips? You probably want to use an enable-method property to describe this. Thanks, Mark. [1] https://www.devicetree.org/specifications/