[PATCH 0/2] RISC-V APLIC fixes

2024-03-06 Thread Anup Patel
Few fixes for RISC-V APLIC discovered during Linux AIA patch reviews. These patches can also be found in the apatel_aplic_fixes_v1 branch at: https://github.com/avpatel/qemu.git Anup Patel (2): hw/intc/riscv_aplic: Fix setipnum_le write emulation for APLIC MSI-mode hw/intc/riscv_aplic

[PATCH 2/2] hw/intc/riscv_aplic: Fix in_clrip[x] read emulation

2024-03-06 Thread Anup Patel
lue = (incoming wire value) XOR (source is inverted)" Update the riscv_aplic_read_input_word() implementation to match the above. Fixes: e8f79343cfc8 ("hw/intc: Add RISC-V AIA APLIC device emulation") Signed-off-by: Anup Patel --- hw/intc/riscv_aplic.c | 17 +++-- 1 fil

[PATCH 1/2] hw/intc/riscv_aplic: Fix setipnum_le write emulation for APLIC MSI-mode

2024-03-06 Thread Anup Patel
d RISC-V AIA APLIC device emulation") Signed-off-by: Anup Patel --- hw/intc/riscv_aplic.c | 20 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/hw/intc/riscv_aplic.c b/hw/intc/riscv_aplic.c index e98e258deb..775bb96164 100644 --- a/hw/intc/riscv_aplic.c +++ b/hw

Re: [PATCH v3 0/2] Export debug triggers as an extension

2024-02-29 Thread Anup Patel
On Thu, Feb 29, 2024 at 8:42 PM Andrew Jones wrote: > > On Thu, Feb 29, 2024 at 07:07:43PM +0530, Himanshu Chauhan wrote: > > All the CPUs may or may not implement the debug triggers (sdtrig) > > extension. The presence of it should be dynamically detectable. > > This patch exports the debug

Re: Re: [PATCH 0/2] Export debug triggers as an extension

2024-02-04 Thread Anup Patel
On Mon, Feb 5, 2024 at 9:36 AM Alistair Francis wrote: > > On Mon, Jan 22, 2024 at 7:16 PM Andrew Jones wrote: > > > > On Mon, Jan 22, 2024 at 03:42:10PM +1000, Alistair Francis wrote: > > > > > From memory the "debug" property is for the original debug spec: > > > > >

Re: [PATCH v2 1/2] target/riscv: Convert sdtrig functionality from property to an extension

2024-01-18 Thread Anup Patel
On Wed, Jan 17, 2024 at 7:54 PM Himanshu Chauhan wrote: > > The debug trigger (sdtrig) capability is controlled using the debug property. > The sdtrig is an ISA extension and should be treated so. The sdtrig extension > may or may not be implemented in a system. Therefore, it must raise an

Re: [PATCH] hw/riscv: split RAM into low and high memory

2023-09-07 Thread Anup Patel
fdt_load_addr = riscv_compute_fdt_addr(memmap[VIRT_DRAM].base, > > > memmap[VIRT_DRAM].size, > > > machine); > > > +} else { > > > +fdt_load_addr = >

Re: [PATCH] hw/riscv: split RAM into low and high memory

2023-09-07 Thread Anup Patel
On Tue, Aug 1, 2023 at 4:16 AM Daniel Henrique Barboza wrote: > > > > On 7/30/23 22:53, Fei Wu wrote: > > riscv virt platform's memory started at 0x8000 and > > straddled the 4GiB boundary. Curiously enough, this choice > > of a memory layout will prevent from launching a VM with > > a bit

Re: Boot failure after QEMU's upgrade to OpenSBI v1.3 (was Re: [PATCH for-8.2 6/7] target/riscv: add 'max' CPU type)

2023-07-19 Thread Anup Patel
Hi Bin, On Wed, Jul 19, 2023 at 9:15 PM Bin Meng wrote: > > On Wed, Jul 19, 2023 at 11:22 PM Anup Patel wrote: > > > > On Wed, Jul 19, 2023 at 3:23 PM Alistair Francis > > wrote: > > > > > > On Wed, Jul 19, 2023 at 3:39 PM Anup Patel wrote: >

Re: Boot failure after QEMU's upgrade to OpenSBI v1.3 (was Re: [PATCH for-8.2 6/7] target/riscv: add 'max' CPU type)

2023-07-19 Thread Anup Patel
On Wed, Jul 19, 2023 at 3:23 PM Alistair Francis wrote: > > On Wed, Jul 19, 2023 at 3:39 PM Anup Patel wrote: > > > > On Wed, Jul 19, 2023 at 7:03 AM Alistair Francis > > wrote: > > > > > > On Sat, Jul 15, 2023 at 7:14 PM Atish Patra wrote: >

Re: Boot failure after QEMU's upgrade to OpenSBI v1.3 (was Re: [PATCH for-8.2 6/7] target/riscv: add 'max' CPU type)

2023-07-18 Thread Anup Patel
t; > On Fri, Jul 14, 2023 at 10:00:19AM +0530, Anup

Re: Boot failure after QEMU's upgrade to OpenSBI v1.3 (was Re: [PATCH for-8.2 6/7] target/riscv: add 'max' CPU type)

2023-07-14 Thread Anup Patel
On Fri, Jul 14, 2023 at 3:50 PM Conor Dooley wrote: > > On Fri, Jul 14, 2023 at 10:00:19AM +0530, Anup Patel wrote: > > > &

Re: Boot failure after QEMU's upgrade to OpenSBI v1.3 (was Re: [PATCH for-8.2 6/7] target/riscv: add 'max' CPU type)

2023-07-13 Thread Anup Patel
On Fri, Jul 14, 2023 at 3:43 AM Conor Dooley wrote: > > +CC OpenSBI Mailing list > > I've not yet had the chance to bisect this, so adding the OpenSBI folks > to CC in case they might have an idea for what to try. > > And a question for you below Daniel. > > On Wed, Jul 12, 2023 at 11:14:21PM

Re: Is it possible to boot a riscv32 guest on riscv64 host using KVM?

2023-06-27 Thread Anup Patel
On Mon, Jun 26, 2023 at 4:57 PM Philippe Mathieu-Daudé wrote: > > Hi, > > I'm working on a tree-wide accelerator refactor and want > to run various configs to be sure I didn't broke anything. > > QEMU theoretically supports running a riscv32 guest using > KVM on a riscv64 host, however the

Re: [PATCH] hw/intc: If mmsiaddrcfgh.L == 1, smsiaddrcfg and smsiaddrcfgh are read-only.

2023-06-11 Thread Anup Patel
d `mmsiaddrcfgh`. > > Signed-off-by: Tommy Wu > Reviewed-by: Frank Chang Looks good to me. Reviewed-by: Anup Patel > --- > hw/intc/riscv_aplic.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/hw/intc/riscv_aplic.c b/hw/intc/riscv_aplic.

Re: [PATCH v5 0/3] hw/riscv/virt: pflash improvements

2023-05-30 Thread Anup Patel
On Fri, May 26, 2023 at 5:41 PM Sunil V L wrote: > > This series improves the pflash usage in RISC-V virt machine with solutions to > below issues. > > 1) Currently the first pflash is reserved for ROM/M-mode firmware code. But > S-mode > payload firmware like EDK2 need both pflash devices to

Re: [PATCH] hw/intc/riscv_aplic: Zero init APLIC internal state

2023-04-13 Thread Anup Patel
te. > > Signed-off-by: Ivan Klokov Looks good to me. Reviewed-by: Anup Patel Regards, Anup > --- > hw/intc/riscv_aplic.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/hw/intc/riscv_aplic.c b/hw/intc/riscv_aplic.c > index cfd007e629..71591

Re: [PATCH v3 1/1] hw/riscv: Fix max size limit when put initrd to RAM

2023-03-13 Thread Anup Patel
On Mon, Mar 13, 2023 at 7:49 AM Hang Xu wrote: > > Because the starting address of ram is not necessarily 0, > the remaining free space in ram is > ram_size - (start - ram_base) instead of ram_size-start. > > Signed-off-by: Hang Xu What happens in-case a platform has multiple RAM banks ?

[PATCH v3 1/4] target/riscv: Update VS timer whenever htimedelta changes

2023-01-20 Thread Anup Patel
The htimedelta[h] CSR has impact on the VS timer comparison so we should call riscv_timer_write_timecmp() whenever htimedelta changes. Fixes: 3ec0fe18a31f ("target/riscv: Add vstimecmp suppor") Signed-off-by: Anup Patel Reviewed-by: Alistair Francis --- target/riscv/

[PATCH v3 2/4] target/riscv: Don't clear mask in riscv_cpu_update_mip() for VSTIP

2023-01-20 Thread Anup Patel
Instead of clearing mask in riscv_cpu_update_mip() for VSTIP, we should call riscv_cpu_update_mip() with mask == 0 from timer_helper.c for VSTIP. Fixes: 3ec0fe18a31f ("target/riscv: Add vstimecmp suppor") Signed-off-by: Anup Patel Reviewed-by: Alistair Francis --- target/riscv/cp

[PATCH v3 3/4] target/riscv: No need to re-start QEMU timer when timecmp == UINT64_MAX

2023-01-20 Thread Anup Patel
The time CSR will wrap-around immediately after reaching UINT64_MAX so we don't need to re-start QEMU timer when timecmp == UINT64_MAX in riscv_timer_write_timecmp(). Signed-off-by: Anup Patel Reviewed-by: Alistair Francis --- target/riscv/time_helper.c | 24 1 file

[PATCH v3 4/4] target/riscv: Ensure opcode is saved for all relevant instructions

2023-01-20 Thread Anup Patel
as zero in htinst CSR for guest MMIO emulation which makes MMIO emulation in hypervisor slow and also breaks nested virtualization. Fixes: a9814e3e08d2 ("target/riscv: Minimize the calls to decode_save_opc") Signed-off-by: Anup Patel --- target/riscv/insn_trans/trans_rva.c.in

[PATCH v3 0/4] Nested virtualization fixes for QEMU

2023-01-20 Thread Anup Patel
riscv-to-apply.next branch of Alistair Changes since v1: - Added Alistair's Reviewed-by tags to appropriate patches - Added detailed comment block in PATCH4 Anup Patel (4): target/riscv: Update VS timer whenever htimedelta changes target/riscv: Don't clear mask in riscv_cpu_update_mip

Re: [PATCH v2 2/5] target/riscv: Update VS timer whenever htimedelta changes

2023-01-15 Thread Anup Patel
Hi Alistair, On Tue, Jan 3, 2023 at 9:43 PM Anup Patel wrote: > > Hi Alistair, > > On Wed, Dec 28, 2022 at 11:08 AM Alistair Francis > wrote: > > > > On Fri, Dec 23, 2022 at 11:14 PM Anup Patel wrote: > > > > > > On Thu, Dec 15, 2

Re: [PATCH v2 2/5] target/riscv: Update VS timer whenever htimedelta changes

2023-01-03 Thread Anup Patel
Hi Alistair, On Wed, Dec 28, 2022 at 11:08 AM Alistair Francis wrote: > > On Fri, Dec 23, 2022 at 11:14 PM Anup Patel wrote: > > > > On Thu, Dec 15, 2022 at 8:55 AM Alistair Francis > > wrote: > > > > > > On Mon, Dec 12, 2022 at 9:12 PM Anup Patel &

Re: [PATCH v2 2/5] target/riscv: Update VS timer whenever htimedelta changes

2022-12-23 Thread Anup Patel
On Thu, Dec 15, 2022 at 8:55 AM Alistair Francis wrote: > > On Mon, Dec 12, 2022 at 9:12 PM Anup Patel wrote: > > > > On Mon, Dec 12, 2022 at 11:23 AM Alistair Francis > > wrote: > > > > > > On Thu, Dec 8, 2022 at 6:41 PM Anup Patel wrote: >

Re: [PATCH 01/15] tests/avocado: add RISC-V opensbi boot test

2022-12-22 Thread Anup Patel
On Thu, Dec 22, 2022 at 6:27 PM Bin Meng wrote: > > On Thu, Dec 22, 2022 at 6:47 PM Daniel Henrique Barboza > wrote: > > > > > > > > On 12/22/22 07:24, Bin Meng wrote: > > > On Thu, Dec 22, 2022 at 2:29 AM Daniel Henrique Barboza > > > wrote: > > >> This test is used to do a quick sanity check

Re: [PATCH v2 2/5] target/riscv: Update VS timer whenever htimedelta changes

2022-12-12 Thread Anup Patel
On Mon, Dec 12, 2022 at 11:23 AM Alistair Francis wrote: > > On Thu, Dec 8, 2022 at 6:41 PM Anup Patel wrote: > > > > On Thu, Dec 8, 2022 at 9:00 AM Alistair Francis > > wrote: > > > > > > On Tue, Nov 8, 2022 at 11:07 PM Anup Patel > > &g

Re: [PATCH v2 2/5] target/riscv: Update VS timer whenever htimedelta changes

2022-12-08 Thread Anup Patel
On Thu, Dec 8, 2022 at 9:00 AM Alistair Francis wrote: > > On Tue, Nov 8, 2022 at 11:07 PM Anup Patel wrote: > > > > The htimedelta[h] CSR has impact on the VS timer comparison so we > > should call riscv_timer_write_timecmp() whenever htimedelta changes. > > &g

Re: [PATCH v2 0/5] Nested virtualization fixes for QEMU

2022-11-20 Thread Anup Patel
Hi Alistair, On Tue, Nov 8, 2022 at 6:27 PM Anup Patel wrote: > > This series mainly includes fixes discovered while developing nested > virtualization running on QEMU. > > These patches can also be found in the riscv_nested_fixes_v2 branch at: > https://github.com/avpatel/qe

[PATCH v2 4/5] target/riscv: No need to re-start QEMU timer when timecmp == UINT64_MAX

2022-11-08 Thread Anup Patel
The time CSR will wrap-around immediately after reaching UINT64_MAX so we don't need to re-start QEMU timer when timecmp == UINT64_MAX in riscv_timer_write_timecmp(). Signed-off-by: Anup Patel Reviewed-by: Alistair Francis --- target/riscv/time_helper.c | 24 1 file

[PATCH v2 5/5] target/riscv: Ensure opcode is saved for all relevant instructions

2022-11-08 Thread Anup Patel
as zero in htinst CSR for guest MMIO emulation which makes MMIO emulation in hypervisor slow and also breaks nested virtualization. Fixes: a9814e3e08d2 ("target/riscv: Minimize the calls to decode_save_opc") Signed-off-by: Anup Patel --- target/riscv/insn_trans/trans_rva.c.in

[PATCH v2 3/5] target/riscv: Don't clear mask in riscv_cpu_update_mip() for VSTIP

2022-11-08 Thread Anup Patel
Instead of clearing mask in riscv_cpu_update_mip() for VSTIP, we should call riscv_cpu_update_mip() with mask == 0 from timer_helper.c for VSTIP. Fixes: 3ec0fe18a31f ("target/riscv: Add vstimecmp suppor") Signed-off-by: Anup Patel Reviewed-by: Alistair Francis --- target/riscv/cp

[PATCH v2 1/5] target/riscv: Typo fix in sstc() predicate

2022-11-08 Thread Anup Patel
We should use "&&" instead of "&" when checking hcounteren.TM and henvcfg.STCE bits. Fixes: 3ec0fe18a31f ("target/riscv: Add vstimecmp suppor") Signed-off-by: Anup Patel Reviewed-by: Alistair Francis --- target/riscv/csr.c | 2 +- 1 file changed,

[PATCH v2 0/5] Nested virtualization fixes for QEMU

2022-11-08 Thread Anup Patel
detailed comment block in PATCH4 Anup Patel (5): target/riscv: Typo fix in sstc() predicate target/riscv: Update VS timer whenever htimedelta changes target/riscv: Don't clear mask in riscv_cpu_update_mip() for VSTIP target/riscv: No need to re-start QEMU timer when timecmp

[PATCH v2 2/5] target/riscv: Update VS timer whenever htimedelta changes

2022-11-08 Thread Anup Patel
The htimedelta[h] CSR has impact on the VS timer comparison so we should call riscv_timer_write_timecmp() whenever htimedelta changes. Fixes: 3ec0fe18a31f ("target/riscv: Add vstimecmp suppor") Signed-off-by: Anup Patel Reviewed-by: Alistair Francis --- target/riscv/

Re: [PATCH 4/5] target/riscv: No need to re-start QEMU timer when timecmp == UINT64_MAX

2022-11-06 Thread Anup Patel
On Wed, Nov 2, 2022 at 5:40 AM Alistair Francis wrote: > > On Mon, Oct 31, 2022 at 1:49 PM Anup Patel wrote: > > > > On Mon, Oct 31, 2022 at 6:25 AM Alistair Francis > > wrote: > > > > > > On Fri, Oct 28, 2022 at 2:53 AM Anup Patel > > > w

Re: [PATCH 4/5] target/riscv: No need to re-start QEMU timer when timecmp == UINT64_MAX

2022-10-30 Thread Anup Patel
On Mon, Oct 31, 2022 at 6:25 AM Alistair Francis wrote: > > On Fri, Oct 28, 2022 at 2:53 AM Anup Patel wrote: > > > > The time CSR will wrap-around immediately after reaching UINT64_MAX > > so we don't need to re-start QEMU timer when timecmp == UINT64_MAX > >

[PATCH 2/5] target/riscv: Update VS timer whenever htimedelta changes

2022-10-27 Thread Anup Patel
The htimedelta[h] CSR has impact on the VS timer comparison so we should call riscv_timer_write_timecmp() whenever htimedelta changes. Fixes: 3ec0fe18a31f ("target/riscv: Add vstimecmp suppor") Signed-off-by: Anup Patel --- target/riscv/csr.c | 16 1 file changed, 16

[PATCH 4/5] target/riscv: No need to re-start QEMU timer when timecmp == UINT64_MAX

2022-10-27 Thread Anup Patel
The time CSR will wrap-around immediately after reaching UINT64_MAX so we don't need to re-start QEMU timer when timecmp == UINT64_MAX in riscv_timer_write_timecmp(). Signed-off-by: Anup Patel --- target/riscv/time_helper.c | 8 1 file changed, 8 insertions(+) diff --git a/target

[PATCH 3/5] target/riscv: Don't clear mask in riscv_cpu_update_mip() for VSTIP

2022-10-27 Thread Anup Patel
Instead of clearing mask in riscv_cpu_update_mip() for VSTIP, we should call riscv_cpu_update_mip() with mask == 0 from timer_helper.c for VSTIP. Fixes: 3ec0fe18a31f ("target/riscv: Add vstimecmp suppor") Signed-off-by: Anup Patel --- target/riscv/cpu_helper.c | 2 -- ta

[PATCH 1/5] target/riscv: Typo fix in sstc() predicate

2022-10-27 Thread Anup Patel
We should use "&&" instead of "&" when checking hcounteren.TM and henvcfg.STCE bits. Fixes: 3ec0fe18a31f ("target/riscv: Add vstimecmp suppor") Signed-off-by: Anup Patel --- target/riscv/csr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

[PATCH 5/5] target/riscv: Ensure opcode is saved for all relevant instructions

2022-10-27 Thread Anup Patel
as zero in htinst CSR for guest MMIO emulation which makes MMIO emulation in hypervisor slow and also breaks nested virtualization. Fixes: a9814e3e08d2 ("target/riscv: Minimize the calls to decode_save_opc") Signed-off-by: Anup Patel --- target/riscv/insn_trans/trans_rva.c.in

[PATCH 0/5] Nested virtualization fixes for QEMU

2022-10-27 Thread Anup Patel
This series mainly includes fixes discovered while developing nested virtualization running on QEMU. These patches can also be found in the riscv_nested_fixes_v1 branch at: https://github.com/avpatel/qemu.git Anup Patel (5): target/riscv: Typo fix in sstc() predicate target/riscv: Update VS

[PATCH v3] target/riscv: Use official extension names for AIA CSRs

2022-08-19 Thread Anup Patel
-032.pdf) Based on above, we update QEMU RISC-V to: 1) Have separate config options for Smaia and Ssaia extensions which replace RISCV_FEATURE_AIA in CPU features 2) Not generate AIA INTC compatible string in virt machine Signed-off-by: Anup Patel Reviewed-by: Andrew Jones --- Changes since v2

Re: [PATCH v2] target/riscv: Use official extension names for AIA CSRs

2022-08-19 Thread Anup Patel
On Fri, Aug 19, 2022 at 8:40 PM Richard Henderson wrote: > > On 8/19/22 00:31, Anup Patel wrote: > > static int aia_hmode(CPURISCVState *env, int csrno) > > { > > -if (!riscv_feature(env, RISCV_FEATURE_AIA)) { > > +CPUState *cs = env_cpu(env); > &g

[PATCH v2] target/riscv: Use official extension names for AIA CSRs

2022-08-19 Thread Anup Patel
-032.pdf) Based on above, we update QEMU RISC-V to: 1) Have separate config options for Smaia and Ssaia extensions which replace RISCV_FEATURE_AIA in CPU features 2) Not generate AIA INTC compatible string in virt machine Signed-off-by: Anup Patel Reviewed-by: Andrew Jones --- Changes since v1

Re: [PATCH] target/riscv: Use official extension names for AIA CSRs

2022-08-18 Thread Anup Patel
On Fri, Aug 19, 2022 at 10:24 AM Weiwei Li wrote: > > > 在 2022/8/19 上午11:09, Anup Patel 写道: > > The arch review of AIA spec is completed and we now have official > > extension names for AIA: Smaia (M-mode AIA CSRs) and Ssaia (S-mode > > AIA CSRs). > > > &g

[PATCH] target/riscv: Use official extension names for AIA CSRs

2022-08-18 Thread Anup Patel
-032.pdf) Based on above, we update QEMU RISC-V to: 1) Have separate config options for Smaia and Ssaia extensions which replace RISCV_FEATURE_AIA in CPU features 2) Not generate AIA INTC compatible string in virt machine Signed-off-by: Anup Patel Reviewed-by: Andrew Jones --- hw/intc

Re: [PATCH] target/riscv: Fix priority of csr related check in riscv_csrrw_check

2022-08-04 Thread Anup Patel
On Thu, Aug 4, 2022 at 5:59 PM Weiwei Li wrote: > > > 在 2022/8/4 上午11:38, Anup Patel 写道: > > On Wed, Aug 3, 2022 at 6:16 PM Weiwei Li wrote: > >> Normally, riscv_csrrw_check is called when executing Zicsr instructions. > >> And we can only do access control

Re: [PATCH] target/riscv: Fix priority of csr related check in riscv_csrrw_check

2022-08-03 Thread Anup Patel
On Wed, Aug 3, 2022 at 6:16 PM Weiwei Li wrote: > > Normally, riscv_csrrw_check is called when executing Zicsr instructions. > And we can only do access control for existed CSRs. So the priority of > CSR related check, from highest to lowest, should be as follows: > 1) check whether Zicsr is

Re: [PATCH] target/riscv: Ensure opcode is saved for every instruction

2022-07-26 Thread Anup Patel
On Wed, Jul 27, 2022 at 9:24 AM Richard Henderson wrote: > > On 7/26/22 20:25, Anup Patel wrote: > > We should call decode_save_opc() for every decoded instruction > > because generating transformed instruction upon guest page faults > > expects opcode to be available.

[PATCH] target/riscv: Ensure opcode is saved for every instruction

2022-07-26 Thread Anup Patel
in hypervisor slow and also breaks nested virtualization. Fixes: a9814e3e08d2 ("target/riscv: Minimize the calls to decode_save_opc") Signed-off-by: Anup Patel --- target/riscv/insn_trans/trans_privileged.c.inc | 4 target/riscv/insn_trans/trans_rvh.c.inc| 2 -- target/riscv/

Re: [PATCH] target/riscv: Support SW update of PTE A/D bits and Ssptwad extension

2022-07-19 Thread Anup Patel
t have better suggestions on this ? Regards, Anup > > Regards, > Jim Shu > > On Mon, Jul 18, 2022 at 12:02 PM Anup Patel wrote: >> >> +Atish >> >> On Mon, Jul 18, 2022 at 9:23 AM Jim Shu wrote: >> > >> > RISC-V priv spec v1.12 permits 2

Re: [PATCH] target/riscv: Support SW update of PTE A/D bits and Ssptwad extension

2022-07-17 Thread Anup Patel
+Atish On Mon, Jul 18, 2022 at 9:23 AM Jim Shu wrote: > > RISC-V priv spec v1.12 permits 2 PTE-update schemes of A/D-bit > (Access/Dirty bit): HW update or SW update. RISC-V profile defines the > extension name 'Ssptwad' for HW update to PTE A/D bits. >

Re: [PATCH v2 03/11] goldfish_rtc: Add endianness property

2022-07-03 Thread Anup Patel
On Mon, Jul 4, 2022 at 2:59 AM Stafford Horne wrote: > > Add an endianness property to allow configuring the RTC as either > native, little or big endian. > > Cc: Laurent Vivier > Signed-off-by: Stafford Horne Looks good to me. Reviewed-by: Anup Patel Regards, Anu

Re: [PATCH v9 0/2] QEMU RISC-V nested virtualization fixes

2022-06-30 Thread Anup Patel
On Thu, Jun 30, 2022 at 11:42 AM Anup Patel wrote: > > This series does fixes and improvements to have nested virtualization > on QEMU RISC-V. > > These patches can also be found in riscv_nested_fixes_v9 branch at: > https://github.com/avpatel/qemu.git > > The RISC

[PATCH v9 0/2] QEMU RISC-V nested virtualization fixes

2022-06-30 Thread Anup Patel
riv spec version is not staisfied - Added new PATCH8 to fix "aia=aplic-imsic" mode of virt machine Anup Patel (2): target/riscv: Update [m|h]tinst CSR in riscv_cpu_do_interrupt() target/riscv: Force disable extensions if priv spec version does not match target/riscv/cpu.c

[PATCH v9 2/2] target/riscv: Force disable extensions if priv spec version does not match

2022-06-30 Thread Anup Patel
rings to the device tree") Reviewed-by: Alistair Francis Signed-off-by: Anup Patel Signed-off-by: Rahul Pathak --- target/riscv/cpu.c | 150 - 1 file changed, 94 insertions(+), 56 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/c

[PATCH v9 1/2] target/riscv: Update [m|h]tinst CSR in riscv_cpu_do_interrupt()

2022-06-30 Thread Anup Patel
We should write transformed instruction encoding of the trapped instruction in [m|h]tinst CSR at time of taking trap as defined by the RISC-V privileged specification v1.12. Reviewed-by: Alistair Francis Signed-off-by: Anup Patel --- target/riscv/cpu.h| 5 + target/riscv/cpu_helper.c

Re: [PATCH v2] target/riscv: fix user-mode build issue because mhartid

2022-06-28 Thread Anup Patel
On Wed, Jun 29, 2022 at 9:27 AM Bin Meng wrote: > > Hi Rahul, > > On Wed, Jun 29, 2022 at 10:07 AM Rahul Pathak > wrote: > > > > Hi Alistair > > > > My fix patch needs to be dropped since Anup took care of this issue > > in his yesterdays series update in this patch - > > [PATCH v8 4/4]

[PATCH v8 2/4] target/riscv: Set minumum priv spec version for mcountinhibit

2022-06-28 Thread Anup Patel
The minimum priv spec versino for mcountinhibit to v1.11 so that it is not available for v1.10 (or lower). Fixes: eab4776b2bad ("target/riscv: Add support for hpmcounters/hpmevents") Signed-off-by: Anup Patel --- target/riscv/csr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletio

[PATCH v8 3/4] target/riscv: Update [m|h]tinst CSR in riscv_cpu_do_interrupt()

2022-06-28 Thread Anup Patel
We should write transformed instruction encoding of the trapped instruction in [m|h]tinst CSR at time of taking trap as defined by the RISC-V privileged specification v1.12. Reviewed-by: Alistair Francis Signed-off-by: Anup Patel --- target/riscv/cpu.h| 5 + target/riscv/cpu_helper.c

[PATCH v8 0/4] QEMU RISC-V nested virtualization fixes

2022-06-28 Thread Anup Patel
riv spec version is not staisfied - Added new PATCH8 to fix "aia=aplic-imsic" mode of virt machine Anup Patel (4): Revert "target/riscv: Add dummy mcountinhibit CSR for priv spec v1.11 or higher" target/riscv: Set minumum priv spec version for mcountinhibit target/riscv

[PATCH v8 4/4] target/riscv: Force disable extensions if priv spec version does not match

2022-06-28 Thread Anup Patel
rings to the device tree") Reviewed-by: Alistair Francis Signed-off-by: Anup Patel Signed-off-by: Rahul Pathak --- target/riscv/cpu.c | 150 - 1 file changed, 94 insertions(+), 56 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/c

[PATCH v8 1/4] Revert "target/riscv: Add dummy mcountinhibit CSR for priv spec v1.11 or higher"

2022-06-28 Thread Anup Patel
This reverts commit 33cc1c0b69e457f5c526f64297353cba6f7bfdb4 because commit eab4776b2badd4088a4f807c9bb3dc453c53dc23 already implements proper mcountinhibit CSR emulation. Signed-off-by: Anup Patel --- target/riscv/cpu_bits.h | 3 --- target/riscv/csr.c | 2 -- 2 files changed, 5 deletions

Re: [PATCH v6 3/4] target/riscv: Update [m|h]tinst CSR in riscv_cpu_do_interrupt()

2022-06-28 Thread Anup Patel
On Mon, Jun 27, 2022 at 10:25 PM dramforever wrote: > > On 6/27/22 09:00, Alistair Francis wrote: > > On Sat, Jun 11, 2022 at 6:06 PM Anup Patel wrote: > >> We should write transformed instruction encoding of the trapped > >> instruction in [m|h]tinst CSR at

[PATCH v7 2/4] target/riscv: Set minumum priv spec version for mcountinhibit

2022-06-28 Thread Anup Patel
The minimum priv spec versino for mcountinhibit to v1.11 so that it is not available for v1.10 (or lower). Fixes: eab4776b2bad ("target/riscv: Add support for hpmcounters/hpmevents") Signed-off-by: Anup Patel --- target/riscv/csr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletio

[PATCH v7 1/4] Revert "target/riscv: Add dummy mcountinhibit CSR for priv spec v1.11 or higher"

2022-06-28 Thread Anup Patel
This reverts commit 33cc1c0b69e457f5c526f64297353cba6f7bfdb4 because commit eab4776b2badd4088a4f807c9bb3dc453c53dc23 already implements proper mcountinhibit CSR emulation. Signed-off-by: Anup Patel --- target/riscv/cpu_bits.h | 3 --- target/riscv/csr.c | 2 -- 2 files changed, 5 deletions

[PATCH v7 4/4] target/riscv: Force disable extensions if priv spec version does not match

2022-06-27 Thread Anup Patel
rings to the device tree") Reviewed-by: Alistair Francis Signed-off-by: Anup Patel Signed-off-by: Rahul Pathak --- target/riscv/cpu.c | 150 - 1 file changed, 94 insertions(+), 56 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/c

[PATCH v7 3/4] target/riscv: Update [m|h]tinst CSR in riscv_cpu_do_interrupt()

2022-06-27 Thread Anup Patel
We should write transformed instruction encoding of the trapped instruction in [m|h]tinst CSR at time of taking trap as defined by the RISC-V privileged specification v1.12. Reviewed-by: Alistair Francis Signed-off-by: Anup Patel --- target/riscv/cpu.h| 5 + target/riscv/cpu_helper.c

[PATCH v7 0/4] QEMU RISC-V nested virtualization fixes

2022-06-27 Thread Anup Patel
rite_gva is true only for HLV/HSV instructions - Included "[PATCH 0/3] QEMU RISC-V priv spec version fixes" patches in this series for easy review - Re-worked PATCH7 to force disable extensions if required priv spec version is not staisfied - Added new PATCH8 to fix "aia=

Re: [PATCH v6 4/4] target/riscv: Force disable extensions if priv spec version does not match

2022-06-27 Thread Anup Patel
On Tue, Jun 28, 2022 at 4:47 AM Alistair Francis wrote: > > On Sat, Jun 11, 2022 at 6:07 PM Anup Patel wrote: > > > > We should disable extensions in riscv_cpu_realize() if minimum required > > priv spec version is not satisfied. This also ensures that machines with >

Re: [PATCH v5 3/4] target/riscv: Update [m|h]tinst CSR in riscv_cpu_do_interrupt()

2022-06-27 Thread Anup Patel
On Tue, Jun 28, 2022 at 4:48 AM Alistair Francis wrote: > > On Thu, Jun 9, 2022 at 1:31 PM Anup Patel wrote: > > > > We should write transformed instruction encoding of the trapped > > instruction in [m|h]tinst CSR at time of taking trap as defined > > by the R

Re: [PATCH v5 2/3] target/riscv: Add stimecmp support

2022-06-15 Thread Anup Patel
On Thu, Jun 16, 2022 at 8:08 AM Alistair Francis wrote: > > On Thu, Jun 16, 2022 at 4:21 AM Atish Kumar Patra wrote: > > > > On Wed, Jun 8, 2022 at 12:19 AM Alistair Francis > > wrote: > > > > > > On Mon, Jun 6, 2022 at 2:23 AM Atish Patra wrote: > > > > > > > > On Thu, Jun 2, 2022 at 12:02

[PATCH 1/2] target/riscv: Remove CSRs that set/clear an IMSIC interrupt file bits

2022-06-15 Thread Anup Patel
for software convenience and software can always use [m|s|vs]iselect and [m|s|vs]ireg CSRs to update the IMSIC interrupt file bits. We update the IMSIC CSR emulation as-per above to match the latest AIA draft specification. Signed-off-by: Anup Patel --- target/riscv/cpu_bits.h | 24 +-- target

[PATCH 2/2] target/riscv: Update default priority table for local interrupts

2022-06-15 Thread Anup Patel
(not mandatory) priority assignments. We update the default priority table and hviprio mapping as-per above. Signed-off-by: Anup Patel --- target/riscv/cpu_bits.h | 2 +- target/riscv/cpu_helper.c | 134 ++ 2 files changed, 66 insertions(+), 70

[PATCH 0/2] AIA draft v0.3.0 support for QEMU RISC-V

2022-06-15 Thread Anup Patel
and these can be found at: riscv_aia_update_v1 branch of https://github.com/avpatel/opensbi.git riscv_aia_v1 branch of https://github.com/avpatel/linux.git Anup Patel (2): target/riscv: Remove CSRs that set/clear an IMSIC interrupt file bits target/riscv: Update default priority table for local

[PATCH v6 0/4] QEMU RISC-V nested virtualization fixes

2022-06-11 Thread Anup Patel
ATCH8 to fix "aia=aplic-imsic" mode of virt machine Anup Patel (4): target/riscv: Don't force update priv spec version to latest target/riscv: Add dummy mcountinhibit CSR for priv spec v1.11 or higher target/riscv: Update [m|h]tinst CSR in riscv_cpu_do_interrupt() target/risc

[PATCH v6 1/4] target/riscv: Don't force update priv spec version to latest

2022-06-11 Thread Anup Patel
t latest priv spec version (i.e. v1.12) for base rv64/rv32 cpu and riscv_cpu_realize() will override priv spec version only when "cpu->cfg.priv_spec != NULL". Fixes: 7100fe6c2441 ("target/riscv: Enable privileged spec version 1.12") Signed-off-by: Anup Patel Reviewed-by

[PATCH v6 2/4] target/riscv: Add dummy mcountinhibit CSR for priv spec v1.11 or higher

2022-06-11 Thread Anup Patel
The mcountinhibit CSR is mandatory for priv spec v1.11 or higher. For implementation that don't want to implement can simply have a dummy mcountinhibit which is always zero. Fixes: a4b2fa433125 ("target/riscv: Introduce privilege version field in the CSR ops.") Signed-off-by:

[PATCH v6 4/4] target/riscv: Force disable extensions if priv spec version does not match

2022-06-11 Thread Anup Patel
rings to the device tree") Signed-off-by: Anup Patel --- target/riscv/cpu.c | 144 +++-- 1 file changed, 88 insertions(+), 56 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 8db0f0bd49..a17bc98662 100644 --- a/target/riscv/cpu.c ++

[PATCH v6 3/4] target/riscv: Update [m|h]tinst CSR in riscv_cpu_do_interrupt()

2022-06-11 Thread Anup Patel
We should write transformed instruction encoding of the trapped instruction in [m|h]tinst CSR at time of taking trap as defined by the RISC-V privileged specification v1.12. Signed-off-by: Anup Patel --- target/riscv/cpu.h| 3 + target/riscv/cpu_helper.c | 214

Re: [PATCH v5 3/4] target/riscv: Update [m|h]tinst CSR in riscv_cpu_do_interrupt()

2022-06-10 Thread Anup Patel
On Fri, Jun 10, 2022 at 5:20 PM dramforever wrote: > > > > >> In addition, the various V-extension vector load/store instructions do not > >> have > >> defined transformations, so they should show up in [m|h]tinst as all zeros. > > Okay, I will update. > Just a clarification/suggestion: It might

Re: [PATCH v5 3/4] target/riscv: Update [m|h]tinst CSR in riscv_cpu_do_interrupt()

2022-06-10 Thread Anup Patel
On Fri, Jun 10, 2022 at 3:00 PM dramforever wrote: > > Hi Anup Patel, > > I think there are some misunderstandings of the privileged spec with regards > to > [m|h]tinst handling. Here are some possible issues I've found: > > > +

Re: [PATCH v4 4/4] target/riscv: Force disable extensions if priv spec version does not match

2022-06-09 Thread Anup Patel
On Thu, Jun 9, 2022 at 7:28 PM Richard Henderson wrote: > > On 6/8/22 20:16, Anup Patel wrote: > > On Wed, Jun 8, 2022 at 10:23 PM Richard Henderson > > wrote: > >> > >> On 6/8/22 09:14, Anup Patel wrote: > >>> +struct isa_ext_data isa_edata

[PATCH v5 4/4] target/riscv: Force disable extensions if priv spec version does not match

2022-06-08 Thread Anup Patel
rings to the device tree") Signed-off-by: Anup Patel --- target/riscv/cpu.c | 57 ++ 1 file changed, 52 insertions(+), 5 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 9f9c27a3f5..e7eb65d708 100644 --- a/target/riscv/cpu.c ++

[PATCH v5 3/4] target/riscv: Update [m|h]tinst CSR in riscv_cpu_do_interrupt()

2022-06-08 Thread Anup Patel
We should write transformed instruction encoding of the trapped instruction in [m|h]tinst CSR at time of taking trap as defined by the RISC-V privileged specification v1.12. Signed-off-by: Anup Patel --- target/riscv/cpu.h| 3 + target/riscv/cpu_helper.c | 231

[PATCH v5 0/4] QEMU RISC-V nested virtualization fixes

2022-06-08 Thread Anup Patel
es in this series for easy review - Re-worked PATCH7 to force disable extensions if required priv spec version is not staisfied - Added new PATCH8 to fix "aia=aplic-imsic" mode of virt machine Anup Patel (4): target/riscv: Don't force update priv spec version to latest target/riscv

[PATCH v5 1/4] target/riscv: Don't force update priv spec version to latest

2022-06-08 Thread Anup Patel
t latest priv spec version (i.e. v1.12) for base rv64/rv32 cpu and riscv_cpu_realize() will override priv spec version only when "cpu->cfg.priv_spec != NULL". Fixes: 7100fe6c2441 ("target/riscv: Enable privileged spec version 1.12") Signed-off-by: Anup Patel Reviewed-by

[PATCH v5 2/4] target/riscv: Add dummy mcountinhibit CSR for priv spec v1.11 or higher

2022-06-08 Thread Anup Patel
The mcountinhibit CSR is mandatory for priv spec v1.11 or higher. For implementation that don't want to implement can simply have a dummy mcountinhibit which is always zero. Fixes: a4b2fa433125 ("target/riscv: Introduce privilege version field in the CSR ops.") Signed-off-by:

Re: [PATCH v4 4/4] target/riscv: Force disable extensions if priv spec version does not match

2022-06-08 Thread Anup Patel
On Wed, Jun 8, 2022 at 10:23 PM Richard Henderson wrote: > > On 6/8/22 09:14, Anup Patel wrote: > > +struct isa_ext_data isa_edata_arr[] = { > > static const? Using const is fine but we can't use "static const" because the "struct isa_ext_data" has a

[PATCH v4 4/4] target/riscv: Force disable extensions if priv spec version does not match

2022-06-08 Thread Anup Patel
rings to the device tree") Signed-off-by: Anup Patel --- target/riscv/cpu.c | 57 ++ 1 file changed, 52 insertions(+), 5 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c index 9f9c27a3f5..953ba2e445 100644 --- a/target/riscv/cpu.c ++

[PATCH v4 3/4] target/riscv: Update [m|h]tinst CSR in riscv_cpu_do_interrupt()

2022-06-08 Thread Anup Patel
We should write transformed instruction encoding of the trapped instruction in [m|h]tinst CSR at time of taking trap as defined by the RISC-V privileged specification v1.12. Signed-off-by: Anup Patel --- target/riscv/cpu.h| 3 + target/riscv/cpu_helper.c | 231

[PATCH v4 0/4] QEMU RISC-V nested virtualization fixes

2022-06-08 Thread Anup Patel
ied - Added new PATCH8 to fix "aia=aplic-imsic" mode of virt machine Anup Patel (4): target/riscv: Don't force update priv spec version to latest target/riscv: Add dummy mcountinhibit CSR for priv spec v1.11 or higher target/riscv: Update [m|h]tinst CSR in riscv_cpu_do_interrup

[PATCH v4 2/4] target/riscv: Add dummy mcountinhibit CSR for priv spec v1.11 or higher

2022-06-08 Thread Anup Patel
The mcountinhibit CSR is mandatory for priv spec v1.11 or higher. For implementation that don't want to implement can simply have a dummy mcountinhibit which always zero. Fixes: a4b2fa433125 ("target/riscv: Introduce privilege version field in the CSR ops.") Signed-off-by: Anup Patel

[PATCH v4 1/4] target/riscv: Don't force update priv spec version to latest

2022-06-08 Thread Anup Patel
t latest priv spec version (i.e. v1.12) for base rv64/rv32 cpu and riscv_cpu_realize() will override priv spec version only when "cpu->cfg.priv_spec != NULL". Fixes: 7100fe6c2441 ("target/riscv: Enable privileged spec version 1.12") Signed-off-by: Anup Patel Reviewed-by

Re: [PATCH v3 3/4] target/riscv: Update [m|h]tinst CSR in riscv_cpu_do_interrupt()

2022-06-06 Thread Anup Patel
On Tue, Jun 7, 2022 at 8:31 AM Anup Patel wrote: > > On Mon, Jun 6, 2022 at 7:23 AM Alistair Francis wrote: > > > > On Mon, Jun 6, 2022 at 11:48 AM Alistair Francis > > wrote: > > > > > > On Thu, May 26, 2022 at 8:12 PM Anup Patel > > >

Re: [PATCH v3 4/4] target/riscv: Force disable extensions if priv spec version does not match

2022-06-06 Thread Anup Patel
On Mon, Jun 6, 2022 at 7:25 AM Alistair Francis wrote: > > On Thu, May 26, 2022 at 8:09 PM Anup Patel wrote: > > > > We should disable extensions in riscv_cpu_realize() if minimum required > > priv spec version is not satisfied. This also ensures that machines with >

Re: [PATCH v3 3/4] target/riscv: Update [m|h]tinst CSR in riscv_cpu_do_interrupt()

2022-06-06 Thread Anup Patel
On Mon, Jun 6, 2022 at 7:23 AM Alistair Francis wrote: > > On Mon, Jun 6, 2022 at 11:48 AM Alistair Francis wrote: > > > > On Thu, May 26, 2022 at 8:12 PM Anup Patel wrote: > > > > > > We should write transformed instruction encoding of the trapped > &g

  1   2   3   4   5   6   7   >