From: Samuel Holland <samuel.holland@sifive.com> To: Palmer Dabbelt <palmer@dabbelt.com> Cc: "Björn Töpel" <bjorn@rivosinc.com>, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, "Samuel Holland" <samuel.holland@sifive.com> Subject: [PATCH v2 7/7] riscv: Remove extra variable in patch_text_nosync() Date: Wed, 27 Mar 2024 09:04:46 -0700 [thread overview] Message-ID: <20240327160520.791322-8-samuel.holland@sifive.com> (raw) In-Reply-To: <20240327160520.791322-1-samuel.holland@sifive.com> This cast is superfluous, and is incorrect anyway if compressed instructions may be present. Reviewed-by: Björn Töpel <bjorn@rivosinc.com> Signed-off-by: Samuel Holland <samuel.holland@sifive.com> --- (no changes since v1) arch/riscv/kernel/patch.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/arch/riscv/kernel/patch.c b/arch/riscv/kernel/patch.c index cfcb9926e722..9b8d633f6536 100644 --- a/arch/riscv/kernel/patch.c +++ b/arch/riscv/kernel/patch.c @@ -178,13 +178,11 @@ NOKPROBE_SYMBOL(patch_insn_set); int patch_text_set_nosync(void *addr, u8 c, size_t len) { - u32 *tp = addr; int ret; - ret = patch_insn_set(tp, c, len); - + ret = patch_insn_set(addr, c, len); if (!ret) - flush_icache_range((uintptr_t)tp, (uintptr_t)tp + len); + flush_icache_range((uintptr_t)addr, (uintptr_t)addr + len); return ret; } @@ -216,13 +214,11 @@ NOKPROBE_SYMBOL(patch_insn_write); int patch_text_nosync(void *addr, const void *insns, size_t len) { - u32 *tp = addr; int ret; - ret = patch_insn_write(tp, insns, len); - + ret = patch_insn_write(addr, insns, len); if (!ret) - flush_icache_range((uintptr_t) tp, (uintptr_t) tp + len); + flush_icache_range((uintptr_t)addr, (uintptr_t)addr + len); return ret; } -- 2.43.1
WARNING: multiple messages have this Message-ID (diff)
From: Samuel Holland <samuel.holland@sifive.com> To: Palmer Dabbelt <palmer@dabbelt.com> Cc: "Björn Töpel" <bjorn@rivosinc.com>, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, "Samuel Holland" <samuel.holland@sifive.com> Subject: [PATCH v2 7/7] riscv: Remove extra variable in patch_text_nosync() Date: Wed, 27 Mar 2024 09:04:46 -0700 [thread overview] Message-ID: <20240327160520.791322-8-samuel.holland@sifive.com> (raw) In-Reply-To: <20240327160520.791322-1-samuel.holland@sifive.com> This cast is superfluous, and is incorrect anyway if compressed instructions may be present. Reviewed-by: Björn Töpel <bjorn@rivosinc.com> Signed-off-by: Samuel Holland <samuel.holland@sifive.com> --- (no changes since v1) arch/riscv/kernel/patch.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/arch/riscv/kernel/patch.c b/arch/riscv/kernel/patch.c index cfcb9926e722..9b8d633f6536 100644 --- a/arch/riscv/kernel/patch.c +++ b/arch/riscv/kernel/patch.c @@ -178,13 +178,11 @@ NOKPROBE_SYMBOL(patch_insn_set); int patch_text_set_nosync(void *addr, u8 c, size_t len) { - u32 *tp = addr; int ret; - ret = patch_insn_set(tp, c, len); - + ret = patch_insn_set(addr, c, len); if (!ret) - flush_icache_range((uintptr_t)tp, (uintptr_t)tp + len); + flush_icache_range((uintptr_t)addr, (uintptr_t)addr + len); return ret; } @@ -216,13 +214,11 @@ NOKPROBE_SYMBOL(patch_insn_write); int patch_text_nosync(void *addr, const void *insns, size_t len) { - u32 *tp = addr; int ret; - ret = patch_insn_write(tp, insns, len); - + ret = patch_insn_write(addr, insns, len); if (!ret) - flush_icache_range((uintptr_t) tp, (uintptr_t) tp + len); + flush_icache_range((uintptr_t)addr, (uintptr_t)addr + len); return ret; } -- 2.43.1 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2024-03-27 16:05 UTC|newest] Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-03-27 16:04 [PATCH v2 0/7] riscv: Various text patching improvements Samuel Holland 2024-03-27 16:04 ` Samuel Holland 2024-03-27 16:04 ` [PATCH v2 1/7] riscv: jump_label: Batch icache maintenance Samuel Holland 2024-03-27 16:04 ` Samuel Holland 2024-03-27 16:04 ` [PATCH v2 2/7] riscv: jump_label: Simplify assembly syntax Samuel Holland 2024-03-27 16:04 ` Samuel Holland 2024-03-27 16:04 ` [PATCH v2 3/7] riscv: kprobes: Use patch_text_nosync() for insn slots Samuel Holland 2024-03-27 16:04 ` Samuel Holland 2024-03-27 16:04 ` [PATCH v2 4/7] riscv: Simplify text patching loops Samuel Holland 2024-03-27 16:04 ` Samuel Holland 2024-04-02 11:13 ` Björn Töpel 2024-04-02 11:13 ` Björn Töpel 2024-04-24 10:44 ` Conor Dooley 2024-04-24 10:44 ` Conor Dooley 2024-04-24 10:47 ` Conor Dooley 2024-04-24 10:47 ` Conor Dooley 2024-03-27 16:04 ` [PATCH v2 5/7] riscv: Pass patch_text() the length in bytes Samuel Holland 2024-03-27 16:04 ` Samuel Holland 2024-04-24 10:49 ` Conor Dooley 2024-04-24 10:49 ` Conor Dooley 2024-03-27 16:04 ` [PATCH v2 6/7] riscv: Use offset_in_page() in text patching functions Samuel Holland 2024-03-27 16:04 ` Samuel Holland 2024-04-24 10:51 ` Conor Dooley 2024-04-24 10:51 ` Conor Dooley 2024-03-27 16:04 ` Samuel Holland [this message] 2024-03-27 16:04 ` [PATCH v2 7/7] riscv: Remove extra variable in patch_text_nosync() Samuel Holland 2024-04-24 10:54 ` Conor Dooley 2024-04-24 10:54 ` Conor Dooley
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20240327160520.791322-8-samuel.holland@sifive.com \ --to=samuel.holland@sifive.com \ --cc=bjorn@rivosinc.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-riscv@lists.infradead.org \ --cc=palmer@dabbelt.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.