1
A small set of arm bugfixes for rc1 tomorrow.
1
v2: added a missing #include qemu/error-report.h which only causes
2
build failure in some configs, not all.
2
3
3
thanks
4
The following changes since commit 853546f8128476eefb701d4a55b2781bb3a46faa:
4
-- PMM
5
5
6
The following changes since commit c442b7b4a7ae8696bcdf46091d781bd9052731be:
6
Merge tag 'pull-loongarch-20240322' of https://gitlab.com/gaosong/qemu into staging (2024-03-22 10:59:57 +0000)
7
8
Merge remote-tracking branch 'remotes/elmarco/tags/slirp-pull-request' into staging (2019-03-25 07:59:40 +0000)
9
7
10
are available in the Git repository at:
8
are available in the Git repository at:
11
9
12
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20190325
10
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20240325-1
13
11
14
for you to fetch changes up to f2b2f53f6429b5abd7cd86bd65747f5f13e195eb:
12
for you to fetch changes up to fe3e38390126c2202292911c49d46fc7ee4a163a:
15
13
16
target/arm: make pmccntr_op_start/finish static (2019-03-25 14:16:47 +0000)
14
tests/qtest/libqtest.c: Check for g_setenv() failure (2024-03-25 14:17:07 +0000)
17
15
18
----------------------------------------------------------------
16
----------------------------------------------------------------
19
target-arm queue:
17
target-arm queue:
20
* Fix non-parallel expansion of CASP
18
* Fixes for seven minor coverity issues
21
* nrf51_gpio: reflect pull-up/pull-down to IRQs
22
* Fix crash if guest tries to enable non-existent PMU counters
23
* Add PMUv2 to the Cortex-A15 and Cortex-A7
24
* Make pmccntr_op_start/finish static
25
19
26
----------------------------------------------------------------
20
----------------------------------------------------------------
27
Andrew Jones (4):
21
Peter Maydell (7):
28
target/arm: add PCI_TESTDEV back to default config
22
tests/qtest/npcm7xx_emc_test: Don't leak cmd_line
29
target/arm: fix crash on pmu register access
23
tests/unit/socket-helpers: Don't close(-1)
30
target/arm: cortex-a7 and cortex-a15 have pmus
24
net/af-xdp.c: Don't leak sock_fds array in net_init_af_xdp()
31
target/arm: make pmccntr_op_start/finish static
25
hw/misc/pca9554: Correct error check bounds in get/set pin functions
26
hw/nvram/mac_nvram: Report failure to write data
27
tests/unit/test-throttle: Avoid unintended integer division
28
tests/qtest/libqtest.c: Check for g_setenv() failure
32
29
33
Paolo Bonzini (1):
30
hw/misc/pca9554.c | 4 ++--
34
nrf51_gpio: reflect pull-up/pull-down to IRQs
31
hw/nvram/mac_nvram.c | 6 +++++-
35
32
net/af-xdp.c | 3 +--
36
Richard Henderson (1):
33
tests/qtest/libqtest.c | 6 +++++-
37
target/arm: Fix non-parallel expansion of CASP
34
tests/qtest/npcm7xx_emc-test.c | 4 ++--
38
35
tests/unit/socket-helpers.c | 4 +++-
39
target/arm/cpu.h | 11 -------
36
tests/unit/test-throttle.c | 4 ++--
40
hw/gpio/nrf51_gpio.c | 65 +++++++++++++++++++++++++----------------
37
7 files changed, 20 insertions(+), 11 deletions(-)
41
target/arm/cpu.c | 3 ++
42
target/arm/helper.c | 8 +++--
43
target/arm/translate-a64.c | 2 +-
44
default-configs/arm-softmmu.mak | 1 +
45
6 files changed, 51 insertions(+), 39 deletions(-)
46
diff view generated by jsdifflib
Deleted patch
1
From: Richard Henderson <richard.henderson@linaro.org>
2
1
3
The second word has been loaded from the unincremented
4
address since the first commit.
5
6
Fixes: 44ac14b06fa
7
Reported-by: Alex Bennée <alex.bennee@linaro.org>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
10
Tested-by: Alex Bennée <alex.bennee@linaro.org>
11
Message-id: 20190322234302.12770-1-richard.henderson@linaro.org
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
14
target/arm/translate-a64.c | 2 +-
15
1 file changed, 1 insertion(+), 1 deletion(-)
16
17
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
18
index XXXXXXX..XXXXXXX 100644
19
--- a/target/arm/translate-a64.c
20
+++ b/target/arm/translate-a64.c
21
@@ -XXX,XX +XXX,XX @@ static void gen_compare_and_swap_pair(DisasContext *s, int rs, int rt,
22
tcg_gen_qemu_ld_i64(d1, clean_addr, memidx,
23
MO_64 | MO_ALIGN_16 | s->be_data);
24
tcg_gen_addi_i64(a2, clean_addr, 8);
25
- tcg_gen_qemu_ld_i64(d2, clean_addr, memidx, MO_64 | s->be_data);
26
+ tcg_gen_qemu_ld_i64(d2, a2, memidx, MO_64 | s->be_data);
27
28
/* Compare the two words, also in memory order. */
29
tcg_gen_setcond_i64(TCG_COND_EQ, c1, d1, s1);
30
--
31
2.20.1
32
33
diff view generated by jsdifflib
Deleted patch
1
From: Paolo Bonzini <pbonzini@redhat.com>
2
1
3
Some drivers do I2C bitbanging by keeping the output to 0 and flipping
4
the GPIO direction between input and output (see for example in Linux
5
gpio_set_open_drain_value_commit, in drivers/gpio/gpiolib.c).
6
When the GPIO is set to input, the pull-up resistor brings the output
7
to 1, while when the GPIO is set to output, the output driver brings
8
the output to 0.
9
10
Implement this for the nRF51 GPIO device model. First, if both input and
11
output are floating, and there is a pull-up or pull-down resistor
12
configured, do not just set s->in, but also make any devices listening
13
on the output qemu_irq receive that value. Second, if the pin is
14
driven both internally (output pin) and externally you don't get a
15
short circuit if both sides drive the pin to the same value.
16
17
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
18
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
19
Message-id: 20190317141001.3346-1-pbonzini@redhat.com
20
[PMM: wrapped long line]
21
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
22
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
23
---
24
hw/gpio/nrf51_gpio.c | 65 +++++++++++++++++++++++++++-----------------
25
1 file changed, 40 insertions(+), 25 deletions(-)
26
27
diff --git a/hw/gpio/nrf51_gpio.c b/hw/gpio/nrf51_gpio.c
28
index XXXXXXX..XXXXXXX 100644
29
--- a/hw/gpio/nrf51_gpio.c
30
+++ b/hw/gpio/nrf51_gpio.c
31
@@ -XXX,XX +XXX,XX @@ static bool is_connected(uint32_t config, uint32_t level)
32
return state;
33
}
34
35
+static int pull_value(uint32_t config)
36
+{
37
+ int pull = extract32(config, 2, 2);
38
+ if (pull == NRF51_GPIO_PULLDOWN) {
39
+ return 0;
40
+ } else if (pull == NRF51_GPIO_PULLUP) {
41
+ return 1;
42
+ }
43
+ return -1;
44
+}
45
+
46
static void update_output_irq(NRF51GPIOState *s, size_t i,
47
bool connected, bool level)
48
{
49
@@ -XXX,XX +XXX,XX @@ static void update_output_irq(NRF51GPIOState *s, size_t i,
50
51
static void update_state(NRF51GPIOState *s)
52
{
53
- uint32_t pull;
54
+ int pull;
55
size_t i;
56
- bool connected_out, dir, connected_in, out, input;
57
+ bool connected_out, dir, connected_in, out, in, input;
58
59
for (i = 0; i < NRF51_GPIO_PINS; i++) {
60
- pull = extract32(s->cnf[i], 2, 2);
61
+ pull = pull_value(s->cnf[i]);
62
dir = extract32(s->cnf[i], 0, 1);
63
connected_in = extract32(s->in_mask, i, 1);
64
out = extract32(s->out, i, 1);
65
+ in = extract32(s->in, i, 1);
66
input = !extract32(s->cnf[i], 1, 1);
67
connected_out = is_connected(s->cnf[i], out) && dir;
68
69
- update_output_irq(s, i, connected_out, out);
70
-
71
- /* Pin both driven externally and internally */
72
- if (connected_out && connected_in) {
73
- qemu_log_mask(LOG_GUEST_ERROR, "GPIO pin %zu short circuited\n", i);
74
- }
75
-
76
- /*
77
- * Input buffer disconnected from internal/external drives, so
78
- * pull-up/pull-down becomes relevant
79
- */
80
- if (!input || (input && !connected_in && !connected_out)) {
81
- if (pull == NRF51_GPIO_PULLDOWN) {
82
- s->in = deposit32(s->in, i, 1, 0);
83
- } else if (pull == NRF51_GPIO_PULLUP) {
84
- s->in = deposit32(s->in, i, 1, 1);
85
+ if (!input) {
86
+ if (pull >= 0) {
87
+ /* Input buffer disconnected from external drives */
88
+ s->in = deposit32(s->in, i, 1, pull);
89
+ }
90
+ } else {
91
+ if (connected_out && connected_in && out != in) {
92
+ /* Pin both driven externally and internally */
93
+ qemu_log_mask(LOG_GUEST_ERROR,
94
+ "GPIO pin %zu short circuited\n", i);
95
+ }
96
+ if (!connected_in) {
97
+ /*
98
+ * Floating input: the output stimulates IN if connected,
99
+ * otherwise pull-up/pull-down resistors put a value on both
100
+ * IN and OUT.
101
+ */
102
+ if (pull >= 0 && !connected_out) {
103
+ connected_out = true;
104
+ out = pull;
105
+ }
106
+ if (connected_out) {
107
+ s->in = deposit32(s->in, i, 1, out);
108
+ }
109
}
110
}
111
-
112
- /* Self stimulation through internal output driver */
113
- if (connected_out && !connected_in && input) {
114
- s->in = deposit32(s->in, i, 1, out);
115
- }
116
+ update_output_irq(s, i, connected_out, out);
117
}
118
-
119
}
120
121
/*
122
--
123
2.20.1
124
125
diff view generated by jsdifflib
Deleted patch
1
From: Andrew Jones <drjones@redhat.com>
2
1
3
In the kconfig shuffle arm lost pci-testdev which is used by
4
kvm-unit-tests. Let's add it back.
5
6
Signed-off-by: Andrew Jones <drjones@redhat.com>
7
Reviewed-by: Thomas Huth <thuth@redhat.com>
8
Message-id: 20190322163059.9716-1-drjones@redhat.com
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
default-configs/arm-softmmu.mak | 1 +
12
1 file changed, 1 insertion(+)
13
14
diff --git a/default-configs/arm-softmmu.mak b/default-configs/arm-softmmu.mak
15
index XXXXXXX..XXXXXXX 100644
16
--- a/default-configs/arm-softmmu.mak
17
+++ b/default-configs/arm-softmmu.mak
18
@@ -XXX,XX +XXX,XX @@
19
20
CONFIG_PCI=y
21
CONFIG_PCI_DEVICES=y
22
+CONFIG_PCI_TESTDEV=y
23
CONFIG_VGA=y
24
CONFIG_NAND=y
25
CONFIG_ECC=y
26
--
27
2.20.1
28
29
diff view generated by jsdifflib
Deleted patch
1
From: Andrew Jones <drjones@redhat.com>
2
1
3
Fix a QEMU NULL derefence that occurs when the guest attempts to
4
enable PMU counters with a non-v8 cpu model or a v8 cpu model
5
which has not configured a PMU.
6
7
Fixes: 4e7beb0cc0f3 ("target/arm: Add a timer to predict PMU counter overflow")
8
Signed-off-by: Andrew Jones <drjones@redhat.com>
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Message-id: 20190322162333.17159-2-drjones@redhat.com
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
13
target/arm/helper.c | 4 ++++
14
1 file changed, 4 insertions(+)
15
16
diff --git a/target/arm/helper.c b/target/arm/helper.c
17
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/helper.c
19
+++ b/target/arm/helper.c
20
@@ -XXX,XX +XXX,XX @@ static bool pmu_counter_enabled(CPUARMState *env, uint8_t counter)
21
int el = arm_current_el(env);
22
uint8_t hpmn = env->cp15.mdcr_el2 & MDCR_HPMN;
23
24
+ if (!arm_feature(env, ARM_FEATURE_PMU)) {
25
+ return false;
26
+ }
27
+
28
if (!arm_feature(env, ARM_FEATURE_EL2) ||
29
(counter < hpmn || counter == 31)) {
30
e = env->cp15.c9_pmcr & PMCRE;
31
--
32
2.20.1
33
34
diff view generated by jsdifflib
Deleted patch
1
From: Andrew Jones <drjones@redhat.com>
2
1
3
cortex-a7 and cortex-a15 have pmus (PMUv2) and they advertise
4
them in ID_DFR0. Let's allow them to function. This also enables
5
the pmu cpu property to work with these cpu types, i.e. we can
6
now do '-cpu cortex-a15,pmu=off' to remove the pmu.
7
8
Signed-off-by: Andrew Jones <drjones@redhat.com>
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Message-id: 20190322162333.17159-3-drjones@redhat.com
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
13
target/arm/cpu.c | 3 +++
14
1 file changed, 3 insertions(+)
15
16
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
17
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/cpu.c
19
+++ b/target/arm/cpu.c
20
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
21
#endif
22
} else {
23
cpu->id_aa64dfr0 &= ~0xf00;
24
+ cpu->id_dfr0 &= ~(0xf << 24);
25
cpu->pmceid0 = 0;
26
cpu->pmceid1 = 0;
27
}
28
@@ -XXX,XX +XXX,XX @@ static void cortex_a7_initfn(Object *obj)
29
set_feature(&cpu->env, ARM_FEATURE_CBAR_RO);
30
set_feature(&cpu->env, ARM_FEATURE_EL2);
31
set_feature(&cpu->env, ARM_FEATURE_EL3);
32
+ set_feature(&cpu->env, ARM_FEATURE_PMU);
33
cpu->kvm_target = QEMU_KVM_ARM_TARGET_CORTEX_A7;
34
cpu->midr = 0x410fc075;
35
cpu->reset_fpsid = 0x41023075;
36
@@ -XXX,XX +XXX,XX @@ static void cortex_a15_initfn(Object *obj)
37
set_feature(&cpu->env, ARM_FEATURE_CBAR_RO);
38
set_feature(&cpu->env, ARM_FEATURE_EL2);
39
set_feature(&cpu->env, ARM_FEATURE_EL3);
40
+ set_feature(&cpu->env, ARM_FEATURE_PMU);
41
cpu->kvm_target = QEMU_KVM_ARM_TARGET_CORTEX_A15;
42
cpu->midr = 0x412fc0f1;
43
cpu->reset_fpsid = 0x410430f0;
44
--
45
2.20.1
46
47
diff view generated by jsdifflib
Deleted patch
1
From: Andrew Jones <drjones@redhat.com>
2
1
3
These functions are not used outside helper.c
4
5
Signed-off-by: Andrew Jones <drjones@redhat.com>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20190322162333.17159-4-drjones@redhat.com
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
10
target/arm/cpu.h | 11 -----------
11
target/arm/helper.c | 4 ++--
12
2 files changed, 2 insertions(+), 13 deletions(-)
13
14
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
15
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/cpu.h
17
+++ b/target/arm/cpu.h
18
@@ -XXX,XX +XXX,XX @@ static inline bool is_a64(CPUARMState *env)
19
int cpu_arm_signal_handler(int host_signum, void *pinfo,
20
void *puc);
21
22
-/**
23
- * pmccntr_op_start/finish
24
- * @env: CPUARMState
25
- *
26
- * Convert the counter in the PMCCNTR between its delta form (the typical mode
27
- * when it's enabled) and the guest-visible value. These two calls must always
28
- * surround any action which might affect the counter.
29
- */
30
-void pmccntr_op_start(CPUARMState *env);
31
-void pmccntr_op_finish(CPUARMState *env);
32
-
33
/**
34
* pmu_op_start/finish
35
* @env: CPUARMState
36
diff --git a/target/arm/helper.c b/target/arm/helper.c
37
index XXXXXXX..XXXXXXX 100644
38
--- a/target/arm/helper.c
39
+++ b/target/arm/helper.c
40
@@ -XXX,XX +XXX,XX @@ static void pmu_update_irq(CPUARMState *env)
41
* etc. can be done logically. This is essentially a no-op if the counter is
42
* not enabled at the time of the call.
43
*/
44
-void pmccntr_op_start(CPUARMState *env)
45
+static void pmccntr_op_start(CPUARMState *env)
46
{
47
uint64_t cycles = cycles_get_count(env);
48
49
@@ -XXX,XX +XXX,XX @@ void pmccntr_op_start(CPUARMState *env)
50
* guest-visible count. A call to pmccntr_op_finish should follow every call to
51
* pmccntr_op_start.
52
*/
53
-void pmccntr_op_finish(CPUARMState *env)
54
+static void pmccntr_op_finish(CPUARMState *env)
55
{
56
if (pmu_counter_enabled(env, 31)) {
57
#ifndef CONFIG_USER_ONLY
58
--
59
2.20.1
60
61
diff view generated by jsdifflib