1
The following changes since commit 5cc7a54c2e91d82cb6a52e4921325c511fd90712:
1
From: Alistair Francis <alistair.francis@wdc.com>
2
2
3
Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20200602' into staging (2020-06-02 18:16:38 +0100)
3
The following changes since commit c5fbdd60cf1fb52f01bdfe342b6fa65d5343e1b1:
4
5
Merge tag 'qemu-sparc-20211121' of git://github.com/mcayland/qemu into staging (2021-11-21 14:12:25 +0100)
4
6
5
are available in the Git repository at:
7
are available in the Git repository at:
6
8
7
git@github.com:alistair23/qemu.git tags/pull-riscv-to-apply-20200603
9
git@github.com:alistair23/qemu.git tags/pull-riscv-to-apply-20211122
8
10
9
for you to fetch changes up to fe0fe4735e798578097758781166cc221319b93d:
11
for you to fetch changes up to 526e7443027c71fe7b04c29df529e1f9f425f9e3:
10
12
11
riscv: Initial commit of OpenTitan machine (2020-06-03 09:11:51 -0700)
13
hw/misc/sifive_u_otp: Do not reset OTP content on hardware reset (2021-11-22 10:46:22 +1000)
12
14
13
----------------------------------------------------------------
15
----------------------------------------------------------------
14
This is a collection of RISC-V patches for 5.1.
16
Seventh RISC-V PR for QEMU 6.2
15
17
16
This incldues removing deprecated features and part of the OpenTitan
18
- Deprecate IF_NONE for SiFive OTP
17
support series.
19
- Don't reset SiFive OTP content
18
20
19
----------------------------------------------------------------
21
----------------------------------------------------------------
20
Alistair Francis (11):
22
Philippe Mathieu-Daudé (1):
21
hw/riscv: spike: Remove deprecated ISA specific machines
23
hw/misc/sifive_u_otp: Do not reset OTP content on hardware reset
22
target/riscv: Remove the deprecated CPUs
23
target/riscv: Drop support for ISA spec version 1.09.1
24
docs: deprecated: Update the -bios documentation
25
riscv: sifive_e: Manually define the machine
26
riscv/boot: Add a missing header include
27
target/riscv: Don't overwrite the reset vector
28
target/riscv: Disable the MMU correctly
29
target/riscv: Don't set PMP feature in the cpu init
30
target/riscv: Add the lowRISC Ibex CPU
31
riscv: Initial commit of OpenTitan machine
32
24
33
Bin Meng (4):
25
Thomas Huth (1):
34
riscv: Suppress the error report for QEMU testing with riscv_find_firmware()
26
hw/misc/sifive_u_otp: Use IF_PFLASH for the OTP device instead of IF_NONE
35
riscv: Change the default behavior if no -bios option is specified
36
hw/riscv: sifive_u: Remove the riscv_ prefix of the soc* functions
37
hw/riscv: virt: Remove the riscv_ prefix of the machine* functions
38
27
39
docs/system/deprecated.rst | 98 +++++------
28
docs/about/deprecated.rst | 6 ++++++
40
default-configs/riscv32-softmmu.mak | 1 +
29
hw/misc/sifive_u_otp.c | 22 +++++++++++++---------
41
default-configs/riscv64-softmmu.mak | 11 +-
30
2 files changed, 19 insertions(+), 9 deletions(-)
42
include/hw/riscv/boot.h | 1 +
43
include/hw/riscv/opentitan.h | 68 ++++++++
44
include/hw/riscv/sifive_e.h | 4 +
45
include/hw/riscv/spike.h | 6 +-
46
target/riscv/cpu.h | 9 +-
47
hw/riscv/boot.c | 45 ++---
48
hw/riscv/opentitan.c | 184 +++++++++++++++++++++
49
hw/riscv/sifive_e.c | 41 +++--
50
hw/riscv/sifive_u.c | 24 +--
51
hw/riscv/spike.c | 217 -------------------------
52
hw/riscv/virt.c | 20 +--
53
target/riscv/cpu.c | 45 ++---
54
target/riscv/cpu_helper.c | 82 ++++------
55
target/riscv/csr.c | 138 +++-------------
56
target/riscv/insn_trans/trans_privileged.inc.c | 18 +-
57
target/riscv/monitor.c | 5 -
58
target/riscv/op_helper.c | 17 +-
59
tests/qtest/machine-none-test.c | 4 +-
60
MAINTAINERS | 9 +
61
hw/riscv/Kconfig | 5 +
62
hw/riscv/Makefile.objs | 1 +
63
24 files changed, 480 insertions(+), 573 deletions(-)
64
create mode 100644 include/hw/riscv/opentitan.h
65
create mode 100644 hw/riscv/opentitan.c
66
31
diff view generated by jsdifflib
Deleted patch
1
From: Bin Meng <bin.meng@windriver.com>
2
1
3
We only ship plain binary bios images in the QEMU source. With Spike
4
machine that uses ELF images as the default bios, running QEMU test
5
will complain hence let's suppress the error report for QEMU testing.
6
7
Signed-off-by: Bin Meng <bin.meng@windriver.com>
8
Reviewed-by: Anup Patel <anup@brainfault.org>
9
Message-Id: <1588348254-7241-6-git-send-email-bmeng.cn@gmail.com>
10
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
11
---
12
hw/riscv/boot.c | 14 +++++++++++---
13
1 file changed, 11 insertions(+), 3 deletions(-)
14
15
diff --git a/hw/riscv/boot.c b/hw/riscv/boot.c
16
index XXXXXXX..XXXXXXX 100644
17
--- a/hw/riscv/boot.c
18
+++ b/hw/riscv/boot.c
19
@@ -XXX,XX +XXX,XX @@ char *riscv_find_firmware(const char *firmware_filename)
20
21
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, firmware_filename);
22
if (filename == NULL) {
23
- error_report("Unable to load the RISC-V firmware \"%s\"",
24
- firmware_filename);
25
- exit(1);
26
+ if (!qtest_enabled()) {
27
+ /*
28
+ * We only ship plain binary bios images in the QEMU source.
29
+ * With Spike machine that uses ELF images as the default bios,
30
+ * running QEMU test will complain hence let's suppress the error
31
+ * report for QEMU testing.
32
+ */
33
+ error_report("Unable to load the RISC-V firmware \"%s\"",
34
+ firmware_filename);
35
+ exit(1);
36
+ }
37
}
38
39
return filename;
40
--
41
2.26.2
42
43
diff view generated by jsdifflib
1
From: Bin Meng <bin.meng@windriver.com>
1
From: Thomas Huth <thuth@redhat.com>
2
2
3
Per QEMU deprecated doc, QEMU 4.1 introduced support for the -bios
3
Configuring a drive with "if=none" is meant for creation of a backend
4
option in QEMU for RISC-V for the virt machine and sifive_u machine.
4
only, it should not get automatically assigned to a device frontend.
5
The default behavior has been that QEMU does not automatically load
5
Use "if=pflash" for the One-Time-Programmable device instead (like
6
any firmware if no -bios option is included.
6
it is e.g. also done for the efuse device in hw/arm/xlnx-zcu102.c).
7
7
8
Now 2 releases passed, it's time to change the default behavior to
8
Since the old way of configuring the device has already been published
9
load the default OpenSBI firmware automatically. The firmware is
9
with the previous QEMU versions, we cannot remove this immediately, but
10
included with the QEMU release and no user interaction is required.
10
have to deprecate it and support it for at least two more releases.
11
All a user needs to do is specify the kernel they want to boot with
12
the -kernel option.
13
11
14
Signed-off-by: Bin Meng <bin.meng@windriver.com>
12
Signed-off-by: Thomas Huth <thuth@redhat.com>
13
Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
14
Reviewed-by: Markus Armbruster <armbru@redhat.com>
15
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
15
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
16
Message-id: 1588335545-649-1-git-send-email-bmeng.cn@gmail.com
16
Message-id: 20211119102549.217755-1-thuth@redhat.com
17
Message-Id: <1588335545-649-1-git-send-email-bmeng.cn@gmail.com>
18
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
17
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
19
---
18
---
20
hw/riscv/boot.c | 31 ++++---------------------------
19
docs/about/deprecated.rst | 6 ++++++
21
1 file changed, 4 insertions(+), 27 deletions(-)
20
hw/misc/sifive_u_otp.c | 9 ++++++++-
21
2 files changed, 14 insertions(+), 1 deletion(-)
22
22
23
diff --git a/hw/riscv/boot.c b/hw/riscv/boot.c
23
diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
24
index XXXXXXX..XXXXXXX 100644
24
index XXXXXXX..XXXXXXX 100644
25
--- a/hw/riscv/boot.c
25
--- a/docs/about/deprecated.rst
26
+++ b/hw/riscv/boot.c
26
+++ b/docs/about/deprecated.rst
27
@@ -XXX,XX +XXX,XX @@ void riscv_find_and_load_firmware(MachineState *machine,
27
@@ -XXX,XX +XXX,XX @@ as short-form boolean values, and passed to plugins as ``arg_name=on``.
28
{
28
However, short-form booleans are deprecated and full explicit ``arg_name=on``
29
char *firmware_filename = NULL;
29
form is preferred.
30
30
31
- if (!machine->firmware) {
31
+``-drive if=none`` for the sifive_u OTP device (since 6.2)
32
+ if ((!machine->firmware) || (!strcmp(machine->firmware, "default"))) {
32
+''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
33
/*
33
+
34
- * The user didn't specify -bios.
34
+Using ``-drive if=none`` to configure the OTP device of the sifive_u
35
- * At the moment we default to loading nothing when this hapens.
35
+RISC-V machine is deprecated. Use ``-drive if=pflash`` instead.
36
- * In the future this defaul will change to loading the prebuilt
36
+
37
- * OpenSBI firmware. Let's warn the user and then continue.
37
38
- */
38
QEMU Machine Protocol (QMP) commands
39
- if (!qtest_enabled()) {
39
------------------------------------
40
- warn_report("No -bios option specified. Not loading a firmware.");
40
diff --git a/hw/misc/sifive_u_otp.c b/hw/misc/sifive_u_otp.c
41
- warn_report("This default will change in a future QEMU release. " \
41
index XXXXXXX..XXXXXXX 100644
42
- "Please use the -bios option to avoid breakages when "\
42
--- a/hw/misc/sifive_u_otp.c
43
- "this happens.");
43
+++ b/hw/misc/sifive_u_otp.c
44
- warn_report("See QEMU's deprecation documentation for details.");
44
@@ -XXX,XX +XXX,XX @@ static void sifive_u_otp_realize(DeviceState *dev, Error **errp)
45
- }
45
TYPE_SIFIVE_U_OTP, SIFIVE_U_OTP_REG_SIZE);
46
- return;
46
sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->mmio);
47
- }
47
48
-
48
- dinfo = drive_get_next(IF_NONE);
49
- if (!strcmp(machine->firmware, "default")) {
49
+ dinfo = drive_get_next(IF_PFLASH);
50
- /*
50
+ if (!dinfo) {
51
- * The user has specified "-bios default". That means we are going to
51
+ dinfo = drive_get_next(IF_NONE);
52
- * load the OpenSBI binary included in the QEMU source.
52
+ if (dinfo) {
53
- *
53
+ warn_report("using \"-drive if=none\" for the OTP is deprecated, "
54
- * We can't load the binary by default as it will break existing users
54
+ "use \"-drive if=pflash\" instead.");
55
- * as users are already loading their own firmware.
55
+ }
56
- *
56
+ }
57
- * Let's try to get everyone to specify the -bios option at all times,
57
if (dinfo) {
58
- * so then in the future we can make "-bios default" the default option
58
int ret;
59
- * if no -bios option is set without breaking anything.
59
uint64_t perm;
60
+ * The user didn't specify -bios, or has specified "-bios default".
61
+ * That means we are going to load the OpenSBI binary included in
62
+ * the QEMU source.
63
*/
64
firmware_filename = riscv_find_firmware(default_machine_firmware);
65
} else if (strcmp(machine->firmware, "none")) {
66
--
60
--
67
2.26.2
61
2.31.1
68
62
69
63
diff view generated by jsdifflib
1
From: Bin Meng <bin.meng@windriver.com>
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
2
3
To keep consistency with the machine* functions, remove the riscv_
3
Once a "One Time Programmable" is programmed, it shouldn't be reset.
4
prefix of the soc* functions.
5
4
6
Signed-off-by: Bin Meng <bin.meng@windriver.com>
5
Do not re-initialize the OTP content in the DeviceReset handler,
7
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
6
initialize it once in the DeviceRealize one.
7
8
Fixes: 9fb45c62ae8 ("riscv: sifive: Implement a model for SiFive FU540 OTP")
9
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
8
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
10
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
9
Message-id: 1590072147-13035-1-git-send-email-bmeng.cn@gmail.com
11
Message-Id: <20211119104757.331579-1-f4bug@amsat.org>
10
Message-Id: <1590072147-13035-1-git-send-email-bmeng.cn@gmail.com>
11
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
12
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
12
---
13
---
13
hw/riscv/sifive_u.c | 24 ++++++++++++------------
14
hw/misc/sifive_u_otp.c | 13 +++++--------
14
1 file changed, 12 insertions(+), 12 deletions(-)
15
1 file changed, 5 insertions(+), 8 deletions(-)
15
16
16
diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c
17
diff --git a/hw/misc/sifive_u_otp.c b/hw/misc/sifive_u_otp.c
17
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
18
--- a/hw/riscv/sifive_u.c
19
--- a/hw/misc/sifive_u_otp.c
19
+++ b/hw/riscv/sifive_u.c
20
+++ b/hw/misc/sifive_u_otp.c
20
@@ -XXX,XX +XXX,XX @@ static void sifive_u_machine_init_register_types(void)
21
@@ -XXX,XX +XXX,XX @@ static void sifive_u_otp_realize(DeviceState *dev, Error **errp)
21
22
22
type_init(sifive_u_machine_init_register_types)
23
if (blk_pread(s->blk, 0, s->fuse, filesize) != filesize) {
23
24
error_setg(errp, "failed to read the initial flash content");
24
-static void riscv_sifive_u_soc_init(Object *obj)
25
+ return;
25
+static void sifive_u_soc_instance_init(Object *obj)
26
}
26
{
27
}
27
MachineState *ms = MACHINE(qdev_get_machine());
28
}
28
SiFiveUSoCState *s = RISCV_U_SOC(obj);
29
-}
29
@@ -XXX,XX +XXX,XX @@ static void riscv_sifive_u_soc_init(Object *obj)
30
-
30
TYPE_CADENCE_GEM);
31
-static void sifive_u_otp_reset(DeviceState *dev)
32
-{
33
- SiFiveUOTPState *s = SIFIVE_U_OTP(dev);
34
35
/* Initialize all fuses' initial value to 0xFFs */
36
memset(s->fuse, 0xff, sizeof(s->fuse));
37
@@ -XXX,XX +XXX,XX @@ static void sifive_u_otp_reset(DeviceState *dev)
38
serial_data = s->serial;
39
if (blk_pwrite(s->blk, index * SIFIVE_U_OTP_FUSE_WORD,
40
&serial_data, SIFIVE_U_OTP_FUSE_WORD, 0) < 0) {
41
- error_report("write error index<%d>", index);
42
+ error_setg(errp, "failed to write index<%d>", index);
43
+ return;
44
}
45
46
serial_data = ~(s->serial);
47
if (blk_pwrite(s->blk, (index + 1) * SIFIVE_U_OTP_FUSE_WORD,
48
&serial_data, SIFIVE_U_OTP_FUSE_WORD, 0) < 0) {
49
- error_report("write error index<%d>", index + 1);
50
+ error_setg(errp, "failed to write index<%d>", index + 1);
51
+ return;
52
}
53
}
54
55
@@ -XXX,XX +XXX,XX @@ static void sifive_u_otp_class_init(ObjectClass *klass, void *data)
56
57
device_class_set_props(dc, sifive_u_otp_properties);
58
dc->realize = sifive_u_otp_realize;
59
- dc->reset = sifive_u_otp_reset;
31
}
60
}
32
61
33
-static void riscv_sifive_u_soc_realize(DeviceState *dev, Error **errp)
62
static const TypeInfo sifive_u_otp_info = {
34
+static void sifive_u_soc_realize(DeviceState *dev, Error **errp)
35
{
36
MachineState *ms = MACHINE(qdev_get_machine());
37
SiFiveUSoCState *s = RISCV_U_SOC(dev);
38
@@ -XXX,XX +XXX,XX @@ static void riscv_sifive_u_soc_realize(DeviceState *dev, Error **errp)
39
memmap[SIFIVE_U_GEM_MGMT].base, memmap[SIFIVE_U_GEM_MGMT].size);
40
}
41
42
-static Property riscv_sifive_u_soc_props[] = {
43
+static Property sifive_u_soc_props[] = {
44
DEFINE_PROP_UINT32("serial", SiFiveUSoCState, serial, OTP_SERIAL),
45
DEFINE_PROP_END_OF_LIST()
46
};
47
48
-static void riscv_sifive_u_soc_class_init(ObjectClass *oc, void *data)
49
+static void sifive_u_soc_class_init(ObjectClass *oc, void *data)
50
{
51
DeviceClass *dc = DEVICE_CLASS(oc);
52
53
- device_class_set_props(dc, riscv_sifive_u_soc_props);
54
- dc->realize = riscv_sifive_u_soc_realize;
55
+ device_class_set_props(dc, sifive_u_soc_props);
56
+ dc->realize = sifive_u_soc_realize;
57
/* Reason: Uses serial_hds in realize function, thus can't be used twice */
58
dc->user_creatable = false;
59
}
60
61
-static const TypeInfo riscv_sifive_u_soc_type_info = {
62
+static const TypeInfo sifive_u_soc_type_info = {
63
.name = TYPE_RISCV_U_SOC,
64
.parent = TYPE_DEVICE,
65
.instance_size = sizeof(SiFiveUSoCState),
66
- .instance_init = riscv_sifive_u_soc_init,
67
- .class_init = riscv_sifive_u_soc_class_init,
68
+ .instance_init = sifive_u_soc_instance_init,
69
+ .class_init = sifive_u_soc_class_init,
70
};
71
72
-static void riscv_sifive_u_soc_register_types(void)
73
+static void sifive_u_soc_register_types(void)
74
{
75
- type_register_static(&riscv_sifive_u_soc_type_info);
76
+ type_register_static(&sifive_u_soc_type_info);
77
}
78
79
-type_init(riscv_sifive_u_soc_register_types)
80
+type_init(sifive_u_soc_register_types)
81
--
63
--
82
2.26.2
64
2.31.1
83
65
84
66
diff view generated by jsdifflib
Deleted patch
1
From: Bin Meng <bin.meng@windriver.com>
2
1
3
Remove the riscv_ prefix of the machine* functions.
4
5
Signed-off-by: Bin Meng <bin.meng@windriver.com>
6
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
8
Message-id: 1590072147-13035-2-git-send-email-bmeng.cn@gmail.com
9
Message-Id: <1590072147-13035-2-git-send-email-bmeng.cn@gmail.com>
10
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
11
---
12
hw/riscv/virt.c | 20 ++++++++++----------
13
1 file changed, 10 insertions(+), 10 deletions(-)
14
15
diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
16
index XXXXXXX..XXXXXXX 100644
17
--- a/hw/riscv/virt.c
18
+++ b/hw/riscv/virt.c
19
@@ -XXX,XX +XXX,XX @@ static inline DeviceState *gpex_pcie_init(MemoryRegion *sys_mem,
20
return dev;
21
}
22
23
-static void riscv_virt_board_init(MachineState *machine)
24
+static void virt_machine_init(MachineState *machine)
25
{
26
const struct MemmapEntry *memmap = virt_memmap;
27
RISCVVirtState *s = RISCV_VIRT_MACHINE(machine);
28
@@ -XXX,XX +XXX,XX @@ static void riscv_virt_board_init(MachineState *machine)
29
g_free(plic_hart_config);
30
}
31
32
-static void riscv_virt_machine_instance_init(Object *obj)
33
+static void virt_machine_instance_init(Object *obj)
34
{
35
}
36
37
-static void riscv_virt_machine_class_init(ObjectClass *oc, void *data)
38
+static void virt_machine_class_init(ObjectClass *oc, void *data)
39
{
40
MachineClass *mc = MACHINE_CLASS(oc);
41
42
mc->desc = "RISC-V VirtIO board";
43
- mc->init = riscv_virt_board_init;
44
+ mc->init = virt_machine_init;
45
mc->max_cpus = 8;
46
mc->default_cpu_type = VIRT_CPU;
47
mc->pci_allow_0_address = true;
48
}
49
50
-static const TypeInfo riscv_virt_machine_typeinfo = {
51
+static const TypeInfo virt_machine_typeinfo = {
52
.name = MACHINE_TYPE_NAME("virt"),
53
.parent = TYPE_MACHINE,
54
- .class_init = riscv_virt_machine_class_init,
55
- .instance_init = riscv_virt_machine_instance_init,
56
+ .class_init = virt_machine_class_init,
57
+ .instance_init = virt_machine_instance_init,
58
.instance_size = sizeof(RISCVVirtState),
59
};
60
61
-static void riscv_virt_machine_init_register_types(void)
62
+static void virt_machine_init_register_types(void)
63
{
64
- type_register_static(&riscv_virt_machine_typeinfo);
65
+ type_register_static(&virt_machine_typeinfo);
66
}
67
68
-type_init(riscv_virt_machine_init_register_types)
69
+type_init(virt_machine_init_register_types)
70
--
71
2.26.2
72
73
diff view generated by jsdifflib
Deleted patch
1
The ISA specific Spike machines have been deprecated in QEMU since 4.1,
2
let's finally remove them.
3
1
4
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
5
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
6
Reviewed-by: Bin Meng <bin.meng@windriver.com>
7
Reviewed-by: Thomas Huth <thuth@redhat.com>
8
---
9
docs/system/deprecated.rst | 17 +--
10
include/hw/riscv/spike.h | 6 +-
11
hw/riscv/spike.c | 217 -------------------------------------
12
3 files changed, 12 insertions(+), 228 deletions(-)
13
14
diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst
15
index XXXXXXX..XXXXXXX 100644
16
--- a/docs/system/deprecated.rst
17
+++ b/docs/system/deprecated.rst
18
@@ -XXX,XX +XXX,XX @@ This machine has been renamed ``fuloong2e``.
19
These machine types are very old and likely can not be used for live migration
20
from old QEMU versions anymore. A newer machine type should be used instead.
21
22
-``spike_v1.9.1`` and ``spike_v1.10`` (since 4.1)
23
-''''''''''''''''''''''''''''''''''''''''''''''''
24
-
25
-The version specific Spike machines have been deprecated in favour of the
26
-generic ``spike`` machine. If you need to specify an older version of the RISC-V
27
-spec you can use the ``-cpu rv64gcsu,priv_spec=v1.9.1`` command line argument.
28
-
29
Device options
30
--------------
31
32
@@ -XXX,XX +XXX,XX @@ The ``hub_id`` parameter of ``hostfwd_add`` / ``hostfwd_remove`` (removed in 5.0
33
The ``[hub_id name]`` parameter tuple of the 'hostfwd_add' and
34
'hostfwd_remove' HMP commands has been replaced by ``netdev_id``.
35
36
+System emulator machines
37
+------------------------
38
+
39
+``spike_v1.9.1`` and ``spike_v1.10`` (removed in 5.1)
40
+'''''''''''''''''''''''''''''''''''''''''''''''''''''
41
+
42
+The version specific Spike machines have been removed in favour of the
43
+generic ``spike`` machine. If you need to specify an older version of the RISC-V
44
+spec you can use the ``-cpu rv64gcsu,priv_spec=v1.10.0`` command line argument.
45
+
46
Related binaries
47
----------------
48
49
diff --git a/include/hw/riscv/spike.h b/include/hw/riscv/spike.h
50
index XXXXXXX..XXXXXXX 100644
51
--- a/include/hw/riscv/spike.h
52
+++ b/include/hw/riscv/spike.h
53
@@ -XXX,XX +XXX,XX @@ enum {
54
};
55
56
#if defined(TARGET_RISCV32)
57
-#define SPIKE_V1_09_1_CPU TYPE_RISCV_CPU_RV32GCSU_V1_09_1
58
-#define SPIKE_V1_10_0_CPU TYPE_RISCV_CPU_RV32GCSU_V1_10_0
59
+#define SPIKE_V1_10_0_CPU TYPE_RISCV_CPU_BASE32
60
#elif defined(TARGET_RISCV64)
61
-#define SPIKE_V1_09_1_CPU TYPE_RISCV_CPU_RV64GCSU_V1_09_1
62
-#define SPIKE_V1_10_0_CPU TYPE_RISCV_CPU_RV64GCSU_V1_10_0
63
+#define SPIKE_V1_10_0_CPU TYPE_RISCV_CPU_BASE64
64
#endif
65
66
#endif
67
diff --git a/hw/riscv/spike.c b/hw/riscv/spike.c
68
index XXXXXXX..XXXXXXX 100644
69
--- a/hw/riscv/spike.c
70
+++ b/hw/riscv/spike.c
71
@@ -XXX,XX +XXX,XX @@ static void spike_board_init(MachineState *machine)
72
false);
73
}
74
75
-static void spike_v1_10_0_board_init(MachineState *machine)
76
-{
77
- const struct MemmapEntry *memmap = spike_memmap;
78
-
79
- SpikeState *s = g_new0(SpikeState, 1);
80
- MemoryRegion *system_memory = get_system_memory();
81
- MemoryRegion *main_mem = g_new(MemoryRegion, 1);
82
- MemoryRegion *mask_rom = g_new(MemoryRegion, 1);
83
- int i;
84
- unsigned int smp_cpus = machine->smp.cpus;
85
-
86
- if (!qtest_enabled()) {
87
- info_report("The Spike v1.10.0 machine has been deprecated. "
88
- "Please use the generic spike machine and specify the ISA "
89
- "versions using -cpu.");
90
- }
91
-
92
- /* Initialize SOC */
93
- object_initialize_child(OBJECT(machine), "soc", &s->soc, sizeof(s->soc),
94
- TYPE_RISCV_HART_ARRAY, &error_abort, NULL);
95
- object_property_set_str(OBJECT(&s->soc), SPIKE_V1_10_0_CPU, "cpu-type",
96
- &error_abort);
97
- object_property_set_int(OBJECT(&s->soc), smp_cpus, "num-harts",
98
- &error_abort);
99
- object_property_set_bool(OBJECT(&s->soc), true, "realized",
100
- &error_abort);
101
-
102
- /* register system main memory (actual RAM) */
103
- memory_region_init_ram(main_mem, NULL, "riscv.spike.ram",
104
- machine->ram_size, &error_fatal);
105
- memory_region_add_subregion(system_memory, memmap[SPIKE_DRAM].base,
106
- main_mem);
107
-
108
- /* create device tree */
109
- create_fdt(s, memmap, machine->ram_size, machine->kernel_cmdline);
110
-
111
- /* boot rom */
112
- memory_region_init_rom(mask_rom, NULL, "riscv.spike.mrom",
113
- memmap[SPIKE_MROM].size, &error_fatal);
114
- memory_region_add_subregion(system_memory, memmap[SPIKE_MROM].base,
115
- mask_rom);
116
-
117
- if (machine->kernel_filename) {
118
- riscv_load_kernel(machine->kernel_filename, htif_symbol_callback);
119
- }
120
-
121
- /* reset vector */
122
- uint32_t reset_vec[8] = {
123
- 0x00000297, /* 1: auipc t0, %pcrel_hi(dtb) */
124
- 0x02028593, /* addi a1, t0, %pcrel_lo(1b) */
125
- 0xf1402573, /* csrr a0, mhartid */
126
-#if defined(TARGET_RISCV32)
127
- 0x0182a283, /* lw t0, 24(t0) */
128
-#elif defined(TARGET_RISCV64)
129
- 0x0182b283, /* ld t0, 24(t0) */
130
-#endif
131
- 0x00028067, /* jr t0 */
132
- 0x00000000,
133
- memmap[SPIKE_DRAM].base, /* start: .dword DRAM_BASE */
134
- 0x00000000,
135
- /* dtb: */
136
- };
137
-
138
- /* copy in the reset vector in little_endian byte order */
139
- for (i = 0; i < sizeof(reset_vec) >> 2; i++) {
140
- reset_vec[i] = cpu_to_le32(reset_vec[i]);
141
- }
142
- rom_add_blob_fixed_as("mrom.reset", reset_vec, sizeof(reset_vec),
143
- memmap[SPIKE_MROM].base, &address_space_memory);
144
-
145
- /* copy in the device tree */
146
- if (fdt_pack(s->fdt) || fdt_totalsize(s->fdt) >
147
- memmap[SPIKE_MROM].size - sizeof(reset_vec)) {
148
- error_report("not enough space to store device-tree");
149
- exit(1);
150
- }
151
- qemu_fdt_dumpdtb(s->fdt, fdt_totalsize(s->fdt));
152
- rom_add_blob_fixed_as("mrom.fdt", s->fdt, fdt_totalsize(s->fdt),
153
- memmap[SPIKE_MROM].base + sizeof(reset_vec),
154
- &address_space_memory);
155
-
156
- /* initialize HTIF using symbols found in load_kernel */
157
- htif_mm_init(system_memory, mask_rom, &s->soc.harts[0].env, serial_hd(0));
158
-
159
- /* Core Local Interruptor (timer and IPI) */
160
- sifive_clint_create(memmap[SPIKE_CLINT].base, memmap[SPIKE_CLINT].size,
161
- smp_cpus, SIFIVE_SIP_BASE, SIFIVE_TIMECMP_BASE, SIFIVE_TIME_BASE,
162
- false);
163
-}
164
-
165
-static void spike_v1_09_1_board_init(MachineState *machine)
166
-{
167
- const struct MemmapEntry *memmap = spike_memmap;
168
-
169
- SpikeState *s = g_new0(SpikeState, 1);
170
- MemoryRegion *system_memory = get_system_memory();
171
- MemoryRegion *main_mem = g_new(MemoryRegion, 1);
172
- MemoryRegion *mask_rom = g_new(MemoryRegion, 1);
173
- int i;
174
- unsigned int smp_cpus = machine->smp.cpus;
175
-
176
- if (!qtest_enabled()) {
177
- info_report("The Spike v1.09.1 machine has been deprecated. "
178
- "Please use the generic spike machine and specify the ISA "
179
- "versions using -cpu.");
180
- }
181
-
182
- /* Initialize SOC */
183
- object_initialize_child(OBJECT(machine), "soc", &s->soc, sizeof(s->soc),
184
- TYPE_RISCV_HART_ARRAY, &error_abort, NULL);
185
- object_property_set_str(OBJECT(&s->soc), SPIKE_V1_09_1_CPU, "cpu-type",
186
- &error_abort);
187
- object_property_set_int(OBJECT(&s->soc), smp_cpus, "num-harts",
188
- &error_abort);
189
- object_property_set_bool(OBJECT(&s->soc), true, "realized",
190
- &error_abort);
191
-
192
- /* register system main memory (actual RAM) */
193
- memory_region_init_ram(main_mem, NULL, "riscv.spike.ram",
194
- machine->ram_size, &error_fatal);
195
- memory_region_add_subregion(system_memory, memmap[SPIKE_DRAM].base,
196
- main_mem);
197
-
198
- /* boot rom */
199
- memory_region_init_rom(mask_rom, NULL, "riscv.spike.mrom",
200
- memmap[SPIKE_MROM].size, &error_fatal);
201
- memory_region_add_subregion(system_memory, memmap[SPIKE_MROM].base,
202
- mask_rom);
203
-
204
- if (machine->kernel_filename) {
205
- riscv_load_kernel(machine->kernel_filename, htif_symbol_callback);
206
- }
207
-
208
- /* reset vector */
209
- uint32_t reset_vec[8] = {
210
- 0x297 + memmap[SPIKE_DRAM].base - memmap[SPIKE_MROM].base, /* lui */
211
- 0x00028067, /* jump to DRAM_BASE */
212
- 0x00000000, /* reserved */
213
- memmap[SPIKE_MROM].base + sizeof(reset_vec), /* config string pointer */
214
- 0, 0, 0, 0 /* trap vector */
215
- };
216
-
217
- /* part one of config string - before memory size specified */
218
- const char *config_string_tmpl =
219
- "platform {\n"
220
- " vendor ucb;\n"
221
- " arch spike;\n"
222
- "};\n"
223
- "rtc {\n"
224
- " addr 0x%" PRIx64 "x;\n"
225
- "};\n"
226
- "ram {\n"
227
- " 0 {\n"
228
- " addr 0x%" PRIx64 "x;\n"
229
- " size 0x%" PRIx64 "x;\n"
230
- " };\n"
231
- "};\n"
232
- "core {\n"
233
- " 0" " {\n"
234
- " " "0 {\n"
235
- " isa %s;\n"
236
- " timecmp 0x%" PRIx64 "x;\n"
237
- " ipi 0x%" PRIx64 "x;\n"
238
- " };\n"
239
- " };\n"
240
- "};\n";
241
-
242
- /* build config string with supplied memory size */
243
- char *isa = riscv_isa_string(&s->soc.harts[0]);
244
- char *config_string = g_strdup_printf(config_string_tmpl,
245
- (uint64_t)memmap[SPIKE_CLINT].base + SIFIVE_TIME_BASE,
246
- (uint64_t)memmap[SPIKE_DRAM].base,
247
- (uint64_t)ram_size, isa,
248
- (uint64_t)memmap[SPIKE_CLINT].base + SIFIVE_TIMECMP_BASE,
249
- (uint64_t)memmap[SPIKE_CLINT].base + SIFIVE_SIP_BASE);
250
- g_free(isa);
251
- size_t config_string_len = strlen(config_string);
252
-
253
- /* copy in the reset vector in little_endian byte order */
254
- for (i = 0; i < sizeof(reset_vec) >> 2; i++) {
255
- reset_vec[i] = cpu_to_le32(reset_vec[i]);
256
- }
257
- rom_add_blob_fixed_as("mrom.reset", reset_vec, sizeof(reset_vec),
258
- memmap[SPIKE_MROM].base, &address_space_memory);
259
-
260
- /* copy in the config string */
261
- rom_add_blob_fixed_as("mrom.reset", config_string, config_string_len,
262
- memmap[SPIKE_MROM].base + sizeof(reset_vec),
263
- &address_space_memory);
264
-
265
- /* initialize HTIF using symbols found in load_kernel */
266
- htif_mm_init(system_memory, mask_rom, &s->soc.harts[0].env, serial_hd(0));
267
-
268
- /* Core Local Interruptor (timer and IPI) */
269
- sifive_clint_create(memmap[SPIKE_CLINT].base, memmap[SPIKE_CLINT].size,
270
- smp_cpus, SIFIVE_SIP_BASE, SIFIVE_TIMECMP_BASE, SIFIVE_TIME_BASE,
271
- false);
272
-
273
- g_free(config_string);
274
-}
275
-
276
-static void spike_v1_09_1_machine_init(MachineClass *mc)
277
-{
278
- mc->desc = "RISC-V Spike Board (Privileged ISA v1.9.1)";
279
- mc->init = spike_v1_09_1_board_init;
280
- mc->max_cpus = 1;
281
-}
282
-
283
-static void spike_v1_10_0_machine_init(MachineClass *mc)
284
-{
285
- mc->desc = "RISC-V Spike Board (Privileged ISA v1.10)";
286
- mc->init = spike_v1_10_0_board_init;
287
- mc->max_cpus = 1;
288
-}
289
-
290
static void spike_machine_init(MachineClass *mc)
291
{
292
mc->desc = "RISC-V Spike Board";
293
@@ -XXX,XX +XXX,XX @@ static void spike_machine_init(MachineClass *mc)
294
mc->default_cpu_type = SPIKE_V1_10_0_CPU;
295
}
296
297
-DEFINE_MACHINE("spike_v1.9.1", spike_v1_09_1_machine_init)
298
-DEFINE_MACHINE("spike_v1.10", spike_v1_10_0_machine_init)
299
DEFINE_MACHINE("spike", spike_machine_init)
300
--
301
2.26.2
302
303
diff view generated by jsdifflib
Deleted patch
1
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2
Reviewed-by: Bin Meng <bin.meng@windriver.com>
3
---
4
docs/system/deprecated.rst | 33 ++++++++++++++++++---------------
5
target/riscv/cpu.h | 7 -------
6
target/riscv/cpu.c | 28 ----------------------------
7
tests/qtest/machine-none-test.c | 4 ++--
8
4 files changed, 20 insertions(+), 52 deletions(-)
9
1
10
diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst
11
index XXXXXXX..XXXXXXX 100644
12
--- a/docs/system/deprecated.rst
13
+++ b/docs/system/deprecated.rst
14
@@ -XXX,XX +XXX,XX @@ should be used instead of the 1.09.1 version.
15
System emulator CPUS
16
--------------------
17
18
-RISC-V ISA CPUs (since 4.1)
19
-'''''''''''''''''''''''''''
20
-
21
-The RISC-V cpus with the ISA version in the CPU name have been depcreated. The
22
-four CPUs are: ``rv32gcsu-v1.9.1``, ``rv32gcsu-v1.10.0``, ``rv64gcsu-v1.9.1`` and
23
-``rv64gcsu-v1.10.0``. Instead the version can be specified via the CPU ``priv_spec``
24
-option when using the ``rv32`` or ``rv64`` CPUs.
25
-
26
-RISC-V ISA CPUs (since 4.1)
27
-'''''''''''''''''''''''''''
28
-
29
-The RISC-V no MMU cpus have been depcreated. The two CPUs: ``rv32imacu-nommu`` and
30
-``rv64imacu-nommu`` should no longer be used. Instead the MMU status can be specified
31
-via the CPU ``mmu`` option when using the ``rv32`` or ``rv64`` CPUs.
32
-
33
``compat`` property of server class POWER CPUs (since 5.0)
34
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
35
36
@@ -XXX,XX +XXX,XX @@ The ``hub_id`` parameter of ``hostfwd_add`` / ``hostfwd_remove`` (removed in 5.0
37
The ``[hub_id name]`` parameter tuple of the 'hostfwd_add' and
38
'hostfwd_remove' HMP commands has been replaced by ``netdev_id``.
39
40
+System emulator CPUS
41
+--------------------
42
+
43
+RISC-V ISA Specific CPUs (removed in 5.1)
44
+'''''''''''''''''''''''''''''''''''''''''
45
+
46
+The RISC-V cpus with the ISA version in the CPU name have been removed. The
47
+four CPUs are: ``rv32gcsu-v1.9.1``, ``rv32gcsu-v1.10.0``, ``rv64gcsu-v1.9.1`` and
48
+``rv64gcsu-v1.10.0``. Instead the version can be specified via the CPU ``priv_spec``
49
+option when using the ``rv32`` or ``rv64`` CPUs.
50
+
51
+RISC-V no MMU CPUs (removed in 5.1)
52
+'''''''''''''''''''''''''''''''''''
53
+
54
+The RISC-V no MMU cpus have been removed. The two CPUs: ``rv32imacu-nommu`` and
55
+``rv64imacu-nommu`` can no longer be used. Instead the MMU status can be specified
56
+via the CPU ``mmu`` option when using the ``rv32`` or ``rv64`` CPUs.
57
+
58
System emulator machines
59
------------------------
60
61
diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
62
index XXXXXXX..XXXXXXX 100644
63
--- a/target/riscv/cpu.h
64
+++ b/target/riscv/cpu.h
65
@@ -XXX,XX +XXX,XX @@
66
#define TYPE_RISCV_CPU_SIFIVE_E51 RISCV_CPU_TYPE_NAME("sifive-e51")
67
#define TYPE_RISCV_CPU_SIFIVE_U34 RISCV_CPU_TYPE_NAME("sifive-u34")
68
#define TYPE_RISCV_CPU_SIFIVE_U54 RISCV_CPU_TYPE_NAME("sifive-u54")
69
-/* Deprecated */
70
-#define TYPE_RISCV_CPU_RV32IMACU_NOMMU RISCV_CPU_TYPE_NAME("rv32imacu-nommu")
71
-#define TYPE_RISCV_CPU_RV32GCSU_V1_09_1 RISCV_CPU_TYPE_NAME("rv32gcsu-v1.9.1")
72
-#define TYPE_RISCV_CPU_RV32GCSU_V1_10_0 RISCV_CPU_TYPE_NAME("rv32gcsu-v1.10.0")
73
-#define TYPE_RISCV_CPU_RV64IMACU_NOMMU RISCV_CPU_TYPE_NAME("rv64imacu-nommu")
74
-#define TYPE_RISCV_CPU_RV64GCSU_V1_09_1 RISCV_CPU_TYPE_NAME("rv64gcsu-v1.9.1")
75
-#define TYPE_RISCV_CPU_RV64GCSU_V1_10_0 RISCV_CPU_TYPE_NAME("rv64gcsu-v1.10.0")
76
77
#define RV32 ((target_ulong)1 << (TARGET_LONG_BITS - 2))
78
#define RV64 ((target_ulong)2 << (TARGET_LONG_BITS - 2))
79
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
80
index XXXXXXX..XXXXXXX 100644
81
--- a/target/riscv/cpu.c
82
+++ b/target/riscv/cpu.c
83
@@ -XXX,XX +XXX,XX @@ static void riscv_base32_cpu_init(Object *obj)
84
set_misa(env, 0);
85
}
86
87
-static void rv32gcsu_priv1_09_1_cpu_init(Object *obj)
88
-{
89
- CPURISCVState *env = &RISCV_CPU(obj)->env;
90
- set_misa(env, RV32 | RVI | RVM | RVA | RVF | RVD | RVC | RVS | RVU);
91
- set_priv_version(env, PRIV_VERSION_1_09_1);
92
- set_resetvec(env, DEFAULT_RSTVEC);
93
- set_feature(env, RISCV_FEATURE_MMU);
94
- set_feature(env, RISCV_FEATURE_PMP);
95
-}
96
-
97
static void rv32gcsu_priv1_10_0_cpu_init(Object *obj)
98
{
99
CPURISCVState *env = &RISCV_CPU(obj)->env;
100
@@ -XXX,XX +XXX,XX @@ static void riscv_base64_cpu_init(Object *obj)
101
set_misa(env, 0);
102
}
103
104
-static void rv64gcsu_priv1_09_1_cpu_init(Object *obj)
105
-{
106
- CPURISCVState *env = &RISCV_CPU(obj)->env;
107
- set_misa(env, RV64 | RVI | RVM | RVA | RVF | RVD | RVC | RVS | RVU);
108
- set_priv_version(env, PRIV_VERSION_1_09_1);
109
- set_resetvec(env, DEFAULT_RSTVEC);
110
- set_feature(env, RISCV_FEATURE_MMU);
111
- set_feature(env, RISCV_FEATURE_PMP);
112
-}
113
-
114
static void rv64gcsu_priv1_10_0_cpu_init(Object *obj)
115
{
116
CPURISCVState *env = &RISCV_CPU(obj)->env;
117
@@ -XXX,XX +XXX,XX @@ static const TypeInfo riscv_cpu_type_infos[] = {
118
DEFINE_CPU(TYPE_RISCV_CPU_SIFIVE_E31, rv32imacu_nommu_cpu_init),
119
DEFINE_CPU(TYPE_RISCV_CPU_SIFIVE_E34, rv32imafcu_nommu_cpu_init),
120
DEFINE_CPU(TYPE_RISCV_CPU_SIFIVE_U34, rv32gcsu_priv1_10_0_cpu_init),
121
- /* Depreacted */
122
- DEFINE_CPU(TYPE_RISCV_CPU_RV32IMACU_NOMMU, rv32imacu_nommu_cpu_init),
123
- DEFINE_CPU(TYPE_RISCV_CPU_RV32GCSU_V1_09_1, rv32gcsu_priv1_09_1_cpu_init),
124
- DEFINE_CPU(TYPE_RISCV_CPU_RV32GCSU_V1_10_0, rv32gcsu_priv1_10_0_cpu_init)
125
#elif defined(TARGET_RISCV64)
126
DEFINE_CPU(TYPE_RISCV_CPU_BASE64, riscv_base64_cpu_init),
127
DEFINE_CPU(TYPE_RISCV_CPU_SIFIVE_E51, rv64imacu_nommu_cpu_init),
128
DEFINE_CPU(TYPE_RISCV_CPU_SIFIVE_U54, rv64gcsu_priv1_10_0_cpu_init),
129
- /* Deprecated */
130
- DEFINE_CPU(TYPE_RISCV_CPU_RV64IMACU_NOMMU, rv64imacu_nommu_cpu_init),
131
- DEFINE_CPU(TYPE_RISCV_CPU_RV64GCSU_V1_09_1, rv64gcsu_priv1_09_1_cpu_init),
132
- DEFINE_CPU(TYPE_RISCV_CPU_RV64GCSU_V1_10_0, rv64gcsu_priv1_10_0_cpu_init)
133
#endif
134
};
135
136
diff --git a/tests/qtest/machine-none-test.c b/tests/qtest/machine-none-test.c
137
index XXXXXXX..XXXXXXX 100644
138
--- a/tests/qtest/machine-none-test.c
139
+++ b/tests/qtest/machine-none-test.c
140
@@ -XXX,XX +XXX,XX @@ static struct arch2cpu cpus_map[] = {
141
{ "xtensa", "dc233c" },
142
{ "xtensaeb", "fsf" },
143
{ "hppa", "hppa" },
144
- { "riscv64", "rv64gcsu-v1.10.0" },
145
- { "riscv32", "rv32gcsu-v1.9.1" },
146
+ { "riscv64", "rv64" },
147
+ { "riscv32", "rv32" },
148
{ "rx", "rx62n" },
149
};
150
151
--
152
2.26.2
153
154
diff view generated by jsdifflib
Deleted patch
1
The RISC-V ISA spec version 1.09.1 has been deprecated in QEMU since
2
4.1. It's not commonly used so let's remove support for it.
3
1
4
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
5
Reviewed-by: Bin Meng <bin.meng@windriver.com>
6
---
7
docs/system/deprecated.rst | 20 +--
8
target/riscv/cpu.h | 1 -
9
target/riscv/cpu.c | 2 -
10
target/riscv/cpu_helper.c | 82 ++++-------
11
target/riscv/csr.c | 138 ++++--------------
12
.../riscv/insn_trans/trans_privileged.inc.c | 18 +--
13
target/riscv/monitor.c | 5 -
14
target/riscv/op_helper.c | 17 +--
15
8 files changed, 73 insertions(+), 210 deletions(-)
16
17
diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst
18
index XXXXXXX..XXXXXXX 100644
19
--- a/docs/system/deprecated.rst
20
+++ b/docs/system/deprecated.rst
21
@@ -XXX,XX +XXX,XX @@ The ``acl_show``, ``acl_reset``, ``acl_policy``, ``acl_add``, and
22
``acl_remove`` commands are deprecated with no replacement. Authorization
23
for VNC should be performed using the pluggable QAuthZ objects.
24
25
-Guest Emulator ISAs
26
--------------------
27
-
28
-RISC-V ISA privledge specification version 1.09.1 (since 4.1)
29
-'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
30
-
31
-The RISC-V ISA privledge specification version 1.09.1 has been deprecated.
32
-QEMU supports both the newer version 1.10.0 and the ratified version 1.11.0, these
33
-should be used instead of the 1.09.1 version.
34
-
35
System emulator CPUS
36
--------------------
37
38
@@ -XXX,XX +XXX,XX @@ The ``hub_id`` parameter of ``hostfwd_add`` / ``hostfwd_remove`` (removed in 5.0
39
The ``[hub_id name]`` parameter tuple of the 'hostfwd_add' and
40
'hostfwd_remove' HMP commands has been replaced by ``netdev_id``.
41
42
+Guest Emulator ISAs
43
+-------------------
44
+
45
+RISC-V ISA privledge specification version 1.09.1 (removed in 5.1)
46
+''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
47
+
48
+The RISC-V ISA privledge specification version 1.09.1 has been removed.
49
+QEMU supports both the newer version 1.10.0 and the ratified version 1.11.0, these
50
+should be used instead of the 1.09.1 version.
51
+
52
System emulator CPUS
53
--------------------
54
55
diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
56
index XXXXXXX..XXXXXXX 100644
57
--- a/target/riscv/cpu.h
58
+++ b/target/riscv/cpu.h
59
@@ -XXX,XX +XXX,XX @@ enum {
60
RISCV_FEATURE_MISA
61
};
62
63
-#define PRIV_VERSION_1_09_1 0x00010901
64
#define PRIV_VERSION_1_10_0 0x00011000
65
#define PRIV_VERSION_1_11_0 0x00011100
66
67
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
68
index XXXXXXX..XXXXXXX 100644
69
--- a/target/riscv/cpu.c
70
+++ b/target/riscv/cpu.c
71
@@ -XXX,XX +XXX,XX @@ static void riscv_cpu_realize(DeviceState *dev, Error **errp)
72
priv_version = PRIV_VERSION_1_11_0;
73
} else if (!g_strcmp0(cpu->cfg.priv_spec, "v1.10.0")) {
74
priv_version = PRIV_VERSION_1_10_0;
75
- } else if (!g_strcmp0(cpu->cfg.priv_spec, "v1.9.1")) {
76
- priv_version = PRIV_VERSION_1_09_1;
77
} else {
78
error_setg(errp,
79
"Unsupported privilege spec version '%s'",
80
diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c
81
index XXXXXXX..XXXXXXX 100644
82
--- a/target/riscv/cpu_helper.c
83
+++ b/target/riscv/cpu_helper.c
84
@@ -XXX,XX +XXX,XX @@ static int get_physical_address(CPURISCVState *env, hwaddr *physical,
85
mxr = get_field(env->vsstatus, MSTATUS_MXR);
86
}
87
88
- if (env->priv_ver >= PRIV_VERSION_1_10_0) {
89
- if (first_stage == true) {
90
- if (use_background) {
91
- base = (hwaddr)get_field(env->vsatp, SATP_PPN) << PGSHIFT;
92
- vm = get_field(env->vsatp, SATP_MODE);
93
- } else {
94
- base = (hwaddr)get_field(env->satp, SATP_PPN) << PGSHIFT;
95
- vm = get_field(env->satp, SATP_MODE);
96
- }
97
- widened = 0;
98
+ if (first_stage == true) {
99
+ if (use_background) {
100
+ base = (hwaddr)get_field(env->vsatp, SATP_PPN) << PGSHIFT;
101
+ vm = get_field(env->vsatp, SATP_MODE);
102
} else {
103
- base = (hwaddr)get_field(env->hgatp, HGATP_PPN) << PGSHIFT;
104
- vm = get_field(env->hgatp, HGATP_MODE);
105
- widened = 2;
106
- }
107
- sum = get_field(env->mstatus, MSTATUS_SUM);
108
- switch (vm) {
109
- case VM_1_10_SV32:
110
- levels = 2; ptidxbits = 10; ptesize = 4; break;
111
- case VM_1_10_SV39:
112
- levels = 3; ptidxbits = 9; ptesize = 8; break;
113
- case VM_1_10_SV48:
114
- levels = 4; ptidxbits = 9; ptesize = 8; break;
115
- case VM_1_10_SV57:
116
- levels = 5; ptidxbits = 9; ptesize = 8; break;
117
- case VM_1_10_MBARE:
118
- *physical = addr;
119
- *prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
120
- return TRANSLATE_SUCCESS;
121
- default:
122
- g_assert_not_reached();
123
+ base = (hwaddr)get_field(env->satp, SATP_PPN) << PGSHIFT;
124
+ vm = get_field(env->satp, SATP_MODE);
125
}
126
- } else {
127
widened = 0;
128
- base = (hwaddr)(env->sptbr) << PGSHIFT;
129
- sum = !get_field(env->mstatus, MSTATUS_PUM);
130
- vm = get_field(env->mstatus, MSTATUS_VM);
131
- switch (vm) {
132
- case VM_1_09_SV32:
133
- levels = 2; ptidxbits = 10; ptesize = 4; break;
134
- case VM_1_09_SV39:
135
- levels = 3; ptidxbits = 9; ptesize = 8; break;
136
- case VM_1_09_SV48:
137
- levels = 4; ptidxbits = 9; ptesize = 8; break;
138
- case VM_1_09_MBARE:
139
- *physical = addr;
140
- *prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
141
- return TRANSLATE_SUCCESS;
142
- default:
143
- g_assert_not_reached();
144
- }
145
+ } else {
146
+ base = (hwaddr)get_field(env->hgatp, HGATP_PPN) << PGSHIFT;
147
+ vm = get_field(env->hgatp, HGATP_MODE);
148
+ widened = 2;
149
+ }
150
+ sum = get_field(env->mstatus, MSTATUS_SUM);
151
+ switch (vm) {
152
+ case VM_1_10_SV32:
153
+ levels = 2; ptidxbits = 10; ptesize = 4; break;
154
+ case VM_1_10_SV39:
155
+ levels = 3; ptidxbits = 9; ptesize = 8; break;
156
+ case VM_1_10_SV48:
157
+ levels = 4; ptidxbits = 9; ptesize = 8; break;
158
+ case VM_1_10_SV57:
159
+ levels = 5; ptidxbits = 9; ptesize = 8; break;
160
+ case VM_1_10_MBARE:
161
+ *physical = addr;
162
+ *prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
163
+ return TRANSLATE_SUCCESS;
164
+ default:
165
+ g_assert_not_reached();
166
}
167
168
CPUState *cs = env_cpu(env);
169
@@ -XXX,XX +XXX,XX @@ static void raise_mmu_exception(CPURISCVState *env, target_ulong address,
170
int page_fault_exceptions;
171
if (first_stage) {
172
page_fault_exceptions =
173
- (env->priv_ver >= PRIV_VERSION_1_10_0) &&
174
get_field(env->satp, SATP_MODE) != VM_1_10_MBARE &&
175
!pmp_violation;
176
} else {
177
@@ -XXX,XX +XXX,XX @@ void riscv_cpu_do_interrupt(CPUState *cs)
178
}
179
180
s = env->mstatus;
181
- s = set_field(s, MSTATUS_SPIE, env->priv_ver >= PRIV_VERSION_1_10_0 ?
182
- get_field(s, MSTATUS_SIE) : get_field(s, MSTATUS_UIE << env->priv));
183
+ s = set_field(s, MSTATUS_SPIE, get_field(s, MSTATUS_SIE));
184
s = set_field(s, MSTATUS_SPP, env->priv);
185
s = set_field(s, MSTATUS_SIE, 0);
186
env->mstatus = s;
187
@@ -XXX,XX +XXX,XX @@ void riscv_cpu_do_interrupt(CPUState *cs)
188
}
189
190
s = env->mstatus;
191
- s = set_field(s, MSTATUS_MPIE, env->priv_ver >= PRIV_VERSION_1_10_0 ?
192
- get_field(s, MSTATUS_MIE) : get_field(s, MSTATUS_UIE << env->priv));
193
+ s = set_field(s, MSTATUS_MPIE, get_field(s, MSTATUS_MIE));
194
s = set_field(s, MSTATUS_MPP, env->priv);
195
s = set_field(s, MSTATUS_MIE, 0);
196
env->mstatus = s;
197
diff --git a/target/riscv/csr.c b/target/riscv/csr.c
198
index XXXXXXX..XXXXXXX 100644
199
--- a/target/riscv/csr.c
200
+++ b/target/riscv/csr.c
201
@@ -XXX,XX +XXX,XX @@ static int ctr(CPURISCVState *env, int csrno)
202
#if !defined(CONFIG_USER_ONLY)
203
CPUState *cs = env_cpu(env);
204
RISCVCPU *cpu = RISCV_CPU(cs);
205
- uint32_t ctr_en = ~0u;
206
207
if (!cpu->cfg.ext_counters) {
208
/* The Counters extensions is not enabled */
209
return -1;
210
}
211
-
212
- /*
213
- * The counters are always enabled at run time on newer priv specs, as the
214
- * CSR has changed from controlling that the counters can be read to
215
- * controlling that the counters increment.
216
- */
217
- if (env->priv_ver > PRIV_VERSION_1_09_1) {
218
- return 0;
219
- }
220
-
221
- if (env->priv < PRV_M) {
222
- ctr_en &= env->mcounteren;
223
- }
224
- if (env->priv < PRV_S) {
225
- ctr_en &= env->scounteren;
226
- }
227
- if (!(ctr_en & (1u << (csrno & 31)))) {
228
- return -1;
229
- }
230
#endif
231
return 0;
232
}
233
@@ -XXX,XX +XXX,XX @@ static const target_ulong delegable_excps =
234
(1ULL << (RISCV_EXCP_INST_GUEST_PAGE_FAULT)) |
235
(1ULL << (RISCV_EXCP_LOAD_GUEST_ACCESS_FAULT)) |
236
(1ULL << (RISCV_EXCP_STORE_GUEST_AMO_ACCESS_FAULT));
237
-static const target_ulong sstatus_v1_9_mask = SSTATUS_SIE | SSTATUS_SPIE |
238
- SSTATUS_UIE | SSTATUS_UPIE | SSTATUS_SPP | SSTATUS_FS | SSTATUS_XS |
239
- SSTATUS_SUM | SSTATUS_SD;
240
static const target_ulong sstatus_v1_10_mask = SSTATUS_SIE | SSTATUS_SPIE |
241
SSTATUS_UIE | SSTATUS_UPIE | SSTATUS_SPP | SSTATUS_FS | SSTATUS_XS |
242
SSTATUS_SUM | SSTATUS_MXR | SSTATUS_SD;
243
@@ -XXX,XX +XXX,XX @@ static const target_ulong hip_writable_mask = MIP_VSSIP | MIP_VSTIP | MIP_VSEIP;
244
static const target_ulong vsip_writable_mask = MIP_VSSIP;
245
246
#if defined(TARGET_RISCV32)
247
-static const char valid_vm_1_09[16] = {
248
- [VM_1_09_MBARE] = 1,
249
- [VM_1_09_SV32] = 1,
250
-};
251
static const char valid_vm_1_10[16] = {
252
[VM_1_10_MBARE] = 1,
253
[VM_1_10_SV32] = 1
254
};
255
#elif defined(TARGET_RISCV64)
256
-static const char valid_vm_1_09[16] = {
257
- [VM_1_09_MBARE] = 1,
258
- [VM_1_09_SV39] = 1,
259
- [VM_1_09_SV48] = 1,
260
-};
261
static const char valid_vm_1_10[16] = {
262
[VM_1_10_MBARE] = 1,
263
[VM_1_10_SV39] = 1,
264
@@ -XXX,XX +XXX,XX @@ static int read_mstatus(CPURISCVState *env, int csrno, target_ulong *val)
265
266
static int validate_vm(CPURISCVState *env, target_ulong vm)
267
{
268
- return (env->priv_ver >= PRIV_VERSION_1_10_0) ?
269
- valid_vm_1_10[vm & 0xf] : valid_vm_1_09[vm & 0xf];
270
+ return valid_vm_1_10[vm & 0xf];
271
}
272
273
static int write_mstatus(CPURISCVState *env, int csrno, target_ulong val)
274
@@ -XXX,XX +XXX,XX @@ static int write_mstatus(CPURISCVState *env, int csrno, target_ulong val)
275
int dirty;
276
277
/* flush tlb on mstatus fields that affect VM */
278
- if (env->priv_ver <= PRIV_VERSION_1_09_1) {
279
- if ((val ^ mstatus) & (MSTATUS_MXR | MSTATUS_MPP |
280
- MSTATUS_MPRV | MSTATUS_SUM | MSTATUS_VM)) {
281
- tlb_flush(env_cpu(env));
282
- }
283
- mask = MSTATUS_SIE | MSTATUS_SPIE | MSTATUS_MIE | MSTATUS_MPIE |
284
- MSTATUS_SPP | MSTATUS_FS | MSTATUS_MPRV | MSTATUS_SUM |
285
- MSTATUS_MPP | MSTATUS_MXR |
286
- (validate_vm(env, get_field(val, MSTATUS_VM)) ?
287
- MSTATUS_VM : 0);
288
+ if ((val ^ mstatus) & (MSTATUS_MXR | MSTATUS_MPP | MSTATUS_MPV |
289
+ MSTATUS_MPRV | MSTATUS_SUM)) {
290
+ tlb_flush(env_cpu(env));
291
}
292
- if (env->priv_ver >= PRIV_VERSION_1_10_0) {
293
- if ((val ^ mstatus) & (MSTATUS_MXR | MSTATUS_MPP | MSTATUS_MPV |
294
- MSTATUS_MPRV | MSTATUS_SUM)) {
295
- tlb_flush(env_cpu(env));
296
- }
297
- mask = MSTATUS_SIE | MSTATUS_SPIE | MSTATUS_MIE | MSTATUS_MPIE |
298
- MSTATUS_SPP | MSTATUS_FS | MSTATUS_MPRV | MSTATUS_SUM |
299
- MSTATUS_MPP | MSTATUS_MXR | MSTATUS_TVM | MSTATUS_TSR |
300
- MSTATUS_TW;
301
+ mask = MSTATUS_SIE | MSTATUS_SPIE | MSTATUS_MIE | MSTATUS_MPIE |
302
+ MSTATUS_SPP | MSTATUS_FS | MSTATUS_MPRV | MSTATUS_SUM |
303
+ MSTATUS_MPP | MSTATUS_MXR | MSTATUS_TVM | MSTATUS_TSR |
304
+ MSTATUS_TW;
305
#if defined(TARGET_RISCV64)
306
- /*
307
- * RV32: MPV and MTL are not in mstatus. The current plan is to
308
- * add them to mstatush. For now, we just don't support it.
309
- */
310
- mask |= MSTATUS_MTL | MSTATUS_MPV;
311
+ /*
312
+ * RV32: MPV and MTL are not in mstatus. The current plan is to
313
+ * add them to mstatush. For now, we just don't support it.
314
+ */
315
+ mask |= MSTATUS_MTL | MSTATUS_MPV;
316
#endif
317
- }
318
319
mstatus = (mstatus & ~mask) | (val & mask);
320
321
@@ -XXX,XX +XXX,XX @@ static int write_mtvec(CPURISCVState *env, int csrno, target_ulong val)
322
323
static int read_mcounteren(CPURISCVState *env, int csrno, target_ulong *val)
324
{
325
- if (env->priv_ver < PRIV_VERSION_1_10_0) {
326
- return -1;
327
- }
328
*val = env->mcounteren;
329
return 0;
330
}
331
332
static int write_mcounteren(CPURISCVState *env, int csrno, target_ulong val)
333
{
334
- if (env->priv_ver < PRIV_VERSION_1_10_0) {
335
- return -1;
336
- }
337
env->mcounteren = val;
338
return 0;
339
}
340
@@ -XXX,XX +XXX,XX @@ static int write_mcounteren(CPURISCVState *env, int csrno, target_ulong val)
341
/* This regiser is replaced with CSR_MCOUNTINHIBIT in 1.11.0 */
342
static int read_mscounteren(CPURISCVState *env, int csrno, target_ulong *val)
343
{
344
- if (env->priv_ver > PRIV_VERSION_1_09_1
345
- && env->priv_ver < PRIV_VERSION_1_11_0) {
346
+ if (env->priv_ver < PRIV_VERSION_1_11_0) {
347
return -1;
348
}
349
*val = env->mcounteren;
350
@@ -XXX,XX +XXX,XX @@ static int read_mscounteren(CPURISCVState *env, int csrno, target_ulong *val)
351
/* This regiser is replaced with CSR_MCOUNTINHIBIT in 1.11.0 */
352
static int write_mscounteren(CPURISCVState *env, int csrno, target_ulong val)
353
{
354
- if (env->priv_ver > PRIV_VERSION_1_09_1
355
- && env->priv_ver < PRIV_VERSION_1_11_0) {
356
+ if (env->priv_ver < PRIV_VERSION_1_11_0) {
357
return -1;
358
}
359
env->mcounteren = val;
360
return 0;
361
}
362
363
-static int read_mucounteren(CPURISCVState *env, int csrno, target_ulong *val)
364
-{
365
- if (env->priv_ver > PRIV_VERSION_1_09_1) {
366
- return -1;
367
- }
368
- *val = env->scounteren;
369
- return 0;
370
-}
371
-
372
-static int write_mucounteren(CPURISCVState *env, int csrno, target_ulong val)
373
-{
374
- if (env->priv_ver > PRIV_VERSION_1_09_1) {
375
- return -1;
376
- }
377
- env->scounteren = val;
378
- return 0;
379
-}
380
-
381
/* Machine Trap Handling */
382
static int read_mscratch(CPURISCVState *env, int csrno, target_ulong *val)
383
{
384
@@ -XXX,XX +XXX,XX @@ static int rmw_mip(CPURISCVState *env, int csrno, target_ulong *ret_value,
385
/* Supervisor Trap Setup */
386
static int read_sstatus(CPURISCVState *env, int csrno, target_ulong *val)
387
{
388
- target_ulong mask = ((env->priv_ver >= PRIV_VERSION_1_10_0) ?
389
- sstatus_v1_10_mask : sstatus_v1_9_mask);
390
+ target_ulong mask = (sstatus_v1_10_mask);
391
*val = env->mstatus & mask;
392
return 0;
393
}
394
395
static int write_sstatus(CPURISCVState *env, int csrno, target_ulong val)
396
{
397
- target_ulong mask = ((env->priv_ver >= PRIV_VERSION_1_10_0) ?
398
- sstatus_v1_10_mask : sstatus_v1_9_mask);
399
+ target_ulong mask = (sstatus_v1_10_mask);
400
target_ulong newval = (env->mstatus & ~mask) | (val & mask);
401
return write_mstatus(env, CSR_MSTATUS, newval);
402
}
403
@@ -XXX,XX +XXX,XX @@ static int write_stvec(CPURISCVState *env, int csrno, target_ulong val)
404
405
static int read_scounteren(CPURISCVState *env, int csrno, target_ulong *val)
406
{
407
- if (env->priv_ver < PRIV_VERSION_1_10_0) {
408
- return -1;
409
- }
410
*val = env->scounteren;
411
return 0;
412
}
413
414
static int write_scounteren(CPURISCVState *env, int csrno, target_ulong val)
415
{
416
- if (env->priv_ver < PRIV_VERSION_1_10_0) {
417
- return -1;
418
- }
419
env->scounteren = val;
420
return 0;
421
}
422
@@ -XXX,XX +XXX,XX @@ static int read_satp(CPURISCVState *env, int csrno, target_ulong *val)
423
{
424
if (!riscv_feature(env, RISCV_FEATURE_MMU)) {
425
*val = 0;
426
- } else if (env->priv_ver >= PRIV_VERSION_1_10_0) {
427
- if (env->priv == PRV_S && get_field(env->mstatus, MSTATUS_TVM)) {
428
- return -1;
429
- } else {
430
- *val = env->satp;
431
- }
432
+ return 0;
433
+ }
434
+
435
+ if (env->priv == PRV_S && get_field(env->mstatus, MSTATUS_TVM)) {
436
+ return -1;
437
} else {
438
- *val = env->sptbr;
439
+ *val = env->satp;
440
}
441
+
442
return 0;
443
}
444
445
@@ -XXX,XX +XXX,XX @@ static int write_satp(CPURISCVState *env, int csrno, target_ulong val)
446
if (!riscv_feature(env, RISCV_FEATURE_MMU)) {
447
return 0;
448
}
449
- if (env->priv_ver <= PRIV_VERSION_1_09_1 && (val ^ env->sptbr)) {
450
- tlb_flush(env_cpu(env));
451
- env->sptbr = val & (((target_ulong)
452
- 1 << (TARGET_PHYS_ADDR_SPACE_BITS - PGSHIFT)) - 1);
453
- }
454
- if (env->priv_ver >= PRIV_VERSION_1_10_0 &&
455
- validate_vm(env, get_field(val, SATP_MODE)) &&
456
+ if (validate_vm(env, get_field(val, SATP_MODE)) &&
457
((val ^ env->satp) & (SATP_MODE | SATP_ASID | SATP_PPN)))
458
{
459
if (env->priv == PRV_S && get_field(env->mstatus, MSTATUS_TVM)) {
460
@@ -XXX,XX +XXX,XX @@ static riscv_csr_operations csr_ops[CSR_TABLE_SIZE] = {
461
[CSR_MSTATUSH] = { any, read_mstatush, write_mstatush },
462
#endif
463
464
- /* Legacy Counter Setup (priv v1.9.1) */
465
- [CSR_MUCOUNTEREN] = { any, read_mucounteren, write_mucounteren },
466
[CSR_MSCOUNTEREN] = { any, read_mscounteren, write_mscounteren },
467
468
/* Machine Trap Handling */
469
diff --git a/target/riscv/insn_trans/trans_privileged.inc.c b/target/riscv/insn_trans/trans_privileged.inc.c
470
index XXXXXXX..XXXXXXX 100644
471
--- a/target/riscv/insn_trans/trans_privileged.inc.c
472
+++ b/target/riscv/insn_trans/trans_privileged.inc.c
473
@@ -XXX,XX +XXX,XX @@ static bool trans_wfi(DisasContext *ctx, arg_wfi *a)
474
static bool trans_sfence_vma(DisasContext *ctx, arg_sfence_vma *a)
475
{
476
#ifndef CONFIG_USER_ONLY
477
- if (ctx->priv_ver >= PRIV_VERSION_1_10_0) {
478
- gen_helper_tlb_flush(cpu_env);
479
- return true;
480
- }
481
+ gen_helper_tlb_flush(cpu_env);
482
+ return true;
483
#endif
484
return false;
485
}
486
487
static bool trans_sfence_vm(DisasContext *ctx, arg_sfence_vm *a)
488
{
489
-#ifndef CONFIG_USER_ONLY
490
- if (ctx->priv_ver <= PRIV_VERSION_1_09_1) {
491
- gen_helper_tlb_flush(cpu_env);
492
- return true;
493
- }
494
-#endif
495
return false;
496
}
497
498
static bool trans_hfence_gvma(DisasContext *ctx, arg_sfence_vma *a)
499
{
500
#ifndef CONFIG_USER_ONLY
501
- if (ctx->priv_ver >= PRIV_VERSION_1_10_0 &&
502
- has_ext(ctx, RVH)) {
503
+ if (has_ext(ctx, RVH)) {
504
/* Hpervisor extensions exist */
505
/*
506
* if (env->priv == PRV_M ||
507
@@ -XXX,XX +XXX,XX @@ static bool trans_hfence_gvma(DisasContext *ctx, arg_sfence_vma *a)
508
static bool trans_hfence_bvma(DisasContext *ctx, arg_sfence_vma *a)
509
{
510
#ifndef CONFIG_USER_ONLY
511
- if (ctx->priv_ver >= PRIV_VERSION_1_10_0 &&
512
- has_ext(ctx, RVH)) {
513
+ if (has_ext(ctx, RVH)) {
514
/* Hpervisor extensions exist */
515
/*
516
* if (env->priv == PRV_M ||
517
diff --git a/target/riscv/monitor.c b/target/riscv/monitor.c
518
index XXXXXXX..XXXXXXX 100644
519
--- a/target/riscv/monitor.c
520
+++ b/target/riscv/monitor.c
521
@@ -XXX,XX +XXX,XX @@ void hmp_info_mem(Monitor *mon, const QDict *qdict)
522
return;
523
}
524
525
- if (env->priv_ver < PRIV_VERSION_1_10_0) {
526
- monitor_printf(mon, "Privileged mode < 1.10 unsupported\n");
527
- return;
528
- }
529
-
530
if (!(env->satp & SATP_MODE)) {
531
monitor_printf(mon, "No translation or protection\n");
532
return;
533
diff --git a/target/riscv/op_helper.c b/target/riscv/op_helper.c
534
index XXXXXXX..XXXXXXX 100644
535
--- a/target/riscv/op_helper.c
536
+++ b/target/riscv/op_helper.c
537
@@ -XXX,XX +XXX,XX @@ target_ulong helper_sret(CPURISCVState *env, target_ulong cpu_pc_deb)
538
riscv_raise_exception(env, RISCV_EXCP_INST_ADDR_MIS, GETPC());
539
}
540
541
- if (env->priv_ver >= PRIV_VERSION_1_10_0 &&
542
- get_field(env->mstatus, MSTATUS_TSR) && !(env->priv >= PRV_M)) {
543
+ if (get_field(env->mstatus, MSTATUS_TSR) && !(env->priv >= PRV_M)) {
544
riscv_raise_exception(env, RISCV_EXCP_ILLEGAL_INST, GETPC());
545
}
546
547
@@ -XXX,XX +XXX,XX @@ target_ulong helper_sret(CPURISCVState *env, target_ulong cpu_pc_deb)
548
} else {
549
prev_priv = get_field(mstatus, MSTATUS_SPP);
550
551
- mstatus = set_field(mstatus,
552
- env->priv_ver >= PRIV_VERSION_1_10_0 ?
553
- MSTATUS_SIE : MSTATUS_UIE << prev_priv,
554
- get_field(mstatus, MSTATUS_SPIE));
555
+ mstatus = set_field(mstatus, MSTATUS_SIE,
556
+ get_field(mstatus, MSTATUS_SPIE));
557
mstatus = set_field(mstatus, MSTATUS_SPIE, 1);
558
mstatus = set_field(mstatus, MSTATUS_SPP, PRV_U);
559
env->mstatus = mstatus;
560
@@ -XXX,XX +XXX,XX @@ target_ulong helper_mret(CPURISCVState *env, target_ulong cpu_pc_deb)
561
target_ulong mstatus = env->mstatus;
562
target_ulong prev_priv = get_field(mstatus, MSTATUS_MPP);
563
target_ulong prev_virt = MSTATUS_MPV_ISSET(env);
564
- mstatus = set_field(mstatus,
565
- env->priv_ver >= PRIV_VERSION_1_10_0 ?
566
- MSTATUS_MIE : MSTATUS_UIE << prev_priv,
567
- get_field(mstatus, MSTATUS_MPIE));
568
+ mstatus = set_field(mstatus, MSTATUS_MIE,
569
+ get_field(mstatus, MSTATUS_MPIE));
570
mstatus = set_field(mstatus, MSTATUS_MPIE, 1);
571
mstatus = set_field(mstatus, MSTATUS_MPP, PRV_U);
572
#ifdef TARGET_RISCV32
573
@@ -XXX,XX +XXX,XX @@ void helper_wfi(CPURISCVState *env)
574
CPUState *cs = env_cpu(env);
575
576
if ((env->priv == PRV_S &&
577
- env->priv_ver >= PRIV_VERSION_1_10_0 &&
578
get_field(env->mstatus, MSTATUS_TW)) ||
579
riscv_cpu_virt_enabled(env)) {
580
riscv_raise_exception(env, RISCV_EXCP_ILLEGAL_INST, GETPC());
581
@@ -XXX,XX +XXX,XX @@ void helper_tlb_flush(CPURISCVState *env)
582
CPUState *cs = env_cpu(env);
583
if (!(env->priv >= PRV_S) ||
584
(env->priv == PRV_S &&
585
- env->priv_ver >= PRIV_VERSION_1_10_0 &&
586
get_field(env->mstatus, MSTATUS_TVM))) {
587
riscv_raise_exception(env, RISCV_EXCP_ILLEGAL_INST, GETPC());
588
} else {
589
--
590
2.26.2
591
592
diff view generated by jsdifflib
Deleted patch
1
Update the -bios deprecation documentation to describe the new
2
behaviour.
3
1
4
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
5
Reviewed-by: Bin Meng <bin.meng@windriver.com>
6
---
7
docs/system/deprecated.rst | 28 +++++++++++++---------------
8
1 file changed, 13 insertions(+), 15 deletions(-)
9
10
diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst
11
index XXXXXXX..XXXXXXX 100644
12
--- a/docs/system/deprecated.rst
13
+++ b/docs/system/deprecated.rst
14
@@ -XXX,XX +XXX,XX @@ the backing storage specified with ``-mem-path`` can actually provide
15
the guest RAM configured with ``-m`` and QEMU will fail to start up if
16
RAM allocation is unsuccessful.
17
18
-RISC-V ``-bios`` (since 4.1)
19
+RISC-V ``-bios`` (since 5.1)
20
''''''''''''''''''''''''''''
21
22
QEMU 4.1 introduced support for the -bios option in QEMU for RISC-V for the
23
-RISC-V virt machine and sifive_u machine.
24
-
25
-QEMU 4.1 has no changes to the default behaviour to avoid breakages. This
26
-default will change in a future QEMU release, so please prepare now. All users
27
-of the virt or sifive_u machine must change their command line usage.
28
-
29
-QEMU 4.1 has three options, please migrate to one of these three:
30
- 1. ``-bios none`` - This is the current default behavior if no -bios option
31
- is included. QEMU will not automatically load any firmware. It is up
32
+RISC-V virt machine and sifive_u machine. QEMU 4.1 had no changes to the
33
+default behaviour to avoid breakages.
34
+
35
+QEMU 5.1 changes the default behaviour from ``-bios none`` to ``-bios default``.
36
+
37
+QEMU 5.1 has three options:
38
+ 1. ``-bios default`` - This is the current default behavior if no -bios option
39
+ is included. This option will load the default OpenSBI firmware automatically.
40
+ The firmware is included with the QEMU release and no user interaction is
41
+ required. All a user needs to do is specify the kernel they want to boot
42
+ with the -kernel option
43
+ 2. ``-bios none`` - QEMU will not automatically load any firmware. It is up
44
to the user to load all the images they need.
45
- 2. ``-bios default`` - In a future QEMU release this will become the default
46
- behaviour if no -bios option is specified. This option will load the
47
- default OpenSBI firmware automatically. The firmware is included with
48
- the QEMU release and no user interaction is required. All a user needs
49
- to do is specify the kernel they want to boot with the -kernel option
50
3. ``-bios <file>`` - Tells QEMU to load the specified file as the firmwrae.
51
52
``-tb-size`` option (since 5.0)
53
--
54
2.26.2
55
56
diff view generated by jsdifflib
Deleted patch
1
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2
Reviewed-by: Palmer Dabbelt <palmerdabbelt@google.com>
3
---
4
include/hw/riscv/sifive_e.h | 4 ++++
5
hw/riscv/sifive_e.c | 41 +++++++++++++++++++++++++++----------
6
2 files changed, 34 insertions(+), 11 deletions(-)
7
1
8
diff --git a/include/hw/riscv/sifive_e.h b/include/hw/riscv/sifive_e.h
9
index XXXXXXX..XXXXXXX 100644
10
--- a/include/hw/riscv/sifive_e.h
11
+++ b/include/hw/riscv/sifive_e.h
12
@@ -XXX,XX +XXX,XX @@ typedef struct SiFiveEState {
13
SiFiveESoCState soc;
14
} SiFiveEState;
15
16
+#define TYPE_RISCV_E_MACHINE MACHINE_TYPE_NAME("sifive_e")
17
+#define RISCV_E_MACHINE(obj) \
18
+ OBJECT_CHECK(SiFiveEState, (obj), TYPE_RISCV_E_MACHINE)
19
+
20
enum {
21
SIFIVE_E_DEBUG,
22
SIFIVE_E_MROM,
23
diff --git a/hw/riscv/sifive_e.c b/hw/riscv/sifive_e.c
24
index XXXXXXX..XXXXXXX 100644
25
--- a/hw/riscv/sifive_e.c
26
+++ b/hw/riscv/sifive_e.c
27
@@ -XXX,XX +XXX,XX @@ static void riscv_sifive_e_init(MachineState *machine)
28
{
29
const struct MemmapEntry *memmap = sifive_e_memmap;
30
31
- SiFiveEState *s = g_new0(SiFiveEState, 1);
32
+ SiFiveEState *s = RISCV_E_MACHINE(machine);
33
MemoryRegion *sys_mem = get_system_memory();
34
MemoryRegion *main_mem = g_new(MemoryRegion, 1);
35
int i;
36
@@ -XXX,XX +XXX,XX @@ static void riscv_sifive_e_init(MachineState *machine)
37
}
38
}
39
40
+static void sifive_e_machine_instance_init(Object *obj)
41
+{
42
+}
43
+
44
+static void sifive_e_machine_class_init(ObjectClass *oc, void *data)
45
+{
46
+ MachineClass *mc = MACHINE_CLASS(oc);
47
+
48
+ mc->desc = "RISC-V Board compatible with SiFive E SDK";
49
+ mc->init = riscv_sifive_e_init;
50
+ mc->max_cpus = 1;
51
+ mc->default_cpu_type = SIFIVE_E_CPU;
52
+}
53
+
54
+static const TypeInfo sifive_e_machine_typeinfo = {
55
+ .name = MACHINE_TYPE_NAME("sifive_e"),
56
+ .parent = TYPE_MACHINE,
57
+ .class_init = sifive_e_machine_class_init,
58
+ .instance_init = sifive_e_machine_instance_init,
59
+ .instance_size = sizeof(SiFiveEState),
60
+};
61
+
62
+static void sifive_e_machine_init_register_types(void)
63
+{
64
+ type_register_static(&sifive_e_machine_typeinfo);
65
+}
66
+
67
+type_init(sifive_e_machine_init_register_types)
68
+
69
static void riscv_sifive_e_soc_init(Object *obj)
70
{
71
MachineState *ms = MACHINE(qdev_get_machine());
72
@@ -XXX,XX +XXX,XX @@ static void riscv_sifive_e_soc_realize(DeviceState *dev, Error **errp)
73
&s->xip_mem);
74
}
75
76
-static void riscv_sifive_e_machine_init(MachineClass *mc)
77
-{
78
- mc->desc = "RISC-V Board compatible with SiFive E SDK";
79
- mc->init = riscv_sifive_e_init;
80
- mc->max_cpus = 1;
81
- mc->default_cpu_type = SIFIVE_E_CPU;
82
-}
83
-
84
-DEFINE_MACHINE("sifive_e", riscv_sifive_e_machine_init)
85
-
86
static void riscv_sifive_e_soc_class_init(ObjectClass *oc, void *data)
87
{
88
DeviceClass *dc = DEVICE_CLASS(oc);
89
--
90
2.26.2
91
92
diff view generated by jsdifflib