2023-04-11 21:35:09 +03:00
|
|
|
/*
|
|
|
|
* QEMU RISC-V CPU QOM header
|
|
|
|
*
|
|
|
|
* Copyright (c) 2023 Ventana Micro Systems Inc.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms and conditions of the GNU General Public License,
|
|
|
|
* version 2 or later, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
* more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with
|
|
|
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef RISCV_CPU_QOM_H
|
|
|
|
#define RISCV_CPU_QOM_H
|
|
|
|
|
|
|
|
#include "hw/core/cpu.h"
|
|
|
|
#include "qom/object.h"
|
|
|
|
|
|
|
|
#define TYPE_RISCV_CPU "riscv-cpu"
|
target/riscv: add TYPE_RISCV_DYNAMIC_CPU
This new abstract type will be used to differentiate between static and
non-static CPUs in query-cpu-definitions.
All generic CPUs were changed to be of this type. Named CPUs are kept as
TYPE_RISCV_CPU and will still be considered static.
This is the output of query-cpu-definitions after this change for the
riscv64 target:
$ ./build/qemu-system-riscv64 -S -M virt -display none -qmp stdio
{"QMP": {"version": (...)}
{"execute": "qmp_capabilities", "arguments": {"enable": ["oob"]}}
{"return": {}}
{"execute": "query-cpu-definitions"}
{"return": [
{"name": "rv64", "typename": "rv64-riscv-cpu", "static": false, "deprecated": false},
{"name": "sifive-e51", "typename": "sifive-e51-riscv-cpu", "static": true, "deprecated": false},
{"name": "any", "typename": "any-riscv-cpu", "static": false, "deprecated": false},
{"name": "x-rv128", "typename": "x-rv128-riscv-cpu", "static": false, "deprecated": false},
{"name": "shakti-c", "typename": "shakti-c-riscv-cpu", "static": true, "deprecated": false},
{"name": "thead-c906", "typename": "thead-c906-riscv-cpu", "static": true, "deprecated": false},
{"name": "sifive-u54", "typename": "sifive-u54-riscv-cpu", "static": true, "deprecated": false}
]}
Suggested-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230411183511.189632-4-dbarboza@ventanamicro.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2023-04-11 21:35:11 +03:00
|
|
|
#define TYPE_RISCV_DYNAMIC_CPU "riscv-dynamic-cpu"
|
2023-04-11 21:35:09 +03:00
|
|
|
|
|
|
|
#define RISCV_CPU_TYPE_SUFFIX "-" TYPE_RISCV_CPU
|
|
|
|
#define RISCV_CPU_TYPE_NAME(name) (name RISCV_CPU_TYPE_SUFFIX)
|
|
|
|
#define CPU_RESOLVING_TYPE TYPE_RISCV_CPU
|
|
|
|
|
|
|
|
#define TYPE_RISCV_CPU_ANY RISCV_CPU_TYPE_NAME("any")
|
|
|
|
#define TYPE_RISCV_CPU_BASE32 RISCV_CPU_TYPE_NAME("rv32")
|
|
|
|
#define TYPE_RISCV_CPU_BASE64 RISCV_CPU_TYPE_NAME("rv64")
|
|
|
|
#define TYPE_RISCV_CPU_BASE128 RISCV_CPU_TYPE_NAME("x-rv128")
|
|
|
|
#define TYPE_RISCV_CPU_IBEX RISCV_CPU_TYPE_NAME("lowrisc-ibex")
|
|
|
|
#define TYPE_RISCV_CPU_SHAKTI_C RISCV_CPU_TYPE_NAME("shakti-c")
|
|
|
|
#define TYPE_RISCV_CPU_SIFIVE_E31 RISCV_CPU_TYPE_NAME("sifive-e31")
|
|
|
|
#define TYPE_RISCV_CPU_SIFIVE_E34 RISCV_CPU_TYPE_NAME("sifive-e34")
|
|
|
|
#define TYPE_RISCV_CPU_SIFIVE_E51 RISCV_CPU_TYPE_NAME("sifive-e51")
|
|
|
|
#define TYPE_RISCV_CPU_SIFIVE_U34 RISCV_CPU_TYPE_NAME("sifive-u34")
|
|
|
|
#define TYPE_RISCV_CPU_SIFIVE_U54 RISCV_CPU_TYPE_NAME("sifive-u54")
|
|
|
|
#define TYPE_RISCV_CPU_THEAD_C906 RISCV_CPU_TYPE_NAME("thead-c906")
|
2023-04-18 15:36:24 +03:00
|
|
|
#define TYPE_RISCV_CPU_VEYRON_V1 RISCV_CPU_TYPE_NAME("veyron-v1")
|
2023-04-11 21:35:09 +03:00
|
|
|
#define TYPE_RISCV_CPU_HOST RISCV_CPU_TYPE_NAME("host")
|
|
|
|
|
|
|
|
#if defined(TARGET_RISCV32)
|
|
|
|
# define TYPE_RISCV_CPU_BASE TYPE_RISCV_CPU_BASE32
|
|
|
|
#elif defined(TARGET_RISCV64)
|
|
|
|
# define TYPE_RISCV_CPU_BASE TYPE_RISCV_CPU_BASE64
|
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef struct CPUArchState CPURISCVState;
|
|
|
|
|
|
|
|
OBJECT_DECLARE_CPU_TYPE(RISCVCPU, RISCVCPUClass, RISCV_CPU)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* RISCVCPUClass:
|
|
|
|
* @parent_realize: The parent class' realize handler.
|
|
|
|
* @parent_phases: The parent class' reset phase handlers.
|
|
|
|
*
|
|
|
|
* A RISCV CPU model.
|
|
|
|
*/
|
|
|
|
struct RISCVCPUClass {
|
|
|
|
/*< private >*/
|
|
|
|
CPUClass parent_class;
|
|
|
|
/*< public >*/
|
|
|
|
DeviceRealize parent_realize;
|
|
|
|
ResettablePhases parent_phases;
|
|
|
|
};
|
|
|
|
#endif /* RISCV_CPU_QOM_H */
|