Re: [PATCH 1/1] target/riscv: enable floating point unit

2024-10-07 Thread Alistair Francis
On Thu, Sep 19, 2024 at 1:34 AM Peter Maydell wrote: > > On Wed, 18 Sept 2024 at 14:49, Heinrich Schuchardt > wrote: > > > > On 18.09.24 15:12, Peter Maydell wrote: > > > On Wed, 18 Sept 2024 at 14:06, Heinrich Schuchardt > > > wrote: > > >> Thanks Peter for looking into this. > > >> > > >> QEMU

Re: [PATCH 1/1] target/riscv: enable floating point unit

2024-09-19 Thread Richard Henderson
On 9/16/24 20:16, Heinrich Schuchardt wrote: +env->mstatus = set_field(env->mstatus, MSTATUS_FS, env->misa_mxl); Using mxl is definitely wrong here. r~

Re: [PATCH 1/1] target/riscv: enable floating point unit

2024-09-18 Thread Heinrich Schuchardt
On 18.09.24 17:32, Peter Maydell wrote: On Wed, 18 Sept 2024 at 14:49, Heinrich Schuchardt wrote: On 18.09.24 15:12, Peter Maydell wrote: On Wed, 18 Sept 2024 at 14:06, Heinrich Schuchardt wrote: Thanks Peter for looking into this. QEMU's cpu_synchronize_all_post_init() and do_kvm_cpu_sync

Re: [PATCH 1/1] target/riscv: enable floating point unit

2024-09-18 Thread Heinrich Schuchardt
On 18.09.24 15:56, Andrew Jones wrote: Thanks Heinrich, I had also forgotten that distinction. So the last question is whether or not we want to reset mstatus.FS to 1 instead of 3, as is done in this patch. Thanks, drew If the FD flag set to 3 (Dirty) indicates that "the corresponding state

Re: [PATCH 1/1] target/riscv: enable floating point unit

2024-09-18 Thread Peter Maydell
On Wed, 18 Sept 2024 at 14:49, Heinrich Schuchardt wrote: > > On 18.09.24 15:12, Peter Maydell wrote: > > On Wed, 18 Sept 2024 at 14:06, Heinrich Schuchardt > > wrote: > >> Thanks Peter for looking into this. > >> > >> QEMU's cpu_synchronize_all_post_init() and > >> do_kvm_cpu_synchronize_post_re

Re: [PATCH 1/1] target/riscv: enable floating point unit

2024-09-18 Thread Andrew Jones
On Wed, Sep 18, 2024 at 03:49:39PM GMT, Heinrich Schuchardt wrote: > On 18.09.24 15:12, Peter Maydell wrote: > > On Wed, 18 Sept 2024 at 14:06, Heinrich Schuchardt > > wrote: > > > Thanks Peter for looking into this. > > > > > > QEMU's cpu_synchronize_all_post_init() and > > > do_kvm_cpu_synchron

Re: [PATCH 1/1] target/riscv: enable floating point unit

2024-09-18 Thread Heinrich Schuchardt
On 18.09.24 15:12, Peter Maydell wrote: On Wed, 18 Sept 2024 at 14:06, Heinrich Schuchardt wrote: Thanks Peter for looking into this. QEMU's cpu_synchronize_all_post_init() and do_kvm_cpu_synchronize_post_reset() both end up in kvm_arch_put_registers() and that is long after Linux kvm_arch_vcp

Re: [PATCH 1/1] target/riscv: enable floating point unit

2024-09-18 Thread Peter Maydell
On Wed, 18 Sept 2024 at 14:06, Heinrich Schuchardt wrote: > Thanks Peter for looking into this. > > QEMU's cpu_synchronize_all_post_init() and > do_kvm_cpu_synchronize_post_reset() both end up in > kvm_arch_put_registers() and that is long after Linux > kvm_arch_vcpu_create() has been setting some

Re: [PATCH 1/1] target/riscv: enable floating point unit

2024-09-18 Thread Heinrich Schuchardt
On 18.09.24 13:10, Peter Maydell wrote: On Wed, 18 Sept 2024 at 07:06, Andrew Jones wrote: On Tue, Sep 17, 2024 at 06:45:21PM GMT, Heinrich Schuchardt wrote: ... When thinking about the migration of virtual machines shouldn't QEMU be in control of the initial state of vcpus instead of KVM?

Re: [PATCH 1/1] target/riscv: enable floating point unit

2024-09-18 Thread Peter Maydell
On Wed, 18 Sept 2024 at 07:06, Andrew Jones wrote: > > On Tue, Sep 17, 2024 at 06:45:21PM GMT, Heinrich Schuchardt wrote: > ... > > When thinking about the migration of virtual machines shouldn't QEMU be in > > control of the initial state of vcpus instead of KVM? > > > > Thinking about this more,

Re: [PATCH 1/1] target/riscv: enable floating point unit

2024-09-17 Thread Andrew Jones
On Tue, Sep 17, 2024 at 06:45:21PM GMT, Heinrich Schuchardt wrote: ... > When thinking about the migration of virtual machines shouldn't QEMU be in > control of the initial state of vcpus instead of KVM? > Thinking about this more, I'm inclined to agree. Initial state and reset state should be tra

Re: [PATCH 1/1] target/riscv: enable floating point unit

2024-09-17 Thread Heinrich Schuchardt
On 17.09.24 16:49, Andrew Jones wrote: On Tue, Sep 17, 2024 at 03:28:42PM GMT, Heinrich Schuchardt wrote: On 17.09.24 14:13, Andrew Jones wrote: On Mon, Sep 16, 2024 at 08:16:33PM GMT, Heinrich Schuchardt wrote: OpenSBI enables the floating point in mstatus. For consistency QEMU/KVM should do

Re: [PATCH 1/1] target/riscv: enable floating point unit

2024-09-17 Thread Andrew Jones
On Tue, Sep 17, 2024 at 03:28:42PM GMT, Heinrich Schuchardt wrote: > On 17.09.24 14:13, Andrew Jones wrote: > > On Mon, Sep 16, 2024 at 08:16:33PM GMT, Heinrich Schuchardt wrote: > > > OpenSBI enables the floating point in mstatus. For consistency QEMU/KVM > > > should do the same. > > > > > > Wit

Re: [PATCH 1/1] target/riscv: enable floating point unit

2024-09-17 Thread Heinrich Schuchardt
On 17.09.24 14:13, Andrew Jones wrote: On Mon, Sep 16, 2024 at 08:16:33PM GMT, Heinrich Schuchardt wrote: OpenSBI enables the floating point in mstatus. For consistency QEMU/KVM should do the same. Without this patch EDK II with TLS enabled crashes when hitting the first floating point instruct

Re: [PATCH 1/1] target/riscv: enable floating point unit

2024-09-17 Thread Andrew Jones
On Mon, Sep 16, 2024 at 08:16:33PM GMT, Heinrich Schuchardt wrote: > OpenSBI enables the floating point in mstatus. For consistency QEMU/KVM > should do the same. > > Without this patch EDK II with TLS enabled crashes when hitting the first > floating point instruction while running QEMU with --ac

[PATCH 1/1] target/riscv: enable floating point unit

2024-09-16 Thread Heinrich Schuchardt
OpenSBI enables the floating point in mstatus. For consistency QEMU/KVM should do the same. Without this patch EDK II with TLS enabled crashes when hitting the first floating point instruction while running QEMU with --accel kvm and runs fine with --accel tcg. Additionally to this patch EDK II sh