From: Alistair Francis <alistair23@gmail.com> To: Jonathan Behrens <fintelia@gmail.com> Cc: "qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>, Bastian Koppelmann <kbastian@mail.uni-paderborn.de>, Palmer Dabbelt <palmer@sifive.com>, Alistair Francis <Alistair.Francis@wdc.com>, "open list:RISC-V" <qemu-riscv@nongnu.org>, Sagar Karandikar <sagark@eecs.berkeley.edu> Subject: Re: [Qemu-devel] [PATCH] target/riscv: Do not allow sfence.vma from user mode Date: Fri, 12 Apr 2019 14:23:42 -0700 [thread overview] Message-ID: <CAKmqyKOSujRkv+JkgmP79FHVPZabg0QTki3c+BeFMTZpMFSYxA@mail.gmail.com> (raw) In-Reply-To: <CANnJOVHprai3DLd=PunsVDGUwaGvvA4ynou5_LhyGVztTf-tNQ@mail.gmail.com> On Fri, Apr 12, 2019 at 2:15 PM Jonathan Behrens <fintelia@gmail.com> wrote: > > Just to double check, nothing further on this is need from me, right? It is set to be merged onto the master branch once the 4.0 release is out? Thanks for checking! Yep you don't need to do anything, Palmer will merge it in the next RISC-V PR after 4.0. Alistair > > Jonathan > > On Wed, Apr 3, 2019 at 7:11 PM Alistair Francis <alistair23@gmail.com> wrote: >> >> On Mon, Apr 1, 2019 at 1:39 PM Jonathan Behrens <fintelia@gmail.com> wrote: >> > >> > The 'sfence.vma' instruction is privileged, and should only ever be allowed >> > when executing in supervisor mode or higher. >> > >> > Jonathan >> > >> > Signed-off-by: Jonathan Behrens <fintelia@gmail.com> >> >> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> >> >> Alistair >> >> > --- >> > target/riscv/op_helper.c | 7 ++++--- >> > 1 file changed, 4 insertions(+), 3 deletions(-) >> > >> > diff --git a/target/riscv/op_helper.c b/target/riscv/op_helper.c >> > index b7dc18a41e..644d0fb35f 100644 >> > --- a/target/riscv/op_helper.c >> > +++ b/target/riscv/op_helper.c >> > @@ -145,9 +145,10 @@ void helper_tlb_flush(CPURISCVState *env) >> > { >> > RISCVCPU *cpu = riscv_env_get_cpu(env); >> > CPUState *cs = CPU(cpu); >> > - if (env->priv == PRV_S && >> > - env->priv_ver >= PRIV_VERSION_1_10_0 && >> > - get_field(env->mstatus, MSTATUS_TVM)) { >> > + if (!(env->priv >= PRV_S) || >> > + (env->priv == PRV_S && >> > + env->priv_ver >= PRIV_VERSION_1_10_0 && >> > + get_field(env->mstatus, MSTATUS_TVM))) { >> > riscv_raise_exception(env, RISCV_EXCP_ILLEGAL_INST, GETPC()); >> > } else { >> > tlb_flush(cs); >> > -- >> > 2.20.1
WARNING: multiple messages have this Message-ID (diff)
From: Alistair Francis <alistair23@gmail.com> To: Jonathan Behrens <fintelia@gmail.com> Cc: "open list:RISC-V" <qemu-riscv@nongnu.org>, Sagar Karandikar <sagark@eecs.berkeley.edu>, Bastian Koppelmann <kbastian@mail.uni-paderborn.de>, Palmer Dabbelt <palmer@sifive.com>, "qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>, Alistair Francis <Alistair.Francis@wdc.com> Subject: Re: [Qemu-devel] [PATCH] target/riscv: Do not allow sfence.vma from user mode Date: Fri, 12 Apr 2019 14:23:42 -0700 [thread overview] Message-ID: <CAKmqyKOSujRkv+JkgmP79FHVPZabg0QTki3c+BeFMTZpMFSYxA@mail.gmail.com> (raw) Message-ID: <20190412212342.AF6K2iKkCNSc4m55h9_hAIrFhhO7-memOMsEqlwxHg4@z> (raw) In-Reply-To: <CANnJOVHprai3DLd=PunsVDGUwaGvvA4ynou5_LhyGVztTf-tNQ@mail.gmail.com> On Fri, Apr 12, 2019 at 2:15 PM Jonathan Behrens <fintelia@gmail.com> wrote: > > Just to double check, nothing further on this is need from me, right? It is set to be merged onto the master branch once the 4.0 release is out? Thanks for checking! Yep you don't need to do anything, Palmer will merge it in the next RISC-V PR after 4.0. Alistair > > Jonathan > > On Wed, Apr 3, 2019 at 7:11 PM Alistair Francis <alistair23@gmail.com> wrote: >> >> On Mon, Apr 1, 2019 at 1:39 PM Jonathan Behrens <fintelia@gmail.com> wrote: >> > >> > The 'sfence.vma' instruction is privileged, and should only ever be allowed >> > when executing in supervisor mode or higher. >> > >> > Jonathan >> > >> > Signed-off-by: Jonathan Behrens <fintelia@gmail.com> >> >> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> >> >> Alistair >> >> > --- >> > target/riscv/op_helper.c | 7 ++++--- >> > 1 file changed, 4 insertions(+), 3 deletions(-) >> > >> > diff --git a/target/riscv/op_helper.c b/target/riscv/op_helper.c >> > index b7dc18a41e..644d0fb35f 100644 >> > --- a/target/riscv/op_helper.c >> > +++ b/target/riscv/op_helper.c >> > @@ -145,9 +145,10 @@ void helper_tlb_flush(CPURISCVState *env) >> > { >> > RISCVCPU *cpu = riscv_env_get_cpu(env); >> > CPUState *cs = CPU(cpu); >> > - if (env->priv == PRV_S && >> > - env->priv_ver >= PRIV_VERSION_1_10_0 && >> > - get_field(env->mstatus, MSTATUS_TVM)) { >> > + if (!(env->priv >= PRV_S) || >> > + (env->priv == PRV_S && >> > + env->priv_ver >= PRIV_VERSION_1_10_0 && >> > + get_field(env->mstatus, MSTATUS_TVM))) { >> > riscv_raise_exception(env, RISCV_EXCP_ILLEGAL_INST, GETPC()); >> > } else { >> > tlb_flush(cs); >> > -- >> > 2.20.1
next prev parent reply other threads:[~2019-04-12 21:25 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-04-01 19:12 [Qemu-devel] [PATCH] target/riscv: Do not allow sfence.vma from user mode Jonathan Behrens 2019-04-02 0:25 ` Richard Henderson 2019-04-03 23:10 ` Alistair Francis 2019-04-12 21:14 ` Jonathan Behrens 2019-04-12 21:14 ` Jonathan Behrens 2019-04-12 21:23 ` Alistair Francis [this message] 2019-04-12 21:23 ` Alistair Francis 2019-04-12 21:48 ` Palmer Dabbelt 2019-04-12 21:48 ` Palmer Dabbelt
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=CAKmqyKOSujRkv+JkgmP79FHVPZabg0QTki3c+BeFMTZpMFSYxA@mail.gmail.com \ --to=alistair23@gmail.com \ --cc=Alistair.Francis@wdc.com \ --cc=fintelia@gmail.com \ --cc=kbastian@mail.uni-paderborn.de \ --cc=palmer@sifive.com \ --cc=qemu-devel@nongnu.org \ --cc=qemu-riscv@nongnu.org \ --cc=sagark@eecs.berkeley.edu \ /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 a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).