1
The following changes since commit 5ececc3a0b0086c6168e12f4d032809477b30fe5:
1
From: Alistair Francis <alistair.francis@wdc.com>
2
2
3
Merge remote-tracking branch 'remotes/dgilbert/tags/pull-hmp-20201113' into staging (2020-11-13 13:40:23 +0000)
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-20201113-1
9
git@github.com:alistair23/qemu.git tags/pull-riscv-to-apply-20211122
8
10
9
for you to fetch changes up to deef3d2568a7fbaa62d9bee07708cf3a4dc3ac53:
11
for you to fetch changes up to 526e7443027c71fe7b04c29df529e1f9f425f9e3:
10
12
11
intc/ibex_plic: Ensure we don't loose interrupts (2020-11-13 21:43:48 -0800)
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
Two small additional fixes for the Ibex PLIC.
16
Seventh RISC-V PR for QEMU 6.2
17
18
- Deprecate IF_NONE for SiFive OTP
19
- Don't reset SiFive OTP content
15
20
16
----------------------------------------------------------------
21
----------------------------------------------------------------
17
Alistair Francis (2):
22
Philippe Mathieu-Daudé (1):
18
intc/ibex_plic: Fix some typos in the comments
23
hw/misc/sifive_u_otp: Do not reset OTP content on hardware reset
19
intc/ibex_plic: Ensure we don't loose interrupts
20
24
21
include/hw/intc/ibex_plic.h | 1 +
25
Thomas Huth (1):
22
hw/intc/ibex_plic.c | 21 ++++++++++++++++++---
26
hw/misc/sifive_u_otp: Use IF_PFLASH for the OTP device instead of IF_NONE
23
2 files changed, 19 insertions(+), 3 deletions(-)
24
27
28
docs/about/deprecated.rst | 6 ++++++
29
hw/misc/sifive_u_otp.c | 22 +++++++++++++---------
30
2 files changed, 19 insertions(+), 9 deletions(-)
31
diff view generated by jsdifflib
1
From: Thomas Huth <thuth@redhat.com>
2
3
Configuring a drive with "if=none" is meant for creation of a backend
4
only, it should not get automatically assigned to a device frontend.
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).
7
8
Since the old way of configuring the device has already been published
9
with the previous QEMU versions, we cannot remove this immediately, but
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>
15
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
16
Message-id: 20211119102549.217755-1-thuth@redhat.com
1
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
17
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2
Message-id: 22d2fb0d7af5ca316c67ac909926368d1bcb7cf5.1605136387.git.alistair.francis@wdc.com
3
---
18
---
4
hw/intc/ibex_plic.c | 4 ++--
19
docs/about/deprecated.rst | 6 ++++++
5
1 file changed, 2 insertions(+), 2 deletions(-)
20
hw/misc/sifive_u_otp.c | 9 ++++++++-
21
2 files changed, 14 insertions(+), 1 deletion(-)
6
22
7
diff --git a/hw/intc/ibex_plic.c b/hw/intc/ibex_plic.c
23
diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
8
index XXXXXXX..XXXXXXX 100644
24
index XXXXXXX..XXXXXXX 100644
9
--- a/hw/intc/ibex_plic.c
25
--- a/docs/about/deprecated.rst
10
+++ b/hw/intc/ibex_plic.c
26
+++ b/docs/about/deprecated.rst
11
@@ -XXX,XX +XXX,XX @@ static void ibex_plic_irqs_set_pending(IbexPlicState *s, int irq, bool level)
27
@@ -XXX,XX +XXX,XX @@ as short-form boolean values, and passed to plugins as ``arg_name=on``.
12
28
However, short-form booleans are deprecated and full explicit ``arg_name=on``
13
if (s->claimed[pending_num] & 1 << (irq % 32)) {
29
form is preferred.
14
/*
30
15
- * The interrupt has been claimed, but not compelted.
31
+``-drive if=none`` for the sifive_u OTP device (since 6.2)
16
+ * The interrupt has been claimed, but not completed.
32
+''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
17
* The pending bit can't be set.
33
+
18
*/
34
+Using ``-drive if=none`` to configure the OTP device of the sifive_u
19
return;
35
+RISC-V machine is deprecated. Use ``-drive if=pflash`` instead.
20
@@ -XXX,XX +XXX,XX @@ static uint64_t ibex_plic_read(void *opaque, hwaddr addr,
36
+
21
int pending_num = s->claim / 32;
37
22
s->pending[pending_num] &= ~(1 << (s->claim % 32));
38
QEMU Machine Protocol (QMP) commands
23
39
------------------------------------
24
- /* Set the interrupt as claimed, but not compelted */
40
diff --git a/hw/misc/sifive_u_otp.c b/hw/misc/sifive_u_otp.c
25
+ /* Set the interrupt as claimed, but not completed */
41
index XXXXXXX..XXXXXXX 100644
26
s->claimed[pending_num] |= 1 << (s->claim % 32);
42
--- a/hw/misc/sifive_u_otp.c
27
43
+++ b/hw/misc/sifive_u_otp.c
28
/* Return the current claimed interrupt */
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;
29
--
60
--
30
2.29.2
61
2.31.1
31
62
32
63
diff view generated by jsdifflib
1
If an interrupt occurs between when we claim and complete an interrupt
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
we currently drop the interrupt in ibex_plic_irqs_set_pending(). This
3
somewhat matches hardware that also ignore the interrupt between the
4
claim and complete process.
5
2
6
In the case of hardware though the physical interrupt line will still
3
Once a "One Time Programmable" is programmed, it shouldn't be reset.
7
be asserted after we have completed the interrupt. This means we will
8
still act on the interrupt after the complete process. In QEMU we don't
9
and instead we drop the interrupt as it is never recorded.
10
4
11
This patch changed the behaviour of the Ibex PLIC so that we save all
5
Do not re-initialize the OTP content in the DeviceReset handler,
12
interrupts that occur while we are between claiming and completing an
6
initialize it once in the DeviceRealize one.
13
interrupt so that we can act on them after the completition process.
14
7
15
This fixes interrupts being dropped when running Tock on OpenTitain in
8
Fixes: 9fb45c62ae8 ("riscv: sifive: Implement a model for SiFive FU540 OTP")
16
QEMU.
9
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
10
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
11
Message-Id: <20211119104757.331579-1-f4bug@amsat.org>
12
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
13
---
14
hw/misc/sifive_u_otp.c | 13 +++++--------
15
1 file changed, 5 insertions(+), 8 deletions(-)
17
16
18
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
17
diff --git a/hw/misc/sifive_u_otp.c b/hw/misc/sifive_u_otp.c
19
Message-id: e7bcf98c6925b1e6e7828e7c3f85293a09a65b12.1605136387.git.alistair.francis@wdc.com
20
---
21
include/hw/intc/ibex_plic.h | 1 +
22
hw/intc/ibex_plic.c | 17 ++++++++++++++++-
23
2 files changed, 17 insertions(+), 1 deletion(-)
24
25
diff --git a/include/hw/intc/ibex_plic.h b/include/hw/intc/ibex_plic.h
26
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
27
--- a/include/hw/intc/ibex_plic.h
19
--- a/hw/misc/sifive_u_otp.c
28
+++ b/include/hw/intc/ibex_plic.h
20
+++ b/hw/misc/sifive_u_otp.c
29
@@ -XXX,XX +XXX,XX @@ struct IbexPlicState {
21
@@ -XXX,XX +XXX,XX @@ static void sifive_u_otp_realize(DeviceState *dev, Error **errp)
30
MemoryRegion mmio;
22
31
23
if (blk_pread(s->blk, 0, s->fuse, filesize) != filesize) {
32
uint32_t *pending;
24
error_setg(errp, "failed to read the initial flash content");
33
+ uint32_t *hidden_pending;
25
+ return;
34
uint32_t *claimed;
26
}
35
uint32_t *source;
36
uint32_t *priority;
37
diff --git a/hw/intc/ibex_plic.c b/hw/intc/ibex_plic.c
38
index XXXXXXX..XXXXXXX 100644
39
--- a/hw/intc/ibex_plic.c
40
+++ b/hw/intc/ibex_plic.c
41
@@ -XXX,XX +XXX,XX @@ static void ibex_plic_irqs_set_pending(IbexPlicState *s, int irq, bool level)
42
* The interrupt has been claimed, but not completed.
43
* The pending bit can't be set.
44
*/
45
+ s->hidden_pending[pending_num] |= level << (irq % 32);
46
return;
47
}
48
49
@@ -XXX,XX +XXX,XX @@ static void ibex_plic_write(void *opaque, hwaddr addr,
50
s->claim = 0;
51
}
52
if (s->claimed[value / 32] & 1 << (value % 32)) {
53
+ int pending_num = value / 32;
54
+
55
/* This value was already claimed, clear it. */
56
- s->claimed[value / 32] &= ~(1 << (value % 32));
57
+ s->claimed[pending_num] &= ~(1 << (value % 32));
58
+
59
+ if (s->hidden_pending[pending_num] & (1 << (value % 32))) {
60
+ /*
61
+ * If the bit in hidden_pending is set then that means we
62
+ * received an interrupt between claiming and completing
63
+ * the interrupt that hasn't since been de-asserted.
64
+ * On hardware this would trigger an interrupt, so let's
65
+ * trigger one here as well.
66
+ */
67
+ s->pending[pending_num] |= 1 << (value % 32);
68
+ }
69
}
27
}
70
}
28
}
71
29
-}
72
@@ -XXX,XX +XXX,XX @@ static void ibex_plic_realize(DeviceState *dev, Error **errp)
30
-
73
int i;
31
-static void sifive_u_otp_reset(DeviceState *dev)
74
32
-{
75
s->pending = g_new0(uint32_t, s->pending_num);
33
- SiFiveUOTPState *s = SIFIVE_U_OTP(dev);
76
+ s->hidden_pending = g_new0(uint32_t, s->pending_num);
34
77
s->claimed = g_new0(uint32_t, s->pending_num);
35
/* Initialize all fuses' initial value to 0xFFs */
78
s->source = g_new0(uint32_t, s->source_num);
36
memset(s->fuse, 0xff, sizeof(s->fuse));
79
s->priority = g_new0(uint32_t, s->priority_num);
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;
60
}
61
62
static const TypeInfo sifive_u_otp_info = {
80
--
63
--
81
2.29.2
64
2.31.1
82
65
83
66
diff view generated by jsdifflib