1 | A collection of bug fixes for rc2... | 1 | Arm queue; bugfixes only. |
---|---|---|---|
2 | 2 | ||
3 | The following changes since commit 146aa0f104bb3bf88e43c4082a0bfc4bbda4fbd8: | 3 | thanks |
4 | -- PMM | ||
4 | 5 | ||
5 | Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging (2020-04-03 15:30:11 +0100) | 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) | ||
6 | 9 | ||
7 | are available in the Git repository at: | 10 | are available in the Git repository at: |
8 | 11 | ||
9 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20200406 | 12 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20201117 |
10 | 13 | ||
11 | for you to fetch changes up to 8893790966d9c964557ad01be4a68ef50696ace8: | 14 | for you to fetch changes up to ab135622cf478585bdfcb68b85e4a817d74a0c42: |
12 | 15 | ||
13 | dma/xlnx-zdma: Reorg to fix CUR_DSCR (2020-04-06 10:59:56 +0100) | 16 | tmp105: Correct handling of temperature limit checks (2020-11-17 12:56:33 +0000) |
14 | 17 | ||
15 | ---------------------------------------------------------------- | 18 | ---------------------------------------------------------------- |
16 | target-arm queue: | 19 | target-arm queue: |
17 | * don't expose "ieee_half" via gdbstub (prevents gdb crashes or errors | 20 | * hw/arm/virt: ARM_VIRT must select ARM_GIC |
18 | with older GDB versions) | 21 | * exynos: Fix bad printf format specifiers |
19 | * hw/arm/collie: Put StrongARMState* into a CollieMachineState struct | 22 | * hw/input/ps2.c: Remove remnants of printf debug |
20 | * PSTATE.PAN should not clear exec bits | 23 | * target/openrisc: Remove dead code attempting to check "is timer disabled" |
21 | * hw/gpio/aspeed_gpio.c: Don't directly include assert.h | 24 | * register: Remove unnecessary NULL check |
22 | (fixes compilation on some Windows build scenarios) | 25 | * util/cutils: Fix Coverity array overrun in freq_to_str() |
23 | * dump: Fix writing of ELF section | 26 | * configure: Make "does libgio work" test pull in some actual functions |
24 | * dma/xlnx-zdma: various bug fixes | 27 | * tmp105: reset the T_low and T_High registers |
25 | * target/arm/helperc. delete obsolete TODO comment | 28 | * tmp105: Correct handling of temperature limit checks |
26 | 29 | ||
27 | ---------------------------------------------------------------- | 30 | ---------------------------------------------------------------- |
28 | Alex Bennée (1): | 31 | Alex Chen (1): |
29 | target/arm: don't expose "ieee_half" via gdbstub | 32 | exynos: Fix bad printf format specifiers |
30 | 33 | ||
31 | Edgar E. Iglesias (5): | 34 | Alistair Francis (1): |
32 | dma/xlnx-zdma: Remove comment | 35 | register: Remove unnecessary NULL check |
33 | dma/xlnx-zdma: Populate DBG0.CMN_BUF_FREE | 36 | |
34 | dma/xlnx-zdma: Clear DMA_DONE when halting | 37 | Andrew Jones (1): |
35 | dma/xlnx-zdma: Advance the descriptor address when stopping | 38 | hw/arm/virt: ARM_VIRT must select ARM_GIC |
36 | dma/xlnx-zdma: Reorg to fix CUR_DSCR | ||
37 | 39 | ||
38 | Peter Maydell (5): | 40 | Peter Maydell (5): |
39 | hw/arm/collie: Put StrongARMState* into a CollieMachineState struct | 41 | hw/input/ps2.c: Remove remnants of printf debug |
40 | target/arm: PSTATE.PAN should not clear exec bits | 42 | target/openrisc: Remove dead code attempting to check "is timer disabled" |
41 | target/arm: Remove obsolete TODO note from get_phys_addr_lpae() | 43 | configure: Make "does libgio work" test pull in some actual functions |
42 | hw/gpio/aspeed_gpio.c: Don't directly include assert.h | 44 | hw/misc/tmp105: reset the T_low and T_High registers |
43 | dump: Fix writing of ELF section | 45 | tmp105: Correct handling of temperature limit checks |
44 | 46 | ||
45 | dump/dump.c | 2 +- | 47 | Philippe Mathieu-Daudé (1): |
46 | hw/arm/collie.c | 33 +++++++++++++++++++++++++----- | 48 | util/cutils: Fix Coverity array overrun in freq_to_str() |
47 | hw/dma/xlnx-zdma.c | 56 ++++++++++++++++++++++++++------------------------- | ||
48 | hw/gpio/aspeed_gpio.c | 2 -- | ||
49 | target/arm/gdbstub.c | 7 ++++++- | ||
50 | target/arm/helper.c | 13 +++++------- | ||
51 | 6 files changed, 69 insertions(+), 44 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 |
Deleted patch | |||
---|---|---|---|
1 | From: Alex Bennée <alex.bennee@linaro.org> | ||
2 | 1 | ||
3 | While support for parsing ieee_half in the XML description was added | ||
4 | to gdb in 2019 (a6d0f249) there is no easy way for the gdbstub to know | ||
5 | if the gdb end will understand it. Disable it for now and allow older | ||
6 | gdbs to successfully connect to the default -cpu max SVE enabled | ||
7 | QEMUs. | ||
8 | |||
9 | Signed-off-by: Alex Bennée <alex.bennee@linaro.org> | ||
10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
11 | Message-id: 20200402143913.24005-1-alex.bennee@linaro.org | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | --- | ||
14 | target/arm/gdbstub.c | 7 ++++++- | ||
15 | 1 file changed, 6 insertions(+), 1 deletion(-) | ||
16 | |||
17 | diff --git a/target/arm/gdbstub.c b/target/arm/gdbstub.c | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/target/arm/gdbstub.c | ||
20 | +++ b/target/arm/gdbstub.c | ||
21 | @@ -XXX,XX +XXX,XX @@ static const struct TypeSize vec_lanes[] = { | ||
22 | /* 16 bit */ | ||
23 | { "uint16", 16, 'h', 'u' }, | ||
24 | { "int16", 16, 'h', 's' }, | ||
25 | - { "ieee_half", 16, 'h', 'f' }, | ||
26 | + /* | ||
27 | + * TODO: currently there is no reliable way of telling | ||
28 | + * if the remote gdb actually understands ieee_half so | ||
29 | + * we don't expose it in the target description for now. | ||
30 | + * { "ieee_half", 16, 'h', 'f' }, | ||
31 | + */ | ||
32 | /* bytes */ | ||
33 | { "uint8", 8, 'b', 'u' }, | ||
34 | { "int8", 8, 'b', 's' }, | ||
35 | -- | ||
36 | 2.20.1 | ||
37 | |||
38 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Andrew Jones <drjones@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | Clear DMA_DONE when halting the DMA channel. | 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: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 6 | Fixes: bec3c97e0cf9 ("hw/arm/virt: Remove dependency on Cortex-A15 MPCore peripherals") |
6 | Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com> | 7 | Reported-by: Miroslav Rezanina <mrezanin@redhat.com> |
7 | Acked-by: Alistair Francis <alistair.francis@wdc.com> | 8 | Signed-off-by: Andrew Jones <drjones@redhat.com> |
8 | Message-id: 20200402134721.27863-4-edgar.iglesias@gmail.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 | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 13 | --- |
11 | hw/dma/xlnx-zdma.c | 1 + | 14 | hw/arm/Kconfig | 1 + |
12 | 1 file changed, 1 insertion(+) | 15 | 1 file changed, 1 insertion(+) |
13 | 16 | ||
14 | diff --git a/hw/dma/xlnx-zdma.c b/hw/dma/xlnx-zdma.c | 17 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig |
15 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/dma/xlnx-zdma.c | 19 | --- a/hw/arm/Kconfig |
17 | +++ b/hw/dma/xlnx-zdma.c | 20 | +++ b/hw/arm/Kconfig |
18 | @@ -XXX,XX +XXX,XX @@ static void zdma_process_descr(XlnxZDMA *s) | 21 | @@ -XXX,XX +XXX,XX @@ config ARM_VIRT |
19 | if (src_cmd == CMD_HALT) { | 22 | imply VFIO_PLATFORM |
20 | zdma_set_state(s, PAUSED); | 23 | imply VFIO_XGMAC |
21 | ARRAY_FIELD_DP32(s->regs, ZDMA_CH_ISR, DMA_PAUSE, 1); | 24 | imply TPM_TIS_SYSBUS |
22 | + ARRAY_FIELD_DP32(s->regs, ZDMA_CH_ISR, DMA_DONE, false); | 25 | + select ARM_GIC |
23 | zdma_ch_imr_update_irq(s); | 26 | select ACPI |
24 | return; | 27 | select ARM_SMMUV3 |
25 | } | 28 | select GPIO_KEY |
26 | -- | 29 | -- |
27 | 2.20.1 | 30 | 2.20.1 |
28 | 31 | ||
29 | 32 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Alex Chen <alex.chen@huawei.com> |
---|---|---|---|
2 | 2 | ||
3 | Reorganize the descriptor handling so that CUR_DSCR always | 3 | We should use printf format specifier "%u" instead of "%d" for |
4 | points to the next descriptor to be processed. | 4 | argument of type "unsigned int". |
5 | 5 | ||
6 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 6 | Reported-by: Euler Robot <euler.robot@huawei.com> |
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 7 | Signed-off-by: Alex Chen <alex.chen@huawei.com> |
8 | Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com> | 8 | Message-id: 20201111073651.72804-1-alex.chen@huawei.com |
9 | Message-id: 20200402134721.27863-6-edgar.iglesias@gmail.com | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 11 | --- |
12 | hw/dma/xlnx-zdma.c | 47 ++++++++++++++++++++++------------------------ | 12 | hw/timer/exynos4210_mct.c | 4 ++-- |
13 | 1 file changed, 22 insertions(+), 25 deletions(-) | 13 | hw/timer/exynos4210_pwm.c | 8 ++++---- |
14 | 2 files changed, 6 insertions(+), 6 deletions(-) | ||
14 | 15 | ||
15 | diff --git a/hw/dma/xlnx-zdma.c b/hw/dma/xlnx-zdma.c | 16 | diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c |
16 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/dma/xlnx-zdma.c | 18 | --- a/hw/timer/exynos4210_mct.c |
18 | +++ b/hw/dma/xlnx-zdma.c | 19 | +++ b/hw/timer/exynos4210_mct.c |
19 | @@ -XXX,XX +XXX,XX @@ static void zdma_load_src_descriptor(XlnxZDMA *s) | 20 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_gcomp_raise_irq(void *opaque, uint32_t id) |
21 | /* If CSTAT is pending and IRQ is enabled */ | ||
22 | if ((s->reg.int_cstat & G_INT_CSTAT_COMP(id)) && | ||
23 | (s->reg.int_enb & G_INT_ENABLE(id))) { | ||
24 | - DPRINTF("gcmp timer[%d] IRQ\n", id); | ||
25 | + DPRINTF("gcmp timer[%u] IRQ\n", id); | ||
26 | qemu_irq_raise(s->irq[id]); | ||
20 | } | 27 | } |
21 | } | 28 | } |
22 | 29 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_mct_update_freq(Exynos4210MCTState *s) | |
23 | +static void zdma_update_descr_addr(XlnxZDMA *s, bool type, | 30 | MCT_CFG_GET_DIVIDER(s->reg_mct_cfg)); |
24 | + unsigned int basereg) | 31 | |
25 | +{ | 32 | if (freq != s->freq) { |
26 | + uint64_t addr, next; | 33 | - DPRINTF("freq=%dHz\n", s->freq); |
27 | + | 34 | + DPRINTF("freq=%uHz\n", s->freq); |
28 | + if (type == DTYPE_LINEAR) { | 35 | |
29 | + addr = zdma_get_regaddr64(s, basereg); | 36 | /* global timer */ |
30 | + next = addr + sizeof(s->dsc_dst); | 37 | tx_ptimer_set_freq(s->g_timer.ptimer_frc, s->freq); |
31 | + } else { | 38 | diff --git a/hw/timer/exynos4210_pwm.c b/hw/timer/exynos4210_pwm.c |
32 | + addr = zdma_get_regaddr64(s, basereg); | 39 | index XXXXXXX..XXXXXXX 100644 |
33 | + addr += sizeof(s->dsc_dst); | 40 | --- a/hw/timer/exynos4210_pwm.c |
34 | + address_space_read(s->dma_as, addr, s->attr, (void *) &next, 8); | 41 | +++ b/hw/timer/exynos4210_pwm.c |
35 | + } | 42 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_pwm_update_freq(Exynos4210PWMState *s, uint32_t id) |
36 | + | 43 | |
37 | + zdma_put_regaddr64(s, basereg, next); | 44 | if (freq != s->timer[id].freq) { |
38 | +} | 45 | ptimer_set_freq(s->timer[id].ptimer, s->timer[id].freq); |
39 | + | 46 | - DPRINTF("freq=%dHz\n", s->timer[id].freq); |
40 | static void zdma_load_dst_descriptor(XlnxZDMA *s) | 47 | + DPRINTF("freq=%uHz\n", s->timer[id].freq); |
41 | { | ||
42 | uint64_t dst_addr; | ||
43 | unsigned int ptype = ARRAY_FIELD_EX32(s->regs, ZDMA_CH_CTRL0, POINT_TYPE); | ||
44 | + bool dst_type; | ||
45 | |||
46 | if (ptype == PT_REG) { | ||
47 | memcpy(&s->dsc_dst, &s->regs[R_ZDMA_CH_DST_DSCR_WORD0], | ||
48 | @@ -XXX,XX +XXX,XX @@ static void zdma_load_dst_descriptor(XlnxZDMA *s) | ||
49 | if (!zdma_load_descriptor(s, dst_addr, &s->dsc_dst)) { | ||
50 | ARRAY_FIELD_DP32(s->regs, ZDMA_CH_ISR, AXI_RD_DST_DSCR, true); | ||
51 | } | 48 | } |
52 | -} | ||
53 | |||
54 | -static uint64_t zdma_update_descr_addr(XlnxZDMA *s, bool type, | ||
55 | - unsigned int basereg) | ||
56 | -{ | ||
57 | - uint64_t addr, next; | ||
58 | - | ||
59 | - if (type == DTYPE_LINEAR) { | ||
60 | - next = zdma_get_regaddr64(s, basereg); | ||
61 | - next += sizeof(s->dsc_dst); | ||
62 | - zdma_put_regaddr64(s, basereg, next); | ||
63 | - } else { | ||
64 | - addr = zdma_get_regaddr64(s, basereg); | ||
65 | - addr += sizeof(s->dsc_dst); | ||
66 | - address_space_read(s->dma_as, addr, s->attr, &next, 8); | ||
67 | - zdma_put_regaddr64(s, basereg, next); | ||
68 | - } | ||
69 | - return next; | ||
70 | + /* Advance the descriptor pointer. */ | ||
71 | + dst_type = FIELD_EX32(s->dsc_dst.words[3], ZDMA_CH_DST_DSCR_WORD3, TYPE); | ||
72 | + zdma_update_descr_addr(s, dst_type, R_ZDMA_CH_DST_CUR_DSCR_LSB); | ||
73 | } | 49 | } |
74 | 50 | ||
75 | static void zdma_write_dst(XlnxZDMA *s, uint8_t *buf, uint32_t len) | 51 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_pwm_tick(void *opaque) |
76 | @@ -XXX,XX +XXX,XX @@ static void zdma_write_dst(XlnxZDMA *s, uint8_t *buf, uint32_t len) | 52 | uint32_t id = s->id; |
77 | dst_size = FIELD_EX32(s->dsc_dst.words[2], ZDMA_CH_DST_DSCR_WORD2, | 53 | bool cmp; |
78 | SIZE); | 54 | |
79 | if (dst_size == 0 && ptype == PT_MEM) { | 55 | - DPRINTF("timer %d tick\n", id); |
80 | - uint64_t next; | 56 | + DPRINTF("timer %u tick\n", id); |
81 | - bool dst_type = FIELD_EX32(s->dsc_dst.words[3], | 57 | |
82 | - ZDMA_CH_DST_DSCR_WORD3, | 58 | /* set irq status */ |
83 | - TYPE); | 59 | p->reg_tint_cstat |= TINT_CSTAT_STATUS(id); |
84 | - | 60 | |
85 | - next = zdma_update_descr_addr(s, dst_type, | 61 | /* raise IRQ */ |
86 | - R_ZDMA_CH_DST_CUR_DSCR_LSB); | 62 | if (p->reg_tint_cstat & TINT_CSTAT_ENABLE(id)) { |
87 | - zdma_load_descriptor(s, next, &s->dsc_dst); | 63 | - DPRINTF("timer %d IRQ\n", id); |
88 | + zdma_load_dst_descriptor(s); | 64 | + DPRINTF("timer %u IRQ\n", id); |
89 | dst_size = FIELD_EX32(s->dsc_dst.words[2], ZDMA_CH_DST_DSCR_WORD2, | 65 | qemu_irq_raise(p->timer[id].irq); |
90 | SIZE); | 66 | } |
91 | } | 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); | ||
92 | -- | 77 | -- |
93 | 2.20.1 | 78 | 2.20.1 |
94 | 79 | ||
95 | 80 | diff view generated by jsdifflib |
1 | Remove a direct include of assert.h -- this is already | 1 | In commit 5edab03d4040 we added tracepoints to the ps2 keyboard |
---|---|---|---|
2 | provided by qemu/osdep.h, and it breaks our rule that the | 2 | and mouse emulation. However we didn't remove all the debug-by-printf |
3 | first include must always be osdep.h. | 3 | support. In fact there is only one printf() remaining, and it is |
4 | 4 | redundant with the trace_ps2_write_mouse() event next to it. | |
5 | In particular we must get the assert() macro via osdep.h | 5 | Remove the printf() and the now-unused DEBUG* macros. |
6 | to avoid compile failures on mingw (see the comment in | ||
7 | osdep.h where we redefine assert() for that platform). | ||
8 | 6 | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> |
11 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | 9 | Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> |
12 | Message-id: 20200403124712.24826-1-peter.maydell@linaro.org | 10 | Message-id: 20201101133258.4240-1-peter.maydell@linaro.org |
13 | --- | 11 | --- |
14 | hw/gpio/aspeed_gpio.c | 2 -- | 12 | hw/input/ps2.c | 9 --------- |
15 | 1 file changed, 2 deletions(-) | 13 | 1 file changed, 9 deletions(-) |
16 | 14 | ||
17 | diff --git a/hw/gpio/aspeed_gpio.c b/hw/gpio/aspeed_gpio.c | 15 | diff --git a/hw/input/ps2.c b/hw/input/ps2.c |
18 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/hw/gpio/aspeed_gpio.c | 17 | --- a/hw/input/ps2.c |
20 | +++ b/hw/gpio/aspeed_gpio.c | 18 | +++ b/hw/input/ps2.c |
21 | @@ -XXX,XX +XXX,XX @@ | 19 | @@ -XXX,XX +XXX,XX @@ |
22 | * SPDX-License-Identifier: GPL-2.0-or-later | 20 | |
23 | */ | 21 | #include "trace.h" |
24 | 22 | ||
25 | -#include <assert.h> | 23 | -/* debug PC keyboard */ |
24 | -//#define DEBUG_KBD | ||
26 | - | 25 | - |
27 | #include "qemu/osdep.h" | 26 | -/* debug PC keyboard : only mouse */ |
28 | #include "qemu/host-utils.h" | 27 | -//#define DEBUG_MOUSE |
29 | #include "qemu/log.h" | 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: | ||
30 | -- | 42 | -- |
31 | 2.20.1 | 43 | 2.20.1 |
32 | 44 | ||
33 | 45 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 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.) | ||
2 | 5 | ||
3 | Advance the descriptor address when stopping the channel. | 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. | ||
4 | 13 | ||
5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 14 | Fixes: Coverity CID 1005812 |
6 | Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com> | ||
7 | Acked-by: Alistair Francis <alistair.francis@wdc.com> | ||
8 | Message-id: 20200402134721.27863-5-edgar.iglesias@gmail.com | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 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 | ||
10 | --- | 18 | --- |
11 | hw/dma/xlnx-zdma.c | 1 - | 19 | target/openrisc/sys_helper.c | 3 --- |
12 | 1 file changed, 1 deletion(-) | 20 | 1 file changed, 3 deletions(-) |
13 | 21 | ||
14 | diff --git a/hw/dma/xlnx-zdma.c b/hw/dma/xlnx-zdma.c | 22 | diff --git a/target/openrisc/sys_helper.c b/target/openrisc/sys_helper.c |
15 | index XXXXXXX..XXXXXXX 100644 | 23 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/dma/xlnx-zdma.c | 24 | --- a/target/openrisc/sys_helper.c |
17 | +++ b/hw/dma/xlnx-zdma.c | 25 | +++ b/target/openrisc/sys_helper.c |
18 | @@ -XXX,XX +XXX,XX @@ static void zdma_process_descr(XlnxZDMA *s) | 26 | @@ -XXX,XX +XXX,XX @@ void HELPER(mtspr)(CPUOpenRISCState *env, target_ulong spr, target_ulong rb) |
19 | if (ptype == PT_REG || src_cmd == CMD_STOP) { | 27 | |
20 | ARRAY_FIELD_DP32(s->regs, ZDMA_CH_CTRL2, EN, 0); | 28 | case TO_SPR(10, 1): /* TTCR */ |
21 | zdma_set_state(s, DISABLED); | 29 | cpu_openrisc_count_set(cpu, rb); |
22 | - return; | 30 | - if (env->ttmr & TIMER_NONE) { |
23 | } | 31 | - return; |
24 | 32 | - } | |
25 | if (src_cmd == CMD_HALT) { | 33 | cpu_openrisc_timer_update(cpu); |
34 | break; | ||
35 | #endif | ||
26 | -- | 36 | -- |
27 | 2.20.1 | 37 | 2.20.1 |
28 | 38 | ||
29 | 39 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Alistair Francis <alistair.francis@wdc.com> |
---|---|---|---|
2 | 2 | ||
3 | Populate DBG0.CMN_BUF_FREE so that SW can see some free space. | 3 | This patch fixes CID 1432800 by removing an unnecessary check. |
4 | 4 | ||
5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 5 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> |
6 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com> | ||
8 | Message-id: 20200402134721.27863-3-edgar.iglesias@gmail.com | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 8 | --- |
11 | hw/dma/xlnx-zdma.c | 6 ++++++ | 9 | hw/core/register.c | 4 ---- |
12 | 1 file changed, 6 insertions(+) | 10 | 1 file changed, 4 deletions(-) |
13 | 11 | ||
14 | diff --git a/hw/dma/xlnx-zdma.c b/hw/dma/xlnx-zdma.c | 12 | diff --git a/hw/core/register.c b/hw/core/register.c |
15 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/dma/xlnx-zdma.c | 14 | --- a/hw/core/register.c |
17 | +++ b/hw/dma/xlnx-zdma.c | 15 | +++ b/hw/core/register.c |
18 | @@ -XXX,XX +XXX,XX @@ static RegisterAccessInfo zdma_regs_info[] = { | 16 | @@ -XXX,XX +XXX,XX @@ static RegisterInfoArray *register_init_block(DeviceState *owner, |
19 | },{ .name = "ZDMA_CH_DBG0", .addr = A_ZDMA_CH_DBG0, | 17 | int index = rae[i].addr / data_size; |
20 | .rsvd = 0xfffffe00, | 18 | RegisterInfo *r = &ri[index]; |
21 | .ro = 0x1ff, | 19 | |
22 | + | 20 | - if (data + data_size * index == 0 || !&rae[i]) { |
23 | + /* | 21 | - continue; |
24 | + * There's SW out there that will check the debug regs for free space. | 22 | - } |
25 | + * Claim that we always have 0x100 free. | 23 | - |
26 | + */ | 24 | /* Init the register, this will zero it. */ |
27 | + .reset = 0x100 | 25 | object_initialize((void *)r, sizeof(*r), TYPE_REGISTER); |
28 | },{ .name = "ZDMA_CH_DBG1", .addr = A_ZDMA_CH_DBG1, | 26 | |
29 | .rsvd = 0xfffffe00, | ||
30 | .ro = 0x1ff, | ||
31 | -- | 27 | -- |
32 | 2.20.1 | 28 | 2.20.1 |
33 | 29 | ||
34 | 30 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | Remove comment. | 3 | Fix Coverity CID 1435957: Memory - illegal accesses (OVERRUN): |
4 | 4 | ||
5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 5 | >>> Overrunning array "suffixes" of 7 8-byte elements at element |
6 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 6 | index 7 (byte offset 63) using index "idx" (which evaluates to 7). |
7 | Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com> | 7 | |
8 | Message-id: 20200402134721.27863-2-edgar.iglesias@gmail.com | 8 | Note, the biggest input value freq_to_str() can accept is UINT64_MAX, |
9 | which is ~18.446 EHz, less than 1000 EHz. | ||
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> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 20 | --- |
11 | hw/dma/xlnx-zdma.c | 1 - | 21 | util/cutils.c | 3 ++- |
12 | 1 file changed, 1 deletion(-) | 22 | 1 file changed, 2 insertions(+), 1 deletion(-) |
13 | 23 | ||
14 | diff --git a/hw/dma/xlnx-zdma.c b/hw/dma/xlnx-zdma.c | 24 | diff --git a/util/cutils.c b/util/cutils.c |
15 | index XXXXXXX..XXXXXXX 100644 | 25 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/dma/xlnx-zdma.c | 26 | --- a/util/cutils.c |
17 | +++ b/hw/dma/xlnx-zdma.c | 27 | +++ b/util/cutils.c |
18 | @@ -XXX,XX +XXX,XX @@ static void zdma_process_descr(XlnxZDMA *s) | 28 | @@ -XXX,XX +XXX,XX @@ char *freq_to_str(uint64_t freq_hz) |
19 | zdma_src_done(s); | 29 | double freq = freq_hz; |
30 | size_t idx = 0; | ||
31 | |||
32 | - while (freq >= 1000.0 && idx < ARRAY_SIZE(suffixes)) { | ||
33 | + while (freq >= 1000.0) { | ||
34 | freq /= 1000.0; | ||
35 | idx++; | ||
20 | } | 36 | } |
21 | 37 | + assert(idx < ARRAY_SIZE(suffixes)); | |
22 | - /* Load next descriptor. */ | 38 | |
23 | if (ptype == PT_REG || src_cmd == CMD_STOP) { | 39 | return g_strdup_printf("%0.3g %sHz", freq, suffixes[idx]); |
24 | ARRAY_FIELD_DP32(s->regs, ZDMA_CH_CTRL2, EN, 0); | 40 | } |
25 | zdma_set_state(s, DISABLED); | ||
26 | -- | 41 | -- |
27 | 2.20.1 | 42 | 2.20.1 |
28 | 43 | ||
29 | 44 | diff view generated by jsdifflib |
1 | An old comment in get_phys_addr_lpae() claims that the code does not | 1 | In commit 76346b6264a9b01979 we tried to add a configure check that |
---|---|---|---|
2 | support the different format TCR for VTCR_EL2. This used to be true | 2 | the libgio pkg-config data was correct, which builds an executable |
3 | but it is not true now (in particular the aa64_va_parameters() and | 3 | linked against it. Unfortunately this doesn't catch the problem |
4 | aa32_va_parameters() functions correctly handle the different | 4 | (missing static library dependency info), because a "do nothing" test |
5 | register format by checking whether the mmu_idx is Stage2). | 5 | source file doesn't have any symbol references that cause the linker |
6 | Remove the out of date parts of the comment. | 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 | |||
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). | ||
7 | 17 | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 19 | Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> |
10 | Message-id: 20200331143407.3186-1-peter.maydell@linaro.org | 20 | Message-id: 20201116104617.18333-1-peter.maydell@linaro.org |
11 | --- | 21 | --- |
12 | target/arm/helper.c | 7 +------ | 22 | configure | 11 +++++++++-- |
13 | 1 file changed, 1 insertion(+), 6 deletions(-) | 23 | 1 file changed, 9 insertions(+), 2 deletions(-) |
14 | 24 | ||
15 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 25 | diff --git a/configure b/configure |
16 | index XXXXXXX..XXXXXXX 100644 | 26 | index XXXXXXX..XXXXXXX 100755 |
17 | --- a/target/arm/helper.c | 27 | --- a/configure |
18 | +++ b/target/arm/helper.c | 28 | +++ b/configure |
19 | @@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address, | 29 | @@ -XXX,XX +XXX,XX @@ if $pkg_config --atleast-version=$glib_req_ver gio-2.0; then |
20 | bool aarch64 = arm_el_is_aa64(env, el); | 30 | # Check that the libraries actually work -- Ubuntu 18.04 ships |
21 | bool guarded = false; | 31 | # with pkg-config --static --libs data for gio-2.0 that is missing |
22 | 32 | # -lblkid and will give a link error. | |
23 | - /* TODO: | 33 | - write_c_skeleton |
24 | - * This code does not handle the different format TCR for VTCR_EL2. | 34 | - if compile_prog "" "$gio_libs" ; then |
25 | - * This code also does not support shareability levels. | 35 | + cat > $TMPC <<EOF |
26 | - * Attribute and permission bit handling should also be checked when adding | 36 | +#include <gio/gio.h> |
27 | - * support for those page table walks. | 37 | +int main(void) |
28 | - */ | 38 | +{ |
29 | + /* TODO: This code does not support shareability levels. */ | 39 | + g_dbus_proxy_new_sync(0, 0, 0, 0, 0, 0, 0, 0); |
30 | if (aarch64) { | 40 | + return 0; |
31 | param = aa64_va_parameters(env, address, mmu_idx, | 41 | +} |
32 | access_type != MMU_INST_FETCH); | 42 | +EOF |
43 | + if compile_prog "$gio_cflags" "$gio_libs" ; then | ||
44 | gio=yes | ||
45 | else | ||
46 | gio=no | ||
33 | -- | 47 | -- |
34 | 2.20.1 | 48 | 2.20.1 |
35 | 49 | ||
36 | 50 | diff view generated by jsdifflib |
1 | Coverity complains that the collie_init() function leaks the memory | 1 | The TMP105 datasheet (https://www.ti.com/lit/gpn/tmp105) says that the |
---|---|---|---|
2 | allocated in sa1110_init(). This is true but not significant since | 2 | power-up reset values for the T_low and T_high registers are 80 degrees C |
3 | the function is called only once on machine init and the memory must | 3 | and 75 degrees C, which are 0x500 and 0x4B0 hex according to table 5. These |
4 | remain in existence until QEMU exits anyway. | 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. | ||
5 | 7 | ||
6 | Still, we can avoid the technical memory leak by keeping the pointer | 8 | We were resetting these registers to zero, which is problematic for Linux |
7 | to the StrongARMState inside the machine state struct. Switch from | 9 | guests which enable the alert interrupt and then immediately take an |
8 | the simple DEFINE_MACHINE() style to defining a subclass of | 10 | unexpected overtemperature alert because the current temperature is above |
9 | TYPE_MACHINE which extends the MachineState struct, and keep the | 11 | freezing... |
10 | pointer there. | ||
11 | 12 | ||
12 | Fixes: CID 1421921 | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 14 | Reviewed-by: Cédric Le Goater <clg@kaod.org> |
15 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 15 | Message-id: 20201110150023.25533-2-peter.maydell@linaro.org |
16 | Message-id: 20200326204919.22006-1-peter.maydell@linaro.org | ||
17 | --- | 16 | --- |
18 | hw/arm/collie.c | 33 ++++++++++++++++++++++++++++----- | 17 | hw/misc/tmp105.c | 3 +++ |
19 | 1 file changed, 28 insertions(+), 5 deletions(-) | 18 | 1 file changed, 3 insertions(+) |
20 | 19 | ||
21 | diff --git a/hw/arm/collie.c b/hw/arm/collie.c | 20 | diff --git a/hw/misc/tmp105.c b/hw/misc/tmp105.c |
22 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
23 | --- a/hw/arm/collie.c | 22 | --- a/hw/misc/tmp105.c |
24 | +++ b/hw/arm/collie.c | 23 | +++ b/hw/misc/tmp105.c |
25 | @@ -XXX,XX +XXX,XX @@ | 24 | @@ -XXX,XX +XXX,XX @@ static void tmp105_reset(I2CSlave *i2c) |
26 | #include "exec/address-spaces.h" | 25 | s->faults = tmp105_faultq[(s->config >> 3) & 3]; |
27 | #include "cpu.h" | 26 | s->alarm = 0; |
28 | 27 | ||
29 | +typedef struct { | 28 | + s->limit[0] = 0x4b00; /* T_LOW, 75 degrees C */ |
30 | + MachineState parent; | 29 | + s->limit[1] = 0x5000; /* T_HIGH, 80 degrees C */ |
31 | + | 30 | + |
32 | + StrongARMState *sa1110; | 31 | tmp105_interrupt_update(s); |
33 | +} CollieMachineState; | ||
34 | + | ||
35 | +#define TYPE_COLLIE_MACHINE MACHINE_TYPE_NAME("collie") | ||
36 | +#define COLLIE_MACHINE(obj) \ | ||
37 | + OBJECT_CHECK(CollieMachineState, obj, TYPE_COLLIE_MACHINE) | ||
38 | + | ||
39 | static struct arm_boot_info collie_binfo = { | ||
40 | .loader_start = SA_SDCS0, | ||
41 | .ram_size = 0x20000000, | ||
42 | @@ -XXX,XX +XXX,XX @@ static struct arm_boot_info collie_binfo = { | ||
43 | |||
44 | static void collie_init(MachineState *machine) | ||
45 | { | ||
46 | - StrongARMState *s; | ||
47 | DriveInfo *dinfo; | ||
48 | MachineClass *mc = MACHINE_GET_CLASS(machine); | ||
49 | + CollieMachineState *cms = COLLIE_MACHINE(machine); | ||
50 | |||
51 | if (machine->ram_size != mc->default_ram_size) { | ||
52 | char *sz = size_to_str(mc->default_ram_size); | ||
53 | @@ -XXX,XX +XXX,XX @@ static void collie_init(MachineState *machine) | ||
54 | exit(EXIT_FAILURE); | ||
55 | } | ||
56 | |||
57 | - s = sa1110_init(machine->cpu_type); | ||
58 | + cms->sa1110 = sa1110_init(machine->cpu_type); | ||
59 | |||
60 | memory_region_add_subregion(get_system_memory(), SA_SDCS0, machine->ram); | ||
61 | |||
62 | @@ -XXX,XX +XXX,XX @@ static void collie_init(MachineState *machine) | ||
63 | sysbus_create_simple("scoop", 0x40800000, NULL); | ||
64 | |||
65 | collie_binfo.board_id = 0x208; | ||
66 | - arm_load_kernel(s->cpu, machine, &collie_binfo); | ||
67 | + arm_load_kernel(cms->sa1110->cpu, machine, &collie_binfo); | ||
68 | } | 32 | } |
69 | 33 | ||
70 | -static void collie_machine_init(MachineClass *mc) | ||
71 | +static void collie_machine_class_init(ObjectClass *oc, void *data) | ||
72 | { | ||
73 | + MachineClass *mc = MACHINE_CLASS(oc); | ||
74 | + | ||
75 | mc->desc = "Sharp SL-5500 (Collie) PDA (SA-1110)"; | ||
76 | mc->init = collie_init; | ||
77 | mc->ignore_memory_transaction_failures = true; | ||
78 | @@ -XXX,XX +XXX,XX @@ static void collie_machine_init(MachineClass *mc) | ||
79 | mc->default_ram_id = "strongarm.sdram"; | ||
80 | } | ||
81 | |||
82 | -DEFINE_MACHINE("collie", collie_machine_init) | ||
83 | +static const TypeInfo collie_machine_typeinfo = { | ||
84 | + .name = TYPE_COLLIE_MACHINE, | ||
85 | + .parent = TYPE_MACHINE, | ||
86 | + .class_init = collie_machine_class_init, | ||
87 | + .instance_size = sizeof(CollieMachineState), | ||
88 | +}; | ||
89 | + | ||
90 | +static void collie_machine_register_types(void) | ||
91 | +{ | ||
92 | + type_register_static(&collie_machine_typeinfo); | ||
93 | +} | ||
94 | +type_init(collie_machine_register_types); | ||
95 | -- | 34 | -- |
96 | 2.20.1 | 35 | 2.20.1 |
97 | 36 | ||
98 | 37 | diff view generated by jsdifflib |
1 | Our implementation of the PSTATE.PAN bit incorrectly cleared all | 1 | The TMP105 datasheet says that in Interrupt Mode (when TM==1) the device |
---|---|---|---|
2 | access permission bits for privileged access to memory which is | 2 | signals an alert when the temperature equals or exceeds the T_high value and |
3 | user-accessible. It should only affect the privileged read and write | 3 | then remains high until a device register is read or the device responds to |
4 | permissions; execute permission is dealt with via XN/PXN instead. | 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 .) | ||
5 | 10 | ||
6 | Fixes: 81636b70c226dc27d7ebc8d | 11 | We were misimplementing this as a simple "always alert if temperature is |
12 | above T_high or below T_low" condition, which gives a spurious alert on | ||
13 | startup if using the "T_high = 80 degrees C, T_low = 75 degrees C" reset | ||
14 | limit values. | ||
15 | |||
16 | Implement the correct (hysteresis) behaviour by tracking whether we | ||
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. | ||
21 | |||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 22 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 23 | Reviewed-by: Cédric Le Goater <clg@kaod.org> |
9 | Message-id: 20200330170651.20901-1-peter.maydell@linaro.org | 24 | Message-id: 20201110150023.25533-3-peter.maydell@linaro.org |
10 | --- | 25 | --- |
11 | target/arm/helper.c | 6 ++++-- | 26 | hw/misc/tmp105.h | 7 +++++ |
12 | 1 file changed, 4 insertions(+), 2 deletions(-) | 27 | hw/misc/tmp105.c | 70 +++++++++++++++++++++++++++++++++++++++++------- |
28 | 2 files changed, 68 insertions(+), 9 deletions(-) | ||
13 | 29 | ||
14 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 30 | diff --git a/hw/misc/tmp105.h b/hw/misc/tmp105.h |
15 | index XXXXXXX..XXXXXXX 100644 | 31 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/helper.c | 32 | --- a/hw/misc/tmp105.h |
17 | +++ b/target/arm/helper.c | 33 | +++ b/hw/misc/tmp105.h |
18 | @@ -XXX,XX +XXX,XX @@ static int get_S1prot(CPUARMState *env, ARMMMUIdx mmu_idx, bool is_aa64, | 34 | @@ -XXX,XX +XXX,XX @@ struct TMP105State { |
19 | prot_rw = user_rw; | 35 | int16_t limit[2]; |
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; | ||
54 | } | ||
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 | + } | ||
20 | } else { | 78 | } else { |
21 | if (user_rw && regime_is_pan(env, mmu_idx)) { | 79 | - if (s->temperature >= s->limit[1]) |
22 | - return 0; | 80 | - s->alarm = 1; |
23 | + /* PAN forbids data accesses but doesn't affect insn fetch */ | 81 | - else if (s->temperature < s->limit[0]) |
24 | + prot_rw = 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 | + } | ||
25 | + } else { | 93 | + } else { |
26 | + prot_rw = simple_ap_to_rw_prot_is_user(ap, false); | 94 | + if (s->temperature >= s->limit[1]) { |
27 | } | 95 | + s->alarm = 1; |
28 | - prot_rw = simple_ap_to_rw_prot_is_user(ap, false); | 96 | + s->detect_falling = true; |
97 | + } | ||
98 | + } | ||
29 | } | 99 | } |
30 | 100 | ||
31 | if (ns && arm_is_secure(env) && (env->cp15.scr_el3 & SCR_SIF)) { | 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 */ | ||
32 | -- | 151 | -- |
33 | 2.20.1 | 152 | 2.20.1 |
34 | 153 | ||
35 | 154 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | In write_elf_section() we set the 'shdr' pointer to point to local | ||
2 | structures shdr32 or shdr64, which we fill in to be written out to | ||
3 | the ELF dump. Unfortunately the address we pass to fd_write_vmcore() | ||
4 | has a spurious '&' operator, so instead of writing out the section | ||
5 | header we write out the literal pointer value followed by whatever is | ||
6 | on the stack after the 'shdr' local variable. | ||
7 | 1 | ||
8 | Pass the correct address into fd_write_vmcore(). | ||
9 | |||
10 | Spotted by Coverity: CID 1421970. | ||
11 | |||
12 | Cc: qemu-stable@nongnu.org | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
14 | Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> | ||
15 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
16 | Message-id: 20200324173630.12221-1-peter.maydell@linaro.org | ||
17 | --- | ||
18 | dump/dump.c | 2 +- | ||
19 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
20 | |||
21 | diff --git a/dump/dump.c b/dump/dump.c | ||
22 | index XXXXXXX..XXXXXXX 100644 | ||
23 | --- a/dump/dump.c | ||
24 | +++ b/dump/dump.c | ||
25 | @@ -XXX,XX +XXX,XX @@ static void write_elf_section(DumpState *s, int type, Error **errp) | ||
26 | shdr = &shdr64; | ||
27 | } | ||
28 | |||
29 | - ret = fd_write_vmcore(&shdr, shdr_size, s); | ||
30 | + ret = fd_write_vmcore(shdr, shdr_size, s); | ||
31 | if (ret < 0) { | ||
32 | error_setg_errno(errp, -ret, | ||
33 | "dump: failed to write section header table"); | ||
34 | -- | ||
35 | 2.20.1 | ||
36 | |||
37 | diff view generated by jsdifflib |