1
target-arm queue for 3.0:
1
Arm queue; bugfixes only.
2
3
Thomas' fixes for instrospection issues with a handful of
4
devices (including one microblaze one that I include in this
5
pullreq for convenience's sake), plus my bugfix for a
6
corner case of small MPU region support.
7
2
8
thanks
3
thanks
9
-- PMM
4
-- PMM
10
5
11
The following changes since commit 55b1f14cefcb19ce6d5e28c4c83404230888aa7e:
6
The following changes since commit 48aa8f0ac536db3550a35c295ff7de94e4c33739:
12
7
13
Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-3.0-pull-request' into staging (2018-07-23 14:03:14 +0100)
8
Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2020-11-16' into staging (2020-11-17 11:07:00 +0000)
14
9
15
are available in the Git repository at:
10
are available in the Git repository at:
16
11
17
git://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20180723
12
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20201117
18
13
19
for you to fetch changes up to 1ddc9b98c3cb89fe23a55ba924000fd645253e87:
14
for you to fetch changes up to ab135622cf478585bdfcb68b85e4a817d74a0c42:
20
15
21
hw/intc/exynos4210_gic: Turn instance_init into realize function (2018-07-23 15:21:27 +0100)
16
tmp105: Correct handling of temperature limit checks (2020-11-17 12:56:33 +0000)
22
17
23
----------------------------------------------------------------
18
----------------------------------------------------------------
24
target-arm queue:
19
target-arm queue:
25
* spitz, exynos: fix bugs when introspecting some devices
20
* hw/arm/virt: ARM_VIRT must select ARM_GIC
26
* hw/microblaze/xlnx-zynqmp-pmu: Fix introspection problem in 'xlnx, zynqmp-pmu-soc'
21
* exynos: Fix bad printf format specifiers
27
* target/arm: Correctly handle overlapping small MPU regions
22
* hw/input/ps2.c: Remove remnants of printf debug
28
* hw/sd/bcm2835_sdhost: Fix PIO mode writes
23
* target/openrisc: Remove dead code attempting to check "is timer disabled"
24
* register: Remove unnecessary NULL check
25
* util/cutils: Fix Coverity array overrun in freq_to_str()
26
* configure: Make "does libgio work" test pull in some actual functions
27
* tmp105: reset the T_low and T_High registers
28
* tmp105: Correct handling of temperature limit checks
29
29
30
----------------------------------------------------------------
30
----------------------------------------------------------------
31
Guenter Roeck (1):
31
Alex Chen (1):
32
hw/sd/bcm2835_sdhost: Fix PIO mode writes
32
exynos: Fix bad printf format specifiers
33
33
34
Peter Maydell (1):
34
Alistair Francis (1):
35
target/arm: Correctly handle overlapping small MPU regions
35
register: Remove unnecessary NULL check
36
36
37
Thomas Huth (3):
37
Andrew Jones (1):
38
hw/microblaze/xlnx-zynqmp-pmu: Fix introspection problem in 'xlnx, zynqmp-pmu-soc'
38
hw/arm/virt: ARM_VIRT must select ARM_GIC
39
hw/arm/spitz: Move problematic nand_init() code to realize function
40
hw/intc/exynos4210_gic: Turn instance_init into realize function
41
39
42
hw/arm/spitz.c | 15 ++++++++++----
40
Peter Maydell (5):
43
hw/intc/exynos4210_gic.c | 6 +++---
41
hw/input/ps2.c: Remove remnants of printf debug
44
hw/microblaze/xlnx-zynqmp-pmu.c | 10 ++++-----
42
target/openrisc: Remove dead code attempting to check "is timer disabled"
45
hw/sd/bcm2835_sdhost.c | 20 ++++++++++++++----
43
configure: Make "does libgio work" test pull in some actual functions
46
target/arm/helper.c | 46 +++++++++++++++++++++++++++++++++++++++++
44
hw/misc/tmp105: reset the T_low and T_High registers
47
5 files changed, 80 insertions(+), 17 deletions(-)
45
tmp105: Correct handling of temperature limit checks
48
46
47
Philippe Mathieu-Daudé (1):
48
util/cutils: Fix Coverity array overrun in freq_to_str()
49
50
configure | 11 +++++--
51
hw/misc/tmp105.h | 7 +++++
52
hw/core/register.c | 4 ---
53
hw/input/ps2.c | 9 ------
54
hw/misc/tmp105.c | 73 ++++++++++++++++++++++++++++++++++++++------
55
hw/timer/exynos4210_mct.c | 4 +--
56
hw/timer/exynos4210_pwm.c | 8 ++---
57
target/openrisc/sys_helper.c | 3 --
58
util/cutils.c | 3 +-
59
hw/arm/Kconfig | 1 +
60
10 files changed, 89 insertions(+), 34 deletions(-)
61
diff view generated by jsdifflib
New patch
1
From: Andrew Jones <drjones@redhat.com>
1
2
3
The removal of the selection of A15MPCORE from ARM_VIRT also
4
removed what A15MPCORE selects, ARM_GIC. We still need ARM_GIC.
5
6
Fixes: bec3c97e0cf9 ("hw/arm/virt: Remove dependency on Cortex-A15 MPCore peripherals")
7
Reported-by: Miroslav Rezanina <mrezanin@redhat.com>
8
Signed-off-by: Andrew Jones <drjones@redhat.com>
9
Reviewed-by: Miroslav Rezanina <mrezanin@redhat.com>
10
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
11
Message-id: 20201111143440.112763-1-drjones@redhat.com
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
14
hw/arm/Kconfig | 1 +
15
1 file changed, 1 insertion(+)
16
17
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
18
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/arm/Kconfig
20
+++ b/hw/arm/Kconfig
21
@@ -XXX,XX +XXX,XX @@ config ARM_VIRT
22
imply VFIO_PLATFORM
23
imply VFIO_XGMAC
24
imply TPM_TIS_SYSBUS
25
+ select ARM_GIC
26
select ACPI
27
select ARM_SMMUV3
28
select GPIO_KEY
29
--
30
2.20.1
31
32
diff view generated by jsdifflib
1
From: Thomas Huth <thuth@redhat.com>
1
From: Alex Chen <alex.chen@huawei.com>
2
2
3
The instance_init function of the "exynos4210.gic" device creates a
3
We should use printf format specifier "%u" instead of "%d" for
4
new "arm_gic" device and immediately realizes it with qdev_init_nofail().
4
argument of type "unsigned int".
5
This will leave a lot of object in the QOM tree during introspection of
6
the "exynos4210.gic" device, e.g. reproducible by starting QEMU like this:
7
5
8
qemu-system-aarch64 -M none -nodefaults -nographic -monitor stdio
6
Reported-by: Euler Robot <euler.robot@huawei.com>
9
7
Signed-off-by: Alex Chen <alex.chen@huawei.com>
10
And then by running "info qom-tree" at the HMP monitor, followed by
8
Message-id: 20201111073651.72804-1-alex.chen@huawei.com
11
"device_add exynos4210.gic,help" and finally checking "info qom-tree"
12
again.
13
14
Also note that qdev_init_nofail() can exit QEMU in case of errors - and
15
this must never happen during an instance_init function, otherwise QEMU
16
could terminate unexpectedly during introspection of a device.
17
18
Since most of the code that follows the qdev_init_nofail() depends on
19
the realized "gicbusdev", the easiest solution to the problem is to
20
turn the whole instance_init function into a realize function instead.
21
22
Signed-off-by: Thomas Huth <thuth@redhat.com>
23
Message-id: 1532337784-334-1-git-send-email-thuth@redhat.com
24
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
25
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
26
---
11
---
27
hw/intc/exynos4210_gic.c | 6 +++---
12
hw/timer/exynos4210_mct.c | 4 ++--
28
1 file changed, 3 insertions(+), 3 deletions(-)
13
hw/timer/exynos4210_pwm.c | 8 ++++----
14
2 files changed, 6 insertions(+), 6 deletions(-)
29
15
30
diff --git a/hw/intc/exynos4210_gic.c b/hw/intc/exynos4210_gic.c
16
diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c
31
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
32
--- a/hw/intc/exynos4210_gic.c
18
--- a/hw/timer/exynos4210_mct.c
33
+++ b/hw/intc/exynos4210_gic.c
19
+++ b/hw/timer/exynos4210_mct.c
34
@@ -XXX,XX +XXX,XX @@ static void exynos4210_gic_set_irq(void *opaque, int irq, int level)
20
@@ -XXX,XX +XXX,XX @@ static void exynos4210_gcomp_raise_irq(void *opaque, uint32_t id)
35
qemu_set_irq(qdev_get_gpio_in(s->gic, irq), level);
21
/* If CSTAT is pending and IRQ is enabled */
22
if ((s->reg.int_cstat & G_INT_CSTAT_COMP(id)) &&
23
(s->reg.int_enb & G_INT_ENABLE(id))) {
24
- DPRINTF("gcmp timer[%d] IRQ\n", id);
25
+ DPRINTF("gcmp timer[%u] IRQ\n", id);
26
qemu_irq_raise(s->irq[id]);
27
}
36
}
28
}
37
29
@@ -XXX,XX +XXX,XX @@ static void exynos4210_mct_update_freq(Exynos4210MCTState *s)
38
-static void exynos4210_gic_init(Object *obj)
30
MCT_CFG_GET_DIVIDER(s->reg_mct_cfg));
39
+static void exynos4210_gic_realize(DeviceState *dev, Error **errp)
31
40
{
32
if (freq != s->freq) {
41
- DeviceState *dev = DEVICE(obj);
33
- DPRINTF("freq=%dHz\n", s->freq);
42
+ Object *obj = OBJECT(dev);
34
+ DPRINTF("freq=%uHz\n", s->freq);
43
Exynos4210GicState *s = EXYNOS4210_GIC(obj);
35
44
SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
36
/* global timer */
45
const char cpu_prefix[] = "exynos4210-gic-alias_cpu";
37
tx_ptimer_set_freq(s->g_timer.ptimer_frc, s->freq);
46
@@ -XXX,XX +XXX,XX @@ static void exynos4210_gic_class_init(ObjectClass *klass, void *data)
38
diff --git a/hw/timer/exynos4210_pwm.c b/hw/timer/exynos4210_pwm.c
47
DeviceClass *dc = DEVICE_CLASS(klass);
39
index XXXXXXX..XXXXXXX 100644
48
40
--- a/hw/timer/exynos4210_pwm.c
49
dc->props = exynos4210_gic_properties;
41
+++ b/hw/timer/exynos4210_pwm.c
50
+ dc->realize = exynos4210_gic_realize;
42
@@ -XXX,XX +XXX,XX @@ static void exynos4210_pwm_update_freq(Exynos4210PWMState *s, uint32_t id)
43
44
if (freq != s->timer[id].freq) {
45
ptimer_set_freq(s->timer[id].ptimer, s->timer[id].freq);
46
- DPRINTF("freq=%dHz\n", s->timer[id].freq);
47
+ DPRINTF("freq=%uHz\n", s->timer[id].freq);
48
}
51
}
49
}
52
50
53
static const TypeInfo exynos4210_gic_info = {
51
@@ -XXX,XX +XXX,XX @@ static void exynos4210_pwm_tick(void *opaque)
54
.name = TYPE_EXYNOS4210_GIC,
52
uint32_t id = s->id;
55
.parent = TYPE_SYS_BUS_DEVICE,
53
bool cmp;
56
.instance_size = sizeof(Exynos4210GicState),
54
57
- .instance_init = exynos4210_gic_init,
55
- DPRINTF("timer %d tick\n", id);
58
.class_init = exynos4210_gic_class_init,
56
+ DPRINTF("timer %u tick\n", id);
59
};
57
60
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);
61
--
77
--
62
2.17.1
78
2.20.1
63
79
64
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: Guenter Roeck <linux@roeck-us.net>
1
From: Alistair Francis <alistair.francis@wdc.com>
2
2
3
Writes in PIO mode have two requirements:
3
This patch fixes CID 1432800 by removing an unnecessary check.
4
4
5
- A data interrupt must be generated after a write command has been
5
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
6
issued to indicate that the chip is ready to receive data.
7
- A block interrupt must be generated after each block to indicate
8
that the chip is ready to receive the next data block.
9
10
Rearrange the code to make this happen. Tested on raspi3 (in PIO mode)
11
and raspi2 (in DMA mode).
12
13
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
14
Message-id: 1531779837-20557-1-git-send-email-linux@roeck-us.net
15
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
---
8
---
18
hw/sd/bcm2835_sdhost.c | 20 ++++++++++++++++----
9
hw/core/register.c | 4 ----
19
1 file changed, 16 insertions(+), 4 deletions(-)
10
1 file changed, 4 deletions(-)
20
11
21
diff --git a/hw/sd/bcm2835_sdhost.c b/hw/sd/bcm2835_sdhost.c
12
diff --git a/hw/core/register.c b/hw/core/register.c
22
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
23
--- a/hw/sd/bcm2835_sdhost.c
14
--- a/hw/core/register.c
24
+++ b/hw/sd/bcm2835_sdhost.c
15
+++ b/hw/core/register.c
25
@@ -XXX,XX +XXX,XX @@ static void bcm2835_sdhost_fifo_run(BCM2835SDHostState *s)
16
@@ -XXX,XX +XXX,XX @@ static RegisterInfoArray *register_init_block(DeviceState *owner,
26
uint32_t value = 0;
17
int index = rae[i].addr / data_size;
27
int n;
18
RegisterInfo *r = &ri[index];
28
int is_read;
19
29
+ int is_write;
20
- if (data + data_size * index == 0 || !&rae[i]) {
30
21
- continue;
31
is_read = (s->cmd & SDCMD_READ_CMD) != 0;
22
- }
32
- if (s->datacnt != 0 && (!is_read || sdbus_data_ready(&s->sdbus))) {
33
+ is_write = (s->cmd & SDCMD_WRITE_CMD) != 0;
34
+ if (s->datacnt != 0 && (is_write || sdbus_data_ready(&s->sdbus))) {
35
if (is_read) {
36
n = 0;
37
while (s->datacnt && s->fifo_len < BCM2835_SDHOST_FIFO_LEN) {
38
@@ -XXX,XX +XXX,XX @@ static void bcm2835_sdhost_fifo_run(BCM2835SDHostState *s)
39
if (n != 0) {
40
bcm2835_sdhost_fifo_push(s, value);
41
s->status |= SDHSTS_DATA_FLAG;
42
+ if (s->config & SDHCFG_DATA_IRPT_EN) {
43
+ s->status |= SDHSTS_SDIO_IRPT;
44
+ }
45
}
46
- } else { /* write */
47
+ } else if (is_write) { /* write */
48
n = 0;
49
while (s->datacnt > 0 && (s->fifo_len > 0 || n > 0)) {
50
if (n == 0) {
51
@@ -XXX,XX +XXX,XX @@ static void bcm2835_sdhost_fifo_run(BCM2835SDHostState *s)
52
s->edm &= ~SDEDM_FSM_MASK;
53
s->edm |= SDEDM_FSM_DATAMODE;
54
trace_bcm2835_sdhost_edm_change("datacnt 0", s->edm);
55
-
23
-
56
- if ((s->cmd & SDCMD_WRITE_CMD) &&
24
/* Init the register, this will zero it. */
57
+ }
25
object_initialize((void *)r, sizeof(*r), TYPE_REGISTER);
58
+ if (is_write) {
59
+ /* set block interrupt at end of each block transfer */
60
+ if (s->hbct && s->datacnt % s->hbct == 0 &&
61
(s->config & SDHCFG_BLOCK_IRPT_EN)) {
62
s->status |= SDHSTS_BLOCK_IRPT;
63
}
64
+ /* set data interrupt after each transfer */
65
+ s->status |= SDHSTS_DATA_FLAG;
66
+ if (s->config & SDHCFG_DATA_IRPT_EN) {
67
+ s->status |= SDHSTS_SDIO_IRPT;
68
+ }
69
}
70
}
71
26
72
--
27
--
73
2.17.1
28
2.20.1
74
29
75
30
diff view generated by jsdifflib
1
From: Thomas Huth <thuth@redhat.com>
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
2
3
nand_init() does not only create the NAND device, it also realizes
3
Fix Coverity CID 1435957: Memory - illegal accesses (OVERRUN):
4
the device with qdev_init_nofail() already. So we must not call
5
nand_init() from an instance_init function like sl_nand_init(),
6
otherwise we get superfluous NAND devices in the QOM tree after
7
introspecting the 'sl-nand' device. So move the nand_init() to the
8
realize function of 'sl-nand' instead.
9
4
10
Signed-off-by: Thomas Huth <thuth@redhat.com>
5
>>> Overrunning array "suffixes" of 7 8-byte elements at element
11
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
6
index 7 (byte offset 63) using index "idx" (which evaluates to 7).
12
Message-id: 1532006134-7701-1-git-send-email-thuth@redhat.com
7
8
Note, the biggest input value freq_to_str() can accept is UINT64_MAX,
9
which is ~18.446 EHz, less than 1000 EHz.
10
11
Reported-by: Eduardo Habkost <ehabkost@redhat.com>
12
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
13
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
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>
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
---
20
---
16
hw/arm/spitz.c | 15 +++++++++++----
21
util/cutils.c | 3 ++-
17
1 file changed, 11 insertions(+), 4 deletions(-)
22
1 file changed, 2 insertions(+), 1 deletion(-)
18
23
19
diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c
24
diff --git a/util/cutils.c b/util/cutils.c
20
index XXXXXXX..XXXXXXX 100644
25
index XXXXXXX..XXXXXXX 100644
21
--- a/hw/arm/spitz.c
26
--- a/util/cutils.c
22
+++ b/hw/arm/spitz.c
27
+++ b/util/cutils.c
23
@@ -XXX,XX +XXX,XX @@ static void sl_nand_init(Object *obj)
28
@@ -XXX,XX +XXX,XX @@ char *freq_to_str(uint64_t freq_hz)
24
{
29
double freq = freq_hz;
25
SLNANDState *s = SL_NAND(obj);
30
size_t idx = 0;
26
SysBusDevice *dev = SYS_BUS_DEVICE(obj);
31
27
- DriveInfo *nand;
32
- while (freq >= 1000.0 && idx < ARRAY_SIZE(suffixes)) {
28
33
+ while (freq >= 1000.0) {
29
s->ctl = 0;
34
freq /= 1000.0;
30
+
35
idx++;
31
+ memory_region_init_io(&s->iomem, obj, &sl_ops, s, "sl", 0x40);
36
}
32
+ sysbus_init_mmio(dev, &s->iomem);
37
+ assert(idx < ARRAY_SIZE(suffixes));
33
+}
38
34
+
39
return g_strdup_printf("%0.3g %sHz", freq, suffixes[idx]);
35
+static void sl_nand_realize(DeviceState *dev, Error **errp)
36
+{
37
+ SLNANDState *s = SL_NAND(dev);
38
+ DriveInfo *nand;
39
+
40
/* FIXME use a qdev drive property instead of drive_get() */
41
nand = drive_get(IF_MTD, 0, 0);
42
s->nand = nand_init(nand ? blk_by_legacy_dinfo(nand) : NULL,
43
s->manf_id, s->chip_id);
44
-
45
- memory_region_init_io(&s->iomem, obj, &sl_ops, s, "sl", 0x40);
46
- sysbus_init_mmio(dev, &s->iomem);
47
}
48
49
/* Spitz Keyboard */
50
@@ -XXX,XX +XXX,XX @@ static void sl_nand_class_init(ObjectClass *klass, void *data)
51
52
dc->vmsd = &vmstate_sl_nand_info;
53
dc->props = sl_nand_properties;
54
+ dc->realize = sl_nand_realize;
55
/* Reason: init() method uses drive_get() */
56
dc->user_creatable = false;
57
}
40
}
58
--
41
--
59
2.17.1
42
2.20.1
60
43
61
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
To correctly handle small (less than TARGET_PAGE_SIZE) MPU regions,
1
The TMP105 datasheet (https://www.ti.com/lit/gpn/tmp105) says that the
2
we must correctly handle the case where the address being looked
2
power-up reset values for the T_low and T_high registers are 80 degrees C
3
up hits in an MPU region that is not small but the address is
3
and 75 degrees C, which are 0x500 and 0x4B0 hex according to table 5. These
4
in the same page as a small region. For instance if MPU region
4
values are then shifted right by four bits to give the register reset
5
1 covers an entire page from 0x2000 to 0x2400 and MPU region
5
values, since both registers store the 12 bits of temperature data in bits
6
2 is small and covers only 0x2200 to 0x2280, then for an access
6
[15..4] of a 16 bit register.
7
to 0x2000 we must not return a result covering the full page
8
even though we hit the page-sized region 1. Otherwise we will
9
then cache that result in the TLB and accesses that should
10
hit region 2 will incorrectly find the region 1 information.
11
7
12
Check for the case where we miss an MPU region but it is still
8
We were resetting these registers to zero, which is problematic for Linux
13
within the same page, and in that case narrow the size we will
9
guests which enable the alert interrupt and then immediately take an
14
pass to tlb_set_page_with_attrs() for whatever the final
10
unexpected overtemperature alert because the current temperature is above
15
outcome is of the MPU lookup.
11
freezing...
16
12
17
Reported-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Reviewed-by: Cédric Le Goater <clg@kaod.org>
20
Message-id: 20180716133302.25989-1-peter.maydell@linaro.org
15
Message-id: 20201110150023.25533-2-peter.maydell@linaro.org
21
---
16
---
22
target/arm/helper.c | 46 +++++++++++++++++++++++++++++++++++++++++++++
17
hw/misc/tmp105.c | 3 +++
23
1 file changed, 46 insertions(+)
18
1 file changed, 3 insertions(+)
24
19
25
diff --git a/target/arm/helper.c b/target/arm/helper.c
20
diff --git a/hw/misc/tmp105.c b/hw/misc/tmp105.c
26
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
27
--- a/target/arm/helper.c
22
--- a/hw/misc/tmp105.c
28
+++ b/target/arm/helper.c
23
+++ b/hw/misc/tmp105.c
29
@@ -XXX,XX +XXX,XX @@
24
@@ -XXX,XX +XXX,XX @@ static void tmp105_reset(I2CSlave *i2c)
30
#include "exec/semihost.h"
25
s->faults = tmp105_faultq[(s->config >> 3) & 3];
31
#include "sysemu/kvm.h"
26
s->alarm = 0;
32
#include "fpu/softfloat.h"
27
33
+#include "qemu/range.h"
28
+ s->limit[0] = 0x4b00; /* T_LOW, 75 degrees C */
34
29
+ s->limit[1] = 0x5000; /* T_HIGH, 80 degrees C */
35
#define ARM_CPU_FREQ 1000000000 /* FIXME: 1 GHz, should be configurable */
30
+
36
31
tmp105_interrupt_update(s);
37
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address,
32
}
38
}
39
40
if (address < base || address > base + rmask) {
41
+ /*
42
+ * Address not in this region. We must check whether the
43
+ * region covers addresses in the same page as our address.
44
+ * In that case we must not report a size that covers the
45
+ * whole page for a subsequent hit against a different MPU
46
+ * region or the background region, because it would result in
47
+ * incorrect TLB hits for subsequent accesses to addresses that
48
+ * are in this MPU region.
49
+ */
50
+ if (ranges_overlap(base, rmask,
51
+ address & TARGET_PAGE_MASK,
52
+ TARGET_PAGE_SIZE)) {
53
+ *page_size = 1;
54
+ }
55
continue;
56
}
57
58
@@ -XXX,XX +XXX,XX @@ static void v8m_security_lookup(CPUARMState *env, uint32_t address,
59
sattrs->srvalid = true;
60
sattrs->sregion = r;
61
}
62
+ } else {
63
+ /*
64
+ * Address not in this region. We must check whether the
65
+ * region covers addresses in the same page as our address.
66
+ * In that case we must not report a size that covers the
67
+ * whole page for a subsequent hit against a different MPU
68
+ * region or the background region, because it would result
69
+ * in incorrect TLB hits for subsequent accesses to
70
+ * addresses that are in this MPU region.
71
+ */
72
+ if (limit >= base &&
73
+ ranges_overlap(base, limit - base + 1,
74
+ addr_page_base,
75
+ TARGET_PAGE_SIZE)) {
76
+ sattrs->subpage = true;
77
+ }
78
}
79
}
80
}
81
@@ -XXX,XX +XXX,XX @@ static bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address,
82
}
83
84
if (address < base || address > limit) {
85
+ /*
86
+ * Address not in this region. We must check whether the
87
+ * region covers addresses in the same page as our address.
88
+ * In that case we must not report a size that covers the
89
+ * whole page for a subsequent hit against a different MPU
90
+ * region or the background region, because it would result in
91
+ * incorrect TLB hits for subsequent accesses to addresses that
92
+ * are in this MPU region.
93
+ */
94
+ if (limit >= base &&
95
+ ranges_overlap(base, limit - base + 1,
96
+ addr_page_base,
97
+ TARGET_PAGE_SIZE)) {
98
+ *is_subpage = true;
99
+ }
100
continue;
101
}
102
33
103
--
34
--
104
2.17.1
35
2.20.1
105
36
106
37
diff view generated by jsdifflib
1
From: Thomas Huth <thuth@redhat.com>
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 .)
2
10
3
Valgrind complains:
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.
4
15
5
echo "{'execute':'qmp_capabilities'} {'execute':'device-list-properties'," \
16
Implement the correct (hysteresis) behaviour by tracking whether we
6
"'arguments':{'typename':'xlnx,zynqmp-pmu-soc'}}" \
17
are currently looking for the temperature to rise over T_high or
7
"{'execute': 'human-monitor-command', " \
18
for it to fall below T_low. Our implementation of the comparator
8
"'arguments': {'command-line': 'info qtree'}}" | \
19
mode (TM==0) wasn't wrong, but rephrase it to match the way that
9
valgrind -q microblazeel-softmmu/qemu-system-microblazeel -M none,accel=qtest -qmp stdio
20
interrupt mode is now handled for clarity.
10
[...]
11
==13605== Invalid read of size 8
12
==13605== at 0x2AC69A: qdev_print (qdev-monitor.c:686)
13
==13605== by 0x2AC69A: qbus_print (qdev-monitor.c:719)
14
==13605== by 0x2591E8: handle_hmp_command (monitor.c:3446)
15
21
16
Use the new object_initialize_child() and sysbus_init_child_obj() to
22
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
fix the issue.
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(-)
18
29
19
Signed-off-by: Thomas Huth <thuth@redhat.com>
30
diff --git a/hw/misc/tmp105.h b/hw/misc/tmp105.h
20
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
21
Message-id: 1531839343-13828-1-git-send-email-thuth@redhat.com
22
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
23
---
24
hw/microblaze/xlnx-zynqmp-pmu.c | 10 ++++------
25
1 file changed, 4 insertions(+), 6 deletions(-)
26
27
diff --git a/hw/microblaze/xlnx-zynqmp-pmu.c b/hw/microblaze/xlnx-zynqmp-pmu.c
28
index XXXXXXX..XXXXXXX 100644
31
index XXXXXXX..XXXXXXX 100644
29
--- a/hw/microblaze/xlnx-zynqmp-pmu.c
32
--- a/hw/misc/tmp105.h
30
+++ b/hw/microblaze/xlnx-zynqmp-pmu.c
33
+++ b/hw/misc/tmp105.h
31
@@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_pmu_soc_init(Object *obj)
34
@@ -XXX,XX +XXX,XX @@ struct TMP105State {
32
{
35
int16_t limit[2];
33
XlnxZynqMPPMUSoCState *s = XLNX_ZYNQMP_PMU_SOC(obj);
36
int faults;
34
37
uint8_t alarm;
35
- object_initialize(&s->cpu, sizeof(s->cpu),
38
+ /*
36
- TYPE_MICROBLAZE_CPU);
39
+ * The TMP105 initially looks for a temperature rising above T_high;
37
- object_property_add_child(obj, "pmu-cpu", OBJECT(&s->cpu),
40
+ * once this is detected, the condition it looks for next is the
38
- &error_abort);
41
+ * temperature falling below T_low. This flag is false when initially
39
+ object_initialize_child(obj, "pmu-cpu", &s->cpu, sizeof(s->cpu),
42
+ * looking for T_high, true when looking for T_low.
40
+ TYPE_MICROBLAZE_CPU, &error_abort, NULL);
43
+ */
41
44
+ bool detect_falling;
42
- object_initialize(&s->intc, sizeof(s->intc), TYPE_XLNX_PMU_IO_INTC);
45
};
43
- qdev_set_parent_bus(DEVICE(&s->intc), sysbus_get_default());
46
44
+ sysbus_init_child_obj(obj, "intc", &s->intc, sizeof(s->intc),
47
#endif
45
+ TYPE_XLNX_PMU_IO_INTC);
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;
46
}
104
}
47
105
48
static void xlnx_zynqmp_pmu_soc_realize(DeviceState *dev, Error **errp)
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 */
49
--
151
--
50
2.17.1
152
2.20.1
51
153
52
154
diff view generated by jsdifflib