From patchwork Thu Dec 12 06:50:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 3329881 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 335FFC0D4A for ; Thu, 12 Dec 2013 06:53:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E75CA20806 for ; Thu, 12 Dec 2013 06:53:05 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BAF6C20804 for ; Thu, 12 Dec 2013 06:53:04 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vr08q-0002Yl-6N; Thu, 12 Dec 2013 06:53:00 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vr08n-0003Ac-N5; Thu, 12 Dec 2013 06:52:57 +0000 Received: from mail-pd0-f175.google.com ([209.85.192.175]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vr08k-0003A8-Q5 for linux-arm-kernel@lists.infradead.org; Thu, 12 Dec 2013 06:52:55 +0000 Received: by mail-pd0-f175.google.com with SMTP id w10so10969716pde.34 for ; Wed, 11 Dec 2013 22:52:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=8V2Ovz4uMV1tv+8eYGlspvVk+MS6kKIZzTO4MRnAoHc=; b=CDh8xiWAdYW6dTtPoam6TCkgcFf3ZJxsLQaMP+SlyIZWDTXlLtLZtadmjFq56Z6U4w KHbhH7yWtsxZ4g+nGYZ0GlTF3BuMwmVpVmBmOKVMmrIf8HOjAIv8NAv7rEyTiOX7crIg uj5FkrzTMAAuxxwMn/5ziS0EDbODIJHm1s3Xlj9BOyzzeillXHTnXqMwpwNWHXcQQ9++ nwXPZMJkI9OEUXeooDB7s9R7zCUj4zOBQ3ZT+7JlnIcDJHzlSVet+IZlOJxGULRa2uQP q+ghXShpLQIhSWtFvZjoYdfG3GGdTqZmeUC3+eGFSqUZOSrWgK5176ud6a5bRpKyT8/e RdfQ== X-Gm-Message-State: ALoCoQlszM1iqZCrdJtdys3Ud+1a7cu3jv3B37vW+1ldCHGbR8r5bdtkx1V8SPfu5oNq6qc3hGw3 X-Received: by 10.68.195.70 with SMTP id ic6mr8967642pbc.112.1386831147802; Wed, 11 Dec 2013 22:52:27 -0800 (PST) Received: from [192.168.204.184] ([218.17.215.175]) by mx.google.com with ESMTPSA id ye1sm51882415pab.19.2013.12.11.22.50.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 11 Dec 2013 22:52:27 -0800 (PST) Message-ID: <52A95CB3.2030805@linaro.org> Date: Thu, 12 Dec 2013 14:50:27 +0800 From: Hanjun Guo User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Catalin Marinas , Mark Brown Subject: Re: [PATCH 1/6] arm64: Add asm/cpu.h References: <1386767606-6391-1-git-send-email-broonie@kernel.org> <20131211141018.GC596@darko.cambridge.arm.com> <20131211142308.GY11468@sirena.org.uk> <20131211142705.GE596@darko.cambridge.arm.com> In-Reply-To: <20131211142705.GE596@darko.cambridge.arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131212_015254_917594_5F796C62 X-CRM114-Status: GOOD ( 20.97 ) X-Spam-Score: -1.1 (-) Cc: "linux-arm-kernel@lists.infradead.org" , "linaro-kernel@lists.linaro.org" , Will Deacon , Mark Hambleton , Graeme Gregory X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_WEB, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 2013-12-11 22:27, Catalin Marinas wrote: > On Wed, Dec 11, 2013 at 02:23:08PM +0000, Mark Brown wrote: >> On Wed, Dec 11, 2013 at 02:10:19PM +0000, Catalin Marinas wrote: >>> On Wed, Dec 11, 2013 at 01:13:21PM +0000, Mark Brown wrote: >> >>>> +struct cpuinfo_arm { >>>> + struct cpu cpu; >>>> + u64 cpuid; >>>> +#ifdef CONFIG_SMP >>>> + unsigned int loops_per_jiffy; >>>> +#endif >>>> +}; >> >>> How is this structure used? I haven't seen the ACPI code doing anything >>> with struct cpu (though I haven't dug deep enough). Also loops_per_jiffy >>> is useless, that's related to the delay loop based on the generic timer. >> >> Now I look again we can probably drop this for the toplogy work - it had >> been pulled in as part of pulling things in from pre-v8 and the cpuid >> was used in the code while I was working on it but isn't any more unless >> I'm misreading the code. >> >> I don't know what the ACPI guys are doing wtih it, I just saw they added >> the same thing. > > It looked to me that for ACPI and empty asm/cpu.h file would do for now. > There are a couple of prototypes for CPU hotplug I think but haven't > seen the structure used (not even the x86_cpu one). In ACPI code, only struct cpu is used for ACPI based CPU hotplug, here is the code will send to upstream when the ACPI core for ARM is ready. --- arch/arm64/include/asm/cpu.h | 5 +++++ arch/arm64/kernel/topology.c | 26 ++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/arch/arm64/include/asm/cpu.h b/arch/arm64/include/asm/cpu.h index dbeb98d..5613e09 100644 --- a/arch/arm64/include/asm/cpu.h +++ b/arch/arm64/include/asm/cpu.h @@ -20,6 +20,11 @@ struct cpuinfo_arm { #endif }; +#ifdef CONFIG_HOTPLUG_CPU +extern int arch_register_cpu(int cpu); +extern void arch_unregister_cpu(int cpu); +#endif + DECLARE_PER_CPU(struct cpuinfo_arm, cpu_data); #endif diff --git a/arch/arm64/kernel/topology.c b/arch/arm64/kernel/topology.c index cb548f1..5c8e69c 100644 --- a/arch/arm64/kernel/topology.c +++ b/arch/arm64/kernel/topology.c @@ -18,3 +18,29 @@ void arch_fix_phys_package_id(int num, u32 slot) } EXPORT_SYMBOL_GPL(arch_fix_phys_package_id); +#ifdef CONFIG_HOTPLUG_CPU +int __ref arch_register_cpu(int cpu) +{ + struct cpuinfo_arm *cpuinfo = &per_cpu(cpu_data, cpu); + + /* BSP cann't be taken down on arm */ + if (cpu) + cpuinfo->cpu.hotpluggable = 1; + + return register_cpu(&cpuinfo->cpu, cpu); +} +EXPORT_SYMBOL(arch_register_cpu); + +void arch_unregister_cpu(int cpu) +{ + unregister_cpu(&per_cpu(cpu_data, cpu).cpu); +} +EXPORT_SYMBOL(arch_unregister_cpu); +#else /* CONFIG_HOTPLUG_CPU */ + +static int __init arch_register_cpu(int cpu) +{ + return register_cpu(&per_cpu(cpu_data, cpu).cpu, cpu); +} +#endif /* CONFIG_HOTPLUG_CPU */ +