[PATCH v2 3/3] target/riscv: kvm: Support selecting VCPU extensions

2022-12-05 Thread Mayuresh Chitale
Set the state of each ISA extension on the vcpu depending on what is set in the CPU property and what is allowed by KVM for that extension. Signed-off-by: Mayuresh Chitale Reviewed-by: Andrew Jones Reviewed-by: Alistair Francis --- target/riscv/cpu.c | 11 - target/riscv/kvm.c

[PATCH v2 0/3] target/riscv: Apply KVM policy to ISA extensions

2022-12-05 Thread Mayuresh Chitale
https://github.com/mdchitale/qemu.git Changes in v2: - Rebase to latest riscv-to-apply.next - Update linux headers to version 6.1-rc8 - Add reviewed by tags Mayuresh Chitale (3): update-linux-headers: Version 6.1-rc8 target/riscv: Extend isa_ext_data for single letter extensions target/riscv

[PATCH v2 2/3] target/riscv: Extend isa_ext_data for single letter extensions

2022-12-05 Thread Mayuresh Chitale
extensions from the list of single letter extensions as those are not supported yet. Signed-off-by: Mayuresh Chitale Reviewed-by: Andrew Jones Reviewed-by: Alistair Francis --- target/riscv/cpu.c | 41 +++-- 1 file changed, 23 insertions(+), 18 deletions(-)

[PATCH v2 1/3] update-linux-headers: Version 6.1-rc8

2022-12-05 Thread Mayuresh Chitale
Sync headers with kernel commit 76dcd734eca2 Signed-off-by: Mayuresh Chitale Reviewed-by: Andrew Jones --- include/standard-headers/drm/drm_fourcc.h | 34 - include/standard-headers/linux/ethtool.h | 63 +++- include/standard-headers/linux/fuse.h | 6 +- .../linux

Re: [PATCH v6 1/5] target/riscv: Add smstateen support

2022-07-24 Thread Mayuresh Chitale
On Fri, 2022-07-22 at 08:31 +0800, Weiwei Li wrote: > 在 2022/7/21 下午11:31, Mayuresh Chitale 写道: > > Smstateen extension specifies a mechanism to close > > the potential covert channels that could cause security issues. > > > > This patch adds the CSRs defined in th

Re: [PATCH v6 3/5] target/riscv: smstateen check for fcsr

2022-07-24 Thread Mayuresh Chitale
On Fri, 2022-07-22 at 09:42 +0800, Weiwei Li wrote: > 在 2022/7/21 下午11:31, Mayuresh Chitale 写道: > > If smstateen is implemented and sstateen0.fcsr is clear then the > > floating point operations must return illegal instruction > > exception. > > > >

Re: [PATCH v6 1/5] target/riscv: Add smstateen support

2022-07-27 Thread Mayuresh Chitale
On Mon, 2022-07-25 at 15:11 +0800, Weiwei Li wrote: > 在 2022/7/24 下午11:39, Mayuresh Chitale 写道: > > On Fri, 2022-07-22 at 08:31 +0800, Weiwei Li wrote: > > > 在 2022/7/21 下午11:31, Mayuresh Chitale 写道: > > > > Smstateen extension specifies a mechanism to close > &g

Re: [PATCH v6 3/5] target/riscv: smstateen check for fcsr

2022-07-27 Thread Mayuresh Chitale
On Mon, 2022-07-25 at 15:23 +0800, Weiwei Li wrote: > > 在 2022/7/24 下午11:49, Mayuresh Chitale 写道: > > On Fri, 2022-07-22 at 09:42 +0800, Weiwei Li wrote: > > > 在 2022/7/21 下午11:31, Mayuresh Chitale 写道: > > > > If smstateen is implemented and sstatee

Re: [PATCH v6 2/5] target/riscv: smstateen check for h/senvcfg

2022-07-27 Thread Mayuresh Chitale
On Fri, 2022-07-22 at 08:45 +0800, Weiwei Li wrote: > 在 2022/7/21 下午11:31, Mayuresh Chitale 写道: > > Accesses to henvcfg, henvcfgh and senvcfg are allowed only if > > corresponding bit in mstateen0/hstateen0 is enabled. Otherwise an > > illegal instruction trap is generated. &

Re: [PATCH v6 3/5] target/riscv: smstateen check for fcsr

2022-07-29 Thread Mayuresh Chitale
On Thu, 2022-07-28 at 09:09 +0100, Ben Dooks wrote: > On 28/07/2022 07:15, Mayuresh Chitale wrote: > > On Mon, 2022-07-25 at 15:23 +0800, Weiwei Li wrote: > > > 在 2022/7/24 下午11:49, Mayuresh Chitale 写道: > > > > On Fri, 2022-07-22 at 09:42 +0800, Weiwei Li wrote:

[PATCH v7 2/4] target/riscv: smstateen check for h/senvcfg

2022-08-01 Thread Mayuresh Chitale
Accesses to henvcfg, henvcfgh and senvcfg are allowed only if corresponding bit in mstateen0/hstateen0 is enabled. Otherwise an illegal instruction trap is generated. Signed-off-by: Mayuresh Chitale --- roms/opensbi | 2 +- target/riscv/csr.c | 83

[PATCH v7 4/4] target/riscv: smstateen knobs

2022-08-01 Thread Mayuresh Chitale
Add knobs to allow users to enable smstateen and also export it via the ISA extension string. Signed-off-by: Mayuresh Chitale --- target/riscv/cpu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index d4635c7df4..d8a0f4e700 100644 --- a/target

[PATCH v7 0/4] RISC-V Smstateen support

2022-08-01 Thread Mayuresh Chitale
Changes in v2: - Make h/s/envcfg bits in m/h/stateen registers as writeable by default. Anup Patel (1): target/riscv: Force disable extensions if priv spec version does not match Mayuresh Chitale (4): target/riscv: Add smstateen support target/riscv: smstateen check for h/senvcfg target

[PATCH v7 3/4] target/riscv: smstateen check for fcsr

2022-08-01 Thread Mayuresh Chitale
If smstateen is implemented and sstateen0.fcsr is clear then the floating point operations must return illegal instruction exception. Signed-off-by: Mayuresh Chitale --- target/riscv/csr.c| 23 + target/riscv/insn_trans/trans_rvf.c.inc | 40

[PATCH v7 1/4] target/riscv: Add smstateen support

2022-08-01 Thread Mayuresh Chitale
Smstateen extension specifies a mechanism to close the potential covert channels that could cause security issues. This patch adds the CSRs defined in the specification and the corresponding predicates and read/write functions. Signed-off-by: Mayuresh Chitale --- target/riscv/cpu.h | 4

Re: [PATCH v7 1/4] target/riscv: Add smstateen support

2022-08-03 Thread Mayuresh Chitale
On Wed, 2022-08-03 at 16:15 +0800, Weiwei Li wrote: > 在 2022/8/2 上午1:18, Mayuresh Chitale 写道: > > Smstateen extension specifies a mechanism to close > > the potential covert channels that could cause security issues. > > > > This patch adds the CSRs defined in th

Re: [PATCH v7 2/4] target/riscv: smstateen check for h/senvcfg

2022-08-03 Thread Mayuresh Chitale
On Wed, 2022-08-03 at 16:24 +0800, Weiwei Li wrote: > 在 2022/8/2 上午1:18, Mayuresh Chitale 写道: > > Accesses to henvcfg, henvcfgh and senvcfg are allowed only if > > corresponding bit in mstateen0/hstateen0 is enabled. Otherwise an > > illegal instruction trap is generated. &

Re: [PATCH v7 3/4] target/riscv: smstateen check for fcsr

2022-08-03 Thread Mayuresh Chitale
On Wed, 2022-08-03 at 16:32 +0800, Weiwei Li wrote: > 在 2022/8/2 上午1:18, Mayuresh Chitale 写道: > > If smstateen is implemented and sstateen0.fcsr is clear then the > > floating point operations must return illegal instruction > > exception. > > I think this is not corre

[PATCH v8 0/4] RISC-V Smstateen support

2022-08-08 Thread Mayuresh Chitale
rule #3 the comment. Changes in v4: - Fix build issue with riscv32/riscv64-linux-user targets Changes in v3: - Fix coding style issues - Fix *stateen0h index calculation Changes in v2: - Make h/s/envcfg bits in m/h/stateen registers as writeable by default. Mayuresh Chitale (4): target/riscv

[PATCH v8 1/4] target/riscv: Add smstateen support

2022-08-08 Thread Mayuresh Chitale
Smstateen extension specifies a mechanism to close the potential covert channels that could cause security issues. This patch adds the CSRs defined in the specification and the corresponding predicates and read/write functions. Signed-off-by: Mayuresh Chitale --- target/riscv/cpu.h | 4

[PATCH v8 2/4] target/riscv: smstateen check for h/s/envcfg

2022-08-08 Thread Mayuresh Chitale
Accesses to henvcfg, henvcfgh and senvcfg are allowed only if the corresponding bit in mstateen0/hstateen0 is enabled. Otherwise an illegal instruction trap is generated. Signed-off-by: Mayuresh Chitale --- target/riscv/csr.c | 87 ++ 1 file changed

[PATCH v8 4/4] target/riscv: smstateen knobs

2022-08-08 Thread Mayuresh Chitale
Add knobs to allow users to enable smstateen and also export it via the ISA extension string. Signed-off-by: Mayuresh Chitale --- target/riscv/cpu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index d4635c7df4..d8a0f4e700 100644 --- a/target

[PATCH v8 3/4] target/riscv: smstateen check for fcsr

2022-08-08 Thread Mayuresh Chitale
If smstateen is implemented and sstateen0.fcsr is clear then the floating point operations must return illegal instruction exception or virtual instruction trap, if relevant. Signed-off-by: Mayuresh Chitale --- target/riscv/csr.c| 23 + target/riscv

Re: [PATCH v11 4/5] target/riscv: smstateen check for fcsr

2023-03-28 Thread Mayuresh Chitale
On Fri, Mar 24, 2023 at 7:01 PM liweiwei wrote: > > > On 2022/11/21 07:35, Alistair Francis wrote: > > On Sun, Oct 16, 2022 at 11:09 PM Mayuresh Chitale > > wrote: > >> If smstateen is implemented and sstateen0.fcsr is clear then the floating > >> po

[RFC PATCH 3/4] target/riscv: check smstateen fcsr flag

2023-04-10 Thread Mayuresh Chitale
If misa.F and smstateen_fcsr_ok flag are clear then all the floating point instructions must generate an appropriate exception. Signed-off-by: Mayuresh Chitale --- target/riscv/insn_trans/trans_rvf.c.inc | 24 --- target/riscv/insn_trans/trans_rvzfh.c.inc | 4 2

[RFC PATCH 1/4] target/riscv: smstateen check for fcsr

2023-04-10 Thread Mayuresh Chitale
If smstateen is implemented and sstateen0.fcsr is clear then the floating point operations must return illegal instruction exception or virtual instruction trap, if relevant. Signed-off-by: Mayuresh Chitale --- target/riscv/cpu.h | 3 +++ target/riscv/csr.c | 25 - 2

[RFC PATCH 4/4] target/riscv: smstateen knobs

2023-04-10 Thread Mayuresh Chitale
Add knobs to allow users to enable smstateen and also export it via the ISA extension string. Signed-off-by: Mayuresh Chitale Reviewed-by: Weiwei Li Reviewed-by: Alistair Francis --- target/riscv/cpu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/riscv/cpu.c b

[RFC PATCH 0/4] Smstateen FCSR implementation

2023-04-10 Thread Mayuresh Chitale
. Mayuresh Chitale (4): target/riscv: smstateen check for fcsr target/riscv: Add fcsr field in tb->flags target/riscv: check smstateen fcsr flag target/riscv: smstateen knobs target/riscv/cpu.c| 3 ++- target/riscv/cpu.h| 4 target/ri

[RFC PATCH 2/4] target/riscv: Add fcsr field in tb->flags

2023-04-10 Thread Mayuresh Chitale
The state of smstateen0.FCSR bit impacts the execution of floating point instructions when misa.F==0. Add a field in the tb->flags which stores the current state of smstateen0.fcsr and will be used by floating point translation routines. Signed-off-by: Mayuresh Chitale --- target/riscv/cp

Re: [PATCH v4 1/3] target/riscv: smstateen check for fcsr

2023-05-17 Thread Mayuresh Chitale
On Wed, May 17, 2023 at 8:42 AM Alistair Francis wrote: > > On Tue, May 2, 2023 at 12:00 AM Mayuresh Chitale > wrote: > > > > If smstateen is implemented and smtateen0.fcsr is clear and misa.F > > is off then the floating point operations must return illegal > >

Re: [RFC PATCH 3/4] target/riscv: check smstateen fcsr flag

2023-04-13 Thread Mayuresh Chitale
On Mon, Apr 10, 2023 at 8:00 PM liweiwei wrote: > > > On 2023/4/10 22:13, Mayuresh Chitale wrote: > > If misa.F and smstateen_fcsr_ok flag are clear then all the floating > > point instructions must generate an appropriate exception. > > > > Signed-off-by: Mayur

Re: [RFC PATCH 1/4] target/riscv: smstateen check for fcsr

2023-04-13 Thread Mayuresh Chitale
On Mon, Apr 10, 2023 at 8:14 PM liweiwei wrote: > > > On 2023/4/10 22:13, Mayuresh Chitale wrote: > > If smstateen is implemented and sstateen0.fcsr is clear then the > > floating point operations must return illegal instruction exception > > or virtual instruction

Re: [RFC PATCH 3/4] target/riscv: check smstateen fcsr flag

2023-04-13 Thread Mayuresh Chitale
On Tue, Apr 11, 2023 at 7:23 AM Richard Henderson wrote: > > On 4/10/23 07:13, Mayuresh Chitale wrote: > > +#ifndef CONFIG_USER_ONLY > > +#define smstateen_fcsr_check(ctx) do { \ > > +if (!ctx->smstateen_fcsr_ok) { \ > > +if (ctx->virt_enabled) { \

Re: [RFC PATCH 2/4] target/riscv: Add fcsr field in tb->flags

2023-04-13 Thread Mayuresh Chitale
On Tue, Apr 11, 2023 at 7:17 AM Richard Henderson wrote: > > On 4/10/23 07:13, Mayuresh Chitale wrote: > > The state of smstateen0.FCSR bit impacts the execution of floating point > > instructions when misa.F==0. Add a field in the tb->flags which stores > > the curre

[RFC PATCH v2 3/4] target/riscv: check smstateen fcsr flag

2023-04-14 Thread Mayuresh Chitale
If misa.F and smstateen_fcsr_ok flag are clear then all the floating point instructions must generate an appropriate exception. Signed-off-by: Mayuresh Chitale --- target/riscv/insn_trans/trans_rvd.c.inc | 13 target/riscv/insn_trans/trans_rvf.c.inc | 24

[RFC PATCH v2 1/4] target/riscv: smstateen check for fcsr

2023-04-14 Thread Mayuresh Chitale
If smstateen is implemented and smtateen0.fcsr is clear and misa.F is off then the floating point operations must return illegal instruction exception or virtual instruction trap, if relevant. Signed-off-by: Mayuresh Chitale --- target/riscv/csr.c | 23 +++ 1 file changed

[RFC PATCH v2 0/4] Smstateen FCSR

2023-04-14 Thread Mayuresh Chitale
in v2: - Improve patch 1 description - Reuse TB_FLAGS.HS_FS for smstateen - Convert smstateen_fcsr_check to function - Add fcsr check for zdinx Mayuresh Chitale (4): target/riscv: smstateen check for fcsr target/riscv: Reuse TB_FLAGS.MSTATUS_HFS_FS target/riscv: check smstateen fcsr flag

[RFC PATCH v2 4/4] target/riscv: smstateen knobs

2023-04-14 Thread Mayuresh Chitale
Add knobs to allow users to enable smstateen and also export it via the ISA extension string. Signed-off-by: Mayuresh Chitale Reviewed-by: Weiwei Li Reviewed-by: Alistair Francis --- target/riscv/cpu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/riscv/cpu.c b

[RFC PATCH v2 2/4] target/riscv: Reuse TB_FLAGS.MSTATUS_HFS_FS

2023-04-14 Thread Mayuresh Chitale
When misa.F is clear, TB_FLAGS.MSTATUS_HS_FS field is unused and can be used to save the current state of smstateen0.FCSR check which is needed by the floating point translation routines. Signed-off-by: Mayuresh Chitale --- target/riscv/cpu_helper.c | 12 target/riscv/translate.c

Re: [RFC PATCH v2 1/4] target/riscv: smstateen check for fcsr

2023-04-26 Thread Mayuresh Chitale
On Sat, Apr 15, 2023 at 6:32 AM Weiwei Li wrote: > > > On 2023/4/15 00:01, Mayuresh Chitale wrote: > > If smstateen is implemented and smtateen0.fcsr is clear and misa.F > > is off then the floating point operations must return illegal > > instruction exception or v

Re: [RFC PATCH v2 2/4] target/riscv: Reuse TB_FLAGS.MSTATUS_HFS_FS

2023-04-26 Thread Mayuresh Chitale
On Sat, Apr 15, 2023 at 7:15 AM Weiwei Li wrote: > > > On 2023/4/15 00:02, Mayuresh Chitale wrote: > > When misa.F is clear, TB_FLAGS.MSTATUS_HS_FS field is unused and can > > be used to save the current state of smstateen0.FCSR check which is > > needed by the floating

Re: [RFC PATCH v2 3/4] target/riscv: check smstateen fcsr flag

2023-04-26 Thread Mayuresh Chitale
On Sat, Apr 15, 2023 at 6:55 AM Weiwei Li wrote: > > > On 2023/4/15 00:02, Mayuresh Chitale wrote: > > If misa.F and smstateen_fcsr_ok flag are clear then all the floating > > point instructions must generate an appropriate exception. > > > > Signed-off-by: Mayur

[PATCH v3 3/4] target/riscv: check smstateen fcsr flag

2023-04-28 Thread Mayuresh Chitale
If misa.F and smstateen_fcsr_ok flag are clear then all the floating point instructions must generate an appropriate exception. Signed-off-by: Mayuresh Chitale --- target/riscv/insn_trans/trans_rvd.c.inc | 13 ++--- target/riscv/insn_trans/trans_rvf.c.inc | 24 ++--- target

[PATCH v3 0/4] Smstateen FCSR

2023-04-28 Thread Mayuresh Chitale
Mayuresh Chitale (4): target/riscv: smstateen check for fcsr target/riscv: Reuse tb->flags.FS target/riscv: check smstateen fcsr flag target/riscv: smstateen knobs target/riscv/cpu.c| 3 ++- target/riscv/cpu_helper.c | 9 +++ target/riscv/cs

[PATCH v3 2/4] target/riscv: Reuse tb->flags.FS

2023-04-28 Thread Mayuresh Chitale
When misa.F is 0 tb->flags.FS field is unused and can be used to save the current state of smstateen0.FCSR check which is needed by the floating point translation routines. Signed-off-by: Mayuresh Chitale --- target/riscv/cpu_helper.c | 9 + target/riscv/translate.c |

[PATCH v3 1/4] target/riscv: smstateen check for fcsr

2023-04-28 Thread Mayuresh Chitale
If smstateen is implemented and smtateen0.fcsr is clear and misa.F is off then the floating point operations must return illegal instruction exception or virtual instruction trap, if relevant. Signed-off-by: Mayuresh Chitale Reviewed-by: Weiwei Li --- target/riscv/csr.c | 15 +++ 1

[PATCH v3 4/4] target/riscv: smstateen knobs

2023-04-28 Thread Mayuresh Chitale
Add knobs to allow users to enable smstateen and also export it via the ISA extension string. Signed-off-by: Mayuresh Chitale Reviewed-by: Weiwei Li Reviewed-by: Alistair Francis --- target/riscv/cpu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/riscv/cpu.c b

[PATCH v4 1/3] target/riscv: smstateen check for fcsr

2023-05-01 Thread Mayuresh Chitale
If smstateen is implemented and smtateen0.fcsr is clear and misa.F is off then the floating point operations must return illegal instruction exception or virtual instruction trap, if relevant. Signed-off-by: Mayuresh Chitale Reviewed-by: Weiwei Li --- target/riscv/csr.c | 15 +++ 1

[PATCH v4 2/3] target/riscv: Reuse tb->flags.FS

2023-05-01 Thread Mayuresh Chitale
When misa.F is 0 tb->flags.FS field is unused and can be used to save the current state of smstateen0.FCSR check which is needed by the floating point translation routines. Signed-off-by: Mayuresh Chitale Reviewed-by: Weiwei Li --- target/riscv/cpu_helper.c | 6 ++ tar

[PATCH v4 3/3] target/riscv: smstateen knobs

2023-05-01 Thread Mayuresh Chitale
Add knobs to allow users to enable smstateen and also export it via the ISA extension string. Signed-off-by: Mayuresh Chitale Reviewed-by: Weiwei Li Reviewed-by: Alistair Francis --- target/riscv/cpu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/riscv/cpu.c b

[PATCH v4 0/3] Smstateen FCSR

2023-05-01 Thread Mayuresh Chitale
smstateen_fcsr_check to function - Add fcsr check for zdinx Mayuresh Chitale (3): target/riscv: smstateen check for fcsr target/riscv: Reuse tb->flags.FS target/riscv: smstateen knobs target/riscv/cpu.c | 3 ++- target/riscv/cpu_helper.c | 6 ++ target/ri

[PATCH v5 1/3] target/riscv: smstateen check for fcsr

2023-05-18 Thread Mayuresh Chitale
Implement the s/h/mstateen.fcsr bit as defined in the smstateen spec and check for it when accessing the fcsr register and its fields. Signed-off-by: Mayuresh Chitale Reviewed-by: Weiwei Li --- target/riscv/csr.c | 15 +++ 1 file changed, 15 insertions(+) diff --git a/target/riscv

[PATCH v5 2/3] target/riscv: Reuse tb->flags.FS

2023-05-18 Thread Mayuresh Chitale
When misa.F is 0 tb->flags.FS field is unused and can be used to save the current state of smstateen0.FCSR check which is needed by the floating point translation routines. Signed-off-by: Mayuresh Chitale Reviewed-by: Richard Henderson Reviewed-by: Weiwei Li --- target/riscv/cpu_helpe

[PATCH v5 3/3] target/riscv: smstateen knobs

2023-05-18 Thread Mayuresh Chitale
Add knobs to allow users to enable smstateen and also export it via the ISA extension string. Signed-off-by: Mayuresh Chitale Reviewed-by: Weiwei Li Reviewed-by: Alistair Francis --- target/riscv/cpu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/riscv/cpu.c b

[PATCH v5 0/3] Smstateen FCSR

2023-05-18 Thread Mayuresh Chitale
description - Reuse TB_FLAGS.HS_FS for smstateen - Convert smstateen_fcsr_check to function - Add fcsr check for zdinx Mayuresh Chitale (3): target/riscv: smstateen check for fcsr target/riscv: Reuse tb->flags.FS target/riscv: smstateen knobs target/riscv/cpu.c |

[RFC PATCH v4 1/4] target/riscv: Add smstateen support

2022-05-13 Thread Mayuresh Chitale
Smstateen extension specifies a mechanism to close the potential covert channels that could cause security issues. This patch adds the CSRs defined in the specification and the corresponding predicates and read/write functions. Signed-off-by: Mayuresh Chitale --- target/riscv/cpu.c | 2

[RFC PATCH v4 0/4] RISC-V Smstateen support

2022-05-13 Thread Mayuresh Chitale
Changes in v2: - Make h/s/envcfg bits in m/h/stateen registers as writeable by default. Mayuresh Chitale (4): target/riscv: Add smstateen support target/riscv: smstateen check for h/senvcfg target/riscv: smstateen check for fcsr target/riscv: smstateen check for AIA/IMSIC target/riscv/cpu.c

[RFC PATCH v4 3/4] target/riscv: smstateen check for fcsr

2022-05-13 Thread Mayuresh Chitale
If smstateen is implemented and sstateen0.fcsr is clear then the floating point operations must return illegal instruction exception. Signed-off-by: Mayuresh Chitale --- target/riscv/csr.c | 24 1 file changed, 24 insertions(+) diff --git a/target/riscv/csr.c b/target

[RFC PATCH v4 2/4] target/riscv: smstateen check for h/senvcfg

2022-05-13 Thread Mayuresh Chitale
Accesses to henvcfg, henvcfgh and senvcfg are allowed only if corresponding bit in mstateen0/hstateen0 is enabled. Otherwise an illegal instruction trap is generated. Signed-off-by: Mayuresh Chitale --- target/riscv/csr.c | 84 ++ 1 file changed, 78

[RFC PATCH v4 4/4] target/riscv: smstateen check for AIA/IMSIC

2022-05-13 Thread Mayuresh Chitale
If smstateen is implemented then accesses to AIA registers CSRS, IMSIC CSRs and other IMSIC registers is controlled by setting of corresponding bits in mstateen/hstateen registers. Otherwise an illegal instruction trap or virtual instruction trap is generated. Signed-off-by: Mayuresh Chitale

[PATCH v10 3/5] target/riscv: generate virtual instruction exception

2022-10-03 Thread Mayuresh Chitale
This patch adds a mechanism to generate a virtual instruction instruction exception instead of an illegal instruction exception during instruction decode when virt is enabled. Signed-off-by: Mayuresh Chitale --- target/riscv/translate.c | 9 - 1 file changed, 8 insertions(+), 1 deletion

[PATCH v10 0/5] RISC-V Smstateen support

2022-10-03 Thread Mayuresh Chitale
isa_edata_arr as described in rule #3 the comment. Changes in v4: - Fix build issue with riscv32/riscv64-linux-user targets Changes in v3: - Fix coding style issues - Fix *stateen0h index calculation Changes in v2: - Make h/s/envcfg bits in m/h/stateen registers as writeable by default. Mayuresh

[PATCH v10 1/5] target/riscv: Add smstateen support

2022-10-03 Thread Mayuresh Chitale
Smstateen extension specifies a mechanism to close the potential covert channels that could cause security issues. This patch adds the CSRs defined in the specification and the corresponding predicates and read/write functions. Signed-off-by: Mayuresh Chitale Reviewed-by: Weiwei Li --- target

[PATCH v10 2/5] target/riscv: smstateen check for h/s/envcfg

2022-10-03 Thread Mayuresh Chitale
Accesses to henvcfg, henvcfgh and senvcfg are allowed only if the corresponding bit in mstateen0/hstateen0 is enabled. Otherwise an illegal instruction trap is generated. Signed-off-by: Mayuresh Chitale Reviewed-by: Weiwei Li Reviewed-by: Alistair Francis --- target/riscv/csr.c | 87

[PATCH v10 5/5] target/riscv: smstateen knobs

2022-10-03 Thread Mayuresh Chitale
Add knobs to allow users to enable smstateen and also export it via the ISA extension string. Signed-off-by: Mayuresh Chitale Reviewed-by: Weiwei Li Reviewed-by: Alistair Francis --- target/riscv/cpu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/riscv/cpu.c b/target/riscv

[PATCH v10 4/5] target/riscv: smstateen check for fcsr

2022-10-03 Thread Mayuresh Chitale
If smstateen is implemented and sstateen0.fcsr is clear then the floating point operations must return illegal instruction exception or virtual instruction trap, if relevant. Signed-off-by: Mayuresh Chitale --- target/riscv/csr.c| 23 target/riscv/insn_trans

[PATCH v1 3/3] target/riscv: kvm: Support selecting VCPU extensions

2022-10-26 Thread Mayuresh Chitale
Set the state of each ISA extension on the vcpu depending on what is set in the CPU property and what is allowed by KVM for that extension. Signed-off-by: Mayuresh Chitale --- target/riscv/cpu.c | 11 - target/riscv/kvm.c | 88 ++-- target

[PATCH v1 2/3] target/riscv: Extend isa_ext_data for single letter extensions

2022-10-26 Thread Mayuresh Chitale
extensions from the list of single letter extensions as those are not supported yet. Signed-off-by: Mayuresh Chitale --- target/riscv/cpu.c | 41 +++-- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cp

[PATCH v1 0/3] target/riscv: Apply KVM policy to ISA extensions

2022-10-26 Thread Mayuresh Chitale
Currently the single and multi letter ISA extensions exposed to the guest vcpu don't confirm to the KVM policies. This patchset updates the kvm headers and applies policies set in KVM to the extensions exposed to the guest. Mayuresh Chitale (3): update-linux-headers: Version 6.1-rc2 t

[PATCH v1 1/3] update-linux-headers: Version 6.1-rc2

2022-10-26 Thread Mayuresh Chitale
Sync headers with kernel commit 247f34f7b803 Signed-off-by: Mayuresh Chitale --- include/standard-headers/drm/drm_fourcc.h | 34 - include/standard-headers/linux/ethtool.h | 63 +++- include/standard-headers/linux/fuse.h | 6 +- .../linux/input-event-codes.h

[PATCH v3 0/3] target/riscv: Apply KVM policy to ISA extensions

2022-12-08 Thread Mayuresh Chitale
https://github.com/mdchitale/qemu.git Changes in v3: - Address comments from Bin Meng Changes in v2: - Rebase to latest riscv-to-apply.next - Update linux headers to version 6.1-rc8 - Add reviewed by tags Mayuresh Chitale (3): update-linux-headers: Version 6.1-rc8 target/riscv: Extend isa_ext_dat

[PATCH v3 1/3] update-linux-headers: Version 6.1-rc8

2022-12-08 Thread Mayuresh Chitale
Sync headers with kernel commit 76dcd734eca2 Signed-off-by: Mayuresh Chitale Reviewed-by: Andrew Jones --- include/standard-headers/drm/drm_fourcc.h | 34 - include/standard-headers/linux/ethtool.h | 63 +++- include/standard-headers/linux/fuse.h | 6 +- .../linux

[PATCH v3 3/3] target/riscv: kvm: Support selecting VCPU extensions

2022-12-08 Thread Mayuresh Chitale
Set the state of each ISA extension on the vcpu depending on what is set in the CPU property and what is allowed by KVM for that extension. Signed-off-by: Mayuresh Chitale Reviewed-by: Andrew Jones Reviewed-by: Alistair Francis --- target/riscv/cpu.c | 11 - target/riscv/kvm.c

[PATCH v3 2/3] target/riscv: Extend isa_ext_data for single letter extensions

2022-12-08 Thread Mayuresh Chitale
extensions from the list of single letter extensions as those are not supported yet. Signed-off-by: Mayuresh Chitale Reviewed-by: Andrew Jones Reviewed-by: Alistair Francis Reviewed-by: Bin Meng --- target/riscv/cpu.c | 41 +++-- 1 file changed, 23 inserti

Re: [RFC PATCH v5 1/4] target/riscv: Add smstateen support

2022-07-07 Thread Mayuresh Chitale
On Thu, 2022-06-16 at 15:48 +1000, Alistair Francis wrote: > On Sat, Jun 4, 2022 at 2:13 AM Mayuresh Chitale > wrote: > > Smstateen extension specifies a mechanism to close > > the potential covert channels that could cause security issues. > > > > This patc

Re: [RFC PATCH v5 3/4] target/riscv: smstateen check for fcsr

2022-07-07 Thread Mayuresh Chitale
On Thu, 2022-06-16 at 17:17 +1000, Alistair Francis wrote: > On Sat, Jun 4, 2022 at 2:08 AM Mayuresh Chitale > wrote: > > If smstateen is implemented and sstateen0.fcsr is clear > > then the floating point operations must return illegal > > instruction exception. > >

Re: [RFC PATCH v5 4/4] target/riscv: smstateen check for AIA/IMSIC

2022-07-07 Thread Mayuresh Chitale
On Thu, 2022-06-16 at 17:18 +1000, Alistair Francis wrote: > On Sat, Jun 4, 2022 at 2:15 AM Mayuresh Chitale > wrote: > > If smstateen is implemented then accesses to AIA > > registers CSRS, IMSIC CSRs and other IMSIC registers > > is controlled by setting of correspond

Re: [RFC PATCH v5 1/4] target/riscv: Add smstateen support

2022-07-07 Thread Mayuresh Chitale
On Sat, 2022-07-02 at 18:19 +0800, angell1518 wrote: > At 2022-06-04 00:04:22, "Mayuresh Chitale" > wrote: > >Smstateen extension specifies a mechanism to close > >the potential covert channels that could cause security issues. > > > >This patch adds t

Re: [RFC PATCH v5 2/4] target/riscv: smstateen check for h/senvcfg

2022-07-07 Thread Mayuresh Chitale
On Sat, 2022-07-02 at 18:33 +0800, angell1518 wrote: > At 2022-06-04 00:04:23, "Mayuresh Chitale" > wrote: > >Accesses to henvcfg, henvcfgh and senvcfg are allowed > >only if corresponding bit in mstateen0/hstateen0 is > >enabled. Otherwise an illega

Re: [RFC PATCH v5 1/4] target/riscv: Add smstateen support

2022-07-18 Thread Mayuresh Chitale
On Fri, 2022-07-08 at 07:44 +0800, Weiwei Li wrote: > 在 2022/7/8 上午12:53, Mayuresh Chitale 写道: > > On Sat, 2022-07-02 at 18:19 +0800, angell1518 wrote: > > > At 2022-06-04 00:04:22, "Mayuresh Chitale" < > > > mchit...@ventanamicro.com > > >

[PATCH v6 0/5] RISC-V Smstateen support

2022-07-21 Thread Mayuresh Chitale
Patel (1): target/riscv: Force disable extensions if priv spec version does not match *** BLURB HERE *** Mayuresh Chitale (5): target/riscv: Add smstateen support target/riscv: smstateen check for h/senvcfg target/riscv: smstateen check for fcsr target/riscv: smstateen check for AIA

[PATCH v6 1/5] target/riscv: Add smstateen support

2022-07-21 Thread Mayuresh Chitale
Smstateen extension specifies a mechanism to close the potential covert channels that could cause security issues. This patch adds the CSRs defined in the specification and the corresponding predicates and read/write functions. Signed-off-by: Mayuresh Chitale --- target/riscv/cpu.h | 4

[PATCH v6 2/5] target/riscv: smstateen check for h/senvcfg

2022-07-21 Thread Mayuresh Chitale
Accesses to henvcfg, henvcfgh and senvcfg are allowed only if corresponding bit in mstateen0/hstateen0 is enabled. Otherwise an illegal instruction trap is generated. Signed-off-by: Mayuresh Chitale --- target/riscv/csr.c | 100 + 1 file changed, 93

[PATCH v6 3/5] target/riscv: smstateen check for fcsr

2022-07-21 Thread Mayuresh Chitale
If smstateen is implemented and sstateen0.fcsr is clear then the floating point operations must return illegal instruction exception. Signed-off-by: Mayuresh Chitale --- target/riscv/csr.c| 23 ++ target/riscv/insn_trans/trans_rvf.c.inc | 38

[PATCH v6 4/5] target/riscv: smstateen check for AIA/IMSIC

2022-07-21 Thread Mayuresh Chitale
If smstateen is implemented then accesses to AIA registers CSRS, IMSIC CSRs and other IMSIC registers is controlled by setting of corresponding bits in mstateen/hstateen registers. Otherwise an illegal instruction trap or virtual instruction trap is generated. Signed-off-by: Mayuresh Chitale

[PATCH v6 5/5] target/riscv: smstateen knobs

2022-07-21 Thread Mayuresh Chitale
Add knobs to allow users to enable smstateen and also export it via the ISA extension string. Signed-off-by: Mayuresh Chitale --- target/riscv/cpu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index db2b8e4d30..2b7ed95396 100644 --- a/target

[RFC PATCH v5 3/4] target/riscv: smstateen check for fcsr

2022-06-03 Thread Mayuresh Chitale
If smstateen is implemented and sstateen0.fcsr is clear then the floating point operations must return illegal instruction exception. Signed-off-by: Mayuresh Chitale --- target/riscv/csr.c | 24 1 file changed, 24 insertions(+) diff --git a/target/riscv/csr.c b/target

[RFC PATCH v5 0/4] RISC-V Smstateen support

2022-06-03 Thread Mayuresh Chitale
writeable by default. Anup Patel (1): target/riscv: Force disable extensions if priv spec version does not match Mayuresh Chitale (4): target/riscv: Add smstateen support target/riscv: smstateen check for h/senvcfg target/riscv: smstateen check for fcsr target/riscv: smstateen check for

[RFC PATCH v5 1/4] target/riscv: Add smstateen support

2022-06-03 Thread Mayuresh Chitale
Smstateen extension specifies a mechanism to close the potential covert channels that could cause security issues. This patch adds the CSRs defined in the specification and the corresponding predicates and read/write functions. Signed-off-by: Mayuresh Chitale --- target/riscv/cpu.c | 2

[RFC PATCH v5 4/4] target/riscv: smstateen check for AIA/IMSIC

2022-06-03 Thread Mayuresh Chitale
If smstateen is implemented then accesses to AIA registers CSRS, IMSIC CSRs and other IMSIC registers is controlled by setting of corresponding bits in mstateen/hstateen registers. Otherwise an illegal instruction trap or virtual instruction trap is generated. Signed-off-by: Mayuresh Chitale

[RFC PATCH v5 2/4] target/riscv: smstateen check for h/senvcfg

2022-06-03 Thread Mayuresh Chitale
Accesses to henvcfg, henvcfgh and senvcfg are allowed only if corresponding bit in mstateen0/hstateen0 is enabled. Otherwise an illegal instruction trap is generated. Signed-off-by: Mayuresh Chitale --- target/riscv/csr.c | 84 ++ 1 file changed, 78

[RFC PATCH v1 1/4] target/riscv: Add smstateen support

2022-03-22 Thread Mayuresh Chitale
Smstateen extension specifies a mechanism to close the potential covert channels that could cause security issues. This patch adds the CSRs defined in the specification and the corresponding predicates and read/write functions. Signed-off-by: Mayuresh Chitale --- target/riscv/cpu.c | 2

[RFC PATCH v1 2/4] target/riscv: smstateen check for h/senvcfg

2022-03-22 Thread Mayuresh Chitale
Accesses to henvcfg, henvcfgh and senvcfg are allowed only if corresponding bit in mstateen0/hstateen0 is enabled. Otherwise an illegal instruction trap is generated. Signed-off-by: Mayuresh Chitale --- target/riscv/csr.c | 70 -- 1 file changed, 68

[RFC PATCH v1 3/4] target/riscv: smstateen check for fcsr

2022-03-22 Thread Mayuresh Chitale
If smstateen is implemented and sstateen0.fcsr is clear then the floating point operations must return illegal instruction exception. Signed-off-by: Mayuresh Chitale --- target/riscv/csr.c | 24 1 file changed, 24 insertions(+) diff --git a/target/riscv/csr.c b/target

[RFC PATCH v1 0/4] RISC-V Smstateen support

2022-03-22 Thread Mayuresh Chitale
controlled via smstateen. This series depends on the following series from Atish Patra: https://lists.nongnu.org/archive/html/qemu-riscv/2022-03/msg00031.html https://lists.nongnu.org/archive/html/qemu-riscv/2022-03/msg00142.html Mayuresh Chitale (4): target/riscv: Add smstateen support target/riscv

[RFC PATCH v1 4/4] target/riscv: smstateen check for AIA/IMSIC

2022-03-22 Thread Mayuresh Chitale
If smstateen is implemented then accesses to AIA registers CSRS, IMSIC CSRs and other IMSIC registers is controlled by setting of corresponding bits in mstateen/hstateen registers. Otherwise an illegal instruction trap or virtual instruction trap is generated. Signed-off-by: Mayuresh Chitale

[RFC PATCH v2 0/4] RISC-V Smstateen support

2022-03-23 Thread Mayuresh Chitale
writeable by default. Mayuresh Chitale (4): target/riscv: Add smstateen support target/riscv: smstateen check for h/senvcfg target/riscv: smstateen check for fcsr target/riscv: smstateen check for AIA/IMSIC target/riscv/cpu.c | 2 + target/riscv/cpu.h | 4 + target/riscv/cpu_bits.h

[RFC PATCH v2 1/4] target/riscv: Add smstateen support

2022-03-23 Thread Mayuresh Chitale
Smstateen extension specifies a mechanism to close the potential covert channels that could cause security issues. This patch adds the CSRs defined in the specification and the corresponding predicates and read/write functions. Signed-off-by: Mayuresh Chitale --- target/riscv/cpu.c | 2

[RFC PATCH v2 2/4] target/riscv: smstateen check for h/senvcfg

2022-03-23 Thread Mayuresh Chitale
Accesses to henvcfg, henvcfgh and senvcfg are allowed only if corresponding bit in mstateen0/hstateen0 is enabled. Otherwise an illegal instruction trap is generated. Signed-off-by: Mayuresh Chitale --- target/riscv/csr.c | 82 ++ 1 file changed, 76

[RFC PATCH v2 3/4] target/riscv: smstateen check for fcsr

2022-03-23 Thread Mayuresh Chitale
If smstateen is implemented and sstateen0.fcsr is clear then the floating point operations must return illegal instruction exception. Signed-off-by: Mayuresh Chitale --- target/riscv/csr.c | 24 1 file changed, 24 insertions(+) diff --git a/target/riscv/csr.c b/target

  1   2   >