From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B65F6C433EB for ; Mon, 27 Jul 2020 17:29:21 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 87BC42073E for ; Mon, 27 Jul 2020 17:29:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="O3YEKjOp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 87BC42073E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=C3gO8zamzkKGazrD2R7lMutw6HbZI29Q1hr/0vCpiHc=; b=O3YEKjOpSOoCDo2CLsBhTJ3a7 3ADMIJabP5pcJ8R79pYaHBmHizv9UTgRFgOiqZRkhG9wsUAu6FXTEEaoAVu0WxUKvNmgaCMLjspad roT0T1qDhscGwNs4xA0XVyoPEyGtupWUtWN4xzMSreWGYRt0jB/HFXMrxNdpqwRYrB+Lc9WhhJYEL ppgdVqEykfURXLKVvnLeZ2GzT/yGIelOS2EQZJWJk+GvLqnyZi6d/KTpF7HRZDKSdAiWptEfFfBtY /Dv9RDBxNxT3tUlyyanaVrDdiLsa6sBvMxj9kq5+zVtHst7FOfV25kpsoDfe9Ed1pGCR9wlgciPrU 4aSlysWLQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k06uq-0007ZO-3A; Mon, 27 Jul 2020 17:27:56 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k06um-0007Yd-8U for linux-arm-kernel@lists.infradead.org; Mon, 27 Jul 2020 17:27:53 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3D38930E; Mon, 27 Jul 2020 10:27:49 -0700 (PDT) Received: from bogus (unknown [10.37.12.41]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7B18A3F718; Mon, 27 Jul 2020 10:27:47 -0700 (PDT) Date: Mon, 27 Jul 2020 18:27:44 +0100 From: Sudeep Holla To: Kefeng Wang Subject: Re: [PATCH -next v2] arm64: Fix __cpu_logical_map undefined issue Message-ID: <20200727172744.GD8003@bogus> References: <20200727152938.28664-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200727152938.28664-1-wangkefeng.wang@huawei.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200727_132752_394927_03DCA48D X-CRM114-Status: GOOD ( 24.47 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: anshuman.khandual@arm.com, catalin.marinas@arm.com, mperttunen@nvidia.com, hch@infradead.org, Hulk Robot , viresh.kumar@linaro.org, sumitg@nvidia.com, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org (+ ALKML) On Mon, Jul 27, 2020 at 11:29:38PM +0800, Kefeng Wang wrote: > The __cpu_logical_map undefined issue occued when the new > tegra194-cpufreq drvier building as a module. > > ERROR: modpost: "__cpu_logical_map" [drivers/cpufreq/tegra194-cpufreq.ko] undefined! > > The driver using cpu_logical_map() macro which will expand to > __cpu_logical_map, we can't access it in a drvier. Let's turn > cpu_logical_map() into a C wrapper and export it to fix the > build issue. > > Also create a function set_cpu_logical_map(cpu, hwid) when assign > a value to cpu_logical_map(cpu). While I don't have any objection to this in principle, I want to avoid exporting this if possible. I have responded to Sumit's response. -- Regards, Sudeep > > Reported-by: Hulk Robot > Signed-off-by: Kefeng Wang > --- > arch/arm64/include/asm/smp.h | 7 ++++++- > arch/arm64/kernel/setup.c | 8 +++++++- > arch/arm64/kernel/smp.c | 6 +++--- > 3 files changed, 16 insertions(+), 5 deletions(-) > > diff --git a/arch/arm64/include/asm/smp.h b/arch/arm64/include/asm/smp.h > index ea268d88b6f7e..f362dddd09c47 100644 > --- a/arch/arm64/include/asm/smp.h > +++ b/arch/arm64/include/asm/smp.h > @@ -47,7 +47,12 @@ DECLARE_PER_CPU_READ_MOSTLY(int, cpu_number); > * Logical CPU mapping. > */ > extern u64 __cpu_logical_map[NR_CPUS]; > -#define cpu_logical_map(cpu) __cpu_logical_map[cpu] > +extern u64 cpu_logical_map(int cpu); > + > +static inline void set_cpu_logical_map(int cpu, u64 hwid) > +{ > + __cpu_logical_map[cpu] = hwid; > +} > > struct seq_file; > > diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c > index c793276ec7ad9..457652de9df40 100644 > --- a/arch/arm64/kernel/setup.c > +++ b/arch/arm64/kernel/setup.c > @@ -85,7 +85,7 @@ u64 __cacheline_aligned boot_args[4]; > void __init smp_setup_processor_id(void) > { > u64 mpidr = read_cpuid_mpidr() & MPIDR_HWID_BITMASK; > - cpu_logical_map(0) = mpidr; > + set_cpu_logical_map(0, mpidr); > > /* > * clear __my_cpu_offset on boot CPU to avoid hang caused by > @@ -276,6 +276,12 @@ arch_initcall(reserve_memblock_reserved_regions); > > u64 __cpu_logical_map[NR_CPUS] = { [0 ... NR_CPUS-1] = INVALID_HWID }; > > +u64 cpu_logical_map(int cpu) > +{ > + return __cpu_logical_map[cpu]; > +} > +EXPORT_SYMBOL_GPL(cpu_logical_map); > + > void __init setup_arch(char **cmdline_p) > { > init_mm.start_code = (unsigned long) _text; > diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c > index 8059d50bc8cbc..03957a1ae6c0c 100644 > --- a/arch/arm64/kernel/smp.c > +++ b/arch/arm64/kernel/smp.c > @@ -566,7 +566,7 @@ acpi_map_gic_cpu_interface(struct acpi_madt_generic_interrupt *processor) > return; > > /* map the logical cpu id to cpu MPIDR */ > - cpu_logical_map(cpu_count) = hwid; > + set_cpu_logical_map(cpu_count, hwid); > > cpu_madt_gicc[cpu_count] = *processor; > > @@ -680,7 +680,7 @@ static void __init of_parse_and_init_cpus(void) > goto next; > > pr_debug("cpu logical map 0x%llx\n", hwid); > - cpu_logical_map(cpu_count) = hwid; > + set_cpu_logical_map(cpu_count, hwid); > > early_map_cpu_to_node(cpu_count, of_node_to_nid(dn)); > next: > @@ -721,7 +721,7 @@ void __init smp_init_cpus(void) > for (i = 1; i < nr_cpu_ids; i++) { > if (cpu_logical_map(i) != INVALID_HWID) { > if (smp_cpu_setup(i)) > - cpu_logical_map(i) = INVALID_HWID; > + set_cpu_logical_map(i, INVALID_HWID); > } > } > } > -- > 2.26.2 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel