1
Target-arm queue for rc2 -- just some minor bugfixes.
1
Arm queue; bugfixes only.
2
2
3
thanks
3
thanks
4
-- PMM
4
-- PMM
5
5
6
The following changes since commit 6e5d4999c761ffa082f60d72a14e5c953515b417:
6
The following changes since commit 48aa8f0ac536db3550a35c295ff7de94e4c33739:
7
7
8
Merge remote-tracking branch 'remotes/armbru/tags/pull-monitor-2019-11-19' into staging (2019-11-19 11:29:01 +0000)
8
Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2020-11-16' into staging (2020-11-17 11:07:00 +0000)
9
9
10
are available in the Git repository at:
10
are available in the Git repository at:
11
11
12
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20191119
12
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20201117
13
13
14
for you to fetch changes up to 04c9c81b8fa2ee33f59a26265700fae6fc646062:
14
for you to fetch changes up to ab135622cf478585bdfcb68b85e4a817d74a0c42:
15
15
16
target/arm: Support EL0 v7m msr/mrs for CONFIG_USER_ONLY (2019-11-19 13:20:28 +0000)
16
tmp105: Correct handling of temperature limit checks (2020-11-17 12:56:33 +0000)
17
17
18
----------------------------------------------------------------
18
----------------------------------------------------------------
19
target-arm queue:
19
target-arm queue:
20
* Support EL0 v7m msr/mrs for CONFIG_USER_ONLY
20
* hw/arm/virt: ARM_VIRT must select ARM_GIC
21
* Relax r13 restriction for ldrex/strex for v8.0
21
* exynos: Fix bad printf format specifiers
22
* Do not reject rt == rt2 for strexd
22
* hw/input/ps2.c: Remove remnants of printf debug
23
* net/cadence_gem: Set PHY autonegotiation restart status
23
* target/openrisc: Remove dead code attempting to check "is timer disabled"
24
* ssi: xilinx_spips: Skip spi bus update for a few register writes
24
* register: Remove unnecessary NULL check
25
* pl031: Expose RTCICR as proper WC register
25
* util/cutils: Fix Coverity array overrun in freq_to_str()
26
* configure: Make "does libgio work" test pull in some actual functions
27
* tmp105: reset the T_low and T_High registers
28
* tmp105: Correct handling of temperature limit checks
26
29
27
----------------------------------------------------------------
30
----------------------------------------------------------------
28
Alexander Graf (1):
31
Alex Chen (1):
29
pl031: Expose RTCICR as proper WC register
32
exynos: Fix bad printf format specifiers
30
33
31
Linus Ziegert (1):
34
Alistair Francis (1):
32
net/cadence_gem: Set PHY autonegotiation restart status
35
register: Remove unnecessary NULL check
33
36
34
Richard Henderson (4):
37
Andrew Jones (1):
35
target/arm: Merge arm_cpu_vq_map_next_smaller into sole caller
38
hw/arm/virt: ARM_VIRT must select ARM_GIC
36
target/arm: Do not reject rt == rt2 for strexd
37
target/arm: Relax r13 restriction for ldrex/strex for v8.0
38
target/arm: Support EL0 v7m msr/mrs for CONFIG_USER_ONLY
39
39
40
Sai Pavan Boddu (1):
40
Peter Maydell (5):
41
ssi: xilinx_spips: Skip spi bus update for a few register writes
41
hw/input/ps2.c: Remove remnants of printf debug
42
target/openrisc: Remove dead code attempting to check "is timer disabled"
43
configure: Make "does libgio work" test pull in some actual functions
44
hw/misc/tmp105: reset the T_low and T_High registers
45
tmp105: Correct handling of temperature limit checks
42
46
43
target/arm/cpu.h | 5 +--
47
Philippe Mathieu-Daudé (1):
44
hw/net/cadence_gem.c | 9 ++--
48
util/cutils: Fix Coverity array overrun in freq_to_str()
45
hw/rtc/pl031.c | 6 +--
46
hw/ssi/xilinx_spips.c | 22 ++++++++--
47
target/arm/cpu64.c | 15 -------
48
target/arm/helper.c | 9 +++-
49
target/arm/m_helper.c | 114 ++++++++++++++++++++++++++++++-------------------
50
target/arm/translate.c | 14 +++---
51
8 files changed, 113 insertions(+), 81 deletions(-)
52
49
50
configure | 11 +++++--
51
hw/misc/tmp105.h | 7 +++++
52
hw/core/register.c | 4 ---
53
hw/input/ps2.c | 9 ------
54
hw/misc/tmp105.c | 73 ++++++++++++++++++++++++++++++++++++++------
55
hw/timer/exynos4210_mct.c | 4 +--
56
hw/timer/exynos4210_pwm.c | 8 ++---
57
target/openrisc/sys_helper.c | 3 --
58
util/cutils.c | 3 +-
59
hw/arm/Kconfig | 1 +
60
10 files changed, 89 insertions(+), 34 deletions(-)
61
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Andrew Jones <drjones@redhat.com>
2
2
3
Armv8-A removes UNPREDICTABLE for R13 for these cases.
3
The removal of the selection of A15MPCORE from ARM_VIRT also
4
removed what A15MPCORE selects, ARM_GIC. We still need ARM_GIC.
4
5
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Fixes: bec3c97e0cf9 ("hw/arm/virt: Remove dependency on Cortex-A15 MPCore peripherals")
6
Message-id: 20191117090621.32425-3-richard.henderson@linaro.org
7
Reported-by: Miroslav Rezanina <mrezanin@redhat.com>
7
[PMM: changed ENABLE_ARCH_8 checks to check a new bool 'v8a',
8
Signed-off-by: Andrew Jones <drjones@redhat.com>
8
since these cases are still UNPREDICTABLE for v8M]
9
Reviewed-by: Miroslav Rezanina <mrezanin@redhat.com>
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
11
Message-id: 20201111143440.112763-1-drjones@redhat.com
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
13
---
12
target/arm/translate.c | 12 ++++++++----
14
hw/arm/Kconfig | 1 +
13
1 file changed, 8 insertions(+), 4 deletions(-)
15
1 file changed, 1 insertion(+)
14
16
15
diff --git a/target/arm/translate.c b/target/arm/translate.c
17
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
16
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/translate.c
19
--- a/hw/arm/Kconfig
18
+++ b/target/arm/translate.c
20
+++ b/hw/arm/Kconfig
19
@@ -XXX,XX +XXX,XX @@ static bool trans_SWPB(DisasContext *s, arg_SWP *a)
21
@@ -XXX,XX +XXX,XX @@ config ARM_VIRT
20
static bool op_strex(DisasContext *s, arg_STREX *a, MemOp mop, bool rel)
22
imply VFIO_PLATFORM
21
{
23
imply VFIO_XGMAC
22
TCGv_i32 addr;
24
imply TPM_TIS_SYSBUS
23
+ /* Some cases stopped being UNPREDICTABLE in v8A (but not v8M) */
25
+ select ARM_GIC
24
+ bool v8a = ENABLE_ARCH_8 && !arm_dc_feature(s, ARM_FEATURE_M);
26
select ACPI
25
27
select ARM_SMMUV3
26
/* We UNDEF for these UNPREDICTABLE cases. */
28
select GPIO_KEY
27
if (a->rd == 15 || a->rn == 15 || a->rt == 15
28
|| a->rd == a->rn || a->rd == a->rt
29
- || (s->thumb && (a->rd == 13 || a->rt == 13))
30
+ || (!v8a && s->thumb && (a->rd == 13 || a->rt == 13))
31
|| (mop == MO_64
32
&& (a->rt2 == 15
33
|| a->rd == a->rt2
34
- || (s->thumb && a->rt2 == 13)))) {
35
+ || (!v8a && s->thumb && a->rt2 == 13)))) {
36
unallocated_encoding(s);
37
return true;
38
}
39
@@ -XXX,XX +XXX,XX @@ static bool trans_STLH(DisasContext *s, arg_STL *a)
40
static bool op_ldrex(DisasContext *s, arg_LDREX *a, MemOp mop, bool acq)
41
{
42
TCGv_i32 addr;
43
+ /* Some cases stopped being UNPREDICTABLE in v8A (but not v8M) */
44
+ bool v8a = ENABLE_ARCH_8 && !arm_dc_feature(s, ARM_FEATURE_M);
45
46
/* We UNDEF for these UNPREDICTABLE cases. */
47
if (a->rn == 15 || a->rt == 15
48
- || (s->thumb && a->rt == 13)
49
+ || (!v8a && s->thumb && a->rt == 13)
50
|| (mop == MO_64
51
&& (a->rt2 == 15 || a->rt == a->rt2
52
- || (s->thumb && a->rt2 == 13)))) {
53
+ || (!v8a && s->thumb && a->rt2 == 13)))) {
54
unallocated_encoding(s);
55
return true;
56
}
57
--
29
--
58
2.20.1
30
2.20.1
59
31
60
32
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Alex Chen <alex.chen@huawei.com>
2
2
3
There was too much cut and paste between ldrexd and strexd,
3
We should use printf format specifier "%u" instead of "%d" for
4
as ldrexd does prohibit two output registers the same.
4
argument of type "unsigned int".
5
5
6
Fixes: af288228995
6
Reported-by: Euler Robot <euler.robot@huawei.com>
7
Reported-by: Michael Goffioul <michael.goffioul@gmail.com>
7
Signed-off-by: Alex Chen <alex.chen@huawei.com>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20201111073651.72804-1-alex.chen@huawei.com
9
Message-id: 20191117090621.32425-2-richard.henderson@linaro.org
10
Reviewed-by: Robert Foley <robert.foley@linaro.org>
11
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
11
---
14
target/arm/translate.c | 2 +-
12
hw/timer/exynos4210_mct.c | 4 ++--
15
1 file changed, 1 insertion(+), 1 deletion(-)
13
hw/timer/exynos4210_pwm.c | 8 ++++----
14
2 files changed, 6 insertions(+), 6 deletions(-)
16
15
17
diff --git a/target/arm/translate.c b/target/arm/translate.c
16
diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c
18
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
19
--- a/target/arm/translate.c
18
--- a/hw/timer/exynos4210_mct.c
20
+++ b/target/arm/translate.c
19
+++ b/hw/timer/exynos4210_mct.c
21
@@ -XXX,XX +XXX,XX @@ static bool op_strex(DisasContext *s, arg_STREX *a, MemOp mop, bool rel)
20
@@ -XXX,XX +XXX,XX @@ static void exynos4210_gcomp_raise_irq(void *opaque, uint32_t id)
22
|| (s->thumb && (a->rd == 13 || a->rt == 13))
21
/* If CSTAT is pending and IRQ is enabled */
23
|| (mop == MO_64
22
if ((s->reg.int_cstat & G_INT_CSTAT_COMP(id)) &&
24
&& (a->rt2 == 15
23
(s->reg.int_enb & G_INT_ENABLE(id))) {
25
- || a->rd == a->rt2 || a->rt == a->rt2
24
- DPRINTF("gcmp timer[%d] IRQ\n", id);
26
+ || a->rd == a->rt2
25
+ DPRINTF("gcmp timer[%u] IRQ\n", id);
27
|| (s->thumb && a->rt2 == 13)))) {
26
qemu_irq_raise(s->irq[id]);
28
unallocated_encoding(s);
27
}
29
return true;
28
}
29
@@ -XXX,XX +XXX,XX @@ static void exynos4210_mct_update_freq(Exynos4210MCTState *s)
30
MCT_CFG_GET_DIVIDER(s->reg_mct_cfg));
31
32
if (freq != s->freq) {
33
- DPRINTF("freq=%dHz\n", s->freq);
34
+ DPRINTF("freq=%uHz\n", s->freq);
35
36
/* global timer */
37
tx_ptimer_set_freq(s->g_timer.ptimer_frc, s->freq);
38
diff --git a/hw/timer/exynos4210_pwm.c b/hw/timer/exynos4210_pwm.c
39
index XXXXXXX..XXXXXXX 100644
40
--- a/hw/timer/exynos4210_pwm.c
41
+++ b/hw/timer/exynos4210_pwm.c
42
@@ -XXX,XX +XXX,XX @@ static void exynos4210_pwm_update_freq(Exynos4210PWMState *s, uint32_t id)
43
44
if (freq != s->timer[id].freq) {
45
ptimer_set_freq(s->timer[id].ptimer, s->timer[id].freq);
46
- DPRINTF("freq=%dHz\n", s->timer[id].freq);
47
+ DPRINTF("freq=%uHz\n", s->timer[id].freq);
48
}
49
}
50
51
@@ -XXX,XX +XXX,XX @@ static void exynos4210_pwm_tick(void *opaque)
52
uint32_t id = s->id;
53
bool cmp;
54
55
- DPRINTF("timer %d tick\n", id);
56
+ DPRINTF("timer %u tick\n", id);
57
58
/* set irq status */
59
p->reg_tint_cstat |= TINT_CSTAT_STATUS(id);
60
61
/* raise IRQ */
62
if (p->reg_tint_cstat & TINT_CSTAT_ENABLE(id)) {
63
- DPRINTF("timer %d IRQ\n", id);
64
+ DPRINTF("timer %u IRQ\n", id);
65
qemu_irq_raise(p->timer[id].irq);
66
}
67
68
@@ -XXX,XX +XXX,XX @@ static void exynos4210_pwm_tick(void *opaque)
69
}
70
71
if (cmp) {
72
- DPRINTF("auto reload timer %d count to %x\n", id,
73
+ DPRINTF("auto reload timer %u count to %x\n", id,
74
p->timer[id].reg_tcntb);
75
ptimer_set_count(p->timer[id].ptimer, p->timer[id].reg_tcntb);
76
ptimer_run(p->timer[id].ptimer, 1);
30
--
77
--
31
2.20.1
78
2.20.1
32
79
33
80
diff view generated by jsdifflib
1
From: Linus Ziegert <linus.ziegert+qemu@holoplot.com>
1
In commit 5edab03d4040 we added tracepoints to the ps2 keyboard
2
and mouse emulation. However we didn't remove all the debug-by-printf
3
support. In fact there is only one printf() remaining, and it is
4
redundant with the trace_ps2_write_mouse() event next to it.
5
Remove the printf() and the now-unused DEBUG* macros.
2
6
3
The Linux kernel PHY driver sets AN_RESTART in the BMCR of the
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
PHY when autonegotiation is started.
8
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5
Recently the kernel started to read back the PHY's AN_RESTART
9
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
6
bit and now checks whether the autonegotiation is complete and
10
Message-id: 20201101133258.4240-1-peter.maydell@linaro.org
7
the bit was cleared [1]. Otherwise the link status is down.
11
---
12
hw/input/ps2.c | 9 ---------
13
1 file changed, 9 deletions(-)
8
14
9
The emulated PHY needs to clear AN_RESTART immediately to inform
15
diff --git a/hw/input/ps2.c b/hw/input/ps2.c
10
the kernel driver about the completion of autonegotiation phase.
11
12
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c36757eb9dee
13
14
Signed-off-by: Linus Ziegert <linus.ziegert+qemu@holoplot.com>
15
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
16
Message-id: 20191104181604.21943-1-linus.ziegert+qemu@holoplot.com
17
Cc: qemu-stable@nongnu.org
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
---
20
hw/net/cadence_gem.c | 9 +++++----
21
1 file changed, 5 insertions(+), 4 deletions(-)
22
23
diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c
24
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
25
--- a/hw/net/cadence_gem.c
17
--- a/hw/input/ps2.c
26
+++ b/hw/net/cadence_gem.c
18
+++ b/hw/input/ps2.c
27
@@ -XXX,XX +XXX,XX @@
19
@@ -XXX,XX +XXX,XX @@
28
#define PHY_REG_EXT_PHYSPCFC_ST 27
20
29
#define PHY_REG_CABLE_DIAG 28
21
#include "trace.h"
30
22
31
-#define PHY_REG_CONTROL_RST 0x8000
23
-/* debug PC keyboard */
32
-#define PHY_REG_CONTROL_LOOP 0x4000
24
-//#define DEBUG_KBD
33
-#define PHY_REG_CONTROL_ANEG 0x1000
25
-
34
+#define PHY_REG_CONTROL_RST 0x8000
26
-/* debug PC keyboard : only mouse */
35
+#define PHY_REG_CONTROL_LOOP 0x4000
27
-//#define DEBUG_MOUSE
36
+#define PHY_REG_CONTROL_ANEG 0x1000
28
-
37
+#define PHY_REG_CONTROL_ANRESTART 0x0200
29
/* Keyboard Commands */
38
30
#define KBD_CMD_SET_LEDS    0xED    /* Set keyboard leds */
39
#define PHY_REG_STATUS_LINK 0x0004
31
#define KBD_CMD_ECHO     0xEE
40
#define PHY_REG_STATUS_ANEGCMPL 0x0020
32
@@ -XXX,XX +XXX,XX @@ void ps2_write_mouse(void *opaque, int val)
41
@@ -XXX,XX +XXX,XX @@ static void gem_phy_write(CadenceGEMState *s, unsigned reg_num, uint16_t val)
33
PS2MouseState *s = (PS2MouseState *)opaque;
42
}
34
43
if (val & PHY_REG_CONTROL_ANEG) {
35
trace_ps2_write_mouse(opaque, val);
44
/* Complete autonegotiation immediately */
36
-#ifdef DEBUG_MOUSE
45
- val &= ~PHY_REG_CONTROL_ANEG;
37
- printf("kbd: write mouse 0x%02x\n", val);
46
+ val &= ~(PHY_REG_CONTROL_ANEG | PHY_REG_CONTROL_ANRESTART);
38
-#endif
47
s->phy_regs[PHY_REG_STATUS] |= PHY_REG_STATUS_ANEGCMPL;
39
switch(s->common.write_cmd) {
48
}
40
default:
49
if (val & PHY_REG_CONTROL_LOOP) {
41
case -1:
50
--
42
--
51
2.20.1
43
2.20.1
52
44
53
45
diff view generated by jsdifflib
New patch
1
In the mtspr helper we attempt to check for "is the timer disabled"
2
with "if (env->ttmr & TIMER_NONE)". This is wrong because TIMER_NONE
3
is zero and the condition is always false (Coverity complains about
4
the dead code.)
1
5
6
The correct check would be to test whether the TTMR_M field in the
7
register is equal to TIMER_NONE instead. However, the
8
cpu_openrisc_timer_update() function checks whether the timer is
9
enabled (it looks at cpu->env.is_counting, which is set to 0 via
10
cpu_openrisc_count_stop() when the TTMR_M field is set to
11
TIMER_NONE), so there's no need to check for "timer disabled" in the
12
target/openrisc code. Instead, simply remove the dead code.
13
14
Fixes: Coverity CID 1005812
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Acked-by: Stafford Horne <shorne@gmail.com>
17
Message-id: 20201103114654.18540-1-peter.maydell@linaro.org
18
---
19
target/openrisc/sys_helper.c | 3 ---
20
1 file changed, 3 deletions(-)
21
22
diff --git a/target/openrisc/sys_helper.c b/target/openrisc/sys_helper.c
23
index XXXXXXX..XXXXXXX 100644
24
--- a/target/openrisc/sys_helper.c
25
+++ b/target/openrisc/sys_helper.c
26
@@ -XXX,XX +XXX,XX @@ void HELPER(mtspr)(CPUOpenRISCState *env, target_ulong spr, target_ulong rb)
27
28
case TO_SPR(10, 1): /* TTCR */
29
cpu_openrisc_count_set(cpu, rb);
30
- if (env->ttmr & TIMER_NONE) {
31
- return;
32
- }
33
cpu_openrisc_timer_update(cpu);
34
break;
35
#endif
36
--
37
2.20.1
38
39
diff view generated by jsdifflib
1
From: Alexander Graf <graf@amazon.com>
1
From: Alistair Francis <alistair.francis@wdc.com>
2
2
3
The current PL031 RTCICR register implementation always clears the
3
This patch fixes CID 1432800 by removing an unnecessary check.
4
IRQ pending status on a register write, regardless of the value the
5
guest writes.
6
4
7
To justify that behavior, it references the ARM926EJ-S Development
5
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
8
Chip Reference Manual (DDI0287B) and indicates that said document
9
states that any write clears the internal IRQ state. It is indeed
10
true that in section 11.1 this document says:
11
12
"The interrupt is cleared by writing any data value to the
13
interrupt clear register RTCICR".
14
15
However, later in section 11.2.2 it contradicts itself by saying:
16
17
"Writing 1 to bit 0 of RTCICR clears the RTCINTR flag."
18
19
The latter statement matches the PL031 TRM (DDI0224C), which says:
20
21
"Writing 1 to bit position 0 clears the corresponding interrupt.
22
Writing 0 has no effect."
23
24
Let's assume that the self-contradictory DDI0287B is in error, and
25
follow the reference manual for the device itself, by making the
26
register write-one-to-clear.
27
28
Reported-by: Hendrik Borghorst <hborghor@amazon.de>
29
Signed-off-by: Alexander Graf <graf@amazon.com>
30
Message-id: 20191104115228.30745-1-graf@amazon.com
31
[PMM: updated commit message to note that DDI0287B says two
32
conflicting things]
33
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
34
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
35
---
8
---
36
hw/rtc/pl031.c | 6 +-----
9
hw/core/register.c | 4 ----
37
1 file changed, 1 insertion(+), 5 deletions(-)
10
1 file changed, 4 deletions(-)
38
11
39
diff --git a/hw/rtc/pl031.c b/hw/rtc/pl031.c
12
diff --git a/hw/core/register.c b/hw/core/register.c
40
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
41
--- a/hw/rtc/pl031.c
14
--- a/hw/core/register.c
42
+++ b/hw/rtc/pl031.c
15
+++ b/hw/core/register.c
43
@@ -XXX,XX +XXX,XX @@ static void pl031_write(void * opaque, hwaddr offset,
16
@@ -XXX,XX +XXX,XX @@ static RegisterInfoArray *register_init_block(DeviceState *owner,
44
pl031_update(s);
17
int index = rae[i].addr / data_size;
45
break;
18
RegisterInfo *r = &ri[index];
46
case RTC_ICR:
19
47
- /* The PL031 documentation (DDI0224B) states that the interrupt is
20
- if (data + data_size * index == 0 || !&rae[i]) {
48
- cleared when bit 0 of the written value is set. However the
21
- continue;
49
- arm926e documentation (DDI0287B) states that the interrupt is
22
- }
50
- cleared when any value is written. */
23
-
51
- s->is = 0;
24
/* Init the register, this will zero it. */
52
+ s->is &= ~value;
25
object_initialize((void *)r, sizeof(*r), TYPE_REGISTER);
53
pl031_update(s);
26
54
break;
55
case RTC_CR:
56
--
27
--
57
2.20.1
28
2.20.1
58
29
59
30
diff view generated by jsdifflib
1
From: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com>
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
2
3
A few configuration register writes need not update the spi bus state, so just
3
Fix Coverity CID 1435957: Memory - illegal accesses (OVERRUN):
4
return after the register write.
5
4
6
Signed-off-by: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com>
5
>>> Overrunning array "suffixes" of 7 8-byte elements at element
7
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
6
index 7 (byte offset 63) using index "idx" (which evaluates to 7).
8
Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com>
7
9
Tested-by: Francisco Iglesias <frasse.iglesias@gmail.com>
8
Note, the biggest input value freq_to_str() can accept is UINT64_MAX,
10
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
9
which is ~18.446 EHz, less than 1000 EHz.
11
Message-id: 1573830705-14579-1-git-send-email-sai.pavan.boddu@xilinx.com
10
11
Reported-by: Eduardo Habkost <ehabkost@redhat.com>
12
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
13
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
14
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
15
Reviewed-by: Luc Michel <luc@lmichel.fr>
16
Message-id: 20201101215755.2021421-1-f4bug@amsat.org
17
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
18
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
20
---
14
hw/ssi/xilinx_spips.c | 22 ++++++++++++++++++----
21
util/cutils.c | 3 ++-
15
1 file changed, 18 insertions(+), 4 deletions(-)
22
1 file changed, 2 insertions(+), 1 deletion(-)
16
23
17
diff --git a/hw/ssi/xilinx_spips.c b/hw/ssi/xilinx_spips.c
24
diff --git a/util/cutils.c b/util/cutils.c
18
index XXXXXXX..XXXXXXX 100644
25
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/ssi/xilinx_spips.c
26
--- a/util/cutils.c
20
+++ b/hw/ssi/xilinx_spips.c
27
+++ b/util/cutils.c
21
@@ -XXX,XX +XXX,XX @@
28
@@ -XXX,XX +XXX,XX @@ char *freq_to_str(uint64_t freq_hz)
22
#define R_GPIO (0x30 / 4)
29
double freq = freq_hz;
23
#define R_LPBK_DLY_ADJ (0x38 / 4)
30
size_t idx = 0;
24
#define R_LPBK_DLY_ADJ_RESET (0x33)
31
25
+#define R_IOU_TAPDLY_BYPASS (0x3C / 4)
32
- while (freq >= 1000.0 && idx < ARRAY_SIZE(suffixes)) {
26
#define R_TXD1 (0x80 / 4)
33
+ while (freq >= 1000.0) {
27
#define R_TXD2 (0x84 / 4)
34
freq /= 1000.0;
28
#define R_TXD3 (0x88 / 4)
35
idx++;
29
@@ -XXX,XX +XXX,XX @@
30
#define R_LQSPI_STS (0xA4 / 4)
31
#define LQSPI_STS_WR_RECVD (1 << 1)
32
33
+#define R_DUMMY_CYCLE_EN (0xC8 / 4)
34
+#define R_ECO (0xF8 / 4)
35
#define R_MOD_ID (0xFC / 4)
36
37
#define R_GQSPI_SELECT (0x144 / 4)
38
@@ -XXX,XX +XXX,XX @@ static void xilinx_spips_write(void *opaque, hwaddr addr,
39
{
40
int mask = ~0;
41
XilinxSPIPS *s = opaque;
42
+ bool try_flush = true;
43
44
DB_PRINT_L(0, "addr=" TARGET_FMT_plx " = %x\n", addr, (unsigned)value);
45
addr >>= 2;
46
@@ -XXX,XX +XXX,XX @@ static void xilinx_spips_write(void *opaque, hwaddr addr,
47
tx_data_bytes(&s->tx_fifo, (uint32_t)value, 3,
48
s->regs[R_CONFIG] & R_CONFIG_ENDIAN);
49
goto no_reg_update;
50
+ /* Skip SPI bus update for below registers writes */
51
+ case R_GPIO:
52
+ case R_LPBK_DLY_ADJ:
53
+ case R_IOU_TAPDLY_BYPASS:
54
+ case R_DUMMY_CYCLE_EN:
55
+ case R_ECO:
56
+ try_flush = false;
57
+ break;
58
}
36
}
59
s->regs[addr] = (s->regs[addr] & ~mask) | (value & mask);
37
+ assert(idx < ARRAY_SIZE(suffixes));
60
no_reg_update:
38
61
- xilinx_spips_update_cs_lines(s);
39
return g_strdup_printf("%0.3g %sHz", freq, suffixes[idx]);
62
- xilinx_spips_check_flush(s);
63
- xilinx_spips_update_cs_lines(s);
64
- xilinx_spips_update_ixr(s);
65
+ if (try_flush) {
66
+ xilinx_spips_update_cs_lines(s);
67
+ xilinx_spips_check_flush(s);
68
+ xilinx_spips_update_cs_lines(s);
69
+ xilinx_spips_update_ixr(s);
70
+ }
71
}
40
}
72
73
static const MemoryRegionOps spips_ops = {
74
--
41
--
75
2.20.1
42
2.20.1
76
43
77
44
diff view generated by jsdifflib
New patch
1
In commit 76346b6264a9b01979 we tried to add a configure check that
2
the libgio pkg-config data was correct, which builds an executable
3
linked against it. Unfortunately this doesn't catch the problem
4
(missing static library dependency info), because a "do nothing" test
5
source file doesn't have any symbol references that cause the linker
6
to pull in .o files from libgio.a, and so we don't see the "missing
7
symbols from libmount" error that a full QEMU link triggers.
1
8
9
(The ineffective test went unnoticed because of a typo that
10
effectively disabled libgio unconditionally, but after commit
11
3569a5dfc11f2 fixed that, a static link of the system emulator on
12
Ubuntu stopped working again.)
13
14
Improve the gio test by having the test source fragment reference a
15
g_dbus function (which is what is indirectly causing us to end up
16
wanting functions from libmount).
17
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
20
Message-id: 20201116104617.18333-1-peter.maydell@linaro.org
21
---
22
configure | 11 +++++++++--
23
1 file changed, 9 insertions(+), 2 deletions(-)
24
25
diff --git a/configure b/configure
26
index XXXXXXX..XXXXXXX 100755
27
--- a/configure
28
+++ b/configure
29
@@ -XXX,XX +XXX,XX @@ if $pkg_config --atleast-version=$glib_req_ver gio-2.0; then
30
# Check that the libraries actually work -- Ubuntu 18.04 ships
31
# with pkg-config --static --libs data for gio-2.0 that is missing
32
# -lblkid and will give a link error.
33
- write_c_skeleton
34
- if compile_prog "" "$gio_libs" ; then
35
+ cat > $TMPC <<EOF
36
+#include <gio/gio.h>
37
+int main(void)
38
+{
39
+ g_dbus_proxy_new_sync(0, 0, 0, 0, 0, 0, 0, 0);
40
+ return 0;
41
+}
42
+EOF
43
+ if compile_prog "$gio_cflags" "$gio_libs" ; then
44
gio=yes
45
else
46
gio=no
47
--
48
2.20.1
49
50
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
The TMP105 datasheet (https://www.ti.com/lit/gpn/tmp105) says that the
2
power-up reset values for the T_low and T_high registers are 80 degrees C
3
and 75 degrees C, which are 0x500 and 0x4B0 hex according to table 5. These
4
values are then shifted right by four bits to give the register reset
5
values, since both registers store the 12 bits of temperature data in bits
6
[15..4] of a 16 bit register.
2
7
3
Coverity reports, in sve_zcr_get_valid_len,
8
We were resetting these registers to zero, which is problematic for Linux
9
guests which enable the alert interrupt and then immediately take an
10
unexpected overtemperature alert because the current temperature is above
11
freezing...
4
12
5
"Subtract operation overflows on operands
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
arm_cpu_vq_map_next_smaller(cpu, start_vq + 1U) and 1U"
14
Reviewed-by: Cédric Le Goater <clg@kaod.org>
15
Message-id: 20201110150023.25533-2-peter.maydell@linaro.org
16
---
17
hw/misc/tmp105.c | 3 +++
18
1 file changed, 3 insertions(+)
7
19
8
First, the aarch32 stub version of arm_cpu_vq_map_next_smaller,
20
diff --git a/hw/misc/tmp105.c b/hw/misc/tmp105.c
9
returning 0, does exactly what Coverity reports. Remove it.
10
11
Second, the aarch64 version of arm_cpu_vq_map_next_smaller has
12
a set of asserts, but they don't cover the case in question.
13
Further, there is a fair amount of extra arithmetic needed to
14
convert from the 0-based zcr register, to the 1-base vq form,
15
to the 0-based bitmap, and back again. This can be simplified
16
by leaving the value in the 0-based form.
17
18
Finally, use test_bit to simplify the common case, where the
19
length in the zcr registers is in fact a supported length.
20
21
Reported-by: Coverity (CID 1407217)
22
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
23
Reviewed-by: Andrew Jones <drjones@redhat.com>
24
Message-id: 20191118091414.19440-1-richard.henderson@linaro.org
25
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
26
---
27
target/arm/cpu.h | 3 ---
28
target/arm/cpu64.c | 15 ---------------
29
target/arm/helper.c | 9 +++++++--
30
3 files changed, 7 insertions(+), 20 deletions(-)
31
32
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
33
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
34
--- a/target/arm/cpu.h
22
--- a/hw/misc/tmp105.c
35
+++ b/target/arm/cpu.h
23
+++ b/hw/misc/tmp105.c
36
@@ -XXX,XX +XXX,XX @@ typedef struct {
24
@@ -XXX,XX +XXX,XX @@ static void tmp105_reset(I2CSlave *i2c)
37
#ifdef TARGET_AARCH64
25
s->faults = tmp105_faultq[(s->config >> 3) & 3];
38
# define ARM_MAX_VQ 16
26
s->alarm = 0;
39
void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp);
27
40
-uint32_t arm_cpu_vq_map_next_smaller(ARMCPU *cpu, uint32_t vq);
28
+ s->limit[0] = 0x4b00; /* T_LOW, 75 degrees C */
41
#else
29
+ s->limit[1] = 0x5000; /* T_HIGH, 80 degrees C */
42
# define ARM_MAX_VQ 1
30
+
43
static inline void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp) { }
31
tmp105_interrupt_update(s);
44
-static inline uint32_t arm_cpu_vq_map_next_smaller(ARMCPU *cpu, uint32_t vq)
45
-{ return 0; }
46
#endif
47
48
typedef struct ARMVectorReg {
49
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
50
index XXXXXXX..XXXXXXX 100644
51
--- a/target/arm/cpu64.c
52
+++ b/target/arm/cpu64.c
53
@@ -XXX,XX +XXX,XX @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp)
54
cpu->sve_max_vq = max_vq;
55
}
32
}
56
33
57
-uint32_t arm_cpu_vq_map_next_smaller(ARMCPU *cpu, uint32_t vq)
58
-{
59
- uint32_t bitnum;
60
-
61
- /*
62
- * We allow vq == ARM_MAX_VQ + 1 to be input because the caller may want
63
- * to find the maximum vq enabled, which may be ARM_MAX_VQ, but this
64
- * function always returns the next smaller than the input.
65
- */
66
- assert(vq && vq <= ARM_MAX_VQ + 1);
67
-
68
- bitnum = find_last_bit(cpu->sve_vq_map, vq - 1);
69
- return bitnum == vq - 1 ? 0 : bitnum + 1;
70
-}
71
-
72
static void cpu_max_get_sve_max_vq(Object *obj, Visitor *v, const char *name,
73
void *opaque, Error **errp)
74
{
75
diff --git a/target/arm/helper.c b/target/arm/helper.c
76
index XXXXXXX..XXXXXXX 100644
77
--- a/target/arm/helper.c
78
+++ b/target/arm/helper.c
79
@@ -XXX,XX +XXX,XX @@ int sve_exception_el(CPUARMState *env, int el)
80
81
static uint32_t sve_zcr_get_valid_len(ARMCPU *cpu, uint32_t start_len)
82
{
83
- uint32_t start_vq = (start_len & 0xf) + 1;
84
+ uint32_t end_len;
85
86
- return arm_cpu_vq_map_next_smaller(cpu, start_vq + 1) - 1;
87
+ end_len = start_len &= 0xf;
88
+ if (!test_bit(start_len, cpu->sve_vq_map)) {
89
+ end_len = find_last_bit(cpu->sve_vq_map, start_len);
90
+ assert(end_len < start_len);
91
+ }
92
+ return end_len;
93
}
94
95
/*
96
--
34
--
97
2.20.1
35
2.20.1
98
36
99
37
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
The TMP105 datasheet says that in Interrupt Mode (when TM==1) the device
2
signals an alert when the temperature equals or exceeds the T_high value and
3
then remains high until a device register is read or the device responds to
4
the SMBUS Alert Response address, or the device is put into Shutdown Mode.
5
Thereafter the Alert pin will only be re-signalled when temperature falls
6
below T_low; alert can then be cleared in the same set of ways, and the
7
device returns to its initial "alert when temperature goes above T_high"
8
mode. (If this textual description is confusing, see figure 3 in the
9
TI datasheet at https://www.ti.com/lit/gpn/tmp105 .)
2
10
3
Simply moving the non-stub helper_v7m_mrs/msr outside of
11
We were misimplementing this as a simple "always alert if temperature is
4
!CONFIG_USER_ONLY is not an option, because of all of the
12
above T_high or below T_low" condition, which gives a spurious alert on
5
other system-mode helpers that are called.
13
startup if using the "T_high = 80 degrees C, T_low = 75 degrees C" reset
14
limit values.
6
15
7
But we can split out a few subroutines to handle the few
16
Implement the correct (hysteresis) behaviour by tracking whether we
8
EL0 accessible registers without duplicating code.
17
are currently looking for the temperature to rise over T_high or
18
for it to fall below T_low. Our implementation of the comparator
19
mode (TM==0) wasn't wrong, but rephrase it to match the way that
20
interrupt mode is now handled for clarity.
9
21
10
Reported-by: Christophe Lyon <christophe.lyon@linaro.org>
11
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
12
Message-id: 20191118194916.3670-1-richard.henderson@linaro.org
13
[PMM: deleted now-redundant comment; added a default case
14
to switch in v7m_msr helper]
15
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
22
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
23
Reviewed-by: Cédric Le Goater <clg@kaod.org>
24
Message-id: 20201110150023.25533-3-peter.maydell@linaro.org
17
---
25
---
18
target/arm/cpu.h | 2 +
26
hw/misc/tmp105.h | 7 +++++
19
target/arm/m_helper.c | 114 ++++++++++++++++++++++++++----------------
27
hw/misc/tmp105.c | 70 +++++++++++++++++++++++++++++++++++++++++-------
20
2 files changed, 73 insertions(+), 43 deletions(-)
28
2 files changed, 68 insertions(+), 9 deletions(-)
21
29
22
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
30
diff --git a/hw/misc/tmp105.h b/hw/misc/tmp105.h
23
index XXXXXXX..XXXXXXX 100644
31
index XXXXXXX..XXXXXXX 100644
24
--- a/target/arm/cpu.h
32
--- a/hw/misc/tmp105.h
25
+++ b/target/arm/cpu.h
33
+++ b/hw/misc/tmp105.h
26
@@ -XXX,XX +XXX,XX @@ static inline void xpsr_write(CPUARMState *env, uint32_t val, uint32_t mask)
34
@@ -XXX,XX +XXX,XX @@ struct TMP105State {
27
if (mask & XPSR_GE) {
35
int16_t limit[2];
28
env->GE = (val & XPSR_GE) >> 16;
36
int faults;
37
uint8_t alarm;
38
+ /*
39
+ * The TMP105 initially looks for a temperature rising above T_high;
40
+ * once this is detected, the condition it looks for next is the
41
+ * temperature falling below T_low. This flag is false when initially
42
+ * looking for T_high, true when looking for T_low.
43
+ */
44
+ bool detect_falling;
45
};
46
47
#endif
48
diff --git a/hw/misc/tmp105.c b/hw/misc/tmp105.c
49
index XXXXXXX..XXXXXXX 100644
50
--- a/hw/misc/tmp105.c
51
+++ b/hw/misc/tmp105.c
52
@@ -XXX,XX +XXX,XX @@ static void tmp105_alarm_update(TMP105State *s)
53
return;
29
}
54
}
30
+#ifndef CONFIG_USER_ONLY
55
31
if (mask & XPSR_T) {
56
- if ((s->config >> 1) & 1) {                    /* TM */
32
env->thumb = ((val & XPSR_T) != 0);
57
- if (s->temperature >= s->limit[1])
58
- s->alarm = 1;
59
- else if (s->temperature < s->limit[0])
60
- s->alarm = 1;
61
+ if (s->config >> 1 & 1) {
62
+ /*
63
+ * TM == 1 : Interrupt mode. We signal Alert when the
64
+ * temperature rises above T_high, and expect the guest to clear
65
+ * it (eg by reading a device register).
66
+ */
67
+ if (s->detect_falling) {
68
+ if (s->temperature < s->limit[0]) {
69
+ s->alarm = 1;
70
+ s->detect_falling = false;
71
+ }
72
+ } else {
73
+ if (s->temperature >= s->limit[1]) {
74
+ s->alarm = 1;
75
+ s->detect_falling = true;
76
+ }
77
+ }
78
} else {
79
- if (s->temperature >= s->limit[1])
80
- s->alarm = 1;
81
- else if (s->temperature < s->limit[0])
82
- s->alarm = 0;
83
+ /*
84
+ * TM == 0 : Comparator mode. We signal Alert when the temperature
85
+ * rises above T_high, and stop signalling it when the temperature
86
+ * falls below T_low.
87
+ */
88
+ if (s->detect_falling) {
89
+ if (s->temperature < s->limit[0]) {
90
+ s->alarm = 0;
91
+ s->detect_falling = false;
92
+ }
93
+ } else {
94
+ if (s->temperature >= s->limit[1]) {
95
+ s->alarm = 1;
96
+ s->detect_falling = true;
97
+ }
98
+ }
33
}
99
}
34
@@ -XXX,XX +XXX,XX @@ static inline void xpsr_write(CPUARMState *env, uint32_t val, uint32_t mask)
100
35
/* Note that this only happens on exception exit */
101
tmp105_interrupt_update(s);
36
write_v7m_exception(env, val & XPSR_EXCP);
102
@@ -XXX,XX +XXX,XX @@ static int tmp105_post_load(void *opaque, int version_id)
37
}
103
return 0;
38
+#endif
39
}
104
}
40
105
41
#define HCR_VM (1ULL << 0)
106
+static bool detect_falling_needed(void *opaque)
42
diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c
43
index XXXXXXX..XXXXXXX 100644
44
--- a/target/arm/m_helper.c
45
+++ b/target/arm/m_helper.c
46
@@ -XXX,XX +XXX,XX @@
47
#include "exec/cpu_ldst.h"
48
#endif
49
50
+static void v7m_msr_xpsr(CPUARMState *env, uint32_t mask,
51
+ uint32_t reg, uint32_t val)
52
+{
107
+{
53
+ /* Only APSR is actually writable */
108
+ TMP105State *s = opaque;
54
+ if (!(reg & 4)) {
55
+ uint32_t apsrmask = 0;
56
+
109
+
57
+ if (mask & 8) {
110
+ /*
58
+ apsrmask |= XPSR_NZCV | XPSR_Q;
111
+ * We only need to migrate the detect_falling bool if it's set;
59
+ }
112
+ * for migration from older machines we assume that it is false
60
+ if ((mask & 4) && arm_feature(env, ARM_FEATURE_THUMB_DSP)) {
113
+ * (ie temperature is not out of range).
61
+ apsrmask |= XPSR_GE;
114
+ */
62
+ }
115
+ return s->detect_falling;
63
+ xpsr_write(env, val, apsrmask);
64
+ }
65
+}
116
+}
66
+
117
+
67
+static uint32_t v7m_mrs_xpsr(CPUARMState *env, uint32_t reg, unsigned el)
118
+static const VMStateDescription vmstate_tmp105_detect_falling = {
68
+{
119
+ .name = "TMP105/detect-falling",
69
+ uint32_t mask = 0;
120
+ .version_id = 1,
121
+ .minimum_version_id = 1,
122
+ .needed = detect_falling_needed,
123
+ .fields = (VMStateField[]) {
124
+ VMSTATE_BOOL(detect_falling, TMP105State),
125
+ VMSTATE_END_OF_LIST()
126
+ }
127
+};
70
+
128
+
71
+ if ((reg & 1) && el) {
129
static const VMStateDescription vmstate_tmp105 = {
72
+ mask |= XPSR_EXCP; /* IPSR (unpriv. reads as zero) */
130
.name = "TMP105",
73
+ }
131
.version_id = 0,
74
+ if (!(reg & 4)) {
132
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_tmp105 = {
75
+ mask |= XPSR_NZCV | XPSR_Q; /* APSR */
133
VMSTATE_UINT8(alarm, TMP105State),
76
+ if (arm_feature(env, ARM_FEATURE_THUMB_DSP)) {
134
VMSTATE_I2C_SLAVE(i2c, TMP105State),
77
+ mask |= XPSR_GE;
135
VMSTATE_END_OF_LIST()
78
+ }
136
+ },
79
+ }
137
+ .subsections = (const VMStateDescription*[]) {
80
+ /* EPSR reads as zero */
138
+ &vmstate_tmp105_detect_falling,
81
+ return xpsr_read(env) & mask;
139
+ NULL
82
+}
140
}
83
+
141
};
84
+static uint32_t v7m_mrs_control(CPUARMState *env, uint32_t secure)
142
85
+{
143
@@ -XXX,XX +XXX,XX @@ static void tmp105_reset(I2CSlave *i2c)
86
+ uint32_t value = env->v7m.control[secure];
144
s->config = 0;
87
+
145
s->faults = tmp105_faultq[(s->config >> 3) & 3];
88
+ if (!secure) {
146
s->alarm = 0;
89
+ /* SFPA is RAZ/WI from NS; FPCA is stored in the M_REG_S bank */
147
+ s->detect_falling = false;
90
+ value |= env->v7m.control[M_REG_S] & R_V7M_CONTROL_FPCA_MASK;
148
91
+ }
149
s->limit[0] = 0x4b00; /* T_LOW, 75 degrees C */
92
+ return value;
150
s->limit[1] = 0x5000; /* T_HIGH, 80 degrees C */
93
+}
94
+
95
#ifdef CONFIG_USER_ONLY
96
97
-/* These should probably raise undefined insn exceptions. */
98
-void HELPER(v7m_msr)(CPUARMState *env, uint32_t reg, uint32_t val)
99
+void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val)
100
{
101
- ARMCPU *cpu = env_archcpu(env);
102
+ uint32_t mask = extract32(maskreg, 8, 4);
103
+ uint32_t reg = extract32(maskreg, 0, 8);
104
105
- cpu_abort(CPU(cpu), "v7m_msr %d\n", reg);
106
+ switch (reg) {
107
+ case 0 ... 7: /* xPSR sub-fields */
108
+ v7m_msr_xpsr(env, mask, reg, val);
109
+ break;
110
+ case 20: /* CONTROL */
111
+ /* There are no sub-fields that are actually writable from EL0. */
112
+ break;
113
+ default:
114
+ /* Unprivileged writes to other registers are ignored */
115
+ break;
116
+ }
117
}
118
119
uint32_t HELPER(v7m_mrs)(CPUARMState *env, uint32_t reg)
120
{
121
- ARMCPU *cpu = env_archcpu(env);
122
-
123
- cpu_abort(CPU(cpu), "v7m_mrs %d\n", reg);
124
- return 0;
125
+ switch (reg) {
126
+ case 0 ... 7: /* xPSR sub-fields */
127
+ return v7m_mrs_xpsr(env, reg, 0);
128
+ case 20: /* CONTROL */
129
+ return v7m_mrs_control(env, 0);
130
+ default:
131
+ /* Unprivileged reads others as zero. */
132
+ return 0;
133
+ }
134
}
135
136
void HELPER(v7m_bxns)(CPUARMState *env, uint32_t dest)
137
@@ -XXX,XX +XXX,XX @@ void arm_v7m_cpu_do_interrupt(CPUState *cs)
138
139
uint32_t HELPER(v7m_mrs)(CPUARMState *env, uint32_t reg)
140
{
141
- uint32_t mask;
142
unsigned el = arm_current_el(env);
143
144
/* First handle registers which unprivileged can read */
145
-
146
switch (reg) {
147
case 0 ... 7: /* xPSR sub-fields */
148
- mask = 0;
149
- if ((reg & 1) && el) {
150
- mask |= XPSR_EXCP; /* IPSR (unpriv. reads as zero) */
151
- }
152
- if (!(reg & 4)) {
153
- mask |= XPSR_NZCV | XPSR_Q; /* APSR */
154
- if (arm_feature(env, ARM_FEATURE_THUMB_DSP)) {
155
- mask |= XPSR_GE;
156
- }
157
- }
158
- /* EPSR reads as zero */
159
- return xpsr_read(env) & mask;
160
- break;
161
+ return v7m_mrs_xpsr(env, reg, el);
162
case 20: /* CONTROL */
163
- {
164
- uint32_t value = env->v7m.control[env->v7m.secure];
165
- if (!env->v7m.secure) {
166
- /* SFPA is RAZ/WI from NS; FPCA is stored in the M_REG_S bank */
167
- value |= env->v7m.control[M_REG_S] & R_V7M_CONTROL_FPCA_MASK;
168
- }
169
- return value;
170
- }
171
+ return v7m_mrs_control(env, env->v7m.secure);
172
case 0x94: /* CONTROL_NS */
173
/*
174
* We have to handle this here because unprivileged Secure code
175
@@ -XXX,XX +XXX,XX @@ void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val)
176
177
switch (reg) {
178
case 0 ... 7: /* xPSR sub-fields */
179
- /* only APSR is actually writable */
180
- if (!(reg & 4)) {
181
- uint32_t apsrmask = 0;
182
-
183
- if (mask & 8) {
184
- apsrmask |= XPSR_NZCV | XPSR_Q;
185
- }
186
- if ((mask & 4) && arm_feature(env, ARM_FEATURE_THUMB_DSP)) {
187
- apsrmask |= XPSR_GE;
188
- }
189
- xpsr_write(env, val, apsrmask);
190
- }
191
+ v7m_msr_xpsr(env, mask, reg, val);
192
break;
193
case 8: /* MSP */
194
if (v7m_using_psp(env)) {
195
--
151
--
196
2.20.1
152
2.20.1
197
153
198
154
diff view generated by jsdifflib