From: Palmer Dabbelt <palmer@dabbelt.com> To: linux-riscv@lists.infradead.org Cc: Paul Walmsley <paul.walmsley@sifive.com>, Palmer Dabbelt <palmer@dabbelt.com>, aou@eecs.berkeley.edu, penberg@kernel.org, guoren@linux.alibaba.com, me@packi.ch, mhiramat@kernel.org, mingo@kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, kernel-team@android.com, Palmer Dabbelt <palmerdabbelt@google.com>, kernel test robot <lkp@intel.com> Subject: [PATCH] RISC-V: probes: Treat the instruction stream as host-endian Date: Fri, 22 Jan 2021 19:34:29 -0800 [thread overview] Message-ID: <20210123033429.2072716-1-palmer@dabbelt.com> (raw) From: Palmer Dabbelt <palmerdabbelt@google.com> Neither of these are actually correct: the instruction stream is defined (for versions of the ISA manual newer than 2.2) as a stream of 16-bit little-endian parcels, which is different than just being little-endian. In theory we should represent this as a type, but we don't have any concrete plans for the big endian stuff so it doesn't seem worth the time -- we've got variants of this all over the place. Instead I'm just dropping the unnecessary type conversion, which is a NOP on LE systems but causes an sparse error as the types are all mixed up. Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com> --- arch/riscv/kernel/probes/decode-insn.c | 2 +- arch/riscv/kernel/probes/kprobes.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/riscv/kernel/probes/decode-insn.c b/arch/riscv/kernel/probes/decode-insn.c index 0876c304ca77..0ed043acc882 100644 --- a/arch/riscv/kernel/probes/decode-insn.c +++ b/arch/riscv/kernel/probes/decode-insn.c @@ -16,7 +16,7 @@ enum probe_insn __kprobes riscv_probe_decode_insn(probe_opcode_t *addr, struct arch_probe_insn *api) { - probe_opcode_t insn = le32_to_cpu(*addr); + probe_opcode_t insn = *addr; /* * Reject instructions list: diff --git a/arch/riscv/kernel/probes/kprobes.c b/arch/riscv/kernel/probes/kprobes.c index e60893bd87db..a2ec18662fee 100644 --- a/arch/riscv/kernel/probes/kprobes.c +++ b/arch/riscv/kernel/probes/kprobes.c @@ -57,7 +57,7 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p) } /* copy instruction */ - p->opcode = le32_to_cpu(*p->addr); + p->opcode = *p->addr; /* decode instruction */ switch (riscv_probe_decode_insn(p->addr, &p->ainsn.api)) { -- 2.30.0.280.ga3ce27912f-goog
WARNING: multiple messages have this Message-ID (diff)
From: Palmer Dabbelt <palmer@dabbelt.com> To: linux-riscv@lists.infradead.org Cc: me@packi.ch, aou@eecs.berkeley.edu, kernel test robot <lkp@intel.com>, Palmer Dabbelt <palmerdabbelt@google.com>, linux-kernel@vger.kernel.org, penberg@kernel.org, guoren@linux.alibaba.com, Palmer Dabbelt <palmer@dabbelt.com>, mhiramat@kernel.org, Paul Walmsley <paul.walmsley@sifive.com>, linux-riscv@lists.infradead.org, kernel-team@android.com, mingo@kernel.org Subject: [PATCH] RISC-V: probes: Treat the instruction stream as host-endian Date: Fri, 22 Jan 2021 19:34:29 -0800 [thread overview] Message-ID: <20210123033429.2072716-1-palmer@dabbelt.com> (raw) From: Palmer Dabbelt <palmerdabbelt@google.com> Neither of these are actually correct: the instruction stream is defined (for versions of the ISA manual newer than 2.2) as a stream of 16-bit little-endian parcels, which is different than just being little-endian. In theory we should represent this as a type, but we don't have any concrete plans for the big endian stuff so it doesn't seem worth the time -- we've got variants of this all over the place. Instead I'm just dropping the unnecessary type conversion, which is a NOP on LE systems but causes an sparse error as the types are all mixed up. Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com> --- arch/riscv/kernel/probes/decode-insn.c | 2 +- arch/riscv/kernel/probes/kprobes.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/riscv/kernel/probes/decode-insn.c b/arch/riscv/kernel/probes/decode-insn.c index 0876c304ca77..0ed043acc882 100644 --- a/arch/riscv/kernel/probes/decode-insn.c +++ b/arch/riscv/kernel/probes/decode-insn.c @@ -16,7 +16,7 @@ enum probe_insn __kprobes riscv_probe_decode_insn(probe_opcode_t *addr, struct arch_probe_insn *api) { - probe_opcode_t insn = le32_to_cpu(*addr); + probe_opcode_t insn = *addr; /* * Reject instructions list: diff --git a/arch/riscv/kernel/probes/kprobes.c b/arch/riscv/kernel/probes/kprobes.c index e60893bd87db..a2ec18662fee 100644 --- a/arch/riscv/kernel/probes/kprobes.c +++ b/arch/riscv/kernel/probes/kprobes.c @@ -57,7 +57,7 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p) } /* copy instruction */ - p->opcode = le32_to_cpu(*p->addr); + p->opcode = *p->addr; /* decode instruction */ switch (riscv_probe_decode_insn(p->addr, &p->ainsn.api)) { -- 2.30.0.280.ga3ce27912f-goog _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv
next reply other threads:[~2021-01-23 3:39 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-01-23 3:34 Palmer Dabbelt [this message] 2021-01-23 3:34 ` [PATCH] RISC-V: probes: Treat the instruction stream as host-endian Palmer Dabbelt 2021-01-23 7:33 ` Guo Ren 2021-01-23 7:33 ` Guo Ren
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=20210123033429.2072716-1-palmer@dabbelt.com \ --to=palmer@dabbelt.com \ --cc=aou@eecs.berkeley.edu \ --cc=guoren@linux.alibaba.com \ --cc=kernel-team@android.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-riscv@lists.infradead.org \ --cc=lkp@intel.com \ --cc=me@packi.ch \ --cc=mhiramat@kernel.org \ --cc=mingo@kernel.org \ --cc=palmerdabbelt@google.com \ --cc=paul.walmsley@sifive.com \ --cc=penberg@kernel.org \ /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.