1
target-arm queue for softfreeze: this is quite big as I
1
Some arm patches; my to-review queue is by no means empty, but
2
was on holiday last week, so this is all just sneaking in
2
this is a big enough set of patches to be getting on with...
3
under the wire. I particularly wanted to get Philippe's
4
patches in before freeze as that sort of code-movement
5
patchset is painful to have to rebase.
6
3
7
thanks
8
-- PMM
4
-- PMM
9
5
10
The following changes since commit ae9108f8f0746ce64d02afb1a216153a50926132:
6
The following changes since commit cb9c6a8e5ad6a1f0ce164d352e3102df46986e22:
11
7
12
Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-4.1-pull-request' into staging (2019-07-01 15:55:40 +0100)
8
.gitlab-ci.d/windows: Work-around timeout and OpenGL problems of the MSYS2 jobs (2023-01-04 18:58:33 +0000)
13
9
14
are available in the Git repository at:
10
are available in the Git repository at:
15
11
16
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20190701
12
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20230105
17
13
18
for you to fetch changes up to 787a7e76c2e93a48c47b324fea592c9910a70483:
14
for you to fetch changes up to 93c9678de9dc7d2e68f9e8477da072bac30ef132:
19
15
20
target/arm: Declare some M-profile functions publicly (2019-07-01 17:29:01 +0100)
16
hw/net: Fix read of uninitialized memory in imx_fec. (2023-01-05 15:33:00 +0000)
21
17
22
----------------------------------------------------------------
18
----------------------------------------------------------------
23
target-arm queue:
19
target-arm queue:
24
* hw/arm/boot: fix direct kernel boot with initrd
20
* Implement AArch32 ARMv8-R support
25
* hw/arm/msf2-som: Exit when the cpu is not the expected one
21
* Add Cortex-R52 CPU
26
* i.mx7: fix bugs in PCI controller needed to boot recent kernels
22
* fix handling of HLT semihosting in system mode
27
* aspeed: add RTC device
23
* hw/timer/ixm_epit: cleanup and fix bug in compare handling
28
* aspeed: fix some timer device bugs
24
* target/arm: Coding style fixes
29
* aspeed: add swift-bmc board
25
* target/arm: Clean up includes
30
* aspeed: vic: Add support for legacy register interface
26
* nseries: minor code cleanups
31
* aspeed: add aspeed-xdma device
27
* target/arm: align exposed ID registers with Linux
32
* Add new sbsa-ref board for aarch64
28
* hw/arm/smmu-common: remove unnecessary inlines
33
* target/arm: code refactoring in preparation for support of
29
* i.MX7D: Handle GPT timers
34
compilation with TCG disabled
30
* i.MX7D: Connect IRQs to GPIO devices
31
* i.MX6UL: Add a specific GPT timer instance
32
* hw/net: Fix read of uninitialized memory in imx_fec
35
33
36
----------------------------------------------------------------
34
----------------------------------------------------------------
37
Adriana Kobylak (1):
35
Alex Bennée (1):
38
aspeed: Add support for the swift-bmc board
36
target/arm: fix handling of HLT semihosting in system mode
39
37
40
Andrew Jeffery (3):
38
Axel Heider (8):
41
aspeed/timer: Status register contains reload for stopped timer
39
hw/timer/imx_epit: improve comments
42
aspeed/timer: Fix match calculations
40
hw/timer/imx_epit: cleanup CR defines
43
aspeed: vic: Add support for legacy register interface
41
hw/timer/imx_epit: define SR_OCIF
42
hw/timer/imx_epit: update interrupt state on CR write access
43
hw/timer/imx_epit: hard reset initializes CR with 0
44
hw/timer/imx_epit: factor out register write handlers
45
hw/timer/imx_epit: remove explicit fields cnt and freq
46
hw/timer/imx_epit: fix compare timer handling
44
47
45
Andrew Jones (1):
48
Claudio Fontana (1):
46
hw/arm/boot: fix direct kernel boot with initrd
49
target/arm: cleanup cpu includes
47
50
48
Andrey Smirnov (5):
51
Fabiano Rosas (5):
49
i.mx7d: Add no-op/unimplemented APBH DMA module
52
target/arm: Fix checkpatch comment style warnings in helper.c
50
i.mx7d: Add no-op/unimplemented PCIE PHY IP block
53
target/arm: Fix checkpatch space errors in helper.c
51
pci: designware: Update MSI mapping unconditionally
54
target/arm: Fix checkpatch brace errors in helper.c
52
pci: designware: Update MSI mapping when MSI address changes
55
target/arm: Remove unused includes from m_helper.c
53
i.mx7d: pci: Update PCI IRQ mapping to match HW
56
target/arm: Remove unused includes from helper.c
54
57
55
Christian Svensson (1):
58
Jean-Christophe Dubois (4):
56
aspeed/timer: Ensure positive muldiv delta
59
i.MX7D: Connect GPT timers to IRQ
60
i.MX7D: Compute clock frequency for the fixed frequency clocks.
61
i.MX6UL: Add a specific GPT timer instance for the i.MX6UL
62
i.MX7D: Connect IRQs to GPIO devices.
57
63
58
Cédric Le Goater (7):
64
Peter Maydell (1):
59
aspeed: add a per SoC mapping for the interrupt space
65
target/arm:Set lg_page_size to 0 if either S1 or S2 asks for it
60
aspeed: add a per SoC mapping for the memory space
61
aspeed: introduce a configurable number of CPU per machine
62
aspeed: add support for multiple NICs
63
aspeed: remove the "ram" link
64
aspeed: add a RAM memory region container
65
aspeed/smc: add a 'sdram_base' property
66
66
67
Eddie James (1):
67
Philippe Mathieu-Daudé (5):
68
hw/misc/aspeed_xdma: New device
68
hw/input/tsc2xxx: Constify set_transform()'s MouseTransformInfo arg
69
hw/arm/nseries: Constify various read-only arrays
70
hw/arm/nseries: Silent -Wmissing-field-initializers warning
71
hw/arm/smmu-common: Reduce smmu_inv_notifiers_mr() scope
72
hw/arm/smmu-common: Avoid using inlined functions with external linkage
69
73
70
Hongbo Zhang (2):
74
Stephen Longfield (1):
71
hw/arm: Add arm SBSA reference machine, skeleton part
75
hw/net: Fix read of uninitialized memory in imx_fec.
72
hw/arm: Add arm SBSA reference machine, devices part
73
76
74
Jan Kiszka (1):
77
Tobias Röhmel (7):
75
hw/arm/virt: Add support for Cortex-A7
78
target/arm: Don't add all MIDR aliases for cores that implement PMSA
79
target/arm: Make RVBAR available for all ARMv8 CPUs
80
target/arm: Make stage_2_format for cache attributes optional
81
target/arm: Enable TTBCR_EAE for ARMv8-R AArch32
82
target/arm: Add PMSAv8r registers
83
target/arm: Add PMSAv8r functionality
84
target/arm: Add ARM Cortex-R52 CPU
76
85
77
Joel Stanley (4):
86
Zhuojia Shen (1):
78
hw: timer: Add ASPEED RTC device
87
target/arm: align exposed ID registers with Linux
79
hw/arm/aspeed: Add RTC to SoC
80
aspeed/timer: Fix behaviour running Linux
81
aspeed: Link SCU to the watchdog
82
88
83
Philippe Mathieu-Daudé (19):
89
include/hw/arm/fsl-imx7.h | 20 +
84
hw/arm/msf2-som: Exit when the cpu is not the expected one
90
include/hw/arm/smmu-common.h | 3 -
85
target/arm: Makefile cleanup (Aarch64)
91
include/hw/input/tsc2xxx.h | 4 +-
86
target/arm: Makefile cleanup (ARM)
92
include/hw/timer/imx_epit.h | 8 +-
87
target/arm: Makefile cleanup (KVM)
93
include/hw/timer/imx_gpt.h | 1 +
88
target/arm: Makefile cleanup (softmmu)
94
target/arm/cpu.h | 6 +
89
target/arm: Add copyright boilerplate
95
target/arm/internals.h | 4 +
90
target/arm/helper: Remove unused include
96
hw/arm/fsl-imx6ul.c | 2 +-
91
target/arm: Fix multiline comment syntax
97
hw/arm/fsl-imx7.c | 41 +-
92
target/arm: Fix coding style issues
98
hw/arm/nseries.c | 28 +-
93
target/arm: Move CPU state dumping routines to cpu.c
99
hw/arm/smmu-common.c | 15 +-
94
target/arm: Declare get_phys_addr() function publicly
100
hw/input/tsc2005.c | 2 +-
95
target/arm: Move TLB related routines to tlb_helper.c
101
hw/input/tsc210x.c | 3 +-
96
target/arm/vfp_helper: Move code around
102
hw/misc/imx6ul_ccm.c | 6 -
97
target/arm/vfp_helper: Extract vfp_set_fpscr_to_host()
103
hw/misc/imx7_ccm.c | 49 ++-
98
target/arm/vfp_helper: Extract vfp_set_fpscr_from_host()
104
hw/net/imx_fec.c | 8 +-
99
target/arm/vfp_helper: Restrict the SoftFloat use to TCG
105
hw/timer/imx_epit.c | 376 +++++++++-------
100
target/arm: Restrict PSCI to TCG
106
hw/timer/imx_gpt.c | 25 ++
101
target/arm: Declare arm_log_exception() function publicly
107
target/arm/cpu.c | 35 +-
102
target/arm: Declare some M-profile functions publicly
108
target/arm/cpu64.c | 6 -
109
target/arm/cpu_tcg.c | 42 ++
110
target/arm/debug_helper.c | 3 +
111
target/arm/helper.c | 871 +++++++++++++++++++++++++++++---------
112
target/arm/m_helper.c | 16 -
113
target/arm/machine.c | 28 ++
114
target/arm/ptw.c | 152 +++++--
115
target/arm/tlb_helper.c | 4 +
116
target/arm/translate.c | 2 +-
117
tests/tcg/aarch64/sysregs.c | 24 +-
118
tests/tcg/aarch64/Makefile.target | 7 +-
119
30 files changed, 1330 insertions(+), 461 deletions(-)
103
120
104
Samuel Ortiz (1):
105
target/arm: Move the DC ZVA helper into op_helper
106
107
hw/arm/Makefile.objs | 1 +
108
hw/misc/Makefile.objs | 1 +
109
hw/timer/Makefile.objs | 2 +-
110
target/arm/Makefile.objs | 24 +-
111
include/hw/arm/aspeed_soc.h | 53 ++-
112
include/hw/arm/fsl-imx7.h | 14 +-
113
include/hw/misc/aspeed_xdma.h | 30 ++
114
include/hw/ssi/aspeed_smc.h | 3 +
115
include/hw/timer/aspeed_rtc.h | 31 ++
116
include/hw/watchdog/wdt_aspeed.h | 1 +
117
target/arm/cpu.h | 2 -
118
target/arm/internals.h | 69 ++-
119
target/arm/translate.h | 5 -
120
hw/arm/aspeed.c | 76 +++-
121
hw/arm/aspeed_soc.c | 262 +++++++++---
122
hw/arm/boot.c | 3 +-
123
hw/arm/fsl-imx7.c | 11 +
124
hw/arm/msf2-som.c | 1 +
125
hw/arm/sbsa-ref.c | 806 ++++++++++++++++++++++++++++++++++++
126
hw/arm/virt.c | 1 +
127
hw/intc/aspeed_vic.c | 105 +++--
128
hw/misc/aspeed_xdma.c | 165 ++++++++
129
hw/pci-host/designware.c | 18 +-
130
hw/ssi/aspeed_smc.c | 1 +
131
hw/timer/aspeed_rtc.c | 180 ++++++++
132
hw/timer/aspeed_timer.c | 76 ++--
133
hw/watchdog/wdt_aspeed.c | 20 +
134
target/arm/cpu.c | 232 ++++++++++-
135
target/arm/helper.c | 498 +++++++++-------------
136
target/arm/op_helper.c | 262 ++++++------
137
target/arm/tlb_helper.c | 200 +++++++++
138
target/arm/translate-a64.c | 128 ------
139
target/arm/translate.c | 91 +---
140
target/arm/vfp_helper.c | 199 +++++----
141
MAINTAINERS | 8 +
142
default-configs/aarch64-softmmu.mak | 1 +
143
hw/arm/Kconfig | 14 +
144
hw/misc/trace-events | 3 +
145
hw/timer/trace-events | 4 +
146
39 files changed, 2675 insertions(+), 926 deletions(-)
147
create mode 100644 include/hw/misc/aspeed_xdma.h
148
create mode 100644 include/hw/timer/aspeed_rtc.h
149
create mode 100644 hw/arm/sbsa-ref.c
150
create mode 100644 hw/misc/aspeed_xdma.c
151
create mode 100644 hw/timer/aspeed_rtc.c
152
create mode 100644 target/arm/tlb_helper.c
153
diff view generated by jsdifflib
Deleted patch
1
From: Andrew Jones <drjones@redhat.com>
2
1
3
Fix the condition used to check whether the initrd fits
4
into RAM; in some cases if an initrd was also passed on
5
the command line we would get an error stating that it
6
was too big to fit into RAM after the kernel. Despite the
7
error the loader continued anyway, though, so also add an
8
exit(1) when the initrd is actually too big.
9
10
Fixes: 852dc64d665f ("hw/arm/boot: Diagnose layouts that put initrd or
11
DTB off the end of RAM")
12
Signed-off-by: Andrew Jones <drjones@redhat.com>
13
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
14
Message-id: 20190618125844.4863-1-drjones@redhat.com
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
---
17
hw/arm/boot.c | 3 ++-
18
1 file changed, 2 insertions(+), 1 deletion(-)
19
20
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
21
index XXXXXXX..XXXXXXX 100644
22
--- a/hw/arm/boot.c
23
+++ b/hw/arm/boot.c
24
@@ -XXX,XX +XXX,XX @@ static void arm_setup_direct_kernel_boot(ARMCPU *cpu,
25
info->initrd_filename);
26
exit(1);
27
}
28
- if (info->initrd_start + initrd_size > info->ram_size) {
29
+ if (info->initrd_start + initrd_size > ram_end) {
30
error_report("could not load initrd '%s': "
31
"too big to fit into RAM after the kernel",
32
info->initrd_filename);
33
+ exit(1);
34
}
35
} else {
36
initrd_size = 0;
37
--
38
2.20.1
39
40
diff view generated by jsdifflib
Deleted patch
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
2
1
3
This machine correctly defines its default_cpu_type to cortex-m3
4
and report an error if the user requested another cpu_type,
5
however it does not exit, and this can confuse users trying
6
to use another core:
7
8
$ qemu-system-arm -M emcraft-sf2 -cpu cortex-m4 -kernel test-m4.elf
9
qemu-system-arm: This board can only be used with CPU cortex-m3-arm-cpu
10
[output related to M3 core ...]
11
12
The CPU is indeed a M3 core:
13
14
(qemu) info qom-tree
15
/machine (emcraft-sf2-machine)
16
/unattached (container)
17
/device[0] (msf2-soc)
18
/armv7m (armv7m)
19
/cpu (cortex-m3-arm-cpu)
20
21
Add the missing exit() call to return to the shell.
22
23
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
24
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
25
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
26
Message-id: 20190617160136.29930-1-philmd@redhat.com
27
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
28
---
29
hw/arm/msf2-som.c | 1 +
30
1 file changed, 1 insertion(+)
31
32
diff --git a/hw/arm/msf2-som.c b/hw/arm/msf2-som.c
33
index XXXXXXX..XXXXXXX 100644
34
--- a/hw/arm/msf2-som.c
35
+++ b/hw/arm/msf2-som.c
36
@@ -XXX,XX +XXX,XX @@ static void emcraft_sf2_s2s010_init(MachineState *machine)
37
if (strcmp(machine->cpu_type, mc->default_cpu_type) != 0) {
38
error_report("This board can only be used with CPU %s",
39
mc->default_cpu_type);
40
+ exit(1);
41
}
42
43
memory_region_init_ram(ddr, NULL, "ddr-ram", DDR_SIZE,
44
--
45
2.20.1
46
47
diff view generated by jsdifflib
1
From: Andrew Jeffery <andrew@aj.id.au>
1
In get_phys_addr_twostage() we set the lg_page_size of the result to
2
the maximum of the stage 1 and stage 2 page sizes. This works for
3
the case where we do want to create a TLB entry, because we know the
4
common TLB code only creates entries of the TARGET_PAGE_SIZE and
5
asking for a size larger than that only means that invalidations
6
invalidate the whole larger area. However, if lg_page_size is
7
smaller than TARGET_PAGE_SIZE this effectively means "don't create a
8
TLB entry"; in this case if either S1 or S2 said "this covers less
9
than a page and can't go in a TLB" then the final result also should
10
be marked that way. Set the resulting page size to 0 if either
11
stage asked for a less-than-a-page entry, and expand the comment
12
to explain what's going on.
2
13
3
The legacy interface only supported up to 32 IRQs, which became
14
This has no effect for VMSA because currently the VMSA lookup always
4
restrictive around the AST2400 generation. QEMU support for the SoCs
15
returns results that cover at least TARGET_PAGE_SIZE; however when we
5
started with the AST2400 along with an effort to reimplement and
16
add v8R support it will reuse this code path, and for v8R the S1 and
6
upstream drivers for Linux, so up until this point the consumers of the
17
S2 results can be smaller than TARGET_PAGE_SIZE.
7
QEMU ASPEED support only required the 64 IRQ register interface.
8
18
9
In an effort to support older BMC firmware, add support for the 32 IRQ
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
interface.
20
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
21
Message-id: 20221212142708.610090-1-peter.maydell@linaro.org
22
---
23
target/arm/ptw.c | 16 +++++++++++++---
24
1 file changed, 13 insertions(+), 3 deletions(-)
11
25
12
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
26
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
13
Signed-off-by: Cédric Le Goater <clg@kaod.org>
14
Reviewed-by: Joel Stanley <joel@jms.id.au>
15
Message-id: 20190618165311.27066-22-clg@kaod.org
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
---
18
hw/intc/aspeed_vic.c | 105 ++++++++++++++++++++++++++-----------------
19
1 file changed, 63 insertions(+), 42 deletions(-)
20
21
diff --git a/hw/intc/aspeed_vic.c b/hw/intc/aspeed_vic.c
22
index XXXXXXX..XXXXXXX 100644
27
index XXXXXXX..XXXXXXX 100644
23
--- a/hw/intc/aspeed_vic.c
28
--- a/target/arm/ptw.c
24
+++ b/hw/intc/aspeed_vic.c
29
+++ b/target/arm/ptw.c
25
@@ -XXX,XX +XXX,XX @@ static void aspeed_vic_set_irq(void *opaque, int irq, int level)
30
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw,
26
27
static uint64_t aspeed_vic_read(void *opaque, hwaddr offset, unsigned size)
28
{
29
- uint64_t val;
30
- const bool high = !!(offset & 0x4);
31
- hwaddr n_offset = (offset & ~0x4);
32
AspeedVICState *s = (AspeedVICState *)opaque;
33
+ hwaddr n_offset;
34
+ uint64_t val;
35
+ bool high;
36
37
if (offset < AVIC_NEW_BASE_OFFSET) {
38
- qemu_log_mask(LOG_UNIMP, "%s: Ignoring read from legacy registers "
39
- "at 0x%" HWADDR_PRIx "[%u]\n", __func__, offset, size);
40
- return 0;
41
+ high = false;
42
+ n_offset = offset;
43
+ } else {
44
+ high = !!(offset & 0x4);
45
+ n_offset = (offset & ~0x4);
46
}
31
}
47
32
48
- n_offset -= AVIC_NEW_BASE_OFFSET;
33
/*
49
-
34
- * Use the maximum of the S1 & S2 page size, so that invalidation
50
switch (n_offset) {
35
- * of pages > TARGET_PAGE_SIZE works correctly.
51
- case 0x0: /* IRQ Status */
36
+ * If either S1 or S2 returned a result smaller than TARGET_PAGE_SIZE,
52
+ case 0x80: /* IRQ Status */
37
+ * this means "don't put this in the TLB"; in this case, return a
53
+ case 0x00:
38
+ * result with lg_page_size == 0 to achieve that. Otherwise,
54
val = s->raw & ~s->select & s->enable;
39
+ * use the maximum of the S1 & S2 page size, so that invalidation
55
break;
40
+ * of pages > TARGET_PAGE_SIZE works correctly. (This works even though
56
- case 0x08: /* FIQ Status */
41
+ * we know the combined result permissions etc only cover the minimum
57
+ case 0x88: /* FIQ Status */
42
+ * of the S1 and S2 page size, because we know that the common TLB code
58
+ case 0x04:
43
+ * never actually creates TLB entries bigger than TARGET_PAGE_SIZE,
59
val = s->raw & s->select & s->enable;
44
+ * and passing a larger page size value only affects invalidations.)
60
break;
45
*/
61
- case 0x10: /* Raw Interrupt Status */
46
- if (result->f.lg_page_size < s1_lgpgsz) {
62
+ case 0x90: /* Raw Interrupt Status */
47
+ if (result->f.lg_page_size < TARGET_PAGE_BITS ||
63
+ case 0x08:
48
+ s1_lgpgsz < TARGET_PAGE_BITS) {
64
val = s->raw;
49
+ result->f.lg_page_size = 0;
65
break;
50
+ } else if (result->f.lg_page_size < s1_lgpgsz) {
66
- case 0x18: /* Interrupt Selection */
51
result->f.lg_page_size = s1_lgpgsz;
67
+ case 0x98: /* Interrupt Selection */
68
+ case 0x0c:
69
val = s->select;
70
break;
71
- case 0x20: /* Interrupt Enable */
72
+ case 0xa0: /* Interrupt Enable */
73
+ case 0x10:
74
val = s->enable;
75
break;
76
- case 0x30: /* Software Interrupt */
77
+ case 0xb0: /* Software Interrupt */
78
+ case 0x18:
79
val = s->trigger;
80
break;
81
- case 0x40: /* Interrupt Sensitivity */
82
+ case 0xc0: /* Interrupt Sensitivity */
83
+ case 0x24:
84
val = s->sense;
85
break;
86
- case 0x48: /* Interrupt Both Edge Trigger Control */
87
+ case 0xc8: /* Interrupt Both Edge Trigger Control */
88
+ case 0x28:
89
val = s->dual_edge;
90
break;
91
- case 0x50: /* Interrupt Event */
92
+ case 0xd0: /* Interrupt Event */
93
+ case 0x2c:
94
val = s->event;
95
break;
96
- case 0x60: /* Edge Triggered Interrupt Status */
97
+ case 0xe0: /* Edge Triggered Interrupt Status */
98
val = s->raw & ~s->sense;
99
break;
100
/* Illegal */
101
- case 0x28: /* Interrupt Enable Clear */
102
- case 0x38: /* Software Interrupt Clear */
103
- case 0x58: /* Edge Triggered Interrupt Clear */
104
+ case 0xa8: /* Interrupt Enable Clear */
105
+ case 0xb8: /* Software Interrupt Clear */
106
+ case 0xd8: /* Edge Triggered Interrupt Clear */
107
qemu_log_mask(LOG_GUEST_ERROR,
108
"%s: Read of write-only register with offset 0x%"
109
HWADDR_PRIx "\n", __func__, offset);
110
@@ -XXX,XX +XXX,XX @@ static uint64_t aspeed_vic_read(void *opaque, hwaddr offset, unsigned size)
111
}
52
}
112
if (high) {
53
113
val = extract64(val, 32, 19);
114
+ } else {
115
+ val = extract64(val, 0, 32);
116
}
117
trace_aspeed_vic_read(offset, size, val);
118
return val;
119
@@ -XXX,XX +XXX,XX @@ static uint64_t aspeed_vic_read(void *opaque, hwaddr offset, unsigned size)
120
static void aspeed_vic_write(void *opaque, hwaddr offset, uint64_t data,
121
unsigned size)
122
{
123
- const bool high = !!(offset & 0x4);
124
- hwaddr n_offset = (offset & ~0x4);
125
AspeedVICState *s = (AspeedVICState *)opaque;
126
+ hwaddr n_offset;
127
+ bool high;
128
129
if (offset < AVIC_NEW_BASE_OFFSET) {
130
- qemu_log_mask(LOG_UNIMP,
131
- "%s: Ignoring write to legacy registers at 0x%"
132
- HWADDR_PRIx "[%u] <- 0x%" PRIx64 "\n", __func__, offset,
133
- size, data);
134
- return;
135
+ high = false;
136
+ n_offset = offset;
137
+ } else {
138
+ high = !!(offset & 0x4);
139
+ n_offset = (offset & ~0x4);
140
}
141
142
- n_offset -= AVIC_NEW_BASE_OFFSET;
143
trace_aspeed_vic_write(offset, size, data);
144
145
/* Given we have members using separate enable/clear registers, deposit64()
146
@@ -XXX,XX +XXX,XX @@ static void aspeed_vic_write(void *opaque, hwaddr offset, uint64_t data,
147
}
148
149
switch (n_offset) {
150
- case 0x18: /* Interrupt Selection */
151
+ case 0x98: /* Interrupt Selection */
152
+ case 0x0c:
153
/* Register has deposit64() semantics - overwrite requested 32 bits */
154
if (high) {
155
s->select &= AVIC_L_MASK;
156
@@ -XXX,XX +XXX,XX @@ static void aspeed_vic_write(void *opaque, hwaddr offset, uint64_t data,
157
}
158
s->select |= data;
159
break;
160
- case 0x20: /* Interrupt Enable */
161
+ case 0xa0: /* Interrupt Enable */
162
+ case 0x10:
163
s->enable |= data;
164
break;
165
- case 0x28: /* Interrupt Enable Clear */
166
+ case 0xa8: /* Interrupt Enable Clear */
167
+ case 0x14:
168
s->enable &= ~data;
169
break;
170
- case 0x30: /* Software Interrupt */
171
+ case 0xb0: /* Software Interrupt */
172
+ case 0x18:
173
qemu_log_mask(LOG_UNIMP, "%s: Software interrupts unavailable. "
174
"IRQs requested: 0x%016" PRIx64 "\n", __func__, data);
175
break;
176
- case 0x38: /* Software Interrupt Clear */
177
+ case 0xb8: /* Software Interrupt Clear */
178
+ case 0x1c:
179
qemu_log_mask(LOG_UNIMP, "%s: Software interrupts unavailable. "
180
"IRQs to be cleared: 0x%016" PRIx64 "\n", __func__, data);
181
break;
182
- case 0x50: /* Interrupt Event */
183
+ case 0xd0: /* Interrupt Event */
184
/* Register has deposit64() semantics - overwrite the top four valid
185
* IRQ bits, as only the top four IRQs (GPIOs) can change their event
186
* type */
187
@@ -XXX,XX +XXX,XX @@ static void aspeed_vic_write(void *opaque, hwaddr offset, uint64_t data,
188
"Ignoring invalid write to interrupt event register");
189
}
190
break;
191
- case 0x58: /* Edge Triggered Interrupt Clear */
192
+ case 0xd8: /* Edge Triggered Interrupt Clear */
193
+ case 0x38:
194
s->raw &= ~(data & ~s->sense);
195
break;
196
- case 0x00: /* IRQ Status */
197
- case 0x08: /* FIQ Status */
198
- case 0x10: /* Raw Interrupt Status */
199
- case 0x40: /* Interrupt Sensitivity */
200
- case 0x48: /* Interrupt Both Edge Trigger Control */
201
- case 0x60: /* Edge Triggered Interrupt Status */
202
+ case 0x80: /* IRQ Status */
203
+ case 0x00:
204
+ case 0x88: /* FIQ Status */
205
+ case 0x04:
206
+ case 0x90: /* Raw Interrupt Status */
207
+ case 0x08:
208
+ case 0xc0: /* Interrupt Sensitivity */
209
+ case 0x24:
210
+ case 0xc8: /* Interrupt Both Edge Trigger Control */
211
+ case 0x28:
212
+ case 0xe0: /* Edge Triggered Interrupt Status */
213
qemu_log_mask(LOG_GUEST_ERROR,
214
"%s: Write of read-only register with offset 0x%"
215
HWADDR_PRIx "\n", __func__, offset);
216
--
54
--
217
2.20.1
55
2.25.1
218
219
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
From: Tobias Röhmel <tobias.roehmel@rwth-aachen.de>
2
2
3
In the next commit we will split the TLB related routines of
3
Cores with PMSA have the MPUIR register which has the
4
this file, and this function will also be called in the new
4
same encoding as the MIDR alias with opc2=4. So we only
5
file. Declare it in the "internals.h" header.
5
add that alias if we are not realizing a core that
6
implements PMSA.
6
7
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
8
Signed-off-by: Tobias Röhmel <tobias.roehmel@rwth-aachen.de>
8
Message-id: 20190701132516.26392-12-philmd@redhat.com
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11
Message-id: 20221206102504.165775-2-tobias.roehmel@rwth-aachen.de
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
13
---
12
target/arm/internals.h | 16 ++++++++++++++++
14
target/arm/helper.c | 13 +++++++++----
13
target/arm/helper.c | 21 +++++----------------
15
1 file changed, 9 insertions(+), 4 deletions(-)
14
2 files changed, 21 insertions(+), 16 deletions(-)
15
16
16
diff --git a/target/arm/internals.h b/target/arm/internals.h
17
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/internals.h
19
+++ b/target/arm/internals.h
20
@@ -XXX,XX +XXX,XX @@ static inline int exception_target_el(CPUARMState *env)
21
return target_el;
22
}
23
24
+#ifndef CONFIG_USER_ONLY
25
+
26
+/* Cacheability and shareability attributes for a memory access */
27
+typedef struct ARMCacheAttrs {
28
+ unsigned int attrs:8; /* as in the MAIR register encoding */
29
+ unsigned int shareability:2; /* as in the SH field of the VMSAv8-64 PTEs */
30
+} ARMCacheAttrs;
31
+
32
+bool get_phys_addr(CPUARMState *env, target_ulong address,
33
+ MMUAccessType access_type, ARMMMUIdx mmu_idx,
34
+ hwaddr *phys_ptr, MemTxAttrs *attrs, int *prot,
35
+ target_ulong *page_size,
36
+ ARMMMUFaultInfo *fi, ARMCacheAttrs *cacheattrs);
37
+
38
+#endif /* !CONFIG_USER_ONLY */
39
+
40
#endif
41
diff --git a/target/arm/helper.c b/target/arm/helper.c
17
diff --git a/target/arm/helper.c b/target/arm/helper.c
42
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
43
--- a/target/arm/helper.c
19
--- a/target/arm/helper.c
44
+++ b/target/arm/helper.c
20
+++ b/target/arm/helper.c
45
@@ -XXX,XX +XXX,XX @@
21
@@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu)
46
#define ARM_CPU_FREQ 1000000000 /* FIXME: 1 GHz, should be configurable */
22
.access = PL1_R, .type = ARM_CP_NO_RAW, .resetvalue = cpu->midr,
47
23
.fieldoffset = offsetof(CPUARMState, cp15.c0_cpuid),
48
#ifndef CONFIG_USER_ONLY
24
.readfn = midr_read },
49
-/* Cacheability and shareability attributes for a memory access */
25
- /* crn = 0 op1 = 0 crm = 0 op2 = 4,7 : AArch32 aliases of MIDR */
50
-typedef struct ARMCacheAttrs {
26
- { .name = "MIDR", .type = ARM_CP_ALIAS | ARM_CP_CONST,
51
- unsigned int attrs:8; /* as in the MAIR register encoding */
27
- .cp = 15, .crn = 0, .crm = 0, .opc1 = 0, .opc2 = 4,
52
- unsigned int shareability:2; /* as in the SH field of the VMSAv8-64 PTEs */
28
- .access = PL1_R, .resetvalue = cpu->midr },
53
-} ARMCacheAttrs;
29
+ /* crn = 0 op1 = 0 crm = 0 op2 = 7 : AArch32 aliases of MIDR */
54
-
30
{ .name = "MIDR", .type = ARM_CP_ALIAS | ARM_CP_CONST,
55
-static bool get_phys_addr(CPUARMState *env, target_ulong address,
31
.cp = 15, .crn = 0, .crm = 0, .opc1 = 0, .opc2 = 7,
56
- MMUAccessType access_type, ARMMMUIdx mmu_idx,
32
.access = PL1_R, .resetvalue = cpu->midr },
57
- hwaddr *phys_ptr, MemTxAttrs *attrs, int *prot,
33
@@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu)
58
- target_ulong *page_size,
34
.accessfn = access_aa64_tid1,
59
- ARMMMUFaultInfo *fi, ARMCacheAttrs *cacheattrs);
35
.type = ARM_CP_CONST, .resetvalue = cpu->revidr },
60
36
};
61
static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address,
37
+ ARMCPRegInfo id_v8_midr_alias_cp_reginfo = {
62
MMUAccessType access_type, ARMMMUIdx mmu_idx,
38
+ .name = "MIDR", .type = ARM_CP_ALIAS | ARM_CP_CONST,
63
@@ -XXX,XX +XXX,XX @@ static ARMCacheAttrs combine_cacheattrs(ARMCacheAttrs s1, ARMCacheAttrs s2)
39
+ .cp = 15, .crn = 0, .crm = 0, .opc1 = 0, .opc2 = 4,
64
* @fi: set to fault info if the translation fails
40
+ .access = PL1_R, .resetvalue = cpu->midr
65
* @cacheattrs: (if non-NULL) set to the cacheability/shareability attributes
41
+ };
66
*/
42
ARMCPRegInfo id_cp_reginfo[] = {
67
-static bool get_phys_addr(CPUARMState *env, target_ulong address,
43
/* These are common to v8 and pre-v8 */
68
- MMUAccessType access_type, ARMMMUIdx mmu_idx,
44
{ .name = "CTR",
69
- hwaddr *phys_ptr, MemTxAttrs *attrs, int *prot,
45
@@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu)
70
- target_ulong *page_size,
46
}
71
- ARMMMUFaultInfo *fi, ARMCacheAttrs *cacheattrs)
47
if (arm_feature(env, ARM_FEATURE_V8)) {
72
+bool get_phys_addr(CPUARMState *env, target_ulong address,
48
define_arm_cp_regs(cpu, id_v8_midr_cp_reginfo);
73
+ MMUAccessType access_type, ARMMMUIdx mmu_idx,
49
+ if (!arm_feature(env, ARM_FEATURE_PMSA)) {
74
+ hwaddr *phys_ptr, MemTxAttrs *attrs, int *prot,
50
+ define_one_arm_cp_reg(cpu, &id_v8_midr_alias_cp_reginfo);
75
+ target_ulong *page_size,
51
+ }
76
+ ARMMMUFaultInfo *fi, ARMCacheAttrs *cacheattrs)
52
} else {
77
{
53
define_arm_cp_regs(cpu, id_pre_v8_midr_cp_reginfo);
78
if (mmu_idx == ARMMMUIdx_S12NSE0 || mmu_idx == ARMMMUIdx_S12NSE1) {
54
}
79
/* Call ourselves recursively to do the stage 1 and then stage 2
80
--
55
--
81
2.20.1
56
2.25.1
82
57
83
58
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
From: Tobias Röhmel <tobias.roehmel@rwth-aachen.de>
2
2
3
These routines are TCG specific.
3
RVBAR shadows RVBAR_ELx where x is the highest exception
4
The arm_deliver_fault() function is only used within the new
4
level if the highest EL is not EL3. This patch also allows
5
helper. Make it static.
5
ARMv8 CPUs to change the reset address with
6
the rvbar property.
6
7
7
Suggested-by: Alex Bennée <alex.bennee@linaro.org>
8
Signed-off-by: Tobias Röhmel <tobias.roehmel@rwth-aachen.de>
8
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
9
Message-id: 20190701132516.26392-13-philmd@redhat.com
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Message-id: 20221206102504.165775-3-tobias.roehmel@rwth-aachen.de
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
12
---
13
target/arm/Makefile.objs | 1 +
13
target/arm/cpu.c | 6 +++++-
14
target/arm/internals.h | 3 -
14
target/arm/helper.c | 21 ++++++++++++++-------
15
target/arm/cpu.c | 6 +-
15
2 files changed, 19 insertions(+), 8 deletions(-)
16
target/arm/helper.c | 53 -----------
17
target/arm/op_helper.c | 135 --------------------------
18
target/arm/tlb_helper.c | 200 +++++++++++++++++++++++++++++++++++++++
19
6 files changed, 205 insertions(+), 193 deletions(-)
20
create mode 100644 target/arm/tlb_helper.c
21
16
22
diff --git a/target/arm/Makefile.objs b/target/arm/Makefile.objs
23
index XXXXXXX..XXXXXXX 100644
24
--- a/target/arm/Makefile.objs
25
+++ b/target/arm/Makefile.objs
26
@@ -XXX,XX +XXX,XX @@ target/arm/translate-sve.o: target/arm/decode-sve.inc.c
27
target/arm/translate.o: target/arm/decode-vfp.inc.c
28
target/arm/translate.o: target/arm/decode-vfp-uncond.inc.c
29
30
+obj-y += tlb_helper.o
31
obj-y += translate.o op_helper.o
32
obj-y += crypto_helper.o
33
obj-y += iwmmxt_helper.o vec_helper.o neon_helper.o
34
diff --git a/target/arm/internals.h b/target/arm/internals.h
35
index XXXXXXX..XXXXXXX 100644
36
--- a/target/arm/internals.h
37
+++ b/target/arm/internals.h
38
@@ -XXX,XX +XXX,XX @@ bool arm_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
39
MMUAccessType access_type, int mmu_idx,
40
bool probe, uintptr_t retaddr);
41
42
-void arm_deliver_fault(ARMCPU *cpu, vaddr addr, MMUAccessType access_type,
43
- int mmu_idx, ARMMMUFaultInfo *fi) QEMU_NORETURN;
44
-
45
/* Return true if the stage 1 translation regime is using LPAE format page
46
* tables */
47
bool arm_s1_regime_using_lpae_format(CPUARMState *env, ARMMMUIdx mmu_idx);
48
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
17
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
49
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
50
--- a/target/arm/cpu.c
19
--- a/target/arm/cpu.c
51
+++ b/target/arm/cpu.c
20
+++ b/target/arm/cpu.c
52
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_class_init(ObjectClass *oc, void *data)
21
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset_hold(Object *obj)
53
cc->gdb_write_register = arm_cpu_gdb_write_register;
22
env->cp15.cpacr_el1 = FIELD_DP64(env->cp15.cpacr_el1,
54
#ifndef CONFIG_USER_ONLY
23
CPACR, CP11, 3);
55
cc->do_interrupt = arm_cpu_do_interrupt;
56
- cc->do_unaligned_access = arm_cpu_do_unaligned_access;
57
- cc->do_transaction_failed = arm_cpu_do_transaction_failed;
58
cc->get_phys_page_attrs_debug = arm_cpu_get_phys_page_attrs_debug;
59
cc->asidx_from_attrs = arm_asidx_from_attrs;
60
cc->vmsd = &vmstate_arm_cpu;
61
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_class_init(ObjectClass *oc, void *data)
62
#ifdef CONFIG_TCG
63
cc->tcg_initialize = arm_translate_init;
64
cc->tlb_fill = arm_cpu_tlb_fill;
65
+#if !defined(CONFIG_USER_ONLY)
66
+ cc->do_unaligned_access = arm_cpu_do_unaligned_access;
67
+ cc->do_transaction_failed = arm_cpu_do_transaction_failed;
68
+#endif /* CONFIG_TCG && !CONFIG_USER_ONLY */
69
#endif
24
#endif
70
}
25
+ if (arm_feature(env, ARM_FEATURE_V8)) {
71
26
+ env->cp15.rvbar = cpu->rvbar_prop;
27
+ env->regs[15] = cpu->rvbar_prop;
28
+ }
29
}
30
31
#if defined(CONFIG_USER_ONLY)
32
@@ -XXX,XX +XXX,XX @@ void arm_cpu_post_init(Object *obj)
33
qdev_property_add_static(DEVICE(obj), &arm_cpu_reset_hivecs_property);
34
}
35
36
- if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64)) {
37
+ if (arm_feature(&cpu->env, ARM_FEATURE_V8)) {
38
object_property_add_uint64_ptr(obj, "rvbar",
39
&cpu->rvbar_prop,
40
OBJ_PROP_FLAG_READWRITE);
72
diff --git a/target/arm/helper.c b/target/arm/helper.c
41
diff --git a/target/arm/helper.c b/target/arm/helper.c
73
index XXXXXXX..XXXXXXX 100644
42
index XXXXXXX..XXXXXXX 100644
74
--- a/target/arm/helper.c
43
--- a/target/arm/helper.c
75
+++ b/target/arm/helper.c
44
+++ b/target/arm/helper.c
76
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(v7m_tt)(CPUARMState *env, uint32_t addr, uint32_t op)
45
@@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu)
77
46
if (!arm_feature(env, ARM_FEATURE_EL3) &&
78
#endif
47
!arm_feature(env, ARM_FEATURE_EL2)) {
79
48
ARMCPRegInfo rvbar = {
80
-bool arm_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
49
- .name = "RVBAR_EL1", .state = ARM_CP_STATE_AA64,
81
- MMUAccessType access_type, int mmu_idx,
50
+ .name = "RVBAR_EL1", .state = ARM_CP_STATE_BOTH,
82
- bool probe, uintptr_t retaddr)
51
.opc0 = 3, .opc1 = 0, .crn = 12, .crm = 0, .opc2 = 1,
83
-{
52
.access = PL1_R,
84
- ARMCPU *cpu = ARM_CPU(cs);
53
.fieldoffset = offsetof(CPUARMState, cp15.rvbar),
85
-
54
@@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu)
86
-#ifdef CONFIG_USER_ONLY
55
}
87
- cpu->env.exception.vaddress = address;
56
/* RVBAR_EL2 is only implemented if EL2 is the highest EL */
88
- if (access_type == MMU_INST_FETCH) {
57
if (!arm_feature(env, ARM_FEATURE_EL3)) {
89
- cs->exception_index = EXCP_PREFETCH_ABORT;
58
- ARMCPRegInfo rvbar = {
90
- } else {
59
- .name = "RVBAR_EL2", .state = ARM_CP_STATE_AA64,
91
- cs->exception_index = EXCP_DATA_ABORT;
60
- .opc0 = 3, .opc1 = 4, .crn = 12, .crm = 0, .opc2 = 1,
92
- }
61
- .access = PL2_R,
93
- cpu_loop_exit_restore(cs, retaddr);
62
- .fieldoffset = offsetof(CPUARMState, cp15.rvbar),
94
-#else
63
+ ARMCPRegInfo rvbar[] = {
95
- hwaddr phys_addr;
64
+ {
96
- target_ulong page_size;
65
+ .name = "RVBAR_EL2", .state = ARM_CP_STATE_AA64,
97
- int prot, ret;
66
+ .opc0 = 3, .opc1 = 4, .crn = 12, .crm = 0, .opc2 = 1,
98
- MemTxAttrs attrs = {};
67
+ .access = PL2_R,
99
- ARMMMUFaultInfo fi = {};
68
+ .fieldoffset = offsetof(CPUARMState, cp15.rvbar),
100
-
69
+ },
101
- /*
70
+ { .name = "RVBAR", .type = ARM_CP_ALIAS,
102
- * Walk the page table and (if the mapping exists) add the page
71
+ .cp = 15, .opc1 = 0, .crn = 12, .crm = 0, .opc2 = 1,
103
- * to the TLB. On success, return true. Otherwise, if probing,
72
+ .access = PL2_R,
104
- * return false. Otherwise populate fsr with ARM DFSR/IFSR fault
73
+ .fieldoffset = offsetof(CPUARMState, cp15.rvbar),
105
- * register format, and signal the fault.
74
+ },
106
- */
75
};
107
- ret = get_phys_addr(&cpu->env, address, access_type,
76
- define_one_arm_cp_reg(cpu, &rvbar);
108
- core_to_arm_mmu_idx(&cpu->env, mmu_idx),
77
+ define_arm_cp_regs(cpu, rvbar);
109
- &phys_addr, &attrs, &prot, &page_size, &fi, NULL);
78
}
110
- if (likely(!ret)) {
79
}
111
- /*
80
112
- * Map a single [sub]page. Regions smaller than our declared
113
- * target page size are handled specially, so for those we
114
- * pass in the exact addresses.
115
- */
116
- if (page_size >= TARGET_PAGE_SIZE) {
117
- phys_addr &= TARGET_PAGE_MASK;
118
- address &= TARGET_PAGE_MASK;
119
- }
120
- tlb_set_page_with_attrs(cs, address, phys_addr, attrs,
121
- prot, mmu_idx, page_size);
122
- return true;
123
- } else if (probe) {
124
- return false;
125
- } else {
126
- /* now we have a real cpu fault */
127
- cpu_restore_state(cs, retaddr, true);
128
- arm_deliver_fault(cpu, address, access_type, mmu_idx, &fi);
129
- }
130
-#endif
131
-}
132
-
133
/* Note that signed overflow is undefined in C. The following routines are
134
careful to use unsigned types where modulo arithmetic is required.
135
Failure to do so _will_ break on newer gcc. */
136
diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c
137
index XXXXXXX..XXXXXXX 100644
138
--- a/target/arm/op_helper.c
139
+++ b/target/arm/op_helper.c
140
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(neon_tbl)(uint32_t ireg, uint32_t def, void *vn,
141
return val;
142
}
143
144
-#if !defined(CONFIG_USER_ONLY)
145
-
146
-static inline uint32_t merge_syn_data_abort(uint32_t template_syn,
147
- unsigned int target_el,
148
- bool same_el, bool ea,
149
- bool s1ptw, bool is_write,
150
- int fsc)
151
-{
152
- uint32_t syn;
153
-
154
- /*
155
- * ISV is only set for data aborts routed to EL2 and
156
- * never for stage-1 page table walks faulting on stage 2.
157
- *
158
- * Furthermore, ISV is only set for certain kinds of load/stores.
159
- * If the template syndrome does not have ISV set, we should leave
160
- * it cleared.
161
- *
162
- * See ARMv8 specs, D7-1974:
163
- * ISS encoding for an exception from a Data Abort, the
164
- * ISV field.
165
- */
166
- if (!(template_syn & ARM_EL_ISV) || target_el != 2 || s1ptw) {
167
- syn = syn_data_abort_no_iss(same_el,
168
- ea, 0, s1ptw, is_write, fsc);
169
- } else {
170
- /*
171
- * Fields: IL, ISV, SAS, SSE, SRT, SF and AR come from the template
172
- * syndrome created at translation time.
173
- * Now we create the runtime syndrome with the remaining fields.
174
- */
175
- syn = syn_data_abort_with_iss(same_el,
176
- 0, 0, 0, 0, 0,
177
- ea, 0, s1ptw, is_write, fsc,
178
- false);
179
- /* Merge the runtime syndrome with the template syndrome. */
180
- syn |= template_syn;
181
- }
182
- return syn;
183
-}
184
-
185
-void arm_deliver_fault(ARMCPU *cpu, vaddr addr, MMUAccessType access_type,
186
- int mmu_idx, ARMMMUFaultInfo *fi)
187
-{
188
- CPUARMState *env = &cpu->env;
189
- int target_el;
190
- bool same_el;
191
- uint32_t syn, exc, fsr, fsc;
192
- ARMMMUIdx arm_mmu_idx = core_to_arm_mmu_idx(env, mmu_idx);
193
-
194
- target_el = exception_target_el(env);
195
- if (fi->stage2) {
196
- target_el = 2;
197
- env->cp15.hpfar_el2 = extract64(fi->s2addr, 12, 47) << 4;
198
- }
199
- same_el = (arm_current_el(env) == target_el);
200
-
201
- if (target_el == 2 || arm_el_is_aa64(env, target_el) ||
202
- arm_s1_regime_using_lpae_format(env, arm_mmu_idx)) {
203
- /*
204
- * LPAE format fault status register : bottom 6 bits are
205
- * status code in the same form as needed for syndrome
206
- */
207
- fsr = arm_fi_to_lfsc(fi);
208
- fsc = extract32(fsr, 0, 6);
209
- } else {
210
- fsr = arm_fi_to_sfsc(fi);
211
- /*
212
- * Short format FSR : this fault will never actually be reported
213
- * to an EL that uses a syndrome register. Use a (currently)
214
- * reserved FSR code in case the constructed syndrome does leak
215
- * into the guest somehow.
216
- */
217
- fsc = 0x3f;
218
- }
219
-
220
- if (access_type == MMU_INST_FETCH) {
221
- syn = syn_insn_abort(same_el, fi->ea, fi->s1ptw, fsc);
222
- exc = EXCP_PREFETCH_ABORT;
223
- } else {
224
- syn = merge_syn_data_abort(env->exception.syndrome, target_el,
225
- same_el, fi->ea, fi->s1ptw,
226
- access_type == MMU_DATA_STORE,
227
- fsc);
228
- if (access_type == MMU_DATA_STORE
229
- && arm_feature(env, ARM_FEATURE_V6)) {
230
- fsr |= (1 << 11);
231
- }
232
- exc = EXCP_DATA_ABORT;
233
- }
234
-
235
- env->exception.vaddress = addr;
236
- env->exception.fsr = fsr;
237
- raise_exception(env, exc, syn, target_el);
238
-}
239
-
240
-/* Raise a data fault alignment exception for the specified virtual address */
241
-void arm_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr,
242
- MMUAccessType access_type,
243
- int mmu_idx, uintptr_t retaddr)
244
-{
245
- ARMCPU *cpu = ARM_CPU(cs);
246
- ARMMMUFaultInfo fi = {};
247
-
248
- /* now we have a real cpu fault */
249
- cpu_restore_state(cs, retaddr, true);
250
-
251
- fi.type = ARMFault_Alignment;
252
- arm_deliver_fault(cpu, vaddr, access_type, mmu_idx, &fi);
253
-}
254
-
255
-/*
256
- * arm_cpu_do_transaction_failed: handle a memory system error response
257
- * (eg "no device/memory present at address") by raising an external abort
258
- * exception
259
- */
260
-void arm_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr,
261
- vaddr addr, unsigned size,
262
- MMUAccessType access_type,
263
- int mmu_idx, MemTxAttrs attrs,
264
- MemTxResult response, uintptr_t retaddr)
265
-{
266
- ARMCPU *cpu = ARM_CPU(cs);
267
- ARMMMUFaultInfo fi = {};
268
-
269
- /* now we have a real cpu fault */
270
- cpu_restore_state(cs, retaddr, true);
271
-
272
- fi.ea = arm_extabort_type(response);
273
- fi.type = ARMFault_SyncExternal;
274
- arm_deliver_fault(cpu, addr, access_type, mmu_idx, &fi);
275
-}
276
-
277
-#endif /* !defined(CONFIG_USER_ONLY) */
278
-
279
void HELPER(v8m_stackcheck)(CPUARMState *env, uint32_t newvalue)
280
{
281
/*
282
diff --git a/target/arm/tlb_helper.c b/target/arm/tlb_helper.c
283
new file mode 100644
284
index XXXXXXX..XXXXXXX
285
--- /dev/null
286
+++ b/target/arm/tlb_helper.c
287
@@ -XXX,XX +XXX,XX @@
288
+/*
289
+ * ARM TLB (Translation lookaside buffer) helpers.
290
+ *
291
+ * This code is licensed under the GNU GPL v2 or later.
292
+ *
293
+ * SPDX-License-Identifier: GPL-2.0-or-later
294
+ */
295
+#include "qemu/osdep.h"
296
+#include "cpu.h"
297
+#include "internals.h"
298
+#include "exec/exec-all.h"
299
+
300
+#if !defined(CONFIG_USER_ONLY)
301
+
302
+static inline uint32_t merge_syn_data_abort(uint32_t template_syn,
303
+ unsigned int target_el,
304
+ bool same_el, bool ea,
305
+ bool s1ptw, bool is_write,
306
+ int fsc)
307
+{
308
+ uint32_t syn;
309
+
310
+ /*
311
+ * ISV is only set for data aborts routed to EL2 and
312
+ * never for stage-1 page table walks faulting on stage 2.
313
+ *
314
+ * Furthermore, ISV is only set for certain kinds of load/stores.
315
+ * If the template syndrome does not have ISV set, we should leave
316
+ * it cleared.
317
+ *
318
+ * See ARMv8 specs, D7-1974:
319
+ * ISS encoding for an exception from a Data Abort, the
320
+ * ISV field.
321
+ */
322
+ if (!(template_syn & ARM_EL_ISV) || target_el != 2 || s1ptw) {
323
+ syn = syn_data_abort_no_iss(same_el,
324
+ ea, 0, s1ptw, is_write, fsc);
325
+ } else {
326
+ /*
327
+ * Fields: IL, ISV, SAS, SSE, SRT, SF and AR come from the template
328
+ * syndrome created at translation time.
329
+ * Now we create the runtime syndrome with the remaining fields.
330
+ */
331
+ syn = syn_data_abort_with_iss(same_el,
332
+ 0, 0, 0, 0, 0,
333
+ ea, 0, s1ptw, is_write, fsc,
334
+ false);
335
+ /* Merge the runtime syndrome with the template syndrome. */
336
+ syn |= template_syn;
337
+ }
338
+ return syn;
339
+}
340
+
341
+static void QEMU_NORETURN arm_deliver_fault(ARMCPU *cpu, vaddr addr,
342
+ MMUAccessType access_type,
343
+ int mmu_idx, ARMMMUFaultInfo *fi)
344
+{
345
+ CPUARMState *env = &cpu->env;
346
+ int target_el;
347
+ bool same_el;
348
+ uint32_t syn, exc, fsr, fsc;
349
+ ARMMMUIdx arm_mmu_idx = core_to_arm_mmu_idx(env, mmu_idx);
350
+
351
+ target_el = exception_target_el(env);
352
+ if (fi->stage2) {
353
+ target_el = 2;
354
+ env->cp15.hpfar_el2 = extract64(fi->s2addr, 12, 47) << 4;
355
+ }
356
+ same_el = (arm_current_el(env) == target_el);
357
+
358
+ if (target_el == 2 || arm_el_is_aa64(env, target_el) ||
359
+ arm_s1_regime_using_lpae_format(env, arm_mmu_idx)) {
360
+ /*
361
+ * LPAE format fault status register : bottom 6 bits are
362
+ * status code in the same form as needed for syndrome
363
+ */
364
+ fsr = arm_fi_to_lfsc(fi);
365
+ fsc = extract32(fsr, 0, 6);
366
+ } else {
367
+ fsr = arm_fi_to_sfsc(fi);
368
+ /*
369
+ * Short format FSR : this fault will never actually be reported
370
+ * to an EL that uses a syndrome register. Use a (currently)
371
+ * reserved FSR code in case the constructed syndrome does leak
372
+ * into the guest somehow.
373
+ */
374
+ fsc = 0x3f;
375
+ }
376
+
377
+ if (access_type == MMU_INST_FETCH) {
378
+ syn = syn_insn_abort(same_el, fi->ea, fi->s1ptw, fsc);
379
+ exc = EXCP_PREFETCH_ABORT;
380
+ } else {
381
+ syn = merge_syn_data_abort(env->exception.syndrome, target_el,
382
+ same_el, fi->ea, fi->s1ptw,
383
+ access_type == MMU_DATA_STORE,
384
+ fsc);
385
+ if (access_type == MMU_DATA_STORE
386
+ && arm_feature(env, ARM_FEATURE_V6)) {
387
+ fsr |= (1 << 11);
388
+ }
389
+ exc = EXCP_DATA_ABORT;
390
+ }
391
+
392
+ env->exception.vaddress = addr;
393
+ env->exception.fsr = fsr;
394
+ raise_exception(env, exc, syn, target_el);
395
+}
396
+
397
+/* Raise a data fault alignment exception for the specified virtual address */
398
+void arm_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr,
399
+ MMUAccessType access_type,
400
+ int mmu_idx, uintptr_t retaddr)
401
+{
402
+ ARMCPU *cpu = ARM_CPU(cs);
403
+ ARMMMUFaultInfo fi = {};
404
+
405
+ /* now we have a real cpu fault */
406
+ cpu_restore_state(cs, retaddr, true);
407
+
408
+ fi.type = ARMFault_Alignment;
409
+ arm_deliver_fault(cpu, vaddr, access_type, mmu_idx, &fi);
410
+}
411
+
412
+/*
413
+ * arm_cpu_do_transaction_failed: handle a memory system error response
414
+ * (eg "no device/memory present at address") by raising an external abort
415
+ * exception
416
+ */
417
+void arm_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr,
418
+ vaddr addr, unsigned size,
419
+ MMUAccessType access_type,
420
+ int mmu_idx, MemTxAttrs attrs,
421
+ MemTxResult response, uintptr_t retaddr)
422
+{
423
+ ARMCPU *cpu = ARM_CPU(cs);
424
+ ARMMMUFaultInfo fi = {};
425
+
426
+ /* now we have a real cpu fault */
427
+ cpu_restore_state(cs, retaddr, true);
428
+
429
+ fi.ea = arm_extabort_type(response);
430
+ fi.type = ARMFault_SyncExternal;
431
+ arm_deliver_fault(cpu, addr, access_type, mmu_idx, &fi);
432
+}
433
+
434
+#endif /* !defined(CONFIG_USER_ONLY) */
435
+
436
+bool arm_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
437
+ MMUAccessType access_type, int mmu_idx,
438
+ bool probe, uintptr_t retaddr)
439
+{
440
+ ARMCPU *cpu = ARM_CPU(cs);
441
+
442
+#ifdef CONFIG_USER_ONLY
443
+ cpu->env.exception.vaddress = address;
444
+ if (access_type == MMU_INST_FETCH) {
445
+ cs->exception_index = EXCP_PREFETCH_ABORT;
446
+ } else {
447
+ cs->exception_index = EXCP_DATA_ABORT;
448
+ }
449
+ cpu_loop_exit_restore(cs, retaddr);
450
+#else
451
+ hwaddr phys_addr;
452
+ target_ulong page_size;
453
+ int prot, ret;
454
+ MemTxAttrs attrs = {};
455
+ ARMMMUFaultInfo fi = {};
456
+
457
+ /*
458
+ * Walk the page table and (if the mapping exists) add the page
459
+ * to the TLB. On success, return true. Otherwise, if probing,
460
+ * return false. Otherwise populate fsr with ARM DFSR/IFSR fault
461
+ * register format, and signal the fault.
462
+ */
463
+ ret = get_phys_addr(&cpu->env, address, access_type,
464
+ core_to_arm_mmu_idx(&cpu->env, mmu_idx),
465
+ &phys_addr, &attrs, &prot, &page_size, &fi, NULL);
466
+ if (likely(!ret)) {
467
+ /*
468
+ * Map a single [sub]page. Regions smaller than our declared
469
+ * target page size are handled specially, so for those we
470
+ * pass in the exact addresses.
471
+ */
472
+ if (page_size >= TARGET_PAGE_SIZE) {
473
+ phys_addr &= TARGET_PAGE_MASK;
474
+ address &= TARGET_PAGE_MASK;
475
+ }
476
+ tlb_set_page_with_attrs(cs, address, phys_addr, attrs,
477
+ prot, mmu_idx, page_size);
478
+ return true;
479
+ } else if (probe) {
480
+ return false;
481
+ } else {
482
+ /* now we have a real cpu fault */
483
+ cpu_restore_state(cs, retaddr, true);
484
+ arm_deliver_fault(cpu, address, access_type, mmu_idx, &fi);
485
+ }
486
+#endif
487
+}
488
--
81
--
489
2.20.1
82
2.25.1
490
83
491
84
diff view generated by jsdifflib
1
From: Cédric Le Goater <clg@kaod.org>
1
From: Tobias Röhmel <tobias.roehmel@rwth-aachen.de>
2
2
3
The current models of the Aspeed SoCs only have one CPU but future
3
The v8R PMSAv8 has a two-stage MPU translation process, but, unlike
4
ones will support SMP. Introduce a new num_cpus field at the SoC class
4
VMSAv8, the stage 2 attributes are in the same format as the stage 1
5
level to define the number of available CPUs per SoC and also
5
attributes (8-bit MAIR format). Rather than converting the MAIR
6
introduce a 'num-cpus' property to activate the CPUs configured for
6
format to the format used for VMSA stage 2 (bits [5:2] of a VMSA
7
the machine.
7
stage 2 descriptor) and then converting back to do the attribute
8
combination, allow combined_attrs_nofwb() to accept s2 attributes
9
that are already in the MAIR format.
8
10
9
The max_cpus limit of the machine should depend on the SoC definition
11
We move the assert() to combined_attrs_fwb(), because that function
10
but, unfortunately, these values are not available when the machine
12
really does require a VMSA stage 2 attribute format. (We will never
11
class is initialized. This is the reason why we add a check on
13
get there for v8R, because PMSAv8 does not implement FEAT_S2FWB.)
12
num_cpus in the AspeedSoC realize handler.
13
14
14
SMP support will be activated when models for such SoCs are implemented.
15
Signed-off-by: Tobias Röhmel <tobias.roehmel@rwth-aachen.de>
15
16
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
16
Signed-off-by: Cédric Le Goater <clg@kaod.org>
17
Message-id: 20221206102504.165775-4-tobias.roehmel@rwth-aachen.de
17
Reviewed-by: Joel Stanley <joel@jms.id.au>
18
Message-id: 20190618165311.27066-6-clg@kaod.org
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
---
19
---
21
include/hw/arm/aspeed_soc.h | 5 ++++-
20
target/arm/ptw.c | 10 ++++++++--
22
hw/arm/aspeed.c | 7 +++++--
21
1 file changed, 8 insertions(+), 2 deletions(-)
23
hw/arm/aspeed_soc.c | 33 +++++++++++++++++++++++++++------
24
3 files changed, 36 insertions(+), 9 deletions(-)
25
22
26
diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h
23
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
27
index XXXXXXX..XXXXXXX 100644
24
index XXXXXXX..XXXXXXX 100644
28
--- a/include/hw/arm/aspeed_soc.h
25
--- a/target/arm/ptw.c
29
+++ b/include/hw/arm/aspeed_soc.h
26
+++ b/target/arm/ptw.c
30
@@ -XXX,XX +XXX,XX @@
27
@@ -XXX,XX +XXX,XX @@ static uint8_t combined_attrs_nofwb(uint64_t hcr,
31
28
{
32
#define ASPEED_SPIS_NUM 2
29
uint8_t s1lo, s2lo, s1hi, s2hi, s2_mair_attrs, ret_attrs;
33
#define ASPEED_WDTS_NUM 3
30
34
+#define ASPEED_CPUS_NUM 2
31
- s2_mair_attrs = convert_stage2_attrs(hcr, s2.attrs);
35
32
+ if (s2.is_s2_format) {
36
typedef struct AspeedSoCState {
33
+ s2_mair_attrs = convert_stage2_attrs(hcr, s2.attrs);
37
/*< private >*/
34
+ } else {
38
DeviceState parent;
35
+ s2_mair_attrs = s2.attrs;
39
40
/*< public >*/
41
- ARMCPU cpu;
42
+ ARMCPU cpu[ASPEED_CPUS_NUM];
43
+ uint32_t num_cpus;
44
MemoryRegion sram;
45
AspeedVICState vic;
46
AspeedRtcState rtc;
47
@@ -XXX,XX +XXX,XX @@ typedef struct AspeedSoCInfo {
48
int wdts_num;
49
const int *irqmap;
50
const hwaddr *memmap;
51
+ uint32_t num_cpus;
52
} AspeedSoCInfo;
53
54
typedef struct AspeedSoCClass {
55
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
56
index XXXXXXX..XXXXXXX 100644
57
--- a/hw/arm/aspeed.c
58
+++ b/hw/arm/aspeed.c
59
@@ -XXX,XX +XXX,XX @@
60
#include "hw/misc/tmp105.h"
61
#include "qemu/log.h"
62
#include "sysemu/block-backend.h"
63
+#include "sysemu/sysemu.h"
64
#include "hw/loader.h"
65
#include "qemu/error-report.h"
66
#include "qemu/units.h"
67
68
static struct arm_boot_info aspeed_board_binfo = {
69
.board_id = -1, /* device-tree-only board */
70
- .nb_cpus = 1,
71
};
72
73
struct AspeedBoardState {
74
@@ -XXX,XX +XXX,XX @@ static void aspeed_board_init(MachineState *machine,
75
&error_abort);
76
object_property_set_int(OBJECT(&bmc->soc), cfg->num_cs, "num-cs",
77
&error_abort);
78
+ object_property_set_int(OBJECT(&bmc->soc), smp_cpus, "num-cpus",
79
+ &error_abort);
80
if (machine->kernel_filename) {
81
/*
82
* When booting with a -kernel command line there is no u-boot
83
@@ -XXX,XX +XXX,XX @@ static void aspeed_board_init(MachineState *machine,
84
aspeed_board_binfo.kernel_cmdline = machine->kernel_cmdline;
85
aspeed_board_binfo.ram_size = ram_size;
86
aspeed_board_binfo.loader_start = sc->info->memmap[ASPEED_SDRAM];
87
+ aspeed_board_binfo.nb_cpus = bmc->soc.num_cpus;
88
89
if (cfg->i2c_init) {
90
cfg->i2c_init(bmc);
91
@@ -XXX,XX +XXX,XX @@ static void aspeed_machine_class_init(ObjectClass *oc, void *data)
92
93
mc->desc = board->desc;
94
mc->init = aspeed_machine_init;
95
- mc->max_cpus = 1;
96
+ mc->max_cpus = ASPEED_CPUS_NUM;
97
mc->no_sdcard = 1;
98
mc->no_floppy = 1;
99
mc->no_cdrom = 1;
100
diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c
101
index XXXXXXX..XXXXXXX 100644
102
--- a/hw/arm/aspeed_soc.c
103
+++ b/hw/arm/aspeed_soc.c
104
@@ -XXX,XX +XXX,XX @@
105
#include "hw/char/serial.h"
106
#include "qemu/log.h"
107
#include "qemu/module.h"
108
+#include "qemu/error-report.h"
109
#include "hw/i2c/aspeed_i2c.h"
110
#include "net/net.h"
111
112
@@ -XXX,XX +XXX,XX @@ static const AspeedSoCInfo aspeed_socs[] = {
113
.wdts_num = 2,
114
.irqmap = aspeed_soc_ast2400_irqmap,
115
.memmap = aspeed_soc_ast2400_memmap,
116
+ .num_cpus = 1,
117
}, {
118
.name = "ast2400-a1",
119
.cpu_type = ARM_CPU_TYPE_NAME("arm926"),
120
@@ -XXX,XX +XXX,XX @@ static const AspeedSoCInfo aspeed_socs[] = {
121
.wdts_num = 2,
122
.irqmap = aspeed_soc_ast2400_irqmap,
123
.memmap = aspeed_soc_ast2400_memmap,
124
+ .num_cpus = 1,
125
}, {
126
.name = "ast2400",
127
.cpu_type = ARM_CPU_TYPE_NAME("arm926"),
128
@@ -XXX,XX +XXX,XX @@ static const AspeedSoCInfo aspeed_socs[] = {
129
.wdts_num = 2,
130
.irqmap = aspeed_soc_ast2400_irqmap,
131
.memmap = aspeed_soc_ast2400_memmap,
132
+ .num_cpus = 1,
133
}, {
134
.name = "ast2500-a1",
135
.cpu_type = ARM_CPU_TYPE_NAME("arm1176"),
136
@@ -XXX,XX +XXX,XX @@ static const AspeedSoCInfo aspeed_socs[] = {
137
.wdts_num = 3,
138
.irqmap = aspeed_soc_ast2500_irqmap,
139
.memmap = aspeed_soc_ast2500_memmap,
140
+ .num_cpus = 1,
141
},
142
};
143
144
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_init(Object *obj)
145
AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
146
int i;
147
148
- object_initialize_child(obj, "cpu", OBJECT(&s->cpu), sizeof(s->cpu),
149
- sc->info->cpu_type, &error_abort, NULL);
150
+ for (i = 0; i < sc->info->num_cpus; i++) {
151
+ object_initialize_child(obj, "cpu[*]", OBJECT(&s->cpu[i]),
152
+ sizeof(s->cpu[i]), sc->info->cpu_type,
153
+ &error_abort, NULL);
154
+ }
36
+ }
155
37
156
sysbus_init_child_obj(obj, "scu", OBJECT(&s->scu), sizeof(s->scu),
38
s1lo = extract32(s1.attrs, 0, 4);
157
TYPE_ASPEED_SCU);
39
s2lo = extract32(s2_mair_attrs, 0, 4);
158
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
40
@@ -XXX,XX +XXX,XX @@ static uint8_t force_cacheattr_nibble_wb(uint8_t attr)
159
create_unimplemented_device("aspeed_soc.io", sc->info->memmap[ASPEED_IOMEM],
41
*/
160
ASPEED_SOC_IOMEM_SIZE);
42
static uint8_t combined_attrs_fwb(ARMCacheAttrs s1, ARMCacheAttrs s2)
161
43
{
162
+ if (s->num_cpus > sc->info->num_cpus) {
44
+ assert(s2.is_s2_format && !s1.is_s2_format);
163
+ warn_report("%s: invalid number of CPUs %d, using default %d",
164
+ sc->info->name, s->num_cpus, sc->info->num_cpus);
165
+ s->num_cpus = sc->info->num_cpus;
166
+ }
167
+
45
+
168
/* CPU */
46
switch (s2.attrs) {
169
- object_property_set_bool(OBJECT(&s->cpu), true, "realized", &err);
47
case 7:
170
- if (err) {
48
/* Use stage 1 attributes */
171
- error_propagate(errp, err);
49
@@ -XXX,XX +XXX,XX @@ static ARMCacheAttrs combine_cacheattrs(uint64_t hcr,
172
- return;
50
ARMCacheAttrs ret;
173
+ for (i = 0; i < s->num_cpus; i++) {
51
bool tagged = false;
174
+ object_property_set_bool(OBJECT(&s->cpu[i]), true, "realized", &err);
52
175
+ if (err) {
53
- assert(s2.is_s2_format && !s1.is_s2_format);
176
+ error_propagate(errp, err);
54
+ assert(!s1.is_s2_format);
177
+ return;
55
ret.is_s2_format = false;
178
+ }
56
179
}
57
if (s1.attrs == 0xf0) {
180
181
/* SRAM */
182
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
183
sysbus_connect_irq(SYS_BUS_DEVICE(&s->ftgmac100), 0,
184
aspeed_soc_get_irq(s, ASPEED_ETH1));
185
}
186
+static Property aspeed_soc_properties[] = {
187
+ DEFINE_PROP_UINT32("num-cpus", AspeedSoCState, num_cpus, 0),
188
+ DEFINE_PROP_END_OF_LIST(),
189
+};
190
191
static void aspeed_soc_class_init(ObjectClass *oc, void *data)
192
{
193
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_class_init(ObjectClass *oc, void *data)
194
dc->realize = aspeed_soc_realize;
195
/* Reason: Uses serial_hds and nd_table in realize() directly */
196
dc->user_creatable = false;
197
+ dc->props = aspeed_soc_properties;
198
}
199
200
static const TypeInfo aspeed_soc_type_info = {
201
--
58
--
202
2.20.1
59
2.25.1
203
60
204
61
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
From: Tobias Röhmel <tobias.roehmel@rwth-aachen.de>
2
2
3
Under KVM, the kernel gets the HVC call and handle the PSCI requests.
3
ARMv8-R AArch32 CPUs behave as if TTBCR.EAE is always 1 even
4
tough they don't have the TTBCR register.
5
See ARM Architecture Reference Manual Supplement - ARMv8, for the ARMv8-R
6
AArch32 architecture profile Version:A.c section C1.2.
4
7
5
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
8
Signed-off-by: Tobias Röhmel <tobias.roehmel@rwth-aachen.de>
6
Message-id: 20190701132516.26392-20-philmd@redhat.com
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Message-id: 20221206102504.165775-5-tobias.roehmel@rwth-aachen.de
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
12
---
10
target/arm/internals.h | 6 +++++-
13
target/arm/internals.h | 4 ++++
11
1 file changed, 5 insertions(+), 1 deletion(-)
14
target/arm/debug_helper.c | 3 +++
15
target/arm/tlb_helper.c | 4 ++++
16
3 files changed, 11 insertions(+)
12
17
13
diff --git a/target/arm/internals.h b/target/arm/internals.h
18
diff --git a/target/arm/internals.h b/target/arm/internals.h
14
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/internals.h
20
--- a/target/arm/internals.h
16
+++ b/target/arm/internals.h
21
+++ b/target/arm/internals.h
17
@@ -XXX,XX +XXX,XX @@ vaddr arm_adjust_watchpoint_address(CPUState *cs, vaddr addr, int len);
22
@@ -XXX,XX +XXX,XX @@ unsigned int arm_pamax(ARMCPU *cpu);
18
/* Callback function for when a watchpoint or breakpoint triggers. */
23
static inline bool extended_addresses_enabled(CPUARMState *env)
19
void arm_debug_excp_handler(CPUState *cs);
20
21
-#ifdef CONFIG_USER_ONLY
22
+#if defined(CONFIG_USER_ONLY) || !defined(CONFIG_TCG)
23
static inline bool arm_is_psci_call(ARMCPU *cpu, int excp_type)
24
{
24
{
25
return false;
25
uint64_t tcr = env->cp15.tcr_el[arm_is_secure(env) ? 3 : 1];
26
+ if (arm_feature(env, ARM_FEATURE_PMSA) &&
27
+ arm_feature(env, ARM_FEATURE_V8)) {
28
+ return true;
29
+ }
30
return arm_el_is_aa64(env, 1) ||
31
(arm_feature(env, ARM_FEATURE_LPAE) && (tcr & TTBCR_EAE));
26
}
32
}
27
+static inline void arm_handle_psci_call(ARMCPU *cpu)
33
diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c
28
+{
34
index XXXXXXX..XXXXXXX 100644
29
+ g_assert_not_reached();
35
--- a/target/arm/debug_helper.c
30
+}
36
+++ b/target/arm/debug_helper.c
31
#else
37
@@ -XXX,XX +XXX,XX @@ static uint32_t arm_debug_exception_fsr(CPUARMState *env)
32
/* Return true if the r0/x0 value indicates that this SMC/HVC is a PSCI call. */
38
33
bool arm_is_psci_call(ARMCPU *cpu, int excp_type);
39
if (target_el == 2 || arm_el_is_aa64(env, target_el)) {
40
using_lpae = true;
41
+ } else if (arm_feature(env, ARM_FEATURE_PMSA) &&
42
+ arm_feature(env, ARM_FEATURE_V8)) {
43
+ using_lpae = true;
44
} else {
45
if (arm_feature(env, ARM_FEATURE_LPAE) &&
46
(env->cp15.tcr_el[target_el] & TTBCR_EAE)) {
47
diff --git a/target/arm/tlb_helper.c b/target/arm/tlb_helper.c
48
index XXXXXXX..XXXXXXX 100644
49
--- a/target/arm/tlb_helper.c
50
+++ b/target/arm/tlb_helper.c
51
@@ -XXX,XX +XXX,XX @@ bool regime_using_lpae_format(CPUARMState *env, ARMMMUIdx mmu_idx)
52
if (el == 2 || arm_el_is_aa64(env, el)) {
53
return true;
54
}
55
+ if (arm_feature(env, ARM_FEATURE_PMSA) &&
56
+ arm_feature(env, ARM_FEATURE_V8)) {
57
+ return true;
58
+ }
59
if (arm_feature(env, ARM_FEATURE_LPAE)
60
&& (regime_tcr(env, mmu_idx) & TTBCR_EAE)) {
61
return true;
34
--
62
--
35
2.20.1
63
2.25.1
36
64
37
65
diff view generated by jsdifflib
1
From: Joel Stanley <joel@jms.id.au>
1
From: Tobias Röhmel <tobias.roehmel@rwth-aachen.de>
2
2
3
The ast2500 uses the watchdog to reset the SDRAM controller. This
3
Signed-off-by: Tobias Röhmel <tobias.roehmel@rwth-aachen.de>
4
operation is usually performed by u-boot's memory training procedure,
4
Message-id: 20221206102504.165775-6-tobias.roehmel@rwth-aachen.de
5
and it is enabled by setting a bit in the SCU and then causing the
6
watchdog to expire. Therefore, we need the watchdog to be able to
7
access the SCU's register space.
8
9
This causes the watchdog to not perform a system reset when the bit is
10
set. In the future it could perform a reset of the SDMC model.
11
12
Signed-off-by: Joel Stanley <joel@jms.id.au>
13
Signed-off-by: Cédric Le Goater <clg@kaod.org>
14
Reviewed-by: Cédric Le Goater <clg@kaod.org>
15
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
16
Message-id: 20190621065242.32535-1-joel@jms.id.au
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
---
6
---
19
include/hw/watchdog/wdt_aspeed.h | 1 +
7
target/arm/cpu.h | 6 +
20
hw/arm/aspeed_soc.c | 2 ++
8
target/arm/cpu.c | 28 +++-
21
hw/watchdog/wdt_aspeed.c | 20 ++++++++++++++++++++
9
target/arm/helper.c | 302 +++++++++++++++++++++++++++++++++++++++++++
22
3 files changed, 23 insertions(+)
10
target/arm/machine.c | 28 ++++
11
4 files changed, 360 insertions(+), 4 deletions(-)
23
12
24
diff --git a/include/hw/watchdog/wdt_aspeed.h b/include/hw/watchdog/wdt_aspeed.h
13
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
25
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
26
--- a/include/hw/watchdog/wdt_aspeed.h
15
--- a/target/arm/cpu.h
27
+++ b/include/hw/watchdog/wdt_aspeed.h
16
+++ b/target/arm/cpu.h
28
@@ -XXX,XX +XXX,XX @@ typedef struct AspeedWDTState {
17
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
29
MemoryRegion iomem;
18
};
30
uint32_t regs[ASPEED_WDT_REGS_MAX];
19
uint64_t sctlr_el[4];
31
20
};
32
+ AspeedSCUState *scu;
21
+ uint64_t vsctlr; /* Virtualization System control register. */
33
uint32_t pclk_freq;
22
uint64_t cpacr_el1; /* Architectural feature access control register */
34
uint32_t silicon_rev;
23
uint64_t cptr_el[4]; /* ARMv8 feature trap registers */
35
uint32_t ext_pulse_width_mask;
24
uint32_t c1_xscaleauxcr; /* XScale auxiliary control register. */
36
diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c
25
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
26
*/
27
uint32_t *rbar[M_REG_NUM_BANKS];
28
uint32_t *rlar[M_REG_NUM_BANKS];
29
+ uint32_t *hprbar;
30
+ uint32_t *hprlar;
31
uint32_t mair0[M_REG_NUM_BANKS];
32
uint32_t mair1[M_REG_NUM_BANKS];
33
+ uint32_t hprselr;
34
} pmsav8;
35
36
/* v8M SAU */
37
@@ -XXX,XX +XXX,XX @@ struct ArchCPU {
38
bool has_mpu;
39
/* PMSAv7 MPU number of supported regions */
40
uint32_t pmsav7_dregion;
41
+ /* PMSAv8 MPU number of supported hyp regions */
42
+ uint32_t pmsav8r_hdregion;
43
/* v8M SAU number of supported regions */
44
uint32_t sau_sregion;
45
46
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
37
index XXXXXXX..XXXXXXX 100644
47
index XXXXXXX..XXXXXXX 100644
38
--- a/hw/arm/aspeed_soc.c
48
--- a/target/arm/cpu.c
39
+++ b/hw/arm/aspeed_soc.c
49
+++ b/target/arm/cpu.c
40
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_init(Object *obj)
50
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset_hold(Object *obj)
41
sizeof(s->wdt[i]), TYPE_ASPEED_WDT);
51
sizeof(*env->pmsav7.dracr) * cpu->pmsav7_dregion);
42
qdev_prop_set_uint32(DEVICE(&s->wdt[i]), "silicon-rev",
52
}
43
sc->info->silicon_rev);
53
}
44
+ object_property_add_const_link(OBJECT(&s->wdt[i]), "scu",
54
+
45
+ OBJECT(&s->scu), &error_abort);
55
+ if (cpu->pmsav8r_hdregion > 0) {
56
+ memset(env->pmsav8.hprbar, 0,
57
+ sizeof(*env->pmsav8.hprbar) * cpu->pmsav8r_hdregion);
58
+ memset(env->pmsav8.hprlar, 0,
59
+ sizeof(*env->pmsav8.hprlar) * cpu->pmsav8r_hdregion);
60
+ }
61
+
62
env->pmsav7.rnr[M_REG_NS] = 0;
63
env->pmsav7.rnr[M_REG_S] = 0;
64
env->pmsav8.mair0[M_REG_NS] = 0;
65
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
66
/* MPU can be configured out of a PMSA CPU either by setting has-mpu
67
* to false or by setting pmsav7-dregion to 0.
68
*/
69
- if (!cpu->has_mpu) {
70
- cpu->pmsav7_dregion = 0;
71
- }
72
- if (cpu->pmsav7_dregion == 0) {
73
+ if (!cpu->has_mpu || cpu->pmsav7_dregion == 0) {
74
cpu->has_mpu = false;
75
+ cpu->pmsav7_dregion = 0;
76
+ cpu->pmsav8r_hdregion = 0;
46
}
77
}
47
78
48
for (i = 0; i < ASPEED_MACS_NUM; i++) {
79
if (arm_feature(env, ARM_FEATURE_PMSA) &&
49
diff --git a/hw/watchdog/wdt_aspeed.c b/hw/watchdog/wdt_aspeed.c
80
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
81
env->pmsav7.dracr = g_new0(uint32_t, nr);
82
}
83
}
84
+
85
+ if (cpu->pmsav8r_hdregion > 0xff) {
86
+ error_setg(errp, "PMSAv8 MPU EL2 #regions invalid %" PRIu32,
87
+ cpu->pmsav8r_hdregion);
88
+ return;
89
+ }
90
+
91
+ if (cpu->pmsav8r_hdregion) {
92
+ env->pmsav8.hprbar = g_new0(uint32_t,
93
+ cpu->pmsav8r_hdregion);
94
+ env->pmsav8.hprlar = g_new0(uint32_t,
95
+ cpu->pmsav8r_hdregion);
96
+ }
97
}
98
99
if (arm_feature(env, ARM_FEATURE_M_SECURITY)) {
100
diff --git a/target/arm/helper.c b/target/arm/helper.c
50
index XXXXXXX..XXXXXXX 100644
101
index XXXXXXX..XXXXXXX 100644
51
--- a/hw/watchdog/wdt_aspeed.c
102
--- a/target/arm/helper.c
52
+++ b/hw/watchdog/wdt_aspeed.c
103
+++ b/target/arm/helper.c
53
@@ -XXX,XX +XXX,XX @@
104
@@ -XXX,XX +XXX,XX @@ static void pmsav7_rgnr_write(CPUARMState *env, const ARMCPRegInfo *ri,
54
105
raw_write(env, ri, value);
55
#define WDT_RESTART_MAGIC 0x4755
106
}
56
107
57
+#define SCU_RESET_CONTROL1 (0x04 / 4)
108
+static void prbar_write(CPUARMState *env, const ARMCPRegInfo *ri,
58
+#define SCU_RESET_SDRAM BIT(0)
109
+ uint64_t value)
59
+
110
+{
60
static bool aspeed_wdt_is_enabled(const AspeedWDTState *s)
111
+ ARMCPU *cpu = env_archcpu(env);
61
{
112
+
62
return s->regs[WDT_CTRL] & WDT_CTRL_ENABLE;
113
+ tlb_flush(CPU(cpu)); /* Mappings may have changed - purge! */
63
@@ -XXX,XX +XXX,XX @@ static void aspeed_wdt_timer_expired(void *dev)
114
+ env->pmsav8.rbar[M_REG_NS][env->pmsav7.rnr[M_REG_NS]] = value;
64
{
115
+}
65
AspeedWDTState *s = ASPEED_WDT(dev);
116
+
66
117
+static uint64_t prbar_read(CPUARMState *env, const ARMCPRegInfo *ri)
67
+ /* Do not reset on SDRAM controller reset */
118
+{
68
+ if (s->scu->regs[SCU_RESET_CONTROL1] & SCU_RESET_SDRAM) {
119
+ return env->pmsav8.rbar[M_REG_NS][env->pmsav7.rnr[M_REG_NS]];
69
+ timer_del(s->timer);
120
+}
70
+ s->regs[WDT_CTRL] = 0;
121
+
122
+static void prlar_write(CPUARMState *env, const ARMCPRegInfo *ri,
123
+ uint64_t value)
124
+{
125
+ ARMCPU *cpu = env_archcpu(env);
126
+
127
+ tlb_flush(CPU(cpu)); /* Mappings may have changed - purge! */
128
+ env->pmsav8.rlar[M_REG_NS][env->pmsav7.rnr[M_REG_NS]] = value;
129
+}
130
+
131
+static uint64_t prlar_read(CPUARMState *env, const ARMCPRegInfo *ri)
132
+{
133
+ return env->pmsav8.rlar[M_REG_NS][env->pmsav7.rnr[M_REG_NS]];
134
+}
135
+
136
+static void prselr_write(CPUARMState *env, const ARMCPRegInfo *ri,
137
+ uint64_t value)
138
+{
139
+ ARMCPU *cpu = env_archcpu(env);
140
+
141
+ /*
142
+ * Ignore writes that would select not implemented region.
143
+ * This is architecturally UNPREDICTABLE.
144
+ */
145
+ if (value >= cpu->pmsav7_dregion) {
71
+ return;
146
+ return;
72
+ }
147
+ }
73
+
148
+
74
qemu_log_mask(CPU_LOG_RESET, "Watchdog timer expired.\n");
149
+ env->pmsav7.rnr[M_REG_NS] = value;
75
watchdog_perform_action();
150
+}
76
timer_del(s->timer);
151
+
77
@@ -XXX,XX +XXX,XX @@ static void aspeed_wdt_realize(DeviceState *dev, Error **errp)
152
+static void hprbar_write(CPUARMState *env, const ARMCPRegInfo *ri,
78
{
153
+ uint64_t value)
79
SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
154
+{
80
AspeedWDTState *s = ASPEED_WDT(dev);
155
+ ARMCPU *cpu = env_archcpu(env);
81
+ Error *err = NULL;
156
+
82
+ Object *obj;
157
+ tlb_flush(CPU(cpu)); /* Mappings may have changed - purge! */
83
+
158
+ env->pmsav8.hprbar[env->pmsav8.hprselr] = value;
84
+ obj = object_property_get_link(OBJECT(dev), "scu", &err);
159
+}
85
+ if (!obj) {
160
+
86
+ error_propagate(errp, err);
161
+static uint64_t hprbar_read(CPUARMState *env, const ARMCPRegInfo *ri)
87
+ error_prepend(errp, "required link 'scu' not found: ");
162
+{
163
+ return env->pmsav8.hprbar[env->pmsav8.hprselr];
164
+}
165
+
166
+static void hprlar_write(CPUARMState *env, const ARMCPRegInfo *ri,
167
+ uint64_t value)
168
+{
169
+ ARMCPU *cpu = env_archcpu(env);
170
+
171
+ tlb_flush(CPU(cpu)); /* Mappings may have changed - purge! */
172
+ env->pmsav8.hprlar[env->pmsav8.hprselr] = value;
173
+}
174
+
175
+static uint64_t hprlar_read(CPUARMState *env, const ARMCPRegInfo *ri)
176
+{
177
+ return env->pmsav8.hprlar[env->pmsav8.hprselr];
178
+}
179
+
180
+static void hprenr_write(CPUARMState *env, const ARMCPRegInfo *ri,
181
+ uint64_t value)
182
+{
183
+ uint32_t n;
184
+ uint32_t bit;
185
+ ARMCPU *cpu = env_archcpu(env);
186
+
187
+ /* Ignore writes to unimplemented regions */
188
+ int rmax = MIN(cpu->pmsav8r_hdregion, 32);
189
+ value &= MAKE_64BIT_MASK(0, rmax);
190
+
191
+ tlb_flush(CPU(cpu)); /* Mappings may have changed - purge! */
192
+
193
+ /* Register alias is only valid for first 32 indexes */
194
+ for (n = 0; n < rmax; ++n) {
195
+ bit = extract32(value, n, 1);
196
+ env->pmsav8.hprlar[n] = deposit32(
197
+ env->pmsav8.hprlar[n], 0, 1, bit);
198
+ }
199
+}
200
+
201
+static uint64_t hprenr_read(CPUARMState *env, const ARMCPRegInfo *ri)
202
+{
203
+ uint32_t n;
204
+ uint32_t result = 0x0;
205
+ ARMCPU *cpu = env_archcpu(env);
206
+
207
+ /* Register alias is only valid for first 32 indexes */
208
+ for (n = 0; n < MIN(cpu->pmsav8r_hdregion, 32); ++n) {
209
+ if (env->pmsav8.hprlar[n] & 0x1) {
210
+ result |= (0x1 << n);
211
+ }
212
+ }
213
+ return result;
214
+}
215
+
216
+static void hprselr_write(CPUARMState *env, const ARMCPRegInfo *ri,
217
+ uint64_t value)
218
+{
219
+ ARMCPU *cpu = env_archcpu(env);
220
+
221
+ /*
222
+ * Ignore writes that would select not implemented region.
223
+ * This is architecturally UNPREDICTABLE.
224
+ */
225
+ if (value >= cpu->pmsav8r_hdregion) {
88
+ return;
226
+ return;
89
+ }
227
+ }
90
+ s->scu = ASPEED_SCU(obj);
228
+
91
229
+ env->pmsav8.hprselr = value;
92
if (!is_supported_silicon_rev(s->silicon_rev)) {
230
+}
93
error_setg(errp, "Unknown silicon revision: 0x%" PRIx32,
231
+
232
+static void pmsav8r_regn_write(CPUARMState *env, const ARMCPRegInfo *ri,
233
+ uint64_t value)
234
+{
235
+ ARMCPU *cpu = env_archcpu(env);
236
+ uint8_t index = (extract32(ri->opc0, 0, 1) << 4) |
237
+ (extract32(ri->crm, 0, 3) << 1) | extract32(ri->opc2, 2, 1);
238
+
239
+ tlb_flush(CPU(cpu)); /* Mappings may have changed - purge! */
240
+
241
+ if (ri->opc1 & 4) {
242
+ if (index >= cpu->pmsav8r_hdregion) {
243
+ return;
244
+ }
245
+ if (ri->opc2 & 0x1) {
246
+ env->pmsav8.hprlar[index] = value;
247
+ } else {
248
+ env->pmsav8.hprbar[index] = value;
249
+ }
250
+ } else {
251
+ if (index >= cpu->pmsav7_dregion) {
252
+ return;
253
+ }
254
+ if (ri->opc2 & 0x1) {
255
+ env->pmsav8.rlar[M_REG_NS][index] = value;
256
+ } else {
257
+ env->pmsav8.rbar[M_REG_NS][index] = value;
258
+ }
259
+ }
260
+}
261
+
262
+static uint64_t pmsav8r_regn_read(CPUARMState *env, const ARMCPRegInfo *ri)
263
+{
264
+ ARMCPU *cpu = env_archcpu(env);
265
+ uint8_t index = (extract32(ri->opc0, 0, 1) << 4) |
266
+ (extract32(ri->crm, 0, 3) << 1) | extract32(ri->opc2, 2, 1);
267
+
268
+ if (ri->opc1 & 4) {
269
+ if (index >= cpu->pmsav8r_hdregion) {
270
+ return 0x0;
271
+ }
272
+ if (ri->opc2 & 0x1) {
273
+ return env->pmsav8.hprlar[index];
274
+ } else {
275
+ return env->pmsav8.hprbar[index];
276
+ }
277
+ } else {
278
+ if (index >= cpu->pmsav7_dregion) {
279
+ return 0x0;
280
+ }
281
+ if (ri->opc2 & 0x1) {
282
+ return env->pmsav8.rlar[M_REG_NS][index];
283
+ } else {
284
+ return env->pmsav8.rbar[M_REG_NS][index];
285
+ }
286
+ }
287
+}
288
+
289
+static const ARMCPRegInfo pmsav8r_cp_reginfo[] = {
290
+ { .name = "PRBAR",
291
+ .cp = 15, .opc1 = 0, .crn = 6, .crm = 3, .opc2 = 0,
292
+ .access = PL1_RW, .type = ARM_CP_NO_RAW,
293
+ .accessfn = access_tvm_trvm,
294
+ .readfn = prbar_read, .writefn = prbar_write },
295
+ { .name = "PRLAR",
296
+ .cp = 15, .opc1 = 0, .crn = 6, .crm = 3, .opc2 = 1,
297
+ .access = PL1_RW, .type = ARM_CP_NO_RAW,
298
+ .accessfn = access_tvm_trvm,
299
+ .readfn = prlar_read, .writefn = prlar_write },
300
+ { .name = "PRSELR", .resetvalue = 0,
301
+ .cp = 15, .opc1 = 0, .crn = 6, .crm = 2, .opc2 = 1,
302
+ .access = PL1_RW, .accessfn = access_tvm_trvm,
303
+ .writefn = prselr_write,
304
+ .fieldoffset = offsetof(CPUARMState, pmsav7.rnr[M_REG_NS]) },
305
+ { .name = "HPRBAR", .resetvalue = 0,
306
+ .cp = 15, .opc1 = 4, .crn = 6, .crm = 3, .opc2 = 0,
307
+ .access = PL2_RW, .type = ARM_CP_NO_RAW,
308
+ .readfn = hprbar_read, .writefn = hprbar_write },
309
+ { .name = "HPRLAR",
310
+ .cp = 15, .opc1 = 4, .crn = 6, .crm = 3, .opc2 = 1,
311
+ .access = PL2_RW, .type = ARM_CP_NO_RAW,
312
+ .readfn = hprlar_read, .writefn = hprlar_write },
313
+ { .name = "HPRSELR", .resetvalue = 0,
314
+ .cp = 15, .opc1 = 4, .crn = 6, .crm = 2, .opc2 = 1,
315
+ .access = PL2_RW,
316
+ .writefn = hprselr_write,
317
+ .fieldoffset = offsetof(CPUARMState, pmsav8.hprselr) },
318
+ { .name = "HPRENR",
319
+ .cp = 15, .opc1 = 4, .crn = 6, .crm = 1, .opc2 = 1,
320
+ .access = PL2_RW, .type = ARM_CP_NO_RAW,
321
+ .readfn = hprenr_read, .writefn = hprenr_write },
322
+};
323
+
324
static const ARMCPRegInfo pmsav7_cp_reginfo[] = {
325
/* Reset for all these registers is handled in arm_cpu_reset(),
326
* because the PMSAv7 is also used by M-profile CPUs, which do
327
@@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu)
328
.access = PL1_R, .type = ARM_CP_CONST,
329
.resetvalue = cpu->pmsav7_dregion << 8
330
};
331
+ /* HMPUIR is specific to PMSA V8 */
332
+ ARMCPRegInfo id_hmpuir_reginfo = {
333
+ .name = "HMPUIR",
334
+ .cp = 15, .opc1 = 4, .crn = 0, .crm = 0, .opc2 = 4,
335
+ .access = PL2_R, .type = ARM_CP_CONST,
336
+ .resetvalue = cpu->pmsav8r_hdregion
337
+ };
338
static const ARMCPRegInfo crn0_wi_reginfo = {
339
.name = "CRN0_WI", .cp = 15, .crn = 0, .crm = CP_ANY,
340
.opc1 = CP_ANY, .opc2 = CP_ANY, .access = PL1_W,
341
@@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu)
342
define_arm_cp_regs(cpu, id_cp_reginfo);
343
if (!arm_feature(env, ARM_FEATURE_PMSA)) {
344
define_one_arm_cp_reg(cpu, &id_tlbtr_reginfo);
345
+ } else if (arm_feature(env, ARM_FEATURE_PMSA) &&
346
+ arm_feature(env, ARM_FEATURE_V8)) {
347
+ uint32_t i = 0;
348
+ char *tmp_string;
349
+
350
+ define_one_arm_cp_reg(cpu, &id_mpuir_reginfo);
351
+ define_one_arm_cp_reg(cpu, &id_hmpuir_reginfo);
352
+ define_arm_cp_regs(cpu, pmsav8r_cp_reginfo);
353
+
354
+ /* Register alias is only valid for first 32 indexes */
355
+ for (i = 0; i < MIN(cpu->pmsav7_dregion, 32); ++i) {
356
+ uint8_t crm = 0b1000 | extract32(i, 1, 3);
357
+ uint8_t opc1 = extract32(i, 4, 1);
358
+ uint8_t opc2 = extract32(i, 0, 1) << 2;
359
+
360
+ tmp_string = g_strdup_printf("PRBAR%u", i);
361
+ ARMCPRegInfo tmp_prbarn_reginfo = {
362
+ .name = tmp_string, .type = ARM_CP_ALIAS | ARM_CP_NO_RAW,
363
+ .cp = 15, .opc1 = opc1, .crn = 6, .crm = crm, .opc2 = opc2,
364
+ .access = PL1_RW, .resetvalue = 0,
365
+ .accessfn = access_tvm_trvm,
366
+ .writefn = pmsav8r_regn_write, .readfn = pmsav8r_regn_read
367
+ };
368
+ define_one_arm_cp_reg(cpu, &tmp_prbarn_reginfo);
369
+ g_free(tmp_string);
370
+
371
+ opc2 = extract32(i, 0, 1) << 2 | 0x1;
372
+ tmp_string = g_strdup_printf("PRLAR%u", i);
373
+ ARMCPRegInfo tmp_prlarn_reginfo = {
374
+ .name = tmp_string, .type = ARM_CP_ALIAS | ARM_CP_NO_RAW,
375
+ .cp = 15, .opc1 = opc1, .crn = 6, .crm = crm, .opc2 = opc2,
376
+ .access = PL1_RW, .resetvalue = 0,
377
+ .accessfn = access_tvm_trvm,
378
+ .writefn = pmsav8r_regn_write, .readfn = pmsav8r_regn_read
379
+ };
380
+ define_one_arm_cp_reg(cpu, &tmp_prlarn_reginfo);
381
+ g_free(tmp_string);
382
+ }
383
+
384
+ /* Register alias is only valid for first 32 indexes */
385
+ for (i = 0; i < MIN(cpu->pmsav8r_hdregion, 32); ++i) {
386
+ uint8_t crm = 0b1000 | extract32(i, 1, 3);
387
+ uint8_t opc1 = 0b100 | extract32(i, 4, 1);
388
+ uint8_t opc2 = extract32(i, 0, 1) << 2;
389
+
390
+ tmp_string = g_strdup_printf("HPRBAR%u", i);
391
+ ARMCPRegInfo tmp_hprbarn_reginfo = {
392
+ .name = tmp_string,
393
+ .type = ARM_CP_NO_RAW,
394
+ .cp = 15, .opc1 = opc1, .crn = 6, .crm = crm, .opc2 = opc2,
395
+ .access = PL2_RW, .resetvalue = 0,
396
+ .writefn = pmsav8r_regn_write, .readfn = pmsav8r_regn_read
397
+ };
398
+ define_one_arm_cp_reg(cpu, &tmp_hprbarn_reginfo);
399
+ g_free(tmp_string);
400
+
401
+ opc2 = extract32(i, 0, 1) << 2 | 0x1;
402
+ tmp_string = g_strdup_printf("HPRLAR%u", i);
403
+ ARMCPRegInfo tmp_hprlarn_reginfo = {
404
+ .name = tmp_string,
405
+ .type = ARM_CP_NO_RAW,
406
+ .cp = 15, .opc1 = opc1, .crn = 6, .crm = crm, .opc2 = opc2,
407
+ .access = PL2_RW, .resetvalue = 0,
408
+ .writefn = pmsav8r_regn_write, .readfn = pmsav8r_regn_read
409
+ };
410
+ define_one_arm_cp_reg(cpu, &tmp_hprlarn_reginfo);
411
+ g_free(tmp_string);
412
+ }
413
} else if (arm_feature(env, ARM_FEATURE_V7)) {
414
define_one_arm_cp_reg(cpu, &id_mpuir_reginfo);
415
}
416
@@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu)
417
sctlr.type |= ARM_CP_SUPPRESS_TB_END;
418
}
419
define_one_arm_cp_reg(cpu, &sctlr);
420
+
421
+ if (arm_feature(env, ARM_FEATURE_PMSA) &&
422
+ arm_feature(env, ARM_FEATURE_V8)) {
423
+ ARMCPRegInfo vsctlr = {
424
+ .name = "VSCTLR", .state = ARM_CP_STATE_AA32,
425
+ .cp = 15, .opc1 = 4, .crn = 2, .crm = 0, .opc2 = 0,
426
+ .access = PL2_RW, .resetvalue = 0x0,
427
+ .fieldoffset = offsetoflow32(CPUARMState, cp15.vsctlr),
428
+ };
429
+ define_one_arm_cp_reg(cpu, &vsctlr);
430
+ }
431
}
432
433
if (cpu_isar_feature(aa64_lor, cpu)) {
434
diff --git a/target/arm/machine.c b/target/arm/machine.c
435
index XXXXXXX..XXXXXXX 100644
436
--- a/target/arm/machine.c
437
+++ b/target/arm/machine.c
438
@@ -XXX,XX +XXX,XX @@ static bool pmsav8_needed(void *opaque)
439
arm_feature(env, ARM_FEATURE_V8);
440
}
441
442
+static bool pmsav8r_needed(void *opaque)
443
+{
444
+ ARMCPU *cpu = opaque;
445
+ CPUARMState *env = &cpu->env;
446
+
447
+ return arm_feature(env, ARM_FEATURE_PMSA) &&
448
+ arm_feature(env, ARM_FEATURE_V8) &&
449
+ !arm_feature(env, ARM_FEATURE_M);
450
+}
451
+
452
+static const VMStateDescription vmstate_pmsav8r = {
453
+ .name = "cpu/pmsav8/pmsav8r",
454
+ .version_id = 1,
455
+ .minimum_version_id = 1,
456
+ .needed = pmsav8r_needed,
457
+ .fields = (VMStateField[]) {
458
+ VMSTATE_VARRAY_UINT32(env.pmsav8.hprbar, ARMCPU,
459
+ pmsav8r_hdregion, 0, vmstate_info_uint32, uint32_t),
460
+ VMSTATE_VARRAY_UINT32(env.pmsav8.hprlar, ARMCPU,
461
+ pmsav8r_hdregion, 0, vmstate_info_uint32, uint32_t),
462
+ VMSTATE_END_OF_LIST()
463
+ },
464
+};
465
+
466
static const VMStateDescription vmstate_pmsav8 = {
467
.name = "cpu/pmsav8",
468
.version_id = 1,
469
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_pmsav8 = {
470
VMSTATE_UINT32(env.pmsav8.mair0[M_REG_NS], ARMCPU),
471
VMSTATE_UINT32(env.pmsav8.mair1[M_REG_NS], ARMCPU),
472
VMSTATE_END_OF_LIST()
473
+ },
474
+ .subsections = (const VMStateDescription * []) {
475
+ &vmstate_pmsav8r,
476
+ NULL
477
}
478
};
479
94
--
480
--
95
2.20.1
481
2.25.1
96
482
97
483
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
From: Tobias Röhmel <tobias.roehmel@rwth-aachen.de>
2
2
3
In few commits we will split the M-profile functions from this
3
Add PMSAv8r translation.
4
file, and this function will also be called in the new file.
4
5
Declare it in the "internals.h" header.
5
Signed-off-by: Tobias Röhmel <tobias.roehmel@rwth-aachen.de>
6
Since it is in the middle of a block of M profile functions,
7
move it previous to this block to ease the later refactor.
8
9
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
10
Message-id: 20190701132516.26392-21-philmd@redhat.com
11
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Message-id: 20221206102504.165775-7-tobias.roehmel@rwth-aachen.de
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
9
---
14
target/arm/internals.h | 2 ++
10
target/arm/ptw.c | 126 ++++++++++++++++++++++++++++++++++++++---------
15
target/arm/helper.c | 76 +++++++++++++++++++++---------------------
11
1 file changed, 104 insertions(+), 22 deletions(-)
16
2 files changed, 40 insertions(+), 38 deletions(-)
12
17
13
diff --git a/target/arm/ptw.c b/target/arm/ptw.c
18
diff --git a/target/arm/internals.h b/target/arm/internals.h
19
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
20
--- a/target/arm/internals.h
15
--- a/target/arm/ptw.c
21
+++ b/target/arm/internals.h
16
+++ b/target/arm/ptw.c
22
@@ -XXX,XX +XXX,XX @@ bool get_phys_addr(CPUARMState *env, target_ulong address,
17
@@ -XXX,XX +XXX,XX @@ static bool pmsav7_use_background_region(ARMCPU *cpu, ARMMMUIdx mmu_idx,
23
target_ulong *page_size,
18
24
ARMMMUFaultInfo *fi, ARMCacheAttrs *cacheattrs);
19
if (arm_feature(env, ARM_FEATURE_M)) {
25
20
return env->v7m.mpu_ctrl[is_secure] & R_V7M_MPU_CTRL_PRIVDEFENA_MASK;
26
+void arm_log_exception(int idx);
21
- } else {
27
+
22
- return regime_sctlr(env, mmu_idx) & SCTLR_BR;
28
#endif /* !CONFIG_USER_ONLY */
23
}
29
24
+
30
#endif
25
+ if (mmu_idx == ARMMMUIdx_Stage2) {
31
diff --git a/target/arm/helper.c b/target/arm/helper.c
26
+ return false;
32
index XXXXXXX..XXXXXXX 100644
27
+ }
33
--- a/target/arm/helper.c
28
+
34
+++ b/target/arm/helper.c
29
+ return regime_sctlr(env, mmu_idx) & SCTLR_BR;
35
@@ -XXX,XX +XXX,XX @@ uint32_t arm_phys_excp_target_el(CPUState *cs, uint32_t excp_idx,
36
return target_el;
37
}
30
}
38
31
39
+void arm_log_exception(int idx)
32
static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address,
33
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_pmsav7(CPUARMState *env, uint32_t address,
34
return !(result->f.prot & (1 << access_type));
35
}
36
37
+static uint32_t *regime_rbar(CPUARMState *env, ARMMMUIdx mmu_idx,
38
+ uint32_t secure)
40
+{
39
+{
41
+ if (qemu_loglevel_mask(CPU_LOG_INT)) {
40
+ if (regime_el(env, mmu_idx) == 2) {
42
+ const char *exc = NULL;
41
+ return env->pmsav8.hprbar;
43
+ static const char * const excnames[] = {
42
+ } else {
44
+ [EXCP_UDEF] = "Undefined Instruction",
43
+ return env->pmsav8.rbar[secure];
45
+ [EXCP_SWI] = "SVC",
46
+ [EXCP_PREFETCH_ABORT] = "Prefetch Abort",
47
+ [EXCP_DATA_ABORT] = "Data Abort",
48
+ [EXCP_IRQ] = "IRQ",
49
+ [EXCP_FIQ] = "FIQ",
50
+ [EXCP_BKPT] = "Breakpoint",
51
+ [EXCP_EXCEPTION_EXIT] = "QEMU v7M exception exit",
52
+ [EXCP_KERNEL_TRAP] = "QEMU intercept of kernel commpage",
53
+ [EXCP_HVC] = "Hypervisor Call",
54
+ [EXCP_HYP_TRAP] = "Hypervisor Trap",
55
+ [EXCP_SMC] = "Secure Monitor Call",
56
+ [EXCP_VIRQ] = "Virtual IRQ",
57
+ [EXCP_VFIQ] = "Virtual FIQ",
58
+ [EXCP_SEMIHOST] = "Semihosting call",
59
+ [EXCP_NOCP] = "v7M NOCP UsageFault",
60
+ [EXCP_INVSTATE] = "v7M INVSTATE UsageFault",
61
+ [EXCP_STKOF] = "v8M STKOF UsageFault",
62
+ [EXCP_LAZYFP] = "v7M exception during lazy FP stacking",
63
+ [EXCP_LSERR] = "v8M LSERR UsageFault",
64
+ [EXCP_UNALIGNED] = "v7M UNALIGNED UsageFault",
65
+ };
66
+
67
+ if (idx >= 0 && idx < ARRAY_SIZE(excnames)) {
68
+ exc = excnames[idx];
69
+ }
70
+ if (!exc) {
71
+ exc = "unknown";
72
+ }
73
+ qemu_log_mask(CPU_LOG_INT, "Taking exception %d [%s]\n", idx, exc);
74
+ }
44
+ }
75
+}
45
+}
76
+
46
+
77
/*
47
+static uint32_t *regime_rlar(CPUARMState *env, ARMMMUIdx mmu_idx,
78
* Return true if the v7M CPACR permits access to the FPU for the specified
48
+ uint32_t secure)
79
* security state and privilege level.
49
+{
80
@@ -XXX,XX +XXX,XX @@ static bool do_v7m_function_return(ARMCPU *cpu)
50
+ if (regime_el(env, mmu_idx) == 2) {
81
return true;
51
+ return env->pmsav8.hprlar;
52
+ } else {
53
+ return env->pmsav8.rlar[secure];
54
+ }
55
+}
56
+
57
bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address,
58
MMUAccessType access_type, ARMMMUIdx mmu_idx,
59
bool secure, GetPhysAddrResult *result,
60
@@ -XXX,XX +XXX,XX @@ bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address,
61
bool hit = false;
62
uint32_t addr_page_base = address & TARGET_PAGE_MASK;
63
uint32_t addr_page_limit = addr_page_base + (TARGET_PAGE_SIZE - 1);
64
+ int region_counter;
65
+
66
+ if (regime_el(env, mmu_idx) == 2) {
67
+ region_counter = cpu->pmsav8r_hdregion;
68
+ } else {
69
+ region_counter = cpu->pmsav7_dregion;
70
+ }
71
72
result->f.lg_page_size = TARGET_PAGE_BITS;
73
result->f.phys_addr = address;
74
@@ -XXX,XX +XXX,XX @@ bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address,
75
*mregion = -1;
76
}
77
78
+ if (mmu_idx == ARMMMUIdx_Stage2) {
79
+ fi->stage2 = true;
80
+ }
81
+
82
/*
83
* Unlike the ARM ARM pseudocode, we don't need to check whether this
84
* was an exception vector read from the vector table (which is always
85
@@ -XXX,XX +XXX,XX @@ bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address,
86
hit = true;
87
}
88
89
- for (n = (int)cpu->pmsav7_dregion - 1; n >= 0; n--) {
90
+ uint32_t bitmask;
91
+ if (arm_feature(env, ARM_FEATURE_M)) {
92
+ bitmask = 0x1f;
93
+ } else {
94
+ bitmask = 0x3f;
95
+ fi->level = 0;
96
+ }
97
+
98
+ for (n = region_counter - 1; n >= 0; n--) {
99
/* region search */
100
/*
101
- * Note that the base address is bits [31:5] from the register
102
- * with bits [4:0] all zeroes, but the limit address is bits
103
- * [31:5] from the register with bits [4:0] all ones.
104
+ * Note that the base address is bits [31:x] from the register
105
+ * with bits [x-1:0] all zeroes, but the limit address is bits
106
+ * [31:x] from the register with bits [x:0] all ones. Where x is
107
+ * 5 for Cortex-M and 6 for Cortex-R
108
*/
109
- uint32_t base = env->pmsav8.rbar[secure][n] & ~0x1f;
110
- uint32_t limit = env->pmsav8.rlar[secure][n] | 0x1f;
111
+ uint32_t base = regime_rbar(env, mmu_idx, secure)[n] & ~bitmask;
112
+ uint32_t limit = regime_rlar(env, mmu_idx, secure)[n] | bitmask;
113
114
- if (!(env->pmsav8.rlar[secure][n] & 0x1)) {
115
+ if (!(regime_rlar(env, mmu_idx, secure)[n] & 0x1)) {
116
/* Region disabled */
117
continue;
118
}
119
@@ -XXX,XX +XXX,XX @@ bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address,
120
* PMSAv7 where highest-numbered-region wins)
121
*/
122
fi->type = ARMFault_Permission;
123
- fi->level = 1;
124
+ if (arm_feature(env, ARM_FEATURE_M)) {
125
+ fi->level = 1;
126
+ }
127
return true;
128
}
129
130
@@ -XXX,XX +XXX,XX @@ bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address,
131
}
132
133
if (!hit) {
134
- /* background fault */
135
- fi->type = ARMFault_Background;
136
+ if (arm_feature(env, ARM_FEATURE_M)) {
137
+ fi->type = ARMFault_Background;
138
+ } else {
139
+ fi->type = ARMFault_Permission;
140
+ }
141
return true;
142
}
143
144
@@ -XXX,XX +XXX,XX @@ bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address,
145
/* hit using the background region */
146
get_phys_addr_pmsav7_default(env, mmu_idx, address, &result->f.prot);
147
} else {
148
- uint32_t ap = extract32(env->pmsav8.rbar[secure][matchregion], 1, 2);
149
- uint32_t xn = extract32(env->pmsav8.rbar[secure][matchregion], 0, 1);
150
+ uint32_t matched_rbar = regime_rbar(env, mmu_idx, secure)[matchregion];
151
+ uint32_t matched_rlar = regime_rlar(env, mmu_idx, secure)[matchregion];
152
+ uint32_t ap = extract32(matched_rbar, 1, 2);
153
+ uint32_t xn = extract32(matched_rbar, 0, 1);
154
bool pxn = false;
155
156
if (arm_feature(env, ARM_FEATURE_V8_1M)) {
157
- pxn = extract32(env->pmsav8.rlar[secure][matchregion], 4, 1);
158
+ pxn = extract32(matched_rlar, 4, 1);
159
}
160
161
if (m_is_system_region(env, address)) {
162
@@ -XXX,XX +XXX,XX @@ bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address,
163
xn = 1;
164
}
165
166
- result->f.prot = simple_ap_to_rw_prot(env, mmu_idx, ap);
167
+ if (regime_el(env, mmu_idx) == 2) {
168
+ result->f.prot = simple_ap_to_rw_prot_is_user(ap,
169
+ mmu_idx != ARMMMUIdx_E2);
170
+ } else {
171
+ result->f.prot = simple_ap_to_rw_prot(env, mmu_idx, ap);
172
+ }
173
+
174
+ if (!arm_feature(env, ARM_FEATURE_M)) {
175
+ uint8_t attrindx = extract32(matched_rlar, 1, 3);
176
+ uint64_t mair = env->cp15.mair_el[regime_el(env, mmu_idx)];
177
+ uint8_t sh = extract32(matched_rlar, 3, 2);
178
+
179
+ if (regime_sctlr(env, mmu_idx) & SCTLR_WXN &&
180
+ result->f.prot & PAGE_WRITE && mmu_idx != ARMMMUIdx_Stage2) {
181
+ xn = 0x1;
182
+ }
183
+
184
+ if ((regime_el(env, mmu_idx) == 1) &&
185
+ regime_sctlr(env, mmu_idx) & SCTLR_UWXN && ap == 0x1) {
186
+ pxn = 0x1;
187
+ }
188
+
189
+ result->cacheattrs.is_s2_format = false;
190
+ result->cacheattrs.attrs = extract64(mair, attrindx * 8, 8);
191
+ result->cacheattrs.shareability = sh;
192
+ }
193
+
194
if (result->f.prot && !xn && !(pxn && !is_user)) {
195
result->f.prot |= PAGE_EXEC;
196
}
197
- /*
198
- * We don't need to look the attribute up in the MAIR0/MAIR1
199
- * registers because that only tells us about cacheability.
200
- */
201
+
202
if (mregion) {
203
*mregion = matchregion;
204
}
205
}
206
207
fi->type = ARMFault_Permission;
208
- fi->level = 1;
209
+ if (arm_feature(env, ARM_FEATURE_M)) {
210
+ fi->level = 1;
211
+ }
212
return !(result->f.prot & (1 << access_type));
82
}
213
}
83
214
84
-static void arm_log_exception(int idx)
215
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw,
85
-{
216
cacheattrs1 = result->cacheattrs;
86
- if (qemu_loglevel_mask(CPU_LOG_INT)) {
217
memset(result, 0, sizeof(*result));
87
- const char *exc = NULL;
218
88
- static const char * const excnames[] = {
219
- ret = get_phys_addr_lpae(env, ptw, ipa, access_type, is_el0, result, fi);
89
- [EXCP_UDEF] = "Undefined Instruction",
220
+ if (arm_feature(env, ARM_FEATURE_PMSA)) {
90
- [EXCP_SWI] = "SVC",
221
+ ret = get_phys_addr_pmsav8(env, ipa, access_type,
91
- [EXCP_PREFETCH_ABORT] = "Prefetch Abort",
222
+ ptw->in_mmu_idx, is_secure, result, fi);
92
- [EXCP_DATA_ABORT] = "Data Abort",
223
+ } else {
93
- [EXCP_IRQ] = "IRQ",
224
+ ret = get_phys_addr_lpae(env, ptw, ipa, access_type,
94
- [EXCP_FIQ] = "FIQ",
225
+ is_el0, result, fi);
95
- [EXCP_BKPT] = "Breakpoint",
226
+ }
96
- [EXCP_EXCEPTION_EXIT] = "QEMU v7M exception exit",
227
fi->s2addr = ipa;
97
- [EXCP_KERNEL_TRAP] = "QEMU intercept of kernel commpage",
228
98
- [EXCP_HVC] = "Hypervisor Call",
229
/* Combine the S1 and S2 perms. */
99
- [EXCP_HYP_TRAP] = "Hypervisor Trap",
100
- [EXCP_SMC] = "Secure Monitor Call",
101
- [EXCP_VIRQ] = "Virtual IRQ",
102
- [EXCP_VFIQ] = "Virtual FIQ",
103
- [EXCP_SEMIHOST] = "Semihosting call",
104
- [EXCP_NOCP] = "v7M NOCP UsageFault",
105
- [EXCP_INVSTATE] = "v7M INVSTATE UsageFault",
106
- [EXCP_STKOF] = "v8M STKOF UsageFault",
107
- [EXCP_LAZYFP] = "v7M exception during lazy FP stacking",
108
- [EXCP_LSERR] = "v8M LSERR UsageFault",
109
- [EXCP_UNALIGNED] = "v7M UNALIGNED UsageFault",
110
- };
111
-
112
- if (idx >= 0 && idx < ARRAY_SIZE(excnames)) {
113
- exc = excnames[idx];
114
- }
115
- if (!exc) {
116
- exc = "unknown";
117
- }
118
- qemu_log_mask(CPU_LOG_INT, "Taking exception %d [%s]\n", idx, exc);
119
- }
120
-}
121
-
122
static bool v7m_read_half_insn(ARMCPU *cpu, ARMMMUIdx mmu_idx,
123
uint32_t addr, uint16_t *insn)
124
{
125
--
230
--
126
2.20.1
231
2.25.1
127
232
128
233
diff view generated by jsdifflib
1
From: Andrew Jeffery <andrew@aj.id.au>
1
From: Tobias Röhmel <tobias.roehmel@rwth-aachen.de>
2
2
3
If the match value exceeds reload then we don't want to include it in
3
All constants are taken from the ARM Cortex-R52 Processor TRM Revision: r1p3
4
calculations for the next event.
5
4
6
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
5
Signed-off-by: Tobias Röhmel <tobias.roehmel@rwth-aachen.de>
7
Signed-off-by: Cédric Le Goater <clg@kaod.org>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Message-id: 20190618165311.27066-10-clg@kaod.org
7
Message-id: 20221206102504.165775-8-tobias.roehmel@rwth-aachen.de
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
9
---
11
hw/timer/aspeed_timer.c | 13 ++++++++++---
10
target/arm/cpu_tcg.c | 42 ++++++++++++++++++++++++++++++++++++++++++
12
1 file changed, 10 insertions(+), 3 deletions(-)
11
1 file changed, 42 insertions(+)
13
12
14
diff --git a/hw/timer/aspeed_timer.c b/hw/timer/aspeed_timer.c
13
diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c
15
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/timer/aspeed_timer.c
15
--- a/target/arm/cpu_tcg.c
17
+++ b/hw/timer/aspeed_timer.c
16
+++ b/target/arm/cpu_tcg.c
18
@@ -XXX,XX +XXX,XX @@ static inline uint64_t calculate_time(struct AspeedTimer *t, uint32_t ticks)
17
@@ -XXX,XX +XXX,XX @@ static void cortex_r5_initfn(Object *obj)
19
return t->start + delta_ns;
18
define_arm_cp_regs(cpu, cortexr5_cp_reginfo);
20
}
19
}
21
20
22
+static inline uint32_t calculate_match(struct AspeedTimer *t, int i)
21
+static void cortex_r52_initfn(Object *obj)
23
+{
22
+{
24
+ return t->match[i] < t->reload ? t->match[i] : 0;
23
+ ARMCPU *cpu = ARM_CPU(obj);
24
+
25
+ set_feature(&cpu->env, ARM_FEATURE_V8);
26
+ set_feature(&cpu->env, ARM_FEATURE_EL2);
27
+ set_feature(&cpu->env, ARM_FEATURE_PMSA);
28
+ set_feature(&cpu->env, ARM_FEATURE_NEON);
29
+ set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER);
30
+ cpu->midr = 0x411fd133; /* r1p3 */
31
+ cpu->revidr = 0x00000000;
32
+ cpu->reset_fpsid = 0x41034023;
33
+ cpu->isar.mvfr0 = 0x10110222;
34
+ cpu->isar.mvfr1 = 0x12111111;
35
+ cpu->isar.mvfr2 = 0x00000043;
36
+ cpu->ctr = 0x8144c004;
37
+ cpu->reset_sctlr = 0x30c50838;
38
+ cpu->isar.id_pfr0 = 0x00000131;
39
+ cpu->isar.id_pfr1 = 0x10111001;
40
+ cpu->isar.id_dfr0 = 0x03010006;
41
+ cpu->id_afr0 = 0x00000000;
42
+ cpu->isar.id_mmfr0 = 0x00211040;
43
+ cpu->isar.id_mmfr1 = 0x40000000;
44
+ cpu->isar.id_mmfr2 = 0x01200000;
45
+ cpu->isar.id_mmfr3 = 0xf0102211;
46
+ cpu->isar.id_mmfr4 = 0x00000010;
47
+ cpu->isar.id_isar0 = 0x02101110;
48
+ cpu->isar.id_isar1 = 0x13112111;
49
+ cpu->isar.id_isar2 = 0x21232142;
50
+ cpu->isar.id_isar3 = 0x01112131;
51
+ cpu->isar.id_isar4 = 0x00010142;
52
+ cpu->isar.id_isar5 = 0x00010001;
53
+ cpu->isar.dbgdidr = 0x77168000;
54
+ cpu->clidr = (1 << 27) | (1 << 24) | 0x3;
55
+ cpu->ccsidr[0] = 0x700fe01a; /* 32KB L1 dcache */
56
+ cpu->ccsidr[1] = 0x201fe00a; /* 32KB L1 icache */
57
+
58
+ cpu->pmsav7_dregion = 16;
59
+ cpu->pmsav8r_hdregion = 16;
25
+}
60
+}
26
+
61
+
27
static uint64_t calculate_next(struct AspeedTimer *t)
62
static void cortex_r5f_initfn(Object *obj)
28
{
63
{
29
uint64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
64
ARMCPU *cpu = ARM_CPU(obj);
30
@@ -XXX,XX +XXX,XX @@ static uint64_t calculate_next(struct AspeedTimer *t)
65
@@ -XXX,XX +XXX,XX @@ static const ARMCPUInfo arm_tcg_cpus[] = {
31
* the timer counts down to zero.
66
.class_init = arm_v7m_class_init },
32
*/
67
{ .name = "cortex-r5", .initfn = cortex_r5_initfn },
33
68
{ .name = "cortex-r5f", .initfn = cortex_r5f_initfn },
34
- next = calculate_time(t, MAX(t->match[0], t->match[1]));
69
+ { .name = "cortex-r52", .initfn = cortex_r52_initfn },
35
+ next = calculate_time(t, MAX(calculate_match(t, 0), calculate_match(t, 1)));
70
{ .name = "ti925t", .initfn = ti925t_initfn },
36
if (now < next) {
71
{ .name = "sa1100", .initfn = sa1100_initfn },
37
return next;
72
{ .name = "sa1110", .initfn = sa1110_initfn },
38
}
39
40
- next = calculate_time(t, MIN(t->match[0], t->match[1]));
41
+ next = calculate_time(t, MIN(calculate_match(t, 0), calculate_match(t, 1)));
42
if (now < next) {
43
return next;
44
}
45
@@ -XXX,XX +XXX,XX @@ static uint64_t calculate_next(struct AspeedTimer *t)
46
qemu_set_irq(t->irq, t->level);
47
}
48
49
+ next = MAX(MAX(calculate_match(t, 0), calculate_match(t, 1)), 0);
50
t->start = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
51
- return calculate_time(t, MAX(MAX(t->match[0], t->match[1]), 0));
52
+
53
+ return calculate_time(t, next);
54
}
55
56
static void aspeed_timer_mod(AspeedTimer *t)
57
--
73
--
58
2.20.1
74
2.25.1
59
75
60
76
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
From: Alex Bennée <alex.bennee@linaro.org>
2
2
3
Since we'll move this code around, fix its style first.
3
The check semihosting_enabled() wants to know if the guest is
4
currently in user mode. Unlike the other cases the test was inverted
5
causing us to block semihosting calls in non-EL0 modes.
4
6
5
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
7
Cc: qemu-stable@nongnu.org
6
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
8
Fixes: 19b26317e9 (target/arm: Honour -semihosting-config userspace=on)
7
Message-id: 20190701132516.26392-9-philmd@redhat.com
9
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
12
---
10
target/arm/translate.c | 11 ++++++-----
13
target/arm/translate.c | 2 +-
11
target/arm/vfp_helper.c | 36 ++++++++++++++++++++++++------------
14
1 file changed, 1 insertion(+), 1 deletion(-)
12
2 files changed, 30 insertions(+), 17 deletions(-)
13
15
14
diff --git a/target/arm/translate.c b/target/arm/translate.c
16
diff --git a/target/arm/translate.c b/target/arm/translate.c
15
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/translate.c
18
--- a/target/arm/translate.c
17
+++ b/target/arm/translate.c
19
+++ b/target/arm/translate.c
18
@@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
20
@@ -XXX,XX +XXX,XX @@ static inline void gen_hlt(DisasContext *s, int imm)
19
loaded_base = 0;
21
* semihosting, to provide some semblance of security
20
loaded_var = NULL;
22
* (and for consistency with our 32-bit semihosting).
21
n = 0;
23
*/
22
- for(i=0;i<16;i++) {
24
- if (semihosting_enabled(s->current_el != 0) &&
23
+ for (i = 0; i < 16; i++) {
25
+ if (semihosting_enabled(s->current_el == 0) &&
24
if (insn & (1 << i))
26
(imm == (s->thumb ? 0x3c : 0xf000))) {
25
n++;
27
gen_exception_internal_insn(s, EXCP_SEMIHOST);
26
}
27
@@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
28
}
29
}
30
j = 0;
31
- for(i=0;i<16;i++) {
32
+ for (i = 0; i < 16; i++) {
33
if (insn & (1 << i)) {
34
if (is_load) {
35
/* load */
36
@@ -XXX,XX +XXX,XX @@ void arm_cpu_dump_state(CPUState *cs, FILE *f, int flags)
37
return;
28
return;
38
}
39
40
- for(i=0;i<16;i++) {
41
+ for (i = 0; i < 16; i++) {
42
qemu_fprintf(f, "R%02d=%08x", i, env->regs[i]);
43
- if ((i % 4) == 3)
44
+ if ((i % 4) == 3) {
45
qemu_fprintf(f, "\n");
46
- else
47
+ } else {
48
qemu_fprintf(f, " ");
49
+ }
50
}
51
52
if (arm_feature(env, ARM_FEATURE_M)) {
53
diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c
54
index XXXXXXX..XXXXXXX 100644
55
--- a/target/arm/vfp_helper.c
56
+++ b/target/arm/vfp_helper.c
57
@@ -XXX,XX +XXX,XX @@ static inline int vfp_exceptbits_from_host(int host_bits)
58
{
59
int target_bits = 0;
60
61
- if (host_bits & float_flag_invalid)
62
+ if (host_bits & float_flag_invalid) {
63
target_bits |= 1;
64
- if (host_bits & float_flag_divbyzero)
65
+ }
66
+ if (host_bits & float_flag_divbyzero) {
67
target_bits |= 2;
68
- if (host_bits & float_flag_overflow)
69
+ }
70
+ if (host_bits & float_flag_overflow) {
71
target_bits |= 4;
72
- if (host_bits & (float_flag_underflow | float_flag_output_denormal))
73
+ }
74
+ if (host_bits & (float_flag_underflow | float_flag_output_denormal)) {
75
target_bits |= 8;
76
- if (host_bits & float_flag_inexact)
77
+ }
78
+ if (host_bits & float_flag_inexact) {
79
target_bits |= 0x10;
80
- if (host_bits & float_flag_input_denormal)
81
+ }
82
+ if (host_bits & float_flag_input_denormal) {
83
target_bits |= 0x80;
84
+ }
85
return target_bits;
86
}
87
88
@@ -XXX,XX +XXX,XX @@ static inline int vfp_exceptbits_to_host(int target_bits)
89
{
90
int host_bits = 0;
91
92
- if (target_bits & 1)
93
+ if (target_bits & 1) {
94
host_bits |= float_flag_invalid;
95
- if (target_bits & 2)
96
+ }
97
+ if (target_bits & 2) {
98
host_bits |= float_flag_divbyzero;
99
- if (target_bits & 4)
100
+ }
101
+ if (target_bits & 4) {
102
host_bits |= float_flag_overflow;
103
- if (target_bits & 8)
104
+ }
105
+ if (target_bits & 8) {
106
host_bits |= float_flag_underflow;
107
- if (target_bits & 0x10)
108
+ }
109
+ if (target_bits & 0x10) {
110
host_bits |= float_flag_inexact;
111
- if (target_bits & 0x80)
112
+ }
113
+ if (target_bits & 0x80) {
114
host_bits |= float_flag_input_denormal;
115
+ }
116
return host_bits;
117
}
118
119
--
29
--
120
2.20.1
30
2.25.1
121
31
122
32
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
From: Axel Heider <axel.heider@hensoldt.net>
2
2
3
To ease the review of the next commit,
3
Fix typos, add background information
4
move the vfp_exceptbits_to_host() function directly after
5
vfp_exceptbits_from_host(). Amusingly the diff shows we
6
are moving vfp_get_fpscr().
7
4
8
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5
Signed-off-by: Axel Heider <axel.heider@hensoldt.net>
9
Message-id: 20190701132516.26392-15-philmd@redhat.com
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
8
---
13
target/arm/vfp_helper.c | 52 ++++++++++++++++++++---------------------
9
hw/timer/imx_epit.c | 20 ++++++++++++++++----
14
1 file changed, 26 insertions(+), 26 deletions(-)
10
1 file changed, 16 insertions(+), 4 deletions(-)
15
11
16
diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c
12
diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c
17
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/vfp_helper.c
14
--- a/hw/timer/imx_epit.c
19
+++ b/target/arm/vfp_helper.c
15
+++ b/hw/timer/imx_epit.c
20
@@ -XXX,XX +XXX,XX @@ static inline int vfp_exceptbits_from_host(int host_bits)
16
@@ -XXX,XX +XXX,XX @@ static void imx_epit_set_freq(IMXEPITState *s)
21
return target_bits;
17
}
22
}
18
}
23
19
24
-uint32_t HELPER(vfp_get_fpscr)(CPUARMState *env)
20
+/*
25
-{
21
+ * This is called both on hardware (device) reset and software reset.
26
- uint32_t i, fpscr;
22
+ */
27
-
23
static void imx_epit_reset(DeviceState *dev)
28
- fpscr = env->vfp.xregs[ARM_VFP_FPSCR]
29
- | (env->vfp.vec_len << 16)
30
- | (env->vfp.vec_stride << 20);
31
-
32
- i = get_float_exception_flags(&env->vfp.fp_status);
33
- i |= get_float_exception_flags(&env->vfp.standard_fp_status);
34
- /* FZ16 does not generate an input denormal exception. */
35
- i |= (get_float_exception_flags(&env->vfp.fp_status_f16)
36
- & ~float_flag_input_denormal);
37
- fpscr |= vfp_exceptbits_from_host(i);
38
-
39
- i = env->vfp.qc[0] | env->vfp.qc[1] | env->vfp.qc[2] | env->vfp.qc[3];
40
- fpscr |= i ? FPCR_QC : 0;
41
-
42
- return fpscr;
43
-}
44
-
45
-uint32_t vfp_get_fpscr(CPUARMState *env)
46
-{
47
- return HELPER(vfp_get_fpscr)(env);
48
-}
49
-
50
/* Convert vfp exception flags to target form. */
51
static inline int vfp_exceptbits_to_host(int target_bits)
52
{
24
{
53
@@ -XXX,XX +XXX,XX @@ static inline int vfp_exceptbits_to_host(int target_bits)
25
IMXEPITState *s = IMX_EPIT(dev);
54
return host_bits;
26
27
- /*
28
- * Soft reset doesn't touch some bits; hard reset clears them
29
- */
30
+ /* Soft reset doesn't touch some bits; hard reset clears them */
31
s->cr &= (CR_EN|CR_ENMOD|CR_STOPEN|CR_DOZEN|CR_WAITEN|CR_DBGEN);
32
s->sr = 0;
33
s->lr = EPIT_TIMER_MAX;
34
@@ -XXX,XX +XXX,XX @@ static void imx_epit_write(void *opaque, hwaddr offset, uint64_t value,
35
ptimer_transaction_begin(s->timer_cmp);
36
ptimer_transaction_begin(s->timer_reload);
37
38
+ /* Update the frequency. Has been done already in case of a reset. */
39
if (!(s->cr & CR_SWR)) {
40
imx_epit_set_freq(s);
41
}
42
@@ -XXX,XX +XXX,XX @@ static void imx_epit_write(void *opaque, hwaddr offset, uint64_t value,
43
break;
44
45
case 1: /* SR - ACK*/
46
- /* writing 1 to OCIF clear the OCIF bit */
47
+ /* writing 1 to OCIF clears the OCIF bit */
48
if (value & 0x01) {
49
s->sr = 0;
50
imx_epit_update_int(s);
51
@@ -XXX,XX +XXX,XX @@ static void imx_epit_realize(DeviceState *dev, Error **errp)
52
0x00001000);
53
sysbus_init_mmio(sbd, &s->iomem);
54
55
+ /*
56
+ * The reload timer keeps running when the peripheral is enabled. It is a
57
+ * kind of wall clock that does not generate any interrupts. The callback
58
+ * needs to be provided, but it does nothing as the ptimer already supports
59
+ * all necessary reloading functionality.
60
+ */
61
s->timer_reload = ptimer_init(imx_epit_reload, s, PTIMER_POLICY_LEGACY);
62
63
+ /*
64
+ * The compare timer is running only when the peripheral configuration is
65
+ * in a state that will generate compare interrupts.
66
+ */
67
s->timer_cmp = ptimer_init(imx_epit_cmp, s, PTIMER_POLICY_LEGACY);
55
}
68
}
56
69
57
+uint32_t HELPER(vfp_get_fpscr)(CPUARMState *env)
58
+{
59
+ uint32_t i, fpscr;
60
+
61
+ fpscr = env->vfp.xregs[ARM_VFP_FPSCR]
62
+ | (env->vfp.vec_len << 16)
63
+ | (env->vfp.vec_stride << 20);
64
+
65
+ i = get_float_exception_flags(&env->vfp.fp_status);
66
+ i |= get_float_exception_flags(&env->vfp.standard_fp_status);
67
+ /* FZ16 does not generate an input denormal exception. */
68
+ i |= (get_float_exception_flags(&env->vfp.fp_status_f16)
69
+ & ~float_flag_input_denormal);
70
+ fpscr |= vfp_exceptbits_from_host(i);
71
+
72
+ i = env->vfp.qc[0] | env->vfp.qc[1] | env->vfp.qc[2] | env->vfp.qc[3];
73
+ fpscr |= i ? FPCR_QC : 0;
74
+
75
+ return fpscr;
76
+}
77
+
78
+uint32_t vfp_get_fpscr(CPUARMState *env)
79
+{
80
+ return HELPER(vfp_get_fpscr)(env);
81
+}
82
+
83
void HELPER(vfp_set_fpscr)(CPUARMState *env, uint32_t val)
84
{
85
int i;
86
--
70
--
87
2.20.1
71
2.25.1
88
89
diff view generated by jsdifflib
1
From: Andrey Smirnov <andrew.smirnov@gmail.com>
1
From: Axel Heider <axel.heider@hensoldt.net>
2
2
3
Expression to calculate update_msi_mapping in code handling writes to
3
remove unused defines, add needed defines
4
DESIGNWARE_PCIE_MSI_INTR0_ENABLE is missing an ! operator and should
5
be:
6
4
7
!!root->msi.intr[0].enable ^ !!val;
5
Signed-off-by: Axel Heider <axel.heider@hensoldt.net>
8
9
so that MSI mapping is updated when enabled transitions from either
10
"none" -> "any" or "any" -> "none". Since that register shouldn't be
11
written to very often, change the code to update MSI mapping
12
unconditionally instead of trying to fix the update_msi_mapping logic.
13
14
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
15
Cc: Peter Maydell <peter.maydell@linaro.org>
16
Cc: Michael S. Tsirkin <mst@redhat.com>
17
Cc: qemu-devel@nongnu.org
18
Cc: qemu-arm@nongnu.org
19
Acked-by: Michael S. Tsirkin <mst@redhat.com>
20
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
21
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
22
---
8
---
23
hw/pci-host/designware.c | 10 ++--------
9
include/hw/timer/imx_epit.h | 4 ++--
24
1 file changed, 2 insertions(+), 8 deletions(-)
10
hw/timer/imx_epit.c | 4 ++--
11
2 files changed, 4 insertions(+), 4 deletions(-)
25
12
26
diff --git a/hw/pci-host/designware.c b/hw/pci-host/designware.c
13
diff --git a/include/hw/timer/imx_epit.h b/include/hw/timer/imx_epit.h
27
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
28
--- a/hw/pci-host/designware.c
15
--- a/include/hw/timer/imx_epit.h
29
+++ b/hw/pci-host/designware.c
16
+++ b/include/hw/timer/imx_epit.h
30
@@ -XXX,XX +XXX,XX @@ static void designware_pcie_root_config_write(PCIDevice *d, uint32_t address,
17
@@ -XXX,XX +XXX,XX @@
31
root->msi.base |= (uint64_t)val << 32;
18
#define CR_OCIEN (1 << 2)
32
break;
19
#define CR_RLD (1 << 3)
33
20
#define CR_PRESCALE_SHIFT (4)
34
- case DESIGNWARE_PCIE_MSI_INTR0_ENABLE: {
21
-#define CR_PRESCALE_MASK (0xfff)
35
- const bool update_msi_mapping = !root->msi.intr[0].enable ^ !!val;
22
+#define CR_PRESCALE_BITS (12)
36
-
23
#define CR_SWR (1 << 16)
37
+ case DESIGNWARE_PCIE_MSI_INTR0_ENABLE:
24
#define CR_IOVW (1 << 17)
38
root->msi.intr[0].enable = val;
25
#define CR_DBGEN (1 << 18)
39
-
26
@@ -XXX,XX +XXX,XX @@
40
- if (update_msi_mapping) {
27
#define CR_DOZEN (1 << 20)
41
- designware_pcie_root_update_msi_mapping(root);
28
#define CR_STOPEN (1 << 21)
42
- }
29
#define CR_CLKSRC_SHIFT (24)
43
+ designware_pcie_root_update_msi_mapping(root);
30
-#define CR_CLKSRC_MASK (0x3 << CR_CLKSRC_SHIFT)
44
break;
31
+#define CR_CLKSRC_BITS (2)
45
- }
32
46
33
#define EPIT_TIMER_MAX 0XFFFFFFFFUL
47
case DESIGNWARE_PCIE_MSI_INTR0_MASK:
34
48
root->msi.intr[0].mask = val;
35
diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c
36
index XXXXXXX..XXXXXXX 100644
37
--- a/hw/timer/imx_epit.c
38
+++ b/hw/timer/imx_epit.c
39
@@ -XXX,XX +XXX,XX @@ static void imx_epit_set_freq(IMXEPITState *s)
40
uint32_t clksrc;
41
uint32_t prescaler;
42
43
- clksrc = extract32(s->cr, CR_CLKSRC_SHIFT, 2);
44
- prescaler = 1 + extract32(s->cr, CR_PRESCALE_SHIFT, 12);
45
+ clksrc = extract32(s->cr, CR_CLKSRC_SHIFT, CR_CLKSRC_BITS);
46
+ prescaler = 1 + extract32(s->cr, CR_PRESCALE_SHIFT, CR_PRESCALE_BITS);
47
48
s->freq = imx_ccm_get_clock_frequency(s->ccm,
49
imx_epit_clocks[clksrc]) / prescaler;
49
--
50
--
50
2.20.1
51
2.25.1
51
52
diff view generated by jsdifflib
1
From: Andrey Smirnov <andrew.smirnov@gmail.com>
1
From: Axel Heider <axel.heider@hensoldt.net>
2
2
3
Datasheet for i.MX7 is incorrect and i.MX7's PCI IRQ mapping matches
4
that of i.MX6:
5
6
* INTD/MSI 122
7
* INTC 123
8
* INTB 124
9
* INTA 125
10
11
Fix all of the relevant code to reflect that fact. Needed by latest
12
Linux kernels.
13
14
(Reference: Linux kernel commit 538d6e9d597584e80 from an
15
NXP employee confirming that the datasheet is incorrect and
16
with a report of a test against hardware.)
17
18
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
19
Cc: Peter Maydell <peter.maydell@linaro.org>
20
Cc: Michael S. Tsirkin <mst@redhat.com>
21
Cc: qemu-devel@nongnu.org
22
Cc: qemu-arm@nongnu.org
23
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
3
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
24
[PMM: added ref to kernel commit confirming the datasheet error]
25
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
26
---
5
---
27
include/hw/arm/fsl-imx7.h | 8 ++++----
6
include/hw/timer/imx_epit.h | 2 ++
28
hw/pci-host/designware.c | 6 ++++--
7
hw/timer/imx_epit.c | 12 ++++++------
29
2 files changed, 8 insertions(+), 6 deletions(-)
8
2 files changed, 8 insertions(+), 6 deletions(-)
30
9
31
diff --git a/include/hw/arm/fsl-imx7.h b/include/hw/arm/fsl-imx7.h
10
diff --git a/include/hw/timer/imx_epit.h b/include/hw/timer/imx_epit.h
32
index XXXXXXX..XXXXXXX 100644
11
index XXXXXXX..XXXXXXX 100644
33
--- a/include/hw/arm/fsl-imx7.h
12
--- a/include/hw/timer/imx_epit.h
34
+++ b/include/hw/arm/fsl-imx7.h
13
+++ b/include/hw/timer/imx_epit.h
35
@@ -XXX,XX +XXX,XX @@ enum FslIMX7IRQs {
14
@@ -XXX,XX +XXX,XX @@
36
FSL_IMX7_USB2_IRQ = 42,
15
#define CR_CLKSRC_SHIFT (24)
37
FSL_IMX7_USB3_IRQ = 40,
16
#define CR_CLKSRC_BITS (2)
38
17
39
- FSL_IMX7_PCI_INTA_IRQ = 122,
18
+#define SR_OCIF (1 << 0)
40
- FSL_IMX7_PCI_INTB_IRQ = 123,
19
+
41
- FSL_IMX7_PCI_INTC_IRQ = 124,
20
#define EPIT_TIMER_MAX 0XFFFFFFFFUL
42
- FSL_IMX7_PCI_INTD_IRQ = 125,
21
43
+ FSL_IMX7_PCI_INTA_IRQ = 125,
22
#define TYPE_IMX_EPIT "imx.epit"
44
+ FSL_IMX7_PCI_INTB_IRQ = 124,
23
diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c
45
+ FSL_IMX7_PCI_INTC_IRQ = 123,
46
+ FSL_IMX7_PCI_INTD_IRQ = 122,
47
48
FSL_IMX7_UART7_IRQ = 126,
49
50
diff --git a/hw/pci-host/designware.c b/hw/pci-host/designware.c
51
index XXXXXXX..XXXXXXX 100644
24
index XXXXXXX..XXXXXXX 100644
52
--- a/hw/pci-host/designware.c
25
--- a/hw/timer/imx_epit.c
53
+++ b/hw/pci-host/designware.c
26
+++ b/hw/timer/imx_epit.c
54
@@ -XXX,XX +XXX,XX @@
27
@@ -XXX,XX +XXX,XX @@ static const IMXClk imx_epit_clocks[] = {
55
#define DESIGNWARE_PCIE_ATU_DEVFN(x) (((x) >> 16) & 0xff)
28
*/
56
#define DESIGNWARE_PCIE_ATU_UPPER_TARGET 0x91C
29
static void imx_epit_update_int(IMXEPITState *s)
57
58
+#define DESIGNWARE_PCIE_IRQ_MSI 3
59
+
60
static DesignwarePCIEHost *
61
designware_pcie_root_to_host(DesignwarePCIERoot *root)
62
{
30
{
63
@@ -XXX,XX +XXX,XX @@ static void designware_pcie_root_msi_write(void *opaque, hwaddr addr,
31
- if (s->sr && (s->cr & CR_OCIEN) && (s->cr & CR_EN)) {
64
root->msi.intr[0].status |= BIT(val) & root->msi.intr[0].enable;
32
+ if ((s->sr & SR_OCIF) && (s->cr & CR_OCIEN) && (s->cr & CR_EN)) {
65
33
qemu_irq_raise(s->irq);
66
if (root->msi.intr[0].status & ~root->msi.intr[0].mask) {
34
} else {
67
- qemu_set_irq(host->pci.irqs[0], 1);
35
qemu_irq_lower(s->irq);
68
+ qemu_set_irq(host->pci.irqs[DESIGNWARE_PCIE_IRQ_MSI], 1);
36
@@ -XXX,XX +XXX,XX @@ static void imx_epit_write(void *opaque, hwaddr offset, uint64_t value,
69
}
37
break;
70
}
38
71
39
case 1: /* SR - ACK*/
72
@@ -XXX,XX +XXX,XX @@ static void designware_pcie_root_config_write(PCIDevice *d, uint32_t address,
40
- /* writing 1 to OCIF clears the OCIF bit */
73
case DESIGNWARE_PCIE_MSI_INTR0_STATUS:
41
- if (value & 0x01) {
74
root->msi.intr[0].status ^= val;
42
- s->sr = 0;
75
if (!root->msi.intr[0].status) {
43
+ /* writing 1 to SR.OCIF clears this bit and turns the interrupt off */
76
- qemu_set_irq(host->pci.irqs[0], 0);
44
+ if (value & SR_OCIF) {
77
+ qemu_set_irq(host->pci.irqs[DESIGNWARE_PCIE_IRQ_MSI], 0);
45
+ s->sr = 0; /* SR.OCIF is the only bit in this register anyway */
46
imx_epit_update_int(s);
78
}
47
}
79
break;
48
break;
49
@@ -XXX,XX +XXX,XX @@ static void imx_epit_cmp(void *opaque)
50
IMXEPITState *s = IMX_EPIT(opaque);
51
52
DPRINTF("sr was %d\n", s->sr);
53
-
54
- s->sr = 1;
55
+ /* Set interrupt status bit SR.OCIF and update the interrupt state */
56
+ s->sr |= SR_OCIF;
57
imx_epit_update_int(s);
58
}
80
59
81
--
60
--
82
2.20.1
61
2.25.1
83
84
diff view generated by jsdifflib
1
From: Cédric Le Goater <clg@kaod.org>
1
From: Axel Heider <axel.heider@hensoldt.net>
2
2
3
The DRAM address of a DMA transaction depends on the DRAM base address
3
The interrupt state can change due to:
4
of the SoC. Inform the SMC controller model with this value.
4
- reset clears both SR.OCIF and CR.OCIE
5
- write to CR.EN or CR.OCIE
5
6
6
Signed-off-by: Cédric Le Goater <clg@kaod.org>
7
Signed-off-by: Axel Heider <axel.heider@hensoldt.net>
7
Reviewed-by: Joel Stanley <joel@jms.id.au>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
9
Message-id: 20190618165311.27066-15-clg@kaod.org
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
10
---
12
include/hw/ssi/aspeed_smc.h | 3 +++
11
hw/timer/imx_epit.c | 16 ++++++++++++----
13
hw/arm/aspeed_soc.c | 6 ++++++
12
1 file changed, 12 insertions(+), 4 deletions(-)
14
hw/ssi/aspeed_smc.c | 1 +
15
3 files changed, 10 insertions(+)
16
13
17
diff --git a/include/hw/ssi/aspeed_smc.h b/include/hw/ssi/aspeed_smc.h
14
diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c
18
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
19
--- a/include/hw/ssi/aspeed_smc.h
16
--- a/hw/timer/imx_epit.c
20
+++ b/include/hw/ssi/aspeed_smc.h
17
+++ b/hw/timer/imx_epit.c
21
@@ -XXX,XX +XXX,XX @@ typedef struct AspeedSMCState {
18
@@ -XXX,XX +XXX,XX @@ static void imx_epit_write(void *opaque, hwaddr offset, uint64_t value,
22
uint8_t r_timings;
19
if (s->cr & CR_SWR) {
23
uint8_t conf_enable_w0;
20
/* handle the reset */
24
21
imx_epit_reset(DEVICE(s));
25
+ /* for DMA support */
22
- /*
26
+ uint64_t sdram_base;
23
- * TODO: could we 'break' here? following operations appear
24
- * to duplicate the work imx_epit_reset() already did.
25
- */
26
}
27
28
+ /*
29
+ * The interrupt state can change due to:
30
+ * - reset clears both SR.OCIF and CR.OCIE
31
+ * - write to CR.EN or CR.OCIE
32
+ */
33
+ imx_epit_update_int(s);
27
+
34
+
28
AspeedSMCFlash *flashes;
35
+ /*
29
36
+ * TODO: could we 'break' here for reset? following operations appear
30
uint8_t snoop_index;
37
+ * to duplicate the work imx_epit_reset() already did.
31
diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c
38
+ */
32
index XXXXXXX..XXXXXXX 100644
39
+
33
--- a/hw/arm/aspeed_soc.c
40
ptimer_transaction_begin(s->timer_cmp);
34
+++ b/hw/arm/aspeed_soc.c
41
ptimer_transaction_begin(s->timer_reload);
35
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
36
aspeed_soc_get_irq(s, ASPEED_I2C));
37
38
/* FMC, The number of CS is set at the board level */
39
+ object_property_set_int(OBJECT(&s->fmc), sc->info->memmap[ASPEED_SDRAM],
40
+ "sdram-base", &err);
41
+ if (err) {
42
+ error_propagate(errp, err);
43
+ return;
44
+ }
45
object_property_set_bool(OBJECT(&s->fmc), true, "realized", &err);
46
if (err) {
47
error_propagate(errp, err);
48
diff --git a/hw/ssi/aspeed_smc.c b/hw/ssi/aspeed_smc.c
49
index XXXXXXX..XXXXXXX 100644
50
--- a/hw/ssi/aspeed_smc.c
51
+++ b/hw/ssi/aspeed_smc.c
52
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_aspeed_smc = {
53
54
static Property aspeed_smc_properties[] = {
55
DEFINE_PROP_UINT32("num-cs", AspeedSMCState, num_cs, 1),
56
+ DEFINE_PROP_UINT64("sdram-base", AspeedSMCState, sdram_base, 0),
57
DEFINE_PROP_END_OF_LIST(),
58
};
59
42
60
--
43
--
61
2.20.1
44
2.25.1
62
63
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
From: Axel Heider <axel.heider@hensoldt.net>
2
2
3
The vfp_set_fpscr() helper contains code specific to the host
3
Signed-off-by: Axel Heider <axel.heider@hensoldt.net>
4
floating point implementation (here the SoftFloat library).
5
Extract this code to vfp_set_fpscr_from_host().
6
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
8
Message-id: 20190701132516.26392-17-philmd@redhat.com
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
6
---
12
target/arm/vfp_helper.c | 19 +++++++++++++------
7
hw/timer/imx_epit.c | 20 ++++++++++++++------
13
1 file changed, 13 insertions(+), 6 deletions(-)
8
1 file changed, 14 insertions(+), 6 deletions(-)
14
9
15
diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c
10
diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c
16
index XXXXXXX..XXXXXXX 100644
11
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/vfp_helper.c
12
--- a/hw/timer/imx_epit.c
18
+++ b/target/arm/vfp_helper.c
13
+++ b/hw/timer/imx_epit.c
19
@@ -XXX,XX +XXX,XX @@ static inline int vfp_exceptbits_to_host(int target_bits)
14
@@ -XXX,XX +XXX,XX @@ static void imx_epit_set_freq(IMXEPITState *s)
20
return host_bits;
15
/*
16
* This is called both on hardware (device) reset and software reset.
17
*/
18
-static void imx_epit_reset(DeviceState *dev)
19
+static void imx_epit_reset(IMXEPITState *s, bool is_hard_reset)
20
{
21
- IMXEPITState *s = IMX_EPIT(dev);
22
-
23
/* Soft reset doesn't touch some bits; hard reset clears them */
24
- s->cr &= (CR_EN|CR_ENMOD|CR_STOPEN|CR_DOZEN|CR_WAITEN|CR_DBGEN);
25
+ if (is_hard_reset) {
26
+ s->cr = 0;
27
+ } else {
28
+ s->cr &= (CR_EN|CR_ENMOD|CR_STOPEN|CR_DOZEN|CR_WAITEN|CR_DBGEN);
29
+ }
30
s->sr = 0;
31
s->lr = EPIT_TIMER_MAX;
32
s->cmp = 0;
33
@@ -XXX,XX +XXX,XX @@ static void imx_epit_write(void *opaque, hwaddr offset, uint64_t value,
34
s->cr = value & 0x03ffffff;
35
if (s->cr & CR_SWR) {
36
/* handle the reset */
37
- imx_epit_reset(DEVICE(s));
38
+ imx_epit_reset(s, false);
39
}
40
41
/*
42
@@ -XXX,XX +XXX,XX @@ static void imx_epit_realize(DeviceState *dev, Error **errp)
43
s->timer_cmp = ptimer_init(imx_epit_cmp, s, PTIMER_POLICY_LEGACY);
21
}
44
}
22
45
23
+static uint32_t vfp_get_fpscr_from_host(CPUARMState *env)
46
+static void imx_epit_dev_reset(DeviceState *dev)
24
+{
47
+{
25
+ uint32_t i;
48
+ IMXEPITState *s = IMX_EPIT(dev);
26
+
49
+ imx_epit_reset(s, true);
27
+ i = get_float_exception_flags(&env->vfp.fp_status);
28
+ i |= get_float_exception_flags(&env->vfp.standard_fp_status);
29
+ /* FZ16 does not generate an input denormal exception. */
30
+ i |= (get_float_exception_flags(&env->vfp.fp_status_f16)
31
+ & ~float_flag_input_denormal);
32
+ return vfp_exceptbits_from_host(i);
33
+}
50
+}
34
+
51
+
35
static void vfp_set_fpscr_to_host(CPUARMState *env, uint32_t val)
52
static void imx_epit_class_init(ObjectClass *klass, void *data)
36
{
53
{
37
int i;
54
DeviceClass *dc = DEVICE_CLASS(klass);
38
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(vfp_get_fpscr)(CPUARMState *env)
55
39
| (env->vfp.vec_len << 16)
56
dc->realize = imx_epit_realize;
40
| (env->vfp.vec_stride << 20);
57
- dc->reset = imx_epit_reset;
41
58
+ dc->reset = imx_epit_dev_reset;
42
- i = get_float_exception_flags(&env->vfp.fp_status);
59
dc->vmsd = &vmstate_imx_timer_epit;
43
- i |= get_float_exception_flags(&env->vfp.standard_fp_status);
60
dc->desc = "i.MX periodic timer";
44
- /* FZ16 does not generate an input denormal exception. */
61
}
45
- i |= (get_float_exception_flags(&env->vfp.fp_status_f16)
46
- & ~float_flag_input_denormal);
47
- fpscr |= vfp_exceptbits_from_host(i);
48
+ fpscr |= vfp_get_fpscr_from_host(env);
49
50
i = env->vfp.qc[0] | env->vfp.qc[1] | env->vfp.qc[2] | env->vfp.qc[3];
51
fpscr |= i ? FPCR_QC : 0;
52
--
62
--
53
2.20.1
63
2.25.1
54
55
diff view generated by jsdifflib
1
From: Hongbo Zhang <hongbo.zhang@linaro.org>
1
From: Axel Heider <axel.heider@hensoldt.net>
2
2
3
For AArch64, the existing "virt" machine is primarily meant to
3
Signed-off-by: Axel Heider <axel.heider@hensoldt.net>
4
run on KVM and execute virtualization workloads, but we need an
5
environment as faithful as possible to physical hardware, for supporting
6
firmware and OS development for physical Aarch64 machines.
7
8
This patch introduces new machine type 'sbsa-ref' with main features:
9
- Based on 'virt' machine type.
10
- A new memory map.
11
- CPU type cortex-a57.
12
- EL2 and EL3 are enabled.
13
- GIC version 3.
14
- System bus AHCI controller.
15
- System bus EHCI controller.
16
- CDROM and hard disc on AHCI bus.
17
- E1000E ethernet card on PCIE bus.
18
- VGA display adaptor on PCIE bus.
19
- No virtio devices.
20
- No fw_cfg device.
21
- No ACPI table supplied.
22
- Only minimal device tree nodes.
23
24
Arm Trusted Firmware and UEFI porting to this are done accordingly,
25
and the firmware should supply ACPI tables to the guest OS. The
26
minimal device tree nodes supplied by QEMU for this platform are only
27
to pass the dynamic info reflecting command line input to firmware,
28
not for loading the guest OS.
29
30
To make the review easier, this task is split into two patches, the
31
fundamental skeleton part and the peripheral devices part; this patch is
32
the first part.
33
34
Signed-off-by: Hongbo Zhang <hongbo.zhang@linaro.org>
35
Message-id: 1561890034-15921-2-git-send-email-hongbo.zhang@linaro.org
36
[PMM: commit message tweaks; moved some bits between patch 1 and 2
37
to ensure patch 1 builds cleanly; removed unneeded lines from
38
Kconfig stanza; only provide board for qemu-system-aarch64, not
39
qemu-system-arm; added MAINTAINERS entry]
40
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
41
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
42
---
6
---
43
hw/arm/Makefile.objs | 1 +
7
hw/timer/imx_epit.c | 215 ++++++++++++++++++++++++--------------------
44
hw/arm/sbsa-ref.c | 271 ++++++++++++++++++++++++++++
8
1 file changed, 117 insertions(+), 98 deletions(-)
45
MAINTAINERS | 8 +
46
default-configs/aarch64-softmmu.mak | 1 +
47
hw/arm/Kconfig | 14 ++
48
5 files changed, 295 insertions(+)
49
create mode 100644 hw/arm/sbsa-ref.c
50
9
51
diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs
10
diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c
52
index XXXXXXX..XXXXXXX 100644
11
index XXXXXXX..XXXXXXX 100644
53
--- a/hw/arm/Makefile.objs
12
--- a/hw/timer/imx_epit.c
54
+++ b/hw/arm/Makefile.objs
13
+++ b/hw/timer/imx_epit.c
55
@@ -XXX,XX +XXX,XX @@ obj-$(CONFIG_SPITZ) += spitz.o
14
@@ -XXX,XX +XXX,XX @@ static void imx_epit_reload_compare_timer(IMXEPITState *s)
56
obj-$(CONFIG_TOSA) += tosa.o
15
}
57
obj-$(CONFIG_Z2) += z2.o
16
}
58
obj-$(CONFIG_REALVIEW) += realview.o
17
59
+obj-$(CONFIG_SBSA_REF) += sbsa-ref.o
18
+static void imx_epit_write_cr(IMXEPITState *s, uint32_t value)
60
obj-$(CONFIG_STELLARIS) += stellaris.o
19
+{
61
obj-$(CONFIG_COLLIE) += collie.o
20
+ uint32_t oldcr = s->cr;
62
obj-$(CONFIG_VERSATILE) += versatilepb.o
21
+
63
diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
22
+ s->cr = value & 0x03ffffff;
64
new file mode 100644
23
+
65
index XXXXXXX..XXXXXXX
24
+ if (s->cr & CR_SWR) {
66
--- /dev/null
25
+ /* handle the reset */
67
+++ b/hw/arm/sbsa-ref.c
26
+ imx_epit_reset(s, false);
68
@@ -XXX,XX +XXX,XX @@
69
+/*
70
+ * ARM SBSA Reference Platform emulation
71
+ *
72
+ * Copyright (c) 2018 Linaro Limited
73
+ * Written by Hongbo Zhang <hongbo.zhang@linaro.org>
74
+ *
75
+ * This program is free software; you can redistribute it and/or modify it
76
+ * under the terms and conditions of the GNU General Public License,
77
+ * version 2 or later, as published by the Free Software Foundation.
78
+ *
79
+ * This program is distributed in the hope it will be useful, but WITHOUT
80
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
81
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
82
+ * more details.
83
+ *
84
+ * You should have received a copy of the GNU General Public License along with
85
+ * this program. If not, see <http://www.gnu.org/licenses/>.
86
+ */
87
+
88
+#include "qemu/osdep.h"
89
+#include "qapi/error.h"
90
+#include "qemu/error-report.h"
91
+#include "qemu/units.h"
92
+#include "sysemu/numa.h"
93
+#include "sysemu/sysemu.h"
94
+#include "exec/address-spaces.h"
95
+#include "exec/hwaddr.h"
96
+#include "kvm_arm.h"
97
+#include "hw/arm/boot.h"
98
+#include "hw/boards.h"
99
+#include "hw/intc/arm_gicv3_common.h"
100
+
101
+#define RAMLIMIT_GB 8192
102
+#define RAMLIMIT_BYTES (RAMLIMIT_GB * GiB)
103
+
104
+enum {
105
+ SBSA_FLASH,
106
+ SBSA_MEM,
107
+ SBSA_CPUPERIPHS,
108
+ SBSA_GIC_DIST,
109
+ SBSA_GIC_REDIST,
110
+ SBSA_SMMU,
111
+ SBSA_UART,
112
+ SBSA_RTC,
113
+ SBSA_PCIE,
114
+ SBSA_PCIE_MMIO,
115
+ SBSA_PCIE_MMIO_HIGH,
116
+ SBSA_PCIE_PIO,
117
+ SBSA_PCIE_ECAM,
118
+ SBSA_GPIO,
119
+ SBSA_SECURE_UART,
120
+ SBSA_SECURE_UART_MM,
121
+ SBSA_SECURE_MEM,
122
+ SBSA_AHCI,
123
+ SBSA_EHCI,
124
+};
125
+
126
+typedef struct MemMapEntry {
127
+ hwaddr base;
128
+ hwaddr size;
129
+} MemMapEntry;
130
+
131
+typedef struct {
132
+ MachineState parent;
133
+ struct arm_boot_info bootinfo;
134
+ int smp_cpus;
135
+ void *fdt;
136
+ int fdt_size;
137
+ int psci_conduit;
138
+} SBSAMachineState;
139
+
140
+#define TYPE_SBSA_MACHINE MACHINE_TYPE_NAME("sbsa-ref")
141
+#define SBSA_MACHINE(obj) \
142
+ OBJECT_CHECK(SBSAMachineState, (obj), TYPE_SBSA_MACHINE)
143
+
144
+static const MemMapEntry sbsa_ref_memmap[] = {
145
+ /* 512M boot ROM */
146
+ [SBSA_FLASH] = { 0, 0x20000000 },
147
+ /* 512M secure memory */
148
+ [SBSA_SECURE_MEM] = { 0x20000000, 0x20000000 },
149
+ /* Space reserved for CPU peripheral devices */
150
+ [SBSA_CPUPERIPHS] = { 0x40000000, 0x00040000 },
151
+ [SBSA_GIC_DIST] = { 0x40060000, 0x00010000 },
152
+ [SBSA_GIC_REDIST] = { 0x40080000, 0x04000000 },
153
+ [SBSA_UART] = { 0x60000000, 0x00001000 },
154
+ [SBSA_RTC] = { 0x60010000, 0x00001000 },
155
+ [SBSA_GPIO] = { 0x60020000, 0x00001000 },
156
+ [SBSA_SECURE_UART] = { 0x60030000, 0x00001000 },
157
+ [SBSA_SECURE_UART_MM] = { 0x60040000, 0x00001000 },
158
+ [SBSA_SMMU] = { 0x60050000, 0x00020000 },
159
+ /* Space here reserved for more SMMUs */
160
+ [SBSA_AHCI] = { 0x60100000, 0x00010000 },
161
+ [SBSA_EHCI] = { 0x60110000, 0x00010000 },
162
+ /* Space here reserved for other devices */
163
+ [SBSA_PCIE_PIO] = { 0x7fff0000, 0x00010000 },
164
+ /* 32-bit address PCIE MMIO space */
165
+ [SBSA_PCIE_MMIO] = { 0x80000000, 0x70000000 },
166
+ /* 256M PCIE ECAM space */
167
+ [SBSA_PCIE_ECAM] = { 0xf0000000, 0x10000000 },
168
+ /* ~1TB PCIE MMIO space (4GB to 1024GB boundary) */
169
+ [SBSA_PCIE_MMIO_HIGH] = { 0x100000000ULL, 0xFF00000000ULL },
170
+ [SBSA_MEM] = { 0x10000000000ULL, RAMLIMIT_BYTES },
171
+};
172
+
173
+static void sbsa_ref_init(MachineState *machine)
174
+{
175
+ SBSAMachineState *sms = SBSA_MACHINE(machine);
176
+ MachineClass *mc = MACHINE_GET_CLASS(machine);
177
+ MemoryRegion *sysmem = get_system_memory();
178
+ MemoryRegion *secure_sysmem = NULL;
179
+ MemoryRegion *ram = g_new(MemoryRegion, 1);
180
+ const CPUArchIdList *possible_cpus;
181
+ int n, sbsa_max_cpus;
182
+
183
+ if (strcmp(machine->cpu_type, ARM_CPU_TYPE_NAME("cortex-a57"))) {
184
+ error_report("sbsa-ref: CPU type other than the built-in "
185
+ "cortex-a57 not supported");
186
+ exit(1);
187
+ }
188
+
189
+ if (kvm_enabled()) {
190
+ error_report("sbsa-ref: KVM is not supported for this machine");
191
+ exit(1);
192
+ }
27
+ }
193
+
28
+
194
+ /*
29
+ /*
195
+ * This machine has EL3 enabled, external firmware should supply PSCI
30
+ * The interrupt state can change due to:
196
+ * implementation, so the QEMU's internal PSCI is disabled.
31
+ * - reset clears both SR.OCIF and CR.OCIE
32
+ * - write to CR.EN or CR.OCIE
197
+ */
33
+ */
198
+ sms->psci_conduit = QEMU_PSCI_CONDUIT_DISABLED;
34
+ imx_epit_update_int(s);
199
+
35
+
200
+ sbsa_max_cpus = sbsa_ref_memmap[SBSA_GIC_REDIST].size / GICV3_REDIST_SIZE;
36
+ /*
201
+
37
+ * TODO: could we 'break' here for reset? following operations appear
202
+ if (max_cpus > sbsa_max_cpus) {
38
+ * to duplicate the work imx_epit_reset() already did.
203
+ error_report("Number of SMP CPUs requested (%d) exceeds max CPUs "
39
+ */
204
+ "supported by machine 'sbsa-ref' (%d)",
40
+
205
+ max_cpus, sbsa_max_cpus);
41
+ ptimer_transaction_begin(s->timer_cmp);
206
+ exit(1);
42
+ ptimer_transaction_begin(s->timer_reload);
207
+ }
43
+
208
+
44
+ /* Update the frequency. Has been done already in case of a reset. */
209
+ sms->smp_cpus = smp_cpus;
45
+ if (!(s->cr & CR_SWR)) {
210
+
46
+ imx_epit_set_freq(s);
211
+ if (machine->ram_size > sbsa_ref_memmap[SBSA_MEM].size) {
47
+ }
212
+ error_report("sbsa-ref: cannot model more than %dGB RAM", RAMLIMIT_GB);
48
+
213
+ exit(1);
49
+ if (s->freq && (s->cr & CR_EN) && !(oldcr & CR_EN)) {
214
+ }
50
+ if (s->cr & CR_ENMOD) {
215
+
51
+ if (s->cr & CR_RLD) {
216
+ possible_cpus = mc->possible_cpu_arch_ids(machine);
52
+ ptimer_set_limit(s->timer_reload, s->lr, 1);
217
+ for (n = 0; n < possible_cpus->len; n++) {
53
+ ptimer_set_limit(s->timer_cmp, s->lr, 1);
218
+ Object *cpuobj;
54
+ } else {
219
+ CPUState *cs;
55
+ ptimer_set_limit(s->timer_reload, EPIT_TIMER_MAX, 1);
220
+
56
+ ptimer_set_limit(s->timer_cmp, EPIT_TIMER_MAX, 1);
221
+ if (n >= smp_cpus) {
57
+ }
222
+ break;
223
+ }
58
+ }
224
+
59
+
225
+ cpuobj = object_new(possible_cpus->cpus[n].type);
60
+ imx_epit_reload_compare_timer(s);
226
+ object_property_set_int(cpuobj, possible_cpus->cpus[n].arch_id,
61
+ ptimer_run(s->timer_reload, 0);
227
+ "mp-affinity", NULL);
62
+ if (s->cr & CR_OCIEN) {
228
+
63
+ ptimer_run(s->timer_cmp, 0);
229
+ cs = CPU(cpuobj);
64
+ } else {
230
+ cs->cpu_index = n;
65
+ ptimer_stop(s->timer_cmp);
231
+
232
+ numa_cpu_pre_plug(&possible_cpus->cpus[cs->cpu_index], DEVICE(cpuobj),
233
+ &error_fatal);
234
+
235
+ if (object_property_find(cpuobj, "reset-cbar", NULL)) {
236
+ object_property_set_int(cpuobj,
237
+ sbsa_ref_memmap[SBSA_CPUPERIPHS].base,
238
+ "reset-cbar", &error_abort);
239
+ }
66
+ }
240
+
67
+ } else if (!(s->cr & CR_EN)) {
241
+ object_property_set_link(cpuobj, OBJECT(sysmem), "memory",
68
+ /* stop both timers */
242
+ &error_abort);
69
+ ptimer_stop(s->timer_reload);
243
+
70
+ ptimer_stop(s->timer_cmp);
244
+ object_property_set_link(cpuobj, OBJECT(secure_sysmem),
71
+ } else if (s->cr & CR_OCIEN) {
245
+ "secure-memory", &error_abort);
72
+ if (!(oldcr & CR_OCIEN)) {
246
+
73
+ imx_epit_reload_compare_timer(s);
247
+ object_property_set_bool(cpuobj, true, "realized", &error_fatal);
74
+ ptimer_run(s->timer_cmp, 0);
248
+ object_unref(cpuobj);
75
+ }
249
+ }
76
+ } else {
250
+
77
+ ptimer_stop(s->timer_cmp);
251
+ memory_region_allocate_system_memory(ram, NULL, "sbsa-ref.ram",
78
+ }
252
+ machine->ram_size);
79
+
253
+ memory_region_add_subregion(sysmem, sbsa_ref_memmap[SBSA_MEM].base, ram);
80
+ ptimer_transaction_commit(s->timer_cmp);
254
+
81
+ ptimer_transaction_commit(s->timer_reload);
255
+ sms->bootinfo.ram_size = machine->ram_size;
82
+}
256
+ sms->bootinfo.kernel_filename = machine->kernel_filename;
83
+
257
+ sms->bootinfo.nb_cpus = smp_cpus;
84
+static void imx_epit_write_sr(IMXEPITState *s, uint32_t value)
258
+ sms->bootinfo.board_id = -1;
85
+{
259
+ sms->bootinfo.loader_start = sbsa_ref_memmap[SBSA_MEM].base;
86
+ /* writing 1 to SR.OCIF clears this bit and turns the interrupt off */
260
+ arm_load_kernel(ARM_CPU(first_cpu), &sms->bootinfo);
87
+ if (value & SR_OCIF) {
261
+}
88
+ s->sr = 0; /* SR.OCIF is the only bit in this register anyway */
262
+
89
+ imx_epit_update_int(s);
263
+static uint64_t sbsa_ref_cpu_mp_affinity(SBSAMachineState *sms, int idx)
90
+ }
264
+{
91
+}
265
+ uint8_t clustersz = ARM_DEFAULT_CPUS_PER_CLUSTER;
92
+
266
+ return arm_cpu_mp_affinity(idx, clustersz);
93
+static void imx_epit_write_lr(IMXEPITState *s, uint32_t value)
267
+}
94
+{
268
+
95
+ s->lr = value;
269
+static const CPUArchIdList *sbsa_ref_possible_cpu_arch_ids(MachineState *ms)
96
+
270
+{
97
+ ptimer_transaction_begin(s->timer_cmp);
271
+ SBSAMachineState *sms = SBSA_MACHINE(ms);
98
+ ptimer_transaction_begin(s->timer_reload);
272
+ int n;
99
+ if (s->cr & CR_RLD) {
273
+
100
+ /* Also set the limit if the LRD bit is set */
274
+ if (ms->possible_cpus) {
101
+ /* If IOVW bit is set then set the timer value */
275
+ assert(ms->possible_cpus->len == max_cpus);
102
+ ptimer_set_limit(s->timer_reload, s->lr, s->cr & CR_IOVW);
276
+ return ms->possible_cpus;
103
+ ptimer_set_limit(s->timer_cmp, s->lr, 0);
277
+ }
104
+ } else if (s->cr & CR_IOVW) {
278
+
105
+ /* If IOVW bit is set then set the timer value */
279
+ ms->possible_cpus = g_malloc0(sizeof(CPUArchIdList) +
106
+ ptimer_set_count(s->timer_reload, s->lr);
280
+ sizeof(CPUArchId) * max_cpus);
107
+ }
281
+ ms->possible_cpus->len = max_cpus;
108
+ /*
282
+ for (n = 0; n < ms->possible_cpus->len; n++) {
109
+ * Commit the change to s->timer_reload, so it can propagate. Otherwise
283
+ ms->possible_cpus->cpus[n].type = ms->cpu_type;
110
+ * the timer interrupt may not fire properly. The commit must happen
284
+ ms->possible_cpus->cpus[n].arch_id =
111
+ * before calling imx_epit_reload_compare_timer(), which reads
285
+ sbsa_ref_cpu_mp_affinity(sms, n);
112
+ * s->timer_reload internally again.
286
+ ms->possible_cpus->cpus[n].props.has_thread_id = true;
113
+ */
287
+ ms->possible_cpus->cpus[n].props.thread_id = n;
114
+ ptimer_transaction_commit(s->timer_reload);
288
+ }
115
+ imx_epit_reload_compare_timer(s);
289
+ return ms->possible_cpus;
116
+ ptimer_transaction_commit(s->timer_cmp);
290
+}
117
+}
291
+
118
+
292
+static CpuInstanceProperties
119
+static void imx_epit_write_cmp(IMXEPITState *s, uint32_t value)
293
+sbsa_ref_cpu_index_to_props(MachineState *ms, unsigned cpu_index)
120
+{
294
+{
121
+ s->cmp = value;
295
+ MachineClass *mc = MACHINE_GET_CLASS(ms);
122
+
296
+ const CPUArchIdList *possible_cpus = mc->possible_cpu_arch_ids(ms);
123
+ ptimer_transaction_begin(s->timer_cmp);
297
+
124
+ imx_epit_reload_compare_timer(s);
298
+ assert(cpu_index < possible_cpus->len);
125
+ ptimer_transaction_commit(s->timer_cmp);
299
+ return possible_cpus->cpus[cpu_index].props;
126
+}
300
+}
127
+
301
+
128
static void imx_epit_write(void *opaque, hwaddr offset, uint64_t value,
302
+static int64_t
129
unsigned size)
303
+sbsa_ref_get_default_cpu_node_id(const MachineState *ms, int idx)
130
{
304
+{
131
IMXEPITState *s = IMX_EPIT(opaque);
305
+ return idx % nb_numa_nodes;
132
- uint64_t oldcr;
306
+}
133
307
+
134
DPRINTF("(%s, value = 0x%08x)\n", imx_epit_reg_name(offset >> 2),
308
+static void sbsa_ref_class_init(ObjectClass *oc, void *data)
135
(uint32_t)value);
309
+{
136
310
+ MachineClass *mc = MACHINE_CLASS(oc);
137
switch (offset >> 2) {
311
+
138
case 0: /* CR */
312
+ mc->init = sbsa_ref_init;
139
-
313
+ mc->desc = "QEMU 'SBSA Reference' ARM Virtual Machine";
140
- oldcr = s->cr;
314
+ mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a57");
141
- s->cr = value & 0x03ffffff;
315
+ mc->max_cpus = 512;
142
- if (s->cr & CR_SWR) {
316
+ mc->pci_allow_0_address = true;
143
- /* handle the reset */
317
+ mc->minimum_page_bits = 12;
144
- imx_epit_reset(s, false);
318
+ mc->block_default_type = IF_IDE;
145
- }
319
+ mc->no_cdrom = 1;
146
-
320
+ mc->default_ram_size = 1 * GiB;
147
- /*
321
+ mc->default_cpus = 4;
148
- * The interrupt state can change due to:
322
+ mc->possible_cpu_arch_ids = sbsa_ref_possible_cpu_arch_ids;
149
- * - reset clears both SR.OCIF and CR.OCIE
323
+ mc->cpu_index_to_instance_props = sbsa_ref_cpu_index_to_props;
150
- * - write to CR.EN or CR.OCIE
324
+ mc->get_default_cpu_node_id = sbsa_ref_get_default_cpu_node_id;
151
- */
325
+}
152
- imx_epit_update_int(s);
326
+
153
-
327
+static const TypeInfo sbsa_ref_info = {
154
- /*
328
+ .name = TYPE_SBSA_MACHINE,
155
- * TODO: could we 'break' here for reset? following operations appear
329
+ .parent = TYPE_MACHINE,
156
- * to duplicate the work imx_epit_reset() already did.
330
+ .class_init = sbsa_ref_class_init,
157
- */
331
+ .instance_size = sizeof(SBSAMachineState),
158
-
332
+};
159
- ptimer_transaction_begin(s->timer_cmp);
333
+
160
- ptimer_transaction_begin(s->timer_reload);
334
+static void sbsa_ref_machine_init(void)
161
-
335
+{
162
- /* Update the frequency. Has been done already in case of a reset. */
336
+ type_register_static(&sbsa_ref_info);
163
- if (!(s->cr & CR_SWR)) {
337
+}
164
- imx_epit_set_freq(s);
338
+
165
- }
339
+type_init(sbsa_ref_machine_init);
166
-
340
diff --git a/MAINTAINERS b/MAINTAINERS
167
- if (s->freq && (s->cr & CR_EN) && !(oldcr & CR_EN)) {
341
index XXXXXXX..XXXXXXX 100644
168
- if (s->cr & CR_ENMOD) {
342
--- a/MAINTAINERS
169
- if (s->cr & CR_RLD) {
343
+++ b/MAINTAINERS
170
- ptimer_set_limit(s->timer_reload, s->lr, 1);
344
@@ -XXX,XX +XXX,XX @@ F: include/hw/arm/fsl-imx6.h
171
- ptimer_set_limit(s->timer_cmp, s->lr, 1);
345
F: include/hw/misc/imx6_*.h
172
- } else {
346
F: include/hw/ssi/imx_spi.h
173
- ptimer_set_limit(s->timer_reload, EPIT_TIMER_MAX, 1);
347
174
- ptimer_set_limit(s->timer_cmp, EPIT_TIMER_MAX, 1);
348
+SBSA-REF
175
- }
349
+M: Radoslaw Biernacki <radoslaw.biernacki@linaro.org>
176
- }
350
+M: Peter Maydell <peter.maydell@linaro.org>
177
-
351
+R: Leif Lindholm <leif.lindholm@linaro.org>
178
- imx_epit_reload_compare_timer(s);
352
+L: qemu-arm@nongnu.org
179
- ptimer_run(s->timer_reload, 0);
353
+S: Maintained
180
- if (s->cr & CR_OCIEN) {
354
+F: hw/arm/sbsa-ref.c
181
- ptimer_run(s->timer_cmp, 0);
355
+
182
- } else {
356
Sharp SL-5500 (Collie) PDA
183
- ptimer_stop(s->timer_cmp);
357
M: Peter Maydell <peter.maydell@linaro.org>
184
- }
358
L: qemu-arm@nongnu.org
185
- } else if (!(s->cr & CR_EN)) {
359
diff --git a/default-configs/aarch64-softmmu.mak b/default-configs/aarch64-softmmu.mak
186
- /* stop both timers */
360
index XXXXXXX..XXXXXXX 100644
187
- ptimer_stop(s->timer_reload);
361
--- a/default-configs/aarch64-softmmu.mak
188
- ptimer_stop(s->timer_cmp);
362
+++ b/default-configs/aarch64-softmmu.mak
189
- } else if (s->cr & CR_OCIEN) {
363
@@ -XXX,XX +XXX,XX @@ include arm-softmmu.mak
190
- if (!(oldcr & CR_OCIEN)) {
364
191
- imx_epit_reload_compare_timer(s);
365
CONFIG_XLNX_ZYNQMP_ARM=y
192
- ptimer_run(s->timer_cmp, 0);
366
CONFIG_XLNX_VERSAL=y
193
- }
367
+CONFIG_SBSA_REF=y
194
- } else {
368
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
195
- ptimer_stop(s->timer_cmp);
369
index XXXXXXX..XXXXXXX 100644
196
- }
370
--- a/hw/arm/Kconfig
197
-
371
+++ b/hw/arm/Kconfig
198
- ptimer_transaction_commit(s->timer_cmp);
372
@@ -XXX,XX +XXX,XX @@ config REALVIEW
199
- ptimer_transaction_commit(s->timer_reload);
373
select DS1338 # I2C RTC+NVRAM
200
+ imx_epit_write_cr(s, (uint32_t)value);
374
select USB_OHCI
201
break;
375
202
376
+config SBSA_REF
203
- case 1: /* SR - ACK*/
377
+ bool
204
- /* writing 1 to SR.OCIF clears this bit and turns the interrupt off */
378
+ imply PCI_DEVICES
205
- if (value & SR_OCIF) {
379
+ select AHCI
206
- s->sr = 0; /* SR.OCIF is the only bit in this register anyway */
380
+ select ARM_SMMUV3
207
- imx_epit_update_int(s);
381
+ select GPIO_KEY
208
- }
382
+ select PCI_EXPRESS
209
+ case 1: /* SR */
383
+ select PCI_EXPRESS_GENERIC_BRIDGE
210
+ imx_epit_write_sr(s, (uint32_t)value);
384
+ select PFLASH_CFI01
211
break;
385
+ select PL011 # UART
212
386
+ select PL031 # RTC
213
- case 2: /* LR - set ticks */
387
+ select PL061 # GPIO
214
- s->lr = value;
388
+ select USB_EHCI_SYSBUS
215
-
389
+
216
- ptimer_transaction_begin(s->timer_cmp);
390
config SABRELITE
217
- ptimer_transaction_begin(s->timer_reload);
391
bool
218
- if (s->cr & CR_RLD) {
392
select FSL_IMX6
219
- /* Also set the limit if the LRD bit is set */
220
- /* If IOVW bit is set then set the timer value */
221
- ptimer_set_limit(s->timer_reload, s->lr, s->cr & CR_IOVW);
222
- ptimer_set_limit(s->timer_cmp, s->lr, 0);
223
- } else if (s->cr & CR_IOVW) {
224
- /* If IOVW bit is set then set the timer value */
225
- ptimer_set_count(s->timer_reload, s->lr);
226
- }
227
- /*
228
- * Commit the change to s->timer_reload, so it can propagate. Otherwise
229
- * the timer interrupt may not fire properly. The commit must happen
230
- * before calling imx_epit_reload_compare_timer(), which reads
231
- * s->timer_reload internally again.
232
- */
233
- ptimer_transaction_commit(s->timer_reload);
234
- imx_epit_reload_compare_timer(s);
235
- ptimer_transaction_commit(s->timer_cmp);
236
+ case 2: /* LR */
237
+ imx_epit_write_lr(s, (uint32_t)value);
238
break;
239
240
case 3: /* CMP */
241
- s->cmp = value;
242
-
243
- ptimer_transaction_begin(s->timer_cmp);
244
- imx_epit_reload_compare_timer(s);
245
- ptimer_transaction_commit(s->timer_cmp);
246
-
247
+ imx_epit_write_cmp(s, (uint32_t)value);
248
break;
249
250
default:
251
qemu_log_mask(LOG_GUEST_ERROR, "[%s]%s: Bad register at offset 0x%"
252
HWADDR_PRIx "\n", TYPE_IMX_EPIT, __func__, offset);
253
-
254
break;
255
}
256
}
257
+
258
static void imx_epit_cmp(void *opaque)
259
{
260
IMXEPITState *s = IMX_EPIT(opaque);
393
--
261
--
394
2.20.1
262
2.25.1
395
396
diff view generated by jsdifflib
1
From: Andrey Smirnov <andrew.smirnov@gmail.com>
1
From: Axel Heider <axel.heider@hensoldt.net>
2
2
3
MSI mapping needs to be update when MSI address changes, so add the
3
The CNT register is a read-only register. There is no need to
4
code to do so.
4
store it's value, it can be calculated on demand.
5
The calculated frequency is needed temporarily only.
5
6
6
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
7
Note that this is a migration compatibility break for all boards
7
Cc: Peter Maydell <peter.maydell@linaro.org>
8
types that use the EPIT peripheral.
8
Cc: Michael S. Tsirkin <mst@redhat.com>
9
9
Cc: qemu-devel@nongnu.org
10
Signed-off-by: Axel Heider <axel.heider@hensoldt.net>
10
Cc: qemu-arm@nongnu.org
11
Acked-by: Michael S. Tsirkin <mst@redhat.com>
12
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
---
13
---
15
hw/pci-host/designware.c | 2 ++
14
include/hw/timer/imx_epit.h | 2 -
16
1 file changed, 2 insertions(+)
15
hw/timer/imx_epit.c | 73 ++++++++++++++-----------------------
16
2 files changed, 28 insertions(+), 47 deletions(-)
17
17
18
diff --git a/hw/pci-host/designware.c b/hw/pci-host/designware.c
18
diff --git a/include/hw/timer/imx_epit.h b/include/hw/timer/imx_epit.h
19
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
20
--- a/hw/pci-host/designware.c
20
--- a/include/hw/timer/imx_epit.h
21
+++ b/hw/pci-host/designware.c
21
+++ b/include/hw/timer/imx_epit.h
22
@@ -XXX,XX +XXX,XX @@ static void designware_pcie_root_config_write(PCIDevice *d, uint32_t address,
22
@@ -XXX,XX +XXX,XX @@ struct IMXEPITState {
23
case DESIGNWARE_PCIE_MSI_ADDR_LO:
23
uint32_t sr;
24
root->msi.base &= 0xFFFFFFFF00000000ULL;
24
uint32_t lr;
25
root->msi.base |= val;
25
uint32_t cmp;
26
+ designware_pcie_root_update_msi_mapping(root);
26
- uint32_t cnt;
27
28
- uint32_t freq;
29
qemu_irq irq;
30
};
31
32
diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c
33
index XXXXXXX..XXXXXXX 100644
34
--- a/hw/timer/imx_epit.c
35
+++ b/hw/timer/imx_epit.c
36
@@ -XXX,XX +XXX,XX @@ static void imx_epit_update_int(IMXEPITState *s)
37
}
38
}
39
40
-/*
41
- * Must be called from within a ptimer_transaction_begin/commit block
42
- * for both s->timer_cmp and s->timer_reload.
43
- */
44
-static void imx_epit_set_freq(IMXEPITState *s)
45
+static uint32_t imx_epit_get_freq(IMXEPITState *s)
46
{
47
- uint32_t clksrc;
48
- uint32_t prescaler;
49
-
50
- clksrc = extract32(s->cr, CR_CLKSRC_SHIFT, CR_CLKSRC_BITS);
51
- prescaler = 1 + extract32(s->cr, CR_PRESCALE_SHIFT, CR_PRESCALE_BITS);
52
-
53
- s->freq = imx_ccm_get_clock_frequency(s->ccm,
54
- imx_epit_clocks[clksrc]) / prescaler;
55
-
56
- DPRINTF("Setting ptimer frequency to %u\n", s->freq);
57
-
58
- if (s->freq) {
59
- ptimer_set_freq(s->timer_reload, s->freq);
60
- ptimer_set_freq(s->timer_cmp, s->freq);
61
- }
62
+ uint32_t clksrc = extract32(s->cr, CR_CLKSRC_SHIFT, CR_CLKSRC_BITS);
63
+ uint32_t prescaler = 1 + extract32(s->cr, CR_PRESCALE_SHIFT, CR_PRESCALE_BITS);
64
+ uint32_t f_in = imx_ccm_get_clock_frequency(s->ccm, imx_epit_clocks[clksrc]);
65
+ uint32_t freq = f_in / prescaler;
66
+ DPRINTF("ptimer frequency is %u\n", freq);
67
+ return freq;
68
}
69
70
/*
71
@@ -XXX,XX +XXX,XX @@ static void imx_epit_reset(IMXEPITState *s, bool is_hard_reset)
72
s->sr = 0;
73
s->lr = EPIT_TIMER_MAX;
74
s->cmp = 0;
75
- s->cnt = 0;
76
ptimer_transaction_begin(s->timer_cmp);
77
ptimer_transaction_begin(s->timer_reload);
78
- /* stop both timers */
79
+
80
+ /*
81
+ * The reset switches off the input clock, so even if the CR.EN is still
82
+ * set, the timers are no longer running.
83
+ */
84
+ assert(imx_epit_get_freq(s) == 0);
85
ptimer_stop(s->timer_cmp);
86
ptimer_stop(s->timer_reload);
87
- /* compute new frequency */
88
- imx_epit_set_freq(s);
89
/* init both timers to EPIT_TIMER_MAX */
90
ptimer_set_limit(s->timer_cmp, EPIT_TIMER_MAX, 1);
91
ptimer_set_limit(s->timer_reload, EPIT_TIMER_MAX, 1);
92
- if (s->freq && (s->cr & CR_EN)) {
93
- /* if the timer is still enabled, restart it */
94
- ptimer_run(s->timer_reload, 0);
95
- }
96
ptimer_transaction_commit(s->timer_cmp);
97
ptimer_transaction_commit(s->timer_reload);
98
}
99
100
-static uint32_t imx_epit_update_count(IMXEPITState *s)
101
-{
102
- s->cnt = ptimer_get_count(s->timer_reload);
103
-
104
- return s->cnt;
105
-}
106
-
107
static uint64_t imx_epit_read(void *opaque, hwaddr offset, unsigned size)
108
{
109
IMXEPITState *s = IMX_EPIT(opaque);
110
@@ -XXX,XX +XXX,XX @@ static uint64_t imx_epit_read(void *opaque, hwaddr offset, unsigned size)
27
break;
111
break;
28
112
29
case DESIGNWARE_PCIE_MSI_ADDR_HI:
113
case 4: /* CNT */
30
root->msi.base &= 0x00000000FFFFFFFFULL;
114
- imx_epit_update_count(s);
31
root->msi.base |= (uint64_t)val << 32;
115
- reg_value = s->cnt;
32
+ designware_pcie_root_update_msi_mapping(root);
116
+ reg_value = ptimer_get_count(s->timer_reload);
33
break;
117
break;
34
118
35
case DESIGNWARE_PCIE_MSI_INTR0_ENABLE:
119
default:
120
@@ -XXX,XX +XXX,XX @@ static void imx_epit_reload_compare_timer(IMXEPITState *s)
121
{
122
if ((s->cr & (CR_EN | CR_OCIEN)) == (CR_EN | CR_OCIEN)) {
123
/* if the compare feature is on and timers are running */
124
- uint32_t tmp = imx_epit_update_count(s);
125
+ uint32_t tmp = ptimer_get_count(s->timer_reload);
126
uint64_t next;
127
if (tmp > s->cmp) {
128
/* It'll fire in this round of the timer */
129
@@ -XXX,XX +XXX,XX @@ static void imx_epit_reload_compare_timer(IMXEPITState *s)
130
131
static void imx_epit_write_cr(IMXEPITState *s, uint32_t value)
132
{
133
+ uint32_t freq = 0;
134
uint32_t oldcr = s->cr;
135
136
s->cr = value & 0x03ffffff;
137
@@ -XXX,XX +XXX,XX @@ static void imx_epit_write_cr(IMXEPITState *s, uint32_t value)
138
ptimer_transaction_begin(s->timer_cmp);
139
ptimer_transaction_begin(s->timer_reload);
140
141
- /* Update the frequency. Has been done already in case of a reset. */
142
+ /*
143
+ * Update the frequency. In case of a reset the input clock was
144
+ * switched off, so this can be skipped.
145
+ */
146
if (!(s->cr & CR_SWR)) {
147
- imx_epit_set_freq(s);
148
+ freq = imx_epit_get_freq(s);
149
+ if (freq) {
150
+ ptimer_set_freq(s->timer_reload, freq);
151
+ ptimer_set_freq(s->timer_cmp, freq);
152
+ }
153
}
154
155
- if (s->freq && (s->cr & CR_EN) && !(oldcr & CR_EN)) {
156
+ if (freq && (s->cr & CR_EN) && !(oldcr & CR_EN)) {
157
if (s->cr & CR_ENMOD) {
158
if (s->cr & CR_RLD) {
159
ptimer_set_limit(s->timer_reload, s->lr, 1);
160
@@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps imx_epit_ops = {
161
162
static const VMStateDescription vmstate_imx_timer_epit = {
163
.name = TYPE_IMX_EPIT,
164
- .version_id = 2,
165
- .minimum_version_id = 2,
166
+ .version_id = 3,
167
+ .minimum_version_id = 3,
168
.fields = (VMStateField[]) {
169
VMSTATE_UINT32(cr, IMXEPITState),
170
VMSTATE_UINT32(sr, IMXEPITState),
171
VMSTATE_UINT32(lr, IMXEPITState),
172
VMSTATE_UINT32(cmp, IMXEPITState),
173
- VMSTATE_UINT32(cnt, IMXEPITState),
174
- VMSTATE_UINT32(freq, IMXEPITState),
175
VMSTATE_PTIMER(timer_reload, IMXEPITState),
176
VMSTATE_PTIMER(timer_cmp, IMXEPITState),
177
VMSTATE_END_OF_LIST()
36
--
178
--
37
2.20.1
179
2.25.1
38
39
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
From: Axel Heider <axel.heider@hensoldt.net>
2
2
3
The vfp_set_fpscr() helper contains code specific to the host
3
- fix #1263 for CR writes
4
floating point implementation (here the SoftFloat library).
4
- rework compare time handling
5
Extract this code to vfp_set_fpscr_to_host().
5
- The compare timer has to run even if CR.OCIEN is not set,
6
as SR.OCIF must be updated.
7
- The compare timer fires exactly once when the
8
compare value is less than the current value, but the
9
reload values is less than the compare value.
10
- The compare timer will never fire if the reload value is
11
less than the compare value. Disable it in this case.
6
12
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
13
Signed-off-by: Axel Heider <axel.heider@hensoldt.net>
8
Message-id: 20190701132516.26392-16-philmd@redhat.com
14
[PMM: fixed minor style nits]
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
15
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
17
---
12
target/arm/vfp_helper.c | 127 +++++++++++++++++++++-------------------
18
hw/timer/imx_epit.c | 192 ++++++++++++++++++++++++++------------------
13
1 file changed, 66 insertions(+), 61 deletions(-)
19
1 file changed, 116 insertions(+), 76 deletions(-)
14
20
15
diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c
21
diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c
16
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/vfp_helper.c
23
--- a/hw/timer/imx_epit.c
18
+++ b/target/arm/vfp_helper.c
24
+++ b/hw/timer/imx_epit.c
19
@@ -XXX,XX +XXX,XX @@ static inline int vfp_exceptbits_to_host(int target_bits)
25
@@ -XXX,XX +XXX,XX @@
20
return host_bits;
26
* Originally written by Hans Jiang
21
}
27
* Updated by Peter Chubb
22
28
* Updated by Jean-Christophe Dubois <jcd@tribudubois.net>
23
-uint32_t HELPER(vfp_get_fpscr)(CPUARMState *env)
29
+ * Updated by Axel Heider
24
-{
30
*
25
- uint32_t i, fpscr;
31
* This code is licensed under GPL version 2 or later. See
26
-
32
* the COPYING file in the top-level directory.
27
- fpscr = env->vfp.xregs[ARM_VFP_FPSCR]
33
@@ -XXX,XX +XXX,XX @@ static uint64_t imx_epit_read(void *opaque, hwaddr offset, unsigned size)
28
- | (env->vfp.vec_len << 16)
34
return reg_value;
29
- | (env->vfp.vec_stride << 20);
35
}
30
-
36
31
- i = get_float_exception_flags(&env->vfp.fp_status);
37
-/* Must be called from ptimer_transaction_begin/commit block for s->timer_cmp */
32
- i |= get_float_exception_flags(&env->vfp.standard_fp_status);
38
-static void imx_epit_reload_compare_timer(IMXEPITState *s)
33
- /* FZ16 does not generate an input denormal exception. */
39
+/*
34
- i |= (get_float_exception_flags(&env->vfp.fp_status_f16)
40
+ * Must be called from a ptimer_transaction_begin/commit block for
35
- & ~float_flag_input_denormal);
41
+ * s->timer_cmp, but outside of a transaction block of s->timer_reload,
36
- fpscr |= vfp_exceptbits_from_host(i);
42
+ * so the proper counter value is read.
37
-
43
+ */
38
- i = env->vfp.qc[0] | env->vfp.qc[1] | env->vfp.qc[2] | env->vfp.qc[3];
44
+static void imx_epit_update_compare_timer(IMXEPITState *s)
39
- fpscr |= i ? FPCR_QC : 0;
45
{
40
-
46
- if ((s->cr & (CR_EN | CR_OCIEN)) == (CR_EN | CR_OCIEN)) {
41
- return fpscr;
47
- /* if the compare feature is on and timers are running */
42
-}
48
- uint32_t tmp = ptimer_get_count(s->timer_reload);
43
-
49
- uint64_t next;
44
-uint32_t vfp_get_fpscr(CPUARMState *env)
50
- if (tmp > s->cmp) {
45
-{
51
- /* It'll fire in this round of the timer */
46
- return HELPER(vfp_get_fpscr)(env);
52
- next = tmp - s->cmp;
47
-}
53
- } else { /* catch it next time around */
48
-
54
- next = tmp - s->cmp + ((s->cr & CR_RLD) ? EPIT_TIMER_MAX : s->lr);
49
-void HELPER(vfp_set_fpscr)(CPUARMState *env, uint32_t val)
55
+ uint64_t counter = 0;
50
+static void vfp_set_fpscr_to_host(CPUARMState *env, uint32_t val)
56
+ bool is_oneshot = false;
51
{
57
+ /*
52
int i;
58
+ * The compare timer only has to run if the timer peripheral is active
53
uint32_t changed = env->vfp.xregs[ARM_VFP_FPSCR];
59
+ * and there is an input clock, Otherwise it can be switched off.
54
60
+ */
55
- /* When ARMv8.2-FP16 is not supported, FZ16 is RES0. */
61
+ bool is_active = (s->cr & CR_EN) && imx_epit_get_freq(s);
56
- if (!cpu_isar_feature(aa64_fp16, env_archcpu(env))) {
62
+ if (is_active) {
57
- val &= ~FPCR_FZ16;
63
+ /*
64
+ * Calculate next timeout for compare timer. Reading the reload
65
+ * counter returns proper results only if pending transactions
66
+ * on it are committed here. Otherwise stale values are be read.
67
+ */
68
+ counter = ptimer_get_count(s->timer_reload);
69
+ uint64_t limit = ptimer_get_limit(s->timer_cmp);
70
+ /*
71
+ * The compare timer is a periodic timer if the limit is at least
72
+ * the compare value. Otherwise it may fire at most once in the
73
+ * current round.
74
+ */
75
+ bool is_oneshot = (limit >= s->cmp);
76
+ if (counter >= s->cmp) {
77
+ /* The compare timer fires in the current round. */
78
+ counter -= s->cmp;
79
+ } else if (!is_oneshot) {
80
+ /*
81
+ * The compare timer fires after a reload, as it is below the
82
+ * compare value already in this round. Note that the counter
83
+ * value calculated below can be above the 32-bit limit, which
84
+ * is legal here because the compare timer is an internal
85
+ * helper ptimer only.
86
+ */
87
+ counter += limit - s->cmp;
88
+ } else {
89
+ /*
90
+ * The compare timer won't fire in this round, and the limit is
91
+ * set to a value below the compare value. This practically means
92
+ * it will never fire, so it can be switched off.
93
+ */
94
+ is_active = false;
95
}
96
- ptimer_set_count(s->timer_cmp, next);
97
}
98
+
99
+ /*
100
+ * Set the compare timer and let it run, or stop it. This is agnostic
101
+ * of CR.OCIEN bit, as this bit affects interrupt generation only. The
102
+ * compare timer needs to run even if no interrupts are to be generated,
103
+ * because the SR.OCIF bit must be updated also.
104
+ * Note that the timer might already be stopped or be running with
105
+ * counter values. However, finding out when an update is needed and
106
+ * when not is not trivial. It's much easier applying the setting again,
107
+ * as this does not harm either and the overhead is negligible.
108
+ */
109
+ if (is_active) {
110
+ ptimer_set_count(s->timer_cmp, counter);
111
+ ptimer_run(s->timer_cmp, is_oneshot ? 1 : 0);
112
+ } else {
113
+ ptimer_stop(s->timer_cmp);
114
+ }
115
+
116
}
117
118
static void imx_epit_write_cr(IMXEPITState *s, uint32_t value)
119
{
120
- uint32_t freq = 0;
121
uint32_t oldcr = s->cr;
122
123
s->cr = value & 0x03ffffff;
124
125
if (s->cr & CR_SWR) {
126
- /* handle the reset */
127
+ /*
128
+ * Reset clears CR.SWR again. It does not touch CR.EN, but the timers
129
+ * are still stopped because the input clock is disabled.
130
+ */
131
imx_epit_reset(s, false);
132
+ } else {
133
+ uint32_t freq;
134
+ uint32_t toggled_cr_bits = oldcr ^ s->cr;
135
+ /* re-initialize the limits if CR.RLD has changed */
136
+ bool set_limit = toggled_cr_bits & CR_RLD;
137
+ /* set the counter if the timer got just enabled and CR.ENMOD is set */
138
+ bool is_switched_on = (toggled_cr_bits & s->cr) & CR_EN;
139
+ bool set_counter = is_switched_on && (s->cr & CR_ENMOD);
140
+
141
+ ptimer_transaction_begin(s->timer_cmp);
142
+ ptimer_transaction_begin(s->timer_reload);
143
+ freq = imx_epit_get_freq(s);
144
+ if (freq) {
145
+ ptimer_set_freq(s->timer_reload, freq);
146
+ ptimer_set_freq(s->timer_cmp, freq);
147
+ }
148
+
149
+ if (set_limit || set_counter) {
150
+ uint64_t limit = (s->cr & CR_RLD) ? s->lr : EPIT_TIMER_MAX;
151
+ ptimer_set_limit(s->timer_reload, limit, set_counter ? 1 : 0);
152
+ if (set_limit) {
153
+ ptimer_set_limit(s->timer_cmp, limit, 0);
154
+ }
155
+ }
156
+ /*
157
+ * If there is an input clock and the peripheral is enabled, then
158
+ * ensure the wall clock timer is ticking. Otherwise stop the timers.
159
+ * The compare timer will be updated later.
160
+ */
161
+ if (freq && (s->cr & CR_EN)) {
162
+ ptimer_run(s->timer_reload, 0);
163
+ } else {
164
+ ptimer_stop(s->timer_reload);
165
+ }
166
+ /* Commit changes to reload timer, so they can propagate. */
167
+ ptimer_transaction_commit(s->timer_reload);
168
+ /* Update compare timer based on the committed reload timer value. */
169
+ imx_epit_update_compare_timer(s);
170
+ ptimer_transaction_commit(s->timer_cmp);
171
}
172
173
/*
174
@@ -XXX,XX +XXX,XX @@ static void imx_epit_write_cr(IMXEPITState *s, uint32_t value)
175
* - write to CR.EN or CR.OCIE
176
*/
177
imx_epit_update_int(s);
178
-
179
- /*
180
- * TODO: could we 'break' here for reset? following operations appear
181
- * to duplicate the work imx_epit_reset() already did.
182
- */
183
-
184
- ptimer_transaction_begin(s->timer_cmp);
185
- ptimer_transaction_begin(s->timer_reload);
186
-
187
- /*
188
- * Update the frequency. In case of a reset the input clock was
189
- * switched off, so this can be skipped.
190
- */
191
- if (!(s->cr & CR_SWR)) {
192
- freq = imx_epit_get_freq(s);
193
- if (freq) {
194
- ptimer_set_freq(s->timer_reload, freq);
195
- ptimer_set_freq(s->timer_cmp, freq);
196
- }
58
- }
197
- }
59
-
198
-
60
- if (arm_feature(env, ARM_FEATURE_M)) {
199
- if (freq && (s->cr & CR_EN) && !(oldcr & CR_EN)) {
61
- /*
200
- if (s->cr & CR_ENMOD) {
62
- * M profile FPSCR is RES0 for the QC, STRIDE, FZ16, LEN bits
201
- if (s->cr & CR_RLD) {
63
- * and also for the trapped-exception-handling bits IxE.
202
- ptimer_set_limit(s->timer_reload, s->lr, 1);
64
- */
203
- ptimer_set_limit(s->timer_cmp, s->lr, 1);
65
- val &= 0xf7c0009f;
204
- } else {
205
- ptimer_set_limit(s->timer_reload, EPIT_TIMER_MAX, 1);
206
- ptimer_set_limit(s->timer_cmp, EPIT_TIMER_MAX, 1);
207
- }
208
- }
209
-
210
- imx_epit_reload_compare_timer(s);
211
- ptimer_run(s->timer_reload, 0);
212
- if (s->cr & CR_OCIEN) {
213
- ptimer_run(s->timer_cmp, 0);
214
- } else {
215
- ptimer_stop(s->timer_cmp);
216
- }
217
- } else if (!(s->cr & CR_EN)) {
218
- /* stop both timers */
219
- ptimer_stop(s->timer_reload);
220
- ptimer_stop(s->timer_cmp);
221
- } else if (s->cr & CR_OCIEN) {
222
- if (!(oldcr & CR_OCIEN)) {
223
- imx_epit_reload_compare_timer(s);
224
- ptimer_run(s->timer_cmp, 0);
225
- }
226
- } else {
227
- ptimer_stop(s->timer_cmp);
66
- }
228
- }
67
-
229
-
230
- ptimer_transaction_commit(s->timer_cmp);
231
- ptimer_transaction_commit(s->timer_reload);
232
}
233
234
static void imx_epit_write_sr(IMXEPITState *s, uint32_t value)
235
@@ -XXX,XX +XXX,XX @@ static void imx_epit_write_lr(IMXEPITState *s, uint32_t value)
236
/* If IOVW bit is set then set the timer value */
237
ptimer_set_count(s->timer_reload, s->lr);
238
}
68
- /*
239
- /*
69
- * We don't implement trapped exception handling, so the
240
- * Commit the change to s->timer_reload, so it can propagate. Otherwise
70
- * trap enable bits, IDE|IXE|UFE|OFE|DZE|IOE are all RAZ/WI (not RES0!)
241
- * the timer interrupt may not fire properly. The commit must happen
71
- *
242
- * before calling imx_epit_reload_compare_timer(), which reads
72
- * If we exclude the exception flags, IOC|DZC|OFC|UFC|IXC|IDC
243
- * s->timer_reload internally again.
73
- * (which are stored in fp_status), and the other RES0 bits
74
- * in between, then we clear all of the low 16 bits.
75
- */
244
- */
76
- env->vfp.xregs[ARM_VFP_FPSCR] = val & 0xf7c80000;
245
+ /* Commit the changes to s->timer_reload, so they can propagate. */
77
- env->vfp.vec_len = (val >> 16) & 7;
246
ptimer_transaction_commit(s->timer_reload);
78
- env->vfp.vec_stride = (val >> 20) & 3;
247
- imx_epit_reload_compare_timer(s);
79
-
248
+ /* Update the compare timer based on the committed reload timer value. */
80
- /*
249
+ imx_epit_update_compare_timer(s);
81
- * The bit we set within fpscr_q is arbitrary; the register as a
250
ptimer_transaction_commit(s->timer_cmp);
82
- * whole being zero/non-zero is what counts.
251
}
83
- */
252
84
- env->vfp.qc[0] = val & FPCR_QC;
253
@@ -XXX,XX +XXX,XX @@ static void imx_epit_write_cmp(IMXEPITState *s, uint32_t value)
85
- env->vfp.qc[1] = 0;
254
{
86
- env->vfp.qc[2] = 0;
255
s->cmp = value;
87
- env->vfp.qc[3] = 0;
256
88
-
257
+ /* Update the compare timer based on the committed reload timer value. */
89
changed ^= val;
258
ptimer_transaction_begin(s->timer_cmp);
90
if (changed & (3 << 22)) {
259
- imx_epit_reload_compare_timer(s);
91
i = (val >> 22) & 3;
260
+ imx_epit_update_compare_timer(s);
92
@@ -XXX,XX +XXX,XX @@ void HELPER(vfp_set_fpscr)(CPUARMState *env, uint32_t val)
261
ptimer_transaction_commit(s->timer_cmp);
93
set_float_exception_flags(0, &env->vfp.standard_fp_status);
262
}
94
}
263
95
264
@@ -XXX,XX +XXX,XX @@ static void imx_epit_cmp(void *opaque)
96
+uint32_t HELPER(vfp_get_fpscr)(CPUARMState *env)
265
{
97
+{
266
IMXEPITState *s = IMX_EPIT(opaque);
98
+ uint32_t i, fpscr;
267
99
+
268
+ /* The cmp ptimer can't be running when the peripheral is disabled */
100
+ fpscr = env->vfp.xregs[ARM_VFP_FPSCR]
269
+ assert(s->cr & CR_EN);
101
+ | (env->vfp.vec_len << 16)
270
+
102
+ | (env->vfp.vec_stride << 20);
271
DPRINTF("sr was %d\n", s->sr);
103
+
272
/* Set interrupt status bit SR.OCIF and update the interrupt state */
104
+ i = get_float_exception_flags(&env->vfp.fp_status);
273
s->sr |= SR_OCIF;
105
+ i |= get_float_exception_flags(&env->vfp.standard_fp_status);
106
+ /* FZ16 does not generate an input denormal exception. */
107
+ i |= (get_float_exception_flags(&env->vfp.fp_status_f16)
108
+ & ~float_flag_input_denormal);
109
+ fpscr |= vfp_exceptbits_from_host(i);
110
+
111
+ i = env->vfp.qc[0] | env->vfp.qc[1] | env->vfp.qc[2] | env->vfp.qc[3];
112
+ fpscr |= i ? FPCR_QC : 0;
113
+
114
+ return fpscr;
115
+}
116
+
117
+uint32_t vfp_get_fpscr(CPUARMState *env)
118
+{
119
+ return HELPER(vfp_get_fpscr)(env);
120
+}
121
+
122
+void HELPER(vfp_set_fpscr)(CPUARMState *env, uint32_t val)
123
+{
124
+ /* When ARMv8.2-FP16 is not supported, FZ16 is RES0. */
125
+ if (!cpu_isar_feature(aa64_fp16, env_archcpu(env))) {
126
+ val &= ~FPCR_FZ16;
127
+ }
128
+
129
+ if (arm_feature(env, ARM_FEATURE_M)) {
130
+ /*
131
+ * M profile FPSCR is RES0 for the QC, STRIDE, FZ16, LEN bits
132
+ * and also for the trapped-exception-handling bits IxE.
133
+ */
134
+ val &= 0xf7c0009f;
135
+ }
136
+
137
+ /*
138
+ * We don't implement trapped exception handling, so the
139
+ * trap enable bits, IDE|IXE|UFE|OFE|DZE|IOE are all RAZ/WI (not RES0!)
140
+ *
141
+ * If we exclude the exception flags, IOC|DZC|OFC|UFC|IXC|IDC
142
+ * (which are stored in fp_status), and the other RES0 bits
143
+ * in between, then we clear all of the low 16 bits.
144
+ */
145
+ env->vfp.xregs[ARM_VFP_FPSCR] = val & 0xf7c80000;
146
+ env->vfp.vec_len = (val >> 16) & 7;
147
+ env->vfp.vec_stride = (val >> 20) & 3;
148
+
149
+ /*
150
+ * The bit we set within fpscr_q is arbitrary; the register as a
151
+ * whole being zero/non-zero is what counts.
152
+ */
153
+ env->vfp.qc[0] = val & FPCR_QC;
154
+ env->vfp.qc[1] = 0;
155
+ env->vfp.qc[2] = 0;
156
+ env->vfp.qc[3] = 0;
157
+
158
+ vfp_set_fpscr_to_host(env, val);
159
+}
160
+
161
void vfp_set_fpscr(CPUARMState *env, uint32_t val)
162
{
163
HELPER(vfp_set_fpscr)(env, val);
164
--
274
--
165
2.20.1
275
2.25.1
166
167
diff view generated by jsdifflib
1
From: Cédric Le Goater <clg@kaod.org>
1
From: Fabiano Rosas <farosas@suse.de>
2
2
3
This will simplify the definition of new SoCs, like the AST2600 which
3
Fix these:
4
should use a slightly different address space and have a different set
5
of controllers.
6
4
7
Signed-off-by: Cédric Le Goater <clg@kaod.org>
5
WARNING: Block comments use a leading /* on a separate line
8
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
6
WARNING: Block comments use * on subsequent lines
9
Reviewed-by: Joel Stanley <joel@jms.id.au>
7
WARNING: Block comments use a trailing */ on a separate line
10
Message-id: 20190618165311.27066-3-clg@kaod.org
8
9
Signed-off-by: Fabiano Rosas <farosas@suse.de>
10
Reviewed-by: Claudio Fontana <cfontana@suse.de>
11
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
12
Message-id: 20221213190537.511-2-farosas@suse.de
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
14
---
13
include/hw/arm/aspeed_soc.h | 4 +-
15
target/arm/helper.c | 323 +++++++++++++++++++++++++++++---------------
14
hw/arm/aspeed.c | 8 +--
16
1 file changed, 215 insertions(+), 108 deletions(-)
15
hw/arm/aspeed_soc.c | 117 ++++++++++++++++++++++--------------
16
3 files changed, 78 insertions(+), 51 deletions(-)
17
17
18
diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h
18
diff --git a/target/arm/helper.c b/target/arm/helper.c
19
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
20
--- a/include/hw/arm/aspeed_soc.h
20
--- a/target/arm/helper.c
21
+++ b/include/hw/arm/aspeed_soc.h
21
+++ b/target/arm/helper.c
22
@@ -XXX,XX +XXX,XX @@ typedef struct AspeedSoCInfo {
22
@@ -XXX,XX +XXX,XX @@ uint64_t read_raw_cp_reg(CPUARMState *env, const ARMCPRegInfo *ri)
23
const char *name;
23
static void write_raw_cp_reg(CPUARMState *env, const ARMCPRegInfo *ri,
24
const char *cpu_type;
24
uint64_t v)
25
uint32_t silicon_rev;
25
{
26
- hwaddr sdram_base;
26
- /* Raw write of a coprocessor register (as needed for migration, etc).
27
uint64_t sram_size;
27
+ /*
28
int spis_num;
28
+ * Raw write of a coprocessor register (as needed for migration, etc).
29
- const hwaddr *spi_bases;
29
* Note that constant registers are treated as write-ignored; the
30
const char *fmc_typename;
30
* caller should check for success by whether a readback gives the
31
const char **spi_typename;
31
* value written.
32
int wdts_num;
32
@@ -XXX,XX +XXX,XX @@ static void write_raw_cp_reg(CPUARMState *env, const ARMCPRegInfo *ri,
33
const int *irqmap;
33
34
+ const hwaddr *memmap;
34
static bool raw_accessors_invalid(const ARMCPRegInfo *ri)
35
} AspeedSoCInfo;
35
{
36
36
- /* Return true if the regdef would cause an assertion if you called
37
typedef struct AspeedSoCClass {
37
+ /*
38
@@ -XXX,XX +XXX,XX @@ enum {
38
+ * Return true if the regdef would cause an assertion if you called
39
ASPEED_I2C,
39
* read_raw_cp_reg() or write_raw_cp_reg() on it (ie if it is a
40
ASPEED_ETH1,
40
* program bug for it not to have the NO_RAW flag).
41
ASPEED_ETH2,
41
* NB that returning false here doesn't necessarily mean that calling
42
+ ASPEED_SDRAM,
42
@@ -XXX,XX +XXX,XX @@ bool write_list_to_cpustate(ARMCPU *cpu)
43
if (ri->type & ARM_CP_NO_RAW) {
44
continue;
45
}
46
- /* Write value and confirm it reads back as written
47
+ /*
48
+ * Write value and confirm it reads back as written
49
* (to catch read-only registers and partially read-only
50
* registers where the incoming migration value doesn't match)
51
*/
52
@@ -XXX,XX +XXX,XX @@ static gint cpreg_key_compare(gconstpointer a, gconstpointer b)
53
54
void init_cpreg_list(ARMCPU *cpu)
55
{
56
- /* Initialise the cpreg_tuples[] array based on the cp_regs hash.
57
+ /*
58
+ * Initialise the cpreg_tuples[] array based on the cp_regs hash.
59
* Note that we require cpreg_tuples[] to be sorted by key ID.
60
*/
61
GList *keys;
62
@@ -XXX,XX +XXX,XX @@ static CPAccessResult access_el3_aa32ns(CPUARMState *env,
63
return CP_ACCESS_OK;
64
}
65
66
-/* Some secure-only AArch32 registers trap to EL3 if used from
67
+/*
68
+ * Some secure-only AArch32 registers trap to EL3 if used from
69
* Secure EL1 (but are just ordinary UNDEF in other non-EL3 contexts).
70
* Note that an access from Secure EL1 can only happen if EL3 is AArch64.
71
* We assume that the .access field is set to PL1_RW.
72
@@ -XXX,XX +XXX,XX @@ static CPAccessResult access_trap_aa32s_el1(CPUARMState *env,
73
return CP_ACCESS_TRAP_UNCATEGORIZED;
74
}
75
76
-/* Check for traps to performance monitor registers, which are controlled
77
+/*
78
+ * Check for traps to performance monitor registers, which are controlled
79
* by MDCR_EL2.TPM for EL2 and MDCR_EL3.TPM for EL3.
80
*/
81
static CPAccessResult access_tpm(CPUARMState *env, const ARMCPRegInfo *ri,
82
@@ -XXX,XX +XXX,XX @@ static void fcse_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value)
83
ARMCPU *cpu = env_archcpu(env);
84
85
if (raw_read(env, ri) != value) {
86
- /* Unlike real hardware the qemu TLB uses virtual addresses,
87
+ /*
88
+ * Unlike real hardware the qemu TLB uses virtual addresses,
89
* not modified virtual addresses, so this causes a TLB flush.
90
*/
91
tlb_flush(CPU(cpu));
92
@@ -XXX,XX +XXX,XX @@ static void contextidr_write(CPUARMState *env, const ARMCPRegInfo *ri,
93
94
if (raw_read(env, ri) != value && !arm_feature(env, ARM_FEATURE_PMSA)
95
&& !extended_addresses_enabled(env)) {
96
- /* For VMSA (when not using the LPAE long descriptor page table
97
+ /*
98
+ * For VMSA (when not using the LPAE long descriptor page table
99
* format) this register includes the ASID, so do a TLB flush.
100
* For PMSA it is purely a process ID and no action is needed.
101
*/
102
@@ -XXX,XX +XXX,XX @@ static void tlbiipas2is_hyp_write(CPUARMState *env, const ARMCPRegInfo *ri,
103
}
104
105
static const ARMCPRegInfo cp_reginfo[] = {
106
- /* Define the secure and non-secure FCSE identifier CP registers
107
+ /*
108
+ * Define the secure and non-secure FCSE identifier CP registers
109
* separately because there is no secure bank in V8 (no _EL3). This allows
110
* the secure register to be properly reset and migrated. There is also no
111
* v8 EL1 version of the register so the non-secure instance stands alone.
112
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo cp_reginfo[] = {
113
.access = PL1_RW, .secure = ARM_CP_SECSTATE_S,
114
.fieldoffset = offsetof(CPUARMState, cp15.fcseidr_s),
115
.resetvalue = 0, .writefn = fcse_write, .raw_writefn = raw_write, },
116
- /* Define the secure and non-secure context identifier CP registers
117
+ /*
118
+ * Define the secure and non-secure context identifier CP registers
119
* separately because there is no secure bank in V8 (no _EL3). This allows
120
* the secure register to be properly reset and migrated. In the
121
* non-secure case, the 32-bit register will have reset and migration
122
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo cp_reginfo[] = {
43
};
123
};
44
124
45
#endif /* ASPEED_SOC_H */
125
static const ARMCPRegInfo not_v8_cp_reginfo[] = {
46
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
126
- /* NB: Some of these registers exist in v8 but with more precise
47
index XXXXXXX..XXXXXXX 100644
127
+ /*
48
--- a/hw/arm/aspeed.c
128
+ * NB: Some of these registers exist in v8 but with more precise
49
+++ b/hw/arm/aspeed.c
129
* definitions that don't use CP_ANY wildcards (mostly in v8_cp_reginfo[]).
50
@@ -XXX,XX +XXX,XX @@ static void aspeed_board_init(MachineState *machine,
130
*/
51
&error_abort);
131
/* MMU Domain access control / MPU write buffer control */
52
132
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo not_v8_cp_reginfo[] = {
53
memory_region_allocate_system_memory(&bmc->ram, NULL, "ram", ram_size);
133
.writefn = dacr_write, .raw_writefn = raw_write,
54
- memory_region_add_subregion(get_system_memory(), sc->info->sdram_base,
134
.bank_fieldoffsets = { offsetoflow32(CPUARMState, cp15.dacr_s),
55
- &bmc->ram);
135
offsetoflow32(CPUARMState, cp15.dacr_ns) } },
56
+ memory_region_add_subregion(get_system_memory(),
136
- /* ARMv7 allocates a range of implementation defined TLB LOCKDOWN regs.
57
+ sc->info->memmap[ASPEED_SDRAM], &bmc->ram);
137
+ /*
58
object_property_add_const_link(OBJECT(&bmc->soc), "ram", OBJECT(&bmc->ram),
138
+ * ARMv7 allocates a range of implementation defined TLB LOCKDOWN regs.
59
&error_abort);
139
* For v6 and v5, these mappings are overly broad.
60
140
*/
61
@@ -XXX,XX +XXX,XX @@ static void aspeed_board_init(MachineState *machine,
141
{ .name = "TLB_LOCKDOWN", .cp = 15, .crn = 10, .crm = 0,
62
memory_region_init_io(&bmc->max_ram, NULL, &max_ram_ops, NULL,
142
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo not_v8_cp_reginfo[] = {
63
"max_ram", max_ram_size - ram_size);
64
memory_region_add_subregion(get_system_memory(),
65
- sc->info->sdram_base + ram_size,
66
+ sc->info->memmap[ASPEED_SDRAM] + ram_size,
67
&bmc->max_ram);
68
69
aspeed_board_init_flashes(&bmc->soc.fmc, cfg->fmc_model, &error_abort);
70
@@ -XXX,XX +XXX,XX @@ static void aspeed_board_init(MachineState *machine,
71
aspeed_board_binfo.initrd_filename = machine->initrd_filename;
72
aspeed_board_binfo.kernel_cmdline = machine->kernel_cmdline;
73
aspeed_board_binfo.ram_size = ram_size;
74
- aspeed_board_binfo.loader_start = sc->info->sdram_base;
75
+ aspeed_board_binfo.loader_start = sc->info->memmap[ASPEED_SDRAM];
76
77
if (cfg->i2c_init) {
78
cfg->i2c_init(bmc);
79
diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c
80
index XXXXXXX..XXXXXXX 100644
81
--- a/hw/arm/aspeed_soc.c
82
+++ b/hw/arm/aspeed_soc.c
83
@@ -XXX,XX +XXX,XX @@
84
#include "hw/i2c/aspeed_i2c.h"
85
#include "net/net.h"
86
87
-#define ASPEED_SOC_UART_5_BASE 0x00184000
88
#define ASPEED_SOC_IOMEM_SIZE 0x00200000
89
-#define ASPEED_SOC_IOMEM_BASE 0x1E600000
90
-#define ASPEED_SOC_FMC_BASE 0x1E620000
91
-#define ASPEED_SOC_SPI_BASE 0x1E630000
92
-#define ASPEED_SOC_SPI2_BASE 0x1E631000
93
-#define ASPEED_SOC_VIC_BASE 0x1E6C0000
94
-#define ASPEED_SOC_SDMC_BASE 0x1E6E0000
95
-#define ASPEED_SOC_SCU_BASE 0x1E6E2000
96
-#define ASPEED_SOC_SRAM_BASE 0x1E720000
97
-#define ASPEED_SOC_TIMER_BASE 0x1E782000
98
-#define ASPEED_SOC_WDT_BASE 0x1E785000
99
-#define ASPEED_SOC_I2C_BASE 0x1E78A000
100
-#define ASPEED_SOC_ETH1_BASE 0x1E660000
101
-#define ASPEED_SOC_ETH2_BASE 0x1E680000
102
+
103
+static const hwaddr aspeed_soc_ast2400_memmap[] = {
104
+ [ASPEED_IOMEM] = 0x1E600000,
105
+ [ASPEED_FMC] = 0x1E620000,
106
+ [ASPEED_SPI1] = 0x1E630000,
107
+ [ASPEED_VIC] = 0x1E6C0000,
108
+ [ASPEED_SDMC] = 0x1E6E0000,
109
+ [ASPEED_SCU] = 0x1E6E2000,
110
+ [ASPEED_ADC] = 0x1E6E9000,
111
+ [ASPEED_SRAM] = 0x1E720000,
112
+ [ASPEED_GPIO] = 0x1E780000,
113
+ [ASPEED_RTC] = 0x1E781000,
114
+ [ASPEED_TIMER1] = 0x1E782000,
115
+ [ASPEED_WDT] = 0x1E785000,
116
+ [ASPEED_PWM] = 0x1E786000,
117
+ [ASPEED_LPC] = 0x1E789000,
118
+ [ASPEED_IBT] = 0x1E789140,
119
+ [ASPEED_I2C] = 0x1E78A000,
120
+ [ASPEED_ETH1] = 0x1E660000,
121
+ [ASPEED_ETH2] = 0x1E680000,
122
+ [ASPEED_UART1] = 0x1E783000,
123
+ [ASPEED_UART5] = 0x1E784000,
124
+ [ASPEED_VUART] = 0x1E787000,
125
+ [ASPEED_SDRAM] = 0x40000000,
126
+};
127
+
128
+static const hwaddr aspeed_soc_ast2500_memmap[] = {
129
+ [ASPEED_IOMEM] = 0x1E600000,
130
+ [ASPEED_FMC] = 0x1E620000,
131
+ [ASPEED_SPI1] = 0x1E630000,
132
+ [ASPEED_SPI2] = 0x1E631000,
133
+ [ASPEED_VIC] = 0x1E6C0000,
134
+ [ASPEED_SDMC] = 0x1E6E0000,
135
+ [ASPEED_SCU] = 0x1E6E2000,
136
+ [ASPEED_ADC] = 0x1E6E9000,
137
+ [ASPEED_SRAM] = 0x1E720000,
138
+ [ASPEED_GPIO] = 0x1E780000,
139
+ [ASPEED_RTC] = 0x1E781000,
140
+ [ASPEED_TIMER1] = 0x1E782000,
141
+ [ASPEED_WDT] = 0x1E785000,
142
+ [ASPEED_PWM] = 0x1E786000,
143
+ [ASPEED_LPC] = 0x1E789000,
144
+ [ASPEED_IBT] = 0x1E789140,
145
+ [ASPEED_I2C] = 0x1E78A000,
146
+ [ASPEED_ETH1] = 0x1E660000,
147
+ [ASPEED_ETH2] = 0x1E680000,
148
+ [ASPEED_UART1] = 0x1E783000,
149
+ [ASPEED_UART5] = 0x1E784000,
150
+ [ASPEED_VUART] = 0x1E787000,
151
+ [ASPEED_SDRAM] = 0x80000000,
152
+};
153
154
static const int aspeed_soc_ast2400_irqmap[] = {
155
[ASPEED_UART1] = 9,
156
@@ -XXX,XX +XXX,XX @@ static const int aspeed_soc_ast2400_irqmap[] = {
157
[ASPEED_ETH2] = 3,
158
};
143
};
159
144
160
-#define AST2400_SDRAM_BASE 0x40000000
145
static const ARMCPRegInfo not_v6_cp_reginfo[] = {
161
-#define AST2500_SDRAM_BASE 0x80000000
146
- /* Not all pre-v6 cores implemented this WFI, so this is slightly
162
-
147
+ /*
163
-/* AST2500 uses the same IRQs as the AST2400 */
148
+ * Not all pre-v6 cores implemented this WFI, so this is slightly
164
#define aspeed_soc_ast2500_irqmap aspeed_soc_ast2400_irqmap
149
* over-broad.
165
150
*/
166
-static const hwaddr aspeed_soc_ast2400_spi_bases[] = { ASPEED_SOC_SPI_BASE };
151
{ .name = "WFI_v5", .cp = 15, .crn = 7, .crm = 8, .opc1 = 0, .opc2 = 2,
167
static const char *aspeed_soc_ast2400_typenames[] = { "aspeed.smc.spi" };
152
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo not_v6_cp_reginfo[] = {
168
-
153
};
169
-static const hwaddr aspeed_soc_ast2500_spi_bases[] = { ASPEED_SOC_SPI_BASE,
154
170
- ASPEED_SOC_SPI2_BASE};
155
static const ARMCPRegInfo not_v7_cp_reginfo[] = {
171
static const char *aspeed_soc_ast2500_typenames[] = {
156
- /* Standard v6 WFI (also used in some pre-v6 cores); not in v7 (which
172
"aspeed.smc.ast2500-spi1", "aspeed.smc.ast2500-spi2" };
157
+ /*
173
158
+ * Standard v6 WFI (also used in some pre-v6 cores); not in v7 (which
174
@@ -XXX,XX +XXX,XX @@ static const AspeedSoCInfo aspeed_socs[] = {
159
* is UNPREDICTABLE; we choose to NOP as most implementations do).
175
.name = "ast2400-a0",
160
*/
176
.cpu_type = ARM_CPU_TYPE_NAME("arm926"),
161
{ .name = "WFI_v6", .cp = 15, .crn = 7, .crm = 0, .opc1 = 0, .opc2 = 4,
177
.silicon_rev = AST2400_A0_SILICON_REV,
162
.access = PL1_W, .type = ARM_CP_WFI },
178
- .sdram_base = AST2400_SDRAM_BASE,
163
- /* L1 cache lockdown. Not architectural in v6 and earlier but in practice
179
.sram_size = 0x8000,
164
+ /*
180
.spis_num = 1,
165
+ * L1 cache lockdown. Not architectural in v6 and earlier but in practice
181
- .spi_bases = aspeed_soc_ast2400_spi_bases,
166
* implemented in 926, 946, 1026, 1136, 1176 and 11MPCore. StrongARM and
182
.fmc_typename = "aspeed.smc.fmc",
167
* OMAPCP will override this space.
183
.spi_typename = aspeed_soc_ast2400_typenames,
168
*/
184
.wdts_num = 2,
169
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo not_v7_cp_reginfo[] = {
185
.irqmap = aspeed_soc_ast2400_irqmap,
170
{ .name = "DUMMY", .cp = 15, .crn = 0, .crm = 0, .opc1 = 1, .opc2 = CP_ANY,
186
+ .memmap = aspeed_soc_ast2400_memmap,
171
.access = PL1_R, .type = ARM_CP_CONST | ARM_CP_NO_RAW,
187
}, {
172
.resetvalue = 0 },
188
.name = "ast2400-a1",
173
- /* We don't implement pre-v7 debug but most CPUs had at least a DBGDIDR;
189
.cpu_type = ARM_CPU_TYPE_NAME("arm926"),
174
+ /*
190
.silicon_rev = AST2400_A1_SILICON_REV,
175
+ * We don't implement pre-v7 debug but most CPUs had at least a DBGDIDR;
191
- .sdram_base = AST2400_SDRAM_BASE,
176
* implementing it as RAZ means the "debug architecture version" bits
192
.sram_size = 0x8000,
177
* will read as a reserved value, which should cause Linux to not try
193
.spis_num = 1,
178
* to use the debug hardware.
194
- .spi_bases = aspeed_soc_ast2400_spi_bases,
179
*/
195
.fmc_typename = "aspeed.smc.fmc",
180
{ .name = "DBGDIDR", .cp = 14, .crn = 0, .crm = 0, .opc1 = 0, .opc2 = 0,
196
.spi_typename = aspeed_soc_ast2400_typenames,
181
.access = PL0_R, .type = ARM_CP_CONST, .resetvalue = 0 },
197
.wdts_num = 2,
182
- /* MMU TLB control. Note that the wildcarding means we cover not just
198
.irqmap = aspeed_soc_ast2400_irqmap,
183
+ /*
199
+ .memmap = aspeed_soc_ast2400_memmap,
184
+ * MMU TLB control. Note that the wildcarding means we cover not just
200
}, {
185
* the unified TLB ops but also the dside/iside/inner-shareable variants.
201
.name = "ast2400",
186
*/
202
.cpu_type = ARM_CPU_TYPE_NAME("arm926"),
187
{ .name = "TLBIALL", .cp = 15, .crn = 8, .crm = CP_ANY,
203
.silicon_rev = AST2400_A0_SILICON_REV,
188
@@ -XXX,XX +XXX,XX @@ static void cpacr_write(CPUARMState *env, const ARMCPRegInfo *ri,
204
- .sdram_base = AST2400_SDRAM_BASE,
189
205
.sram_size = 0x8000,
190
/* In ARMv8 most bits of CPACR_EL1 are RES0. */
206
.spis_num = 1,
191
if (!arm_feature(env, ARM_FEATURE_V8)) {
207
- .spi_bases = aspeed_soc_ast2400_spi_bases,
192
- /* ARMv7 defines bits for unimplemented coprocessors as RAZ/WI.
208
.fmc_typename = "aspeed.smc.fmc",
193
+ /*
209
.spi_typename = aspeed_soc_ast2400_typenames,
194
+ * ARMv7 defines bits for unimplemented coprocessors as RAZ/WI.
210
.wdts_num = 2,
195
* ASEDIS [31] and D32DIS [30] are both UNK/SBZP without VFP.
211
.irqmap = aspeed_soc_ast2400_irqmap,
196
* TRCDIS [28] is RAZ/WI since we do not implement a trace macrocell.
212
+ .memmap = aspeed_soc_ast2400_memmap,
197
*/
213
}, {
198
@@ -XXX,XX +XXX,XX @@ static void cpacr_write(CPUARMState *env, const ARMCPRegInfo *ri,
214
.name = "ast2500-a1",
199
value |= R_CPACR_ASEDIS_MASK;
215
.cpu_type = ARM_CPU_TYPE_NAME("arm1176"),
200
}
216
.silicon_rev = AST2500_A1_SILICON_REV,
201
217
- .sdram_base = AST2500_SDRAM_BASE,
202
- /* VFPv3 and upwards with NEON implement 32 double precision
218
.sram_size = 0x9000,
203
+ /*
219
.spis_num = 2,
204
+ * VFPv3 and upwards with NEON implement 32 double precision
220
- .spi_bases = aspeed_soc_ast2500_spi_bases,
205
* registers (D0-D31).
221
.fmc_typename = "aspeed.smc.ast2500-fmc",
206
*/
222
.spi_typename = aspeed_soc_ast2500_typenames,
207
if (!cpu_isar_feature(aa32_simd_r32, env_archcpu(env))) {
223
.wdts_num = 3,
208
@@ -XXX,XX +XXX,XX @@ static uint64_t cpacr_read(CPUARMState *env, const ARMCPRegInfo *ri)
224
.irqmap = aspeed_soc_ast2500_irqmap,
209
225
+ .memmap = aspeed_soc_ast2500_memmap,
210
static void cpacr_reset(CPUARMState *env, const ARMCPRegInfo *ri)
211
{
212
- /* Call cpacr_write() so that we reset with the correct RAO bits set
213
+ /*
214
+ * Call cpacr_write() so that we reset with the correct RAO bits set
215
* for our CPU features.
216
*/
217
cpacr_write(env, ri, 0);
218
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v6_cp_reginfo[] = {
219
{ .name = "MVA_prefetch",
220
.cp = 15, .crn = 7, .crm = 13, .opc1 = 0, .opc2 = 1,
221
.access = PL1_W, .type = ARM_CP_NOP },
222
- /* We need to break the TB after ISB to execute self-modifying code
223
+ /*
224
+ * We need to break the TB after ISB to execute self-modifying code
225
* correctly and also to take any pending interrupts immediately.
226
* So use arm_cp_write_ignore() function instead of ARM_CP_NOP flag.
227
*/
228
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v6_cp_reginfo[] = {
229
.bank_fieldoffsets = { offsetof(CPUARMState, cp15.ifar_s),
230
offsetof(CPUARMState, cp15.ifar_ns) },
231
.resetvalue = 0, },
232
- /* Watchpoint Fault Address Register : should actually only be present
233
+ /*
234
+ * Watchpoint Fault Address Register : should actually only be present
235
* for 1136, 1176, 11MPCore.
236
*/
237
{ .name = "WFAR", .cp = 15, .crn = 6, .crm = 0, .opc1 = 0, .opc2 = 1,
238
@@ -XXX,XX +XXX,XX @@ static bool event_supported(uint16_t number)
239
static CPAccessResult pmreg_access(CPUARMState *env, const ARMCPRegInfo *ri,
240
bool isread)
241
{
242
- /* Performance monitor registers user accessibility is controlled
243
+ /*
244
+ * Performance monitor registers user accessibility is controlled
245
* by PMUSERENR. MDCR_EL2.TPM and MDCR_EL3.TPM allow configurable
246
* trapping to EL2 or EL3 for other accesses.
247
*/
248
@@ -XXX,XX +XXX,XX @@ static CPAccessResult pmreg_access_ccntr(CPUARMState *env,
249
(MDCR_HPME | MDCR_HPMD | MDCR_HPMN | MDCR_HCCD | MDCR_HLP)
250
#define MDCR_EL3_PMU_ENABLE_BITS (MDCR_SPME | MDCR_SCCD)
251
252
-/* Returns true if the counter (pass 31 for PMCCNTR) should count events using
253
+/*
254
+ * Returns true if the counter (pass 31 for PMCCNTR) should count events using
255
* the current EL, security state, and register configuration.
256
*/
257
static bool pmu_counter_enabled(CPUARMState *env, uint8_t counter)
258
@@ -XXX,XX +XXX,XX @@ static uint64_t pmccntr_read(CPUARMState *env, const ARMCPRegInfo *ri)
259
static void pmselr_write(CPUARMState *env, const ARMCPRegInfo *ri,
260
uint64_t value)
261
{
262
- /* The value of PMSELR.SEL affects the behavior of PMXEVTYPER and
263
+ /*
264
+ * The value of PMSELR.SEL affects the behavior of PMXEVTYPER and
265
* PMXEVCNTR. We allow [0..31] to be written to PMSELR here; in the
266
* meanwhile, we check PMSELR.SEL when PMXEVTYPER and PMXEVCNTR are
267
* accessed.
268
@@ -XXX,XX +XXX,XX @@ static void pmevtyper_write(CPUARMState *env, const ARMCPRegInfo *ri,
269
env->cp15.c14_pmevtyper[counter] = value & PMXEVTYPER_MASK;
270
pmevcntr_op_finish(env, counter);
271
}
272
- /* Attempts to access PMXEVTYPER are CONSTRAINED UNPREDICTABLE when
273
+ /*
274
+ * Attempts to access PMXEVTYPER are CONSTRAINED UNPREDICTABLE when
275
* PMSELR value is equal to or greater than the number of implemented
276
* counters, but not equal to 0x1f. We opt to behave as a RAZ/WI.
277
*/
278
@@ -XXX,XX +XXX,XX @@ static uint64_t pmevcntr_read(CPUARMState *env, const ARMCPRegInfo *ri,
279
}
280
return ret;
281
} else {
282
- /* We opt to behave as a RAZ/WI when attempts to access PM[X]EVCNTR
283
- * are CONSTRAINED UNPREDICTABLE. */
284
+ /*
285
+ * We opt to behave as a RAZ/WI when attempts to access PM[X]EVCNTR
286
+ * are CONSTRAINED UNPREDICTABLE.
287
+ */
288
return 0;
289
}
290
}
291
@@ -XXX,XX +XXX,XX @@ static void pmintenclr_write(CPUARMState *env, const ARMCPRegInfo *ri,
292
static void vbar_write(CPUARMState *env, const ARMCPRegInfo *ri,
293
uint64_t value)
294
{
295
- /* Note that even though the AArch64 view of this register has bits
296
+ /*
297
+ * Note that even though the AArch64 view of this register has bits
298
* [10:0] all RES0 we can only mask the bottom 5, to comply with the
299
* architectural requirements for bits which are RES0 only in some
300
* contexts. (ARMv8 would permit us to do no masking at all, but ARMv7
301
@@ -XXX,XX +XXX,XX @@ static void scr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value)
302
if (!arm_feature(env, ARM_FEATURE_EL2)) {
303
valid_mask &= ~SCR_HCE;
304
305
- /* On ARMv7, SMD (or SCD as it is called in v7) is only
306
+ /*
307
+ * On ARMv7, SMD (or SCD as it is called in v7) is only
308
* supported if EL2 exists. The bit is UNK/SBZP when
309
* EL2 is unavailable. In QEMU ARMv7, we force it to always zero
310
* when EL2 is unavailable.
311
@@ -XXX,XX +XXX,XX @@ static uint64_t ccsidr_read(CPUARMState *env, const ARMCPRegInfo *ri)
312
{
313
ARMCPU *cpu = env_archcpu(env);
314
315
- /* Acquire the CSSELR index from the bank corresponding to the CCSIDR
316
+ /*
317
+ * Acquire the CSSELR index from the bank corresponding to the CCSIDR
318
* bank
319
*/
320
uint32_t index = A32_BANKED_REG_GET(env, csselr,
321
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = {
322
/* the old v6 WFI, UNPREDICTABLE in v7 but we choose to NOP */
323
{ .name = "NOP", .cp = 15, .crn = 7, .crm = 0, .opc1 = 0, .opc2 = 4,
324
.access = PL1_W, .type = ARM_CP_NOP },
325
- /* Performance monitors are implementation defined in v7,
326
+ /*
327
+ * Performance monitors are implementation defined in v7,
328
* but with an ARM recommended set of registers, which we
329
* follow.
330
*
331
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = {
332
.writefn = csselr_write, .resetvalue = 0,
333
.bank_fieldoffsets = { offsetof(CPUARMState, cp15.csselr_s),
334
offsetof(CPUARMState, cp15.csselr_ns) } },
335
- /* Auxiliary ID register: this actually has an IMPDEF value but for now
336
+ /*
337
+ * Auxiliary ID register: this actually has an IMPDEF value but for now
338
* just RAZ for all cores:
339
*/
340
{ .name = "AIDR", .state = ARM_CP_STATE_BOTH,
341
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = {
342
.access = PL1_R, .type = ARM_CP_CONST,
343
.accessfn = access_aa64_tid1,
344
.resetvalue = 0 },
345
- /* Auxiliary fault status registers: these also are IMPDEF, and we
346
+ /*
347
+ * Auxiliary fault status registers: these also are IMPDEF, and we
348
* choose to RAZ/WI for all cores.
349
*/
350
{ .name = "AFSR0_EL1", .state = ARM_CP_STATE_BOTH,
351
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = {
352
.opc0 = 3, .opc1 = 0, .crn = 5, .crm = 1, .opc2 = 1,
353
.access = PL1_RW, .accessfn = access_tvm_trvm,
354
.type = ARM_CP_CONST, .resetvalue = 0 },
355
- /* MAIR can just read-as-written because we don't implement caches
356
+ /*
357
+ * MAIR can just read-as-written because we don't implement caches
358
* and so don't need to care about memory attributes.
359
*/
360
{ .name = "MAIR_EL1", .state = ARM_CP_STATE_AA64,
361
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v7_cp_reginfo[] = {
362
.opc0 = 3, .opc1 = 6, .crn = 10, .crm = 2, .opc2 = 0,
363
.access = PL3_RW, .fieldoffset = offsetof(CPUARMState, cp15.mair_el[3]),
364
.resetvalue = 0 },
365
- /* For non-long-descriptor page tables these are PRRR and NMRR;
366
+ /*
367
+ * For non-long-descriptor page tables these are PRRR and NMRR;
368
* regardless they still act as reads-as-written for QEMU.
369
*/
370
- /* MAIR0/1 are defined separately from their 64-bit counterpart which
371
+ /*
372
+ * MAIR0/1 are defined separately from their 64-bit counterpart which
373
* allows them to assign the correct fieldoffset based on the endianness
374
* handled in the field definitions.
375
*/
376
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v6k_cp_reginfo[] = {
377
static CPAccessResult gt_cntfrq_access(CPUARMState *env, const ARMCPRegInfo *ri,
378
bool isread)
379
{
380
- /* CNTFRQ: not visible from PL0 if both PL0PCTEN and PL0VCTEN are zero.
381
+ /*
382
+ * CNTFRQ: not visible from PL0 if both PL0PCTEN and PL0VCTEN are zero.
383
* Writable only at the highest implemented exception level.
384
*/
385
int el = arm_current_el(env);
386
@@ -XXX,XX +XXX,XX @@ static CPAccessResult gt_stimer_access(CPUARMState *env,
387
const ARMCPRegInfo *ri,
388
bool isread)
389
{
390
- /* The AArch64 register view of the secure physical timer is
391
+ /*
392
+ * The AArch64 register view of the secure physical timer is
393
* always accessible from EL3, and configurably accessible from
394
* Secure EL1.
395
*/
396
@@ -XXX,XX +XXX,XX @@ static void gt_recalc_timer(ARMCPU *cpu, int timeridx)
397
ARMGenericTimer *gt = &cpu->env.cp15.c14_timer[timeridx];
398
399
if (gt->ctl & 1) {
400
- /* Timer enabled: calculate and set current ISTATUS, irq, and
401
+ /*
402
+ * Timer enabled: calculate and set current ISTATUS, irq, and
403
* reset timer to when ISTATUS next has to change
404
*/
405
uint64_t offset = timeridx == GTIMER_VIRT ?
406
@@ -XXX,XX +XXX,XX @@ static void gt_recalc_timer(ARMCPU *cpu, int timeridx)
407
/* Next transition is when we hit cval */
408
nexttick = gt->cval + offset;
409
}
410
- /* Note that the desired next expiry time might be beyond the
411
+ /*
412
+ * Note that the desired next expiry time might be beyond the
413
* signed-64-bit range of a QEMUTimer -- in this case we just
414
* set the timer for as far in the future as possible. When the
415
* timer expires we will reset the timer for any remaining period.
416
@@ -XXX,XX +XXX,XX @@ static void gt_ctl_write(CPUARMState *env, const ARMCPRegInfo *ri,
417
/* Enable toggled */
418
gt_recalc_timer(cpu, timeridx);
419
} else if ((oldval ^ value) & 2) {
420
- /* IMASK toggled: don't need to recalculate,
421
+ /*
422
+ * IMASK toggled: don't need to recalculate,
423
* just set the interrupt line based on ISTATUS
424
*/
425
int irqstate = (oldval & 4) && !(value & 2);
426
@@ -XXX,XX +XXX,XX @@ static void arm_gt_cntfrq_reset(CPUARMState *env, const ARMCPRegInfo *opaque)
427
}
428
429
static const ARMCPRegInfo generic_timer_cp_reginfo[] = {
430
- /* Note that CNTFRQ is purely reads-as-written for the benefit
431
+ /*
432
+ * Note that CNTFRQ is purely reads-as-written for the benefit
433
* of software; writing it doesn't actually change the timer frequency.
434
* Our reset value matches the fixed frequency we implement the timer at.
435
*/
436
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = {
437
.readfn = gt_virt_redir_cval_read, .raw_readfn = raw_read,
438
.writefn = gt_virt_redir_cval_write, .raw_writefn = raw_write,
226
},
439
},
440
- /* Secure timer -- this is actually restricted to only EL3
441
+ /*
442
+ * Secure timer -- this is actually restricted to only EL3
443
* and configurably Secure-EL1 via the accessfn.
444
*/
445
{ .name = "CNTPS_TVAL_EL1", .state = ARM_CP_STATE_AA64,
446
@@ -XXX,XX +XXX,XX @@ static CPAccessResult e2h_access(CPUARMState *env, const ARMCPRegInfo *ri,
447
448
#else
449
450
-/* In user-mode most of the generic timer registers are inaccessible
451
+/*
452
+ * In user-mode most of the generic timer registers are inaccessible
453
* however modern kernels (4.12+) allow access to cntvct_el0
454
*/
455
456
@@ -XXX,XX +XXX,XX @@ static uint64_t gt_virt_cnt_read(CPUARMState *env, const ARMCPRegInfo *ri)
457
{
458
ARMCPU *cpu = env_archcpu(env);
459
460
- /* Currently we have no support for QEMUTimer in linux-user so we
461
+ /*
462
+ * Currently we have no support for QEMUTimer in linux-user so we
463
* can't call gt_get_countervalue(env), instead we directly
464
* call the lower level functions.
465
*/
466
@@ -XXX,XX +XXX,XX @@ static CPAccessResult ats_access(CPUARMState *env, const ARMCPRegInfo *ri,
467
bool isread)
468
{
469
if (ri->opc2 & 4) {
470
- /* The ATS12NSO* operations must trap to EL3 or EL2 if executed in
471
+ /*
472
+ * The ATS12NSO* operations must trap to EL3 or EL2 if executed in
473
* Secure EL1 (which can only happen if EL3 is AArch64).
474
* They are simply UNDEF if executed from NS EL1.
475
* They function normally from EL2 or EL3.
476
@@ -XXX,XX +XXX,XX @@ static uint64_t do_ats_write(CPUARMState *env, uint64_t value,
477
}
478
}
479
} else {
480
- /* fsr is a DFSR/IFSR value for the short descriptor
481
+ /*
482
+ * fsr is a DFSR/IFSR value for the short descriptor
483
* translation table format (with WnR always clear).
484
* Convert it to a 32-bit PAR.
485
*/
486
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo pmsav8r_cp_reginfo[] = {
227
};
487
};
228
488
229
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
489
static const ARMCPRegInfo pmsav7_cp_reginfo[] = {
230
Error *err = NULL, *local_err = NULL;
490
- /* Reset for all these registers is handled in arm_cpu_reset(),
231
491
+ /*
232
/* IO space */
492
+ * Reset for all these registers is handled in arm_cpu_reset(),
233
- create_unimplemented_device("aspeed_soc.io",
493
* because the PMSAv7 is also used by M-profile CPUs, which do
234
- ASPEED_SOC_IOMEM_BASE, ASPEED_SOC_IOMEM_SIZE);
494
* not register cpregs but still need the state to be reset.
235
+ create_unimplemented_device("aspeed_soc.io", sc->info->memmap[ASPEED_IOMEM],
495
*/
236
+ ASPEED_SOC_IOMEM_SIZE);
496
@@ -XXX,XX +XXX,XX @@ static void vmsa_ttbcr_write(CPUARMState *env, const ARMCPRegInfo *ri,
237
497
}
238
/* CPU */
498
239
object_property_set_bool(OBJECT(&s->cpu), true, "realized", &err);
499
if (arm_feature(env, ARM_FEATURE_LPAE)) {
240
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
500
- /* With LPAE the TTBCR could result in a change of ASID
241
error_propagate(errp, err);
501
+ /*
502
+ * With LPAE the TTBCR could result in a change of ASID
503
* via the TTBCR.A1 bit, so do a TLB flush.
504
*/
505
tlb_flush(CPU(cpu));
506
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo vmsa_cp_reginfo[] = {
507
offsetoflow32(CPUARMState, cp15.tcr_el[1])} },
508
};
509
510
-/* Note that unlike TTBCR, writing to TTBCR2 does not require flushing
511
+/*
512
+ * Note that unlike TTBCR, writing to TTBCR2 does not require flushing
513
* qemu tlbs nor adjusting cached masks.
514
*/
515
static const ARMCPRegInfo ttbcr2_reginfo = {
516
@@ -XXX,XX +XXX,XX @@ static void omap_wfi_write(CPUARMState *env, const ARMCPRegInfo *ri,
517
static void omap_cachemaint_write(CPUARMState *env, const ARMCPRegInfo *ri,
518
uint64_t value)
519
{
520
- /* On OMAP there are registers indicating the max/min index of dcache lines
521
+ /*
522
+ * On OMAP there are registers indicating the max/min index of dcache lines
523
* containing a dirty line; cache flush operations have to reset these.
524
*/
525
env->cp15.c15_i_max = 0x000;
526
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo omap_cp_reginfo[] = {
527
.crm = 8, .opc1 = 0, .opc2 = 0, .access = PL1_RW,
528
.type = ARM_CP_NO_RAW,
529
.readfn = arm_cp_read_zero, .writefn = omap_wfi_write, },
530
- /* TODO: Peripheral port remap register:
531
+ /*
532
+ * TODO: Peripheral port remap register:
533
* On OMAP2 mcr p15, 0, rn, c15, c2, 4 sets up the interrupt controller
534
* base address at $rn & ~0xfff and map size of 0x200 << ($rn & 0xfff),
535
* when MMU is off.
536
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo xscale_cp_reginfo[] = {
537
.cp = 15, .crn = 1, .crm = 0, .opc1 = 0, .opc2 = 1, .access = PL1_RW,
538
.fieldoffset = offsetof(CPUARMState, cp15.c1_xscaleauxcr),
539
.resetvalue = 0, },
540
- /* XScale specific cache-lockdown: since we have no cache we NOP these
541
+ /*
542
+ * XScale specific cache-lockdown: since we have no cache we NOP these
543
* and hope the guest does not really rely on cache behaviour.
544
*/
545
{ .name = "XSCALE_LOCK_ICACHE_LINE",
546
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo xscale_cp_reginfo[] = {
547
};
548
549
static const ARMCPRegInfo dummy_c15_cp_reginfo[] = {
550
- /* RAZ/WI the whole crn=15 space, when we don't have a more specific
551
+ /*
552
+ * RAZ/WI the whole crn=15 space, when we don't have a more specific
553
* implementation of this implementation-defined space.
554
* Ideally this should eventually disappear in favour of actually
555
* implementing the correct behaviour for all cores.
556
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo cache_block_ops_cp_reginfo[] = {
557
};
558
559
static const ARMCPRegInfo cache_test_clean_cp_reginfo[] = {
560
- /* The cache test-and-clean instructions always return (1 << 30)
561
+ /*
562
+ * The cache test-and-clean instructions always return (1 << 30)
563
* to indicate that there are no dirty cache lines.
564
*/
565
{ .name = "TC_DCACHE", .cp = 15, .crn = 7, .crm = 10, .opc1 = 0, .opc2 = 3,
566
@@ -XXX,XX +XXX,XX @@ static uint64_t mpidr_read_val(CPUARMState *env)
567
568
if (arm_feature(env, ARM_FEATURE_V7MP)) {
569
mpidr |= (1U << 31);
570
- /* Cores which are uniprocessor (non-coherent)
571
+ /*
572
+ * Cores which are uniprocessor (non-coherent)
573
* but still implement the MP extensions set
574
* bit 30. (For instance, Cortex-R5).
575
*/
576
@@ -XXX,XX +XXX,XX @@ static CPAccessResult access_tocu(CPUARMState *env, const ARMCPRegInfo *ri,
577
return do_cacheop_pou_access(env, HCR_TOCU | HCR_TPU);
578
}
579
580
-/* See: D4.7.2 TLB maintenance requirements and the TLB maintenance instructions
581
+/*
582
+ * See: D4.7.2 TLB maintenance requirements and the TLB maintenance instructions
583
* Page D4-1736 (DDI0487A.b)
584
*/
585
586
@@ -XXX,XX +XXX,XX @@ static void tlbi_aa64_alle3is_write(CPUARMState *env, const ARMCPRegInfo *ri,
587
static void tlbi_aa64_vae2_write(CPUARMState *env, const ARMCPRegInfo *ri,
588
uint64_t value)
589
{
590
- /* Invalidate by VA, EL2
591
+ /*
592
+ * Invalidate by VA, EL2
593
* Currently handles both VAE2 and VALE2, since we don't support
594
* flush-last-level-only.
595
*/
596
@@ -XXX,XX +XXX,XX @@ static void tlbi_aa64_vae2_write(CPUARMState *env, const ARMCPRegInfo *ri,
597
static void tlbi_aa64_vae3_write(CPUARMState *env, const ARMCPRegInfo *ri,
598
uint64_t value)
599
{
600
- /* Invalidate by VA, EL3
601
+ /*
602
+ * Invalidate by VA, EL3
603
* Currently handles both VAE3 and VALE3, since we don't support
604
* flush-last-level-only.
605
*/
606
@@ -XXX,XX +XXX,XX @@ static void tlbi_aa64_vae1is_write(CPUARMState *env, const ARMCPRegInfo *ri,
607
static void tlbi_aa64_vae1_write(CPUARMState *env, const ARMCPRegInfo *ri,
608
uint64_t value)
609
{
610
- /* Invalidate by VA, EL1&0 (AArch64 version).
611
+ /*
612
+ * Invalidate by VA, EL1&0 (AArch64 version).
613
* Currently handles all of VAE1, VAAE1, VAALE1 and VALE1,
614
* since we don't support flush-for-specific-ASID-only or
615
* flush-last-level-only.
616
@@ -XXX,XX +XXX,XX @@ static CPAccessResult sp_el0_access(CPUARMState *env, const ARMCPRegInfo *ri,
617
bool isread)
618
{
619
if (!(env->pstate & PSTATE_SP)) {
620
- /* Access to SP_EL0 is undefined if it's being used as
621
+ /*
622
+ * Access to SP_EL0 is undefined if it's being used as
623
* the stack pointer.
624
*/
625
return CP_ACCESS_TRAP_UNCATEGORIZED;
626
@@ -XXX,XX +XXX,XX @@ static void sctlr_write(CPUARMState *env, const ARMCPRegInfo *ri,
627
}
628
629
if (raw_read(env, ri) == value) {
630
- /* Skip the TLB flush if nothing actually changed; Linux likes
631
+ /*
632
+ * Skip the TLB flush if nothing actually changed; Linux likes
633
* to do a lot of pointless SCTLR writes.
634
*/
242
return;
635
return;
243
}
636
@@ -XXX,XX +XXX,XX @@ static void mdcr_el2_write(CPUARMState *env, const ARMCPRegInfo *ri,
244
- memory_region_add_subregion(get_system_memory(), ASPEED_SOC_SRAM_BASE,
637
}
245
- &s->sram);
638
246
+ memory_region_add_subregion(get_system_memory(),
639
static const ARMCPRegInfo v8_cp_reginfo[] = {
247
+ sc->info->memmap[ASPEED_SRAM], &s->sram);
640
- /* Minimal set of EL0-visible registers. This will need to be expanded
248
641
+ /*
249
/* SCU */
642
+ * Minimal set of EL0-visible registers. This will need to be expanded
250
object_property_set_bool(OBJECT(&s->scu), true, "realized", &err);
643
* significantly for system emulation of AArch64 CPUs.
251
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
644
*/
252
error_propagate(errp, err);
645
{ .name = "NZCV", .state = ARM_CP_STATE_AA64,
253
return;
646
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = {
254
}
647
.opc0 = 3, .opc1 = 0, .crn = 4, .crm = 0, .opc2 = 0,
255
- sysbus_mmio_map(SYS_BUS_DEVICE(&s->scu), 0, ASPEED_SOC_SCU_BASE);
648
.access = PL1_RW,
256
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->scu), 0, sc->info->memmap[ASPEED_SCU]);
649
.fieldoffset = offsetof(CPUARMState, banked_spsr[BANK_SVC]) },
257
650
- /* We rely on the access checks not allowing the guest to write to the
258
/* VIC */
651
+ /*
259
object_property_set_bool(OBJECT(&s->vic), true, "realized", &err);
652
+ * We rely on the access checks not allowing the guest to write to the
260
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
653
* state field when SPSel indicates that it's being used as the stack
261
error_propagate(errp, err);
654
* pointer.
262
return;
655
*/
263
}
656
@@ -XXX,XX +XXX,XX @@ static void do_hcr_write(CPUARMState *env, uint64_t value, uint64_t valid_mask)
264
- sysbus_mmio_map(SYS_BUS_DEVICE(&s->vic), 0, ASPEED_SOC_VIC_BASE);
657
if (arm_feature(env, ARM_FEATURE_EL3)) {
265
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->vic), 0, sc->info->memmap[ASPEED_VIC]);
658
valid_mask &= ~HCR_HCD;
266
sysbus_connect_irq(SYS_BUS_DEVICE(&s->vic), 0,
659
} else if (cpu->psci_conduit != QEMU_PSCI_CONDUIT_SMC) {
267
qdev_get_gpio_in(DEVICE(&s->cpu), ARM_CPU_IRQ));
660
- /* Architecturally HCR.TSC is RES0 if EL3 is not implemented.
268
sysbus_connect_irq(SYS_BUS_DEVICE(&s->vic), 1,
661
+ /*
269
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
662
+ * Architecturally HCR.TSC is RES0 if EL3 is not implemented.
270
error_propagate(errp, err);
663
* However, if we're using the SMC PSCI conduit then QEMU is
271
return;
664
* effectively acting like EL3 firmware and so the guest at
272
}
665
* EL2 should retain the ability to prevent EL1 from being
273
- sysbus_mmio_map(SYS_BUS_DEVICE(&s->timerctrl), 0, ASPEED_SOC_TIMER_BASE);
666
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el2_cp_reginfo[] = {
274
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->timerctrl), 0,
667
.access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF,
275
+ sc->info->memmap[ASPEED_TIMER1]);
668
.writefn = tlbi_aa64_vae2is_write },
276
for (i = 0; i < ASPEED_TIMER_NR_TIMERS; i++) {
669
#ifndef CONFIG_USER_ONLY
277
qemu_irq irq = aspeed_soc_get_irq(s, ASPEED_TIMER1 + i);
670
- /* Unlike the other EL2-related AT operations, these must
278
sysbus_connect_irq(SYS_BUS_DEVICE(&s->timerctrl), i, irq);
671
+ /*
279
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
672
+ * Unlike the other EL2-related AT operations, these must
280
/* UART - attach an 8250 to the IO space as our UART5 */
673
* UNDEF from EL3 if EL2 is not implemented, which is why we
281
if (serial_hd(0)) {
674
* define them here rather than with the rest of the AT ops.
282
qemu_irq uart5 = aspeed_soc_get_irq(s, ASPEED_UART5);
675
*/
283
- serial_mm_init(get_system_memory(),
676
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el2_cp_reginfo[] = {
284
- ASPEED_SOC_IOMEM_BASE + ASPEED_SOC_UART_5_BASE, 2,
677
.access = PL2_W, .accessfn = at_s1e2_access,
285
+ serial_mm_init(get_system_memory(), sc->info->memmap[ASPEED_UART5], 2,
678
.type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC | ARM_CP_EL3_NO_EL2_UNDEF,
286
uart5, 38400, serial_hd(0), DEVICE_LITTLE_ENDIAN);
679
.writefn = ats_write64 },
287
}
680
- /* The AArch32 ATS1H* operations are CONSTRAINED UNPREDICTABLE
288
681
+ /*
289
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
682
+ * The AArch32 ATS1H* operations are CONSTRAINED UNPREDICTABLE
290
error_propagate(errp, err);
683
* if EL2 is not implemented; we choose to UNDEF. Behaviour at EL3
291
return;
684
* with SCR.NS == 0 outside Monitor mode is UNPREDICTABLE; we choose
292
}
685
* to behave as if SCR.NS was 1.
293
- sysbus_mmio_map(SYS_BUS_DEVICE(&s->i2c), 0, ASPEED_SOC_I2C_BASE);
686
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el2_cp_reginfo[] = {
294
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->i2c), 0, sc->info->memmap[ASPEED_I2C]);
687
.writefn = ats1h_write, .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC },
295
sysbus_connect_irq(SYS_BUS_DEVICE(&s->i2c), 0,
688
{ .name = "CNTHCTL_EL2", .state = ARM_CP_STATE_BOTH,
296
aspeed_soc_get_irq(s, ASPEED_I2C));
689
.opc0 = 3, .opc1 = 4, .crn = 14, .crm = 1, .opc2 = 0,
297
690
- /* ARMv7 requires bit 0 and 1 to reset to 1. ARMv8 defines the
298
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
691
+ /*
299
error_propagate(errp, err);
692
+ * ARMv7 requires bit 0 and 1 to reset to 1. ARMv8 defines the
300
return;
693
* reset values as IMPDEF. We choose to reset to 3 to comply with
301
}
694
* both ARMv7 and ARMv8.
302
- sysbus_mmio_map(SYS_BUS_DEVICE(&s->fmc), 0, ASPEED_SOC_FMC_BASE);
695
*/
303
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->fmc), 0, sc->info->memmap[ASPEED_FMC]);
696
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el2_sec_cp_reginfo[] = {
304
sysbus_mmio_map(SYS_BUS_DEVICE(&s->fmc), 1,
697
static CPAccessResult nsacr_access(CPUARMState *env, const ARMCPRegInfo *ri,
305
s->fmc.ctrl->flash_window_base);
698
bool isread)
306
sysbus_connect_irq(SYS_BUS_DEVICE(&s->fmc), 0,
699
{
307
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
700
- /* The NSACR is RW at EL3, and RO for NS EL1 and NS EL2.
308
error_propagate(errp, err);
701
+ /*
309
return;
702
+ * The NSACR is RW at EL3, and RO for NS EL1 and NS EL2.
703
* At Secure EL1 it traps to EL3 or EL2.
704
*/
705
if (arm_current_el(env) == 3) {
706
@@ -XXX,XX +XXX,XX @@ static void define_pmu_regs(ARMCPU *cpu)
707
}
708
}
709
710
-/* We don't know until after realize whether there's a GICv3
711
+/*
712
+ * We don't know until after realize whether there's a GICv3
713
* attached, and that is what registers the gicv3 sysregs.
714
* So we have to fill in the GIC fields in ID_PFR/ID_PFR1_EL1/ID_AA64PFR0_EL1
715
* at runtime.
716
@@ -XXX,XX +XXX,XX @@ static uint64_t id_aa64pfr0_read(CPUARMState *env, const ARMCPRegInfo *ri)
717
}
718
#endif
719
720
-/* Shared logic between LORID and the rest of the LOR* registers.
721
+/*
722
+ * Shared logic between LORID and the rest of the LOR* registers.
723
* Secure state exclusion has already been dealt with.
724
*/
725
static CPAccessResult access_lor_ns(CPUARMState *env,
726
@@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu)
727
728
define_arm_cp_regs(cpu, cp_reginfo);
729
if (!arm_feature(env, ARM_FEATURE_V8)) {
730
- /* Must go early as it is full of wildcards that may be
731
+ /*
732
+ * Must go early as it is full of wildcards that may be
733
* overridden by later definitions.
734
*/
735
define_arm_cp_regs(cpu, not_v8_cp_reginfo);
736
@@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu)
737
.access = PL1_R, .type = ARM_CP_CONST,
738
.accessfn = access_aa32_tid3,
739
.resetvalue = cpu->isar.id_pfr0 },
740
- /* ID_PFR1 is not a plain ARM_CP_CONST because we don't know
741
+ /*
742
+ * ID_PFR1 is not a plain ARM_CP_CONST because we don't know
743
* the value of the GIC field until after we define these regs.
744
*/
745
{ .name = "ID_PFR1", .state = ARM_CP_STATE_BOTH,
746
@@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu)
747
748
define_arm_cp_regs(cpu, el3_regs);
749
}
750
- /* The behaviour of NSACR is sufficiently various that we don't
751
+ /*
752
+ * The behaviour of NSACR is sufficiently various that we don't
753
* try to describe it in a single reginfo:
754
* if EL3 is 64 bit, then trap to EL3 from S EL1,
755
* reads as constant 0xc00 from NS EL1 and NS EL2
756
@@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu)
757
if (cpu_isar_feature(aa32_jazelle, cpu)) {
758
define_arm_cp_regs(cpu, jazelle_regs);
759
}
760
- /* Slightly awkwardly, the OMAP and StrongARM cores need all of
761
+ /*
762
+ * Slightly awkwardly, the OMAP and StrongARM cores need all of
763
* cp15 crn=0 to be writes-ignored, whereas for other cores they should
764
* be read-only (ie write causes UNDEF exception).
765
*/
766
{
767
ARMCPRegInfo id_pre_v8_midr_cp_reginfo[] = {
768
- /* Pre-v8 MIDR space.
769
+ /*
770
+ * Pre-v8 MIDR space.
771
* Note that the MIDR isn't a simple constant register because
772
* of the TI925 behaviour where writes to another register can
773
* cause the MIDR value to change.
774
@@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu)
775
if (arm_feature(env, ARM_FEATURE_OMAPCP) ||
776
arm_feature(env, ARM_FEATURE_STRONGARM)) {
777
size_t i;
778
- /* Register the blanket "writes ignored" value first to cover the
779
+ /*
780
+ * Register the blanket "writes ignored" value first to cover the
781
* whole space. Then update the specific ID registers to allow write
782
* access, so that they ignore writes rather than causing them to
783
* UNDEF.
784
@@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu)
785
.raw_writefn = raw_write,
786
};
787
if (arm_feature(env, ARM_FEATURE_XSCALE)) {
788
- /* Normally we would always end the TB on an SCTLR write, but Linux
789
+ /*
790
+ * Normally we would always end the TB on an SCTLR write, but Linux
791
* arch/arm/mach-pxa/sleep.S expects two instructions following
792
* an MMU enable to execute from cache. Imitate this behaviour.
793
*/
794
@@ -XXX,XX +XXX,XX @@ static void add_cpreg_to_hashtable(ARMCPU *cpu, const ARMCPRegInfo *r,
795
void define_one_arm_cp_reg_with_opaque(ARMCPU *cpu,
796
const ARMCPRegInfo *r, void *opaque)
797
{
798
- /* Define implementations of coprocessor registers.
799
+ /*
800
+ * Define implementations of coprocessor registers.
801
* We store these in a hashtable because typically
802
* there are less than 150 registers in a space which
803
* is 16*16*16*8*8 = 262144 in size.
804
@@ -XXX,XX +XXX,XX @@ void define_one_arm_cp_reg_with_opaque(ARMCPU *cpu,
805
default:
806
g_assert_not_reached();
807
}
808
- /* The AArch64 pseudocode CheckSystemAccess() specifies that op1
809
+ /*
810
+ * The AArch64 pseudocode CheckSystemAccess() specifies that op1
811
* encodes a minimum access level for the register. We roll this
812
* runtime check into our general permission check code, so check
813
* here that the reginfo's specified permissions are strict enough
814
@@ -XXX,XX +XXX,XX @@ void define_one_arm_cp_reg_with_opaque(ARMCPU *cpu,
815
assert((r->access & ~mask) == 0);
816
}
817
818
- /* Check that the register definition has enough info to handle
819
+ /*
820
+ * Check that the register definition has enough info to handle
821
* reads and writes if they are permitted.
822
*/
823
if (!(r->type & (ARM_CP_SPECIAL_MASK | ARM_CP_CONST))) {
824
@@ -XXX,XX +XXX,XX @@ void define_one_arm_cp_reg_with_opaque(ARMCPU *cpu,
825
continue;
826
}
827
if (state == ARM_CP_STATE_AA32) {
828
- /* Under AArch32 CP registers can be common
829
+ /*
830
+ * Under AArch32 CP registers can be common
831
* (same for secure and non-secure world) or banked.
832
*/
833
char *name;
834
@@ -XXX,XX +XXX,XX @@ void define_one_arm_cp_reg_with_opaque(ARMCPU *cpu,
835
g_assert_not_reached();
836
}
837
} else {
838
- /* AArch64 registers get mapped to non-secure instance
839
- * of AArch32 */
840
+ /*
841
+ * AArch64 registers get mapped to non-secure instance
842
+ * of AArch32
843
+ */
844
add_cpreg_to_hashtable(cpu, r, opaque, state,
845
ARM_CP_SECSTATE_NS,
846
crm, opc1, opc2, r->name);
847
@@ -XXX,XX +XXX,XX @@ void arm_cp_reset_ignore(CPUARMState *env, const ARMCPRegInfo *opaque)
848
849
static int bad_mode_switch(CPUARMState *env, int mode, CPSRWriteType write_type)
850
{
851
- /* Return true if it is not valid for us to switch to
852
+ /*
853
+ * Return true if it is not valid for us to switch to
854
* this CPU mode (ie all the UNPREDICTABLE cases in
855
* the ARM ARM CPSRWriteByInstr pseudocode).
856
*/
857
@@ -XXX,XX +XXX,XX @@ static int bad_mode_switch(CPUARMState *env, int mode, CPSRWriteType write_type)
858
case ARM_CPU_MODE_UND:
859
case ARM_CPU_MODE_IRQ:
860
case ARM_CPU_MODE_FIQ:
861
- /* Note that we don't implement the IMPDEF NSACR.RFR which in v7
862
+ /*
863
+ * Note that we don't implement the IMPDEF NSACR.RFR which in v7
864
* allows FIQ mode to be Secure-only. (In v8 this doesn't exist.)
865
*/
866
- /* If HCR.TGE is set then changes from Monitor to NS PL1 via MSR
867
+ /*
868
+ * If HCR.TGE is set then changes from Monitor to NS PL1 via MSR
869
* and CPS are treated as illegal mode changes.
870
*/
871
if (write_type == CPSRWriteByInstr &&
872
@@ -XXX,XX +XXX,XX @@ void cpsr_write(CPUARMState *env, uint32_t val, uint32_t mask,
873
env->GE = (val >> 16) & 0xf;
874
}
875
876
- /* In a V7 implementation that includes the security extensions but does
877
+ /*
878
+ * In a V7 implementation that includes the security extensions but does
879
* not include Virtualization Extensions the SCR.FW and SCR.AW bits control
880
* whether non-secure software is allowed to change the CPSR_F and CPSR_A
881
* bits respectively.
882
@@ -XXX,XX +XXX,XX @@ void cpsr_write(CPUARMState *env, uint32_t val, uint32_t mask,
883
changed_daif = (env->daif ^ val) & mask;
884
885
if (changed_daif & CPSR_A) {
886
- /* Check to see if we are allowed to change the masking of async
887
+ /*
888
+ * Check to see if we are allowed to change the masking of async
889
* abort exceptions from a non-secure state.
890
*/
891
if (!(env->cp15.scr_el3 & SCR_AW)) {
892
@@ -XXX,XX +XXX,XX @@ void cpsr_write(CPUARMState *env, uint32_t val, uint32_t mask,
310
}
893
}
311
- sysbus_mmio_map(SYS_BUS_DEVICE(&s->spi[i]), 0, sc->info->spi_bases[i]);
894
312
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->spi[i]), 0,
895
if (changed_daif & CPSR_F) {
313
+ sc->info->memmap[ASPEED_SPI1 + i]);
896
- /* Check to see if we are allowed to change the masking of FIQ
314
sysbus_mmio_map(SYS_BUS_DEVICE(&s->spi[i]), 1,
897
+ /*
315
s->spi[i].ctrl->flash_window_base);
898
+ * Check to see if we are allowed to change the masking of FIQ
316
}
899
* exceptions from a non-secure state.
317
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
900
*/
318
error_propagate(errp, err);
901
if (!(env->cp15.scr_el3 & SCR_FW)) {
319
return;
902
@@ -XXX,XX +XXX,XX @@ void cpsr_write(CPUARMState *env, uint32_t val, uint32_t mask,
320
}
903
mask &= ~CPSR_F;
321
- sysbus_mmio_map(SYS_BUS_DEVICE(&s->sdmc), 0, ASPEED_SOC_SDMC_BASE);
904
}
322
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->sdmc), 0, sc->info->memmap[ASPEED_SDMC]);
905
323
906
- /* Check whether non-maskable FIQ (NMFI) support is enabled.
324
/* Watch dog */
907
+ /*
325
for (i = 0; i < sc->info->wdts_num; i++) {
908
+ * Check whether non-maskable FIQ (NMFI) support is enabled.
326
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
909
* If this bit is set software is not allowed to mask
327
return;
910
* FIQs, but is allowed to set CPSR_F to 0.
328
}
911
*/
329
sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt[i]), 0,
912
@@ -XXX,XX +XXX,XX @@ void cpsr_write(CPUARMState *env, uint32_t val, uint32_t mask,
330
- ASPEED_SOC_WDT_BASE + i * 0x20);
913
if (write_type != CPSRWriteRaw &&
331
+ sc->info->memmap[ASPEED_WDT] + i * 0x20);
914
((env->uncached_cpsr ^ val) & mask & CPSR_M)) {
332
}
915
if ((env->uncached_cpsr & CPSR_M) == ARM_CPU_MODE_USR) {
333
916
- /* Note that we can only get here in USR mode if this is a
334
/* Net */
917
+ /*
335
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
918
+ * Note that we can only get here in USR mode if this is a
336
error_propagate(errp, err);
919
* gdb stub write; for this case we follow the architectural
337
return;
920
* behaviour for guest writes in USR mode of ignoring an attempt
338
}
921
* to switch mode. (Those are caught by translate.c for writes
339
- sysbus_mmio_map(SYS_BUS_DEVICE(&s->ftgmac100), 0, ASPEED_SOC_ETH1_BASE);
922
@@ -XXX,XX +XXX,XX @@ void cpsr_write(CPUARMState *env, uint32_t val, uint32_t mask,
340
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->ftgmac100), 0,
923
*/
341
+ sc->info->memmap[ASPEED_ETH1]);
924
mask &= ~CPSR_M;
342
sysbus_connect_irq(SYS_BUS_DEVICE(&s->ftgmac100), 0,
925
} else if (bad_mode_switch(env, val & CPSR_M, write_type)) {
343
aspeed_soc_get_irq(s, ASPEED_ETH1));
926
- /* Attempt to switch to an invalid mode: this is UNPREDICTABLE in
344
}
927
+ /*
928
+ * Attempt to switch to an invalid mode: this is UNPREDICTABLE in
929
* v7, and has defined behaviour in v8:
930
* + leave CPSR.M untouched
931
* + allow changes to the other CPSR fields
932
@@ -XXX,XX +XXX,XX @@ static void switch_mode(CPUARMState *env, int mode)
933
env->regs[14] = env->banked_r14[r14_bank_number(mode)];
934
}
935
936
-/* Physical Interrupt Target EL Lookup Table
937
+/*
938
+ * Physical Interrupt Target EL Lookup Table
939
*
940
* [ From ARM ARM section G1.13.4 (Table G1-15) ]
941
*
942
@@ -XXX,XX +XXX,XX @@ uint32_t arm_phys_excp_target_el(CPUState *cs, uint32_t excp_idx,
943
if (arm_feature(env, ARM_FEATURE_EL3)) {
944
rw = ((env->cp15.scr_el3 & SCR_RW) == SCR_RW);
945
} else {
946
- /* Either EL2 is the highest EL (and so the EL2 register width
947
+ /*
948
+ * Either EL2 is the highest EL (and so the EL2 register width
949
* is given by is64); or there is no EL2 or EL3, in which case
950
* the value of 'rw' does not affect the table lookup anyway.
951
*/
952
@@ -XXX,XX +XXX,XX @@ void aarch64_sync_64_to_32(CPUARMState *env)
953
env->banked_r13[bank_number(ARM_CPU_MODE_UND)] = env->xregs[23];
954
}
955
956
- /* Registers x24-x30 are mapped to r8-r14 in FIQ mode. If we are in FIQ
957
+ /*
958
+ * Registers x24-x30 are mapped to r8-r14 in FIQ mode. If we are in FIQ
959
* mode, then we can copy to r8-r14. Otherwise, we copy to the
960
* FIQ bank for r8-r14.
961
*/
962
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_do_interrupt_aarch32(CPUState *cs)
963
/* High vectors. When enabled, base address cannot be remapped. */
964
addr += 0xffff0000;
965
} else {
966
- /* ARM v7 architectures provide a vector base address register to remap
967
+ /*
968
+ * ARM v7 architectures provide a vector base address register to remap
969
* the interrupt vector table.
970
* This register is only followed in non-monitor mode, and is banked.
971
* Note: only bits 31:5 are valid.
972
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_do_interrupt_aarch64(CPUState *cs)
973
aarch64_sve_change_el(env, cur_el, new_el, is_a64(env));
974
975
if (cur_el < new_el) {
976
- /* Entry vector offset depends on whether the implemented EL
977
+ /*
978
+ * Entry vector offset depends on whether the implemented EL
979
* immediately lower than the target level is using AArch32 or AArch64
980
*/
981
bool is_aa64;
982
@@ -XXX,XX +XXX,XX @@ static void handle_semihosting(CPUState *cs)
983
}
984
#endif
985
986
-/* Handle a CPU exception for A and R profile CPUs.
987
+/*
988
+ * Handle a CPU exception for A and R profile CPUs.
989
* Do any appropriate logging, handle PSCI calls, and then hand off
990
* to the AArch64-entry or AArch32-entry function depending on the
991
* target exception level's register width.
992
@@ -XXX,XX +XXX,XX @@ void arm_cpu_do_interrupt(CPUState *cs)
993
}
994
#endif
995
996
- /* Hooks may change global state so BQL should be held, also the
997
+ /*
998
+ * Hooks may change global state so BQL should be held, also the
999
* BQL needs to be held for any modification of
1000
* cs->interrupt_request.
1001
*/
1002
@@ -XXX,XX +XXX,XX @@ ARMVAParameters aa64_va_parameters(CPUARMState *env, uint64_t va,
1003
};
1004
}
1005
1006
-/* Note that signed overflow is undefined in C. The following routines are
1007
- careful to use unsigned types where modulo arithmetic is required.
1008
- Failure to do so _will_ break on newer gcc. */
1009
+/*
1010
+ * Note that signed overflow is undefined in C. The following routines are
1011
+ * careful to use unsigned types where modulo arithmetic is required.
1012
+ * Failure to do so _will_ break on newer gcc.
1013
+ */
1014
1015
/* Signed saturating arithmetic. */
1016
1017
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(sel_flags)(uint32_t flags, uint32_t a, uint32_t b)
1018
return (a & mask) | (b & ~mask);
1019
}
1020
1021
-/* CRC helpers.
1022
+/*
1023
+ * CRC helpers.
1024
* The upper bytes of val (above the number specified by 'bytes') must have
1025
* been zeroed out by the caller.
1026
*/
1027
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(crc32c)(uint32_t acc, uint32_t val, uint32_t bytes)
1028
return crc32c(acc, buf, bytes) ^ 0xffffffff;
1029
}
1030
1031
-/* Return the exception level to which FP-disabled exceptions should
1032
+/*
1033
+ * Return the exception level to which FP-disabled exceptions should
1034
* be taken, or 0 if FP is enabled.
1035
*/
1036
int fp_exception_el(CPUARMState *env, int cur_el)
1037
@@ -XXX,XX +XXX,XX @@ int fp_exception_el(CPUARMState *env, int cur_el)
1038
#ifndef CONFIG_USER_ONLY
1039
uint64_t hcr_el2;
1040
1041
- /* CPACR and the CPTR registers don't exist before v6, so FP is
1042
+ /*
1043
+ * CPACR and the CPTR registers don't exist before v6, so FP is
1044
* always accessible
1045
*/
1046
if (!arm_feature(env, ARM_FEATURE_V6)) {
1047
@@ -XXX,XX +XXX,XX @@ int fp_exception_el(CPUARMState *env, int cur_el)
1048
1049
hcr_el2 = arm_hcr_el2_eff(env);
1050
1051
- /* The CPACR controls traps to EL1, or PL1 if we're 32 bit:
1052
+ /*
1053
+ * The CPACR controls traps to EL1, or PL1 if we're 32 bit:
1054
* 0, 2 : trap EL0 and EL1/PL1 accesses
1055
* 1 : trap only EL0 accesses
1056
* 3 : trap no accesses
345
--
1057
--
346
2.20.1
1058
2.25.1
347
348
diff view generated by jsdifflib
1
From: Samuel Ortiz <sameo@linux.intel.com>
1
From: Fabiano Rosas <farosas@suse.de>
2
2
3
Those helpers are a software implementation of the ARM v8 memory zeroing
3
Fix the following:
4
op code. They should be moved to the op helper file, which is going to
5
eventually be built only when TCG is enabled.
6
4
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5
ERROR: spaces required around that '|' (ctx:VxV)
8
Reviewed-by: Robert Bradford <robert.bradford@intel.com>
6
ERROR: space required before the open parenthesis '('
9
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
7
ERROR: spaces required around that '+' (ctx:VxB)
10
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
8
ERROR: space prohibited between function name and open parenthesis '('
11
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
9
12
Message-id: 20190701132516.26392-10-philmd@redhat.com
10
(the last two still have some occurrences in macros which I left
13
[PMD: Rebased]
11
behind because it might impact readability)
14
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
12
15
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Fabiano Rosas <farosas@suse.de>
14
Reviewed-by: Claudio Fontana <cfontana@suse.de>
15
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
16
Message-id: 20221213190537.511-3-farosas@suse.de
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
---
18
---
18
target/arm/helper.c | 92 -----------------------------------------
19
target/arm/helper.c | 42 +++++++++++++++++++++---------------------
19
target/arm/op_helper.c | 93 ++++++++++++++++++++++++++++++++++++++++++
20
1 file changed, 21 insertions(+), 21 deletions(-)
20
2 files changed, 93 insertions(+), 92 deletions(-)
21
21
22
diff --git a/target/arm/helper.c b/target/arm/helper.c
22
diff --git a/target/arm/helper.c b/target/arm/helper.c
23
index XXXXXXX..XXXXXXX 100644
23
index XXXXXXX..XXXXXXX 100644
24
--- a/target/arm/helper.c
24
--- a/target/arm/helper.c
25
+++ b/target/arm/helper.c
25
+++ b/target/arm/helper.c
26
@@ -XXX,XX +XXX,XX @@ bool arm_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
26
@@ -XXX,XX +XXX,XX @@ static void add_cpreg_to_list(gpointer key, gpointer opaque)
27
#endif
27
uint32_t regidx = (uintptr_t)key;
28
}
28
const ARMCPRegInfo *ri = get_arm_cp_reginfo(cpu->cp_regs, regidx);
29
29
30
-void HELPER(dc_zva)(CPUARMState *env, uint64_t vaddr_in)
30
- if (!(ri->type & (ARM_CP_NO_RAW|ARM_CP_ALIAS))) {
31
-{
31
+ if (!(ri->type & (ARM_CP_NO_RAW | ARM_CP_ALIAS))) {
32
- /*
32
cpu->cpreg_indexes[cpu->cpreg_array_len] = cpreg_to_kvm_id(regidx);
33
- * Implement DC ZVA, which zeroes a fixed-length block of memory.
33
/* The value array need not be initialized at this point */
34
- * Note that we do not implement the (architecturally mandated)
34
cpu->cpreg_array_len++;
35
- * alignment fault for attempts to use this on Device memory
35
@@ -XXX,XX +XXX,XX @@ static void count_cpreg(gpointer key, gpointer opaque)
36
- * (which matches the usual QEMU behaviour of not implementing either
36
37
- * alignment faults or any memory attribute handling).
37
ri = g_hash_table_lookup(cpu->cp_regs, key);
38
- */
38
39
-
39
- if (!(ri->type & (ARM_CP_NO_RAW|ARM_CP_ALIAS))) {
40
- ARMCPU *cpu = env_archcpu(env);
40
+ if (!(ri->type & (ARM_CP_NO_RAW | ARM_CP_ALIAS))) {
41
- uint64_t blocklen = 4 << cpu->dcz_blocksize;
41
cpu->cpreg_array_len++;
42
- uint64_t vaddr = vaddr_in & ~(blocklen - 1);
43
-
44
-#ifndef CONFIG_USER_ONLY
45
- {
46
- /*
47
- * Slightly awkwardly, QEMU's TARGET_PAGE_SIZE may be less than
48
- * the block size so we might have to do more than one TLB lookup.
49
- * We know that in fact for any v8 CPU the page size is at least 4K
50
- * and the block size must be 2K or less, but TARGET_PAGE_SIZE is only
51
- * 1K as an artefact of legacy v5 subpage support being present in the
52
- * same QEMU executable. So in practice the hostaddr[] array has
53
- * two entries, given the current setting of TARGET_PAGE_BITS_MIN.
54
- */
55
- int maxidx = DIV_ROUND_UP(blocklen, TARGET_PAGE_SIZE);
56
- void *hostaddr[DIV_ROUND_UP(2 * KiB, 1 << TARGET_PAGE_BITS_MIN)];
57
- int try, i;
58
- unsigned mmu_idx = cpu_mmu_index(env, false);
59
- TCGMemOpIdx oi = make_memop_idx(MO_UB, mmu_idx);
60
-
61
- assert(maxidx <= ARRAY_SIZE(hostaddr));
62
-
63
- for (try = 0; try < 2; try++) {
64
-
65
- for (i = 0; i < maxidx; i++) {
66
- hostaddr[i] = tlb_vaddr_to_host(env,
67
- vaddr + TARGET_PAGE_SIZE * i,
68
- 1, mmu_idx);
69
- if (!hostaddr[i]) {
70
- break;
71
- }
72
- }
73
- if (i == maxidx) {
74
- /*
75
- * If it's all in the TLB it's fair game for just writing to;
76
- * we know we don't need to update dirty status, etc.
77
- */
78
- for (i = 0; i < maxidx - 1; i++) {
79
- memset(hostaddr[i], 0, TARGET_PAGE_SIZE);
80
- }
81
- memset(hostaddr[i], 0, blocklen - (i * TARGET_PAGE_SIZE));
82
- return;
83
- }
84
- /*
85
- * OK, try a store and see if we can populate the tlb. This
86
- * might cause an exception if the memory isn't writable,
87
- * in which case we will longjmp out of here. We must for
88
- * this purpose use the actual register value passed to us
89
- * so that we get the fault address right.
90
- */
91
- helper_ret_stb_mmu(env, vaddr_in, 0, oi, GETPC());
92
- /* Now we can populate the other TLB entries, if any */
93
- for (i = 0; i < maxidx; i++) {
94
- uint64_t va = vaddr + TARGET_PAGE_SIZE * i;
95
- if (va != (vaddr_in & TARGET_PAGE_MASK)) {
96
- helper_ret_stb_mmu(env, va, 0, oi, GETPC());
97
- }
98
- }
99
- }
100
-
101
- /*
102
- * Slow path (probably attempt to do this to an I/O device or
103
- * similar, or clearing of a block of code we have translations
104
- * cached for). Just do a series of byte writes as the architecture
105
- * demands. It's not worth trying to use a cpu_physical_memory_map(),
106
- * memset(), unmap() sequence here because:
107
- * + we'd need to account for the blocksize being larger than a page
108
- * + the direct-RAM access case is almost always going to be dealt
109
- * with in the fastpath code above, so there's no speed benefit
110
- * + we would have to deal with the map returning NULL because the
111
- * bounce buffer was in use
112
- */
113
- for (i = 0; i < blocklen; i++) {
114
- helper_ret_stb_mmu(env, vaddr + i, 0, oi, GETPC());
115
- }
116
- }
117
-#else
118
- memset(g2h(vaddr), 0, blocklen);
119
-#endif
120
-}
121
-
122
/* Note that signed overflow is undefined in C. The following routines are
123
careful to use unsigned types where modulo arithmetic is required.
124
Failure to do so _will_ break on newer gcc. */
125
diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c
126
index XXXXXXX..XXXXXXX 100644
127
--- a/target/arm/op_helper.c
128
+++ b/target/arm/op_helper.c
129
@@ -XXX,XX +XXX,XX @@
130
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
131
*/
132
#include "qemu/osdep.h"
133
+#include "qemu/units.h"
134
#include "qemu/log.h"
135
#include "qemu/main-loop.h"
136
#include "cpu.h"
137
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(ror_cc)(CPUARMState *env, uint32_t x, uint32_t i)
138
return ((uint32_t)x >> shift) | (x << (32 - shift));
139
}
42
}
140
}
43
}
141
+
44
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v6k_cp_reginfo[] = {
142
+void HELPER(dc_zva)(CPUARMState *env, uint64_t vaddr_in)
45
.resetfn = arm_cp_reset_ignore },
143
+{
46
{ .name = "TPIDRRO_EL0", .state = ARM_CP_STATE_AA64,
144
+ /*
47
.opc0 = 3, .opc1 = 3, .opc2 = 3, .crn = 13, .crm = 0,
145
+ * Implement DC ZVA, which zeroes a fixed-length block of memory.
48
- .access = PL0_R|PL1_W,
146
+ * Note that we do not implement the (architecturally mandated)
49
+ .access = PL0_R | PL1_W,
147
+ * alignment fault for attempts to use this on Device memory
50
.fieldoffset = offsetof(CPUARMState, cp15.tpidrro_el[0]),
148
+ * (which matches the usual QEMU behaviour of not implementing either
51
.resetvalue = 0},
149
+ * alignment faults or any memory attribute handling).
52
{ .name = "TPIDRURO", .cp = 15, .crn = 13, .crm = 0, .opc1 = 0, .opc2 = 3,
150
+ */
53
- .access = PL0_R|PL1_W,
151
+
54
+ .access = PL0_R | PL1_W,
152
+ ARMCPU *cpu = env_archcpu(env);
55
.bank_fieldoffsets = { offsetoflow32(CPUARMState, cp15.tpidruro_s),
153
+ uint64_t blocklen = 4 << cpu->dcz_blocksize;
56
offsetoflow32(CPUARMState, cp15.tpidruro_ns) },
154
+ uint64_t vaddr = vaddr_in & ~(blocklen - 1);
57
.resetfn = arm_cp_reset_ignore },
155
+
58
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo cache_block_ops_cp_reginfo[] = {
156
+#ifndef CONFIG_USER_ONLY
59
.resetvalue = 0 },
157
+ {
60
/* The cache ops themselves: these all NOP for QEMU */
158
+ /*
61
{ .name = "IICR", .cp = 15, .crm = 5, .opc1 = 0,
159
+ * Slightly awkwardly, QEMU's TARGET_PAGE_SIZE may be less than
62
- .access = PL1_W, .type = ARM_CP_NOP|ARM_CP_64BIT },
160
+ * the block size so we might have to do more than one TLB lookup.
63
+ .access = PL1_W, .type = ARM_CP_NOP | ARM_CP_64BIT },
161
+ * We know that in fact for any v8 CPU the page size is at least 4K
64
{ .name = "IDCR", .cp = 15, .crm = 6, .opc1 = 0,
162
+ * and the block size must be 2K or less, but TARGET_PAGE_SIZE is only
65
- .access = PL1_W, .type = ARM_CP_NOP|ARM_CP_64BIT },
163
+ * 1K as an artefact of legacy v5 subpage support being present in the
66
+ .access = PL1_W, .type = ARM_CP_NOP | ARM_CP_64BIT },
164
+ * same QEMU executable. So in practice the hostaddr[] array has
67
{ .name = "CDCR", .cp = 15, .crm = 12, .opc1 = 0,
165
+ * two entries, given the current setting of TARGET_PAGE_BITS_MIN.
68
- .access = PL0_W, .type = ARM_CP_NOP|ARM_CP_64BIT },
166
+ */
69
+ .access = PL0_W, .type = ARM_CP_NOP | ARM_CP_64BIT },
167
+ int maxidx = DIV_ROUND_UP(blocklen, TARGET_PAGE_SIZE);
70
{ .name = "PIR", .cp = 15, .crm = 12, .opc1 = 1,
168
+ void *hostaddr[DIV_ROUND_UP(2 * KiB, 1 << TARGET_PAGE_BITS_MIN)];
71
- .access = PL0_W, .type = ARM_CP_NOP|ARM_CP_64BIT },
169
+ int try, i;
72
+ .access = PL0_W, .type = ARM_CP_NOP | ARM_CP_64BIT },
170
+ unsigned mmu_idx = cpu_mmu_index(env, false);
73
{ .name = "PDR", .cp = 15, .crm = 12, .opc1 = 2,
171
+ TCGMemOpIdx oi = make_memop_idx(MO_UB, mmu_idx);
74
- .access = PL0_W, .type = ARM_CP_NOP|ARM_CP_64BIT },
172
+
75
+ .access = PL0_W, .type = ARM_CP_NOP | ARM_CP_64BIT },
173
+ assert(maxidx <= ARRAY_SIZE(hostaddr));
76
{ .name = "CIDCR", .cp = 15, .crm = 14, .opc1 = 0,
174
+
77
- .access = PL1_W, .type = ARM_CP_NOP|ARM_CP_64BIT },
175
+ for (try = 0; try < 2; try++) {
78
+ .access = PL1_W, .type = ARM_CP_NOP | ARM_CP_64BIT },
176
+
79
};
177
+ for (i = 0; i < maxidx; i++) {
80
178
+ hostaddr[i] = tlb_vaddr_to_host(env,
81
static const ARMCPRegInfo cache_test_clean_cp_reginfo[] = {
179
+ vaddr + TARGET_PAGE_SIZE * i,
82
@@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu)
180
+ 1, mmu_idx);
83
ARMCPRegInfo cbar = {
181
+ if (!hostaddr[i]) {
84
.name = "CBAR",
182
+ break;
85
.cp = 15, .crn = 15, .crm = 0, .opc1 = 4, .opc2 = 0,
183
+ }
86
- .access = PL1_R|PL3_W, .resetvalue = cpu->reset_cbar,
184
+ }
87
+ .access = PL1_R | PL3_W, .resetvalue = cpu->reset_cbar,
185
+ if (i == maxidx) {
88
.fieldoffset = offsetof(CPUARMState,
186
+ /*
89
cp15.c15_config_base_address)
187
+ * If it's all in the TLB it's fair game for just writing to;
90
};
188
+ * we know we don't need to update dirty status, etc.
91
@@ -XXX,XX +XXX,XX @@ static void switch_mode(CPUARMState *env, int mode)
189
+ */
92
return;
190
+ for (i = 0; i < maxidx - 1; i++) {
93
191
+ memset(hostaddr[i], 0, TARGET_PAGE_SIZE);
94
if (old_mode == ARM_CPU_MODE_FIQ) {
192
+ }
95
- memcpy (env->fiq_regs, env->regs + 8, 5 * sizeof(uint32_t));
193
+ memset(hostaddr[i], 0, blocklen - (i * TARGET_PAGE_SIZE));
96
- memcpy (env->regs + 8, env->usr_regs, 5 * sizeof(uint32_t));
194
+ return;
97
+ memcpy(env->fiq_regs, env->regs + 8, 5 * sizeof(uint32_t));
195
+ }
98
+ memcpy(env->regs + 8, env->usr_regs, 5 * sizeof(uint32_t));
196
+ /*
99
} else if (mode == ARM_CPU_MODE_FIQ) {
197
+ * OK, try a store and see if we can populate the tlb. This
100
- memcpy (env->usr_regs, env->regs + 8, 5 * sizeof(uint32_t));
198
+ * might cause an exception if the memory isn't writable,
101
- memcpy (env->regs + 8, env->fiq_regs, 5 * sizeof(uint32_t));
199
+ * in which case we will longjmp out of here. We must for
102
+ memcpy(env->usr_regs, env->regs + 8, 5 * sizeof(uint32_t));
200
+ * this purpose use the actual register value passed to us
103
+ memcpy(env->regs + 8, env->fiq_regs, 5 * sizeof(uint32_t));
201
+ * so that we get the fault address right.
104
}
202
+ */
105
203
+ helper_ret_stb_mmu(env, vaddr_in, 0, oi, GETPC());
106
i = bank_number(old_mode);
204
+ /* Now we can populate the other TLB entries, if any */
107
@@ -XXX,XX +XXX,XX @@ static inline uint8_t sub8_usat(uint8_t a, uint8_t b)
205
+ for (i = 0; i < maxidx; i++) {
108
RESULT(sum, n, 16); \
206
+ uint64_t va = vaddr + TARGET_PAGE_SIZE * i;
109
if (sum >= 0) \
207
+ if (va != (vaddr_in & TARGET_PAGE_MASK)) {
110
ge |= 3 << (n * 2); \
208
+ helper_ret_stb_mmu(env, va, 0, oi, GETPC());
111
- } while(0)
209
+ }
112
+ } while (0)
210
+ }
113
211
+ }
114
#define SARITH8(a, b, n, op) do { \
212
+
115
int32_t sum; \
213
+ /*
116
@@ -XXX,XX +XXX,XX @@ static inline uint8_t sub8_usat(uint8_t a, uint8_t b)
214
+ * Slow path (probably attempt to do this to an I/O device or
117
RESULT(sum, n, 8); \
215
+ * similar, or clearing of a block of code we have translations
118
if (sum >= 0) \
216
+ * cached for). Just do a series of byte writes as the architecture
119
ge |= 1 << n; \
217
+ * demands. It's not worth trying to use a cpu_physical_memory_map(),
120
- } while(0)
218
+ * memset(), unmap() sequence here because:
121
+ } while (0)
219
+ * + we'd need to account for the blocksize being larger than a page
122
220
+ * + the direct-RAM access case is almost always going to be dealt
123
221
+ * with in the fastpath code above, so there's no speed benefit
124
#define ADD16(a, b, n) SARITH16(a, b, n, +)
222
+ * + we would have to deal with the map returning NULL because the
125
@@ -XXX,XX +XXX,XX @@ static inline uint8_t sub8_usat(uint8_t a, uint8_t b)
223
+ * bounce buffer was in use
126
RESULT(sum, n, 16); \
224
+ */
127
if ((sum >> 16) == 1) \
225
+ for (i = 0; i < blocklen; i++) {
128
ge |= 3 << (n * 2); \
226
+ helper_ret_stb_mmu(env, vaddr + i, 0, oi, GETPC());
129
- } while(0)
227
+ }
130
+ } while (0)
228
+ }
131
229
+#else
132
#define ADD8(a, b, n) do { \
230
+ memset(g2h(vaddr), 0, blocklen);
133
uint32_t sum; \
231
+#endif
134
@@ -XXX,XX +XXX,XX @@ static inline uint8_t sub8_usat(uint8_t a, uint8_t b)
232
+}
135
RESULT(sum, n, 8); \
136
if ((sum >> 8) == 1) \
137
ge |= 1 << n; \
138
- } while(0)
139
+ } while (0)
140
141
#define SUB16(a, b, n) do { \
142
uint32_t sum; \
143
@@ -XXX,XX +XXX,XX @@ static inline uint8_t sub8_usat(uint8_t a, uint8_t b)
144
RESULT(sum, n, 16); \
145
if ((sum >> 16) == 0) \
146
ge |= 3 << (n * 2); \
147
- } while(0)
148
+ } while (0)
149
150
#define SUB8(a, b, n) do { \
151
uint32_t sum; \
152
@@ -XXX,XX +XXX,XX @@ static inline uint8_t sub8_usat(uint8_t a, uint8_t b)
153
RESULT(sum, n, 8); \
154
if ((sum >> 8) == 0) \
155
ge |= 1 << n; \
156
- } while(0)
157
+ } while (0)
158
159
#define PFX u
160
#define ARITH_GE
233
--
161
--
234
2.20.1
162
2.25.1
235
236
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
From: Fabiano Rosas <farosas@suse.de>
2
2
3
Since commit 8c06fbdf36b checkpatch.pl enforce a new multiline
3
Fix this:
4
comment syntax. Since we'll move this code around, fix its style
4
ERROR: braces {} are necessary for all arms of this statement
5
first.
6
5
7
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
6
Signed-off-by: Fabiano Rosas <farosas@suse.de>
8
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
7
Reviewed-by: Claudio Fontana <cfontana@suse.de>
9
Message-id: 20190701132516.26392-8-philmd@redhat.com
8
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
9
Message-id: 20221213190537.511-4-farosas@suse.de
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
11
---
12
target/arm/helper.c | 237 ++++++++++++++++++++++++++--------------
12
target/arm/helper.c | 67 ++++++++++++++++++++++++++++-----------------
13
target/arm/op_helper.c | 54 ++++++---
13
1 file changed, 42 insertions(+), 25 deletions(-)
14
target/arm/vfp_helper.c | 3 +-
15
3 files changed, 196 insertions(+), 98 deletions(-)
16
14
17
diff --git a/target/arm/helper.c b/target/arm/helper.c
15
diff --git a/target/arm/helper.c b/target/arm/helper.c
18
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
19
--- a/target/arm/helper.c
17
--- a/target/arm/helper.c
20
+++ b/target/arm/helper.c
18
+++ b/target/arm/helper.c
21
@@ -XXX,XX +XXX,XX @@ void HELPER(v7m_vlldm)(CPUARMState *env, uint32_t fptr)
19
@@ -XXX,XX +XXX,XX @@ void cpsr_write(CPUARMState *env, uint32_t val, uint32_t mask,
22
20
env->CF = (val >> 29) & 1;
23
uint32_t HELPER(v7m_tt)(CPUARMState *env, uint32_t addr, uint32_t op)
21
env->VF = (val << 3) & 0x80000000;
22
}
23
- if (mask & CPSR_Q)
24
+ if (mask & CPSR_Q) {
25
env->QF = ((val & CPSR_Q) != 0);
26
- if (mask & CPSR_T)
27
+ }
28
+ if (mask & CPSR_T) {
29
env->thumb = ((val & CPSR_T) != 0);
30
+ }
31
if (mask & CPSR_IT_0_1) {
32
env->condexec_bits &= ~3;
33
env->condexec_bits |= (val >> 25) & 3;
34
@@ -XXX,XX +XXX,XX @@ static void switch_mode(CPUARMState *env, int mode)
35
int i;
36
37
old_mode = env->uncached_cpsr & CPSR_M;
38
- if (mode == old_mode)
39
+ if (mode == old_mode) {
40
return;
41
+ }
42
43
if (old_mode == ARM_CPU_MODE_FIQ) {
44
memcpy(env->fiq_regs, env->regs + 8, 5 * sizeof(uint32_t));
45
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_do_interrupt_aarch32(CPUState *cs)
46
new_mode = ARM_CPU_MODE_UND;
47
addr = 0x04;
48
mask = CPSR_I;
49
- if (env->thumb)
50
+ if (env->thumb) {
51
offset = 2;
52
- else
53
+ } else {
54
offset = 4;
55
+ }
56
break;
57
case EXCP_SWI:
58
new_mode = ARM_CPU_MODE_SVC;
59
@@ -XXX,XX +XXX,XX @@ static inline uint16_t add16_sat(uint16_t a, uint16_t b)
60
61
res = a + b;
62
if (((res ^ a) & 0x8000) && !((a ^ b) & 0x8000)) {
63
- if (a & 0x8000)
64
+ if (a & 0x8000) {
65
res = 0x8000;
66
- else
67
+ } else {
68
res = 0x7fff;
69
+ }
70
}
71
return res;
72
}
73
@@ -XXX,XX +XXX,XX @@ static inline uint8_t add8_sat(uint8_t a, uint8_t b)
74
75
res = a + b;
76
if (((res ^ a) & 0x80) && !((a ^ b) & 0x80)) {
77
- if (a & 0x80)
78
+ if (a & 0x80) {
79
res = 0x80;
80
- else
81
+ } else {
82
res = 0x7f;
83
+ }
84
}
85
return res;
86
}
87
@@ -XXX,XX +XXX,XX @@ static inline uint16_t sub16_sat(uint16_t a, uint16_t b)
88
89
res = a - b;
90
if (((res ^ a) & 0x8000) && ((a ^ b) & 0x8000)) {
91
- if (a & 0x8000)
92
+ if (a & 0x8000) {
93
res = 0x8000;
94
- else
95
+ } else {
96
res = 0x7fff;
97
+ }
98
}
99
return res;
100
}
101
@@ -XXX,XX +XXX,XX @@ static inline uint8_t sub8_sat(uint8_t a, uint8_t b)
102
103
res = a - b;
104
if (((res ^ a) & 0x80) && ((a ^ b) & 0x80)) {
105
- if (a & 0x80)
106
+ if (a & 0x80) {
107
res = 0x80;
108
- else
109
+ } else {
110
res = 0x7f;
111
+ }
112
}
113
return res;
114
}
115
@@ -XXX,XX +XXX,XX @@ static inline uint16_t add16_usat(uint16_t a, uint16_t b)
24
{
116
{
25
- /* The TT instructions can be used by unprivileged code, but in
117
uint16_t res;
26
+ /*
118
res = a + b;
27
+ * The TT instructions can be used by unprivileged code, but in
119
- if (res < a)
28
* user-only emulation we don't have the MPU.
120
+ if (res < a) {
29
* Luckily since we know we are NonSecure unprivileged (and that in
121
res = 0xffff;
30
* turn means that the A flag wasn't specified), all the bits in the
122
+ }
31
@@ -XXX,XX +XXX,XX @@ static bool v7m_stack_write(ARMCPU *cpu, uint32_t addr, uint32_t value,
123
return res;
32
return true;
33
34
pend_fault:
35
- /* By pending the exception at this point we are making
36
+ /*
37
+ * By pending the exception at this point we are making
38
* the IMPDEF choice "overridden exceptions pended" (see the
39
* MergeExcInfo() pseudocode). The other choice would be to not
40
* pend them now and then make a choice about which to throw away
41
@@ -XXX,XX +XXX,XX @@ static bool v7m_stack_read(ARMCPU *cpu, uint32_t *dest, uint32_t addr,
42
return true;
43
44
pend_fault:
45
- /* By pending the exception at this point we are making
46
+ /*
47
+ * By pending the exception at this point we are making
48
* the IMPDEF choice "overridden exceptions pended" (see the
49
* MergeExcInfo() pseudocode). The other choice would be to not
50
* pend them now and then make a choice about which to throw away
51
@@ -XXX,XX +XXX,XX @@ void HELPER(v7m_preserve_fp_state)(CPUARMState *env)
52
*/
53
}
124
}
54
125
55
-/* Write to v7M CONTROL.SPSEL bit for the specified security bank.
126
static inline uint16_t sub16_usat(uint16_t a, uint16_t b)
56
+/*
127
{
57
+ * Write to v7M CONTROL.SPSEL bit for the specified security bank.
128
- if (a > b)
58
* This may change the current stack pointer between Main and Process
129
+ if (a > b) {
59
* stack pointers if it is done for the CONTROL register for the current
130
return a - b;
60
* security state.
131
- else
61
@@ -XXX,XX +XXX,XX @@ static void write_v7m_control_spsel_for_secstate(CPUARMState *env,
132
+ } else {
62
}
133
return 0;
134
+ }
63
}
135
}
64
136
65
-/* Write to v7M CONTROL.SPSEL bit. This may change the current
137
static inline uint8_t add8_usat(uint8_t a, uint8_t b)
66
+/*
67
+ * Write to v7M CONTROL.SPSEL bit. This may change the current
68
* stack pointer between Main and Process stack pointers.
69
*/
70
static void write_v7m_control_spsel(CPUARMState *env, bool new_spsel)
71
@@ -XXX,XX +XXX,XX @@ static void write_v7m_control_spsel(CPUARMState *env, bool new_spsel)
72
73
void write_v7m_exception(CPUARMState *env, uint32_t new_exc)
74
{
138
{
75
- /* Write a new value to v7m.exception, thus transitioning into or out
139
uint8_t res;
76
+ /*
140
res = a + b;
77
+ * Write a new value to v7m.exception, thus transitioning into or out
141
- if (res < a)
78
* of Handler mode; this may result in a change of active stack pointer.
142
+ if (res < a) {
79
*/
143
res = 0xff;
80
bool new_is_psp, old_is_psp = v7m_using_psp(env);
144
+ }
81
@@ -XXX,XX +XXX,XX @@ static void switch_v7m_security_state(CPUARMState *env, bool new_secstate)
145
return res;
82
return;
146
}
83
}
147
84
148
static inline uint8_t sub8_usat(uint8_t a, uint8_t b)
85
- /* All the banked state is accessed by looking at env->v7m.secure
86
+ /*
87
+ * All the banked state is accessed by looking at env->v7m.secure
88
* except for the stack pointer; rearrange the SP appropriately.
89
*/
90
new_ss_msp = env->v7m.other_ss_msp;
91
@@ -XXX,XX +XXX,XX @@ static void switch_v7m_security_state(CPUARMState *env, bool new_secstate)
92
93
void HELPER(v7m_bxns)(CPUARMState *env, uint32_t dest)
94
{
149
{
95
- /* Handle v7M BXNS:
150
- if (a > b)
96
+ /*
151
+ if (a > b) {
97
+ * Handle v7M BXNS:
152
return a - b;
98
* - if the return value is a magic value, do exception return (like BX)
153
- else
99
* - otherwise bit 0 of the return value is the target security state
154
+ } else {
100
*/
155
return 0;
101
@@ -XXX,XX +XXX,XX @@ void HELPER(v7m_bxns)(CPUARMState *env, uint32_t dest)
156
+ }
102
}
157
}
103
158
104
if (dest >= min_magic) {
159
#define ADD16(a, b, n) RESULT(add16_usat(a, b), n, 16);
105
- /* This is an exception return magic value; put it where
160
@@ -XXX,XX +XXX,XX @@ static inline uint8_t sub8_usat(uint8_t a, uint8_t b)
106
+ /*
161
107
+ * This is an exception return magic value; put it where
162
static inline uint8_t do_usad(uint8_t a, uint8_t b)
108
* do_v7m_exception_exit() expects and raise EXCEPTION_EXIT.
109
* Note that if we ever add gen_ss_advance() singlestep support to
110
* M profile this should count as an "instruction execution complete"
111
@@ -XXX,XX +XXX,XX @@ void HELPER(v7m_bxns)(CPUARMState *env, uint32_t dest)
112
113
void HELPER(v7m_blxns)(CPUARMState *env, uint32_t dest)
114
{
163
{
115
- /* Handle v7M BLXNS:
164
- if (a > b)
116
+ /*
165
+ if (a > b) {
117
+ * Handle v7M BLXNS:
166
return a - b;
118
* - bit 0 of the destination address is the target security state
167
- else
119
*/
168
+ } else {
120
169
return b - a;
121
@@ -XXX,XX +XXX,XX @@ void HELPER(v7m_blxns)(CPUARMState *env, uint32_t dest)
170
+ }
122
assert(env->v7m.secure);
123
124
if (dest & 1) {
125
- /* target is Secure, so this is just a normal BLX,
126
+ /*
127
+ * Target is Secure, so this is just a normal BLX,
128
* except that the low bit doesn't indicate Thumb/not.
129
*/
130
env->regs[14] = nextinst;
131
@@ -XXX,XX +XXX,XX @@ void HELPER(v7m_blxns)(CPUARMState *env, uint32_t dest)
132
env->regs[13] = sp;
133
env->regs[14] = 0xfeffffff;
134
if (arm_v7m_is_handler_mode(env)) {
135
- /* Write a dummy value to IPSR, to avoid leaking the current secure
136
+ /*
137
+ * Write a dummy value to IPSR, to avoid leaking the current secure
138
* exception number to non-secure code. This is guaranteed not
139
* to cause write_v7m_exception() to actually change stacks.
140
*/
141
@@ -XXX,XX +XXX,XX @@ void HELPER(v7m_blxns)(CPUARMState *env, uint32_t dest)
142
static uint32_t *get_v7m_sp_ptr(CPUARMState *env, bool secure, bool threadmode,
143
bool spsel)
144
{
145
- /* Return a pointer to the location where we currently store the
146
+ /*
147
+ * Return a pointer to the location where we currently store the
148
* stack pointer for the requested security state and thread mode.
149
* This pointer will become invalid if the CPU state is updated
150
* such that the stack pointers are switched around (eg changing
151
@@ -XXX,XX +XXX,XX @@ static bool arm_v7m_load_vector(ARMCPU *cpu, int exc, bool targets_secure,
152
153
mmu_idx = arm_v7m_mmu_idx_for_secstate_and_priv(env, targets_secure, true);
154
155
- /* We don't do a get_phys_addr() here because the rules for vector
156
+ /*
157
+ * We don't do a get_phys_addr() here because the rules for vector
158
* loads are special: they always use the default memory map, and
159
* the default memory map permits reads from all addresses.
160
* Since there's no easy way to pass through to pmsav8_mpu_lookup()
161
@@ -XXX,XX +XXX,XX @@ static bool arm_v7m_load_vector(ARMCPU *cpu, int exc, bool targets_secure,
162
return true;
163
164
load_fail:
165
- /* All vector table fetch fails are reported as HardFault, with
166
+ /*
167
+ * All vector table fetch fails are reported as HardFault, with
168
* HFSR.VECTTBL and .FORCED set. (FORCED is set because
169
* technically the underlying exception is a MemManage or BusFault
170
* that is escalated to HardFault.) This is a terminal exception,
171
@@ -XXX,XX +XXX,XX @@ static uint32_t v7m_integrity_sig(CPUARMState *env, uint32_t lr)
172
static bool v7m_push_callee_stack(ARMCPU *cpu, uint32_t lr, bool dotailchain,
173
bool ignore_faults)
174
{
175
- /* For v8M, push the callee-saves register part of the stack frame.
176
+ /*
177
+ * For v8M, push the callee-saves register part of the stack frame.
178
* Compare the v8M pseudocode PushCalleeStack().
179
* In the tailchaining case this may not be the current stack.
180
*/
181
@@ -XXX,XX +XXX,XX @@ static bool v7m_push_callee_stack(ARMCPU *cpu, uint32_t lr, bool dotailchain,
182
return true;
183
}
184
185
- /* Write as much of the stack frame as we can. A write failure may
186
+ /*
187
+ * Write as much of the stack frame as we can. A write failure may
188
* cause us to pend a derived exception.
189
*/
190
sig = v7m_integrity_sig(env, lr);
191
@@ -XXX,XX +XXX,XX @@ static bool v7m_push_callee_stack(ARMCPU *cpu, uint32_t lr, bool dotailchain,
192
static void v7m_exception_taken(ARMCPU *cpu, uint32_t lr, bool dotailchain,
193
bool ignore_stackfaults)
194
{
195
- /* Do the "take the exception" parts of exception entry,
196
+ /*
197
+ * Do the "take the exception" parts of exception entry,
198
* but not the pushing of state to the stack. This is
199
* similar to the pseudocode ExceptionTaken() function.
200
*/
201
@@ -XXX,XX +XXX,XX @@ static void v7m_exception_taken(ARMCPU *cpu, uint32_t lr, bool dotailchain,
202
if (arm_feature(env, ARM_FEATURE_V8)) {
203
if (arm_feature(env, ARM_FEATURE_M_SECURITY) &&
204
(lr & R_V7M_EXCRET_S_MASK)) {
205
- /* The background code (the owner of the registers in the
206
+ /*
207
+ * The background code (the owner of the registers in the
208
* exception frame) is Secure. This means it may either already
209
* have or now needs to push callee-saves registers.
210
*/
211
if (targets_secure) {
212
if (dotailchain && !(lr & R_V7M_EXCRET_ES_MASK)) {
213
- /* We took an exception from Secure to NonSecure
214
+ /*
215
+ * We took an exception from Secure to NonSecure
216
* (which means the callee-saved registers got stacked)
217
* and are now tailchaining to a Secure exception.
218
* Clear DCRS so eventual return from this Secure
219
@@ -XXX,XX +XXX,XX @@ static void v7m_exception_taken(ARMCPU *cpu, uint32_t lr, bool dotailchain,
220
lr &= ~R_V7M_EXCRET_DCRS_MASK;
221
}
222
} else {
223
- /* We're going to a non-secure exception; push the
224
+ /*
225
+ * We're going to a non-secure exception; push the
226
* callee-saves registers to the stack now, if they're
227
* not already saved.
228
*/
229
@@ -XXX,XX +XXX,XX @@ static void v7m_exception_taken(ARMCPU *cpu, uint32_t lr, bool dotailchain,
230
lr |= R_V7M_EXCRET_SPSEL_MASK;
231
}
232
233
- /* Clear registers if necessary to prevent non-secure exception
234
+ /*
235
+ * Clear registers if necessary to prevent non-secure exception
236
* code being able to see register values from secure code.
237
* Where register values become architecturally UNKNOWN we leave
238
* them with their previous values.
239
*/
240
if (arm_feature(env, ARM_FEATURE_M_SECURITY)) {
241
if (!targets_secure) {
242
- /* Always clear the caller-saved registers (they have been
243
+ /*
244
+ * Always clear the caller-saved registers (they have been
245
* pushed to the stack earlier in v7m_push_stack()).
246
* Clear callee-saved registers if the background code is
247
* Secure (in which case these regs were saved in
248
@@ -XXX,XX +XXX,XX @@ static void v7m_exception_taken(ARMCPU *cpu, uint32_t lr, bool dotailchain,
249
}
250
251
if (push_failed && !ignore_stackfaults) {
252
- /* Derived exception on callee-saves register stacking:
253
+ /*
254
+ * Derived exception on callee-saves register stacking:
255
* we might now want to take a different exception which
256
* targets a different security state, so try again from the top.
257
*/
258
@@ -XXX,XX +XXX,XX @@ static void v7m_exception_taken(ARMCPU *cpu, uint32_t lr, bool dotailchain,
259
return;
260
}
261
262
- /* Now we've done everything that might cause a derived exception
263
+ /*
264
+ * Now we've done everything that might cause a derived exception
265
* we can go ahead and activate whichever exception we're going to
266
* take (which might now be the derived exception).
267
*/
268
@@ -XXX,XX +XXX,XX @@ void HELPER(v7m_vlldm)(CPUARMState *env, uint32_t fptr)
269
270
static bool v7m_push_stack(ARMCPU *cpu)
271
{
272
- /* Do the "set up stack frame" part of exception entry,
273
+ /*
274
+ * Do the "set up stack frame" part of exception entry,
275
* similar to pseudocode PushStack().
276
* Return true if we generate a derived exception (and so
277
* should ignore further stack faults trying to process
278
@@ -XXX,XX +XXX,XX @@ static bool v7m_push_stack(ARMCPU *cpu)
279
}
280
}
281
282
- /* Write as much of the stack frame as we can. If we fail a stack
283
+ /*
284
+ * Write as much of the stack frame as we can. If we fail a stack
285
* write this will result in a derived exception being pended
286
* (which may be taken in preference to the one we started with
287
* if it has higher priority).
288
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
289
bool ftype;
290
bool restore_s16_s31;
291
292
- /* If we're not in Handler mode then jumps to magic exception-exit
293
+ /*
294
+ * If we're not in Handler mode then jumps to magic exception-exit
295
* addresses don't have magic behaviour. However for the v8M
296
* security extensions the magic secure-function-return has to
297
* work in thread mode too, so to avoid doing an extra check in
298
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
299
return;
300
}
301
302
- /* In the spec pseudocode ExceptionReturn() is called directly
303
+ /*
304
+ * In the spec pseudocode ExceptionReturn() is called directly
305
* from BXWritePC() and gets the full target PC value including
306
* bit zero. In QEMU's implementation we treat it as a normal
307
* jump-to-register (which is then caught later on), and so split
308
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
309
}
310
311
if (arm_feature(env, ARM_FEATURE_M_SECURITY)) {
312
- /* EXC_RETURN.ES validation check (R_SMFL). We must do this before
313
+ /*
314
+ * EXC_RETURN.ES validation check (R_SMFL). We must do this before
315
* we pick which FAULTMASK to clear.
316
*/
317
if (!env->v7m.secure &&
318
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
319
}
320
321
if (env->v7m.exception != ARMV7M_EXCP_NMI) {
322
- /* Auto-clear FAULTMASK on return from other than NMI.
323
+ /*
324
+ * Auto-clear FAULTMASK on return from other than NMI.
325
* If the security extension is implemented then this only
326
* happens if the raw execution priority is >= 0; the
327
* value of the ES bit in the exception return value indicates
328
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
329
/* still an irq active now */
330
break;
331
case 1:
332
- /* we returned to base exception level, no nesting.
333
+ /*
334
+ * We returned to base exception level, no nesting.
335
* (In the pseudocode this is written using "NestedActivation != 1"
336
* where we have 'rettobase == false'.)
337
*/
338
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
339
340
if (arm_feature(env, ARM_FEATURE_V8)) {
341
if (!arm_feature(env, ARM_FEATURE_M_SECURITY)) {
342
- /* UNPREDICTABLE if S == 1 or DCRS == 0 or ES == 1 (R_XLCP);
343
+ /*
344
+ * UNPREDICTABLE if S == 1 or DCRS == 0 or ES == 1 (R_XLCP);
345
* we choose to take the UsageFault.
346
*/
347
if ((excret & R_V7M_EXCRET_S_MASK) ||
348
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
349
break;
350
case 13: /* Return to Thread using Process stack */
351
case 9: /* Return to Thread using Main stack */
352
- /* We only need to check NONBASETHRDENA for v7M, because in
353
+ /*
354
+ * We only need to check NONBASETHRDENA for v7M, because in
355
* v8M this bit does not exist (it is RES1).
356
*/
357
if (!rettobase &&
358
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
359
}
360
361
if (ufault) {
362
- /* Bad exception return: instead of popping the exception
363
+ /*
364
+ * Bad exception return: instead of popping the exception
365
* stack, directly take a usage fault on the current stack.
366
*/
367
env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_INVPC_MASK;
368
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
369
switch_v7m_security_state(env, return_to_secure);
370
371
{
372
- /* The stack pointer we should be reading the exception frame from
373
+ /*
374
+ * The stack pointer we should be reading the exception frame from
375
* depends on bits in the magic exception return type value (and
376
* for v8M isn't necessarily the stack pointer we will eventually
377
* end up resuming execution with). Get a pointer to the location
378
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
379
v7m_stack_read(cpu, &xpsr, frameptr + 0x1c, mmu_idx);
380
381
if (!pop_ok) {
382
- /* v7m_stack_read() pended a fault, so take it (as a tail
383
+ /*
384
+ * v7m_stack_read() pended a fault, so take it (as a tail
385
* chained exception on the same stack frame)
386
*/
387
qemu_log_mask(CPU_LOG_INT, "...derived exception on unstacking\n");
388
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
389
return;
390
}
391
392
- /* Returning from an exception with a PC with bit 0 set is defined
393
+ /*
394
+ * Returning from an exception with a PC with bit 0 set is defined
395
* behaviour on v8M (bit 0 is ignored), but for v7M it was specified
396
* to be UNPREDICTABLE. In practice actual v7M hardware seems to ignore
397
* the lsbit, and there are several RTOSes out there which incorrectly
398
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
399
}
400
401
if (arm_feature(env, ARM_FEATURE_V8)) {
402
- /* For v8M we have to check whether the xPSR exception field
403
+ /*
404
+ * For v8M we have to check whether the xPSR exception field
405
* matches the EXCRET value for return to handler/thread
406
* before we commit to changing the SP and xPSR.
407
*/
408
bool will_be_handler = (xpsr & XPSR_EXCP) != 0;
409
if (return_to_handler != will_be_handler) {
410
- /* Take an INVPC UsageFault on the current stack.
411
+ /*
412
+ * Take an INVPC UsageFault on the current stack.
413
* By this point we will have switched to the security state
414
* for the background state, so this UsageFault will target
415
* that state.
416
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
417
frameptr += 0x40;
418
}
419
}
420
- /* Undo stack alignment (the SPREALIGN bit indicates that the original
421
+ /*
422
+ * Undo stack alignment (the SPREALIGN bit indicates that the original
423
* pre-exception SP was not 8-aligned and we added a padding word to
424
* align it, so we undo this by ORing in the bit that increases it
425
* from the current 8-aligned value to the 8-unaligned value. (Adding 4
426
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
427
V7M_CONTROL, SFPA, sfpa);
428
}
429
430
- /* The restored xPSR exception field will be zero if we're
431
+ /*
432
+ * The restored xPSR exception field will be zero if we're
433
* resuming in Thread mode. If that doesn't match what the
434
* exception return excret specified then this is a UsageFault.
435
* v7M requires we make this check here; v8M did it earlier.
436
*/
437
if (return_to_handler != arm_v7m_is_handler_mode(env)) {
438
- /* Take an INVPC UsageFault by pushing the stack again;
439
+ /*
440
+ * Take an INVPC UsageFault by pushing the stack again;
441
* we know we're v7M so this is never a Secure UsageFault.
442
*/
443
bool ignore_stackfaults;
444
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
445
446
static bool do_v7m_function_return(ARMCPU *cpu)
447
{
448
- /* v8M security extensions magic function return.
449
+ /*
450
+ * v8M security extensions magic function return.
451
* We may either:
452
* (1) throw an exception (longjump)
453
* (2) return true if we successfully handled the function return
454
@@ -XXX,XX +XXX,XX @@ static bool do_v7m_function_return(ARMCPU *cpu)
455
frame_sp_p = get_v7m_sp_ptr(env, true, threadmode, spsel);
456
frameptr = *frame_sp_p;
457
458
- /* These loads may throw an exception (for MPU faults). We want to
459
+ /*
460
+ * These loads may throw an exception (for MPU faults). We want to
461
* do them as secure, so work out what MMU index that is.
462
*/
463
mmu_idx = arm_v7m_mmu_idx_for_secstate(env, true);
464
@@ -XXX,XX +XXX,XX @@ static void arm_log_exception(int idx)
465
static bool v7m_read_half_insn(ARMCPU *cpu, ARMMMUIdx mmu_idx,
466
uint32_t addr, uint16_t *insn)
467
{
468
- /* Load a 16-bit portion of a v7M instruction, returning true on success,
469
+ /*
470
+ * Load a 16-bit portion of a v7M instruction, returning true on success,
471
* or false on failure (in which case we will have pended the appropriate
472
* exception).
473
* We need to do the instruction fetch's MPU and SAU checks
474
@@ -XXX,XX +XXX,XX @@ static bool v7m_read_half_insn(ARMCPU *cpu, ARMMMUIdx mmu_idx,
475
476
v8m_security_lookup(env, addr, MMU_INST_FETCH, mmu_idx, &sattrs);
477
if (!sattrs.nsc || sattrs.ns) {
478
- /* This must be the second half of the insn, and it straddles a
479
+ /*
480
+ * This must be the second half of the insn, and it straddles a
481
* region boundary with the second half not being S&NSC.
482
*/
483
env->v7m.sfsr |= R_V7M_SFSR_INVEP_MASK;
484
@@ -XXX,XX +XXX,XX @@ static bool v7m_read_half_insn(ARMCPU *cpu, ARMMMUIdx mmu_idx,
485
486
static bool v7m_handle_execute_nsc(ARMCPU *cpu)
487
{
488
- /* Check whether this attempt to execute code in a Secure & NS-Callable
489
+ /*
490
+ * Check whether this attempt to execute code in a Secure & NS-Callable
491
* memory region is for an SG instruction; if so, then emulate the
492
* effect of the SG instruction and return true. Otherwise pend
493
* the correct kind of exception and return false.
494
@@ -XXX,XX +XXX,XX @@ static bool v7m_handle_execute_nsc(ARMCPU *cpu)
495
ARMMMUIdx mmu_idx;
496
uint16_t insn;
497
498
- /* We should never get here unless get_phys_addr_pmsav8() caused
499
+ /*
500
+ * We should never get here unless get_phys_addr_pmsav8() caused
501
* an exception for NS executing in S&NSC memory.
502
*/
503
assert(!env->v7m.secure);
504
@@ -XXX,XX +XXX,XX @@ static bool v7m_handle_execute_nsc(ARMCPU *cpu)
505
}
506
507
if (insn != 0xe97f) {
508
- /* Not an SG instruction first half (we choose the IMPDEF
509
+ /*
510
+ * Not an SG instruction first half (we choose the IMPDEF
511
* early-SG-check option).
512
*/
513
goto gen_invep;
514
@@ -XXX,XX +XXX,XX @@ static bool v7m_handle_execute_nsc(ARMCPU *cpu)
515
}
516
517
if (insn != 0xe97f) {
518
- /* Not an SG instruction second half (yes, both halves of the SG
519
+ /*
520
+ * Not an SG instruction second half (yes, both halves of the SG
521
* insn have the same hex value)
522
*/
523
goto gen_invep;
524
}
525
526
- /* OK, we have confirmed that we really have an SG instruction.
527
+ /*
528
+ * OK, we have confirmed that we really have an SG instruction.
529
* We know we're NS in S memory so don't need to repeat those checks.
530
*/
531
qemu_log_mask(CPU_LOG_INT, "...really an SG instruction at 0x%08" PRIx32
532
@@ -XXX,XX +XXX,XX @@ void arm_v7m_cpu_do_interrupt(CPUState *cs)
533
534
arm_log_exception(cs->exception_index);
535
536
- /* For exceptions we just mark as pending on the NVIC, and let that
537
- handle it. */
538
+ /*
539
+ * For exceptions we just mark as pending on the NVIC, and let that
540
+ * handle it.
541
+ */
542
switch (cs->exception_index) {
543
case EXCP_UDEF:
544
armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE, env->v7m.secure);
545
@@ -XXX,XX +XXX,XX @@ void arm_v7m_cpu_do_interrupt(CPUState *cs)
546
break;
547
case EXCP_PREFETCH_ABORT:
548
case EXCP_DATA_ABORT:
549
- /* Note that for M profile we don't have a guest facing FSR, but
550
+ /*
551
+ * Note that for M profile we don't have a guest facing FSR, but
552
* the env->exception.fsr will be populated by the code that
553
* raises the fault, in the A profile short-descriptor format.
554
*/
555
switch (env->exception.fsr & 0xf) {
556
case M_FAKE_FSR_NSC_EXEC:
557
- /* Exception generated when we try to execute code at an address
558
+ /*
559
+ * Exception generated when we try to execute code at an address
560
* which is marked as Secure & Non-Secure Callable and the CPU
561
* is in the Non-Secure state. The only instruction which can
562
* be executed like this is SG (and that only if both halves of
563
@@ -XXX,XX +XXX,XX @@ void arm_v7m_cpu_do_interrupt(CPUState *cs)
564
}
565
break;
566
case M_FAKE_FSR_SFAULT:
567
- /* Various flavours of SecureFault for attempts to execute or
568
+ /*
569
+ * Various flavours of SecureFault for attempts to execute or
570
* access data in the wrong security state.
571
*/
572
switch (cs->exception_index) {
573
@@ -XXX,XX +XXX,XX @@ void arm_v7m_cpu_do_interrupt(CPUState *cs)
574
armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_BUS, false);
575
break;
576
default:
577
- /* All other FSR values are either MPU faults or "can't happen
578
+ /*
579
+ * All other FSR values are either MPU faults or "can't happen
580
* for M profile" cases.
581
*/
582
switch (cs->exception_index) {
583
@@ -XXX,XX +XXX,XX @@ void arm_v7m_cpu_do_interrupt(CPUState *cs)
584
if (arm_feature(env, ARM_FEATURE_V8)) {
585
lr = R_V7M_EXCRET_RES1_MASK |
586
R_V7M_EXCRET_DCRS_MASK;
587
- /* The S bit indicates whether we should return to Secure
588
+ /*
589
+ * The S bit indicates whether we should return to Secure
590
* or NonSecure (ie our current state).
591
* The ES bit indicates whether we're taking this exception
592
* to Secure or NonSecure (ie our target state). We set it
593
@@ -XXX,XX +XXX,XX @@ void arm_v7m_cpu_do_interrupt(CPUState *cs)
594
v7m_exception_taken(cpu, lr, false, ignore_stackfaults);
595
}
171
}
596
172
597
-/* Function used to synchronize QEMU's AArch64 register set with AArch32
173
/* Unsigned sum of absolute byte differences. */
598
+/*
174
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(sel_flags)(uint32_t flags, uint32_t a, uint32_t b)
599
+ * Function used to synchronize QEMU's AArch64 register set with AArch32
175
uint32_t mask;
600
* register set. This is necessary when switching between AArch32 and AArch64
176
601
* execution state.
177
mask = 0;
602
*/
178
- if (flags & 1)
603
@@ -XXX,XX +XXX,XX @@ void aarch64_sync_32_to_64(CPUARMState *env)
179
+ if (flags & 1) {
604
env->xregs[i] = env->regs[i];
180
mask |= 0xff;
605
}
181
- if (flags & 2)
606
182
+ }
607
- /* Unless we are in FIQ mode, x8-x12 come from the user registers r8-r12.
183
+ if (flags & 2) {
608
+ /*
184
mask |= 0xff00;
609
+ * Unless we are in FIQ mode, x8-x12 come from the user registers r8-r12.
185
- if (flags & 4)
610
* Otherwise, they come from the banked user regs.
186
+ }
611
*/
187
+ if (flags & 4) {
612
if (mode == ARM_CPU_MODE_FIQ) {
188
mask |= 0xff0000;
613
@@ -XXX,XX +XXX,XX @@ void aarch64_sync_32_to_64(CPUARMState *env)
189
- if (flags & 8)
614
}
190
+ }
615
}
191
+ if (flags & 8) {
616
192
mask |= 0xff000000;
617
- /* Registers x13-x23 are the various mode SP and FP registers. Registers
193
+ }
618
+ /*
194
return (a & mask) | (b & ~mask);
619
+ * Registers x13-x23 are the various mode SP and FP registers. Registers
620
* r13 and r14 are only copied if we are in that mode, otherwise we copy
621
* from the mode banked register.
622
*/
623
@@ -XXX,XX +XXX,XX @@ void aarch64_sync_32_to_64(CPUARMState *env)
624
env->xregs[23] = env->banked_r13[bank_number(ARM_CPU_MODE_UND)];
625
}
626
627
- /* Registers x24-x30 are mapped to r8-r14 in FIQ mode. If we are in FIQ
628
+ /*
629
+ * Registers x24-x30 are mapped to r8-r14 in FIQ mode. If we are in FIQ
630
* mode, then we can copy from r8-r14. Otherwise, we copy from the
631
* FIQ bank for r8-r14.
632
*/
633
@@ -XXX,XX +XXX,XX @@ void aarch64_sync_32_to_64(CPUARMState *env)
634
env->pc = env->regs[15];
635
}
195
}
636
196
637
-/* Function used to synchronize QEMU's AArch32 register set with AArch64
638
+/*
639
+ * Function used to synchronize QEMU's AArch32 register set with AArch64
640
* register set. This is necessary when switching between AArch32 and AArch64
641
* execution state.
642
*/
643
@@ -XXX,XX +XXX,XX @@ void aarch64_sync_64_to_32(CPUARMState *env)
644
env->regs[i] = env->xregs[i];
645
}
646
647
- /* Unless we are in FIQ mode, r8-r12 come from the user registers x8-x12.
648
+ /*
649
+ * Unless we are in FIQ mode, r8-r12 come from the user registers x8-x12.
650
* Otherwise, we copy x8-x12 into the banked user regs.
651
*/
652
if (mode == ARM_CPU_MODE_FIQ) {
653
@@ -XXX,XX +XXX,XX @@ void aarch64_sync_64_to_32(CPUARMState *env)
654
}
655
}
656
657
- /* Registers r13 & r14 depend on the current mode.
658
+ /*
659
+ * Registers r13 & r14 depend on the current mode.
660
* If we are in a given mode, we copy the corresponding x registers to r13
661
* and r14. Otherwise, we copy the x register to the banked r13 and r14
662
* for the mode.
663
@@ -XXX,XX +XXX,XX @@ void aarch64_sync_64_to_32(CPUARMState *env)
664
} else {
665
env->banked_r13[bank_number(ARM_CPU_MODE_USR)] = env->xregs[13];
666
667
- /* HYP is an exception in that it does not have its own banked r14 but
668
+ /*
669
+ * HYP is an exception in that it does not have its own banked r14 but
670
* shares the USR r14
671
*/
672
if (mode == ARM_CPU_MODE_HYP) {
673
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(v7m_mrs)(CPUARMState *env, uint32_t reg)
674
return value;
675
}
676
case 0x94: /* CONTROL_NS */
677
- /* We have to handle this here because unprivileged Secure code
678
+ /*
679
+ * We have to handle this here because unprivileged Secure code
680
* can read the NS CONTROL register.
681
*/
682
if (!env->v7m.secure) {
683
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(v7m_mrs)(CPUARMState *env, uint32_t reg)
684
return env->v7m.faultmask[M_REG_NS];
685
case 0x98: /* SP_NS */
686
{
687
- /* This gives the non-secure SP selected based on whether we're
688
+ /*
689
+ * This gives the non-secure SP selected based on whether we're
690
* currently in handler mode or not, using the NS CONTROL.SPSEL.
691
*/
692
bool spsel = env->v7m.control[M_REG_NS] & R_V7M_CONTROL_SPSEL_MASK;
693
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(v7m_mrs)(CPUARMState *env, uint32_t reg)
694
695
void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val)
696
{
697
- /* We're passed bits [11..0] of the instruction; extract
698
+ /*
699
+ * We're passed bits [11..0] of the instruction; extract
700
* SYSm and the mask bits.
701
* Invalid combinations of SYSm and mask are UNPREDICTABLE;
702
* we choose to treat them as if the mask bits were valid.
703
@@ -XXX,XX +XXX,XX @@ void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val)
704
return;
705
case 0x98: /* SP_NS */
706
{
707
- /* This gives the non-secure SP selected based on whether we're
708
+ /*
709
+ * This gives the non-secure SP selected based on whether we're
710
* currently in handler mode or not, using the NS CONTROL.SPSEL.
711
*/
712
bool spsel = env->v7m.control[M_REG_NS] & R_V7M_CONTROL_SPSEL_MASK;
713
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(v7m_tt)(CPUARMState *env, uint32_t addr, uint32_t op)
714
bool targetsec = env->v7m.secure;
715
bool is_subpage;
716
717
- /* Work out what the security state and privilege level we're
718
+ /*
719
+ * Work out what the security state and privilege level we're
720
* interested in is...
721
*/
722
if (alt) {
723
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(v7m_tt)(CPUARMState *env, uint32_t addr, uint32_t op)
724
/* ...and then figure out which MMU index this is */
725
mmu_idx = arm_v7m_mmu_idx_for_secstate_and_priv(env, targetsec, targetpriv);
726
727
- /* We know that the MPU and SAU don't care about the access type
728
+ /*
729
+ * We know that the MPU and SAU don't care about the access type
730
* for our purposes beyond that we don't want to claim to be
731
* an insn fetch, so we arbitrarily call this a read.
732
*/
733
734
- /* MPU region info only available for privileged or if
735
+ /*
736
+ * MPU region info only available for privileged or if
737
* inspecting the other MPU state.
738
*/
739
if (arm_current_el(env) != 0 || alt) {
740
@@ -XXX,XX +XXX,XX @@ bool arm_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
741
742
void HELPER(dc_zva)(CPUARMState *env, uint64_t vaddr_in)
743
{
744
- /* Implement DC ZVA, which zeroes a fixed-length block of memory.
745
+ /*
746
+ * Implement DC ZVA, which zeroes a fixed-length block of memory.
747
* Note that we do not implement the (architecturally mandated)
748
* alignment fault for attempts to use this on Device memory
749
* (which matches the usual QEMU behaviour of not implementing either
750
@@ -XXX,XX +XXX,XX @@ void HELPER(dc_zva)(CPUARMState *env, uint64_t vaddr_in)
751
752
#ifndef CONFIG_USER_ONLY
753
{
754
- /* Slightly awkwardly, QEMU's TARGET_PAGE_SIZE may be less than
755
+ /*
756
+ * Slightly awkwardly, QEMU's TARGET_PAGE_SIZE may be less than
757
* the block size so we might have to do more than one TLB lookup.
758
* We know that in fact for any v8 CPU the page size is at least 4K
759
* and the block size must be 2K or less, but TARGET_PAGE_SIZE is only
760
@@ -XXX,XX +XXX,XX @@ void HELPER(dc_zva)(CPUARMState *env, uint64_t vaddr_in)
761
}
762
}
763
if (i == maxidx) {
764
- /* If it's all in the TLB it's fair game for just writing to;
765
+ /*
766
+ * If it's all in the TLB it's fair game for just writing to;
767
* we know we don't need to update dirty status, etc.
768
*/
769
for (i = 0; i < maxidx - 1; i++) {
770
@@ -XXX,XX +XXX,XX @@ void HELPER(dc_zva)(CPUARMState *env, uint64_t vaddr_in)
771
memset(hostaddr[i], 0, blocklen - (i * TARGET_PAGE_SIZE));
772
return;
773
}
774
- /* OK, try a store and see if we can populate the tlb. This
775
+ /*
776
+ * OK, try a store and see if we can populate the tlb. This
777
* might cause an exception if the memory isn't writable,
778
* in which case we will longjmp out of here. We must for
779
* this purpose use the actual register value passed to us
780
@@ -XXX,XX +XXX,XX @@ void HELPER(dc_zva)(CPUARMState *env, uint64_t vaddr_in)
781
}
782
}
783
784
- /* Slow path (probably attempt to do this to an I/O device or
785
+ /*
786
+ * Slow path (probably attempt to do this to an I/O device or
787
* similar, or clearing of a block of code we have translations
788
* cached for). Just do a series of byte writes as the architecture
789
* demands. It's not worth trying to use a cpu_physical_memory_map(),
790
diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c
791
index XXXXXXX..XXXXXXX 100644
792
--- a/target/arm/op_helper.c
793
+++ b/target/arm/op_helper.c
794
@@ -XXX,XX +XXX,XX @@ static inline uint32_t merge_syn_data_abort(uint32_t template_syn,
795
{
796
uint32_t syn;
797
798
- /* ISV is only set for data aborts routed to EL2 and
799
+ /*
800
+ * ISV is only set for data aborts routed to EL2 and
801
* never for stage-1 page table walks faulting on stage 2.
802
*
803
* Furthermore, ISV is only set for certain kinds of load/stores.
804
@@ -XXX,XX +XXX,XX @@ static inline uint32_t merge_syn_data_abort(uint32_t template_syn,
805
syn = syn_data_abort_no_iss(same_el,
806
ea, 0, s1ptw, is_write, fsc);
807
} else {
808
- /* Fields: IL, ISV, SAS, SSE, SRT, SF and AR come from the template
809
+ /*
810
+ * Fields: IL, ISV, SAS, SSE, SRT, SF and AR come from the template
811
* syndrome created at translation time.
812
* Now we create the runtime syndrome with the remaining fields.
813
*/
814
@@ -XXX,XX +XXX,XX @@ void arm_deliver_fault(ARMCPU *cpu, vaddr addr, MMUAccessType access_type,
815
816
if (target_el == 2 || arm_el_is_aa64(env, target_el) ||
817
arm_s1_regime_using_lpae_format(env, arm_mmu_idx)) {
818
- /* LPAE format fault status register : bottom 6 bits are
819
+ /*
820
+ * LPAE format fault status register : bottom 6 bits are
821
* status code in the same form as needed for syndrome
822
*/
823
fsr = arm_fi_to_lfsc(fi);
824
fsc = extract32(fsr, 0, 6);
825
} else {
826
fsr = arm_fi_to_sfsc(fi);
827
- /* Short format FSR : this fault will never actually be reported
828
+ /*
829
+ * Short format FSR : this fault will never actually be reported
830
* to an EL that uses a syndrome register. Use a (currently)
831
* reserved FSR code in case the constructed syndrome does leak
832
* into the guest somehow.
833
@@ -XXX,XX +XXX,XX @@ void arm_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr,
834
arm_deliver_fault(cpu, vaddr, access_type, mmu_idx, &fi);
835
}
836
837
-/* arm_cpu_do_transaction_failed: handle a memory system error response
838
+/*
839
+ * arm_cpu_do_transaction_failed: handle a memory system error response
840
* (eg "no device/memory present at address") by raising an external abort
841
* exception
842
*/
843
@@ -XXX,XX +XXX,XX @@ static bool linked_bp_matches(ARMCPU *cpu, int lbn)
844
int bt;
845
uint32_t contextidr;
846
847
- /* Links to unimplemented or non-context aware breakpoints are
848
+ /*
849
+ * Links to unimplemented or non-context aware breakpoints are
850
* CONSTRAINED UNPREDICTABLE: either behave as if disabled, or
851
* as if linked to an UNKNOWN context-aware breakpoint (in which
852
* case DBGWCR<n>_EL1.LBN must indicate that breakpoint).
853
@@ -XXX,XX +XXX,XX @@ static bool linked_bp_matches(ARMCPU *cpu, int lbn)
854
855
bt = extract64(bcr, 20, 4);
856
857
- /* We match the whole register even if this is AArch32 using the
858
+ /*
859
+ * We match the whole register even if this is AArch32 using the
860
* short descriptor format (in which case it holds both PROCID and ASID),
861
* since we don't implement the optional v7 context ID masking.
862
*/
863
@@ -XXX,XX +XXX,XX @@ static bool linked_bp_matches(ARMCPU *cpu, int lbn)
864
case 9: /* linked VMID match (reserved if no EL2) */
865
case 11: /* linked context ID and VMID match (reserved if no EL2) */
866
default:
867
- /* Links to Unlinked context breakpoints must generate no
868
+ /*
869
+ * Links to Unlinked context breakpoints must generate no
870
* events; we choose to do the same for reserved values too.
871
*/
872
return false;
873
@@ -XXX,XX +XXX,XX @@ static bool bp_wp_matches(ARMCPU *cpu, int n, bool is_wp)
874
CPUARMState *env = &cpu->env;
875
uint64_t cr;
876
int pac, hmc, ssc, wt, lbn;
877
- /* Note that for watchpoints the check is against the CPU security
878
+ /*
879
+ * Note that for watchpoints the check is against the CPU security
880
* state, not the S/NS attribute on the offending data access.
881
*/
882
bool is_secure = arm_is_secure(env);
883
@@ -XXX,XX +XXX,XX @@ static bool bp_wp_matches(ARMCPU *cpu, int n, bool is_wp)
884
}
885
cr = env->cp15.dbgwcr[n];
886
if (wp->hitattrs.user) {
887
- /* The LDRT/STRT/LDT/STT "unprivileged access" instructions should
888
+ /*
889
+ * The LDRT/STRT/LDT/STT "unprivileged access" instructions should
890
* match watchpoints as if they were accesses done at EL0, even if
891
* the CPU is at EL1 or higher.
892
*/
893
@@ -XXX,XX +XXX,XX @@ static bool bp_wp_matches(ARMCPU *cpu, int n, bool is_wp)
894
}
895
cr = env->cp15.dbgbcr[n];
896
}
897
- /* The WATCHPOINT_HIT flag guarantees us that the watchpoint is
898
+ /*
899
+ * The WATCHPOINT_HIT flag guarantees us that the watchpoint is
900
* enabled and that the address and access type match; for breakpoints
901
* we know the address matched; check the remaining fields, including
902
* linked breakpoints. We rely on WCR and BCR having the same layout
903
@@ -XXX,XX +XXX,XX @@ static bool check_watchpoints(ARMCPU *cpu)
904
CPUARMState *env = &cpu->env;
905
int n;
906
907
- /* If watchpoints are disabled globally or we can't take debug
908
+ /*
909
+ * If watchpoints are disabled globally or we can't take debug
910
* exceptions here then watchpoint firings are ignored.
911
*/
912
if (extract32(env->cp15.mdscr_el1, 15, 1) == 0
913
@@ -XXX,XX +XXX,XX @@ static bool check_breakpoints(ARMCPU *cpu)
914
CPUARMState *env = &cpu->env;
915
int n;
916
917
- /* If breakpoints are disabled globally or we can't take debug
918
+ /*
919
+ * If breakpoints are disabled globally or we can't take debug
920
* exceptions here then breakpoint firings are ignored.
921
*/
922
if (extract32(env->cp15.mdscr_el1, 15, 1) == 0
923
@@ -XXX,XX +XXX,XX @@ void HELPER(check_breakpoints)(CPUARMState *env)
924
925
bool arm_debug_check_watchpoint(CPUState *cs, CPUWatchpoint *wp)
926
{
927
- /* Called by core code when a CPU watchpoint fires; need to check if this
928
+ /*
929
+ * Called by core code when a CPU watchpoint fires; need to check if this
930
* is also an architectural watchpoint match.
931
*/
932
ARMCPU *cpu = ARM_CPU(cs);
933
@@ -XXX,XX +XXX,XX @@ vaddr arm_adjust_watchpoint_address(CPUState *cs, vaddr addr, int len)
934
ARMCPU *cpu = ARM_CPU(cs);
935
CPUARMState *env = &cpu->env;
936
937
- /* In BE32 system mode, target memory is stored byteswapped (on a
938
+ /*
939
+ * In BE32 system mode, target memory is stored byteswapped (on a
940
* little-endian host system), and by the time we reach here (via an
941
* opcode helper) the addresses of subword accesses have been adjusted
942
* to account for that, which means that watchpoints will not match.
943
@@ -XXX,XX +XXX,XX @@ vaddr arm_adjust_watchpoint_address(CPUState *cs, vaddr addr, int len)
944
945
void arm_debug_excp_handler(CPUState *cs)
946
{
947
- /* Called by core code when a watchpoint or breakpoint fires;
948
+ /*
949
+ * Called by core code when a watchpoint or breakpoint fires;
950
* need to check which one and raise the appropriate exception.
951
*/
952
ARMCPU *cpu = ARM_CPU(cs);
953
@@ -XXX,XX +XXX,XX @@ void arm_debug_excp_handler(CPUState *cs)
954
uint64_t pc = is_a64(env) ? env->pc : env->regs[15];
955
bool same_el = (arm_debug_target_el(env) == arm_current_el(env));
956
957
- /* (1) GDB breakpoints should be handled first.
958
+ /*
959
+ * (1) GDB breakpoints should be handled first.
960
* (2) Do not raise a CPU exception if no CPU breakpoint has fired,
961
* since singlestep is also done by generating a debug internal
962
* exception.
963
@@ -XXX,XX +XXX,XX @@ void arm_debug_excp_handler(CPUState *cs)
964
}
965
966
env->exception.fsr = arm_debug_exception_fsr(env);
967
- /* FAR is UNKNOWN: clear vaddress to avoid potentially exposing
968
+ /*
969
+ * FAR is UNKNOWN: clear vaddress to avoid potentially exposing
970
* values to the guest that it shouldn't be able to see at its
971
* exception/security level.
972
*/
973
diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c
974
index XXXXXXX..XXXXXXX 100644
975
--- a/target/arm/vfp_helper.c
976
+++ b/target/arm/vfp_helper.c
977
@@ -XXX,XX +XXX,XX @@ void HELPER(vfp_set_fpscr)(CPUARMState *env, uint32_t val)
978
set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_f16);
979
}
980
981
- /* The exception flags are ORed together when we read fpscr so we
982
+ /*
983
+ * The exception flags are ORed together when we read fpscr so we
984
* only need to preserve the current state in one of our
985
* float_status values.
986
*/
987
--
197
--
988
2.20.1
198
2.25.1
989
990
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
From: Fabiano Rosas <farosas@suse.de>
2
2
3
This code is specific to the SoftFloat floating-point
3
Signed-off-by: Fabiano Rosas <farosas@suse.de>
4
implementation, which is only used by TCG.
4
Reviewed-by: Claudio Fontana <cfontana@suse.de>
5
5
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
6
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
6
Message-id: 20221213190537.511-5-farosas@suse.de
7
Message-id: 20190701132516.26392-18-philmd@redhat.com
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
8
---
11
target/arm/vfp_helper.c | 26 +++++++++++++++++++++++---
9
target/arm/m_helper.c | 16 ----------------
12
1 file changed, 23 insertions(+), 3 deletions(-)
10
1 file changed, 16 deletions(-)
13
11
14
diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c
12
diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c
15
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/vfp_helper.c
14
--- a/target/arm/m_helper.c
17
+++ b/target/arm/vfp_helper.c
15
+++ b/target/arm/m_helper.c
18
@@ -XXX,XX +XXX,XX @@
16
@@ -XXX,XX +XXX,XX @@
19
*/
17
*/
20
18
21
#include "qemu/osdep.h"
19
#include "qemu/osdep.h"
22
-#include "qemu/log.h"
20
-#include "qemu/units.h"
21
-#include "target/arm/idau.h"
22
-#include "trace.h"
23
#include "cpu.h"
23
#include "cpu.h"
24
#include "internals.h"
25
-#include "exec/gdbstub.h"
24
#include "exec/helper-proto.h"
26
#include "exec/helper-proto.h"
25
-#include "fpu/softfloat.h"
27
-#include "qemu/host-utils.h"
26
#include "internals.h"
28
#include "qemu/main-loop.h"
27
-
29
#include "qemu/bitops.h"
28
+#ifdef CONFIG_TCG
30
-#include "qemu/crc32c.h"
29
+#include "qemu/log.h"
31
-#include "qemu/qemu-print.h"
30
+#include "fpu/softfloat.h"
32
#include "qemu/log.h"
31
+#endif
33
#include "exec/exec-all.h"
32
34
-#include <zlib.h> /* For crc32 */
33
/* VFP support. We follow the convention used for VFP instructions:
35
-#include "semihosting/semihost.h"
34
Single precision routines have a "s" suffix, double precision a
36
-#include "sysemu/cpus.h"
35
"d" suffix. */
37
-#include "sysemu/kvm.h"
36
38
-#include "qemu/range.h"
37
+#ifdef CONFIG_TCG
39
-#include "qapi/qapi-commands-machine-target.h"
38
+
40
-#include "qapi/error.h"
39
/* Convert host exception flags to vfp form. */
41
-#include "qemu/guest-random.h"
40
static inline int vfp_exceptbits_from_host(int host_bits)
42
#ifdef CONFIG_TCG
41
{
43
-#include "arm_ldst.h"
42
@@ -XXX,XX +XXX,XX @@ static void vfp_set_fpscr_to_host(CPUARMState *env, uint32_t val)
44
#include "exec/cpu_ldst.h"
43
set_float_exception_flags(0, &env->vfp.standard_fp_status);
45
#include "semihosting/common-semi.h"
44
}
46
#endif
45
46
+#else
47
+
48
+static uint32_t vfp_get_fpscr_from_host(CPUARMState *env)
49
+{
50
+ return 0;
51
+}
52
+
53
+static void vfp_set_fpscr_to_host(CPUARMState *env, uint32_t val)
54
+{
55
+}
56
+
57
+#endif
58
+
59
uint32_t HELPER(vfp_get_fpscr)(CPUARMState *env)
60
{
61
uint32_t i, fpscr;
62
@@ -XXX,XX +XXX,XX @@ void vfp_set_fpscr(CPUARMState *env, uint32_t val)
63
HELPER(vfp_set_fpscr)(env, val);
64
}
65
66
+#ifdef CONFIG_TCG
67
+
68
#define VFP_HELPER(name, p) HELPER(glue(glue(vfp_,name),p))
69
70
#define VFP_BINOP(name) \
71
@@ -XXX,XX +XXX,XX @@ float64 HELPER(frint64_d)(float64 f, void *fpst)
72
{
73
return frint_d(f, fpst, 64);
74
}
75
+
76
+#endif
77
--
47
--
78
2.20.1
48
2.25.1
79
80
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
From: Fabiano Rosas <farosas@suse.de>
2
2
3
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
3
Signed-off-by: Fabiano Rosas <farosas@suse.de>
4
Message-id: 20190701132516.26392-7-philmd@redhat.com
4
Reviewed-by: Claudio Fontana <cfontana@suse.de>
5
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
6
Message-id: 20221213190537.511-6-farosas@suse.de
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
---
8
---
8
target/arm/helper.c | 2 --
9
target/arm/helper.c | 7 -------
9
1 file changed, 2 deletions(-)
10
1 file changed, 7 deletions(-)
10
11
11
diff --git a/target/arm/helper.c b/target/arm/helper.c
12
diff --git a/target/arm/helper.c b/target/arm/helper.c
12
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
13
--- a/target/arm/helper.c
14
--- a/target/arm/helper.c
14
+++ b/target/arm/helper.c
15
+++ b/target/arm/helper.c
15
@@ -XXX,XX +XXX,XX @@
16
@@ -XXX,XX +XXX,XX @@
16
#include "exec/gdbstub.h"
17
*/
18
19
#include "qemu/osdep.h"
20
-#include "qemu/units.h"
21
#include "qemu/log.h"
22
#include "trace.h"
23
#include "cpu.h"
24
#include "internals.h"
17
#include "exec/helper-proto.h"
25
#include "exec/helper-proto.h"
18
#include "qemu/host-utils.h"
26
-#include "qemu/host-utils.h"
19
-#include "sysemu/arch_init.h"
27
#include "qemu/main-loop.h"
20
#include "sysemu/sysemu.h"
28
#include "qemu/timer.h"
21
#include "qemu/bitops.h"
29
#include "qemu/bitops.h"
22
#include "qemu/crc32c.h"
23
@@ -XXX,XX +XXX,XX @@
30
@@ -XXX,XX +XXX,XX @@
24
#include "hw/semihosting/semihost.h"
31
#include "exec/exec-all.h"
25
#include "sysemu/cpus.h"
32
#include <zlib.h> /* For crc32 */
33
#include "hw/irq.h"
34
-#include "semihosting/semihost.h"
35
-#include "sysemu/cpus.h"
36
#include "sysemu/cpu-timers.h"
26
#include "sysemu/kvm.h"
37
#include "sysemu/kvm.h"
27
-#include "fpu/softfloat.h"
38
-#include "qemu/range.h"
28
#include "qemu/range.h"
39
#include "qapi/qapi-commands-machine-target.h"
29
#include "qapi/qapi-commands-target.h"
30
#include "qapi/error.h"
40
#include "qapi/error.h"
41
#include "qemu/guest-random.h"
42
#ifdef CONFIG_TCG
43
-#include "arm_ldst.h"
44
-#include "exec/cpu_ldst.h"
45
#include "semihosting/common-semi.h"
46
#endif
47
#include "cpregs.h"
31
--
48
--
32
2.20.1
49
2.25.1
33
34
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
From: Claudio Fontana <cfontana@suse.de>
2
2
3
Suggested-by: Samuel Ortiz <sameo@linux.intel.com>
3
Remove some unused headers.
4
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
4
5
Message-id: 20190701132516.26392-11-philmd@redhat.com
5
Signed-off-by: Claudio Fontana <cfontana@suse.de>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Acked-by: Richard Henderson <richard.henderson@linaro.org>
7
Reviewed-by: Claudio Fontana <cfontana@suse.de>
8
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
9
Signed-off-by: Fabiano Rosas <farosas@suse.de>
10
Message-id: 20221213190537.511-7-farosas@suse.de
11
[added back some includes that are still needed at this point]
12
Signed-off-by: Fabiano Rosas <farosas@suse.de>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
---
14
---
9
target/arm/cpu.h | 2 -
15
target/arm/cpu.c | 1 -
10
target/arm/translate.h | 5 -
16
target/arm/cpu64.c | 6 ------
11
target/arm/cpu.c | 226 +++++++++++++++++++++++++++++++++++++
17
2 files changed, 7 deletions(-)
12
target/arm/translate-a64.c | 128 ---------------------
13
target/arm/translate.c | 88 ---------------
14
5 files changed, 226 insertions(+), 223 deletions(-)
15
18
16
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
17
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/cpu.h
19
+++ b/target/arm/cpu.h
20
@@ -XXX,XX +XXX,XX @@ void arm_cpu_do_interrupt(CPUState *cpu);
21
void arm_v7m_cpu_do_interrupt(CPUState *cpu);
22
bool arm_cpu_exec_interrupt(CPUState *cpu, int int_req);
23
24
-void arm_cpu_dump_state(CPUState *cs, FILE *f, int flags);
25
-
26
hwaddr arm_cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr,
27
MemTxAttrs *attrs);
28
29
diff --git a/target/arm/translate.h b/target/arm/translate.h
30
index XXXXXXX..XXXXXXX 100644
31
--- a/target/arm/translate.h
32
+++ b/target/arm/translate.h
33
@@ -XXX,XX +XXX,XX @@ static inline void disas_set_insn_syndrome(DisasContext *s, uint32_t syn)
34
#ifdef TARGET_AARCH64
35
void a64_translate_init(void);
36
void gen_a64_set_pc_im(uint64_t val);
37
-void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int flags);
38
extern const TranslatorOps aarch64_translator_ops;
39
#else
40
static inline void a64_translate_init(void)
41
@@ -XXX,XX +XXX,XX @@ static inline void a64_translate_init(void)
42
static inline void gen_a64_set_pc_im(uint64_t val)
43
{
44
}
45
-
46
-static inline void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int flags)
47
-{
48
-}
49
#endif
50
51
void arm_test_cc(DisasCompare *cmp, int cc);
52
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
19
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
53
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
54
--- a/target/arm/cpu.c
21
--- a/target/arm/cpu.c
55
+++ b/target/arm/cpu.c
22
+++ b/target/arm/cpu.c
56
@@ -XXX,XX +XXX,XX @@
23
@@ -XXX,XX +XXX,XX @@
57
*/
58
59
#include "qemu/osdep.h"
60
+#include "qemu/qemu-print.h"
61
#include "qemu-common.h"
62
#include "target/arm/idau.h"
24
#include "target/arm/idau.h"
63
#include "qemu/module.h"
25
#include "qemu/module.h"
64
@@ -XXX,XX +XXX,XX @@ static void arm_disas_set_info(CPUState *cpu, disassemble_info *info)
26
#include "qapi/error.h"
65
#endif
27
-#include "qapi/visitor.h"
66
}
28
#include "cpu.h"
67
29
#ifdef CONFIG_TCG
68
+#ifdef TARGET_AARCH64
30
#include "hw/core/tcg-cpu-ops.h"
69
+
31
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
70
+static void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int flags)
71
+{
72
+ ARMCPU *cpu = ARM_CPU(cs);
73
+ CPUARMState *env = &cpu->env;
74
+ uint32_t psr = pstate_read(env);
75
+ int i;
76
+ int el = arm_current_el(env);
77
+ const char *ns_status;
78
+
79
+ qemu_fprintf(f, " PC=%016" PRIx64 " ", env->pc);
80
+ for (i = 0; i < 32; i++) {
81
+ if (i == 31) {
82
+ qemu_fprintf(f, " SP=%016" PRIx64 "\n", env->xregs[i]);
83
+ } else {
84
+ qemu_fprintf(f, "X%02d=%016" PRIx64 "%s", i, env->xregs[i],
85
+ (i + 2) % 3 ? " " : "\n");
86
+ }
87
+ }
88
+
89
+ if (arm_feature(env, ARM_FEATURE_EL3) && el != 3) {
90
+ ns_status = env->cp15.scr_el3 & SCR_NS ? "NS " : "S ";
91
+ } else {
92
+ ns_status = "";
93
+ }
94
+ qemu_fprintf(f, "PSTATE=%08x %c%c%c%c %sEL%d%c",
95
+ psr,
96
+ psr & PSTATE_N ? 'N' : '-',
97
+ psr & PSTATE_Z ? 'Z' : '-',
98
+ psr & PSTATE_C ? 'C' : '-',
99
+ psr & PSTATE_V ? 'V' : '-',
100
+ ns_status,
101
+ el,
102
+ psr & PSTATE_SP ? 'h' : 't');
103
+
104
+ if (cpu_isar_feature(aa64_bti, cpu)) {
105
+ qemu_fprintf(f, " BTYPE=%d", (psr & PSTATE_BTYPE) >> 10);
106
+ }
107
+ if (!(flags & CPU_DUMP_FPU)) {
108
+ qemu_fprintf(f, "\n");
109
+ return;
110
+ }
111
+ if (fp_exception_el(env, el) != 0) {
112
+ qemu_fprintf(f, " FPU disabled\n");
113
+ return;
114
+ }
115
+ qemu_fprintf(f, " FPCR=%08x FPSR=%08x\n",
116
+ vfp_get_fpcr(env), vfp_get_fpsr(env));
117
+
118
+ if (cpu_isar_feature(aa64_sve, cpu) && sve_exception_el(env, el) == 0) {
119
+ int j, zcr_len = sve_zcr_len_for_el(env, el);
120
+
121
+ for (i = 0; i <= FFR_PRED_NUM; i++) {
122
+ bool eol;
123
+ if (i == FFR_PRED_NUM) {
124
+ qemu_fprintf(f, "FFR=");
125
+ /* It's last, so end the line. */
126
+ eol = true;
127
+ } else {
128
+ qemu_fprintf(f, "P%02d=", i);
129
+ switch (zcr_len) {
130
+ case 0:
131
+ eol = i % 8 == 7;
132
+ break;
133
+ case 1:
134
+ eol = i % 6 == 5;
135
+ break;
136
+ case 2:
137
+ case 3:
138
+ eol = i % 3 == 2;
139
+ break;
140
+ default:
141
+ /* More than one quadword per predicate. */
142
+ eol = true;
143
+ break;
144
+ }
145
+ }
146
+ for (j = zcr_len / 4; j >= 0; j--) {
147
+ int digits;
148
+ if (j * 4 + 4 <= zcr_len + 1) {
149
+ digits = 16;
150
+ } else {
151
+ digits = (zcr_len % 4 + 1) * 4;
152
+ }
153
+ qemu_fprintf(f, "%0*" PRIx64 "%s", digits,
154
+ env->vfp.pregs[i].p[j],
155
+ j ? ":" : eol ? "\n" : " ");
156
+ }
157
+ }
158
+
159
+ for (i = 0; i < 32; i++) {
160
+ if (zcr_len == 0) {
161
+ qemu_fprintf(f, "Z%02d=%016" PRIx64 ":%016" PRIx64 "%s",
162
+ i, env->vfp.zregs[i].d[1],
163
+ env->vfp.zregs[i].d[0], i & 1 ? "\n" : " ");
164
+ } else if (zcr_len == 1) {
165
+ qemu_fprintf(f, "Z%02d=%016" PRIx64 ":%016" PRIx64
166
+ ":%016" PRIx64 ":%016" PRIx64 "\n",
167
+ i, env->vfp.zregs[i].d[3], env->vfp.zregs[i].d[2],
168
+ env->vfp.zregs[i].d[1], env->vfp.zregs[i].d[0]);
169
+ } else {
170
+ for (j = zcr_len; j >= 0; j--) {
171
+ bool odd = (zcr_len - j) % 2 != 0;
172
+ if (j == zcr_len) {
173
+ qemu_fprintf(f, "Z%02d[%x-%x]=", i, j, j - 1);
174
+ } else if (!odd) {
175
+ if (j > 0) {
176
+ qemu_fprintf(f, " [%x-%x]=", j, j - 1);
177
+ } else {
178
+ qemu_fprintf(f, " [%x]=", j);
179
+ }
180
+ }
181
+ qemu_fprintf(f, "%016" PRIx64 ":%016" PRIx64 "%s",
182
+ env->vfp.zregs[i].d[j * 2 + 1],
183
+ env->vfp.zregs[i].d[j * 2],
184
+ odd || j == 0 ? "\n" : ":");
185
+ }
186
+ }
187
+ }
188
+ } else {
189
+ for (i = 0; i < 32; i++) {
190
+ uint64_t *q = aa64_vfp_qreg(env, i);
191
+ qemu_fprintf(f, "Q%02d=%016" PRIx64 ":%016" PRIx64 "%s",
192
+ i, q[1], q[0], (i & 1 ? "\n" : " "));
193
+ }
194
+ }
195
+}
196
+
197
+#else
198
+
199
+static inline void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int flags)
200
+{
201
+ g_assert_not_reached();
202
+}
203
+
204
+#endif
205
+
206
+static void arm_cpu_dump_state(CPUState *cs, FILE *f, int flags)
207
+{
208
+ ARMCPU *cpu = ARM_CPU(cs);
209
+ CPUARMState *env = &cpu->env;
210
+ int i;
211
+
212
+ if (is_a64(env)) {
213
+ aarch64_cpu_dump_state(cs, f, flags);
214
+ return;
215
+ }
216
+
217
+ for (i = 0; i < 16; i++) {
218
+ qemu_fprintf(f, "R%02d=%08x", i, env->regs[i]);
219
+ if ((i % 4) == 3) {
220
+ qemu_fprintf(f, "\n");
221
+ } else {
222
+ qemu_fprintf(f, " ");
223
+ }
224
+ }
225
+
226
+ if (arm_feature(env, ARM_FEATURE_M)) {
227
+ uint32_t xpsr = xpsr_read(env);
228
+ const char *mode;
229
+ const char *ns_status = "";
230
+
231
+ if (arm_feature(env, ARM_FEATURE_M_SECURITY)) {
232
+ ns_status = env->v7m.secure ? "S " : "NS ";
233
+ }
234
+
235
+ if (xpsr & XPSR_EXCP) {
236
+ mode = "handler";
237
+ } else {
238
+ if (env->v7m.control[env->v7m.secure] & R_V7M_CONTROL_NPRIV_MASK) {
239
+ mode = "unpriv-thread";
240
+ } else {
241
+ mode = "priv-thread";
242
+ }
243
+ }
244
+
245
+ qemu_fprintf(f, "XPSR=%08x %c%c%c%c %c %s%s\n",
246
+ xpsr,
247
+ xpsr & XPSR_N ? 'N' : '-',
248
+ xpsr & XPSR_Z ? 'Z' : '-',
249
+ xpsr & XPSR_C ? 'C' : '-',
250
+ xpsr & XPSR_V ? 'V' : '-',
251
+ xpsr & XPSR_T ? 'T' : 'A',
252
+ ns_status,
253
+ mode);
254
+ } else {
255
+ uint32_t psr = cpsr_read(env);
256
+ const char *ns_status = "";
257
+
258
+ if (arm_feature(env, ARM_FEATURE_EL3) &&
259
+ (psr & CPSR_M) != ARM_CPU_MODE_MON) {
260
+ ns_status = env->cp15.scr_el3 & SCR_NS ? "NS " : "S ";
261
+ }
262
+
263
+ qemu_fprintf(f, "PSR=%08x %c%c%c%c %c %s%s%d\n",
264
+ psr,
265
+ psr & CPSR_N ? 'N' : '-',
266
+ psr & CPSR_Z ? 'Z' : '-',
267
+ psr & CPSR_C ? 'C' : '-',
268
+ psr & CPSR_V ? 'V' : '-',
269
+ psr & CPSR_T ? 'T' : 'A',
270
+ ns_status,
271
+ aarch32_mode_name(psr), (psr & 0x10) ? 32 : 26);
272
+ }
273
+
274
+ if (flags & CPU_DUMP_FPU) {
275
+ int numvfpregs = 0;
276
+ if (arm_feature(env, ARM_FEATURE_VFP)) {
277
+ numvfpregs += 16;
278
+ }
279
+ if (arm_feature(env, ARM_FEATURE_VFP3)) {
280
+ numvfpregs += 16;
281
+ }
282
+ for (i = 0; i < numvfpregs; i++) {
283
+ uint64_t v = *aa32_vfp_dreg(env, i);
284
+ qemu_fprintf(f, "s%02d=%08x s%02d=%08x d%02d=%016" PRIx64 "\n",
285
+ i * 2, (uint32_t)v,
286
+ i * 2 + 1, (uint32_t)(v >> 32),
287
+ i, v);
288
+ }
289
+ qemu_fprintf(f, "FPSCR: %08x\n", vfp_get_fpscr(env));
290
+ }
291
+}
292
+
293
uint64_t arm_cpu_mp_affinity(int idx, uint8_t clustersz)
294
{
295
uint32_t Aff1 = idx / clustersz;
296
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
297
index XXXXXXX..XXXXXXX 100644
32
index XXXXXXX..XXXXXXX 100644
298
--- a/target/arm/translate-a64.c
33
--- a/target/arm/cpu64.c
299
+++ b/target/arm/translate-a64.c
34
+++ b/target/arm/cpu64.c
300
@@ -XXX,XX +XXX,XX @@
35
@@ -XXX,XX +XXX,XX @@
301
#include "translate.h"
36
#include "qemu/osdep.h"
302
#include "internals.h"
37
#include "qapi/error.h"
303
#include "qemu/host-utils.h"
38
#include "cpu.h"
304
-#include "qemu/qemu-print.h"
39
-#ifdef CONFIG_TCG
305
40
-#include "hw/core/tcg-cpu-ops.h"
306
#include "hw/semihosting/semihost.h"
41
-#endif /* CONFIG_TCG */
307
#include "exec/gen-icount.h"
42
#include "qemu/module.h"
308
@@ -XXX,XX +XXX,XX @@ static void set_btype(DisasContext *s, int val)
43
-#if !defined(CONFIG_USER_ONLY)
309
s->btype = -1;
44
-#include "hw/loader.h"
310
}
45
-#endif
311
46
#include "sysemu/kvm.h"
312
-void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int flags)
47
#include "sysemu/hvf.h"
313
-{
48
#include "kvm_arm.h"
314
- ARMCPU *cpu = ARM_CPU(cs);
315
- CPUARMState *env = &cpu->env;
316
- uint32_t psr = pstate_read(env);
317
- int i;
318
- int el = arm_current_el(env);
319
- const char *ns_status;
320
-
321
- qemu_fprintf(f, " PC=%016" PRIx64 " ", env->pc);
322
- for (i = 0; i < 32; i++) {
323
- if (i == 31) {
324
- qemu_fprintf(f, " SP=%016" PRIx64 "\n", env->xregs[i]);
325
- } else {
326
- qemu_fprintf(f, "X%02d=%016" PRIx64 "%s", i, env->xregs[i],
327
- (i + 2) % 3 ? " " : "\n");
328
- }
329
- }
330
-
331
- if (arm_feature(env, ARM_FEATURE_EL3) && el != 3) {
332
- ns_status = env->cp15.scr_el3 & SCR_NS ? "NS " : "S ";
333
- } else {
334
- ns_status = "";
335
- }
336
- qemu_fprintf(f, "PSTATE=%08x %c%c%c%c %sEL%d%c",
337
- psr,
338
- psr & PSTATE_N ? 'N' : '-',
339
- psr & PSTATE_Z ? 'Z' : '-',
340
- psr & PSTATE_C ? 'C' : '-',
341
- psr & PSTATE_V ? 'V' : '-',
342
- ns_status,
343
- el,
344
- psr & PSTATE_SP ? 'h' : 't');
345
-
346
- if (cpu_isar_feature(aa64_bti, cpu)) {
347
- qemu_fprintf(f, " BTYPE=%d", (psr & PSTATE_BTYPE) >> 10);
348
- }
349
- if (!(flags & CPU_DUMP_FPU)) {
350
- qemu_fprintf(f, "\n");
351
- return;
352
- }
353
- if (fp_exception_el(env, el) != 0) {
354
- qemu_fprintf(f, " FPU disabled\n");
355
- return;
356
- }
357
- qemu_fprintf(f, " FPCR=%08x FPSR=%08x\n",
358
- vfp_get_fpcr(env), vfp_get_fpsr(env));
359
-
360
- if (cpu_isar_feature(aa64_sve, cpu) && sve_exception_el(env, el) == 0) {
361
- int j, zcr_len = sve_zcr_len_for_el(env, el);
362
-
363
- for (i = 0; i <= FFR_PRED_NUM; i++) {
364
- bool eol;
365
- if (i == FFR_PRED_NUM) {
366
- qemu_fprintf(f, "FFR=");
367
- /* It's last, so end the line. */
368
- eol = true;
369
- } else {
370
- qemu_fprintf(f, "P%02d=", i);
371
- switch (zcr_len) {
372
- case 0:
373
- eol = i % 8 == 7;
374
- break;
375
- case 1:
376
- eol = i % 6 == 5;
377
- break;
378
- case 2:
379
- case 3:
380
- eol = i % 3 == 2;
381
- break;
382
- default:
383
- /* More than one quadword per predicate. */
384
- eol = true;
385
- break;
386
- }
387
- }
388
- for (j = zcr_len / 4; j >= 0; j--) {
389
- int digits;
390
- if (j * 4 + 4 <= zcr_len + 1) {
391
- digits = 16;
392
- } else {
393
- digits = (zcr_len % 4 + 1) * 4;
394
- }
395
- qemu_fprintf(f, "%0*" PRIx64 "%s", digits,
396
- env->vfp.pregs[i].p[j],
397
- j ? ":" : eol ? "\n" : " ");
398
- }
399
- }
400
-
401
- for (i = 0; i < 32; i++) {
402
- if (zcr_len == 0) {
403
- qemu_fprintf(f, "Z%02d=%016" PRIx64 ":%016" PRIx64 "%s",
404
- i, env->vfp.zregs[i].d[1],
405
- env->vfp.zregs[i].d[0], i & 1 ? "\n" : " ");
406
- } else if (zcr_len == 1) {
407
- qemu_fprintf(f, "Z%02d=%016" PRIx64 ":%016" PRIx64
408
- ":%016" PRIx64 ":%016" PRIx64 "\n",
409
- i, env->vfp.zregs[i].d[3], env->vfp.zregs[i].d[2],
410
- env->vfp.zregs[i].d[1], env->vfp.zregs[i].d[0]);
411
- } else {
412
- for (j = zcr_len; j >= 0; j--) {
413
- bool odd = (zcr_len - j) % 2 != 0;
414
- if (j == zcr_len) {
415
- qemu_fprintf(f, "Z%02d[%x-%x]=", i, j, j - 1);
416
- } else if (!odd) {
417
- if (j > 0) {
418
- qemu_fprintf(f, " [%x-%x]=", j, j - 1);
419
- } else {
420
- qemu_fprintf(f, " [%x]=", j);
421
- }
422
- }
423
- qemu_fprintf(f, "%016" PRIx64 ":%016" PRIx64 "%s",
424
- env->vfp.zregs[i].d[j * 2 + 1],
425
- env->vfp.zregs[i].d[j * 2],
426
- odd || j == 0 ? "\n" : ":");
427
- }
428
- }
429
- }
430
- } else {
431
- for (i = 0; i < 32; i++) {
432
- uint64_t *q = aa64_vfp_qreg(env, i);
433
- qemu_fprintf(f, "Q%02d=%016" PRIx64 ":%016" PRIx64 "%s",
434
- i, q[1], q[0], (i & 1 ? "\n" : " "));
435
- }
436
- }
437
-}
438
-
439
void gen_a64_set_pc_im(uint64_t val)
440
{
441
tcg_gen_movi_i64(cpu_pc, val);
442
diff --git a/target/arm/translate.c b/target/arm/translate.c
443
index XXXXXXX..XXXXXXX 100644
444
--- a/target/arm/translate.c
445
+++ b/target/arm/translate.c
446
@@ -XXX,XX +XXX,XX @@
447
#include "tcg-op-gvec.h"
448
#include "qemu/log.h"
449
#include "qemu/bitops.h"
450
-#include "qemu/qemu-print.h"
451
#include "arm_ldst.h"
452
#include "hw/semihosting/semihost.h"
453
454
@@ -XXX,XX +XXX,XX @@ void gen_intermediate_code(CPUState *cpu, TranslationBlock *tb, int max_insns)
455
translator_loop(ops, &dc.base, cpu, tb, max_insns);
456
}
457
458
-void arm_cpu_dump_state(CPUState *cs, FILE *f, int flags)
459
-{
460
- ARMCPU *cpu = ARM_CPU(cs);
461
- CPUARMState *env = &cpu->env;
462
- int i;
463
-
464
- if (is_a64(env)) {
465
- aarch64_cpu_dump_state(cs, f, flags);
466
- return;
467
- }
468
-
469
- for (i = 0; i < 16; i++) {
470
- qemu_fprintf(f, "R%02d=%08x", i, env->regs[i]);
471
- if ((i % 4) == 3) {
472
- qemu_fprintf(f, "\n");
473
- } else {
474
- qemu_fprintf(f, " ");
475
- }
476
- }
477
-
478
- if (arm_feature(env, ARM_FEATURE_M)) {
479
- uint32_t xpsr = xpsr_read(env);
480
- const char *mode;
481
- const char *ns_status = "";
482
-
483
- if (arm_feature(env, ARM_FEATURE_M_SECURITY)) {
484
- ns_status = env->v7m.secure ? "S " : "NS ";
485
- }
486
-
487
- if (xpsr & XPSR_EXCP) {
488
- mode = "handler";
489
- } else {
490
- if (env->v7m.control[env->v7m.secure] & R_V7M_CONTROL_NPRIV_MASK) {
491
- mode = "unpriv-thread";
492
- } else {
493
- mode = "priv-thread";
494
- }
495
- }
496
-
497
- qemu_fprintf(f, "XPSR=%08x %c%c%c%c %c %s%s\n",
498
- xpsr,
499
- xpsr & XPSR_N ? 'N' : '-',
500
- xpsr & XPSR_Z ? 'Z' : '-',
501
- xpsr & XPSR_C ? 'C' : '-',
502
- xpsr & XPSR_V ? 'V' : '-',
503
- xpsr & XPSR_T ? 'T' : 'A',
504
- ns_status,
505
- mode);
506
- } else {
507
- uint32_t psr = cpsr_read(env);
508
- const char *ns_status = "";
509
-
510
- if (arm_feature(env, ARM_FEATURE_EL3) &&
511
- (psr & CPSR_M) != ARM_CPU_MODE_MON) {
512
- ns_status = env->cp15.scr_el3 & SCR_NS ? "NS " : "S ";
513
- }
514
-
515
- qemu_fprintf(f, "PSR=%08x %c%c%c%c %c %s%s%d\n",
516
- psr,
517
- psr & CPSR_N ? 'N' : '-',
518
- psr & CPSR_Z ? 'Z' : '-',
519
- psr & CPSR_C ? 'C' : '-',
520
- psr & CPSR_V ? 'V' : '-',
521
- psr & CPSR_T ? 'T' : 'A',
522
- ns_status,
523
- aarch32_mode_name(psr), (psr & 0x10) ? 32 : 26);
524
- }
525
-
526
- if (flags & CPU_DUMP_FPU) {
527
- int numvfpregs = 0;
528
- if (arm_feature(env, ARM_FEATURE_VFP)) {
529
- numvfpregs += 16;
530
- }
531
- if (arm_feature(env, ARM_FEATURE_VFP3)) {
532
- numvfpregs += 16;
533
- }
534
- for (i = 0; i < numvfpregs; i++) {
535
- uint64_t v = *aa32_vfp_dreg(env, i);
536
- qemu_fprintf(f, "s%02d=%08x s%02d=%08x d%02d=%016" PRIx64 "\n",
537
- i * 2, (uint32_t)v,
538
- i * 2 + 1, (uint32_t)(v >> 32),
539
- i, v);
540
- }
541
- qemu_fprintf(f, "FPSCR: %08x\n", vfp_get_fpscr(env));
542
- }
543
-}
544
-
545
void restore_state_to_opc(CPUARMState *env, TranslationBlock *tb,
546
target_ulong *data)
547
{
548
--
49
--
549
2.20.1
50
2.25.1
550
551
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
Group SOFTMMU objects together.
3
The pointed MouseTransformInfo structure is accessed read-only.
4
Since PSCI is TCG specific, keep it separate.
5
4
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
5
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20190701132516.26392-5-philmd@redhat.com
7
Message-id: 20221220142520.24094-2-philmd@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
9
---
11
target/arm/Makefile.objs | 5 ++++-
10
include/hw/input/tsc2xxx.h | 4 ++--
12
1 file changed, 4 insertions(+), 1 deletion(-)
11
hw/input/tsc2005.c | 2 +-
12
hw/input/tsc210x.c | 3 +--
13
3 files changed, 4 insertions(+), 5 deletions(-)
13
14
14
diff --git a/target/arm/Makefile.objs b/target/arm/Makefile.objs
15
diff --git a/include/hw/input/tsc2xxx.h b/include/hw/input/tsc2xxx.h
15
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/Makefile.objs
17
--- a/include/hw/input/tsc2xxx.h
17
+++ b/target/arm/Makefile.objs
18
+++ b/include/hw/input/tsc2xxx.h
18
@@ -XXX,XX +XXX,XX @@
19
@@ -XXX,XX +XXX,XX @@ uWireSlave *tsc2102_init(qemu_irq pint);
19
obj-y += arm-semi.o
20
uWireSlave *tsc2301_init(qemu_irq penirq, qemu_irq kbirq, qemu_irq dav);
20
-obj-$(CONFIG_SOFTMMU) += machine.o psci.o arch_dump.o monitor.o
21
I2SCodec *tsc210x_codec(uWireSlave *chip);
21
obj-y += helper.o vfp_helper.o
22
uint32_t tsc210x_txrx(void *opaque, uint32_t value, int len);
22
obj-y += cpu.o gdbstub.o
23
-void tsc210x_set_transform(uWireSlave *chip, MouseTransformInfo *info);
23
obj-$(TARGET_AARCH64) += cpu64.o gdbstub64.o
24
+void tsc210x_set_transform(uWireSlave *chip, const MouseTransformInfo *info);
24
+
25
void tsc210x_key_event(uWireSlave *chip, int key, int down);
25
+obj-$(CONFIG_SOFTMMU) += machine.o arch_dump.o monitor.o
26
26
obj-$(CONFIG_SOFTMMU) += arm-powerctl.o
27
/* tsc2005.c */
27
28
void *tsc2005_init(qemu_irq pintdav);
28
obj-$(CONFIG_KVM) += kvm.o
29
uint32_t tsc2005_txrx(void *opaque, uint32_t value, int len);
29
@@ -XXX,XX +XXX,XX @@ obj-y += translate.o op_helper.o
30
-void tsc2005_set_transform(void *opaque, MouseTransformInfo *info);
30
obj-y += crypto_helper.o
31
+void tsc2005_set_transform(void *opaque, const MouseTransformInfo *info);
31
obj-y += iwmmxt_helper.o vec_helper.o neon_helper.o
32
32
33
#endif
33
+obj-$(CONFIG_SOFTMMU) += psci.o
34
diff --git a/hw/input/tsc2005.c b/hw/input/tsc2005.c
34
+
35
index XXXXXXX..XXXXXXX 100644
35
obj-$(TARGET_AARCH64) += translate-a64.o helper-a64.o
36
--- a/hw/input/tsc2005.c
36
obj-$(TARGET_AARCH64) += translate-sve.o sve_helper.o
37
+++ b/hw/input/tsc2005.c
37
obj-$(TARGET_AARCH64) += pauth_helper.o
38
@@ -XXX,XX +XXX,XX @@ void *tsc2005_init(qemu_irq pintdav)
39
* from the touchscreen. Assuming 12-bit precision was used during
40
* tslib calibration.
41
*/
42
-void tsc2005_set_transform(void *opaque, MouseTransformInfo *info)
43
+void tsc2005_set_transform(void *opaque, const MouseTransformInfo *info)
44
{
45
TSC2005State *s = (TSC2005State *) opaque;
46
47
diff --git a/hw/input/tsc210x.c b/hw/input/tsc210x.c
48
index XXXXXXX..XXXXXXX 100644
49
--- a/hw/input/tsc210x.c
50
+++ b/hw/input/tsc210x.c
51
@@ -XXX,XX +XXX,XX @@ I2SCodec *tsc210x_codec(uWireSlave *chip)
52
* from the touchscreen. Assuming 12-bit precision was used during
53
* tslib calibration.
54
*/
55
-void tsc210x_set_transform(uWireSlave *chip,
56
- MouseTransformInfo *info)
57
+void tsc210x_set_transform(uWireSlave *chip, const MouseTransformInfo *info)
58
{
59
TSC210xState *s = (TSC210xState *) chip->opaque;
60
#if 0
38
--
61
--
39
2.20.1
62
2.25.1
40
63
41
64
diff view generated by jsdifflib
1
From: Eddie James <eajames@linux.ibm.com>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
The XDMA engine embedded in the Aspeed SOCs performs PCI DMA operations
3
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
4
between the SOC (acting as a BMC) and a host processor in a server.
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
5
Message-id: 20221220142520.24094-3-philmd@linaro.org
6
The XDMA engine exists on the AST2400, AST2500, and AST2600 SOCs, so
7
enable it for all of those. Add trace events on the important register
8
writes in the XDMA engine.
9
10
Signed-off-by: Eddie James <eajames@linux.ibm.com>
11
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
12
Signed-off-by: Cédric Le Goater <clg@kaod.org>
13
Message-id: 20190618165311.27066-21-clg@kaod.org
14
[clg: - changed title ]
15
Signed-off-by: Cédric Le Goater <clg@kaod.org>
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
---
7
---
18
hw/misc/Makefile.objs | 1 +
8
hw/arm/nseries.c | 18 +++++++++---------
19
include/hw/arm/aspeed_soc.h | 3 +
9
1 file changed, 9 insertions(+), 9 deletions(-)
20
include/hw/misc/aspeed_xdma.h | 30 +++++++
21
hw/arm/aspeed_soc.c | 17 ++++
22
hw/misc/aspeed_xdma.c | 165 ++++++++++++++++++++++++++++++++++
23
hw/misc/trace-events | 3 +
24
6 files changed, 219 insertions(+)
25
create mode 100644 include/hw/misc/aspeed_xdma.h
26
create mode 100644 hw/misc/aspeed_xdma.c
27
10
28
diff --git a/hw/misc/Makefile.objs b/hw/misc/Makefile.objs
11
diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c
29
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
30
--- a/hw/misc/Makefile.objs
13
--- a/hw/arm/nseries.c
31
+++ b/hw/misc/Makefile.objs
14
+++ b/hw/arm/nseries.c
32
@@ -XXX,XX +XXX,XX @@ obj-$(CONFIG_ARMSSE_MHU) += armsse-mhu.o
15
@@ -XXX,XX +XXX,XX @@ static void n8x0_i2c_setup(struct n800_s *s)
33
16
}
34
obj-$(CONFIG_PVPANIC) += pvpanic.o
17
35
obj-$(CONFIG_AUX) += auxbus.o
18
/* Touchscreen and keypad controller */
36
+obj-$(CONFIG_ASPEED_SOC) += aspeed_xdma.o
19
-static MouseTransformInfo n800_pointercal = {
37
obj-$(CONFIG_ASPEED_SOC) += aspeed_scu.o aspeed_sdmc.o
20
+static const MouseTransformInfo n800_pointercal = {
38
obj-$(CONFIG_MSF2) += msf2-sysreg.o
21
.x = 800,
39
obj-$(CONFIG_NRF51_SOC) += nrf51_rng.o
22
.y = 480,
40
diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h
23
.a = { 14560, -68, -3455208, -39, -9621, 35152972, 65536 },
41
index XXXXXXX..XXXXXXX 100644
42
--- a/include/hw/arm/aspeed_soc.h
43
+++ b/include/hw/arm/aspeed_soc.h
44
@@ -XXX,XX +XXX,XX @@
45
#include "hw/intc/aspeed_vic.h"
46
#include "hw/misc/aspeed_scu.h"
47
#include "hw/misc/aspeed_sdmc.h"
48
+#include "hw/misc/aspeed_xdma.h"
49
#include "hw/timer/aspeed_timer.h"
50
#include "hw/timer/aspeed_rtc.h"
51
#include "hw/i2c/aspeed_i2c.h"
52
@@ -XXX,XX +XXX,XX @@ typedef struct AspeedSoCState {
53
AspeedTimerCtrlState timerctrl;
54
AspeedI2CState i2c;
55
AspeedSCUState scu;
56
+ AspeedXDMAState xdma;
57
AspeedSMCState fmc;
58
AspeedSMCState spi[ASPEED_SPIS_NUM];
59
AspeedSDMCState sdmc;
60
@@ -XXX,XX +XXX,XX @@ enum {
61
ASPEED_ETH1,
62
ASPEED_ETH2,
63
ASPEED_SDRAM,
64
+ ASPEED_XDMA,
65
};
24
};
66
25
67
#endif /* ASPEED_SOC_H */
26
-static MouseTransformInfo n810_pointercal = {
68
diff --git a/include/hw/misc/aspeed_xdma.h b/include/hw/misc/aspeed_xdma.h
27
+static const MouseTransformInfo n810_pointercal = {
69
new file mode 100644
28
.x = 800,
70
index XXXXXXX..XXXXXXX
29
.y = 480,
71
--- /dev/null
30
.a = { 15041, 148, -4731056, 171, -10238, 35933380, 65536 },
72
+++ b/include/hw/misc/aspeed_xdma.h
31
@@ -XXX,XX +XXX,XX @@ static void n810_key_event(void *opaque, int keycode)
73
@@ -XXX,XX +XXX,XX @@
32
74
+/*
33
#define M    0
75
+ * ASPEED XDMA Controller
34
76
+ * Eddie James <eajames@linux.ibm.com>
35
-static int n810_keys[0x80] = {
77
+ *
36
+static const int n810_keys[0x80] = {
78
+ * Copyright (C) 2019 IBM Corp.
37
[0x01] = 16,    /* Q */
79
+ * SPDX-License-Identifer: GPL-2.0-or-later
38
[0x02] = 37,    /* K */
80
+ */
39
[0x03] = 24,    /* O */
81
+
40
@@ -XXX,XX +XXX,XX @@ static void n8x0_usb_setup(struct n800_s *s)
82
+#ifndef ASPEED_XDMA_H
41
/* Setup done before the main bootloader starts by some early setup code
83
+#define ASPEED_XDMA_H
42
* - used when we want to run the main bootloader in emulation. This
84
+
43
* isn't documented. */
85
+#include "hw/sysbus.h"
44
-static uint32_t n800_pinout[104] = {
86
+
45
+static const uint32_t n800_pinout[104] = {
87
+#define TYPE_ASPEED_XDMA "aspeed.xdma"
46
0x080f00d8, 0x00d40808, 0x03080808, 0x080800d0,
88
+#define ASPEED_XDMA(obj) OBJECT_CHECK(AspeedXDMAState, (obj), TYPE_ASPEED_XDMA)
47
0x00dc0808, 0x0b0f0f00, 0x080800b4, 0x00c00808,
89
+
48
0x08080808, 0x180800c4, 0x00b80000, 0x08080808,
90
+#define ASPEED_XDMA_NUM_REGS (ASPEED_XDMA_REG_SIZE / sizeof(uint32_t))
49
@@ -XXX,XX +XXX,XX @@ static void n8x0_boot_init(void *opaque)
91
+#define ASPEED_XDMA_REG_SIZE 0x7C
50
#define OMAP_TAG_CBUS        0x4e03
92
+
51
#define OMAP_TAG_EM_ASIC_BB5    0x4e04
93
+typedef struct AspeedXDMAState {
52
94
+ SysBusDevice parent;
53
-static struct omap_gpiosw_info_s {
95
+
54
+static const struct omap_gpiosw_info_s {
96
+ MemoryRegion iomem;
55
const char *name;
97
+ qemu_irq irq;
56
int line;
98
+
57
int type;
99
+ char bmc_cmdq_readp_set;
58
@@ -XXX,XX +XXX,XX @@ static struct omap_gpiosw_info_s {
100
+ uint32_t regs[ASPEED_XDMA_NUM_REGS];
59
{ NULL }
101
+} AspeedXDMAState;
102
+
103
+#endif /* ASPEED_XDMA_H */
104
diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c
105
index XXXXXXX..XXXXXXX 100644
106
--- a/hw/arm/aspeed_soc.c
107
+++ b/hw/arm/aspeed_soc.c
108
@@ -XXX,XX +XXX,XX @@ static const hwaddr aspeed_soc_ast2400_memmap[] = {
109
[ASPEED_VIC] = 0x1E6C0000,
110
[ASPEED_SDMC] = 0x1E6E0000,
111
[ASPEED_SCU] = 0x1E6E2000,
112
+ [ASPEED_XDMA] = 0x1E6E7000,
113
[ASPEED_ADC] = 0x1E6E9000,
114
[ASPEED_SRAM] = 0x1E720000,
115
[ASPEED_GPIO] = 0x1E780000,
116
@@ -XXX,XX +XXX,XX @@ static const hwaddr aspeed_soc_ast2500_memmap[] = {
117
[ASPEED_VIC] = 0x1E6C0000,
118
[ASPEED_SDMC] = 0x1E6E0000,
119
[ASPEED_SCU] = 0x1E6E2000,
120
+ [ASPEED_XDMA] = 0x1E6E7000,
121
[ASPEED_ADC] = 0x1E6E9000,
122
[ASPEED_SRAM] = 0x1E720000,
123
[ASPEED_GPIO] = 0x1E780000,
124
@@ -XXX,XX +XXX,XX @@ static const int aspeed_soc_ast2400_irqmap[] = {
125
[ASPEED_I2C] = 12,
126
[ASPEED_ETH1] = 2,
127
[ASPEED_ETH2] = 3,
128
+ [ASPEED_XDMA] = 6,
129
};
60
};
130
61
131
#define aspeed_soc_ast2500_irqmap aspeed_soc_ast2400_irqmap
62
-static struct omap_partition_info_s {
132
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_init(Object *obj)
63
+static const struct omap_partition_info_s {
133
sysbus_init_child_obj(obj, "ftgmac100[*]", OBJECT(&s->ftgmac100[i]),
64
uint32_t offset;
134
sizeof(s->ftgmac100[i]), TYPE_FTGMAC100);
65
uint32_t size;
135
}
66
int mask;
136
+
67
@@ -XXX,XX +XXX,XX @@ static struct omap_partition_info_s {
137
+ sysbus_init_child_obj(obj, "xdma", OBJECT(&s->xdma), sizeof(s->xdma),
68
{ 0, 0, 0, NULL }
138
+ TYPE_ASPEED_XDMA);
69
};
139
}
70
140
71
-static uint8_t n8x0_bd_addr[6] = { N8X0_BD_ADDR };
141
static void aspeed_soc_realize(DeviceState *dev, Error **errp)
72
+static const uint8_t n8x0_bd_addr[6] = { N8X0_BD_ADDR };
142
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
73
143
sysbus_connect_irq(SYS_BUS_DEVICE(&s->ftgmac100[i]), 0,
74
static int n8x0_atag_setup(void *p, int model)
144
aspeed_soc_get_irq(s, ASPEED_ETH1 + i));
75
{
145
}
76
uint8_t *b;
146
+
77
uint16_t *w;
147
+ /* XDMA */
78
uint32_t *l;
148
+ object_property_set_bool(OBJECT(&s->xdma), true, "realized", &err);
79
- struct omap_gpiosw_info_s *gpiosw;
149
+ if (err) {
80
- struct omap_partition_info_s *partition;
150
+ error_propagate(errp, err);
81
+ const struct omap_gpiosw_info_s *gpiosw;
151
+ return;
82
+ const struct omap_partition_info_s *partition;
152
+ }
83
const char *tag;
153
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->xdma), 0,
84
154
+ sc->info->memmap[ASPEED_XDMA]);
85
w = p;
155
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->xdma), 0,
156
+ aspeed_soc_get_irq(s, ASPEED_XDMA));
157
}
158
static Property aspeed_soc_properties[] = {
159
DEFINE_PROP_UINT32("num-cpus", AspeedSoCState, num_cpus, 0),
160
diff --git a/hw/misc/aspeed_xdma.c b/hw/misc/aspeed_xdma.c
161
new file mode 100644
162
index XXXXXXX..XXXXXXX
163
--- /dev/null
164
+++ b/hw/misc/aspeed_xdma.c
165
@@ -XXX,XX +XXX,XX @@
166
+/*
167
+ * ASPEED XDMA Controller
168
+ * Eddie James <eajames@linux.ibm.com>
169
+ *
170
+ * Copyright (C) 2019 IBM Corp
171
+ * SPDX-License-Identifer: GPL-2.0-or-later
172
+ */
173
+
174
+#include "qemu/osdep.h"
175
+#include "qemu/log.h"
176
+#include "qemu/error-report.h"
177
+#include "hw/misc/aspeed_xdma.h"
178
+#include "qapi/error.h"
179
+
180
+#include "trace.h"
181
+
182
+#define XDMA_BMC_CMDQ_ADDR 0x10
183
+#define XDMA_BMC_CMDQ_ENDP 0x14
184
+#define XDMA_BMC_CMDQ_WRP 0x18
185
+#define XDMA_BMC_CMDQ_W_MASK 0x0003FFFF
186
+#define XDMA_BMC_CMDQ_RDP 0x1C
187
+#define XDMA_BMC_CMDQ_RDP_MAGIC 0xEE882266
188
+#define XDMA_IRQ_ENG_CTRL 0x20
189
+#define XDMA_IRQ_ENG_CTRL_US_COMP BIT(4)
190
+#define XDMA_IRQ_ENG_CTRL_DS_COMP BIT(5)
191
+#define XDMA_IRQ_ENG_CTRL_W_MASK 0xBFEFF07F
192
+#define XDMA_IRQ_ENG_STAT 0x24
193
+#define XDMA_IRQ_ENG_STAT_US_COMP BIT(4)
194
+#define XDMA_IRQ_ENG_STAT_DS_COMP BIT(5)
195
+#define XDMA_IRQ_ENG_STAT_RESET 0xF8000000
196
+#define XDMA_MEM_SIZE 0x1000
197
+
198
+#define TO_REG(addr) ((addr) / sizeof(uint32_t))
199
+
200
+static uint64_t aspeed_xdma_read(void *opaque, hwaddr addr, unsigned int size)
201
+{
202
+ uint32_t val = 0;
203
+ AspeedXDMAState *xdma = opaque;
204
+
205
+ if (addr < ASPEED_XDMA_REG_SIZE) {
206
+ val = xdma->regs[TO_REG(addr)];
207
+ }
208
+
209
+ return (uint64_t)val;
210
+}
211
+
212
+static void aspeed_xdma_write(void *opaque, hwaddr addr, uint64_t val,
213
+ unsigned int size)
214
+{
215
+ unsigned int idx;
216
+ uint32_t val32 = (uint32_t)val;
217
+ AspeedXDMAState *xdma = opaque;
218
+
219
+ if (addr >= ASPEED_XDMA_REG_SIZE) {
220
+ return;
221
+ }
222
+
223
+ switch (addr) {
224
+ case XDMA_BMC_CMDQ_ENDP:
225
+ xdma->regs[TO_REG(addr)] = val32 & XDMA_BMC_CMDQ_W_MASK;
226
+ break;
227
+ case XDMA_BMC_CMDQ_WRP:
228
+ idx = TO_REG(addr);
229
+ xdma->regs[idx] = val32 & XDMA_BMC_CMDQ_W_MASK;
230
+ xdma->regs[TO_REG(XDMA_BMC_CMDQ_RDP)] = xdma->regs[idx];
231
+
232
+ trace_aspeed_xdma_write(addr, val);
233
+
234
+ if (xdma->bmc_cmdq_readp_set) {
235
+ xdma->bmc_cmdq_readp_set = 0;
236
+ } else {
237
+ xdma->regs[TO_REG(XDMA_IRQ_ENG_STAT)] |=
238
+ XDMA_IRQ_ENG_STAT_US_COMP | XDMA_IRQ_ENG_STAT_DS_COMP;
239
+
240
+ if (xdma->regs[TO_REG(XDMA_IRQ_ENG_CTRL)] &
241
+ (XDMA_IRQ_ENG_CTRL_US_COMP | XDMA_IRQ_ENG_CTRL_DS_COMP))
242
+ qemu_irq_raise(xdma->irq);
243
+ }
244
+ break;
245
+ case XDMA_BMC_CMDQ_RDP:
246
+ trace_aspeed_xdma_write(addr, val);
247
+
248
+ if (val32 == XDMA_BMC_CMDQ_RDP_MAGIC) {
249
+ xdma->bmc_cmdq_readp_set = 1;
250
+ }
251
+ break;
252
+ case XDMA_IRQ_ENG_CTRL:
253
+ xdma->regs[TO_REG(addr)] = val32 & XDMA_IRQ_ENG_CTRL_W_MASK;
254
+ break;
255
+ case XDMA_IRQ_ENG_STAT:
256
+ trace_aspeed_xdma_write(addr, val);
257
+
258
+ idx = TO_REG(addr);
259
+ if (val32 & (XDMA_IRQ_ENG_STAT_US_COMP | XDMA_IRQ_ENG_STAT_DS_COMP)) {
260
+ xdma->regs[idx] &=
261
+ ~(XDMA_IRQ_ENG_STAT_US_COMP | XDMA_IRQ_ENG_STAT_DS_COMP);
262
+ qemu_irq_lower(xdma->irq);
263
+ }
264
+ break;
265
+ default:
266
+ xdma->regs[TO_REG(addr)] = val32;
267
+ break;
268
+ }
269
+}
270
+
271
+static const MemoryRegionOps aspeed_xdma_ops = {
272
+ .read = aspeed_xdma_read,
273
+ .write = aspeed_xdma_write,
274
+ .endianness = DEVICE_NATIVE_ENDIAN,
275
+ .valid.min_access_size = 4,
276
+ .valid.max_access_size = 4,
277
+};
278
+
279
+static void aspeed_xdma_realize(DeviceState *dev, Error **errp)
280
+{
281
+ SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
282
+ AspeedXDMAState *xdma = ASPEED_XDMA(dev);
283
+
284
+ sysbus_init_irq(sbd, &xdma->irq);
285
+ memory_region_init_io(&xdma->iomem, OBJECT(xdma), &aspeed_xdma_ops, xdma,
286
+ TYPE_ASPEED_XDMA, XDMA_MEM_SIZE);
287
+ sysbus_init_mmio(sbd, &xdma->iomem);
288
+}
289
+
290
+static void aspeed_xdma_reset(DeviceState *dev)
291
+{
292
+ AspeedXDMAState *xdma = ASPEED_XDMA(dev);
293
+
294
+ xdma->bmc_cmdq_readp_set = 0;
295
+ memset(xdma->regs, 0, ASPEED_XDMA_REG_SIZE);
296
+ xdma->regs[TO_REG(XDMA_IRQ_ENG_STAT)] = XDMA_IRQ_ENG_STAT_RESET;
297
+
298
+ qemu_irq_lower(xdma->irq);
299
+}
300
+
301
+static const VMStateDescription aspeed_xdma_vmstate = {
302
+ .name = TYPE_ASPEED_XDMA,
303
+ .version_id = 1,
304
+ .fields = (VMStateField[]) {
305
+ VMSTATE_UINT32_ARRAY(regs, AspeedXDMAState, ASPEED_XDMA_NUM_REGS),
306
+ VMSTATE_END_OF_LIST(),
307
+ },
308
+};
309
+
310
+static void aspeed_xdma_class_init(ObjectClass *classp, void *data)
311
+{
312
+ DeviceClass *dc = DEVICE_CLASS(classp);
313
+
314
+ dc->realize = aspeed_xdma_realize;
315
+ dc->reset = aspeed_xdma_reset;
316
+ dc->vmsd = &aspeed_xdma_vmstate;
317
+}
318
+
319
+static const TypeInfo aspeed_xdma_info = {
320
+ .name = TYPE_ASPEED_XDMA,
321
+ .parent = TYPE_SYS_BUS_DEVICE,
322
+ .instance_size = sizeof(AspeedXDMAState),
323
+ .class_init = aspeed_xdma_class_init,
324
+};
325
+
326
+static void aspeed_xdma_register_type(void)
327
+{
328
+ type_register_static(&aspeed_xdma_info);
329
+}
330
+type_init(aspeed_xdma_register_type);
331
diff --git a/hw/misc/trace-events b/hw/misc/trace-events
332
index XXXXXXX..XXXXXXX 100644
333
--- a/hw/misc/trace-events
334
+++ b/hw/misc/trace-events
335
@@ -XXX,XX +XXX,XX @@ armsse_cpuid_write(uint64_t offset, uint64_t data, unsigned size) "SSE-200 CPU_I
336
# armsse-mhu.c
337
armsse_mhu_read(uint64_t offset, uint64_t data, unsigned size) "SSE-200 MHU read: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u"
338
armsse_mhu_write(uint64_t offset, uint64_t data, unsigned size) "SSE-200 MHU write: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u"
339
+
340
+# aspeed_xdma.c
341
+aspeed_xdma_write(uint64_t offset, uint64_t data) "XDMA write: offset 0x%" PRIx64 " data 0x%" PRIx64
342
--
86
--
343
2.20.1
87
2.25.1
344
88
345
89
diff view generated by jsdifflib
1
From: Jan Kiszka <jan.kiszka@siemens.com>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
Allow cortex-a7 to be used with the virt board; it supports
3
Silent when compiling with -Wextra:
4
the v7VE features and there is no reason to deny this type.
5
4
6
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
5
../hw/arm/nseries.c:1081:12: warning: missing field 'line' initializer [-Wmissing-field-initializers]
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
6
{ NULL }
8
Message-id: fc5404f7-4d1d-c28f-6e48-d8799c82acc0@web.de
7
^
8
9
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
10
Message-id: 20221220142520.24094-4-philmd@linaro.org
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
13
---
12
hw/arm/virt.c | 1 +
14
hw/arm/nseries.c | 10 ++++------
13
1 file changed, 1 insertion(+)
15
1 file changed, 4 insertions(+), 6 deletions(-)
14
16
15
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
17
diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c
16
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
17
--- a/hw/arm/virt.c
19
--- a/hw/arm/nseries.c
18
+++ b/hw/arm/virt.c
20
+++ b/hw/arm/nseries.c
19
@@ -XXX,XX +XXX,XX @@ static const int a15irqmap[] = {
21
@@ -XXX,XX +XXX,XX @@ static const struct omap_gpiosw_info_s {
22
"headphone", N8X0_HEADPHONE_GPIO,
23
OMAP_GPIOSW_TYPE_CONNECTION | OMAP_GPIOSW_INVERTED,
24
},
25
- { NULL }
26
+ { /* end of list */ }
27
}, n810_gpiosw_info[] = {
28
{
29
"gps_reset", N810_GPS_RESET_GPIO,
30
@@ -XXX,XX +XXX,XX @@ static const struct omap_gpiosw_info_s {
31
"slide", N810_SLIDE_GPIO,
32
OMAP_GPIOSW_TYPE_COVER | OMAP_GPIOSW_INVERTED,
33
},
34
- { NULL }
35
+ { /* end of list */ }
20
};
36
};
21
37
22
static const char *valid_cpus[] = {
38
static const struct omap_partition_info_s {
23
+ ARM_CPU_TYPE_NAME("cortex-a7"),
39
@@ -XXX,XX +XXX,XX @@ static const struct omap_partition_info_s {
24
ARM_CPU_TYPE_NAME("cortex-a15"),
40
{ 0x00080000, 0x00200000, 0x0, "kernel" },
25
ARM_CPU_TYPE_NAME("cortex-a53"),
41
{ 0x00280000, 0x00200000, 0x3, "initfs" },
26
ARM_CPU_TYPE_NAME("cortex-a57"),
42
{ 0x00480000, 0x0fb80000, 0x3, "rootfs" },
43
-
44
- { 0, 0, 0, NULL }
45
+ { /* end of list */ }
46
}, n810_part_info[] = {
47
{ 0x00000000, 0x00020000, 0x3, "bootloader" },
48
{ 0x00020000, 0x00060000, 0x0, "config" },
49
{ 0x00080000, 0x00220000, 0x0, "kernel" },
50
{ 0x002a0000, 0x00400000, 0x0, "initfs" },
51
{ 0x006a0000, 0x0f960000, 0x0, "rootfs" },
52
-
53
- { 0, 0, 0, NULL }
54
+ { /* end of list */ }
55
};
56
57
static const uint8_t n8x0_bd_addr[6] = { N8X0_BD_ADDR };
27
--
58
--
28
2.20.1
59
2.25.1
29
60
30
61
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
From: Zhuojia Shen <chaosdefinition@hotmail.com>
2
2
3
Reviewed-by: Robert Bradford <robert.bradford@intel.com>
3
In CPUID registers exposed to userspace, some registers were missing
4
Reviewed-by: Samuel Ortiz <sameo@linux.intel.com>
4
and some fields were not exposed. This patch aligns exposed ID
5
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
5
registers and their fields with what the upstream kernel currently
6
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
6
exposes.
7
Message-id: 20190701132516.26392-6-philmd@redhat.com
7
8
Specifically, the following new ID registers/fields are exposed to
9
userspace:
10
11
ID_AA64PFR1_EL1.BT: bits 3-0
12
ID_AA64PFR1_EL1.MTE: bits 11-8
13
ID_AA64PFR1_EL1.SME: bits 27-24
14
15
ID_AA64ZFR0_EL1.SVEver: bits 3-0
16
ID_AA64ZFR0_EL1.AES: bits 7-4
17
ID_AA64ZFR0_EL1.BitPerm: bits 19-16
18
ID_AA64ZFR0_EL1.BF16: bits 23-20
19
ID_AA64ZFR0_EL1.SHA3: bits 35-32
20
ID_AA64ZFR0_EL1.SM4: bits 43-40
21
ID_AA64ZFR0_EL1.I8MM: bits 47-44
22
ID_AA64ZFR0_EL1.F32MM: bits 55-52
23
ID_AA64ZFR0_EL1.F64MM: bits 59-56
24
25
ID_AA64SMFR0_EL1.F32F32: bit 32
26
ID_AA64SMFR0_EL1.B16F32: bit 34
27
ID_AA64SMFR0_EL1.F16F32: bit 35
28
ID_AA64SMFR0_EL1.I8I32: bits 39-36
29
ID_AA64SMFR0_EL1.F64F64: bit 48
30
ID_AA64SMFR0_EL1.I16I64: bits 55-52
31
ID_AA64SMFR0_EL1.FA64: bit 63
32
33
ID_AA64MMFR0_EL1.ECV: bits 63-60
34
35
ID_AA64MMFR1_EL1.AFP: bits 47-44
36
37
ID_AA64MMFR2_EL1.AT: bits 35-32
38
39
ID_AA64ISAR0_EL1.RNDR: bits 63-60
40
41
ID_AA64ISAR1_EL1.FRINTTS: bits 35-32
42
ID_AA64ISAR1_EL1.BF16: bits 47-44
43
ID_AA64ISAR1_EL1.DGH: bits 51-48
44
ID_AA64ISAR1_EL1.I8MM: bits 55-52
45
46
ID_AA64ISAR2_EL1.WFxT: bits 3-0
47
ID_AA64ISAR2_EL1.RPRES: bits 7-4
48
ID_AA64ISAR2_EL1.GPA3: bits 11-8
49
ID_AA64ISAR2_EL1.APA3: bits 15-12
50
51
The code is also refactored to use symbolic names for ID register fields
52
for better readability and maintainability.
53
54
The test case in tests/tcg/aarch64/sysregs.c is also updated to match
55
the intended behavior.
56
57
Signed-off-by: Zhuojia Shen <chaosdefinition@hotmail.com>
58
Message-id: DS7PR12MB6309FB585E10772928F14271ACE79@DS7PR12MB6309.namprd12.prod.outlook.com
59
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
60
[PMM: use Sn_n_Cn_Cn_n syntax to work with older assemblers
61
that don't recognize id_aa64isar2_el1 and id_aa64mmfr2_el1]
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
62
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
63
---
10
target/arm/helper.c | 7 +++++++
64
target/arm/helper.c | 96 +++++++++++++++++++++++++------
11
1 file changed, 7 insertions(+)
65
tests/tcg/aarch64/sysregs.c | 24 ++++++--
66
tests/tcg/aarch64/Makefile.target | 7 ++-
67
3 files changed, 103 insertions(+), 24 deletions(-)
12
68
13
diff --git a/target/arm/helper.c b/target/arm/helper.c
69
diff --git a/target/arm/helper.c b/target/arm/helper.c
14
index XXXXXXX..XXXXXXX 100644
70
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/helper.c
71
--- a/target/arm/helper.c
16
+++ b/target/arm/helper.c
72
+++ b/target/arm/helper.c
73
@@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu)
74
#ifdef CONFIG_USER_ONLY
75
static const ARMCPRegUserSpaceInfo v8_user_idregs[] = {
76
{ .name = "ID_AA64PFR0_EL1",
77
- .exported_bits = 0x000f000f00ff0000,
78
- .fixed_bits = 0x0000000000000011 },
79
+ .exported_bits = R_ID_AA64PFR0_FP_MASK |
80
+ R_ID_AA64PFR0_ADVSIMD_MASK |
81
+ R_ID_AA64PFR0_SVE_MASK |
82
+ R_ID_AA64PFR0_DIT_MASK,
83
+ .fixed_bits = (0x1u << R_ID_AA64PFR0_EL0_SHIFT) |
84
+ (0x1u << R_ID_AA64PFR0_EL1_SHIFT) },
85
{ .name = "ID_AA64PFR1_EL1",
86
- .exported_bits = 0x00000000000000f0 },
87
+ .exported_bits = R_ID_AA64PFR1_BT_MASK |
88
+ R_ID_AA64PFR1_SSBS_MASK |
89
+ R_ID_AA64PFR1_MTE_MASK |
90
+ R_ID_AA64PFR1_SME_MASK },
91
{ .name = "ID_AA64PFR*_EL1_RESERVED",
92
- .is_glob = true },
93
- { .name = "ID_AA64ZFR0_EL1" },
94
+ .is_glob = true },
95
+ { .name = "ID_AA64ZFR0_EL1",
96
+ .exported_bits = R_ID_AA64ZFR0_SVEVER_MASK |
97
+ R_ID_AA64ZFR0_AES_MASK |
98
+ R_ID_AA64ZFR0_BITPERM_MASK |
99
+ R_ID_AA64ZFR0_BFLOAT16_MASK |
100
+ R_ID_AA64ZFR0_SHA3_MASK |
101
+ R_ID_AA64ZFR0_SM4_MASK |
102
+ R_ID_AA64ZFR0_I8MM_MASK |
103
+ R_ID_AA64ZFR0_F32MM_MASK |
104
+ R_ID_AA64ZFR0_F64MM_MASK },
105
+ { .name = "ID_AA64SMFR0_EL1",
106
+ .exported_bits = R_ID_AA64SMFR0_F32F32_MASK |
107
+ R_ID_AA64SMFR0_B16F32_MASK |
108
+ R_ID_AA64SMFR0_F16F32_MASK |
109
+ R_ID_AA64SMFR0_I8I32_MASK |
110
+ R_ID_AA64SMFR0_F64F64_MASK |
111
+ R_ID_AA64SMFR0_I16I64_MASK |
112
+ R_ID_AA64SMFR0_FA64_MASK },
113
{ .name = "ID_AA64MMFR0_EL1",
114
- .fixed_bits = 0x00000000ff000000 },
115
- { .name = "ID_AA64MMFR1_EL1" },
116
+ .exported_bits = R_ID_AA64MMFR0_ECV_MASK,
117
+ .fixed_bits = (0xfu << R_ID_AA64MMFR0_TGRAN64_SHIFT) |
118
+ (0xfu << R_ID_AA64MMFR0_TGRAN4_SHIFT) },
119
+ { .name = "ID_AA64MMFR1_EL1",
120
+ .exported_bits = R_ID_AA64MMFR1_AFP_MASK },
121
+ { .name = "ID_AA64MMFR2_EL1",
122
+ .exported_bits = R_ID_AA64MMFR2_AT_MASK },
123
{ .name = "ID_AA64MMFR*_EL1_RESERVED",
124
- .is_glob = true },
125
+ .is_glob = true },
126
{ .name = "ID_AA64DFR0_EL1",
127
- .fixed_bits = 0x0000000000000006 },
128
- { .name = "ID_AA64DFR1_EL1" },
129
+ .fixed_bits = (0x6u << R_ID_AA64DFR0_DEBUGVER_SHIFT) },
130
+ { .name = "ID_AA64DFR1_EL1" },
131
{ .name = "ID_AA64DFR*_EL1_RESERVED",
132
- .is_glob = true },
133
+ .is_glob = true },
134
{ .name = "ID_AA64AFR*",
135
- .is_glob = true },
136
+ .is_glob = true },
137
{ .name = "ID_AA64ISAR0_EL1",
138
- .exported_bits = 0x00fffffff0fffff0 },
139
+ .exported_bits = R_ID_AA64ISAR0_AES_MASK |
140
+ R_ID_AA64ISAR0_SHA1_MASK |
141
+ R_ID_AA64ISAR0_SHA2_MASK |
142
+ R_ID_AA64ISAR0_CRC32_MASK |
143
+ R_ID_AA64ISAR0_ATOMIC_MASK |
144
+ R_ID_AA64ISAR0_RDM_MASK |
145
+ R_ID_AA64ISAR0_SHA3_MASK |
146
+ R_ID_AA64ISAR0_SM3_MASK |
147
+ R_ID_AA64ISAR0_SM4_MASK |
148
+ R_ID_AA64ISAR0_DP_MASK |
149
+ R_ID_AA64ISAR0_FHM_MASK |
150
+ R_ID_AA64ISAR0_TS_MASK |
151
+ R_ID_AA64ISAR0_RNDR_MASK },
152
{ .name = "ID_AA64ISAR1_EL1",
153
- .exported_bits = 0x000000f0ffffffff },
154
+ .exported_bits = R_ID_AA64ISAR1_DPB_MASK |
155
+ R_ID_AA64ISAR1_APA_MASK |
156
+ R_ID_AA64ISAR1_API_MASK |
157
+ R_ID_AA64ISAR1_JSCVT_MASK |
158
+ R_ID_AA64ISAR1_FCMA_MASK |
159
+ R_ID_AA64ISAR1_LRCPC_MASK |
160
+ R_ID_AA64ISAR1_GPA_MASK |
161
+ R_ID_AA64ISAR1_GPI_MASK |
162
+ R_ID_AA64ISAR1_FRINTTS_MASK |
163
+ R_ID_AA64ISAR1_SB_MASK |
164
+ R_ID_AA64ISAR1_BF16_MASK |
165
+ R_ID_AA64ISAR1_DGH_MASK |
166
+ R_ID_AA64ISAR1_I8MM_MASK },
167
+ { .name = "ID_AA64ISAR2_EL1",
168
+ .exported_bits = R_ID_AA64ISAR2_WFXT_MASK |
169
+ R_ID_AA64ISAR2_RPRES_MASK |
170
+ R_ID_AA64ISAR2_GPA3_MASK |
171
+ R_ID_AA64ISAR2_APA3_MASK },
172
{ .name = "ID_AA64ISAR*_EL1_RESERVED",
173
- .is_glob = true },
174
+ .is_glob = true },
175
};
176
modify_arm_cp_regs(v8_idregs, v8_user_idregs);
177
#endif
178
@@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu)
179
#ifdef CONFIG_USER_ONLY
180
static const ARMCPRegUserSpaceInfo id_v8_user_midr_cp_reginfo[] = {
181
{ .name = "MIDR_EL1",
182
- .exported_bits = 0x00000000ffffffff },
183
- { .name = "REVIDR_EL1" },
184
+ .exported_bits = R_MIDR_EL1_REVISION_MASK |
185
+ R_MIDR_EL1_PARTNUM_MASK |
186
+ R_MIDR_EL1_ARCHITECTURE_MASK |
187
+ R_MIDR_EL1_VARIANT_MASK |
188
+ R_MIDR_EL1_IMPLEMENTER_MASK },
189
+ { .name = "REVIDR_EL1" },
190
};
191
modify_arm_cp_regs(id_v8_midr_cp_reginfo, id_v8_user_midr_cp_reginfo);
192
#endif
193
diff --git a/tests/tcg/aarch64/sysregs.c b/tests/tcg/aarch64/sysregs.c
194
index XXXXXXX..XXXXXXX 100644
195
--- a/tests/tcg/aarch64/sysregs.c
196
+++ b/tests/tcg/aarch64/sysregs.c
17
@@ -XXX,XX +XXX,XX @@
197
@@ -XXX,XX +XXX,XX @@
198
#define HWCAP_CPUID (1 << 11)
199
#endif
200
18
+/*
201
+/*
19
+ * ARM generic helpers.
202
+ * Older assemblers don't recognize newer system register names,
20
+ *
203
+ * but we can still access them by the Sn_n_Cn_Cn_n syntax.
21
+ * This code is licensed under the GNU GPL v2 or later.
22
+ *
23
+ * SPDX-License-Identifier: GPL-2.0-or-later
24
+ */
204
+ */
25
#include "qemu/osdep.h"
205
+#define SYS_ID_AA64ISAR2_EL1 S3_0_C0_C6_2
26
#include "qemu/units.h"
206
+#define SYS_ID_AA64MMFR2_EL1 S3_0_C0_C7_2
27
#include "target/arm/idau.h"
207
+
208
int failed_bit_count;
209
210
/* Read and print system register `id' value */
211
@@ -XXX,XX +XXX,XX @@ int main(void)
212
* minimum valid fields - for the purposes of this check allowed
213
* to have non-zero values.
214
*/
215
- get_cpu_reg_check_mask(id_aa64isar0_el1, _m(00ff,ffff,f0ff,fff0));
216
- get_cpu_reg_check_mask(id_aa64isar1_el1, _m(0000,00f0,ffff,ffff));
217
+ get_cpu_reg_check_mask(id_aa64isar0_el1, _m(f0ff,ffff,f0ff,fff0));
218
+ get_cpu_reg_check_mask(id_aa64isar1_el1, _m(00ff,f0ff,ffff,ffff));
219
+ get_cpu_reg_check_mask(SYS_ID_AA64ISAR2_EL1, _m(0000,0000,0000,ffff));
220
/* TGran4 & TGran64 as pegged to -1 */
221
- get_cpu_reg_check_mask(id_aa64mmfr0_el1, _m(0000,0000,ff00,0000));
222
- get_cpu_reg_check_zero(id_aa64mmfr1_el1);
223
+ get_cpu_reg_check_mask(id_aa64mmfr0_el1, _m(f000,0000,ff00,0000));
224
+ get_cpu_reg_check_mask(id_aa64mmfr1_el1, _m(0000,f000,0000,0000));
225
+ get_cpu_reg_check_mask(SYS_ID_AA64MMFR2_EL1, _m(0000,000f,0000,0000));
226
/* EL1/EL0 reported as AA64 only */
227
get_cpu_reg_check_mask(id_aa64pfr0_el1, _m(000f,000f,00ff,0011));
228
- get_cpu_reg_check_mask(id_aa64pfr1_el1, _m(0000,0000,0000,00f0));
229
+ get_cpu_reg_check_mask(id_aa64pfr1_el1, _m(0000,0000,0f00,0fff));
230
/* all hidden, DebugVer fixed to 0x6 (ARMv8 debug architecture) */
231
get_cpu_reg_check_mask(id_aa64dfr0_el1, _m(0000,0000,0000,0006));
232
get_cpu_reg_check_zero(id_aa64dfr1_el1);
233
- get_cpu_reg_check_zero(id_aa64zfr0_el1);
234
+ get_cpu_reg_check_mask(id_aa64zfr0_el1, _m(0ff0,ff0f,00ff,00ff));
235
+#ifdef HAS_ARMV9_SME
236
+ get_cpu_reg_check_mask(id_aa64smfr0_el1, _m(80f1,00fd,0000,0000));
237
+#endif
238
239
get_cpu_reg_check_zero(id_aa64afr0_el1);
240
get_cpu_reg_check_zero(id_aa64afr1_el1);
241
diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile.target
242
index XXXXXXX..XXXXXXX 100644
243
--- a/tests/tcg/aarch64/Makefile.target
244
+++ b/tests/tcg/aarch64/Makefile.target
245
@@ -XXX,XX +XXX,XX @@ config-cc.mak: Makefile
246
     $(call cc-option,-march=armv8.1-a+sve2, CROSS_CC_HAS_SVE2); \
247
     $(call cc-option,-march=armv8.3-a, CROSS_CC_HAS_ARMV8_3); \
248
     $(call cc-option,-mbranch-protection=standard, CROSS_CC_HAS_ARMV8_BTI); \
249
-     $(call cc-option,-march=armv8.5-a+memtag, CROSS_CC_HAS_ARMV8_MTE)) 3> config-cc.mak
250
+     $(call cc-option,-march=armv8.5-a+memtag, CROSS_CC_HAS_ARMV8_MTE); \
251
+     $(call cc-option,-march=armv9-a+sme, CROSS_CC_HAS_ARMV9_SME)) 3> config-cc.mak
252
-include config-cc.mak
253
254
# Pauth Tests
255
@@ -XXX,XX +XXX,XX @@ endif
256
ifneq ($(CROSS_CC_HAS_SVE),)
257
# System Registers Tests
258
AARCH64_TESTS += sysregs
259
+ifneq ($(CROSS_CC_HAS_ARMV9_SME),)
260
+sysregs: CFLAGS+=-march=armv9-a+sme -DHAS_ARMV9_SME
261
+else
262
sysregs: CFLAGS+=-march=armv8.1-a+sve
263
+endif
264
265
# SVE ioctl test
266
AARCH64_TESTS += sve-ioctls
28
--
267
--
29
2.20.1
268
2.25.1
30
31
diff view generated by jsdifflib
1
From: Adriana Kobylak <anoo@us.ibm.com>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
The Swift board is an OpenPOWER system hosting POWER processors.
3
This function is not used anywhere outside this file,
4
Add support for their BMC including the I2C devices as found on HW.
4
so we can make the function "static void".
5
5
6
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
6
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7
Reviewed-by: Cédric Le Goater <clg@kaod.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Reviewed-by: Joel Stanley <joel@jms.id.au>
8
Reviewed-by: Eric Auger <eric.auger@redhat.com>
9
Message-id: 20190618165311.27066-20-clg@kaod.org
9
Message-id: 20221216214924.4711-2-philmd@linaro.org
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
11
---
12
hw/arm/aspeed.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++++
12
include/hw/arm/smmu-common.h | 3 ---
13
1 file changed, 50 insertions(+)
13
hw/arm/smmu-common.c | 2 +-
14
2 files changed, 1 insertion(+), 4 deletions(-)
14
15
15
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
16
diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h
16
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
17
--- a/hw/arm/aspeed.c
18
--- a/include/hw/arm/smmu-common.h
18
+++ b/hw/arm/aspeed.c
19
+++ b/include/hw/arm/smmu-common.h
19
@@ -XXX,XX +XXX,XX @@ struct AspeedBoardState {
20
@@ -XXX,XX +XXX,XX @@ void smmu_iotlb_inv_iova(SMMUState *s, int asid, dma_addr_t iova,
20
SCU_AST2500_HW_STRAP_ACPI_ENABLE | \
21
/* Unmap the range of all the notifiers registered to any IOMMU mr */
21
SCU_HW_STRAP_SPI_MODE(SCU_HW_STRAP_SPI_MASTER))
22
void smmu_inv_notifiers_all(SMMUState *s);
22
23
23
+/* Swift hardware value: 0xF11AD206 */
24
-/* Unmap the range of all the notifiers registered to @mr */
24
+#define SWIFT_BMC_HW_STRAP1 ( \
25
-void smmu_inv_notifiers_mr(IOMMUMemoryRegion *mr);
25
+ AST2500_HW_STRAP1_DEFAULTS | \
26
-
26
+ SCU_AST2500_HW_STRAP_SPI_AUTOFETCH_ENABLE | \
27
#endif /* HW_ARM_SMMU_COMMON_H */
27
+ SCU_AST2500_HW_STRAP_GPIO_STRAP_ENABLE | \
28
diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
28
+ SCU_AST2500_HW_STRAP_UART_DEBUG | \
29
index XXXXXXX..XXXXXXX 100644
29
+ SCU_AST2500_HW_STRAP_DDR4_ENABLE | \
30
--- a/hw/arm/smmu-common.c
30
+ SCU_H_PLL_BYPASS_EN | \
31
+++ b/hw/arm/smmu-common.c
31
+ SCU_AST2500_HW_STRAP_ACPI_ENABLE | \
32
@@ -XXX,XX +XXX,XX @@ static void smmu_unmap_notifier_range(IOMMUNotifier *n)
32
+ SCU_HW_STRAP_SPI_MODE(SCU_HW_STRAP_SPI_MASTER))
33
+
34
/* Witherspoon hardware value: 0xF10AD216 (but use romulus definition) */
35
#define WITHERSPOON_BMC_HW_STRAP1 ROMULUS_BMC_HW_STRAP1
36
37
@@ -XXX,XX +XXX,XX @@ static void romulus_bmc_i2c_init(AspeedBoardState *bmc)
38
i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 11), "ds1338", 0x32);
39
}
33
}
40
34
41
+static void swift_bmc_i2c_init(AspeedBoardState *bmc)
35
/* Unmap all notifiers attached to @mr */
42
+{
36
-inline void smmu_inv_notifiers_mr(IOMMUMemoryRegion *mr)
43
+ AspeedSoCState *soc = &bmc->soc;
37
+static void smmu_inv_notifiers_mr(IOMMUMemoryRegion *mr)
44
+
45
+ i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 3), "pca9552", 0x60);
46
+
47
+ /* The swift board expects a TMP275 but a TMP105 is compatible */
48
+ i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 7), "tmp105", 0x48);
49
+ /* The swift board expects a pca9551 but a pca9552 is compatible */
50
+ i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 7), "pca9552", 0x60);
51
+
52
+ /* The swift board expects an Epson RX8900 RTC but a ds1338 is compatible */
53
+ i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 8), "ds1338", 0x32);
54
+ i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 8), "pca9552", 0x60);
55
+
56
+ i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 9), "tmp423", 0x4c);
57
+ /* The swift board expects a pca9539 but a pca9552 is compatible */
58
+ i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 9), "pca9552", 0x74);
59
+
60
+ i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 10), "tmp423", 0x4c);
61
+ /* The swift board expects a pca9539 but a pca9552 is compatible */
62
+ i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 10), "pca9552",
63
+ 0x74);
64
+
65
+ /* The swift board expects a TMP275 but a TMP105 is compatible */
66
+ i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 12), "tmp105", 0x48);
67
+ i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 12), "tmp105", 0x4a);
68
+}
69
+
70
static void witherspoon_bmc_i2c_init(AspeedBoardState *bmc)
71
{
38
{
72
AspeedSoCState *soc = &bmc->soc;
39
IOMMUNotifier *n;
73
@@ -XXX,XX +XXX,XX @@ static const AspeedBoardConfig aspeed_boards[] = {
40
74
.num_cs = 2,
75
.i2c_init = romulus_bmc_i2c_init,
76
.ram = 512 * MiB,
77
+ }, {
78
+ .name = MACHINE_TYPE_NAME("swift-bmc"),
79
+ .desc = "OpenPOWER Swift BMC (ARM1176)",
80
+ .soc_name = "ast2500-a1",
81
+ .hw_strap1 = SWIFT_BMC_HW_STRAP1,
82
+ .fmc_model = "mx66l1g45g",
83
+ .spi_model = "mx66l1g45g",
84
+ .num_cs = 2,
85
+ .i2c_init = swift_bmc_i2c_init,
86
+ .ram = 512 * MiB,
87
}, {
88
.name = MACHINE_TYPE_NAME("witherspoon-bmc"),
89
.desc = "OpenPOWER Witherspoon BMC (ARM1176)",
90
--
41
--
91
2.20.1
42
2.25.1
92
43
93
44
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
In the next commit we will split the M-profile functions from this
3
When using Clang ("Apple clang version 14.0.0 (clang-1400.0.29.202)")
4
file. Some function will be called out of helper.c. Declare them in
4
and building with -Wall we get:
5
the "internals.h" header.
6
5
7
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
6
hw/arm/smmu-common.c:173:33: warning: static function 'smmu_hash_remove_by_asid_iova' is used in an inline function with external linkage [-Wstatic-in-inline]
8
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
7
hw/arm/smmu-common.h:170:1: note: use 'static' to give inline function 'smmu_iotlb_inv_iova' internal linkage
9
Message-id: 20190701132516.26392-22-philmd@redhat.com
8
void smmu_iotlb_inv_iova(SMMUState *s, int asid, dma_addr_t iova,
9
^
10
static
11
12
None of our code base require / use inlined functions with external
13
linkage. Some places use internal inlining in the hot path. These
14
two functions are certainly not in any hot path and don't justify
15
any inlining, so these are likely oversights rather than intentional.
16
17
Reported-by: Stefan Weil <sw@weilnetz.de>
18
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
19
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
20
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
21
Reviewed-by: Eric Auger <eric.auger@redhat.com>
22
Message-id: 20221216214924.4711-3-philmd@linaro.org
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
23
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
24
---
12
target/arm/internals.h | 42 ++++++++++++++++++++++++++++++++++++++++++
25
hw/arm/smmu-common.c | 13 ++++++-------
13
target/arm/helper.c | 38 ++------------------------------------
26
1 file changed, 6 insertions(+), 7 deletions(-)
14
2 files changed, 44 insertions(+), 36 deletions(-)
15
27
16
diff --git a/target/arm/internals.h b/target/arm/internals.h
28
diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
17
index XXXXXXX..XXXXXXX 100644
29
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/internals.h
30
--- a/hw/arm/smmu-common.c
19
+++ b/target/arm/internals.h
31
+++ b/hw/arm/smmu-common.c
20
@@ -XXX,XX +XXX,XX @@ static inline uint32_t v7m_sp_limit(CPUARMState *env)
32
@@ -XXX,XX +XXX,XX @@ void smmu_iotlb_insert(SMMUState *bs, SMMUTransCfg *cfg, SMMUTLBEntry *new)
21
}
33
g_hash_table_insert(bs->iotlb, key, new);
22
}
34
}
23
35
24
+/**
36
-inline void smmu_iotlb_inv_all(SMMUState *s)
25
+ * v7m_cpacr_pass:
37
+void smmu_iotlb_inv_all(SMMUState *s)
26
+ * Return true if the v7M CPACR permits access to the FPU for the specified
38
{
27
+ * security state and privilege level.
39
trace_smmu_iotlb_inv_all();
28
+ */
40
g_hash_table_remove_all(s->iotlb);
29
+static inline bool v7m_cpacr_pass(CPUARMState *env,
41
@@ -XXX,XX +XXX,XX @@ static gboolean smmu_hash_remove_by_asid_iova(gpointer key, gpointer value,
30
+ bool is_secure, bool is_priv)
42
((entry->iova & ~info->mask) == info->iova);
31
+{
32
+ switch (extract32(env->v7m.cpacr[is_secure], 20, 2)) {
33
+ case 0:
34
+ case 2: /* UNPREDICTABLE: we treat like 0 */
35
+ return false;
36
+ case 1:
37
+ return is_priv;
38
+ case 3:
39
+ return true;
40
+ default:
41
+ g_assert_not_reached();
42
+ }
43
+}
44
+
45
/**
46
* aarch32_mode_name(): Return name of the AArch32 CPU mode
47
* @psr: Program Status Register indicating CPU mode
48
@@ -XXX,XX +XXX,XX @@ static inline int exception_target_el(CPUARMState *env)
49
50
#ifndef CONFIG_USER_ONLY
51
52
+/* Security attributes for an address, as returned by v8m_security_lookup. */
53
+typedef struct V8M_SAttributes {
54
+ bool subpage; /* true if these attrs don't cover the whole TARGET_PAGE */
55
+ bool ns;
56
+ bool nsc;
57
+ uint8_t sregion;
58
+ bool srvalid;
59
+ uint8_t iregion;
60
+ bool irvalid;
61
+} V8M_SAttributes;
62
+
63
+void v8m_security_lookup(CPUARMState *env, uint32_t address,
64
+ MMUAccessType access_type, ARMMMUIdx mmu_idx,
65
+ V8M_SAttributes *sattrs);
66
+
67
+bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address,
68
+ MMUAccessType access_type, ARMMMUIdx mmu_idx,
69
+ hwaddr *phys_ptr, MemTxAttrs *txattrs,
70
+ int *prot, bool *is_subpage,
71
+ ARMMMUFaultInfo *fi, uint32_t *mregion);
72
+
73
/* Cacheability and shareability attributes for a memory access */
74
typedef struct ARMCacheAttrs {
75
unsigned int attrs:8; /* as in the MAIR register encoding */
76
diff --git a/target/arm/helper.c b/target/arm/helper.c
77
index XXXXXXX..XXXXXXX 100644
78
--- a/target/arm/helper.c
79
+++ b/target/arm/helper.c
80
@@ -XXX,XX +XXX,XX @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address,
81
hwaddr *phys_ptr, MemTxAttrs *txattrs, int *prot,
82
target_ulong *page_size_ptr,
83
ARMMMUFaultInfo *fi, ARMCacheAttrs *cacheattrs);
84
-
85
-/* Security attributes for an address, as returned by v8m_security_lookup. */
86
-typedef struct V8M_SAttributes {
87
- bool subpage; /* true if these attrs don't cover the whole TARGET_PAGE */
88
- bool ns;
89
- bool nsc;
90
- uint8_t sregion;
91
- bool srvalid;
92
- uint8_t iregion;
93
- bool irvalid;
94
-} V8M_SAttributes;
95
-
96
-static void v8m_security_lookup(CPUARMState *env, uint32_t address,
97
- MMUAccessType access_type, ARMMMUIdx mmu_idx,
98
- V8M_SAttributes *sattrs);
99
#endif
100
101
static void switch_mode(CPUARMState *env, int mode);
102
@@ -XXX,XX +XXX,XX @@ void arm_log_exception(int idx)
103
}
104
}
43
}
105
44
106
-/*
45
-inline void
107
- * Return true if the v7M CPACR permits access to the FPU for the specified
46
-smmu_iotlb_inv_iova(SMMUState *s, int asid, dma_addr_t iova,
108
- * security state and privilege level.
47
- uint8_t tg, uint64_t num_pages, uint8_t ttl)
109
- */
48
+void smmu_iotlb_inv_iova(SMMUState *s, int asid, dma_addr_t iova,
110
-static bool v7m_cpacr_pass(CPUARMState *env, bool is_secure, bool is_priv)
49
+ uint8_t tg, uint64_t num_pages, uint8_t ttl)
111
-{
50
{
112
- switch (extract32(env->v7m.cpacr[is_secure], 20, 2)) {
51
/* if tg is not set we use 4KB range invalidation */
113
- case 0:
52
uint8_t granule = tg ? tg * 2 + 10 : 12;
114
- case 2: /* UNPREDICTABLE: we treat like 0 */
53
@@ -XXX,XX +XXX,XX @@ smmu_iotlb_inv_iova(SMMUState *s, int asid, dma_addr_t iova,
115
- return false;
54
&info);
116
- case 1:
117
- return is_priv;
118
- case 3:
119
- return true;
120
- default:
121
- g_assert_not_reached();
122
- }
123
-}
124
-
125
/*
126
* What kind of stack write are we doing? This affects how exceptions
127
* generated during the stacking are treated.
128
@@ -XXX,XX +XXX,XX @@ static bool v8m_is_sau_exempt(CPUARMState *env,
129
(address >= 0xe00ff000 && address <= 0xe00fffff);
130
}
55
}
131
56
132
-static void v8m_security_lookup(CPUARMState *env, uint32_t address,
57
-inline void smmu_iotlb_inv_asid(SMMUState *s, uint16_t asid)
133
+void v8m_security_lookup(CPUARMState *env, uint32_t address,
58
+void smmu_iotlb_inv_asid(SMMUState *s, uint16_t asid)
134
MMUAccessType access_type, ARMMMUIdx mmu_idx,
135
V8M_SAttributes *sattrs)
136
{
59
{
137
@@ -XXX,XX +XXX,XX @@ static void v8m_security_lookup(CPUARMState *env, uint32_t address,
60
trace_smmu_iotlb_inv_asid(asid);
138
}
61
g_hash_table_foreach_remove(s->iotlb, smmu_hash_remove_by_asid, &asid);
139
}
62
@@ -XXX,XX +XXX,XX @@ error:
140
63
*
141
-static bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address,
64
* return 0 on success
142
+bool pmsav8_mpu_lookup(CPUARMState *env, uint32_t address,
65
*/
143
MMUAccessType access_type, ARMMMUIdx mmu_idx,
66
-inline int smmu_ptw(SMMUTransCfg *cfg, dma_addr_t iova, IOMMUAccessFlags perm,
144
hwaddr *phys_ptr, MemTxAttrs *txattrs,
67
- SMMUTLBEntry *tlbe, SMMUPTWEventInfo *info)
145
int *prot, bool *is_subpage,
68
+int smmu_ptw(SMMUTransCfg *cfg, dma_addr_t iova, IOMMUAccessFlags perm,
69
+ SMMUTLBEntry *tlbe, SMMUPTWEventInfo *info)
70
{
71
if (!cfg->aa64) {
72
/*
146
--
73
--
147
2.20.1
74
2.25.1
148
75
149
76
diff view generated by jsdifflib
1
From: Andrey Smirnov <andrew.smirnov@gmail.com>
1
From: Jean-Christophe Dubois <jcd@tribudubois.net>
2
2
3
Instantiate no-op APBH DMA module. Needed to boot latest Linux kernel.
3
So far the GPT timers were unable to raise IRQs to the processor.
4
4
5
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
5
Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net>
6
Cc: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Cc: Michael S. Tsirkin <mst@redhat.com>
8
Cc: qemu-devel@nongnu.org
9
Cc: qemu-arm@nongnu.org
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12
---
8
---
13
include/hw/arm/fsl-imx7.h | 3 +++
9
include/hw/arm/fsl-imx7.h | 5 +++++
14
hw/arm/fsl-imx7.c | 6 ++++++
10
hw/arm/fsl-imx7.c | 10 ++++++++++
15
2 files changed, 9 insertions(+)
11
2 files changed, 15 insertions(+)
16
12
17
diff --git a/include/hw/arm/fsl-imx7.h b/include/hw/arm/fsl-imx7.h
13
diff --git a/include/hw/arm/fsl-imx7.h b/include/hw/arm/fsl-imx7.h
18
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
19
--- a/include/hw/arm/fsl-imx7.h
15
--- a/include/hw/arm/fsl-imx7.h
20
+++ b/include/hw/arm/fsl-imx7.h
16
+++ b/include/hw/arm/fsl-imx7.h
21
@@ -XXX,XX +XXX,XX @@ enum FslIMX7MemoryMap {
17
@@ -XXX,XX +XXX,XX @@ enum FslIMX7IRQs {
22
FSL_IMX7_PCIE_REG_SIZE = 16 * 1024,
18
FSL_IMX7_USB2_IRQ = 42,
23
19
FSL_IMX7_USB3_IRQ = 40,
24
FSL_IMX7_GPR_ADDR = 0x30340000,
20
21
+ FSL_IMX7_GPT1_IRQ = 55,
22
+ FSL_IMX7_GPT2_IRQ = 54,
23
+ FSL_IMX7_GPT3_IRQ = 53,
24
+ FSL_IMX7_GPT4_IRQ = 52,
25
+
25
+
26
+ FSL_IMX7_DMA_APBH_ADDR = 0x33000000,
26
FSL_IMX7_WDOG1_IRQ = 78,
27
+ FSL_IMX7_DMA_APBH_SIZE = 0x2000,
27
FSL_IMX7_WDOG2_IRQ = 79,
28
};
28
FSL_IMX7_WDOG3_IRQ = 10,
29
30
enum FslIMX7IRQs {
31
diff --git a/hw/arm/fsl-imx7.c b/hw/arm/fsl-imx7.c
29
diff --git a/hw/arm/fsl-imx7.c b/hw/arm/fsl-imx7.c
32
index XXXXXXX..XXXXXXX 100644
30
index XXXXXXX..XXXXXXX 100644
33
--- a/hw/arm/fsl-imx7.c
31
--- a/hw/arm/fsl-imx7.c
34
+++ b/hw/arm/fsl-imx7.c
32
+++ b/hw/arm/fsl-imx7.c
35
@@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
33
@@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
36
*/
34
FSL_IMX7_GPT4_ADDR,
37
create_unimplemented_device("lcdif", FSL_IMX7_LCDIF_ADDR,
35
};
38
FSL_IMX7_LCDIF_SIZE);
36
37
+ static const int FSL_IMX7_GPTn_IRQ[FSL_IMX7_NUM_GPTS] = {
38
+ FSL_IMX7_GPT1_IRQ,
39
+ FSL_IMX7_GPT2_IRQ,
40
+ FSL_IMX7_GPT3_IRQ,
41
+ FSL_IMX7_GPT4_IRQ,
42
+ };
39
+
43
+
40
+ /*
44
s->gpt[i].ccm = IMX_CCM(&s->ccm);
41
+ * DMA APBH
45
sysbus_realize(SYS_BUS_DEVICE(&s->gpt[i]), &error_abort);
42
+ */
46
sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpt[i]), 0, FSL_IMX7_GPTn_ADDR[i]);
43
+ create_unimplemented_device("dma-apbh", FSL_IMX7_DMA_APBH_ADDR,
47
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpt[i]), 0,
44
+ FSL_IMX7_DMA_APBH_SIZE);
48
+ qdev_get_gpio_in(DEVICE(&s->a7mpcore),
45
}
49
+ FSL_IMX7_GPTn_IRQ[i]));
46
50
}
47
static void fsl_imx7_class_init(ObjectClass *oc, void *data)
51
52
for (i = 0; i < FSL_IMX7_NUM_GPIOS; i++) {
48
--
53
--
49
2.20.1
54
2.25.1
50
51
diff view generated by jsdifflib
1
From: Joel Stanley <joel@jms.id.au>
1
From: Jean-Christophe Dubois <jcd@tribudubois.net>
2
2
3
The Linux kernel driver was updated in commit 4451d3f59f2a
3
CCM derived clocks will have to be added later.
4
("clocksource/drivers/fttmr010: Fix set_next_event handler) to fix an
5
issue observed on hardware:
6
4
7
> RELOAD register is loaded into COUNT register when the aspeed timer
5
Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net>
8
> is enabled, which means the next event may be delayed because timer
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
> interrupt won't be generated until <0xFFFFFFFF - current_count +
10
> cycles>.
11
12
When running under Qemu, the system appeared "laggy". The guest is now
13
scheduling timer events too regularly, starving the host of CPU time.
14
15
This patch modifies the timer model to attempt to schedule the timer
16
expiry as the guest requests, but if we have missed the deadline we
17
re interrupt and try again, which allows the guest to catch up.
18
19
Provides expected behaviour with old and new guest code.
20
21
Fixes: c04bd47db6b9 ("hw/timer: Add ASPEED timer device model")
22
Signed-off-by: Joel Stanley <joel@jms.id.au>
23
Signed-off-by: Cédric Le Goater <clg@kaod.org>
24
Message-id: 20190618165311.27066-8-clg@kaod.org
25
[clg: - merged a fix from Andrew Jeffery <andrew@aj.id.au>
26
"Fire interrupt on failure to meet deadline"
27
https://lists.ozlabs.org/pipermail/openbmc/2019-January/014641.html
28
- adapted commit log
29
- checkpatch fixes ]
30
Signed-off-by: Cédric Le Goater <clg@kaod.org>
31
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
32
---
8
---
33
hw/timer/aspeed_timer.c | 57 ++++++++++++++++++++++-------------------
9
hw/misc/imx7_ccm.c | 49 +++++++++++++++++++++++++++++++++++++---------
34
1 file changed, 30 insertions(+), 27 deletions(-)
10
1 file changed, 40 insertions(+), 9 deletions(-)
35
11
36
diff --git a/hw/timer/aspeed_timer.c b/hw/timer/aspeed_timer.c
12
diff --git a/hw/misc/imx7_ccm.c b/hw/misc/imx7_ccm.c
37
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
38
--- a/hw/timer/aspeed_timer.c
14
--- a/hw/misc/imx7_ccm.c
39
+++ b/hw/timer/aspeed_timer.c
15
+++ b/hw/misc/imx7_ccm.c
40
@@ -XXX,XX +XXX,XX @@ static inline uint64_t calculate_time(struct AspeedTimer *t, uint32_t ticks)
16
@@ -XXX,XX +XXX,XX @@
41
17
#include "hw/misc/imx7_ccm.h"
42
static uint64_t calculate_next(struct AspeedTimer *t)
18
#include "migration/vmstate.h"
19
20
+#include "trace.h"
21
+
22
+#define CKIH_FREQ 24000000 /* 24MHz crystal input */
23
+
24
static void imx7_analog_reset(DeviceState *dev)
43
{
25
{
44
- uint64_t next = 0;
26
IMX7AnalogState *s = IMX7_ANALOG(dev);
45
- uint32_t rate = calculate_rate(t);
27
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_imx7_ccm = {
46
+ uint64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
28
static uint32_t imx7_ccm_get_clock_frequency(IMXCCMState *dev, IMXClk clock)
47
+ uint64_t next;
29
{
48
30
/*
49
- while (!next) {
31
- * This function is "consumed" by GPT emulation code, however on
50
- /* We don't know the relationship between the values in the match
32
- * i.MX7 each GPT block can have their own clock root. This means
51
- * registers, so sort using MAX/MIN/zero. We sort in that order as the
33
- * that this functions needs somehow to know requester's identity
52
- * timer counts down to zero. */
34
- * and the way to pass it: be it via additional IMXClk constants
53
- uint64_t seq[] = {
35
- * or by adding another argument to this method needs to be
54
- calculate_time(t, MAX(t->match[0], t->match[1])),
36
- * figured out
55
- calculate_time(t, MIN(t->match[0], t->match[1])),
37
+ * This function is "consumed" by GPT emulation code. Some clocks
56
- calculate_time(t, 0),
38
+ * have fixed frequencies and we can provide requested frequency
57
- };
39
+ * easily. However for CCM provided clocks (like IPG) each GPT
58
- uint64_t reload_ns;
40
+ * timer can have its own clock root.
59
- uint64_t now = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
41
+ * This means we need additionnal information when calling this
60
+ /*
42
+ * function to know the requester's identity.
61
+ * We don't know the relationship between the values in the match
43
*/
62
+ * registers, so sort using MAX/MIN/zero. We sort in that order as
44
- qemu_log_mask(LOG_GUEST_ERROR, "[%s]%s: Not implemented\n",
63
+ * the timer counts down to zero.
45
- TYPE_IMX7_CCM, __func__);
64
+ */
46
- return 0;
65
47
+ uint32_t freq = 0;
66
- if (now < seq[0]) {
48
+
67
- next = seq[0];
49
+ switch (clock) {
68
- } else if (now < seq[1]) {
50
+ case CLK_NONE:
69
- next = seq[1];
51
+ break;
70
- } else if (now < seq[2]) {
52
+ case CLK_32k:
71
- next = seq[2];
53
+ freq = CKIL_FREQ;
72
- } else if (t->reload) {
54
+ break;
73
- reload_ns = muldiv64(t->reload, NANOSECONDS_PER_SECOND, rate);
55
+ case CLK_HIGH:
74
- t->start = now - ((now - t->start) % reload_ns);
56
+ freq = CKIH_FREQ;
75
- } else {
57
+ break;
76
- /* no reload value, return 0 */
58
+ case CLK_IPG:
77
- break;
59
+ case CLK_IPG_HIGH:
78
- }
60
+ /*
79
+ next = calculate_time(t, MAX(t->match[0], t->match[1]));
61
+ * For now we don't have a way to figure out the device this
80
+ if (now < next) {
62
+ * function is called for. Until then the IPG derived clocks
81
+ return next;
63
+ * are left unimplemented.
82
}
64
+ */
83
65
+ qemu_log_mask(LOG_GUEST_ERROR, "[%s]%s: Clock %d Not implemented\n",
84
- return next;
66
+ TYPE_IMX7_CCM, __func__, clock);
85
+ next = calculate_time(t, MIN(t->match[0], t->match[1]));
67
+ break;
86
+ if (now < next) {
68
+ default:
87
+ return next;
69
+ qemu_log_mask(LOG_GUEST_ERROR, "[%s]%s: unsupported clock %d\n",
70
+ TYPE_IMX7_CCM, __func__, clock);
71
+ break;
88
+ }
72
+ }
89
+
73
+
90
+ next = calculate_time(t, 0);
74
+ trace_ccm_clock_freq(clock, freq);
91
+ if (now < next) {
92
+ return next;
93
+ }
94
+
75
+
95
+ /* We've missed all deadlines, fire interrupt and try again */
76
+ return freq;
96
+ timer_del(&t->timer);
97
+
98
+ if (timer_overflow_interrupt(t)) {
99
+ t->level = !t->level;
100
+ qemu_set_irq(t->irq, t->level);
101
+ }
102
+
103
+ t->start = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
104
+ return calculate_time(t, MAX(MAX(t->match[0], t->match[1]), 0));
105
}
77
}
106
78
107
static void aspeed_timer_mod(AspeedTimer *t)
79
static void imx7_ccm_class_init(ObjectClass *klass, void *data)
108
--
80
--
109
2.20.1
81
2.25.1
110
111
diff view generated by jsdifflib
1
From: Hongbo Zhang <hongbo.zhang@linaro.org>
1
From: Jean-Christophe Dubois <jcd@tribudubois.net>
2
2
3
Following the previous patch, this patch adds peripheral devices to the
3
The i.MX6UL doesn't support CLK_HIGH ou CLK_HIGH_DIV clock source.
4
newly introduced SBSA-ref machine.
5
4
6
Signed-off-by: Hongbo Zhang <hongbo.zhang@linaro.org>
5
Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net>
7
Message-id: 1561890034-15921-3-git-send-email-hongbo.zhang@linaro.org
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
8
---
11
hw/arm/sbsa-ref.c | 535 ++++++++++++++++++++++++++++++++++++++++++++++
9
include/hw/timer/imx_gpt.h | 1 +
12
1 file changed, 535 insertions(+)
10
hw/arm/fsl-imx6ul.c | 2 +-
11
hw/misc/imx6ul_ccm.c | 6 ------
12
hw/timer/imx_gpt.c | 25 +++++++++++++++++++++++++
13
4 files changed, 27 insertions(+), 7 deletions(-)
13
14
14
diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
15
diff --git a/include/hw/timer/imx_gpt.h b/include/hw/timer/imx_gpt.h
15
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/arm/sbsa-ref.c
17
--- a/include/hw/timer/imx_gpt.h
17
+++ b/hw/arm/sbsa-ref.c
18
+++ b/include/hw/timer/imx_gpt.h
18
@@ -XXX,XX +XXX,XX @@
19
@@ -XXX,XX +XXX,XX @@
19
*/
20
#define TYPE_IMX25_GPT "imx25.gpt"
20
21
#define TYPE_IMX31_GPT "imx31.gpt"
21
#include "qemu/osdep.h"
22
#define TYPE_IMX6_GPT "imx6.gpt"
22
+#include "qemu-common.h"
23
+#define TYPE_IMX6UL_GPT "imx6ul.gpt"
23
#include "qapi/error.h"
24
#define TYPE_IMX7_GPT "imx7.gpt"
24
#include "qemu/error-report.h"
25
25
#include "qemu/units.h"
26
#define TYPE_IMX_GPT TYPE_IMX25_GPT
26
+#include "sysemu/device_tree.h"
27
diff --git a/hw/arm/fsl-imx6ul.c b/hw/arm/fsl-imx6ul.c
27
#include "sysemu/numa.h"
28
index XXXXXXX..XXXXXXX 100644
28
#include "sysemu/sysemu.h"
29
--- a/hw/arm/fsl-imx6ul.c
29
#include "exec/address-spaces.h"
30
+++ b/hw/arm/fsl-imx6ul.c
30
#include "exec/hwaddr.h"
31
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_init(Object *obj)
31
#include "kvm_arm.h"
32
*/
32
#include "hw/arm/boot.h"
33
for (i = 0; i < FSL_IMX6UL_NUM_GPTS; i++) {
33
+#include "hw/block/flash.h"
34
snprintf(name, NAME_SIZE, "gpt%d", i);
34
#include "hw/boards.h"
35
- object_initialize_child(obj, name, &s->gpt[i], TYPE_IMX7_GPT);
35
+#include "hw/ide/internal.h"
36
+ object_initialize_child(obj, name, &s->gpt[i], TYPE_IMX6UL_GPT);
36
+#include "hw/ide/ahci_internal.h"
37
}
37
#include "hw/intc/arm_gicv3_common.h"
38
38
+#include "hw/loader.h"
39
/*
39
+#include "hw/pci-host/gpex.h"
40
diff --git a/hw/misc/imx6ul_ccm.c b/hw/misc/imx6ul_ccm.c
40
+#include "hw/usb.h"
41
index XXXXXXX..XXXXXXX 100644
41
+#include "net/net.h"
42
--- a/hw/misc/imx6ul_ccm.c
42
43
+++ b/hw/misc/imx6ul_ccm.c
43
#define RAMLIMIT_GB 8192
44
@@ -XXX,XX +XXX,XX @@ static uint32_t imx6ul_ccm_get_clock_frequency(IMXCCMState *dev, IMXClk clock)
44
#define RAMLIMIT_BYTES (RAMLIMIT_GB * GiB)
45
case CLK_32k:
45
46
freq = CKIL_FREQ;
46
+#define NUM_IRQS 256
47
break;
47
+#define NUM_SMMU_IRQS 4
48
- case CLK_HIGH:
48
+#define NUM_SATA_PORTS 6
49
- freq = CKIH_FREQ;
49
+
50
- break;
50
+#define VIRTUAL_PMU_IRQ 7
51
- case CLK_HIGH_DIV:
51
+#define ARCH_GIC_MAINT_IRQ 9
52
- freq = CKIH_FREQ / 8;
52
+#define ARCH_TIMER_VIRT_IRQ 11
53
- break;
53
+#define ARCH_TIMER_S_EL1_IRQ 13
54
default:
54
+#define ARCH_TIMER_NS_EL1_IRQ 14
55
qemu_log_mask(LOG_GUEST_ERROR, "[%s]%s: unsupported clock %d\n",
55
+#define ARCH_TIMER_NS_EL2_IRQ 10
56
TYPE_IMX6UL_CCM, __func__, clock);
56
+
57
diff --git a/hw/timer/imx_gpt.c b/hw/timer/imx_gpt.c
57
enum {
58
index XXXXXXX..XXXXXXX 100644
58
SBSA_FLASH,
59
--- a/hw/timer/imx_gpt.c
59
SBSA_MEM,
60
+++ b/hw/timer/imx_gpt.c
60
@@ -XXX,XX +XXX,XX @@ typedef struct {
61
@@ -XXX,XX +XXX,XX @@ static const IMXClk imx6_gpt_clocks[] = {
61
void *fdt;
62
CLK_HIGH, /* 111 reference clock */
62
int fdt_size;
63
int psci_conduit;
64
+ PFlashCFI01 *flash[2];
65
} SBSAMachineState;
66
67
#define TYPE_SBSA_MACHINE MACHINE_TYPE_NAME("sbsa-ref")
68
@@ -XXX,XX +XXX,XX @@ static const MemMapEntry sbsa_ref_memmap[] = {
69
[SBSA_MEM] = { 0x10000000000ULL, RAMLIMIT_BYTES },
70
};
63
};
71
64
72
+static const int sbsa_ref_irqmap[] = {
65
+static const IMXClk imx6ul_gpt_clocks[] = {
73
+ [SBSA_UART] = 1,
66
+ CLK_NONE, /* 000 No clock source */
74
+ [SBSA_RTC] = 2,
67
+ CLK_IPG, /* 001 ipg_clk, 532MHz*/
75
+ [SBSA_PCIE] = 3, /* ... to 6 */
68
+ CLK_IPG_HIGH, /* 010 ipg_clk_highfreq */
76
+ [SBSA_GPIO] = 7,
69
+ CLK_EXT, /* 011 External clock */
77
+ [SBSA_SECURE_UART] = 8,
70
+ CLK_32k, /* 100 ipg_clk_32k */
78
+ [SBSA_SECURE_UART_MM] = 9,
71
+ CLK_NONE, /* 101 not defined */
79
+ [SBSA_AHCI] = 10,
72
+ CLK_NONE, /* 110 not defined */
80
+ [SBSA_EHCI] = 11,
73
+ CLK_NONE, /* 111 not defined */
81
+};
74
+};
82
+
75
+
83
+/*
76
static const IMXClk imx7_gpt_clocks[] = {
84
+ * Firmware on this machine only uses ACPI table to load OS, these limited
77
CLK_NONE, /* 000 No clock source */
85
+ * device tree nodes are just to let firmware know the info which varies from
78
CLK_IPG, /* 001 ipg_clk, 532MHz*/
86
+ * command line parameters, so it is not necessary to be fully compatible
79
@@ -XXX,XX +XXX,XX @@ static void imx6_gpt_init(Object *obj)
87
+ * with the kernel CPU and NUMA binding rules.
80
s->clocks = imx6_gpt_clocks;
88
+ */
81
}
89
+static void create_fdt(SBSAMachineState *sms)
82
83
+static void imx6ul_gpt_init(Object *obj)
90
+{
84
+{
91
+ void *fdt = create_device_tree(&sms->fdt_size);
85
+ IMXGPTState *s = IMX_GPT(obj);
92
+ const MachineState *ms = MACHINE(sms);
93
+ int cpu;
94
+
86
+
95
+ if (!fdt) {
87
+ s->clocks = imx6ul_gpt_clocks;
96
+ error_report("create_device_tree() failed");
97
+ exit(1);
98
+ }
99
+
100
+ sms->fdt = fdt;
101
+
102
+ qemu_fdt_setprop_string(fdt, "/", "compatible", "linux,sbsa-ref");
103
+ qemu_fdt_setprop_cell(fdt, "/", "#address-cells", 0x2);
104
+ qemu_fdt_setprop_cell(fdt, "/", "#size-cells", 0x2);
105
+
106
+ if (have_numa_distance) {
107
+ int size = nb_numa_nodes * nb_numa_nodes * 3 * sizeof(uint32_t);
108
+ uint32_t *matrix = g_malloc0(size);
109
+ int idx, i, j;
110
+
111
+ for (i = 0; i < nb_numa_nodes; i++) {
112
+ for (j = 0; j < nb_numa_nodes; j++) {
113
+ idx = (i * nb_numa_nodes + j) * 3;
114
+ matrix[idx + 0] = cpu_to_be32(i);
115
+ matrix[idx + 1] = cpu_to_be32(j);
116
+ matrix[idx + 2] = cpu_to_be32(numa_info[i].distance[j]);
117
+ }
118
+ }
119
+
120
+ qemu_fdt_add_subnode(fdt, "/distance-map");
121
+ qemu_fdt_setprop(fdt, "/distance-map", "distance-matrix",
122
+ matrix, size);
123
+ g_free(matrix);
124
+ }
125
+
126
+ qemu_fdt_add_subnode(sms->fdt, "/cpus");
127
+
128
+ for (cpu = sms->smp_cpus - 1; cpu >= 0; cpu--) {
129
+ char *nodename = g_strdup_printf("/cpus/cpu@%d", cpu);
130
+ ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(cpu));
131
+ CPUState *cs = CPU(armcpu);
132
+
133
+ qemu_fdt_add_subnode(sms->fdt, nodename);
134
+
135
+ if (ms->possible_cpus->cpus[cs->cpu_index].props.has_node_id) {
136
+ qemu_fdt_setprop_cell(sms->fdt, nodename, "numa-node-id",
137
+ ms->possible_cpus->cpus[cs->cpu_index].props.node_id);
138
+ }
139
+
140
+ g_free(nodename);
141
+ }
142
+}
88
+}
143
+
89
+
144
+#define SBSA_FLASH_SECTOR_SIZE (256 * KiB)
90
static void imx7_gpt_init(Object *obj)
145
+
91
{
146
+static PFlashCFI01 *sbsa_flash_create1(SBSAMachineState *sms,
92
IMXGPTState *s = IMX_GPT(obj);
147
+ const char *name,
93
@@ -XXX,XX +XXX,XX @@ static const TypeInfo imx6_gpt_info = {
148
+ const char *alias_prop_name)
94
.instance_init = imx6_gpt_init,
149
+{
95
};
150
+ /*
96
151
+ * Create a single flash device. We use the same parameters as
97
+static const TypeInfo imx6ul_gpt_info = {
152
+ * the flash devices on the Versatile Express board.
98
+ .name = TYPE_IMX6UL_GPT,
153
+ */
99
+ .parent = TYPE_IMX25_GPT,
154
+ DeviceState *dev = qdev_create(NULL, TYPE_PFLASH_CFI01);
100
+ .instance_init = imx6ul_gpt_init,
155
+
156
+ qdev_prop_set_uint64(dev, "sector-length", SBSA_FLASH_SECTOR_SIZE);
157
+ qdev_prop_set_uint8(dev, "width", 4);
158
+ qdev_prop_set_uint8(dev, "device-width", 2);
159
+ qdev_prop_set_bit(dev, "big-endian", false);
160
+ qdev_prop_set_uint16(dev, "id0", 0x89);
161
+ qdev_prop_set_uint16(dev, "id1", 0x18);
162
+ qdev_prop_set_uint16(dev, "id2", 0x00);
163
+ qdev_prop_set_uint16(dev, "id3", 0x00);
164
+ qdev_prop_set_string(dev, "name", name);
165
+ object_property_add_child(OBJECT(sms), name, OBJECT(dev),
166
+ &error_abort);
167
+ object_property_add_alias(OBJECT(sms), alias_prop_name,
168
+ OBJECT(dev), "drive", &error_abort);
169
+ return PFLASH_CFI01(dev);
170
+}
171
+
172
+static void sbsa_flash_create(SBSAMachineState *sms)
173
+{
174
+ sms->flash[0] = sbsa_flash_create1(sms, "sbsa.flash0", "pflash0");
175
+ sms->flash[1] = sbsa_flash_create1(sms, "sbsa.flash1", "pflash1");
176
+}
177
+
178
+static void sbsa_flash_map1(PFlashCFI01 *flash,
179
+ hwaddr base, hwaddr size,
180
+ MemoryRegion *sysmem)
181
+{
182
+ DeviceState *dev = DEVICE(flash);
183
+
184
+ assert(size % SBSA_FLASH_SECTOR_SIZE == 0);
185
+ assert(size / SBSA_FLASH_SECTOR_SIZE <= UINT32_MAX);
186
+ qdev_prop_set_uint32(dev, "num-blocks", size / SBSA_FLASH_SECTOR_SIZE);
187
+ qdev_init_nofail(dev);
188
+
189
+ memory_region_add_subregion(sysmem, base,
190
+ sysbus_mmio_get_region(SYS_BUS_DEVICE(dev),
191
+ 0));
192
+}
193
+
194
+static void sbsa_flash_map(SBSAMachineState *sms,
195
+ MemoryRegion *sysmem,
196
+ MemoryRegion *secure_sysmem)
197
+{
198
+ /*
199
+ * Map two flash devices to fill the SBSA_FLASH space in the memmap.
200
+ * sysmem is the system memory space. secure_sysmem is the secure view
201
+ * of the system, and the first flash device should be made visible only
202
+ * there. The second flash device is visible to both secure and nonsecure.
203
+ * If sysmem == secure_sysmem this means there is no separate Secure
204
+ * address space and both flash devices are generally visible.
205
+ */
206
+ hwaddr flashsize = sbsa_ref_memmap[SBSA_FLASH].size / 2;
207
+ hwaddr flashbase = sbsa_ref_memmap[SBSA_FLASH].base;
208
+
209
+ sbsa_flash_map1(sms->flash[0], flashbase, flashsize,
210
+ secure_sysmem);
211
+ sbsa_flash_map1(sms->flash[1], flashbase + flashsize, flashsize,
212
+ sysmem);
213
+}
214
+
215
+static bool sbsa_firmware_init(SBSAMachineState *sms,
216
+ MemoryRegion *sysmem,
217
+ MemoryRegion *secure_sysmem)
218
+{
219
+ int i;
220
+ BlockBackend *pflash_blk0;
221
+
222
+ /* Map legacy -drive if=pflash to machine properties */
223
+ for (i = 0; i < ARRAY_SIZE(sms->flash); i++) {
224
+ pflash_cfi01_legacy_drive(sms->flash[i],
225
+ drive_get(IF_PFLASH, 0, i));
226
+ }
227
+
228
+ sbsa_flash_map(sms, sysmem, secure_sysmem);
229
+
230
+ pflash_blk0 = pflash_cfi01_get_blk(sms->flash[0]);
231
+
232
+ if (bios_name) {
233
+ char *fname;
234
+ MemoryRegion *mr;
235
+ int image_size;
236
+
237
+ if (pflash_blk0) {
238
+ error_report("The contents of the first flash device may be "
239
+ "specified with -bios or with -drive if=pflash... "
240
+ "but you cannot use both options at once");
241
+ exit(1);
242
+ }
243
+
244
+ /* Fall back to -bios */
245
+
246
+ fname = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
247
+ if (!fname) {
248
+ error_report("Could not find ROM image '%s'", bios_name);
249
+ exit(1);
250
+ }
251
+ mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(sms->flash[0]), 0);
252
+ image_size = load_image_mr(fname, mr);
253
+ g_free(fname);
254
+ if (image_size < 0) {
255
+ error_report("Could not load ROM image '%s'", bios_name);
256
+ exit(1);
257
+ }
258
+ }
259
+
260
+ return pflash_blk0 || bios_name;
261
+}
262
+
263
+static void create_secure_ram(SBSAMachineState *sms,
264
+ MemoryRegion *secure_sysmem)
265
+{
266
+ MemoryRegion *secram = g_new(MemoryRegion, 1);
267
+ hwaddr base = sbsa_ref_memmap[SBSA_SECURE_MEM].base;
268
+ hwaddr size = sbsa_ref_memmap[SBSA_SECURE_MEM].size;
269
+
270
+ memory_region_init_ram(secram, NULL, "sbsa-ref.secure-ram", size,
271
+ &error_fatal);
272
+ memory_region_add_subregion(secure_sysmem, base, secram);
273
+}
274
+
275
+static void create_gic(SBSAMachineState *sms, qemu_irq *pic)
276
+{
277
+ DeviceState *gicdev;
278
+ SysBusDevice *gicbusdev;
279
+ const char *gictype;
280
+ uint32_t redist0_capacity, redist0_count;
281
+ int i;
282
+
283
+ gictype = gicv3_class_name();
284
+
285
+ gicdev = qdev_create(NULL, gictype);
286
+ qdev_prop_set_uint32(gicdev, "revision", 3);
287
+ qdev_prop_set_uint32(gicdev, "num-cpu", smp_cpus);
288
+ /*
289
+ * Note that the num-irq property counts both internal and external
290
+ * interrupts; there are always 32 of the former (mandated by GIC spec).
291
+ */
292
+ qdev_prop_set_uint32(gicdev, "num-irq", NUM_IRQS + 32);
293
+ qdev_prop_set_bit(gicdev, "has-security-extensions", true);
294
+
295
+ redist0_capacity =
296
+ sbsa_ref_memmap[SBSA_GIC_REDIST].size / GICV3_REDIST_SIZE;
297
+ redist0_count = MIN(smp_cpus, redist0_capacity);
298
+
299
+ qdev_prop_set_uint32(gicdev, "len-redist-region-count", 1);
300
+ qdev_prop_set_uint32(gicdev, "redist-region-count[0]", redist0_count);
301
+
302
+ qdev_init_nofail(gicdev);
303
+ gicbusdev = SYS_BUS_DEVICE(gicdev);
304
+ sysbus_mmio_map(gicbusdev, 0, sbsa_ref_memmap[SBSA_GIC_DIST].base);
305
+ sysbus_mmio_map(gicbusdev, 1, sbsa_ref_memmap[SBSA_GIC_REDIST].base);
306
+
307
+ /*
308
+ * Wire the outputs from each CPU's generic timer and the GICv3
309
+ * maintenance interrupt signal to the appropriate GIC PPI inputs,
310
+ * and the GIC's IRQ/FIQ/VIRQ/VFIQ interrupt outputs to the CPU's inputs.
311
+ */
312
+ for (i = 0; i < smp_cpus; i++) {
313
+ DeviceState *cpudev = DEVICE(qemu_get_cpu(i));
314
+ int ppibase = NUM_IRQS + i * GIC_INTERNAL + GIC_NR_SGIS;
315
+ int irq;
316
+ /*
317
+ * Mapping from the output timer irq lines from the CPU to the
318
+ * GIC PPI inputs used for this board.
319
+ */
320
+ const int timer_irq[] = {
321
+ [GTIMER_PHYS] = ARCH_TIMER_NS_EL1_IRQ,
322
+ [GTIMER_VIRT] = ARCH_TIMER_VIRT_IRQ,
323
+ [GTIMER_HYP] = ARCH_TIMER_NS_EL2_IRQ,
324
+ [GTIMER_SEC] = ARCH_TIMER_S_EL1_IRQ,
325
+ };
326
+
327
+ for (irq = 0; irq < ARRAY_SIZE(timer_irq); irq++) {
328
+ qdev_connect_gpio_out(cpudev, irq,
329
+ qdev_get_gpio_in(gicdev,
330
+ ppibase + timer_irq[irq]));
331
+ }
332
+
333
+ qdev_connect_gpio_out_named(cpudev, "gicv3-maintenance-interrupt", 0,
334
+ qdev_get_gpio_in(gicdev, ppibase
335
+ + ARCH_GIC_MAINT_IRQ));
336
+ qdev_connect_gpio_out_named(cpudev, "pmu-interrupt", 0,
337
+ qdev_get_gpio_in(gicdev, ppibase
338
+ + VIRTUAL_PMU_IRQ));
339
+
340
+ sysbus_connect_irq(gicbusdev, i, qdev_get_gpio_in(cpudev, ARM_CPU_IRQ));
341
+ sysbus_connect_irq(gicbusdev, i + smp_cpus,
342
+ qdev_get_gpio_in(cpudev, ARM_CPU_FIQ));
343
+ sysbus_connect_irq(gicbusdev, i + 2 * smp_cpus,
344
+ qdev_get_gpio_in(cpudev, ARM_CPU_VIRQ));
345
+ sysbus_connect_irq(gicbusdev, i + 3 * smp_cpus,
346
+ qdev_get_gpio_in(cpudev, ARM_CPU_VFIQ));
347
+ }
348
+
349
+ for (i = 0; i < NUM_IRQS; i++) {
350
+ pic[i] = qdev_get_gpio_in(gicdev, i);
351
+ }
352
+}
353
+
354
+static void create_uart(const SBSAMachineState *sms, qemu_irq *pic, int uart,
355
+ MemoryRegion *mem, Chardev *chr)
356
+{
357
+ hwaddr base = sbsa_ref_memmap[uart].base;
358
+ int irq = sbsa_ref_irqmap[uart];
359
+ DeviceState *dev = qdev_create(NULL, "pl011");
360
+ SysBusDevice *s = SYS_BUS_DEVICE(dev);
361
+
362
+ qdev_prop_set_chr(dev, "chardev", chr);
363
+ qdev_init_nofail(dev);
364
+ memory_region_add_subregion(mem, base,
365
+ sysbus_mmio_get_region(s, 0));
366
+ sysbus_connect_irq(s, 0, pic[irq]);
367
+}
368
+
369
+static void create_rtc(const SBSAMachineState *sms, qemu_irq *pic)
370
+{
371
+ hwaddr base = sbsa_ref_memmap[SBSA_RTC].base;
372
+ int irq = sbsa_ref_irqmap[SBSA_RTC];
373
+
374
+ sysbus_create_simple("pl031", base, pic[irq]);
375
+}
376
+
377
+static DeviceState *gpio_key_dev;
378
+static void sbsa_ref_powerdown_req(Notifier *n, void *opaque)
379
+{
380
+ /* use gpio Pin 3 for power button event */
381
+ qemu_set_irq(qdev_get_gpio_in(gpio_key_dev, 0), 1);
382
+}
383
+
384
+static Notifier sbsa_ref_powerdown_notifier = {
385
+ .notify = sbsa_ref_powerdown_req
386
+};
101
+};
387
+
102
+
388
+static void create_gpio(const SBSAMachineState *sms, qemu_irq *pic)
103
static const TypeInfo imx7_gpt_info = {
389
+{
104
.name = TYPE_IMX7_GPT,
390
+ DeviceState *pl061_dev;
105
.parent = TYPE_IMX25_GPT,
391
+ hwaddr base = sbsa_ref_memmap[SBSA_GPIO].base;
106
@@ -XXX,XX +XXX,XX @@ static void imx_gpt_register_types(void)
392
+ int irq = sbsa_ref_irqmap[SBSA_GPIO];
107
type_register_static(&imx25_gpt_info);
393
+
108
type_register_static(&imx31_gpt_info);
394
+ pl061_dev = sysbus_create_simple("pl061", base, pic[irq]);
109
type_register_static(&imx6_gpt_info);
395
+
110
+ type_register_static(&imx6ul_gpt_info);
396
+ gpio_key_dev = sysbus_create_simple("gpio-key", -1,
111
type_register_static(&imx7_gpt_info);
397
+ qdev_get_gpio_in(pl061_dev, 3));
398
+
399
+ /* connect powerdown request */
400
+ qemu_register_powerdown_notifier(&sbsa_ref_powerdown_notifier);
401
+}
402
+
403
+static void create_ahci(const SBSAMachineState *sms, qemu_irq *pic)
404
+{
405
+ hwaddr base = sbsa_ref_memmap[SBSA_AHCI].base;
406
+ int irq = sbsa_ref_irqmap[SBSA_AHCI];
407
+ DeviceState *dev;
408
+ DriveInfo *hd[NUM_SATA_PORTS];
409
+ SysbusAHCIState *sysahci;
410
+ AHCIState *ahci;
411
+ int i;
412
+
413
+ dev = qdev_create(NULL, "sysbus-ahci");
414
+ qdev_prop_set_uint32(dev, "num-ports", NUM_SATA_PORTS);
415
+ qdev_init_nofail(dev);
416
+ sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
417
+ sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[irq]);
418
+
419
+ sysahci = SYSBUS_AHCI(dev);
420
+ ahci = &sysahci->ahci;
421
+ ide_drive_get(hd, ARRAY_SIZE(hd));
422
+ for (i = 0; i < ahci->ports; i++) {
423
+ if (hd[i] == NULL) {
424
+ continue;
425
+ }
426
+ ide_create_drive(&ahci->dev[i].port, 0, hd[i]);
427
+ }
428
+}
429
+
430
+static void create_ehci(const SBSAMachineState *sms, qemu_irq *pic)
431
+{
432
+ hwaddr base = sbsa_ref_memmap[SBSA_EHCI].base;
433
+ int irq = sbsa_ref_irqmap[SBSA_EHCI];
434
+
435
+ sysbus_create_simple("platform-ehci-usb", base, pic[irq]);
436
+}
437
+
438
+static void create_smmu(const SBSAMachineState *sms, qemu_irq *pic,
439
+ PCIBus *bus)
440
+{
441
+ hwaddr base = sbsa_ref_memmap[SBSA_SMMU].base;
442
+ int irq = sbsa_ref_irqmap[SBSA_SMMU];
443
+ DeviceState *dev;
444
+ int i;
445
+
446
+ dev = qdev_create(NULL, "arm-smmuv3");
447
+
448
+ object_property_set_link(OBJECT(dev), OBJECT(bus), "primary-bus",
449
+ &error_abort);
450
+ qdev_init_nofail(dev);
451
+ sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, base);
452
+ for (i = 0; i < NUM_SMMU_IRQS; i++) {
453
+ sysbus_connect_irq(SYS_BUS_DEVICE(dev), i, pic[irq + i]);
454
+ }
455
+}
456
+
457
+static void create_pcie(SBSAMachineState *sms, qemu_irq *pic)
458
+{
459
+ hwaddr base_ecam = sbsa_ref_memmap[SBSA_PCIE_ECAM].base;
460
+ hwaddr size_ecam = sbsa_ref_memmap[SBSA_PCIE_ECAM].size;
461
+ hwaddr base_mmio = sbsa_ref_memmap[SBSA_PCIE_MMIO].base;
462
+ hwaddr size_mmio = sbsa_ref_memmap[SBSA_PCIE_MMIO].size;
463
+ hwaddr base_mmio_high = sbsa_ref_memmap[SBSA_PCIE_MMIO_HIGH].base;
464
+ hwaddr size_mmio_high = sbsa_ref_memmap[SBSA_PCIE_MMIO_HIGH].size;
465
+ hwaddr base_pio = sbsa_ref_memmap[SBSA_PCIE_PIO].base;
466
+ int irq = sbsa_ref_irqmap[SBSA_PCIE];
467
+ MemoryRegion *mmio_alias, *mmio_alias_high, *mmio_reg;
468
+ MemoryRegion *ecam_alias, *ecam_reg;
469
+ DeviceState *dev;
470
+ PCIHostState *pci;
471
+ int i;
472
+
473
+ dev = qdev_create(NULL, TYPE_GPEX_HOST);
474
+ qdev_init_nofail(dev);
475
+
476
+ /* Map ECAM space */
477
+ ecam_alias = g_new0(MemoryRegion, 1);
478
+ ecam_reg = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0);
479
+ memory_region_init_alias(ecam_alias, OBJECT(dev), "pcie-ecam",
480
+ ecam_reg, 0, size_ecam);
481
+ memory_region_add_subregion(get_system_memory(), base_ecam, ecam_alias);
482
+
483
+ /* Map the MMIO space */
484
+ mmio_alias = g_new0(MemoryRegion, 1);
485
+ mmio_reg = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 1);
486
+ memory_region_init_alias(mmio_alias, OBJECT(dev), "pcie-mmio",
487
+ mmio_reg, base_mmio, size_mmio);
488
+ memory_region_add_subregion(get_system_memory(), base_mmio, mmio_alias);
489
+
490
+ /* Map the MMIO_HIGH space */
491
+ mmio_alias_high = g_new0(MemoryRegion, 1);
492
+ memory_region_init_alias(mmio_alias_high, OBJECT(dev), "pcie-mmio-high",
493
+ mmio_reg, base_mmio_high, size_mmio_high);
494
+ memory_region_add_subregion(get_system_memory(), base_mmio_high,
495
+ mmio_alias_high);
496
+
497
+ /* Map IO port space */
498
+ sysbus_mmio_map(SYS_BUS_DEVICE(dev), 2, base_pio);
499
+
500
+ for (i = 0; i < GPEX_NUM_IRQS; i++) {
501
+ sysbus_connect_irq(SYS_BUS_DEVICE(dev), i, pic[irq + i]);
502
+ gpex_set_irq_num(GPEX_HOST(dev), i, irq + i);
503
+ }
504
+
505
+ pci = PCI_HOST_BRIDGE(dev);
506
+ if (pci->bus) {
507
+ for (i = 0; i < nb_nics; i++) {
508
+ NICInfo *nd = &nd_table[i];
509
+
510
+ if (!nd->model) {
511
+ nd->model = g_strdup("e1000e");
512
+ }
513
+
514
+ pci_nic_init_nofail(nd, pci->bus, nd->model, NULL);
515
+ }
516
+ }
517
+
518
+ pci_create_simple(pci->bus, -1, "VGA");
519
+
520
+ create_smmu(sms, pic, pci->bus);
521
+}
522
+
523
+static void *sbsa_ref_dtb(const struct arm_boot_info *binfo, int *fdt_size)
524
+{
525
+ const SBSAMachineState *board = container_of(binfo, SBSAMachineState,
526
+ bootinfo);
527
+
528
+ *fdt_size = board->fdt_size;
529
+ return board->fdt;
530
+}
531
+
532
static void sbsa_ref_init(MachineState *machine)
533
{
534
SBSAMachineState *sms = SBSA_MACHINE(machine);
535
@@ -XXX,XX +XXX,XX @@ static void sbsa_ref_init(MachineState *machine)
536
MemoryRegion *sysmem = get_system_memory();
537
MemoryRegion *secure_sysmem = NULL;
538
MemoryRegion *ram = g_new(MemoryRegion, 1);
539
+ bool firmware_loaded;
540
const CPUArchIdList *possible_cpus;
541
int n, sbsa_max_cpus;
542
+ qemu_irq pic[NUM_IRQS];
543
544
if (strcmp(machine->cpu_type, ARM_CPU_TYPE_NAME("cortex-a57"))) {
545
error_report("sbsa-ref: CPU type other than the built-in "
546
@@ -XXX,XX +XXX,XX @@ static void sbsa_ref_init(MachineState *machine)
547
exit(1);
548
}
549
550
+ /*
551
+ * The Secure view of the world is the same as the NonSecure,
552
+ * but with a few extra devices. Create it as a container region
553
+ * containing the system memory at low priority; any secure-only
554
+ * devices go in at higher priority and take precedence.
555
+ */
556
+ secure_sysmem = g_new(MemoryRegion, 1);
557
+ memory_region_init(secure_sysmem, OBJECT(machine), "secure-memory",
558
+ UINT64_MAX);
559
+ memory_region_add_subregion_overlap(secure_sysmem, 0, sysmem, -1);
560
+
561
+ firmware_loaded = sbsa_firmware_init(sms, sysmem,
562
+ secure_sysmem ?: sysmem);
563
+
564
+ if (machine->kernel_filename && firmware_loaded) {
565
+ error_report("sbsa-ref: No fw_cfg device on this machine, "
566
+ "so -kernel option is not supported when firmware loaded, "
567
+ "please load OS from hard disk instead");
568
+ exit(1);
569
+ }
570
+
571
/*
572
* This machine has EL3 enabled, external firmware should supply PSCI
573
* implementation, so the QEMU's internal PSCI is disabled.
574
@@ -XXX,XX +XXX,XX @@ static void sbsa_ref_init(MachineState *machine)
575
machine->ram_size);
576
memory_region_add_subregion(sysmem, sbsa_ref_memmap[SBSA_MEM].base, ram);
577
578
+ create_fdt(sms);
579
+
580
+ create_secure_ram(sms, secure_sysmem);
581
+
582
+ create_gic(sms, pic);
583
+
584
+ create_uart(sms, pic, SBSA_UART, sysmem, serial_hd(0));
585
+ create_uart(sms, pic, SBSA_SECURE_UART, secure_sysmem, serial_hd(1));
586
+ /* Second secure UART for RAS and MM from EL0 */
587
+ create_uart(sms, pic, SBSA_SECURE_UART_MM, secure_sysmem, serial_hd(2));
588
+
589
+ create_rtc(sms, pic);
590
+
591
+ create_gpio(sms, pic);
592
+
593
+ create_ahci(sms, pic);
594
+
595
+ create_ehci(sms, pic);
596
+
597
+ create_pcie(sms, pic);
598
+
599
sms->bootinfo.ram_size = machine->ram_size;
600
sms->bootinfo.kernel_filename = machine->kernel_filename;
601
sms->bootinfo.nb_cpus = smp_cpus;
602
sms->bootinfo.board_id = -1;
603
sms->bootinfo.loader_start = sbsa_ref_memmap[SBSA_MEM].base;
604
+ sms->bootinfo.get_dtb = sbsa_ref_dtb;
605
+ sms->bootinfo.firmware_loaded = firmware_loaded;
606
arm_load_kernel(ARM_CPU(first_cpu), &sms->bootinfo);
607
}
112
}
608
113
609
@@ -XXX,XX +XXX,XX @@ sbsa_ref_get_default_cpu_node_id(const MachineState *ms, int idx)
610
return idx % nb_numa_nodes;
611
}
612
613
+static void sbsa_ref_instance_init(Object *obj)
614
+{
615
+ SBSAMachineState *sms = SBSA_MACHINE(obj);
616
+
617
+ sbsa_flash_create(sms);
618
+}
619
+
620
static void sbsa_ref_class_init(ObjectClass *oc, void *data)
621
{
622
MachineClass *mc = MACHINE_CLASS(oc);
623
@@ -XXX,XX +XXX,XX @@ static void sbsa_ref_class_init(ObjectClass *oc, void *data)
624
static const TypeInfo sbsa_ref_info = {
625
.name = TYPE_SBSA_MACHINE,
626
.parent = TYPE_MACHINE,
627
+ .instance_init = sbsa_ref_instance_init,
628
.class_init = sbsa_ref_class_init,
629
.instance_size = sizeof(SBSAMachineState),
630
};
631
--
114
--
632
2.20.1
115
2.25.1
633
634
diff view generated by jsdifflib
1
From: Andrey Smirnov <andrew.smirnov@gmail.com>
1
From: Jean-Christophe Dubois <jcd@tribudubois.net>
2
2
3
Add no-op/unimplemented PCIE PHY IP block. Needed by new kernels to
3
IRQs were not associated to the various GPIO devices inside i.MX7D.
4
use PCIE.
4
This patch brings the i.MX7D on par with i.MX6.
5
5
6
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
6
Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net>
7
Cc: Peter Maydell <peter.maydell@linaro.org>
7
Message-id: 20221226101418.415170-1-jcd@tribudubois.net
8
Cc: Michael S. Tsirkin <mst@redhat.com>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Cc: qemu-devel@nongnu.org
10
Cc: qemu-arm@nongnu.org
11
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
10
---
14
include/hw/arm/fsl-imx7.h | 3 +++
11
include/hw/arm/fsl-imx7.h | 15 +++++++++++++++
15
hw/arm/fsl-imx7.c | 5 +++++
12
hw/arm/fsl-imx7.c | 31 ++++++++++++++++++++++++++++++-
16
2 files changed, 8 insertions(+)
13
2 files changed, 45 insertions(+), 1 deletion(-)
17
14
18
diff --git a/include/hw/arm/fsl-imx7.h b/include/hw/arm/fsl-imx7.h
15
diff --git a/include/hw/arm/fsl-imx7.h b/include/hw/arm/fsl-imx7.h
19
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
20
--- a/include/hw/arm/fsl-imx7.h
17
--- a/include/hw/arm/fsl-imx7.h
21
+++ b/include/hw/arm/fsl-imx7.h
18
+++ b/include/hw/arm/fsl-imx7.h
22
@@ -XXX,XX +XXX,XX @@ enum FslIMX7MemoryMap {
19
@@ -XXX,XX +XXX,XX @@ enum FslIMX7IRQs {
23
FSL_IMX7_ADC2_ADDR = 0x30620000,
20
FSL_IMX7_GPT3_IRQ = 53,
24
FSL_IMX7_ADCn_SIZE = 0x1000,
21
FSL_IMX7_GPT4_IRQ = 52,
25
22
26
+ FSL_IMX7_PCIE_PHY_ADDR = 0x306D0000,
23
+ FSL_IMX7_GPIO1_LOW_IRQ = 64,
27
+ FSL_IMX7_PCIE_PHY_SIZE = 0x10000,
24
+ FSL_IMX7_GPIO1_HIGH_IRQ = 65,
25
+ FSL_IMX7_GPIO2_LOW_IRQ = 66,
26
+ FSL_IMX7_GPIO2_HIGH_IRQ = 67,
27
+ FSL_IMX7_GPIO3_LOW_IRQ = 68,
28
+ FSL_IMX7_GPIO3_HIGH_IRQ = 69,
29
+ FSL_IMX7_GPIO4_LOW_IRQ = 70,
30
+ FSL_IMX7_GPIO4_HIGH_IRQ = 71,
31
+ FSL_IMX7_GPIO5_LOW_IRQ = 72,
32
+ FSL_IMX7_GPIO5_HIGH_IRQ = 73,
33
+ FSL_IMX7_GPIO6_LOW_IRQ = 74,
34
+ FSL_IMX7_GPIO6_HIGH_IRQ = 75,
35
+ FSL_IMX7_GPIO7_LOW_IRQ = 76,
36
+ FSL_IMX7_GPIO7_HIGH_IRQ = 77,
28
+
37
+
29
FSL_IMX7_GPC_ADDR = 0x303A0000,
38
FSL_IMX7_WDOG1_IRQ = 78,
30
39
FSL_IMX7_WDOG2_IRQ = 79,
31
FSL_IMX7_I2C1_ADDR = 0x30A20000,
40
FSL_IMX7_WDOG3_IRQ = 10,
32
diff --git a/hw/arm/fsl-imx7.c b/hw/arm/fsl-imx7.c
41
diff --git a/hw/arm/fsl-imx7.c b/hw/arm/fsl-imx7.c
33
index XXXXXXX..XXXXXXX 100644
42
index XXXXXXX..XXXXXXX 100644
34
--- a/hw/arm/fsl-imx7.c
43
--- a/hw/arm/fsl-imx7.c
35
+++ b/hw/arm/fsl-imx7.c
44
+++ b/hw/arm/fsl-imx7.c
36
@@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
45
@@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
37
*/
46
FSL_IMX7_GPIO7_ADDR,
38
create_unimplemented_device("dma-apbh", FSL_IMX7_DMA_APBH_ADDR,
47
};
39
FSL_IMX7_DMA_APBH_SIZE);
48
40
+ /*
49
+ static const int FSL_IMX7_GPIOn_LOW_IRQ[FSL_IMX7_NUM_GPIOS] = {
41
+ * PCIe PHY
50
+ FSL_IMX7_GPIO1_LOW_IRQ,
42
+ */
51
+ FSL_IMX7_GPIO2_LOW_IRQ,
43
+ create_unimplemented_device("pcie-phy", FSL_IMX7_PCIE_PHY_ADDR,
52
+ FSL_IMX7_GPIO3_LOW_IRQ,
44
+ FSL_IMX7_PCIE_PHY_SIZE);
53
+ FSL_IMX7_GPIO4_LOW_IRQ,
45
}
54
+ FSL_IMX7_GPIO5_LOW_IRQ,
46
55
+ FSL_IMX7_GPIO6_LOW_IRQ,
47
static void fsl_imx7_class_init(ObjectClass *oc, void *data)
56
+ FSL_IMX7_GPIO7_LOW_IRQ,
57
+ };
58
+
59
+ static const int FSL_IMX7_GPIOn_HIGH_IRQ[FSL_IMX7_NUM_GPIOS] = {
60
+ FSL_IMX7_GPIO1_HIGH_IRQ,
61
+ FSL_IMX7_GPIO2_HIGH_IRQ,
62
+ FSL_IMX7_GPIO3_HIGH_IRQ,
63
+ FSL_IMX7_GPIO4_HIGH_IRQ,
64
+ FSL_IMX7_GPIO5_HIGH_IRQ,
65
+ FSL_IMX7_GPIO6_HIGH_IRQ,
66
+ FSL_IMX7_GPIO7_HIGH_IRQ,
67
+ };
68
+
69
sysbus_realize(SYS_BUS_DEVICE(&s->gpio[i]), &error_abort);
70
- sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpio[i]), 0, FSL_IMX7_GPIOn_ADDR[i]);
71
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpio[i]), 0,
72
+ FSL_IMX7_GPIOn_ADDR[i]);
73
+
74
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio[i]), 0,
75
+ qdev_get_gpio_in(DEVICE(&s->a7mpcore),
76
+ FSL_IMX7_GPIOn_LOW_IRQ[i]));
77
+
78
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio[i]), 1,
79
+ qdev_get_gpio_in(DEVICE(&s->a7mpcore),
80
+ FSL_IMX7_GPIOn_HIGH_IRQ[i]));
81
}
82
83
/*
48
--
84
--
49
2.20.1
85
2.25.1
50
51
diff view generated by jsdifflib
Deleted patch
1
From: Cédric Le Goater <clg@kaod.org>
2
1
3
This will simplify the definition of new SoCs, like the AST2600 which
4
should use a different CPU and a different IRQ number layout.
5
6
Signed-off-by: Cédric Le Goater <clg@kaod.org>
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
8
Reviewed-by: Joel Stanley <joel@jms.id.au>
9
Message-id: 20190618165311.27066-2-clg@kaod.org
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
12
include/hw/arm/aspeed_soc.h | 36 +++++++++++++++++++++++
13
hw/arm/aspeed_soc.c | 57 +++++++++++++++++++++++++++++++------
14
2 files changed, 85 insertions(+), 8 deletions(-)
15
16
diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h
17
index XXXXXXX..XXXXXXX 100644
18
--- a/include/hw/arm/aspeed_soc.h
19
+++ b/include/hw/arm/aspeed_soc.h
20
@@ -XXX,XX +XXX,XX @@ typedef struct AspeedSoCInfo {
21
const char *fmc_typename;
22
const char **spi_typename;
23
int wdts_num;
24
+ const int *irqmap;
25
} AspeedSoCInfo;
26
27
typedef struct AspeedSoCClass {
28
@@ -XXX,XX +XXX,XX @@ typedef struct AspeedSoCClass {
29
#define ASPEED_SOC_GET_CLASS(obj) \
30
OBJECT_GET_CLASS(AspeedSoCClass, (obj), TYPE_ASPEED_SOC)
31
32
+enum {
33
+ ASPEED_IOMEM,
34
+ ASPEED_UART1,
35
+ ASPEED_UART2,
36
+ ASPEED_UART3,
37
+ ASPEED_UART4,
38
+ ASPEED_UART5,
39
+ ASPEED_VUART,
40
+ ASPEED_FMC,
41
+ ASPEED_SPI1,
42
+ ASPEED_SPI2,
43
+ ASPEED_VIC,
44
+ ASPEED_SDMC,
45
+ ASPEED_SCU,
46
+ ASPEED_ADC,
47
+ ASPEED_SRAM,
48
+ ASPEED_GPIO,
49
+ ASPEED_RTC,
50
+ ASPEED_TIMER1,
51
+ ASPEED_TIMER2,
52
+ ASPEED_TIMER3,
53
+ ASPEED_TIMER4,
54
+ ASPEED_TIMER5,
55
+ ASPEED_TIMER6,
56
+ ASPEED_TIMER7,
57
+ ASPEED_TIMER8,
58
+ ASPEED_WDT,
59
+ ASPEED_PWM,
60
+ ASPEED_LPC,
61
+ ASPEED_IBT,
62
+ ASPEED_I2C,
63
+ ASPEED_ETH1,
64
+ ASPEED_ETH2,
65
+};
66
+
67
#endif /* ASPEED_SOC_H */
68
diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c
69
index XXXXXXX..XXXXXXX 100644
70
--- a/hw/arm/aspeed_soc.c
71
+++ b/hw/arm/aspeed_soc.c
72
@@ -XXX,XX +XXX,XX @@
73
#define ASPEED_SOC_ETH1_BASE 0x1E660000
74
#define ASPEED_SOC_ETH2_BASE 0x1E680000
75
76
-static const int uart_irqs[] = { 9, 32, 33, 34, 10 };
77
-static const int timer_irqs[] = { 16, 17, 18, 35, 36, 37, 38, 39, };
78
+static const int aspeed_soc_ast2400_irqmap[] = {
79
+ [ASPEED_UART1] = 9,
80
+ [ASPEED_UART2] = 32,
81
+ [ASPEED_UART3] = 33,
82
+ [ASPEED_UART4] = 34,
83
+ [ASPEED_UART5] = 10,
84
+ [ASPEED_VUART] = 8,
85
+ [ASPEED_FMC] = 19,
86
+ [ASPEED_SDMC] = 0,
87
+ [ASPEED_SCU] = 21,
88
+ [ASPEED_ADC] = 31,
89
+ [ASPEED_GPIO] = 20,
90
+ [ASPEED_RTC] = 22,
91
+ [ASPEED_TIMER1] = 16,
92
+ [ASPEED_TIMER2] = 17,
93
+ [ASPEED_TIMER3] = 18,
94
+ [ASPEED_TIMER4] = 35,
95
+ [ASPEED_TIMER5] = 36,
96
+ [ASPEED_TIMER6] = 37,
97
+ [ASPEED_TIMER7] = 38,
98
+ [ASPEED_TIMER8] = 39,
99
+ [ASPEED_WDT] = 27,
100
+ [ASPEED_PWM] = 28,
101
+ [ASPEED_LPC] = 8,
102
+ [ASPEED_IBT] = 8, /* LPC */
103
+ [ASPEED_I2C] = 12,
104
+ [ASPEED_ETH1] = 2,
105
+ [ASPEED_ETH2] = 3,
106
+};
107
108
#define AST2400_SDRAM_BASE 0x40000000
109
#define AST2500_SDRAM_BASE 0x80000000
110
111
+/* AST2500 uses the same IRQs as the AST2400 */
112
+#define aspeed_soc_ast2500_irqmap aspeed_soc_ast2400_irqmap
113
+
114
static const hwaddr aspeed_soc_ast2400_spi_bases[] = { ASPEED_SOC_SPI_BASE };
115
static const char *aspeed_soc_ast2400_typenames[] = { "aspeed.smc.spi" };
116
117
@@ -XXX,XX +XXX,XX @@ static const AspeedSoCInfo aspeed_socs[] = {
118
.fmc_typename = "aspeed.smc.fmc",
119
.spi_typename = aspeed_soc_ast2400_typenames,
120
.wdts_num = 2,
121
+ .irqmap = aspeed_soc_ast2400_irqmap,
122
}, {
123
.name = "ast2400-a1",
124
.cpu_type = ARM_CPU_TYPE_NAME("arm926"),
125
@@ -XXX,XX +XXX,XX @@ static const AspeedSoCInfo aspeed_socs[] = {
126
.fmc_typename = "aspeed.smc.fmc",
127
.spi_typename = aspeed_soc_ast2400_typenames,
128
.wdts_num = 2,
129
+ .irqmap = aspeed_soc_ast2400_irqmap,
130
}, {
131
.name = "ast2400",
132
.cpu_type = ARM_CPU_TYPE_NAME("arm926"),
133
@@ -XXX,XX +XXX,XX @@ static const AspeedSoCInfo aspeed_socs[] = {
134
.fmc_typename = "aspeed.smc.fmc",
135
.spi_typename = aspeed_soc_ast2400_typenames,
136
.wdts_num = 2,
137
+ .irqmap = aspeed_soc_ast2400_irqmap,
138
}, {
139
.name = "ast2500-a1",
140
.cpu_type = ARM_CPU_TYPE_NAME("arm1176"),
141
@@ -XXX,XX +XXX,XX @@ static const AspeedSoCInfo aspeed_socs[] = {
142
.fmc_typename = "aspeed.smc.ast2500-fmc",
143
.spi_typename = aspeed_soc_ast2500_typenames,
144
.wdts_num = 3,
145
+ .irqmap = aspeed_soc_ast2500_irqmap,
146
},
147
};
148
149
+static qemu_irq aspeed_soc_get_irq(AspeedSoCState *s, int ctrl)
150
+{
151
+ AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
152
+
153
+ return qdev_get_gpio_in(DEVICE(&s->vic), sc->info->irqmap[ctrl]);
154
+}
155
+
156
static void aspeed_soc_init(Object *obj)
157
{
158
AspeedSoCState *s = ASPEED_SOC(obj);
159
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
160
return;
161
}
162
sysbus_mmio_map(SYS_BUS_DEVICE(&s->timerctrl), 0, ASPEED_SOC_TIMER_BASE);
163
- for (i = 0; i < ARRAY_SIZE(timer_irqs); i++) {
164
- qemu_irq irq = qdev_get_gpio_in(DEVICE(&s->vic), timer_irqs[i]);
165
+ for (i = 0; i < ASPEED_TIMER_NR_TIMERS; i++) {
166
+ qemu_irq irq = aspeed_soc_get_irq(s, ASPEED_TIMER1 + i);
167
sysbus_connect_irq(SYS_BUS_DEVICE(&s->timerctrl), i, irq);
168
}
169
170
/* UART - attach an 8250 to the IO space as our UART5 */
171
if (serial_hd(0)) {
172
- qemu_irq uart5 = qdev_get_gpio_in(DEVICE(&s->vic), uart_irqs[4]);
173
+ qemu_irq uart5 = aspeed_soc_get_irq(s, ASPEED_UART5);
174
serial_mm_init(get_system_memory(),
175
ASPEED_SOC_IOMEM_BASE + ASPEED_SOC_UART_5_BASE, 2,
176
uart5, 38400, serial_hd(0), DEVICE_LITTLE_ENDIAN);
177
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
178
}
179
sysbus_mmio_map(SYS_BUS_DEVICE(&s->i2c), 0, ASPEED_SOC_I2C_BASE);
180
sysbus_connect_irq(SYS_BUS_DEVICE(&s->i2c), 0,
181
- qdev_get_gpio_in(DEVICE(&s->vic), 12));
182
+ aspeed_soc_get_irq(s, ASPEED_I2C));
183
184
/* FMC, The number of CS is set at the board level */
185
object_property_set_bool(OBJECT(&s->fmc), true, "realized", &err);
186
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
187
sysbus_mmio_map(SYS_BUS_DEVICE(&s->fmc), 1,
188
s->fmc.ctrl->flash_window_base);
189
sysbus_connect_irq(SYS_BUS_DEVICE(&s->fmc), 0,
190
- qdev_get_gpio_in(DEVICE(&s->vic), 19));
191
+ aspeed_soc_get_irq(s, ASPEED_FMC));
192
193
/* SPI */
194
for (i = 0; i < sc->info->spis_num; i++) {
195
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
196
}
197
sysbus_mmio_map(SYS_BUS_DEVICE(&s->ftgmac100), 0, ASPEED_SOC_ETH1_BASE);
198
sysbus_connect_irq(SYS_BUS_DEVICE(&s->ftgmac100), 0,
199
- qdev_get_gpio_in(DEVICE(&s->vic), 2));
200
+ aspeed_soc_get_irq(s, ASPEED_ETH1));
201
}
202
203
static void aspeed_soc_class_init(ObjectClass *oc, void *data)
204
--
205
2.20.1
206
207
diff view generated by jsdifflib
Deleted patch
1
From: Joel Stanley <joel@jms.id.au>
2
1
3
The RTC is modeled to provide time and date functionality. It is
4
initialised at zero to match the hardware.
5
6
There is no modelling of the alarm functionality, which includes the IRQ
7
line. As there is no guest code to exercise this function that is
8
acceptable for now.
9
10
Signed-off-by: Joel Stanley <joel@jms.id.au>
11
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12
Message-id: 20190618165311.27066-4-clg@kaod.org
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
---
15
hw/timer/Makefile.objs | 2 +-
16
include/hw/timer/aspeed_rtc.h | 31 ++++++
17
hw/timer/aspeed_rtc.c | 180 ++++++++++++++++++++++++++++++++++
18
hw/timer/trace-events | 4 +
19
4 files changed, 216 insertions(+), 1 deletion(-)
20
create mode 100644 include/hw/timer/aspeed_rtc.h
21
create mode 100644 hw/timer/aspeed_rtc.c
22
23
diff --git a/hw/timer/Makefile.objs b/hw/timer/Makefile.objs
24
index XXXXXXX..XXXXXXX 100644
25
--- a/hw/timer/Makefile.objs
26
+++ b/hw/timer/Makefile.objs
27
@@ -XXX,XX +XXX,XX @@ obj-$(CONFIG_MC146818RTC) += mc146818rtc.o
28
obj-$(CONFIG_ALLWINNER_A10_PIT) += allwinner-a10-pit.o
29
30
common-obj-$(CONFIG_STM32F2XX_TIMER) += stm32f2xx_timer.o
31
-common-obj-$(CONFIG_ASPEED_SOC) += aspeed_timer.o
32
+common-obj-$(CONFIG_ASPEED_SOC) += aspeed_timer.o aspeed_rtc.o
33
34
common-obj-$(CONFIG_SUN4V_RTC) += sun4v-rtc.o
35
common-obj-$(CONFIG_CMSDK_APB_TIMER) += cmsdk-apb-timer.o
36
diff --git a/include/hw/timer/aspeed_rtc.h b/include/hw/timer/aspeed_rtc.h
37
new file mode 100644
38
index XXXXXXX..XXXXXXX
39
--- /dev/null
40
+++ b/include/hw/timer/aspeed_rtc.h
41
@@ -XXX,XX +XXX,XX @@
42
+/*
43
+ * ASPEED Real Time Clock
44
+ * Joel Stanley <joel@jms.id.au>
45
+ *
46
+ * Copyright 2019 IBM Corp
47
+ * SPDX-License-Identifier: GPL-2.0-or-later
48
+ */
49
+#ifndef ASPEED_RTC_H
50
+#define ASPEED_RTC_H
51
+
52
+#include <stdint.h>
53
+
54
+#include "hw/hw.h"
55
+#include "hw/irq.h"
56
+#include "hw/sysbus.h"
57
+
58
+typedef struct AspeedRtcState {
59
+ SysBusDevice parent_obj;
60
+
61
+ MemoryRegion iomem;
62
+ qemu_irq irq;
63
+
64
+ uint32_t reg[0x18];
65
+ int offset;
66
+
67
+} AspeedRtcState;
68
+
69
+#define TYPE_ASPEED_RTC "aspeed.rtc"
70
+#define ASPEED_RTC(obj) OBJECT_CHECK(AspeedRtcState, (obj), TYPE_ASPEED_RTC)
71
+
72
+#endif /* ASPEED_RTC_H */
73
diff --git a/hw/timer/aspeed_rtc.c b/hw/timer/aspeed_rtc.c
74
new file mode 100644
75
index XXXXXXX..XXXXXXX
76
--- /dev/null
77
+++ b/hw/timer/aspeed_rtc.c
78
@@ -XXX,XX +XXX,XX @@
79
+/*
80
+ * ASPEED Real Time Clock
81
+ * Joel Stanley <joel@jms.id.au>
82
+ *
83
+ * Copyright 2019 IBM Corp
84
+ * SPDX-License-Identifier: GPL-2.0-or-later
85
+ */
86
+
87
+#include "qemu/osdep.h"
88
+#include "qemu-common.h"
89
+#include "hw/timer/aspeed_rtc.h"
90
+#include "qemu/log.h"
91
+#include "qemu/timer.h"
92
+
93
+#include "trace.h"
94
+
95
+#define COUNTER1 (0x00 / 4)
96
+#define COUNTER2 (0x04 / 4)
97
+#define ALARM (0x08 / 4)
98
+#define CONTROL (0x10 / 4)
99
+#define ALARM_STATUS (0x14 / 4)
100
+
101
+#define RTC_UNLOCKED BIT(1)
102
+#define RTC_ENABLED BIT(0)
103
+
104
+static void aspeed_rtc_calc_offset(AspeedRtcState *rtc)
105
+{
106
+ struct tm tm;
107
+ uint32_t year, cent;
108
+ uint32_t reg1 = rtc->reg[COUNTER1];
109
+ uint32_t reg2 = rtc->reg[COUNTER2];
110
+
111
+ tm.tm_mday = (reg1 >> 24) & 0x1f;
112
+ tm.tm_hour = (reg1 >> 16) & 0x1f;
113
+ tm.tm_min = (reg1 >> 8) & 0x3f;
114
+ tm.tm_sec = (reg1 >> 0) & 0x3f;
115
+
116
+ cent = (reg2 >> 16) & 0x1f;
117
+ year = (reg2 >> 8) & 0x7f;
118
+ tm.tm_mon = ((reg2 >> 0) & 0x0f) - 1;
119
+ tm.tm_year = year + (cent * 100) - 1900;
120
+
121
+ rtc->offset = qemu_timedate_diff(&tm);
122
+}
123
+
124
+static uint32_t aspeed_rtc_get_counter(AspeedRtcState *rtc, int r)
125
+{
126
+ uint32_t year, cent;
127
+ struct tm now;
128
+
129
+ qemu_get_timedate(&now, rtc->offset);
130
+
131
+ switch (r) {
132
+ case COUNTER1:
133
+ return (now.tm_mday << 24) | (now.tm_hour << 16) |
134
+ (now.tm_min << 8) | now.tm_sec;
135
+ case COUNTER2:
136
+ cent = (now.tm_year + 1900) / 100;
137
+ year = now.tm_year % 100;
138
+ return ((cent & 0x1f) << 16) | ((year & 0x7f) << 8) |
139
+ ((now.tm_mon + 1) & 0xf);
140
+ default:
141
+ g_assert_not_reached();
142
+ }
143
+}
144
+
145
+static uint64_t aspeed_rtc_read(void *opaque, hwaddr addr,
146
+ unsigned size)
147
+{
148
+ AspeedRtcState *rtc = opaque;
149
+ uint64_t val;
150
+ uint32_t r = addr >> 2;
151
+
152
+ switch (r) {
153
+ case COUNTER1:
154
+ case COUNTER2:
155
+ if (rtc->reg[CONTROL] & RTC_ENABLED) {
156
+ rtc->reg[r] = aspeed_rtc_get_counter(rtc, r);
157
+ }
158
+ /* fall through */
159
+ case CONTROL:
160
+ val = rtc->reg[r];
161
+ break;
162
+ case ALARM:
163
+ case ALARM_STATUS:
164
+ default:
165
+ qemu_log_mask(LOG_UNIMP, "%s: 0x%" HWADDR_PRIx "\n", __func__, addr);
166
+ return 0;
167
+ }
168
+
169
+ trace_aspeed_rtc_read(addr, val);
170
+
171
+ return val;
172
+}
173
+
174
+static void aspeed_rtc_write(void *opaque, hwaddr addr,
175
+ uint64_t val, unsigned size)
176
+{
177
+ AspeedRtcState *rtc = opaque;
178
+ uint32_t r = addr >> 2;
179
+
180
+ switch (r) {
181
+ case COUNTER1:
182
+ case COUNTER2:
183
+ if (!(rtc->reg[CONTROL] & RTC_UNLOCKED)) {
184
+ break;
185
+ }
186
+ /* fall through */
187
+ case CONTROL:
188
+ rtc->reg[r] = val;
189
+ aspeed_rtc_calc_offset(rtc);
190
+ break;
191
+ case ALARM:
192
+ case ALARM_STATUS:
193
+ default:
194
+ qemu_log_mask(LOG_UNIMP, "%s: 0x%" HWADDR_PRIx "\n", __func__, addr);
195
+ break;
196
+ }
197
+ trace_aspeed_rtc_write(addr, val);
198
+}
199
+
200
+static void aspeed_rtc_reset(DeviceState *d)
201
+{
202
+ AspeedRtcState *rtc = ASPEED_RTC(d);
203
+
204
+ rtc->offset = 0;
205
+ memset(rtc->reg, 0, sizeof(rtc->reg));
206
+}
207
+
208
+static const MemoryRegionOps aspeed_rtc_ops = {
209
+ .read = aspeed_rtc_read,
210
+ .write = aspeed_rtc_write,
211
+ .endianness = DEVICE_NATIVE_ENDIAN,
212
+};
213
+
214
+static const VMStateDescription vmstate_aspeed_rtc = {
215
+ .name = TYPE_ASPEED_RTC,
216
+ .version_id = 1,
217
+ .fields = (VMStateField[]) {
218
+ VMSTATE_UINT32_ARRAY(reg, AspeedRtcState, 0x18),
219
+ VMSTATE_INT32(offset, AspeedRtcState),
220
+ VMSTATE_INT32(offset, AspeedRtcState),
221
+ VMSTATE_END_OF_LIST()
222
+ }
223
+};
224
+
225
+static void aspeed_rtc_realize(DeviceState *dev, Error **errp)
226
+{
227
+ SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
228
+ AspeedRtcState *s = ASPEED_RTC(dev);
229
+
230
+ sysbus_init_irq(sbd, &s->irq);
231
+
232
+ memory_region_init_io(&s->iomem, OBJECT(s), &aspeed_rtc_ops, s,
233
+ "aspeed-rtc", 0x18ULL);
234
+ sysbus_init_mmio(sbd, &s->iomem);
235
+}
236
+
237
+static void aspeed_rtc_class_init(ObjectClass *klass, void *data)
238
+{
239
+ DeviceClass *dc = DEVICE_CLASS(klass);
240
+
241
+ dc->realize = aspeed_rtc_realize;
242
+ dc->vmsd = &vmstate_aspeed_rtc;
243
+ dc->reset = aspeed_rtc_reset;
244
+}
245
+
246
+static const TypeInfo aspeed_rtc_info = {
247
+ .name = TYPE_ASPEED_RTC,
248
+ .parent = TYPE_SYS_BUS_DEVICE,
249
+ .instance_size = sizeof(AspeedRtcState),
250
+ .class_init = aspeed_rtc_class_init,
251
+};
252
+
253
+static void aspeed_rtc_register_types(void)
254
+{
255
+ type_register_static(&aspeed_rtc_info);
256
+}
257
+
258
+type_init(aspeed_rtc_register_types)
259
diff --git a/hw/timer/trace-events b/hw/timer/trace-events
260
index XXXXXXX..XXXXXXX 100644
261
--- a/hw/timer/trace-events
262
+++ b/hw/timer/trace-events
263
@@ -XXX,XX +XXX,XX @@ cmsdk_apb_dualtimer_read(uint64_t offset, uint64_t data, unsigned size) "CMSDK A
264
cmsdk_apb_dualtimer_write(uint64_t offset, uint64_t data, unsigned size) "CMSDK APB dualtimer write: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u"
265
cmsdk_apb_dualtimer_reset(void) "CMSDK APB dualtimer: reset"
266
267
+# hw/timer/aspeed-rtc.c
268
+aspeed_rtc_read(uint64_t addr, uint64_t value) "addr 0x%02" PRIx64 " value 0x%08" PRIx64
269
+aspeed_rtc_write(uint64_t addr, uint64_t value) "addr 0x%02" PRIx64 " value 0x%08" PRIx64
270
+
271
# sun4v-rtc.c
272
sun4v_rtc_read(uint64_t addr, uint64_t value) "read: addr 0x%" PRIx64 " value 0x%" PRIx64
273
sun4v_rtc_write(uint64_t addr, uint64_t value) "write: addr 0x%" PRIx64 " value 0x%" PRIx64
274
--
275
2.20.1
276
277
diff view generated by jsdifflib
Deleted patch
1
From: Joel Stanley <joel@jms.id.au>
2
1
3
All systems have an RTC.
4
5
The IRQ is hooked up but the model does not use it at this stage. There
6
is no guest code that uses it, so this limitation is acceptable.
7
8
Signed-off-by: Joel Stanley <joel@jms.id.au>
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Message-id: 20190618165311.27066-5-clg@kaod.org
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
13
include/hw/arm/aspeed_soc.h | 2 ++
14
hw/arm/aspeed_soc.c | 13 +++++++++++++
15
2 files changed, 15 insertions(+)
16
17
diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h
18
index XXXXXXX..XXXXXXX 100644
19
--- a/include/hw/arm/aspeed_soc.h
20
+++ b/include/hw/arm/aspeed_soc.h
21
@@ -XXX,XX +XXX,XX @@
22
#include "hw/misc/aspeed_scu.h"
23
#include "hw/misc/aspeed_sdmc.h"
24
#include "hw/timer/aspeed_timer.h"
25
+#include "hw/timer/aspeed_rtc.h"
26
#include "hw/i2c/aspeed_i2c.h"
27
#include "hw/ssi/aspeed_smc.h"
28
#include "hw/watchdog/wdt_aspeed.h"
29
@@ -XXX,XX +XXX,XX @@ typedef struct AspeedSoCState {
30
ARMCPU cpu;
31
MemoryRegion sram;
32
AspeedVICState vic;
33
+ AspeedRtcState rtc;
34
AspeedTimerCtrlState timerctrl;
35
AspeedI2CState i2c;
36
AspeedSCUState scu;
37
diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c
38
index XXXXXXX..XXXXXXX 100644
39
--- a/hw/arm/aspeed_soc.c
40
+++ b/hw/arm/aspeed_soc.c
41
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_init(Object *obj)
42
sysbus_init_child_obj(obj, "vic", OBJECT(&s->vic), sizeof(s->vic),
43
TYPE_ASPEED_VIC);
44
45
+ sysbus_init_child_obj(obj, "rtc", OBJECT(&s->rtc), sizeof(s->rtc),
46
+ TYPE_ASPEED_RTC);
47
+
48
sysbus_init_child_obj(obj, "timerctrl", OBJECT(&s->timerctrl),
49
sizeof(s->timerctrl), TYPE_ASPEED_TIMER);
50
object_property_add_const_link(OBJECT(&s->timerctrl), "scu",
51
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
52
sysbus_connect_irq(SYS_BUS_DEVICE(&s->vic), 1,
53
qdev_get_gpio_in(DEVICE(&s->cpu), ARM_CPU_FIQ));
54
55
+ /* RTC */
56
+ object_property_set_bool(OBJECT(&s->rtc), true, "realized", &err);
57
+ if (err) {
58
+ error_propagate(errp, err);
59
+ return;
60
+ }
61
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->rtc), 0, sc->info->memmap[ASPEED_RTC]);
62
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->rtc), 0,
63
+ aspeed_soc_get_irq(s, ASPEED_RTC));
64
+
65
/* Timer */
66
object_property_set_bool(OBJECT(&s->timerctrl), true, "realized", &err);
67
if (err) {
68
--
69
2.20.1
70
71
diff view generated by jsdifflib
1
From: Cédric Le Goater <clg@kaod.org>
1
From: Stephen Longfield <slongfield@google.com>
2
2
3
The Aspeed SoCs have two MACs. Extend the Aspeed model to support a
3
Size is used at lines 1088/1188 for the loop, which reads the last 4
4
second NIC.
4
bytes from the crc_ptr so it does need to get increased, however it
5
shouldn't be increased before the buffer is passed to CRC computation,
6
or the crc32 function will access uninitialized memory.
5
7
6
Signed-off-by: Cédric Le Goater <clg@kaod.org>
8
This was pointed out to me by clg@kaod.org during the code review of
7
Reviewed-by: Joel Stanley <joel@jms.id.au>
9
a similar patch to hw/net/ftgmac100.c
8
Message-id: 20190618165311.27066-7-clg@kaod.org
10
11
Change-Id: Ib0464303b191af1e28abeb2f5105eb25aadb5e9b
12
Signed-off-by: Stephen Longfield <slongfield@google.com>
13
Reviewed-by: Patrick Venture <venture@google.com>
14
Message-id: 20221221183202.3788132-1-slongfield@google.com
15
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
17
---
11
include/hw/arm/aspeed_soc.h | 3 ++-
18
hw/net/imx_fec.c | 8 ++++----
12
hw/arm/aspeed_soc.c | 33 +++++++++++++++++++--------------
19
1 file changed, 4 insertions(+), 4 deletions(-)
13
2 files changed, 21 insertions(+), 15 deletions(-)
14
20
15
diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h
21
diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c
16
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
17
--- a/include/hw/arm/aspeed_soc.h
23
--- a/hw/net/imx_fec.c
18
+++ b/include/hw/arm/aspeed_soc.h
24
+++ b/hw/net/imx_fec.c
19
@@ -XXX,XX +XXX,XX @@
25
@@ -XXX,XX +XXX,XX @@ static ssize_t imx_fec_receive(NetClientState *nc, const uint8_t *buf,
20
#define ASPEED_SPIS_NUM 2
26
return 0;
21
#define ASPEED_WDTS_NUM 3
22
#define ASPEED_CPUS_NUM 2
23
+#define ASPEED_MACS_NUM 2
24
25
typedef struct AspeedSoCState {
26
/*< private >*/
27
@@ -XXX,XX +XXX,XX @@ typedef struct AspeedSoCState {
28
AspeedSMCState spi[ASPEED_SPIS_NUM];
29
AspeedSDMCState sdmc;
30
AspeedWDTState wdt[ASPEED_WDTS_NUM];
31
- FTGMAC100State ftgmac100;
32
+ FTGMAC100State ftgmac100[ASPEED_MACS_NUM];
33
} AspeedSoCState;
34
35
#define TYPE_ASPEED_SOC "aspeed-soc"
36
diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c
37
index XXXXXXX..XXXXXXX 100644
38
--- a/hw/arm/aspeed_soc.c
39
+++ b/hw/arm/aspeed_soc.c
40
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_init(Object *obj)
41
sc->info->silicon_rev);
42
}
27
}
43
28
44
- sysbus_init_child_obj(obj, "ftgmac100", OBJECT(&s->ftgmac100),
29
- /* 4 bytes for the CRC. */
45
- sizeof(s->ftgmac100), TYPE_FTGMAC100);
30
- size += 4;
46
+ for (i = 0; i < ASPEED_MACS_NUM; i++) {
31
crc = cpu_to_be32(crc32(~0, buf, size));
47
+ sysbus_init_child_obj(obj, "ftgmac100[*]", OBJECT(&s->ftgmac100[i]),
32
+ /* Increase size by 4, loop below reads the last 4 bytes from crc_ptr. */
48
+ sizeof(s->ftgmac100[i]), TYPE_FTGMAC100);
33
+ size += 4;
49
+ }
34
crc_ptr = (uint8_t *) &crc;
50
}
35
51
36
/* Huge frames are truncated. */
52
static void aspeed_soc_realize(DeviceState *dev, Error **errp)
37
@@ -XXX,XX +XXX,XX @@ static ssize_t imx_enet_receive(NetClientState *nc, const uint8_t *buf,
53
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
38
return 0;
54
}
39
}
55
40
56
/* Net */
41
- /* 4 bytes for the CRC. */
57
- qdev_set_nic_properties(DEVICE(&s->ftgmac100), &nd_table[0]);
42
- size += 4;
58
- object_property_set_bool(OBJECT(&s->ftgmac100), true, "aspeed", &err);
43
crc = cpu_to_be32(crc32(~0, buf, size));
59
- object_property_set_bool(OBJECT(&s->ftgmac100), true, "realized",
44
+ /* Increase size by 4, loop below reads the last 4 bytes from crc_ptr. */
60
- &local_err);
45
+ size += 4;
61
- error_propagate(&err, local_err);
46
crc_ptr = (uint8_t *) &crc;
62
- if (err) {
47
63
- error_propagate(errp, err);
48
if (shift16) {
64
- return;
65
+ for (i = 0; i < nb_nics; i++) {
66
+ qdev_set_nic_properties(DEVICE(&s->ftgmac100[i]), &nd_table[i]);
67
+ object_property_set_bool(OBJECT(&s->ftgmac100[i]), true, "aspeed",
68
+ &err);
69
+ object_property_set_bool(OBJECT(&s->ftgmac100[i]), true, "realized",
70
+ &local_err);
71
+ error_propagate(&err, local_err);
72
+ if (err) {
73
+ error_propagate(errp, err);
74
+ return;
75
+ }
76
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->ftgmac100[i]), 0,
77
+ sc->info->memmap[ASPEED_ETH1 + i]);
78
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->ftgmac100[i]), 0,
79
+ aspeed_soc_get_irq(s, ASPEED_ETH1 + i));
80
}
81
- sysbus_mmio_map(SYS_BUS_DEVICE(&s->ftgmac100), 0,
82
- sc->info->memmap[ASPEED_ETH1]);
83
- sysbus_connect_irq(SYS_BUS_DEVICE(&s->ftgmac100), 0,
84
- aspeed_soc_get_irq(s, ASPEED_ETH1));
85
}
86
static Property aspeed_soc_properties[] = {
87
DEFINE_PROP_UINT32("num-cpus", AspeedSoCState, num_cpus, 0),
88
--
49
--
89
2.20.1
50
2.25.1
90
91
diff view generated by jsdifflib
Deleted patch
1
From: Andrew Jeffery <andrew@aj.id.au>
2
1
3
From the datasheet:
4
5
This register stores the current status of counter #N. When timer
6
enable bit TMC30[N * b] is disabled, the reload register will be
7
loaded into this counter. When timer bit TMC30[N * b] is set, the
8
counter will start to decrement. CPU can update this register value
9
when enable bit is set.
10
11
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
12
Signed-off-by: Cédric Le Goater <clg@kaod.org>
13
Reviewed-by: Joel Stanley <joel@jms.id.au>
14
Message-id: 20190618165311.27066-9-clg@kaod.org
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
---
17
hw/timer/aspeed_timer.c | 6 +++++-
18
1 file changed, 5 insertions(+), 1 deletion(-)
19
20
diff --git a/hw/timer/aspeed_timer.c b/hw/timer/aspeed_timer.c
21
index XXXXXXX..XXXXXXX 100644
22
--- a/hw/timer/aspeed_timer.c
23
+++ b/hw/timer/aspeed_timer.c
24
@@ -XXX,XX +XXX,XX @@ static uint64_t aspeed_timer_get_value(AspeedTimer *t, int reg)
25
26
switch (reg) {
27
case TIMER_REG_STATUS:
28
- value = calculate_ticks(t, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL));
29
+ if (timer_enabled(t)) {
30
+ value = calculate_ticks(t, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL));
31
+ } else {
32
+ value = t->reload;
33
+ }
34
break;
35
case TIMER_REG_RELOAD:
36
value = t->reload;
37
--
38
2.20.1
39
40
diff view generated by jsdifflib
Deleted patch
1
From: Christian Svensson <bluecmd@google.com>
2
1
3
If the host decrements the counter register that results in a negative
4
delta. This is then passed to muldiv64 which only handles unsigned
5
numbers resulting in bogus results.
6
7
This fix ensures the delta being operated on is positive.
8
9
Test case: kexec a kernel using aspeed_timer and it will freeze on the
10
second bootup when the kernel initializes the timer. With this patch
11
that no longer happens and the timer appears to run OK.
12
13
Signed-off-by: Christian Svensson <bluecmd@google.com>
14
Signed-off-by: Cédric Le Goater <clg@kaod.org>
15
Reviewed-by: Joel Stanley <joel@jms.id.au>
16
Reviewed-by: Andrew Jeffery <andrew@aj.id.au>
17
Message-id: 20190618165311.27066-12-clg@kaod.org
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
---
20
hw/timer/aspeed_timer.c | 6 +++++-
21
1 file changed, 5 insertions(+), 1 deletion(-)
22
23
diff --git a/hw/timer/aspeed_timer.c b/hw/timer/aspeed_timer.c
24
index XXXXXXX..XXXXXXX 100644
25
--- a/hw/timer/aspeed_timer.c
26
+++ b/hw/timer/aspeed_timer.c
27
@@ -XXX,XX +XXX,XX @@ static void aspeed_timer_set_value(AspeedTimerCtrlState *s, int timer, int reg,
28
int64_t delta = (int64_t) value - (int64_t) calculate_ticks(t, now);
29
uint32_t rate = calculate_rate(t);
30
31
- t->start += muldiv64(delta, NANOSECONDS_PER_SECOND, rate);
32
+ if (delta >= 0) {
33
+ t->start += muldiv64(delta, NANOSECONDS_PER_SECOND, rate);
34
+ } else {
35
+ t->start -= muldiv64(-delta, NANOSECONDS_PER_SECOND, rate);
36
+ }
37
aspeed_timer_mod(t);
38
}
39
break;
40
--
41
2.20.1
42
43
diff view generated by jsdifflib
Deleted patch
1
From: Cédric Le Goater <clg@kaod.org>
2
1
3
It has never been used as far as I can tell from the git history.
4
5
Signed-off-by: Cédric Le Goater <clg@kaod.org>
6
Reviewed-by: Joel Stanley <joel@jms.id.au>
7
Message-id: 20190618165311.27066-13-clg@kaod.org
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
10
hw/arm/aspeed.c | 2 --
11
1 file changed, 2 deletions(-)
12
13
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
14
index XXXXXXX..XXXXXXX 100644
15
--- a/hw/arm/aspeed.c
16
+++ b/hw/arm/aspeed.c
17
@@ -XXX,XX +XXX,XX @@ static void aspeed_board_init(MachineState *machine,
18
memory_region_allocate_system_memory(&bmc->ram, NULL, "ram", ram_size);
19
memory_region_add_subregion(get_system_memory(),
20
sc->info->memmap[ASPEED_SDRAM], &bmc->ram);
21
- object_property_add_const_link(OBJECT(&bmc->soc), "ram", OBJECT(&bmc->ram),
22
- &error_abort);
23
24
max_ram_size = object_property_get_uint(OBJECT(&bmc->soc), "max-ram-size",
25
&error_abort);
26
--
27
2.20.1
28
29
diff view generated by jsdifflib
Deleted patch
1
From: Cédric Le Goater <clg@kaod.org>
2
1
3
The RAM memory region is defined after the SoC is realized when the
4
SDMC controller has checked that the defined RAM size for the machine
5
is correct. This is problematic for controller models requiring a link
6
on the RAM region, for DMA support in the SMC controller for instance.
7
8
Introduce a container memory region for the RAM that we can link into
9
the controllers early, before the SoC is realized. It will be
10
populated with the RAM region after the checks have be done.
11
12
Signed-off-by: Cédric Le Goater <clg@kaod.org>
13
Reviewed-by: Joel Stanley <joel@jms.id.au>
14
Message-id: 20190618165311.27066-14-clg@kaod.org
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
---
17
hw/arm/aspeed.c | 13 +++++++++----
18
1 file changed, 9 insertions(+), 4 deletions(-)
19
20
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
21
index XXXXXXX..XXXXXXX 100644
22
--- a/hw/arm/aspeed.c
23
+++ b/hw/arm/aspeed.c
24
@@ -XXX,XX +XXX,XX @@ static struct arm_boot_info aspeed_board_binfo = {
25
26
struct AspeedBoardState {
27
AspeedSoCState soc;
28
+ MemoryRegion ram_container;
29
MemoryRegion ram;
30
MemoryRegion max_ram;
31
};
32
@@ -XXX,XX +XXX,XX @@ static void aspeed_board_init(MachineState *machine,
33
ram_addr_t max_ram_size;
34
35
bmc = g_new0(AspeedBoardState, 1);
36
+
37
+ memory_region_init(&bmc->ram_container, NULL, "aspeed-ram-container",
38
+ UINT32_MAX);
39
+
40
object_initialize_child(OBJECT(machine), "soc", &bmc->soc,
41
(sizeof(bmc->soc)), cfg->soc_name, &error_abort,
42
NULL);
43
@@ -XXX,XX +XXX,XX @@ static void aspeed_board_init(MachineState *machine,
44
&error_abort);
45
46
memory_region_allocate_system_memory(&bmc->ram, NULL, "ram", ram_size);
47
+ memory_region_add_subregion(&bmc->ram_container, 0, &bmc->ram);
48
memory_region_add_subregion(get_system_memory(),
49
- sc->info->memmap[ASPEED_SDRAM], &bmc->ram);
50
+ sc->info->memmap[ASPEED_SDRAM],
51
+ &bmc->ram_container);
52
53
max_ram_size = object_property_get_uint(OBJECT(&bmc->soc), "max-ram-size",
54
&error_abort);
55
memory_region_init_io(&bmc->max_ram, NULL, &max_ram_ops, NULL,
56
"max_ram", max_ram_size - ram_size);
57
- memory_region_add_subregion(get_system_memory(),
58
- sc->info->memmap[ASPEED_SDRAM] + ram_size,
59
- &bmc->max_ram);
60
+ memory_region_add_subregion(&bmc->ram_container, ram_size, &bmc->max_ram);
61
62
aspeed_board_init_flashes(&bmc->soc.fmc, cfg->fmc_model, &error_abort);
63
aspeed_board_init_flashes(&bmc->soc.spi[0], cfg->spi_model, &error_abort);
64
--
65
2.20.1
66
67
diff view generated by jsdifflib
Deleted patch
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
2
1
3
Group Aarch64 rules together, TCG related ones at the bottom.
4
This will help when restricting TCG-only objects.
5
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
8
Message-id: 20190701132516.26392-2-philmd@redhat.com
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
target/arm/Makefile.objs | 5 +++--
12
1 file changed, 3 insertions(+), 2 deletions(-)
13
14
diff --git a/target/arm/Makefile.objs b/target/arm/Makefile.objs
15
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/Makefile.objs
17
+++ b/target/arm/Makefile.objs
18
@@ -XXX,XX +XXX,XX @@ obj-$(call lnot,$(CONFIG_KVM)) += kvm-stub.o
19
obj-y += translate.o op_helper.o helper.o cpu.o
20
obj-y += neon_helper.o iwmmxt_helper.o vec_helper.o vfp_helper.o
21
obj-y += gdbstub.o
22
-obj-$(TARGET_AARCH64) += cpu64.o translate-a64.o helper-a64.o gdbstub64.o
23
-obj-$(TARGET_AARCH64) += pauth_helper.o
24
+obj-$(TARGET_AARCH64) += cpu64.o gdbstub64.o
25
obj-y += crypto_helper.o
26
obj-$(CONFIG_SOFTMMU) += arm-powerctl.o
27
28
@@ -XXX,XX +XXX,XX @@ target/arm/translate-sve.o: target/arm/decode-sve.inc.c
29
target/arm/translate.o: target/arm/decode-vfp.inc.c
30
target/arm/translate.o: target/arm/decode-vfp-uncond.inc.c
31
32
+obj-$(TARGET_AARCH64) += translate-a64.o helper-a64.o
33
obj-$(TARGET_AARCH64) += translate-sve.o sve_helper.o
34
+obj-$(TARGET_AARCH64) += pauth_helper.o
35
--
36
2.20.1
37
38
diff view generated by jsdifflib
Deleted patch
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
2
1
3
Group ARM objects together, TCG related ones at the bottom.
4
This will help when restricting TCG-only objects.
5
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
8
Message-id: 20190701132516.26392-3-philmd@redhat.com
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
target/arm/Makefile.objs | 10 ++++++----
12
1 file changed, 6 insertions(+), 4 deletions(-)
13
14
diff --git a/target/arm/Makefile.objs b/target/arm/Makefile.objs
15
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/Makefile.objs
17
+++ b/target/arm/Makefile.objs
18
@@ -XXX,XX +XXX,XX @@ obj-$(CONFIG_KVM) += kvm.o
19
obj-$(call land,$(CONFIG_KVM),$(call lnot,$(TARGET_AARCH64))) += kvm32.o
20
obj-$(call land,$(CONFIG_KVM),$(TARGET_AARCH64)) += kvm64.o
21
obj-$(call lnot,$(CONFIG_KVM)) += kvm-stub.o
22
-obj-y += translate.o op_helper.o helper.o cpu.o
23
-obj-y += neon_helper.o iwmmxt_helper.o vec_helper.o vfp_helper.o
24
-obj-y += gdbstub.o
25
+obj-y += helper.o vfp_helper.o
26
+obj-y += cpu.o gdbstub.o
27
obj-$(TARGET_AARCH64) += cpu64.o gdbstub64.o
28
-obj-y += crypto_helper.o
29
obj-$(CONFIG_SOFTMMU) += arm-powerctl.o
30
31
DECODETREE = $(SRC_PATH)/scripts/decodetree.py
32
@@ -XXX,XX +XXX,XX @@ target/arm/translate-sve.o: target/arm/decode-sve.inc.c
33
target/arm/translate.o: target/arm/decode-vfp.inc.c
34
target/arm/translate.o: target/arm/decode-vfp-uncond.inc.c
35
36
+obj-y += translate.o op_helper.o
37
+obj-y += crypto_helper.o
38
+obj-y += iwmmxt_helper.o vec_helper.o neon_helper.o
39
+
40
obj-$(TARGET_AARCH64) += translate-a64.o helper-a64.o
41
obj-$(TARGET_AARCH64) += translate-sve.o sve_helper.o
42
obj-$(TARGET_AARCH64) += pauth_helper.o
43
--
44
2.20.1
45
46
diff view generated by jsdifflib
Deleted patch
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
2
1
3
Group KVM rules together.
4
5
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
6
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
7
Message-id: 20190701132516.26392-4-philmd@redhat.com
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
10
target/arm/Makefile.objs | 9 +++++----
11
1 file changed, 5 insertions(+), 4 deletions(-)
12
13
diff --git a/target/arm/Makefile.objs b/target/arm/Makefile.objs
14
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/Makefile.objs
16
+++ b/target/arm/Makefile.objs
17
@@ -XXX,XX +XXX,XX @@
18
obj-y += arm-semi.o
19
obj-$(CONFIG_SOFTMMU) += machine.o psci.o arch_dump.o monitor.o
20
-obj-$(CONFIG_KVM) += kvm.o
21
-obj-$(call land,$(CONFIG_KVM),$(call lnot,$(TARGET_AARCH64))) += kvm32.o
22
-obj-$(call land,$(CONFIG_KVM),$(TARGET_AARCH64)) += kvm64.o
23
-obj-$(call lnot,$(CONFIG_KVM)) += kvm-stub.o
24
obj-y += helper.o vfp_helper.o
25
obj-y += cpu.o gdbstub.o
26
obj-$(TARGET_AARCH64) += cpu64.o gdbstub64.o
27
obj-$(CONFIG_SOFTMMU) += arm-powerctl.o
28
29
+obj-$(CONFIG_KVM) += kvm.o
30
+obj-$(call land,$(CONFIG_KVM),$(call lnot,$(TARGET_AARCH64))) += kvm32.o
31
+obj-$(call land,$(CONFIG_KVM),$(TARGET_AARCH64)) += kvm64.o
32
+obj-$(call lnot,$(CONFIG_KVM)) += kvm-stub.o
33
+
34
DECODETREE = $(SRC_PATH)/scripts/decodetree.py
35
36
target/arm/decode-sve.inc.c: $(SRC_PATH)/target/arm/sve.decode $(DECODETREE)
37
--
38
2.20.1
39
40
diff view generated by jsdifflib