1 | Just a few minor bugfixes, but we might as well get them in | 1 | Arm queue; bugfixes only. |
---|---|---|---|
2 | for rc0 tomorrow. | ||
3 | 2 | ||
3 | thanks | ||
4 | -- PMM | 4 | -- PMM |
5 | 5 | ||
6 | The following changes since commit 787f82407c5056a8b1097e39e53d01dd1abe406b: | 6 | The following changes since commit 48aa8f0ac536db3550a35c295ff7de94e4c33739: |
7 | 7 | ||
8 | Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20200323' into staging (2020-03-23 15:38:30 +0000) | 8 | Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2020-11-16' into staging (2020-11-17 11:07:00 +0000) |
9 | 9 | ||
10 | are available in the Git repository at: | 10 | are available in the Git repository at: |
11 | 11 | ||
12 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20200323 | 12 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20201117 |
13 | 13 | ||
14 | for you to fetch changes up to 550a04893c2bd4442211b353680b9a6408d94dba: | 14 | for you to fetch changes up to ab135622cf478585bdfcb68b85e4a817d74a0c42: |
15 | 15 | ||
16 | target/arm: Move computation of index in handle_simd_dupe (2020-03-23 17:22:30 +0000) | 16 | tmp105: Correct handling of temperature limit checks (2020-11-17 12:56:33 +0000) |
17 | 17 | ||
18 | ---------------------------------------------------------------- | 18 | ---------------------------------------------------------------- |
19 | target-arm queue: | 19 | target-arm queue: |
20 | * target/arm: avoid undefined behaviour shift in watchpoint code | 20 | * hw/arm/virt: ARM_VIRT must select ARM_GIC |
21 | * target/arm: avoid undefined behaviour shift in handle_simd_dupe() | 21 | * exynos: Fix bad printf format specifiers |
22 | * target/arm: add assert that immh != 0 in disas_simd_shift_imm() | 22 | * hw/input/ps2.c: Remove remnants of printf debug |
23 | * aspeed/smc: Fix DMA support for AST2600 | 23 | * target/openrisc: Remove dead code attempting to check "is timer disabled" |
24 | * hw/arm/bcm283x: Correct the license text ('and' vs 'or') | 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 | ||
25 | 29 | ||
26 | ---------------------------------------------------------------- | 30 | ---------------------------------------------------------------- |
27 | Cédric Le Goater (1): | 31 | Alex Chen (1): |
28 | aspeed/smc: Fix DMA support for AST2600 | 32 | exynos: Fix bad printf format specifiers |
33 | |||
34 | Alistair Francis (1): | ||
35 | register: Remove unnecessary NULL check | ||
36 | |||
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 | ||
29 | 46 | ||
30 | Philippe Mathieu-Daudé (1): | 47 | Philippe Mathieu-Daudé (1): |
31 | hw/arm/bcm283x: Correct the license text | 48 | util/cutils: Fix Coverity array overrun in freq_to_str() |
32 | 49 | ||
33 | Richard Henderson (3): | 50 | configure | 11 +++++-- |
34 | target/arm: Rearrange disabled check for watchpoints | 51 | hw/misc/tmp105.h | 7 +++++ |
35 | target/arm: Assert immh != 0 in disas_simd_shift_imm | 52 | hw/core/register.c | 4 --- |
36 | target/arm: Move computation of index in handle_simd_dupe | 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(-) | ||
37 | 61 | ||
38 | include/hw/arm/bcm2835_peripherals.h | 3 ++- | ||
39 | include/hw/arm/bcm2836.h | 3 ++- | ||
40 | include/hw/char/bcm2835_aux.h | 3 ++- | ||
41 | include/hw/display/bcm2835_fb.h | 3 ++- | ||
42 | include/hw/dma/bcm2835_dma.h | 4 +++- | ||
43 | include/hw/intc/bcm2835_ic.h | 4 +++- | ||
44 | include/hw/intc/bcm2836_control.h | 3 ++- | ||
45 | include/hw/misc/bcm2835_mbox.h | 4 +++- | ||
46 | include/hw/misc/bcm2835_mbox_defs.h | 4 +++- | ||
47 | include/hw/misc/bcm2835_property.h | 4 +++- | ||
48 | hw/arm/aspeed_ast2600.c | 6 ++++++ | ||
49 | hw/arm/bcm2835_peripherals.c | 3 ++- | ||
50 | hw/arm/bcm2836.c | 3 ++- | ||
51 | hw/arm/raspi.c | 3 ++- | ||
52 | hw/display/bcm2835_fb.c | 1 - | ||
53 | hw/dma/bcm2835_dma.c | 4 +++- | ||
54 | hw/intc/bcm2835_ic.c | 4 ++-- | ||
55 | hw/intc/bcm2836_control.c | 4 +++- | ||
56 | hw/misc/bcm2835_mbox.c | 4 +++- | ||
57 | hw/misc/bcm2835_property.c | 4 +++- | ||
58 | hw/ssi/aspeed_smc.c | 15 +++++++++++++-- | ||
59 | target/arm/helper.c | 11 ++++++----- | ||
60 | target/arm/translate-a64.c | 6 +++++- | ||
61 | hw/ssi/trace-events | 1 + | ||
62 | 24 files changed, 76 insertions(+), 28 deletions(-) | ||
63 | diff view generated by jsdifflib |
1 | From: Cédric Le Goater <clg@kaod.org> | 1 | From: Andrew Jones <drjones@redhat.com> |
---|---|---|---|
2 | 2 | ||
3 | Recent firmwares uses SPI DMA transfers in U-Boot to load the | 3 | The removal of the selection of A15MPCORE from ARM_VIRT also |
4 | different images (kernel, initrd, dtb) in the SoC DRAM. The AST2600 | 4 | removed what A15MPCORE selects, ARM_GIC. We still need ARM_GIC. |
5 | FMC model is missing the masks to be applied on the DMA registers | ||
6 | which resulted in incorrect values. Fix that and wire the SPI | ||
7 | controllers which have DMA support on the AST2600. | ||
8 | 5 | ||
9 | Fixes: bcaa8ddd081c ("aspeed/smc: Add AST2600 support") | 6 | Fixes: bec3c97e0cf9 ("hw/arm/virt: Remove dependency on Cortex-A15 MPCore peripherals") |
10 | Signed-off-by: Cédric Le Goater <clg@kaod.org> | 7 | Reported-by: Miroslav Rezanina <mrezanin@redhat.com> |
11 | Reviewed-by: Joel Stanley <joel@jms.id.au> | 8 | Signed-off-by: Andrew Jones <drjones@redhat.com> |
12 | Message-id: 20200320053923.20565-1-clg@kaod.org | 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 | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | --- | 13 | --- |
15 | hw/arm/aspeed_ast2600.c | 6 ++++++ | 14 | hw/arm/Kconfig | 1 + |
16 | hw/ssi/aspeed_smc.c | 15 +++++++++++++-- | 15 | 1 file changed, 1 insertion(+) |
17 | hw/ssi/trace-events | 1 + | ||
18 | 3 files changed, 20 insertions(+), 2 deletions(-) | ||
19 | 16 | ||
20 | diff --git a/hw/arm/aspeed_ast2600.c b/hw/arm/aspeed_ast2600.c | 17 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig |
21 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/hw/arm/aspeed_ast2600.c | 19 | --- a/hw/arm/Kconfig |
23 | +++ b/hw/arm/aspeed_ast2600.c | 20 | +++ b/hw/arm/Kconfig |
24 | @@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp) | 21 | @@ -XXX,XX +XXX,XX @@ config ARM_VIRT |
25 | 22 | imply VFIO_PLATFORM | |
26 | /* SPI */ | 23 | imply VFIO_XGMAC |
27 | for (i = 0; i < sc->spis_num; i++) { | 24 | imply TPM_TIS_SYSBUS |
28 | + object_property_set_link(OBJECT(&s->spi[i]), OBJECT(s->dram_mr), | 25 | + select ARM_GIC |
29 | + "dram", &err); | 26 | select ACPI |
30 | + if (err) { | 27 | select ARM_SMMUV3 |
31 | + error_propagate(errp, err); | 28 | select GPIO_KEY |
32 | + return; | ||
33 | + } | ||
34 | object_property_set_int(OBJECT(&s->spi[i]), 1, "num-cs", &err); | ||
35 | object_property_set_bool(OBJECT(&s->spi[i]), true, "realized", | ||
36 | &local_err); | ||
37 | diff --git a/hw/ssi/aspeed_smc.c b/hw/ssi/aspeed_smc.c | ||
38 | index XXXXXXX..XXXXXXX 100644 | ||
39 | --- a/hw/ssi/aspeed_smc.c | ||
40 | +++ b/hw/ssi/aspeed_smc.c | ||
41 | @@ -XXX,XX +XXX,XX @@ static const AspeedSMCController controllers[] = { | ||
42 | .flash_window_base = ASPEED26_SOC_FMC_FLASH_BASE, | ||
43 | .flash_window_size = 0x10000000, | ||
44 | .has_dma = true, | ||
45 | + .dma_flash_mask = 0x0FFFFFFC, | ||
46 | + .dma_dram_mask = 0x3FFFFFFC, | ||
47 | .nregs = ASPEED_SMC_R_MAX, | ||
48 | .segment_to_reg = aspeed_2600_smc_segment_to_reg, | ||
49 | .reg_to_segment = aspeed_2600_smc_reg_to_segment, | ||
50 | @@ -XXX,XX +XXX,XX @@ static const AspeedSMCController controllers[] = { | ||
51 | .segments = aspeed_segments_ast2600_spi1, | ||
52 | .flash_window_base = ASPEED26_SOC_SPI_FLASH_BASE, | ||
53 | .flash_window_size = 0x10000000, | ||
54 | - .has_dma = false, | ||
55 | + .has_dma = true, | ||
56 | + .dma_flash_mask = 0x0FFFFFFC, | ||
57 | + .dma_dram_mask = 0x3FFFFFFC, | ||
58 | .nregs = ASPEED_SMC_R_MAX, | ||
59 | .segment_to_reg = aspeed_2600_smc_segment_to_reg, | ||
60 | .reg_to_segment = aspeed_2600_smc_reg_to_segment, | ||
61 | @@ -XXX,XX +XXX,XX @@ static const AspeedSMCController controllers[] = { | ||
62 | .segments = aspeed_segments_ast2600_spi2, | ||
63 | .flash_window_base = ASPEED26_SOC_SPI2_FLASH_BASE, | ||
64 | .flash_window_size = 0x10000000, | ||
65 | - .has_dma = false, | ||
66 | + .has_dma = true, | ||
67 | + .dma_flash_mask = 0x0FFFFFFC, | ||
68 | + .dma_dram_mask = 0x3FFFFFFC, | ||
69 | .nregs = ASPEED_SMC_R_MAX, | ||
70 | .segment_to_reg = aspeed_2600_smc_segment_to_reg, | ||
71 | .reg_to_segment = aspeed_2600_smc_reg_to_segment, | ||
72 | @@ -XXX,XX +XXX,XX @@ static void aspeed_smc_dma_rw(AspeedSMCState *s) | ||
73 | MemTxResult result; | ||
74 | uint32_t data; | ||
75 | |||
76 | + trace_aspeed_smc_dma_rw(s->regs[R_DMA_CTRL] & DMA_CTRL_WRITE ? | ||
77 | + "write" : "read", | ||
78 | + s->regs[R_DMA_FLASH_ADDR], | ||
79 | + s->regs[R_DMA_DRAM_ADDR], | ||
80 | + s->regs[R_DMA_LEN]); | ||
81 | while (s->regs[R_DMA_LEN]) { | ||
82 | if (s->regs[R_DMA_CTRL] & DMA_CTRL_WRITE) { | ||
83 | data = address_space_ldl_le(&s->dram_as, s->regs[R_DMA_DRAM_ADDR], | ||
84 | diff --git a/hw/ssi/trace-events b/hw/ssi/trace-events | ||
85 | index XXXXXXX..XXXXXXX 100644 | ||
86 | --- a/hw/ssi/trace-events | ||
87 | +++ b/hw/ssi/trace-events | ||
88 | @@ -XXX,XX +XXX,XX @@ aspeed_smc_do_snoop(int cs, int index, int dummies, int data) "CS%d index:0x%x d | ||
89 | aspeed_smc_flash_write(int cs, uint64_t addr, uint32_t size, uint64_t data, int mode) "CS%d @0x%" PRIx64 " size %u: 0x%" PRIx64" mode:%d" | ||
90 | aspeed_smc_read(uint64_t addr, uint32_t size, uint64_t data) "@0x%" PRIx64 " size %u: 0x%" PRIx64 | ||
91 | aspeed_smc_dma_checksum(uint32_t addr, uint32_t data) "0x%08x: 0x%08x" | ||
92 | +aspeed_smc_dma_rw(const char *dir, uint32_t flash_addr, uint32_t dram_addr, uint32_t size) "%s flash:@0x%08x dram:@0x%08x size:0x%08x" | ||
93 | aspeed_smc_write(uint64_t addr, uint32_t size, uint64_t data) "@0x%" PRIx64 " size %u: 0x%" PRIx64 | ||
94 | aspeed_smc_flash_select(int cs, const char *prefix) "CS%d %sselect" | ||
95 | -- | 29 | -- |
96 | 2.20.1 | 30 | 2.20.1 |
97 | 31 | ||
98 | 32 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | From: Alex Chen <alex.chen@huawei.com> |
---|---|---|---|
2 | 2 | ||
3 | The license is the 'GNU General Public License v2.0 or later', | 3 | We should use printf format specifier "%u" instead of "%d" for |
4 | not 'and': | 4 | argument of type "unsigned int". |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/ori | 6 | Reported-by: Euler Robot <euler.robot@huawei.com> |
7 | modify it under the terms of the GNU General Public License as | 7 | Signed-off-by: Alex Chen <alex.chen@huawei.com> |
8 | published by the Free Software Foundation; either version 2 of | 8 | Message-id: 20201111073651.72804-1-alex.chen@huawei.com |
9 | the License, or (at your option) any later version. | ||
10 | |||
11 | Fix the license comment. | ||
12 | |||
13 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
14 | Message-id: 20200312213455.15854-1-philmd@redhat.com | ||
15 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
17 | --- | 11 | --- |
18 | include/hw/arm/bcm2835_peripherals.h | 3 ++- | 12 | hw/timer/exynos4210_mct.c | 4 ++-- |
19 | include/hw/arm/bcm2836.h | 3 ++- | 13 | hw/timer/exynos4210_pwm.c | 8 ++++---- |
20 | include/hw/char/bcm2835_aux.h | 3 ++- | 14 | 2 files changed, 6 insertions(+), 6 deletions(-) |
21 | include/hw/display/bcm2835_fb.h | 3 ++- | ||
22 | include/hw/dma/bcm2835_dma.h | 4 +++- | ||
23 | include/hw/intc/bcm2835_ic.h | 4 +++- | ||
24 | include/hw/intc/bcm2836_control.h | 3 ++- | ||
25 | include/hw/misc/bcm2835_mbox.h | 4 +++- | ||
26 | include/hw/misc/bcm2835_mbox_defs.h | 4 +++- | ||
27 | include/hw/misc/bcm2835_property.h | 4 +++- | ||
28 | hw/arm/bcm2835_peripherals.c | 3 ++- | ||
29 | hw/arm/bcm2836.c | 3 ++- | ||
30 | hw/arm/raspi.c | 3 ++- | ||
31 | hw/display/bcm2835_fb.c | 1 - | ||
32 | hw/dma/bcm2835_dma.c | 4 +++- | ||
33 | hw/intc/bcm2835_ic.c | 4 ++-- | ||
34 | hw/intc/bcm2836_control.c | 4 +++- | ||
35 | hw/misc/bcm2835_mbox.c | 4 +++- | ||
36 | hw/misc/bcm2835_property.c | 4 +++- | ||
37 | 19 files changed, 45 insertions(+), 20 deletions(-) | ||
38 | 15 | ||
39 | diff --git a/include/hw/arm/bcm2835_peripherals.h b/include/hw/arm/bcm2835_peripherals.h | 16 | diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c |
40 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
41 | --- a/include/hw/arm/bcm2835_peripherals.h | 18 | --- a/hw/timer/exynos4210_mct.c |
42 | +++ b/include/hw/arm/bcm2835_peripherals.h | 19 | +++ b/hw/timer/exynos4210_mct.c |
43 | @@ -XXX,XX +XXX,XX @@ | 20 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_gcomp_raise_irq(void *opaque, uint32_t id) |
44 | * Rasperry Pi 2 emulation and refactoring Copyright (c) 2015, Microsoft | 21 | /* If CSTAT is pending and IRQ is enabled */ |
45 | * Written by Andrew Baumann | 22 | if ((s->reg.int_cstat & G_INT_CSTAT_COMP(id)) && |
46 | * | 23 | (s->reg.int_enb & G_INT_ENABLE(id))) { |
47 | - * This code is licensed under the GNU GPLv2 and later. | 24 | - DPRINTF("gcmp timer[%d] IRQ\n", id); |
48 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | 25 | + DPRINTF("gcmp timer[%u] IRQ\n", id); |
49 | + * See the COPYING file in the top-level directory. | 26 | qemu_irq_raise(s->irq[id]); |
50 | */ | 27 | } |
51 | 28 | } | |
52 | #ifndef BCM2835_PERIPHERALS_H | 29 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_mct_update_freq(Exynos4210MCTState *s) |
53 | diff --git a/include/hw/arm/bcm2836.h b/include/hw/arm/bcm2836.h | 30 | MCT_CFG_GET_DIVIDER(s->reg_mct_cfg)); |
31 | |||
32 | if (freq != s->freq) { | ||
33 | - DPRINTF("freq=%dHz\n", s->freq); | ||
34 | + DPRINTF("freq=%uHz\n", s->freq); | ||
35 | |||
36 | /* global timer */ | ||
37 | tx_ptimer_set_freq(s->g_timer.ptimer_frc, s->freq); | ||
38 | diff --git a/hw/timer/exynos4210_pwm.c b/hw/timer/exynos4210_pwm.c | ||
54 | index XXXXXXX..XXXXXXX 100644 | 39 | index XXXXXXX..XXXXXXX 100644 |
55 | --- a/include/hw/arm/bcm2836.h | 40 | --- a/hw/timer/exynos4210_pwm.c |
56 | +++ b/include/hw/arm/bcm2836.h | 41 | +++ b/hw/timer/exynos4210_pwm.c |
57 | @@ -XXX,XX +XXX,XX @@ | 42 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_pwm_update_freq(Exynos4210PWMState *s, uint32_t id) |
58 | * Rasperry Pi 2 emulation and refactoring Copyright (c) 2015, Microsoft | 43 | |
59 | * Written by Andrew Baumann | 44 | if (freq != s->timer[id].freq) { |
60 | * | 45 | ptimer_set_freq(s->timer[id].ptimer, s->timer[id].freq); |
61 | - * This code is licensed under the GNU GPLv2 and later. | 46 | - DPRINTF("freq=%dHz\n", s->timer[id].freq); |
62 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | 47 | + DPRINTF("freq=%uHz\n", s->timer[id].freq); |
63 | + * See the COPYING file in the top-level directory. | 48 | } |
64 | */ | 49 | } |
65 | 50 | ||
66 | #ifndef BCM2836_H | 51 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_pwm_tick(void *opaque) |
67 | diff --git a/include/hw/char/bcm2835_aux.h b/include/hw/char/bcm2835_aux.h | 52 | uint32_t id = s->id; |
68 | index XXXXXXX..XXXXXXX 100644 | 53 | bool cmp; |
69 | --- a/include/hw/char/bcm2835_aux.h | 54 | |
70 | +++ b/include/hw/char/bcm2835_aux.h | 55 | - DPRINTF("timer %d tick\n", id); |
71 | @@ -XXX,XX +XXX,XX @@ | 56 | + DPRINTF("timer %u tick\n", id); |
72 | * Rasperry Pi 2 emulation and refactoring Copyright (c) 2015, Microsoft | 57 | |
73 | * Written by Andrew Baumann | 58 | /* set irq status */ |
74 | * | 59 | p->reg_tint_cstat |= TINT_CSTAT_STATUS(id); |
75 | - * This code is licensed under the GNU GPLv2 and later. | 60 | |
76 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | 61 | /* raise IRQ */ |
77 | + * See the COPYING file in the top-level directory. | 62 | if (p->reg_tint_cstat & TINT_CSTAT_ENABLE(id)) { |
78 | */ | 63 | - DPRINTF("timer %d IRQ\n", id); |
79 | 64 | + DPRINTF("timer %u IRQ\n", id); | |
80 | #ifndef BCM2835_AUX_H | 65 | qemu_irq_raise(p->timer[id].irq); |
81 | diff --git a/include/hw/display/bcm2835_fb.h b/include/hw/display/bcm2835_fb.h | 66 | } |
82 | index XXXXXXX..XXXXXXX 100644 | 67 | |
83 | --- a/include/hw/display/bcm2835_fb.h | 68 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_pwm_tick(void *opaque) |
84 | +++ b/include/hw/display/bcm2835_fb.h | 69 | } |
85 | @@ -XXX,XX +XXX,XX @@ | 70 | |
86 | * Rasperry Pi 2 emulation and refactoring Copyright (c) 2015, Microsoft | 71 | if (cmp) { |
87 | * Written by Andrew Baumann | 72 | - DPRINTF("auto reload timer %d count to %x\n", id, |
88 | * | 73 | + DPRINTF("auto reload timer %u count to %x\n", id, |
89 | - * This code is licensed under the GNU GPLv2 and later. | 74 | p->timer[id].reg_tcntb); |
90 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | 75 | ptimer_set_count(p->timer[id].ptimer, p->timer[id].reg_tcntb); |
91 | + * See the COPYING file in the top-level directory. | 76 | ptimer_run(p->timer[id].ptimer, 1); |
92 | */ | ||
93 | |||
94 | #ifndef BCM2835_FB_H | ||
95 | diff --git a/include/hw/dma/bcm2835_dma.h b/include/hw/dma/bcm2835_dma.h | ||
96 | index XXXXXXX..XXXXXXX 100644 | ||
97 | --- a/include/hw/dma/bcm2835_dma.h | ||
98 | +++ b/include/hw/dma/bcm2835_dma.h | ||
99 | @@ -XXX,XX +XXX,XX @@ | ||
100 | /* | ||
101 | * Raspberry Pi emulation (c) 2012 Gregory Estrade | ||
102 | - * This code is licensed under the GNU GPLv2 and later. | ||
103 | + * | ||
104 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
105 | + * See the COPYING file in the top-level directory. | ||
106 | */ | ||
107 | |||
108 | #ifndef BCM2835_DMA_H | ||
109 | diff --git a/include/hw/intc/bcm2835_ic.h b/include/hw/intc/bcm2835_ic.h | ||
110 | index XXXXXXX..XXXXXXX 100644 | ||
111 | --- a/include/hw/intc/bcm2835_ic.h | ||
112 | +++ b/include/hw/intc/bcm2835_ic.h | ||
113 | @@ -XXX,XX +XXX,XX @@ | ||
114 | /* | ||
115 | * Raspberry Pi emulation (c) 2012 Gregory Estrade | ||
116 | - * This code is licensed under the GNU GPLv2 and later. | ||
117 | + * | ||
118 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
119 | + * See the COPYING file in the top-level directory. | ||
120 | */ | ||
121 | |||
122 | #ifndef BCM2835_IC_H | ||
123 | diff --git a/include/hw/intc/bcm2836_control.h b/include/hw/intc/bcm2836_control.h | ||
124 | index XXXXXXX..XXXXXXX 100644 | ||
125 | --- a/include/hw/intc/bcm2836_control.h | ||
126 | +++ b/include/hw/intc/bcm2836_control.h | ||
127 | @@ -XXX,XX +XXX,XX @@ | ||
128 | * ARM Local Timer IRQ Copyright (c) 2019. Zoltán Baldaszti | ||
129 | * Added basic IRQ_TIMER interrupt support | ||
130 | * | ||
131 | - * This code is licensed under the GNU GPLv2 and later. | ||
132 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
133 | + * See the COPYING file in the top-level directory. | ||
134 | */ | ||
135 | |||
136 | #ifndef BCM2836_CONTROL_H | ||
137 | diff --git a/include/hw/misc/bcm2835_mbox.h b/include/hw/misc/bcm2835_mbox.h | ||
138 | index XXXXXXX..XXXXXXX 100644 | ||
139 | --- a/include/hw/misc/bcm2835_mbox.h | ||
140 | +++ b/include/hw/misc/bcm2835_mbox.h | ||
141 | @@ -XXX,XX +XXX,XX @@ | ||
142 | /* | ||
143 | * Raspberry Pi emulation (c) 2012 Gregory Estrade | ||
144 | - * This code is licensed under the GNU GPLv2 and later. | ||
145 | + * | ||
146 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
147 | + * See the COPYING file in the top-level directory. | ||
148 | */ | ||
149 | |||
150 | #ifndef BCM2835_MBOX_H | ||
151 | diff --git a/include/hw/misc/bcm2835_mbox_defs.h b/include/hw/misc/bcm2835_mbox_defs.h | ||
152 | index XXXXXXX..XXXXXXX 100644 | ||
153 | --- a/include/hw/misc/bcm2835_mbox_defs.h | ||
154 | +++ b/include/hw/misc/bcm2835_mbox_defs.h | ||
155 | @@ -XXX,XX +XXX,XX @@ | ||
156 | /* | ||
157 | * Raspberry Pi emulation (c) 2012 Gregory Estrade | ||
158 | - * This code is licensed under the GNU GPLv2 and later. | ||
159 | + * | ||
160 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
161 | + * See the COPYING file in the top-level directory. | ||
162 | */ | ||
163 | |||
164 | #ifndef BCM2835_MBOX_DEFS_H | ||
165 | diff --git a/include/hw/misc/bcm2835_property.h b/include/hw/misc/bcm2835_property.h | ||
166 | index XXXXXXX..XXXXXXX 100644 | ||
167 | --- a/include/hw/misc/bcm2835_property.h | ||
168 | +++ b/include/hw/misc/bcm2835_property.h | ||
169 | @@ -XXX,XX +XXX,XX @@ | ||
170 | /* | ||
171 | * Raspberry Pi emulation (c) 2012 Gregory Estrade | ||
172 | - * This code is licensed under the GNU GPLv2 and later. | ||
173 | + * | ||
174 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
175 | + * See the COPYING file in the top-level directory. | ||
176 | */ | ||
177 | |||
178 | #ifndef BCM2835_PROPERTY_H | ||
179 | diff --git a/hw/arm/bcm2835_peripherals.c b/hw/arm/bcm2835_peripherals.c | ||
180 | index XXXXXXX..XXXXXXX 100644 | ||
181 | --- a/hw/arm/bcm2835_peripherals.c | ||
182 | +++ b/hw/arm/bcm2835_peripherals.c | ||
183 | @@ -XXX,XX +XXX,XX @@ | ||
184 | * Rasperry Pi 2 emulation and refactoring Copyright (c) 2015, Microsoft | ||
185 | * Written by Andrew Baumann | ||
186 | * | ||
187 | - * This code is licensed under the GNU GPLv2 and later. | ||
188 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
189 | + * See the COPYING file in the top-level directory. | ||
190 | */ | ||
191 | |||
192 | #include "qemu/osdep.h" | ||
193 | diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c | ||
194 | index XXXXXXX..XXXXXXX 100644 | ||
195 | --- a/hw/arm/bcm2836.c | ||
196 | +++ b/hw/arm/bcm2836.c | ||
197 | @@ -XXX,XX +XXX,XX @@ | ||
198 | * Rasperry Pi 2 emulation and refactoring Copyright (c) 2015, Microsoft | ||
199 | * Written by Andrew Baumann | ||
200 | * | ||
201 | - * This code is licensed under the GNU GPLv2 and later. | ||
202 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
203 | + * See the COPYING file in the top-level directory. | ||
204 | */ | ||
205 | |||
206 | #include "qemu/osdep.h" | ||
207 | diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c | ||
208 | index XXXXXXX..XXXXXXX 100644 | ||
209 | --- a/hw/arm/raspi.c | ||
210 | +++ b/hw/arm/raspi.c | ||
211 | @@ -XXX,XX +XXX,XX @@ | ||
212 | * Raspberry Pi 3 emulation Copyright (c) 2018 Zoltán Baldaszti | ||
213 | * Upstream code cleanup (c) 2018 Pekka Enberg | ||
214 | * | ||
215 | - * This code is licensed under the GNU GPLv2 and later. | ||
216 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
217 | + * See the COPYING file in the top-level directory. | ||
218 | */ | ||
219 | |||
220 | #include "qemu/osdep.h" | ||
221 | diff --git a/hw/display/bcm2835_fb.c b/hw/display/bcm2835_fb.c | ||
222 | index XXXXXXX..XXXXXXX 100644 | ||
223 | --- a/hw/display/bcm2835_fb.c | ||
224 | +++ b/hw/display/bcm2835_fb.c | ||
225 | @@ -XXX,XX +XXX,XX @@ | ||
226 | /* | ||
227 | * Raspberry Pi emulation (c) 2012 Gregory Estrade | ||
228 | * Refactoring for Pi2 Copyright (c) 2015, Microsoft. Written by Andrew Baumann. | ||
229 | - * This code is licensed under the GNU GPLv2 and later. | ||
230 | * | ||
231 | * Heavily based on milkymist-vgafb.c, copyright terms below: | ||
232 | * QEMU model of the Milkymist VGA framebuffer. | ||
233 | diff --git a/hw/dma/bcm2835_dma.c b/hw/dma/bcm2835_dma.c | ||
234 | index XXXXXXX..XXXXXXX 100644 | ||
235 | --- a/hw/dma/bcm2835_dma.c | ||
236 | +++ b/hw/dma/bcm2835_dma.c | ||
237 | @@ -XXX,XX +XXX,XX @@ | ||
238 | /* | ||
239 | * Raspberry Pi emulation (c) 2012 Gregory Estrade | ||
240 | - * This code is licensed under the GNU GPLv2 and later. | ||
241 | + * | ||
242 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
243 | + * See the COPYING file in the top-level directory. | ||
244 | */ | ||
245 | |||
246 | #include "qemu/osdep.h" | ||
247 | diff --git a/hw/intc/bcm2835_ic.c b/hw/intc/bcm2835_ic.c | ||
248 | index XXXXXXX..XXXXXXX 100644 | ||
249 | --- a/hw/intc/bcm2835_ic.c | ||
250 | +++ b/hw/intc/bcm2835_ic.c | ||
251 | @@ -XXX,XX +XXX,XX @@ | ||
252 | /* | ||
253 | * Raspberry Pi emulation (c) 2012 Gregory Estrade | ||
254 | * Refactoring for Pi2 Copyright (c) 2015, Microsoft. Written by Andrew Baumann. | ||
255 | - * This code is licensed under the GNU GPLv2 and later. | ||
256 | * Heavily based on pl190.c, copyright terms below: | ||
257 | * | ||
258 | * Arm PrimeCell PL190 Vector Interrupt Controller | ||
259 | @@ -XXX,XX +XXX,XX @@ | ||
260 | * Copyright (c) 2006 CodeSourcery. | ||
261 | * Written by Paul Brook | ||
262 | * | ||
263 | - * This code is licensed under the GPL. | ||
264 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
265 | + * See the COPYING file in the top-level directory. | ||
266 | */ | ||
267 | |||
268 | #include "qemu/osdep.h" | ||
269 | diff --git a/hw/intc/bcm2836_control.c b/hw/intc/bcm2836_control.c | ||
270 | index XXXXXXX..XXXXXXX 100644 | ||
271 | --- a/hw/intc/bcm2836_control.c | ||
272 | +++ b/hw/intc/bcm2836_control.c | ||
273 | @@ -XXX,XX +XXX,XX @@ | ||
274 | * Written by Andrew Baumann | ||
275 | * | ||
276 | * Based on bcm2835_ic.c (Raspberry Pi emulation) (c) 2012 Gregory Estrade | ||
277 | - * This code is licensed under the GNU GPLv2 and later. | ||
278 | * | ||
279 | * At present, only implements interrupt routing, and mailboxes (i.e., | ||
280 | * not PMU interrupt, or AXI counters). | ||
281 | @@ -XXX,XX +XXX,XX @@ | ||
282 | * | ||
283 | * Ref: | ||
284 | * https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2836/QA7_rev3.4.pdf | ||
285 | + * | ||
286 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
287 | + * See the COPYING file in the top-level directory. | ||
288 | */ | ||
289 | |||
290 | #include "qemu/osdep.h" | ||
291 | diff --git a/hw/misc/bcm2835_mbox.c b/hw/misc/bcm2835_mbox.c | ||
292 | index XXXXXXX..XXXXXXX 100644 | ||
293 | --- a/hw/misc/bcm2835_mbox.c | ||
294 | +++ b/hw/misc/bcm2835_mbox.c | ||
295 | @@ -XXX,XX +XXX,XX @@ | ||
296 | /* | ||
297 | * Raspberry Pi emulation (c) 2012 Gregory Estrade | ||
298 | - * This code is licensed under the GNU GPLv2 and later. | ||
299 | * | ||
300 | * This file models the system mailboxes, which are used for | ||
301 | * communication with low-bandwidth GPU peripherals. Refs: | ||
302 | * https://github.com/raspberrypi/firmware/wiki/Mailboxes | ||
303 | * https://github.com/raspberrypi/firmware/wiki/Accessing-mailboxes | ||
304 | + * | ||
305 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
306 | + * See the COPYING file in the top-level directory. | ||
307 | */ | ||
308 | |||
309 | #include "qemu/osdep.h" | ||
310 | diff --git a/hw/misc/bcm2835_property.c b/hw/misc/bcm2835_property.c | ||
311 | index XXXXXXX..XXXXXXX 100644 | ||
312 | --- a/hw/misc/bcm2835_property.c | ||
313 | +++ b/hw/misc/bcm2835_property.c | ||
314 | @@ -XXX,XX +XXX,XX @@ | ||
315 | /* | ||
316 | * Raspberry Pi emulation (c) 2012 Gregory Estrade | ||
317 | - * This code is licensed under the GNU GPLv2 and later. | ||
318 | + * | ||
319 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
320 | + * See the COPYING file in the top-level directory. | ||
321 | */ | ||
322 | |||
323 | #include "qemu/osdep.h" | ||
324 | -- | 77 | -- |
325 | 2.20.1 | 78 | 2.20.1 |
326 | 79 | ||
327 | 80 | diff view generated by jsdifflib |
New 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. | ||
1 | 6 | ||
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 |
New patch | |||
---|---|---|---|
1 | In the mtspr helper we attempt to check for "is the timer disabled" | ||
2 | with "if (env->ttmr & TIMER_NONE)". This is wrong because TIMER_NONE | ||
3 | is zero and the condition is always false (Coverity complains about | ||
4 | the dead code.) | ||
1 | 5 | ||
6 | The correct check would be to test whether the TTMR_M field in the | ||
7 | register is equal to TIMER_NONE instead. However, the | ||
8 | cpu_openrisc_timer_update() function checks whether the timer is | ||
9 | enabled (it looks at cpu->env.is_counting, which is set to 0 via | ||
10 | cpu_openrisc_count_stop() when the TTMR_M field is set to | ||
11 | TIMER_NONE), so there's no need to check for "timer disabled" in the | ||
12 | target/openrisc code. Instead, simply remove the dead code. | ||
13 | |||
14 | Fixes: Coverity CID 1005812 | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
16 | Acked-by: Stafford Horne <shorne@gmail.com> | ||
17 | Message-id: 20201103114654.18540-1-peter.maydell@linaro.org | ||
18 | --- | ||
19 | target/openrisc/sys_helper.c | 3 --- | ||
20 | 1 file changed, 3 deletions(-) | ||
21 | |||
22 | diff --git a/target/openrisc/sys_helper.c b/target/openrisc/sys_helper.c | ||
23 | index XXXXXXX..XXXXXXX 100644 | ||
24 | --- a/target/openrisc/sys_helper.c | ||
25 | +++ b/target/openrisc/sys_helper.c | ||
26 | @@ -XXX,XX +XXX,XX @@ void HELPER(mtspr)(CPUOpenRISCState *env, target_ulong spr, target_ulong rb) | ||
27 | |||
28 | case TO_SPR(10, 1): /* TTCR */ | ||
29 | cpu_openrisc_count_set(cpu, rb); | ||
30 | - if (env->ttmr & TIMER_NONE) { | ||
31 | - return; | ||
32 | - } | ||
33 | cpu_openrisc_timer_update(cpu); | ||
34 | break; | ||
35 | #endif | ||
36 | -- | ||
37 | 2.20.1 | ||
38 | |||
39 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Alistair Francis <alistair.francis@wdc.com> |
---|---|---|---|
2 | 2 | ||
3 | Coverity rightly notes that ctz32(bas) on 0 will return 32, | 3 | This patch fixes CID 1432800 by removing an unnecessary check. |
4 | which makes the len calculation a BAD_SHIFT. | ||
5 | 4 | ||
6 | A value of 0 in DBGWCR<n>_EL1.BAS is reserved. Simply move | 5 | Signed-off-by: Alistair Francis <alistair.francis@wdc.com> |
7 | the existing check we have for this case. | ||
8 | |||
9 | Reported-by: Coverity (CID 1421964) | ||
10 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
11 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
12 | Message-id: 20200320160622.8040-2-richard.henderson@linaro.org | ||
13 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
15 | --- | 8 | --- |
16 | target/arm/helper.c | 11 ++++++----- | 9 | hw/core/register.c | 4 ---- |
17 | 1 file changed, 6 insertions(+), 5 deletions(-) | 10 | 1 file changed, 4 deletions(-) |
18 | 11 | ||
19 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 12 | diff --git a/hw/core/register.c b/hw/core/register.c |
20 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/target/arm/helper.c | 14 | --- a/hw/core/register.c |
22 | +++ b/target/arm/helper.c | 15 | +++ b/hw/core/register.c |
23 | @@ -XXX,XX +XXX,XX @@ void hw_watchpoint_update(ARMCPU *cpu, int n) | 16 | @@ -XXX,XX +XXX,XX @@ static RegisterInfoArray *register_init_block(DeviceState *owner, |
24 | int bas = extract64(wcr, 5, 8); | 17 | int index = rae[i].addr / data_size; |
25 | int basstart; | 18 | RegisterInfo *r = &ri[index]; |
26 | 19 | ||
27 | - if (bas == 0) { | 20 | - if (data + data_size * index == 0 || !&rae[i]) { |
28 | - /* This must act as if the watchpoint is disabled */ | 21 | - continue; |
29 | - return; | ||
30 | - } | 22 | - } |
31 | - | 23 | - |
32 | if (extract64(wvr, 2, 1)) { | 24 | /* Init the register, this will zero it. */ |
33 | /* Deprecated case of an only 4-aligned address. BAS[7:4] are | 25 | object_initialize((void *)r, sizeof(*r), TYPE_REGISTER); |
34 | * ignored, and BAS[3:0] define which bytes to watch. | 26 | |
35 | */ | ||
36 | bas &= 0xf; | ||
37 | } | ||
38 | + | ||
39 | + if (bas == 0) { | ||
40 | + /* This must act as if the watchpoint is disabled */ | ||
41 | + return; | ||
42 | + } | ||
43 | + | ||
44 | /* The BAS bits are supposed to be programmed to indicate a contiguous | ||
45 | * range of bytes. Otherwise it is CONSTRAINED UNPREDICTABLE whether | ||
46 | * we fire for each byte in the word/doubleword addressed by the WVR. | ||
47 | -- | 27 | -- |
48 | 2.20.1 | 28 | 2.20.1 |
49 | 29 | ||
50 | 30 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | Coverity reports a BAD_SHIFT with ctz32(imm5), with imm5 == 0. | 3 | Fix Coverity CID 1435957: Memory - illegal accesses (OVERRUN): |
4 | This is an invalid encoding, but we diagnose that just below | ||
5 | by rejecting size > 3. Avoid the warning by sinking the | ||
6 | computation of index below the check. | ||
7 | 4 | ||
8 | Reported-by: Coverity (CID 1421965) | 5 | >>> Overrunning array "suffixes" of 7 8-byte elements at element |
9 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 6 | index 7 (byte offset 63) using index "idx" (which evaluates to 7). |
10 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 7 | |
11 | Message-id: 20200320160622.8040-4-richard.henderson@linaro.org | 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> | ||
12 | Reviewed-by: Peter Maydell <peter.maydell@linaro.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> | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | --- | 20 | --- |
15 | target/arm/translate-a64.c | 3 ++- | 21 | util/cutils.c | 3 ++- |
16 | 1 file changed, 2 insertions(+), 1 deletion(-) | 22 | 1 file changed, 2 insertions(+), 1 deletion(-) |
17 | 23 | ||
18 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 24 | diff --git a/util/cutils.c b/util/cutils.c |
19 | index XXXXXXX..XXXXXXX 100644 | 25 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/target/arm/translate-a64.c | 26 | --- a/util/cutils.c |
21 | +++ b/target/arm/translate-a64.c | 27 | +++ b/util/cutils.c |
22 | @@ -XXX,XX +XXX,XX @@ static void handle_simd_dupe(DisasContext *s, int is_q, int rd, int rn, | 28 | @@ -XXX,XX +XXX,XX @@ char *freq_to_str(uint64_t freq_hz) |
23 | int imm5) | 29 | double freq = freq_hz; |
24 | { | 30 | size_t idx = 0; |
25 | int size = ctz32(imm5); | 31 | |
26 | - int index = imm5 >> (size + 1); | 32 | - while (freq >= 1000.0 && idx < ARRAY_SIZE(suffixes)) { |
27 | + int index; | 33 | + while (freq >= 1000.0) { |
28 | 34 | freq /= 1000.0; | |
29 | if (size > 3 || (size == 3 && !is_q)) { | 35 | idx++; |
30 | unallocated_encoding(s); | ||
31 | @@ -XXX,XX +XXX,XX @@ static void handle_simd_dupe(DisasContext *s, int is_q, int rd, int rn, | ||
32 | return; | ||
33 | } | 36 | } |
34 | 37 | + assert(idx < ARRAY_SIZE(suffixes)); | |
35 | + index = imm5 >> (size + 1); | 38 | |
36 | tcg_gen_gvec_dup_mem(size, vec_full_reg_offset(s, rd), | 39 | return g_strdup_printf("%0.3g %sHz", freq, suffixes[idx]); |
37 | vec_reg_offset(s, rn, index, size), | 40 | } |
38 | is_q ? 16 : 8, vec_full_reg_size(s)); | ||
39 | -- | 41 | -- |
40 | 2.20.1 | 42 | 2.20.1 |
41 | 43 | ||
42 | 44 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | In commit 76346b6264a9b01979 we tried to add a configure check that | ||
2 | the libgio pkg-config data was correct, which builds an executable | ||
3 | linked against it. Unfortunately this doesn't catch the problem | ||
4 | (missing static library dependency info), because a "do nothing" test | ||
5 | source file doesn't have any symbol references that cause the linker | ||
6 | to pull in .o files from libgio.a, and so we don't see the "missing | ||
7 | symbols from libmount" error that a full QEMU link triggers. | ||
1 | 8 | ||
9 | (The ineffective test went unnoticed because of a typo that | ||
10 | effectively disabled libgio unconditionally, but after commit | ||
11 | 3569a5dfc11f2 fixed that, a static link of the system emulator on | ||
12 | Ubuntu stopped working again.) | ||
13 | |||
14 | Improve the gio test by having the test source fragment reference a | ||
15 | g_dbus function (which is what is indirectly causing us to end up | ||
16 | wanting functions from libmount). | ||
17 | |||
18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
19 | Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> | ||
20 | Message-id: 20201116104617.18333-1-peter.maydell@linaro.org | ||
21 | --- | ||
22 | configure | 11 +++++++++-- | ||
23 | 1 file changed, 9 insertions(+), 2 deletions(-) | ||
24 | |||
25 | diff --git a/configure b/configure | ||
26 | index XXXXXXX..XXXXXXX 100755 | ||
27 | --- a/configure | ||
28 | +++ b/configure | ||
29 | @@ -XXX,XX +XXX,XX @@ if $pkg_config --atleast-version=$glib_req_ver gio-2.0; then | ||
30 | # Check that the libraries actually work -- Ubuntu 18.04 ships | ||
31 | # with pkg-config --static --libs data for gio-2.0 that is missing | ||
32 | # -lblkid and will give a link error. | ||
33 | - write_c_skeleton | ||
34 | - if compile_prog "" "$gio_libs" ; then | ||
35 | + cat > $TMPC <<EOF | ||
36 | +#include <gio/gio.h> | ||
37 | +int main(void) | ||
38 | +{ | ||
39 | + g_dbus_proxy_new_sync(0, 0, 0, 0, 0, 0, 0, 0); | ||
40 | + return 0; | ||
41 | +} | ||
42 | +EOF | ||
43 | + if compile_prog "$gio_cflags" "$gio_libs" ; then | ||
44 | gio=yes | ||
45 | else | ||
46 | gio=no | ||
47 | -- | ||
48 | 2.20.1 | ||
49 | |||
50 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | The TMP105 datasheet (https://www.ti.com/lit/gpn/tmp105) says that the |
---|---|---|---|
2 | power-up reset values for the T_low and T_high registers are 80 degrees C | ||
3 | and 75 degrees C, which are 0x500 and 0x4B0 hex according to table 5. These | ||
4 | values are then shifted right by four bits to give the register reset | ||
5 | values, since both registers store the 12 bits of temperature data in bits | ||
6 | [15..4] of a 16 bit register. | ||
2 | 7 | ||
3 | Coverity raised a shed-load of errors cascading from inferring | 8 | We were resetting these registers to zero, which is problematic for Linux |
4 | that clz32(immh) might yield 32, from immh might be 0. | 9 | guests which enable the alert interrupt and then immediately take an |
10 | unexpected overtemperature alert because the current temperature is above | ||
11 | freezing... | ||
5 | 12 | ||
6 | While immh cannot be 0 from encoding, it is not obvious even to | ||
7 | a human how we've checked that: via the filtering provided by | ||
8 | data_proc_simd[]. | ||
9 | |||
10 | Reported-by: Coverity (CID 1421923, and more) | ||
11 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
12 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
13 | Message-id: 20200320160622.8040-3-richard.henderson@linaro.org | ||
14 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 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 | --- | 16 | --- |
17 | target/arm/translate-a64.c | 3 +++ | 17 | hw/misc/tmp105.c | 3 +++ |
18 | 1 file changed, 3 insertions(+) | 18 | 1 file changed, 3 insertions(+) |
19 | 19 | ||
20 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 20 | diff --git a/hw/misc/tmp105.c b/hw/misc/tmp105.c |
21 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/target/arm/translate-a64.c | 22 | --- a/hw/misc/tmp105.c |
23 | +++ b/target/arm/translate-a64.c | 23 | +++ b/hw/misc/tmp105.c |
24 | @@ -XXX,XX +XXX,XX @@ static void disas_simd_shift_imm(DisasContext *s, uint32_t insn) | 24 | @@ -XXX,XX +XXX,XX @@ static void tmp105_reset(I2CSlave *i2c) |
25 | bool is_u = extract32(insn, 29, 1); | 25 | s->faults = tmp105_faultq[(s->config >> 3) & 3]; |
26 | bool is_q = extract32(insn, 30, 1); | 26 | s->alarm = 0; |
27 | 27 | ||
28 | + /* data_proc_simd[] has sent immh == 0 to disas_simd_mod_imm. */ | 28 | + s->limit[0] = 0x4b00; /* T_LOW, 75 degrees C */ |
29 | + assert(immh != 0); | 29 | + s->limit[1] = 0x5000; /* T_HIGH, 80 degrees C */ |
30 | + | 30 | + |
31 | switch (opcode) { | 31 | tmp105_interrupt_update(s); |
32 | case 0x08: /* SRI */ | 32 | } |
33 | if (!is_u) { | 33 | |
34 | -- | 34 | -- |
35 | 2.20.1 | 35 | 2.20.1 |
36 | 36 | ||
37 | 37 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | The TMP105 datasheet says that in Interrupt Mode (when TM==1) the device | ||
2 | signals an alert when the temperature equals or exceeds the T_high value and | ||
3 | then remains high until a device register is read or the device responds to | ||
4 | the SMBUS Alert Response address, or the device is put into Shutdown Mode. | ||
5 | Thereafter the Alert pin will only be re-signalled when temperature falls | ||
6 | below T_low; alert can then be cleared in the same set of ways, and the | ||
7 | device returns to its initial "alert when temperature goes above T_high" | ||
8 | mode. (If this textual description is confusing, see figure 3 in the | ||
9 | TI datasheet at https://www.ti.com/lit/gpn/tmp105 .) | ||
1 | 10 | ||
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 | |||
22 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
23 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | ||
24 | Message-id: 20201110150023.25533-3-peter.maydell@linaro.org | ||
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 | ||
32 | --- a/hw/misc/tmp105.h | ||
33 | +++ b/hw/misc/tmp105.h | ||
34 | @@ -XXX,XX +XXX,XX @@ struct TMP105State { | ||
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 | + } | ||
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 | -- | ||
152 | 2.20.1 | ||
153 | |||
154 | diff view generated by jsdifflib |