mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
riscv: Introduce satp mode hw capabilities
Currently, the max satp mode is set with the only constraint that it must be implemented in QEMU, i.e. set in valid_vm_1_10_[32|64]. But we actually need to add another level of constraint: what the hw is actually capable of, because currently, a linux booting on a sifive-u54 boots in sv57 mode which is incompatible with the cpu's sv39 max capability. So add a new bitmap to RISCVSATPMap which contains this capability and initialize it in every XXX_cpu_init. Finally: - valid_vm_1_10_[32|64] constrains which satp mode the CPU can use - the CPU hw capabilities constrains what the user may select - the user's selection then constrains what's available to the guest OS. Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com> Reviewed-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Bin Meng <bmeng@tinylab.org> Reviewed-by: Frank Chang <frank.chang@sifive.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-ID: <20230303131252.892893-5-alexghiti@rivosinc.com> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
This commit is contained in:
parent
6f23aaeb9b
commit
6df3747a27
2 changed files with 75 additions and 26 deletions
|
@ -404,13 +404,17 @@ struct RISCVCPUClass {
|
|||
|
||||
/*
|
||||
* map is a 16-bit bitmap: the most significant set bit in map is the maximum
|
||||
* satp mode that is supported.
|
||||
* satp mode that is supported. It may be chosen by the user and must respect
|
||||
* what qemu implements (valid_1_10_32/64) and what the hw is capable of
|
||||
* (supported bitmap below).
|
||||
*
|
||||
* init is a 16-bit bitmap used to make sure the user selected a correct
|
||||
* configuration as per the specification.
|
||||
*
|
||||
* supported is a 16-bit bitmap used to reflect the hw capabilities.
|
||||
*/
|
||||
typedef struct {
|
||||
uint16_t map, init;
|
||||
uint16_t map, init, supported;
|
||||
} RISCVSATPMap;
|
||||
|
||||
struct RISCVCPUConfig {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue