1
The following changes since commit 7993b0f83fe5c3f8555e79781d5d098f99751a94:
1
Only thing for Arm for rc1 is RTH's fix for the KVM SVE probe code.
2
2
3
Merge remote-tracking branch 'remotes/nvme/tags/nvme-fixes-for-6.0-pull-request' into staging (2021-03-29 18:45:12 +0100)
3
-- PMM
4
5
The following changes since commit 4e06b3fc1b5e1ec03f22190eabe56891dc9c2236:
6
7
Merge tag 'pull-hex-20220731' of https://github.com/quic/qemu into staging (2022-07-31 21:38:54 -0700)
4
8
5
are available in the Git repository at:
9
are available in the Git repository at:
6
10
7
https://git.linaro.org/people/pmaydell/qemu-arm.git pull-target-arm-20210330
11
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20220801
8
12
9
for you to fetch changes up to b9e3f1579a4b06fc63dfa8cdb68df1c58eeb0cf1:
13
for you to fetch changes up to 5265d24c981dfdda8d29b44f7e84a514da75eedc:
10
14
11
hw/timer/renesas_tmr: Add default-case asserts in read_tcnt() (2021-03-30 14:05:34 +0100)
15
target/arm: Move sve probe inside kvm >= 4.15 branch (2022-08-01 16:21:18 +0100)
12
16
13
----------------------------------------------------------------
17
----------------------------------------------------------------
14
* net/npcm7xx_emc.c: Fix handling of receiving packets when RSDR not set
18
target-arm queue:
15
* hw/display/xlnx_dp: Free FIFOs adding xlnx_dp_finalize()
19
* Fix KVM SVE ID register probe code
16
* hw/arm/smmuv3: Drop unused CDM_VALID() and is_cd_valid()
17
* target/arm: Make number of counters in PMCR follow the CPU
18
* hw/timer/renesas_tmr: Add default-case asserts in read_tcnt()
19
20
20
----------------------------------------------------------------
21
----------------------------------------------------------------
21
Doug Evans (1):
22
Richard Henderson (3):
22
net/npcm7xx_emc.c: Fix handling of receiving packets when RSDR not set
23
target/arm: Use kvm_arm_sve_supported in kvm_arm_get_host_cpu_features
24
target/arm: Set KVM_ARM_VCPU_SVE while probing the host
25
target/arm: Move sve probe inside kvm >= 4.15 branch
23
26
24
Peter Maydell (2):
27
target/arm/kvm64.c | 45 ++++++++++++++++++++++-----------------------
25
target/arm: Make number of counters in PMCR follow the CPU
28
1 file changed, 22 insertions(+), 23 deletions(-)
26
hw/timer/renesas_tmr: Add default-case asserts in read_tcnt()
27
28
Philippe Mathieu-Daudé (1):
29
hw/display/xlnx_dp: Free FIFOs adding xlnx_dp_finalize()
30
31
Zenghui Yu (1):
32
hw/arm/smmuv3: Drop unused CDM_VALID() and is_cd_valid()
33
34
hw/arm/smmuv3-internal.h | 7 -------
35
target/arm/cpu.h | 1 +
36
hw/display/xlnx_dp.c | 9 +++++++++
37
hw/net/npcm7xx_emc.c | 4 +++-
38
hw/timer/renesas_tmr.c | 4 ++++
39
target/arm/cpu64.c | 3 +++
40
target/arm/cpu_tcg.c | 5 +++++
41
target/arm/helper.c | 29 +++++++++++++++++------------
42
target/arm/kvm64.c | 2 ++
43
tests/qtest/npcm7xx_emc-test.c | 30 +++++++++++++++++++++---------
44
10 files changed, 65 insertions(+), 29 deletions(-)
45
diff view generated by jsdifflib
1
From: Zenghui Yu <yuzenghui@huawei.com>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
They were introduced in commit 9bde7f0674fe ("hw/arm/smmuv3: Implement
3
Indication for support for SVE will not depend on whether we
4
translate callback") but never actually used. Drop them.
4
perform the query on the main kvm_state or the temp vcpu.
5
5
6
Signed-off-by: Zenghui Yu <yuzenghui@huawei.com>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Acked-by: Eric Auger <eric.auger@redhat.com>
7
Message-id: 20220726045828.53697-2-richard.henderson@linaro.org
8
Message-id: 20210325142702.790-1-yuzenghui@huawei.com
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
10
---
12
hw/arm/smmuv3-internal.h | 7 -------
11
target/arm/kvm64.c | 2 +-
13
1 file changed, 7 deletions(-)
12
1 file changed, 1 insertion(+), 1 deletion(-)
14
13
15
diff --git a/hw/arm/smmuv3-internal.h b/hw/arm/smmuv3-internal.h
14
diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
16
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
17
--- a/hw/arm/smmuv3-internal.h
16
--- a/target/arm/kvm64.c
18
+++ b/hw/arm/smmuv3-internal.h
17
+++ b/target/arm/kvm64.c
19
@@ -XXX,XX +XXX,XX @@ static inline int pa_range(STE *ste)
18
@@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
20
#define CD_A(x) extract32((x)->word[1], 14, 1)
19
}
21
#define CD_AARCH64(x) extract32((x)->word[1], 9 , 1)
20
}
22
21
23
-#define CDM_VALID(x) ((x)->word[0] & 0x1)
22
- sve_supported = ioctl(fdarray[0], KVM_CHECK_EXTENSION, KVM_CAP_ARM_SVE) > 0;
24
-
23
+ sve_supported = kvm_arm_sve_supported();
25
-static inline int is_cd_valid(SMMUv3State *s, STE *ste, CD *cd)
24
26
-{
25
/* Add feature bits that can't appear until after VCPU init. */
27
- return CD_VALID(cd);
26
if (sve_supported) {
28
-}
29
-
30
/**
31
* tg2granule - Decodes the CD translation granule size field according
32
* to the ttbr in use
33
--
27
--
34
2.20.1
28
2.25.1
35
36
diff view generated by jsdifflib
1
From: Doug Evans <dje@google.com>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Turning REG_MCMDR_RXON is enough to start receiving packets.
3
Because we weren't setting this flag, our probe of ID_AA64ZFR0
4
was always returning zero. This also obviates the adjustment
5
of ID_AA64PFR0, which had sanitized the SVE field.
4
6
5
Signed-off-by: Doug Evans <dje@google.com>
7
The effects of the bug are not visible, because the only thing that
6
Message-id: 20210319195044.741821-1-dje@google.com
8
ID_AA64ZFR0 is used for within qemu at present is tcg translation.
9
The other tests for SVE within KVM are via ID_AA64PFR0.SVE.
10
11
Reported-by: Zenghui Yu <yuzenghui@huawei.com>
12
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
13
Message-id: 20220726045828.53697-3-richard.henderson@linaro.org
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
14
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
16
---
10
hw/net/npcm7xx_emc.c | 4 +++-
17
target/arm/kvm64.c | 27 +++++++++++++--------------
11
tests/qtest/npcm7xx_emc-test.c | 30 +++++++++++++++++++++---------
18
1 file changed, 13 insertions(+), 14 deletions(-)
12
2 files changed, 24 insertions(+), 10 deletions(-)
13
19
14
diff --git a/hw/net/npcm7xx_emc.c b/hw/net/npcm7xx_emc.c
20
diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
15
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/net/npcm7xx_emc.c
22
--- a/target/arm/kvm64.c
17
+++ b/hw/net/npcm7xx_emc.c
23
+++ b/target/arm/kvm64.c
18
@@ -XXX,XX +XXX,XX @@ static void npcm7xx_emc_write(void *opaque, hwaddr offset,
24
@@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
19
!(value & REG_MCMDR_RXON)) {
25
bool sve_supported;
20
emc->regs[REG_MGSTA] |= REG_MGSTA_RXHA;
26
bool pmu_supported = false;
21
}
27
uint64_t features = 0;
22
- if (!(value & REG_MCMDR_RXON)) {
28
- uint64_t t;
23
+ if (value & REG_MCMDR_RXON) {
29
int err;
24
+ emc->rx_active = true;
30
25
+ } else {
31
/* Old kernels may not know about the PREFERRED_TARGET ioctl: however
26
emc_halt_rx(emc, 0);
32
@@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
27
}
33
struct kvm_vcpu_init init = { .target = -1, };
28
break;
34
29
diff --git a/tests/qtest/npcm7xx_emc-test.c b/tests/qtest/npcm7xx_emc-test.c
30
index XXXXXXX..XXXXXXX 100644
31
--- a/tests/qtest/npcm7xx_emc-test.c
32
+++ b/tests/qtest/npcm7xx_emc-test.c
33
@@ -XXX,XX +XXX,XX @@ static void enable_tx(QTestState *qts, const EMCModule *mod,
34
mcmdr |= REG_MCMDR_TXON;
35
emc_write(qts, mod, REG_MCMDR, mcmdr);
36
}
37
-
38
- /* Prod the device to send the packet. */
39
- emc_write(qts, mod, REG_TSDR, 1);
40
}
41
42
static void emc_send_verify1(QTestState *qts, const EMCModule *mod, int fd,
43
@@ -XXX,XX +XXX,XX @@ static void emc_send_verify(QTestState *qts, const EMCModule *mod, int fd,
44
enable_tx(qts, mod, &desc[0], NUM_TX_DESCRIPTORS, desc_addr,
45
with_irq ? REG_MIEN_ENTXINTR : 0);
46
47
+ /* Prod the device to send the packet. */
48
+ emc_write(qts, mod, REG_TSDR, 1);
49
+
50
/*
35
/*
51
* It's problematic to observe the interrupt for each packet.
36
- * Ask for Pointer Authentication if supported. We can't play the
52
* Instead just wait until all the packets go out.
37
- * SVE trick of synthesising the ID reg as KVM won't tell us
53
@@ -XXX,XX +XXX,XX @@ static void enable_rx(QTestState *qts, const EMCModule *mod,
38
- * whether we have the architected or IMPDEF version of PAuth, so
54
mcmdr |= REG_MCMDR_RXON | mcmdr_flags;
39
- * we have to use the actual ID regs.
55
emc_write(qts, mod, REG_MCMDR, mcmdr);
40
+ * Ask for SVE if supported, so that we can query ID_AA64ZFR0,
56
}
41
+ * which is otherwise RAZ.
57
-
58
- /* Prod the device to accept a packet. */
59
- emc_write(qts, mod, REG_RSDR, 1);
60
}
61
62
static void emc_recv_verify(QTestState *qts, const EMCModule *mod, int fd,
63
- bool with_irq)
64
+ bool with_irq, bool pump_rsdr)
65
{
66
NPCM7xxEMCRxDesc desc[NUM_RX_DESCRIPTORS];
67
uint32_t desc_addr = DESC_ADDR;
68
@@ -XXX,XX +XXX,XX @@ static void emc_recv_verify(QTestState *qts, const EMCModule *mod, int fd,
69
enable_rx(qts, mod, &desc[0], NUM_RX_DESCRIPTORS, desc_addr,
70
with_irq ? REG_MIEN_ENRXINTR : 0, 0);
71
72
+ /*
73
+ * If requested, prod the device to accept a packet.
74
+ * This isn't necessary, the linux driver doesn't do this.
75
+ * Test doing/not-doing this for robustness.
76
+ */
42
+ */
77
+ if (pump_rsdr) {
43
+ sve_supported = kvm_arm_sve_supported();
78
+ emc_write(qts, mod, REG_RSDR, 1);
44
+ if (sve_supported) {
45
+ init.features[0] |= 1 << KVM_ARM_VCPU_SVE;
79
+ }
46
+ }
80
+
47
+
81
/* Send test packet to device's socket. */
48
+ /*
82
ret = iov_send(fd, iov, 2, 0, sizeof(len) + sizeof(test));
49
+ * Ask for Pointer Authentication if supported, so that we get
83
g_assert_cmpint(ret, == , sizeof(test) + sizeof(len));
50
+ * the unsanitized field values for AA64ISAR1_EL1.
84
@@ -XXX,XX +XXX,XX @@ static void test_rx(gconstpointer test_data)
51
*/
85
52
if (kvm_arm_pauth_supported()) {
86
qtest_irq_intercept_in(qts, "/machine/soc/a9mpcore/gic");
53
init.features[0] |= (1 << KVM_ARM_VCPU_PTRAUTH_ADDRESS |
87
54
@@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
88
- emc_recv_verify(qts, td->module, test_sockets[0], /*with_irq=*/false);
55
}
89
- emc_recv_verify(qts, td->module, test_sockets[0], /*with_irq=*/true);
56
}
90
+ emc_recv_verify(qts, td->module, test_sockets[0], /*with_irq=*/false,
57
91
+ /*pump_rsdr=*/false);
58
- sve_supported = kvm_arm_sve_supported();
92
+ emc_recv_verify(qts, td->module, test_sockets[0], /*with_irq=*/false,
59
-
93
+ /*pump_rsdr=*/true);
60
- /* Add feature bits that can't appear until after VCPU init. */
94
+ emc_recv_verify(qts, td->module, test_sockets[0], /*with_irq=*/true,
61
if (sve_supported) {
95
+ /*pump_rsdr=*/false);
62
- t = ahcf->isar.id_aa64pfr0;
96
+ emc_recv_verify(qts, td->module, test_sockets[0], /*with_irq=*/true,
63
- t = FIELD_DP64(t, ID_AA64PFR0, SVE, 1);
97
+ /*pump_rsdr=*/true);
64
- ahcf->isar.id_aa64pfr0 = t;
98
emc_test_ptle(qts, td->module, test_sockets[0]);
65
-
99
66
/*
100
qtest_quit(qts);
67
* There is a range of kernels between kernel commit 73433762fcae
68
* and f81cb2c3ad41 which have a bug where the kernel doesn't expose
69
* SYS_ID_AA64ZFR0_EL1 via the ONE_REG API unless the VM has enabled
70
- * SVE support, so we only read it here, rather than together with all
71
- * the other ID registers earlier.
72
+ * SVE support, which resulted in an error rather than RAZ.
73
+ * So only read the register if we set KVM_ARM_VCPU_SVE above.
74
*/
75
err |= read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64zfr0,
76
ARM64_SYS_REG(3, 0, 0, 4, 4));
101
--
77
--
102
2.20.1
78
2.25.1
103
104
diff view generated by jsdifflib
Deleted patch
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
1
3
When building with --enable-sanitizers we get:
4
5
Direct leak of 16 byte(s) in 1 object(s) allocated from:
6
#0 0x5618479ec7cf in malloc (qemu-system-aarch64+0x233b7cf)
7
#1 0x7f675745f958 in g_malloc (/lib64/libglib-2.0.so.0+0x58958)
8
#2 0x561847c2dcc9 in xlnx_dp_init hw/display/xlnx_dp.c:1259:5
9
#3 0x56184a5bdab8 in object_init_with_type qom/object.c:375:9
10
#4 0x56184a5a2bda in object_initialize_with_type qom/object.c:517:5
11
#5 0x56184a5a24d5 in object_initialize qom/object.c:536:5
12
#6 0x56184a5a2f6c in object_initialize_child_with_propsv qom/object.c:566:5
13
#7 0x56184a5a2e60 in object_initialize_child_with_props qom/object.c:549:10
14
#8 0x56184a5a3a1e in object_initialize_child_internal qom/object.c:603:5
15
#9 0x5618495aa431 in xlnx_zynqmp_init hw/arm/xlnx-zynqmp.c:273:5
16
17
The RX/TX FIFOs are created in xlnx_dp_init(), add xlnx_dp_finalize()
18
to destroy them.
19
20
Fixes: 58ac482a66d ("introduce xlnx-dp")
21
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
22
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
23
Message-id: 20210323182958.277654-1-f4bug@amsat.org
24
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
25
---
26
hw/display/xlnx_dp.c | 9 +++++++++
27
1 file changed, 9 insertions(+)
28
29
diff --git a/hw/display/xlnx_dp.c b/hw/display/xlnx_dp.c
30
index XXXXXXX..XXXXXXX 100644
31
--- a/hw/display/xlnx_dp.c
32
+++ b/hw/display/xlnx_dp.c
33
@@ -XXX,XX +XXX,XX @@ static void xlnx_dp_init(Object *obj)
34
fifo8_create(&s->tx_fifo, 16);
35
}
36
37
+static void xlnx_dp_finalize(Object *obj)
38
+{
39
+ XlnxDPState *s = XLNX_DP(obj);
40
+
41
+ fifo8_destroy(&s->tx_fifo);
42
+ fifo8_destroy(&s->rx_fifo);
43
+}
44
+
45
static void xlnx_dp_realize(DeviceState *dev, Error **errp)
46
{
47
XlnxDPState *s = XLNX_DP(dev);
48
@@ -XXX,XX +XXX,XX @@ static const TypeInfo xlnx_dp_info = {
49
.parent = TYPE_SYS_BUS_DEVICE,
50
.instance_size = sizeof(XlnxDPState),
51
.instance_init = xlnx_dp_init,
52
+ .instance_finalize = xlnx_dp_finalize,
53
.class_init = xlnx_dp_class_init,
54
};
55
56
--
57
2.20.1
58
59
diff view generated by jsdifflib
1
Currently we give all the v7-and-up CPUs a PMU with 4 counters. This
1
From: Richard Henderson <richard.henderson@linaro.org>
2
means that we don't provide the 6 counters that are required by the
3
Arm BSA (Base System Architecture) specification if the CPU supports
4
the Virtualization extensions.
5
2
6
Instead of having a single PMCR_NUM_COUNTERS, make each CPU type
3
The test for the IF block indicates no ID registers are exposed, much
7
specify the PMCR reset value (obtained from the appropriate TRM), and
4
less host support for SVE. Move the SVE probe into the ELSE block.
8
use the 'N' field of that value to define the number of counters
9
provided.
10
5
11
This means that we now supply 6 counters for Cortex-A53, A57, A72,
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
12
A15 and A9 as well as '-cpu max'; Cortex-A7 and A8 stay at 4; and
7
Message-id: 20220726045828.53697-4-richard.henderson@linaro.org
13
Cortex-R5 goes down to 3.
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
target/arm/kvm64.c | 22 +++++++++++-----------
12
1 file changed, 11 insertions(+), 11 deletions(-)
14
13
15
Note that because we now use the PMCR reset value of the specific
16
implementation, we no longer set the LC bit out of reset. This has
17
an UNKNOWN value out of reset for all cores with any AArch32 support,
18
so guest software should be setting it anyway if it wants it.
19
20
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
21
Tested-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
22
Message-id: 20210311165947.27470-1-peter.maydell@linaro.org
23
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
24
---
25
target/arm/cpu.h | 1 +
26
target/arm/cpu64.c | 3 +++
27
target/arm/cpu_tcg.c | 5 +++++
28
target/arm/helper.c | 29 +++++++++++++++++------------
29
target/arm/kvm64.c | 2 ++
30
5 files changed, 28 insertions(+), 12 deletions(-)
31
32
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
33
index XXXXXXX..XXXXXXX 100644
34
--- a/target/arm/cpu.h
35
+++ b/target/arm/cpu.h
36
@@ -XXX,XX +XXX,XX @@ struct ARMCPU {
37
uint64_t id_aa64mmfr2;
38
uint64_t id_aa64dfr0;
39
uint64_t id_aa64dfr1;
40
+ uint64_t reset_pmcr_el0;
41
} isar;
42
uint64_t midr;
43
uint32_t revidr;
44
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
45
index XXXXXXX..XXXXXXX 100644
46
--- a/target/arm/cpu64.c
47
+++ b/target/arm/cpu64.c
48
@@ -XXX,XX +XXX,XX @@ static void aarch64_a57_initfn(Object *obj)
49
cpu->gic_num_lrs = 4;
50
cpu->gic_vpribits = 5;
51
cpu->gic_vprebits = 5;
52
+ cpu->isar.reset_pmcr_el0 = 0x41013000;
53
define_arm_cp_regs(cpu, cortex_a72_a57_a53_cp_reginfo);
54
}
55
56
@@ -XXX,XX +XXX,XX @@ static void aarch64_a53_initfn(Object *obj)
57
cpu->gic_num_lrs = 4;
58
cpu->gic_vpribits = 5;
59
cpu->gic_vprebits = 5;
60
+ cpu->isar.reset_pmcr_el0 = 0x41033000;
61
define_arm_cp_regs(cpu, cortex_a72_a57_a53_cp_reginfo);
62
}
63
64
@@ -XXX,XX +XXX,XX @@ static void aarch64_a72_initfn(Object *obj)
65
cpu->gic_num_lrs = 4;
66
cpu->gic_vpribits = 5;
67
cpu->gic_vprebits = 5;
68
+ cpu->isar.reset_pmcr_el0 = 0x41023000;
69
define_arm_cp_regs(cpu, cortex_a72_a57_a53_cp_reginfo);
70
}
71
72
diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c
73
index XXXXXXX..XXXXXXX 100644
74
--- a/target/arm/cpu_tcg.c
75
+++ b/target/arm/cpu_tcg.c
76
@@ -XXX,XX +XXX,XX @@ static void cortex_a8_initfn(Object *obj)
77
cpu->ccsidr[1] = 0x2007e01a; /* 16k L1 icache. */
78
cpu->ccsidr[2] = 0xf0000000; /* No L2 icache. */
79
cpu->reset_auxcr = 2;
80
+ cpu->isar.reset_pmcr_el0 = 0x41002000;
81
define_arm_cp_regs(cpu, cortexa8_cp_reginfo);
82
}
83
84
@@ -XXX,XX +XXX,XX @@ static void cortex_a9_initfn(Object *obj)
85
cpu->clidr = (1 << 27) | (1 << 24) | 3;
86
cpu->ccsidr[0] = 0xe00fe019; /* 16k L1 dcache. */
87
cpu->ccsidr[1] = 0x200fe019; /* 16k L1 icache. */
88
+ cpu->isar.reset_pmcr_el0 = 0x41093000;
89
define_arm_cp_regs(cpu, cortexa9_cp_reginfo);
90
}
91
92
@@ -XXX,XX +XXX,XX @@ static void cortex_a7_initfn(Object *obj)
93
cpu->ccsidr[0] = 0x701fe00a; /* 32K L1 dcache */
94
cpu->ccsidr[1] = 0x201fe00a; /* 32K L1 icache */
95
cpu->ccsidr[2] = 0x711fe07a; /* 4096K L2 unified cache */
96
+ cpu->isar.reset_pmcr_el0 = 0x41072000;
97
define_arm_cp_regs(cpu, cortexa15_cp_reginfo); /* Same as A15 */
98
}
99
100
@@ -XXX,XX +XXX,XX @@ static void cortex_a15_initfn(Object *obj)
101
cpu->ccsidr[0] = 0x701fe00a; /* 32K L1 dcache */
102
cpu->ccsidr[1] = 0x201fe00a; /* 32K L1 icache */
103
cpu->ccsidr[2] = 0x711fe07a; /* 4096K L2 unified cache */
104
+ cpu->isar.reset_pmcr_el0 = 0x410F3000;
105
define_arm_cp_regs(cpu, cortexa15_cp_reginfo);
106
}
107
108
@@ -XXX,XX +XXX,XX @@ static void cortex_r5_initfn(Object *obj)
109
cpu->isar.id_isar6 = 0x0;
110
cpu->mp_is_up = true;
111
cpu->pmsav7_dregion = 16;
112
+ cpu->isar.reset_pmcr_el0 = 0x41151800;
113
define_arm_cp_regs(cpu, cortexr5_cp_reginfo);
114
}
115
116
diff --git a/target/arm/helper.c b/target/arm/helper.c
117
index XXXXXXX..XXXXXXX 100644
118
--- a/target/arm/helper.c
119
+++ b/target/arm/helper.c
120
@@ -XXX,XX +XXX,XX @@
121
#endif
122
123
#define ARM_CPU_FREQ 1000000000 /* FIXME: 1 GHz, should be configurable */
124
-#define PMCR_NUM_COUNTERS 4 /* QEMU IMPDEF choice */
125
126
#ifndef CONFIG_USER_ONLY
127
128
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v6_cp_reginfo[] = {
129
130
static inline uint32_t pmu_num_counters(CPUARMState *env)
131
{
132
- return (env->cp15.c9_pmcr & PMCRN_MASK) >> PMCRN_SHIFT;
133
+ ARMCPU *cpu = env_archcpu(env);
134
+
135
+ return (cpu->isar.reset_pmcr_el0 & PMCRN_MASK) >> PMCRN_SHIFT;
136
}
137
138
/* Bits allowed to be set/cleared for PMCNTEN* and PMINTEN* */
139
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el2_cp_reginfo[] = {
140
.resetvalue = 0,
141
.writefn = gt_hyp_ctl_write, .raw_writefn = raw_write },
142
#endif
143
- /* The only field of MDCR_EL2 that has a defined architectural reset value
144
- * is MDCR_EL2.HPMN which should reset to the value of PMCR_EL0.N.
145
- */
146
- { .name = "MDCR_EL2", .state = ARM_CP_STATE_BOTH,
147
- .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 1,
148
- .access = PL2_RW, .resetvalue = PMCR_NUM_COUNTERS,
149
- .fieldoffset = offsetof(CPUARMState, cp15.mdcr_el2), },
150
{ .name = "HPFAR", .state = ARM_CP_STATE_AA32,
151
.cp = 15, .opc1 = 4, .crn = 6, .crm = 0, .opc2 = 4,
152
.access = PL2_RW, .accessfn = access_el3_aa32ns,
153
@@ -XXX,XX +XXX,XX @@ static void define_pmu_regs(ARMCPU *cpu)
154
* field as main ID register, and we implement four counters in
155
* addition to the cycle count register.
156
*/
157
- unsigned int i, pmcrn = PMCR_NUM_COUNTERS;
158
+ unsigned int i, pmcrn = pmu_num_counters(&cpu->env);
159
ARMCPRegInfo pmcr = {
160
.name = "PMCR", .cp = 15, .crn = 9, .crm = 12, .opc1 = 0, .opc2 = 0,
161
.access = PL0_RW,
162
@@ -XXX,XX +XXX,XX @@ static void define_pmu_regs(ARMCPU *cpu)
163
.access = PL0_RW, .accessfn = pmreg_access,
164
.type = ARM_CP_IO,
165
.fieldoffset = offsetof(CPUARMState, cp15.c9_pmcr),
166
- .resetvalue = (cpu->midr & 0xff000000) | (pmcrn << PMCRN_SHIFT) |
167
- PMCRLC,
168
+ .resetvalue = cpu->isar.reset_pmcr_el0,
169
.writefn = pmcr_write, .raw_writefn = raw_write,
170
};
171
+
172
define_one_arm_cp_reg(cpu, &pmcr);
173
define_one_arm_cp_reg(cpu, &pmcr64);
174
for (i = 0; i < pmcrn; i++) {
175
@@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu)
176
.fieldoffset = offsetof(CPUARMState, cp15.vmpidr_el2) },
177
REGINFO_SENTINEL
178
};
179
+ /*
180
+ * The only field of MDCR_EL2 that has a defined architectural reset
181
+ * value is MDCR_EL2.HPMN which should reset to the value of PMCR_EL0.N.
182
+ */
183
+ ARMCPRegInfo mdcr_el2 = {
184
+ .name = "MDCR_EL2", .state = ARM_CP_STATE_BOTH,
185
+ .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 1,
186
+ .access = PL2_RW, .resetvalue = pmu_num_counters(env),
187
+ .fieldoffset = offsetof(CPUARMState, cp15.mdcr_el2),
188
+ };
189
+ define_one_arm_cp_reg(cpu, &mdcr_el2);
190
define_arm_cp_regs(cpu, vpidr_regs);
191
define_arm_cp_regs(cpu, el2_cp_reginfo);
192
if (arm_feature(env, ARM_FEATURE_V8)) {
193
diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
14
diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
194
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
195
--- a/target/arm/kvm64.c
16
--- a/target/arm/kvm64.c
196
+++ b/target/arm/kvm64.c
17
+++ b/target/arm/kvm64.c
197
@@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
18
@@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
198
ARM64_SYS_REG(3, 0, 0, 7, 1));
19
err |= read_sys_reg64(fdarray[2], &ahcf->isar.reset_pmcr_el0,
199
err |= read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64mmfr2,
20
ARM64_SYS_REG(3, 3, 9, 12, 0));
200
ARM64_SYS_REG(3, 0, 0, 7, 2));
21
}
201
+ err |= read_sys_reg64(fdarray[2], &ahcf->isar.reset_pmcr_el0,
22
- }
202
+ ARM64_SYS_REG(3, 3, 9, 12, 0));
23
203
24
- if (sve_supported) {
204
/*
25
- /*
205
* Note that if AArch32 support is not present in the host,
26
- * There is a range of kernels between kernel commit 73433762fcae
27
- * and f81cb2c3ad41 which have a bug where the kernel doesn't expose
28
- * SYS_ID_AA64ZFR0_EL1 via the ONE_REG API unless the VM has enabled
29
- * SVE support, which resulted in an error rather than RAZ.
30
- * So only read the register if we set KVM_ARM_VCPU_SVE above.
31
- */
32
- err |= read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64zfr0,
33
- ARM64_SYS_REG(3, 0, 0, 4, 4));
34
+ if (sve_supported) {
35
+ /*
36
+ * There is a range of kernels between kernel commit 73433762fcae
37
+ * and f81cb2c3ad41 which have a bug where the kernel doesn't
38
+ * expose SYS_ID_AA64ZFR0_EL1 via the ONE_REG API unless the VM has
39
+ * enabled SVE support, which resulted in an error rather than RAZ.
40
+ * So only read the register if we set KVM_ARM_VCPU_SVE above.
41
+ */
42
+ err |= read_sys_reg64(fdarray[2], &ahcf->isar.id_aa64zfr0,
43
+ ARM64_SYS_REG(3, 0, 0, 4, 4));
44
+ }
45
}
46
47
kvm_arm_destroy_scratch_host_vcpu(fdarray);
206
--
48
--
207
2.20.1
49
2.25.1
208
209
diff view generated by jsdifflib
Deleted patch
1
In commit 81b3ddaf8772ec we fixed a use of uninitialized data
2
in read_tcnt(). However this change wasn't enough to placate
3
Coverity, which is not smart enough to see that if we read a
4
2 bit field and then handle cases 0, 1, 2 and 3 then there cannot
5
be a flow of execution through the switch default. Add explicit
6
default cases which assert that they can't be reached, which
7
should help silence Coverity.
8
1
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
11
Message-id: 20210319162458.13760-1-peter.maydell@linaro.org
12
---
13
hw/timer/renesas_tmr.c | 4 ++++
14
1 file changed, 4 insertions(+)
15
16
diff --git a/hw/timer/renesas_tmr.c b/hw/timer/renesas_tmr.c
17
index XXXXXXX..XXXXXXX 100644
18
--- a/hw/timer/renesas_tmr.c
19
+++ b/hw/timer/renesas_tmr.c
20
@@ -XXX,XX +XXX,XX @@ static uint16_t read_tcnt(RTMRState *tmr, unsigned size, int ch)
21
case CSS_CASCADING:
22
tcnt[1] = tmr->tcnt[1];
23
break;
24
+ default:
25
+ g_assert_not_reached();
26
}
27
switch (FIELD_EX8(tmr->tccr[0], TCCR, CSS)) {
28
case CSS_INTERNAL:
29
@@ -XXX,XX +XXX,XX @@ static uint16_t read_tcnt(RTMRState *tmr, unsigned size, int ch)
30
case CSS_EXTERNAL: /* QEMU doesn't implement this */
31
tcnt[0] = tmr->tcnt[0];
32
break;
33
+ default:
34
+ g_assert_not_reached();
35
}
36
} else {
37
tcnt[0] = tmr->tcnt[0];
38
--
39
2.20.1
40
41
diff view generated by jsdifflib