1
Arm queue; bugfixes only.
1
The following changes since commit efcd0ec14b0fe9ee0ee70277763b2d538d19238d:
2
2
3
thanks
3
Merge tag 'misc-fixes-20230330' of https://github.com/philmd/qemu into staging (2023-03-30 14:22:29 +0100)
4
-- PMM
5
6
The following changes since commit 48aa8f0ac536db3550a35c295ff7de94e4c33739:
7
8
Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2020-11-16' into staging (2020-11-17 11:07:00 +0000)
9
4
10
are available in the Git repository at:
5
are available in the Git repository at:
11
6
12
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20201117
7
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20230403
13
8
14
for you to fetch changes up to ab135622cf478585bdfcb68b85e4a817d74a0c42:
9
for you to fetch changes up to a0eaa126af3c5a43937a22c58cfb9bb36e4a5001:
15
10
16
tmp105: Correct handling of temperature limit checks (2020-11-17 12:56:33 +0000)
11
hw/ssi: Fix Linux driver init issue with xilinx_spi (2023-04-03 16:12:30 +0100)
17
12
18
----------------------------------------------------------------
13
----------------------------------------------------------------
19
target-arm queue:
14
* target/arm: Fix non-TCG build failure by inlining pauth_ptr_mask()
20
* hw/arm/virt: ARM_VIRT must select ARM_GIC
15
* hw/arm: do not free machine->fdt in arm_load_dtb()
21
* exynos: Fix bad printf format specifiers
16
* target/arm: Fix generated code for cpreg reads when HSTR is active
22
* hw/input/ps2.c: Remove remnants of printf debug
17
* hw/ssi: Fix Linux driver init issue with xilinx_spi
23
* target/openrisc: Remove dead code attempting to check "is timer disabled"
24
* register: Remove unnecessary NULL check
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
29
18
30
----------------------------------------------------------------
19
----------------------------------------------------------------
31
Alex Chen (1):
20
Chris Rauer (1):
32
exynos: Fix bad printf format specifiers
21
hw/ssi: Fix Linux driver init issue with xilinx_spi
33
22
34
Alistair Francis (1):
23
Markus Armbruster (1):
35
register: Remove unnecessary NULL check
24
hw/arm: do not free machine->fdt in arm_load_dtb()
36
25
37
Andrew Jones (1):
26
Peter Maydell (1):
38
hw/arm/virt: ARM_VIRT must select ARM_GIC
27
target/arm: Fix generated code for cpreg reads when HSTR is active
39
40
Peter Maydell (5):
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
46
28
47
Philippe Mathieu-Daudé (1):
29
Philippe Mathieu-Daudé (1):
48
util/cutils: Fix Coverity array overrun in freq_to_str()
30
target/arm: Fix non-TCG build failure by inlining pauth_ptr_mask()
49
31
50
configure | 11 +++++--
32
target/arm/internals.h | 15 ++++++++++-----
51
hw/misc/tmp105.h | 7 +++++
33
hw/arm/boot.c | 5 ++++-
52
hw/core/register.c | 4 ---
34
hw/ssi/xilinx_spi.c | 1 +
53
hw/input/ps2.c | 9 ------
35
target/arm/gdbstub64.c | 7 +++++--
54
hw/misc/tmp105.c | 73 ++++++++++++++++++++++++++++++++++++++------
36
target/arm/tcg/pauth_helper.c | 18 +-----------------
55
hw/timer/exynos4210_mct.c | 4 +--
37
target/arm/tcg/translate.c | 6 ++++++
56
hw/timer/exynos4210_pwm.c | 8 ++---
38
6 files changed, 27 insertions(+), 25 deletions(-)
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
39
diff view generated by jsdifflib
Deleted patch
1
From: Andrew Jones <drjones@redhat.com>
2
1
3
The removal of the selection of A15MPCORE from ARM_VIRT also
4
removed what A15MPCORE selects, ARM_GIC. We still need ARM_GIC.
5
6
Fixes: bec3c97e0cf9 ("hw/arm/virt: Remove dependency on Cortex-A15 MPCore peripherals")
7
Reported-by: Miroslav Rezanina <mrezanin@redhat.com>
8
Signed-off-by: Andrew Jones <drjones@redhat.com>
9
Reviewed-by: Miroslav Rezanina <mrezanin@redhat.com>
10
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
11
Message-id: 20201111143440.112763-1-drjones@redhat.com
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
14
hw/arm/Kconfig | 1 +
15
1 file changed, 1 insertion(+)
16
17
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
18
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/arm/Kconfig
20
+++ b/hw/arm/Kconfig
21
@@ -XXX,XX +XXX,XX @@ config ARM_VIRT
22
imply VFIO_PLATFORM
23
imply VFIO_XGMAC
24
imply TPM_TIS_SYSBUS
25
+ select ARM_GIC
26
select ACPI
27
select ARM_SMMUV3
28
select GPIO_KEY
29
--
30
2.20.1
31
32
diff view generated by jsdifflib
1
From: Alex Chen <alex.chen@huawei.com>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
We should use printf format specifier "%u" instead of "%d" for
3
aarch64_gdb_get_pauth_reg() -- although disabled since commit
4
argument of type "unsigned int".
4
5787d17a42 ("target/arm: Don't advertise aarch64-pauth.xml to
5
gdb") is still compiled in. It calls pauth_ptr_mask() which is
6
located in target/arm/tcg/pauth_helper.c, a TCG specific helper.
5
7
6
Reported-by: Euler Robot <euler.robot@huawei.com>
8
To avoid a linking error when TCG is not enabled:
7
Signed-off-by: Alex Chen <alex.chen@huawei.com>
9
8
Message-id: 20201111073651.72804-1-alex.chen@huawei.com
10
Undefined symbols for architecture arm64:
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
"_pauth_ptr_mask", referenced from:
12
_aarch64_gdb_get_pauth_reg in target_arm_gdbstub64.c.o
13
ld: symbol(s) not found for architecture arm64
14
clang: error: linker command failed with exit code 1 (use -v to see invocation)
15
16
- Inline pauth_ptr_mask() in aarch64_gdb_get_pauth_reg()
17
(this is the single user),
18
- Rename pauth_ptr_mask_internal() as pauth_ptr_mask() and
19
inline it in "internals.h",
20
21
Fixes: e995d5cce4 ("target/arm: Implement gdbstub pauth extension")
22
Suggested-by: Richard Henderson <richard.henderson@linaro.org>
23
Reviewed-by: Fabiano Rosas <farosas@suse.de>
24
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
25
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
26
Message-id: 20230328212516.29592-1-philmd@linaro.org
27
[PMM: reinstated doc comment]
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
28
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
29
---
12
hw/timer/exynos4210_mct.c | 4 ++--
30
target/arm/internals.h | 15 ++++++++++-----
13
hw/timer/exynos4210_pwm.c | 8 ++++----
31
target/arm/gdbstub64.c | 7 +++++--
14
2 files changed, 6 insertions(+), 6 deletions(-)
32
target/arm/tcg/pauth_helper.c | 18 +-----------------
33
3 files changed, 16 insertions(+), 24 deletions(-)
15
34
16
diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c
35
diff --git a/target/arm/internals.h b/target/arm/internals.h
17
index XXXXXXX..XXXXXXX 100644
36
index XXXXXXX..XXXXXXX 100644
18
--- a/hw/timer/exynos4210_mct.c
37
--- a/target/arm/internals.h
19
+++ b/hw/timer/exynos4210_mct.c
38
+++ b/target/arm/internals.h
20
@@ -XXX,XX +XXX,XX @@ static void exynos4210_gcomp_raise_irq(void *opaque, uint32_t id)
39
@@ -XXX,XX +XXX,XX @@ bool arm_generate_debug_exceptions(CPUARMState *env);
21
/* If CSTAT is pending and IRQ is enabled */
40
22
if ((s->reg.int_cstat & G_INT_CSTAT_COMP(id)) &&
41
/**
23
(s->reg.int_enb & G_INT_ENABLE(id))) {
42
* pauth_ptr_mask:
24
- DPRINTF("gcmp timer[%d] IRQ\n", id);
43
- * @env: cpu context
25
+ DPRINTF("gcmp timer[%u] IRQ\n", id);
44
- * @ptr: selects between TTBR0 and TTBR1
26
qemu_irq_raise(s->irq[id]);
45
- * @data: selects between TBI and TBID
46
+ * @param: parameters defining the MMU setup
47
*
48
- * Return a mask of the bits of @ptr that contain the authentication code.
49
+ * Return a mask of the address bits that contain the authentication code,
50
+ * given the MMU config defined by @param.
51
*/
52
-uint64_t pauth_ptr_mask(CPUARMState *env, uint64_t ptr, bool data);
53
+static inline uint64_t pauth_ptr_mask(ARMVAParameters param)
54
+{
55
+ int bot_pac_bit = 64 - param.tsz;
56
+ int top_pac_bit = 64 - 8 * param.tbi;
57
+
58
+ return MAKE_64BIT_MASK(bot_pac_bit, top_pac_bit - bot_pac_bit);
59
+}
60
61
/* Add the cpreg definitions for debug related system registers */
62
void define_debug_regs(ARMCPU *cpu);
63
diff --git a/target/arm/gdbstub64.c b/target/arm/gdbstub64.c
64
index XXXXXXX..XXXXXXX 100644
65
--- a/target/arm/gdbstub64.c
66
+++ b/target/arm/gdbstub64.c
67
@@ -XXX,XX +XXX,XX @@ int aarch64_gdb_get_pauth_reg(CPUARMState *env, GByteArray *buf, int reg)
68
{
69
bool is_data = !(reg & 1);
70
bool is_high = reg & 2;
71
- uint64_t mask = pauth_ptr_mask(env, -is_high, is_data);
72
- return gdb_get_reg64(buf, mask);
73
+ ARMMMUIdx mmu_idx = arm_stage1_mmu_idx(env);
74
+ ARMVAParameters param;
75
+
76
+ param = aa64_va_parameters(env, -is_high, mmu_idx, is_data);
77
+ return gdb_get_reg64(buf, pauth_ptr_mask(param));
78
}
79
default:
80
return 0;
81
diff --git a/target/arm/tcg/pauth_helper.c b/target/arm/tcg/pauth_helper.c
82
index XXXXXXX..XXXXXXX 100644
83
--- a/target/arm/tcg/pauth_helper.c
84
+++ b/target/arm/tcg/pauth_helper.c
85
@@ -XXX,XX +XXX,XX @@ static uint64_t pauth_addpac(CPUARMState *env, uint64_t ptr, uint64_t modifier,
86
return pac | ext | ptr;
87
}
88
89
-static uint64_t pauth_ptr_mask_internal(ARMVAParameters param)
90
-{
91
- int bot_pac_bit = 64 - param.tsz;
92
- int top_pac_bit = 64 - 8 * param.tbi;
93
-
94
- return MAKE_64BIT_MASK(bot_pac_bit, top_pac_bit - bot_pac_bit);
95
-}
96
-
97
static uint64_t pauth_original_ptr(uint64_t ptr, ARMVAParameters param)
98
{
99
- uint64_t mask = pauth_ptr_mask_internal(param);
100
+ uint64_t mask = pauth_ptr_mask(param);
101
102
/* Note that bit 55 is used whether or not the regime has 2 ranges. */
103
if (extract64(ptr, 55, 1)) {
104
@@ -XXX,XX +XXX,XX @@ static uint64_t pauth_original_ptr(uint64_t ptr, ARMVAParameters param)
27
}
105
}
28
}
106
}
29
@@ -XXX,XX +XXX,XX @@ static void exynos4210_mct_update_freq(Exynos4210MCTState *s)
107
30
MCT_CFG_GET_DIVIDER(s->reg_mct_cfg));
108
-uint64_t pauth_ptr_mask(CPUARMState *env, uint64_t ptr, bool data)
31
109
-{
32
if (freq != s->freq) {
110
- ARMMMUIdx mmu_idx = arm_stage1_mmu_idx(env);
33
- DPRINTF("freq=%dHz\n", s->freq);
111
- ARMVAParameters param = aa64_va_parameters(env, ptr, mmu_idx, data);
34
+ DPRINTF("freq=%uHz\n", s->freq);
112
-
35
113
- return pauth_ptr_mask_internal(param);
36
/* global timer */
114
-}
37
tx_ptimer_set_freq(s->g_timer.ptimer_frc, s->freq);
115
-
38
diff --git a/hw/timer/exynos4210_pwm.c b/hw/timer/exynos4210_pwm.c
116
static uint64_t pauth_auth(CPUARMState *env, uint64_t ptr, uint64_t modifier,
39
index XXXXXXX..XXXXXXX 100644
117
ARMPACKey *key, bool data, int keynumber)
40
--- a/hw/timer/exynos4210_pwm.c
118
{
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);
77
--
119
--
78
2.20.1
120
2.34.1
79
121
80
122
diff view generated by jsdifflib
Deleted patch
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.
6
1
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
9
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
10
Message-id: 20201101133258.4240-1-peter.maydell@linaro.org
11
---
12
hw/input/ps2.c | 9 ---------
13
1 file changed, 9 deletions(-)
14
15
diff --git a/hw/input/ps2.c b/hw/input/ps2.c
16
index XXXXXXX..XXXXXXX 100644
17
--- a/hw/input/ps2.c
18
+++ b/hw/input/ps2.c
19
@@ -XXX,XX +XXX,XX @@
20
21
#include "trace.h"
22
23
-/* debug PC keyboard */
24
-//#define DEBUG_KBD
25
-
26
-/* debug PC keyboard : only mouse */
27
-//#define DEBUG_MOUSE
28
-
29
/* Keyboard Commands */
30
#define KBD_CMD_SET_LEDS    0xED    /* Set keyboard leds */
31
#define KBD_CMD_ECHO     0xEE
32
@@ -XXX,XX +XXX,XX @@ void ps2_write_mouse(void *opaque, int val)
33
PS2MouseState *s = (PS2MouseState *)opaque;
34
35
trace_ps2_write_mouse(opaque, val);
36
-#ifdef DEBUG_MOUSE
37
- printf("kbd: write mouse 0x%02x\n", val);
38
-#endif
39
switch(s->common.write_cmd) {
40
default:
41
case -1:
42
--
43
2.20.1
44
45
diff view generated by jsdifflib
Deleted 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.)
5
1
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: Alistair Francis <alistair.francis@wdc.com>
1
From: Markus Armbruster <armbru@redhat.com>
2
2
3
This patch fixes CID 1432800 by removing an unnecessary check.
3
At this moment, arm_load_dtb() can free machine->fdt when
4
binfo->dtb_filename is NULL. If there's no 'dtb_filename', 'fdt' will be
5
retrieved by binfo->get_dtb(). If get_dtb() returns machine->fdt, as is
6
the case of machvirt_dtb() from hw/arm/virt.c, fdt now has a pointer to
7
machine->fdt. And, in that case, the existing g_free(fdt) at the end of
8
arm_load_dtb() will make machine->fdt point to an invalid memory region.
4
9
5
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
10
Since monitor command 'dumpdtb' was introduced a couple of releases
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
ago, running it with any ARM machine that uses arm_load_dtb() will
12
crash QEMU.
13
14
Let's enable all arm_load_dtb() callers to use dumpdtb properly. Instead
15
of freeing 'fdt', assign it back to ms->fdt.
16
17
Cc: Peter Maydell <peter.maydell@linaro.org>
18
Cc: qemu-arm@nongnu.org
19
Fixes: bf353ad55590f ("qmp/hmp, device_tree.c: introduce dumpdtb")
20
Reported-by: Markus Armbruster <armbru@redhat.com>
21
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
22
Signed-off-by: Markus Armbruster <armbru@redhat.com>
23
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
24
Message-id: 20230328165935.1512846-1-armbru@redhat.com
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
25
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
---
26
---
9
hw/core/register.c | 4 ----
27
hw/arm/boot.c | 5 ++++-
10
1 file changed, 4 deletions(-)
28
1 file changed, 4 insertions(+), 1 deletion(-)
11
29
12
diff --git a/hw/core/register.c b/hw/core/register.c
30
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
13
index XXXXXXX..XXXXXXX 100644
31
index XXXXXXX..XXXXXXX 100644
14
--- a/hw/core/register.c
32
--- a/hw/arm/boot.c
15
+++ b/hw/core/register.c
33
+++ b/hw/arm/boot.c
16
@@ -XXX,XX +XXX,XX @@ static RegisterInfoArray *register_init_block(DeviceState *owner,
34
@@ -XXX,XX +XXX,XX @@ int arm_load_dtb(hwaddr addr, const struct arm_boot_info *binfo,
17
int index = rae[i].addr / data_size;
35
qemu_register_reset_nosnapshotload(qemu_fdt_randomize_seeds,
18
RegisterInfo *r = &ri[index];
36
rom_ptr_for_as(as, addr, size));
19
37
20
- if (data + data_size * index == 0 || !&rae[i]) {
38
- g_free(fdt);
21
- continue;
39
+ if (fdt != ms->fdt) {
22
- }
40
+ g_free(ms->fdt);
23
-
41
+ ms->fdt = fdt;
24
/* Init the register, this will zero it. */
42
+ }
25
object_initialize((void *)r, sizeof(*r), TYPE_REGISTER);
43
44
return size;
26
45
27
--
46
--
28
2.20.1
47
2.34.1
29
30
diff view generated by jsdifflib
1
The TMP105 datasheet says that in Interrupt Mode (when TM==1) the device
1
In commit 049edada we added some code to handle HSTR_EL2 traps, which
2
signals an alert when the temperature equals or exceeds the T_high value and
2
we did as an inline "conditionally branch over a
3
then remains high until a device register is read or the device responds to
3
gen_exception_insn()". Unfortunately this fails to take account of
4
the SMBUS Alert Response address, or the device is put into Shutdown Mode.
4
the fact that gen_exception_insn() will set s->base.is_jmp to
5
Thereafter the Alert pin will only be re-signalled when temperature falls
5
DISAS_NORETURN. That means that at the end of the TB we won't
6
below T_low; alert can then be cleared in the same set of ways, and the
6
generate the necessary code to handle the "branched over the trap and
7
device returns to its initial "alert when temperature goes above T_high"
7
continued normal execution" codepath. The result is that the TCG
8
mode. (If this textual description is confusing, see figure 3 in the
8
main loop thinks that we stopped execution of the TB due to a
9
TI datasheet at https://www.ti.com/lit/gpn/tmp105 .)
9
situation that only happens when icount is enabled, and hits an
10
assertion. Explicitly set is_jmp back to DISAS_NEXT so we generate
11
the correct code for when execution continues past this insn.
10
12
11
We were misimplementing this as a simple "always alert if temperature is
13
Note that this only happens for cpreg reads; writes will call
12
above T_high or below T_low" condition, which gives a spurious alert on
14
gen_lookup_tb() which generates a valid end-of-TB.
13
startup if using the "T_high = 80 degrees C, T_low = 75 degrees C" reset
14
limit values.
15
15
16
Implement the correct (hysteresis) behaviour by tracking whether we
16
Fixes: 049edada ("target/arm: Make HSTR_EL2 traps take priority over UNDEF-at-EL1")
17
are currently looking for the temperature to rise over T_high or
17
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1551
18
for it to fall below T_low. Our implementation of the comparator
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
mode (TM==0) wasn't wrong, but rephrase it to match the way that
19
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
20
interrupt mode is now handled for clarity.
20
Message-id: 20230330101900.2320380-1-peter.maydell@linaro.org
21
---
22
target/arm/tcg/translate.c | 6 ++++++
23
1 file changed, 6 insertions(+)
21
24
22
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
25
diff --git a/target/arm/tcg/translate.c b/target/arm/tcg/translate.c
23
Reviewed-by: Cédric Le Goater <clg@kaod.org>
24
Message-id: 20201110150023.25533-3-peter.maydell@linaro.org
25
---
26
hw/misc/tmp105.h | 7 +++++
27
hw/misc/tmp105.c | 70 +++++++++++++++++++++++++++++++++++++++++-------
28
2 files changed, 68 insertions(+), 9 deletions(-)
29
30
diff --git a/hw/misc/tmp105.h b/hw/misc/tmp105.h
31
index XXXXXXX..XXXXXXX 100644
26
index XXXXXXX..XXXXXXX 100644
32
--- a/hw/misc/tmp105.h
27
--- a/target/arm/tcg/translate.c
33
+++ b/hw/misc/tmp105.h
28
+++ b/target/arm/tcg/translate.c
34
@@ -XXX,XX +XXX,XX @@ struct TMP105State {
29
@@ -XXX,XX +XXX,XX @@ static void do_coproc_insn(DisasContext *s, int cpnum, int is64,
35
int16_t limit[2];
30
tcg_gen_brcondi_i32(TCG_COND_EQ, t, 0, over.label);
36
int faults;
31
37
uint8_t alarm;
32
gen_exception_insn(s, 0, EXCP_UDEF, syndrome);
38
+ /*
33
+ /*
39
+ * The TMP105 initially looks for a temperature rising above T_high;
34
+ * gen_exception_insn() will set is_jmp to DISAS_NORETURN,
40
+ * once this is detected, the condition it looks for next is the
35
+ * but since we're conditionally branching over it, we want
41
+ * temperature falling below T_low. This flag is false when initially
36
+ * to assume continue-to-next-instruction.
42
+ * looking for T_high, true when looking for T_low.
37
+ */
43
+ */
38
+ s->base.is_jmp = DISAS_NEXT;
44
+ bool detect_falling;
39
set_disas_label(s, over);
45
};
40
}
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;
54
}
41
}
55
56
- if ((s->config >> 1) & 1) {                    /* TM */
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
+ }
99
}
100
101
tmp105_interrupt_update(s);
102
@@ -XXX,XX +XXX,XX @@ static int tmp105_post_load(void *opaque, int version_id)
103
return 0;
104
}
105
106
+static bool detect_falling_needed(void *opaque)
107
+{
108
+ TMP105State *s = opaque;
109
+
110
+ /*
111
+ * We only need to migrate the detect_falling bool if it's set;
112
+ * for migration from older machines we assume that it is false
113
+ * (ie temperature is not out of range).
114
+ */
115
+ return s->detect_falling;
116
+}
117
+
118
+static const VMStateDescription vmstate_tmp105_detect_falling = {
119
+ .name = "TMP105/detect-falling",
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
+};
128
+
129
static const VMStateDescription vmstate_tmp105 = {
130
.name = "TMP105",
131
.version_id = 0,
132
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_tmp105 = {
133
VMSTATE_UINT8(alarm, TMP105State),
134
VMSTATE_I2C_SLAVE(i2c, TMP105State),
135
VMSTATE_END_OF_LIST()
136
+ },
137
+ .subsections = (const VMStateDescription*[]) {
138
+ &vmstate_tmp105_detect_falling,
139
+ NULL
140
}
141
};
142
143
@@ -XXX,XX +XXX,XX @@ static void tmp105_reset(I2CSlave *i2c)
144
s->config = 0;
145
s->faults = tmp105_faultq[(s->config >> 3) & 3];
146
s->alarm = 0;
147
+ s->detect_falling = false;
148
149
s->limit[0] = 0x4b00; /* T_LOW, 75 degrees C */
150
s->limit[1] = 0x5000; /* T_HIGH, 80 degrees C */
151
--
42
--
152
2.20.1
43
2.34.1
153
154
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Chris Rauer <crauer@google.com>
2
2
3
Fix Coverity CID 1435957: Memory - illegal accesses (OVERRUN):
3
The problem is that the Linux driver expects the master transaction inhibit
4
bit(R_SPICR_MTI) to be set during driver initialization so that it can
5
detect the fifo size but QEMU defaults it to zero out of reset. The
6
datasheet indicates this bit is active on reset.
4
7
5
>>> Overrunning array "suffixes" of 7 8-byte elements at element
8
See page 25, SPI Control Register section:
6
index 7 (byte offset 63) using index "idx" (which evaluates to 7).
9
https://www.xilinx.com/content/dam/xilinx/support/documents/ip_documentation/axi_quad_spi/v3_2/pg153-axi-quad-spi.pdf
7
10
8
Note, the biggest input value freq_to_str() can accept is UINT64_MAX,
11
Signed-off-by: Chris Rauer <crauer@google.com>
9
which is ~18.446 EHz, less than 1000 EHz.
12
Message-id: 20230323182811.2641044-1-crauer@google.com
10
13
Reviewed-by: Edgar E. Iglesias <edgar@zeroasic.com>
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>
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
---
15
---
21
util/cutils.c | 3 ++-
16
hw/ssi/xilinx_spi.c | 1 +
22
1 file changed, 2 insertions(+), 1 deletion(-)
17
1 file changed, 1 insertion(+)
23
18
24
diff --git a/util/cutils.c b/util/cutils.c
19
diff --git a/hw/ssi/xilinx_spi.c b/hw/ssi/xilinx_spi.c
25
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
26
--- a/util/cutils.c
21
--- a/hw/ssi/xilinx_spi.c
27
+++ b/util/cutils.c
22
+++ b/hw/ssi/xilinx_spi.c
28
@@ -XXX,XX +XXX,XX @@ char *freq_to_str(uint64_t freq_hz)
23
@@ -XXX,XX +XXX,XX @@ static void xlx_spi_do_reset(XilinxSPI *s)
29
double freq = freq_hz;
24
txfifo_reset(s);
30
size_t idx = 0;
25
31
26
s->regs[R_SPISSR] = ~0;
32
- while (freq >= 1000.0 && idx < ARRAY_SIZE(suffixes)) {
27
+ s->regs[R_SPICR] = R_SPICR_MTI;
33
+ while (freq >= 1000.0) {
28
xlx_spi_update_irq(s);
34
freq /= 1000.0;
29
xlx_spi_update_cs(s);
35
idx++;
36
}
37
+ assert(idx < ARRAY_SIZE(suffixes));
38
39
return g_strdup_printf("%0.3g %sHz", freq, suffixes[idx]);
40
}
30
}
41
--
31
--
42
2.20.1
32
2.34.1
43
44
diff view generated by jsdifflib
Deleted 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.
8
1
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
Deleted patch
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.
7
1
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...
12
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
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(+)
19
20
diff --git a/hw/misc/tmp105.c b/hw/misc/tmp105.c
21
index XXXXXXX..XXXXXXX 100644
22
--- a/hw/misc/tmp105.c
23
+++ b/hw/misc/tmp105.c
24
@@ -XXX,XX +XXX,XX @@ static void tmp105_reset(I2CSlave *i2c)
25
s->faults = tmp105_faultq[(s->config >> 3) & 3];
26
s->alarm = 0;
27
28
+ s->limit[0] = 0x4b00; /* T_LOW, 75 degrees C */
29
+ s->limit[1] = 0x5000; /* T_HIGH, 80 degrees C */
30
+
31
tmp105_interrupt_update(s);
32
}
33
34
--
35
2.20.1
36
37
diff view generated by jsdifflib