[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 01/10] target/riscv: turn write_misa() into an official no
From: |
Andrew Jones |
Subject: |
Re: [PATCH v4 01/10] target/riscv: turn write_misa() into an official no-op |
Date: |
Thu, 16 Feb 2023 15:51:22 +0100 |
On Thu, Feb 16, 2023 at 10:04:35AM -0300, Daniel Henrique Barboza wrote:
> At this moment, and apparently since ever, we have no way of enabling
> RISCV_FEATURE_MISA. This means that all the code from write_misa(), all
> the nuts and bolts that handles how to write this CSR, has always been a
> no-op as well because write_misa() will always exit earlier.
>
> This seems to be benign in the majority of cases. Booting an Ubuntu
> 'virt' guest and logging all the calls to 'write_misa' shows that no
> writes to MISA CSR was attempted. Writing MISA, i.e. enabling/disabling
> RISC-V extensions after the machine is powered on, seems to be a niche
> use.
>
> It is important to mention that the spec says that MISA is a WARL (Write
> Any Read Legal) CSR, and having the write operations as a no-op is a
> valid spec implementation.
This sort of reads like all WARL CSRs can ignore their writes. That's not
generally true, but this CSR can, because the spec says an implementation
may/can make its bits modifiable.
> Allowing the dormant code to write MISA can
> cause tricky bugs to solve later on. Given that we don't have a
> particularly interesting case of writing MISA to support today, the
> risks outweights the benefits.
>
> Let's make it official and erase all the body of write_misa(), making it
> an official no-op.
>
> Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
> ---
> target/riscv/csr.c | 55 ----------------------------------------------
> 1 file changed, 55 deletions(-)
>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Thanks,
drew
- [PATCH v4 00/10] make write_misa a no-op and FEATURE_* cleanups, Daniel Henrique Barboza, 2023/02/16
- [PATCH v4 01/10] target/riscv: turn write_misa() into an official no-op, Daniel Henrique Barboza, 2023/02/16
- [PATCH v4 02/10] target/riscv: remove RISCV_FEATURE_MISA, Daniel Henrique Barboza, 2023/02/16
- [PATCH v4 04/10] target/riscv: remove RISCV_FEATURE_DEBUG, Daniel Henrique Barboza, 2023/02/16
- [PATCH v4 03/10] target/riscv: introduce riscv_cpu_cfg(), Daniel Henrique Barboza, 2023/02/16
- [PATCH v4 05/10] target/riscv/cpu.c: error out if EPMP is enabled without PMP, Daniel Henrique Barboza, 2023/02/16
- [PATCH v4 06/10] target/riscv: remove RISCV_FEATURE_EPMP, Daniel Henrique Barboza, 2023/02/16
- [PATCH v4 08/10] hw/riscv/virt.c: do not use RISCV_FEATURE_MMU in create_fdt_socket_cpus(), Daniel Henrique Barboza, 2023/02/16
- [PATCH v4 07/10] target/riscv: remove RISCV_FEATURE_PMP, Daniel Henrique Barboza, 2023/02/16