Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp4455210ybz; Tue, 21 Apr 2020 00:32:18 -0700 (PDT) X-Google-Smtp-Source: APiQypLZ05lDAbONVAlsyexyHNZdC8TLOrVCxn5l7aXUBs3TL0+OPlTkleh+nYRgxHVG4U/EnK/0 X-Received: by 2002:a05:6402:b17:: with SMTP id bm23mr18200763edb.137.1587454337726; Tue, 21 Apr 2020 00:32:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587454337; cv=none; d=google.com; s=arc-20160816; b=iHfj/LCGxGhjILZP5SjORjnR1qhOqmGvQlWTrf0l6Wh7uW5+vKXaWkow8NILOMBGzZ JZBJC35PPRv9HKkZIOSNv/3RoK8Z3gDdKtG0k18wxT4D57XYDCtOa95dergHHZYvf6Mh U9k4fbMKl+SyFVeLrdYR5R5ipjMELsylctkhcwOMl0xN0tN7bibZy9GXuk6gilgYMQeH RMy2xf8mRh/iW1D8jWiHtPHFQ3Chk24r8dmO89IhckD7beiwTGz9DMIT1zrgY2sUVY59 jFv5kVoQzK9rXBuy5CGIfeU2gMWnhz2pFg5UzW4ydvQivANzJefAPJJVQ+Ut7TvWAB5U AL0w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=fqdk4PAIqG8nuCO40pczcx65QEF5mBrlQS3vzbn1WpQ=; b=p30ZHCi01o0rqUY21UcYmYzQt9Pt1Y/8V+uEWa/VOeDh0pSBdCVw24VPG4qTnMGQDu +6m+yZt63cdbL6mCv8ybhwZNT88wRv59coMZVc5Mkbyj66i261f3JLkhC8pHcTojflPS 8JdtUvbBgh06Jv+VnKtM20L9mnOmsKIPuiNKEUOfTviLgRURm3beN+Czr181d0g8n3PO SLZm51BQHcRWZkWY5qlPFlRWLyvrhJgRpDfYv85VRT9CqJFm2dYrWi98b5wcfAgU5MZI bmqbcAfIU/X+4lexxH5su4VjFGpQwhkVlpxr1X14zYcZVdzA17gvIFZ1JElxtfRkslEF XQ9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=VSh9fIaB; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m4si1133904ejc.103.2020.04.21.00.31.54; Tue, 21 Apr 2020 00:32:17 -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=@sifive.com header.s=google header.b=VSh9fIaB; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726716AbgDUHaM (ORCPT + 99 others); Tue, 21 Apr 2020 03:30:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725989AbgDUHaL (ORCPT ); Tue, 21 Apr 2020 03:30:11 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26150C061A0F for ; Tue, 21 Apr 2020 00:30:10 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id b8so6228922pfp.8 for ; Tue, 21 Apr 2020 00:30:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fqdk4PAIqG8nuCO40pczcx65QEF5mBrlQS3vzbn1WpQ=; b=VSh9fIaBN7oj6/8mumUuw27O4lo2HM/p1xnMxKeVTUJRCRPKX9hmBeg7FHypkhD8Ky ztyl7JHxbH+YNrWyTR5d2CeDf9sn9cy5PW1TDJ1NQqc6R5QGspGYw+5H9egt1u9/hvi6 PWq8HFs1fccwJDfupHdUAU4lyxrweuGSWBYPYydmRckCUhqCJIp91adXeAcVVmpVlz0W qj3F8jypnJBnEbTRJmqzYW7CaK7WAUcFLuchpbjeYz0bBadHfSPJ8oqm6WXLy7SOmIve SYAuchx4PSrvwrpc9qQz9QEU0i4cvJ3+YobJsu2QlhCAWkS2Cf/CwRXilEvVtO8XULkz Loaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fqdk4PAIqG8nuCO40pczcx65QEF5mBrlQS3vzbn1WpQ=; b=VYu/j+Q0qV+ci51tJOjQfmTl4oiFDqcQ5cyPE0mfqgzCUHhdBMov2/bRqHhmkyu1UW VWwsY3PFZm8fUo/hxx8i4kDRGwxOTOr+rJQ1I3WaYBOtxPNzzzWlo7Y2LrY+eAoNdYLe yvuF51noFoYeY8H885x5eg89rTJF2dh8FeojUH5Mm2rOYtdbfhC37jZNXjqeP2O5XPez jAR7dmlTk9Tgy2m1OPIji6bFzx2/CBNPTRiUIdJonwja5K1gYlIhaGHgctJT4YdIK4VY eJKj96JE938XKUsKl1Z6EZd20dXOL5ItuRWP5lhDd3g4YE5CRVp1yta/fj3YD35/Hv2f +x0Q== X-Gm-Message-State: AGi0PuaS7Ck7TAHbUTxcq89Z29JP47tvAAOoh6Q2htQ1Nc4MHnN/8zfR sHjQt7aqLWW6M6XiiyAdfEqq9g== X-Received: by 2002:a63:79c9:: with SMTP id u192mr19776129pgc.7.1587454209688; Tue, 21 Apr 2020 00:30:09 -0700 (PDT) Received: from hsinchu02.internal.sifive.com (114-34-229-221.HINET-IP.hinet.net. [114.34.229.221]) by smtp.gmail.com with ESMTPSA id t7sm1535200pfh.143.2020.04.21.00.30.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 00:30:08 -0700 (PDT) From: Zong Li To: palmer@dabbelt.com, paul.walmsley@sifive.com, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Zong Li , Masami Hiramatsu , Palmer Dabbelt Subject: [PATCH 1/3] riscv: Remove the 'riscv_' prefix of function name Date: Tue, 21 Apr 2020 15:29:59 +0800 Message-Id: <2a1a03d7f9895dd92490b89c926fc7975015e449.1587453338.git.zong.li@sifive.com> X-Mailer: git-send-email 2.26.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Refactor the function name by removing the 'riscv_' prefix, it would be better unless it could mix up with arch-independent functions. Signed-off-by: Zong Li Reviewed-by: Masami Hiramatsu Reviewed-by: Palmer Dabbelt --- arch/riscv/include/asm/patch.h | 4 ++-- arch/riscv/kernel/ftrace.c | 2 +- arch/riscv/kernel/patch.c | 22 +++++++++++----------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/arch/riscv/include/asm/patch.h b/arch/riscv/include/asm/patch.h index b5918a6e0615..9a7d7346001e 100644 --- a/arch/riscv/include/asm/patch.h +++ b/arch/riscv/include/asm/patch.h @@ -6,7 +6,7 @@ #ifndef _ASM_RISCV_PATCH_H #define _ASM_RISCV_PATCH_H -int riscv_patch_text_nosync(void *addr, const void *insns, size_t len); -int riscv_patch_text(void *addr, u32 insn); +int patch_text_nosync(void *addr, const void *insns, size_t len); +int patch_text(void *addr, u32 insn); #endif /* _ASM_RISCV_PATCH_H */ diff --git a/arch/riscv/kernel/ftrace.c b/arch/riscv/kernel/ftrace.c index ce69b34ff55d..fb1e2b8fe254 100644 --- a/arch/riscv/kernel/ftrace.c +++ b/arch/riscv/kernel/ftrace.c @@ -51,7 +51,7 @@ static int __ftrace_modify_call(unsigned long hook_pos, unsigned long target, make_call(hook_pos, target, call); /* Replace the auipc-jalr pair at once. Return -EPERM on write error. */ - if (riscv_patch_text_nosync + if (patch_text_nosync ((void *)hook_pos, enable ? call : nops, MCOUNT_INSN_SIZE)) return -EPERM; diff --git a/arch/riscv/kernel/patch.c b/arch/riscv/kernel/patch.c index 8a4fc65ee022..de28f23f65cb 100644 --- a/arch/riscv/kernel/patch.c +++ b/arch/riscv/kernel/patch.c @@ -11,7 +11,7 @@ #include #include -struct riscv_insn_patch { +struct patch_insn { void *addr; u32 insn; atomic_t cpu_count; @@ -43,7 +43,7 @@ static void __kprobes patch_unmap(int fixmap) clear_fixmap(fixmap); } -static int __kprobes riscv_insn_write(void *addr, const void *insn, size_t len) +static int __kprobes patch_insn_write(void *addr, const void *insn, size_t len) { void *waddr = addr; bool across_pages = (((uintptr_t) addr & ~PAGE_MASK) + len) > PAGE_SIZE; @@ -69,18 +69,18 @@ static int __kprobes riscv_insn_write(void *addr, const void *insn, size_t len) return ret; } #else -static int __kprobes riscv_insn_write(void *addr, const void *insn, size_t len) +static int __kprobes patch_insn_write(void *addr, const void *insn, size_t len) { return probe_kernel_write(addr, insn, len); } #endif /* CONFIG_MMU */ -int __kprobes riscv_patch_text_nosync(void *addr, const void *insns, size_t len) +int __kprobes patch_text_nosync(void *addr, const void *insns, size_t len) { u32 *tp = addr; int ret; - ret = riscv_insn_write(tp, insns, len); + ret = patch_insn_write(tp, insns, len); if (!ret) flush_icache_range((uintptr_t) tp, (uintptr_t) tp + len); @@ -88,14 +88,14 @@ int __kprobes riscv_patch_text_nosync(void *addr, const void *insns, size_t len) return ret; } -static int __kprobes riscv_patch_text_cb(void *data) +static int __kprobes patch_text_cb(void *data) { - struct riscv_insn_patch *patch = data; + struct patch_insn *patch = data; int ret = 0; if (atomic_inc_return(&patch->cpu_count) == 1) { ret = - riscv_patch_text_nosync(patch->addr, &patch->insn, + patch_text_nosync(patch->addr, &patch->insn, GET_INSN_LENGTH(patch->insn)); atomic_inc(&patch->cpu_count); } else { @@ -107,14 +107,14 @@ static int __kprobes riscv_patch_text_cb(void *data) return ret; } -int __kprobes riscv_patch_text(void *addr, u32 insn) +int __kprobes patch_text(void *addr, u32 insn) { - struct riscv_insn_patch patch = { + struct patch_insn patch = { .addr = addr, .insn = insn, .cpu_count = ATOMIC_INIT(0), }; - return stop_machine_cpuslocked(riscv_patch_text_cb, + return stop_machine_cpuslocked(patch_text_cb, &patch, cpu_online_mask); } -- 2.26.1