1
Hi; this target-arm pull request has a collection of generally
1
Arm queue; bugfixes only.
2
fairly minor bugs to sneak in before 3.0 rc0 tomorrow...
3
2
4
thanks
3
thanks
5
-- PMM
4
-- PMM
6
5
7
The following changes since commit a98ff0ec2ba3538dd766b349518ee18d03942ed8:
6
The following changes since commit 48aa8f0ac536db3550a35c295ff7de94e4c33739:
8
7
9
Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-3.0-20180709' into staging (2018-07-09 11:00:45 +0100)
8
Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2020-11-16' into staging (2020-11-17 11:07:00 +0000)
10
9
11
are available in the Git repository at:
10
are available in the Git repository at:
12
11
13
git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20180709
12
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20201117
14
13
15
for you to fetch changes up to 8fad0a65582c0a6e324580f45516461e9b6aa439:
14
for you to fetch changes up to ab135622cf478585bdfcb68b85e4a817d74a0c42:
16
15
17
hw/net/dp8393x: don't make prom region 'nomigrate' (2018-07-09 14:51:35 +0100)
16
tmp105: Correct handling of temperature limit checks (2020-11-17 12:56:33 +0000)
18
17
19
----------------------------------------------------------------
18
----------------------------------------------------------------
20
target-arm queue:
19
target-arm queue:
21
* hw/net/dp8393x: don't make prom region 'nomigrate'
20
* hw/arm/virt: ARM_VIRT must select ARM_GIC
22
* boards.h: Remove doc comment reference to nonexistent function
21
* exynos: Fix bad printf format specifiers
23
* hw/sd/omap_mmc: Split 'pseudo-reset' from 'power-on-reset'
22
* hw/input/ps2.c: Remove remnants of printf debug
24
* target/arm: Fix do_predset for large VL
23
* target/openrisc: Remove dead code attempting to check "is timer disabled"
25
* tcg: Restrict check_size_impl to multiples of the line size
24
* register: Remove unnecessary NULL check
26
* target/arm: Suppress Coverity warning for PRF
25
* util/cutils: Fix Coverity array overrun in freq_to_str()
27
* hw/timer/cmsdk-apb-timer: fix minor corner-case bugs and
26
* configure: Make "does libgio work" test pull in some actual functions
28
suppress spurious warnings when running Linux's timer driver
27
* tmp105: reset the T_low and T_High registers
29
* hw/arm/smmu-common: Fix devfn computation in smmu_iommu_mr
28
* tmp105: Correct handling of temperature limit checks
30
29
31
----------------------------------------------------------------
30
----------------------------------------------------------------
32
Eric Auger (1):
31
Alex Chen (1):
33
hw/arm/smmu-common: Fix devfn computation in smmu_iommu_mr
32
exynos: Fix bad printf format specifiers
34
33
35
Guenter Roeck (1):
34
Alistair Francis (1):
36
hw/timer/cmsdk-apb-timer: Correctly identify and set one-shot mode
35
register: Remove unnecessary NULL check
36
37
Andrew Jones (1):
38
hw/arm/virt: ARM_VIRT must select ARM_GIC
37
39
38
Peter Maydell (5):
40
Peter Maydell (5):
39
ptimer: Add TRIGGER_ONLY_ON_DECREMENT policy option
41
hw/input/ps2.c: Remove remnants of printf debug
40
hw/timer/cmsdk-apb-timer: Correct ptimer policy settings
42
target/openrisc: Remove dead code attempting to check "is timer disabled"
41
hw/timer/cmsdk-apb-timer: run or stop timer on writes to RELOAD and VALUE
43
configure: Make "does libgio work" test pull in some actual functions
42
boards.h: Remove doc comment reference to nonexistent function
44
hw/misc/tmp105: reset the T_low and T_High registers
43
hw/net/dp8393x: don't make prom region 'nomigrate'
45
tmp105: Correct handling of temperature limit checks
44
46
45
Philippe Mathieu-Daudé (1):
47
Philippe Mathieu-Daudé (1):
46
hw/sd/omap_mmc: Split 'pseudo-reset' from 'power-on-reset'
48
util/cutils: Fix Coverity array overrun in freq_to_str()
47
49
48
Richard Henderson (3):
50
configure | 11 +++++--
49
target/arm: Suppress Coverity warning for PRF
51
hw/misc/tmp105.h | 7 +++++
50
tcg: Restrict check_size_impl to multiples of the line size
52
hw/core/register.c | 4 ---
51
target/arm: Fix do_predset for large VL
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(-)
52
61
53
include/hw/arm/smmu-common.h | 1 +
54
include/hw/boards.h | 3 +--
55
include/hw/ptimer.h | 9 +++++++++
56
hw/arm/smmu-common.c | 2 +-
57
hw/core/ptimer.c | 22 +++++++++++++++++++++-
58
hw/net/dp8393x.c | 2 +-
59
hw/sd/omap_mmc.c | 14 +++++++++++---
60
hw/timer/cmsdk-apb-timer.c | 20 ++++++++++++++++++--
61
target/arm/translate-sve.c | 14 ++++----------
62
tcg/tcg-op-gvec.c | 7 +++++--
63
tests/ptimer-test.c | 25 +++++++++++++++++++------
64
11 files changed, 91 insertions(+), 28 deletions(-)
65
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Andrew Jones <drjones@redhat.com>
2
2
3
Use MAKE_64BIT_MASK instead of open-coding. Remove an odd
3
The removal of the selection of A15MPCORE from ARM_VIRT also
4
vector size check that is unlikely to be more profitable
4
removed what A15MPCORE selects, ARM_GIC. We still need ARM_GIC.
5
than 3 64-bit integer stores. Correct the iteration for WORD
6
to avoid writing too much data.
7
5
8
Fixes RISU tests of PTRUE for VL 256.
6
Fixes: bec3c97e0cf9 ("hw/arm/virt: Remove dependency on Cortex-A15 MPCore peripherals")
9
7
Reported-by: Miroslav Rezanina <mrezanin@redhat.com>
10
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Signed-off-by: Andrew Jones <drjones@redhat.com>
11
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
9
Reviewed-by: Miroslav Rezanina <mrezanin@redhat.com>
12
Tested-by: Alex Bennée <alex.bennee@linaro.org>
10
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
13
Message-id: 20180705191929.30773-3-richard.henderson@linaro.org
11
Message-id: 20201111143440.112763-1-drjones@redhat.com
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
---
13
---
16
target/arm/translate-sve.c | 10 ++--------
14
hw/arm/Kconfig | 1 +
17
1 file changed, 2 insertions(+), 8 deletions(-)
15
1 file changed, 1 insertion(+)
18
16
19
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
17
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
20
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
21
--- a/target/arm/translate-sve.c
19
--- a/hw/arm/Kconfig
22
+++ b/target/arm/translate-sve.c
20
+++ b/hw/arm/Kconfig
23
@@ -XXX,XX +XXX,XX @@ static bool do_predset(DisasContext *s, int esz, int rd, int pat, bool setflag)
21
@@ -XXX,XX +XXX,XX @@ config ARM_VIRT
24
setsz = numelem << esz;
22
imply VFIO_PLATFORM
25
lastword = word = pred_esz_masks[esz];
23
imply VFIO_XGMAC
26
if (setsz % 64) {
24
imply TPM_TIS_SYSBUS
27
- lastword &= ~(-1ull << (setsz % 64));
25
+ select ARM_GIC
28
+ lastword &= MAKE_64BIT_MASK(0, setsz % 64);
26
select ACPI
29
}
27
select ARM_SMMUV3
30
}
28
select GPIO_KEY
31
32
@@ -XXX,XX +XXX,XX @@ static bool do_predset(DisasContext *s, int esz, int rd, int pat, bool setflag)
33
tcg_gen_gvec_dup64i(ofs, oprsz, maxsz, word);
34
goto done;
35
}
36
- if (oprsz * 8 == setsz + 8) {
37
- tcg_gen_gvec_dup64i(ofs, oprsz, maxsz, word);
38
- tcg_gen_movi_i64(t, 0);
39
- tcg_gen_st_i64(t, cpu_env, ofs + oprsz - 8);
40
- goto done;
41
- }
42
}
43
44
setsz /= 8;
45
fullsz /= 8;
46
47
tcg_gen_movi_i64(t, word);
48
- for (i = 0; i < setsz; i += 8) {
49
+ for (i = 0; i < QEMU_ALIGN_DOWN(setsz, 8); i += 8) {
50
tcg_gen_st_i64(t, cpu_env, ofs + i);
51
}
52
if (lastword != word) {
53
--
29
--
54
2.17.1
30
2.20.1
55
31
56
32
diff view generated by jsdifflib
1
From: Eric Auger <eric.auger@redhat.com>
1
From: Alex Chen <alex.chen@huawei.com>
2
2
3
smmu_iommu_mr() aims at returning the IOMMUMemoryRegion corresponding
3
We should use printf format specifier "%u" instead of "%d" for
4
to a given sid. The function extracts both the PCIe bus number and
4
argument of type "unsigned int".
5
the devfn to return this data. Current computation of devfn is wrong
6
as it only returns the PCIe function instead of slot | function.
7
5
8
Fixes 32cfd7f39e08 ("hw/arm/smmuv3: Cache/invalidate config data")
6
Reported-by: Euler Robot <euler.robot@huawei.com>
9
7
Signed-off-by: Alex Chen <alex.chen@huawei.com>
10
Signed-off-by: Eric Auger <eric.auger@redhat.com>
8
Message-id: 20201111073651.72804-1-alex.chen@huawei.com
11
Message-id: 1530775623-32399-1-git-send-email-eric.auger@redhat.com
12
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
---
11
---
15
include/hw/arm/smmu-common.h | 1 +
12
hw/timer/exynos4210_mct.c | 4 ++--
16
hw/arm/smmu-common.c | 2 +-
13
hw/timer/exynos4210_pwm.c | 8 ++++----
17
2 files changed, 2 insertions(+), 1 deletion(-)
14
2 files changed, 6 insertions(+), 6 deletions(-)
18
15
19
diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h
16
diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c
20
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
21
--- a/include/hw/arm/smmu-common.h
18
--- a/hw/timer/exynos4210_mct.c
22
+++ b/include/hw/arm/smmu-common.h
19
+++ b/hw/timer/exynos4210_mct.c
23
@@ -XXX,XX +XXX,XX @@
20
@@ -XXX,XX +XXX,XX @@ static void exynos4210_gcomp_raise_irq(void *opaque, uint32_t id)
24
21
/* If CSTAT is pending and IRQ is enabled */
25
#define SMMU_PCI_BUS_MAX 256
22
if ((s->reg.int_cstat & G_INT_CSTAT_COMP(id)) &&
26
#define SMMU_PCI_DEVFN_MAX 256
23
(s->reg.int_enb & G_INT_ENABLE(id))) {
27
+#define SMMU_PCI_DEVFN(sid) (sid & 0xFF)
24
- DPRINTF("gcmp timer[%d] IRQ\n", id);
28
25
+ DPRINTF("gcmp timer[%u] IRQ\n", id);
29
#define SMMU_MAX_VA_BITS 48
26
qemu_irq_raise(s->irq[id]);
30
27
}
31
diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
28
}
29
@@ -XXX,XX +XXX,XX @@ static void exynos4210_mct_update_freq(Exynos4210MCTState *s)
30
MCT_CFG_GET_DIVIDER(s->reg_mct_cfg));
31
32
if (freq != s->freq) {
33
- DPRINTF("freq=%dHz\n", s->freq);
34
+ DPRINTF("freq=%uHz\n", s->freq);
35
36
/* global timer */
37
tx_ptimer_set_freq(s->g_timer.ptimer_frc, s->freq);
38
diff --git a/hw/timer/exynos4210_pwm.c b/hw/timer/exynos4210_pwm.c
32
index XXXXXXX..XXXXXXX 100644
39
index XXXXXXX..XXXXXXX 100644
33
--- a/hw/arm/smmu-common.c
40
--- a/hw/timer/exynos4210_pwm.c
34
+++ b/hw/arm/smmu-common.c
41
+++ b/hw/timer/exynos4210_pwm.c
35
@@ -XXX,XX +XXX,XX @@ IOMMUMemoryRegion *smmu_iommu_mr(SMMUState *s, uint32_t sid)
42
@@ -XXX,XX +XXX,XX @@ static void exynos4210_pwm_update_freq(Exynos4210PWMState *s, uint32_t id)
36
bus_n = PCI_BUS_NUM(sid);
43
37
smmu_bus = smmu_find_smmu_pcibus(s, bus_n);
44
if (freq != s->timer[id].freq) {
38
if (smmu_bus) {
45
ptimer_set_freq(s->timer[id].ptimer, s->timer[id].freq);
39
- devfn = sid & 0x7;
46
- DPRINTF("freq=%dHz\n", s->timer[id].freq);
40
+ devfn = SMMU_PCI_DEVFN(sid);
47
+ DPRINTF("freq=%uHz\n", s->timer[id].freq);
41
smmu = smmu_bus->pbdev[devfn];
48
}
42
if (smmu) {
49
}
43
return &smmu->iommu;
50
51
@@ -XXX,XX +XXX,XX @@ static void exynos4210_pwm_tick(void *opaque)
52
uint32_t id = s->id;
53
bool cmp;
54
55
- DPRINTF("timer %d tick\n", id);
56
+ DPRINTF("timer %u tick\n", id);
57
58
/* set irq status */
59
p->reg_tint_cstat |= TINT_CSTAT_STATUS(id);
60
61
/* raise IRQ */
62
if (p->reg_tint_cstat & TINT_CSTAT_ENABLE(id)) {
63
- DPRINTF("timer %d IRQ\n", id);
64
+ DPRINTF("timer %u IRQ\n", id);
65
qemu_irq_raise(p->timer[id].irq);
66
}
67
68
@@ -XXX,XX +XXX,XX @@ static void exynos4210_pwm_tick(void *opaque)
69
}
70
71
if (cmp) {
72
- DPRINTF("auto reload timer %d count to %x\n", id,
73
+ DPRINTF("auto reload timer %u count to %x\n", id,
74
p->timer[id].reg_tcntb);
75
ptimer_set_count(p->timer[id].ptimer, p->timer[id].reg_tcntb);
76
ptimer_run(p->timer[id].ptimer, 1);
44
--
77
--
45
2.17.1
78
2.20.1
46
79
47
80
diff view generated by jsdifflib
1
Currently we use memory_region_init_rom_nomigrate() to create
1
In commit 5edab03d4040 we added tracepoints to the ps2 keyboard
2
the "dp3893x-prom" memory region, and we don't manually register
2
and mouse emulation. However we didn't remove all the debug-by-printf
3
it with vmstate_register_ram(). This currently means that its
3
support. In fact there is only one printf() remaining, and it is
4
contents are migrated but as a ram block whose name is the empty
4
redundant with the trace_ps2_write_mouse() event next to it.
5
string; in future it may mean they are not migrated at all. Use
5
Remove the printf() and the now-unused DEBUG* macros.
6
memory_region_init_ram() instead.
7
8
Note that this is a a cross-version migration compatibility break
9
for the MIPS "magnum" and "pica61" machines.
10
6
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Reviewed-by: Aleksandar Markovic <aleksandar.markovic@wavecomp.com>
8
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
13
Message-id: 20180706174309.27110-1-peter.maydell@linaro.org
9
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
10
Message-id: 20201101133258.4240-1-peter.maydell@linaro.org
14
---
11
---
15
hw/net/dp8393x.c | 2 +-
12
hw/input/ps2.c | 9 ---------
16
1 file changed, 1 insertion(+), 1 deletion(-)
13
1 file changed, 9 deletions(-)
17
14
18
diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c
15
diff --git a/hw/input/ps2.c b/hw/input/ps2.c
19
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
20
--- a/hw/net/dp8393x.c
17
--- a/hw/input/ps2.c
21
+++ b/hw/net/dp8393x.c
18
+++ b/hw/input/ps2.c
22
@@ -XXX,XX +XXX,XX @@ static void dp8393x_realize(DeviceState *dev, Error **errp)
19
@@ -XXX,XX +XXX,XX @@
23
s->watchdog = timer_new_ns(QEMU_CLOCK_VIRTUAL, dp8393x_watchdog, s);
20
24
s->regs[SONIC_SR] = 0x0004; /* only revision recognized by Linux */
21
#include "trace.h"
25
22
26
- memory_region_init_ram_nomigrate(&s->prom, OBJECT(dev),
23
-/* debug PC keyboard */
27
+ memory_region_init_ram(&s->prom, OBJECT(dev),
24
-//#define DEBUG_KBD
28
"dp8393x-prom", SONIC_PROM_SIZE, &local_err);
25
-
29
if (local_err) {
26
-/* debug PC keyboard : only mouse */
30
error_propagate(errp, local_err);
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:
31
--
42
--
32
2.17.1
43
2.20.1
33
44
34
45
diff view generated by jsdifflib
1
commit b08199c6fbea1 accidentally added a reference to a doc
1
In the mtspr helper we attempt to check for "is the timer disabled"
2
comment to a nonexistent memory_region_allocate_aux_memory().
2
with "if (env->ttmr & TIMER_NONE)". This is wrong because TIMER_NONE
3
This was a leftover from a previous version of the patchset
3
is zero and the condition is always false (Coverity complains about
4
which defined memory_region_allocate_aux_memory() for
4
the dead code.)
5
"allocate RAM MemoryRegion and register it for migration"
6
and left "memory_region_init_ram()" with its original semantics
7
of "allocate RAM MR but do not register for migration". In
8
the end we decided on the approach of "memory_region_init_ram()
9
registers the MR for migration, and memory_region_init_ram_nomigrate()
10
is a new function which does not", but this comment change
11
got left in by mistake. Revert that part of the commit.
12
5
13
Reported-by: Thomas Huth <huth@tuxfamily.org>
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
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
Message-id: 20180702130605.13611-1-peter.maydell@linaro.org
16
Acked-by: Stafford Horne <shorne@gmail.com>
17
Message-id: 20201103114654.18540-1-peter.maydell@linaro.org
16
---
18
---
17
include/hw/boards.h | 3 +--
19
target/openrisc/sys_helper.c | 3 ---
18
1 file changed, 1 insertion(+), 2 deletions(-)
20
1 file changed, 3 deletions(-)
19
21
20
diff --git a/include/hw/boards.h b/include/hw/boards.h
22
diff --git a/target/openrisc/sys_helper.c b/target/openrisc/sys_helper.c
21
index XXXXXXX..XXXXXXX 100644
23
index XXXXXXX..XXXXXXX 100644
22
--- a/include/hw/boards.h
24
--- a/target/openrisc/sys_helper.c
23
+++ b/include/hw/boards.h
25
+++ b/target/openrisc/sys_helper.c
24
@@ -XXX,XX +XXX,XX @@
26
@@ -XXX,XX +XXX,XX @@ void HELPER(mtspr)(CPUOpenRISCState *env, target_ulong spr, target_ulong rb)
25
*
27
26
* Smaller pieces of memory (display RAM, static RAMs, etc) don't need
28
case TO_SPR(10, 1): /* TTCR */
27
* to be backed via the -mem-path memory backend and can simply
29
cpu_openrisc_count_set(cpu, rb);
28
- * be created via memory_region_allocate_aux_memory() or
30
- if (env->ttmr & TIMER_NONE) {
29
- * memory_region_init_ram().
31
- return;
30
+ * be created via memory_region_init_ram().
32
- }
31
*/
33
cpu_openrisc_timer_update(cpu);
32
void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner,
34
break;
33
const char *name,
35
#endif
34
--
36
--
35
2.17.1
37
2.20.1
36
38
37
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
These instructions must perform the sve_access_check, but
3
This patch fixes CID 1432800 by removing an unnecessary check.
4
since they are implemented as NOPs there is no generated
5
code to elide when the access check fails.
6
4
7
Fixes: Coverity issues 1393780 & 1393779.
5
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
8
---
12
target/arm/translate-sve.c | 4 ++--
9
hw/core/register.c | 4 ----
13
1 file changed, 2 insertions(+), 2 deletions(-)
10
1 file changed, 4 deletions(-)
14
11
15
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
12
diff --git a/hw/core/register.c b/hw/core/register.c
16
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/translate-sve.c
14
--- a/hw/core/register.c
18
+++ b/target/arm/translate-sve.c
15
+++ b/hw/core/register.c
19
@@ -XXX,XX +XXX,XX @@ static bool trans_ST1_zpiz(DisasContext *s, arg_ST1_zpiz *a, uint32_t insn)
16
@@ -XXX,XX +XXX,XX @@ static RegisterInfoArray *register_init_block(DeviceState *owner,
20
static bool trans_PRF(DisasContext *s, arg_PRF *a, uint32_t insn)
17
int index = rae[i].addr / data_size;
21
{
18
RegisterInfo *r = &ri[index];
22
/* Prefetch is a nop within QEMU. */
19
23
- sve_access_check(s);
20
- if (data + data_size * index == 0 || !&rae[i]) {
24
+ (void)sve_access_check(s);
21
- continue;
25
return true;
22
- }
26
}
23
-
27
24
/* Init the register, this will zero it. */
28
@@ -XXX,XX +XXX,XX @@ static bool trans_PRF_rr(DisasContext *s, arg_PRF_rr *a, uint32_t insn)
25
object_initialize((void *)r, sizeof(*r), TYPE_REGISTER);
29
return false;
30
}
31
/* Prefetch is a nop within QEMU. */
32
- sve_access_check(s);
33
+ (void)sve_access_check(s);
34
return true;
35
}
36
26
37
--
27
--
38
2.17.1
28
2.20.1
39
29
40
30
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
2
3
DeviceClass::reset models a "cold power-on" reset which can
3
Fix Coverity CID 1435957: Memory - illegal accesses (OVERRUN):
4
also be used to powercycle a device; but there is no "hot reset"
5
(a.k.a. soft-reset) method available.
6
4
7
The OMAP MMC Power-Up Control bit is not designed to powercycle
5
>>> Overrunning array "suffixes" of 7 8-byte elements at element
8
a card, but to disable it without powering it off (pseudo-reset):
6
index 7 (byte offset 63) using index "idx" (which evaluates to 7).
9
7
10
Multimedia Card (MMC/SD/SDIO) Interface [SPRU765A]
8
Note, the biggest input value freq_to_str() can accept is UINT64_MAX,
9
which is ~18.446 EHz, less than 1000 EHz.
11
10
12
MMC_CON[11] Power-Up Control (POW)
11
Reported-by: Eduardo Habkost <ehabkost@redhat.com>
13
This bit must be set to 1 before any valid transaction to either
14
MMC/SD or SPI memory cards.
15
When 1, the card is considered powered-up and the controller core
16
is enabled.
17
When 0, the card is considered powered-down (system dependent),
18
and the controller core logic is in pseudo-reset state. This is,
19
the MMC_STAT flags and the FIFO pointers are reset, any access to
20
MMC_DATA[DATA] has no effect, a write into the MMC.CMD register
21
is ignored, and a setting of MMC_SPI[STR] to 1 is ignored.
22
23
By splitting the 'pseudo-reset' code out of the 'power-on' reset
24
function, this patch fixes a latent bug in omap_mmc_write(MMC_CON)i
25
recently exposed by ecd219f7abb.
26
27
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
12
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
28
Message-id: 20180706162155.8432-2-f4bug@amsat.org
29
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>
30
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
31
---
20
---
32
hw/sd/omap_mmc.c | 14 +++++++++++---
21
util/cutils.c | 3 ++-
33
1 file changed, 11 insertions(+), 3 deletions(-)
22
1 file changed, 2 insertions(+), 1 deletion(-)
34
23
35
diff --git a/hw/sd/omap_mmc.c b/hw/sd/omap_mmc.c
24
diff --git a/util/cutils.c b/util/cutils.c
36
index XXXXXXX..XXXXXXX 100644
25
index XXXXXXX..XXXXXXX 100644
37
--- a/hw/sd/omap_mmc.c
26
--- a/util/cutils.c
38
+++ b/hw/sd/omap_mmc.c
27
+++ b/util/cutils.c
39
@@ -XXX,XX +XXX,XX @@
28
@@ -XXX,XX +XXX,XX @@ char *freq_to_str(uint64_t freq_hz)
40
/*
29
double freq = freq_hz;
41
* OMAP on-chip MMC/SD host emulation.
30
size_t idx = 0;
42
*
31
43
+ * Datasheet: TI Multimedia Card (MMC/SD/SDIO) Interface (SPRU765A)
32
- while (freq >= 1000.0 && idx < ARRAY_SIZE(suffixes)) {
44
+ *
33
+ while (freq >= 1000.0) {
45
* Copyright (C) 2006-2007 Andrzej Zaborowski <balrog@zabor.org>
34
freq /= 1000.0;
46
*
35
idx++;
47
* This program is free software; you can redistribute it and/or
36
}
48
@@ -XXX,XX +XXX,XX @@ static void omap_mmc_update(void *opaque)
37
+ assert(idx < ARRAY_SIZE(suffixes));
49
omap_mmc_interrupts_update(s);
38
39
return g_strdup_printf("%0.3g %sHz", freq, suffixes[idx]);
50
}
40
}
51
52
+static void omap_mmc_pseudo_reset(struct omap_mmc_s *host)
53
+{
54
+ host->status = 0;
55
+ host->fifo_len = 0;
56
+}
57
+
58
void omap_mmc_reset(struct omap_mmc_s *host)
59
{
60
host->last_cmd = 0;
61
@@ -XXX,XX +XXX,XX @@ void omap_mmc_reset(struct omap_mmc_s *host)
62
host->dw = 0;
63
host->mode = 0;
64
host->enable = 0;
65
- host->status = 0;
66
host->mask = 0;
67
host->cto = 0;
68
host->dto = 0;
69
- host->fifo_len = 0;
70
host->blen = 0;
71
host->blen_counter = 0;
72
host->nblk = 0;
73
@@ -XXX,XX +XXX,XX @@ void omap_mmc_reset(struct omap_mmc_s *host)
74
qemu_set_irq(host->coverswitch, host->cdet_state);
75
host->clkdiv = 0;
76
77
+ omap_mmc_pseudo_reset(host);
78
+
79
/* Since we're still using the legacy SD API the card is not plugged
80
* into any bus, and we must reset it manually. When omap_mmc is
81
* QOMified this must move into the QOM reset function.
82
@@ -XXX,XX +XXX,XX @@ static void omap_mmc_write(void *opaque, hwaddr offset,
83
if (s->dw != 0 && s->lines < 4)
84
printf("4-bit SD bus enabled\n");
85
if (!s->enable)
86
- omap_mmc_reset(s);
87
+ omap_mmc_pseudo_reset(s);
88
break;
89
90
case 0x10:    /* MMC_STAT */
91
--
41
--
92
2.17.1
42
2.20.1
93
43
94
44
diff view generated by jsdifflib
1
If the CMSDK APB timer is set up with a zero RELOAD value
1
In commit 76346b6264a9b01979 we tried to add a configure check that
2
then it will count down to zero, fire once and then stay
2
the libgio pkg-config data was correct, which builds an executable
3
at zero. From the point of view of the ptimer system, the
3
linked against it. Unfortunately this doesn't catch the problem
4
timer is disabled; but the enable bit in the CTRL register
4
(missing static library dependency info), because a "do nothing" test
5
is still set and if the guest subsequently writes to the
5
source file doesn't have any symbol references that cause the linker
6
RELOAD or VALUE registers this should cause the timer to
6
to pull in .o files from libgio.a, and so we don't see the "missing
7
start counting down again.
7
symbols from libmount" error that a full QEMU link triggers.
8
8
9
Add code to the write paths for RELOAD and VALUE so that
9
(The ineffective test went unnoticed because of a typo that
10
we correctly restart the timer in this situation.
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.)
11
13
12
Conversely, if the new RELOAD and VALUE are both zero,
14
Improve the gio test by having the test source fragment reference a
13
we should stop the ptimer.
15
g_dbus function (which is what is indirectly causing us to end up
16
wanting functions from libmount).
14
17
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
19
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
17
Tested-by: Guenter Roeck <linux@roeck-us.net>
20
Message-id: 20201116104617.18333-1-peter.maydell@linaro.org
18
Message-id: 20180703171044.9503-5-peter.maydell@linaro.org
19
---
21
---
20
hw/timer/cmsdk-apb-timer.c | 16 ++++++++++++++++
22
configure | 11 +++++++++--
21
1 file changed, 16 insertions(+)
23
1 file changed, 9 insertions(+), 2 deletions(-)
22
24
23
diff --git a/hw/timer/cmsdk-apb-timer.c b/hw/timer/cmsdk-apb-timer.c
25
diff --git a/configure b/configure
24
index XXXXXXX..XXXXXXX 100644
26
index XXXXXXX..XXXXXXX 100755
25
--- a/hw/timer/cmsdk-apb-timer.c
27
--- a/configure
26
+++ b/hw/timer/cmsdk-apb-timer.c
28
+++ b/configure
27
@@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_timer_write(void *opaque, hwaddr offset, uint64_t value,
29
@@ -XXX,XX +XXX,XX @@ if $pkg_config --atleast-version=$glib_req_ver gio-2.0; then
28
break;
30
# Check that the libraries actually work -- Ubuntu 18.04 ships
29
case A_RELOAD:
31
# with pkg-config --static --libs data for gio-2.0 that is missing
30
/* Writing to reload also sets the current timer value */
32
# -lblkid and will give a link error.
31
+ if (!value) {
33
- write_c_skeleton
32
+ ptimer_stop(s->timer);
34
- if compile_prog "" "$gio_libs" ; then
33
+ }
35
+ cat > $TMPC <<EOF
34
ptimer_set_limit(s->timer, value, 1);
36
+#include <gio/gio.h>
35
+ if (value && (s->ctrl & R_CTRL_EN_MASK)) {
37
+int main(void)
36
+ /*
38
+{
37
+ * Make sure timer is running (it might have stopped if this
39
+ g_dbus_proxy_new_sync(0, 0, 0, 0, 0, 0, 0, 0);
38
+ * was an expired one-shot timer)
40
+ return 0;
39
+ */
41
+}
40
+ ptimer_run(s->timer, 0);
42
+EOF
41
+ }
43
+ if compile_prog "$gio_cflags" "$gio_libs" ; then
42
break;
44
gio=yes
43
case A_VALUE:
45
else
44
+ if (!value && !ptimer_get_limit(s->timer)) {
46
gio=no
45
+ ptimer_stop(s->timer);
46
+ }
47
ptimer_set_count(s->timer, value);
48
+ if (value && (s->ctrl & R_CTRL_EN_MASK)) {
49
+ ptimer_run(s->timer, ptimer_get_limit(s->timer) == 0);
50
+ }
51
break;
52
case A_INTSTATUS:
53
/* Just one bit, which is W1C. */
54
--
47
--
55
2.17.1
48
2.20.1
56
49
57
50
diff view generated by jsdifflib
1
The CMSDK timer interrupt triggers when the counter goes from 1 to 0,
1
The TMP105 datasheet (https://www.ti.com/lit/gpn/tmp105) says that the
2
so we want to trigger immediately, rather than waiting for a
2
power-up reset values for the T_low and T_high registers are 80 degrees C
3
clock cycle. Drop the incorrect NO_IMMEDIATE_TRIGGER setting.
3
and 75 degrees C, which are 0x500 and 0x4B0 hex according to table 5. These
4
We also do not want to get an interrupt if the guest sets the
4
values are then shifted right by four bits to give the register reset
5
counter directly to zero, so use the new TRIGGER_ONLY_ON_DECREMENT
5
values, since both registers store the 12 bits of temperature data in bits
6
policy.
6
[15..4] of a 16 bit register.
7
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...
7
12
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Reviewed-by: Cédric Le Goater <clg@kaod.org>
10
Tested-by: Guenter Roeck <linux@roeck-us.net>
15
Message-id: 20201110150023.25533-2-peter.maydell@linaro.org
11
Message-id: 20180703171044.9503-3-peter.maydell@linaro.org
12
---
16
---
13
hw/timer/cmsdk-apb-timer.c | 2 +-
17
hw/misc/tmp105.c | 3 +++
14
1 file changed, 1 insertion(+), 1 deletion(-)
18
1 file changed, 3 insertions(+)
15
19
16
diff --git a/hw/timer/cmsdk-apb-timer.c b/hw/timer/cmsdk-apb-timer.c
20
diff --git a/hw/misc/tmp105.c b/hw/misc/tmp105.c
17
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
18
--- a/hw/timer/cmsdk-apb-timer.c
22
--- a/hw/misc/tmp105.c
19
+++ b/hw/timer/cmsdk-apb-timer.c
23
+++ b/hw/misc/tmp105.c
20
@@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_timer_realize(DeviceState *dev, Error **errp)
24
@@ -XXX,XX +XXX,XX @@ static void tmp105_reset(I2CSlave *i2c)
21
bh = qemu_bh_new(cmsdk_apb_timer_tick, s);
25
s->faults = tmp105_faultq[(s->config >> 3) & 3];
22
s->timer = ptimer_init(bh,
26
s->alarm = 0;
23
PTIMER_POLICY_WRAP_AFTER_ONE_PERIOD |
27
24
- PTIMER_POLICY_NO_IMMEDIATE_TRIGGER |
28
+ s->limit[0] = 0x4b00; /* T_LOW, 75 degrees C */
25
+ PTIMER_POLICY_TRIGGER_ONLY_ON_DECREMENT |
29
+ s->limit[1] = 0x5000; /* T_HIGH, 80 degrees C */
26
PTIMER_POLICY_NO_IMMEDIATE_RELOAD |
30
+
27
PTIMER_POLICY_NO_COUNTER_ROUND_DOWN);
31
tmp105_interrupt_update(s);
32
}
28
33
29
--
34
--
30
2.17.1
35
2.20.1
31
36
32
37
diff view generated by jsdifflib
1
The CMSDK timer behaviour is that an interrupt is triggered when the
1
The TMP105 datasheet says that in Interrupt Mode (when TM==1) the device
2
counter counts down from 1 to 0; however one is not triggered if the
2
signals an alert when the temperature equals or exceeds the T_high value and
3
counter is manually set to 0 by a guest write to the counter register.
3
then remains high until a device register is read or the device responds to
4
Currently ptimer can't handle this; add a policy option to allow
4
the SMBUS Alert Response address, or the device is put into Shutdown Mode.
5
a ptimer user to request this behaviour.
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
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.
6
21
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
22
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
23
Reviewed-by: Cédric Le Goater <clg@kaod.org>
9
Tested-by: Guenter Roeck <linux@roeck-us.net>
24
Message-id: 20201110150023.25533-3-peter.maydell@linaro.org
10
Message-id: 20180703171044.9503-2-peter.maydell@linaro.org
11
---
25
---
12
include/hw/ptimer.h | 9 +++++++++
26
hw/misc/tmp105.h | 7 +++++
13
hw/core/ptimer.c | 22 +++++++++++++++++++++-
27
hw/misc/tmp105.c | 70 +++++++++++++++++++++++++++++++++++++++++-------
14
tests/ptimer-test.c | 25 +++++++++++++++++++------
28
2 files changed, 68 insertions(+), 9 deletions(-)
15
3 files changed, 49 insertions(+), 7 deletions(-)
16
29
17
diff --git a/include/hw/ptimer.h b/include/hw/ptimer.h
30
diff --git a/hw/misc/tmp105.h b/hw/misc/tmp105.h
18
index XXXXXXX..XXXXXXX 100644
31
index XXXXXXX..XXXXXXX 100644
19
--- a/include/hw/ptimer.h
32
--- a/hw/misc/tmp105.h
20
+++ b/include/hw/ptimer.h
33
+++ b/hw/misc/tmp105.h
21
@@ -XXX,XX +XXX,XX @@
34
@@ -XXX,XX +XXX,XX @@ struct TMP105State {
22
* not the one less. */
35
int16_t limit[2];
23
#define PTIMER_POLICY_NO_COUNTER_ROUND_DOWN (1 << 4)
36
int faults;
24
37
uint8_t alarm;
25
+/*
38
+ /*
26
+ * Starting to run with a zero counter, or setting the counter to "0" via
39
+ * The TMP105 initially looks for a temperature rising above T_high;
27
+ * ptimer_set_count() or ptimer_set_limit() will not trigger the timer
40
+ * once this is detected, the condition it looks for next is the
28
+ * (though it will cause a reload). Only a counter decrement to "0"
41
+ * temperature falling below T_low. This flag is false when initially
29
+ * will cause a trigger. Not compatible with NO_IMMEDIATE_TRIGGER;
42
+ * looking for T_high, true when looking for T_low.
30
+ * ptimer_init() will assert() that you don't set both.
43
+ */
31
+ */
44
+ bool detect_falling;
32
+#define PTIMER_POLICY_TRIGGER_ONLY_ON_DECREMENT (1 << 5)
45
};
33
+
46
34
/* ptimer.c */
47
#endif
35
typedef struct ptimer_state ptimer_state;
48
diff --git a/hw/misc/tmp105.c b/hw/misc/tmp105.c
36
typedef void (*ptimer_cb)(void *opaque);
37
diff --git a/hw/core/ptimer.c b/hw/core/ptimer.c
38
index XXXXXXX..XXXXXXX 100644
49
index XXXXXXX..XXXXXXX 100644
39
--- a/hw/core/ptimer.c
50
--- a/hw/misc/tmp105.c
40
+++ b/hw/core/ptimer.c
51
+++ b/hw/misc/tmp105.c
41
@@ -XXX,XX +XXX,XX @@ static void ptimer_reload(ptimer_state *s, int delta_adjust)
52
@@ -XXX,XX +XXX,XX @@ static void tmp105_alarm_update(TMP105State *s)
42
uint32_t period_frac = s->period_frac;
53
return;
43
uint64_t period = s->period;
44
uint64_t delta = s->delta;
45
+ bool suppress_trigger = false;
46
47
- if (delta == 0 && !(s->policy_mask & PTIMER_POLICY_NO_IMMEDIATE_TRIGGER)) {
48
+ /*
49
+ * Note that if delta_adjust is 0 then we must be here because of
50
+ * a count register write or timer start, not because of timer expiry.
51
+ * In that case the policy might require us to suppress the timer trigger
52
+ * that we would otherwise generate for a zero delta.
53
+ */
54
+ if (delta_adjust == 0 &&
55
+ (s->policy_mask & PTIMER_POLICY_TRIGGER_ONLY_ON_DECREMENT)) {
56
+ suppress_trigger = true;
57
+ }
58
+ if (delta == 0 && !(s->policy_mask & PTIMER_POLICY_NO_IMMEDIATE_TRIGGER)
59
+ && !suppress_trigger) {
60
ptimer_trigger(s);
61
}
54
}
62
55
63
@@ -XXX,XX +XXX,XX @@ ptimer_state *ptimer_init(QEMUBH *bh, uint8_t policy_mask)
56
- if ((s->config >> 1) & 1) {                    /* TM */
64
s->bh = bh;
57
- if (s->temperature >= s->limit[1])
65
s->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, ptimer_tick, s);
58
- s->alarm = 1;
66
s->policy_mask = policy_mask;
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;
67
+
109
+
68
+ /*
110
+ /*
69
+ * These two policies are incompatible -- trigger-on-decrement implies
111
+ * We only need to migrate the detect_falling bool if it's set;
70
+ * a timer trigger when the count becomes 0, but no-immediate-trigger
112
+ * for migration from older machines we assume that it is false
71
+ * implies a trigger when the count stops being 0.
113
+ * (ie temperature is not out of range).
72
+ */
114
+ */
73
+ assert(!((policy_mask & PTIMER_POLICY_TRIGGER_ONLY_ON_DECREMENT) &&
115
+ return s->detect_falling;
74
+ (policy_mask & PTIMER_POLICY_NO_IMMEDIATE_TRIGGER)));
116
+}
75
return s;
117
+
76
}
118
+static const VMStateDescription vmstate_tmp105_detect_falling = {
77
119
+ .name = "TMP105/detect-falling",
78
diff --git a/tests/ptimer-test.c b/tests/ptimer-test.c
120
+ .version_id = 1,
79
index XXXXXXX..XXXXXXX 100644
121
+ .minimum_version_id = 1,
80
--- a/tests/ptimer-test.c
122
+ .needed = detect_falling_needed,
81
+++ b/tests/ptimer-test.c
123
+ .fields = (VMStateField[]) {
82
@@ -XXX,XX +XXX,XX @@ static void check_periodic(gconstpointer arg)
124
+ VMSTATE_BOOL(detect_falling, TMP105State),
83
bool no_immediate_trigger = (*policy & PTIMER_POLICY_NO_IMMEDIATE_TRIGGER);
125
+ VMSTATE_END_OF_LIST()
84
bool no_immediate_reload = (*policy & PTIMER_POLICY_NO_IMMEDIATE_RELOAD);
126
+ }
85
bool no_round_down = (*policy & PTIMER_POLICY_NO_COUNTER_ROUND_DOWN);
127
+};
86
+ bool trig_only_on_dec = (*policy & PTIMER_POLICY_TRIGGER_ONLY_ON_DECREMENT);
128
+
87
129
static const VMStateDescription vmstate_tmp105 = {
88
triggered = false;
130
.name = "TMP105",
89
131
.version_id = 0,
90
@@ -XXX,XX +XXX,XX @@ static void check_periodic(gconstpointer arg)
132
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_tmp105 = {
91
g_assert_cmpuint(ptimer_get_count(ptimer), ==,
133
VMSTATE_UINT8(alarm, TMP105State),
92
no_immediate_reload ? 0 : 10);
134
VMSTATE_I2C_SLAVE(i2c, TMP105State),
93
135
VMSTATE_END_OF_LIST()
94
- if (no_immediate_trigger) {
136
+ },
95
+ if (no_immediate_trigger || trig_only_on_dec) {
137
+ .subsections = (const VMStateDescription*[]) {
96
g_assert_false(triggered);
138
+ &vmstate_tmp105_detect_falling,
97
} else {
139
+ NULL
98
g_assert_true(triggered);
99
@@ -XXX,XX +XXX,XX @@ static void check_run_with_delta_0(gconstpointer arg)
100
bool no_immediate_trigger = (*policy & PTIMER_POLICY_NO_IMMEDIATE_TRIGGER);
101
bool no_immediate_reload = (*policy & PTIMER_POLICY_NO_IMMEDIATE_RELOAD);
102
bool no_round_down = (*policy & PTIMER_POLICY_NO_COUNTER_ROUND_DOWN);
103
+ bool trig_only_on_dec = (*policy & PTIMER_POLICY_TRIGGER_ONLY_ON_DECREMENT);
104
105
triggered = false;
106
107
@@ -XXX,XX +XXX,XX @@ static void check_run_with_delta_0(gconstpointer arg)
108
g_assert_cmpuint(ptimer_get_count(ptimer), ==,
109
no_immediate_reload ? 0 : 99);
110
111
- if (no_immediate_trigger) {
112
+ if (no_immediate_trigger || trig_only_on_dec) {
113
g_assert_false(triggered);
114
} else {
115
g_assert_true(triggered);
116
@@ -XXX,XX +XXX,XX @@ static void check_run_with_delta_0(gconstpointer arg)
117
g_assert_cmpuint(ptimer_get_count(ptimer), ==,
118
no_immediate_reload ? 0 : 99);
119
120
- if (no_immediate_trigger) {
121
+ if (no_immediate_trigger || trig_only_on_dec) {
122
g_assert_false(triggered);
123
} else {
124
g_assert_true(triggered);
125
@@ -XXX,XX +XXX,XX @@ static void check_periodic_with_load_0(gconstpointer arg)
126
ptimer_state *ptimer = ptimer_init(bh, *policy);
127
bool continuous_trigger = (*policy & PTIMER_POLICY_CONTINUOUS_TRIGGER);
128
bool no_immediate_trigger = (*policy & PTIMER_POLICY_NO_IMMEDIATE_TRIGGER);
129
+ bool trig_only_on_dec = (*policy & PTIMER_POLICY_TRIGGER_ONLY_ON_DECREMENT);
130
131
triggered = false;
132
133
@@ -XXX,XX +XXX,XX @@ static void check_periodic_with_load_0(gconstpointer arg)
134
135
g_assert_cmpuint(ptimer_get_count(ptimer), ==, 0);
136
137
- if (no_immediate_trigger) {
138
+ if (no_immediate_trigger || trig_only_on_dec) {
139
g_assert_false(triggered);
140
} else {
141
g_assert_true(triggered);
142
@@ -XXX,XX +XXX,XX @@ static void check_oneshot_with_load_0(gconstpointer arg)
143
QEMUBH *bh = qemu_bh_new(ptimer_trigger, NULL);
144
ptimer_state *ptimer = ptimer_init(bh, *policy);
145
bool no_immediate_trigger = (*policy & PTIMER_POLICY_NO_IMMEDIATE_TRIGGER);
146
+ bool trig_only_on_dec = (*policy & PTIMER_POLICY_TRIGGER_ONLY_ON_DECREMENT);
147
148
triggered = false;
149
150
@@ -XXX,XX +XXX,XX @@ static void check_oneshot_with_load_0(gconstpointer arg)
151
152
g_assert_cmpuint(ptimer_get_count(ptimer), ==, 0);
153
154
- if (no_immediate_trigger) {
155
+ if (no_immediate_trigger || trig_only_on_dec) {
156
g_assert_false(triggered);
157
} else {
158
g_assert_true(triggered);
159
@@ -XXX,XX +XXX,XX @@ static void add_ptimer_tests(uint8_t policy)
160
g_strlcat(policy_name, "no_counter_rounddown,", 256);
161
}
140
}
162
141
};
163
+ if (policy & PTIMER_POLICY_TRIGGER_ONLY_ON_DECREMENT) {
142
164
+ g_strlcat(policy_name, "trigger_only_on_decrement,", 256);
143
@@ -XXX,XX +XXX,XX @@ static void tmp105_reset(I2CSlave *i2c)
165
+ }
144
s->config = 0;
166
+
145
s->faults = tmp105_faultq[(s->config >> 3) & 3];
167
g_test_add_data_func_full(
146
s->alarm = 0;
168
tmp = g_strdup_printf("/ptimer/set_count policy=%s", policy_name),
147
+ s->detect_falling = false;
169
g_memdup(&policy, 1), check_set_count, g_free);
148
170
@@ -XXX,XX +XXX,XX @@ static void add_ptimer_tests(uint8_t policy)
149
s->limit[0] = 0x4b00; /* T_LOW, 75 degrees C */
171
150
s->limit[1] = 0x5000; /* T_HIGH, 80 degrees C */
172
static void add_all_ptimer_policies_comb_tests(void)
173
{
174
- int last_policy = PTIMER_POLICY_NO_COUNTER_ROUND_DOWN;
175
+ int last_policy = PTIMER_POLICY_TRIGGER_ONLY_ON_DECREMENT;
176
int policy = PTIMER_POLICY_DEFAULT;
177
178
for (; policy < (last_policy << 1); policy++) {
179
+ if ((policy & PTIMER_POLICY_TRIGGER_ONLY_ON_DECREMENT) &&
180
+ (policy & PTIMER_POLICY_NO_IMMEDIATE_TRIGGER)) {
181
+ /* Incompatible policy flag settings -- don't try to test them */
182
+ continue;
183
+ }
184
add_ptimer_tests(policy);
185
}
186
}
187
--
151
--
188
2.17.1
152
2.20.1
189
153
190
154
diff view generated by jsdifflib
Deleted patch
1
From: Guenter Roeck <linux@roeck-us.net>
2
1
3
The CMSDK APB timer is currently always configured as periodic timer.
4
This results in the following messages when trying to boot Linux.
5
6
Timer with delta zero, disabling
7
8
If the timer limit set with the RELOAD command is 0, the timer
9
needs to be enabled as one-shot timer.
10
11
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
12
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
13
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
14
Tested-by: Guenter Roeck <linux@roeck-us.net>
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
---
17
hw/timer/cmsdk-apb-timer.c | 2 +-
18
1 file changed, 1 insertion(+), 1 deletion(-)
19
20
diff --git a/hw/timer/cmsdk-apb-timer.c b/hw/timer/cmsdk-apb-timer.c
21
index XXXXXXX..XXXXXXX 100644
22
--- a/hw/timer/cmsdk-apb-timer.c
23
+++ b/hw/timer/cmsdk-apb-timer.c
24
@@ -XXX,XX +XXX,XX @@ static void cmsdk_apb_timer_write(void *opaque, hwaddr offset, uint64_t value,
25
}
26
s->ctrl = value & 0xf;
27
if (s->ctrl & R_CTRL_EN_MASK) {
28
- ptimer_run(s->timer, 0);
29
+ ptimer_run(s->timer, ptimer_get_limit(s->timer) == 0);
30
} else {
31
ptimer_stop(s->timer);
32
}
33
--
34
2.17.1
35
36
diff view generated by jsdifflib
Deleted patch
1
From: Richard Henderson <richard.henderson@linaro.org>
2
1
3
Normally this is automatic in the size restrictions that are placed
4
on vector sizes coming from the implementation. However, for the
5
legitimate size tuple [oprsz=8, maxsz=32], we need to clear the final
6
24 bytes of the vector register. Without this check, do_dup selects
7
TCG_TYPE_V128 and clears only 16 bytes.
8
9
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
10
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
11
Tested-by: Alex Bennée <alex.bennee@linaro.org>
12
Message-id: 20180705191929.30773-2-richard.henderson@linaro.org
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
---
15
tcg/tcg-op-gvec.c | 7 +++++--
16
1 file changed, 5 insertions(+), 2 deletions(-)
17
18
diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c
19
index XXXXXXX..XXXXXXX 100644
20
--- a/tcg/tcg-op-gvec.c
21
+++ b/tcg/tcg-op-gvec.c
22
@@ -XXX,XX +XXX,XX @@ void tcg_gen_gvec_4_ptr(uint32_t dofs, uint32_t aofs, uint32_t bofs,
23
in units of LNSZ. This limits the expansion of inline code. */
24
static inline bool check_size_impl(uint32_t oprsz, uint32_t lnsz)
25
{
26
- uint32_t lnct = oprsz / lnsz;
27
- return lnct >= 1 && lnct <= MAX_UNROLL;
28
+ if (oprsz % lnsz == 0) {
29
+ uint32_t lnct = oprsz / lnsz;
30
+ return lnct >= 1 && lnct <= MAX_UNROLL;
31
+ }
32
+ return false;
33
}
34
35
static void expand_clr(uint32_t dofs, uint32_t maxsz);
36
--
37
2.17.1
38
39
diff view generated by jsdifflib