1 | Arm queue; bugfixes only. | 1 | The following changes since commit 7993b0f83fe5c3f8555e79781d5d098f99751a94: |
---|---|---|---|
2 | 2 | ||
3 | thanks | 3 | Merge remote-tracking branch 'remotes/nvme/tags/nvme-fixes-for-6.0-pull-request' into staging (2021-03-29 18:45:12 +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 pull-target-arm-20210330 |
13 | 8 | ||
14 | for you to fetch changes up to ab135622cf478585bdfcb68b85e4a817d74a0c42: | 9 | for you to fetch changes up to b9e3f1579a4b06fc63dfa8cdb68df1c58eeb0cf1: |
15 | 10 | ||
16 | tmp105: Correct handling of temperature limit checks (2020-11-17 12:56:33 +0000) | 11 | hw/timer/renesas_tmr: Add default-case asserts in read_tcnt() (2021-03-30 14:05:34 +0100) |
17 | 12 | ||
18 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
19 | target-arm queue: | 14 | * net/npcm7xx_emc.c: Fix handling of receiving packets when RSDR not set |
20 | * hw/arm/virt: ARM_VIRT must select ARM_GIC | 15 | * hw/display/xlnx_dp: Free FIFOs adding xlnx_dp_finalize() |
21 | * exynos: Fix bad printf format specifiers | 16 | * hw/arm/smmuv3: Drop unused CDM_VALID() and is_cd_valid() |
22 | * hw/input/ps2.c: Remove remnants of printf debug | 17 | * target/arm: Make number of counters in PMCR follow the CPU |
23 | * target/openrisc: Remove dead code attempting to check "is timer disabled" | 18 | * hw/timer/renesas_tmr: Add default-case asserts in read_tcnt() |
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 | 19 | ||
30 | ---------------------------------------------------------------- | 20 | ---------------------------------------------------------------- |
31 | Alex Chen (1): | 21 | Doug Evans (1): |
32 | exynos: Fix bad printf format specifiers | 22 | net/npcm7xx_emc.c: Fix handling of receiving packets when RSDR not set |
33 | 23 | ||
34 | Alistair Francis (1): | 24 | Peter Maydell (2): |
35 | register: Remove unnecessary NULL check | 25 | target/arm: Make number of counters in PMCR follow the CPU |
36 | 26 | hw/timer/renesas_tmr: Add default-case asserts in read_tcnt() | |
37 | Andrew Jones (1): | ||
38 | hw/arm/virt: ARM_VIRT must select ARM_GIC | ||
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 | 27 | ||
47 | Philippe Mathieu-Daudé (1): | 28 | Philippe Mathieu-Daudé (1): |
48 | util/cutils: Fix Coverity array overrun in freq_to_str() | 29 | hw/display/xlnx_dp: Free FIFOs adding xlnx_dp_finalize() |
49 | 30 | ||
50 | configure | 11 +++++-- | 31 | Zenghui Yu (1): |
51 | hw/misc/tmp105.h | 7 +++++ | 32 | hw/arm/smmuv3: Drop unused CDM_VALID() and is_cd_valid() |
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 | 33 | ||
34 | hw/arm/smmuv3-internal.h | 7 ------- | ||
35 | target/arm/cpu.h | 1 + | ||
36 | hw/display/xlnx_dp.c | 9 +++++++++ | ||
37 | hw/net/npcm7xx_emc.c | 4 +++- | ||
38 | hw/timer/renesas_tmr.c | 4 ++++ | ||
39 | target/arm/cpu64.c | 3 +++ | ||
40 | target/arm/cpu_tcg.c | 5 +++++ | ||
41 | target/arm/helper.c | 29 +++++++++++++++++------------ | ||
42 | target/arm/kvm64.c | 2 ++ | ||
43 | tests/qtest/npcm7xx_emc-test.c | 30 +++++++++++++++++++++--------- | ||
44 | 10 files changed, 65 insertions(+), 29 deletions(-) | ||
45 | 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: Doug Evans <dje@google.com> |
---|---|---|---|
2 | 2 | ||
3 | We should use printf format specifier "%u" instead of "%d" for | 3 | Turning REG_MCMDR_RXON is enough to start receiving packets. |
4 | argument of type "unsigned int". | ||
5 | 4 | ||
6 | Reported-by: Euler Robot <euler.robot@huawei.com> | 5 | Signed-off-by: Doug Evans <dje@google.com> |
7 | Signed-off-by: Alex Chen <alex.chen@huawei.com> | 6 | Message-id: 20210319195044.741821-1-dje@google.com |
8 | Message-id: 20201111073651.72804-1-alex.chen@huawei.com | ||
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 9 | --- |
12 | hw/timer/exynos4210_mct.c | 4 ++-- | 10 | hw/net/npcm7xx_emc.c | 4 +++- |
13 | hw/timer/exynos4210_pwm.c | 8 ++++---- | 11 | tests/qtest/npcm7xx_emc-test.c | 30 +++++++++++++++++++++--------- |
14 | 2 files changed, 6 insertions(+), 6 deletions(-) | 12 | 2 files changed, 24 insertions(+), 10 deletions(-) |
15 | 13 | ||
16 | diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c | 14 | diff --git a/hw/net/npcm7xx_emc.c b/hw/net/npcm7xx_emc.c |
17 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/hw/timer/exynos4210_mct.c | 16 | --- a/hw/net/npcm7xx_emc.c |
19 | +++ b/hw/timer/exynos4210_mct.c | 17 | +++ b/hw/net/npcm7xx_emc.c |
20 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_gcomp_raise_irq(void *opaque, uint32_t id) | 18 | @@ -XXX,XX +XXX,XX @@ static void npcm7xx_emc_write(void *opaque, hwaddr offset, |
21 | /* If CSTAT is pending and IRQ is enabled */ | 19 | !(value & REG_MCMDR_RXON)) { |
22 | if ((s->reg.int_cstat & G_INT_CSTAT_COMP(id)) && | 20 | emc->regs[REG_MGSTA] |= REG_MGSTA_RXHA; |
23 | (s->reg.int_enb & G_INT_ENABLE(id))) { | 21 | } |
24 | - DPRINTF("gcmp timer[%d] IRQ\n", id); | 22 | - if (!(value & REG_MCMDR_RXON)) { |
25 | + DPRINTF("gcmp timer[%u] IRQ\n", id); | 23 | + if (value & REG_MCMDR_RXON) { |
26 | qemu_irq_raise(s->irq[id]); | 24 | + emc->rx_active = true; |
25 | + } else { | ||
26 | emc_halt_rx(emc, 0); | ||
27 | } | ||
28 | break; | ||
29 | diff --git a/tests/qtest/npcm7xx_emc-test.c b/tests/qtest/npcm7xx_emc-test.c | ||
30 | index XXXXXXX..XXXXXXX 100644 | ||
31 | --- a/tests/qtest/npcm7xx_emc-test.c | ||
32 | +++ b/tests/qtest/npcm7xx_emc-test.c | ||
33 | @@ -XXX,XX +XXX,XX @@ static void enable_tx(QTestState *qts, const EMCModule *mod, | ||
34 | mcmdr |= REG_MCMDR_TXON; | ||
35 | emc_write(qts, mod, REG_MCMDR, mcmdr); | ||
27 | } | 36 | } |
37 | - | ||
38 | - /* Prod the device to send the packet. */ | ||
39 | - emc_write(qts, mod, REG_TSDR, 1); | ||
28 | } | 40 | } |
29 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_mct_update_freq(Exynos4210MCTState *s) | 41 | |
30 | MCT_CFG_GET_DIVIDER(s->reg_mct_cfg)); | 42 | static void emc_send_verify1(QTestState *qts, const EMCModule *mod, int fd, |
31 | 43 | @@ -XXX,XX +XXX,XX @@ static void emc_send_verify(QTestState *qts, const EMCModule *mod, int fd, | |
32 | if (freq != s->freq) { | 44 | enable_tx(qts, mod, &desc[0], NUM_TX_DESCRIPTORS, desc_addr, |
33 | - DPRINTF("freq=%dHz\n", s->freq); | 45 | with_irq ? REG_MIEN_ENTXINTR : 0); |
34 | + DPRINTF("freq=%uHz\n", s->freq); | 46 | |
35 | 47 | + /* Prod the device to send the packet. */ | |
36 | /* global timer */ | 48 | + emc_write(qts, mod, REG_TSDR, 1); |
37 | tx_ptimer_set_freq(s->g_timer.ptimer_frc, s->freq); | 49 | + |
38 | diff --git a/hw/timer/exynos4210_pwm.c b/hw/timer/exynos4210_pwm.c | 50 | /* |
39 | index XXXXXXX..XXXXXXX 100644 | 51 | * It's problematic to observe the interrupt for each packet. |
40 | --- a/hw/timer/exynos4210_pwm.c | 52 | * Instead just wait until all the packets go out. |
41 | +++ b/hw/timer/exynos4210_pwm.c | 53 | @@ -XXX,XX +XXX,XX @@ static void enable_rx(QTestState *qts, const EMCModule *mod, |
42 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_pwm_update_freq(Exynos4210PWMState *s, uint32_t id) | 54 | mcmdr |= REG_MCMDR_RXON | mcmdr_flags; |
43 | 55 | emc_write(qts, mod, REG_MCMDR, mcmdr); | |
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 | } | 56 | } |
57 | - | ||
58 | - /* Prod the device to accept a packet. */ | ||
59 | - emc_write(qts, mod, REG_RSDR, 1); | ||
49 | } | 60 | } |
50 | 61 | ||
51 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_pwm_tick(void *opaque) | 62 | static void emc_recv_verify(QTestState *qts, const EMCModule *mod, int fd, |
52 | uint32_t id = s->id; | 63 | - bool with_irq) |
53 | bool cmp; | 64 | + bool with_irq, bool pump_rsdr) |
54 | 65 | { | |
55 | - DPRINTF("timer %d tick\n", id); | 66 | NPCM7xxEMCRxDesc desc[NUM_RX_DESCRIPTORS]; |
56 | + DPRINTF("timer %u tick\n", id); | 67 | uint32_t desc_addr = DESC_ADDR; |
57 | 68 | @@ -XXX,XX +XXX,XX @@ static void emc_recv_verify(QTestState *qts, const EMCModule *mod, int fd, | |
58 | /* set irq status */ | 69 | enable_rx(qts, mod, &desc[0], NUM_RX_DESCRIPTORS, desc_addr, |
59 | p->reg_tint_cstat |= TINT_CSTAT_STATUS(id); | 70 | with_irq ? REG_MIEN_ENRXINTR : 0, 0); |
60 | 71 | ||
61 | /* raise IRQ */ | 72 | + /* |
62 | if (p->reg_tint_cstat & TINT_CSTAT_ENABLE(id)) { | 73 | + * If requested, prod the device to accept a packet. |
63 | - DPRINTF("timer %d IRQ\n", id); | 74 | + * This isn't necessary, the linux driver doesn't do this. |
64 | + DPRINTF("timer %u IRQ\n", id); | 75 | + * Test doing/not-doing this for robustness. |
65 | qemu_irq_raise(p->timer[id].irq); | 76 | + */ |
66 | } | 77 | + if (pump_rsdr) { |
67 | 78 | + emc_write(qts, mod, REG_RSDR, 1); | |
68 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_pwm_tick(void *opaque) | 79 | + } |
69 | } | 80 | + |
70 | 81 | /* Send test packet to device's socket. */ | |
71 | if (cmp) { | 82 | ret = iov_send(fd, iov, 2, 0, sizeof(len) + sizeof(test)); |
72 | - DPRINTF("auto reload timer %d count to %x\n", id, | 83 | g_assert_cmpint(ret, == , sizeof(test) + sizeof(len)); |
73 | + DPRINTF("auto reload timer %u count to %x\n", id, | 84 | @@ -XXX,XX +XXX,XX @@ static void test_rx(gconstpointer test_data) |
74 | p->timer[id].reg_tcntb); | 85 | |
75 | ptimer_set_count(p->timer[id].ptimer, p->timer[id].reg_tcntb); | 86 | qtest_irq_intercept_in(qts, "/machine/soc/a9mpcore/gic"); |
76 | ptimer_run(p->timer[id].ptimer, 1); | 87 | |
88 | - emc_recv_verify(qts, td->module, test_sockets[0], /*with_irq=*/false); | ||
89 | - emc_recv_verify(qts, td->module, test_sockets[0], /*with_irq=*/true); | ||
90 | + emc_recv_verify(qts, td->module, test_sockets[0], /*with_irq=*/false, | ||
91 | + /*pump_rsdr=*/false); | ||
92 | + emc_recv_verify(qts, td->module, test_sockets[0], /*with_irq=*/false, | ||
93 | + /*pump_rsdr=*/true); | ||
94 | + emc_recv_verify(qts, td->module, test_sockets[0], /*with_irq=*/true, | ||
95 | + /*pump_rsdr=*/false); | ||
96 | + emc_recv_verify(qts, td->module, test_sockets[0], /*with_irq=*/true, | ||
97 | + /*pump_rsdr=*/true); | ||
98 | emc_test_ptle(qts, td->module, test_sockets[0]); | ||
99 | |||
100 | qtest_quit(qts); | ||
77 | -- | 101 | -- |
78 | 2.20.1 | 102 | 2.20.1 |
79 | 103 | ||
80 | 104 | diff view generated by jsdifflib |
1 | The TMP105 datasheet says that in Interrupt Mode (when TM==1) the device | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
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 .) | ||
10 | 2 | ||
11 | We were misimplementing this as a simple "always alert if temperature is | 3 | When building with --enable-sanitizers we get: |
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 | 4 | ||
16 | Implement the correct (hysteresis) behaviour by tracking whether we | 5 | Direct leak of 16 byte(s) in 1 object(s) allocated from: |
17 | are currently looking for the temperature to rise over T_high or | 6 | #0 0x5618479ec7cf in malloc (qemu-system-aarch64+0x233b7cf) |
18 | for it to fall below T_low. Our implementation of the comparator | 7 | #1 0x7f675745f958 in g_malloc (/lib64/libglib-2.0.so.0+0x58958) |
19 | mode (TM==0) wasn't wrong, but rephrase it to match the way that | 8 | #2 0x561847c2dcc9 in xlnx_dp_init hw/display/xlnx_dp.c:1259:5 |
20 | interrupt mode is now handled for clarity. | 9 | #3 0x56184a5bdab8 in object_init_with_type qom/object.c:375:9 |
10 | #4 0x56184a5a2bda in object_initialize_with_type qom/object.c:517:5 | ||
11 | #5 0x56184a5a24d5 in object_initialize qom/object.c:536:5 | ||
12 | #6 0x56184a5a2f6c in object_initialize_child_with_propsv qom/object.c:566:5 | ||
13 | #7 0x56184a5a2e60 in object_initialize_child_with_props qom/object.c:549:10 | ||
14 | #8 0x56184a5a3a1e in object_initialize_child_internal qom/object.c:603:5 | ||
15 | #9 0x5618495aa431 in xlnx_zynqmp_init hw/arm/xlnx-zynqmp.c:273:5 | ||
21 | 16 | ||
17 | The RX/TX FIFOs are created in xlnx_dp_init(), add xlnx_dp_finalize() | ||
18 | to destroy them. | ||
19 | |||
20 | Fixes: 58ac482a66d ("introduce xlnx-dp") | ||
21 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
22 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
23 | Message-id: 20210323182958.277654-1-f4bug@amsat.org | ||
22 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 24 | 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 | ||
25 | --- | 25 | --- |
26 | hw/misc/tmp105.h | 7 +++++ | 26 | hw/display/xlnx_dp.c | 9 +++++++++ |
27 | hw/misc/tmp105.c | 70 +++++++++++++++++++++++++++++++++++++++++------- | 27 | 1 file changed, 9 insertions(+) |
28 | 2 files changed, 68 insertions(+), 9 deletions(-) | ||
29 | 28 | ||
30 | diff --git a/hw/misc/tmp105.h b/hw/misc/tmp105.h | 29 | diff --git a/hw/display/xlnx_dp.c b/hw/display/xlnx_dp.c |
31 | index XXXXXXX..XXXXXXX 100644 | 30 | index XXXXXXX..XXXXXXX 100644 |
32 | --- a/hw/misc/tmp105.h | 31 | --- a/hw/display/xlnx_dp.c |
33 | +++ b/hw/misc/tmp105.h | 32 | +++ b/hw/display/xlnx_dp.c |
34 | @@ -XXX,XX +XXX,XX @@ struct TMP105State { | 33 | @@ -XXX,XX +XXX,XX @@ static void xlnx_dp_init(Object *obj) |
35 | int16_t limit[2]; | 34 | fifo8_create(&s->tx_fifo, 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; | ||
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 | + } | ||
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 | } | 35 | } |
105 | 36 | ||
106 | +static bool detect_falling_needed(void *opaque) | 37 | +static void xlnx_dp_finalize(Object *obj) |
107 | +{ | 38 | +{ |
108 | + TMP105State *s = opaque; | 39 | + XlnxDPState *s = XLNX_DP(obj); |
109 | + | 40 | + |
110 | + /* | 41 | + fifo8_destroy(&s->tx_fifo); |
111 | + * We only need to migrate the detect_falling bool if it's set; | 42 | + fifo8_destroy(&s->rx_fifo); |
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 | +} | 43 | +} |
117 | + | 44 | + |
118 | +static const VMStateDescription vmstate_tmp105_detect_falling = { | 45 | static void xlnx_dp_realize(DeviceState *dev, Error **errp) |
119 | + .name = "TMP105/detect-falling", | 46 | { |
120 | + .version_id = 1, | 47 | XlnxDPState *s = XLNX_DP(dev); |
121 | + .minimum_version_id = 1, | 48 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo xlnx_dp_info = { |
122 | + .needed = detect_falling_needed, | 49 | .parent = TYPE_SYS_BUS_DEVICE, |
123 | + .fields = (VMStateField[]) { | 50 | .instance_size = sizeof(XlnxDPState), |
124 | + VMSTATE_BOOL(detect_falling, TMP105State), | 51 | .instance_init = xlnx_dp_init, |
125 | + VMSTATE_END_OF_LIST() | 52 | + .instance_finalize = xlnx_dp_finalize, |
126 | + } | 53 | .class_init = xlnx_dp_class_init, |
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 | }; | 54 | }; |
142 | 55 | ||
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 | -- | 56 | -- |
152 | 2.20.1 | 57 | 2.20.1 |
153 | 58 | ||
154 | 59 | diff view generated by jsdifflib |
1 | From: Alistair Francis <alistair.francis@wdc.com> | 1 | From: Zenghui Yu <yuzenghui@huawei.com> |
---|---|---|---|
2 | 2 | ||
3 | This patch fixes CID 1432800 by removing an unnecessary check. | 3 | They were introduced in commit 9bde7f0674fe ("hw/arm/smmuv3: Implement |
4 | translate callback") but never actually used. Drop them. | ||
4 | 5 | ||
5 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> | 6 | Signed-off-by: Zenghui Yu <yuzenghui@huawei.com> |
7 | Acked-by: Eric Auger <eric.auger@redhat.com> | ||
8 | Message-id: 20210325142702.790-1-yuzenghui@huawei.com | ||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | --- | 11 | --- |
9 | hw/core/register.c | 4 ---- | 12 | hw/arm/smmuv3-internal.h | 7 ------- |
10 | 1 file changed, 4 deletions(-) | 13 | 1 file changed, 7 deletions(-) |
11 | 14 | ||
12 | diff --git a/hw/core/register.c b/hw/core/register.c | 15 | diff --git a/hw/arm/smmuv3-internal.h b/hw/arm/smmuv3-internal.h |
13 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/hw/core/register.c | 17 | --- a/hw/arm/smmuv3-internal.h |
15 | +++ b/hw/core/register.c | 18 | +++ b/hw/arm/smmuv3-internal.h |
16 | @@ -XXX,XX +XXX,XX @@ static RegisterInfoArray *register_init_block(DeviceState *owner, | 19 | @@ -XXX,XX +XXX,XX @@ static inline int pa_range(STE *ste) |
17 | int index = rae[i].addr / data_size; | 20 | #define CD_A(x) extract32((x)->word[1], 14, 1) |
18 | RegisterInfo *r = &ri[index]; | 21 | #define CD_AARCH64(x) extract32((x)->word[1], 9 , 1) |
19 | 22 | ||
20 | - if (data + data_size * index == 0 || !&rae[i]) { | 23 | -#define CDM_VALID(x) ((x)->word[0] & 0x1) |
21 | - continue; | ||
22 | - } | ||
23 | - | 24 | - |
24 | /* Init the register, this will zero it. */ | 25 | -static inline int is_cd_valid(SMMUv3State *s, STE *ste, CD *cd) |
25 | object_initialize((void *)r, sizeof(*r), TYPE_REGISTER); | 26 | -{ |
26 | 27 | - return CD_VALID(cd); | |
28 | -} | ||
29 | - | ||
30 | /** | ||
31 | * tg2granule - Decodes the CD translation granule size field according | ||
32 | * to the ttbr in use | ||
27 | -- | 33 | -- |
28 | 2.20.1 | 34 | 2.20.1 |
29 | 35 | ||
30 | 36 | diff view generated by jsdifflib |
1 | In commit 5edab03d4040 we added tracepoints to the ps2 keyboard | 1 | Currently we give all the v7-and-up CPUs a PMU with 4 counters. This |
---|---|---|---|
2 | and mouse emulation. However we didn't remove all the debug-by-printf | 2 | means that we don't provide the 6 counters that are required by the |
3 | support. In fact there is only one printf() remaining, and it is | 3 | Arm BSA (Base System Architecture) specification if the CPU supports |
4 | redundant with the trace_ps2_write_mouse() event next to it. | 4 | the Virtualization extensions. |
5 | Remove the printf() and the now-unused DEBUG* macros. | 5 | |
6 | Instead of having a single PMCR_NUM_COUNTERS, make each CPU type | ||
7 | specify the PMCR reset value (obtained from the appropriate TRM), and | ||
8 | use the 'N' field of that value to define the number of counters | ||
9 | provided. | ||
10 | |||
11 | This means that we now supply 6 counters for Cortex-A53, A57, A72, | ||
12 | A15 and A9 as well as '-cpu max'; Cortex-A7 and A8 stay at 4; and | ||
13 | Cortex-R5 goes down to 3. | ||
14 | |||
15 | Note that because we now use the PMCR reset value of the specific | ||
16 | implementation, we no longer set the LC bit out of reset. This has | ||
17 | an UNKNOWN value out of reset for all cores with any AArch32 support, | ||
18 | so guest software should be setting it anyway if it wants it. | ||
6 | 19 | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 20 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 21 | Tested-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org> |
9 | Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> | 22 | Message-id: 20210311165947.27470-1-peter.maydell@linaro.org |
10 | Message-id: 20201101133258.4240-1-peter.maydell@linaro.org | 23 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
11 | --- | 24 | --- |
12 | hw/input/ps2.c | 9 --------- | 25 | target/arm/cpu.h | 1 + |
13 | 1 file changed, 9 deletions(-) | 26 | target/arm/cpu64.c | 3 +++ |
14 | 27 | target/arm/cpu_tcg.c | 5 +++++ | |
15 | diff --git a/hw/input/ps2.c b/hw/input/ps2.c | 28 | target/arm/helper.c | 29 +++++++++++++++++------------ |
16 | index XXXXXXX..XXXXXXX 100644 | 29 | target/arm/kvm64.c | 2 ++ |
17 | --- a/hw/input/ps2.c | 30 | 5 files changed, 28 insertions(+), 12 deletions(-) |
18 | +++ b/hw/input/ps2.c | 31 | |
32 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | ||
33 | index XXXXXXX..XXXXXXX 100644 | ||
34 | --- a/target/arm/cpu.h | ||
35 | +++ b/target/arm/cpu.h | ||
36 | @@ -XXX,XX +XXX,XX @@ struct ARMCPU { | ||
37 | uint64_t id_aa64mmfr2; | ||
38 | uint64_t id_aa64dfr0; | ||
39 | uint64_t id_aa64dfr1; | ||
40 | + uint64_t reset_pmcr_el0; | ||
41 | } isar; | ||
42 | uint64_t midr; | ||
43 | uint32_t revidr; | ||
44 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | ||
45 | index XXXXXXX..XXXXXXX 100644 | ||
46 | --- a/target/arm/cpu64.c | ||
47 | +++ b/target/arm/cpu64.c | ||
48 | @@ -XXX,XX +XXX,XX @@ static void aarch64_a57_initfn(Object *obj) | ||
49 | cpu->gic_num_lrs = 4; | ||
50 | cpu->gic_vpribits = 5; | ||
51 | cpu->gic_vprebits = 5; | ||
52 | + cpu->isar.reset_pmcr_el0 = 0x41013000; | ||
53 | define_arm_cp_regs(cpu, cortex_a72_a57_a53_cp_reginfo); | ||
54 | } | ||
55 | |||
56 | @@ -XXX,XX +XXX,XX @@ static void aarch64_a53_initfn(Object *obj) | ||
57 | cpu->gic_num_lrs = 4; | ||
58 | cpu->gic_vpribits = 5; | ||
59 | cpu->gic_vprebits = 5; | ||
60 | + cpu->isar.reset_pmcr_el0 = 0x41033000; | ||
61 | define_arm_cp_regs(cpu, cortex_a72_a57_a53_cp_reginfo); | ||
62 | } | ||
63 | |||
64 | @@ -XXX,XX +XXX,XX @@ static void aarch64_a72_initfn(Object *obj) | ||
65 | cpu->gic_num_lrs = 4; | ||
66 | cpu->gic_vpribits = 5; | ||
67 | cpu->gic_vprebits = 5; | ||
68 | + cpu->isar.reset_pmcr_el0 = 0x41023000; | ||
69 | define_arm_cp_regs(cpu, cortex_a72_a57_a53_cp_reginfo); | ||
70 | } | ||
71 | |||
72 | diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c | ||
73 | index XXXXXXX..XXXXXXX 100644 | ||
74 | --- a/target/arm/cpu_tcg.c | ||
75 | +++ b/target/arm/cpu_tcg.c | ||
76 | @@ -XXX,XX +XXX,XX @@ static void cortex_a8_initfn(Object *obj) | ||
77 | cpu->ccsidr[1] = 0x2007e01a; /* 16k L1 icache. */ | ||
78 | cpu->ccsidr[2] = 0xf0000000; /* No L2 icache. */ | ||
79 | cpu->reset_auxcr = 2; | ||
80 | + cpu->isar.reset_pmcr_el0 = 0x41002000; | ||
81 | define_arm_cp_regs(cpu, cortexa8_cp_reginfo); | ||
82 | } | ||
83 | |||
84 | @@ -XXX,XX +XXX,XX @@ static void cortex_a9_initfn(Object *obj) | ||
85 | cpu->clidr = (1 << 27) | (1 << 24) | 3; | ||
86 | cpu->ccsidr[0] = 0xe00fe019; /* 16k L1 dcache. */ | ||
87 | cpu->ccsidr[1] = 0x200fe019; /* 16k L1 icache. */ | ||
88 | + cpu->isar.reset_pmcr_el0 = 0x41093000; | ||
89 | define_arm_cp_regs(cpu, cortexa9_cp_reginfo); | ||
90 | } | ||
91 | |||
92 | @@ -XXX,XX +XXX,XX @@ static void cortex_a7_initfn(Object *obj) | ||
93 | cpu->ccsidr[0] = 0x701fe00a; /* 32K L1 dcache */ | ||
94 | cpu->ccsidr[1] = 0x201fe00a; /* 32K L1 icache */ | ||
95 | cpu->ccsidr[2] = 0x711fe07a; /* 4096K L2 unified cache */ | ||
96 | + cpu->isar.reset_pmcr_el0 = 0x41072000; | ||
97 | define_arm_cp_regs(cpu, cortexa15_cp_reginfo); /* Same as A15 */ | ||
98 | } | ||
99 | |||
100 | @@ -XXX,XX +XXX,XX @@ static void cortex_a15_initfn(Object *obj) | ||
101 | cpu->ccsidr[0] = 0x701fe00a; /* 32K L1 dcache */ | ||
102 | cpu->ccsidr[1] = 0x201fe00a; /* 32K L1 icache */ | ||
103 | cpu->ccsidr[2] = 0x711fe07a; /* 4096K L2 unified cache */ | ||
104 | + cpu->isar.reset_pmcr_el0 = 0x410F3000; | ||
105 | define_arm_cp_regs(cpu, cortexa15_cp_reginfo); | ||
106 | } | ||
107 | |||
108 | @@ -XXX,XX +XXX,XX @@ static void cortex_r5_initfn(Object *obj) | ||
109 | cpu->isar.id_isar6 = 0x0; | ||
110 | cpu->mp_is_up = true; | ||
111 | cpu->pmsav7_dregion = 16; | ||
112 | + cpu->isar.reset_pmcr_el0 = 0x41151800; | ||
113 | define_arm_cp_regs(cpu, cortexr5_cp_reginfo); | ||
114 | } | ||
115 | |||
116 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
117 | index XXXXXXX..XXXXXXX 100644 | ||
118 | --- a/target/arm/helper.c | ||
119 | +++ b/target/arm/helper.c | ||
19 | @@ -XXX,XX +XXX,XX @@ | 120 | @@ -XXX,XX +XXX,XX @@ |
20 | 121 | #endif | |
21 | #include "trace.h" | 122 | |
22 | 123 | #define ARM_CPU_FREQ 1000000000 /* FIXME: 1 GHz, should be configurable */ | |
23 | -/* debug PC keyboard */ | 124 | -#define PMCR_NUM_COUNTERS 4 /* QEMU IMPDEF choice */ |
24 | -//#define DEBUG_KBD | 125 | |
25 | - | 126 | #ifndef CONFIG_USER_ONLY |
26 | -/* debug PC keyboard : only mouse */ | 127 | |
27 | -//#define DEBUG_MOUSE | 128 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v6_cp_reginfo[] = { |
28 | - | 129 | |
29 | /* Keyboard Commands */ | 130 | static inline uint32_t pmu_num_counters(CPUARMState *env) |
30 | #define KBD_CMD_SET_LEDS 0xED /* Set keyboard leds */ | 131 | { |
31 | #define KBD_CMD_ECHO 0xEE | 132 | - return (env->cp15.c9_pmcr & PMCRN_MASK) >> PMCRN_SHIFT; |
32 | @@ -XXX,XX +XXX,XX @@ void ps2_write_mouse(void *opaque, int val) | 133 | + ARMCPU *cpu = env_archcpu(env); |
33 | PS2MouseState *s = (PS2MouseState *)opaque; | 134 | + |
34 | 135 | + return (cpu->isar.reset_pmcr_el0 & PMCRN_MASK) >> PMCRN_SHIFT; | |
35 | trace_ps2_write_mouse(opaque, val); | 136 | } |
36 | -#ifdef DEBUG_MOUSE | 137 | |
37 | - printf("kbd: write mouse 0x%02x\n", val); | 138 | /* Bits allowed to be set/cleared for PMCNTEN* and PMINTEN* */ |
38 | -#endif | 139 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el2_cp_reginfo[] = { |
39 | switch(s->common.write_cmd) { | 140 | .resetvalue = 0, |
40 | default: | 141 | .writefn = gt_hyp_ctl_write, .raw_writefn = raw_write }, |
41 | case -1: | 142 | #endif |
143 | - /* The only field of MDCR_EL2 that has a defined architectural reset value | ||
144 | - * is MDCR_EL2.HPMN which should reset to the value of PMCR_EL0.N. | ||
145 | - */ | ||
146 | - { .name = "MDCR_EL2", .state = ARM_CP_STATE_BOTH, | ||
147 | - .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 1, | ||
148 | - .access = PL2_RW, .resetvalue = PMCR_NUM_COUNTERS, | ||
149 | - .fieldoffset = offsetof(CPUARMState, cp15.mdcr_el2), }, | ||
150 | { .name = "HPFAR", .state = ARM_CP_STATE_AA32, | ||
151 | .cp = 15, .opc1 = 4, .crn = 6, .crm = 0, .opc2 = 4, | ||
152 | .access = PL2_RW, .accessfn = access_el3_aa32ns, | ||
153 | @@ -XXX,XX +XXX,XX @@ static void define_pmu_regs(ARMCPU *cpu) | ||
154 | * field as main ID register, and we implement four counters in | ||
155 | * addition to the cycle count register. | ||
156 | */ | ||
157 | - unsigned int i, pmcrn = PMCR_NUM_COUNTERS; | ||
158 | + unsigned int i, pmcrn = pmu_num_counters(&cpu->env); | ||
159 | ARMCPRegInfo pmcr = { | ||
160 | .name = "PMCR", .cp = 15, .crn = 9, .crm = 12, .opc1 = 0, .opc2 = 0, | ||
161 | .access = PL0_RW, | ||
162 | @@ -XXX,XX +XXX,XX @@ static void define_pmu_regs(ARMCPU *cpu) | ||
163 | .access = PL0_RW, .accessfn = pmreg_access, | ||
164 | .type = ARM_CP_IO, | ||
165 | .fieldoffset = offsetof(CPUARMState, cp15.c9_pmcr), | ||
166 | - .resetvalue = (cpu->midr & 0xff000000) | (pmcrn << PMCRN_SHIFT) | | ||
167 | - PMCRLC, | ||
168 | + .resetvalue = cpu->isar.reset_pmcr_el0, | ||
169 | .writefn = pmcr_write, .raw_writefn = raw_write, | ||
170 | }; | ||
171 | + | ||
172 | define_one_arm_cp_reg(cpu, &pmcr); | ||
173 | define_one_arm_cp_reg(cpu, &pmcr64); | ||
174 | for (i = 0; i < pmcrn; i++) { | ||
175 | @@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu) | ||
176 | .fieldoffset = offsetof(CPUARMState, cp15.vmpidr_el2) }, | ||
177 | REGINFO_SENTINEL | ||
178 | }; | ||
179 | + /* | ||
180 | + * The only field of MDCR_EL2 that has a defined architectural reset | ||
181 | + * value is MDCR_EL2.HPMN which should reset to the value of PMCR_EL0.N. | ||
182 | + */ | ||
183 | + ARMCPRegInfo mdcr_el2 = { | ||
184 | + .name = "MDCR_EL2", .state = ARM_CP_STATE_BOTH, | ||
185 | + .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 1, | ||
186 | + .access = PL2_RW, .resetvalue = pmu_num_counters(env), | ||
187 | + .fieldoffset = offsetof(CPUARMState, cp15.mdcr_el2), | ||
188 | + }; | ||
189 | + define_one_arm_cp_reg(cpu, &mdcr_el2); | ||
190 | define_arm_cp_regs(cpu, vpidr_regs); | ||
191 | define_arm_cp_regs(cpu, el2_cp_reginfo); | ||
192 | if (arm_feature(env, ARM_FEATURE_V8)) { | ||
193 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c | ||
194 | index XXXXXXX..XXXXXXX 100644 | ||
195 | --- a/target/arm/kvm64.c | ||
196 | +++ b/target/arm/kvm64.c | ||
197 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf) | ||
198 | ARM64_SYS_REG(3, 0, 0, 7, 1)); | ||
199 | err |= read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64mmfr2, | ||
200 | ARM64_SYS_REG(3, 0, 0, 7, 2)); | ||
201 | + err |= read_sys_reg64(fdarray[2], &ahcf->isar.reset_pmcr_el0, | ||
202 | + ARM64_SYS_REG(3, 3, 9, 12, 0)); | ||
203 | |||
204 | /* | ||
205 | * Note that if AArch32 support is not present in the host, | ||
42 | -- | 206 | -- |
43 | 2.20.1 | 207 | 2.20.1 |
44 | 208 | ||
45 | 209 | 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 |
Deleted patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
2 | 1 | ||
3 | Fix Coverity CID 1435957: Memory - illegal accesses (OVERRUN): | ||
4 | |||
5 | >>> Overrunning array "suffixes" of 7 8-byte elements at element | ||
6 | index 7 (byte offset 63) using index "idx" (which evaluates to 7). | ||
7 | |||
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> | ||
19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
20 | --- | ||
21 | util/cutils.c | 3 ++- | ||
22 | 1 file changed, 2 insertions(+), 1 deletion(-) | ||
23 | |||
24 | diff --git a/util/cutils.c b/util/cutils.c | ||
25 | index XXXXXXX..XXXXXXX 100644 | ||
26 | --- a/util/cutils.c | ||
27 | +++ b/util/cutils.c | ||
28 | @@ -XXX,XX +XXX,XX @@ char *freq_to_str(uint64_t freq_hz) | ||
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++; | ||
36 | } | ||
37 | + assert(idx < ARRAY_SIZE(suffixes)); | ||
38 | |||
39 | return g_strdup_printf("%0.3g %sHz", freq, suffixes[idx]); | ||
40 | } | ||
41 | -- | ||
42 | 2.20.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 |
1 | The TMP105 datasheet (https://www.ti.com/lit/gpn/tmp105) says that the | 1 | In commit 81b3ddaf8772ec we fixed a use of uninitialized data |
---|---|---|---|
2 | power-up reset values for the T_low and T_high registers are 80 degrees C | 2 | in read_tcnt(). However this change wasn't enough to placate |
3 | and 75 degrees C, which are 0x500 and 0x4B0 hex according to table 5. These | 3 | Coverity, which is not smart enough to see that if we read a |
4 | values are then shifted right by four bits to give the register reset | 4 | 2 bit field and then handle cases 0, 1, 2 and 3 then there cannot |
5 | values, since both registers store the 12 bits of temperature data in bits | 5 | be a flow of execution through the switch default. Add explicit |
6 | [15..4] of a 16 bit register. | 6 | default cases which assert that they can't be reached, which |
7 | 7 | should help silence Coverity. | |
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 | 8 | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | 10 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
15 | Message-id: 20201110150023.25533-2-peter.maydell@linaro.org | 11 | Message-id: 20210319162458.13760-1-peter.maydell@linaro.org |
16 | --- | 12 | --- |
17 | hw/misc/tmp105.c | 3 +++ | 13 | hw/timer/renesas_tmr.c | 4 ++++ |
18 | 1 file changed, 3 insertions(+) | 14 | 1 file changed, 4 insertions(+) |
19 | 15 | ||
20 | diff --git a/hw/misc/tmp105.c b/hw/misc/tmp105.c | 16 | diff --git a/hw/timer/renesas_tmr.c b/hw/timer/renesas_tmr.c |
21 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/hw/misc/tmp105.c | 18 | --- a/hw/timer/renesas_tmr.c |
23 | +++ b/hw/misc/tmp105.c | 19 | +++ b/hw/timer/renesas_tmr.c |
24 | @@ -XXX,XX +XXX,XX @@ static void tmp105_reset(I2CSlave *i2c) | 20 | @@ -XXX,XX +XXX,XX @@ static uint16_t read_tcnt(RTMRState *tmr, unsigned size, int ch) |
25 | s->faults = tmp105_faultq[(s->config >> 3) & 3]; | 21 | case CSS_CASCADING: |
26 | s->alarm = 0; | 22 | tcnt[1] = tmr->tcnt[1]; |
27 | 23 | break; | |
28 | + s->limit[0] = 0x4b00; /* T_LOW, 75 degrees C */ | 24 | + default: |
29 | + s->limit[1] = 0x5000; /* T_HIGH, 80 degrees C */ | 25 | + g_assert_not_reached(); |
30 | + | 26 | } |
31 | tmp105_interrupt_update(s); | 27 | switch (FIELD_EX8(tmr->tccr[0], TCCR, CSS)) { |
32 | } | 28 | case CSS_INTERNAL: |
33 | 29 | @@ -XXX,XX +XXX,XX @@ static uint16_t read_tcnt(RTMRState *tmr, unsigned size, int ch) | |
30 | case CSS_EXTERNAL: /* QEMU doesn't implement this */ | ||
31 | tcnt[0] = tmr->tcnt[0]; | ||
32 | break; | ||
33 | + default: | ||
34 | + g_assert_not_reached(); | ||
35 | } | ||
36 | } else { | ||
37 | tcnt[0] = tmr->tcnt[0]; | ||
34 | -- | 38 | -- |
35 | 2.20.1 | 39 | 2.20.1 |
36 | 40 | ||
37 | 41 | diff view generated by jsdifflib |