Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2966922ybb; Sun, 22 Mar 2020 11:58:38 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvaMfslcMKTnRfYDWhKJ2IR0qdwI6DQ5z5IXg+YkHCM6/mO8TDQP75wb6HvpUj3AJy3yXLm X-Received: by 2002:a05:6808:910:: with SMTP id w16mr14139486oih.66.1584903518221; Sun, 22 Mar 2020 11:58:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584903518; cv=none; d=google.com; s=arc-20160816; b=eLRXxHEZbEw5xMFNL+aJ5JfOt8968gxPVgQldFJg8ZuNM1mljG+EGzgidgwpLW9oe6 ltjnfwOuZqu6gp+IEDjh5rDmxJ5lX4EbXU3MhDSM7gu9Izrl+4ApM+S0AObB8TPqqZAS d2M9zhR2VXnlYW1oykulKIB6b5eFvopoLA5cRttoNp57qhCstay/RF+fKS6Fs/khMJrw VjL8FbTdpCRhH7AAm2vkY7YkgQWZyX4LC0at7STEUkYWDfWJli9FvxbO9Zomj8dCZRIt /CnT+XbJ1p6hfMjY679t4OfkPKYCS9e+NrfrE8T6XeochSd1hjhMgvihYnQ83TfQ1WPZ w+Pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=Mmnkh4tIPhkmDVqzDTAxBITfEcPQAAHBwGY25ObTH98=; b=W+K5nvlCqluuZEkOeeKxAuYUd8oizuFjgkek2g16IowIzYsAvte/Hr5enE/C9m0MOQ khPz3ZUZtG41//nwMK+seup3aqXqIjMAdM3ex8YrZUpMtSliffLO6IjtkUn7A8dQUal+ PqmF8/On9XXemRMoHqMs6lg9v1Oy8Z/u2mzZcBl38qzOMGkF2dDnODzKsW9mYBBLbmCA BNWqg6tgiCeAu/4R+u4/gq/9yjl/EQJF0I592TGQyyjbBDKJlbqXzPwIweTLBwKav/nJ dXfVGL4Gf3Pu0/1ch/4G7Pz6jBEJ+5WzJD4YSEgBKzUsODR900f1q57ULffvOpVKzXpt X5aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pqgruber.com header.s=mail header.b=R5zcCdz2; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=pqgruber.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m26si5701120oie.67.2020.03.22.11.58.16; Sun, 22 Mar 2020 11:58: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; dkim=pass header.i=@pqgruber.com header.s=mail header.b=R5zcCdz2; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=pqgruber.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726664AbgCVS4n (ORCPT + 99 others); Sun, 22 Mar 2020 14:56:43 -0400 Received: from mail.pqgruber.com ([52.59.78.55]:59256 "EHLO mail.pqgruber.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725881AbgCVS4n (ORCPT ); Sun, 22 Mar 2020 14:56:43 -0400 X-Greylist: delayed 376 seconds by postgrey-1.27 at vger.kernel.org; Sun, 22 Mar 2020 14:56:41 EDT Received: from workstation.tuxnet (213-47-165-233.cable.dynamic.surfer.at [213.47.165.233]) by mail.pqgruber.com (Postfix) with ESMTPSA id 3B378C6B271; Sun, 22 Mar 2020 19:50:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pqgruber.com; s=mail; t=1584903024; bh=Mmnkh4tIPhkmDVqzDTAxBITfEcPQAAHBwGY25ObTH98=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=R5zcCdz2BV4YcW5+v5CB5WJrATuiFow7KNrQAJKODRSY5cb0gvNEJ5/hsBWPJTNEV ZH1fr09d6nlMd+Cqo6kRhPd2cXRSrL11R8rzfhhxmqmMM3ogcTKiQGzeomnju7NSxA GuMqkMuUUJMJd2a3cSc2sLzOUFRJKvYTPTm/KuE8= Date: Sun, 22 Mar 2020 19:50:22 +0100 From: Clemens Gruber To: Rouven Czerwinski Cc: s.hauer@pengutronix.de, shawnguo@kernel.org, Ahmad Fatoum , linux-kernel@vger.kernel.org, linux-imx@nxp.com, kernel@pengutronix.de, festevam@gmail.com, linux-arm-kernel@lists.infradead.org, Lucas Stach , stable@vger.kernel.org, Greg Kroah-Hartman Subject: Re: [PATCH] ARM: imx: build v7_cpu_resume() unconditionally Message-ID: <20200322185022.GA82867@workstation.tuxnet> Reply-To: 20200116141849.73955-1-r.czerwinski@pengutronix.de References: <20200116141849.73955-1-r.czerwinski@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200116141849.73955-1-r.czerwinski@pengutronix.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Thu, Jan 16, 2020 at 03:18:49PM +0100, Rouven Czerwinski wrote: > From: Ahmad Fatoum > > This function is not only needed by the platform suspend code, but is also > reused as the CPU resume function when the ARM cores can be powered down > completely in deep idle, which is the case on i.MX6SX and i.MX6UL(L). > > Providing the static inline stub whenever CONFIG_SUSPEND is disabled means > that those platforms will hang on resume from cpuidle if suspend is disabled. > > So there are two problems: > > - The static inline stub masks the linker error > - The function is not available where needed > > Fix both by just building the function unconditionally, when > CONFIG_SOC_IMX6 is enabled. The actual code is three instructions long, > so it's arguably ok to just leave it in for all i.MX6 kernel configurations. > > Fixes: 05136f0897b5 ("ARM: imx: support arm power off in cpuidle for i.mx6sx") > Signed-off-by: Lucas Stach > Signed-off-by: Ahmad Fatoum > Signed-off-by: Rouven Czerwinski > --- > arch/arm/mach-imx/Makefile | 2 ++ > arch/arm/mach-imx/common.h | 4 ++-- > arch/arm/mach-imx/resume-imx6.S | 24 ++++++++++++++++++++++++ > arch/arm/mach-imx/suspend-imx6.S | 14 -------------- > 4 files changed, 28 insertions(+), 16 deletions(-) > create mode 100644 arch/arm/mach-imx/resume-imx6.S > > diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile > index 35ff620537e6..03506ce46149 100644 > --- a/arch/arm/mach-imx/Makefile > +++ b/arch/arm/mach-imx/Makefile > @@ -91,6 +91,8 @@ AFLAGS_suspend-imx6.o :=-Wa,-march=armv7-a > obj-$(CONFIG_SOC_IMX6) += suspend-imx6.o > obj-$(CONFIG_SOC_IMX53) += suspend-imx53.o > endif > +AFLAGS_resume-imx6.o :=-Wa,-march=armv7-a > +obj-$(CONFIG_SOC_IMX6) += resume-imx6.o > obj-$(CONFIG_SOC_IMX6) += pm-imx6.o > > obj-$(CONFIG_SOC_IMX1) += mach-imx1.o > diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h > index 912aeceb4ff8..5aa5796cff0e 100644 > --- a/arch/arm/mach-imx/common.h > +++ b/arch/arm/mach-imx/common.h > @@ -109,17 +109,17 @@ void imx_cpu_die(unsigned int cpu); > int imx_cpu_kill(unsigned int cpu); > > #ifdef CONFIG_SUSPEND > -void v7_cpu_resume(void); > void imx53_suspend(void __iomem *ocram_vbase); > extern const u32 imx53_suspend_sz; > void imx6_suspend(void __iomem *ocram_vbase); > #else > -static inline void v7_cpu_resume(void) {} > static inline void imx53_suspend(void __iomem *ocram_vbase) {} > static const u32 imx53_suspend_sz; > static inline void imx6_suspend(void __iomem *ocram_vbase) {} > #endif > > +void v7_cpu_resume(void); > + > void imx6_pm_ccm_init(const char *ccm_compat); > void imx6q_pm_init(void); > void imx6dl_pm_init(void); > diff --git a/arch/arm/mach-imx/resume-imx6.S b/arch/arm/mach-imx/resume-imx6.S > new file mode 100644 > index 000000000000..5bd1ba7ef15b > --- /dev/null > +++ b/arch/arm/mach-imx/resume-imx6.S > @@ -0,0 +1,24 @@ > +/* SPDX-License-Identifier: GPL-2.0-or-later */ > +/* > + * Copyright 2014 Freescale Semiconductor, Inc. > + */ > + > +#include > +#include > +#include > +#include > +#include "hardware.h" > + > +/* > + * The following code must assume it is running from physical address > + * where absolute virtual addresses to the data section have to be > + * turned into relative ones. > + */ > + > +ENTRY(v7_cpu_resume) > + bl v7_invalidate_l1 > +#ifdef CONFIG_CACHE_L2X0 > + bl l2c310_early_resume > +#endif > + b cpu_resume > +ENDPROC(v7_cpu_resume) > diff --git a/arch/arm/mach-imx/suspend-imx6.S b/arch/arm/mach-imx/suspend-imx6.S > index 062391ff13da..1eabf2d2834b 100644 > --- a/arch/arm/mach-imx/suspend-imx6.S > +++ b/arch/arm/mach-imx/suspend-imx6.S > @@ -327,17 +327,3 @@ resume: > > ret lr > ENDPROC(imx6_suspend) > - > -/* > - * The following code must assume it is running from physical address > - * where absolute virtual addresses to the data section have to be > - * turned into relative ones. > - */ > - > -ENTRY(v7_cpu_resume) > - bl v7_invalidate_l1 > -#ifdef CONFIG_CACHE_L2X0 > - bl l2c310_early_resume > -#endif > - b cpu_resume > -ENDPROC(v7_cpu_resume) > -- > 2.25.0 This patch broke the build for our i.MX6 kernel. I am referring to commits 512a928aff in mainline and 7199cb65bb in linux-stable. In our kernel, neither CONFIG_PM nor CONFIG_SUSPEND are set. Therefore, ARM_CPU_SUSPEND is also unset, which means that sleep.S (containing cpu_resume) is not built. With this patch, ld reports the following error: arch/arm/mach-imx/resume-imx6.o: in function `v7_cpu_resume': (.text+0x8): undefined reference to `cpu_resume' Best regards, Clemens