1
Some more outstanding target-arm patches; nothing terribly
1
Hi; not so many patches in this one, but notably it includes the
2
exciting. Mostly they're mine; I'm trying to reduce the
2
fix for various Avocado CI tests failing (incorrectly reported by
3
number of patches I still have in flight, so I've picked
3
Avocado as a timeout, but really a QEMU exit-with-error).
4
out some of the reviewed patches from a couple of sets I've
5
sent out and will resend v2 versions of those sets with the
6
remaining patches with fixes for issues noted in review once
7
this is in master.
8
4
9
thanks
5
thanks
10
-- PMM
6
-- PMM
11
7
8
The following changes since commit c8de6ec63d766ca1998c5af468483ce912fdc0c2:
12
9
13
The following changes since commit adaec191bfb31e12d40af8ab1b869f5b40d61ee9:
10
Merge tag 'pull-request-2022-09-28' of https://gitlab.com/thuth/qemu into staging (2022-09-28 17:04:11 -0400)
14
15
Merge remote-tracking branch 'remotes/ehabkost/tags/machine-next-pull-request' into staging (2018-08-20 09:48:03 +0100)
16
11
17
are available in the Git repository at:
12
are available in the Git repository at:
18
13
19
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20180820
14
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20220930
20
15
21
for you to fetch changes up to b85fad1588e812566f897f747e38da345a7016d6:
16
for you to fetch changes up to beeec926d24aac28f95cc7694ef3837d7a4cd3bb:
22
17
23
hw/dma/pl080: Remove hw_error() if DMA is enabled (2018-08-20 11:24:33 +0100)
18
target/arm: mark SP_EL1 with ARM_CP_EL3_NO_EL2_KEEP (2022-09-29 18:01:09 +0100)
24
19
25
----------------------------------------------------------------
20
----------------------------------------------------------------
26
target-arm queue:
21
target-arm queue:
27
* Fix crash on conditional instruction in an IT block
22
* Fix breakage of icount mode when guest touches MDCR_EL3, MDCR_EL2,
28
* docs/generic-loader: mention U-Boot and Intel HEX executable formats
23
PMCNTENSET_EL0 or PMCNTENCLR_EL0
29
* hw/intc/arm_gicv3_its: downgrade error_report to warn_report in kvm_arm_its_reset
24
* Make writes to MDCR_EL3 use PMU start/finish calls
30
* imx_serial: Generate interrupt on receive data ready if enabled
25
* Let AArch32 write to SDCR.SCCD
31
* Fix various minor bugs in AArch32 Hyp related coprocessor registers
26
* Rearrange cpu64.c so all the CPU initfns are together
32
* Permit accesses to ELR_Hyp from Hyp mode via MSR/MRS (banked)
27
* hw/arm/xlnx-zynqmp: Connect ZynqMP's USB controllers
33
* Implement AArch32 ERET instruction
28
* hw/arm/virt: fix some minor issues with generated device tree
34
* hw/arm/virt: Add virt-3.1 machine type
29
* Fix regression where EL3 could not write to SP_EL1 if there is no EL2
35
* sdhci: add i.MX SD Stable Clock bit
36
* Remove now-obsolete MMIO request_ptr APIs
37
* hw/timer/m48t59: Move away from old_mmio accessors
38
* hw/watchdog/cmsdk_apb_watchdog: Implement CMSDK APB watchdog module
39
* nvic: Expose NMI line
40
* hw/dma/pl080: cleanups and new features required for use in MPS boards
41
30
42
----------------------------------------------------------------
31
----------------------------------------------------------------
43
Andrew Jones (1):
32
Francisco Iglesias (1):
44
hw/arm/virt: Add virt-3.1 machine type
33
hw/arm/xlnx-zynqmp: Connect ZynqMP's USB controllers
45
34
46
Hans-Erik Floryd (2):
35
Jean-Philippe Brucker (4):
47
imx_serial: Generate interrupt on receive data ready if enabled
36
hw/arm/virt: Fix devicetree warning about the root node
48
sdhci: add i.MX SD Stable Clock bit
37
hw/arm/virt: Fix devicetree warning about the GIC node
38
hw/arm/virt: Use "msi-map" devicetree property for PCI
39
hw/arm/virt: Fix devicetree warning about the SMMU node
49
40
50
Jia He (1):
41
Jerome Forissier (1):
51
hw/intc/arm_gicv3_its: downgrade error_report to warn_report in kvm_arm_its_reset
42
target/arm: mark SP_EL1 with ARM_CP_EL3_NO_EL2_KEEP
52
43
53
Peter Maydell (19):
44
Peter Maydell (4):
54
target/arm: Correct typo in HAMAIR1 regdef name
45
target/arm: Mark registers which call pmu_op_start() as ARM_CP_IO
55
target/arm: Add missing .cp = 15 to HMAIR1 and HAMAIR1 regdefs
46
target/arm: Make writes to MDCR_EL3 use PMU start/finish calls
56
target/arm: Implement AArch32 HVBAR
47
target/arm: Update SDCR_VALID_MASK to include SCCD
57
target/arm: Implement AArch32 Hyp FARs
48
target/arm: Rearrange cpu64.c so all the CPU initfns are together
58
target/arm: Implement ESR_EL2/HSR for AArch32 and no-EL2
59
target/arm: Permit accesses to ELR_Hyp from Hyp mode via MSR/MRS (banked)
60
target/arm: Implement AArch32 ERET instruction
61
hw/ssi/xilinx_spips: Remove unneeded MMIO request_ptr code
62
memory: Remove MMIO request_ptr APIs
63
hw/misc: Remove mmio_interface device
64
hw/timer/m48t59: Move away from old_mmio accessors
65
hw/watchdog/cmsdk_apb_watchdog: Implement CMSDK APB watchdog module
66
nvic: Expose NMI line
67
hw/dma/pl080: Allow use as embedded-struct device
68
hw/dma/pl080: Support all three interrupt lines
69
hw/dma/pl080: Don't use CPU address space for DMA accesses
70
hw/dma/pl080: Provide device reset function
71
hw/dma/pl080: Correct bug in register address decode logic
72
hw/dma/pl080: Remove hw_error() if DMA is enabled
73
49
74
Roman Kapl (1):
50
include/hw/arm/xlnx-zynqmp.h | 3 +
75
target/arm: Fix crash on conditional instruction in an IT block
51
target/arm/cpu.h | 8 +-
76
52
hw/arm/virt.c | 8 +-
77
Stefan Hajnoczi (1):
53
hw/arm/xlnx-zynqmp.c | 36 +++
78
docs/generic-loader: mention U-Boot and Intel HEX executable formats
54
target/arm/cpu64.c | 712 +++++++++++++++++++++----------------------
79
55
target/arm/helper.c | 32 +-
80
docs/generic-loader.txt | 20 +-
56
6 files changed, 427 insertions(+), 372 deletions(-)
81
Makefile.objs | 1 +
82
hw/misc/Makefile.objs | 1 -
83
hw/watchdog/Makefile.objs | 1 +
84
hw/sd/sdhci-internal.h | 2 +
85
include/exec/memory.h | 35 ----
86
include/hw/char/imx_serial.h | 1 +
87
include/hw/dma/pl080.h | 71 +++++++
88
include/hw/misc/mmio_interface.h | 49 -----
89
include/hw/watchdog/cmsdk-apb-watchdog.h | 59 ++++++
90
hw/arm/armv7m.c | 1 +
91
hw/arm/realview.c | 8 +-
92
hw/arm/versatilepb.c | 9 +-
93
hw/arm/virt.c | 23 ++-
94
hw/char/imx_serial.c | 3 +-
95
hw/dma/pl080.c | 113 ++++++-----
96
hw/intc/arm_gicv3_its_kvm.c | 2 +-
97
hw/intc/armv7m_nvic.c | 19 ++
98
hw/misc/mmio_interface.c | 135 -------------
99
hw/sd/sdhci.c | 8 +
100
hw/ssi/xilinx_spips.c | 46 -----
101
hw/timer/m48t59.c | 59 ++----
102
hw/watchdog/cmsdk-apb-watchdog.c | 326 +++++++++++++++++++++++++++++++
103
memory.c | 110 -----------
104
target/arm/helper.c | 36 +++-
105
target/arm/op_helper.c | 22 +--
106
target/arm/translate.c | 76 +++++--
107
MAINTAINERS | 3 +
108
default-configs/arm-softmmu.mak | 1 +
109
hw/intc/trace-events | 1 +
110
hw/watchdog/trace-events | 6 +
111
31 files changed, 717 insertions(+), 530 deletions(-)
112
create mode 100644 include/hw/dma/pl080.h
113
delete mode 100644 include/hw/misc/mmio_interface.h
114
create mode 100644 include/hw/watchdog/cmsdk-apb-watchdog.h
115
delete mode 100644 hw/misc/mmio_interface.c
116
create mode 100644 hw/watchdog/cmsdk-apb-watchdog.c
117
create mode 100644 hw/watchdog/trace-events
118
diff view generated by jsdifflib
1
ARMCPRegInfo structs will default to .cp = 15 if they
1
In commit 01765386a888 we made some system register write functions
2
are ARM_CP_STATE_BOTH, but not if they are ARM_CP_STATE_AA32
2
call pmu_op_start()/pmu_op_finish(). This means that they now touch
3
(because a coprocessor number of 0 is valid for AArch32).
3
timers, so for icount to work these registers must have the ARM_CP_IO
4
We forgot to explicitly set .cp = 15 for the HMAIR1 and
4
flag set.
5
HAMAIR1 regdefs, which meant they would UNDEF when the guest
6
tried to access them under cp15.
7
5
6
This fixes a bug where when icount is enabled a guest that touches
7
MDCR_EL3, MDCR_EL2, PMCNTENSET_EL0 or PMCNTENCLR_EL0 would cause
8
QEMU to print an error message and exit, for example:
9
10
[ 2.495971] TCP: Hash tables configured (established 1024 bind 1024)
11
[ 2.496213] UDP hash table entries: 256 (order: 1, 8192 bytes)
12
[ 2.496386] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
13
[ 2.496917] NET: Registered protocol family 1
14
qemu-system-aarch64: Bad icount read
15
16
Reported-by: Thomas Huth <thuth@redhat.com>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
18
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
19
Message-id: 20220923123412.1214041-2-peter.maydell@linaro.org
11
Message-id: 20180814124254.5229-3-peter.maydell@linaro.org
12
---
20
---
13
target/arm/helper.c | 8 ++++----
21
target/arm/helper.c | 12 ++++++------
14
1 file changed, 4 insertions(+), 4 deletions(-)
22
1 file changed, 6 insertions(+), 6 deletions(-)
15
23
16
diff --git a/target/arm/helper.c b/target/arm/helper.c
24
diff --git a/target/arm/helper.c b/target/arm/helper.c
17
index XXXXXXX..XXXXXXX 100644
25
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/helper.c
26
--- a/target/arm/helper.c
19
+++ b/target/arm/helper.c
27
+++ b/target/arm/helper.c
20
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el3_no_el2_cp_reginfo[] = {
28
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = {
21
.access = PL2_RW, .type = ARM_CP_CONST,
29
* or PL0_RO as appropriate and then check PMUSERENR in the helper fn.
22
.resetvalue = 0 },
30
*/
23
{ .name = "HMAIR1", .state = ARM_CP_STATE_AA32,
31
{ .name = "PMCNTENSET", .cp = 15, .crn = 9, .crm = 12, .opc1 = 0, .opc2 = 1,
24
- .opc1 = 4, .crn = 10, .crm = 2, .opc2 = 1,
32
- .access = PL0_RW, .type = ARM_CP_ALIAS,
25
+ .cp = 15, .opc1 = 4, .crn = 10, .crm = 2, .opc2 = 1,
33
+ .access = PL0_RW, .type = ARM_CP_ALIAS | ARM_CP_IO,
26
.access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
34
.fieldoffset = offsetoflow32(CPUARMState, cp15.c9_pmcnten),
27
{ .name = "AMAIR_EL2", .state = ARM_CP_STATE_BOTH,
35
.writefn = pmcntenset_write,
28
.opc0 = 3, .opc1 = 4, .crn = 10, .crm = 3, .opc2 = 0,
36
.accessfn = pmreg_access,
29
.access = PL2_RW, .type = ARM_CP_CONST,
37
.raw_writefn = raw_write },
30
.resetvalue = 0 },
38
- { .name = "PMCNTENSET_EL0", .state = ARM_CP_STATE_AA64,
31
{ .name = "HAMAIR1", .state = ARM_CP_STATE_AA32,
39
+ { .name = "PMCNTENSET_EL0", .state = ARM_CP_STATE_AA64, .type = ARM_CP_IO,
32
- .opc1 = 4, .crn = 10, .crm = 3, .opc2 = 1,
40
.opc0 = 3, .opc1 = 3, .crn = 9, .crm = 12, .opc2 = 1,
33
+ .cp = 15, .opc1 = 4, .crn = 10, .crm = 3, .opc2 = 1,
41
.access = PL0_RW, .accessfn = pmreg_access,
34
.access = PL2_RW, .type = ARM_CP_CONST,
42
.fieldoffset = offsetof(CPUARMState, cp15.c9_pmcnten), .resetvalue = 0,
35
.resetvalue = 0 },
43
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = {
36
{ .name = "AFSR0_EL2", .state = ARM_CP_STATE_BOTH,
44
.fieldoffset = offsetoflow32(CPUARMState, cp15.c9_pmcnten),
37
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el2_cp_reginfo[] = {
45
.accessfn = pmreg_access,
38
.access = PL2_RW, .fieldoffset = offsetof(CPUARMState, cp15.mair_el[2]),
46
.writefn = pmcntenclr_write,
39
.resetvalue = 0 },
47
- .type = ARM_CP_ALIAS },
40
{ .name = "HMAIR1", .state = ARM_CP_STATE_AA32,
48
+ .type = ARM_CP_ALIAS | ARM_CP_IO },
41
- .opc1 = 4, .crn = 10, .crm = 2, .opc2 = 1,
49
{ .name = "PMCNTENCLR_EL0", .state = ARM_CP_STATE_AA64,
42
+ .cp = 15, .opc1 = 4, .crn = 10, .crm = 2, .opc2 = 1,
50
.opc0 = 3, .opc1 = 3, .crn = 9, .crm = 12, .opc2 = 2,
43
.access = PL2_RW, .type = ARM_CP_ALIAS,
51
.access = PL0_RW, .accessfn = pmreg_access,
44
.fieldoffset = offsetofhigh32(CPUARMState, cp15.mair_el[2]) },
52
- .type = ARM_CP_ALIAS,
45
{ .name = "AMAIR_EL2", .state = ARM_CP_STATE_BOTH,
53
+ .type = ARM_CP_ALIAS | ARM_CP_IO,
46
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el2_cp_reginfo[] = {
54
.fieldoffset = offsetof(CPUARMState, cp15.c9_pmcnten),
47
.resetvalue = 0 },
55
.writefn = pmcntenclr_write },
48
/* HAMAIR1 is mapped to AMAIR_EL2[63:32] */
56
{ .name = "PMOVSR", .cp = 15, .crn = 9, .crm = 12, .opc1 = 0, .opc2 = 3,
49
{ .name = "HAMAIR1", .state = ARM_CP_STATE_AA32,
57
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = {
50
- .opc1 = 4, .crn = 10, .crm = 3, .opc2 = 1,
58
.opc0 = 3, .opc1 = 6, .crn = 1, .crm = 3, .opc2 = 1,
51
+ .cp = 15, .opc1 = 4, .crn = 10, .crm = 3, .opc2 = 1,
59
.resetvalue = 0,
52
.access = PL2_RW, .type = ARM_CP_CONST,
60
.access = PL3_RW, .fieldoffset = offsetof(CPUARMState, cp15.mdcr_el3) },
53
.resetvalue = 0 },
61
- { .name = "SDCR", .type = ARM_CP_ALIAS,
54
{ .name = "AFSR0_EL2", .state = ARM_CP_STATE_BOTH,
62
+ { .name = "SDCR", .type = ARM_CP_ALIAS | ARM_CP_IO,
63
.cp = 15, .opc1 = 0, .crn = 1, .crm = 3, .opc2 = 1,
64
.access = PL1_RW, .accessfn = access_trap_aa32s_el1,
65
.writefn = sdcr_write,
66
@@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu)
67
* value is MDCR_EL2.HPMN which should reset to the value of PMCR_EL0.N.
68
*/
69
ARMCPRegInfo mdcr_el2 = {
70
- .name = "MDCR_EL2", .state = ARM_CP_STATE_BOTH,
71
+ .name = "MDCR_EL2", .state = ARM_CP_STATE_BOTH, .type = ARM_CP_IO,
72
.opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 1,
73
.writefn = mdcr_el2_write,
74
.access = PL2_RW, .resetvalue = pmu_num_counters(env),
55
--
75
--
56
2.18.0
76
2.25.1
57
58
diff view generated by jsdifflib
1
We implement the HAMAIR1 register as RAZ/WI; we had a typo in the
1
In commit 01765386a88868 we fixed a bug where we weren't correctly
2
regdef, though, and were incorrectly naming it HMAIR1 (which is
2
bracketing changes to some registers with pmu_op_start() and
3
a different register which we also implement as RAZ/WI).
3
pmu_op_finish() calls for changes which affect whether the PMU
4
counters might be enabled. However, we missed the case of writes to
5
the AArch64 MDCR_EL3 register, because (unlike its AArch32
6
counterpart) they are currently done directly to the CPU state struct
7
without going through the sdcr_write() function.
8
9
Give MDCR_EL3 a writefn which handles the PMU start/finish calls.
10
The SDCR writefn then simplfies to "call the MDCR_EL3 writefn after
11
masking off the bits which don't exist in the AArch32 register".
4
12
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
14
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
15
Message-id: 20220923123412.1214041-3-peter.maydell@linaro.org
8
Message-id: 20180814124254.5229-2-peter.maydell@linaro.org
9
---
16
---
10
target/arm/helper.c | 4 ++--
17
target/arm/helper.c | 18 ++++++++++++++----
11
1 file changed, 2 insertions(+), 2 deletions(-)
18
1 file changed, 14 insertions(+), 4 deletions(-)
12
19
13
diff --git a/target/arm/helper.c b/target/arm/helper.c
20
diff --git a/target/arm/helper.c b/target/arm/helper.c
14
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/helper.c
22
--- a/target/arm/helper.c
16
+++ b/target/arm/helper.c
23
+++ b/target/arm/helper.c
17
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el3_no_el2_cp_reginfo[] = {
24
@@ -XXX,XX +XXX,XX @@ static void sctlr_write(CPUARMState *env, const ARMCPRegInfo *ri,
18
.opc0 = 3, .opc1 = 4, .crn = 10, .crm = 3, .opc2 = 0,
25
}
19
.access = PL2_RW, .type = ARM_CP_CONST,
26
}
20
.resetvalue = 0 },
27
21
- { .name = "HMAIR1", .state = ARM_CP_STATE_AA32,
28
-static void sdcr_write(CPUARMState *env, const ARMCPRegInfo *ri,
22
+ { .name = "HAMAIR1", .state = ARM_CP_STATE_AA32,
29
- uint64_t value)
23
.opc1 = 4, .crn = 10, .crm = 3, .opc2 = 1,
30
+static void mdcr_el3_write(CPUARMState *env, const ARMCPRegInfo *ri,
24
.access = PL2_RW, .type = ARM_CP_CONST,
31
+ uint64_t value)
25
.resetvalue = 0 },
32
{
26
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el2_cp_reginfo[] = {
33
/*
27
.access = PL2_RW, .type = ARM_CP_CONST,
34
* Some MDCR_EL3 bits affect whether PMU counters are running:
28
.resetvalue = 0 },
35
@@ -XXX,XX +XXX,XX @@ static void sdcr_write(CPUARMState *env, const ARMCPRegInfo *ri,
29
/* HAMAIR1 is mapped to AMAIR_EL2[63:32] */
36
if (pmu_op) {
30
- { .name = "HMAIR1", .state = ARM_CP_STATE_AA32,
37
pmu_op_start(env);
31
+ { .name = "HAMAIR1", .state = ARM_CP_STATE_AA32,
38
}
32
.opc1 = 4, .crn = 10, .crm = 3, .opc2 = 1,
39
- env->cp15.mdcr_el3 = value & SDCR_VALID_MASK;
33
.access = PL2_RW, .type = ARM_CP_CONST,
40
+ env->cp15.mdcr_el3 = value;
34
.resetvalue = 0 },
41
if (pmu_op) {
42
pmu_op_finish(env);
43
}
44
}
45
46
+static void sdcr_write(CPUARMState *env, const ARMCPRegInfo *ri,
47
+ uint64_t value)
48
+{
49
+ /* Not all bits defined for MDCR_EL3 exist in the AArch32 SDCR */
50
+ mdcr_el3_write(env, ri, value & SDCR_VALID_MASK);
51
+}
52
+
53
static void mdcr_el2_write(CPUARMState *env, const ARMCPRegInfo *ri,
54
uint64_t value)
55
{
56
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = {
57
.access = PL2_RW,
58
.fieldoffset = offsetof(CPUARMState, banked_spsr[BANK_FIQ]) },
59
{ .name = "MDCR_EL3", .state = ARM_CP_STATE_AA64,
60
+ .type = ARM_CP_IO,
61
.opc0 = 3, .opc1 = 6, .crn = 1, .crm = 3, .opc2 = 1,
62
.resetvalue = 0,
63
- .access = PL3_RW, .fieldoffset = offsetof(CPUARMState, cp15.mdcr_el3) },
64
+ .access = PL3_RW,
65
+ .writefn = mdcr_el3_write,
66
+ .fieldoffset = offsetof(CPUARMState, cp15.mdcr_el3) },
67
{ .name = "SDCR", .type = ARM_CP_ALIAS | ARM_CP_IO,
68
.cp = 15, .opc1 = 0, .crn = 1, .crm = 3, .opc2 = 1,
69
.access = PL1_RW, .accessfn = access_trap_aa32s_el1,
35
--
70
--
36
2.18.0
71
2.25.1
37
38
diff view generated by jsdifflib
1
The PL08x model currently will unconditionally call hw_error()
1
Our SDCR_VALID_MASK doesn't include all of the bits which are defined
2
if the DMA engine is enabled by the guest. This has been
2
by the current architecture. In particular in commit 0b42f4fab9d3 we
3
present since the PL080 model was edded in 2006, and is
3
forgot to add SCCD, which meant that an AArch32 guest couldn't
4
presumably either unintentional debug code left enabled,
4
actually use the SCCD bit to disable counting in Secure state.
5
or a guard against untested DMA engine code being used.
6
5
7
Remove the hw_error(), since we now have a guest which
6
Add all the currently defined bits; we don't implement all of them,
8
will actually try to use the DMA engine (the self-test
7
but this makes them be reads-as-written, which is architecturally
9
binary for the AN505 MPS2 FPGA image).
8
valid and matches how we currently handle most of the others in the
9
mask.
10
10
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
12
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
13
Message-id: 20220923123412.1214041-4-peter.maydell@linaro.org
13
---
14
---
14
hw/dma/pl080.c | 1 -
15
target/arm/cpu.h | 8 +++++++-
15
1 file changed, 1 deletion(-)
16
1 file changed, 7 insertions(+), 1 deletion(-)
16
17
17
diff --git a/hw/dma/pl080.c b/hw/dma/pl080.c
18
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
18
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/dma/pl080.c
20
--- a/target/arm/cpu.h
20
+++ b/hw/dma/pl080.c
21
+++ b/target/arm/cpu.h
21
@@ -XXX,XX +XXX,XX @@ static void pl080_run(PL080State *s)
22
@@ -XXX,XX +XXX,XX @@ FIELD(CPTR_EL3, TTA, 20, 1)
22
if ((s->conf & PL080_CONF_E) == 0)
23
FIELD(CPTR_EL3, TAM, 30, 1)
23
return;
24
FIELD(CPTR_EL3, TCPAC, 31, 1)
24
25
25
-hw_error("DMA active\n");
26
+#define MDCR_MTPME (1U << 28)
26
/* If we are already in the middle of a DMA operation then indicate that
27
+#define MDCR_TDCC (1U << 27)
27
there may be new DMA requests and return immediately. */
28
#define MDCR_HLP (1U << 26) /* MDCR_EL2 */
28
if (s->running) {
29
#define MDCR_SCCD (1U << 23) /* MDCR_EL3 */
30
#define MDCR_HCCD (1U << 23) /* MDCR_EL2 */
31
#define MDCR_EPMAD (1U << 21)
32
#define MDCR_EDAD (1U << 20)
33
+#define MDCR_TTRF (1U << 19)
34
+#define MDCR_STE (1U << 18) /* MDCR_EL3 */
35
#define MDCR_SPME (1U << 17) /* MDCR_EL3 */
36
#define MDCR_HPMD (1U << 17) /* MDCR_EL2 */
37
#define MDCR_SDD (1U << 16)
38
@@ -XXX,XX +XXX,XX @@ FIELD(CPTR_EL3, TCPAC, 31, 1)
39
#define MDCR_HPMN (0x1fU)
40
41
/* Not all of the MDCR_EL3 bits are present in the 32-bit SDCR */
42
-#define SDCR_VALID_MASK (MDCR_EPMAD | MDCR_EDAD | MDCR_SPME | MDCR_SPD)
43
+#define SDCR_VALID_MASK (MDCR_MTPME | MDCR_TDCC | MDCR_SCCD | \
44
+ MDCR_EPMAD | MDCR_EDAD | MDCR_TTRF | \
45
+ MDCR_STE | MDCR_SPME | MDCR_SPD)
46
47
#define CPSR_M (0x1fU)
48
#define CPSR_T (1U << 5)
29
--
49
--
30
2.18.0
50
2.25.1
31
32
diff view generated by jsdifflib
1
Move the m48t59 device away from using old_mmio MemoryRegionOps
1
cpu64.c has ended up in a slightly odd order -- it starts with the
2
accessors.
2
initfns for most of the models-real-hardware CPUs; after that comes a
3
bunch of support code for SVE, SME, pauth and LPA2 properties. Then
4
come the initfns for the 'host' and 'max' CPU types, and then after
5
that one more models-real-hardware CPU initfn, for a64fx. (This
6
ordering is partly historical and partly required because a64fx needs
7
the SVE properties.)
8
9
Reorder the file into:
10
* CPU property support functions
11
* initfns for real hardware CPUs
12
* initfns for host and max
13
* class boilerplate
3
14
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
16
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
6
Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
17
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20180802180602.22047-1-peter.maydell@linaro.org
8
---
18
---
9
hw/timer/m48t59.c | 59 +++++++++--------------------------------------
19
target/arm/cpu64.c | 712 ++++++++++++++++++++++-----------------------
10
1 file changed, 11 insertions(+), 48 deletions(-)
20
1 file changed, 356 insertions(+), 356 deletions(-)
11
21
12
diff --git a/hw/timer/m48t59.c b/hw/timer/m48t59.c
22
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
13
index XXXXXXX..XXXXXXX 100644
23
index XXXXXXX..XXXXXXX 100644
14
--- a/hw/timer/m48t59.c
24
--- a/target/arm/cpu64.c
15
+++ b/hw/timer/m48t59.c
25
+++ b/target/arm/cpu64.c
16
@@ -XXX,XX +XXX,XX @@ static uint64_t NVRAM_readb(void *opaque, hwaddr addr, unsigned size)
26
@@ -XXX,XX +XXX,XX @@ static void aarch64_a35_initfn(Object *obj)
17
return retval;
27
define_cortex_a72_a57_a53_cp_reginfo(cpu);
18
}
28
}
19
29
20
-static void nvram_writeb (void *opaque, hwaddr addr, uint32_t value)
30
-static void aarch64_a57_initfn(Object *obj)
21
-{
31
-{
22
- M48t59State *NVRAM = opaque;
32
- ARMCPU *cpu = ARM_CPU(obj);
23
-
33
-
24
- m48t59_write(NVRAM, addr, value & 0xff);
34
- cpu->dtb_compatible = "arm,cortex-a57";
35
- set_feature(&cpu->env, ARM_FEATURE_V8);
36
- set_feature(&cpu->env, ARM_FEATURE_NEON);
37
- set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER);
38
- set_feature(&cpu->env, ARM_FEATURE_AARCH64);
39
- set_feature(&cpu->env, ARM_FEATURE_CBAR_RO);
40
- set_feature(&cpu->env, ARM_FEATURE_EL2);
41
- set_feature(&cpu->env, ARM_FEATURE_EL3);
42
- set_feature(&cpu->env, ARM_FEATURE_PMU);
43
- cpu->kvm_target = QEMU_KVM_ARM_TARGET_CORTEX_A57;
44
- cpu->midr = 0x411fd070;
45
- cpu->revidr = 0x00000000;
46
- cpu->reset_fpsid = 0x41034070;
47
- cpu->isar.mvfr0 = 0x10110222;
48
- cpu->isar.mvfr1 = 0x12111111;
49
- cpu->isar.mvfr2 = 0x00000043;
50
- cpu->ctr = 0x8444c004;
51
- cpu->reset_sctlr = 0x00c50838;
52
- cpu->isar.id_pfr0 = 0x00000131;
53
- cpu->isar.id_pfr1 = 0x00011011;
54
- cpu->isar.id_dfr0 = 0x03010066;
55
- cpu->id_afr0 = 0x00000000;
56
- cpu->isar.id_mmfr0 = 0x10101105;
57
- cpu->isar.id_mmfr1 = 0x40000000;
58
- cpu->isar.id_mmfr2 = 0x01260000;
59
- cpu->isar.id_mmfr3 = 0x02102211;
60
- cpu->isar.id_isar0 = 0x02101110;
61
- cpu->isar.id_isar1 = 0x13112111;
62
- cpu->isar.id_isar2 = 0x21232042;
63
- cpu->isar.id_isar3 = 0x01112131;
64
- cpu->isar.id_isar4 = 0x00011142;
65
- cpu->isar.id_isar5 = 0x00011121;
66
- cpu->isar.id_isar6 = 0;
67
- cpu->isar.id_aa64pfr0 = 0x00002222;
68
- cpu->isar.id_aa64dfr0 = 0x10305106;
69
- cpu->isar.id_aa64isar0 = 0x00011120;
70
- cpu->isar.id_aa64mmfr0 = 0x00001124;
71
- cpu->isar.dbgdidr = 0x3516d000;
72
- cpu->isar.dbgdevid = 0x01110f13;
73
- cpu->isar.dbgdevid1 = 0x2;
74
- cpu->isar.reset_pmcr_el0 = 0x41013000;
75
- cpu->clidr = 0x0a200023;
76
- cpu->ccsidr[0] = 0x701fe00a; /* 32KB L1 dcache */
77
- cpu->ccsidr[1] = 0x201fe012; /* 48KB L1 icache */
78
- cpu->ccsidr[2] = 0x70ffe07a; /* 2048KB L2 cache */
79
- cpu->dcz_blocksize = 4; /* 64 bytes */
80
- cpu->gic_num_lrs = 4;
81
- cpu->gic_vpribits = 5;
82
- cpu->gic_vprebits = 5;
83
- cpu->gic_pribits = 5;
84
- define_cortex_a72_a57_a53_cp_reginfo(cpu);
25
-}
85
-}
26
-
86
-
27
-static void nvram_writew (void *opaque, hwaddr addr, uint32_t value)
87
-static void aarch64_a53_initfn(Object *obj)
28
-{
88
-{
29
- M48t59State *NVRAM = opaque;
89
- ARMCPU *cpu = ARM_CPU(obj);
30
-
90
-
31
- m48t59_write(NVRAM, addr, (value >> 8) & 0xff);
91
- cpu->dtb_compatible = "arm,cortex-a53";
32
- m48t59_write(NVRAM, addr + 1, value & 0xff);
92
- set_feature(&cpu->env, ARM_FEATURE_V8);
93
- set_feature(&cpu->env, ARM_FEATURE_NEON);
94
- set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER);
95
- set_feature(&cpu->env, ARM_FEATURE_AARCH64);
96
- set_feature(&cpu->env, ARM_FEATURE_CBAR_RO);
97
- set_feature(&cpu->env, ARM_FEATURE_EL2);
98
- set_feature(&cpu->env, ARM_FEATURE_EL3);
99
- set_feature(&cpu->env, ARM_FEATURE_PMU);
100
- cpu->kvm_target = QEMU_KVM_ARM_TARGET_CORTEX_A53;
101
- cpu->midr = 0x410fd034;
102
- cpu->revidr = 0x00000000;
103
- cpu->reset_fpsid = 0x41034070;
104
- cpu->isar.mvfr0 = 0x10110222;
105
- cpu->isar.mvfr1 = 0x12111111;
106
- cpu->isar.mvfr2 = 0x00000043;
107
- cpu->ctr = 0x84448004; /* L1Ip = VIPT */
108
- cpu->reset_sctlr = 0x00c50838;
109
- cpu->isar.id_pfr0 = 0x00000131;
110
- cpu->isar.id_pfr1 = 0x00011011;
111
- cpu->isar.id_dfr0 = 0x03010066;
112
- cpu->id_afr0 = 0x00000000;
113
- cpu->isar.id_mmfr0 = 0x10101105;
114
- cpu->isar.id_mmfr1 = 0x40000000;
115
- cpu->isar.id_mmfr2 = 0x01260000;
116
- cpu->isar.id_mmfr3 = 0x02102211;
117
- cpu->isar.id_isar0 = 0x02101110;
118
- cpu->isar.id_isar1 = 0x13112111;
119
- cpu->isar.id_isar2 = 0x21232042;
120
- cpu->isar.id_isar3 = 0x01112131;
121
- cpu->isar.id_isar4 = 0x00011142;
122
- cpu->isar.id_isar5 = 0x00011121;
123
- cpu->isar.id_isar6 = 0;
124
- cpu->isar.id_aa64pfr0 = 0x00002222;
125
- cpu->isar.id_aa64dfr0 = 0x10305106;
126
- cpu->isar.id_aa64isar0 = 0x00011120;
127
- cpu->isar.id_aa64mmfr0 = 0x00001122; /* 40 bit physical addr */
128
- cpu->isar.dbgdidr = 0x3516d000;
129
- cpu->isar.dbgdevid = 0x00110f13;
130
- cpu->isar.dbgdevid1 = 0x1;
131
- cpu->isar.reset_pmcr_el0 = 0x41033000;
132
- cpu->clidr = 0x0a200023;
133
- cpu->ccsidr[0] = 0x700fe01a; /* 32KB L1 dcache */
134
- cpu->ccsidr[1] = 0x201fe00a; /* 32KB L1 icache */
135
- cpu->ccsidr[2] = 0x707fe07a; /* 1024KB L2 cache */
136
- cpu->dcz_blocksize = 4; /* 64 bytes */
137
- cpu->gic_num_lrs = 4;
138
- cpu->gic_vpribits = 5;
139
- cpu->gic_vprebits = 5;
140
- cpu->gic_pribits = 5;
141
- define_cortex_a72_a57_a53_cp_reginfo(cpu);
33
-}
142
-}
34
-
143
-
35
-static void nvram_writel (void *opaque, hwaddr addr, uint32_t value)
144
-static void aarch64_a72_initfn(Object *obj)
36
-{
145
-{
37
- M48t59State *NVRAM = opaque;
146
- ARMCPU *cpu = ARM_CPU(obj);
38
-
147
-
39
- m48t59_write(NVRAM, addr, (value >> 24) & 0xff);
148
- cpu->dtb_compatible = "arm,cortex-a72";
40
- m48t59_write(NVRAM, addr + 1, (value >> 16) & 0xff);
149
- set_feature(&cpu->env, ARM_FEATURE_V8);
41
- m48t59_write(NVRAM, addr + 2, (value >> 8) & 0xff);
150
- set_feature(&cpu->env, ARM_FEATURE_NEON);
42
- m48t59_write(NVRAM, addr + 3, value & 0xff);
151
- set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER);
152
- set_feature(&cpu->env, ARM_FEATURE_AARCH64);
153
- set_feature(&cpu->env, ARM_FEATURE_CBAR_RO);
154
- set_feature(&cpu->env, ARM_FEATURE_EL2);
155
- set_feature(&cpu->env, ARM_FEATURE_EL3);
156
- set_feature(&cpu->env, ARM_FEATURE_PMU);
157
- cpu->midr = 0x410fd083;
158
- cpu->revidr = 0x00000000;
159
- cpu->reset_fpsid = 0x41034080;
160
- cpu->isar.mvfr0 = 0x10110222;
161
- cpu->isar.mvfr1 = 0x12111111;
162
- cpu->isar.mvfr2 = 0x00000043;
163
- cpu->ctr = 0x8444c004;
164
- cpu->reset_sctlr = 0x00c50838;
165
- cpu->isar.id_pfr0 = 0x00000131;
166
- cpu->isar.id_pfr1 = 0x00011011;
167
- cpu->isar.id_dfr0 = 0x03010066;
168
- cpu->id_afr0 = 0x00000000;
169
- cpu->isar.id_mmfr0 = 0x10201105;
170
- cpu->isar.id_mmfr1 = 0x40000000;
171
- cpu->isar.id_mmfr2 = 0x01260000;
172
- cpu->isar.id_mmfr3 = 0x02102211;
173
- cpu->isar.id_isar0 = 0x02101110;
174
- cpu->isar.id_isar1 = 0x13112111;
175
- cpu->isar.id_isar2 = 0x21232042;
176
- cpu->isar.id_isar3 = 0x01112131;
177
- cpu->isar.id_isar4 = 0x00011142;
178
- cpu->isar.id_isar5 = 0x00011121;
179
- cpu->isar.id_aa64pfr0 = 0x00002222;
180
- cpu->isar.id_aa64dfr0 = 0x10305106;
181
- cpu->isar.id_aa64isar0 = 0x00011120;
182
- cpu->isar.id_aa64mmfr0 = 0x00001124;
183
- cpu->isar.dbgdidr = 0x3516d000;
184
- cpu->isar.dbgdevid = 0x01110f13;
185
- cpu->isar.dbgdevid1 = 0x2;
186
- cpu->isar.reset_pmcr_el0 = 0x41023000;
187
- cpu->clidr = 0x0a200023;
188
- cpu->ccsidr[0] = 0x701fe00a; /* 32KB L1 dcache */
189
- cpu->ccsidr[1] = 0x201fe012; /* 48KB L1 icache */
190
- cpu->ccsidr[2] = 0x707fe07a; /* 1MB L2 cache */
191
- cpu->dcz_blocksize = 4; /* 64 bytes */
192
- cpu->gic_num_lrs = 4;
193
- cpu->gic_vpribits = 5;
194
- cpu->gic_vprebits = 5;
195
- cpu->gic_pribits = 5;
196
- define_cortex_a72_a57_a53_cp_reginfo(cpu);
43
-}
197
-}
44
-
198
-
45
-static uint32_t nvram_readb (void *opaque, hwaddr addr)
199
-static void aarch64_a76_initfn(Object *obj)
46
+static uint64_t nvram_read(void *opaque, hwaddr addr, unsigned size)
200
-{
201
- ARMCPU *cpu = ARM_CPU(obj);
202
-
203
- cpu->dtb_compatible = "arm,cortex-a76";
204
- set_feature(&cpu->env, ARM_FEATURE_V8);
205
- set_feature(&cpu->env, ARM_FEATURE_NEON);
206
- set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER);
207
- set_feature(&cpu->env, ARM_FEATURE_AARCH64);
208
- set_feature(&cpu->env, ARM_FEATURE_CBAR_RO);
209
- set_feature(&cpu->env, ARM_FEATURE_EL2);
210
- set_feature(&cpu->env, ARM_FEATURE_EL3);
211
- set_feature(&cpu->env, ARM_FEATURE_PMU);
212
-
213
- /* Ordered by B2.4 AArch64 registers by functional group */
214
- cpu->clidr = 0x82000023;
215
- cpu->ctr = 0x8444C004;
216
- cpu->dcz_blocksize = 4;
217
- cpu->isar.id_aa64dfr0 = 0x0000000010305408ull;
218
- cpu->isar.id_aa64isar0 = 0x0000100010211120ull;
219
- cpu->isar.id_aa64isar1 = 0x0000000000100001ull;
220
- cpu->isar.id_aa64mmfr0 = 0x0000000000101122ull;
221
- cpu->isar.id_aa64mmfr1 = 0x0000000010212122ull;
222
- cpu->isar.id_aa64mmfr2 = 0x0000000000001011ull;
223
- cpu->isar.id_aa64pfr0 = 0x1100000010111112ull; /* GIC filled in later */
224
- cpu->isar.id_aa64pfr1 = 0x0000000000000010ull;
225
- cpu->id_afr0 = 0x00000000;
226
- cpu->isar.id_dfr0 = 0x04010088;
227
- cpu->isar.id_isar0 = 0x02101110;
228
- cpu->isar.id_isar1 = 0x13112111;
229
- cpu->isar.id_isar2 = 0x21232042;
230
- cpu->isar.id_isar3 = 0x01112131;
231
- cpu->isar.id_isar4 = 0x00010142;
232
- cpu->isar.id_isar5 = 0x01011121;
233
- cpu->isar.id_isar6 = 0x00000010;
234
- cpu->isar.id_mmfr0 = 0x10201105;
235
- cpu->isar.id_mmfr1 = 0x40000000;
236
- cpu->isar.id_mmfr2 = 0x01260000;
237
- cpu->isar.id_mmfr3 = 0x02122211;
238
- cpu->isar.id_mmfr4 = 0x00021110;
239
- cpu->isar.id_pfr0 = 0x10010131;
240
- cpu->isar.id_pfr1 = 0x00010000; /* GIC filled in later */
241
- cpu->isar.id_pfr2 = 0x00000011;
242
- cpu->midr = 0x414fd0b1; /* r4p1 */
243
- cpu->revidr = 0;
244
-
245
- /* From B2.18 CCSIDR_EL1 */
246
- cpu->ccsidr[0] = 0x701fe01a; /* 64KB L1 dcache */
247
- cpu->ccsidr[1] = 0x201fe01a; /* 64KB L1 icache */
248
- cpu->ccsidr[2] = 0x707fe03a; /* 512KB L2 cache */
249
-
250
- /* From B2.93 SCTLR_EL3 */
251
- cpu->reset_sctlr = 0x30c50838;
252
-
253
- /* From B4.23 ICH_VTR_EL2 */
254
- cpu->gic_num_lrs = 4;
255
- cpu->gic_vpribits = 5;
256
- cpu->gic_vprebits = 5;
257
- cpu->gic_pribits = 5;
258
-
259
- /* From B5.1 AdvSIMD AArch64 register summary */
260
- cpu->isar.mvfr0 = 0x10110222;
261
- cpu->isar.mvfr1 = 0x13211111;
262
- cpu->isar.mvfr2 = 0x00000043;
263
-
264
- /* From D5.1 AArch64 PMU register summary */
265
- cpu->isar.reset_pmcr_el0 = 0x410b3000;
266
-}
267
-
268
-static void aarch64_neoverse_n1_initfn(Object *obj)
269
-{
270
- ARMCPU *cpu = ARM_CPU(obj);
271
-
272
- cpu->dtb_compatible = "arm,neoverse-n1";
273
- set_feature(&cpu->env, ARM_FEATURE_V8);
274
- set_feature(&cpu->env, ARM_FEATURE_NEON);
275
- set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER);
276
- set_feature(&cpu->env, ARM_FEATURE_AARCH64);
277
- set_feature(&cpu->env, ARM_FEATURE_CBAR_RO);
278
- set_feature(&cpu->env, ARM_FEATURE_EL2);
279
- set_feature(&cpu->env, ARM_FEATURE_EL3);
280
- set_feature(&cpu->env, ARM_FEATURE_PMU);
281
-
282
- /* Ordered by B2.4 AArch64 registers by functional group */
283
- cpu->clidr = 0x82000023;
284
- cpu->ctr = 0x8444c004;
285
- cpu->dcz_blocksize = 4;
286
- cpu->isar.id_aa64dfr0 = 0x0000000110305408ull;
287
- cpu->isar.id_aa64isar0 = 0x0000100010211120ull;
288
- cpu->isar.id_aa64isar1 = 0x0000000000100001ull;
289
- cpu->isar.id_aa64mmfr0 = 0x0000000000101125ull;
290
- cpu->isar.id_aa64mmfr1 = 0x0000000010212122ull;
291
- cpu->isar.id_aa64mmfr2 = 0x0000000000001011ull;
292
- cpu->isar.id_aa64pfr0 = 0x1100000010111112ull; /* GIC filled in later */
293
- cpu->isar.id_aa64pfr1 = 0x0000000000000020ull;
294
- cpu->id_afr0 = 0x00000000;
295
- cpu->isar.id_dfr0 = 0x04010088;
296
- cpu->isar.id_isar0 = 0x02101110;
297
- cpu->isar.id_isar1 = 0x13112111;
298
- cpu->isar.id_isar2 = 0x21232042;
299
- cpu->isar.id_isar3 = 0x01112131;
300
- cpu->isar.id_isar4 = 0x00010142;
301
- cpu->isar.id_isar5 = 0x01011121;
302
- cpu->isar.id_isar6 = 0x00000010;
303
- cpu->isar.id_mmfr0 = 0x10201105;
304
- cpu->isar.id_mmfr1 = 0x40000000;
305
- cpu->isar.id_mmfr2 = 0x01260000;
306
- cpu->isar.id_mmfr3 = 0x02122211;
307
- cpu->isar.id_mmfr4 = 0x00021110;
308
- cpu->isar.id_pfr0 = 0x10010131;
309
- cpu->isar.id_pfr1 = 0x00010000; /* GIC filled in later */
310
- cpu->isar.id_pfr2 = 0x00000011;
311
- cpu->midr = 0x414fd0c1; /* r4p1 */
312
- cpu->revidr = 0;
313
-
314
- /* From B2.23 CCSIDR_EL1 */
315
- cpu->ccsidr[0] = 0x701fe01a; /* 64KB L1 dcache */
316
- cpu->ccsidr[1] = 0x201fe01a; /* 64KB L1 icache */
317
- cpu->ccsidr[2] = 0x70ffe03a; /* 1MB L2 cache */
318
-
319
- /* From B2.98 SCTLR_EL3 */
320
- cpu->reset_sctlr = 0x30c50838;
321
-
322
- /* From B4.23 ICH_VTR_EL2 */
323
- cpu->gic_num_lrs = 4;
324
- cpu->gic_vpribits = 5;
325
- cpu->gic_vprebits = 5;
326
- cpu->gic_pribits = 5;
327
-
328
- /* From B5.1 AdvSIMD AArch64 register summary */
329
- cpu->isar.mvfr0 = 0x10110222;
330
- cpu->isar.mvfr1 = 0x13211111;
331
- cpu->isar.mvfr2 = 0x00000043;
332
-
333
- /* From D5.1 AArch64 PMU register summary */
334
- cpu->isar.reset_pmcr_el0 = 0x410c3000;
335
-}
336
-
337
void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp)
47
{
338
{
48
M48t59State *NVRAM = opaque;
339
/*
49
340
@@ -XXX,XX +XXX,XX @@ void arm_cpu_lpa2_finalize(ARMCPU *cpu, Error **errp)
50
return m48t59_read(NVRAM, addr);
341
cpu->isar.id_aa64mmfr0 = t;
51
}
342
}
52
343
53
-static uint32_t nvram_readw (void *opaque, hwaddr addr)
344
+static void aarch64_a57_initfn(Object *obj)
54
+static void nvram_write(void *opaque, hwaddr addr, uint64_t value,
345
+{
55
+ unsigned size)
346
+ ARMCPU *cpu = ARM_CPU(obj);
347
+
348
+ cpu->dtb_compatible = "arm,cortex-a57";
349
+ set_feature(&cpu->env, ARM_FEATURE_V8);
350
+ set_feature(&cpu->env, ARM_FEATURE_NEON);
351
+ set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER);
352
+ set_feature(&cpu->env, ARM_FEATURE_AARCH64);
353
+ set_feature(&cpu->env, ARM_FEATURE_CBAR_RO);
354
+ set_feature(&cpu->env, ARM_FEATURE_EL2);
355
+ set_feature(&cpu->env, ARM_FEATURE_EL3);
356
+ set_feature(&cpu->env, ARM_FEATURE_PMU);
357
+ cpu->kvm_target = QEMU_KVM_ARM_TARGET_CORTEX_A57;
358
+ cpu->midr = 0x411fd070;
359
+ cpu->revidr = 0x00000000;
360
+ cpu->reset_fpsid = 0x41034070;
361
+ cpu->isar.mvfr0 = 0x10110222;
362
+ cpu->isar.mvfr1 = 0x12111111;
363
+ cpu->isar.mvfr2 = 0x00000043;
364
+ cpu->ctr = 0x8444c004;
365
+ cpu->reset_sctlr = 0x00c50838;
366
+ cpu->isar.id_pfr0 = 0x00000131;
367
+ cpu->isar.id_pfr1 = 0x00011011;
368
+ cpu->isar.id_dfr0 = 0x03010066;
369
+ cpu->id_afr0 = 0x00000000;
370
+ cpu->isar.id_mmfr0 = 0x10101105;
371
+ cpu->isar.id_mmfr1 = 0x40000000;
372
+ cpu->isar.id_mmfr2 = 0x01260000;
373
+ cpu->isar.id_mmfr3 = 0x02102211;
374
+ cpu->isar.id_isar0 = 0x02101110;
375
+ cpu->isar.id_isar1 = 0x13112111;
376
+ cpu->isar.id_isar2 = 0x21232042;
377
+ cpu->isar.id_isar3 = 0x01112131;
378
+ cpu->isar.id_isar4 = 0x00011142;
379
+ cpu->isar.id_isar5 = 0x00011121;
380
+ cpu->isar.id_isar6 = 0;
381
+ cpu->isar.id_aa64pfr0 = 0x00002222;
382
+ cpu->isar.id_aa64dfr0 = 0x10305106;
383
+ cpu->isar.id_aa64isar0 = 0x00011120;
384
+ cpu->isar.id_aa64mmfr0 = 0x00001124;
385
+ cpu->isar.dbgdidr = 0x3516d000;
386
+ cpu->isar.dbgdevid = 0x01110f13;
387
+ cpu->isar.dbgdevid1 = 0x2;
388
+ cpu->isar.reset_pmcr_el0 = 0x41013000;
389
+ cpu->clidr = 0x0a200023;
390
+ cpu->ccsidr[0] = 0x701fe00a; /* 32KB L1 dcache */
391
+ cpu->ccsidr[1] = 0x201fe012; /* 48KB L1 icache */
392
+ cpu->ccsidr[2] = 0x70ffe07a; /* 2048KB L2 cache */
393
+ cpu->dcz_blocksize = 4; /* 64 bytes */
394
+ cpu->gic_num_lrs = 4;
395
+ cpu->gic_vpribits = 5;
396
+ cpu->gic_vprebits = 5;
397
+ cpu->gic_pribits = 5;
398
+ define_cortex_a72_a57_a53_cp_reginfo(cpu);
399
+}
400
+
401
+static void aarch64_a53_initfn(Object *obj)
402
+{
403
+ ARMCPU *cpu = ARM_CPU(obj);
404
+
405
+ cpu->dtb_compatible = "arm,cortex-a53";
406
+ set_feature(&cpu->env, ARM_FEATURE_V8);
407
+ set_feature(&cpu->env, ARM_FEATURE_NEON);
408
+ set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER);
409
+ set_feature(&cpu->env, ARM_FEATURE_AARCH64);
410
+ set_feature(&cpu->env, ARM_FEATURE_CBAR_RO);
411
+ set_feature(&cpu->env, ARM_FEATURE_EL2);
412
+ set_feature(&cpu->env, ARM_FEATURE_EL3);
413
+ set_feature(&cpu->env, ARM_FEATURE_PMU);
414
+ cpu->kvm_target = QEMU_KVM_ARM_TARGET_CORTEX_A53;
415
+ cpu->midr = 0x410fd034;
416
+ cpu->revidr = 0x00000000;
417
+ cpu->reset_fpsid = 0x41034070;
418
+ cpu->isar.mvfr0 = 0x10110222;
419
+ cpu->isar.mvfr1 = 0x12111111;
420
+ cpu->isar.mvfr2 = 0x00000043;
421
+ cpu->ctr = 0x84448004; /* L1Ip = VIPT */
422
+ cpu->reset_sctlr = 0x00c50838;
423
+ cpu->isar.id_pfr0 = 0x00000131;
424
+ cpu->isar.id_pfr1 = 0x00011011;
425
+ cpu->isar.id_dfr0 = 0x03010066;
426
+ cpu->id_afr0 = 0x00000000;
427
+ cpu->isar.id_mmfr0 = 0x10101105;
428
+ cpu->isar.id_mmfr1 = 0x40000000;
429
+ cpu->isar.id_mmfr2 = 0x01260000;
430
+ cpu->isar.id_mmfr3 = 0x02102211;
431
+ cpu->isar.id_isar0 = 0x02101110;
432
+ cpu->isar.id_isar1 = 0x13112111;
433
+ cpu->isar.id_isar2 = 0x21232042;
434
+ cpu->isar.id_isar3 = 0x01112131;
435
+ cpu->isar.id_isar4 = 0x00011142;
436
+ cpu->isar.id_isar5 = 0x00011121;
437
+ cpu->isar.id_isar6 = 0;
438
+ cpu->isar.id_aa64pfr0 = 0x00002222;
439
+ cpu->isar.id_aa64dfr0 = 0x10305106;
440
+ cpu->isar.id_aa64isar0 = 0x00011120;
441
+ cpu->isar.id_aa64mmfr0 = 0x00001122; /* 40 bit physical addr */
442
+ cpu->isar.dbgdidr = 0x3516d000;
443
+ cpu->isar.dbgdevid = 0x00110f13;
444
+ cpu->isar.dbgdevid1 = 0x1;
445
+ cpu->isar.reset_pmcr_el0 = 0x41033000;
446
+ cpu->clidr = 0x0a200023;
447
+ cpu->ccsidr[0] = 0x700fe01a; /* 32KB L1 dcache */
448
+ cpu->ccsidr[1] = 0x201fe00a; /* 32KB L1 icache */
449
+ cpu->ccsidr[2] = 0x707fe07a; /* 1024KB L2 cache */
450
+ cpu->dcz_blocksize = 4; /* 64 bytes */
451
+ cpu->gic_num_lrs = 4;
452
+ cpu->gic_vpribits = 5;
453
+ cpu->gic_vprebits = 5;
454
+ cpu->gic_pribits = 5;
455
+ define_cortex_a72_a57_a53_cp_reginfo(cpu);
456
+}
457
+
458
+static void aarch64_a72_initfn(Object *obj)
459
+{
460
+ ARMCPU *cpu = ARM_CPU(obj);
461
+
462
+ cpu->dtb_compatible = "arm,cortex-a72";
463
+ set_feature(&cpu->env, ARM_FEATURE_V8);
464
+ set_feature(&cpu->env, ARM_FEATURE_NEON);
465
+ set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER);
466
+ set_feature(&cpu->env, ARM_FEATURE_AARCH64);
467
+ set_feature(&cpu->env, ARM_FEATURE_CBAR_RO);
468
+ set_feature(&cpu->env, ARM_FEATURE_EL2);
469
+ set_feature(&cpu->env, ARM_FEATURE_EL3);
470
+ set_feature(&cpu->env, ARM_FEATURE_PMU);
471
+ cpu->midr = 0x410fd083;
472
+ cpu->revidr = 0x00000000;
473
+ cpu->reset_fpsid = 0x41034080;
474
+ cpu->isar.mvfr0 = 0x10110222;
475
+ cpu->isar.mvfr1 = 0x12111111;
476
+ cpu->isar.mvfr2 = 0x00000043;
477
+ cpu->ctr = 0x8444c004;
478
+ cpu->reset_sctlr = 0x00c50838;
479
+ cpu->isar.id_pfr0 = 0x00000131;
480
+ cpu->isar.id_pfr1 = 0x00011011;
481
+ cpu->isar.id_dfr0 = 0x03010066;
482
+ cpu->id_afr0 = 0x00000000;
483
+ cpu->isar.id_mmfr0 = 0x10201105;
484
+ cpu->isar.id_mmfr1 = 0x40000000;
485
+ cpu->isar.id_mmfr2 = 0x01260000;
486
+ cpu->isar.id_mmfr3 = 0x02102211;
487
+ cpu->isar.id_isar0 = 0x02101110;
488
+ cpu->isar.id_isar1 = 0x13112111;
489
+ cpu->isar.id_isar2 = 0x21232042;
490
+ cpu->isar.id_isar3 = 0x01112131;
491
+ cpu->isar.id_isar4 = 0x00011142;
492
+ cpu->isar.id_isar5 = 0x00011121;
493
+ cpu->isar.id_aa64pfr0 = 0x00002222;
494
+ cpu->isar.id_aa64dfr0 = 0x10305106;
495
+ cpu->isar.id_aa64isar0 = 0x00011120;
496
+ cpu->isar.id_aa64mmfr0 = 0x00001124;
497
+ cpu->isar.dbgdidr = 0x3516d000;
498
+ cpu->isar.dbgdevid = 0x01110f13;
499
+ cpu->isar.dbgdevid1 = 0x2;
500
+ cpu->isar.reset_pmcr_el0 = 0x41023000;
501
+ cpu->clidr = 0x0a200023;
502
+ cpu->ccsidr[0] = 0x701fe00a; /* 32KB L1 dcache */
503
+ cpu->ccsidr[1] = 0x201fe012; /* 48KB L1 icache */
504
+ cpu->ccsidr[2] = 0x707fe07a; /* 1MB L2 cache */
505
+ cpu->dcz_blocksize = 4; /* 64 bytes */
506
+ cpu->gic_num_lrs = 4;
507
+ cpu->gic_vpribits = 5;
508
+ cpu->gic_vprebits = 5;
509
+ cpu->gic_pribits = 5;
510
+ define_cortex_a72_a57_a53_cp_reginfo(cpu);
511
+}
512
+
513
+static void aarch64_a76_initfn(Object *obj)
514
+{
515
+ ARMCPU *cpu = ARM_CPU(obj);
516
+
517
+ cpu->dtb_compatible = "arm,cortex-a76";
518
+ set_feature(&cpu->env, ARM_FEATURE_V8);
519
+ set_feature(&cpu->env, ARM_FEATURE_NEON);
520
+ set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER);
521
+ set_feature(&cpu->env, ARM_FEATURE_AARCH64);
522
+ set_feature(&cpu->env, ARM_FEATURE_CBAR_RO);
523
+ set_feature(&cpu->env, ARM_FEATURE_EL2);
524
+ set_feature(&cpu->env, ARM_FEATURE_EL3);
525
+ set_feature(&cpu->env, ARM_FEATURE_PMU);
526
+
527
+ /* Ordered by B2.4 AArch64 registers by functional group */
528
+ cpu->clidr = 0x82000023;
529
+ cpu->ctr = 0x8444C004;
530
+ cpu->dcz_blocksize = 4;
531
+ cpu->isar.id_aa64dfr0 = 0x0000000010305408ull;
532
+ cpu->isar.id_aa64isar0 = 0x0000100010211120ull;
533
+ cpu->isar.id_aa64isar1 = 0x0000000000100001ull;
534
+ cpu->isar.id_aa64mmfr0 = 0x0000000000101122ull;
535
+ cpu->isar.id_aa64mmfr1 = 0x0000000010212122ull;
536
+ cpu->isar.id_aa64mmfr2 = 0x0000000000001011ull;
537
+ cpu->isar.id_aa64pfr0 = 0x1100000010111112ull; /* GIC filled in later */
538
+ cpu->isar.id_aa64pfr1 = 0x0000000000000010ull;
539
+ cpu->id_afr0 = 0x00000000;
540
+ cpu->isar.id_dfr0 = 0x04010088;
541
+ cpu->isar.id_isar0 = 0x02101110;
542
+ cpu->isar.id_isar1 = 0x13112111;
543
+ cpu->isar.id_isar2 = 0x21232042;
544
+ cpu->isar.id_isar3 = 0x01112131;
545
+ cpu->isar.id_isar4 = 0x00010142;
546
+ cpu->isar.id_isar5 = 0x01011121;
547
+ cpu->isar.id_isar6 = 0x00000010;
548
+ cpu->isar.id_mmfr0 = 0x10201105;
549
+ cpu->isar.id_mmfr1 = 0x40000000;
550
+ cpu->isar.id_mmfr2 = 0x01260000;
551
+ cpu->isar.id_mmfr3 = 0x02122211;
552
+ cpu->isar.id_mmfr4 = 0x00021110;
553
+ cpu->isar.id_pfr0 = 0x10010131;
554
+ cpu->isar.id_pfr1 = 0x00010000; /* GIC filled in later */
555
+ cpu->isar.id_pfr2 = 0x00000011;
556
+ cpu->midr = 0x414fd0b1; /* r4p1 */
557
+ cpu->revidr = 0;
558
+
559
+ /* From B2.18 CCSIDR_EL1 */
560
+ cpu->ccsidr[0] = 0x701fe01a; /* 64KB L1 dcache */
561
+ cpu->ccsidr[1] = 0x201fe01a; /* 64KB L1 icache */
562
+ cpu->ccsidr[2] = 0x707fe03a; /* 512KB L2 cache */
563
+
564
+ /* From B2.93 SCTLR_EL3 */
565
+ cpu->reset_sctlr = 0x30c50838;
566
+
567
+ /* From B4.23 ICH_VTR_EL2 */
568
+ cpu->gic_num_lrs = 4;
569
+ cpu->gic_vpribits = 5;
570
+ cpu->gic_vprebits = 5;
571
+ cpu->gic_pribits = 5;
572
+
573
+ /* From B5.1 AdvSIMD AArch64 register summary */
574
+ cpu->isar.mvfr0 = 0x10110222;
575
+ cpu->isar.mvfr1 = 0x13211111;
576
+ cpu->isar.mvfr2 = 0x00000043;
577
+
578
+ /* From D5.1 AArch64 PMU register summary */
579
+ cpu->isar.reset_pmcr_el0 = 0x410b3000;
580
+}
581
+
582
+static void aarch64_a64fx_initfn(Object *obj)
583
+{
584
+ ARMCPU *cpu = ARM_CPU(obj);
585
+
586
+ cpu->dtb_compatible = "arm,a64fx";
587
+ set_feature(&cpu->env, ARM_FEATURE_V8);
588
+ set_feature(&cpu->env, ARM_FEATURE_NEON);
589
+ set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER);
590
+ set_feature(&cpu->env, ARM_FEATURE_AARCH64);
591
+ set_feature(&cpu->env, ARM_FEATURE_EL2);
592
+ set_feature(&cpu->env, ARM_FEATURE_EL3);
593
+ set_feature(&cpu->env, ARM_FEATURE_PMU);
594
+ cpu->midr = 0x461f0010;
595
+ cpu->revidr = 0x00000000;
596
+ cpu->ctr = 0x86668006;
597
+ cpu->reset_sctlr = 0x30000180;
598
+ cpu->isar.id_aa64pfr0 = 0x0000000101111111; /* No RAS Extensions */
599
+ cpu->isar.id_aa64pfr1 = 0x0000000000000000;
600
+ cpu->isar.id_aa64dfr0 = 0x0000000010305408;
601
+ cpu->isar.id_aa64dfr1 = 0x0000000000000000;
602
+ cpu->id_aa64afr0 = 0x0000000000000000;
603
+ cpu->id_aa64afr1 = 0x0000000000000000;
604
+ cpu->isar.id_aa64mmfr0 = 0x0000000000001122;
605
+ cpu->isar.id_aa64mmfr1 = 0x0000000011212100;
606
+ cpu->isar.id_aa64mmfr2 = 0x0000000000001011;
607
+ cpu->isar.id_aa64isar0 = 0x0000000010211120;
608
+ cpu->isar.id_aa64isar1 = 0x0000000000010001;
609
+ cpu->isar.id_aa64zfr0 = 0x0000000000000000;
610
+ cpu->clidr = 0x0000000080000023;
611
+ cpu->ccsidr[0] = 0x7007e01c; /* 64KB L1 dcache */
612
+ cpu->ccsidr[1] = 0x2007e01c; /* 64KB L1 icache */
613
+ cpu->ccsidr[2] = 0x70ffe07c; /* 8MB L2 cache */
614
+ cpu->dcz_blocksize = 6; /* 256 bytes */
615
+ cpu->gic_num_lrs = 4;
616
+ cpu->gic_vpribits = 5;
617
+ cpu->gic_vprebits = 5;
618
+ cpu->gic_pribits = 5;
619
+
620
+ /* The A64FX supports only 128, 256 and 512 bit vector lengths */
621
+ aarch64_add_sve_properties(obj);
622
+ cpu->sve_vq.supported = (1 << 0) /* 128bit */
623
+ | (1 << 1) /* 256bit */
624
+ | (1 << 3); /* 512bit */
625
+
626
+ cpu->isar.reset_pmcr_el0 = 0x46014040;
627
+
628
+ /* TODO: Add A64FX specific HPC extension registers */
629
+}
630
+
631
+static void aarch64_neoverse_n1_initfn(Object *obj)
632
+{
633
+ ARMCPU *cpu = ARM_CPU(obj);
634
+
635
+ cpu->dtb_compatible = "arm,neoverse-n1";
636
+ set_feature(&cpu->env, ARM_FEATURE_V8);
637
+ set_feature(&cpu->env, ARM_FEATURE_NEON);
638
+ set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER);
639
+ set_feature(&cpu->env, ARM_FEATURE_AARCH64);
640
+ set_feature(&cpu->env, ARM_FEATURE_CBAR_RO);
641
+ set_feature(&cpu->env, ARM_FEATURE_EL2);
642
+ set_feature(&cpu->env, ARM_FEATURE_EL3);
643
+ set_feature(&cpu->env, ARM_FEATURE_PMU);
644
+
645
+ /* Ordered by B2.4 AArch64 registers by functional group */
646
+ cpu->clidr = 0x82000023;
647
+ cpu->ctr = 0x8444c004;
648
+ cpu->dcz_blocksize = 4;
649
+ cpu->isar.id_aa64dfr0 = 0x0000000110305408ull;
650
+ cpu->isar.id_aa64isar0 = 0x0000100010211120ull;
651
+ cpu->isar.id_aa64isar1 = 0x0000000000100001ull;
652
+ cpu->isar.id_aa64mmfr0 = 0x0000000000101125ull;
653
+ cpu->isar.id_aa64mmfr1 = 0x0000000010212122ull;
654
+ cpu->isar.id_aa64mmfr2 = 0x0000000000001011ull;
655
+ cpu->isar.id_aa64pfr0 = 0x1100000010111112ull; /* GIC filled in later */
656
+ cpu->isar.id_aa64pfr1 = 0x0000000000000020ull;
657
+ cpu->id_afr0 = 0x00000000;
658
+ cpu->isar.id_dfr0 = 0x04010088;
659
+ cpu->isar.id_isar0 = 0x02101110;
660
+ cpu->isar.id_isar1 = 0x13112111;
661
+ cpu->isar.id_isar2 = 0x21232042;
662
+ cpu->isar.id_isar3 = 0x01112131;
663
+ cpu->isar.id_isar4 = 0x00010142;
664
+ cpu->isar.id_isar5 = 0x01011121;
665
+ cpu->isar.id_isar6 = 0x00000010;
666
+ cpu->isar.id_mmfr0 = 0x10201105;
667
+ cpu->isar.id_mmfr1 = 0x40000000;
668
+ cpu->isar.id_mmfr2 = 0x01260000;
669
+ cpu->isar.id_mmfr3 = 0x02122211;
670
+ cpu->isar.id_mmfr4 = 0x00021110;
671
+ cpu->isar.id_pfr0 = 0x10010131;
672
+ cpu->isar.id_pfr1 = 0x00010000; /* GIC filled in later */
673
+ cpu->isar.id_pfr2 = 0x00000011;
674
+ cpu->midr = 0x414fd0c1; /* r4p1 */
675
+ cpu->revidr = 0;
676
+
677
+ /* From B2.23 CCSIDR_EL1 */
678
+ cpu->ccsidr[0] = 0x701fe01a; /* 64KB L1 dcache */
679
+ cpu->ccsidr[1] = 0x201fe01a; /* 64KB L1 icache */
680
+ cpu->ccsidr[2] = 0x70ffe03a; /* 1MB L2 cache */
681
+
682
+ /* From B2.98 SCTLR_EL3 */
683
+ cpu->reset_sctlr = 0x30c50838;
684
+
685
+ /* From B4.23 ICH_VTR_EL2 */
686
+ cpu->gic_num_lrs = 4;
687
+ cpu->gic_vpribits = 5;
688
+ cpu->gic_vprebits = 5;
689
+ cpu->gic_pribits = 5;
690
+
691
+ /* From B5.1 AdvSIMD AArch64 register summary */
692
+ cpu->isar.mvfr0 = 0x10110222;
693
+ cpu->isar.mvfr1 = 0x13211111;
694
+ cpu->isar.mvfr2 = 0x00000043;
695
+
696
+ /* From D5.1 AArch64 PMU register summary */
697
+ cpu->isar.reset_pmcr_el0 = 0x410c3000;
698
+}
699
+
700
static void aarch64_host_initfn(Object *obj)
56
{
701
{
57
M48t59State *NVRAM = opaque;
702
#if defined(CONFIG_KVM)
58
- uint32_t retval;
703
@@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj)
59
704
qdev_property_add_static(DEVICE(obj), &arm_cpu_lpa2_property);
60
- retval = m48t59_read(NVRAM, addr) << 8;
705
}
61
- retval |= m48t59_read(NVRAM, addr + 1);
706
62
- return retval;
707
-static void aarch64_a64fx_initfn(Object *obj)
708
-{
709
- ARMCPU *cpu = ARM_CPU(obj);
710
-
711
- cpu->dtb_compatible = "arm,a64fx";
712
- set_feature(&cpu->env, ARM_FEATURE_V8);
713
- set_feature(&cpu->env, ARM_FEATURE_NEON);
714
- set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER);
715
- set_feature(&cpu->env, ARM_FEATURE_AARCH64);
716
- set_feature(&cpu->env, ARM_FEATURE_EL2);
717
- set_feature(&cpu->env, ARM_FEATURE_EL3);
718
- set_feature(&cpu->env, ARM_FEATURE_PMU);
719
- cpu->midr = 0x461f0010;
720
- cpu->revidr = 0x00000000;
721
- cpu->ctr = 0x86668006;
722
- cpu->reset_sctlr = 0x30000180;
723
- cpu->isar.id_aa64pfr0 = 0x0000000101111111; /* No RAS Extensions */
724
- cpu->isar.id_aa64pfr1 = 0x0000000000000000;
725
- cpu->isar.id_aa64dfr0 = 0x0000000010305408;
726
- cpu->isar.id_aa64dfr1 = 0x0000000000000000;
727
- cpu->id_aa64afr0 = 0x0000000000000000;
728
- cpu->id_aa64afr1 = 0x0000000000000000;
729
- cpu->isar.id_aa64mmfr0 = 0x0000000000001122;
730
- cpu->isar.id_aa64mmfr1 = 0x0000000011212100;
731
- cpu->isar.id_aa64mmfr2 = 0x0000000000001011;
732
- cpu->isar.id_aa64isar0 = 0x0000000010211120;
733
- cpu->isar.id_aa64isar1 = 0x0000000000010001;
734
- cpu->isar.id_aa64zfr0 = 0x0000000000000000;
735
- cpu->clidr = 0x0000000080000023;
736
- cpu->ccsidr[0] = 0x7007e01c; /* 64KB L1 dcache */
737
- cpu->ccsidr[1] = 0x2007e01c; /* 64KB L1 icache */
738
- cpu->ccsidr[2] = 0x70ffe07c; /* 8MB L2 cache */
739
- cpu->dcz_blocksize = 6; /* 256 bytes */
740
- cpu->gic_num_lrs = 4;
741
- cpu->gic_vpribits = 5;
742
- cpu->gic_vprebits = 5;
743
- cpu->gic_pribits = 5;
744
-
745
- /* The A64FX supports only 128, 256 and 512 bit vector lengths */
746
- aarch64_add_sve_properties(obj);
747
- cpu->sve_vq.supported = (1 << 0) /* 128bit */
748
- | (1 << 1) /* 256bit */
749
- | (1 << 3); /* 512bit */
750
-
751
- cpu->isar.reset_pmcr_el0 = 0x46014040;
752
-
753
- /* TODO: Add A64FX specific HPC extension registers */
63
-}
754
-}
64
-
755
-
65
-static uint32_t nvram_readl (void *opaque, hwaddr addr)
756
static const ARMCPUInfo aarch64_cpus[] = {
66
-{
757
{ .name = "cortex-a35", .initfn = aarch64_a35_initfn },
67
- M48t59State *NVRAM = opaque;
758
{ .name = "cortex-a57", .initfn = aarch64_a57_initfn },
68
- uint32_t retval;
69
-
70
- retval = m48t59_read(NVRAM, addr) << 24;
71
- retval |= m48t59_read(NVRAM, addr + 1) << 16;
72
- retval |= m48t59_read(NVRAM, addr + 2) << 8;
73
- retval |= m48t59_read(NVRAM, addr + 3);
74
- return retval;
75
+ return m48t59_write(NVRAM, addr, value);
76
}
77
78
static const MemoryRegionOps nvram_ops = {
79
- .old_mmio = {
80
- .read = { nvram_readb, nvram_readw, nvram_readl, },
81
- .write = { nvram_writeb, nvram_writew, nvram_writel, },
82
- },
83
- .endianness = DEVICE_NATIVE_ENDIAN,
84
+ .read = nvram_read,
85
+ .write = nvram_write,
86
+ .impl.min_access_size = 1,
87
+ .impl.max_access_size = 1,
88
+ .valid.min_access_size = 1,
89
+ .valid.max_access_size = 4,
90
+ .endianness = DEVICE_BIG_ENDIAN,
91
};
92
93
static const VMStateDescription vmstate_m48t59 = {
94
--
759
--
95
2.18.0
760
2.25.1
96
761
97
762
diff view generated by jsdifflib
1
From: Roman Kapl <rka@sysgo.com>
1
From: Francisco Iglesias <francisco.iglesias@amd.com>
2
2
3
If an instruction is conditional (like CBZ) and it is executed
3
Connect ZynqMP's USB controllers.
4
conditionally (using the ITx instruction), a jump to an undefined
5
label is generated, and QEMU crashes.
6
4
7
CBZ in IT block is an UNPREDICTABLE behavior, but we should not
5
Signed-off-by: Francisco Iglesias <francisco.iglesias@amd.com>
8
crash. Honouring the condition code is allowed by the spec in this
6
Acked-by: Alistair Francis <alistair.francis@wdc.com>
9
case (constrained unpredictable, ARMv8, section K1.1.7), and matches
7
Message-id: 20220920081517.25401-1-frasse.iglesias@gmail.com
10
what we do for other "UNPREDICTABLE inside an IT block" instructions.
11
12
Fix the 'skip on condition' code to create a new label only if it
13
does not already exist. Previously multiple labels were created, but
14
only the last one of them was set.
15
16
Signed-off-by: Roman Kapl <rka@sysgo.com>
17
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
18
Message-id: 20180816120533.6587-1-rka@sysgo.com
19
[PMM: fixed ^ 1 being applied to wrong argument, fixed typo]
20
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
21
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
22
---
10
---
23
target/arm/translate.c | 35 +++++++++++++++++++++--------------
11
include/hw/arm/xlnx-zynqmp.h | 3 +++
24
1 file changed, 21 insertions(+), 14 deletions(-)
12
hw/arm/xlnx-zynqmp.c | 36 ++++++++++++++++++++++++++++++++++++
13
2 files changed, 39 insertions(+)
25
14
26
diff --git a/target/arm/translate.c b/target/arm/translate.c
15
diff --git a/include/hw/arm/xlnx-zynqmp.h b/include/hw/arm/xlnx-zynqmp.h
27
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
28
--- a/target/arm/translate.c
17
--- a/include/hw/arm/xlnx-zynqmp.h
29
+++ b/target/arm/translate.c
18
+++ b/include/hw/arm/xlnx-zynqmp.h
30
@@ -XXX,XX +XXX,XX @@ static void gen_srs(DisasContext *s,
19
@@ -XXX,XX +XXX,XX @@
31
s->base.is_jmp = DISAS_UPDATE;
20
#include "hw/misc/xlnx-zynqmp-apu-ctrl.h"
21
#include "hw/misc/xlnx-zynqmp-crf.h"
22
#include "hw/timer/cadence_ttc.h"
23
+#include "hw/usb/hcd-dwc3.h"
24
25
#define TYPE_XLNX_ZYNQMP "xlnx-zynqmp"
26
OBJECT_DECLARE_SIMPLE_TYPE(XlnxZynqMPState, XLNX_ZYNQMP)
27
@@ -XXX,XX +XXX,XX @@ OBJECT_DECLARE_SIMPLE_TYPE(XlnxZynqMPState, XLNX_ZYNQMP)
28
#define XLNX_ZYNQMP_NUM_SPIS 2
29
#define XLNX_ZYNQMP_NUM_GDMA_CH 8
30
#define XLNX_ZYNQMP_NUM_ADMA_CH 8
31
+#define XLNX_ZYNQMP_NUM_USB 2
32
33
#define XLNX_ZYNQMP_NUM_QSPI_BUS 2
34
#define XLNX_ZYNQMP_NUM_QSPI_BUS_CS 2
35
@@ -XXX,XX +XXX,XX @@ struct XlnxZynqMPState {
36
XlnxZynqMPAPUCtrl apu_ctrl;
37
XlnxZynqMPCRF crf;
38
CadenceTTCState ttc[XLNX_ZYNQMP_NUM_TTC];
39
+ USBDWC3 usb[XLNX_ZYNQMP_NUM_USB];
40
41
char *boot_cpu;
42
ARMCPU *boot_cpu_ptr;
43
diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c
44
index XXXXXXX..XXXXXXX 100644
45
--- a/hw/arm/xlnx-zynqmp.c
46
+++ b/hw/arm/xlnx-zynqmp.c
47
@@ -XXX,XX +XXX,XX @@ static const int adma_ch_intr[XLNX_ZYNQMP_NUM_ADMA_CH] = {
48
77, 78, 79, 80, 81, 82, 83, 84
49
};
50
51
+static const uint64_t usb_addr[XLNX_ZYNQMP_NUM_USB] = {
52
+ 0xFE200000, 0xFE300000
53
+};
54
+
55
+static const int usb_intr[XLNX_ZYNQMP_NUM_USB] = {
56
+ 65, 70
57
+};
58
+
59
typedef struct XlnxZynqMPGICRegion {
60
int region_index;
61
uint32_t address;
62
@@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_init(Object *obj)
63
object_initialize_child(obj, "qspi-dma", &s->qspi_dma, TYPE_XLNX_CSU_DMA);
64
object_initialize_child(obj, "qspi-irq-orgate",
65
&s->qspi_irq_orgate, TYPE_OR_IRQ);
66
+
67
+ for (i = 0; i < XLNX_ZYNQMP_NUM_USB; i++) {
68
+ object_initialize_child(obj, "usb[*]", &s->usb[i], TYPE_USB_DWC3);
69
+ }
32
}
70
}
33
71
34
+/* Generate a label used for skipping this instruction */
72
static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)
35
+static void arm_gen_condlabel(DisasContext *s)
73
@@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)
36
+{
74
object_property_add_alias(OBJECT(s), bus_name,
37
+ if (!s->condjmp) {
75
OBJECT(&s->qspi), target_bus);
38
+ s->condlabel = gen_new_label();
76
}
39
+ s->condjmp = 1;
77
+
78
+ for (i = 0; i < XLNX_ZYNQMP_NUM_USB; i++) {
79
+ if (!object_property_set_link(OBJECT(&s->usb[i].sysbus_xhci), "dma",
80
+ OBJECT(system_memory), errp)) {
81
+ return;
82
+ }
83
+
84
+ qdev_prop_set_uint32(DEVICE(&s->usb[i].sysbus_xhci), "intrs", 4);
85
+ qdev_prop_set_uint32(DEVICE(&s->usb[i].sysbus_xhci), "slots", 2);
86
+
87
+ if (!sysbus_realize(SYS_BUS_DEVICE(&s->usb[i]), errp)) {
88
+ return;
89
+ }
90
+
91
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->usb[i]), 0, usb_addr[i]);
92
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->usb[i].sysbus_xhci), 0,
93
+ gic_spi[usb_intr[i]]);
94
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->usb[i].sysbus_xhci), 1,
95
+ gic_spi[usb_intr[i] + 1]);
96
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->usb[i].sysbus_xhci), 2,
97
+ gic_spi[usb_intr[i] + 2]);
98
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->usb[i].sysbus_xhci), 3,
99
+ gic_spi[usb_intr[i] + 3]);
40
+ }
100
+ }
41
+}
101
}
42
+
102
43
+/* Skip this instruction if the ARM condition is false */
103
static Property xlnx_zynqmp_props[] = {
44
+static void arm_skip_unless(DisasContext *s, uint32_t cond)
45
+{
46
+ arm_gen_condlabel(s);
47
+ arm_gen_test_cc(cond ^ 1, s->condlabel);
48
+}
49
+
50
static void disas_arm_insn(DisasContext *s, unsigned int insn)
51
{
52
unsigned int cond, val, op1, i, shift, rm, rs, rn, rd, sh;
53
@@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
54
if (cond != 0xe) {
55
/* if not always execute, we generate a conditional jump to
56
next instruction */
57
- s->condlabel = gen_new_label();
58
- arm_gen_test_cc(cond ^ 1, s->condlabel);
59
- s->condjmp = 1;
60
+ arm_skip_unless(s, cond);
61
}
62
if ((insn & 0x0f900000) == 0x03000000) {
63
if ((insn & (1 << 21)) == 0) {
64
@@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn)
65
/* Conditional branch. */
66
op = (insn >> 22) & 0xf;
67
/* Generate a conditional jump to next instruction. */
68
- s->condlabel = gen_new_label();
69
- arm_gen_test_cc(op ^ 1, s->condlabel);
70
- s->condjmp = 1;
71
+ arm_skip_unless(s, op);
72
73
/* offset[11:1] = insn[10:0] */
74
offset = (insn & 0x7ff) << 1;
75
@@ -XXX,XX +XXX,XX @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn)
76
case 1: case 3: case 9: case 11: /* czb */
77
rm = insn & 7;
78
tmp = load_reg(s, rm);
79
- s->condlabel = gen_new_label();
80
- s->condjmp = 1;
81
+ arm_gen_condlabel(s);
82
if (insn & (1 << 11))
83
tcg_gen_brcondi_i32(TCG_COND_EQ, tmp, 0, s->condlabel);
84
else
85
@@ -XXX,XX +XXX,XX @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn)
86
break;
87
}
88
/* generate a conditional jump to next instruction */
89
- s->condlabel = gen_new_label();
90
- arm_gen_test_cc(cond ^ 1, s->condlabel);
91
- s->condjmp = 1;
92
+ arm_skip_unless(s, cond);
93
94
/* jump to the offset */
95
val = (uint32_t)s->pc + 2;
96
@@ -XXX,XX +XXX,XX @@ static void thumb_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
97
uint32_t cond = dc->condexec_cond;
98
99
if (cond != 0x0e) { /* Skip conditional when condition is AL. */
100
- dc->condlabel = gen_new_label();
101
- arm_gen_test_cc(cond ^ 1, dc->condlabel);
102
- dc->condjmp = 1;
103
+ arm_skip_unless(dc, cond);
104
}
105
}
106
107
--
104
--
108
2.18.0
105
2.25.1
109
110
diff view generated by jsdifflib
Deleted patch
1
From: Stefan Hajnoczi <stefanha@redhat.com>
2
1
3
The generic loader device supports the U-Boot and Intel HEX executable
4
formats in addition to the document raw and ELF formats. Reword the
5
documentation to include these formats and explain how various options
6
depend on the executable format.
7
8
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
10
Message-id: 20180816145554.9814-1-stefanha@redhat.com
11
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
14
docs/generic-loader.txt | 20 ++++++++++----------
15
1 file changed, 10 insertions(+), 10 deletions(-)
16
17
diff --git a/docs/generic-loader.txt b/docs/generic-loader.txt
18
index XXXXXXX..XXXXXXX 100644
19
--- a/docs/generic-loader.txt
20
+++ b/docs/generic-loader.txt
21
@@ -XXX,XX +XXX,XX @@ An example of setting CPU 0's PC to 0x8000 is:
22
23
Loading Files
24
-------------
25
-The loader device also allows files to be loaded into memory. It can load raw
26
-files and ELF executable files. Raw files are loaded verbatim. ELF executable
27
-files are loaded by an ELF loader. The syntax is shown below:
28
+The loader device also allows files to be loaded into memory. It can load ELF,
29
+U-Boot, and Intel HEX executable formats as well as raw images. The syntax is
30
+shown below:
31
32
-device loader,file=<file>[,addr=<addr>][,cpu-num=<cpu-num>][,force-raw=<raw>]
33
34
<file> - A file to be loaded into memory
35
- <addr> - The addr in memory that the file should be loaded. This is
36
- ignored if you are using an ELF (unless force-raw is true).
37
- This is required if you aren't loading an ELF.
38
+ <addr> - The memory address where the file should be loaded. This is
39
+ required for raw images and ignored for non-raw files.
40
<cpu-num> - This specifies the CPU that should be used. This is an
41
optional argument and will cause the CPU's PC to be set to
42
- where the image is stored or in the case of an ELF file to
43
- the value in the header. This option should only be used
44
- for the boot image.
45
+ the memory address where the raw file is loaded or the entry
46
+ point specified in the executable format header. This option
47
+ should only be used for the boot image.
48
This will also cause the image to be written to the specified
49
CPU's address space. If not specified, the default is CPU 0.
50
<force-raw> - Setting force-raw=on forces the file to be treated as a raw
51
- image. This can be used to load ELF files as if they were raw.
52
+ image. This can be used to load supported executable formats
53
+ as if they were raw.
54
55
All values are parsed using the standard QemuOps parsing. This allows the user
56
to specify any values in any format supported. By default the values
57
--
58
2.18.0
59
60
diff view generated by jsdifflib
1
From: Hans-Erik Floryd <hans-erik.floryd@rt-labs.com>
1
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
2
2
3
Generate an interrupt if USR2_RDR and UCR4_DREN are both set.
3
The devicetree specification requires a 'model' property in the root
4
node. Fix the corresponding dt-validate warning:
4
5
5
Signed-off-by: Hans-Erik Floryd <hans-erik.floryd@rt-labs.com>
6
/: 'model' is a required property
6
Message-id: 1534341354-11956-1-git-send-email-hans-erik.floryd@rt-labs.com
7
From schema: dtschema/schemas/root-node.yaml
8
9
Use the same name for model as for compatible. The specification
10
recommends that 'compatible' follows the format 'manufacturer,model' and
11
'model' follows the format 'manufacturer,model-number'. Since our
12
'compatible' doesn't observe this, 'model' doesn't really need to
13
either.
14
15
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
16
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
17
Reviewed-by: Eric Auger <eric.auger@redhat.com>
18
Message-id: 20220927100347.176606-2-jean-philippe@linaro.org
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
20
---
10
include/hw/char/imx_serial.h | 1 +
21
hw/arm/virt.c | 1 +
11
hw/char/imx_serial.c | 3 ++-
22
1 file changed, 1 insertion(+)
12
2 files changed, 3 insertions(+), 1 deletion(-)
13
23
14
diff --git a/include/hw/char/imx_serial.h b/include/hw/char/imx_serial.h
24
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
15
index XXXXXXX..XXXXXXX 100644
25
index XXXXXXX..XXXXXXX 100644
16
--- a/include/hw/char/imx_serial.h
26
--- a/hw/arm/virt.c
17
+++ b/include/hw/char/imx_serial.h
27
+++ b/hw/arm/virt.c
18
@@ -XXX,XX +XXX,XX @@
28
@@ -XXX,XX +XXX,XX @@ static void create_fdt(VirtMachineState *vms)
19
#define UCR2_RXEN (1<<1) /* Receiver enable */
29
qemu_fdt_setprop_string(fdt, "/", "compatible", "linux,dummy-virt");
20
#define UCR2_SRST (1<<0) /* Reset complete */
30
qemu_fdt_setprop_cell(fdt, "/", "#address-cells", 0x2);
21
31
qemu_fdt_setprop_cell(fdt, "/", "#size-cells", 0x2);
22
+#define UCR4_DREN BIT(0) /* Receive Data Ready interrupt enable */
32
+ qemu_fdt_setprop_string(fdt, "/", "model", "linux,dummy-virt");
23
#define UCR4_TCEN BIT(3) /* TX complete interrupt enable */
33
24
34
/* /chosen must exist for load_dtb to fill in necessary properties later */
25
#define UTS1_TXEMPTY (1<<6)
35
qemu_fdt_add_subnode(fdt, "/chosen");
26
diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c
27
index XXXXXXX..XXXXXXX 100644
28
--- a/hw/char/imx_serial.c
29
+++ b/hw/char/imx_serial.c
30
@@ -XXX,XX +XXX,XX @@ static void imx_update(IMXSerialState *s)
31
mask = (s->ucr1 & UCR1_TXMPTYEN) ? USR2_TXFE : 0;
32
/*
33
* TCEN and TXDC are both bit 3
34
+ * RDR and DREN are both bit 0
35
*/
36
- mask |= s->ucr4 & UCR4_TCEN;
37
+ mask |= s->ucr4 & (UCR4_TCEN | UCR4_DREN);
38
39
usr2 = s->usr2 & mask;
40
41
--
36
--
42
2.18.0
37
2.25.1
43
44
diff view generated by jsdifflib
1
The Arm Cortex-M System Design Kit includes a simple watchdog module
1
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
2
based on a 32-bit down-counter. Implement this.
3
2
3
The GICv3 bindings requires a #msi-cells property for the ITS node. Fix
4
the corresponding dt-validate warning:
5
6
interrupt-controller@8000000: msi-controller@8080000: '#msi-cells' is a required property
7
From schema: linux/Documentation/devicetree/bindings/interrupt-controller/arm,gic-v3.yaml
8
9
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Eric Auger <eric.auger@redhat.com>
12
Message-id: 20220927100347.176606-3-jean-philippe@linaro.org
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
---
14
---
6
Makefile.objs | 1 +
15
hw/arm/virt.c | 1 +
7
hw/watchdog/Makefile.objs | 1 +
16
1 file changed, 1 insertion(+)
8
include/hw/watchdog/cmsdk-apb-watchdog.h | 59 ++++
9
hw/watchdog/cmsdk-apb-watchdog.c | 326 +++++++++++++++++++++++
10
MAINTAINERS | 2 +
11
default-configs/arm-softmmu.mak | 1 +
12
hw/watchdog/trace-events | 6 +
13
7 files changed, 396 insertions(+)
14
create mode 100644 include/hw/watchdog/cmsdk-apb-watchdog.h
15
create mode 100644 hw/watchdog/cmsdk-apb-watchdog.c
16
create mode 100644 hw/watchdog/trace-events
17
17
18
diff --git a/Makefile.objs b/Makefile.objs
18
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
19
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
20
--- a/Makefile.objs
20
--- a/hw/arm/virt.c
21
+++ b/Makefile.objs
21
+++ b/hw/arm/virt.c
22
@@ -XXX,XX +XXX,XX @@ trace-events-subdirs += hw/tpm
22
@@ -XXX,XX +XXX,XX @@ static void fdt_add_its_gic_node(VirtMachineState *vms)
23
trace-events-subdirs += hw/usb
23
qemu_fdt_setprop_string(ms->fdt, nodename, "compatible",
24
trace-events-subdirs += hw/vfio
24
"arm,gic-v3-its");
25
trace-events-subdirs += hw/virtio
25
qemu_fdt_setprop(ms->fdt, nodename, "msi-controller", NULL, 0);
26
+trace-events-subdirs += hw/watchdog
26
+ qemu_fdt_setprop_cell(ms->fdt, nodename, "#msi-cells", 1);
27
trace-events-subdirs += hw/xen
27
qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg",
28
trace-events-subdirs += io
28
2, vms->memmap[VIRT_GIC_ITS].base,
29
trace-events-subdirs += linux-user
29
2, vms->memmap[VIRT_GIC_ITS].size);
30
diff --git a/hw/watchdog/Makefile.objs b/hw/watchdog/Makefile.objs
31
index XXXXXXX..XXXXXXX 100644
32
--- a/hw/watchdog/Makefile.objs
33
+++ b/hw/watchdog/Makefile.objs
34
@@ -XXX,XX +XXX,XX @@
35
common-obj-y += watchdog.o
36
+common-obj-$(CONFIG_CMSDK_APB_WATCHDOG) += cmsdk-apb-watchdog.o
37
common-obj-$(CONFIG_WDT_IB6300ESB) += wdt_i6300esb.o
38
common-obj-$(CONFIG_WDT_IB700) += wdt_ib700.o
39
common-obj-$(CONFIG_WDT_DIAG288) += wdt_diag288.o
40
diff --git a/include/hw/watchdog/cmsdk-apb-watchdog.h b/include/hw/watchdog/cmsdk-apb-watchdog.h
41
new file mode 100644
42
index XXXXXXX..XXXXXXX
43
--- /dev/null
44
+++ b/include/hw/watchdog/cmsdk-apb-watchdog.h
45
@@ -XXX,XX +XXX,XX @@
46
+/*
47
+ * ARM CMSDK APB watchdog emulation
48
+ *
49
+ * Copyright (c) 2018 Linaro Limited
50
+ * Written by Peter Maydell
51
+ *
52
+ * This program is free software; you can redistribute it and/or modify
53
+ * it under the terms of the GNU General Public License version 2 or
54
+ * (at your option) any later version.
55
+ */
56
+
57
+/*
58
+ * This is a model of the "APB watchdog" which is part of the Cortex-M
59
+ * System Design Kit (CMSDK) and documented in the Cortex-M System
60
+ * Design Kit Technical Reference Manual (ARM DDI0479C):
61
+ * https://developer.arm.com/products/system-design/system-design-kits/cortex-m-system-design-kit
62
+ *
63
+ * QEMU interface:
64
+ * + QOM property "wdogclk-frq": frequency at which the watchdog is clocked
65
+ * + sysbus MMIO region 0: the register bank
66
+ * + sysbus IRQ 0: watchdog interrupt
67
+ *
68
+ * In real hardware the watchdog's reset output is just a GPIO line
69
+ * which can then be masked by the board or treated as a simple interrupt.
70
+ * (For instance the IoTKit does this with the non-secure watchdog, so that
71
+ * secure code can control whether non-secure code can perform a system
72
+ * reset via its watchdog.) In QEMU, we just wire up the watchdog reset
73
+ * to watchdog_perform_action(), at least for the moment.
74
+ */
75
+
76
+#ifndef CMSDK_APB_WATCHDOG_H
77
+#define CMSDK_APB_WATCHDOG_H
78
+
79
+#include "hw/sysbus.h"
80
+#include "hw/ptimer.h"
81
+
82
+#define TYPE_CMSDK_APB_WATCHDOG "cmsdk-apb-watchdog"
83
+#define CMSDK_APB_WATCHDOG(obj) OBJECT_CHECK(CMSDKAPBWatchdog, (obj), \
84
+ TYPE_CMSDK_APB_WATCHDOG)
85
+
86
+typedef struct CMSDKAPBWatchdog {
87
+ /*< private >*/
88
+ SysBusDevice parent_obj;
89
+
90
+ /*< public >*/
91
+ MemoryRegion iomem;
92
+ qemu_irq wdogint;
93
+ uint32_t wdogclk_frq;
94
+ struct ptimer_state *timer;
95
+
96
+ uint32_t control;
97
+ uint32_t intstatus;
98
+ uint32_t lock;
99
+ uint32_t itcr;
100
+ uint32_t itop;
101
+ uint32_t resetstatus;
102
+} CMSDKAPBWatchdog;
103
+
104
+#endif
105
diff --git a/hw/watchdog/cmsdk-apb-watchdog.c b/hw/watchdog/cmsdk-apb-watchdog.c
106
new file mode 100644
107
index XXXXXXX..XXXXXXX
108
--- /dev/null
109
+++ b/hw/watchdog/cmsdk-apb-watchdog.c
110
@@ -XXX,XX +XXX,XX @@
111
+/*
112
+ * ARM CMSDK APB watchdog emulation
113
+ *
114
+ * Copyright (c) 2018 Linaro Limited
115
+ * Written by Peter Maydell
116
+ *
117
+ * This program is free software; you can redistribute it and/or modify
118
+ * it under the terms of the GNU General Public License version 2 or
119
+ * (at your option) any later version.
120
+ */
121
+
122
+/*
123
+ * This is a model of the "APB watchdog" which is part of the Cortex-M
124
+ * System Design Kit (CMSDK) and documented in the Cortex-M System
125
+ * Design Kit Technical Reference Manual (ARM DDI0479C):
126
+ * https://developer.arm.com/products/system-design/system-design-kits/cortex-m-system-design-kit
127
+ */
128
+
129
+#include "qemu/osdep.h"
130
+#include "qemu/log.h"
131
+#include "trace.h"
132
+#include "qapi/error.h"
133
+#include "qemu/main-loop.h"
134
+#include "sysemu/watchdog.h"
135
+#include "hw/sysbus.h"
136
+#include "hw/registerfields.h"
137
+#include "hw/watchdog/cmsdk-apb-watchdog.h"
138
+
139
+REG32(WDOGLOAD, 0x0)
140
+REG32(WDOGVALUE, 0x4)
141
+REG32(WDOGCONTROL, 0x8)
142
+ FIELD(WDOGCONTROL, INTEN, 0, 1)
143
+ FIELD(WDOGCONTROL, RESEN, 1, 1)
144
+#define R_WDOGCONTROL_VALID_MASK (R_WDOGCONTROL_INTEN_MASK | \
145
+ R_WDOGCONTROL_RESEN_MASK)
146
+REG32(WDOGINTCLR, 0xc)
147
+REG32(WDOGRIS, 0x10)
148
+ FIELD(WDOGRIS, INT, 0, 1)
149
+REG32(WDOGMIS, 0x14)
150
+REG32(WDOGLOCK, 0xc00)
151
+#define WDOG_UNLOCK_VALUE 0x1ACCE551
152
+REG32(WDOGITCR, 0xf00)
153
+ FIELD(WDOGITCR, ENABLE, 0, 1)
154
+#define R_WDOGITCR_VALID_MASK R_WDOGITCR_ENABLE_MASK
155
+REG32(WDOGITOP, 0xf04)
156
+ FIELD(WDOGITOP, WDOGRES, 0, 1)
157
+ FIELD(WDOGITOP, WDOGINT, 1, 1)
158
+#define R_WDOGITOP_VALID_MASK (R_WDOGITOP_WDOGRES_MASK | \
159
+ R_WDOGITOP_WDOGINT_MASK)
160
+REG32(PID4, 0xfd0)
161
+REG32(PID5, 0xfd4)
162
+REG32(PID6, 0xfd8)
163
+REG32(PID7, 0xfdc)
164
+REG32(PID0, 0xfe0)
165
+REG32(PID1, 0xfe4)
166
+REG32(PID2, 0xfe8)
167
+REG32(PID3, 0xfec)
168
+REG32(CID0, 0xff0)
169
+REG32(CID1, 0xff4)
170
+REG32(CID2, 0xff8)
171
+REG32(CID3, 0xffc)
172
+
173
+/* PID/CID values */
174
+static const int watchdog_id[] = {
175
+ 0x04, 0x00, 0x00, 0x00, /* PID4..PID7 */
176
+ 0x24, 0xb8, 0x1b, 0x00, /* PID0..PID3 */
177
+ 0x0d, 0xf0, 0x05, 0xb1, /* CID0..CID3 */
178
+};
179
+
180
+static bool cmsdk_apb_watchdog_intstatus(CMSDKAPBWatchdog *s)
181
+{
182
+ /* Return masked interrupt status */
183
+ return s->intstatus && (s->control & R_WDOGCONTROL_INTEN_MASK);
184
+}
185
+
186
+static bool cmsdk_apb_watchdog_resetstatus(CMSDKAPBWatchdog *s)
187
+{
188
+ /* Return masked reset status */
189
+ return s->resetstatus && (s->control & R_WDOGCONTROL_RESEN_MASK);
190
+}
191
+
192
+static void cmsdk_apb_watchdog_update(CMSDKAPBWatchdog *s)
193
+{
194
+ bool wdogint;
195
+ bool wdogres;
196
+
197
+ if (s->itcr) {
198
+ wdogint = s->itop & R_WDOGITOP_WDOGINT_MASK;
199
+ wdogres = s->itop & R_WDOGITOP_WDOGRES_MASK;
200
+ } else {
201
+ wdogint = cmsdk_apb_watchdog_intstatus(s);
202
+ wdogres = cmsdk_apb_watchdog_resetstatus(s);
203
+ }
204
+
205
+ qemu_set_irq(s->wdogint, wdogint);
206
+ if (wdogres) {
207
+ watchdog_perform_action();
208
+ }
209
+}
210
+
211
+static uint64_t cmsdk_apb_watchdog_read(void *opaque, hwaddr offset,
212
+ unsigned size)
213
+{
214
+ CMSDKAPBWatchdog *s = CMSDK_APB_WATCHDOG(opaque);
215
+ uint64_t r;
216
+
217
+ switch (offset) {
218
+ case A_WDOGLOAD:
219
+ r = ptimer_get_limit(s->timer);
220
+ break;
221
+ case A_WDOGVALUE:
222
+ r = ptimer_get_count(s->timer);
223
+ break;
224
+ case A_WDOGCONTROL:
225
+ r = s->control;
226
+ break;
227
+ case A_WDOGRIS:
228
+ r = s->intstatus;
229
+ break;
230
+ case A_WDOGMIS:
231
+ r = cmsdk_apb_watchdog_intstatus(s);
232
+ break;
233
+ case A_WDOGLOCK:
234
+ r = s->lock;
235
+ break;
236
+ case A_WDOGITCR:
237
+ r = s->itcr;
238
+ break;
239
+ case A_PID4 ... A_CID3:
240
+ r = watchdog_id[(offset - A_PID4) / 4];
241
+ break;
242
+ case A_WDOGINTCLR:
243
+ case A_WDOGITOP:
244
+ qemu_log_mask(LOG_GUEST_ERROR,
245
+ "CMSDK APB watchdog read: read of WO offset %x\n",
246
+ (int)offset);
247
+ r = 0;
248
+ break;
249
+ default:
250
+ qemu_log_mask(LOG_GUEST_ERROR,
251
+ "CMSDK APB watchdog read: bad offset %x\n", (int)offset);
252
+ r = 0;
253
+ break;
254
+ }
255
+ trace_cmsdk_apb_watchdog_read(offset, r, size);
256
+ return r;
257
+}
258
+
259
+static void cmsdk_apb_watchdog_write(void *opaque, hwaddr offset,
260
+ uint64_t value, unsigned size)
261
+{
262
+ CMSDKAPBWatchdog *s = CMSDK_APB_WATCHDOG(opaque);
263
+
264
+ trace_cmsdk_apb_watchdog_write(offset, value, size);
265
+
266
+ if (s->lock && offset != A_WDOGLOCK) {
267
+ /* Write access is disabled via WDOGLOCK */
268
+ qemu_log_mask(LOG_GUEST_ERROR,
269
+ "CMSDK APB watchdog write: write to locked watchdog\n");
270
+ return;
271
+ }
272
+
273
+ switch (offset) {
274
+ case A_WDOGLOAD:
275
+ /*
276
+ * Reset the load value and the current count, and make sure
277
+ * we're counting.
278
+ */
279
+ ptimer_set_limit(s->timer, value, 1);
280
+ ptimer_run(s->timer, 0);
281
+ break;
282
+ case A_WDOGCONTROL:
283
+ s->control = value & R_WDOGCONTROL_VALID_MASK;
284
+ cmsdk_apb_watchdog_update(s);
285
+ break;
286
+ case A_WDOGINTCLR:
287
+ s->intstatus = 0;
288
+ ptimer_set_count(s->timer, ptimer_get_limit(s->timer));
289
+ cmsdk_apb_watchdog_update(s);
290
+ break;
291
+ case A_WDOGLOCK:
292
+ s->lock = (value != WDOG_UNLOCK_VALUE);
293
+ break;
294
+ case A_WDOGITCR:
295
+ s->itcr = value & R_WDOGITCR_VALID_MASK;
296
+ cmsdk_apb_watchdog_update(s);
297
+ break;
298
+ case A_WDOGITOP:
299
+ s->itop = value & R_WDOGITOP_VALID_MASK;
300
+ cmsdk_apb_watchdog_update(s);
301
+ break;
302
+ case A_WDOGVALUE:
303
+ case A_WDOGRIS:
304
+ case A_WDOGMIS:
305
+ case A_PID4 ... A_CID3:
306
+ qemu_log_mask(LOG_GUEST_ERROR,
307
+ "CMSDK APB watchdog write: write to RO offset 0x%x\n",
308
+ (int)offset);
309
+ break;
310
+ default:
311
+ qemu_log_mask(LOG_GUEST_ERROR,
312
+ "CMSDK APB watchdog write: bad offset 0x%x\n",
313
+ (int)offset);
314
+ break;
315
+ }
316
+}
317
+
318
+static const MemoryRegionOps cmsdk_apb_watchdog_ops = {
319
+ .read = cmsdk_apb_watchdog_read,
320
+ .write = cmsdk_apb_watchdog_write,
321
+ .endianness = DEVICE_LITTLE_ENDIAN,
322
+ /* byte/halfword accesses are just zero-padded on reads and writes */
323
+ .impl.min_access_size = 4,
324
+ .impl.max_access_size = 4,
325
+ .valid.min_access_size = 1,
326
+ .valid.max_access_size = 4,
327
+};
328
+
329
+static void cmsdk_apb_watchdog_tick(void *opaque)
330
+{
331
+ CMSDKAPBWatchdog *s = CMSDK_APB_WATCHDOG(opaque);
332
+
333
+ if (!s->intstatus) {
334
+ /* Count expired for the first time: raise interrupt */
335
+ s->intstatus = R_WDOGRIS_INT_MASK;
336
+ } else {
337
+ /* Count expired for the second time: raise reset and stop clock */
338
+ s->resetstatus = 1;
339
+ ptimer_stop(s->timer);
340
+ }
341
+ cmsdk_apb_watchdog_update(s);
342
+}
343
+
344
+static void cmsdk_apb_watchdog_reset(DeviceState *dev)
345
+{
346
+ CMSDKAPBWatchdog *s = CMSDK_APB_WATCHDOG(dev);
347
+
348
+ trace_cmsdk_apb_watchdog_reset();
349
+ s->control = 0;
350
+ s->intstatus = 0;
351
+ s->lock = 0;
352
+ s->itcr = 0;
353
+ s->itop = 0;
354
+ s->resetstatus = 0;
355
+ /* Set the limit and the count */
356
+ ptimer_set_limit(s->timer, 0xffffffff, 1);
357
+ ptimer_run(s->timer, 0);
358
+}
359
+
360
+static void cmsdk_apb_watchdog_init(Object *obj)
361
+{
362
+ SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
363
+ CMSDKAPBWatchdog *s = CMSDK_APB_WATCHDOG(obj);
364
+
365
+ memory_region_init_io(&s->iomem, obj, &cmsdk_apb_watchdog_ops,
366
+ s, "cmsdk-apb-watchdog", 0x1000);
367
+ sysbus_init_mmio(sbd, &s->iomem);
368
+ sysbus_init_irq(sbd, &s->wdogint);
369
+}
370
+
371
+static void cmsdk_apb_watchdog_realize(DeviceState *dev, Error **errp)
372
+{
373
+ CMSDKAPBWatchdog *s = CMSDK_APB_WATCHDOG(dev);
374
+ QEMUBH *bh;
375
+
376
+ if (s->wdogclk_frq == 0) {
377
+ error_setg(errp,
378
+ "CMSDK APB watchdog: wdogclk-frq property must be set");
379
+ return;
380
+ }
381
+
382
+ bh = qemu_bh_new(cmsdk_apb_watchdog_tick, s);
383
+ s->timer = ptimer_init(bh,
384
+ PTIMER_POLICY_WRAP_AFTER_ONE_PERIOD |
385
+ PTIMER_POLICY_TRIGGER_ONLY_ON_DECREMENT |
386
+ PTIMER_POLICY_NO_IMMEDIATE_RELOAD |
387
+ PTIMER_POLICY_NO_COUNTER_ROUND_DOWN);
388
+
389
+ ptimer_set_freq(s->timer, s->wdogclk_frq);
390
+}
391
+
392
+static const VMStateDescription cmsdk_apb_watchdog_vmstate = {
393
+ .name = "cmsdk-apb-watchdog",
394
+ .version_id = 1,
395
+ .minimum_version_id = 1,
396
+ .fields = (VMStateField[]) {
397
+ VMSTATE_PTIMER(timer, CMSDKAPBWatchdog),
398
+ VMSTATE_UINT32(control, CMSDKAPBWatchdog),
399
+ VMSTATE_UINT32(intstatus, CMSDKAPBWatchdog),
400
+ VMSTATE_UINT32(lock, CMSDKAPBWatchdog),
401
+ VMSTATE_UINT32(itcr, CMSDKAPBWatchdog),
402
+ VMSTATE_UINT32(itop, CMSDKAPBWatchdog),
403
+ VMSTATE_UINT32(resetstatus, CMSDKAPBWatchdog),
404
+ VMSTATE_END_OF_LIST()
405
+ }
406
+};
407
+
408
+static Property cmsdk_apb_watchdog_properties[] = {
409
+ DEFINE_PROP_UINT32("wdogclk-frq", CMSDKAPBWatchdog, wdogclk_frq, 0),
410
+ DEFINE_PROP_END_OF_LIST(),
411
+};
412
+
413
+static void cmsdk_apb_watchdog_class_init(ObjectClass *klass, void *data)
414
+{
415
+ DeviceClass *dc = DEVICE_CLASS(klass);
416
+
417
+ dc->realize = cmsdk_apb_watchdog_realize;
418
+ dc->vmsd = &cmsdk_apb_watchdog_vmstate;
419
+ dc->reset = cmsdk_apb_watchdog_reset;
420
+ dc->props = cmsdk_apb_watchdog_properties;
421
+}
422
+
423
+static const TypeInfo cmsdk_apb_watchdog_info = {
424
+ .name = TYPE_CMSDK_APB_WATCHDOG,
425
+ .parent = TYPE_SYS_BUS_DEVICE,
426
+ .instance_size = sizeof(CMSDKAPBWatchdog),
427
+ .instance_init = cmsdk_apb_watchdog_init,
428
+ .class_init = cmsdk_apb_watchdog_class_init,
429
+};
430
+
431
+static void cmsdk_apb_watchdog_register_types(void)
432
+{
433
+ type_register_static(&cmsdk_apb_watchdog_info);
434
+}
435
+
436
+type_init(cmsdk_apb_watchdog_register_types);
437
diff --git a/MAINTAINERS b/MAINTAINERS
438
index XXXXXXX..XXXXXXX 100644
439
--- a/MAINTAINERS
440
+++ b/MAINTAINERS
441
@@ -XXX,XX +XXX,XX @@ F: hw/timer/cmsdk-apb-timer.c
442
F: include/hw/timer/cmsdk-apb-timer.h
443
F: hw/char/cmsdk-apb-uart.c
444
F: include/hw/char/cmsdk-apb-uart.h
445
+F: hw/watchdog/cmsdk-apb-watchdog.c
446
+F: include/hw/watchdog/cmsdk-apb-watchdog.h
447
F: hw/misc/tz-ppc.c
448
F: include/hw/misc/tz-ppc.h
449
F: hw/misc/tz-mpc.c
450
diff --git a/default-configs/arm-softmmu.mak b/default-configs/arm-softmmu.mak
451
index XXXXXXX..XXXXXXX 100644
452
--- a/default-configs/arm-softmmu.mak
453
+++ b/default-configs/arm-softmmu.mak
454
@@ -XXX,XX +XXX,XX @@ CONFIG_STM32F205_SOC=y
455
456
CONFIG_CMSDK_APB_TIMER=y
457
CONFIG_CMSDK_APB_UART=y
458
+CONFIG_CMSDK_APB_WATCHDOG=y
459
460
CONFIG_MPS2_FPGAIO=y
461
CONFIG_MPS2_SCC=y
462
diff --git a/hw/watchdog/trace-events b/hw/watchdog/trace-events
463
new file mode 100644
464
index XXXXXXX..XXXXXXX
465
--- /dev/null
466
+++ b/hw/watchdog/trace-events
467
@@ -XXX,XX +XXX,XX @@
468
+# See docs/devel/tracing.txt for syntax documentation.
469
+
470
+# hw/char/cmsdk_apb_watchdog.c
471
+cmsdk_apb_watchdog_read(uint64_t offset, uint64_t data, unsigned size) "CMSDK APB watchdog read: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u"
472
+cmsdk_apb_watchdog_write(uint64_t offset, uint64_t data, unsigned size) "CMSDK APB watchdog write: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u"
473
+cmsdk_apb_watchdog_reset(void) "CMSDK APB watchdog: reset"
474
--
30
--
475
2.18.0
31
2.25.1
476
477
diff view generated by jsdifflib
1
From: Jia He <hejianet@gmail.com>
1
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
2
2
3
In scripts/arch-run.bash of kvm-unit-tests, it will check the qemu
3
The "msi-parent" property can be used on the PCI node when MSIs do not
4
output log with:
4
contain sideband data (device IDs) [1]. In QEMU, MSI transactions
5
if [ -z "$(echo "$errors" | grep -vi warning)" ]; then
5
contain the requester ID, so the PCI node should use the "msi-map"
6
property instead of "msi-parent". In our case the property describes an
7
identity map between requester ID and sideband data.
6
8
7
Thus without the warning prefix, all of the test fail.
9
This fixes a warning when passing the DTB generated by QEMU to dtc,
10
following a recent change to the GICv3 node:
8
11
9
Since it is not unrecoverable error in kvm_arm_its_reset for
12
Warning (msi_parent_property): /pcie@10000000:msi-parent: property size (4) too small for cell size 1
10
current implementation, downgrading the report from error to
11
warn makes sense.
12
13
13
Signed-off-by: Jia He <jia.he@hxt-semitech.com>
14
[1] linux/Documentation/devicetree/bindings/pci/pci-msi.txt
14
Message-id: 1531969910-32843-1-git-send-email-jia.he@hxt-semitech.com
15
16
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
15
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
17
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
18
Reviewed-by: Eric Auger <eric.auger@redhat.com>
19
Message-id: 20220927100347.176606-4-jean-philippe@linaro.org
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
---
21
---
18
hw/intc/arm_gicv3_its_kvm.c | 2 +-
22
hw/arm/virt.c | 4 ++--
19
1 file changed, 1 insertion(+), 1 deletion(-)
23
1 file changed, 2 insertions(+), 2 deletions(-)
20
24
21
diff --git a/hw/intc/arm_gicv3_its_kvm.c b/hw/intc/arm_gicv3_its_kvm.c
25
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
22
index XXXXXXX..XXXXXXX 100644
26
index XXXXXXX..XXXXXXX 100644
23
--- a/hw/intc/arm_gicv3_its_kvm.c
27
--- a/hw/arm/virt.c
24
+++ b/hw/intc/arm_gicv3_its_kvm.c
28
+++ b/hw/arm/virt.c
25
@@ -XXX,XX +XXX,XX @@ static void kvm_arm_its_reset(DeviceState *dev)
29
@@ -XXX,XX +XXX,XX @@ static void create_pcie(VirtMachineState *vms)
26
return;
30
qemu_fdt_setprop(ms->fdt, nodename, "dma-coherent", NULL, 0);
31
32
if (vms->msi_phandle) {
33
- qemu_fdt_setprop_cells(ms->fdt, nodename, "msi-parent",
34
- vms->msi_phandle);
35
+ qemu_fdt_setprop_cells(ms->fdt, nodename, "msi-map",
36
+ 0, vms->msi_phandle, 0, 0x10000);
27
}
37
}
28
38
29
- error_report("ITS KVM: full reset is not supported by the host kernel");
39
qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg",
30
+ warn_report("ITS KVM: full reset is not supported by the host kernel");
31
32
if (!kvm_device_check_attr(s->dev_fd, KVM_DEV_ARM_VGIC_GRP_ITS_REGS,
33
GITS_CTLR)) {
34
--
40
--
35
2.18.0
41
2.25.1
36
37
diff view generated by jsdifflib
1
From: Andrew Jones <drjones@redhat.com>
1
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
2
2
3
Signed-off-by: Andrew Jones <drjones@redhat.com>
3
The SMMUv3 node isn't expected to have clock properties
4
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
4
(unlike the SMMUv2). Fix the corresponding dt-validate warning:
5
6
smmuv3@9050000: 'clock-names', 'clocks' do not match any of the regexes: 'pinctrl-[0-9]+'
7
From schema: linux/Documentation/devicetree/bindings/iommu/arm,smmu-v3.yaml
8
9
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
5
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
[PMM: tweaked commit message as suggested by Eric]
12
Reviewed-by: Eric Auger <eric.auger@redhat.com>
13
Message-id: 20220927100347.176606-7-jean-philippe@linaro.org
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
---
15
---
8
hw/arm/virt.c | 23 +++++++++++++++++------
16
hw/arm/virt.c | 2 --
9
1 file changed, 17 insertions(+), 6 deletions(-)
17
1 file changed, 2 deletions(-)
10
18
11
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
19
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
12
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
13
--- a/hw/arm/virt.c
21
--- a/hw/arm/virt.c
14
+++ b/hw/arm/virt.c
22
+++ b/hw/arm/virt.c
15
@@ -XXX,XX +XXX,XX @@ static void machvirt_machine_init(void)
23
@@ -XXX,XX +XXX,XX @@ static void create_smmu(const VirtMachineState *vms,
16
}
24
qemu_fdt_setprop(ms->fdt, node, "interrupt-names", irq_names,
17
type_init(machvirt_machine_init);
25
sizeof(irq_names));
18
26
19
-#define VIRT_COMPAT_2_12 \
27
- qemu_fdt_setprop_cell(ms->fdt, node, "clocks", vms->clock_phandle);
20
- HW_COMPAT_2_12
28
- qemu_fdt_setprop_string(ms->fdt, node, "clock-names", "apb_pclk");
21
-
29
qemu_fdt_setprop(ms->fdt, node, "dma-coherent", NULL, 0);
22
-static void virt_3_0_instance_init(Object *obj)
30
23
+static void virt_3_1_instance_init(Object *obj)
31
qemu_fdt_setprop_cell(ms->fdt, node, "#iommu-cells", 1);
24
{
25
VirtMachineState *vms = VIRT_MACHINE(obj);
26
VirtMachineClass *vmc = VIRT_MACHINE_GET_CLASS(vms);
27
@@ -XXX,XX +XXX,XX @@ static void virt_3_0_instance_init(Object *obj)
28
vms->irqmap = a15irqmap;
29
}
30
31
-static void virt_machine_3_0_options(MachineClass *mc)
32
+static void virt_machine_3_1_options(MachineClass *mc)
33
{
34
}
35
-DEFINE_VIRT_MACHINE_AS_LATEST(3, 0)
36
+DEFINE_VIRT_MACHINE_AS_LATEST(3, 1)
37
+
38
+static void virt_3_0_instance_init(Object *obj)
39
+{
40
+ virt_3_1_instance_init(obj);
41
+}
42
+
43
+static void virt_machine_3_0_options(MachineClass *mc)
44
+{
45
+ virt_machine_3_1_options(mc);
46
+}
47
+DEFINE_VIRT_MACHINE(3, 0)
48
+
49
+#define VIRT_COMPAT_2_12 \
50
+ HW_COMPAT_2_12
51
52
static void virt_2_12_instance_init(Object *obj)
53
{
54
--
32
--
55
2.18.0
33
2.25.1
56
57
diff view generated by jsdifflib
1
Implement the AArch32 HVBAR register; we can do this just by
1
From: Jerome Forissier <jerome.forissier@linaro.org>
2
making the existing VBAR_EL2 regdefs be STATE_BOTH.
3
2
3
SP_EL1 must be kept when EL3 is present but EL2 is not. Therefore mark
4
it with ARM_CP_EL3_NO_EL2_KEEP.
5
6
Cc: qemu-stable@nongnu.org
7
Fixes: 696ba3771894 ("target/arm: Handle cpreg registration for missing EL")
8
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Message-id: 20220927120058.670901-1-jerome.forissier@linaro.org
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
6
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
7
Message-id: 20180814124254.5229-5-peter.maydell@linaro.org
8
---
12
---
9
target/arm/helper.c | 4 ++--
13
target/arm/helper.c | 2 +-
10
1 file changed, 2 insertions(+), 2 deletions(-)
14
1 file changed, 1 insertion(+), 1 deletion(-)
11
15
12
diff --git a/target/arm/helper.c b/target/arm/helper.c
16
diff --git a/target/arm/helper.c b/target/arm/helper.c
13
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
14
--- a/target/arm/helper.c
18
--- a/target/arm/helper.c
15
+++ b/target/arm/helper.c
19
+++ b/target/arm/helper.c
16
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = {
20
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = {
17
21
.fieldoffset = offsetof(CPUARMState, sp_el[0]) },
18
/* Used to describe the behaviour of EL2 regs when EL2 does not exist. */
22
{ .name = "SP_EL1", .state = ARM_CP_STATE_AA64,
19
static const ARMCPRegInfo el3_no_el2_cp_reginfo[] = {
23
.opc0 = 3, .opc1 = 4, .crn = 4, .crm = 1, .opc2 = 0,
20
- { .name = "VBAR_EL2", .state = ARM_CP_STATE_AA64,
24
- .access = PL2_RW, .type = ARM_CP_ALIAS,
21
+ { .name = "VBAR_EL2", .state = ARM_CP_STATE_BOTH,
25
+ .access = PL2_RW, .type = ARM_CP_ALIAS | ARM_CP_EL3_NO_EL2_KEEP,
22
.opc0 = 3, .opc1 = 4, .crn = 12, .crm = 0, .opc2 = 0,
26
.fieldoffset = offsetof(CPUARMState, sp_el[1]) },
23
.access = PL2_RW,
27
{ .name = "SPSel", .state = ARM_CP_STATE_AA64,
24
.readfn = arm_cp_read_zero, .writefn = arm_cp_write_ignore },
28
.opc0 = 3, .opc1 = 0, .crn = 4, .crm = 2, .opc2 = 0,
25
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el2_cp_reginfo[] = {
26
.opc0 = 3, .opc1 = 4, .crn = 4, .crm = 0, .opc2 = 0,
27
.access = PL2_RW,
28
.fieldoffset = offsetof(CPUARMState, banked_spsr[BANK_HYP]) },
29
- { .name = "VBAR_EL2", .state = ARM_CP_STATE_AA64,
30
+ { .name = "VBAR_EL2", .state = ARM_CP_STATE_BOTH,
31
.opc0 = 3, .opc1 = 4, .crn = 12, .crm = 0, .opc2 = 0,
32
.access = PL2_RW, .writefn = vbar_write,
33
.fieldoffset = offsetof(CPUARMState, cp15.vbar_el[2]),
34
--
29
--
35
2.18.0
30
2.25.1
36
37
diff view generated by jsdifflib
Deleted patch
1
The AArch32 virtualization extensions support these fault address
2
registers:
3
* HDFAR: aliased with AArch64 FAR_EL2[31:0] and AArch32 DFAR(S)
4
* HIFAR: aliased with AArch64 FAR_EL2[63:32] and AArch32 IFAR(S)
5
1
6
Implement the accessors for these. This fixes in passing a bug
7
where we weren't implementing the "RES0 from EL3 if EL2 not
8
implemented" behaviour for AArch64 FAR_EL2.
9
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
12
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
13
Message-id: 20180814124254.5229-7-peter.maydell@linaro.org
14
---
15
target/arm/helper.c | 14 +++++++++++++-
16
1 file changed, 13 insertions(+), 1 deletion(-)
17
18
diff --git a/target/arm/helper.c b/target/arm/helper.c
19
index XXXXXXX..XXXXXXX 100644
20
--- a/target/arm/helper.c
21
+++ b/target/arm/helper.c
22
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el3_no_el2_cp_reginfo[] = {
23
{ .name = "HSTR_EL2", .state = ARM_CP_STATE_BOTH,
24
.opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 3,
25
.access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
26
+ { .name = "FAR_EL2", .state = ARM_CP_STATE_BOTH,
27
+ .opc0 = 3, .opc1 = 4, .crn = 6, .crm = 0, .opc2 = 0,
28
+ .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
29
+ { .name = "HIFAR", .state = ARM_CP_STATE_AA32,
30
+ .type = ARM_CP_CONST,
31
+ .cp = 15, .opc1 = 4, .crn = 6, .crm = 0, .opc2 = 2,
32
+ .access = PL2_RW, .resetvalue = 0 },
33
REGINFO_SENTINEL
34
};
35
36
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el2_cp_reginfo[] = {
37
{ .name = "ESR_EL2", .state = ARM_CP_STATE_AA64,
38
.opc0 = 3, .opc1 = 4, .crn = 5, .crm = 2, .opc2 = 0,
39
.access = PL2_RW, .fieldoffset = offsetof(CPUARMState, cp15.esr_el[2]) },
40
- { .name = "FAR_EL2", .state = ARM_CP_STATE_AA64,
41
+ { .name = "FAR_EL2", .state = ARM_CP_STATE_BOTH,
42
.opc0 = 3, .opc1 = 4, .crn = 6, .crm = 0, .opc2 = 0,
43
.access = PL2_RW, .fieldoffset = offsetof(CPUARMState, cp15.far_el[2]) },
44
+ { .name = "HIFAR", .state = ARM_CP_STATE_AA32,
45
+ .type = ARM_CP_ALIAS,
46
+ .cp = 15, .opc1 = 4, .crn = 6, .crm = 0, .opc2 = 2,
47
+ .access = PL2_RW,
48
+ .fieldoffset = offsetofhigh32(CPUARMState, cp15.far_el[2]) },
49
{ .name = "SPSR_EL2", .state = ARM_CP_STATE_AA64,
50
.type = ARM_CP_ALIAS,
51
.opc0 = 3, .opc1 = 4, .crn = 4, .crm = 0, .opc2 = 0,
52
--
53
2.18.0
54
55
diff view generated by jsdifflib
Deleted patch
1
The AArch32 HSR is the equivalent of AArch64 ESR_EL2;
2
we can implement it by marking our existing ESR_EL2 regdef
3
as STATE_BOTH. It also needs to be "RES0 from EL3 if
4
EL2 not implemented", so add the missing stanza to
5
el3_no_el2_cp_reginfo.
6
1
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
9
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
10
Message-id: 20180814124254.5229-8-peter.maydell@linaro.org
11
---
12
target/arm/helper.c | 6 +++++-
13
1 file changed, 5 insertions(+), 1 deletion(-)
14
15
diff --git a/target/arm/helper.c b/target/arm/helper.c
16
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/helper.c
18
+++ b/target/arm/helper.c
19
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el3_no_el2_cp_reginfo[] = {
20
.opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 0,
21
.access = PL2_RW,
22
.readfn = arm_cp_read_zero, .writefn = arm_cp_write_ignore },
23
+ { .name = "ESR_EL2", .state = ARM_CP_STATE_BOTH,
24
+ .opc0 = 3, .opc1 = 4, .crn = 5, .crm = 2, .opc2 = 0,
25
+ .access = PL2_RW,
26
+ .type = ARM_CP_CONST, .resetvalue = 0 },
27
{ .name = "CPTR_EL2", .state = ARM_CP_STATE_BOTH,
28
.opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 2,
29
.access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
30
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el2_cp_reginfo[] = {
31
.opc0 = 3, .opc1 = 4, .crn = 4, .crm = 0, .opc2 = 1,
32
.access = PL2_RW,
33
.fieldoffset = offsetof(CPUARMState, elr_el[2]) },
34
- { .name = "ESR_EL2", .state = ARM_CP_STATE_AA64,
35
+ { .name = "ESR_EL2", .state = ARM_CP_STATE_BOTH,
36
.opc0 = 3, .opc1 = 4, .crn = 5, .crm = 2, .opc2 = 0,
37
.access = PL2_RW, .fieldoffset = offsetof(CPUARMState, cp15.esr_el[2]) },
38
{ .name = "FAR_EL2", .state = ARM_CP_STATE_BOTH,
39
--
40
2.18.0
41
42
diff view generated by jsdifflib
Deleted patch
1
The MSR (banked) and MRS (banked) instructions allow accesses to ELR_Hyp
2
from either Monitor or Hyp mode. Our translate time check
3
was overly strict and only permitted access from Monitor mode.
4
1
5
The runtime check we do in msr_mrs_banked_exc_checks() had the
6
correct code in it, but never got there because of the earlier
7
"currmode == tgtmode" check. Special case ELR_Hyp.
8
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
11
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
12
Message-id: 20180814124254.5229-9-peter.maydell@linaro.org
13
---
14
target/arm/op_helper.c | 22 +++++++++++-----------
15
target/arm/translate.c | 10 +++++++---
16
2 files changed, 18 insertions(+), 14 deletions(-)
17
18
diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c
19
index XXXXXXX..XXXXXXX 100644
20
--- a/target/arm/op_helper.c
21
+++ b/target/arm/op_helper.c
22
@@ -XXX,XX +XXX,XX @@ static void msr_mrs_banked_exc_checks(CPUARMState *env, uint32_t tgtmode,
23
*/
24
int curmode = env->uncached_cpsr & CPSR_M;
25
26
+ if (regno == 17) {
27
+ /* ELR_Hyp: a special case because access from tgtmode is OK */
28
+ if (curmode != ARM_CPU_MODE_HYP && curmode != ARM_CPU_MODE_MON) {
29
+ goto undef;
30
+ }
31
+ return;
32
+ }
33
+
34
if (curmode == tgtmode) {
35
goto undef;
36
}
37
@@ -XXX,XX +XXX,XX @@ static void msr_mrs_banked_exc_checks(CPUARMState *env, uint32_t tgtmode,
38
}
39
40
if (tgtmode == ARM_CPU_MODE_HYP) {
41
- switch (regno) {
42
- case 17: /* ELR_Hyp */
43
- if (curmode != ARM_CPU_MODE_HYP && curmode != ARM_CPU_MODE_MON) {
44
- goto undef;
45
- }
46
- break;
47
- default:
48
- if (curmode != ARM_CPU_MODE_MON) {
49
- goto undef;
50
- }
51
- break;
52
+ /* SPSR_Hyp, r13_hyp: accessible from Monitor mode only */
53
+ if (curmode != ARM_CPU_MODE_MON) {
54
+ goto undef;
55
}
56
}
57
58
diff --git a/target/arm/translate.c b/target/arm/translate.c
59
index XXXXXXX..XXXXXXX 100644
60
--- a/target/arm/translate.c
61
+++ b/target/arm/translate.c
62
@@ -XXX,XX +XXX,XX @@ static bool msr_banked_access_decode(DisasContext *s, int r, int sysm, int rn,
63
}
64
break;
65
case ARM_CPU_MODE_HYP:
66
- /* Note that we can forbid accesses from EL2 here because they
67
- * must be from Hyp mode itself
68
+ /*
69
+ * SPSR_hyp and r13_hyp can only be accessed from Monitor mode
70
+ * (and so we can forbid accesses from EL2 or below). elr_hyp
71
+ * can be accessed also from Hyp mode, so forbid accesses from
72
+ * EL0 or EL1.
73
*/
74
- if (!arm_dc_feature(s, ARM_FEATURE_EL2) || s->current_el < 3) {
75
+ if (!arm_dc_feature(s, ARM_FEATURE_EL2) || s->current_el < 2 ||
76
+ (s->current_el < 3 && *regno != 17)) {
77
goto undef;
78
}
79
break;
80
--
81
2.18.0
82
83
diff view generated by jsdifflib
Deleted patch
1
ARMv7VE introduced the ERET instruction, which is necessary to
2
return from an exception taken to Hyp mode. Implement this.
3
In A32 encoding it is a completely new encoding; in T32 it
4
is an adjustment of the behaviour of the existing
5
"SUBS PC, LR, #<imm8>" instruction.
6
1
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
9
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
10
Message-id: 20180814124254.5229-10-peter.maydell@linaro.org
11
---
12
target/arm/translate.c | 31 +++++++++++++++++++++++++++++--
13
1 file changed, 29 insertions(+), 2 deletions(-)
14
15
diff --git a/target/arm/translate.c b/target/arm/translate.c
16
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/translate.c
18
+++ b/target/arm/translate.c
19
@@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
20
tcg_temp_free_i32(tmp2);
21
store_reg(s, rd, tmp);
22
break;
23
+ case 0x6: /* ERET */
24
+ if (op1 != 3) {
25
+ goto illegal_op;
26
+ }
27
+ if (!arm_dc_feature(s, ARM_FEATURE_V7VE)) {
28
+ goto illegal_op;
29
+ }
30
+ if ((insn & 0x000fff0f) != 0x0000000e) {
31
+ /* UNPREDICTABLE; we choose to UNDEF */
32
+ goto illegal_op;
33
+ }
34
+
35
+ if (s->current_el == 2) {
36
+ tmp = load_cpu_field(elr_el[2]);
37
+ } else {
38
+ tmp = load_reg(s, 14);
39
+ }
40
+ gen_exception_return(s, tmp);
41
+ break;
42
case 7:
43
{
44
int imm16 = extract32(insn, 0, 4) | (extract32(insn, 8, 12) << 4);
45
@@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn)
46
if (rn != 14 || rd != 15) {
47
goto illegal_op;
48
}
49
- tmp = load_reg(s, rn);
50
- tcg_gen_subi_i32(tmp, tmp, insn & 0xff);
51
+ if (s->current_el == 2) {
52
+ /* ERET from Hyp uses ELR_Hyp, not LR */
53
+ if (insn & 0xff) {
54
+ goto illegal_op;
55
+ }
56
+ tmp = load_cpu_field(elr_el[2]);
57
+ } else {
58
+ tmp = load_reg(s, rn);
59
+ tcg_gen_subi_i32(tmp, tmp, insn & 0xff);
60
+ }
61
gen_exception_return(s, tmp);
62
break;
63
case 6: /* MRS */
64
--
65
2.18.0
66
67
diff view generated by jsdifflib
Deleted patch
1
From: Hans-Erik Floryd <hans-erik.floryd@rt-labs.com>
2
1
3
Add the ESDHC PRSSTAT_SDSTB bit, using the value of SDHC_CLOCK_INT_STABLE.
4
Freescale recommends checking this bit when changing clock frequency.
5
6
Signed-off-by: Hans-Erik Floryd <hans-erik.floryd@rt-labs.com>
7
Message-id: 1534507843-4251-1-git-send-email-hans-erik.floryd@rt-labs.com
8
[PMM: fixed indentation]
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
12
hw/sd/sdhci-internal.h | 2 ++
13
hw/sd/sdhci.c | 8 ++++++++
14
2 files changed, 10 insertions(+)
15
16
diff --git a/hw/sd/sdhci-internal.h b/hw/sd/sdhci-internal.h
17
index XXXXXXX..XXXXXXX 100644
18
--- a/hw/sd/sdhci-internal.h
19
+++ b/hw/sd/sdhci-internal.h
20
@@ -XXX,XX +XXX,XX @@ extern const VMStateDescription sdhci_vmstate;
21
#define ESDHC_CTRL_4BITBUS (0x1 << 1)
22
#define ESDHC_CTRL_8BITBUS (0x2 << 1)
23
24
+#define ESDHC_PRNSTS_SDSTB (1 << 3)
25
+
26
#endif
27
diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
28
index XXXXXXX..XXXXXXX 100644
29
--- a/hw/sd/sdhci.c
30
+++ b/hw/sd/sdhci.c
31
@@ -XXX,XX +XXX,XX @@ static uint64_t usdhc_read(void *opaque, hwaddr offset, unsigned size)
32
33
break;
34
35
+ case SDHC_PRNSTS:
36
+ /* Add SDSTB (SD Clock Stable) bit to PRNSTS */
37
+ ret = sdhci_read(opaque, offset, size) & ~ESDHC_PRNSTS_SDSTB;
38
+ if (s->clkcon & SDHC_CLOCK_INT_STABLE) {
39
+ ret |= ESDHC_PRNSTS_SDSTB;
40
+ }
41
+ break;
42
+
43
case ESDHC_DLL_CTRL:
44
case ESDHC_TUNE_CTRL_STATUS:
45
case ESDHC_UNDOCUMENTED_REG27:
46
--
47
2.18.0
48
49
diff view generated by jsdifflib
Deleted patch
1
We now support direct execution from MMIO regions in the
2
core memory subsystem. This means that we don't need to
3
have device-specific support for it, and we can remove
4
the request_ptr handling from the Xilinx SPIPS device.
5
(It was broken anyway due to race conditions, and disabled
6
by default.)
7
1
8
This device is the only in-tree user of this API.
9
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
12
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
13
Reviewed-by: KONRAD Frederic <frederic.konrad@adacore.com>
14
Message-id: 20180817114619.22354-2-peter.maydell@linaro.org
15
---
16
hw/ssi/xilinx_spips.c | 46 -------------------------------------------
17
1 file changed, 46 deletions(-)
18
19
diff --git a/hw/ssi/xilinx_spips.c b/hw/ssi/xilinx_spips.c
20
index XXXXXXX..XXXXXXX 100644
21
--- a/hw/ssi/xilinx_spips.c
22
+++ b/hw/ssi/xilinx_spips.c
23
@@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps spips_ops = {
24
25
static void xilinx_qspips_invalidate_mmio_ptr(XilinxQSPIPS *q)
26
{
27
- XilinxSPIPS *s = &q->parent_obj;
28
-
29
- if ((q->mmio_execution_enabled) && (q->lqspi_cached_addr != ~0ULL)) {
30
- /* Invalidate the current mapped mmio */
31
- memory_region_invalidate_mmio_ptr(&s->mmlqspi, q->lqspi_cached_addr,
32
- LQSPI_CACHE_SIZE);
33
- }
34
-
35
q->lqspi_cached_addr = ~0ULL;
36
}
37
38
@@ -XXX,XX +XXX,XX @@ static void lqspi_load_cache(void *opaque, hwaddr addr)
39
}
40
}
41
42
-static void *lqspi_request_mmio_ptr(void *opaque, hwaddr addr, unsigned *size,
43
- unsigned *offset)
44
-{
45
- XilinxQSPIPS *q = opaque;
46
- hwaddr offset_within_the_region;
47
-
48
- if (!q->mmio_execution_enabled) {
49
- return NULL;
50
- }
51
-
52
- offset_within_the_region = addr & ~(LQSPI_CACHE_SIZE - 1);
53
- lqspi_load_cache(opaque, offset_within_the_region);
54
- *size = LQSPI_CACHE_SIZE;
55
- *offset = offset_within_the_region;
56
- return q->lqspi_buf;
57
-}
58
-
59
static uint64_t
60
lqspi_read(void *opaque, hwaddr addr, unsigned int size)
61
{
62
@@ -XXX,XX +XXX,XX @@ lqspi_read(void *opaque, hwaddr addr, unsigned int size)
63
64
static const MemoryRegionOps lqspi_ops = {
65
.read = lqspi_read,
66
- .request_ptr = lqspi_request_mmio_ptr,
67
.endianness = DEVICE_NATIVE_ENDIAN,
68
.valid = {
69
.min_access_size = 1,
70
@@ -XXX,XX +XXX,XX @@ static void xilinx_qspips_realize(DeviceState *dev, Error **errp)
71
sysbus_init_mmio(sbd, &s->mmlqspi);
72
73
q->lqspi_cached_addr = ~0ULL;
74
-
75
- /* mmio_execution breaks migration better aborting than having strange
76
- * bugs.
77
- */
78
- if (q->mmio_execution_enabled) {
79
- error_setg(&q->migration_blocker,
80
- "enabling mmio_execution breaks migration");
81
- migrate_add_blocker(q->migration_blocker, &error_fatal);
82
- }
83
}
84
85
static void xlnx_zynqmp_qspips_realize(DeviceState *dev, Error **errp)
86
@@ -XXX,XX +XXX,XX @@ static Property xilinx_zynqmp_qspips_properties[] = {
87
DEFINE_PROP_END_OF_LIST(),
88
};
89
90
-static Property xilinx_qspips_properties[] = {
91
- /* We had to turn this off for 2.10 as it is not compatible with migration.
92
- * It can be enabled but will prevent the device to be migrated.
93
- * This will go aways when a fix will be released.
94
- */
95
- DEFINE_PROP_BOOL("x-mmio-exec", XilinxQSPIPS, mmio_execution_enabled,
96
- false),
97
- DEFINE_PROP_END_OF_LIST(),
98
-};
99
-
100
static Property xilinx_spips_properties[] = {
101
DEFINE_PROP_UINT8("num-busses", XilinxSPIPS, num_busses, 1),
102
DEFINE_PROP_UINT8("num-ss-bits", XilinxSPIPS, num_cs, 4),
103
@@ -XXX,XX +XXX,XX @@ static void xilinx_qspips_class_init(ObjectClass *klass, void * data)
104
XilinxSPIPSClass *xsc = XILINX_SPIPS_CLASS(klass);
105
106
dc->realize = xilinx_qspips_realize;
107
- dc->props = xilinx_qspips_properties;
108
xsc->reg_ops = &qspips_ops;
109
xsc->rx_fifo_size = RXFF_A_Q;
110
xsc->tx_fifo_size = TXFF_A_Q;
111
--
112
2.18.0
113
114
diff view generated by jsdifflib
Deleted patch
1
Remove the obsolete MMIO request_ptr APIs; they have no
2
users now.
3
1
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
6
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
7
Reviewed-by: KONRAD Frederic <frederic.konrad@adacore.com>
8
Message-id: 20180817114619.22354-3-peter.maydell@linaro.org
9
---
10
include/exec/memory.h | 35 --------------
11
memory.c | 110 ------------------------------------------
12
2 files changed, 145 deletions(-)
13
14
diff --git a/include/exec/memory.h b/include/exec/memory.h
15
index XXXXXXX..XXXXXXX 100644
16
--- a/include/exec/memory.h
17
+++ b/include/exec/memory.h
18
@@ -XXX,XX +XXX,XX @@ struct MemoryRegionOps {
19
uint64_t data,
20
unsigned size,
21
MemTxAttrs attrs);
22
- /* Instruction execution pre-callback:
23
- * @addr is the address of the access relative to the @mr.
24
- * @size is the size of the area returned by the callback.
25
- * @offset is the location of the pointer inside @mr.
26
- *
27
- * Returns a pointer to a location which contains guest code.
28
- */
29
- void *(*request_ptr)(void *opaque, hwaddr addr, unsigned *size,
30
- unsigned *offset);
31
32
enum device_endian endianness;
33
/* Guest-visible constraints: */
34
@@ -XXX,XX +XXX,XX @@ void memory_global_dirty_log_stop(void);
35
void mtree_info(fprintf_function mon_printf, void *f, bool flatview,
36
bool dispatch_tree, bool owner);
37
38
-/**
39
- * memory_region_request_mmio_ptr: request a pointer to an mmio
40
- * MemoryRegion. If it is possible map a RAM MemoryRegion with this pointer.
41
- * When the device wants to invalidate the pointer it will call
42
- * memory_region_invalidate_mmio_ptr.
43
- *
44
- * @mr: #MemoryRegion to check
45
- * @addr: address within that region
46
- *
47
- * Returns true on success, false otherwise.
48
- */
49
-bool memory_region_request_mmio_ptr(MemoryRegion *mr, hwaddr addr);
50
-
51
-/**
52
- * memory_region_invalidate_mmio_ptr: invalidate the pointer to an mmio
53
- * previously requested.
54
- * In the end that means that if something wants to execute from this area it
55
- * will need to request the pointer again.
56
- *
57
- * @mr: #MemoryRegion associated to the pointer.
58
- * @offset: offset within the memory region
59
- * @size: size of that area.
60
- */
61
-void memory_region_invalidate_mmio_ptr(MemoryRegion *mr, hwaddr offset,
62
- unsigned size);
63
-
64
/**
65
* memory_region_dispatch_read: perform a read directly to the specified
66
* MemoryRegion.
67
diff --git a/memory.c b/memory.c
68
index XXXXXXX..XXXXXXX 100644
69
--- a/memory.c
70
+++ b/memory.c
71
@@ -XXX,XX +XXX,XX @@
72
#include "exec/ram_addr.h"
73
#include "sysemu/kvm.h"
74
#include "sysemu/sysemu.h"
75
-#include "hw/misc/mmio_interface.h"
76
#include "hw/qdev-properties.h"
77
#include "migration/vmstate.h"
78
79
@@ -XXX,XX +XXX,XX @@ void memory_listener_unregister(MemoryListener *listener)
80
listener->address_space = NULL;
81
}
82
83
-bool memory_region_request_mmio_ptr(MemoryRegion *mr, hwaddr addr)
84
-{
85
- void *host;
86
- unsigned size = 0;
87
- unsigned offset = 0;
88
- Object *new_interface;
89
-
90
- if (!mr || !mr->ops->request_ptr) {
91
- return false;
92
- }
93
-
94
- /*
95
- * Avoid an update if the request_ptr call
96
- * memory_region_invalidate_mmio_ptr which seems to be likely when we use
97
- * a cache.
98
- */
99
- memory_region_transaction_begin();
100
-
101
- host = mr->ops->request_ptr(mr->opaque, addr - mr->addr, &size, &offset);
102
-
103
- if (!host || !size) {
104
- memory_region_transaction_commit();
105
- return false;
106
- }
107
-
108
- new_interface = object_new("mmio_interface");
109
- qdev_prop_set_uint64(DEVICE(new_interface), "start", offset);
110
- qdev_prop_set_uint64(DEVICE(new_interface), "end", offset + size - 1);
111
- qdev_prop_set_bit(DEVICE(new_interface), "ro", true);
112
- qdev_prop_set_ptr(DEVICE(new_interface), "host_ptr", host);
113
- qdev_prop_set_ptr(DEVICE(new_interface), "subregion", mr);
114
- object_property_set_bool(OBJECT(new_interface), true, "realized", NULL);
115
-
116
- memory_region_transaction_commit();
117
- return true;
118
-}
119
-
120
-typedef struct MMIOPtrInvalidate {
121
- MemoryRegion *mr;
122
- hwaddr offset;
123
- unsigned size;
124
- int busy;
125
- int allocated;
126
-} MMIOPtrInvalidate;
127
-
128
-#define MAX_MMIO_INVALIDATE 10
129
-static MMIOPtrInvalidate mmio_ptr_invalidate_list[MAX_MMIO_INVALIDATE];
130
-
131
-static void memory_region_do_invalidate_mmio_ptr(CPUState *cpu,
132
- run_on_cpu_data data)
133
-{
134
- MMIOPtrInvalidate *invalidate_data = (MMIOPtrInvalidate *)data.host_ptr;
135
- MemoryRegion *mr = invalidate_data->mr;
136
- hwaddr offset = invalidate_data->offset;
137
- unsigned size = invalidate_data->size;
138
- MemoryRegionSection section = memory_region_find(mr, offset, size);
139
-
140
- qemu_mutex_lock_iothread();
141
-
142
- /* Reset dirty so this doesn't happen later. */
143
- cpu_physical_memory_test_and_clear_dirty(offset, size, 1);
144
-
145
- if (section.mr != mr) {
146
- /* memory_region_find add a ref on section.mr */
147
- memory_region_unref(section.mr);
148
- if (MMIO_INTERFACE(section.mr->owner)) {
149
- /* We found the interface just drop it. */
150
- object_property_set_bool(section.mr->owner, false, "realized",
151
- NULL);
152
- object_unref(section.mr->owner);
153
- object_unparent(section.mr->owner);
154
- }
155
- }
156
-
157
- qemu_mutex_unlock_iothread();
158
-
159
- if (invalidate_data->allocated) {
160
- g_free(invalidate_data);
161
- } else {
162
- invalidate_data->busy = 0;
163
- }
164
-}
165
-
166
-void memory_region_invalidate_mmio_ptr(MemoryRegion *mr, hwaddr offset,
167
- unsigned size)
168
-{
169
- size_t i;
170
- MMIOPtrInvalidate *invalidate_data = NULL;
171
-
172
- for (i = 0; i < MAX_MMIO_INVALIDATE; i++) {
173
- if (atomic_cmpxchg(&(mmio_ptr_invalidate_list[i].busy), 0, 1) == 0) {
174
- invalidate_data = &mmio_ptr_invalidate_list[i];
175
- break;
176
- }
177
- }
178
-
179
- if (!invalidate_data) {
180
- invalidate_data = g_malloc0(sizeof(MMIOPtrInvalidate));
181
- invalidate_data->allocated = 1;
182
- }
183
-
184
- invalidate_data->mr = mr;
185
- invalidate_data->offset = offset;
186
- invalidate_data->size = size;
187
-
188
- async_safe_run_on_cpu(first_cpu, memory_region_do_invalidate_mmio_ptr,
189
- RUN_ON_CPU_HOST_PTR(invalidate_data));
190
-}
191
-
192
void address_space_init(AddressSpace *as, MemoryRegion *root, const char *name)
193
{
194
memory_region_ref(root);
195
--
196
2.18.0
197
198
diff view generated by jsdifflib
Deleted patch
1
The mmio_interface device was a purely internal artifact
2
of the implementation of the memory subsystem's request_ptr
3
APIs. Now that we have removed those APIs, we can remove
4
the mmio_interface device too.
5
1
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
8
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
9
Reviewed-by: KONRAD Frederic <frederic.konrad@adacore.com>
10
Message-id: 20180817114619.22354-4-peter.maydell@linaro.org
11
---
12
hw/misc/Makefile.objs | 1 -
13
include/hw/misc/mmio_interface.h | 49 -----------
14
hw/misc/mmio_interface.c | 135 -------------------------------
15
3 files changed, 185 deletions(-)
16
delete mode 100644 include/hw/misc/mmio_interface.h
17
delete mode 100644 hw/misc/mmio_interface.c
18
19
diff --git a/hw/misc/Makefile.objs b/hw/misc/Makefile.objs
20
index XXXXXXX..XXXXXXX 100644
21
--- a/hw/misc/Makefile.objs
22
+++ b/hw/misc/Makefile.objs
23
@@ -XXX,XX +XXX,XX @@ obj-$(CONFIG_PVPANIC) += pvpanic.o
24
obj-$(CONFIG_HYPERV_TESTDEV) += hyperv_testdev.o
25
obj-$(CONFIG_AUX) += auxbus.o
26
obj-$(CONFIG_ASPEED_SOC) += aspeed_scu.o aspeed_sdmc.o
27
-obj-y += mmio_interface.o
28
obj-$(CONFIG_MSF2) += msf2-sysreg.o
29
diff --git a/include/hw/misc/mmio_interface.h b/include/hw/misc/mmio_interface.h
30
deleted file mode 100644
31
index XXXXXXX..XXXXXXX
32
--- a/include/hw/misc/mmio_interface.h
33
+++ /dev/null
34
@@ -XXX,XX +XXX,XX @@
35
-/*
36
- * mmio_interface.h
37
- *
38
- * Copyright (C) 2017 : GreenSocs
39
- * http://www.greensocs.com/ , email: info@greensocs.com
40
- *
41
- * Developed by :
42
- * Frederic Konrad <fred.konrad@greensocs.com>
43
- *
44
- * This program is free software; you can redistribute it and/or modify
45
- * it under the terms of the GNU General Public License as published by
46
- * the Free Software Foundation, either version 2 of the License, or
47
- * (at your option)any later version.
48
- *
49
- * This program is distributed in the hope that it will be useful,
50
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
51
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
52
- * GNU General Public License for more details.
53
- *
54
- * You should have received a copy of the GNU General Public License along
55
- * with this program; if not, see <http://www.gnu.org/licenses/>.
56
- *
57
- */
58
-
59
-#ifndef MMIO_INTERFACE_H
60
-#define MMIO_INTERFACE_H
61
-
62
-#include "exec/memory.h"
63
-
64
-#define TYPE_MMIO_INTERFACE "mmio_interface"
65
-#define MMIO_INTERFACE(obj) OBJECT_CHECK(MMIOInterface, (obj), \
66
- TYPE_MMIO_INTERFACE)
67
-
68
-typedef struct MMIOInterface {
69
- DeviceState parent_obj;
70
-
71
- MemoryRegion *subregion;
72
- MemoryRegion ram_mem;
73
- uint64_t start;
74
- uint64_t end;
75
- bool ro;
76
- uint64_t id;
77
- void *host_ptr;
78
-} MMIOInterface;
79
-
80
-void mmio_interface_map(MMIOInterface *s);
81
-void mmio_interface_unmap(MMIOInterface *s);
82
-
83
-#endif /* MMIO_INTERFACE_H */
84
diff --git a/hw/misc/mmio_interface.c b/hw/misc/mmio_interface.c
85
deleted file mode 100644
86
index XXXXXXX..XXXXXXX
87
--- a/hw/misc/mmio_interface.c
88
+++ /dev/null
89
@@ -XXX,XX +XXX,XX @@
90
-/*
91
- * mmio_interface.c
92
- *
93
- * Copyright (C) 2017 : GreenSocs
94
- * http://www.greensocs.com/ , email: info@greensocs.com
95
- *
96
- * Developed by :
97
- * Frederic Konrad <fred.konrad@greensocs.com>
98
- *
99
- * This program is free software; you can redistribute it and/or modify
100
- * it under the terms of the GNU General Public License as published by
101
- * the Free Software Foundation, either version 2 of the License, or
102
- * (at your option)any later version.
103
- *
104
- * This program is distributed in the hope that it will be useful,
105
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
106
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
107
- * GNU General Public License for more details.
108
- *
109
- * You should have received a copy of the GNU General Public License along
110
- * with this program; if not, see <http://www.gnu.org/licenses/>.
111
- *
112
- */
113
-
114
-#include "qemu/osdep.h"
115
-#include "qemu/log.h"
116
-#include "trace.h"
117
-#include "hw/qdev-properties.h"
118
-#include "hw/misc/mmio_interface.h"
119
-#include "qapi/error.h"
120
-
121
-#ifndef DEBUG_MMIO_INTERFACE
122
-#define DEBUG_MMIO_INTERFACE 0
123
-#endif
124
-
125
-static uint64_t mmio_interface_counter;
126
-
127
-#define DPRINTF(fmt, ...) do { \
128
- if (DEBUG_MMIO_INTERFACE) { \
129
- qemu_log("mmio_interface: 0x%" PRIX64 ": " fmt, s->id, ## __VA_ARGS__);\
130
- } \
131
-} while (0)
132
-
133
-static void mmio_interface_init(Object *obj)
134
-{
135
- MMIOInterface *s = MMIO_INTERFACE(obj);
136
-
137
- if (DEBUG_MMIO_INTERFACE) {
138
- s->id = mmio_interface_counter++;
139
- }
140
-
141
- DPRINTF("interface created\n");
142
- s->host_ptr = 0;
143
- s->subregion = 0;
144
-}
145
-
146
-static void mmio_interface_realize(DeviceState *dev, Error **errp)
147
-{
148
- MMIOInterface *s = MMIO_INTERFACE(dev);
149
-
150
- DPRINTF("realize from 0x%" PRIX64 " to 0x%" PRIX64 " map host pointer"
151
- " %p\n", s->start, s->end, s->host_ptr);
152
-
153
- if (!s->host_ptr) {
154
- error_setg(errp, "host_ptr property must be set");
155
- return;
156
- }
157
-
158
- if (!s->subregion) {
159
- error_setg(errp, "subregion property must be set");
160
- return;
161
- }
162
-
163
- memory_region_init_ram_ptr(&s->ram_mem, OBJECT(s), "ram",
164
- s->end - s->start + 1, s->host_ptr);
165
- memory_region_set_readonly(&s->ram_mem, s->ro);
166
- memory_region_add_subregion(s->subregion, s->start, &s->ram_mem);
167
-}
168
-
169
-static void mmio_interface_unrealize(DeviceState *dev, Error **errp)
170
-{
171
- MMIOInterface *s = MMIO_INTERFACE(dev);
172
-
173
- DPRINTF("unrealize from 0x%" PRIX64 " to 0x%" PRIX64 " map host pointer"
174
- " %p\n", s->start, s->end, s->host_ptr);
175
- memory_region_del_subregion(s->subregion, &s->ram_mem);
176
-}
177
-
178
-static void mmio_interface_finalize(Object *obj)
179
-{
180
- MMIOInterface *s = MMIO_INTERFACE(obj);
181
-
182
- DPRINTF("finalize from 0x%" PRIX64 " to 0x%" PRIX64 " map host pointer"
183
- " %p\n", s->start, s->end, s->host_ptr);
184
- object_unparent(OBJECT(&s->ram_mem));
185
-}
186
-
187
-static Property mmio_interface_properties[] = {
188
- DEFINE_PROP_UINT64("start", MMIOInterface, start, 0),
189
- DEFINE_PROP_UINT64("end", MMIOInterface, end, 0),
190
- DEFINE_PROP_PTR("host_ptr", MMIOInterface, host_ptr),
191
- DEFINE_PROP_BOOL("ro", MMIOInterface, ro, false),
192
- DEFINE_PROP_MEMORY_REGION("subregion", MMIOInterface, subregion),
193
- DEFINE_PROP_END_OF_LIST(),
194
-};
195
-
196
-static void mmio_interface_class_init(ObjectClass *oc, void *data)
197
-{
198
- DeviceClass *dc = DEVICE_CLASS(oc);
199
-
200
- dc->realize = mmio_interface_realize;
201
- dc->unrealize = mmio_interface_unrealize;
202
- dc->props = mmio_interface_properties;
203
- /* Reason: pointer property "host_ptr", and this device
204
- * is an implementation detail of the memory subsystem,
205
- * not intended to be created directly by the user.
206
- */
207
- dc->user_creatable = false;
208
-}
209
-
210
-static const TypeInfo mmio_interface_info = {
211
- .name = TYPE_MMIO_INTERFACE,
212
- .parent = TYPE_DEVICE,
213
- .instance_size = sizeof(MMIOInterface),
214
- .instance_init = mmio_interface_init,
215
- .instance_finalize = mmio_interface_finalize,
216
- .class_init = mmio_interface_class_init,
217
-};
218
-
219
-static void mmio_interface_register_types(void)
220
-{
221
- type_register_static(&mmio_interface_info);
222
-}
223
-
224
-type_init(mmio_interface_register_types)
225
--
226
2.18.0
227
228
diff view generated by jsdifflib
Deleted patch
1
On real v7M hardware, the NMI line is an externally visible signal
2
that an SoC or board can toggle to assert an NMI. Expose it in
3
our QEMU NVIC and armv7m container objects so that a board model
4
can wire it up if it needs to.
5
1
6
In particular, the MPS2 watchdog is wired to NMI.
7
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
10
---
11
hw/arm/armv7m.c | 1 +
12
hw/intc/armv7m_nvic.c | 19 +++++++++++++++++++
13
hw/intc/trace-events | 1 +
14
3 files changed, 21 insertions(+)
15
16
diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c
17
index XXXXXXX..XXXXXXX 100644
18
--- a/hw/arm/armv7m.c
19
+++ b/hw/arm/armv7m.c
20
@@ -XXX,XX +XXX,XX @@ static void armv7m_realize(DeviceState *dev, Error **errp)
21
*/
22
qdev_pass_gpios(DEVICE(&s->nvic), dev, NULL);
23
qdev_pass_gpios(DEVICE(&s->nvic), dev, "SYSRESETREQ");
24
+ qdev_pass_gpios(DEVICE(&s->nvic), dev, "NMI");
25
26
/* Wire the NVIC up to the CPU */
27
sbd = SYS_BUS_DEVICE(&s->nvic);
28
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
29
index XXXXXXX..XXXXXXX 100644
30
--- a/hw/intc/armv7m_nvic.c
31
+++ b/hw/intc/armv7m_nvic.c
32
@@ -XXX,XX +XXX,XX @@ static void set_irq_level(void *opaque, int n, int level)
33
}
34
}
35
36
+/* callback when external NMI line is changed */
37
+static void nvic_nmi_trigger(void *opaque, int n, int level)
38
+{
39
+ NVICState *s = opaque;
40
+
41
+ trace_nvic_set_nmi_level(level);
42
+
43
+ /*
44
+ * The architecture doesn't specify whether NMI should share
45
+ * the normal-interrupt behaviour of being resampled on
46
+ * exception handler return. We choose not to, so just
47
+ * set NMI pending here and don't track the current level.
48
+ */
49
+ if (level) {
50
+ armv7m_nvic_set_pending(s, ARMV7M_EXCP_NMI, false);
51
+ }
52
+}
53
+
54
static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs)
55
{
56
ARMCPU *cpu = s->cpu;
57
@@ -XXX,XX +XXX,XX @@ static void armv7m_nvic_instance_init(Object *obj)
58
qdev_init_gpio_out_named(dev, &nvic->sysresetreq, "SYSRESETREQ", 1);
59
qdev_init_gpio_in_named(dev, nvic_systick_trigger, "systick-trigger",
60
M_REG_NUM_BANKS);
61
+ qdev_init_gpio_in_named(dev, nvic_nmi_trigger, "NMI", 1);
62
}
63
64
static void armv7m_nvic_class_init(ObjectClass *klass, void *data)
65
diff --git a/hw/intc/trace-events b/hw/intc/trace-events
66
index XXXXXXX..XXXXXXX 100644
67
--- a/hw/intc/trace-events
68
+++ b/hw/intc/trace-events
69
@@ -XXX,XX +XXX,XX @@ nvic_acknowledge_irq(int irq, int prio) "NVIC acknowledge IRQ: %d now active (pr
70
nvic_get_pending_irq_info(int irq, bool secure) "NVIC next IRQ %d: targets_secure: %d"
71
nvic_complete_irq(int irq, bool secure) "NVIC complete IRQ %d (secure %d)"
72
nvic_set_irq_level(int irq, int level) "NVIC external irq %d level set to %d"
73
+nvic_set_nmi_level(int level) "NVIC external NMI level set to %d"
74
nvic_sysreg_read(uint64_t addr, uint32_t value, unsigned size) "NVIC sysreg read addr 0x%" PRIx64 " data 0x%" PRIx32 " size %u"
75
nvic_sysreg_write(uint64_t addr, uint32_t value, unsigned size) "NVIC sysreg write addr 0x%" PRIx64 " data 0x%" PRIx32 " size %u"
76
77
--
78
2.18.0
79
80
diff view generated by jsdifflib
Deleted patch
1
Create a new include file for the pl081's device struct,
2
type macros, etc, so that it can be instantiated using
3
the "embedded struct" coding style.
4
1
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7
---
8
include/hw/dma/pl080.h | 62 ++++++++++++++++++++++++++++++++++++++++++
9
hw/dma/pl080.c | 34 ++---------------------
10
MAINTAINERS | 1 +
11
3 files changed, 65 insertions(+), 32 deletions(-)
12
create mode 100644 include/hw/dma/pl080.h
13
14
diff --git a/include/hw/dma/pl080.h b/include/hw/dma/pl080.h
15
new file mode 100644
16
index XXXXXXX..XXXXXXX
17
--- /dev/null
18
+++ b/include/hw/dma/pl080.h
19
@@ -XXX,XX +XXX,XX @@
20
+/*
21
+ * ARM PrimeCell PL080/PL081 DMA controller
22
+ *
23
+ * Copyright (c) 2006 CodeSourcery.
24
+ * Copyright (c) 2018 Linaro Limited
25
+ * Written by Paul Brook, Peter Maydell
26
+ *
27
+ * This program is free software; you can redistribute it and/or modify
28
+ * it under the terms of the GNU General Public License version 2 or
29
+ * (at your option) any later version.
30
+ */
31
+
32
+/* This is a model of the Arm PrimeCell PL080/PL081 DMA controller:
33
+ * The PL080 TRM is:
34
+ * http://infocenter.arm.com/help/topic/com.arm.doc.ddi0196g/DDI0196.pdf
35
+ * and the PL081 TRM is:
36
+ * http://infocenter.arm.com/help/topic/com.arm.doc.ddi0218e/DDI0218.pdf
37
+ *
38
+ * QEMU interface:
39
+ * + sysbus IRQ: DMACINTR combined interrupt line
40
+ * + sysbus MMIO region 0: MemoryRegion for the device's registers
41
+ */
42
+
43
+#ifndef HW_DMA_PL080_H
44
+#define HW_DMA_PL080_H
45
+
46
+#include "hw/sysbus.h"
47
+
48
+#define PL080_MAX_CHANNELS 8
49
+
50
+typedef struct {
51
+ uint32_t src;
52
+ uint32_t dest;
53
+ uint32_t lli;
54
+ uint32_t ctrl;
55
+ uint32_t conf;
56
+} pl080_channel;
57
+
58
+#define TYPE_PL080 "pl080"
59
+#define TYPE_PL081 "pl081"
60
+#define PL080(obj) OBJECT_CHECK(PL080State, (obj), TYPE_PL080)
61
+
62
+typedef struct PL080State {
63
+ SysBusDevice parent_obj;
64
+
65
+ MemoryRegion iomem;
66
+ uint8_t tc_int;
67
+ uint8_t tc_mask;
68
+ uint8_t err_int;
69
+ uint8_t err_mask;
70
+ uint32_t conf;
71
+ uint32_t sync;
72
+ uint32_t req_single;
73
+ uint32_t req_burst;
74
+ pl080_channel chan[PL080_MAX_CHANNELS];
75
+ int nchannels;
76
+ /* Flag to avoid recursive DMA invocations. */
77
+ int running;
78
+ qemu_irq irq;
79
+} PL080State;
80
+
81
+#endif
82
diff --git a/hw/dma/pl080.c b/hw/dma/pl080.c
83
index XXXXXXX..XXXXXXX 100644
84
--- a/hw/dma/pl080.c
85
+++ b/hw/dma/pl080.c
86
@@ -XXX,XX +XXX,XX @@
87
#include "hw/sysbus.h"
88
#include "exec/address-spaces.h"
89
#include "qemu/log.h"
90
+#include "hw/dma/pl080.h"
91
92
-#define PL080_MAX_CHANNELS 8
93
#define PL080_CONF_E 0x1
94
#define PL080_CONF_M1 0x2
95
#define PL080_CONF_M2 0x4
96
@@ -XXX,XX +XXX,XX @@
97
#define PL080_CCTRL_D 0x02000000
98
#define PL080_CCTRL_S 0x01000000
99
100
-typedef struct {
101
- uint32_t src;
102
- uint32_t dest;
103
- uint32_t lli;
104
- uint32_t ctrl;
105
- uint32_t conf;
106
-} pl080_channel;
107
-
108
-#define TYPE_PL080 "pl080"
109
-#define PL080(obj) OBJECT_CHECK(PL080State, (obj), TYPE_PL080)
110
-
111
-typedef struct PL080State {
112
- SysBusDevice parent_obj;
113
-
114
- MemoryRegion iomem;
115
- uint8_t tc_int;
116
- uint8_t tc_mask;
117
- uint8_t err_int;
118
- uint8_t err_mask;
119
- uint32_t conf;
120
- uint32_t sync;
121
- uint32_t req_single;
122
- uint32_t req_burst;
123
- pl080_channel chan[PL080_MAX_CHANNELS];
124
- int nchannels;
125
- /* Flag to avoid recursive DMA invocations. */
126
- int running;
127
- qemu_irq irq;
128
-} PL080State;
129
-
130
static const VMStateDescription vmstate_pl080_channel = {
131
.name = "pl080_channel",
132
.version_id = 1,
133
@@ -XXX,XX +XXX,XX @@ static const TypeInfo pl080_info = {
134
};
135
136
static const TypeInfo pl081_info = {
137
- .name = "pl081",
138
+ .name = TYPE_PL081,
139
.parent = TYPE_PL080,
140
.instance_init = pl081_init,
141
};
142
diff --git a/MAINTAINERS b/MAINTAINERS
143
index XXXXXXX..XXXXXXX 100644
144
--- a/MAINTAINERS
145
+++ b/MAINTAINERS
146
@@ -XXX,XX +XXX,XX @@ F: hw/char/pl011.c
147
F: include/hw/char/pl011.h
148
F: hw/display/pl110*
149
F: hw/dma/pl080.c
150
+F: include/hw/dma/pl080.h
151
F: hw/dma/pl330.c
152
F: hw/gpio/pl061.c
153
F: hw/input/pl050.c
154
--
155
2.18.0
156
157
diff view generated by jsdifflib
Deleted patch
1
The PL080 and PL081 have three outgoing interrupt lines:
2
* DMACINTERR signals DMA errors
3
* DMACINTTC is the DMA count interrupt
4
* DMACINTR is a combined interrupt, the logical OR of the other two
5
1
6
We currently only implement DMACINTR, because that's all the
7
realview and versatile boards needed, but the instances of the
8
PL081 in the MPS2 firmware images use all three interrupt lines.
9
Implement the missing DMACINTERR and DMACINTTC.
10
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
13
---
14
include/hw/dma/pl080.h | 6 +++++-
15
hw/dma/pl080.c | 13 ++++++++-----
16
2 files changed, 13 insertions(+), 6 deletions(-)
17
18
diff --git a/include/hw/dma/pl080.h b/include/hw/dma/pl080.h
19
index XXXXXXX..XXXXXXX 100644
20
--- a/include/hw/dma/pl080.h
21
+++ b/include/hw/dma/pl080.h
22
@@ -XXX,XX +XXX,XX @@
23
* http://infocenter.arm.com/help/topic/com.arm.doc.ddi0218e/DDI0218.pdf
24
*
25
* QEMU interface:
26
- * + sysbus IRQ: DMACINTR combined interrupt line
27
+ * + sysbus IRQ 0: DMACINTR combined interrupt line
28
+ * + sysbus IRQ 1: DMACINTERR error interrupt request
29
+ * + sysbus IRQ 2: DMACINTTC count interrupt request
30
* + sysbus MMIO region 0: MemoryRegion for the device's registers
31
*/
32
33
@@ -XXX,XX +XXX,XX @@ typedef struct PL080State {
34
/* Flag to avoid recursive DMA invocations. */
35
int running;
36
qemu_irq irq;
37
+ qemu_irq interr;
38
+ qemu_irq inttc;
39
} PL080State;
40
41
#endif
42
diff --git a/hw/dma/pl080.c b/hw/dma/pl080.c
43
index XXXXXXX..XXXXXXX 100644
44
--- a/hw/dma/pl080.c
45
+++ b/hw/dma/pl080.c
46
@@ -XXX,XX +XXX,XX @@ static const unsigned char pl081_id[] =
47
48
static void pl080_update(PL080State *s)
49
{
50
- if ((s->tc_int & s->tc_mask)
51
- || (s->err_int & s->err_mask))
52
- qemu_irq_raise(s->irq);
53
- else
54
- qemu_irq_lower(s->irq);
55
+ bool tclevel = (s->tc_int & s->tc_mask);
56
+ bool errlevel = (s->err_int & s->err_mask);
57
+
58
+ qemu_set_irq(s->interr, errlevel);
59
+ qemu_set_irq(s->inttc, tclevel);
60
+ qemu_set_irq(s->irq, errlevel || tclevel);
61
}
62
63
static void pl080_run(PL080State *s)
64
@@ -XXX,XX +XXX,XX @@ static void pl080_init(Object *obj)
65
memory_region_init_io(&s->iomem, OBJECT(s), &pl080_ops, s, "pl080", 0x1000);
66
sysbus_init_mmio(sbd, &s->iomem);
67
sysbus_init_irq(sbd, &s->irq);
68
+ sysbus_init_irq(sbd, &s->interr);
69
+ sysbus_init_irq(sbd, &s->inttc);
70
s->nchannels = 8;
71
}
72
73
--
74
2.18.0
75
76
diff view generated by jsdifflib
Deleted patch
1
Currently our PL080/PL081 model uses a combination of the CPU's
2
address space (via cpu_physical_memory_{read,write}()) and the
3
system address space for performing DMA accesses.
4
1
5
For the PL081s in the MPS FPGA images, their DMA accesses
6
must go via Master Security Controllers. Switch the
7
PL080/PL081 model to take a MemoryRegion property which
8
defines its downstream for making DMA accesses.
9
10
Since the PL08x are only used in two board models, we
11
make provision of the 'downstream' link mandatory and convert
12
both users at once, rather than having it be optional with
13
a default to the system address space.
14
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
17
---
18
include/hw/dma/pl080.h | 5 +++++
19
hw/arm/realview.c | 8 +++++++-
20
hw/arm/versatilepb.c | 9 ++++++++-
21
hw/dma/pl080.c | 35 +++++++++++++++++++++++++++++------
22
4 files changed, 49 insertions(+), 8 deletions(-)
23
24
diff --git a/include/hw/dma/pl080.h b/include/hw/dma/pl080.h
25
index XXXXXXX..XXXXXXX 100644
26
--- a/include/hw/dma/pl080.h
27
+++ b/include/hw/dma/pl080.h
28
@@ -XXX,XX +XXX,XX @@
29
* + sysbus IRQ 1: DMACINTERR error interrupt request
30
* + sysbus IRQ 2: DMACINTTC count interrupt request
31
* + sysbus MMIO region 0: MemoryRegion for the device's registers
32
+ * + QOM property "downstream": MemoryRegion defining where DMA
33
+ * bus master transactions are made
34
*/
35
36
#ifndef HW_DMA_PL080_H
37
@@ -XXX,XX +XXX,XX @@ typedef struct PL080State {
38
qemu_irq irq;
39
qemu_irq interr;
40
qemu_irq inttc;
41
+
42
+ MemoryRegion *downstream;
43
+ AddressSpace downstream_as;
44
} PL080State;
45
46
#endif
47
diff --git a/hw/arm/realview.c b/hw/arm/realview.c
48
index XXXXXXX..XXXXXXX 100644
49
--- a/hw/arm/realview.c
50
+++ b/hw/arm/realview.c
51
@@ -XXX,XX +XXX,XX @@ static void realview_init(MachineState *machine,
52
pl011_create(0x1000c000, pic[15], serial_hd(3));
53
54
/* DMA controller is optional, apparently. */
55
- sysbus_create_simple("pl081", 0x10030000, pic[24]);
56
+ dev = qdev_create(NULL, "pl081");
57
+ object_property_set_link(OBJECT(dev), OBJECT(sysmem), "downstream",
58
+ &error_fatal);
59
+ qdev_init_nofail(dev);
60
+ busdev = SYS_BUS_DEVICE(dev);
61
+ sysbus_mmio_map(busdev, 0, 0x10030000);
62
+ sysbus_connect_irq(busdev, 0, pic[24]);
63
64
sysbus_create_simple("sp804", 0x10011000, pic[4]);
65
sysbus_create_simple("sp804", 0x10012000, pic[5]);
66
diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c
67
index XXXXXXX..XXXXXXX 100644
68
--- a/hw/arm/versatilepb.c
69
+++ b/hw/arm/versatilepb.c
70
@@ -XXX,XX +XXX,XX @@ static void versatile_init(MachineState *machine, int board_id)
71
pl011_create(0x101f3000, pic[14], serial_hd(2));
72
pl011_create(0x10009000, sic[6], serial_hd(3));
73
74
- sysbus_create_simple("pl080", 0x10130000, pic[17]);
75
+ dev = qdev_create(NULL, "pl080");
76
+ object_property_set_link(OBJECT(dev), OBJECT(sysmem), "downstream",
77
+ &error_fatal);
78
+ qdev_init_nofail(dev);
79
+ busdev = SYS_BUS_DEVICE(dev);
80
+ sysbus_mmio_map(busdev, 0, 0x10130000);
81
+ sysbus_connect_irq(busdev, 0, pic[17]);
82
+
83
sysbus_create_simple("sp804", 0x101e2000, pic[4]);
84
sysbus_create_simple("sp804", 0x101e3000, pic[5]);
85
86
diff --git a/hw/dma/pl080.c b/hw/dma/pl080.c
87
index XXXXXXX..XXXXXXX 100644
88
--- a/hw/dma/pl080.c
89
+++ b/hw/dma/pl080.c
90
@@ -XXX,XX +XXX,XX @@
91
#include "exec/address-spaces.h"
92
#include "qemu/log.h"
93
#include "hw/dma/pl080.h"
94
+#include "qapi/error.h"
95
96
#define PL080_CONF_E 0x1
97
#define PL080_CONF_M1 0x2
98
@@ -XXX,XX +XXX,XX @@ again:
99
swidth = 1 << ((ch->ctrl >> 18) & 7);
100
dwidth = 1 << ((ch->ctrl >> 21) & 7);
101
for (n = 0; n < dwidth; n+= swidth) {
102
- cpu_physical_memory_read(ch->src, buff + n, swidth);
103
+ address_space_read(&s->downstream_as, ch->src,
104
+ MEMTXATTRS_UNSPECIFIED, buff + n, swidth);
105
if (ch->ctrl & PL080_CCTRL_SI)
106
ch->src += swidth;
107
}
108
xsize = (dwidth < swidth) ? swidth : dwidth;
109
/* ??? This may pad the value incorrectly for dwidth < 32. */
110
for (n = 0; n < xsize; n += dwidth) {
111
- cpu_physical_memory_write(ch->dest + n, buff + n, dwidth);
112
+ address_space_write(&s->downstream_as, ch->dest + n,
113
+ MEMTXATTRS_UNSPECIFIED, buff + n, dwidth);
114
if (ch->ctrl & PL080_CCTRL_DI)
115
ch->dest += swidth;
116
}
117
@@ -XXX,XX +XXX,XX @@ again:
118
if (size == 0) {
119
/* Transfer complete. */
120
if (ch->lli) {
121
- ch->src = address_space_ldl_le(&address_space_memory,
122
+ ch->src = address_space_ldl_le(&s->downstream_as,
123
ch->lli,
124
MEMTXATTRS_UNSPECIFIED,
125
NULL);
126
- ch->dest = address_space_ldl_le(&address_space_memory,
127
+ ch->dest = address_space_ldl_le(&s->downstream_as,
128
ch->lli + 4,
129
MEMTXATTRS_UNSPECIFIED,
130
NULL);
131
- ch->ctrl = address_space_ldl_le(&address_space_memory,
132
+ ch->ctrl = address_space_ldl_le(&s->downstream_as,
133
ch->lli + 12,
134
MEMTXATTRS_UNSPECIFIED,
135
NULL);
136
- ch->lli = address_space_ldl_le(&address_space_memory,
137
+ ch->lli = address_space_ldl_le(&s->downstream_as,
138
ch->lli + 8,
139
MEMTXATTRS_UNSPECIFIED,
140
NULL);
141
@@ -XXX,XX +XXX,XX @@ static void pl080_init(Object *obj)
142
s->nchannels = 8;
143
}
144
145
+static void pl080_realize(DeviceState *dev, Error **errp)
146
+{
147
+ PL080State *s = PL080(dev);
148
+
149
+ if (!s->downstream) {
150
+ error_setg(errp, "PL080 'downstream' link not set");
151
+ return;
152
+ }
153
+
154
+ address_space_init(&s->downstream_as, s->downstream, "pl080-downstream");
155
+}
156
+
157
static void pl081_init(Object *obj)
158
{
159
PL080State *s = PL080(obj);
160
@@ -XXX,XX +XXX,XX @@ static void pl081_init(Object *obj)
161
s->nchannels = 2;
162
}
163
164
+static Property pl080_properties[] = {
165
+ DEFINE_PROP_LINK("downstream", PL080State, downstream,
166
+ TYPE_MEMORY_REGION, MemoryRegion *),
167
+ DEFINE_PROP_END_OF_LIST(),
168
+};
169
+
170
static void pl080_class_init(ObjectClass *oc, void *data)
171
{
172
DeviceClass *dc = DEVICE_CLASS(oc);
173
174
dc->vmsd = &vmstate_pl080;
175
+ dc->realize = pl080_realize;
176
+ dc->props = pl080_properties;
177
}
178
179
static const TypeInfo pl080_info = {
180
--
181
2.18.0
182
183
diff view generated by jsdifflib
Deleted patch
1
The PL080/PL081 model is missing a reset function; implement it.
2
1
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
5
---
6
hw/dma/pl080.c | 25 +++++++++++++++++++++++++
7
1 file changed, 25 insertions(+)
8
9
diff --git a/hw/dma/pl080.c b/hw/dma/pl080.c
10
index XXXXXXX..XXXXXXX 100644
11
--- a/hw/dma/pl080.c
12
+++ b/hw/dma/pl080.c
13
@@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps pl080_ops = {
14
.endianness = DEVICE_NATIVE_ENDIAN,
15
};
16
17
+static void pl080_reset(DeviceState *dev)
18
+{
19
+ PL080State *s = PL080(dev);
20
+ int i;
21
+
22
+ s->tc_int = 0;
23
+ s->tc_mask = 0;
24
+ s->err_int = 0;
25
+ s->err_mask = 0;
26
+ s->conf = 0;
27
+ s->sync = 0;
28
+ s->req_single = 0;
29
+ s->req_burst = 0;
30
+ s->running = 0;
31
+
32
+ for (i = 0; i < s->nchannels; i++) {
33
+ s->chan[i].src = 0;
34
+ s->chan[i].dest = 0;
35
+ s->chan[i].lli = 0;
36
+ s->chan[i].ctrl = 0;
37
+ s->chan[i].conf = 0;
38
+ }
39
+}
40
+
41
static void pl080_init(Object *obj)
42
{
43
SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
44
@@ -XXX,XX +XXX,XX @@ static void pl080_class_init(ObjectClass *oc, void *data)
45
dc->vmsd = &vmstate_pl080;
46
dc->realize = pl080_realize;
47
dc->props = pl080_properties;
48
+ dc->reset = pl080_reset;
49
}
50
51
static const TypeInfo pl080_info = {
52
--
53
2.18.0
54
55
diff view generated by jsdifflib
Deleted patch
1
A bug in the handling of the register address decode logic
2
for the PL08x meant that we were incorrectly treating
3
accesses to the DMA channel registers (DMACCxSrcAddr,
4
DMACCxDestaddr, DMACCxLLI, DMACCxControl, DMACCxConfiguration)
5
as bad offsets. Fix this long-standing bug.
6
1
7
Fixes: https://bugs.launchpad.net/qemu/+bug/1637974
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
10
---
11
hw/dma/pl080.c | 5 +++--
12
1 file changed, 3 insertions(+), 2 deletions(-)
13
14
diff --git a/hw/dma/pl080.c b/hw/dma/pl080.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/dma/pl080.c
17
+++ b/hw/dma/pl080.c
18
@@ -XXX,XX +XXX,XX @@ static uint64_t pl080_read(void *opaque, hwaddr offset,
19
i = (offset & 0xe0) >> 5;
20
if (i >= s->nchannels)
21
goto bad_offset;
22
- switch (offset >> 2) {
23
+ switch ((offset >> 2) & 7) {
24
case 0: /* SrcAddr */
25
return s->chan[i].src;
26
case 1: /* DestAddr */
27
@@ -XXX,XX +XXX,XX @@ static void pl080_write(void *opaque, hwaddr offset,
28
i = (offset & 0xe0) >> 5;
29
if (i >= s->nchannels)
30
goto bad_offset;
31
- switch (offset >> 2) {
32
+ switch ((offset >> 2) & 7) {
33
case 0: /* SrcAddr */
34
s->chan[i].src = value;
35
break;
36
@@ -XXX,XX +XXX,XX @@ static void pl080_write(void *opaque, hwaddr offset,
37
pl080_run(s);
38
break;
39
}
40
+ return;
41
}
42
switch (offset >> 2) {
43
case 2: /* IntTCClear */
44
--
45
2.18.0
46
47
diff view generated by jsdifflib