Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp4482013ybx; Mon, 4 Nov 2019 14:09:38 -0800 (PST) X-Google-Smtp-Source: APXvYqw4Ni9zIY5NZT4kxX2yIF4keFWnY554RgUcvVbHeXfIdrOSxRCIQG4WXTzsTwfSOqB2CB9P X-Received: by 2002:a17:906:5807:: with SMTP id m7mr26496146ejq.58.1572905377883; Mon, 04 Nov 2019 14:09:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572905377; cv=none; d=google.com; s=arc-20160816; b=oQiuTfYKpZHF9eaeX4xeJMhMsfA+SMXuxx9TZ6e5PzLDl04b/HjGfrHIjNjTSA8rt5 IQvFdHKnyDSZKoMDupVJqIduJRhr0bGciHJnVfMcjWcOjI7hjZJid81JRkOG8qwTJV/G 1PiG1AI6T/SrDifW9OhgH4WzQRnCp+ERM+3NdNti7TVM9fl6tdgDqLfU3j5q9fVUyrF0 ROVMJVdHBYPYAsGrP++Ii6tQ6X2bPzcJ14+mhqYxlsGtG3Xjl9OcnG8Ujp41d+taeBml 1HrIOusmYTHUQoi9ILDqH5QxQXbzLs+idzdJpWV7AuvYZ7X2YQhyUapy7hmvzVzmq+FL An6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OcfBY+8byHsxl0gYpNdSnst0SE6RCaDSQ0NwUWyc3Rk=; b=r1cBllu3ZSVvc2aYYY/93z2pwrKIWEWtP9fZpQWyXDEBhvW5vgMuQAhd2xIN3xdocd wGu4YHBMdajJ65ojreXcx9b8n6K28gB52gvqcShV14bzzsuvR/c3ULZfn9dAOBRt1YDP 5Y3YBCSjWO94MNPF64+mQ14upEHeTunsCjAGL/xWHACdiowGzlutHLdCuRxnXxUd3V91 0JzY5qTAATnrIJHDfIrtifa13gCIiXGEeTx8LNd3qy1jk76hAjx3LPZnp3/8/55A/55m gs/L0ZAT0BvpxK4dj6EtQ/26q1GDNhM9b5cIQ7t4GPRIc4oJ0HmEFg+8qha74qd+1XUa 24Zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WByDid6d; 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 w18si12091666ejv.378.2019.11.04.14.09.13; Mon, 04 Nov 2019 14:09:37 -0800 (PST) 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=@kernel.org header.s=default header.b=WByDid6d; 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 S2389842AbfKDWI0 (ORCPT + 99 others); Mon, 4 Nov 2019 17:08:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:41210 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390219AbfKDWIW (ORCPT ); Mon, 4 Nov 2019 17:08:22 -0500 Received: from localhost (6.204-14-84.ripe.coltfrance.com [84.14.204.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5F5E82084D; Mon, 4 Nov 2019 22:08:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572905300; bh=/g46P0TulW0h/dwsxG3+s4Jb4S23l9pXlIPSTXCiciA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WByDid6dcBIMGtJ2fBkyt7D8C1bpJoZ6a0j3ctdsBSYBeAM3B0pVJi20ggAGt8Wlw KZMdgMxhuYgQIiuyObYa1gHyvcL3xnh6Pn+YgUnzXUjCFc84mkjsBF2H8TYFOzll5t JNRrgGlLePfW2lRKwiJUxFhjx0CExxquT8Rj6RKU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Will Deacon , Catalin Marinas , Vincenzo Frascino , Sasha Levin Subject: [PATCH 5.3 046/163] arm64: vdso32: Detect binutils support for dmb ishld Date: Mon, 4 Nov 2019 22:43:56 +0100 Message-Id: <20191104212143.556017848@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191104212140.046021995@linuxfoundation.org> References: <20191104212140.046021995@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vincenzo Frascino [ Upstream commit 0df2c90eba60791148cee1823c0bf5fc66e3465c ] Older versions of binutils (prior to 2.24) do not support the "ISHLD" option for memory barrier instructions, which leads to a build failure when assembling the vdso32 library. Add a compilation time mechanism that detects if binutils supports those instructions and configure the kernel accordingly. Cc: Will Deacon Cc: Catalin Marinas Reported-by: Will Deacon Signed-off-by: Vincenzo Frascino Reviewed-by: Catalin Marinas Tested-by: Catalin Marinas Signed-off-by: Will Deacon Signed-off-by: Sasha Levin --- arch/arm64/include/asm/vdso/compat_barrier.h | 2 +- arch/arm64/kernel/vdso32/Makefile | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/vdso/compat_barrier.h b/arch/arm64/include/asm/vdso/compat_barrier.h index fb60a88b5ed41..3fd8fd6d8fc25 100644 --- a/arch/arm64/include/asm/vdso/compat_barrier.h +++ b/arch/arm64/include/asm/vdso/compat_barrier.h @@ -20,7 +20,7 @@ #define dmb(option) __asm__ __volatile__ ("dmb " #option : : : "memory") -#if __LINUX_ARM_ARCH__ >= 8 +#if __LINUX_ARM_ARCH__ >= 8 && defined(CONFIG_AS_DMB_ISHLD) #define aarch32_smp_mb() dmb(ish) #define aarch32_smp_rmb() dmb(ishld) #define aarch32_smp_wmb() dmb(ishst) diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile index 19e0d3115ffe0..77aa613403747 100644 --- a/arch/arm64/kernel/vdso32/Makefile +++ b/arch/arm64/kernel/vdso32/Makefile @@ -15,6 +15,8 @@ cc32-disable-warning = $(call try-run,\ $(COMPATCC) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1))) cc32-ldoption = $(call try-run,\ $(COMPATCC) $(1) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2)) +cc32-as-instr = $(call try-run,\ + printf "%b\n" "$(1)" | $(COMPATCC) $(VDSO_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3)) # We cannot use the global flags to compile the vDSO files, the main reason # being that the 32-bit compiler may be older than the main (64-bit) compiler @@ -53,6 +55,7 @@ endif VDSO_CAFLAGS += -fPIC -fno-builtin -fno-stack-protector VDSO_CAFLAGS += -DDISABLE_BRANCH_PROFILING + # Try to compile for ARMv8. If the compiler is too old and doesn't support it, # fall back to v7. There is no easy way to check for what architecture the code # is being compiled, so define a macro specifying that (see arch/arm/Makefile). @@ -89,6 +92,12 @@ VDSO_CFLAGS += -Wno-int-to-pointer-cast VDSO_AFLAGS := $(VDSO_CAFLAGS) VDSO_AFLAGS += -D__ASSEMBLY__ +# Check for binutils support for dmb ishld +dmbinstr := $(call cc32-as-instr,dmb ishld,-DCONFIG_AS_DMB_ISHLD=1) + +VDSO_CFLAGS += $(dmbinstr) +VDSO_AFLAGS += $(dmbinstr) + VDSO_LDFLAGS := $(VDSO_CPPFLAGS) # From arm vDSO Makefile VDSO_LDFLAGS += -Wl,-Bsymbolic -Wl,--no-undefined -Wl,-soname=linux-vdso.so.1 -- 2.20.1