Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp3731209pxb; Mon, 4 Oct 2021 08:25:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxwtOJqZu+gh7s1qd3dnOuUqJmt1H8OawO0G0FRgj17ENuiQSEWwHiErEHHBOZY7vOOv29M X-Received: by 2002:aa7:93d2:0:b0:44b:e5e8:f89e with SMTP id y18-20020aa793d2000000b0044be5e8f89emr25428057pff.52.1633361139520; Mon, 04 Oct 2021 08:25:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633361139; cv=none; d=google.com; s=arc-20160816; b=gRFqJSlhg9H2E/eraW64FOsOrSJegPpP4n9ZXaMQYUqTvwKXqltkQqHGC03/k3QQUz 525AsZ4fVX2HeKg3clfhiMAyp5HyEtI7nflb2LDaxVoZg/LkblrDlKjKWQMxn5BGVrFL ZinNOn1LToLK4aeToHaGD9aWLuLKF10UCr34Q6d0UWlv0PM7Pd+VsIVXjg4F9xAGlzYC E36wsveY7SjFRmq6IzNHmnW/tjh2hZkGH10idOgL06C3UeN3jJZd1c0+PW/nDCm5AxWc TyQATj0F+AklrQw+ISnhr4FzL77Z0uqWPd0KJrzQF7GZ80HJ8Q5FlhO8TSz9xjJN7A2u L7fQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Xa+8xpln07YLQYsJ0O0o2vzsBUsgY+BnOSJg2VIfa0w=; b=QfUstQA3tvHwzNFzELbZVxUR5weknLTsiXKkdb1HNlyvpTZ4Va2mMC+QKERS5SRkQG fc+6jEhix+PbWf/mdxIUs9VZ1Bv8dWEMxtYBMoyWRvI8IXMdiw1gCfSXmotBJzAQDlIu 6M5WvJATaCZhcxk44HaCMz6uAXQ9DMv4Om8Yv8dkWcnitLsgWJ5Er3IniVFmLOrxy9Kw G8gw51Gp0nuEvQyLHuszCVo9jx8cq2CeZ4fvY8Szx8irCJqiBOxnWyRuAWN/gGMWS/sK OCAsqj/H7JT8wgAUuq+DGCfjpa0F6/UwYSEGrvwIuArbqj5VR1Qvnm9V8d7vvXA0n/7p 6i4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="WcbzqT/G"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j4si19210855pjv.119.2021.10.04.08.25.26; Mon, 04 Oct 2021 08:25:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="WcbzqT/G"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235696AbhJDNOp (ORCPT + 99 others); Mon, 4 Oct 2021 09:14:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:46350 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235660AbhJDNMp (ORCPT ); Mon, 4 Oct 2021 09:12:45 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 59CE76137D; Mon, 4 Oct 2021 13:04:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1633352699; bh=sCKqQsnWyy2TMFoIwAoK9TxQENvqp67L5yhaXHcheCw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WcbzqT/GzczerPGzsKHcJDq5pR5aGnqpqEnYfnP9fo5Te5KLHyvRmbdV8msJ9mRpQ 9R4V/tWVQBZFlJZeEh9G1R3KR8Oh+Ca4C+PRjbi7XI7lFHTrU8wbYM05owL0kdPlDi x8fG7n69e6eGW4TX2KPTvCQBnnBQQN3ZQa+jMRrI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Sverdlin , Russell King , Florian Fainelli Subject: [PATCH 4.19 85/95] ARM: 9078/1: Add warn suppress parameter to arm_gen_branch_link() Date: Mon, 4 Oct 2021 14:52:55 +0200 Message-Id: <20211004125036.356842983@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004125033.572932188@linuxfoundation.org> References: <20211004125033.572932188@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alex Sverdlin commit 890cb057a46d323fd8c77ebecb6485476614cd21 upstream Will be used in the following patch. No functional change. Signed-off-by: Alexander Sverdlin Signed-off-by: Russell King Signed-off-by: Florian Fainelli Signed-off-by: Greg Kroah-Hartman --- arch/arm/include/asm/insn.h | 8 ++++---- arch/arm/kernel/ftrace.c | 2 +- arch/arm/kernel/insn.c | 19 ++++++++++--------- 3 files changed, 15 insertions(+), 14 deletions(-) --- a/arch/arm/include/asm/insn.h +++ b/arch/arm/include/asm/insn.h @@ -13,18 +13,18 @@ arm_gen_nop(void) } unsigned long -__arm_gen_branch(unsigned long pc, unsigned long addr, bool link); +__arm_gen_branch(unsigned long pc, unsigned long addr, bool link, bool warn); static inline unsigned long arm_gen_branch(unsigned long pc, unsigned long addr) { - return __arm_gen_branch(pc, addr, false); + return __arm_gen_branch(pc, addr, false, true); } static inline unsigned long -arm_gen_branch_link(unsigned long pc, unsigned long addr) +arm_gen_branch_link(unsigned long pc, unsigned long addr, bool warn) { - return __arm_gen_branch(pc, addr, true); + return __arm_gen_branch(pc, addr, true, warn); } #endif --- a/arch/arm/kernel/ftrace.c +++ b/arch/arm/kernel/ftrace.c @@ -98,7 +98,7 @@ int ftrace_arch_code_modify_post_process static unsigned long ftrace_call_replace(unsigned long pc, unsigned long addr) { - return arm_gen_branch_link(pc, addr); + return arm_gen_branch_link(pc, addr, true); } static int ftrace_modify_code(unsigned long pc, unsigned long old, --- a/arch/arm/kernel/insn.c +++ b/arch/arm/kernel/insn.c @@ -3,8 +3,9 @@ #include #include -static unsigned long -__arm_gen_branch_thumb2(unsigned long pc, unsigned long addr, bool link) +static unsigned long __arm_gen_branch_thumb2(unsigned long pc, + unsigned long addr, bool link, + bool warn) { unsigned long s, j1, j2, i1, i2, imm10, imm11; unsigned long first, second; @@ -12,7 +13,7 @@ __arm_gen_branch_thumb2(unsigned long pc offset = (long)addr - (long)(pc + 4); if (offset < -16777216 || offset > 16777214) { - WARN_ON_ONCE(1); + WARN_ON_ONCE(warn); return 0; } @@ -33,8 +34,8 @@ __arm_gen_branch_thumb2(unsigned long pc return __opcode_thumb32_compose(first, second); } -static unsigned long -__arm_gen_branch_arm(unsigned long pc, unsigned long addr, bool link) +static unsigned long __arm_gen_branch_arm(unsigned long pc, unsigned long addr, + bool link, bool warn) { unsigned long opcode = 0xea000000; long offset; @@ -44,7 +45,7 @@ __arm_gen_branch_arm(unsigned long pc, u offset = (long)addr - (long)(pc + 8); if (unlikely(offset < -33554432 || offset > 33554428)) { - WARN_ON_ONCE(1); + WARN_ON_ONCE(warn); return 0; } @@ -54,10 +55,10 @@ __arm_gen_branch_arm(unsigned long pc, u } unsigned long -__arm_gen_branch(unsigned long pc, unsigned long addr, bool link) +__arm_gen_branch(unsigned long pc, unsigned long addr, bool link, bool warn) { if (IS_ENABLED(CONFIG_THUMB2_KERNEL)) - return __arm_gen_branch_thumb2(pc, addr, link); + return __arm_gen_branch_thumb2(pc, addr, link, warn); else - return __arm_gen_branch_arm(pc, addr, link); + return __arm_gen_branch_arm(pc, addr, link, warn); }