1
From: Alistair Francis <alistair.francis@wdc.com>
1
From: Alistair Francis <alistair.francis@wdc.com>
2
2
3
The following changes since commit 8d5fcb1990bc64b62c0bc12121fe510940be5664:
3
The following changes since commit c5fbdd60cf1fb52f01bdfe342b6fa65d5343e1b1:
4
4
5
Merge tag 'python-pull-request' of https://gitlab.com/jsnow/qemu into staging (2021-11-17 07:41:08 +0100)
5
Merge tag 'qemu-sparc-20211121' of git://github.com/mcayland/qemu into staging (2021-11-21 14:12:25 +0100)
6
6
7
are available in the Git repository at:
7
are available in the Git repository at:
8
8
9
git@github.com:alistair23/qemu.git tags/pull-riscv-to-apply-20211117-1
9
git@github.com:alistair23/qemu.git tags/pull-riscv-to-apply-20211122
10
10
11
for you to fetch changes up to c94c239496256f1f1cb589825d052c2f3e26ebf6:
11
for you to fetch changes up to 526e7443027c71fe7b04c29df529e1f9f425f9e3:
12
12
13
meson.build: Merge riscv32 and riscv64 cpu family (2021-11-17 19:18:22 +1000)
13
hw/misc/sifive_u_otp: Do not reset OTP content on hardware reset (2021-11-22 10:46:22 +1000)
14
14
15
----------------------------------------------------------------
15
----------------------------------------------------------------
16
Sixth RISC-V PR for QEMU 6.2
16
Seventh RISC-V PR for QEMU 6.2
17
17
18
- Fix build for riscv hosts
18
- Deprecate IF_NONE for SiFive OTP
19
- Soft code alphabetically
19
- Don't reset SiFive OTP content
20
20
21
----------------------------------------------------------------
21
----------------------------------------------------------------
22
Bin Meng (1):
22
Philippe Mathieu-Daudé (1):
23
target/riscv: machine: Sort the .subsections
23
hw/misc/sifive_u_otp: Do not reset OTP content on hardware reset
24
24
25
Richard Henderson (1):
25
Thomas Huth (1):
26
meson.build: Merge riscv32 and riscv64 cpu family
26
hw/misc/sifive_u_otp: Use IF_PFLASH for the OTP device instead of IF_NONE
27
27
28
meson.build | 6 ++++
28
docs/about/deprecated.rst | 6 ++++++
29
target/riscv/machine.c | 92 +++++++++++++++++++++++++-------------------------
29
hw/misc/sifive_u_otp.c | 22 +++++++++++++---------
30
2 files changed, 52 insertions(+), 46 deletions(-)
30
2 files changed, 19 insertions(+), 9 deletions(-)
31
31
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Thomas Huth <thuth@redhat.com>
2
2
3
In ba0e73336200, we merged riscv32 and riscv64 in configure.
3
Configuring a drive with "if=none" is meant for creation of a backend
4
However, meson does not treat them the same. We need to merge
4
only, it should not get automatically assigned to a device frontend.
5
them here as well.
5
Use "if=pflash" for the One-Time-Programmable device instead (like
6
it is e.g. also done for the efuse device in hw/arm/xlnx-zcu102.c).
6
7
7
Fixes: ba0e73336200
8
Since the old way of configuring the device has already been published
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
with the previous QEMU versions, we cannot remove this immediately, but
9
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
10
have to deprecate it and support it for at least two more releases.
11
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>
10
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
15
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
11
Message-id: 20211116095042.335224-1-richard.henderson@linaro.org
16
Message-id: 20211119102549.217755-1-thuth@redhat.com
12
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
17
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
13
---
18
---
14
meson.build | 6 ++++++
19
docs/about/deprecated.rst | 6 ++++++
15
1 file changed, 6 insertions(+)
20
hw/misc/sifive_u_otp.c | 9 ++++++++-
21
2 files changed, 14 insertions(+), 1 deletion(-)
16
22
17
diff --git a/meson.build b/meson.build
23
diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
18
index XXXXXXX..XXXXXXX 100644
24
index XXXXXXX..XXXXXXX 100644
19
--- a/meson.build
25
--- a/docs/about/deprecated.rst
20
+++ b/meson.build
26
+++ b/docs/about/deprecated.rst
21
@@ -XXX,XX +XXX,XX @@ supported_cpus = ['ppc', 'ppc64', 's390x', 'riscv', 'x86', 'x86_64',
27
@@ -XXX,XX +XXX,XX @@ as short-form boolean values, and passed to plugins as ``arg_name=on``.
22
'arm', 'aarch64', 'mips', 'mips64', 'sparc', 'sparc64']
28
However, short-form booleans are deprecated and full explicit ``arg_name=on``
23
29
form is preferred.
24
cpu = host_machine.cpu_family()
30
31
+``-drive if=none`` for the sifive_u OTP device (since 6.2)
32
+''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
25
+
33
+
26
+# Unify riscv* to a single family.
34
+Using ``-drive if=none`` to configure the OTP device of the sifive_u
27
+if cpu in ['riscv32', 'riscv64']
35
+RISC-V machine is deprecated. Use ``-drive if=pflash`` instead.
28
+ cpu = 'riscv'
29
+endif
30
+
36
+
31
targetos = host_machine.system()
37
32
38
QEMU Machine Protocol (QMP) commands
33
if cpu in ['x86', 'x86_64']
39
------------------------------------
40
diff --git a/hw/misc/sifive_u_otp.c b/hw/misc/sifive_u_otp.c
41
index XXXXXXX..XXXXXXX 100644
42
--- a/hw/misc/sifive_u_otp.c
43
+++ b/hw/misc/sifive_u_otp.c
44
@@ -XXX,XX +XXX,XX @@ static void sifive_u_otp_realize(DeviceState *dev, Error **errp)
45
TYPE_SIFIVE_U_OTP, SIFIVE_U_OTP_REG_SIZE);
46
sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->mmio);
47
48
- dinfo = drive_get_next(IF_NONE);
49
+ dinfo = drive_get_next(IF_PFLASH);
50
+ if (!dinfo) {
51
+ dinfo = drive_get_next(IF_NONE);
52
+ if (dinfo) {
53
+ warn_report("using \"-drive if=none\" for the OTP is deprecated, "
54
+ "use \"-drive if=pflash\" instead.");
55
+ }
56
+ }
57
if (dinfo) {
58
int ret;
59
uint64_t perm;
34
--
60
--
35
2.31.1
61
2.31.1
36
62
37
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
Move the codes around so that the order of .subsections matches
3
Once a "One Time Programmable" is programmed, it shouldn't be reset.
4
the one they are referenced in vmstate_riscv_cpu.
5
4
6
Signed-off-by: Bin Meng <bin.meng@windriver.com>
5
Do not re-initialize the OTP content in the DeviceReset handler,
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>
7
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
10
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
8
Message-id: 20211030030606.32297-1-bmeng.cn@gmail.com
11
Message-Id: <20211119104757.331579-1-f4bug@amsat.org>
9
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
12
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
10
---
13
---
11
target/riscv/machine.c | 92 +++++++++++++++++++++---------------------
14
hw/misc/sifive_u_otp.c | 13 +++++--------
12
1 file changed, 46 insertions(+), 46 deletions(-)
15
1 file changed, 5 insertions(+), 8 deletions(-)
13
16
14
diff --git a/target/riscv/machine.c b/target/riscv/machine.c
17
diff --git a/hw/misc/sifive_u_otp.c b/hw/misc/sifive_u_otp.c
15
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
16
--- a/target/riscv/machine.c
19
--- a/hw/misc/sifive_u_otp.c
17
+++ b/target/riscv/machine.c
20
+++ b/hw/misc/sifive_u_otp.c
18
@@ -XXX,XX +XXX,XX @@ static bool hyper_needed(void *opaque)
21
@@ -XXX,XX +XXX,XX @@ static void sifive_u_otp_realize(DeviceState *dev, Error **errp)
19
return riscv_has_ext(env, RVH);
22
23
if (blk_pread(s->blk, 0, s->fuse, filesize) != filesize) {
24
error_setg(errp, "failed to read the initial flash content");
25
+ return;
26
}
27
}
28
}
29
-}
30
-
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;
20
}
60
}
21
61
22
-static bool vector_needed(void *opaque)
62
static const TypeInfo sifive_u_otp_info = {
23
-{
24
- RISCVCPU *cpu = opaque;
25
- CPURISCVState *env = &cpu->env;
26
+static const VMStateDescription vmstate_hyper = {
27
+ .name = "cpu/hyper",
28
+ .version_id = 1,
29
+ .minimum_version_id = 1,
30
+ .needed = hyper_needed,
31
+ .fields = (VMStateField[]) {
32
+ VMSTATE_UINTTL(env.hstatus, RISCVCPU),
33
+ VMSTATE_UINTTL(env.hedeleg, RISCVCPU),
34
+ VMSTATE_UINTTL(env.hideleg, RISCVCPU),
35
+ VMSTATE_UINTTL(env.hcounteren, RISCVCPU),
36
+ VMSTATE_UINTTL(env.htval, RISCVCPU),
37
+ VMSTATE_UINTTL(env.htinst, RISCVCPU),
38
+ VMSTATE_UINTTL(env.hgatp, RISCVCPU),
39
+ VMSTATE_UINT64(env.htimedelta, RISCVCPU),
40
41
- return riscv_has_ext(env, RVV);
42
-}
43
+ VMSTATE_UINT64(env.vsstatus, RISCVCPU),
44
+ VMSTATE_UINTTL(env.vstvec, RISCVCPU),
45
+ VMSTATE_UINTTL(env.vsscratch, RISCVCPU),
46
+ VMSTATE_UINTTL(env.vsepc, RISCVCPU),
47
+ VMSTATE_UINTTL(env.vscause, RISCVCPU),
48
+ VMSTATE_UINTTL(env.vstval, RISCVCPU),
49
+ VMSTATE_UINTTL(env.vsatp, RISCVCPU),
50
51
-static bool pointermasking_needed(void *opaque)
52
+ VMSTATE_UINTTL(env.mtval2, RISCVCPU),
53
+ VMSTATE_UINTTL(env.mtinst, RISCVCPU),
54
+
55
+ VMSTATE_UINTTL(env.stvec_hs, RISCVCPU),
56
+ VMSTATE_UINTTL(env.sscratch_hs, RISCVCPU),
57
+ VMSTATE_UINTTL(env.sepc_hs, RISCVCPU),
58
+ VMSTATE_UINTTL(env.scause_hs, RISCVCPU),
59
+ VMSTATE_UINTTL(env.stval_hs, RISCVCPU),
60
+ VMSTATE_UINTTL(env.satp_hs, RISCVCPU),
61
+ VMSTATE_UINT64(env.mstatus_hs, RISCVCPU),
62
+
63
+ VMSTATE_END_OF_LIST()
64
+ }
65
+};
66
+
67
+static bool vector_needed(void *opaque)
68
{
69
RISCVCPU *cpu = opaque;
70
CPURISCVState *env = &cpu->env;
71
72
- return riscv_has_ext(env, RVJ);
73
+ return riscv_has_ext(env, RVV);
74
}
75
76
static const VMStateDescription vmstate_vector = {
77
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_vector = {
78
}
79
};
80
81
+static bool pointermasking_needed(void *opaque)
82
+{
83
+ RISCVCPU *cpu = opaque;
84
+ CPURISCVState *env = &cpu->env;
85
+
86
+ return riscv_has_ext(env, RVJ);
87
+}
88
+
89
static const VMStateDescription vmstate_pointermasking = {
90
.name = "cpu/pointer_masking",
91
.version_id = 1,
92
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_pointermasking = {
93
}
94
};
95
96
-static const VMStateDescription vmstate_hyper = {
97
- .name = "cpu/hyper",
98
- .version_id = 1,
99
- .minimum_version_id = 1,
100
- .needed = hyper_needed,
101
- .fields = (VMStateField[]) {
102
- VMSTATE_UINTTL(env.hstatus, RISCVCPU),
103
- VMSTATE_UINTTL(env.hedeleg, RISCVCPU),
104
- VMSTATE_UINTTL(env.hideleg, RISCVCPU),
105
- VMSTATE_UINTTL(env.hcounteren, RISCVCPU),
106
- VMSTATE_UINTTL(env.htval, RISCVCPU),
107
- VMSTATE_UINTTL(env.htinst, RISCVCPU),
108
- VMSTATE_UINTTL(env.hgatp, RISCVCPU),
109
- VMSTATE_UINT64(env.htimedelta, RISCVCPU),
110
-
111
- VMSTATE_UINT64(env.vsstatus, RISCVCPU),
112
- VMSTATE_UINTTL(env.vstvec, RISCVCPU),
113
- VMSTATE_UINTTL(env.vsscratch, RISCVCPU),
114
- VMSTATE_UINTTL(env.vsepc, RISCVCPU),
115
- VMSTATE_UINTTL(env.vscause, RISCVCPU),
116
- VMSTATE_UINTTL(env.vstval, RISCVCPU),
117
- VMSTATE_UINTTL(env.vsatp, RISCVCPU),
118
-
119
- VMSTATE_UINTTL(env.mtval2, RISCVCPU),
120
- VMSTATE_UINTTL(env.mtinst, RISCVCPU),
121
-
122
- VMSTATE_UINTTL(env.stvec_hs, RISCVCPU),
123
- VMSTATE_UINTTL(env.sscratch_hs, RISCVCPU),
124
- VMSTATE_UINTTL(env.sepc_hs, RISCVCPU),
125
- VMSTATE_UINTTL(env.scause_hs, RISCVCPU),
126
- VMSTATE_UINTTL(env.stval_hs, RISCVCPU),
127
- VMSTATE_UINTTL(env.satp_hs, RISCVCPU),
128
- VMSTATE_UINT64(env.mstatus_hs, RISCVCPU),
129
-
130
- VMSTATE_END_OF_LIST()
131
- }
132
-};
133
-
134
const VMStateDescription vmstate_riscv_cpu = {
135
.name = "cpu",
136
.version_id = 3,
137
--
63
--
138
2.31.1
64
2.31.1
139
65
140
66
diff view generated by jsdifflib